From: Johannes Berg 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. Signed-off-by: Johannes Berg --- net/mac80211/chan.c | 4 ++-- net/mac80211/he.c | 2 +- net/mac80211/ht.c | 7 ++++++- net/mac80211/ieee80211_i.h | 9 ++------- net/mac80211/mlme.c | 4 ++-- net/mac80211/sta_info.c | 2 +- net/mac80211/vht.c | 36 +++++++++++++++--------------------- 7 files changed, 29 insertions(+), 35 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 6beebbc93c3c..62f6d7f4be0d 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -626,8 +626,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) diff --git a/net/mac80211/he.c b/net/mac80211/he.c index 028c5a8459b3..2f7f7a834da6 100644 --- a/net/mac80211/he.c +++ b/net/mac80211/he.c @@ -269,7 +269,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; diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index d5528fbc5fbe..f0d5c9363a5f 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c @@ -581,9 +581,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 @@ -591,7 +596,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; diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 8a5640cdf298..29f51ec142ed 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -2281,13 +2281,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, diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 06300cf1c8ec..3cd5fe11756f 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -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; } diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 51d5618bd3f9..9ae32d601b61 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -3494,7 +3494,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, diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c index f8992d71fd19..3e3efabe9149 100644 --- a/net/mac80211/vht.c +++ b/net/mac80211/vht.c @@ -397,12 +397,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); @@ -410,30 +410,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; - 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); @@ -467,9 +456,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; @@ -516,7 +510,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); -- 2.53.0