Commit 8a919a78 authored by Miri Korenblit's avatar Miri Korenblit Committed by Johannes Berg

wifi: iwlwifi: mvm: refactor __iwl_mvm_assign_vif_chanctx()

Since parts of the functionality of this function is going to be used
also by the MLD version of it, put in a separate function the parts
that are common for both MLD and non-MLD modes.
The common function will later be used in the MLD ops.
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.844755701cac.I1c650718ad2381eabc38f4103c1aac67936a1ffc@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 60efeca1
...@@ -4405,15 +4405,21 @@ static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw, ...@@ -4405,15 +4405,21 @@ static void iwl_mvm_change_chanctx(struct ieee80211_hw *hw,
mutex_unlock(&mvm->mutex); mutex_unlock(&mvm->mutex);
} }
static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm, /*
* This function executes the common part for MLD and non-MLD modes.
*
* Returns true if we're done assigning the chanctx
* (either on failure or success)
*/
static bool __iwl_mvm_assign_vif_chanctx_common(struct iwl_mvm *mvm,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *ctx, struct ieee80211_chanctx_conf *ctx,
bool switching_chanctx) bool switching_chanctx,
int *ret)
{ {
u16 *phy_ctxt_id = (u16 *)ctx->drv_priv; u16 *phy_ctxt_id = (u16 *)ctx->drv_priv;
struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id]; struct iwl_mvm_phy_ctxt *phy_ctxt = &mvm->phy_ctxts[*phy_ctxt_id];
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
int ret;
lockdep_assert_held(&mvm->mutex); lockdep_assert_held(&mvm->mutex);
...@@ -4432,19 +4438,32 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm, ...@@ -4432,19 +4438,32 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
* The AP binding flow is handled as part of the start_ap flow * The AP binding flow is handled as part of the start_ap flow
* (in bss_info_changed), similarly for IBSS. * (in bss_info_changed), similarly for IBSS.
*/ */
ret = 0; *ret = 0;
goto out; return true;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
mvmvif->csa_bcn_pending = false;
break; break;
case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_MONITOR:
/* always disable PS when a monitor interface is active */ /* always disable PS when a monitor interface is active */
mvmvif->ps_disabled = true; mvmvif->ps_disabled = true;
break; break;
default: default:
ret = -EINVAL; *ret = -EINVAL;
goto out; return true;
} }
return false;
}
static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *ctx,
bool switching_chanctx)
{
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
int ret;
if (__iwl_mvm_assign_vif_chanctx_common(mvm, vif, ctx,
switching_chanctx, &ret))
goto out;
ret = iwl_mvm_binding_add_vif(mvm, vif); ret = iwl_mvm_binding_add_vif(mvm, vif);
if (ret) if (ret)
...@@ -4478,7 +4497,12 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm, ...@@ -4478,7 +4497,12 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL);
} }
if (switching_chanctx && vif->type == NL80211_IFTYPE_STATION) { if (vif->type == NL80211_IFTYPE_STATION) {
if (!switching_chanctx) {
mvmvif->csa_bcn_pending = false;
goto out;
}
mvmvif->csa_bcn_pending = true; mvmvif->csa_bcn_pending = true;
if (!fw_has_capa(&mvm->fw->ucode_capa, if (!fw_has_capa(&mvm->fw->ucode_capa,
...@@ -4506,6 +4530,7 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm, ...@@ -4506,6 +4530,7 @@ static int __iwl_mvm_assign_vif_chanctx(struct iwl_mvm *mvm,
mvmvif->phy_ctxt = NULL; mvmvif->phy_ctxt = NULL;
return ret; return ret;
} }
static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw, static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf, struct ieee80211_bss_conf *link_conf,
......
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