OSDN Git Service

wifi: iwlwifi: mvm: add stop_ap() and leave_ibss() callbacks for MLD mode
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Mon, 20 Mar 2023 10:33:10 +0000 (12:33 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 22 Mar 2023 12:16:36 +0000 (13:16 +0100)
This is another patch in the series adding all the ops
for the new MLD ieee80211_ops.
The callbacks added here use the new MLD FW API

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230320122330.42b0d4726b8d.I0755baace47c0ab1d9d70137448125d3140ef3af@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index 165358a..c6eb4cb 100644 (file)
@@ -2826,16 +2826,15 @@ static int iwl_mvm_start_ibss(struct ieee80211_hw *hw,
        return iwl_mvm_start_ap_ibss(hw, vif, &vif->bss_conf);
 }
 
-static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
-                                struct ieee80211_vif *vif,
-                                struct ieee80211_bss_conf *link_conf)
+/* Common part for MLD and non-MLD ops */
+void iwl_mvm_stop_ap_ibss_common(struct iwl_mvm *mvm,
+                                struct ieee80211_vif *vif)
 {
-       struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
-       iwl_mvm_prepare_mac_removal(mvm, vif);
+       lockdep_assert_held(&mvm->mutex);
 
-       mutex_lock(&mvm->mutex);
+       iwl_mvm_prepare_mac_removal(mvm, vif);
 
        /* Handle AP stop while in CSA */
        if (rcu_access_pointer(mvm->csa_vif) == vif) {
@@ -2860,6 +2859,17 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
        }
 
        iwl_mvm_bt_coex_vif_change(mvm);
+}
+
+static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,
+                                struct ieee80211_vif *vif,
+                                struct ieee80211_bss_conf *link_conf)
+{
+       struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
+
+       mutex_lock(&mvm->mutex);
+
+       iwl_mvm_stop_ap_ibss_common(mvm, vif);
 
        /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
        if (vif->p2p && mvm->p2p_device_vif)
index 866415d..f800bf0 100644 (file)
@@ -322,10 +322,40 @@ out_unlock:
        return ret;
 }
 
+static void iwl_mvm_mld_stop_ap_ibss(struct ieee80211_hw *hw,
+                                    struct ieee80211_vif *vif)
+{
+       struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
+
+       mutex_lock(&mvm->mutex);
+
+       iwl_mvm_stop_ap_ibss_common(mvm, vif);
+
+       /* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
+       if (vif->p2p && mvm->p2p_device_vif)
+               iwl_mvm_mld_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false);
+
+       iwl_mvm_ftm_responder_clear(mvm, vif);
+
+       iwl_mvm_mld_rm_bcast_sta(mvm, vif);
+       iwl_mvm_mld_rm_mcast_sta(mvm, vif);
+
+       /* Link needs to be deactivated before removal */
+       iwl_mvm_link_changed(mvm, vif, LINK_CONTEXT_MODIFY_ACTIVE, false);
+       iwl_mvm_remove_link(mvm, vif);
+
+       iwl_mvm_power_update_mac(mvm);
+
+       iwl_mvm_mld_mac_ctxt_remove(mvm, vif);
+
+       mutex_unlock(&mvm->mutex);
+}
+
 const struct ieee80211_ops iwl_mvm_mld_hw_ops = {
        .add_interface = iwl_mvm_mld_mac_add_interface,
        .remove_interface = iwl_mvm_mld_mac_remove_interface,
        .assign_vif_chanctx = iwl_mvm_mld_assign_vif_chanctx,
        .unassign_vif_chanctx = iwl_mvm_mld_unassign_vif_chanctx,
        .join_ibss = iwl_mvm_mld_start_ap_ibss,
+       .leave_ibss = iwl_mvm_mld_stop_ap_ibss,
 };
index a21ccbf..a03c2e5 100644 (file)
@@ -1769,6 +1769,8 @@ int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
 /* AP and IBSS */
 bool iwl_mvm_start_ap_ibss_common(struct ieee80211_hw *hw,
                                  struct ieee80211_vif *vif, int *ret);
+void iwl_mvm_stop_ap_ibss_common(struct iwl_mvm *mvm,
+                                struct ieee80211_vif *vif);
 
 /* Quota management */
 static inline size_t iwl_mvm_quota_cmd_size(struct iwl_mvm *mvm)