iwlwifi: updates intended for v6.2 2022-11-02
cover iwlwifi: updates intended for v6.2 2022-11-02
From: Gregory Greenman <[email protected]>
Hi,
Here's the second set of patches intended for v6.2. It contains some small new features, cleanups and bugfixes.
As usual, I'm pushing this to a pending branch, for kbuild bot, and will send a pull-request later.
Please review.
Thanks,
Gregory
Avraham Stern (4):
wifi: iwlwifi: mei: implement PLDR flow
wifi: iwlwifi: mei: use wait_event_timeout() return value
wifi: iwlwifi: iwlmei: report disconnection as temporary
wifi: iwlwifi: mei: wait for the mac to stop on suspend
Ilan Peer (1):
wifi: iwlwifi: mvm: Fix getting the lowest rate
Johannes Berg (2):
wifi: iwlwifi: mvm: use old checksum for Bz A-step
wifi: iwlwifi: mvm: support new key API
Luca Coelho (2):
wifi: iwlwifi: cfg: disable STBC for BL step A devices
wifi: iwlwifi: mvm: print an error instead of a warning on invalid
rate
Rotem Saado (2):
wifi: iwlwifi: dbg: add support for DBGC4 on BZ family and above
wifi: iwlwifi: dbg: use bit of DRAM alloc ID to store failed allocs
.../net/wireless/intel/iwlwifi/cfg/22000.c | 36 ++- .../wireless/intel/iwlwifi/fw/api/datapath.h | 79 ++++++ .../net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 7 +- drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 4 + .../net/wireless/intel/iwlwifi/mei/iwl-mei.h | 21 ++ drivers/net/wireless/intel/iwlwifi/mei/main.c | 130 ++++++++-- drivers/net/wireless/intel/iwlwifi/mei/sap.h | 51 ++++ .../net/wireless/intel/iwlwifi/mvm/Makefile | 1 + .../net/wireless/intel/iwlwifi/mvm/debugfs.c | 4 +- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 7 + .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 60 ++++- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 20 +- .../net/wireless/intel/iwlwifi/mvm/mld-key.c | 226 ++++++++++++++++++ drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 15 +- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 1 + drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 8 +- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 3 + drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 7 +- 18 files changed, 641 insertions(+), 39 deletions(-) create mode 100644 drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c
Signature · 1 line
2.35.3
PATCH 1/11 wifi: iwlwifi: mvm: use old checksum for Bz A-step
From: Johannes Berg <[email protected]>
For Bz A-step hardware, the checksum offload is broken and we need to use the old way, which is still there. Do that, which requires taking the checksum capability bits out of the IWL_DEVICE_BZ macro and listing them individually.
--- drivers/net/wireless/intel/iwlwifi/cfg/22000.c | 16 +++++++++++++++- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 7 +++++-- 2 files changed, 20 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/cfg/22000.c +15 -1
@@ -261,7 +261,6 @@ static const struct iwl_ht_params iwl_22000_ht_params = { .dccm2_len = IWL_22000_DCCM2_LEN, \ .smem_offset = IWL_22000_SMEM_OFFSET, \ .smem_len = IWL_22000_SMEM_LEN, \ - .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, \ .apmg_not_supported = true, \ .trans.mq_rx_supported = true, \ .vht_mu_mimo_supported = true, \
@@ -901,6 +900,7 @@ const struct iwl_cfg iwl_cfg_bz_a0_hr_b0 = { .fw_name_pre = IWL_BZ_A_HR_B_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -908,6 +908,7 @@ const struct iwl_cfg iwl_cfg_bz_a0_gf_a0 = { .fw_name_pre = IWL_BZ_A_GF_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -915,6 +916,7 @@ const struct iwl_cfg iwl_cfg_bz_a0_gf4_a0 = { .fw_name_pre = IWL_BZ_A_GF4_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -922,6 +924,7 @@ const struct iwl_cfg iwl_cfg_bz_a0_mr_a0 = { .fw_name_pre = IWL_BZ_A_MR_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -929,6 +932,7 @@ const struct iwl_cfg iwl_cfg_bz_a0_fm_a0 = { .fw_name_pre = IWL_BZ_A_FM_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -936,6 +940,7 @@ const struct iwl_cfg iwl_cfg_bz_a0_fm4_a0 = { .fw_name_pre = IWL_BZ_A_FM4_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -943,6 +948,7 @@ const struct iwl_cfg iwl_cfg_gl_a0_fm_a0 = { .fw_name_pre = IWL_GL_A_FM_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -950,6 +956,7 @@ const struct iwl_cfg iwl_cfg_gl_b0_fm_b0 = { .fw_name_pre = IWL_GL_B_FM_B_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -957,6 +964,7 @@ const struct iwl_cfg iwl_cfg_bz_z0_gf_a0 = { .fw_name_pre = IWL_BZ_Z_GF_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -964,6 +972,7 @@ const struct iwl_cfg iwl_cfg_bnj_a0_fm_a0 = { .fw_name_pre = IWL_BNJ_A_FM_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -971,6 +980,7 @@ const struct iwl_cfg iwl_cfg_bnj_a0_fm4_a0 = { .fw_name_pre = IWL_BNJ_A_FM4_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -978,6 +988,7 @@ const struct iwl_cfg iwl_cfg_bnj_a0_gf_a0 = { .fw_name_pre = IWL_BNJ_A_GF_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -985,6 +996,7 @@ const struct iwl_cfg iwl_cfg_bnj_a0_gf4_a0 = { .fw_name_pre = IWL_BNJ_A_GF4_A_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -992,6 +1004,7 @@ const struct iwl_cfg iwl_cfg_bnj_a0_hr_b0 = { .fw_name_pre = IWL_BNJ_A_HR_B_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };
@@ -999,6 +1012,7 @@ const struct iwl_cfg iwl_cfg_bnj_b0_fm_b0 = { .fw_name_pre = IWL_BNJ_B_FM_B_FW_PRE, .uhb_supported = true,IWL_DEVICE_BZ , + .features = IWL_TX_CSUM_NETIF_FLAGS_BZ | NETIF_F_RXCSUM, .num_rbds = IWL_NUM_RBDS_AX210_HE, };MODULE_FIRMWARE (IWL_QU_B_HR_B_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +5 -2
@@ -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-2022 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */
@@ -183,7 +183,10 @@ static u32 iwl_mvm_tx_csum(struct iwl_mvm *mvm, struct sk_buff *skb, struct ieee80211_tx_info *info, bool amsdu) { -if (mvm->trans->trans_cfg->device_family <IWL_DEVICE_FAMILY_BZ ) +if (mvm->trans->trans_cfg->device_family <IWL_DEVICE_FAMILY_BZ || + (mvm->trans->trans_cfg->device_family ==IWL_DEVICE_FAMILY_BZ && +CSR_HW_REV_TYPE (mvm->trans->hw_rev) ==IWL_CFG_MAC_TYPE_GL && + mvm->trans->hw_rev_step ==SILICON_A_STEP ))return iwl_mvm_tx_csum_pre_bz (mvm, skb, info, amsdu);return iwl_mvm_tx_csum_bz (mvm, skb, amsdu); }
Signature · 1 line
2.35.3
PATCH 2/11 wifi: iwlwifi: dbg: add support for DBGC4 on BZ family and above
In reply to [email protected]From: Rotem Saado <[email protected]>
Update the for loop that iterates over all the DBGCs to include DBGC4. DBGC4 is only supported staring from the BZ family of devices, so check the family before accepting it.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +4 -1
@@ -590,6 +590,9 @@ static int iwl_dbg_tlv_alloc_fragments(struct iwl_fw_runtime *fwrt,if (alloc_id !=IWL_FW_INI_ALLOCATION_ID_DBGC1 )return -EIO ; num_frags =1 ; + }else if (fwrt->trans->trans_cfg->device_family <IWL_DEVICE_FAMILY_BZ && + alloc_id >IWL_FW_INI_ALLOCATION_ID_DBGC3 ) { +return -EIO ; } remain_pages = DIV_ROUND_UP(le32_to_cpu(fw_mon_cfg->req_size),
@@ -789,7 +792,7 @@ static void iwl_dbg_tlv_update_drams(struct iwl_fw_runtime *fwrt) dram_info->second_word =cpu_to_le32 (DRAM_INFO_SECOND_MAGIC_WORD );for (i =IWL_FW_INI_ALLOCATION_ID_DBGC1 ; - i <=IWL_FW_INI_ALLOCATION_ID_DBGC3 ; i++) { + i <IWL_FW_INI_ALLOCATION_NUM ; i++) { ret =iwl_dbg_tlv_update_dram (fwrt, i, dram_info);if (!ret) dram_alloc = true;
Signature · 1 line
2.35.3
PATCH 3/11 wifi: iwlwifi: cfg: disable STBC for BL step A devices
In reply to [email protected]From: Luca Coelho <[email protected]>
The A step of BL devices doesn't support STBC, so we need to disable it.
Create new HT params and a macro to use specifically with BL A-step devices where STBC is disabled.
--- .../net/wireless/intel/iwlwifi/cfg/22000.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/cfg/22000.c +17 -3
@@ -172,6 +172,13 @@ static const struct iwl_ht_params iwl_22000_ht_params = { BIT(NL80211_BAND_6GHZ), }; +static const struct iwl_ht_params iwl_gl_a_ht_params = { + .stbc = false,/* we explicitly disable STBC for GL step A */ + .ldpc = true, + .ht40_bands =BIT (NL80211_BAND_2GHZ ) |BIT (NL80211_BAND_5GHZ ) | +BIT (NL80211_BAND_6GHZ ), +}; +#define IWL_DEVICE_22000_COMMON \ .ucode_api_max = IWL_22000_UCODE_API_MAX, \ .ucode_api_min = IWL_22000_UCODE_API_MIN, \
@@ -249,7 +256,7 @@ static const struct iwl_ht_params iwl_22000_ht_params = { }, \ } -#define IWL_DEVICE_BZ \ +#define IWL_DEVICE_BZ_COMMON \ .ucode_api_max = IWL_22000_UCODE_API_MAX, \ .ucode_api_min = IWL_22000_UCODE_API_MIN, \ .led_mode = IWL_LED_RF_STATE, \
@@ -265,7 +272,6 @@ static const struct iwl_ht_params iwl_22000_ht_params = { .trans.mq_rx_supported = true, \ .vht_mu_mimo_supported = true, \ .mac_addr_from_csr = 0x30, \ - .ht_params = &iwl_22000_ht_params, \ .nvm_ver = IWL_22000_NVM_VERSION, \ .trans.use_tfh = true, \ .trans.rf_id = true, \
@@ -312,6 +318,14 @@ static const struct iwl_ht_params iwl_22000_ht_params = { }, \ } +#define IWL_DEVICE_BZ \ + IWL_DEVICE_BZ_COMMON, \ + .ht_params = &iwl_22000_ht_params + +#define IWL_DEVICE_GL_A \ + IWL_DEVICE_BZ_COMMON, \ + .ht_params = &iwl_gl_a_ht_params +const struct iwl_cfg_trans_params iwl_qnj_trans_cfg = { .mq_rx_supported = true, .use_tfh = true,
@@ -947,7 +961,7 @@ const struct iwl_cfg iwl_cfg_bz_a0_fm4_a0 = {const struct iwl_cfg iwl_cfg_gl_a0_fm_a0 = { .fw_name_pre =IWL_GL_A_FM_A_FW_PRE , .uhb_supported = true, -IWL_DEVICE_BZ , +IWL_DEVICE_GL_A , .features =IWL_TX_CSUM_NETIF_FLAGS |NETIF_F_RXCSUM , .num_rbds =IWL_NUM_RBDS_AX210_HE , };
Signature · 1 line
2.35.3
PATCH 4/11 wifi: iwlwifi: mvm: print an error instead of a warning on invalid rate
In reply to [email protected]From: Luca Coelho <[email protected]>
In some rare occasions, the firmware may let some frames with invalid rates, such as CCK rates on the high band, come through. This causes the driver to issue a warning, but since this is a possible issue and it's not really a bug in the driver, convert the warning into an error.
--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +5 -3
@@ -1747,10 +1747,12 @@ static void iwl_mvm_rx_fill_status(struct iwl_mvm *mvm, rx_status->rate_idx = rate; -if (WARN_ONCE (rate <0 || rate >0xFF , -"Invalid rate flags 0x%x, band %d,\n" , - rate_n_flags, rx_status->band)) +if ((rate <0 || rate >0xFF ) &&net_ratelimit ()) { +IWL_ERR (mvm,"Invalid rate flags 0x%x, band %d,\n" , + rate_n_flags, rx_status->band); rx_status->rate_idx =0 ; + } +break ; } }
Signature · 1 line
2.35.3
PATCH 5/11 wifi: iwlwifi: dbg: use bit of DRAM alloc ID to store failed allocs
In reply to [email protected]From: Rotem Saado <[email protected]>
The failed_alloc variable is used as a bitmask in the loop where we check DRAM allocations. But erroneously, we were clearing the DRAM alloc IDs we removed as an integer.
Fix that by clearing them as bits instead.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +1 -1
@@ -1327,7 +1327,7 @@ static void iwl_dbg_tlv_init_cfg(struct iwl_fw_runtime *fwrt)"WRT: removing allocation id %d from region id %d\n" , le32_to_cpu(reg->dram_alloc_id), i); - failed_alloc &= ~le32_to_cpu (reg->dram_alloc_id); + failed_alloc &= ~BIT (le32_to_cpu (reg->dram_alloc_id)); fwrt->trans->dbg.unsupported_region_msk |=BIT (i);kfree (*active_reg);
Signature · 1 line
2.35.3
PATCH 6/11 wifi: iwlwifi: mvm: support new key API
In reply to [email protected]From: Johannes Berg <[email protected]>
In order to support MLD, the key API is also changing to have station masks instead of just the station ID etc. Change the driver to support this, and add the new code in a new file so it's more clearly separated.
For now this isn't separated at the mac80211 ops level, which we wanted to do, but we're calling these functions in a place when pre-start keys are installed in iwl_mvm_start_ap_ibss(), and the function has some glue logic to mac80211. We may want to change that later.
--- .../wireless/intel/iwlwifi/fw/api/datapath.h | 79 ++++++ .../net/wireless/intel/iwlwifi/mvm/Makefile | 1 + .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 17 +- .../net/wireless/intel/iwlwifi/mvm/mld-key.c | 226 ++++++++++++++++++ drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 12 + drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 1 + drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 3 + 7 files changed, 337 insertions(+), 2 deletions(-) create mode 100644 drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c
drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h +79 -0
@@ -71,6 +71,11 @@ enum iwl_data_path_subcmd_ids {*/ SCD_QUEUE_CONFIG_CMD =0x17 , +/** +* @SEC_KEY_CMD: security key command, uses &struct iwl_sec_key_cmd +*/ + SEC_KEY_CMD = 0x18, +/** * @MONITOR_NOTIF: Datapath monitoring notification, using * &struct iwl_datapath_monitor_notif
@@ -403,4 +408,78 @@ struct iwl_scd_queue_cfg_cmd { } __packed u; /* TX_QUEUE_CFG_CMD_OPERATION_API_U_VER_1 */ } __packed;/* TX_QUEUE_CFG_CMD_API_S_VER_3 */ +/** +* enum iwl_sec_key_flags - security key command key flags +* @IWL_SEC_KEY_FLAG_CIPHER_MASK: cipher mask +* @IWL_SEC_KEY_FLAG_CIPHER_WEP: WEP cipher +* @IWL_SEC_KEY_FLAG_CIPHER_CCMP: CCMP/CMAC cipher +* @IWL_SEC_KEY_FLAG_CIPHER_TKIP: TKIP cipher +* @IWL_SEC_KEY_FLAG_CIPHER_GCMP: GCMP/GMAC cipher +* @IWL_SEC_KEY_FLAG_NO_TX: don't install for TX +* @IWL_SEC_KEY_FLAG_KEY_SIZE: large key size (WEP-104, GCMP-256, GMAC-256) +* @IWL_SEC_KEY_FLAG_MFP: MFP is in used for this key +* @IWL_SEC_KEY_FLAG_MCAST_KEY: this is a multicast key +* @IWL_SEC_KEY_FLAG_SPP_AMSDU: SPP A-MSDU should be used +*/ +enum iwl_sec_key_flags { +IWL_SEC_KEY_FLAG_CIPHER_MASK =0x07 , +IWL_SEC_KEY_FLAG_CIPHER_WEP =0x01 , +IWL_SEC_KEY_FLAG_CIPHER_CCMP =0x02 , +IWL_SEC_KEY_FLAG_CIPHER_TKIP =0x03 , +IWL_SEC_KEY_FLAG_CIPHER_GCMP =0x05 , +IWL_SEC_KEY_FLAG_NO_TX =0x08 , +IWL_SEC_KEY_FLAG_KEY_SIZE =0x10 , +IWL_SEC_KEY_FLAG_MFP =0x20 , +IWL_SEC_KEY_FLAG_MCAST_KEY =0x40 , +IWL_SEC_KEY_FLAG_SPP_AMSDU =0x80 , +}; + +#define IWL_SEC_WEP_KEY_OFFSET 3 + +/** +* struct iwl_sec_key_cmd - security key command +* @action: action from &enum iwl_ctxt_action +* @u.add.sta_mask: station mask for the new key +* @u.add.key_id: key ID (0-7) for the new key +* @u.add.key_flags: key flags per &enum iwl_sec_key_flags +* @u.add.key: key material. WEP keys should start from &IWL_SEC_WEP_KEY_OFFSET. +* @u.add.tkip_mic_rx_key: TKIP MIC RX key +* @u.add.tkip_mic_tx_key: TKIP MIC TX key +* @u.add.rx_seq: RX sequence counter value +* @u.add.tx_seq: TX sequence counter value +* @u.modify.old_sta_mask: old station mask +* @u.modify.new_sta_mask: new station mask +* @u.modify.key_id: key ID +* @u.modify.key_flags: new key flags +* @u.remove.sta_mask: station mask +* @u.remove.key_id: key ID +* @u.remove.key_flags: key flags +*/ +struct iwl_sec_key_cmd { +__le32 action; +union { +struct { +__le32 sta_mask; +__le32 key_id; +__le32 key_flags; +u8 key[32 ]; +u8 tkip_mic_rx_key[8 ]; +u8 tkip_mic_tx_key[8 ]; +__le64 rx_seq; +__le64 tx_seq; + } __packed add; /* SEC_KEY_ADD_CMD_API_S_VER_1 */ +struct { +__le32 old_sta_mask; +__le32 new_sta_mask; +__le32 key_id; +__le32 key_flags; + } __packed modify; /* SEC_KEY_MODIFY_CMD_API_S_VER_1 */ +struct { +__le32 sta_mask; +__le32 key_id; +__le32 key_flags; + } __packed remove; /* SEC_KEY_REMOVE_CMD_API_S_VER_1 */ + } __packed u; /* SEC_KEY_OPERATION_API_U_VER_1 */ +} __packed;/* SEC_KEY_CMD_API_S_VER_1 */ +#endif /* __iwl_fw_api_datapath_h__ */
drivers/net/wireless/intel/iwlwifi/mvm/Makefile +1 -0
@@ -7,6 +7,7 @@ iwlmvm-y += power.o coex.o iwlmvm-y += tt.o offloading.o tdls.o iwlmvm-y += ftm-responder.o ftm-initiator.o iwlmvm-y += rfi.o +iwlmvm-y += mld-key.o iwlmvm-$(CONFIG_IWLWIFI_DEBUGFS) += debugfs.o debugfs-vif.o iwlmvm-$(CONFIG_IWLWIFI_LEDS) += led.o iwlmvm-$(CONFIG_PM) += d3.o
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +15 -2
@@ -2306,6 +2306,9 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,*/ if (!test_bit (IWL_MVM_STATUS_IN_HW_RESTART , &mvm->status)) { +/* first remove remaining keys */ +iwl_mvm_sec_key_remove_ap (mvm, vif); +/* * Remove AP station now that * the MAC is unassoc
@@ -3464,6 +3467,8 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw,struct iwl_mvm_sta *mvmsta =NULL ;struct iwl_mvm_key_pn *ptk_pn;int keyidx = key->keyidx; +u32 sec_key_id =WIDE_ID (DATA_PATH_GROUP ,SEC_KEY_CMD ); +u8 sec_key_ver =iwl_fw_lookup_cmd_ver (mvm->fw, sec_key_id,0 );int ret, i;u8 key_offset;
@@ -3603,7 +3608,12 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw, mvmsta->pairwise_cipher = key->cipher;IWL_DEBUG_MAC80211 (mvm,"set hwcrypto key\n" ); - ret =iwl_mvm_set_sta_key (mvm, vif, sta, key, key_offset); + +if (sec_key_ver) + ret =iwl_mvm_sec_key_add (mvm, vif, sta, key); +else + ret =iwl_mvm_set_sta_key (mvm, vif, sta, key, key_offset); +if (ret) {IWL_WARN (mvm,"set key failed\n" ); key->hw_key_idx =STA_KEY_IDX_INVALID ;
@@ -3656,7 +3666,10 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw, }IWL_DEBUG_MAC80211 (mvm,"disable hwcrypto key\n" ); - ret =iwl_mvm_remove_sta_key (mvm, vif, sta, key); +if (sec_key_ver) + ret =iwl_mvm_sec_key_del (mvm, vif, sta, key); +else + ret =iwl_mvm_remove_sta_key (mvm, vif, sta, key);break ;default : ret = -EINVAL ;
drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c new file +226 -0
226 lines not on this page · raw message
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +12 -0
@@ -2079,6 +2079,18 @@ void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw, struct dentry *dir);#endif +/* new MLD related APIs */ +int iwl_mvm_sec_key_add (struct iwl_mvm *mvm, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta, +struct ieee80211_key_conf *keyconf); +int iwl_mvm_sec_key_del (struct iwl_mvm *mvm, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta, +struct ieee80211_key_conf *keyconf); +void iwl_mvm_sec_key_remove_ap (struct iwl_mvm *mvm, +struct ieee80211_vif *vif); +int iwl_rfi_send_config_cmd (struct iwl_mvm *mvm,struct iwl_rfi_lut_entry *rfi_table);struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table (struct iwl_mvm *mvm);
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +1 -0
@@ -547,6 +547,7 @@ static const struct iwl_hcmd_names iwl_mvm_data_path_names[] = {HCMD_NAME (TLC_MNG_CONFIG_CMD ),HCMD_NAME (CHEST_COLLECTOR_FILTER_CONFIG_CMD ),HCMD_NAME (SCD_QUEUE_CONFIG_CMD ), +HCMD_NAME (SEC_KEY_CMD ),HCMD_NAME (MONITOR_NOTIF ),HCMD_NAME (THERMAL_DUAL_CHAIN_REQUEST ), HCMD_NAME(STA_PM_NOTIF),
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +3 -0
@@ -1954,6 +1954,9 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,if (vif->cfg.assoc)return ret; +/* first remove remaining keys */ +iwl_mvm_sec_key_remove_ap (mvm, vif); +/* unassoc - go ahead - remove the AP STA now */ mvmvif->ap_sta_id =IWL_MVM_INVALID_STA ; }
Signature · 1 line
2.35.3
PATCH 7/11 wifi: iwlwifi: mvm: Fix getting the lowest rate
In reply to [email protected]From: Ilan Peer <[email protected]>
When setting the rate for Tx, the code tried to get the lowest allowed rate but without considering the BSS basic rates. Fix this by considering the basic rates.
In addition, declare support for configuring beacon Tx rate and when configured use the configured Tx beacon rate to set beacon tx command rate.
--- .../net/wireless/intel/iwlwifi/mvm/debugfs.c | 4 +- .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 60 ++++++++++++++++--- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 3 + drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 +- 4 files changed, 59 insertions(+), 11 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +2 -2
@@ -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-2022 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */
@@ -1248,7 +1248,7 @@ static int _iwl_dbgfs_inject_beacon_ie(struct iwl_mvm *mvm, char *bin, int len) mvmvif =iwl_mvm_vif_from_mac80211 (vif); info =IEEE80211_SKB_CB (beacon); - rate =iwl_mvm_mac_ctxt_get_lowest_rate (info, vif); + rate =iwl_mvm_mac_ctxt_get_beacon_rate (mvm, info, vif); beacon_cmd.flags =cpu_to_le16 (iwl_mvm_mac_ctxt_get_beacon_flags (mvm->fw, rate));
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +52 -8
86 lines not on this page · raw message
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +3 -0
@@ -374,6 +374,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) hw->wiphy->n_cipher_suites++; } +wiphy_ext_feature_set (hw->wiphy, +NL80211_EXT_FEATURE_BEACON_RATE_LEGACY ); +if (fw_has_capa (&mvm->fw->ucode_capa,IWL_UCODE_TLV_CAPA_FTM_CALIBRATED )) { wiphy_ext_feature_set(hw->wiphy,
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +2 -1
@@ -1644,7 +1644,8 @@ int iwl_mvm_mac_ctxt_send_beacon(struct iwl_mvm *mvm,int iwl_mvm_mac_ctxt_send_beacon_cmd (struct iwl_mvm *mvm,struct sk_buff *beacon,void *data,int len); -u8 iwl_mvm_mac_ctxt_get_lowest_rate (struct ieee80211_tx_info *info, +u8 iwl_mvm_mac_ctxt_get_beacon_rate (struct iwl_mvm *mvm, +struct ieee80211_tx_info *info,struct ieee80211_vif *vif);u16 iwl_mvm_mac_ctxt_get_beacon_flags (const struct iwl_fw *fw,u8 rate_idx);
Signature · 1 line
2.35.3
PATCH 8/11 wifi: iwlwifi: mei: implement PLDR flow
In reply to [email protected]From: Avraham Stern <[email protected]>
If the FW needs to do OTP re-read, the driver must notify CSME before loading the FW so CSME will not try to access the NIC during the re-read. Once the alive notification is received, CSME is notified that NIC access is allowed again.
--- drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 4 + .../net/wireless/intel/iwlwifi/mei/iwl-mei.h | 21 ++++ drivers/net/wireless/intel/iwlwifi/mei/main.c | 100 ++++++++++++++++++ drivers/net/wireless/intel/iwlwifi/mei/sap.h | 51 +++++++++ drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 7 ++ 5 files changed, 183 insertions(+)
drivers/net/wireless/intel/iwlwifi/iwl-prph.h +4 -0
@@ -377,6 +377,7 @@ enum {#define PREG_PRPH_WPROT_22000 0xA04D00#define SB_MODIFY_CFG_FLAG 0xA03088 +#define SB_CFG_RESIDES_IN_OTP_MASK 0x10#define SB_CPU_1_STATUS 0xA01E30#define SB_CPU_2_STATUS 0xA01E34#define UMAG_SB_CPU_1_STATUS 0xA038C0
@@ -500,4 +501,7 @@ enum {#define REG_OTP_MINOR 0xA0333C +#define WFPM_LMAC2_PD_NOTIFICATION 0xA033CC +#define WFPM_LMAC2_PD_RE_READ BIT(31) +#endif /* __iwl_prph_h__ */
drivers/net/wireless/intel/iwlwifi/mei/iwl-mei.h +21 -0
@@ -453,6 +453,21 @@ void iwl_mei_host_disassociated(void);*/ void iwl_mei_device_state (bool up); +/** +* iwl_mei_pldr_req() - must be called before loading the fw +* +* Return: 0 if the PLDR flow was successful and the fw can be loaded, negative +* value otherwise. +*/ +int iwl_mei_pldr_req (void ); + +/** +* iwl_mei_alive_notif() - must be called when alive notificaiton is received +* @success: true if received alive notification, false if waiting for the +* notificaiton timed out. +*/ +void iwl_mei_alive_notif (bool success); +#else static inline bool iwl_mei_is_connected (void )
@@ -503,6 +518,12 @@ static inline void iwl_mei_host_disassociated(void)static inline void iwl_mei_device_state (bool up) {} +static inline int iwl_mei_pldr_req (void ) +{return 0 ; } + +static inline void iwl_mei_alive_notif (bool success) +{} +#endif /* CONFIG_IWLMEI */ #endif /* __iwl_mei_h__ */
drivers/net/wireless/intel/iwlwifi/mei/main.c +100 -0
148 lines not on this page · raw message
drivers/net/wireless/intel/iwlwifi/mei/sap.h +51 -0
79 lines not on this page · raw message
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +7 -0
@@ -404,6 +404,8 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,return -EIO ; } +iwl_mei_alive_notif (!ret); + ret =iwl_pnvm_load (mvm->trans, &mvm->notif_wait);if (ret) {IWL_ERR (mvm,"Timeout waiting for PNVM load!\n" );
@@ -1456,6 +1458,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)struct ieee80211_channel *chan;struct cfg80211_chan_def chandef;struct ieee80211_supported_band *sband =NULL ; +u32 sb_cfg;lockdep_assert_held (&mvm->mutex);
@@ -1463,6 +1466,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm)if (ret)return ret; + sb_cfg =iwl_read_umac_prph (mvm->trans,SB_MODIFY_CFG_FLAG ); +if (!(sb_cfg &SB_CFG_RESIDES_IN_OTP_MASK ) &&iwl_mei_pldr_req ()) +return ret; + ret =iwl_mvm_load_rt_fw (mvm);if (ret) {IWL_ERR (mvm,"Failed to start RT ucode: %d\n" , ret);
Signature · 1 line
2.35.3
PATCH 9/11 wifi: iwlwifi: mei: use wait_event_timeout() return value
In reply to [email protected]From: Avraham Stern <[email protected]>
wait_event_timeout() return value indicates whether the condition evaluated to true or not, so no need to re-take the lock and check the got_ownership flag.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +1 -20
@@ -1447,26 +1447,7 @@ int iwl_mei_get_ownership(void) ret =wait_event_timeout (mei->get_ownership_wq, mei->got_ownership,HZ /2 ); -if (!ret) -return -ETIMEDOUT ; - -mutex_lock (&iwl_mei_mutex); - -/* In case we didn't have a bind */ -if (!iwl_mei_is_connected ()) { - ret =0 ; - goto out; - } - - mei =mei_cldev_get_drvdata (iwl_mei_global_cldev); - -if (!mei) { - ret = -ENODEV ; - goto out; - } - - ret = !mei->got_ownership; - +return (!ret) ? -ETIMEDOUT :0 ; out:mutex_unlock (&iwl_mei_mutex);return ret;
Signature · 1 line
2.35.3
PATCH 10/11 wifi: iwlwifi: iwlmei: report disconnection as temporary
In reply to [email protected]From: Avraham Stern <[email protected]>
Disconnections are reported to CSME as long link down. As a result, CSME will take ownership right away so the host doesn't have a chance to reconnect, although in many cases it could quickly reconnect and preserve host connectivity.
Report disconnections as temporary so CSME will give the host some grace time to reconnect.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +1 -1
@@ -1535,7 +1535,7 @@ void iwl_mei_host_disassociated(void)struct iwl_sap_notif_host_link_down msg = { .hdr.type =cpu_to_le16 (SAP_MSG_NOTIF_HOST_LINK_DOWN ), .hdr.len =cpu_to_le16 (sizeof (msg) -sizeof (msg.hdr)), - .type =HOST_LINK_DOWN_TYPE_LONG , + .type =HOST_LINK_DOWN_TYPE_TEMPORARY , };mutex_lock (&iwl_mei_mutex);
Signature · 1 line
2.35.3
PATCH 11/11 wifi: iwlwifi: mei: wait for the mac to stop on suspend
In reply to [email protected]From: Avraham Stern <[email protected]>
When iwlmei driver is removed, it removes all the interfaces since CSME will take over the NIC while there is no SAP connection. When the iwlmei driver is removed due to the host being suspended, this results in the interface being down after resume since the interface was removed on suspend so mac80211 will not try to bring it up on resume.
Since on suspend the mac is stopped anyway by mac80211, there is no need to remove the interface in this case. Wait for the mac to stop instead. Once the mac is stopped, the driver will not access the NIC anymore so it is safe for CSME to take over.
--- drivers/net/wireless/intel/iwlwifi/mei/main.c | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mei/main.c +21 -2
@@ -1990,6 +1990,7 @@ static int iwl_mei_probe(struct mei_cl_device *cldev, }#define SEND_SAP_MAX_WAIT_ITERATION 10 +#define IWLMEI_DEVICE_DOWN_WAIT_ITERATION 50static void iwl_mei_remove (struct mei_cl_device *cldev) {
@@ -2000,8 +2001,26 @@ static void iwl_mei_remove(struct mei_cl_device *cldev)* We are being removed while the bus is active, it means we are * going to suspend/ shutdown, so the NIC will disappear. */ -if (mei_cldev_enabled (cldev) && iwl_mei_cache.ops) - iwl_mei_cache.ops->nic_stolen (iwl_mei_cache.priv); +if (mei_cldev_enabled (cldev) && iwl_mei_cache.ops) { +unsigned int iter =IWLMEI_DEVICE_DOWN_WAIT_ITERATION ; +bool down = false; + +/* +* In case of suspend, wait for the mac to stop and don't remove +* the interface. This will allow the interface to come back +* on resume. +*/ +while (!down && iter--) { +mdelay (1 ); + +mutex_lock (&iwl_mei_mutex); + down = mei->device_down; +mutex_unlock (&iwl_mei_mutex); + } + +if (!down) + iwl_mei_cache.ops->nic_stolen (iwl_mei_cache.priv); + }if (rcu_access_pointer (iwl_mei_cache.netdev)) {struct net_device *dev;
Signature · 1 line
2.35.3