Patchwork [v2] wpa_supplicant: add support for VHT selector

login
register
mail settings
Submitter Michal Kazior
Date July 11, 2013, 12:48 p.m.
Message ID <1373546917-13919-1-git-send-email-michal.kazior@tieto.com>
Download mbox | patch
Permalink /patch/258443/
State Accepted
Commit c8ebeda4060121f09461705d87d2f9c1399668d5
Headers show

Comments

Michal Kazior - July 11, 2013, 12:48 p.m.
This allows wpa_supplicant to associate to an AP
that has VHT selector set.

Without the patch it was impossible to connect to,
e.g. hostapd-based AP that has require_vht=1.
wpa_supplicant was complaining with:

  hardware does not support required rate 63.0 Mbps

Signed-hostap: Michal Kazior <michal.kazior@tieto.com>
---
v2: commit msg tweak, verify vht mcs set

 src/drivers/driver.h         |    1 +
 src/drivers/driver_nl80211.c |   13 ++++++++++++-
 wpa_supplicant/events.c      |   30 ++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
Jouni Malinen - July 20, 2013, 2:31 p.m.
On Thu, Jul 11, 2013 at 02:48:37PM +0200, Michal Kazior wrote:
> This allows wpa_supplicant to associate to an AP
> that has VHT selector set.
> 
> Without the patch it was impossible to connect to,
> e.g. hostapd-based AP that has require_vht=1.
> wpa_supplicant was complaining with:
> 
>   hardware does not support required rate 63.0 Mbps

Thanks, applied.

Patch

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 3b7e400..4b7bf80 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -61,6 +61,7 @@  struct hostapd_channel_data {
 };
 
 #define HOSTAPD_MODE_FLAG_HT_INFO_KNOWN BIT(0)
+#define HOSTAPD_MODE_FLAG_VHT_INFO_KNOWN BIT(1)
 
 /**
  * struct hostapd_hw_modes - Supported hardware mode information
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 0115533..4b1dc38 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5650,7 +5650,18 @@  static int phy_info_band(struct phy_info_arg *phy_info, struct nlattr *nl_band)
 		mode = &phy_info->modes[*(phy_info->num_modes)];
 		os_memset(mode, 0, sizeof(*mode));
 		mode->mode = NUM_HOSTAPD_MODES;
-		mode->flags = HOSTAPD_MODE_FLAG_HT_INFO_KNOWN;
+		mode->flags = HOSTAPD_MODE_FLAG_HT_INFO_KNOWN
+			    | HOSTAPD_MODE_FLAG_VHT_INFO_KNOWN;
+
+		/* Unsupported VHT MCS stream is defined as value 3, so the VHT
+		 * MCS rx/tx map must be initialized with 0xffff to mark all 8
+		 * possible streams as unsupported. This will be overridden if
+		 * driver advertises VHT support. */
+		mode->vht_mcs_set[0] = 0xff;
+		mode->vht_mcs_set[1] = 0xff;
+		mode->vht_mcs_set[4] = 0xff;
+		mode->vht_mcs_set[5] = 0xff;
+
 		*(phy_info->num_modes) += 1;
 		phy_info->last_mode = nl_band->nla_type;
 		phy_info->last_chan_idx = 0;
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index f757c72..8d534bb 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -548,6 +548,24 @@  static int ht_supported(const struct hostapd_hw_modes *mode)
 }
 
 
+static int vht_supported(const struct hostapd_hw_modes *mode)
+{
+	if (!(mode->flags & HOSTAPD_MODE_FLAG_VHT_INFO_KNOWN)) {
+		/*
+		 * The driver did not indicate whether it supports VHT. Assume
+		 * it does to avoid connection issues.
+		 */
+		return 1;
+	}
+
+	/*
+	 * A VHT non-AP STA shall support MCS 0-7 for one spatial stream.
+	 * XXX: Verify if this complies with the spec
+	 */
+	return (mode->vht_mcs_set[0] & 0x3) != 3;
+}
+
+
 static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
 {
 	const struct hostapd_hw_modes *mode = NULL, *modes;
@@ -613,6 +631,18 @@  static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
 				continue;
 			}
 
+			/* There's also a VHT selector for 802.11ac */
+			if (flagged && ((rate_ie[j] & 0x7f) ==
+					BSS_MEMBERSHIP_SELECTOR_VHT_PHY)) {
+				if (!vht_supported(mode)) {
+					wpa_dbg(wpa_s, MSG_DEBUG,
+						"   hardware does not support "
+						"VHT PHY");
+					return 0;
+				}
+				continue;
+			}
+
 			if (!flagged)
 				continue;