]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: use chandef in ieee80211_get_sta_bw()
authorJohannes Berg <johannes.berg@intel.com>
Wed, 15 Apr 2026 12:42:02 +0000 (14:42 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 28 Apr 2026 07:27:45 +0000 (09:27 +0200)
When getting the bandwidth the station uses in order to
calculate the channel context's min_def, pass the channel
for the link to _ieee80211_sta_cap_rx_bw() instead of using
ieee80211_sta_cap_rx_bw(), which looks it up.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260415144514.d2bdf106a39f.I6ae07289a272dd9e27118f9fa324a4865f994003@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/chan.c

index fda692316f081d5356fe965013378b7a16db537c..5e93405d70a377a7090664672133b6ceef024e34 100644 (file)
@@ -438,11 +438,12 @@ ieee80211_find_reservation_chanctx(struct ieee80211_local *local,
        return NULL;
 }
 
-static enum nl80211_chan_width ieee80211_get_sta_bw(struct sta_info *sta,
-                                                   unsigned int link_id)
+static enum nl80211_chan_width
+ieee80211_get_sta_bw(struct sta_info *sta, struct ieee80211_link_data *link)
 {
        enum ieee80211_sta_rx_bandwidth width;
        struct link_sta_info *link_sta;
+       int link_id = link->link_id;
 
        link_sta = wiphy_dereference(sta->local->hw.wiphy, sta->link[link_id]);
 
@@ -457,7 +458,7 @@ static enum nl80211_chan_width ieee80211_get_sta_bw(struct sta_info *sta,
         * capabilities here. Calling it RX bandwidth capability is a bit
         * wrong though, since capabilities are in fact symmetric.
         */
-       width = ieee80211_sta_cap_rx_bw(link_sta);
+       width = _ieee80211_sta_cap_rx_bw(link_sta, &link->conf->chanreq.oper);
 
        switch (width) {
        case IEEE80211_STA_RX_BW_20:
@@ -492,7 +493,6 @@ static enum nl80211_chan_width
 ieee80211_get_max_required_bw(struct ieee80211_link_data *link)
 {
        struct ieee80211_sub_if_data *sdata = link->sdata;
-       unsigned int link_id = link->link_id;
        enum nl80211_chan_width max_bw = NL80211_CHAN_WIDTH_20_NOHT;
        struct sta_info *sta;
 
@@ -503,7 +503,7 @@ ieee80211_get_max_required_bw(struct ieee80211_link_data *link)
                    !(sta->sdata->bss && sta->sdata->bss == sdata->bss))
                        continue;
 
-               max_bw = max(max_bw, ieee80211_get_sta_bw(sta, link_id));
+               max_bw = max(max_bw, ieee80211_get_sta_bw(sta, link));
        }
 
        return max_bw;