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

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@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 8884730e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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) {
+21 −14
Original line number Diff line number Diff line
@@ -679,24 +679,15 @@ int rs_fw_tx_protection(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
	return 0;
}

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)
{
	unsigned int link_id;

	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 = &link_sta->lq_sta.rs_fw;

	lq_sta->pers.drv = mvm;
		lq_sta->pers.sta_id = link->sta_id;
	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));
@@ -707,4 +698,20 @@ void iwl_mvm_rs_add_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta)
	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;

	IWL_DEBUG_RATE(mvm, "create station rate scale window\n");

	for (link_id = 0; link_id < ARRAY_SIZE(mvmsta->link); link_id++) {
		struct iwl_mvm_link_sta *link =
			rcu_dereference_protected(mvmsta->link[link_id],
						  lockdep_is_held(&mvm->mutex));
		if (!link)
			continue;

		iwl_mvm_rs_add_sta_link(mvm, link);
	}
}
+5 −0
Original line number Diff line number Diff line
@@ -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,