Patchwork [v3] hostap: set ht_capab from wiphy when in P2P GO mode

login
register
mail settings
Submitter Arik Nemtsov
Date Nov. 25, 2011, 1:57 p.m.
Message ID <1322229448-30037-1-git-send-email-arik@wizery.com>
Download mbox | patch
Permalink /patch/127701/
State Accepted
Commit 79b8c60f811f2a5d65d2f44889b2ef4f82874f90
Headers show

Comments

Arik Nemtsov - Nov. 25, 2011, 1:57 p.m.
Set the HT capabilities of a P2P GO according to the wiphy supported
ones. Mask-in a white-list of HT capabilities that won't cause problems
for non-supporting stations.

Signed-hostap: Arik Nemtsov <arik@wizery.com>
---
v2->3: OR with the original HT capabilities to preserve SMPS mode.


 wpa_supplicant/ap.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
Jouni Malinen - Nov. 29, 2011, 9:46 p.m.
On Fri, Nov 25, 2011 at 03:57:28PM +0200, Arik Nemtsov wrote:
> Set the HT capabilities of a P2P GO according to the wiphy supported
> ones. Mask-in a white-list of HT capabilities that won't cause problems
> for non-supporting stations.

Thanks! Applied.

Patch

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 7acbefe..0dfa1a3 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -80,9 +80,10 @@  static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
 
 #ifdef CONFIG_IEEE80211N
 	/*
-	 * Enable HT20 if the driver supports it, by setting conf->ieee80211n.
+	 * Enable HT20 if the driver supports it, by setting conf->ieee80211n
+	 * and a mask of allowed capabilities within conf->ht_capab.
 	 * Using default config settings for: conf->ht_op_mode_fixed,
-	 * conf->ht_capab, conf->secondary_channel, conf->require_ht
+	 * conf->secondary_channel, conf->require_ht
 	 */
 	if (wpa_s->hw.modes) {
 		struct hostapd_hw_modes *mode = NULL;
@@ -93,8 +94,21 @@  static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
 				break;
 			}
 		}
-		if (mode && mode->ht_capab)
+		if (mode && mode->ht_capab) {
 			conf->ieee80211n = 1;
+
+			/*
+			 * white-list capabilities that won't cause issues
+			 * to connecting stations, while leaving the current
+			 * capabilities intact (currently disabled SMPS).
+			 */
+			conf->ht_capab |= mode->ht_capab &
+					  (HT_CAP_INFO_GREEN_FIELD |
+					  HT_CAP_INFO_SHORT_GI20MHZ |
+					  HT_CAP_INFO_SHORT_GI40MHZ |
+					  HT_CAP_INFO_RX_STBC_MASK |
+					  HT_CAP_INFO_MAX_AMSDU_SIZE);
+		}
 	}
 #endif /* CONFIG_IEEE80211N */