Skip to content

Commit

Permalink
wifi: iwlwifi: mvm: remove RS rate init update argument
Browse files Browse the repository at this point in the history
Track instead whether or not the station was authorized, that's
clearer than trying to indicate in the code whether or not the
full bandwidth should be used via an 'update' argument.

While at it, give rs_fw_rate_init() the iwl_mvm_ prefix.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230417113648.92bd8d36e311.I1877a109104d5ffeaaad6a623e89f0c44decc38e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Apr 18, 2023
1 parent 9371ac0 commit 15d4183
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
19 changes: 11 additions & 8 deletions drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -3577,8 +3577,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
*/
static void iwl_mvm_rs_rate_init_all_links(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
bool update)
struct ieee80211_sta *sta)
{
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
unsigned int link_id;
Expand All @@ -3593,8 +3592,7 @@ static void iwl_mvm_rs_rate_init_all_links(struct iwl_mvm *mvm,
continue;

iwl_mvm_rs_rate_init(mvm, vif, sta, conf, link_sta,
mvmvif->link[link_id]->phy_ctxt->channel->band,
update);
mvmvif->link[link_id]->phy_ctxt->channel->band);
}
}

Expand Down Expand Up @@ -3766,7 +3764,7 @@ iwl_mvm_sta_state_auth_to_assoc(struct ieee80211_hw *hw,
}

out:
iwl_mvm_rs_rate_init_all_links(mvm, vif, sta, false);
iwl_mvm_rs_rate_init_all_links(mvm, vif, sta);

return callbacks->update_sta(mvm, vif, sta);
}
Expand Down Expand Up @@ -3799,7 +3797,9 @@ iwl_mvm_sta_state_assoc_to_authorized(struct iwl_mvm *mvm,
iwl_mvm_mei_host_associated(mvm, vif, mvm_sta);
}

iwl_mvm_rs_rate_init_all_links(mvm, vif, sta, true);
mvm_sta->authorized = true;

iwl_mvm_rs_rate_init_all_links(mvm, vif, sta);

return 0;
}
Expand All @@ -3811,14 +3811,17 @@ iwl_mvm_sta_state_authorized_to_assoc(struct iwl_mvm *mvm,
struct iwl_mvm_sta_state_ops *callbacks)
{
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
int ret;

lockdep_assert_held(&mvm->mutex);

mvmsta->authorized = false;

/* once we move into assoc state, need to update rate scale to
* disable using wide bandwidth
*/
iwl_mvm_rs_rate_init_all_links(mvm, vif, sta, false);
iwl_mvm_rs_rate_init_all_links(mvm, vif, sta);

if (!sta->tdls) {
/* Set this but don't call iwl_mvm_mac_ctxt_changed()
Expand Down Expand Up @@ -3987,7 +3990,7 @@ void iwl_mvm_sta_rc_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (changed & (IEEE80211_RC_BW_CHANGED |
IEEE80211_RC_SUPP_RATES_CHANGED |
IEEE80211_RC_NSS_CHANGED))
iwl_mvm_rs_rate_init_all_links(mvm, vif, sta, true);
iwl_mvm_rs_rate_init_all_links(mvm, vif, sta);

if (vif->type == NL80211_IFTYPE_STATION &&
changed & IEEE80211_RC_NSS_CHANGED)
Expand Down
14 changes: 7 additions & 7 deletions drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,12 @@ u16 rs_fw_get_max_amsdu_len(struct ieee80211_sta *sta,
return 0;
}

void rs_fw_rate_init(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_bss_conf *link_conf,
struct ieee80211_link_sta *link_sta,
enum nl80211_band band, bool update)
void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_bss_conf *link_conf,
struct ieee80211_link_sta *link_sta,
enum nl80211_band band)
{
struct ieee80211_hw *hw = mvm->hw;
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
Expand All @@ -579,7 +579,7 @@ void rs_fw_rate_init(struct iwl_mvm *mvm,
struct iwl_mvm_link_sta *mvm_link_sta;
struct iwl_lq_sta_rs_fw *lq_sta;
struct iwl_tlc_config_cmd_v4 cfg_cmd = {
.max_ch_width = update ?
.max_ch_width = mvmsta->authorized ?
rs_fw_bw_from_sta_bw(link_sta) : IWL_TLC_MNG_CH_WIDTH_20MHZ,
.flags = cpu_to_le16(rs_fw_get_config_flags(mvm, vif, link_sta,
sband)),
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/wireless/intel/iwlwifi/mvm/rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3017,7 +3017,7 @@ static void rs_drv_rate_update(void *mvm_r,

iwl_mvm_rs_rate_init(mvm, mvmsta->vif, sta,
&mvmsta->vif->bss_conf, &sta->deflink,
sband->band, true);
sband->band);
}

static void __iwl_mvm_rs_tx_status(struct iwl_mvm *mvm,
Expand Down Expand Up @@ -4106,11 +4106,11 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm,
struct ieee80211_sta *sta,
struct ieee80211_bss_conf *link_conf,
struct ieee80211_link_sta *link_sta,
enum nl80211_band band, bool update)
enum nl80211_band band)
{
if (iwl_mvm_has_tlc_offload(mvm)) {
rs_fw_rate_init(mvm, vif, sta, link_conf,
link_sta, band, update);
iwl_mvm_rs_fw_rate_init(mvm, vif, sta, link_conf,
link_sta, band);
} else {
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);

Expand Down
14 changes: 7 additions & 7 deletions drivers/net/wireless/intel/iwlwifi/mvm/rs.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm,
struct ieee80211_sta *sta,
struct ieee80211_bss_conf *link_conf,
struct ieee80211_link_sta *link_sta,
enum nl80211_band band, bool update);
enum nl80211_band band);

/* Notify RS about Tx status */
void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
Expand Down Expand Up @@ -440,12 +440,12 @@ void iwl_mvm_rs_add_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta);
void iwl_mvm_rs_add_sta_link(struct iwl_mvm *mvm,
struct iwl_mvm_link_sta *link_sta);

void rs_fw_rate_init(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_bss_conf *link_conf,
struct ieee80211_link_sta *link_sta,
enum nl80211_band band, bool update);
void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_bss_conf *link_conf,
struct ieee80211_link_sta *link_sta,
enum nl80211_band band);
int rs_fw_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
bool enable);
void iwl_mvm_tlc_update_notif(struct iwl_mvm *mvm,
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/intel/iwlwifi/mvm/sta.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ struct iwl_mvm_link_sta {
* @tid_disable_agg: bitmap: if bit(tid) is set, the fw won't send ampdus for
* tid.
* @sta_type: station type
* @authorized: indicates station is authorized
* @sta_state: station state according to enum %ieee80211_sta_state
* @bt_reduced_txpower: is reduced tx power enabled for this station
* @next_status_eosp: the next reclaimed packet is a PS-Poll response and
Expand Down Expand Up @@ -409,6 +410,7 @@ struct iwl_mvm_sta {
enum ieee80211_sta_state sta_state;
bool bt_reduced_txpower;
bool next_status_eosp;
bool authorized;
spinlock_t lock;
struct iwl_mvm_tid_data tid_data[IWL_MAX_TID_COUNT + 1];
u8 tid_to_baid[IWL_MAX_TID_COUNT];
Expand Down

0 comments on commit 15d4183

Please sign in to comment.