From: Angie Chinchilla Date: Tue, 5 Jul 2011 13:49:28 +0000 (+0300) Subject: wpa_s AP mode: Enable HT20 if driver supports it X-Git-Tag: hostap-1-bp~330 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2db9174503561a05e312ad1a667e7350445d8eb0;p=thirdparty%2Fhostap.git wpa_s AP mode: Enable HT20 if driver supports it If the driver supports HT20, set the config parameter ieee80211n to enable it. This does not enable HT40. Signed-off-by: Angie Chinchilla --- diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index b463e9add..41dbe233e 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 */