]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: clean up ieee80211_sta_cap_rx_bw()
authorJohannes Berg <johannes.berg@intel.com>
Wed, 15 Apr 2026 12:42:09 +0000 (14:42 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 28 Apr 2026 07:27:46 +0000 (09:27 +0200)
There are three versions of this function, but now there's
no caller to ieee80211_sta_cap_rx_bw() and the chandef is
always given. Rename the functions to have one underscore
less and rely on the chandef being passed.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260415144514.62f48003f11c.Ib84ab7aeab8b278ab46d85b142a66bf330909eb6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/chan.c
net/mac80211/ieee80211_i.h
net/mac80211/tdls.c
net/mac80211/vht.c

index b3d810e3691f93f98a81e0a09970874659dc5fd6..7cbe2ce97d3b647c5ee48e7bed6bcad668f9b1d2 100644 (file)
@@ -458,7 +458,7 @@ ieee80211_get_sta_bw(struct sta_info *sta, struct ieee80211_link_data *link)
         * 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, &link->conf->chanreq.oper);
+       width = ieee80211_sta_cap_rx_bw(link_sta, &link->conf->chanreq.oper);
 
        if (width == IEEE80211_STA_RX_BW_20 &&
            !link_sta->pub->ht_cap.ht_supported &&
index 76213b50fe577e716ce4a9b79385f11c5d5ebf51..0c4796d96e65f3b18677b256b87f0762a8f38370 100644 (file)
@@ -2300,13 +2300,8 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
                                    const struct ieee80211_vht_cap *vht_cap_ie2,
                                    struct link_sta_info *link_sta);
 enum ieee80211_sta_rx_bandwidth
-_ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
-                        struct cfg80211_chan_def *chandef);
-static inline enum ieee80211_sta_rx_bandwidth
-ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta)
-{
-       return _ieee80211_sta_cap_rx_bw(link_sta, NULL);
-}
+ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
+                       struct cfg80211_chan_def *chandef);
 enum ieee80211_sta_rx_bandwidth
 _ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta,
                          struct cfg80211_chan_def *chandef);
index 874752738c6831aa633b8059ee3d1fc6b8b06fa5..dcb5fe98ec55b5fd67e5cf4f9928f468bd02814f 100644 (file)
@@ -314,7 +314,7 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata,
        enum nl80211_chan_width max_width;
        int i;
 
-       switch (ieee80211_sta_cap_rx_bw(&sta->deflink)) {
+       switch (ieee80211_sta_cap_rx_bw(&sta->deflink, &uc)) {
        case IEEE80211_STA_RX_BW_20:
                max_width = NL80211_CHAN_WIDTH_20;
                break;
@@ -1337,8 +1337,8 @@ static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata,
                        enum ieee80211_sta_rx_bandwidth bw;
 
                        bw = ieee80211_chan_width_to_rx_bw(conf->def.width);
-                       bw = min(bw, _ieee80211_sta_cap_rx_bw(&sta->deflink,
-                                                             &conf->def));
+                       bw = min(bw, ieee80211_sta_cap_rx_bw(&sta->deflink,
+                                                            &conf->def));
                        if (bw != sta->sta.deflink.bandwidth) {
                                sta->sta.deflink.bandwidth = bw;
                                rate_control_rate_update(local, sband,
index 2a85c578e25204c6459795dcd8987d9a63d2f176..cf7e5b8d373a68d87af64ba8501402b7bfe9275e 100644 (file)
@@ -333,35 +333,16 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
 
 /* FIXME: move this to some better location - parses HE/EHT now */
 static enum ieee80211_sta_rx_bandwidth
-__ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
-                         struct cfg80211_chan_def *chandef)
+_ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta, enum nl80211_band band)
 {
-       unsigned int link_id = link_sta->link_id;
-       struct ieee80211_sub_if_data *sdata = link_sta->sta->sdata;
        struct ieee80211_sta_vht_cap *vht_cap = &link_sta->pub->vht_cap;
        struct ieee80211_sta_he_cap *he_cap = &link_sta->pub->he_cap;
        struct ieee80211_sta_eht_cap *eht_cap = &link_sta->pub->eht_cap;
        u32 cap_width;
 
        if (he_cap->has_he) {
-               enum nl80211_band band;
                u8 info;
 
-               if (chandef) {
-                       band = chandef->chan->band;
-               } else {
-                       struct ieee80211_bss_conf *link_conf;
-
-                       if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_NAN_DATA ||
-                                        sdata->vif.type == NL80211_IFTYPE_NAN))
-                               return IEEE80211_STA_RX_BW_20;
-
-                       rcu_read_lock();
-                       link_conf = rcu_dereference(sdata->vif.link_conf[link_id]);
-                       band = link_conf->chanreq.oper.chan->band;
-                       rcu_read_unlock();
-               }
-
                if (eht_cap->has_eht && band == NL80211_BAND_6GHZ) {
                        info = eht_cap->eht_cap_elem.phy_cap_info[0];
 
@@ -410,8 +391,8 @@ __ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
 }
 
 enum ieee80211_sta_rx_bandwidth
-_ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
-                        struct cfg80211_chan_def *chandef)
+ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
+                       struct cfg80211_chan_def *chandef)
 {
        /*
         * With RX OMI, also pretend that the STA's capability changed.
@@ -427,7 +408,7 @@ _ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
         * the transition we already need to change TX/RX separately,
         * so _ieee80211_sta_cur_vht_bw() below applies the _tx one.
         */
-       return min(__ieee80211_sta_cap_rx_bw(link_sta, chandef),
+       return min(_ieee80211_sta_cap_rx_bw(link_sta, chandef->chan->band),
                   link_sta->rx_omi_bw_rx);
 }
 
@@ -439,9 +420,11 @@ _ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta,
        struct sta_info *sta = link_sta->sta;
        enum nl80211_chan_width bss_width;
        enum ieee80211_sta_rx_bandwidth bw;
+       enum nl80211_band band;
 
        if (chandef) {
                bss_width = chandef->width;
+               band = chandef->chan->band;
        } else {
                struct ieee80211_bss_conf *link_conf;
 
@@ -457,11 +440,12 @@ _ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta,
                        return IEEE80211_STA_RX_BW_20;
                }
                bss_width = link_conf->chanreq.oper.width;
+               band = link_conf->chanreq.oper.chan->band;
                rcu_read_unlock();
        }
 
        /* intentionally do not take rx_bw_omi_rx into account */
-       bw = __ieee80211_sta_cap_rx_bw(link_sta, chandef);
+       bw = _ieee80211_sta_cap_rx_bw(link_sta, band);
        bw = min(bw, link_sta->cur_max_bandwidth);
        /* but do apply rx_omi_bw_tx */
        bw = min(bw, link_sta->rx_omi_bw_tx);