wifi: iwlwifi: updates - 2023-09-26
cover wifi: iwlwifi: updates - 2023-09-26
From: Gregory Greenman <[email protected]>
Hi,
This patch set includes iwlwifi patches intended for v6.7. It contains bugfixes and advances firmware version to 84.
Thanks,
Gregory
Avraham Stern (2):
wifi: iwlwifi: mvm: update station's MFP flag after association
wifi: iwlwifi: mvm: fix removing pasn station for responder
Gregory Greenman (1):
wifi: iwlwifi: bump FW API to 84 for AX/BZ/SC devices
Johannes Berg (6):
wifi: iwlwifi: pcie: propagate iwl_pcie_gen2_apm_init() error
wifi: iwlwifi: skip opmode start retries on dead transport
wifi: iwlwifi: fix opmode start/stop race
wifi: iwlwifi: pcie: clean up WFPM control bits
wifi: iwlwifi: mvm: offload IGTK in AP if BIGTK is supported
wifi: iwlwifi: mvm: use correct sta ID for IGTK/BIGTK
.../net/wireless/intel/iwlwifi/cfg/ax210.c | 2 +- drivers/net/wireless/intel/iwlwifi/cfg/bz.c | 2 +- drivers/net/wireless/intel/iwlwifi/cfg/sc.c | 2 +- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 19 ++++++++++------- drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 1 - .../intel/iwlwifi/mvm/ftm-responder.c | 9 ++++++-- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 21 ++++++++++++++++--- .../net/wireless/intel/iwlwifi/mvm/mld-key.c | 9 ++++++-- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 4 ++-- .../wireless/intel/iwlwifi/pcie/trans-gen2.c | 5 ++++- 10 files changed, 53 insertions(+), 21 deletions(-)
Signature · 1 line
2.38.1
PATCH 1/9 wifi: iwlwifi: mvm: update station's MFP flag after association
From: Avraham Stern <[email protected]>
The management frames protection flag is always set when the station is not yet authorized. However, it was not cleared after association even if the association did not use MFP. As a result, all public action frames are not parsed by fw (which will cause FTM to fail, for example). Update the station MFP flag after the station is authorized.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +6 -0
@@ -3809,6 +3809,12 @@ iwl_mvm_sta_state_assoc_to_authorized(struct iwl_mvm *mvm,iwl_mvm_rs_rate_init_all_links (mvm, vif, sta); +/* MFP is set by default before the station is authorized. +* Clear it here in case it's not used. +*/ +if (!sta->mfp) +return callbacks->update_sta (mvm, vif, sta); +return 0 ; }
Signature · 1 line
2.38.1
PATCH 2/9 wifi: iwlwifi: pcie: propagate iwl_pcie_gen2_apm_init() error
In reply to [email protected]From: Johannes Berg <[email protected]>
If iwl_pcie_gen2_apm_init() fails, we should propagate the error code up, rather than ignoring it.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +4 -1
@@ -230,11 +230,14 @@ static int iwl_pcie_gen2_nic_init(struct iwl_trans *trans)struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans);int queue_size =max_t (u32,IWL_CMD_QUEUE_SIZE , trans->cfg->min_txq_size); +int ret;/* TODO: most of the logic can be removed in A0 - but not in Z0 */ spin_lock_bh (&trans_pcie->irq_lock); -iwl_pcie_gen2_apm_init (trans); + ret =iwl_pcie_gen2_apm_init (trans);spin_unlock_bh (&trans_pcie->irq_lock); +if (ret) +return ret;iwl_op_mode_nic_config (trans->op_mode);
Signature · 1 line
2.38.1
PATCH 3/9 wifi: iwlwifi: skip opmode start retries on dead transport
In reply to [email protected]From: Johannes Berg <[email protected]>
These retries aren't going to succeed if the device was deemed dead and needs to be unbound/rebound/... to be recovered; skip the retries in that case.
--- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c +3 -0
@@ -1429,6 +1429,9 @@ _iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op)if (op_mode)return op_mode; +if (test_bit (STATUS_TRANS_DEAD , &drv->trans->status)) +break ; +IWL_ERR (drv,"retry init count %d\n" , retry);#ifdef CONFIG_IWLWIFI_DEBUGFS
Signature · 1 line
2.38.1
PATCH 4/9 wifi: iwlwifi: fix opmode start/stop race
In reply to [email protected]From: Johannes Berg <[email protected]>
There's a race when the device is unbound (maybe because the module is unloaded) while the opmode start hasn't finished yet. The complete(request_firmware_complete) after the opmode start was meant (and commented accordingly) to prevent this problem, but it's not sufficient when the opmode module is loaded after the firmware load already completed, which happens regularly now because firmware load doesn't require userspace, unlike module load.
Fix this by using the existing opmode registration mutex to protected the start/stop flows against each other properly.
--- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c +9 -7
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2005-2014, 2018-2021 Intel Corporation +* Copyright (C) 2005-2014, 2018-2023 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */
@@ -1415,6 +1415,9 @@ _iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op)struct iwl_op_mode *op_mode =NULL ;int retry, max_retry = !!iwlwifi_mod_params.fw_restart *IWL_MAX_INIT_RETRY ; +/* also protects start/stop from racing against each other */ +lockdep_assert_held (&iwlwifi_opmode_table_mtx); +for (retry =0 ; retry <= max_retry; retry++) {#ifdef CONFIG_IWLWIFI_DEBUGFS
@@ -1445,6 +1448,9 @@ _iwl_op_mode_start(struct iwl_drv *drv, struct iwlwifi_opmode_table *op)static void _iwl_op_mode_stop (struct iwl_drv *drv) { +/* also protects start/stop from racing against each other */ +lockdep_assert_held (&iwlwifi_opmode_table_mtx); +/* op_mode can be NULL if its start failed */ if (drv->op_mode) {iwl_op_mode_stop (drv->op_mode);
@@ -1728,11 +1734,6 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) }mutex_unlock (&iwlwifi_opmode_table_mtx); -/* -* Complete the firmware request last so that -* a driver unbind (stop) doesn't run while we -* are doing the start() above. -*/ complete (&drv->request_firmware_complete);/*
@@ -1837,11 +1838,12 @@ void iwl_drv_stop(struct iwl_drv *drv) {wait_for_completion (&drv->request_firmware_complete); +mutex_lock (&iwlwifi_opmode_table_mtx); +_iwl_op_mode_stop (drv);iwl_dealloc_ucode (drv); -mutex_lock (&iwlwifi_opmode_table_mtx);/* * List is empty (this item wasn't added) * when firmware loading failed -- in that
Signature · 1 line
2.38.1
PATCH 5/9 wifi: iwlwifi: pcie: clean up WFPM control bits
In reply to [email protected]From: Johannes Berg <[email protected]>
We define the same bit twice, remove the less precise definition and use the better one instead.
--- drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 1 - drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-prph.h +0 -1
@@ -365,7 +365,6 @@#define DBGI_SRAM_FIFO_POINTERS_WR_PTR_MSK 0x00000FFFenum { -ENABLE_WFPM =BIT (31 ),WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK =0x80000000 , };
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +2 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2005-2014, 2018-2021 Intel Corporation +* Copyright (C) 2005-2014, 2018-2023 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */
@@ -1134,7 +1134,7 @@ static int get_crf_id(struct iwl_trans *iwl_trans)/* Enable access to peripheral registers */ val =iwl_read_umac_prph_no_grab (iwl_trans,WFPM_CTRL_REG ); - val |=ENABLE_WFPM ; + val |=WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK ;iwl_write_umac_prph_no_grab (iwl_trans,WFPM_CTRL_REG , val);/* Read crf info */
Signature · 1 line
2.38.1
PATCH 6/9 wifi: iwlwifi: mvm: fix removing pasn station for responder
In reply to [email protected]From: Avraham Stern <[email protected]>
In case of MLD operation the station should be removed using the mld api.
--- drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c +7 -2
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * Copyright (C) 2015-2017 Intel Deutschland GmbH -* Copyright (C) 2018-2022 Intel Corporation +* Copyright (C) 2018-2023 Intel Corporation */ #include <net/cfg80211.h> #include <linux/etherdevice.h>
@@ -302,7 +302,12 @@ static void iwl_mvm_resp_del_pasn_sta(struct iwl_mvm *mvm, struct iwl_mvm_pasn_sta *sta) {list_del (&sta->list); -iwl_mvm_rm_sta_id (mvm, vif, sta->int_sta.sta_id); + +if (iwl_mvm_has_mld_api (mvm->fw)) +iwl_mvm_mld_rm_sta_id (mvm, sta->int_sta.sta_id); +else +iwl_mvm_rm_sta_id (mvm, vif, sta->int_sta.sta_id); +iwl_mvm_dealloc_int_sta (mvm, &sta->int_sta);kfree (sta); }
Signature · 1 line
2.38.1
PATCH 7/9 wifi: iwlwifi: mvm: offload IGTK in AP if BIGTK is supported
In reply to [email protected]From: Johannes Berg <[email protected]>
We can't really know easily if a BIGTK will be used, but in case firmware supports BIGTK it also supports the very easy IGTK use (nothing to do on the host), and requires that we program both IGTK and BIGTK to be able to use the BIGTK. Thus, change the condition here to set the keys in firmware (both IGTK/BIGTK) if BIGTK is supported.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +12 -3
@@ -4185,12 +4185,21 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw,* GTK on AP interface is a TX-only key, return 0; * on IBSS they're per-station and because we're lazy * we don't support them for RX, so do the same. -* CMAC/GMAC in AP/IBSS modes must be done in software. +* CMAC/GMAC in AP/IBSS modes must be done in software +* on older NICs. * * Except, of course, beacon protection - it must be -* offloaded since we just set a beacon template. +* offloaded since we just set a beacon template, and +* then we must also offload the IGTK (not just BIGTK) +* for firmware reasons. +* +* So just check for beacon protection - if we don't +* have it we cannot get here with keyidx >= 6, and +* if we do have it we need to send the key to FW in +* all cases (CMAC/GMAC). */ -if (keyidx <6 && +if (!wiphy_ext_feature_isset (hw->wiphy, +NL80211_EXT_FEATURE_BEACON_PROTECTION ) && (key->cipher ==WLAN_CIPHER_SUITE_AES_CMAC || key->cipher ==WLAN_CIPHER_SUITE_BIP_GMAC_128 || key->cipher ==WLAN_CIPHER_SUITE_BIP_GMAC_256 )) {
Signature · 1 line
2.38.1
PATCH 8/9 wifi: iwlwifi: mvm: use correct sta ID for IGTK/BIGTK
In reply to [email protected]From: Johannes Berg <[email protected]>
We don't (yet) send the IGTK down to the firmware, but when we do it needs to be with the broadcast station ID, not the multicast station ID. Same for the BIGTK, which we may send already if firmware advertises it (but it doesn't yet.)
--- drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c +7 -2
@@ -24,10 +24,15 @@ static u32 iwl_mvm_get_sec_sta_mask(struct iwl_mvm *mvm,return 0 ; } -/* AP group keys are per link and should be on the mcast STA */ +/* AP group keys are per link and should be on the mcast/bcast STA */ if (vif->type ==NL80211_IFTYPE_AP && - !(keyconf->flags &IEEE80211_KEY_FLAG_PAIRWISE )) + !(keyconf->flags &IEEE80211_KEY_FLAG_PAIRWISE )) { +/* IGTK/BIGTK to bcast STA */ +if (keyconf->keyidx >=4 ) +return BIT (link_info->bcast_sta.sta_id); +/* GTK for data to mcast STA */ return BIT (link_info->mcast_sta.sta_id); + }/* for client mode use the AP STA also for group keys */ if (!sta && vif->type ==NL80211_IFTYPE_STATION )
Signature · 1 line
2.38.1
PATCH 9/9 wifi: iwlwifi: bump FW API to 84 for AX/BZ/SC devices
In reply to [email protected]From: Gregory Greenman <[email protected]>
Start supporting API version 84 for new devices.
--- drivers/net/wireless/intel/iwlwifi/cfg/ax210.c | 2 +- drivers/net/wireless/intel/iwlwifi/cfg/bz.c | 2 +- drivers/net/wireless/intel/iwlwifi/cfg/sc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/cfg/ax210.c +1 -1
@@ -10,7 +10,7 @@#include "fw/api/txq.h" /* Highest firmware API version supported */ -#define IWL_AX210_UCODE_API_MAX 83 +#define IWL_AX210_UCODE_API_MAX 84/* Lowest firmware API version supported */ #define IWL_AX210_UCODE_API_MIN 59
drivers/net/wireless/intel/iwlwifi/cfg/bz.c +1 -1
@@ -10,7 +10,7 @@#include "fw/api/txq.h" /* Highest firmware API version supported */ -#define IWL_BZ_UCODE_API_MAX 83 +#define IWL_BZ_UCODE_API_MAX 84/* Lowest firmware API version supported */ #define IWL_BZ_UCODE_API_MIN 80
drivers/net/wireless/intel/iwlwifi/cfg/sc.c +1 -1
@@ -10,7 +10,7 @@#include "fw/api/txq.h" /* Highest firmware API version supported */ -#define IWL_SC_UCODE_API_MAX 83 +#define IWL_SC_UCODE_API_MAX 84/* Lowest firmware API version supported */ #define IWL_SC_UCODE_API_MIN 82
Signature · 1 line
2.38.1