wifi: mac80211: remove ieee80211_sta_cur_vht_bw()

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>
This commit is contained in:
Johannes Berg 2026-04-15 14:42:10 +02:00
parent da000365b6
commit 9528f1a682
7 changed files with 29 additions and 40 deletions

View 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)

View 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;

View 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;

View 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,

View 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;
}

View 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,

View 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;
if (WARN_ON(!chandef))
return IEEE80211_STA_RX_BW_20;
/* 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();
}
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);