2020-04-17 10:39:38

by Luca Coelho

[permalink] [raw]
Subject: [PATCH v2 v5.7] iwlwifi: fix WGDS check when WRDS is disabled

From: Luca Coelho <[email protected]>

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: [email protected] # 4.14+
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205513
Signed-off-by: Luca Coelho <[email protected]>
---
drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 9 +++++--
drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 25 +++++++++-----------
2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
index ba2aff3af0fe..e3a33388be70 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/acpi.c
@@ -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]);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index a4038f289ab3..e67c452fa92c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -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
--
2.25.1


2020-04-21 12:41:50

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2 v5.7] iwlwifi: fix WGDS check when WRDS is disabled

Luca Coelho <[email protected]> wrote:

> From: Luca Coelho <[email protected]>
>
> 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: [email protected] # 4.14+
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205513
> Signed-off-by: Luca Coelho <[email protected]>

Patch applied to wireless-drivers.git, thanks.

1edd56e69dca iwlwifi: fix WGDS check when WRDS is disabled

--
https://patchwork.kernel.org/patch/11494719/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2020-04-21 19:56:55

by Sasha Levin

[permalink] [raw]
Subject: Re: [PATCH v2 v5.7] iwlwifi: fix WGDS check when WRDS is disabled

Hi

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: 4.14+

The bot has tested the following trees: v5.6.5, v5.5.18, v5.4.33, v4.19.116, v4.14.176.

v5.6.5: Build OK!
v5.5.18: Build OK!
v5.4.33: Failed to apply! Possible dependencies:
39c1a9728f93 ("iwlwifi: refactor the SAR tables from mvm to acpi")

v4.19.116: Failed to apply! Possible dependencies:
0791c2fce3c8 ("iwlwifi: mvm: support new reduce tx power FW API.")
17b809c9b22e ("iwlwifi: dbg: move debug data to a struct")
22463857a16b ("iwlwifi: receive umac and lmac error table addresses from TLVs")
2d8c261511ab ("iwlwifi: add d3 debug data support")
39c1a9728f93 ("iwlwifi: refactor the SAR tables from mvm to acpi")
48e775e66e2d ("iwlwifi: mvm: add support for 32kHz external clock indication")
4c2f445c0f49 ("iwlwifi: mvm: skip EBS in low latency mode while fragmented scan isn't supported")
68025d5f9bfe ("iwlwifi: dbg: refactor dump code to improve readability")
8d534e96b500 ("iwlwifi: dbg_ini: create new dump flow and implement prph dump")
a6820511f193 ("iwlwifi: dbg: split iwl_fw_error_dump to two functions")
ae17404e3860 ("iwlwifi: avoid code duplication in stopping fw debug data recording")
c5f97542aa06 ("iwlwifi: change monitor DMA to be coherent")
d25eec305c97 ("iwlwifi: fw: add a restart FW debug function")
da7527173b18 ("iwlwifi: debug flow cleanup")
ea7c2bfdec6d ("Revert "iwlwifi: allow memory debug TLV to specify the memory type"")
f130bb75d881 ("iwlwifi: add FW recovery flow")

v4.14.176: Failed to apply! Possible dependencies:
1184611ee88f ("iwlwifi: acpi: move code that reads SPLC to acpi")
1c73acf58bd6 ("iwlwifi: acpi: move ACPI method definitions to acpi.h")
2fa388cfeb1a ("iwlwifi: acpi: generalize iwl_mvm_sar_find_wifi_pkg()")
39c1a9728f93 ("iwlwifi: refactor the SAR tables from mvm to acpi")
45a5c6f68b26 ("iwlwifi: acpi: use iwl_acpi_get_wifi_pkg when reading reading SPLC")
45f65569e0d9 ("iwlwifi: acpi: move function to get mcc into acpi code")
48e775e66e2d ("iwlwifi: mvm: add support for 32kHz external clock indication")
813df5cef3bb ("iwlwifi: acpi: add common code to read from ACPI")
ed1a962db760 ("iwlwifi: acpi: make iwl_get_bios_mcc() use the common acpi functions")


NOTE: The patch will not be queued to stable trees until it is upstream.

How should we proceed with this patch?

--
Thanks
Sasha