]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
iwlwifi: fix WGDS check when WRDS is disabled
authorLuca Coelho <luciano.coelho@intel.com>
Fri, 17 Apr 2020 10:37:11 +0000 (13:37 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 21 Apr 2020 12:40:30 +0000 (15:40 +0300)
In the reference BIOS implementation, WRDS can be disabled without
disabling WGDS.  And this happens in most cases where WRDS is
disabled, causing the WGDS without WRDS check and issue an error.

To avoid this issue, we change the check so that we only considered it
an error if the WRDS entry doesn't exist.  If the entry (or the
selected profile is disabled for any other reason), we just silently
ignore WGDS.

Cc: stable@vger.kernel.org # 4.14+
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205513
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20200417133700.72ad25c3998b.I875d935cefd595ed7f640ddcfc7bc802627d2b7f@changeid
drivers/net/wireless/intel/iwlwifi/fw/acpi.c
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index ba2aff3af0fe9218ed1311e0e56a0c1d95f0a283..e3a33388be701464949af1c0d8e08518247233b9 100644 (file)
@@ -296,9 +296,14 @@ int iwl_sar_select_profile(struct iwl_fw_runtime *fwrt,
                if (!prof->enabled) {
                        IWL_DEBUG_RADIO(fwrt, "SAR profile %d is disabled.\n",
                                        profs[i]);
-                       /* if one of the profiles is disabled, we fail all */
-                       return -ENOENT;
+                       /*
+                        * if one of the profiles is disabled, we
+                        * ignore all of them and return 1 to
+                        * differentiate disabled from other failures.
+                        */
+                       return 1;
                }
+
                IWL_DEBUG_INFO(fwrt,
                               "SAR EWRD: chain %d profile index %d\n",
                               i, profs[i]);
index a4038f289ab31244c1681e37044724a814104ca1..e67c452fa92cff0b09d75f03fcfc3c984ea0246a 100644 (file)
@@ -727,6 +727,7 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
                struct iwl_dev_tx_power_cmd_v4 v4;
        } cmd;
 
+       int ret;
        u16 len = 0;
 
        cmd.v5.v3.set_mode = cpu_to_le32(IWL_TX_POWER_MODE_SET_CHAINS);
@@ -741,9 +742,14 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
                len = sizeof(cmd.v4.v3);
 
 
-       if (iwl_sar_select_profile(&mvm->fwrt, cmd.v5.v3.per_chain_restriction,
-                                  prof_a, prof_b))
-               return -ENOENT;
+       ret = iwl_sar_select_profile(&mvm->fwrt,
+                                    cmd.v5.v3.per_chain_restriction,
+                                    prof_a, prof_b);
+
+       /* return on error or if the profile is disabled (positive number) */
+       if (ret)
+               return ret;
+
        IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n");
        return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd);
 }
@@ -1034,16 +1040,7 @@ static int iwl_mvm_sar_init(struct iwl_mvm *mvm)
                                "EWRD SAR BIOS table invalid or unavailable. (%d)\n",
                                ret);
 
-       ret = iwl_mvm_sar_select_profile(mvm, 1, 1);
-       /*
-        * If we don't have profile 0 from BIOS, just skip it.  This
-        * means that SAR Geo will not be enabled either, even if we
-        * have other valid profiles.
-        */
-       if (ret == -ENOENT)
-               return 1;
-
-       return ret;
+       return iwl_mvm_sar_select_profile(mvm, 1, 1);
 }
 
 static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm)
@@ -1272,7 +1269,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
        ret = iwl_mvm_sar_init(mvm);
        if (ret == 0) {
                ret = iwl_mvm_sar_geo_init(mvm);
-       } else if (ret > 0 && !iwl_sar_get_wgds_table(&mvm->fwrt)) {
+       } else if (ret == -ENOENT && !iwl_sar_get_wgds_table(&mvm->fwrt)) {
                /*
                 * If basic SAR is not available, we check for WGDS,
                 * which should *not* be available either.  If it is