summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2026-04-28 11:25:34 +0200
committerJohannes Berg <johannes.berg@intel.com>2026-05-05 14:49:03 +0200
commitee52966a00a902cdc62ceeabf728b9a661e4805c (patch)
treec02876c18c4a8976d331ccbaea8ad1a867538ac0 /net
parent3ca884399be1bcb04baec264a75133cf7a422b52 (diff)
wifi: mac80211: use NPCA in chandef for validation
Put the NPCA parameters into a chandef when parsing data from the AP to validate them using the cfg80211 code, rather than implementing that in mac80211 directly. Note that the parameters are not applied yet, since mac80211 doesn't yet have NPCA support. Link: https://patch.msgid.link/20260428112708.418e86f9444c.I54430f3018e39a26b4252d71000d7bb7dd744331@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/mlme.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index f8ed8a8ce0b1..5be390de6756 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -402,44 +402,13 @@ check_uhr:
false)) {
struct cfg80211_chan_def npca_chandef = *chandef;
const struct ieee80211_uhr_npca_info *npca;
- const __le16 *dis_subch_bmap;
- u16 punct = chandef->punctured, npca_punct;
npca = ieee80211_uhr_npca_info(uhr_oper);
- if (npca) {
- int width = cfg80211_chandef_get_width(chandef);
- u8 offs = le32_get_bits(npca->params,
- IEEE80211_UHR_NPCA_PARAMS_PRIMARY_CHAN_OFFS);
- u32 cf1 = chandef->center_freq1;
- bool pri_upper, npca_upper;
-
- pri_upper = chandef->chan->center_freq > cf1;
- npca_upper = 20 * offs >= width / 2;
-
- if (20 * offs >= cfg80211_chandef_get_width(chandef) ||
- pri_upper == npca_upper) {
- sdata_info(sdata,
- "AP UHR NPCA primary channel invalid, disabling UHR\n");
- return IEEE80211_CONN_MODE_EHT;
- }
- }
-
- dis_subch_bmap = ieee80211_uhr_npca_dis_subch_bitmap(uhr_oper);
- if (dis_subch_bmap) {
- npca_punct = get_unaligned_le16(dis_subch_bmap);
- npca_chandef.punctured = npca_punct;
- }
-
- /*
- * must be a valid puncturing pattern for this channel as
- * well as puncturing all subchannels that are already in
- * the disabled subchannel bitmap on the primary channel
- */
- if (!cfg80211_chandef_valid(&npca_chandef) ||
- ((punct & npca_punct) != punct)) {
+ if (cfg80211_chandef_add_npca(sdata->local->hw.wiphy,
+ &npca_chandef, npca)) {
sdata_info(sdata,
- "AP UHR NPCA disabled subchannel bitmap invalid, disabling UHR\n");
+ "AP UHR NPCA settings invalid, disabling UHR\n");
return IEEE80211_CONN_MODE_EHT;
}
}