mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 03:27:30 -04:00
wifi: mac80211: refactor link STA bandwidth update
There's similar code in two places in HT and HE, and we need to add the same again for UHR. Rename ieee80211_link_sta_rc_update_omi() to ieee80211_link_sta_update_rc_bw() and move it to sta_info.c and update existing code that can use it to do so. Link: https://patch.msgid.link/20260529102644.577c2f304d33.I09df4fce83c4e3e6deddfecbea74ffdbeedb4927@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
@@ -262,27 +262,6 @@ ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -323,7 +302,7 @@ bool ieee80211_prepare_rx_omi_bw(struct ieee80211_link_sta *pub_link_sta,
|
||||
|
||||
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);
|
||||
@@ -365,7 +344,7 @@ void ieee80211_finalize_rx_omi_bw(struct ieee80211_link_sta *pub_link_sta)
|
||||
/* 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) {
|
||||
|
||||
@@ -584,9 +584,10 @@ void ieee80211_ht_handle_chanwidth_notif(struct ieee80211_local *local,
|
||||
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);
|
||||
@@ -602,21 +603,12 @@ void ieee80211_ht_handle_chanwidth_notif(struct ieee80211_local *local,
|
||||
|
||||
/* 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;
|
||||
sta_opmode.bw = ieee80211_sta_rx_bw_to_chan_width(link_sta->pub->bandwidth);
|
||||
|
||||
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);
|
||||
cfg80211_sta_opmode_change_notify(sdata->dev, sta->addr,
|
||||
&sta_opmode, GFP_KERNEL);
|
||||
}
|
||||
|
||||
@@ -3775,3 +3775,26 @@ ieee80211_sta_current_bw(struct link_sta_info *link_sta,
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@@ -1015,6 +1015,9 @@ ieee80211_sta_current_bw(struct link_sta_info *link_sta,
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user