[PATCH 4/4] ibss: add support for VHT80 configuration

Janusz Dziedzic janusz.dziedzic
Wed Feb 18 22:15:48 PST 2015


Configure VHT80 base on driver capabilities.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/drivers/driver.h            |  2 ++
 wpa_supplicant/wpa_supplicant.c | 56 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 6d0d6f3..c90c8f9 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1193,6 +1193,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
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 926e8c0..433ea1c 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1668,10 +1668,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;
 
@@ -1823,6 +1825,60 @@ 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 (i = 0; i < ARRAY_SIZE(vht80); i++) {
+		if (freq->channel >= vht80[i] &&
+		    freq->channel < vht80[i] + 16) {
+			break;
+		}
+	}
+
+	if (i == ARRAY_SIZE(vht80))
+		return;
+
+	for (j = vht80[i]; j < vht80[i] + 16; j+=4) {
+		struct hostapd_channel_data *chan;
+		chan = hw_get_channel_chan(mode, j, 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);
+
+	return;
 }
 
 
-- 
1.9.1




More information about the Hostap mailing list