wifi: iwlwifi: mvm: fix regdb initialization
authorGregory Greenman <gregory.greenman@intel.com>
Tue, 17 Oct 2023 09:16:49 +0000 (12:16 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 23 Oct 2023 10:48:30 +0000 (12:48 +0200)
In order to get regulatory domain, driver sends MCC_UPDATE_CMD to the
FW. One of the parameters in the response is the status which can tell
if the regdomain has changed or not.

When iwl_mvm_init_mcc() is called during iwl_op_mode_mvm_start(), then
sband is still NULL and channel parameters (i.e. chan->flags)  cannot be
initialized. When, further in the flow, iwl_mvm_update_mcc() is called
during iwl_mvm_up(), it first checks if the regdomain has changed and
then skips the update if it remains the same. But, since channel
parameters weren't initialized yet, the update should be forced in this
codepath. Fix that by adding a corresponding parameter to
iwl_mvm_init_fw_regd().

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231017115047.78b2c5b891b0.Iac49d52e0bfc0317372015607c63ea9276bbb188@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/nvm.c

index 46ee280231eae93a32a5890b6e2f60bdaff1147a..92c45571bd6917b7a474ce70e132fe62d1935dad 100644 (file)
@@ -818,7 +818,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        if (ret)
                IWL_ERR(mvm, "Failed to send quota: %d\n", ret);
 
-       if (iwl_mvm_is_lar_supported(mvm) && iwl_mvm_init_fw_regd(mvm))
+       if (iwl_mvm_is_lar_supported(mvm) && iwl_mvm_init_fw_regd(mvm, false))
                IWL_ERR(mvm, "Failed to initialize D3 LAR information\n");
 
        return 0;
index 28da98e75e52223d4bbccf56adfa2fb37039025c..bb330f1b5d9e3216e7b1193845365b807b9d8fd1 100644 (file)
@@ -186,7 +186,7 @@ struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm,
                                     MCC_SOURCE_OLD_FW, changed);
 }
 
-int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm)
+int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm, bool force_regd_sync)
 {
        enum iwl_mcc_source used_src;
        struct ieee80211_regdomain *regd;
@@ -213,8 +213,10 @@ int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm)
        if (IS_ERR_OR_NULL(regd))
                return -EIO;
 
-       /* update cfg80211 if the regdomain was changed */
-       if (changed)
+       /* update cfg80211 if the regdomain was changed or the caller explicitly
+        * asked to update regdomain
+        */
+       if (changed || force_regd_sync)
                ret = regulatory_set_wiphy_regd_sync(mvm->hw->wiphy, regd);
        else
                ret = 0;
index 81f7b0a644f9bc1a9ebd6f897c6c71544fd29205..760cebf22feeb8abcf2baece84d3d8f31e550025 100644 (file)
@@ -2241,7 +2241,7 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
                                                  bool *changed);
 struct ieee80211_regdomain *iwl_mvm_get_current_regdomain(struct iwl_mvm *mvm,
                                                          bool *changed);
-int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm);
+int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm, bool force_regd_sync);
 void iwl_mvm_update_changed_regdom(struct iwl_mvm *mvm);
 
 /* smart fifo */
index 17a1e5717ddef632efb4769ec48e4b1b4514de20..c0dd441e800ec9ccc4fb1e459f3a969b1af10b3f 100644 (file)
@@ -573,7 +573,7 @@ int iwl_mvm_init_mcc(struct iwl_mvm *mvm)
         * try to replay the last set MCC to FW. If it doesn't exist,
         * queue an update to cfg80211 to retrieve the default alpha2 from FW.
         */
-       retval = iwl_mvm_init_fw_regd(mvm);
+       retval = iwl_mvm_init_fw_regd(mvm, true);
        if (retval != -ENOENT)
                return retval;