wifi: iwlwifi: updates intended for v6.4 2023-04-14
cover wifi: iwlwifi: updates intended for v6.4 2023-04-14
From: Gregory Greenman <[email protected]>
Hi,
Here's the next set of iwlwifi patches for v6.4. Same as the previous one, this set contains the ususal developement, small improvements, cleanups and bugfixes. It also enables the new MLO FW API.
Thanks,
Gregory
Colin Ian King (2):
wifi: iwlwifi: Fix spelling mistake "upto" -> "up to"
wifi: iwlwifi: mvm: Fix spelling mistake "Gerenal" -> "General"
Hyunwoo Kim (1):
wifi: iwlwifi: pcie: Fix integer overflow in iwl_write_to_user_buf
Ilan Peer (1):
wifi: iwlwifi: mvm: Fix setting the rate for non station cases
Johannes Berg (6):
wifi: iwlwifi: mvm: track AP STA pointer and use it for MFP
wifi: iwlwifi: mvm: make iwl_mvm_mac_ctxt_send_beacon() static
wifi: iwlwifi: mvm: fix ptk_pn memory leak
wifi: iwlwifi: mvm: set STA mask for keys in MLO
wifi: iwlwifi: mvm: validate station properly in flush
wifi: iwlwifi: mvm: tx: remove misleading if statement
Miri Korenblit (1):
wifi: iwlwifi: mvm: enable new MLD FW API
Mukesh Sisodiya (2):
wifi: iwlwifi: Add RF Step Type for BZ device
wifi: iwlwifi: add a new PCI device ID for BZ device
Tom Rix (2):
wifi: iwlwifi: mvm: initialize seq variable
wifi: iwlwifi: fw: move memset before early return
.../net/wireless/intel/iwlwifi/cfg/22000.c | 47 ++- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 +- drivers/net/wireless/intel/iwlwifi/fw/file.h | 1 + .../net/wireless/intel/iwlwifi/iwl-config.h | 4 + drivers/net/wireless/intel/iwlwifi/iwl-csr.h | 2 + drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 +- drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 7 + .../net/wireless/intel/iwlwifi/iwl-trans.h | 5 +- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 1 + .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 18 +- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 23 +- .../net/wireless/intel/iwlwifi/mvm/mld-key.c | 82 +++- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 29 +- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 29 +- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 376 +++++++++--------- .../net/wireless/intel/iwlwifi/pcie/trans.c | 2 +- 17 files changed, 378 insertions(+), 256 deletions(-)
Signature · 1 line
2.38.1
PATCH 1/15 wifi: iwlwifi: Add RF Step Type for BZ device
From: Mukesh Sisodiya <[email protected]>
Add RF step id handling and handle for BZ device. Read CNV Aux register and uses for no OTP case. Add missing rf support for Bz/Bnj device and correct/add the mapping for rf-type if OTP not present.
--- .../net/wireless/intel/iwlwifi/cfg/22000.c | 47 ++- .../net/wireless/intel/iwlwifi/iwl-config.h | 4 + drivers/net/wireless/intel/iwlwifi/iwl-csr.h | 2 + drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 7 + .../net/wireless/intel/iwlwifi/iwl-trans.h | 5 +- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 375 +++++++++--------- 6 files changed, 255 insertions(+), 185 deletions(-)
drivers/net/wireless/intel/iwlwifi/cfg/22000.c +41 -6
@@ -51,6 +51,7 @@#define IWL_MA_A_MR_A_FW_PRE "iwlwifi-ma-a0-mr-a0-"#define IWL_MA_A_FM_A_FW_PRE "iwlwifi-ma-a0-fm-a0-"#define IWL_SNJ_A_MR_A_FW_PRE "iwlwifi-SoSnj-a0-mr-a0-" +#define IWL_BZ_A_HR_A_FW_PRE "iwlwifi-bz-a0-hr-b0-"#define IWL_BZ_A_HR_B_FW_PRE "iwlwifi-bz-a0-hr-b0-"#define IWL_BZ_A_GF_A_FW_PRE "iwlwifi-bz-a0-gf-a0-"#define IWL_BZ_A_GF4_A_FW_PRE "iwlwifi-bz-a0-gf4-a0-"
@@ -69,7 +70,9 @@#define IWL_BNJ_B_GF_A_FW_PRE "iwlwifi-BzBnj-b0-gf-a0-"#define IWL_BNJ_A_GF4_A_FW_PRE "iwlwifi-BzBnj-a0-gf4-a0-"#define IWL_BNJ_B_GF4_A_FW_PRE "iwlwifi-BzBnj-b0-gf4-a0-" +#define IWL_BNJ_A_HR_A_FW_PRE "iwlwifi-BzBnj-a0-hr-b0-"#define IWL_BNJ_A_HR_B_FW_PRE "iwlwifi-BzBnj-a0-hr-b0-" +#define IWL_BNJ_B_HR_A_FW_PRE "iwlwifi-BzBnj-b0-hr-b0-"#define IWL_BNJ_B_HR_B_FW_PRE "iwlwifi-BzBnj-b0-hr-b0-"#define IWL_BNJ_B_FM_B_FW_PRE "iwlwifi-BzBnj-b0-fm-b0-"
@@ -118,6 +121,8 @@ IWL_MA_A_FM_A_FW_PRE __stringify(api) ".ucode"#define IWL_SNJ_A_MR_A_MODULE_FIRMWARE (api) \ IWL_SNJ_A_MR_A_FW_PRE __stringify(api) ".ucode" +#define IWL_BZ_A_HR_A_MODULE_FIRMWARE (api) \ + IWL_BZ_A_HR_A_FW_PRE __stringify(api) ".ucode"#define IWL_BZ_A_HR_B_MODULE_FIRMWARE (api) \ IWL_BZ_A_HR_B_FW_PRE __stringify(api) ".ucode"#define IWL_BZ_A_GF_A_MODULE_FIRMWARE (api) \
@@ -127,17 +132,17 @@#define IWL_BZ_A_MR_A_MODULE_FIRMWARE (api) \ IWL_BZ_A_MR_A_FW_PRE __stringify(api) ".ucode"#define IWL_BZ_A_FM_A_MODULE_FIRMWARE (api) \ - IWL_BZ_A_FM_A_FW_PRE __stringify(api) ".ucode" + IWL_BZ_A_FM_A_FW_PRE __stringify(api) ".ucode"#define IWL_BZ_A_FM4_A_MODULE_FIRMWARE (api) \ - IWL_BZ_A_FM4_A_FW_PRE __stringify(api) ".ucode" + IWL_BZ_A_FM4_A_FW_PRE __stringify(api) ".ucode"#define IWL_BZ_A_FM_B_MODULE_FIRMWARE (api) \ - IWL_BZ_A_FM_B_FW_PRE __stringify(api) ".ucode" + IWL_BZ_A_FM_B_FW_PRE __stringify(api) ".ucode"#define IWL_BZ_A_FM4_B_MODULE_FIRMWARE (api) \ - IWL_BZ_A_FM4_B_FW_PRE __stringify(api) ".ucode" + IWL_BZ_A_FM4_B_FW_PRE __stringify(api) ".ucode"#define IWL_GL_A_FM_A_MODULE_FIRMWARE (api) \ - IWL_GL_A_FM_A_FW_PRE __stringify(api) ".ucode" + IWL_GL_A_FM_A_FW_PRE __stringify(api) ".ucode"#define IWL_GL_B_FM_B_MODULE_FIRMWARE (api) \ - IWL_GL_B_FM_B_FW_PRE __stringify(api) ".ucode" + IWL_GL_B_FM_B_FW_PRE __stringify(api) ".ucode"#define IWL_BNJ_A_FM_A_MODULE_FIRMWARE (api) \ IWL_BNJ_A_FM_A_FW_PRE __stringify(api) ".ucode"#define IWL_BNJ_A_FM4_A_MODULE_FIRMWARE (api) \
@@ -152,8 +157,12 @@ IWL_BNJ_A_GF4_A_FW_PRE __stringify(api) ".ucode"#define IWL_BNJ_B_GF4_A_MODULE_FIRMWARE (api) \ IWL_BNJ_B_GF4_A_FW_PRE __stringify(api) ".ucode" +#define IWL_BNJ_A_HR_A_MODULE_FIRMWARE (api) \ + IWL_BNJ_A_HR_A_FW_PRE __stringify(api) ".ucode"#define IWL_BNJ_A_HR_B_MODULE_FIRMWARE (api) \ IWL_BNJ_A_HR_B_FW_PRE __stringify(api) ".ucode" +#define IWL_BNJ_B_HR_A_MODULE_FIRMWARE (api) \ + IWL_BNJ_B_HR_A_FW_PRE __stringify(api) ".ucode"#define IWL_BNJ_B_HR_B_MODULE_FIRMWARE (api) \ IWL_BNJ_B_HR_B_FW_PRE __stringify(api) ".ucode"#define IWL_BNJ_B_FM_B_MODULE_FIRMWARE (api) \
@@ -928,6 +937,14 @@ const struct iwl_cfg iwl_cfg_quz_a0_hr_b0 = { .num_rbds = IWL_NUM_RBDS_22000_HE, }; +const struct iwl_cfg iwl_cfg_bz_a0_hr_a0 = { + .fw_name_pre =IWL_BZ_A_HR_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 , +}; +const struct iwl_cfg iwl_cfg_bz_a0_hr_b0 = { .fw_name_pre =IWL_BZ_A_HR_B_FW_PRE , .uhb_supported = true,
@@ -1072,6 +1089,14 @@ const struct iwl_cfg iwl_cfg_bnj_b0_gf4_a0 = { .num_rbds = IWL_NUM_RBDS_AX210_HE, }; +const struct iwl_cfg iwl_cfg_bnj_a0_hr_a0 = { + .fw_name_pre =IWL_BNJ_A_HR_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 , +}; +const struct iwl_cfg iwl_cfg_bnj_a0_hr_b0 = { .fw_name_pre =IWL_BNJ_A_HR_B_FW_PRE , .uhb_supported = true,
@@ -1080,6 +1105,14 @@ const struct iwl_cfg iwl_cfg_bnj_a0_hr_b0 = { .num_rbds = IWL_NUM_RBDS_AX210_HE, }; +const struct iwl_cfg iwl_cfg_bnj_b0_hr_a0 = { + .fw_name_pre =IWL_BNJ_B_HR_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 , +}; +const struct iwl_cfg iwl_cfg_bnj_b0_hr_b0 = { .fw_name_pre =IWL_BNJ_B_HR_B_FW_PRE , .uhb_supported = true,
@@ -1117,6 +1150,7 @@ MODULE_FIRMWARE(IWL_MA_A_GF4_A_FW_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));MODULE_FIRMWARE (IWL_MA_A_MR_A_FW_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_MA_A_FM_A_FW_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_SNJ_A_MR_A_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX )); +MODULE_FIRMWARE (IWL_BZ_A_HR_A_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_BZ_A_HR_B_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_BZ_A_GF_A_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_BZ_A_GF4_A_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));
@@ -1132,6 +1166,7 @@ MODULE_FIRMWARE(IWL_BNJ_B_GF_A_MODULE_FIRMWARE(IWL_22000_UCODE_API_MAX));MODULE_FIRMWARE (IWL_BNJ_A_GF4_A_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_BNJ_B_GF4_A_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_BNJ_A_HR_B_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX )); +MODULE_FIRMWARE (IWL_BNJ_B_HR_A_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_BNJ_B_HR_B_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_BZ_A_FM4_A_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));MODULE_FIRMWARE (IWL_BZ_A_FM4_B_MODULE_FIRMWARE (IWL_22000_UCODE_API_MAX ));
drivers/net/wireless/intel/iwlwifi/iwl-config.h +4 -0
@@ -469,6 +469,7 @@ struct iwl_dev_info {u16 mac_type;u16 rf_type;u8 mac_step; +u8 rf_step;u8 rf_id;u8 no_160;u8 cores;
@@ -644,6 +645,7 @@ extern const struct iwl_cfg iwl_cfg_snj_a0_ms_a0;extern const struct iwl_cfg iwl_cfg_so_a0_hr_a0;extern const struct iwl_cfg iwl_cfg_so_a0_ms_a0;extern const struct iwl_cfg iwl_cfg_quz_a0_hr_b0; +extern const struct iwl_cfg iwl_cfg_bz_a0_hr_a0;extern const struct iwl_cfg iwl_cfg_bz_a0_hr_b0;extern const struct iwl_cfg iwl_cfg_bz_a0_gf_a0;extern const struct iwl_cfg iwl_cfg_bz_a0_gf4_a0;
@@ -661,7 +663,9 @@ extern const struct iwl_cfg iwl_cfg_bnj_a0_gf_a0;extern const struct iwl_cfg iwl_cfg_bnj_b0_gf_a0;extern const struct iwl_cfg iwl_cfg_bnj_a0_gf4_a0;extern const struct iwl_cfg iwl_cfg_bnj_b0_gf4_a0; +extern const struct iwl_cfg iwl_cfg_bnj_a0_hr_a0;extern const struct iwl_cfg iwl_cfg_bnj_a0_hr_b0; +extern const struct iwl_cfg iwl_cfg_bnj_b0_hr_a0;extern const struct iwl_cfg iwl_cfg_bnj_b0_hr_b0;extern const struct iwl_cfg iwl_cfg_bnj_b0_fm_b0;extern const struct iwl_cfg iwl_cfg_bnj_b0_fm4_b0;
drivers/net/wireless/intel/iwlwifi/iwl-csr.h +2 -0
@@ -311,6 +311,8 @@ enum {SILICON_A_STEP =0 ,SILICON_B_STEP ,SILICON_C_STEP , +SILICON_D_STEP , +SILICON_E_STEP , SILICON_Z_STEP = 0xf, };
drivers/net/wireless/intel/iwlwifi/iwl-prph.h +7 -0
@@ -350,6 +350,11 @@#define WFPM_OTP_CFG1_ADDR 0x00a03098#define WFPM_OTP_CFG1_IS_JACKET_BIT BIT(4)#define WFPM_OTP_CFG1_IS_CDB_BIT BIT(5) +#define WFPM_OTP_BZ_BNJ_JACKET_BIT 5 +#define WFPM_OTP_BZ_BNJ_CDB_BIT 4 +#define WFPM_OTP_CFG1_IS_JACKET (_val) (((_val) & 0x00000020) >> WFPM_OTP_BZ_BNJ_JACKET_BIT) +#define WFPM_OTP_CFG1_IS_CDB (_val) (((_val) & 0x00000010) >> WFPM_OTP_BZ_BNJ_CDB_BIT) +#define WFPM_GP2 0xA030B4
@@ -445,6 +450,8 @@ enum {#define REG_CRF_ID_TYPE_GF_TC 0xF08#define REG_CRF_ID_TYPE_MR 0x810#define REG_CRF_ID_TYPE_FM 0x910 +#define REG_CRF_ID_TYPE_FMI 0x930 +#define REG_CRF_ID_TYPE_FMR 0x900#define HPM_DEBUG 0xA03440#define PERSISTENCE_BIT BIT(12)
drivers/net/wireless/intel/iwlwifi/iwl-trans.h +3 -2
@@ -997,7 +997,7 @@ struct iwl_trans_txqs {* 0 indicates that frag SKBs (NETIF_F_SG) aren't supported. * @hw_rf_id a u32 with the device RF ID * @hw_crf_id a u32 with the device CRF ID -* @hw_cdb_id a u32 with the device CDB ID +* @hw_wfpm_id a u32 with the device wfpm ID * @hw_id: a u32 with the ID of the device / sub-device. * Set during transport allocation. * @hw_id_str: a string with info about HW ID. Set during transport allocation.
@@ -1040,7 +1040,8 @@ struct iwl_trans {u32 hw_rev_step;u32 hw_rf_id;u32 hw_crf_id; -u32 hw_cdb_id; +u32 hw_cnv_id; +u32 hw_wfpm_id;u32 hw_id;char hw_id_str[52 ];u32 sku_id[3 ];
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +198 -177
980 lines not on this page · raw message
Signature · 1 line
2.38.1
PATCH 2/15 wifi: iwlwifi: add a new PCI device ID for BZ device
In reply to [email protected]From: Mukesh Sisodiya <[email protected]>
Add support for a new PCI device ID 0x272b once registering with PCIe.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +1 -0
@@ -504,6 +504,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { /* Bz devices */ {IWL_PCI_DEVICE(0x2727, PCI_ANY_ID, iwl_bz_trans_cfg)}, + {IWL_PCI_DEVICE(0x272b, PCI_ANY_ID, iwl_bz_trans_cfg)}, {IWL_PCI_DEVICE(0xA840, PCI_ANY_ID, iwl_bz_trans_cfg)}, {IWL_PCI_DEVICE(0x7740, PCI_ANY_ID, iwl_bz_trans_cfg)}, #endif /* CONFIG_IWLMVM */
Signature · 1 line
2.38.1
PATCH 3/15 wifi: iwlwifi: mvm: enable new MLD FW API
In reply to [email protected]From: Miri Korenblit <[email protected]>
Enable the new FW API with MLD based on FW TLV.
--- drivers/net/wireless/intel/iwlwifi/fw/file.h | 1 + drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 20 ++------------------ 2 files changed, 3 insertions(+), 18 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/file.h +1 -0
@@ -459,6 +459,7 @@ enum iwl_ucode_tlv_capa {IWL_UCODE_TLV_CAPA_SYNCED_TIME = (__force iwl_ucode_tlv_capa_t )106 ,IWL_UCODE_TLV_CAPA_TIME_SYNC_BOTH_FTM_TM = (__force iwl_ucode_tlv_capa_t )108 ,IWL_UCODE_TLV_CAPA_BIGTK_TX_SUPPORT = (__force iwl_ucode_tlv_capa_t )109 , +IWL_UCODE_TLV_CAPA_MLD_API_SUPPORT = (__force iwl_ucode_tlv_capa_t )110 ,IWL_UCODE_TLV_CAPA_SCAN_DONT_TOGGLE_ANT = (__force iwl_ucode_tlv_capa_t )111 , #ifdef __CHECKER__
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +2 -18
@@ -1401,24 +1401,8 @@ static inline bool iwl_mvm_has_new_rx_api(struct iwl_mvm *mvm)static inline bool iwl_mvm_has_mld_api (const struct iwl_fw *fw) { -return (iwl_fw_lookup_cmd_ver (fw,LINK_CONFIG_CMD , -IWL_FW_CMD_VER_UNKNOWN ) != -IWL_FW_CMD_VER_UNKNOWN ) && - (iwl_fw_lookup_cmd_ver (fw,MAC_CONFIG_CMD , -IWL_FW_CMD_VER_UNKNOWN ) != -IWL_FW_CMD_VER_UNKNOWN ) && - (iwl_fw_lookup_cmd_ver (fw,STA_CONFIG_CMD , -IWL_FW_CMD_VER_UNKNOWN ) != -IWL_FW_CMD_VER_UNKNOWN ) && - (iwl_fw_lookup_cmd_ver (fw,AUX_STA_CMD , -IWL_FW_CMD_VER_UNKNOWN ) != -IWL_FW_CMD_VER_UNKNOWN ) && - (iwl_fw_lookup_cmd_ver (fw,STA_REMOVE_CMD , -IWL_FW_CMD_VER_UNKNOWN ) != -IWL_FW_CMD_VER_UNKNOWN ) && - (iwl_fw_lookup_cmd_ver (fw,STA_DISABLE_TX_CMD , -IWL_FW_CMD_VER_UNKNOWN ) != -IWL_FW_CMD_VER_UNKNOWN ); +return fw_has_capa (&fw->ucode_capa, +IWL_UCODE_TLV_CAPA_MLD_API_SUPPORT ); }static inline bool iwl_mvm_has_new_tx_api (struct iwl_mvm *mvm)
Signature · 1 line
2.38.1
PATCH 4/15 wifi: iwlwifi: Fix spelling mistake "upto" -> "up to"
In reply to [email protected]From: Colin Ian King <[email protected]>
There is a spelling mistake in a IWL_ERR error message. Fix it.
--- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c +1 -1
@@ -895,7 +895,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, drv->fw.img[IWL_UCODE_WOWLAN ].is_dual_cpus = true; }else if ((num_of_cpus >2 ) || (num_of_cpus <1 )) { -IWL_ERR (drv,"Driver support upto 2 CPUs\n" ); +IWL_ERR (drv,"Driver support up to 2 CPUs\n" );return -EINVAL ; }break ;
Signature · 1 line
2.38.1
PATCH 5/15 wifi: iwlwifi: mvm: Fix spelling mistake "Gerenal" -> "General"
In reply to [email protected]From: Colin Ian King <[email protected]>
There is a spelling mistake in a IWL_DEBUG_SCAN debug message. Fix it.
--- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/scan.c +1 -1
@@ -2297,7 +2297,7 @@ iwl_mvm_scan_umac_fill_general_p_v11(struct iwl_mvm *mvm,iwl_mvm_scan_umac_dwell_v11 (mvm, gp, params); -IWL_DEBUG_SCAN (mvm,"Gerenal: flags=0x%x, flags2=0x%x\n" , +IWL_DEBUG_SCAN (mvm,"General: flags=0x%x, flags2=0x%x\n" , gen_flags, gen_flags2); gp->flags =cpu_to_le16 (gen_flags);
Signature · 1 line
2.38.1
PATCH 6/15 wifi: iwlwifi: mvm: initialize seq variable
In reply to [email protected]From: Tom Rix <[email protected]>
Clang static analysis reports this issue
d3.c:567:22: warning: The left operand of '>' is
a garbage value
if (seq.tkip.iv32 > cur_rx_iv32)
~~~~~~~~~~~~~ ^
seq is never initialized. Call ieee80211_get_key_rx_seq() to initialize seq.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +1 -0
@@ -564,6 +564,7 @@ static void iwl_mvm_wowlan_get_tkip_data(struct ieee80211_hw *hw, }for (i =0 ; i <IWL_NUM_RSC ; i++) { +ieee80211_get_key_rx_seq (key, i, &seq);/* wrapping isn't allowed, AP must rekey */ if (seq.tkip.iv32 > cur_rx_iv32) cur_rx_iv32 = seq.tkip.iv32;
Signature · 1 line
2.38.1
PATCH 7/15 wifi: iwlwifi: fw: move memset before early return
In reply to [email protected]From: Tom Rix <[email protected]>
Clang static analysis reports this representative issue dbg.c:1455:6: warning: Branch condition evaluates to a garbage value
if (!rxf_data.size)
^~~~~~~~~~~~~~
This check depends on iwl_ini_get_rxf_data() to clear rxf_data but the function can return early without doing the clear. So move the memset before the early return.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +2 -2
@@ -1388,13 +1388,13 @@ static void iwl_ini_get_rxf_data(struct iwl_fw_runtime *fwrt,if (!data)return ; +memset (data,0 ,sizeof (*data)); +/* make sure only one bit is set in only one fid */ if (WARN_ONCE (hweight_long (fid1) +hweight_long (fid2) !=1 ,"fid1=%x, fid2=%x\n" , fid1, fid2))return ; -memset (data,0 ,sizeof (*data)); -if (fid1) { fifo_idx =ffs (fid1) -1 ; if (WARN_ONCE(fifo_idx >= MAX_NUM_LMAC, "fifo_idx=%d\n",
Signature · 1 line
2.38.1
PATCH 8/15 wifi: iwlwifi: pcie: Fix integer overflow in iwl_write_to_user_buf
In reply to [email protected]From: Hyunwoo Kim <[email protected]>
An integer overflow occurs in the iwl_write_to_user_buf() function, which is called by the iwl_dbgfs_monitor_data_read() function.
static bool iwl_write_to_user_buf(char __user *user_buf, ssize_t count,
void *buf, ssize_t *size, ssize_t *bytes_copied)
{
int buf_size_left = count - *bytes_copied;
buf_size_left = buf_size_left - (buf_size_left % sizeof(u32));
if (*size > buf_size_left)
*size = buf_size_left;If the user passes a SIZE_MAX value to the "ssize_t count" parameter, the ssize_t count parameter is assigned to "int buf_size_left". Then compare "*size" with "buf_size_left" . Here, "buf_size_left" is a negative number, so "*size" is assigned "buf_size_left" and goes into the third argument of the copy_to_user function, causing a heap overflow.
This is not a security vulnerability because iwl_dbgfs_monitor_data_read() is a debugfs operation with 0400 privileges.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +1 -1
@@ -2860,7 +2860,7 @@ static bool iwl_write_to_user_buf(char __user *user_buf, ssize_t count, void *buf, ssize_t *size, ssize_t *bytes_copied) { - int buf_size_left = count - *bytes_copied; + ssize_t buf_size_left = count - *bytes_copied; buf_size_left = buf_size_left - (buf_size_left %sizeof (u32));if (*size > buf_size_left)
Signature · 1 line
2.38.1
PATCH 9/15 wifi: iwlwifi: mvm: track AP STA pointer and use it for MFP
In reply to [email protected]From: Johannes Berg <[email protected]>
Instead of relying on the AP STA ID and dereferencing our firmware -> mac80211 STA array when we really only need the STA, not the per-link information (and might not have it, e.g. for a pairwise key installation where this is relevant), keep track of the AP STA as a pointer to the mac80211 STA, protected by the mutex. Then use it here in the key code instead.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 8 +++++++- drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c | 13 ++++--------- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 ++ 3 files changed, 13 insertions(+), 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +7 -1
@@ -3669,6 +3669,7 @@ iwl_mvm_sta_state_notexist_to_none(struct iwl_mvm *mvm,struct ieee80211_sta *sta, struct iwl_mvm_sta_state_ops *callbacks) { + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);unsigned int i;int ret;
@@ -3704,6 +3705,9 @@ iwl_mvm_sta_state_notexist_to_none(struct iwl_mvm *mvm, }ieee80211_sta_recalc_aggregates (sta); +if (vif->type ==NL80211_IFTYPE_STATION && !sta->tdls) + mvmvif->ap_sta = sta; +return 0 ; }
@@ -3931,8 +3935,10 @@ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw, ret =0 ; }else if (old_state ==IEEE80211_STA_NONE && new_state ==IEEE80211_STA_NOTEXIST ) { -if (vif->type ==NL80211_IFTYPE_STATION && !sta->tdls) +if (vif->type ==NL80211_IFTYPE_STATION && !sta->tdls) {iwl_mvm_stop_session_protection (mvm, vif); + mvmvif->ap_sta =NULL ; + } ret = callbacks->rm_sta (mvm, vif, sta);if (sta->tdls) {iwl_mvm_recalc_tdls_state (mvm, vif, false);
drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c +4 -9
@@ -41,6 +41,8 @@ static u32 iwl_mvm_get_sec_flags(struct iwl_mvm *mvm,struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif);u32 flags =0 ; +lockdep_assert_held (&mvm->mutex); +if (!(keyconf->flags &IEEE80211_KEY_FLAG_PAIRWISE )) flags |=IWL_SEC_KEY_FLAG_MCAST_KEY ;
@@ -68,18 +70,11 @@ static u32 iwl_mvm_get_sec_flags(struct iwl_mvm *mvm,break ; } -rcu_read_lock (); -if (!sta && vif->type ==NL80211_IFTYPE_STATION && - mvmvif->deflink.ap_sta_id !=IWL_MVM_INVALID_STA ) { -u8 sta_id = mvmvif->deflink.ap_sta_id; - - sta =rcu_dereference_check (mvm->fw_id_to_mac_id[sta_id], -lockdep_is_held (&mvm->mutex)); - } +if (!sta && vif->type ==NL80211_IFTYPE_STATION ) + sta = mvmvif->ap_sta;if (!IS_ERR_OR_NULL (sta) && sta->mfp) flags |=IWL_SEC_KEY_FLAG_MFP ; -rcu_read_unlock ();return flags; }
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +2 -0
@@ -434,6 +434,8 @@ struct iwl_mvm_vif {/* TCP Checksum Offload */ netdev_features_t features; +struct ieee80211_sta *ap_sta; +/* we can only have 2 GTK + 2 IGTK active at a time */ struct ieee80211_key_conf *ap_early_keys[4 ];
Signature · 1 line
2.38.1
PATCH 10/15 wifi: iwlwifi: mvm: make iwl_mvm_mac_ctxt_send_beacon() static
In reply to [email protected]From: Johannes Berg <[email protected]>
We never needed this to be non-static, that was just an artifact of the development process. Make it static.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 8 ++++---- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 4 ---- 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +4 -4
@@ -1102,10 +1102,10 @@ static int iwl_mvm_mac_ctxt_send_beacon_v9(struct iwl_mvm *mvm, sizeof(beacon_cmd)); } -int iwl_mvm_mac_ctxt_send_beacon (struct iwl_mvm *mvm, -struct ieee80211_vif *vif, -struct sk_buff *beacon, -struct ieee80211_bss_conf *link_conf) +static int iwl_mvm_mac_ctxt_send_beacon (struct iwl_mvm *mvm, +struct ieee80211_vif *vif, +struct sk_buff *beacon, +struct ieee80211_bss_conf *link_conf) {if (WARN_ON (!beacon))return -EINVAL ;
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +0 -4
@@ -1780,10 +1780,6 @@ int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif);int iwl_mvm_mac_ctxt_beacon_changed (struct iwl_mvm *mvm,struct ieee80211_vif *vif,struct ieee80211_bss_conf *link_conf); -int iwl_mvm_mac_ctxt_send_beacon (struct iwl_mvm *mvm, -struct ieee80211_vif *vif, -struct sk_buff *beacon, -struct ieee80211_bss_conf *link_conf);int iwl_mvm_mac_ctxt_send_beacon_cmd (struct iwl_mvm *mvm,struct sk_buff *beacon,void *data,int len);
Signature · 1 line
2.38.1
PATCH 11/15 wifi: iwlwifi: mvm: fix ptk_pn memory leak
In reply to [email protected]From: Johannes Berg <[email protected]>
If adding a key to firmware fails we leak the allocated ptk_pn. This shouldn't happen in practice, but we should still fix it.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +5 -1
@@ -4107,7 +4107,7 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw,struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif);struct iwl_mvm *mvm =IWL_MAC80211_GET_MVM (hw);struct iwl_mvm_sta *mvmsta =NULL ; -struct iwl_mvm_key_pn *ptk_pn; +struct iwl_mvm_key_pn *ptk_pn =NULL ;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 );
@@ -4265,6 +4265,10 @@ static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw,if (ret) {IWL_WARN (mvm,"set key failed\n" ); key->hw_key_idx =STA_KEY_IDX_INVALID ; +if (ptk_pn) { +RCU_INIT_POINTER (mvmsta->ptk_pn[keyidx],NULL ); +kfree (ptk_pn); + }/* * can't add key for RX, but we don't need it * in the device for TX so still return 0,
Signature · 1 line
2.38.1
PATCH 12/15 wifi: iwlwifi: mvm: set STA mask for keys in MLO
In reply to [email protected]From: Johannes Berg <[email protected]>
Implement the full STA mask and selecting the correct link for key installation.
While at it, catch errors if this function returns a bad zero station mask, rather than waiting for the firmware to crash on it.
--- .../net/wireless/intel/iwlwifi/mvm/mld-key.c | 69 ++++++++++++++++--- 1 file changed, 60 insertions(+), 9 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c +60 -9
@@ -14,23 +14,68 @@ static u32 iwl_mvm_get_sec_sta_mask(struct iwl_mvm *mvm, struct ieee80211_key_conf *keyconf) {struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif); +struct iwl_mvm_vif_link_info *link_info = &mvmvif->deflink; +struct iwl_mvm_link_sta *link_sta; +struct iwl_mvm_sta *mvmsta; +u32 result =0 ; +int link_id; +lockdep_assert_held (&mvm->mutex); + +if (keyconf->link_id >=0 ) { + link_info = mvmvif->link[keyconf->link_id]; +if (!link_info) +return 0 ; + } + +/* AP group keys are per link and should be on the mcast STA */ if (vif->type ==NL80211_IFTYPE_AP && !(keyconf->flags &IEEE80211_KEY_FLAG_PAIRWISE )) -return BIT (mvmvif->deflink.mcast_sta.sta_id); +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 ) + sta = mvmvif->ap_sta; + +/* During remove the STA was removed and the group keys come later +* (which sounds like a bad sequence, but remember that to mac80211 the +* group keys have no sta pointer), so we don't have a STA now. +* Since this happens for group keys only, just use the link_info as +* the group keys are per link; make sure that is the case by checking +* we do have a link_id or are not doing MLO. +* Of course the same can be done during add as well, but we must do +* it during remove, since we don't have the mvmvif->ap_sta pointer. +*/ +if (!sta && (keyconf->link_id >=0 || !vif->valid_links)) +return BIT (link_info->ap_sta_id); -if (sta) { -struct iwl_mvm_sta *mvmsta =iwl_mvm_sta_from_mac80211 (sta); +/* this shouldn't happen now */ +if (!sta) +return 0 ; + mvmsta =iwl_mvm_sta_from_mac80211 (sta); + +/* it's easy when the STA is not an MLD */ +if (!sta->valid_links)return BIT (mvmsta->deflink.sta_id); - } -if (vif->type ==NL80211_IFTYPE_STATION && - mvmvif->deflink.ap_sta_id !=IWL_MVM_INVALID_STA ) -return BIT (mvmvif->deflink.ap_sta_id); +/* but if it is an MLD, get the mask of all the FW STAs it has ... */ +for (link_id =0 ; link_id <ARRAY_SIZE (mvmsta->link); link_id++) { +/* unless we have a specific link in mind (GTK on client) */ +if (keyconf->link_id >=0 && + keyconf->link_id != link_id) +continue ; + + link_sta = +rcu_dereference_protected (mvmsta->link[link_id], +lockdep_is_held (&mvm->mutex)); +if (!link_sta) +continue ; + + result |=BIT (link_sta->sta_id); + } -/* invalid */ -return 0 ; +return result; } static u32 iwl_mvm_get_sec_flags(struct iwl_mvm *mvm,
@@ -113,6 +158,9 @@ int iwl_mvm_sec_key_add(struct iwl_mvm *mvm,if (WARN_ON (keyconf->keylen >sizeof (cmd.u.add.key)))return -EINVAL ; +if (WARN_ON (!sta_mask)) +return -EINVAL ; +if (keyconf->cipher ==WLAN_CIPHER_SUITE_WEP40 || keyconf->cipher ==WLAN_CIPHER_SUITE_WEP104 ) memcpy(cmd.u.add.key + IWL_SEC_WEP_KEY_OFFSET, keyconf->key,
@@ -159,6 +207,9 @@ static int _iwl_mvm_sec_key_del(struct iwl_mvm *mvm,u32 key_flags =iwl_mvm_get_sec_flags (mvm, vif, sta, keyconf);int ret; +if (WARN_ON (!sta_mask)) +return -EINVAL ; + ret =__iwl_mvm_sec_key_del (mvm, sta_mask, key_flags, keyconf->keyidx, flags);if (ret)
Signature · 1 line
2.38.1
PATCH 13/15 wifi: iwlwifi: mvm: validate station properly in flush
In reply to [email protected]From: Johannes Berg <[email protected]>
If we have MLO, then the deflink.ap_sta_id cannot be used. However, we can use the new mvmvif->ap_sta pointer for the validation instead.
Also don't do it multiple times for different FW instances of the same AP STA (TDLS STAs are only on a single link).
Note that this isn't really working right yet since the underlying flush code hasn't been updated yet to know of multiple link STAs.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +8 -1
@@ -5605,6 +5605,7 @@ void iwl_mvm_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct iwl_mvm_vif *mvmvif;struct iwl_mvm_sta *mvmsta;struct ieee80211_sta *sta; +bool ap_sta_done = false;int i;u32 msk =0 ;
@@ -5633,8 +5634,14 @@ void iwl_mvm_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,if (mvmsta->vif != vif)continue ; +if (sta == mvmvif->ap_sta) { +if (ap_sta_done) +continue ; + ap_sta_done = true; + } +/* make sure only TDLS peers or the AP are flushed */ -WARN_ON_ONCE (i != mvmvif->deflink.ap_sta_id && !sta->tdls); +WARN_ON_ONCE (sta != mvmvif->ap_sta && !sta->tdls);if (drop) {if (iwl_mvm_flush_sta (mvm, mvmsta, false))
Signature · 1 line
2.38.1
PATCH 14/15 wifi: iwlwifi: mvm: Fix setting the rate for non station cases
In reply to [email protected]From: Ilan Peer <[email protected]>
The setting of the rate used for non station cases did not take into consideration the interface type etc., thus when probe responses are transmitted on P2P Device interface etc. CCK rates were used which is not allowed.
Modify the code so the non station case would consider the interface type etc. For HWs/FWs that do not support rate control, preserve the previous behavior, i.e., take the rate from the skb metadata and adjust as needed.
--- .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 10 ++++--- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 +++ drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 26 +++++++++---------- 3 files changed, 22 insertions(+), 17 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +6 -4
@@ -870,9 +870,9 @@ static u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size)return ie - beacon; } -static u8 iwl_mvm_mac_ctxt_get_lowest_rate (struct iwl_mvm *mvm, -struct ieee80211_tx_info *info, -struct ieee80211_vif *vif) +u8 iwl_mvm_mac_ctxt_get_lowest_rate (struct iwl_mvm *mvm, +struct ieee80211_tx_info *info, +struct ieee80211_vif *vif) {struct ieee80211_supported_band *sband;unsigned long basic = vif->bss_conf.basic_rates;
@@ -892,7 +892,9 @@ static u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm, } } -if (info->band ==NL80211_BAND_2GHZ && !vif->p2p) { +if (info->band ==NL80211_BAND_2GHZ && !vif->p2p && + vif->type !=NL80211_IFTYPE_P2P_DEVICE && + !(info->flags &IEEE80211_TX_CTL_NO_CCK_RATE )) {if (lowest_cck !=IWL_RATE_COUNT ) rate = lowest_cck;else if (lowest_ofdm !=IWL_RATE_COUNT )
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +3 -0
@@ -1786,6 +1786,9 @@ int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm,u8 iwl_mvm_mac_ctxt_get_beacon_rate (struct iwl_mvm *mvm,struct ieee80211_tx_info *info,struct ieee80211_vif *vif); +u8 iwl_mvm_mac_ctxt_get_lowest_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); void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm,
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +13 -13
@@ -329,23 +329,23 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm, sta ? iwl_mvm_sta_from_mac80211(sta)->sta_state : -1); rate_idx = info->control.rates[0 ].idx; + +/* For non 2 GHZ band, remap mac80211 rate ndices into driver +* indices. +*/ +if (info->band !=NL80211_BAND_2GHZ || + (info->flags &IEEE80211_TX_CTL_NO_CCK_RATE )) + rate_idx +=IWL_FIRST_OFDM_RATE ; + +/* For 2.4 GHZ band, check that there is no need to remap */ +BUILD_BUG_ON (IWL_FIRST_CCK_RATE !=0 ); }/* if the rate isn't a well known legacy rate, take the lowest one */ if (rate_idx <0 || rate_idx >=IWL_RATE_COUNT_LEGACY ) - rate_idx =rate_lowest_index ( - &mvm->nvm_data->bands[info->band], sta); - -/* -* For non 2 GHZ band, remap mac80211 rate -* indices into driver indices -*/ -if (info->band !=NL80211_BAND_2GHZ || - (info->flags &IEEE80211_TX_CTL_NO_CCK_RATE )) - rate_idx +=IWL_FIRST_OFDM_RATE ; - -/* For 2.4 GHZ band, check that there is no need to remap */ -BUILD_BUG_ON (IWL_FIRST_CCK_RATE !=0 ); + rate_idx =iwl_mvm_mac_ctxt_get_lowest_rate (mvm, + info, + info->control.vif);/* Get PLCP rate for tx_cmd->rate_n_flags */ rate_plcp =iwl_mvm_mac80211_idx_to_hwrate (mvm->fw, rate_idx);
Signature · 1 line
2.38.1
PATCH 15/15 wifi: iwlwifi: mvm: tx: remove misleading if statement
In reply to [email protected]From: Johannes Berg <[email protected]>
The if statement here is misleading, we return zero anyway since we just checked the 'ret' variable, simplify the code to remove the condition entirely.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +1 -2
@@ -1255,8 +1255,7 @@ int iwl_mvm_tx_skb_sta(struct iwl_mvm *mvm, struct sk_buff *skb,if (ret)return ret; -if (WARN_ON (skb_queue_empty (&mpdus_skbs))) -return ret; +WARN_ON (skb_queue_empty (&mpdus_skbs));while (!skb_queue_empty (&mpdus_skbs)) { skb =__skb_dequeue (&mpdus_skbs);
Signature · 1 line
2.38.1