summaryrefslogtreecommitdiff
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2024-01-29 19:34:49 +0100
committerJohannes Berg <johannes.berg@intel.com>2024-02-08 15:00:39 +0100
commitb82730bf57b54803ab94abbfd8c4422a7081886d (patch)
tree0638faf1ab123b5fcd5994456ff93e4410ae11ab /net/mac80211/util.c
parent8616f27b3fb0d47be053d7bebc9539171a514917 (diff)
wifi: cfg80211/mac80211: move puncturing into chandef
Aloka originally suggested that puncturing should be part of the chandef, so that it's treated correctly. At the time, I disagreed and it ended up not part of the chandef, but I've now realized that this was wrong. Even for clients, the RX, and perhaps more importantly, CCA configuration needs to take puncturing into account. Move puncturing into the chandef, and adjust all the code accordingly. Also add a few tests for puncturing in chandef compatibility checking. Link: https://lore.kernel.org/linux-wireless/20220214223051.3610-1-quic_alokad@quicinc.com/ Suggested-by: Aloka Dixit <quic_alokad@quicinc.com> Link: https://msgid.link/20240129194108.307183a5d2e5.I4d7fe2f126b2366c1312010e2900dfb2abffa0f6@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 63a88169d53d..5108dbaa9360 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -6,7 +6,7 @@
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH
* Copyright (C) 2015-2017 Intel Deutschland GmbH
- * Copyright (C) 2018-2023 Intel Corporation
+ * Copyright (C) 2018-2024 Intel Corporation
*
* utilities for mac80211
*/
@@ -2810,9 +2810,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
sdata->vif.bss_conf.protected_keep_alive)
changed |= BSS_CHANGED_KEEP_ALIVE;
- if (sdata->vif.bss_conf.eht_puncturing)
- changed |= BSS_CHANGED_EHT_PUNCTURING;
-
ieee80211_bss_info_change_notify(sdata,
changed);
} else if (!WARN_ON(!link)) {
@@ -4365,14 +4362,17 @@ EXPORT_SYMBOL(ieee80211_radar_detected);
void ieee80211_chandef_downgrade(struct cfg80211_chan_def *c,
struct ieee80211_conn_settings *conn)
{
- /* no-HT indicates nothing to do */
- enum nl80211_chan_width new_primary_width = NL80211_CHAN_WIDTH_20_NOHT;
+ enum nl80211_chan_width new_primary_width;
struct ieee80211_conn_settings _ignored = {};
/* allow passing NULL if caller doesn't care */
if (!conn)
conn = &_ignored;
+again:
+ /* no-HT indicates nothing to do */
+ new_primary_width = NL80211_CHAN_WIDTH_20_NOHT;
+
switch (c->width) {
default:
case NL80211_CHAN_WIDTH_20_NOHT:
@@ -4382,6 +4382,7 @@ void ieee80211_chandef_downgrade(struct cfg80211_chan_def *c,
c->width = NL80211_CHAN_WIDTH_20_NOHT;
conn->mode = IEEE80211_CONN_MODE_LEGACY;
conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20;
+ c->punctured = 0;
break;
case NL80211_CHAN_WIDTH_40:
c->width = NL80211_CHAN_WIDTH_20;
@@ -4389,6 +4390,7 @@ void ieee80211_chandef_downgrade(struct cfg80211_chan_def *c,
if (conn->mode == IEEE80211_CONN_MODE_VHT)
conn->mode = IEEE80211_CONN_MODE_HT;
conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20;
+ c->punctured = 0;
break;
case NL80211_CHAN_WIDTH_80:
new_primary_width = NL80211_CHAN_WIDTH_40;
@@ -4429,11 +4431,19 @@ void ieee80211_chandef_downgrade(struct cfg80211_chan_def *c,
}
if (new_primary_width != NL80211_CHAN_WIDTH_20_NOHT) {
- c->center_freq1 =
- cfg80211_chandef_primary_freq(c, new_primary_width);
+ c->center_freq1 = cfg80211_chandef_primary(c, new_primary_width,
+ &c->punctured);
c->width = new_primary_width;
}
+ /*
+ * With an 80 MHz channel, we might have the puncturing in the primary
+ * 40 Mhz channel, but that's not valid when downgraded to 40 MHz width.
+ * In that case, downgrade again.
+ */
+ if (!cfg80211_chandef_valid(c) && c->punctured)
+ goto again;
+
WARN_ON_ONCE(!cfg80211_chandef_valid(c));
}