mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-29 12:55:24 -04:00
wifi: iwlwifi: mvm: allow ADD_STA not to be advertised by the firwmare
Newest firmware don't advertise the version of ADD_STA because it has been replaced by another command. There are old firmware images that also don't advertise it. Replace all the checks with a new inline, and in that check for either MLD API or the ADD_STA command version. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Gregory Greenman <gregory.greenman@intel.com> Link: https://lore.kernel.org/r/20230613155501.4b9305510223.I7cc143d87186f8441e9b8435cc550b76734c7eef@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
committed by
Johannes Berg
parent
d615ea32f6
commit
1724fc781f
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2012-2014, 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2012-2014, 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
|
||||
* Copyright (C) 2016-2017 Intel Deutschland GmbH
|
||||
*/
|
||||
@@ -1637,7 +1637,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
|
||||
* internal aux station for all aux activities that don't
|
||||
* requires a dedicated data queue.
|
||||
*/
|
||||
if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12) {
|
||||
if (!iwl_mvm_has_new_station_api(mvm->fw)) {
|
||||
/*
|
||||
* In old version the aux station uses mac id like other
|
||||
* station and not lmac id
|
||||
@@ -1806,7 +1806,7 @@ int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm)
|
||||
RCU_INIT_POINTER(mvm->fw_id_to_link_sta[i], NULL);
|
||||
}
|
||||
|
||||
if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12) {
|
||||
if (!iwl_mvm_has_new_station_api(mvm->fw)) {
|
||||
/*
|
||||
* Add auxiliary station for scanning.
|
||||
* Newer versions of this command implies that the fw uses
|
||||
|
||||
@@ -1243,7 +1243,7 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm)
|
||||
|
||||
/* async_handlers_wk is now blocked */
|
||||
|
||||
if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12)
|
||||
if (!iwl_mvm_has_new_station_api(mvm->fw))
|
||||
iwl_mvm_rm_aux_sta(mvm);
|
||||
|
||||
iwl_mvm_stop_device(mvm);
|
||||
@@ -4521,7 +4521,7 @@ static int iwl_mvm_add_aux_sta_for_hs20(struct iwl_mvm *mvm, u32 lmac_id)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12) {
|
||||
if (iwl_mvm_has_new_station_api(mvm->fw)) {
|
||||
ret = iwl_mvm_add_aux_sta(mvm, lmac_id);
|
||||
WARN(ret, "Failed to allocate aux station");
|
||||
}
|
||||
|
||||
@@ -1433,6 +1433,12 @@ static inline bool iwl_mvm_has_mld_api(const struct iwl_fw *fw)
|
||||
IWL_UCODE_TLV_CAPA_MLD_API_SUPPORT);
|
||||
}
|
||||
|
||||
static inline bool iwl_mvm_has_new_station_api(const struct iwl_fw *fw)
|
||||
{
|
||||
return iwl_mvm_has_mld_api(fw) ||
|
||||
iwl_fw_lookup_cmd_ver(fw, ADD_STA, 0) >= 12;
|
||||
}
|
||||
|
||||
static inline bool iwl_mvm_has_new_tx_api(struct iwl_mvm *mvm)
|
||||
{
|
||||
/* TODO - replace with TLV once defined */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2012-2014, 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2012-2014, 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
|
||||
* Copyright (C) 2016-2017 Intel Deutschland GmbH
|
||||
*/
|
||||
@@ -647,7 +647,7 @@ static void iwl_mvm_scan_fill_tx_cmd(struct iwl_mvm *mvm,
|
||||
NL80211_BAND_2GHZ,
|
||||
no_cck);
|
||||
|
||||
if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12) {
|
||||
if (!iwl_mvm_has_new_station_api(mvm->fw)) {
|
||||
tx_cmd[0].sta_id = mvm->aux_sta.sta_id;
|
||||
tx_cmd[1].sta_id = mvm->aux_sta.sta_id;
|
||||
|
||||
@@ -1084,7 +1084,7 @@ static void iwl_mvm_fill_scan_config_v1(struct iwl_mvm *mvm, void *config,
|
||||
memcpy(&cfg->mac_addr, &mvm->addresses[0].addr, ETH_ALEN);
|
||||
|
||||
/* This function should not be called when using ADD_STA ver >=12 */
|
||||
WARN_ON_ONCE(iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12);
|
||||
WARN_ON_ONCE(iwl_mvm_has_new_station_api(mvm->fw));
|
||||
|
||||
cfg->bcast_sta_id = mvm->aux_sta.sta_id;
|
||||
cfg->channel_flags = channel_flags;
|
||||
@@ -1135,7 +1135,7 @@ static void iwl_mvm_fill_scan_config_v2(struct iwl_mvm *mvm, void *config,
|
||||
memcpy(&cfg->mac_addr, &mvm->addresses[0].addr, ETH_ALEN);
|
||||
|
||||
/* This function should not be called when using ADD_STA ver >=12 */
|
||||
WARN_ON_ONCE(iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12);
|
||||
WARN_ON_ONCE(iwl_mvm_has_new_station_api(mvm->fw));
|
||||
|
||||
cfg->bcast_sta_id = mvm->aux_sta.sta_id;
|
||||
cfg->channel_flags = channel_flags;
|
||||
@@ -1250,7 +1250,7 @@ int iwl_mvm_config_scan(struct iwl_mvm *mvm)
|
||||
|
||||
memset(&cfg, 0, sizeof(cfg));
|
||||
|
||||
if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) < 12) {
|
||||
if (!iwl_mvm_has_new_station_api(mvm->fw)) {
|
||||
cfg.bcast_sta_id = mvm->aux_sta.sta_id;
|
||||
} else if (iwl_fw_lookup_cmd_ver(mvm->fw, SCAN_CFG_CMD, 0) < 5) {
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2012-2015, 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2012-2015, 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
|
||||
* Copyright (C) 2016-2017 Intel Deutschland GmbH
|
||||
*/
|
||||
@@ -1679,7 +1679,7 @@ static int iwl_mvm_add_int_sta_common(struct iwl_mvm *mvm,
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.sta_id = sta->sta_id;
|
||||
|
||||
if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12 &&
|
||||
if (iwl_mvm_has_new_station_api(mvm->fw) &&
|
||||
sta->type == IWL_STA_AUX_ACTIVITY)
|
||||
cmd.mac_id_n_color = cpu_to_le32(mac_id);
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
/*
|
||||
* Copyright (C) 2012-2014, 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2012-2014, 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
|
||||
* Copyright (C) 2017 Intel Deutschland GmbH
|
||||
*/
|
||||
@@ -103,7 +103,7 @@ void iwl_mvm_roc_done_wk(struct work_struct *wk)
|
||||
/* In newer version of this command an aux station is added only
|
||||
* in cases of dedicated tx queue and need to be removed in end
|
||||
* of use */
|
||||
if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12)
|
||||
if (iwl_mvm_has_new_station_api(mvm->fw))
|
||||
iwl_mvm_rm_aux_sta(mvm);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user