Commit d51439a6 authored by Ariel Malamud's avatar Ariel Malamud Committed by Johannes Berg
Browse files

wifi: iwlwifi: mvm: Refactor iwl_mvm_get_lmac_id()



The iwl_mvm_get_lmac_id() function is currently
defined as a static inline function under fw/api
and receives mvm's fw pointer. It will need the
ability to access other mvm struct members for
future capabilities such as debug. Move the function
out of the fw/api and into mvm proper as a regular
function and have it receive the pointer to mvm.

Signed-off-by: default avatarAriel Malamud <ariel.malamud@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230613155501.507b2f9f64eb.I0ec91310e1911c33faf396b5e17bcb11a164f6ea@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent ff75c21c
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -59,14 +59,6 @@ struct iwl_binding_cmd {
#define IWL_LMAC_24G_INDEX		0
#define IWL_LMAC_5G_INDEX		1

static inline u32 iwl_mvm_get_lmac_id(const struct iwl_fw *fw,
				      enum nl80211_band band){
	if (!fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_CDB_SUPPORT) ||
	    band == NL80211_BAND_2GHZ)
		return IWL_LMAC_24G_INDEX;
	return IWL_LMAC_5G_INDEX;
}

/* The maximal number of fragments in the FW's schedule session */
#define IWL_MVM_MAX_QUOTA 128

+9 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ static int iwl_mvm_binding_cmd(struct iwl_mvm *mvm, u32 action,
	if (fw_has_capa(&mvm->fw->ucode_capa,
			IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT)) {
		size = sizeof(cmd);
		cmd.lmac_id = cpu_to_le32(iwl_mvm_get_lmac_id(mvm->fw,
		cmd.lmac_id = cpu_to_le32(iwl_mvm_get_lmac_id(mvm,
							      phyctxt->channel->band));
	} else {
		size = IWL_BINDING_CMD_SIZE_V1;
@@ -164,3 +164,11 @@ int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif)

	return ret;
}

u32 iwl_mvm_get_lmac_id(struct iwl_mvm *mvm, enum nl80211_band band)
{
	if (!fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_CDB_SUPPORT) ||
	    band == NL80211_BAND_2GHZ)
		return IWL_LMAC_24G_INDEX;
	return IWL_LMAC_5G_INDEX;
}
+1 −1
Original line number Diff line number Diff line
@@ -4595,7 +4595,7 @@ int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif,

	switch (vif->type) {
	case NL80211_IFTYPE_STATION:
		lmac_id = iwl_mvm_get_lmac_id(mvm->fw, channel->band);
		lmac_id = iwl_mvm_get_lmac_id(mvm, channel->band);

		/* Use aux roc framework (HS20) */
		ret = ops->add_aux_sta_for_hs20(mvm, lmac_id);
+1 −0
Original line number Diff line number Diff line
@@ -1841,6 +1841,7 @@ void iwl_mvm_channel_switch_error_notif(struct iwl_mvm *mvm,
/* Bindings */
int iwl_mvm_binding_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
int iwl_mvm_binding_remove_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
u32 iwl_mvm_get_lmac_id(struct iwl_mvm *mvm, enum nl80211_band band);

/* Links */
int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+1 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
				      struct cfg80211_chan_def *chandef,
				      u8 chains_static, u8 chains_dynamic)
{
	cmd->lmac_id = cpu_to_le32(iwl_mvm_get_lmac_id(mvm->fw,
	cmd->lmac_id = cpu_to_le32(iwl_mvm_get_lmac_id(mvm,
						       chandef->chan->band));

	/* Set the channel info data */
Loading