[RFC 3/3] wpa_supplicant: Report 40MHz Intolerance to associated AP.
Rajkumar Manoharan
rmanohar
Sat Jul 16 23:06:07 PDT 2011
This patch adds support for 40MHz intolerance handling in STA
mode. STA should report of any 40MHz intolerance in case if it
finds a non-HT AP or a HT AP which prohibits 40MHz transmission
(i.e 40MHz intolerant bit is set in HT capabilities IE).
STA shall report this condition using 20/40 BSS coexistence
action frame.
Signed-off-by: Rajkumar Manoharan <rmanohar at qca.qualcomm.com>
---
wpa_supplicant/events.c | 2 +
wpa_supplicant/sme.c | 43 ++++++++++++++++++++++++++++++++
wpa_supplicant/sme.h | 6 ++++
wpa_supplicant/wpa_supplicant.c | 51 +++++++++++++++++++++++++++++++++++++++
4 files changed, 102 insertions(+), 0 deletions(-)
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index b398792..663ec81 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -951,6 +951,8 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
return 0;
}
+ wpa_supplicant_proc_40mhz_intolerant(wpa_s);
+
if (bgscan_notify_scan(wpa_s, scan_res) == 1) {
wpa_scan_results_free(scan_res);
return 0;
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 325ffc5..9e050ed 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -590,7 +590,50 @@ void sme_deinit(struct wpa_supplicant *wpa_s)
eloop_cancel_timeout(sme_auth_timer, wpa_s, NULL);
}
+void sme_send_2040_bss_coex(struct wpa_supplicant *wpa_s,
+ u8 *chan_list, u8 n_channels)
+{
+ struct ieee80211_2040_bss_coex_ie *bc_ie;
+ struct ieee80211_2040_intol_chan_report *ic_report;
+ struct wpabuf *buf;
+ u8 *pos;
+
+ wpa_printf(MSG_DEBUG, "MLME: Send 20/40 BSS Coexistence");
+
+ buf = wpabuf_alloc(2 + /* action.category + action_code */
+ sizeof(struct ieee80211_2040_bss_coex_ie) +
+ sizeof(struct ieee80211_2040_intol_chan_report) +
+ n_channels);
+ if (buf == NULL)
+ return;
+
+ pos = wpabuf_put(buf, 2);
+ pos[0] = WLAN_ACTION_PUBLIC;
+ pos[1] = WLAN_PA_20_40_BSS_COEX;
+ bc_ie = wpabuf_put(buf, sizeof(*bc_ie));
+ bc_ie->element_id = WLAN_EID_20_40_BSS_COEXISTENCE;
+ bc_ie->length = 1;
+ bc_ie->coex_param = WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ;
+
+ ic_report = wpabuf_put(buf, sizeof(*ic_report));
+ ic_report->element_id = WLAN_EID_20_40_BSS_INTOLERANT;
+ ic_report->length = n_channels + 1;
+ freq_to_channel(wpa_s->current_bss->freq, &ic_report->reg_class, 0);
+
+ if (n_channels) {
+ pos = wpabuf_put(buf, n_channels);
+ os_memcpy(pos, chan_list, n_channels);
+ }
+
+ if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
+ wpa_s->own_addr, wpa_s->bssid,
+ wpabuf_head(buf), wpabuf_len(buf)) < 0)
+ wpa_msg(wpa_s, MSG_INFO, "SME: Failed to send 20/40 BSS "
+ "Coexistence frame");
+
+ wpabuf_free(buf);
+}
#ifdef CONFIG_IEEE80211W
static const unsigned int sa_query_max_timeout = 1000;
diff --git a/wpa_supplicant/sme.h b/wpa_supplicant/sme.h
index a59b38d..60ccf56 100644
--- a/wpa_supplicant/sme.h
+++ b/wpa_supplicant/sme.h
@@ -41,6 +41,8 @@ void sme_disassoc_while_authenticating(struct wpa_supplicant *wpa_s,
const u8 *prev_pending_bssid);
void sme_deinit(struct wpa_supplicant *wpa_s);
+void sme_send_2040_bss_coex(struct wpa_supplicant *wpa_s,
+ u8 *chan_list, u8 n_channels);
#else /* CONFIG_SME */
static inline void sme_authenticate(struct wpa_supplicant *wpa_s,
@@ -101,6 +103,10 @@ static inline void sme_deinit(struct wpa_supplicant *wpa_s)
{
}
+static inline void sme_send_2040_bss_coex(struct wpa_supplicant *wpa_s,
+ u8 *chan_list, u8 n_channels)
+{
+}
#endif /* CONFIG_SME */
#endif /* SME_H */
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index f303b40..25c7c44 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2824,3 +2824,54 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid)
wpa_supplicant_req_scan(wpa_s, timeout / 1000,
1000 * (timeout % 1000));
}
+
+void wpa_supplicant_proc_40mhz_intolerant(struct wpa_supplicant *wpa_s)
+{
+ struct wpa_bss *bss, *n;
+ struct ieee80211_ht_capabilities *cap;
+ enum nl80211_band assoc_band;
+ Boolean found_intolerant = FALSE;
+ const u8 *ie;
+ u8 intol_channels[28], tmp_channel;
+ u8 n_channels = 0;
+
+ if (wpa_s->wpa_state != WPA_COMPLETED)
+ return;
+
+ /* Check for not-ht association */
+ ie = wpa_bss_get_ie(wpa_s->current_bss, WLAN_EID_HT_CAP);
+ if (!ie)
+ return;
+
+ os_memset(intol_channels, 0, 28);
+
+ assoc_band = freq_to_channel(wpa_s->current_bss->freq, 0, 0);
+ dl_list_for_each_safe(bss, n, &wpa_s->bss, struct wpa_bss, list) {
+ /* Skip other band bss */
+ if (freq_to_channel(bss->freq, 0, &tmp_channel) != assoc_band)
+ continue;
+ ie = wpa_bss_get_ie(bss, WLAN_EID_HT_CAP);
+ if (!ie) {
+ /* To avoid channel duplication */
+ if (!n_channels ||
+ intol_channels[n_channels - 1] != tmp_channel)
+ intol_channels[n_channels++] = tmp_channel;
+ found_intolerant = TRUE;
+ } else {
+ cap = (struct ieee80211_ht_capabilities *) ie + 2;
+ if (le_to_host16(cap->ht_capabilities_info) &
+ HT_CAP_INFO_40MHZ_INTOLERANT) {
+ /* To avoid channel duplication */
+ if (!n_channels ||
+ intol_channels[n_channels - 1]
+ != tmp_channel)
+ intol_channels[n_channels++] =
+ tmp_channel;
+ found_intolerant = TRUE;
+ }
+ }
+ }
+
+ if (found_intolerant)
+ sme_send_2040_bss_coex(wpa_s, intol_channels, n_channels);
+}
--
1.7.6
More information about the Hostap
mailing list