wifi: iwlwifi: mvm: remove nl80211 testmode
authorJohannes Berg <johannes.berg@intel.com>
Wed, 30 Apr 2025 12:57:29 +0000 (15:57 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 6 May 2025 19:22:11 +0000 (22:22 +0300)
This was used in the past for NoA and/or beacon filter
testing, but these days everything is tested via debugfs
or special FW commands, so remove the testmode.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250430155443.751018e0ed8e.I21557a9a3d57234187f1b0b2182a1714ecc66b9a@changeid
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
drivers/net/wireless/intel/iwlwifi/mvm/quota.c

index 70b2cdace86dc0131e0d6fc4be1d2d986865ad1f..d62c797775f24b920bd4f739e00e926a23f1cbb6 100644 (file)
@@ -1988,15 +1988,8 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
         * interface is be handled as part of the stop_ap flow.
         */
        if (vif->type == NL80211_IFTYPE_AP ||
-           vif->type == NL80211_IFTYPE_ADHOC) {
-#ifdef CONFIG_NL80211_TESTMODE
-               if (vif == mvm->noa_vif) {
-                       mvm->noa_vif = NULL;
-                       mvm->noa_duration = 0;
-               }
-#endif
+           vif->type == NL80211_IFTYPE_ADHOC)
                goto out;
-       }
 
        iwl_mvm_power_update_mac(mvm);
 
@@ -5526,70 +5519,6 @@ static int iwl_mvm_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
                                               &mvm_sta->vif->bss_conf);
 }
 
