]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: remove ieee80211_sta_cur_vht_bw()
authorJohannes Berg <johannes.berg@intel.com>
Wed, 15 Apr 2026 12:42:10 +0000 (14:42 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 28 Apr 2026 07:27:47 +0000 (09:27 +0200)
We can now easily always call _ieee80211_sta_cur_vht_bw() with
a valid chandef, so do that, remove ieee80211_sta_cur_vht_bw()
and drop the underscore prefix.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260415144514.73659adc198f.Ic8fc88a7e016e62d00dca380ffbf47a54ef3daef@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/chan.c
net/mac80211/he.c
net/mac80211/ht.c
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c
net/mac80211/sta_info.c
net/mac80211/vht.c

index 7cbe2ce97d3b647c5ee48e7bed6bcad668f9b1d2..13c0d080ef2ae53c738bb6d302affa6cdb514e9c 100644 (file)
@@ -693,8 +693,8 @@ static void ieee80211_chan_bw_change(struct ieee80211_local *local,
                        else
                                new_chandef = &link_conf->chanreq.oper;
 
-                       new_sta_bw = _ieee80211_sta_cur_vht_bw(link_sta,
-                                                              new_chandef);
+                       new_sta_bw = ieee80211_sta_cur_vht_bw(link_sta,
+                                                             new_chandef);
 
                        /* nothing change */
                        if (new_sta_bw == link_sta->pub->bandwidth)
index e6e9c378ed3a4e1f381882fb862bffaf1c21ef9c..1e8ce33bfe2e6be8aee40b6e3ebb6a359f910b4c 100644 (file)
@@ -273,7 +273,7 @@ static void ieee80211_link_sta_rc_update_omi(struct ieee80211_link_data *link,
        band = link->conf->chanreq.oper.chan->band;
        sband = sdata->local->hw.wiphy->bands[band];
 
-       new_bw = ieee80211_sta_cur_vht_bw(link_sta);
+       new_bw = ieee80211_sta_cur_vht_bw(link_sta, &link->conf->chanreq.oper);
        if (link_sta->pub->bandwidth == new_bw)
                return;
 
index e32e40db081bdec77bfb3bc647659407842bd535..02ca6e1edc495987d311fdf91bb4c342bfdc39c7 100644 (file)
@@ -587,9 +587,14 @@ void ieee80211_ht_handle_chanwidth_notif(struct ieee80211_local *local,
        enum ieee80211_sta_rx_bandwidth max_bw, new_bw;
        struct ieee80211_supported_band *sband;
        struct sta_opmode_info sta_opmode = {};
+       struct ieee80211_link_data *link;
 
        lockdep_assert_wiphy(local->hw.wiphy);
 
+       link = sdata_dereference(sdata->link[link_sta->link_id], sdata);
+       if (WARN_ON(!link))
+               return;
+
        if (chanwidth == IEEE80211_HT_CHANWIDTH_20MHZ)
                max_bw = IEEE80211_STA_RX_BW_20;
        else
@@ -597,7 +602,7 @@ void ieee80211_ht_handle_chanwidth_notif(struct ieee80211_local *local,
 
        /* set cur_max_bandwidth and recalc sta bw */
        link_sta->cur_max_bandwidth = max_bw;
-       new_bw = ieee80211_sta_cur_vht_bw(link_sta);
+       new_bw = ieee80211_sta_cur_vht_bw(link_sta, &link->conf->chanreq.oper);
 
        if (link_sta->pub->bandwidth == new_bw)
                return;
index 0c4796d96e65f3b18677b256b87f0762a8f38370..6b72be762dbe687d40b70778687d8aa24bb2b9e4 100644 (file)
@@ -2303,13 +2303,8 @@ enum ieee80211_sta_rx_bandwidth
 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);
-static inline enum ieee80211_sta_rx_bandwidth
-ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta)
-{
-       return _ieee80211_sta_cur_vht_bw(link_sta, NULL);
-}
+ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta,
+                        struct cfg80211_chan_def *chandef);
 
 void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
                                 struct ieee80211_link_data *link,
index ea190d54d1950a831c12bc774e06784098ef3afc..6e0e5d3f5015d3a6309566e7b209701d500663a6 100644 (file)
@@ -2571,8 +2571,8 @@ static void ieee80211_csa_switch_work(struct wiphy *wiphy,
                        return;
 
                link_sta->pub->bandwidth =
-                       _ieee80211_sta_cur_vht_bw(link_sta,
-                                                 &link->csa.chanreq.oper);
+                       ieee80211_sta_cur_vht_bw(link_sta,
+                                                &link->csa.chanreq.oper);
                return;
        }
 
index d53cd8c5df4cdb0acdd7a4987c4110461611c290..508aad14bdf631b2e8fdaa53fbda9acb5f359021 100644 (file)
@@ -3519,7 +3519,7 @@ void ieee80211_sta_init_nss_bw_capa(struct link_sta_info *link_sta,
        link_sta->capa_nss = ieee80211_sta_nss_capability(link_sta);
        link_sta->pub->rx_nss = link_sta->capa_nss;
 
-       link_sta->pub->bandwidth = _ieee80211_sta_cur_vht_bw(link_sta, chandef);
+       link_sta->pub->bandwidth = ieee80211_sta_cur_vht_bw(link_sta, chandef);
 }
 
 void ieee80211_sta_set_max_amsdu_subframes(struct sta_info *sta,
index cf7e5b8d373a68d87af64ba8501402b7bfe9275e..3df5f6c3f777e25ee8b4b391c1df014e17a2a903 100644 (file)
@@ -401,12 +401,12 @@ ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
         * The purpose, however, is to save power, and that requires
         * changing also transmissions to the AP and the chanctx. The
         * transmissions depend on link_sta->bandwidth which is set in
-        * _ieee80211_sta_cur_vht_bw() below, but the chanctx depends
+        * ieee80211_sta_cur_vht_bw() below, but the chanctx depends
         * on the result of this function which is also called by
-        * _ieee80211_sta_cur_vht_bw(), so we need to do that here as
+        * ieee80211_sta_cur_vht_bw(), so we need to do that here as
         * well. This is sufficient for the steady state, but during
         * the transition we already need to change TX/RX separately,
-        * so _ieee80211_sta_cur_vht_bw() below applies the _tx one.
+        * so ieee80211_sta_cur_vht_bw() below applies the _tx one.
         */
        return min(_ieee80211_sta_cap_rx_bw(link_sta, chandef->chan->band),
                   link_sta->rx_omi_bw_rx);
@@ -414,35 +414,19 @@ ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta,
 
 /* FIXME: rename/move - this deals with everything not just VHT */
 enum ieee80211_sta_rx_bandwidth
-_ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta,
-                         struct cfg80211_chan_def *chandef)
+ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta,
+                        struct cfg80211_chan_def *chandef)
 {
        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;
-
-               /* NAN operates on multiple channels so a chandef must be given */
-               if (sta->sdata->vif.type == NL80211_IFTYPE_NAN ||
-                   sta->sdata->vif.type == NL80211_IFTYPE_NAN_DATA)
-                       return IEEE80211_STA_RX_BW_MAX;
-
-               rcu_read_lock();
-               link_conf = rcu_dereference(sta->sdata->vif.link_conf[link_sta->link_id]);
-               if (WARN_ON_ONCE(!link_conf)) {
-                       rcu_read_unlock();
-                       return IEEE80211_STA_RX_BW_20;
-               }
-               bss_width = link_conf->chanreq.oper.width;
-               band = link_conf->chanreq.oper.chan->band;
-               rcu_read_unlock();
-       }
+       if (WARN_ON(!chandef))
+               return IEEE80211_STA_RX_BW_20;
+
+       bss_width = chandef->width;
+       band = chandef->chan->band;
 
        /* intentionally do not take rx_bw_omi_rx into account */
        bw = _ieee80211_sta_cap_rx_bw(link_sta, band);
@@ -476,9 +460,14 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
 {
        enum ieee80211_sta_rx_bandwidth new_bw;
        struct sta_opmode_info sta_opmode = {};
+       struct ieee80211_link_data *link;
        u32 changed = 0;
        u8 nss;
 
+       link = sdata_dereference(sdata->link[link_sta->link_id], sdata);
+       if (WARN_ON(!link))
+               return 0;
+
        /* ignore - no support for BF yet */
        if (opmode & IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF)
                return 0;
@@ -525,7 +514,7 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
                break;
        }
 
-       new_bw = ieee80211_sta_cur_vht_bw(link_sta);
+       new_bw = ieee80211_sta_cur_vht_bw(link_sta, &link->conf->chanreq.oper);
        if (new_bw != link_sta->pub->bandwidth) {
                link_sta->pub->bandwidth = new_bw;
                sta_opmode.bw = ieee80211_sta_rx_bw_to_chan_width(new_bw);