wpa_supplicant: Allow user to disable short guard interval (SGI)
authorBen Greear <greearb@candelatech.com>
Tue, 18 Dec 2012 12:44:15 +0000 (14:44 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 18 Dec 2012 12:45:09 +0000 (14:45 +0200)
Requires Linux kernel patch to make the SGI-20 properly disabled. SGI-40
will already work since Linux 3.4 or so.

Signed-hostap: Ben Greear <greearb@candelatech.com>
Signed-off-by: Ben Greear <greearb@candelatech.com>
wpa_supplicant/config.c
wpa_supplicant/config_ssid.h
wpa_supplicant/wpa_supplicant.c

index 0b6fbb0..0fab07a 100644 (file)
@@ -1637,6 +1637,7 @@ static const struct parse_data ssid_fields[] = {
 #ifdef CONFIG_HT_OVERRIDES
        { INT_RANGE(disable_ht, 0, 1) },
        { INT_RANGE(disable_ht40, -1, 1) },
+       { INT_RANGE(disable_sgi, 0, 1) },
        { INT_RANGE(disable_max_amsdu, -1, 1) },
        { INT_RANGE(ampdu_factor, -1, 3) },
        { INT_RANGE(ampdu_density, -1, 7) },
@@ -2038,6 +2039,7 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid)
 #ifdef CONFIG_HT_OVERRIDES
        ssid->disable_ht = DEFAULT_DISABLE_HT;
        ssid->disable_ht40 = DEFAULT_DISABLE_HT40;
+       ssid->disable_sgi = DEFAULT_DISABLE_SGI;
        ssid->disable_max_amsdu = DEFAULT_DISABLE_MAX_AMSDU;
        ssid->ampdu_factor = DEFAULT_AMPDU_FACTOR;
        ssid->ampdu_density = DEFAULT_AMPDU_DENSITY;
index a9a477a..9ac67c7 100644 (file)
@@ -28,6 +28,7 @@
 #define DEFAULT_BG_SCAN_PERIOD -1
 #define DEFAULT_DISABLE_HT 0
 #define DEFAULT_DISABLE_HT40 0
+#define DEFAULT_DISABLE_SGI 0
 #define DEFAULT_DISABLE_MAX_AMSDU -1 /* no change */
 #define DEFAULT_AMPDU_FACTOR -1 /* no change */
 #define DEFAULT_AMPDU_DENSITY -1 /* no change */
@@ -495,6 +496,14 @@ struct wpa_ssid {
        int disable_ht40;
 
        /**
+        * disable_sgi - Disable SGI (Short Guard Interval) for this network
+        *
+        * By default, use it if it is available, but this can be configured
+        * to 1 to have it disabled.
+        */
+       int disable_sgi;
+
+       /**
         * disable_max_amsdu - Disable MAX A-MSDU
         *
         * A-MDSU will be 3839 bytes when disabled, or 7935
index 9d80555..020f0bd 100644 (file)
@@ -2579,6 +2579,28 @@ static int wpa_set_disable_ht40(struct wpa_supplicant *wpa_s,
 }
 
 
+static int wpa_set_disable_sgi(struct wpa_supplicant *wpa_s,
+                              struct ieee80211_ht_capabilities *htcaps,
+                              struct ieee80211_ht_capabilities *htcaps_mask,
+                              int disabled)
+{
+       /* Masking these out disables SGI */
+       u16 msk = host_to_le16(HT_CAP_INFO_SHORT_GI20MHZ |
+                              HT_CAP_INFO_SHORT_GI40MHZ);
+
+       wpa_msg(wpa_s, MSG_DEBUG, "set_disable_sgi: %d", disabled);
+
+       if (disabled)
+               htcaps->ht_capabilities_info &= ~msk;
+       else
+               htcaps->ht_capabilities_info |= msk;
+
+       htcaps_mask->ht_capabilities_info |= msk;
+
+       return 0;
+}
+
+
 void wpa_supplicant_apply_ht_overrides(
        struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
        struct wpa_driver_associate_params *params)
@@ -2601,6 +2623,7 @@ void wpa_supplicant_apply_ht_overrides(
        wpa_set_ampdu_factor(wpa_s, htcaps, htcaps_mask, ssid->ampdu_factor);
        wpa_set_ampdu_density(wpa_s, htcaps, htcaps_mask, ssid->ampdu_density);
        wpa_set_disable_ht40(wpa_s, htcaps, htcaps_mask, ssid->disable_ht40);
+       wpa_set_disable_sgi(wpa_s, htcaps, htcaps_mask, ssid->disable_sgi);
 }
 
 #endif /* CONFIG_HT_OVERRIDES */