Skip to content

Commit 6895d74

Browse files
committed
wifi: iwlwifi: mld: initialize regulatory early
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 <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250309073442.10ab8fed94e9.I7c8dee3d14c7427a56882739f82546c6492f3b10@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 8d006c9 commit 6895d74

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

drivers/net/wireless/intel/iwlwifi/mld/fw.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ int iwl_mld_load_fw(struct iwl_mld *mld)
339339
if (ret)
340340
return ret;
341341

342+
ret = iwl_mld_init_mcc(mld);
343+
if (ret)
344+
return ret;
345+
342346
mld->fw_status.running = true;
343347

344348
return 0;
@@ -481,10 +485,6 @@ static int iwl_mld_config_fw(struct iwl_mld *mld)
481485
if (ret)
482486
return ret;
483487

484-
ret = iwl_mld_init_mcc(mld);
485-
if (ret)
486-
return ret;
487-
488488
if (mld->fw_status.in_hw_restart) {
489489
iwl_mld_send_recovery_cmd(mld, ERROR_RECOVERY_UPDATE_DB);
490490
iwl_mld_time_sync_fw_config(mld);

drivers/net/wireless/intel/iwlwifi/mld/mac80211.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,6 @@ static void iwl_mld_hw_set_security(struct iwl_mld *mld)
164164
NL80211_EXT_FEATURE_BEACON_PROTECTION);
165165
}
166166

167-
static void iwl_mld_hw_set_regulatory(struct iwl_mld *mld)
168-
{
169-
struct wiphy *wiphy = mld->wiphy;
170-
171-
wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
172-
wiphy->regulatory_flags |= REGULATORY_ENABLE_RELAX_NO_IR;
173-
}
174-
175167
static void iwl_mld_hw_set_antennas(struct iwl_mld *mld)
176168
{
177169
struct wiphy *wiphy = mld->wiphy;
@@ -415,7 +407,6 @@ int iwl_mld_register_hw(struct iwl_mld *mld)
415407
iwl_mld_hw_set_addresses(mld);
416408
iwl_mld_hw_set_channels(mld);
417409
iwl_mld_hw_set_security(mld);
418-
iwl_mld_hw_set_regulatory(mld);
419410
iwl_mld_hw_set_pm(mld);
420411
iwl_mld_hw_set_antennas(mld);
421412
iwl_mac_hw_set_radiotap(mld);

drivers/net/wireless/intel/iwlwifi/mld/mld.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Copyright (C) 2024-2025 Intel Corporation
44
*/
5-
5+
#include <linux/rtnetlink.h>
66
#include <net/mac80211.h>
77

88
#include "fw/api/rx.h"
@@ -50,6 +50,14 @@ static void __exit iwl_mld_exit(void)
5050
}
5151
module_exit(iwl_mld_exit);
5252

53+
static void iwl_mld_hw_set_regulatory(struct iwl_mld *mld)
54+
{
55+
struct wiphy *wiphy = mld->wiphy;
56+
57+
wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
58+
wiphy->regulatory_flags |= REGULATORY_ENABLE_RELAX_NO_IR;
59+
}
60+
5361
VISIBLE_IF_IWLWIFI_KUNIT
5462
void iwl_construct_mld(struct iwl_mld *mld, struct iwl_trans *trans,
5563
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,
6775

6876
/* Setup async RX handling */
6977
spin_lock_init(&mld->async_handlers_lock);
70-
INIT_LIST_HEAD(&mld->async_handlers_list);
7178
wiphy_work_init(&mld->async_handlers_wk,
7279
iwl_mld_async_handlers_wk);
7380

@@ -387,9 +394,13 @@ iwl_op_mode_mld_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
387394
iwl_bios_setup_step(trans, &mld->fwrt);
388395
mld->bios_enable_puncturing = iwl_uefi_get_puncturing(&mld->fwrt);
389396

397+
iwl_mld_hw_set_regulatory(mld);
398+
390399
/* Configure transport layer with the opmode specific params */
391400
iwl_mld_configure_trans(op_mode);
392401

402+
/* needed for regulatory init */
403+
rtnl_lock();
393404
/* Needed for sending commands */
394405
wiphy_lock(mld->wiphy);
395406

@@ -401,13 +412,15 @@ iwl_op_mode_mld_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
401412

402413
if (ret) {
403414
wiphy_unlock(mld->wiphy);
415+
rtnl_unlock();
404416
iwl_fw_flush_dumps(&mld->fwrt);
405417
goto free_hw;
406418
}
407419

408420
iwl_mld_stop_fw(mld);
409421

410422
wiphy_unlock(mld->wiphy);
423+
rtnl_unlock();
411424

412425
ret = iwl_mld_leds_init(mld);
413426
if (ret)

0 commit comments

Comments
 (0)