]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
IBSS: Add support for VHT80 configuration
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>
Thu, 19 Feb 2015 06:15:48 +0000 (07:15 +0100)
committerJouni Malinen <j@w1.fi>
Sat, 21 Feb 2015 14:07:53 +0000 (16:07 +0200)
Configure VHT80 based on driver capabilities.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
src/drivers/driver.h
wpa_supplicant/wpa_supplicant.c

index 9daae88d736c8e423008c18e087326b8a580f616..467c9d2c0d2bf68e9f5380606a97f72627e2fca2 100644 (file)
@@ -1199,6 +1199,8 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH   0x0000000800000000ULL
 /** Driver supports IBSS with HT datarates */
 #define WPA_DRIVER_FLAGS_HT_IBSS               0x0000001000000000ULL
+/** Driver supports IBSS with VHT datarates */
+#define WPA_DRIVER_FLAGS_VHT_IBSS              0x0000002000000000ULL
        u64 flags;
 
 #define WPA_DRIVER_SMPS_MODE_STATIC                    0x00000001
index c1ec8a3fb0d13ced55011ec144c1dbbe7fad445e..29d1aaff40c1e74e5e457f5ba05e3ba4380756cd 100644 (file)
@@ -1669,10 +1669,12 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
        struct hostapd_hw_modes *mode = NULL;
        int ht40plus[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157,
                           184, 192 };
+       int vht80[] = { 36, 52, 100, 116, 132, 149 };
        struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
        u8 channel;
        int i, chan_idx, ht40 = -1, res, obss_scan = 1;
        unsigned int j;
+       struct hostapd_freq_params vht_freq;
 
        freq->freq = ssid->frequency;
 
@@ -1821,6 +1823,55 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s,
        wpa_printf(MSG_DEBUG,
                   "IBSS/mesh: setup freq channel %d, sec_channel_offset %d",
                   freq->channel, freq->sec_channel_offset);
+
+       /* Not sure if mesh is ready for VHT */
+       if (ssid->mode != WPAS_MODE_IBSS)
+               return;
+
+       /* For IBSS check VHT_IBSS flag */
+       if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_VHT_IBSS))
+               return;
+
+       vht_freq = *freq;
+
+       vht_freq.vht_enabled = vht_supported(mode);
+       if (!vht_freq.vht_enabled)
+               return;
+
+       /* setup center_freq1, bandwidth */
+       for (j = 0; j < ARRAY_SIZE(vht80); j++) {
+               if (freq->channel >= vht80[j] &&
+                   freq->channel < vht80[j] + 16)
+                       break;
+       }
+
+       if (j == ARRAY_SIZE(vht80))
+               return;
+
+       for (i = vht80[j]; i < vht80[j] + 16; i += 4) {
+               struct hostapd_channel_data *chan;
+
+               chan = hw_get_channel_chan(mode, i, NULL);
+               if (!chan)
+                       return;
+
+               /* Back to HT configuration if channel not usable */
+               if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_NO_IR))
+                       return;
+       }
+
+       if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq,
+                                   freq->channel, freq->ht_enabled,
+                                   vht_freq.vht_enabled,
+                                   freq->sec_channel_offset,
+                                   VHT_CHANWIDTH_80MHZ,
+                                   vht80[i] + 6, 0, 0) != 0)
+               return;
+
+       *freq = vht_freq;
+
+       wpa_printf(MSG_DEBUG, "IBSS: VHT setup freq cf1 %d, cf2 %d, bw %d",
+                  freq->center_freq1, freq->center_freq2, freq->bandwidth);
 }