]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: set AP NPCA parameters in bss_conf
authorJohannes Berg <johannes.berg@intel.com>
Tue, 28 Apr 2026 09:25:39 +0000 (11:25 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 5 May 2026 12:49:03 +0000 (14:49 +0200)
Set the parameters advertised in the beacon in the BSS
configuration as well.

Note this is incomplete since it doesn't track updates.

Link: https://patch.msgid.link/20260428112708.311609f2eedb.I3db62b48d6afefd23b50fd14663f863e6f9974ca@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c

index 7e9dcb02f9bd9c5240f635b6b7ff31c0a2c4f41b..0ebc58a768a40e836f897279323b472625576cd5 100644 (file)
@@ -1725,10 +1725,42 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
        }
 
        if (params->beacon.uhr_oper) {
+               const struct ieee80211_uhr_npca_info *npca;
+               struct ieee80211_bss_npca_params npca_params = {};
+
                if (!link_conf->eht_support)
                        return -EOPNOTSUPP;
 
                link_conf->uhr_support = true;
+
+               npca = ieee80211_uhr_npca_info(params->beacon.uhr_oper);
+               if (!npca) {
+                       chanreq.oper.npca_chan = NULL;
+                       chanreq.oper.npca_punctured = 0;
+               } else {
+                       npca_params.min_dur_thresh =
+                               le32_get_bits(npca->params,
+                                             IEEE80211_UHR_NPCA_PARAMS_MIN_DUR_THRESH);
+                       npca_params.switch_delay =
+                               le32_get_bits(npca->params,
+                                             IEEE80211_UHR_NPCA_PARAMS_SWITCH_DELAY);
+                       npca_params.switch_back_delay =
+                               le32_get_bits(npca->params,
+                                             IEEE80211_UHR_NPCA_PARAMS_SWITCH_BACK_DELAY);
+                       npca_params.init_qsrc =
+                               le32_get_bits(npca->params,
+                                             IEEE80211_UHR_NPCA_PARAMS_INIT_QSRC);
+                       npca_params.moplen =
+                               le32_get_bits(npca->params,
+                                             IEEE80211_UHR_NPCA_PARAMS_MOPLEN);
+                       npca_params.enabled = true;
+               }
+
+               if (memcmp(&npca_params, &link->conf->npca,
+                          sizeof(npca_params))) {
+                       link->conf->npca = npca_params;
+                       changed |= BSS_CHANGED_NPCA;
+               }
        }
 
        if (sdata->vif.type == NL80211_IFTYPE_AP &&