Commit 9371ac0d authored by Johannes Berg's avatar Johannes Berg

wifi: iwlwifi: mvm: initialize per-link STA ratescale data

When allocating a new link station, initialize the ratescaling
data for it. To do that, refactor the initialization code out
into a new iwl_mvm_rs_add_sta_link() function.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230417113648.441b6a8c60fd.I34f1b3555c25aaa22cc34d1112fc3b6393a20b7c@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 8884730e
......@@ -1126,6 +1126,8 @@ int iwl_mvm_mld_update_sta_links(struct iwl_mvm *mvm,
goto err;
link_sta_added_to_fw |= BIT(link_id);
iwl_mvm_rs_add_sta_link(mvm, mvm_sta_link);
}
if (sta_mask_added) {
......
......@@ -679,6 +679,26 @@ int rs_fw_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
return 0;
}
void iwl_mvm_rs_add_sta_link(struct iwl_mvm *mvm,
struct iwl_mvm_link_sta *link_sta)
{
struct iwl_lq_sta_rs_fw *lq_sta;
lq_sta = &link_sta->lq_sta.rs_fw;
lq_sta->pers.drv = mvm;
lq_sta->pers.sta_id = link_sta->sta_id;
lq_sta->pers.chains = 0;
memset(lq_sta->pers.chain_signal, 0,
sizeof(lq_sta->pers.chain_signal));
lq_sta->pers.last_rssi = S8_MIN;
lq_sta->last_rate_n_flags = 0;
#ifdef CONFIG_MAC80211_DEBUGFS
lq_sta->pers.dbg_fixed_rate = 0;
#endif
}
void iwl_mvm_rs_add_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta)
{
unsigned int link_id;
......@@ -686,25 +706,12 @@ void iwl_mvm_rs_add_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta)
IWL_DEBUG_RATE(mvm, "create station rate scale window\n");
for (link_id = 0; link_id < ARRAY_SIZE(mvmsta->link); link_id++) {
struct iwl_lq_sta_rs_fw *lq_sta;
struct iwl_mvm_link_sta *link =
rcu_dereference_protected(mvmsta->link[link_id],
lockdep_is_held(&mvm->mutex));
if (!link)
continue;
lq_sta = &link->lq_sta.rs_fw;
lq_sta->pers.drv = mvm;
lq_sta->pers.sta_id = link->sta_id;
lq_sta->pers.chains = 0;
memset(lq_sta->pers.chain_signal, 0,
sizeof(lq_sta->pers.chain_signal));
lq_sta->pers.last_rssi = S8_MIN;
lq_sta->last_rate_n_flags = 0;
#ifdef CONFIG_MAC80211_DEBUGFS
lq_sta->pers.dbg_fixed_rate = 0;
#endif
iwl_mvm_rs_add_sta_link(mvm, link);
}
}
......@@ -434,7 +434,12 @@ int iwl_mvm_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
void iwl_mvm_reset_frame_stats(struct iwl_mvm *mvm);
#endif
struct iwl_mvm_link_sta;
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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment