[PATCH] wpa_supplicant: Enable HT40 support for AP mode

Rajkumar Manoharan rmanohar
Sun Jul 8 21:51:08 PDT 2012


Right now HT40 mode is not enabled for AP/P2P GO mode in wpa_supplicant.
If the HW is capable of 40MHz channel width and user specifies the
secondary channel posision, lets enable the HT40 mode in wpa_s. This
patch also enables HT40 support for P2P mode.

ap_ht40_mode : -1 -> HT40MINUS, 1 -> HT40PLUS

Signed-hostap: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
---
 wpa_supplicant/ap.c               | 3 +++
 wpa_supplicant/config.c           | 5 ++++-
 wpa_supplicant/config.h           | 7 +++++++
 wpa_supplicant/config_file.c      | 4 ++++
 wpa_supplicant/p2p_supplicant.c   | 2 --
 wpa_supplicant/wpa_supplicant.c   | 2 ++
 wpa_supplicant/wpa_supplicant_i.h | 1 +
 7 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index f9e0045..25a07d5 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -99,6 +99,9 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
 
 		if (!no_ht && mode && mode->ht_capab) {
 			conf->ieee80211n = 1;
+			if (mode->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET)
+				conf->secondary_channel =
+					wpa_s->global->ap_ht40_mode;
 
 			/*
 			 * white-list capabilities that won't cause issues
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index a68b31e..31a5d39 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2921,7 +2921,10 @@ static const struct global_parse_data global_fields[] = {
 	{ INT_RANGE(wps_nfc_dev_pw_id, 0x10, 0xffff), 0 },
 	{ BIN(wps_nfc_dh_pubkey), 0 },
 	{ BIN(wps_nfc_dh_privkey), 0 },
-	{ BIN(wps_nfc_dev_pw), 0 }
+	{ BIN(wps_nfc_dev_pw), 0 },
+#ifdef CONFIG_IEEE80211N
+	{ INT(ap_ht40_mode), 0 },
+#endif
 };
 
 #undef FUNC
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 46c4da2..7bb326d 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -661,6 +661,13 @@ struct wpa_config {
 	 * wps_nfc_dh_pubkey - NFC Device Password for password token
 	 */
 	struct wpabuf *wps_nfc_dev_pw;
+#ifdef CONFIG_IEEE80211N
+	/**
+	 * ap_ht40_mode - Specify HT40 mode secondary channel position
+	 *		  HT40+/- mainly for AP mode
+	 */
+	int ap_ht40_mode;
+#endif
 };
 
 
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 8badc7b..3182d29 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -875,6 +875,10 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
 	write_global_bin(f, "wps_nfc_dh_pubkey", config->wps_nfc_dh_pubkey);
 	write_global_bin(f, "wps_nfc_dh_privkey", config->wps_nfc_dh_privkey);
 	write_global_bin(f, "wps_nfc_dev_pw", config->wps_nfc_dev_pw);
+#ifdef CONFIG_IEEE80211N
+	if (config->ap_ht40_mode)
+		fprintf(f, "ap_ht40_mode=%d\n", config->ap_ht40_mode);
+#endif
 }
 
 #endif /* CONFIG_NO_CONFIG_WRITE */
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 218ed2f..0a9fc1f 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -2231,10 +2231,8 @@ static int wpas_p2p_setup_channels(struct wpa_supplicant *wpa_s,
 	struct p2p_oper_class_map op_class[] = {
 		{ HOSTAPD_MODE_IEEE80211G, 81, 1, 13, 1, BW20 },
 		{ HOSTAPD_MODE_IEEE80211G, 82, 14, 14, 1, BW20 },
-#if 0 /* Do not enable HT40 on 2 GHz for now */
 		{ HOSTAPD_MODE_IEEE80211G, 83, 1, 9, 1, BW40PLUS },
 		{ HOSTAPD_MODE_IEEE80211G, 84, 5, 13, 1, BW40MINUS },
-#endif
 		{ HOSTAPD_MODE_IEEE80211A, 115, 36, 48, 4, BW20 },
 		{ HOSTAPD_MODE_IEEE80211A, 124, 149, 161, 4, BW20 },
 		{ HOSTAPD_MODE_IEEE80211A, 116, 36, 44, 8, BW40PLUS },
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c65dc3c..22b063b 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2534,6 +2534,8 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
 			return -1;
 		}
 
+		wpa_s->global->ap_ht40_mode = wpa_s->conf->ap_ht40_mode;
+
 		/*
 		 * Override ctrl_interface and driver_param if set on command
 		 * line.
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index b608f29..6c4c507 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -239,6 +239,7 @@ struct wpa_global {
 		WPA_CONC_PREF_STA,
 		WPA_CONC_PREF_P2P
 	} conc_pref;
+	int ap_ht40_mode;
 };
 
 
-- 
1.7.11.1




More information about the Hostap mailing list