[PATCH] wpa_s AP mode: Enable HT20 if driver supports it.

Angie Chinchilla angie.v.chinchilla
Mon Apr 25 10:39:09 PDT 2011


If the driver supports HT20, set the config parameter ieee80211n
to enable it. This does not enable HT40.

Signed-off-by: Angie Chinchilla <angie.v.chinchilla at intel.com>
---
 wpa_supplicant/ap.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 95279d3..294d0c9 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -56,6 +56,10 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
 {
 	struct hostapd_bss_config *bss = &conf->bss[0];
 	int pairwise;
+#ifdef CONFIG_IEEE80211N
+	struct hostapd_hw_modes *modes;
+	u16 num_modes, flags;
+#endif /* CONFIG_IEEE80211N */
 
 	conf->driver = wpa_s->driver;
 
@@ -78,9 +82,32 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
 		return -1;
 	}
 
-	/* TODO: enable HT if driver supports it;
+	/* TODO: enable HT40 if driver supports it;
 	 * drop to 11b if driver does not support 11g */
 
+#ifdef CONFIG_IEEE80211N
+	/*
+	 * Enable HT20 if the driver supports it, by setting conf->ieee80211n.
+	 * Using default config settings for: conf->ht_op_mode_fixed,
+	 *  conf->ht_capab, conf->secondary_channel, conf->require_ht
+	 */
+	modes = wpa_drv_get_hw_feature_data(wpa_s, &num_modes, &flags);
+	if (modes) {
+		struct hostapd_hw_modes *mode = NULL;
+		int i;
+		for (i = 0; i < num_modes; i++) {
+			if (modes[i].mode == conf->hw_mode) {
+				mode = &modes[i];
+				break;
+			}
+		}
+		if (mode && mode->ht_capab)
+			conf->ieee80211n = 1;
+		ieee80211_sta_free_hw_features(modes, num_modes);
+		modes = NULL;
+	}
+#endif /* CONFIG_IEEE80211N */
+
 #ifdef CONFIG_P2P
 	if (conf->hw_mode == HOSTAPD_MODE_IEEE80211G) {
 		/* Remove 802.11b rates from supported and basic rate sets */
-- 
1.7.0.4




More information about the Hostap mailing list