diff mbox series

[RFC,v2,08/13] wifi: mac80211: workaround for tests that drop capabilities during CSA

Message ID 20231123231436.af4c46e01358.I4d433a27e206996acd79b59e4d3e0c84d33ad9cb@changeid
State New
Headers show
Series refactor and wider-BW OFDMA support | expand

Commit Message

Johannes Berg Nov. 23, 2023, 10:14 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

There are some tests that for some reason drop HT (and higher)
capability/operation elements during CSA, which leads to the
code now disconnecting. The affected tests are:
 - ap_csa_1_switch
 - ap_csa_2_switches
 - ap_csa_ecsa_only
 - ap_vht80_csa
 - ap_vht_csa_vht40_disable
 - he80_csa
 - ocv_sa_query_csa
 - ocv_sa_query_csa_no_resp

Work around such APs, but I actually don't think we really
should be doing that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/mlme.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index fdcdba2b2c9e..aa1b07c0548a 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -919,9 +919,10 @@  static int ieee80211_config_bw(struct ieee80211_link_data *link,
 					      elems, true, &link->u.mgd.conn,
 					      &ap_chandef);
 
-	if (ap_mode != link->u.mgd.conn.mode) {
+	/* W/A for some tests, make that == again? */
+	if (ap_mode > link->u.mgd.conn.mode) {
 		link_info(link,
-			  "AP appears to change mode (expected %s, found %s), disconnect\n",
+			  "AP appears to change mode (expected at most %s, got %s), disconnect\n",
 			  ieee80211_conn_mode_str(link->u.mgd.conn.mode),
 			  ieee80211_conn_mode_str(ap_mode));
 		return -EINVAL;
@@ -953,6 +954,11 @@  static int ieee80211_config_bw(struct ieee80211_link_data *link,
 	if (cfg80211_chandef_identical(&ap_chandef, &link->conf->chandef))
 		return 0;
 
+	/* W/A for some tests - remove it again? */
+	if (ap_chandef.width == NL80211_CHAN_WIDTH_20_NOHT &&
+	    link->u.mgd.conn.mode > IEEE80211_CONN_MODE_LEGACY)
+		ap_chandef.width = NL80211_CHAN_WIDTH_20;
+
 	link_info(link,
 		  "AP %pM changed bandwidth, new config is %d.%03d MHz, width %d (%d.%03d/%d MHz)\n",
 		  link->u.mgd.bssid, ap_chandef.chan->center_freq,