Skip to content

Commit 1edd56e

Browse files
lucacoelhoKalle Valo
authored andcommitted
iwlwifi: fix WGDS check when WRDS is disabled
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]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/iwlwifi.20200417133700.72ad25c3998b.I875d935cefd595ed7f640ddcfc7bc802627d2b7f@changeid
1 parent e6d419f commit 1edd56e

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,14 @@ int iwl_sar_select_profile(struct iwl_fw_runtime *fwrt,
296296
if (!prof->enabled) {
297297
IWL_DEBUG_RADIO(fwrt, "SAR profile %d is disabled.\n",
298298
profs[i]);
299-
/* if one of the profiles is disabled, we fail all */
300-
return -ENOENT;
299+
/*
300+
* if one of the profiles is disabled, we
301+
* ignore all of them and return 1 to
302+
* differentiate disabled from other failures.
303+
*/
304+
return 1;
301305
}
306+
302307
IWL_DEBUG_INFO(fwrt,
303308
"SAR EWRD: chain %d profile index %d\n",
304309
i, profs[i]);

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ int iwl_mvm_sar_select_profile(struct iwl_mvm *mvm, int prof_a, int prof_b)
727727
struct iwl_dev_tx_power_cmd_v4 v4;
728728
} cmd;
729729

730+
int ret;
730731
u16 len = 0;
731732

732733
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)
741742
len = sizeof(cmd.v4.v3);
742743

743744

744-
if (iwl_sar_select_profile(&mvm->fwrt, cmd.v5.v3.per_chain_restriction,
745-
prof_a, prof_b))
746-
return -ENOENT;
745+
ret = iwl_sar_select_profile(&mvm->fwrt,
746+
cmd.v5.v3.per_chain_restriction,
747+
prof_a, prof_b);
748+
749+
/* return on error or if the profile is disabled (positive number) */
750+
if (ret)
751+
return ret;
752+
747753
IWL_DEBUG_RADIO(mvm, "Sending REDUCE_TX_POWER_CMD per chain\n");
748754
return iwl_mvm_send_cmd_pdu(mvm, REDUCE_TX_POWER_CMD, 0, len, &cmd);
749755
}
@@ -1034,16 +1040,7 @@ static int iwl_mvm_sar_init(struct iwl_mvm *mvm)
10341040
"EWRD SAR BIOS table invalid or unavailable. (%d)\n",
10351041
ret);
10361042

1037-
ret = iwl_mvm_sar_select_profile(mvm, 1, 1);
1038-
/*
1039-
* If we don't have profile 0 from BIOS, just skip it. This
1040-
* means that SAR Geo will not be enabled either, even if we
1041-
* have other valid profiles.
1042-
*/
1043-
if (ret == -ENOENT)
1044-
return 1;
1045-
1046-
return ret;
1043+
return iwl_mvm_sar_select_profile(mvm, 1, 1);
10471044
}
10481045

10491046
static int iwl_mvm_load_rt_fw(struct iwl_mvm *mvm)
@@ -1272,7 +1269,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
12721269
ret = iwl_mvm_sar_init(mvm);
12731270
if (ret == 0) {
12741271
ret = iwl_mvm_sar_geo_init(mvm);
1275-
} else if (ret > 0 && !iwl_sar_get_wgds_table(&mvm->fwrt)) {
1272+
} else if (ret == -ENOENT && !iwl_sar_get_wgds_table(&mvm->fwrt)) {
12761273
/*
12771274
* If basic SAR is not available, we check for WGDS,
12781275
* which should *not* be available either. If it is

0 commit comments

Comments
 (0)