]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: mld: initialize regulatory early
authorJohannes Berg <johannes.berg@intel.com>
Sun, 9 Mar 2025 05:36:44 +0000 (07:36 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 11 Mar 2025 15:29:24 +0000 (16:29 +0100)
Since iwlmld claims wiphys to be self-managed, it needs to
have a regdomain registered before the wiphy is registered
to avoid issues when trying to get the regdomain, e.g. via
"iw phy phy0 reg get".

Move the initialization early, on every FW start not just
when starting to really operate it. This also requires the
self-managed flag to be set early.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250309073442.10ab8fed94e9.I7c8dee3d14c7427a56882739f82546c6492f3b10@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mld/fw.c
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
drivers/net/wireless/intel/iwlwifi/mld/mld.c

index ec93af362cfc891228162993db5c2e857f9b5a59..9c1dce0d597978700a520c966b22682d9e95b6d5 100644 (file)
@@ -339,6 +339,10 @@ int iwl_mld_load_fw(struct iwl_mld *mld)
        if (ret)
                return ret;
 
+       ret = iwl_mld_init_mcc(mld);
+       if (ret)
+               return ret;
+
        mld->fw_status.running = true;
 
        return 0;
@@ -481,10 +485,6 @@ static int iwl_mld_config_fw(struct iwl_mld *mld)
        if (ret)
                return ret;
 
-       ret = iwl_mld_init_mcc(mld);
-       if (ret)
-               return ret;
-
        if (mld->fw_status.in_hw_restart) {
                iwl_mld_send_recovery_cmd(mld, ERROR_RECOVERY_UPDATE_DB);
                iwl_mld_time_sync_fw_config(mld);
index b01a41f9b01331232864ec1086023cbdffed5241..27ef41d694796bdc48baf1f1e7873aa89b509970 100644 (file)
@@ -164,14 +164,6 @@ static void iwl_mld_hw_set_security(struct iwl_mld *mld)
                              NL80211_EXT_FEATURE_BEACON_PROTECTION);
 }
 
-static void iwl_mld_hw_set_regulatory(struct iwl_mld *mld)
-{
-       struct wiphy *wiphy = mld->wiphy;
-
-       wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
-       wiphy->regulatory_flags |= REGULATORY_ENABLE_RELAX_NO_IR;
-}
-
 static void iwl_mld_hw_set_antennas(struct iwl_mld *mld)
 {
        struct wiphy *wiphy = mld->wiphy;
@@ -415,7 +407,6 @@ int iwl_mld_register_hw(struct iwl_mld *mld)
        iwl_mld_hw_set_addresses(mld);
        iwl_mld_hw_set_channels(mld);
        iwl_mld_hw_set_security(mld);
-       iwl_mld_hw_set_regulatory(mld);
        iwl_mld_hw_set_pm(mld);
        iwl_mld_hw_set_antennas(mld);
        iwl_mac_hw_set_radiotap(mld);
index adc3d23aa019fc6db6b364a519fc78a032c78a71..d4a99ae64074f122640df7befabe875cdcf8f2fb 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * Copyright (C) 2024-2025 Intel Corporation
  */
-
+#include <linux/rtnetlink.h>
 #include <net/mac80211.h>
 
 #include "fw/api/rx.h"
@@ -50,6 +50,14 @@ static void __exit iwl_mld_exit(void)
 }
 module_exit(iwl_mld_exit);
 
+static void iwl_mld_hw_set_regulatory(struct iwl_mld *mld)
+{
+       struct wiphy *wiphy = mld->wiphy;
+
+       wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
+       wiphy->regulatory_flags |= REGULATORY_ENABLE_RELAX_NO_IR;
+}
+
 VISIBLE_IF_IWLWIFI_KUNIT
 void iwl_construct_mld(struct iwl_mld *mld, struct iwl_trans *trans,
                       const struct iwl_cfg *cfg, const struct iwl_fw *fw,
@@ -67,7 +75,6 @@ void iwl_construct_mld(struct iwl_mld *mld, struct iwl_trans *trans,
 
        /* Setup async RX handling */
        spin_lock_init(&mld->async_handlers_lock);
-       INIT_LIST_HEAD(&mld->async_handlers_list);
        wiphy_work_init(&mld->async_handlers_wk,
                        iwl_mld_async_handlers_wk);
 
@@ -387,9 +394,13 @@ iwl_op_mode_mld_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
        iwl_bios_setup_step(trans, &mld->fwrt);
        mld->bios_enable_puncturing = iwl_uefi_get_puncturing(&mld->fwrt);
 
+       iwl_mld_hw_set_regulatory(mld);
+
        /* Configure transport layer with the opmode specific params */
        iwl_mld_configure_trans(op_mode);
 
+       /* needed for regulatory init */
+       rtnl_lock();
        /* Needed for sending commands */
        wiphy_lock(mld->wiphy);
 
@@ -401,6 +412,7 @@ iwl_op_mode_mld_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 
        if (ret) {
                wiphy_unlock(mld->wiphy);
+               rtnl_unlock();
                iwl_fw_flush_dumps(&mld->fwrt);
                goto free_hw;
        }
@@ -408,6 +420,7 @@ iwl_op_mode_mld_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
        iwl_mld_stop_fw(mld);
 
        wiphy_unlock(mld->wiphy);
+       rtnl_unlock();
 
        ret = iwl_mld_leds_init(mld);
        if (ret)