From: Johannes Berg Date: Wed, 15 Apr 2026 12:42:09 +0000 (+0200) Subject: wifi: mac80211: clean up ieee80211_sta_cap_rx_bw() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da000365b640c9ab8accc21b560fc0493c924663;p=thirdparty%2Fkernel%2Flinux.git wifi: mac80211: clean up ieee80211_sta_cap_rx_bw() 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 Link: https://patch.msgid.link/20260415144514.62f48003f11c.Ib84ab7aeab8b278ab46d85b142a66bf330909eb6@changeid Signed-off-by: Johannes Berg --- diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index b3d810e3691f9..7cbe2ce97d3b6 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -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 && diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 76213b50fe577..0c4796d96e65f 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -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); diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index 874752738c683..dcb5fe98ec55b 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -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, diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c index 2a85c578e2520..cf7e5b8d373a6 100644 --- a/net/mac80211/vht.c +++ b/net/mac80211/vht.c @@ -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);