-#ifdef CONFIG_NL80211_TESTMODE
-static const struct nla_policy iwl_mvm_tm_policy[IWL_MVM_TM_ATTR_MAX + 1] = {
-       [IWL_MVM_TM_ATTR_CMD] = { .type = NLA_U32 },
-       [IWL_MVM_TM_ATTR_NOA_DURATION] = { .type = NLA_U32 },
-       [IWL_MVM_TM_ATTR_BEACON_FILTER_STATE] = { .type = NLA_U32 },
-};
-
-static int __iwl_mvm_mac_testmode_cmd(struct iwl_mvm *mvm,
-                                     struct ieee80211_vif *vif,
-                                     void *data, int len)
-{
-       struct nlattr *tb[IWL_MVM_TM_ATTR_MAX + 1];
-       int err;
-       u32 noa_duration;
-
-       err = nla_parse_deprecated(tb, IWL_MVM_TM_ATTR_MAX, data, len,
-                                  iwl_mvm_tm_policy, NULL);
-       if (err)
-               return err;
-
-       if (!tb[IWL_MVM_TM_ATTR_CMD])
-               return -EINVAL;
-
-       switch (nla_get_u32(tb[IWL_MVM_TM_ATTR_CMD])) {
-       case IWL_MVM_TM_CMD_SET_NOA:
-               if (!vif || vif->type != NL80211_IFTYPE_AP || !vif->p2p ||
-                   !vif->bss_conf.enable_beacon ||
-                   !tb[IWL_MVM_TM_ATTR_NOA_DURATION])
-                       return -EINVAL;
-
-               noa_duration = nla_get_u32(tb[IWL_MVM_TM_ATTR_NOA_DURATION]);
-               if (noa_duration >= vif->bss_conf.beacon_int)
-                       return -EINVAL;
-
-               mvm->noa_duration = noa_duration;
-               mvm->noa_vif = vif;
-
-               return iwl_mvm_update_quotas(mvm, true, NULL);
-       case IWL_MVM_TM_CMD_SET_BEACON_FILTER:
-               /* must be associated client vif - ignore authorized */
-               if (!vif || vif->type != NL80211_IFTYPE_STATION ||
-                   !vif->cfg.assoc || !vif->bss_conf.dtim_period ||
-                   !tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE])
-                       return -EINVAL;
-
-               if (nla_get_u32(tb[IWL_MVM_TM_ATTR_BEACON_FILTER_STATE]))
-                       return iwl_mvm_enable_beacon_filter(mvm, vif);
-               return iwl_mvm_disable_beacon_filter(mvm, vif);
-       }
-
-       return -EOPNOTSUPP;
-}
-
-int iwl_mvm_mac_testmode_cmd(struct ieee80211_hw *hw,
-                            struct ieee80211_vif *vif,
-                            void *data, int len)
-{
-       struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
-
-       guard(mvm)(mvm);
-       return __iwl_mvm_mac_testmode_cmd(mvm, vif, data, len);
-}
-#endif
-
 void iwl_mvm_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                            struct ieee80211_channel_switch *chsw)
 {
@@ -6649,8 +6578,6 @@ const struct ieee80211_ops iwl_mvm_hw_ops = {
 
        .sync_rx_queues = iwl_mvm_sync_rx_queues,
 
-       CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd)
-
 #ifdef CONFIG_PM_SLEEP
        /* look at d3.c */
        .suspend = iwl_mvm_suspend,
index 78d7153a0cfca00969a747e251b16c38d74756bd..bf24f8cb673e575c4fabe585af9b456d7a5979b7 100644 (file)
@@ -150,19 +150,6 @@ static void iwl_mvm_mld_mac_remove_interface(struct ieee80211_hw *hw,
 
        iwl_mvm_vif_dbgfs_rm_link(mvm, vif);
 
-       /* For AP/GO interface, the tear down of the resources allocated to the
-        * interface is be handled as part of the stop_ap flow.
-        */
-       if (vif->type == NL80211_IFTYPE_AP ||
-           vif->type == NL80211_IFTYPE_ADHOC) {
-#ifdef CONFIG_NL80211_TESTMODE
-               if (vif == mvm->noa_vif) {
-                       mvm->noa_vif = NULL;
-                       mvm->noa_duration = 0;
-               }
-#endif
-       }
-
        iwl_mvm_power_update_mac(mvm);
 
        /* Before the interface removal, mac80211 would cancel the ROC, and the
@@ -1403,8 +1390,6 @@ const struct ieee80211_ops iwl_mvm_mld_hw_ops = {
 
        .sync_rx_queues = iwl_mvm_sync_rx_queues,
 
-       CFG80211_TESTMODE_CMD(iwl_mvm_mac_testmode_cmd)
-
 #ifdef CONFIG_PM_SLEEP
        /* look at d3.c */
        .suspend = iwl_mvm_suspend,
index 6057b7c4267a47383ec3a2d36901177e08a3145e..4c03fdae43e3c1bfcff03d8d0a6c158fd3006c67 100644 (file)
@@ -1246,11 +1246,6 @@ struct iwl_mvm {
 
        struct iwl_time_quota_cmd last_quota_cmd;
 
-#ifdef CONFIG_NL80211_TESTMODE
-       u32 noa_duration;
-       struct ieee80211_vif *noa_vif;
-#endif
-
        /* Tx queues */
        u16 aux_queue;
        u16 snif_queue;
index aad2614af9adfe961b13dc13fe3aa05919a6262f..798a7e4bea83b63eec87112f26b025a464181e41 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2012-2014, 2018, 2021-2022 Intel Corporation
+ * Copyright (C) 2012-2014, 2018, 2021-2022, 2025 Intel Corporation
  * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -86,45 +86,6 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
        }
 }
 
-static void iwl_mvm_adjust_quota_for_noa(struct iwl_mvm *mvm,
-                                        struct iwl_time_quota_cmd *cmd)
-{
-#ifdef CONFIG_NL80211_TESTMODE
-       struct iwl_mvm_vif *mvmvif;
-       int i, phy_id = -1, beacon_int = 0;
-
-       if (!mvm->noa_duration || !mvm->noa_vif)
-               return;
-
-       mvmvif = iwl_mvm_vif_from_mac80211(mvm->noa_vif);
-       if (!mvmvif->ap_ibss_active)
-               return;
-
-       phy_id = mvmvif->deflink.phy_ctxt->id;
-       beacon_int = mvm->noa_vif->bss_conf.beacon_int;
-
-       for (i = 0; i < MAX_BINDINGS; i++) {
-               struct iwl_time_quota_data *data =
-                                       iwl_mvm_quota_cmd_get_quota(mvm, cmd,
-                                                                   i);
-               u32 id_n_c = le32_to_cpu(data->id_and_color);
-               u32 id = (id_n_c & FW_CTXT_ID_MSK) >> FW_CTXT_ID_POS;
-               u32 quota = le32_to_cpu(data->quota);
-
-               if (id != phy_id)
-                       continue;
-
-               quota *= (beacon_int - mvm->noa_duration);
-               quota /= beacon_int;
-
-               IWL_DEBUG_QUOTA(mvm, "quota: adjust for NoA from %d to %d\n",
-                               le32_to_cpu(data->quota), quota);
-
-               data->quota = cpu_to_le32(quota);
-       }
-#endif
-}
-
 int iwl_mvm_update_quotas(struct iwl_mvm *mvm,
                          bool force_update,
                          struct ieee80211_vif *disabled_vif)
@@ -260,8 +221,6 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm,
                }
        }
 
-       iwl_mvm_adjust_quota_for_noa(mvm, &cmd);
-
        /* check that we have non-zero quota for all valid bindings */
        for (i = 0; i < MAX_BINDINGS; i++) {
                qdata = iwl_mvm_quota_cmd_get_quota(mvm, &cmd, i);