}
}
-static void ieee80211_link_sta_rc_update_omi(struct ieee80211_link_data *link,
- struct link_sta_info *link_sta)
-{
- struct ieee80211_sub_if_data *sdata = link->sdata;
- struct ieee80211_supported_band *sband;
- enum ieee80211_sta_rx_bandwidth new_bw;
- enum nl80211_band band;
-
- band = link->conf->chanreq.oper.chan->band;
- sband = sdata->local->hw.wiphy->bands[band];
-
- new_bw = ieee80211_sta_current_bw(link_sta, &link->conf->chanreq.oper,
- IEEE80211_STA_BW_TX_TO_STA);
- if (link_sta->pub->bandwidth == new_bw)
- return;
-
- link_sta->pub->bandwidth = new_bw;
- rate_control_rate_update(sdata->local, sband, link_sta,
- IEEE80211_RC_BW_CHANGED);
-}
-
bool ieee80211_prepare_rx_omi_bw(struct ieee80211_link_sta *pub_link_sta,
enum ieee80211_sta_rx_bandwidth bw)
{
if (bw < link_sta->rx_omi_bw_staging) {
link_sta->rx_omi_bw_tx = bw;
- ieee80211_link_sta_rc_update_omi(link, link_sta);
+ ieee80211_link_sta_update_rc_bw(link, link_sta);
} else {
link_sta->rx_omi_bw_rx = bw;
ieee80211_recalc_chanctx_min_def(local, chanctx);
/* rate control in finalize only when widening bandwidth */
WARN_ON(link_sta->rx_omi_bw_tx > link_sta->rx_omi_bw_staging);
link_sta->rx_omi_bw_tx = link_sta->rx_omi_bw_staging;
- ieee80211_link_sta_rc_update_omi(link, link_sta);
+ ieee80211_link_sta_update_rc_bw(link, link_sta);
}
if (link_sta->rx_omi_bw_rx != link_sta->rx_omi_bw_staging) {
struct link_sta_info *link_sta,
u8 chanwidth, enum nl80211_band band)
{
- enum ieee80211_sta_rx_bandwidth max_bw, new_bw;
- struct ieee80211_supported_band *sband;
- struct sta_opmode_info sta_opmode = {};
+ enum ieee80211_sta_rx_bandwidth max_bw;
+ struct sta_opmode_info sta_opmode = {
+ .changed = STA_OPMODE_MAX_BW_CHANGED,
+ };
struct ieee80211_link_data *link;
lockdep_assert_wiphy(local->hw.wiphy);
/* set op_mode_bw and recalc sta bw */
link_sta->op_mode_bw = max_bw;
- new_bw = ieee80211_sta_current_bw(link_sta, &link->conf->chanreq.oper,
- IEEE80211_STA_BW_TX_TO_STA);
- if (link_sta->pub->bandwidth == new_bw)
+ if (!ieee80211_link_sta_update_rc_bw(link, link_sta))
return;
- link_sta->pub->bandwidth = new_bw;
- sband = local->hw.wiphy->bands[band];
- sta_opmode.bw = ieee80211_sta_rx_bw_to_chan_width(new_bw);
- sta_opmode.changed = STA_OPMODE_MAX_BW_CHANGED;
-
- rate_control_rate_update(local, sband, link_sta,
- IEEE80211_RC_BW_CHANGED);
- cfg80211_sta_opmode_change_notify(sdata->dev,
- sta->addr,
- &sta_opmode,
- GFP_KERNEL);
+ sta_opmode.bw = ieee80211_sta_rx_bw_to_chan_width(link_sta->pub->bandwidth);
+
+ cfg80211_sta_opmode_change_notify(sdata->dev, sta->addr,
+ &sta_opmode, GFP_KERNEL);
}
/* unreachable */
return IEEE80211_STA_RX_BW_20;
}
+
+bool ieee80211_link_sta_update_rc_bw(struct ieee80211_link_data *link,
+ struct link_sta_info *link_sta)
+{
+ struct ieee80211_sub_if_data *sdata = link->sdata;
+ struct ieee80211_supported_band *sband;
+ enum ieee80211_sta_rx_bandwidth new_bw;
+ enum nl80211_band band;
+
+ band = link->conf->chanreq.oper.chan->band;
+ sband = sdata->local->hw.wiphy->bands[band];
+
+ new_bw = ieee80211_sta_current_bw(link_sta, &link->conf->chanreq.oper,
+ IEEE80211_STA_BW_TX_TO_STA);
+ if (link_sta->pub->bandwidth == new_bw)
+ return false;
+
+ link_sta->pub->bandwidth = new_bw;
+ rate_control_rate_update(sdata->local, sband, link_sta,
+ IEEE80211_RC_BW_CHANGED);
+
+ return true;
+}
struct cfg80211_chan_def *chandef,
enum ieee80211_sta_bw_direction direction);
+bool ieee80211_link_sta_update_rc_bw(struct ieee80211_link_data *link,
+ struct link_sta_info *link_sta);
+
enum sta_stats_type {
STA_STATS_RATE_TYPE_INVALID = 0,
STA_STATS_RATE_TYPE_LEGACY,