Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'wireless-next-2025-07-10' of https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next

Johannes Berg says:

====================
Quite a bit more work, notably:
- mt76: firmware recovery improvements, MLO work
- iwlwifi: use embedded PNVM in (to be released) FW images
to fix compatibility issues
- cfg80211/mac80211: extended regulatory info support (6 GHz)
- cfg80211: use "faux device" for regulatory

* tag 'wireless-next-2025-07-10' of https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (48 commits)
wifi: mac80211: don't complete management TX on SAE commit
wifi: cfg80211/mac80211: implement dot11ExtendedRegInfoSupport
wifi: mac80211: send extended MLD capa/ops if AP has it
wifi: mac80211: copy first_part into HW scan
wifi: cfg80211: add a flag for the first part of a scan
wifi: mac80211: remove DISALLOW_PUNCTURING_5GHZ code
wifi: cfg80211: only verify part of Extended MLD Capabilities
wifi: nl80211: make nl80211_check_scan_flags() type safe
wifi: cfg80211: hide scan internals
wifi: mac80211: fix deactivated link CSA
wifi: mac80211: add mandatory bitrate support for 6 GHz
wifi: mac80211: remove spurious blank line
wifi: mac80211: verify state before connection
wifi: mac80211: avoid weird state in error path
wifi: iwlwifi: mvm: remove support for iwl_wowlan_info_notif_v4
wifi: iwlwifi: bump minimum API version in BZ
wifi: iwlwifi: mvm: remove unneeded argument
wifi: iwlwifi: mvm: remove MLO GTK rekey code
wifi: iwlwifi: pcie: rename iwl_pci_gen1_2_probe() argument
wifi: iwlwifi: match discrete/integrated to fix some names
...
====================

Link: https://patch.msgid.link/20250710123113.24878-3-johannes@sipsolutions.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+1221 -1056
+2 -2
drivers/net/wireless/intel/iwlwifi/cfg/bz.c
··· 10 10 #include "fw/api/txq.h" 11 11 12 12 /* Highest firmware API version supported */ 13 - #define IWL_BZ_UCODE_API_MAX 99 13 + #define IWL_BZ_UCODE_API_MAX 102 14 14 15 15 /* Lowest firmware API version supported */ 16 - #define IWL_BZ_UCODE_API_MIN 94 16 + #define IWL_BZ_UCODE_API_MIN 98 17 17 18 18 /* Memory offsets and lengths */ 19 19 #define IWL_BZ_SMEM_OFFSET 0x400000
+1 -1
drivers/net/wireless/intel/iwlwifi/cfg/dr.c
··· 9 9 #include "fw/api/txq.h" 10 10 11 11 /* Highest firmware API version supported */ 12 - #define IWL_DR_UCODE_API_MAX 99 12 + #define IWL_DR_UCODE_API_MAX 102 13 13 14 14 /* Lowest firmware API version supported */ 15 15 #define IWL_DR_UCODE_API_MIN 98
+1 -1
drivers/net/wireless/intel/iwlwifi/cfg/sc.c
··· 10 10 #include "fw/api/txq.h" 11 11 12 12 /* Highest firmware API version supported */ 13 - #define IWL_SC_UCODE_API_MAX 99 13 + #define IWL_SC_UCODE_API_MAX 102 14 14 15 15 /* Lowest firmware API version supported */ 16 16 #define IWL_SC_UCODE_API_MIN 98
+9 -12
drivers/net/wireless/intel/iwlwifi/dvm/eeprom.c
··· 676 676 CSR_HW_IF_CONFIG_REG_EEPROM_OWN_SEM); 677 677 678 678 /* See if we got it */ 679 - ret = iwl_poll_bit(trans, CSR_HW_IF_CONFIG_REG, 680 - CSR_HW_IF_CONFIG_REG_EEPROM_OWN_SEM, 681 - CSR_HW_IF_CONFIG_REG_EEPROM_OWN_SEM, 682 - IWL_EEPROM_SEM_TIMEOUT); 679 + ret = iwl_poll_bits(trans, CSR_HW_IF_CONFIG_REG, 680 + CSR_HW_IF_CONFIG_REG_EEPROM_OWN_SEM, 681 + IWL_EEPROM_SEM_TIMEOUT); 683 682 if (ret >= 0) { 684 683 IWL_DEBUG_EEPROM(trans->dev, 685 684 "Acquired semaphore after %d tries.\n", ··· 796 797 797 798 iwl_write32(trans, CSR_EEPROM_REG, 798 799 CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); 799 - ret = iwl_poll_bit(trans, CSR_EEPROM_REG, 800 - CSR_EEPROM_REG_READ_VALID_MSK, 801 - CSR_EEPROM_REG_READ_VALID_MSK, 802 - IWL_EEPROM_ACCESS_TIMEOUT); 800 + ret = iwl_poll_bits(trans, CSR_EEPROM_REG, 801 + CSR_EEPROM_REG_READ_VALID_MSK, 802 + IWL_EEPROM_ACCESS_TIMEOUT); 803 803 if (ret < 0) { 804 804 IWL_ERR(trans, "Time out reading OTP[%d]\n", addr); 805 805 return ret; ··· 991 993 iwl_write32(trans, CSR_EEPROM_REG, 992 994 CSR_EEPROM_REG_MSK_ADDR & (addr << 1)); 993 995 994 - ret = iwl_poll_bit(trans, CSR_EEPROM_REG, 995 - CSR_EEPROM_REG_READ_VALID_MSK, 996 - CSR_EEPROM_REG_READ_VALID_MSK, 997 - IWL_EEPROM_ACCESS_TIMEOUT); 996 + ret = iwl_poll_bits(trans, CSR_EEPROM_REG, 997 + CSR_EEPROM_REG_READ_VALID_MSK, 998 + IWL_EEPROM_ACCESS_TIMEOUT); 998 999 if (ret < 0) { 999 1000 IWL_ERR(trans, 1000 1001 "Time out reading EEPROM[%d]\n", addr);
+2 -1
drivers/net/wireless/intel/iwlwifi/dvm/main.c
··· 1467 1467 /******************** 1468 1468 * 6. Setup services 1469 1469 ********************/ 1470 - if (iwl_setup_deferred_work(priv)) 1470 + err = iwl_setup_deferred_work(priv); 1471 + if (err) 1471 1472 goto out_uninit_drv; 1472 1473 1473 1474 iwl_setup_rx_handlers(priv);
+4 -9
drivers/net/wireless/intel/iwlwifi/fw/api/d3.h
··· 912 912 } __packed; /* WOWLAN_MLO_GTK_KEY_API_S_VER_1 */ 913 913 914 914 /** 915 - * struct iwl_wowlan_info_notif_v4 - WoWLAN information notification 915 + * struct iwl_wowlan_info_notif_v3 - WoWLAN information notification 916 916 * @gtk: GTK data 917 917 * @igtk: IGTK data 918 918 * @bigtk: BIGTK data ··· 927 927 * @tid_tear_down: bit mask of tids whose BA sessions were closed 928 928 * in suspend state 929 929 * @station_id: station id 930 - * @num_mlo_link_keys: number of &struct iwl_wowlan_mlo_gtk structs 931 - * following this notif, or reserved in version < 4 932 930 * @reserved2: reserved 933 - * @mlo_gtks: array of GTKs of size num_mlo_link_keys for version >= 4 934 931 */ 935 - struct iwl_wowlan_info_notif_v4 { 932 + struct iwl_wowlan_info_notif_v3 { 936 933 struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM]; 937 934 struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM]; 938 935 struct iwl_wowlan_igtk_status bigtk[WOWLAN_BIGTK_KEYS_NUM]; ··· 943 946 __le32 received_beacons; 944 947 u8 tid_tear_down; 945 948 u8 station_id; 946 - u8 num_mlo_link_keys; 947 - u8 reserved2; 948 - struct iwl_wowlan_mlo_gtk mlo_gtks[]; 949 - } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_3, _VER_4 */ 949 + u8 reserved2[2]; 950 + } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_3 */ 950 951 951 952 /** 952 953 * struct iwl_wowlan_info_notif - WoWLAN information notification
+3
drivers/net/wireless/intel/iwlwifi/fw/file.h
··· 104 104 IWL_UCODE_TLV_CURRENT_PC = 68, 105 105 IWL_UCODE_TLV_FSEQ_BIN_VERSION = 72, 106 106 107 + /* contains sub-sections like PNVM file does (did) */ 108 + IWL_UCODE_TLV_PNVM_DATA = 74, 109 + 107 110 IWL_UCODE_TLV_FW_NUM_STATIONS = IWL_UCODE_TLV_CONST_BASE + 0, 108 111 IWL_UCODE_TLV_FW_NUM_LINKS = IWL_UCODE_TLV_CONST_BASE + 1, 109 112 IWL_UCODE_TLV_FW_NUM_BEACONS = IWL_UCODE_TLV_CONST_BASE + 2,
+5
drivers/net/wireless/intel/iwlwifi/fw/img.h
··· 195 195 * @phy_integration_ver_len: length of @phy_integration_ver 196 196 * @dump_excl: image dump exclusion areas for RT image 197 197 * @dump_excl_wowlan: image dump exclusion areas for WoWLAN image 198 + * @pnvm_data: PNVM data embedded in the .ucode file, if any 199 + * @pnvm_size: size of the embedded PNVM data 198 200 */ 199 201 struct iwl_fw { 200 202 u32 ucode_ver; ··· 229 227 u32 phy_integration_ver_len; 230 228 231 229 struct iwl_dump_exclude dump_excl[2], dump_excl_wowlan[2]; 230 + 231 + const void *pnvm_data; 232 + u32 pnvm_size; 232 233 }; 233 234 234 235 static inline const char *get_fw_dbg_mode_string(int mode)
+20 -12
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
··· 11 11 #include "fw/api/nvm-reg.h" 12 12 #include "fw/api/alive.h" 13 13 #include "fw/uefi.h" 14 + #include "fw/img.h" 14 15 15 16 #define IWL_PNVM_REDUCED_CAP_BIT BIT(25) 16 17 ··· 265 264 return 0; 266 265 } 267 266 268 - static u8 *iwl_get_pnvm_image(struct iwl_trans *trans_p, size_t *len, 269 - __le32 sku_id[3]) 267 + static const u8 *iwl_get_pnvm_image(struct iwl_trans *trans_p, size_t *len, 268 + __le32 sku_id[3], const struct iwl_fw *fw) 270 269 { 271 270 struct pnvm_sku_package *package; 272 271 u8 *image = NULL; ··· 291 290 } 292 291 } 293 292 293 + if (fw->pnvm_data) { 294 + *len = fw->pnvm_size; 295 + 296 + return fw->pnvm_data; 297 + } 298 + 294 299 /* If it's not available, or for Intel SKU, try from the filesystem */ 295 300 if (iwl_pnvm_get_from_fs(trans_p, &image, len)) 296 301 return NULL; ··· 305 298 306 299 static void 307 300 iwl_pnvm_load_pnvm_to_trans(struct iwl_trans *trans, 308 - const struct iwl_ucode_capabilities *capa, 301 + const struct iwl_fw *fw, 309 302 __le32 sku_id[3]) 310 303 { 311 304 struct iwl_pnvm_image *pnvm_data = NULL; 312 - u8 *data = NULL; 305 + const u8 *data = NULL; 313 306 size_t length; 314 307 int ret; 315 308 ··· 320 313 if (trans->pnvm_loaded) 321 314 goto set; 322 315 323 - data = iwl_get_pnvm_image(trans, &length, sku_id); 316 + data = iwl_get_pnvm_image(trans, &length, sku_id, fw); 324 317 if (!data) { 325 318 trans->fail_to_parse_pnvm_image = true; 326 319 return; ··· 336 329 goto free; 337 330 } 338 331 339 - ret = iwl_trans_load_pnvm(trans, pnvm_data, capa); 332 + ret = iwl_trans_load_pnvm(trans, pnvm_data, &fw->ucode_capa); 340 333 if (ret) 341 334 goto free; 342 335 IWL_DEBUG_INFO(trans, "loaded PNVM version %08x\n", pnvm_data->version); 343 336 344 337 set: 345 - iwl_trans_set_pnvm(trans, capa); 338 + iwl_trans_set_pnvm(trans, &fw->ucode_capa); 346 339 free: 347 - kvfree(data); 340 + /* free only if it was allocated, i.e. not just embedded PNVM data */ 341 + if (data != fw->pnvm_data) 342 + kvfree(data); 348 343 kfree(pnvm_data); 349 344 } 350 345 ··· 401 392 402 393 int iwl_pnvm_load(struct iwl_trans *trans, 403 394 struct iwl_notif_wait_data *notif_wait, 404 - const struct iwl_ucode_capabilities *capa, 405 - __le32 sku_id[3]) 395 + const struct iwl_fw *fw, __le32 sku_id[3]) 406 396 { 407 397 struct iwl_notification_wait pnvm_wait; 408 398 static const u16 ntf_cmds[] = { WIDE_ID(REGULATORY_AND_NVM_GROUP, ··· 411 403 if (!sku_id[0] && !sku_id[1] && !sku_id[2]) 412 404 return 0; 413 405 414 - iwl_pnvm_load_pnvm_to_trans(trans, capa, sku_id); 415 - iwl_pnvm_load_reduce_power_to_trans(trans, capa, sku_id); 406 + iwl_pnvm_load_pnvm_to_trans(trans, fw, sku_id); 407 + iwl_pnvm_load_reduce_power_to_trans(trans, &fw->ucode_capa, sku_id); 416 408 417 409 iwl_init_notification_wait(notif_wait, &pnvm_wait, 418 410 ntf_cmds, ARRAY_SIZE(ntf_cmds),
+2 -2
drivers/net/wireless/intel/iwlwifi/fw/pnvm.h
··· 7 7 8 8 #include "iwl-drv.h" 9 9 #include "fw/notif-wait.h" 10 + #include "fw/img.h" 10 11 11 12 #define MVM_UCODE_PNVM_TIMEOUT (HZ / 4) 12 13 ··· 15 14 16 15 int iwl_pnvm_load(struct iwl_trans *trans, 17 16 struct iwl_notif_wait_data *notif_wait, 18 - const struct iwl_ucode_capabilities *capa, 19 - __le32 sku_id[3]); 17 + const struct iwl_fw *fw, __le32 sku_id[3]); 20 18 21 19 static inline 22 20 void iwl_pnvm_get_fs_name(struct iwl_trans *trans,
+6 -5
drivers/net/wireless/intel/iwlwifi/iwl-config.h
··· 488 488 rf_type:9, 489 489 match_bw_limit:1, 490 490 bw_limit:1, 491 - match_rf_step:1, 492 - rf_step:4, 491 + match_discrete:1, 492 + discrete:1, 493 493 match_rf_id:1, 494 494 rf_id:4, 495 495 match_cdb:1, ··· 499 499 #if IS_ENABLED(CONFIG_IWLWIFI_KUNIT_TESTS) 500 500 extern const struct iwl_dev_info iwl_dev_info_table[]; 501 501 extern const unsigned int iwl_dev_info_table_size; 502 - const struct iwl_dev_info * 503 - iwl_pci_find_dev_info(u16 device, u16 subsystem_device, u16 rf_type, u8 cdb, 504 - u8 rf_id, u8 bw_limit, u8 rf_step); 505 502 extern const struct pci_device_id iwl_hw_card_ids[]; 506 503 #endif 504 + 505 + const struct iwl_dev_info * 506 + iwl_pci_find_dev_info(u16 device, u16 subsystem_device, u16 rf_type, u8 cdb, 507 + u8 rf_id, u8 bw_limit, bool discrete); 507 508 508 509 /* 509 510 * This list declares the config structures for all devices.
+12 -2
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
··· 136 136 kfree(drv->fw.phy_integration_ver); 137 137 kfree(drv->trans->dbg.pc_data); 138 138 drv->trans->dbg.pc_data = NULL; 139 + kvfree(drv->fw.pnvm_data); 140 + drv->fw.pnvm_data = NULL; 141 + drv->fw.pnvm_size = 0; 139 142 140 143 for (i = 0; i < IWL_UCODE_TYPE_MAX; i++) 141 144 iwl_free_fw_img(drv, drv->fw.img + i); ··· 1403 1400 drv->trans->dbg.num_pc = 1404 1401 tlv_len / sizeof(struct iwl_pc_data); 1405 1402 break; 1403 + case IWL_UCODE_TLV_PNVM_DATA: 1404 + if (drv->fw.pnvm_data) 1405 + break; 1406 + drv->fw.pnvm_data = 1407 + kvmemdup(tlv_data, tlv_len, GFP_KERNEL); 1408 + if (!drv->fw.pnvm_data) 1409 + return -ENOMEM; 1410 + drv->fw.pnvm_size = tlv_len; 1411 + break; 1406 1412 default: 1407 1413 IWL_DEBUG_INFO(drv, "unknown TLV: %d\n", tlv_type); 1408 1414 break; ··· 2048 2036 2049 2037 for (i = 0; i < ARRAY_SIZE(iwlwifi_opmode_table); i++) 2050 2038 INIT_LIST_HEAD(&iwlwifi_opmode_table[i].drv); 2051 - 2052 - pr_info(DRV_DESCRIPTION "\n"); 2053 2039 2054 2040 #ifdef CONFIG_IWLWIFI_DEBUGFS 2055 2041 /* Create the root of iwlwifi debugfs subsystem. */
+4 -4
drivers/net/wireless/intel/iwlwifi/iwl-io.c
··· 47 47 48 48 #define IWL_POLL_INTERVAL 10 /* microseconds */ 49 49 50 - int iwl_poll_bit(struct iwl_trans *trans, u32 addr, 51 - u32 bits, u32 mask, int timeout) 50 + int iwl_poll_bits_mask(struct iwl_trans *trans, u32 addr, 51 + u32 bits, u32 mask, int timeout) 52 52 { 53 53 int t = 0; 54 54 ··· 61 61 62 62 return -ETIMEDOUT; 63 63 } 64 - IWL_EXPORT_SYMBOL(iwl_poll_bit); 64 + IWL_EXPORT_SYMBOL(iwl_poll_bits_mask); 65 65 66 66 u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg) 67 67 { ··· 477 477 * device-internal resources is supported, e.g. iwl_write_prph() 478 478 * and accesses to uCode SRAM. 479 479 */ 480 - err = iwl_poll_bit(trans, CSR_GP_CNTRL, poll_ready, poll_ready, 25000); 480 + err = iwl_poll_bits(trans, CSR_GP_CNTRL, poll_ready, 25000); 481 481 if (err < 0) { 482 482 IWL_DEBUG_INFO(trans, "Failed to wake NIC\n"); 483 483
+7 -2
drivers/net/wireless/intel/iwlwifi/iwl-io.h
··· 23 23 iwl_trans_set_bits_mask(trans, reg, mask, 0); 24 24 } 25 25 26 - int iwl_poll_bit(struct iwl_trans *trans, u32 addr, 27 - u32 bits, u32 mask, int timeout); 26 + int iwl_poll_bits_mask(struct iwl_trans *trans, u32 addr, 27 + u32 bits, u32 mask, int timeout); 28 + static inline int iwl_poll_bits(struct iwl_trans *trans, u32 addr, u32 bits, 29 + int timeout) 30 + { 31 + return iwl_poll_bits_mask(trans, addr, bits, bits, timeout); 32 + } 28 33 int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, 29 34 int timeout); 30 35
+5 -32
drivers/net/wireless/intel/iwlwifi/iwl-trans.c
··· 268 268 269 269 struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, 270 270 struct device *dev, 271 - const struct iwl_mac_cfg *mac_cfg) 271 + const struct iwl_mac_cfg *mac_cfg, 272 + unsigned int txcmd_size, 273 + unsigned int txcmd_align) 272 274 { 273 275 struct iwl_trans *trans; 274 276 #ifdef CONFIG_LOCKDEP ··· 292 290 293 291 INIT_DELAYED_WORK(&trans->restart.wk, iwl_trans_restart_wk); 294 292 295 - return trans; 296 - } 297 - 298 - int iwl_trans_init(struct iwl_trans *trans) 299 - { 300 - int txcmd_size, txcmd_align; 301 - 302 - /* check if name/num_rx_queues were set as a proxy for info being set */ 303 - if (WARN_ON(!trans->info.name || !trans->info.num_rxqs)) 304 - return -EINVAL; 305 - 306 - if (!trans->mac_cfg->gen2) { 307 - txcmd_size = sizeof(struct iwl_tx_cmd_v6); 308 - txcmd_align = sizeof(void *); 309 - } else if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210) { 310 - txcmd_size = sizeof(struct iwl_tx_cmd_v9); 311 - txcmd_align = 64; 312 - } else { 313 - txcmd_size = sizeof(struct iwl_tx_cmd); 314 - txcmd_align = 128; 315 - } 316 - 317 - txcmd_size += sizeof(struct iwl_cmd_header); 318 - txcmd_size += 36; /* biggest possible 802.11 header */ 319 - 320 - /* Ensure device TX cmd cannot reach/cross a page boundary in gen2 */ 321 - if (WARN_ON(trans->mac_cfg->gen2 && txcmd_size >= txcmd_align)) 322 - return -EINVAL; 323 - 324 293 snprintf(trans->dev_cmd_pool_name, sizeof(trans->dev_cmd_pool_name), 325 294 "iwl_cmd_pool:%s", dev_name(trans->dev)); 326 295 trans->dev_cmd_pool = ··· 299 326 txcmd_size, txcmd_align, 300 327 SLAB_HWCACHE_ALIGN, NULL); 301 328 if (!trans->dev_cmd_pool) 302 - return -ENOMEM; 329 + return NULL; 303 330 304 - return 0; 331 + return trans; 305 332 } 306 333 307 334 void iwl_trans_free(struct iwl_trans *trans)
+4 -3
drivers/net/wireless/intel/iwlwifi/iwl-trans.h
··· 1204 1204 * transport helper functions 1205 1205 *****************************************************/ 1206 1206 struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, 1207 - struct device *dev, 1208 - const struct iwl_mac_cfg *cfg_trans); 1209 - int iwl_trans_init(struct iwl_trans *trans); 1207 + struct device *dev, 1208 + const struct iwl_mac_cfg *mac_cfg, 1209 + unsigned int txcmd_size, 1210 + unsigned int txcmd_align); 1210 1211 void iwl_trans_free(struct iwl_trans *trans); 1211 1212 1212 1213 static inline bool iwl_trans_is_hw_error_value(u32 val)
+1 -1
drivers/net/wireless/intel/iwlwifi/mld/fw.c
··· 294 294 return ret; 295 295 296 296 ret = iwl_pnvm_load(mld->trans, &mld->notif_wait, 297 - &mld->fw->ucode_capa, alive_data.sku_id); 297 + mld->fw, alive_data.sku_id); 298 298 if (ret) { 299 299 IWL_ERR(mld, "Timeout waiting for PNVM load %d\n", ret); 300 300 return ret;
+6 -6
drivers/net/wireless/intel/iwlwifi/mld/ptp.c
··· 299 299 PTR_ERR(mld->ptp_data.ptp_clock)); 300 300 mld->ptp_data.ptp_clock = NULL; 301 301 } else { 302 - IWL_INFO(mld, "Registered PHC clock: %s, with index: %d\n", 303 - mld->ptp_data.ptp_clock_info.name, 304 - ptp_clock_index(mld->ptp_data.ptp_clock)); 302 + IWL_DEBUG_INFO(mld, "Registered PHC clock: %s, with index: %d\n", 303 + mld->ptp_data.ptp_clock_info.name, 304 + ptp_clock_index(mld->ptp_data.ptp_clock)); 305 305 } 306 306 } 307 307 308 308 void iwl_mld_ptp_remove(struct iwl_mld *mld) 309 309 { 310 310 if (mld->ptp_data.ptp_clock) { 311 - IWL_INFO(mld, "Unregistering PHC clock: %s, with index: %d\n", 312 - mld->ptp_data.ptp_clock_info.name, 313 - ptp_clock_index(mld->ptp_data.ptp_clock)); 311 + IWL_DEBUG_INFO(mld, "Unregistering PHC clock: %s, with index: %d\n", 312 + mld->ptp_data.ptp_clock_info.name, 313 + ptp_clock_index(mld->ptp_data.ptp_clock)); 314 314 315 315 ptp_clock_unregister(mld->ptp_data.ptp_clock); 316 316 mld->ptp_data.ptp_clock = NULL;
+21 -211
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
··· 1474 1474 struct iwl_multicast_key_data igtk; 1475 1475 struct iwl_multicast_key_data bigtk[WOWLAN_BIGTK_KEYS_NUM]; 1476 1476 1477 - int num_mlo_keys; 1478 - struct iwl_wowlan_mlo_gtk mlo_keys[WOWLAN_MAX_MLO_KEYS]; 1479 - 1480 1477 u8 *wake_packet; 1481 1478 }; 1482 1479 ··· 1787 1790 } 1788 1791 1789 1792 static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf *key, 1790 - struct iwl_wowlan_status_data *status, 1791 - bool installed) 1793 + struct iwl_wowlan_status_data *status) 1792 1794 { 1793 1795 int i; 1794 1796 ··· 1811 1815 1812 1816 /* handle the case where we didn't, last key only */ 1813 1817 if (status->gtk_seq[i].key_id == -1 && 1814 - (!status->num_of_gtk_rekeys || installed)) 1818 + (!status->num_of_gtk_rekeys)) 1815 1819 iwl_mvm_set_key_rx_seq_idx(key, status, i); 1816 1820 } 1817 1821 } ··· 1962 1966 (status->gtk[1].len && keyidx == status->gtk[1].id))) { 1963 1967 ieee80211_remove_key(key); 1964 1968 } else { 1965 - iwl_mvm_set_key_rx_seq(key, data->status, false); 1969 + iwl_mvm_set_key_rx_seq(key, data->status); 1966 1970 } 1967 1971 break; 1968 1972 case WLAN_CIPHER_SUITE_BIP_GMAC_128: ··· 1980 1984 &status->bigtk[idx]); 1981 1985 } 1982 1986 } 1983 - } 1984 - 1985 - struct iwl_mvm_d3_mlo_old_keys { 1986 - u32 cipher[IEEE80211_MLD_MAX_NUM_LINKS][WOWLAN_MLO_GTK_KEY_NUM_TYPES]; 1987 - struct ieee80211_key_conf *key[IEEE80211_MLD_MAX_NUM_LINKS][8]; 1988 - }; 1989 - 1990 - static void iwl_mvm_mlo_key_ciphers(struct ieee80211_hw *hw, 1991 - struct ieee80211_vif *vif, 1992 - struct ieee80211_sta *sta, 1993 - struct ieee80211_key_conf *key, 1994 - void *data) 1995 - { 1996 - struct iwl_mvm_d3_mlo_old_keys *old_keys = data; 1997 - enum iwl_wowlan_mlo_gtk_type key_type; 1998 - 1999 - if (key->link_id < 0) 2000 - return; 2001 - 2002 - if (WARN_ON(key->link_id >= IEEE80211_MLD_MAX_NUM_LINKS || 2003 - key->keyidx >= 8)) 2004 - return; 2005 - 2006 - if (WARN_ON(old_keys->key[key->link_id][key->keyidx])) 2007 - return; 2008 - 2009 - switch (key->cipher) { 2010 - case WLAN_CIPHER_SUITE_CCMP: 2011 - case WLAN_CIPHER_SUITE_GCMP: 2012 - case WLAN_CIPHER_SUITE_GCMP_256: 2013 - key_type = WOWLAN_MLO_GTK_KEY_TYPE_GTK; 2014 - break; 2015 - case WLAN_CIPHER_SUITE_BIP_GMAC_128: 2016 - case WLAN_CIPHER_SUITE_BIP_GMAC_256: 2017 - case WLAN_CIPHER_SUITE_BIP_CMAC_256: 2018 - case WLAN_CIPHER_SUITE_AES_CMAC: 2019 - if (key->keyidx == 4 || key->keyidx == 5) { 2020 - key_type = WOWLAN_MLO_GTK_KEY_TYPE_IGTK; 2021 - break; 2022 - } else if (key->keyidx == 6 || key->keyidx == 7) { 2023 - key_type = WOWLAN_MLO_GTK_KEY_TYPE_BIGTK; 2024 - break; 2025 - } 2026 - return; 2027 - default: 2028 - /* ignore WEP/TKIP or unknown ciphers */ 2029 - return; 2030 - } 2031 - 2032 - old_keys->cipher[key->link_id][key_type] = key->cipher; 2033 - old_keys->key[key->link_id][key->keyidx] = key; 2034 - } 2035 - 2036 - static bool iwl_mvm_mlo_gtk_rekey(struct iwl_wowlan_status_data *status, 2037 - struct ieee80211_vif *vif, 2038 - struct iwl_mvm *mvm) 2039 - { 2040 - int i; 2041 - struct iwl_mvm_d3_mlo_old_keys *old_keys; 2042 - bool ret = true; 2043 - 2044 - IWL_DEBUG_WOWLAN(mvm, "Num of MLO Keys: %d\n", status->num_mlo_keys); 2045 - if (!status->num_mlo_keys) 2046 - return true; 2047 - 2048 - old_keys = kzalloc(sizeof(*old_keys), GFP_KERNEL); 2049 - if (!old_keys) 2050 - return false; 2051 - 2052 - /* find the cipher for each mlo key */ 2053 - ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_mlo_key_ciphers, old_keys); 2054 - 2055 - for (i = 0; i < status->num_mlo_keys; i++) { 2056 - struct iwl_wowlan_mlo_gtk *mlo_key = &status->mlo_keys[i]; 2057 - struct ieee80211_key_conf *key, *old_key; 2058 - struct ieee80211_key_seq seq; 2059 - DEFINE_RAW_FLEX(struct ieee80211_key_conf, conf, key, 2060 - WOWLAN_KEY_MAX_SIZE); 2061 - u16 flags = le16_to_cpu(mlo_key->flags); 2062 - int j, link_id, key_id, key_type; 2063 - 2064 - link_id = u16_get_bits(flags, WOWLAN_MLO_GTK_FLAG_LINK_ID_MSK); 2065 - key_id = u16_get_bits(flags, WOWLAN_MLO_GTK_FLAG_KEY_ID_MSK); 2066 - key_type = u16_get_bits(flags, 2067 - WOWLAN_MLO_GTK_FLAG_KEY_TYPE_MSK); 2068 - 2069 - if (!(vif->valid_links & BIT(link_id))) 2070 - continue; 2071 - 2072 - if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS || 2073 - key_id >= 8 || 2074 - key_type >= WOWLAN_MLO_GTK_KEY_NUM_TYPES)) 2075 - continue; 2076 - 2077 - conf->cipher = old_keys->cipher[link_id][key_type]; 2078 - /* WARN_ON? */ 2079 - if (!conf->cipher) 2080 - continue; 2081 - 2082 - conf->keylen = 0; 2083 - switch (conf->cipher) { 2084 - case WLAN_CIPHER_SUITE_CCMP: 2085 - case WLAN_CIPHER_SUITE_GCMP: 2086 - conf->keylen = WLAN_KEY_LEN_CCMP; 2087 - break; 2088 - case WLAN_CIPHER_SUITE_GCMP_256: 2089 - conf->keylen = WLAN_KEY_LEN_GCMP_256; 2090 - break; 2091 - case WLAN_CIPHER_SUITE_BIP_GMAC_128: 2092 - conf->keylen = WLAN_KEY_LEN_BIP_GMAC_128; 2093 - break; 2094 - case WLAN_CIPHER_SUITE_BIP_GMAC_256: 2095 - conf->keylen = WLAN_KEY_LEN_BIP_GMAC_256; 2096 - break; 2097 - case WLAN_CIPHER_SUITE_AES_CMAC: 2098 - conf->keylen = WLAN_KEY_LEN_AES_CMAC; 2099 - break; 2100 - case WLAN_CIPHER_SUITE_BIP_CMAC_256: 2101 - conf->keylen = WLAN_KEY_LEN_BIP_CMAC_256; 2102 - break; 2103 - } 2104 - 2105 - if (WARN_ON(!conf->keylen || 2106 - conf->keylen > WOWLAN_KEY_MAX_SIZE)) 2107 - continue; 2108 - 2109 - memcpy(conf->key, mlo_key->key, conf->keylen); 2110 - conf->keyidx = key_id; 2111 - 2112 - old_key = old_keys->key[link_id][key_id]; 2113 - if (old_key) { 2114 - IWL_DEBUG_WOWLAN(mvm, 2115 - "Remove MLO key id %d, link id %d\n", 2116 - key_id, link_id); 2117 - ieee80211_remove_key(old_key); 2118 - } 2119 - 2120 - IWL_DEBUG_WOWLAN(mvm, "Add MLO key id %d, link id %d\n", 2121 - key_id, link_id); 2122 - key = ieee80211_gtk_rekey_add(vif, conf, link_id); 2123 - if (WARN_ON(IS_ERR(key))) { 2124 - ret = false; 2125 - goto out; 2126 - } 2127 - 2128 - /* 2129 - * mac80211 expects the pn in big-endian 2130 - * also note that seq is a union of all cipher types 2131 - * (ccmp, gcmp, cmac, gmac), and they all have the same 2132 - * pn field (of length 6) so just copy it to ccmp.pn. 2133 - */ 2134 - for (j = 5; j >= 0; j--) 2135 - seq.ccmp.pn[5 - j] = mlo_key->pn[j]; 2136 - 2137 - /* group keys are non-QoS and use TID 0 */ 2138 - ieee80211_set_key_rx_seq(key, 0, &seq); 2139 - } 2140 - 2141 - out: 2142 - kfree(old_keys); 2143 - return ret; 2144 1987 } 2145 1988 2146 1989 static bool iwl_mvm_gtk_rekey(struct iwl_wowlan_status_data *status, ··· 2181 2346 return false; 2182 2347 } 2183 2348 2184 - if (!iwl_mvm_mlo_gtk_rekey(status, vif, mvm)) 2185 - return false; 2186 - 2187 2349 ieee80211_gtk_rekey_notify(vif, vif->bss_conf.bssid, 2188 2350 (void *)&replay_ctr, GFP_KERNEL); 2189 2351 } ··· 2311 2479 struct iwl_wowlan_status_data *status, 2312 2480 u32 len) 2313 2481 { 2314 - u32 expected_len = sizeof(*data) + 2315 - data->num_mlo_link_keys * sizeof(status->mlo_keys[0]); 2482 + if (IWL_FW_CHECK(mvm, data->num_mlo_link_keys, 2483 + "MLO is not supported, shouldn't receive MLO keys\n")) 2484 + return; 2316 2485 2317 - if (len < expected_len) { 2486 + if (len < sizeof(*data)) { 2318 2487 IWL_ERR(mvm, "Invalid WoWLAN info notification!\n"); 2319 2488 status = NULL; 2320 2489 return; ··· 2344 2511 le32_to_cpu(data->num_of_gtk_rekeys); 2345 2512 status->received_beacons = le32_to_cpu(data->received_beacons); 2346 2513 status->tid_tear_down = data->tid_tear_down; 2347 - 2348 - if (data->num_mlo_link_keys) { 2349 - status->num_mlo_keys = data->num_mlo_link_keys; 2350 - if (IWL_FW_CHECK(mvm, 2351 - status->num_mlo_keys > WOWLAN_MAX_MLO_KEYS, 2352 - "Too many mlo keys: %d, max %d\n", 2353 - status->num_mlo_keys, WOWLAN_MAX_MLO_KEYS)) 2354 - status->num_mlo_keys = WOWLAN_MAX_MLO_KEYS; 2355 - memcpy(status->mlo_keys, data->mlo_gtks, 2356 - status->num_mlo_keys * sizeof(status->mlo_keys[0])); 2357 - } 2358 2514 } 2359 2515 2360 2516 static void 2361 - iwl_mvm_parse_wowlan_info_notif_v4(struct iwl_mvm *mvm, 2362 - struct iwl_wowlan_info_notif_v4 *data, 2517 + iwl_mvm_parse_wowlan_info_notif_v3(struct iwl_mvm *mvm, 2518 + struct iwl_wowlan_info_notif_v3 *data, 2363 2519 struct iwl_wowlan_status_data *status, 2364 - u32 len, bool has_mlo_keys) 2520 + u32 len) 2365 2521 { 2366 2522 u32 i; 2367 - u32 expected_len = sizeof(*data); 2368 2523 2369 - if (has_mlo_keys) 2370 - expected_len += (data->num_mlo_link_keys * 2371 - sizeof(status->mlo_keys[0])); 2372 - 2373 - if (len < expected_len) { 2524 + if (len < sizeof(*data)) { 2374 2525 IWL_ERR(mvm, "Invalid WoWLAN info notification!\n"); 2375 2526 status = NULL; 2376 2527 return; ··· 2377 2560 le32_to_cpu(data->num_of_gtk_rekeys); 2378 2561 status->received_beacons = le32_to_cpu(data->received_beacons); 2379 2562 status->tid_tear_down = data->tid_tear_down; 2380 - 2381 - if (has_mlo_keys && data->num_mlo_link_keys) { 2382 - status->num_mlo_keys = data->num_mlo_link_keys; 2383 - if (IWL_FW_CHECK(mvm, 2384 - status->num_mlo_keys > WOWLAN_MAX_MLO_KEYS, 2385 - "Too many mlo keys: %d, max %d\n", 2386 - status->num_mlo_keys, WOWLAN_MAX_MLO_KEYS)) 2387 - status->num_mlo_keys = WOWLAN_MAX_MLO_KEYS; 2388 - memcpy(status->mlo_keys, data->mlo_gtks, 2389 - status->num_mlo_keys * sizeof(status->mlo_keys[0])); 2390 - } 2391 2563 } 2392 2564 2393 2565 static void ··· 3122 3316 iwl_mvm_parse_wowlan_info_notif_v2(mvm, notif_v2, 3123 3317 d3_data->status, 3124 3318 len); 3125 - } else if (wowlan_info_ver < 5) { 3126 - struct iwl_wowlan_info_notif_v4 *notif = 3319 + } else if (wowlan_info_ver == 3) { 3320 + struct iwl_wowlan_info_notif_v3 *notif = 3127 3321 (void *)pkt->data; 3128 3322 3129 - iwl_mvm_parse_wowlan_info_notif_v4(mvm, notif, 3130 - d3_data->status, len, 3131 - wowlan_info_ver > 3); 3132 - } else { 3323 + iwl_mvm_parse_wowlan_info_notif_v3(mvm, notif, 3324 + d3_data->status, len); 3325 + } else if (wowlan_info_ver == 5) { 3133 3326 struct iwl_wowlan_info_notif *notif = 3134 3327 (void *)pkt->data; 3135 3328 3136 3329 iwl_mvm_parse_wowlan_info_notif(mvm, notif, 3137 3330 d3_data->status, len); 3331 + } else { 3332 + IWL_FW_CHECK(mvm, 1, 3333 + "Firmware advertises unknown WoWLAN info notification %d!\n", 3334 + wowlan_info_ver); 3335 + return false; 3138 3336 } 3139 3337 3140 3338 d3_data->notif_received |= IWL_D3_NOTIF_WOWLAN_INFO;
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
··· 432 432 iwl_trans_fw_alive(mvm->trans); 433 433 434 434 ret = iwl_pnvm_load(mvm->trans, &mvm->notif_wait, 435 - &mvm->fw->ucode_capa, alive_data.sku_id); 435 + mvm->fw, alive_data.sku_id); 436 436 if (ret) { 437 437 IWL_ERR(mvm, "Timeout waiting for PNVM load!\n"); 438 438 iwl_fw_set_current_image(&mvm->fwrt, old_type);
+7 -7
drivers/net/wireless/intel/iwlwifi/mvm/ptp.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause 2 2 /* 3 - * Copyright (C) 2021 - 2023 Intel Corporation 3 + * Copyright (C) 2021 - 2023, 2025 Intel Corporation 4 4 */ 5 5 6 6 #include "mvm.h" ··· 298 298 PTR_ERR(mvm->ptp_data.ptp_clock)); 299 299 mvm->ptp_data.ptp_clock = NULL; 300 300 } else if (mvm->ptp_data.ptp_clock) { 301 - IWL_INFO(mvm, "Registered PHC clock: %s, with index: %d\n", 302 - mvm->ptp_data.ptp_clock_info.name, 303 - ptp_clock_index(mvm->ptp_data.ptp_clock)); 301 + IWL_DEBUG_INFO(mvm, "Registered PHC clock: %s, with index: %d\n", 302 + mvm->ptp_data.ptp_clock_info.name, 303 + ptp_clock_index(mvm->ptp_data.ptp_clock)); 304 304 } 305 305 } 306 306 ··· 312 312 void iwl_mvm_ptp_remove(struct iwl_mvm *mvm) 313 313 { 314 314 if (mvm->ptp_data.ptp_clock) { 315 - IWL_INFO(mvm, "Unregistering PHC clock: %s, with index: %d\n", 316 - mvm->ptp_data.ptp_clock_info.name, 317 - ptp_clock_index(mvm->ptp_data.ptp_clock)); 315 + IWL_DEBUG_INFO(mvm, "Unregistering PHC clock: %s, with index: %d\n", 316 + mvm->ptp_data.ptp_clock_info.name, 317 + ptp_clock_index(mvm->ptp_data.ptp_clock)); 318 318 319 319 ptp_clock_unregister(mvm->ptp_data.ptp_clock); 320 320 mvm->ptp_data.ptp_clock = NULL;
+35 -317
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 577 577 .subdevice_m_h = _HIGHEST_BIT(m) 578 578 #define RF_TYPE(n) .match_rf_type = 1, \ 579 579 .rf_type = IWL_CFG_RF_TYPE_##n 580 - #define RF_STEP(n) .match_rf_step = 1, \ 581 - .rf_step = SILICON_##n##_STEP 580 + #define DISCRETE .match_discrete = 1, \ 581 + .discrete = 1 582 + #define INTEGRATED .match_discrete = 1, \ 583 + .discrete = 0 582 584 #define RF_ID(n) .match_rf_id = 1, \ 583 585 .rf_id = IWL_CFG_RF_ID_##n 584 586 #define NO_CDB .match_cdb = 1, .cdb = 0 ··· 1034 1032 /* FM RF */ 1035 1033 IWL_DEV_INFO(iwl_rf_fm, iwl_be201_name, RF_TYPE(FM)), 1036 1034 IWL_DEV_INFO(iwl_rf_fm, iwl_be401_name, RF_TYPE(FM), CDB), 1037 - /* the discrete NICs got the RF B0, it's only for the name anyway */ 1038 1035 IWL_DEV_INFO(iwl_rf_fm, iwl_be200_name, RF_TYPE(FM), 1039 - DEVICE(0x272B), RF_STEP(B)), 1036 + DEVICE(0x272B), DISCRETE), 1040 1037 IWL_DEV_INFO(iwl_rf_fm_160mhz, iwl_be202_name, 1041 1038 RF_TYPE(FM), BW_LIMITED), 1042 1039 ··· 1075 1074 EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_dev_info_table_size); 1076 1075 #endif 1077 1076 1078 - /* 1079 - * Read rf id and cdb info from prph register and store it 1080 - */ 1081 - static void get_crf_id(struct iwl_trans *iwl_trans, 1082 - struct iwl_trans_info *info) 1083 - { 1084 - u32 sd_reg_ver_addr; 1085 - u32 hw_wfpm_id; 1086 - u32 val = 0; 1087 - u8 step; 1088 - 1089 - if (iwl_trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) 1090 - sd_reg_ver_addr = SD_REG_VER_GEN2; 1091 - else 1092 - sd_reg_ver_addr = SD_REG_VER; 1093 - 1094 - /* Enable access to peripheral registers */ 1095 - val = iwl_read_umac_prph_no_grab(iwl_trans, WFPM_CTRL_REG); 1096 - val |= WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK; 1097 - iwl_write_umac_prph_no_grab(iwl_trans, WFPM_CTRL_REG, val); 1098 - 1099 - /* Read crf info */ 1100 - info->hw_crf_id = iwl_read_prph_no_grab(iwl_trans, sd_reg_ver_addr); 1101 - 1102 - /* Read cnv info */ 1103 - info->hw_cnv_id = iwl_read_prph_no_grab(iwl_trans, CNVI_AUX_MISC_CHIP); 1104 - 1105 - /* For BZ-W, take B step also when A step is indicated */ 1106 - if (CSR_HW_REV_TYPE(info->hw_rev) == IWL_CFG_MAC_TYPE_BZ_W) 1107 - step = SILICON_B_STEP; 1108 - 1109 - /* In BZ, the MAC step must be read from the CNVI aux register */ 1110 - if (CSR_HW_REV_TYPE(info->hw_rev) == IWL_CFG_MAC_TYPE_BZ) { 1111 - step = CNVI_AUX_MISC_CHIP_MAC_STEP(info->hw_cnv_id); 1112 - 1113 - /* For BZ-U, take B step also when A step is indicated */ 1114 - if ((CNVI_AUX_MISC_CHIP_PROD_TYPE(info->hw_cnv_id) == 1115 - CNVI_AUX_MISC_CHIP_PROD_TYPE_BZ_U) && 1116 - step == SILICON_A_STEP) 1117 - step = SILICON_B_STEP; 1118 - } 1119 - 1120 - if (CSR_HW_REV_TYPE(info->hw_rev) == IWL_CFG_MAC_TYPE_BZ || 1121 - CSR_HW_REV_TYPE(info->hw_rev) == IWL_CFG_MAC_TYPE_BZ_W) { 1122 - info->hw_rev_step = step; 1123 - info->hw_rev |= step; 1124 - } 1125 - 1126 - /* Read cdb info (also contains the jacket info if needed in the future */ 1127 - hw_wfpm_id = iwl_read_umac_prph_no_grab(iwl_trans, WFPM_OTP_CFG1_ADDR); 1128 - IWL_INFO(iwl_trans, "Detected crf-id 0x%x, cnv-id 0x%x wfpm id 0x%x\n", 1129 - info->hw_crf_id, info->hw_cnv_id, hw_wfpm_id); 1130 - } 1131 - 1132 - /* 1133 - * In case that there is no OTP on the NIC, map the rf id and cdb info 1134 - * from the prph registers. 1135 - */ 1136 - static int map_crf_id(struct iwl_trans *iwl_trans, 1137 - struct iwl_trans_info *info) 1138 - { 1139 - int ret = 0; 1140 - u32 val = info->hw_crf_id; 1141 - u32 step_id = REG_CRF_ID_STEP(val); 1142 - u32 slave_id = REG_CRF_ID_SLAVE(val); 1143 - u32 jacket_id_cnv = REG_CRF_ID_SLAVE(info->hw_cnv_id); 1144 - u32 hw_wfpm_id = iwl_read_umac_prph_no_grab(iwl_trans, 1145 - WFPM_OTP_CFG1_ADDR); 1146 - u32 jacket_id_wfpm = WFPM_OTP_CFG1_IS_JACKET(hw_wfpm_id); 1147 - u32 cdb_id_wfpm = WFPM_OTP_CFG1_IS_CDB(hw_wfpm_id); 1148 - 1149 - /* Map between crf id to rf id */ 1150 - switch (REG_CRF_ID_TYPE(val)) { 1151 - case REG_CRF_ID_TYPE_JF_1: 1152 - info->hw_rf_id = (IWL_CFG_RF_TYPE_JF1 << 12); 1153 - break; 1154 - case REG_CRF_ID_TYPE_JF_2: 1155 - info->hw_rf_id = (IWL_CFG_RF_TYPE_JF2 << 12); 1156 - break; 1157 - case REG_CRF_ID_TYPE_HR_NONE_CDB_1X1: 1158 - info->hw_rf_id = (IWL_CFG_RF_TYPE_HR1 << 12); 1159 - break; 1160 - case REG_CRF_ID_TYPE_HR_NONE_CDB: 1161 - info->hw_rf_id = (IWL_CFG_RF_TYPE_HR2 << 12); 1162 - break; 1163 - case REG_CRF_ID_TYPE_HR_CDB: 1164 - info->hw_rf_id = (IWL_CFG_RF_TYPE_HR2 << 12); 1165 - break; 1166 - case REG_CRF_ID_TYPE_GF: 1167 - info->hw_rf_id = (IWL_CFG_RF_TYPE_GF << 12); 1168 - break; 1169 - case REG_CRF_ID_TYPE_FM: 1170 - info->hw_rf_id = (IWL_CFG_RF_TYPE_FM << 12); 1171 - break; 1172 - case REG_CRF_ID_TYPE_WHP: 1173 - info->hw_rf_id = (IWL_CFG_RF_TYPE_WH << 12); 1174 - break; 1175 - case REG_CRF_ID_TYPE_PE: 1176 - info->hw_rf_id = (IWL_CFG_RF_TYPE_PE << 12); 1177 - break; 1178 - default: 1179 - ret = -EIO; 1180 - IWL_ERR(iwl_trans, 1181 - "Can't find a correct rfid for crf id 0x%x\n", 1182 - REG_CRF_ID_TYPE(val)); 1183 - goto out; 1184 - 1185 - } 1186 - 1187 - /* Set Step-id */ 1188 - info->hw_rf_id |= (step_id << 8); 1189 - 1190 - /* Set CDB capabilities */ 1191 - if (cdb_id_wfpm || slave_id) { 1192 - info->hw_rf_id += BIT(28); 1193 - IWL_INFO(iwl_trans, "Adding cdb to rf id\n"); 1194 - } 1195 - 1196 - /* Set Jacket capabilities */ 1197 - if (jacket_id_wfpm || jacket_id_cnv) { 1198 - info->hw_rf_id += BIT(29); 1199 - IWL_INFO(iwl_trans, "Adding jacket to rf id\n"); 1200 - } 1201 - 1202 - IWL_INFO(iwl_trans, 1203 - "Detected rf-type 0x%x step-id 0x%x slave-id 0x%x from crf id 0x%x\n", 1204 - REG_CRF_ID_TYPE(val), step_id, slave_id, info->hw_rf_id); 1205 - IWL_INFO(iwl_trans, 1206 - "Detected cdb-id 0x%x jacket-id 0x%x from wfpm id 0x%x\n", 1207 - cdb_id_wfpm, jacket_id_wfpm, hw_wfpm_id); 1208 - IWL_INFO(iwl_trans, "Detected jacket-id 0x%x from cnvi id 0x%x\n", 1209 - jacket_id_cnv, info->hw_cnv_id); 1210 - 1211 - out: 1212 - return ret; 1213 - } 1214 - 1215 1077 /* PCI registers */ 1216 1078 #define PCI_CFG_RETRY_TIMEOUT 0x041 1217 1079 1218 - VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info * 1080 + const struct iwl_dev_info * 1219 1081 iwl_pci_find_dev_info(u16 device, u16 subsystem_device, u16 rf_type, u8 cdb, 1220 - u8 rf_id, u8 bw_limit, u8 rf_step) 1082 + u8 rf_id, u8 bw_limit, bool discrete) 1221 1083 { 1222 1084 int num_devices = ARRAY_SIZE(iwl_dev_info_table); 1223 1085 int i; ··· 1115 1251 if (dev_info->match_bw_limit && dev_info->bw_limit != bw_limit) 1116 1252 continue; 1117 1253 1118 - if (dev_info->match_rf_step && dev_info->rf_step != rf_step) 1254 + if (dev_info->match_discrete && dev_info->discrete != discrete) 1119 1255 continue; 1120 1256 1121 1257 return dev_info; ··· 1125 1261 } 1126 1262 EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_pci_find_dev_info); 1127 1263 1128 - static void iwl_pcie_recheck_me_status(struct work_struct *wk) 1129 - { 1130 - struct iwl_trans_pcie *trans_pcie = container_of(wk, 1131 - typeof(*trans_pcie), 1132 - me_recheck_wk.work); 1133 - u32 val; 1134 - 1135 - val = iwl_read32(trans_pcie->trans, CSR_HW_IF_CONFIG_REG); 1136 - trans_pcie->me_present = !!(val & CSR_HW_IF_CONFIG_REG_IAMT_UP); 1137 - } 1138 - 1139 - static void iwl_pcie_check_me_status(struct iwl_trans *trans) 1140 - { 1141 - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1142 - u32 val; 1143 - 1144 - trans_pcie->me_present = -1; 1145 - 1146 - INIT_DELAYED_WORK(&trans_pcie->me_recheck_wk, 1147 - iwl_pcie_recheck_me_status); 1148 - 1149 - /* we don't have a good way of determining this until BZ */ 1150 - if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_BZ) 1151 - return; 1152 - 1153 - val = iwl_read_prph(trans, CNVI_SCU_REG_FOR_ECO_1); 1154 - if (val & CNVI_SCU_REG_FOR_ECO_1_WIAMT_KNOWN) { 1155 - trans_pcie->me_present = 1156 - !!(val & CNVI_SCU_REG_FOR_ECO_1_WIAMT_PRESENT); 1157 - return; 1158 - } 1159 - 1160 - val = iwl_read32(trans, CSR_HW_IF_CONFIG_REG); 1161 - if (val & (CSR_HW_IF_CONFIG_REG_ME_OWN | 1162 - CSR_HW_IF_CONFIG_REG_IAMT_UP)) { 1163 - trans_pcie->me_present = 1; 1164 - return; 1165 - } 1166 - 1167 - /* recheck again later, ME might still be initializing */ 1168 - schedule_delayed_work(&trans_pcie->me_recheck_wk, HZ); 1169 - } 1170 - 1171 1264 static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1172 1265 { 1173 - const struct iwl_mac_cfg *trans; 1174 - const struct iwl_dev_info *dev_info; 1175 - struct iwl_trans_info info = { 1176 - .hw_id = (pdev->device << 16) + pdev->subsystem_device, 1177 - }; 1178 - struct iwl_trans *iwl_trans; 1179 - struct iwl_trans_pcie *trans_pcie; 1266 + const struct iwl_mac_cfg *mac_cfg = (void *)ent->driver_data; 1267 + u8 __iomem *hw_base; 1268 + u32 bar0, hw_rev; 1180 1269 int ret; 1181 1270 1182 - trans = (void *)ent->driver_data; 1183 - 1184 - iwl_trans = iwl_trans_pcie_alloc(pdev, trans, &info); 1185 - if (IS_ERR(iwl_trans)) 1186 - return PTR_ERR(iwl_trans); 1187 - 1188 - trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); 1189 - 1190 - iwl_trans_pcie_check_product_reset_status(pdev); 1191 - iwl_trans_pcie_check_product_reset_mode(pdev); 1192 - 1193 - /* set the things we know so far for the grab NIC access */ 1194 - iwl_trans_set_info(iwl_trans, &info); 1195 - 1196 - /* 1197 - * Let's try to grab NIC access early here. Sometimes, NICs may 1198 - * fail to initialize, and if that happens it's better if we see 1199 - * issues early on (and can reprobe, per the logic inside), than 1200 - * first trying to load the firmware etc. and potentially only 1201 - * detecting any problems when the first interface is brought up. 1202 - */ 1203 - ret = iwl_pcie_prepare_card_hw(iwl_trans); 1204 - if (!ret) { 1205 - ret = iwl_finish_nic_init(iwl_trans); 1271 + /* reassign our BAR 0 if invalid due to possible runtime PM races */ 1272 + pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &bar0); 1273 + if (bar0 == PCI_BASE_ADDRESS_MEM_TYPE_64) { 1274 + ret = pci_assign_resource(pdev, 0); 1206 1275 if (ret) 1207 - goto out_free_trans; 1208 - if (iwl_trans_grab_nic_access(iwl_trans)) { 1209 - get_crf_id(iwl_trans, &info); 1210 - /* all good */ 1211 - iwl_trans_release_nic_access(iwl_trans); 1212 - } else { 1213 - ret = -EIO; 1214 - goto out_free_trans; 1215 - } 1276 + return ret; 1216 1277 } 1217 1278 1218 - info.hw_rf_id = iwl_read32(iwl_trans, CSR_HW_RF_ID); 1219 - 1220 - /* 1221 - * The RF_ID is set to zero in blank OTP so read version to 1222 - * extract the RF_ID. 1223 - * This is relevant only for family 9000 and up. 1224 - */ 1225 - if (iwl_trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_9000 && 1226 - !CSR_HW_RFID_TYPE(info.hw_rf_id) && map_crf_id(iwl_trans, &info)) { 1227 - ret = -EINVAL; 1228 - goto out_free_trans; 1229 - } 1230 - 1231 - IWL_INFO(iwl_trans, "PCI dev %04x/%04x, rev=0x%x, rfid=0x%x\n", 1232 - pdev->device, pdev->subsystem_device, 1233 - info.hw_rev, info.hw_rf_id); 1234 - 1235 - dev_info = iwl_pci_find_dev_info(pdev->device, pdev->subsystem_device, 1236 - CSR_HW_RFID_TYPE(info.hw_rf_id), 1237 - CSR_HW_RFID_IS_CDB(info.hw_rf_id), 1238 - IWL_SUBDEVICE_RF_ID(pdev->subsystem_device), 1239 - IWL_SUBDEVICE_BW_LIM(pdev->subsystem_device), 1240 - CSR_HW_RFID_STEP(info.hw_rf_id)); 1241 - if (dev_info) { 1242 - iwl_trans->cfg = dev_info->cfg; 1243 - info.name = dev_info->name; 1244 - } 1245 - 1246 - #if IS_ENABLED(CONFIG_IWLMVM) 1247 - /* 1248 - * special-case 7265D, it has the same PCI IDs. 1249 - * 1250 - * Note that because we already pass the cfg to the transport above, 1251 - * all the parameters that the transport uses must, until that is 1252 - * changed, be identical to the ones in the 7265D configuration. 1253 - */ 1254 - if (iwl_trans->cfg == &iwl7265_cfg && 1255 - (info.hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D) 1256 - iwl_trans->cfg = &iwl7265d_cfg; 1257 - #endif 1258 - if (!iwl_trans->cfg) { 1259 - pr_err("No config found for PCI dev %04x/%04x, rev=0x%x, rfid=0x%x\n", 1260 - pdev->device, pdev->subsystem_device, 1261 - info.hw_rev, info.hw_rf_id); 1262 - ret = -EINVAL; 1263 - goto out_free_trans; 1264 - } 1265 - 1266 - IWL_INFO(iwl_trans, "Detected %s\n", info.name); 1267 - 1268 - if (iwl_trans->mac_cfg->mq_rx_supported) { 1269 - if (WARN_ON(!iwl_trans->cfg->num_rbds)) { 1270 - ret = -EINVAL; 1271 - goto out_free_trans; 1272 - } 1273 - trans_pcie->num_rx_bufs = iwl_trans_get_num_rbds(iwl_trans); 1274 - } else { 1275 - trans_pcie->num_rx_bufs = RX_QUEUE_SIZE; 1276 - } 1277 - 1278 - if (!iwl_trans->mac_cfg->integrated) { 1279 - u16 link_status; 1280 - 1281 - pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &link_status); 1282 - 1283 - info.pcie_link_speed = 1284 - u16_get_bits(link_status, PCI_EXP_LNKSTA_CLS); 1285 - } 1286 - 1287 - iwl_trans_set_info(iwl_trans, &info); 1288 - 1289 - ret = iwl_trans_init(iwl_trans); 1279 + ret = pcim_enable_device(pdev); 1290 1280 if (ret) 1291 - goto out_free_trans; 1281 + return ret; 1292 1282 1293 - pci_set_drvdata(pdev, iwl_trans); 1283 + pci_set_master(pdev); 1294 1284 1295 - iwl_pcie_check_me_status(iwl_trans); 1296 - 1297 - /* try to get ownership so that we'll know if we don't own it */ 1298 - iwl_pcie_prepare_card_hw(iwl_trans); 1299 - 1300 - iwl_trans->drv = iwl_drv_start(iwl_trans); 1301 - 1302 - if (IS_ERR(iwl_trans->drv)) { 1303 - ret = PTR_ERR(iwl_trans->drv); 1304 - goto out_free_trans; 1285 + ret = pcim_request_all_regions(pdev, DRV_NAME); 1286 + if (ret) { 1287 + dev_err(&pdev->dev, "Requesting all PCI BARs failed.\n"); 1288 + return ret; 1305 1289 } 1306 1290 1307 - /* register transport layer debugfs here */ 1308 - iwl_trans_pcie_dbgfs_register(iwl_trans); 1291 + hw_base = pcim_iomap(pdev, 0, 0); 1292 + if (!hw_base) { 1293 + dev_err(&pdev->dev, "Failed to map BAR 0.\n"); 1294 + return -ENOMEM; 1295 + } 1309 1296 1310 - return 0; 1297 + /* We can't use iwl_read32 because trans wasn't allocated */ 1298 + hw_rev = readl(hw_base + CSR_HW_REV); 1299 + if (hw_rev == 0xffffffff) { 1300 + dev_err(&pdev->dev, "HW_REV=0xFFFFFFFF, PCI issues?\n"); 1301 + return -EIO; 1302 + } 1311 1303 1312 - out_free_trans: 1313 - iwl_trans_pcie_free(iwl_trans); 1314 - return ret; 1304 + return iwl_pci_gen1_2_probe(pdev, ent, mac_cfg, hw_base, hw_rev); 1315 1305 } 1316 1306 1317 1307 static void iwl_pci_remove(struct pci_dev *pdev)
+4 -4
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/internal.h
··· 538 538 * Convention: trans API functions: iwl_trans_pcie_XXX 539 539 * Other functions: iwl_pcie_XXX 540 540 */ 541 - struct iwl_trans 542 - *iwl_trans_pcie_alloc(struct pci_dev *pdev, 543 - const struct iwl_mac_cfg *mac_cfg, 544 - struct iwl_trans_info *info); 545 541 void iwl_trans_pcie_free(struct iwl_trans *trans); 546 542 void iwl_trans_pcie_free_pnvm_dram_regions(struct iwl_dram_regions *dram_regions, 547 543 struct device *dev); ··· 1077 1081 void __releases(nic_access_nobh) 1078 1082 iwl_trans_pcie_release_nic_access(struct iwl_trans *trans); 1079 1083 void iwl_pcie_alloc_fw_monitor(struct iwl_trans *trans, u8 max_power); 1084 + int iwl_pci_gen1_2_probe(struct pci_dev *pdev, 1085 + const struct pci_device_id *ent, 1086 + const struct iwl_mac_cfg *mac_cfg, 1087 + u8 __iomem *hw_base, u32 hw_rev); 1080 1088 1081 1089 /* transport gen 1 exported functions */ 1082 1090 void iwl_trans_pcie_fw_alive(struct iwl_trans *trans);
+366 -47
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c
··· 25 25 #include "fw/dbg.h" 26 26 #include "fw/api/tx.h" 27 27 #include "fw/acpi.h" 28 + #include "fw/api/tx.h" 28 29 #include "mei/iwl-mei.h" 29 30 #include "internal.h" 30 31 #include "iwl-fh.h" ··· 381 380 iwl_set_bit(trans, CSR_GP_CNTRL, 382 381 CSR_GP_CNTRL_REG_FLAG_BUS_MASTER_DISABLE_REQ); 383 382 384 - ret = iwl_poll_bit(trans, CSR_GP_CNTRL, 385 - CSR_GP_CNTRL_REG_FLAG_BUS_MASTER_DISABLE_STATUS, 386 - CSR_GP_CNTRL_REG_FLAG_BUS_MASTER_DISABLE_STATUS, 387 - 100); 383 + ret = iwl_poll_bits(trans, CSR_GP_CNTRL, 384 + CSR_GP_CNTRL_REG_FLAG_BUS_MASTER_DISABLE_STATUS, 385 + 100); 388 386 usleep_range(10000, 20000); 389 387 } else { 390 388 iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER); 391 389 392 - ret = iwl_poll_bit(trans, CSR_RESET, 393 - CSR_RESET_REG_FLAG_MASTER_DISABLED, 394 - CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); 390 + ret = iwl_poll_bits(trans, CSR_RESET, 391 + CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); 395 392 } 396 393 397 394 if (ret < 0) ··· 491 492 CSR_HW_IF_CONFIG_REG_PCI_OWN_SET); 492 493 493 494 /* See if we got it */ 494 - ret = iwl_poll_bit(trans, CSR_HW_IF_CONFIG_REG, 495 - CSR_HW_IF_CONFIG_REG_PCI_OWN_SET, 496 - CSR_HW_IF_CONFIG_REG_PCI_OWN_SET, 497 - HW_READY_TIMEOUT); 495 + ret = iwl_poll_bits(trans, CSR_HW_IF_CONFIG_REG, 496 + CSR_HW_IF_CONFIG_REG_PCI_OWN_SET, 497 + HW_READY_TIMEOUT); 498 498 499 499 if (ret >= 0) 500 500 iwl_set_bit(trans, CSR_MBOX_SET_REG, CSR_MBOX_SET_REG_OS_ALIVE); ··· 2352 2354 * 5000 series and later (including 1000 series) have non-volatile SRAM, 2353 2355 * and do not save/restore SRAM when power cycling. 2354 2356 */ 2355 - ret = iwl_poll_bit(trans, CSR_GP_CNTRL, poll, mask, 15000); 2357 + ret = iwl_poll_bits_mask(trans, CSR_GP_CNTRL, poll, mask, 15000); 2356 2358 if (unlikely(ret < 0)) { 2357 2359 u32 cntrl = iwl_read32(trans, CSR_GP_CNTRL); 2358 2360 ··· 3684 3686 iwl_trans_sync_nmi_with_addr(trans, inta_addr, sw_err_bit); 3685 3687 } 3686 3688 3687 - struct iwl_trans * 3689 + static int iwl_trans_pcie_set_txcmd_info(const struct iwl_mac_cfg *mac_cfg, 3690 + unsigned int *txcmd_size, 3691 + unsigned int *txcmd_align) 3692 + { 3693 + if (!mac_cfg->gen2) { 3694 + *txcmd_size = sizeof(struct iwl_tx_cmd_v6); 3695 + *txcmd_align = sizeof(void *); 3696 + } else if (mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210) { 3697 + *txcmd_size = sizeof(struct iwl_tx_cmd_v9); 3698 + *txcmd_align = 64; 3699 + } else { 3700 + *txcmd_size = sizeof(struct iwl_tx_cmd); 3701 + *txcmd_align = 128; 3702 + } 3703 + 3704 + *txcmd_size += sizeof(struct iwl_cmd_header); 3705 + *txcmd_size += 36; /* biggest possible 802.11 header */ 3706 + 3707 + /* Ensure device TX cmd cannot reach/cross a page boundary in gen2 */ 3708 + if (WARN_ON((mac_cfg->gen2 && *txcmd_size >= *txcmd_align))) 3709 + return -EINVAL; 3710 + 3711 + return 0; 3712 + } 3713 + 3714 + static struct iwl_trans * 3688 3715 iwl_trans_pcie_alloc(struct pci_dev *pdev, 3689 3716 const struct iwl_mac_cfg *mac_cfg, 3690 - struct iwl_trans_info *info) 3717 + struct iwl_trans_info *info, u8 __iomem *hw_base) 3691 3718 { 3692 3719 struct iwl_trans_pcie *trans_pcie, **priv; 3720 + unsigned int txcmd_size, txcmd_align; 3693 3721 struct iwl_trans *trans; 3694 3722 unsigned int bc_tbl_n_entries; 3695 3723 int ret, addr_size; 3696 - u32 bar0; 3697 3724 3698 - /* reassign our BAR 0 if invalid due to possible runtime PM races */ 3699 - pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &bar0); 3700 - if (bar0 == PCI_BASE_ADDRESS_MEM_TYPE_64) { 3701 - ret = pci_assign_resource(pdev, 0); 3702 - if (ret) 3703 - return ERR_PTR(ret); 3704 - } 3705 - 3706 - ret = pcim_enable_device(pdev); 3725 + ret = iwl_trans_pcie_set_txcmd_info(mac_cfg, &txcmd_size, 3726 + &txcmd_align); 3707 3727 if (ret) 3708 3728 return ERR_PTR(ret); 3709 3729 3710 3730 trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie), &pdev->dev, 3711 - mac_cfg); 3731 + mac_cfg, txcmd_size, txcmd_align); 3712 3732 if (!trans) 3713 3733 return ERR_PTR(-ENOMEM); 3714 3734 3715 3735 trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 3736 + 3737 + trans_pcie->hw_base = hw_base; 3716 3738 3717 3739 /* Initialize the wait queue for commands */ 3718 3740 init_waitqueue_head(&trans_pcie->wait_command_queue); ··· 3831 3813 PCIE_LINK_STATE_CLKPM); 3832 3814 } 3833 3815 3834 - pci_set_master(pdev); 3835 - 3836 3816 addr_size = trans_pcie->txqs.tfd.addr_size; 3837 3817 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(addr_size)); 3838 3818 if (ret) { ··· 3842 3826 } 3843 3827 } 3844 3828 3845 - ret = pcim_request_all_regions(pdev, DRV_NAME); 3846 - if (ret) { 3847 - dev_err(&pdev->dev, "Requesting all PCI BARs failed.\n"); 3848 - goto out_no_pci; 3849 - } 3850 - 3851 - trans_pcie->hw_base = pcim_iomap(pdev, 0, 0); 3852 - if (!trans_pcie->hw_base) { 3853 - dev_err(&pdev->dev, "Could not ioremap PCI BAR 0.\n"); 3854 - ret = -ENODEV; 3855 - goto out_no_pci; 3856 - } 3857 - 3858 3829 /* We disable the RETRY_TIMEOUT register (0x41) to keep 3859 3830 * PCI Tx retries from interfering with C3 CPU state */ 3860 3831 pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); 3861 3832 3862 3833 trans_pcie->pci_dev = pdev; 3863 3834 iwl_disable_interrupts(trans); 3864 - 3865 - info->hw_rev = iwl_read32(trans, CSR_HW_REV); 3866 - if (info->hw_rev == 0xffffffff) { 3867 - dev_err(&pdev->dev, "HW_REV=0xFFFFFFFF, PCI issues?\n"); 3868 - ret = -EIO; 3869 - goto out_no_pci; 3870 - } 3871 3835 3872 3836 /* 3873 3837 * In the 8000 HW family the format of the 4 bytes of CSR_HW_REV have ··· 3947 3951 } 3948 3952 trans_pcie->imr_status = IMR_D2S_IDLE; 3949 3953 return 0; 3954 + } 3955 + 3956 + /* 3957 + * Read rf id and cdb info from prph register and store it 3958 + */ 3959 + static void get_crf_id(struct iwl_trans *iwl_trans, 3960 + struct iwl_trans_info *info) 3961 + { 3962 + u32 sd_reg_ver_addr; 3963 + u32 hw_wfpm_id; 3964 + u32 val = 0; 3965 + u8 step; 3966 + 3967 + if (iwl_trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) 3968 + sd_reg_ver_addr = SD_REG_VER_GEN2; 3969 + else 3970 + sd_reg_ver_addr = SD_REG_VER; 3971 + 3972 + /* Enable access to peripheral registers */ 3973 + val = iwl_read_umac_prph_no_grab(iwl_trans, WFPM_CTRL_REG); 3974 + val |= WFPM_AUX_CTL_AUX_IF_MAC_OWNER_MSK; 3975 + iwl_write_umac_prph_no_grab(iwl_trans, WFPM_CTRL_REG, val); 3976 + 3977 + /* Read crf info */ 3978 + info->hw_crf_id = iwl_read_prph_no_grab(iwl_trans, sd_reg_ver_addr); 3979 + 3980 + /* Read cnv info */ 3981 + info->hw_cnv_id = iwl_read_prph_no_grab(iwl_trans, CNVI_AUX_MISC_CHIP); 3982 + 3983 + /* For BZ-W, take B step also when A step is indicated */ 3984 + if (CSR_HW_REV_TYPE(info->hw_rev) == IWL_CFG_MAC_TYPE_BZ_W) 3985 + step = SILICON_B_STEP; 3986 + 3987 + /* In BZ, the MAC step must be read from the CNVI aux register */ 3988 + if (CSR_HW_REV_TYPE(info->hw_rev) == IWL_CFG_MAC_TYPE_BZ) { 3989 + step = CNVI_AUX_MISC_CHIP_MAC_STEP(info->hw_cnv_id); 3990 + 3991 + /* For BZ-U, take B step also when A step is indicated */ 3992 + if ((CNVI_AUX_MISC_CHIP_PROD_TYPE(info->hw_cnv_id) == 3993 + CNVI_AUX_MISC_CHIP_PROD_TYPE_BZ_U) && 3994 + step == SILICON_A_STEP) 3995 + step = SILICON_B_STEP; 3996 + } 3997 + 3998 + if (CSR_HW_REV_TYPE(info->hw_rev) == IWL_CFG_MAC_TYPE_BZ || 3999 + CSR_HW_REV_TYPE(info->hw_rev) == IWL_CFG_MAC_TYPE_BZ_W) { 4000 + info->hw_rev_step = step; 4001 + info->hw_rev |= step; 4002 + } 4003 + 4004 + /* Read cdb info (also contains the jacket info if needed in the future */ 4005 + hw_wfpm_id = iwl_read_umac_prph_no_grab(iwl_trans, WFPM_OTP_CFG1_ADDR); 4006 + IWL_INFO(iwl_trans, "Detected crf-id 0x%x, cnv-id 0x%x wfpm id 0x%x\n", 4007 + info->hw_crf_id, info->hw_cnv_id, hw_wfpm_id); 4008 + } 4009 + 4010 + /* 4011 + * In case that there is no OTP on the NIC, map the rf id and cdb info 4012 + * from the prph registers. 4013 + */ 4014 + static int map_crf_id(struct iwl_trans *iwl_trans, 4015 + struct iwl_trans_info *info) 4016 + { 4017 + int ret = 0; 4018 + u32 val = info->hw_crf_id; 4019 + u32 step_id = REG_CRF_ID_STEP(val); 4020 + u32 slave_id = REG_CRF_ID_SLAVE(val); 4021 + u32 jacket_id_cnv = REG_CRF_ID_SLAVE(info->hw_cnv_id); 4022 + u32 hw_wfpm_id = iwl_read_umac_prph_no_grab(iwl_trans, 4023 + WFPM_OTP_CFG1_ADDR); 4024 + u32 jacket_id_wfpm = WFPM_OTP_CFG1_IS_JACKET(hw_wfpm_id); 4025 + u32 cdb_id_wfpm = WFPM_OTP_CFG1_IS_CDB(hw_wfpm_id); 4026 + 4027 + /* Map between crf id to rf id */ 4028 + switch (REG_CRF_ID_TYPE(val)) { 4029 + case REG_CRF_ID_TYPE_JF_1: 4030 + info->hw_rf_id = (IWL_CFG_RF_TYPE_JF1 << 12); 4031 + break; 4032 + case REG_CRF_ID_TYPE_JF_2: 4033 + info->hw_rf_id = (IWL_CFG_RF_TYPE_JF2 << 12); 4034 + break; 4035 + case REG_CRF_ID_TYPE_HR_NONE_CDB_1X1: 4036 + info->hw_rf_id = (IWL_CFG_RF_TYPE_HR1 << 12); 4037 + break; 4038 + case REG_CRF_ID_TYPE_HR_NONE_CDB: 4039 + info->hw_rf_id = (IWL_CFG_RF_TYPE_HR2 << 12); 4040 + break; 4041 + case REG_CRF_ID_TYPE_HR_CDB: 4042 + info->hw_rf_id = (IWL_CFG_RF_TYPE_HR2 << 12); 4043 + break; 4044 + case REG_CRF_ID_TYPE_GF: 4045 + info->hw_rf_id = (IWL_CFG_RF_TYPE_GF << 12); 4046 + break; 4047 + case REG_CRF_ID_TYPE_FM: 4048 + info->hw_rf_id = (IWL_CFG_RF_TYPE_FM << 12); 4049 + break; 4050 + case REG_CRF_ID_TYPE_WHP: 4051 + info->hw_rf_id = (IWL_CFG_RF_TYPE_WH << 12); 4052 + break; 4053 + case REG_CRF_ID_TYPE_PE: 4054 + info->hw_rf_id = (IWL_CFG_RF_TYPE_PE << 12); 4055 + break; 4056 + default: 4057 + ret = -EIO; 4058 + IWL_ERR(iwl_trans, 4059 + "Can't find a correct rfid for crf id 0x%x\n", 4060 + REG_CRF_ID_TYPE(val)); 4061 + goto out; 4062 + } 4063 + 4064 + /* Set Step-id */ 4065 + info->hw_rf_id |= (step_id << 8); 4066 + 4067 + /* Set CDB capabilities */ 4068 + if (cdb_id_wfpm || slave_id) { 4069 + info->hw_rf_id += BIT(28); 4070 + IWL_INFO(iwl_trans, "Adding cdb to rf id\n"); 4071 + } 4072 + 4073 + /* Set Jacket capabilities */ 4074 + if (jacket_id_wfpm || jacket_id_cnv) { 4075 + info->hw_rf_id += BIT(29); 4076 + IWL_INFO(iwl_trans, "Adding jacket to rf id\n"); 4077 + } 4078 + 4079 + IWL_INFO(iwl_trans, 4080 + "Detected rf-type 0x%x step-id 0x%x slave-id 0x%x from crf id 0x%x\n", 4081 + REG_CRF_ID_TYPE(val), step_id, slave_id, info->hw_rf_id); 4082 + IWL_INFO(iwl_trans, 4083 + "Detected cdb-id 0x%x jacket-id 0x%x from wfpm id 0x%x\n", 4084 + cdb_id_wfpm, jacket_id_wfpm, hw_wfpm_id); 4085 + IWL_INFO(iwl_trans, "Detected jacket-id 0x%x from cnvi id 0x%x\n", 4086 + jacket_id_cnv, info->hw_cnv_id); 4087 + 4088 + out: 4089 + return ret; 4090 + } 4091 + 4092 + static void iwl_pcie_recheck_me_status(struct work_struct *wk) 4093 + { 4094 + struct iwl_trans_pcie *trans_pcie = container_of(wk, 4095 + typeof(*trans_pcie), 4096 + me_recheck_wk.work); 4097 + u32 val; 4098 + 4099 + val = iwl_read32(trans_pcie->trans, CSR_HW_IF_CONFIG_REG); 4100 + trans_pcie->me_present = !!(val & CSR_HW_IF_CONFIG_REG_IAMT_UP); 4101 + } 4102 + 4103 + static void iwl_pcie_check_me_status(struct iwl_trans *trans) 4104 + { 4105 + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 4106 + u32 val; 4107 + 4108 + trans_pcie->me_present = -1; 4109 + 4110 + INIT_DELAYED_WORK(&trans_pcie->me_recheck_wk, 4111 + iwl_pcie_recheck_me_status); 4112 + 4113 + /* we don't have a good way of determining this until BZ */ 4114 + if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_BZ) 4115 + return; 4116 + 4117 + val = iwl_read_prph(trans, CNVI_SCU_REG_FOR_ECO_1); 4118 + if (val & CNVI_SCU_REG_FOR_ECO_1_WIAMT_KNOWN) { 4119 + trans_pcie->me_present = 4120 + !!(val & CNVI_SCU_REG_FOR_ECO_1_WIAMT_PRESENT); 4121 + return; 4122 + } 4123 + 4124 + val = iwl_read32(trans, CSR_HW_IF_CONFIG_REG); 4125 + if (val & (CSR_HW_IF_CONFIG_REG_ME_OWN | 4126 + CSR_HW_IF_CONFIG_REG_IAMT_UP)) { 4127 + trans_pcie->me_present = 1; 4128 + return; 4129 + } 4130 + 4131 + /* recheck again later, ME might still be initializing */ 4132 + schedule_delayed_work(&trans_pcie->me_recheck_wk, HZ); 4133 + } 4134 + 4135 + int iwl_pci_gen1_2_probe(struct pci_dev *pdev, 4136 + const struct pci_device_id *ent, 4137 + const struct iwl_mac_cfg *mac_cfg, 4138 + u8 __iomem *hw_base, u32 hw_rev) 4139 + { 4140 + const struct iwl_dev_info *dev_info; 4141 + struct iwl_trans_info info = { 4142 + .hw_id = (pdev->device << 16) + pdev->subsystem_device, 4143 + .hw_rev = hw_rev, 4144 + }; 4145 + struct iwl_trans *iwl_trans; 4146 + struct iwl_trans_pcie *trans_pcie; 4147 + int ret; 4148 + 4149 + iwl_trans = iwl_trans_pcie_alloc(pdev, mac_cfg, &info, hw_base); 4150 + if (IS_ERR(iwl_trans)) 4151 + return PTR_ERR(iwl_trans); 4152 + 4153 + trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans); 4154 + 4155 + iwl_trans_pcie_check_product_reset_status(pdev); 4156 + iwl_trans_pcie_check_product_reset_mode(pdev); 4157 + 4158 + /* set the things we know so far for the grab NIC access */ 4159 + iwl_trans_set_info(iwl_trans, &info); 4160 + 4161 + /* 4162 + * Let's try to grab NIC access early here. Sometimes, NICs may 4163 + * fail to initialize, and if that happens it's better if we see 4164 + * issues early on (and can reprobe, per the logic inside), than 4165 + * first trying to load the firmware etc. and potentially only 4166 + * detecting any problems when the first interface is brought up. 4167 + */ 4168 + ret = iwl_pcie_prepare_card_hw(iwl_trans); 4169 + if (!ret) { 4170 + ret = iwl_finish_nic_init(iwl_trans); 4171 + if (ret) 4172 + goto out_free_trans; 4173 + if (iwl_trans_grab_nic_access(iwl_trans)) { 4174 + get_crf_id(iwl_trans, &info); 4175 + /* all good */ 4176 + iwl_trans_release_nic_access(iwl_trans); 4177 + } else { 4178 + ret = -EIO; 4179 + goto out_free_trans; 4180 + } 4181 + } 4182 + 4183 + info.hw_rf_id = iwl_read32(iwl_trans, CSR_HW_RF_ID); 4184 + 4185 + /* 4186 + * The RF_ID is set to zero in blank OTP so read version to 4187 + * extract the RF_ID. 4188 + * This is relevant only for family 9000 and up. 4189 + */ 4190 + if (iwl_trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_9000 && 4191 + !CSR_HW_RFID_TYPE(info.hw_rf_id) && map_crf_id(iwl_trans, &info)) { 4192 + ret = -EINVAL; 4193 + goto out_free_trans; 4194 + } 4195 + 4196 + IWL_INFO(iwl_trans, "PCI dev %04x/%04x, rev=0x%x, rfid=0x%x\n", 4197 + pdev->device, pdev->subsystem_device, 4198 + info.hw_rev, info.hw_rf_id); 4199 + 4200 + dev_info = iwl_pci_find_dev_info(pdev->device, pdev->subsystem_device, 4201 + CSR_HW_RFID_TYPE(info.hw_rf_id), 4202 + CSR_HW_RFID_IS_CDB(info.hw_rf_id), 4203 + IWL_SUBDEVICE_RF_ID(pdev->subsystem_device), 4204 + IWL_SUBDEVICE_BW_LIM(pdev->subsystem_device), 4205 + !iwl_trans->mac_cfg->integrated); 4206 + if (dev_info) { 4207 + iwl_trans->cfg = dev_info->cfg; 4208 + info.name = dev_info->name; 4209 + } 4210 + 4211 + #if IS_ENABLED(CONFIG_IWLMVM) 4212 + 4213 + /* 4214 + * special-case 7265D, it has the same PCI IDs. 4215 + * 4216 + * Note that because we already pass the cfg to the transport above, 4217 + * all the parameters that the transport uses must, until that is 4218 + * changed, be identical to the ones in the 7265D configuration. 4219 + */ 4220 + if (iwl_trans->cfg == &iwl7265_cfg && 4221 + (info.hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D) 4222 + iwl_trans->cfg = &iwl7265d_cfg; 4223 + #endif 4224 + if (!iwl_trans->cfg) { 4225 + pr_err("No config found for PCI dev %04x/%04x, rev=0x%x, rfid=0x%x\n", 4226 + pdev->device, pdev->subsystem_device, 4227 + info.hw_rev, info.hw_rf_id); 4228 + ret = -EINVAL; 4229 + goto out_free_trans; 4230 + } 4231 + 4232 + IWL_INFO(iwl_trans, "Detected %s\n", info.name); 4233 + 4234 + if (iwl_trans->mac_cfg->mq_rx_supported) { 4235 + if (WARN_ON(!iwl_trans->cfg->num_rbds)) { 4236 + ret = -EINVAL; 4237 + goto out_free_trans; 4238 + } 4239 + trans_pcie->num_rx_bufs = iwl_trans_get_num_rbds(iwl_trans); 4240 + } else { 4241 + trans_pcie->num_rx_bufs = RX_QUEUE_SIZE; 4242 + } 4243 + 4244 + if (!iwl_trans->mac_cfg->integrated) { 4245 + u16 link_status; 4246 + 4247 + pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &link_status); 4248 + 4249 + info.pcie_link_speed = 4250 + u16_get_bits(link_status, PCI_EXP_LNKSTA_CLS); 4251 + } 4252 + 4253 + iwl_trans_set_info(iwl_trans, &info); 4254 + 4255 + pci_set_drvdata(pdev, iwl_trans); 4256 + 4257 + iwl_pcie_check_me_status(iwl_trans); 4258 + 4259 + /* try to get ownership so that we'll know if we don't own it */ 4260 + iwl_pcie_prepare_card_hw(iwl_trans); 4261 + 4262 + iwl_trans->drv = iwl_drv_start(iwl_trans); 4263 + 4264 + if (IS_ERR(iwl_trans->drv)) { 4265 + ret = PTR_ERR(iwl_trans->drv); 4266 + goto out_free_trans; 4267 + } 4268 + 4269 + /* register transport layer debugfs here */ 4270 + iwl_trans_pcie_dbgfs_register(iwl_trans); 4271 + 4272 + return 0; 4273 + 4274 + out_free_trans: 4275 + iwl_trans_pcie_free(iwl_trans); 4276 + return ret; 3950 4277 }
+1 -1
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx.c
··· 590 590 } 591 591 592 592 /* Wait for DMA channels to be idle */ 593 - ret = iwl_poll_bit(trans, FH_TSSR_TX_STATUS_REG, mask, mask, 5000); 593 + ret = iwl_poll_bits(trans, FH_TSSR_TX_STATUS_REG, mask, 5000); 594 594 if (ret < 0) 595 595 IWL_ERR(trans, 596 596 "Failing on timeout while stopping DMA channel %d [0x%08x]\n",
+35 -10
drivers/net/wireless/intel/iwlwifi/tests/devinfo.c
··· 31 31 pos += scnprintf(buf + pos, sizeof(buf) - pos, 32 32 " bw_limit=*"); 33 33 34 - if (di->match_rf_step) 35 - pos += scnprintf(buf + pos, sizeof(buf) - pos, 36 - " rf_step=%c", 37 - di->rf_step == SILICON_Z_STEP ? 'Z' : 38 - 'A' + di->rf_step); 39 - else 40 - pos += scnprintf(buf + pos, sizeof(buf) - pos, 41 - " rf_step=*"); 42 - 43 34 if (di->match_rf_id) 44 35 pos += scnprintf(buf + pos, sizeof(buf) - pos, 45 36 " rf_id=0x%x", di->rf_id); ··· 45 54 pos += scnprintf(buf + pos, sizeof(buf) - pos, 46 55 " cdb=*"); 47 56 57 + if (di->match_discrete) 58 + pos += scnprintf(buf + pos, sizeof(buf) - pos, 59 + " discrete=%d", 60 + di->discrete); 61 + else 62 + pos += scnprintf(buf + pos, sizeof(buf) - pos, 63 + " discrete=*"); 48 64 49 65 printk(KERN_DEBUG "%sdev=%04x subdev=%04x/%04x%s\n", 50 66 pfx, di->device, di->subdevice, subdevice_mask, buf); ··· 68 70 ret = iwl_pci_find_dev_info(di->device, di->subdevice, 69 71 di->rf_type, di->cdb, 70 72 di->rf_id, di->bw_limit, 71 - di->rf_step); 73 + di->discrete); 72 74 if (!ret) { 73 75 iwl_pci_print_dev_info("No entry found for: ", di); 74 76 KUNIT_FAIL(test, ··· 80 82 "unusable entry at index %d (found index %d instead)\n", 81 83 idx, (int)(ret - iwl_dev_info_table)); 82 84 } 85 + } 86 + } 87 + 88 + static void devinfo_discrete_match(struct kunit *test) 89 + { 90 + /* 91 + * Validate that any entries with discrete/integrated match have 92 + * the same config with the value inverted (if they match at all.) 93 + */ 94 + 95 + for (int idx = 0; idx < iwl_dev_info_table_size; idx++) { 96 + const struct iwl_dev_info *di = &iwl_dev_info_table[idx]; 97 + const struct iwl_dev_info *ret; 98 + 99 + if (!di->match_discrete) 100 + continue; 101 + 102 + ret = iwl_pci_find_dev_info(di->device, di->subdevice, 103 + di->rf_type, di->cdb, 104 + di->rf_id, di->bw_limit, 105 + !di->discrete); 106 + if (!ret) 107 + continue; 108 + KUNIT_EXPECT_PTR_EQ(test, di->cfg, ret->cfg); 109 + /* and check the name is different, that'd be the point of it */ 110 + KUNIT_EXPECT_NE(test, strcmp(di->name, ret->name), 0); 83 111 } 84 112 } 85 113 ··· 240 216 241 217 static struct kunit_case devinfo_test_cases[] = { 242 218 KUNIT_CASE(devinfo_table_order), 219 + KUNIT_CASE(devinfo_discrete_match), 243 220 KUNIT_CASE(devinfo_names), 244 221 KUNIT_CASE(devinfo_no_cfg_dups), 245 222 KUNIT_CASE(devinfo_no_name_dups),
+2 -2
drivers/net/wireless/mediatek/mt76/channel.c
··· 173 173 if (!mlink) 174 174 goto out; 175 175 176 - if (link_conf != &vif->bss_conf) 176 + if (mlink != (struct mt76_vif_link *)vif->drv_priv) 177 177 rcu_assign_pointer(mvif->link[link_id], NULL); 178 178 179 179 dev->drv->vif_link_remove(phy, vif, link_conf, mlink); 180 180 mlink->ctx = NULL; 181 181 182 - if (link_conf != &vif->bss_conf) 182 + if (mlink != (struct mt76_vif_link *)vif->drv_priv) 183 183 kfree_rcu(mlink, rcu_head); 184 184 185 185 out:
+3 -8
drivers/net/wireless/mediatek/mt76/dma.c
··· 643 643 644 644 while (q->queued < q->ndesc - 1) { 645 645 struct mt76_queue_buf qbuf = {}; 646 - enum dma_data_direction dir; 647 - dma_addr_t addr; 648 - int offset; 649 646 void *buf = NULL; 647 + int offset; 650 648 651 649 if (mt76_queue_is_wed_rro_ind(q)) 652 650 goto done; ··· 653 655 if (!buf) 654 656 break; 655 657 656 - addr = page_pool_get_dma_addr(virt_to_head_page(buf)) + offset; 657 - dir = page_pool_get_dma_dir(q->page_pool); 658 - dma_sync_single_for_device(dev->dma_dev, addr, len, dir); 659 - 660 - qbuf.addr = addr + q->buf_offset; 658 + qbuf.addr = page_pool_get_dma_addr(virt_to_head_page(buf)) + 659 + offset + q->buf_offset; 661 660 done: 662 661 qbuf.len = len - q->buf_offset; 663 662 qbuf.skip_unmap = false;
+4
drivers/net/wireless/mediatek/mt76/mcu.c
··· 78 78 unsigned long expires; 79 79 int ret, seq; 80 80 81 + if (mt76_is_sdio(dev)) 82 + if (test_bit(MT76_RESET, &dev->phy.state) && atomic_read(&dev->bus_hung)) 83 + return -EIO; 84 + 81 85 if (ret_skb) 82 86 *ret_skb = NULL; 83 87
+6 -1
drivers/net/wireless/mediatek/mt76/mt76.h
··· 983 983 struct mt76_usb usb; 984 984 struct mt76_sdio sdio; 985 985 }; 986 + 987 + atomic_t bus_hung; 986 988 }; 987 989 988 990 /* per-phy stats. */ ··· 1867 1865 struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; 1868 1866 struct mt76_vif_data *mvif = mlink->mvif; 1869 1867 1868 + if (!link_id) 1869 + return mlink; 1870 + 1870 1871 return mt76_dereference(mvif->link[link_id], dev); 1871 1872 } 1872 1873 ··· 1880 1875 struct mt76_vif_link *mlink = (struct mt76_vif_link *)vif->drv_priv; 1881 1876 struct mt76_vif_data *mvif = mlink->mvif; 1882 1877 1883 - if (link_conf == &vif->bss_conf) 1878 + if (link_conf == &vif->bss_conf || !link_conf->link_id) 1884 1879 return mlink; 1885 1880 1886 1881 return mt76_dereference(mvif->link[link_conf->link_id], dev);
+20 -10
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
··· 197 197 static void 198 198 mt7915_mcu_set_timeout(struct mt76_dev *mdev, int cmd) 199 199 { 200 + mdev->mcu.timeout = 5 * HZ; 201 + 200 202 if ((cmd & __MCU_CMD_FIELD_ID) != MCU_CMD_EXT_CID) 201 203 return; 202 204 ··· 209 207 case MCU_EXT_CMD_STA_REC_UPDATE: 210 208 case MCU_EXT_CMD_BSS_INFO_UPDATE: 211 209 mdev->mcu.timeout = 2 * HZ; 210 + return; 211 + case MCU_EXT_CMD_EFUSE_BUFFER_MODE: 212 + mdev->mcu.timeout = 10 * HZ; 212 213 return; 213 214 default: 214 215 break; ··· 2115 2110 { 2116 2111 int ret; 2117 2112 2118 - /* make sure fw is download state */ 2119 - if (mt7915_firmware_state(dev, false)) { 2120 - /* restart firmware once */ 2121 - mt76_connac_mcu_restart(&dev->mt76); 2122 - ret = mt7915_firmware_state(dev, false); 2123 - if (ret) { 2124 - dev_err(dev->mt76.dev, 2125 - "Firmware is not ready for download\n"); 2126 - return ret; 2127 - } 2113 + /* Release Semaphore if taken by previous failed attempt */ 2114 + ret = mt76_connac_mcu_patch_sem_ctrl(&dev->mt76, false); 2115 + if (ret != PATCH_REL_SEM_SUCCESS) { 2116 + dev_err(dev->mt76.dev, "Could not release semaphore\n"); 2117 + /* Continue anyways */ 2118 + } 2119 + 2120 + /* Always restart MCU firmware */ 2121 + mt76_connac_mcu_restart(&dev->mt76); 2122 + 2123 + /* Check if MCU is ready */ 2124 + ret = mt7915_firmware_state(dev, false); 2125 + if (ret) { 2126 + dev_err(dev->mt76.dev, "Firmware did not enter download state\n"); 2127 + return ret; 2128 2128 } 2129 2129 2130 2130 ret = mt76_connac2_load_patch(&dev->mt76, fw_name_var(dev, ROM_PATCH));
+2
drivers/net/wireless/mediatek/mt76/mt7921/mac.c
··· 675 675 if (!ret) 676 676 break; 677 677 } 678 + if (mt76_is_sdio(&dev->mt76) && atomic_read(&dev->mt76.bus_hung)) 679 + return; 678 680 679 681 if (i == 10) 680 682 dev_err(dev->mt76.dev, "chip reset failed\n");
+2
drivers/net/wireless/mediatek/mt76/mt7921/sdio.c
··· 150 150 if (ret) 151 151 goto error; 152 152 153 + atomic_set(&mdev->bus_hung, false); 154 + 153 155 mdev->rev = (mt76_rr(dev, MT_HW_CHIPID) << 16) | 154 156 (mt76_rr(dev, MT_HW_REV) & 0xff); 155 157 dev_dbg(mdev->dev, "ASIC revision: %04x\n", mdev->rev);
+58
drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c
··· 6 6 #include "mt7921.h" 7 7 #include "../mt76_connac2_mac.h" 8 8 #include "../sdio.h" 9 + #include <linux/mmc/host.h> 10 + #include <linux/kallsyms.h> 9 11 10 12 static void mt7921s_enable_irq(struct mt76_dev *dev) 11 13 { ··· 36 34 { 37 35 struct mt76_sdio *sdio = &dev->mt76.sdio; 38 36 u32 val, status; 37 + 38 + if (atomic_read(&dev->mt76.bus_hung)) 39 + return 0; 39 40 40 41 mt7921s_mcu_drv_pmctrl(dev); 41 42 ··· 96 91 return 0; 97 92 } 98 93 94 + static struct mt76_sdio *msdio; 95 + static void mt7921s_card_reset(struct work_struct *work) 96 + { 97 + struct mmc_host *sdio_host = msdio->func->card->host; 98 + 99 + sdio_claim_host(msdio->func); 100 + sdio_release_irq(msdio->func); 101 + sdio_release_host(msdio->func); 102 + 103 + mmc_remove_host(sdio_host); 104 + msleep(50); 105 + mmc_add_host(sdio_host); 106 + } 107 + 108 + static DECLARE_WORK(sdio_reset_work, mt7921s_card_reset); 109 + static int mt7921s_check_bus(struct mt76_dev *dev) 110 + { 111 + struct mt76_sdio *sdio = &dev->sdio; 112 + int err; 113 + 114 + sdio_claim_host(sdio->func); 115 + sdio_readl(dev->sdio.func, MCR_WHCR, &err); 116 + sdio_release_host(sdio->func); 117 + 118 + return err; 119 + } 120 + 121 + static int mt7921s_host_reset(struct mt792x_dev *dev) 122 + { 123 + struct mt76_dev *mdev = &dev->mt76; 124 + int err = -1; 125 + 126 + if (!atomic_read(&mdev->bus_hung)) 127 + err = mt7921s_check_bus(&dev->mt76); 128 + 129 + if (err) { 130 + atomic_set(&mdev->bus_hung, true); 131 + msdio = &dev->mt76.sdio; 132 + dev_err(mdev->dev, "SDIO bus problem detected(%d), resetting card!!\n", err); 133 + schedule_work(&sdio_reset_work); 134 + return err; 135 + } 136 + 137 + atomic_set(&mdev->bus_hung, false); 138 + 139 + return 0; 140 + } 141 + 99 142 int mt7921s_mac_reset(struct mt792x_dev *dev) 100 143 { 101 144 int err; 102 145 103 146 mt76_connac_free_pending_tx_skbs(&dev->pm, NULL); 147 + 148 + mt7921s_host_reset(dev); 149 + if (atomic_read(&dev->mt76.bus_hung)) 150 + return 0; 151 + 104 152 mt76_txq_schedule_all(&dev->mphy); 105 153 mt76_worker_disable(&dev->mt76.tx_worker); 106 154 set_bit(MT76_MCU_RESET, &dev->mphy.state);
+2 -2
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
··· 2866 2866 for (i = 0; i < sreq->n_ssids; i++) { 2867 2867 if (!sreq->ssids[i].ssid_len) 2868 2868 continue; 2869 - if (i > MT7925_RNR_SCAN_MAX_BSSIDS) 2869 + if (i >= MT7925_RNR_SCAN_MAX_BSSIDS) 2870 2870 break; 2871 2871 2872 2872 ssid->ssids[i].ssid_len = cpu_to_le32(sreq->ssids[i].ssid_len); ··· 2883 2883 mt76_connac_mcu_build_rnr_scan_param(mdev, sreq); 2884 2884 2885 2885 for (j = 0; j < mdev->rnr.bssid_num; j++) { 2886 - if (j > MT7925_RNR_SCAN_MAX_BSSIDS) 2886 + if (j >= MT7925_RNR_SCAN_MAX_BSSIDS) 2887 2887 break; 2888 2888 2889 2889 tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_BSSID,
+1
drivers/net/wireless/mediatek/mt76/mt792x_core.c
··· 666 666 ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS); 667 667 ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW); 668 668 ieee80211_hw_set(hw, CONNECTION_MONITOR); 669 + ieee80211_hw_set(hw, NO_VIRTUAL_MONITOR); 669 670 if (is_mt7921(&dev->mt76)) 670 671 ieee80211_hw_set(hw, CHANCTX_STA_CSA); 671 672
+23 -25
drivers/net/wireless/mediatek/mt76/mt7996/mac.c
··· 1087 1087 if (wcid->offchannel) 1088 1088 mlink = rcu_dereference(mvif->mt76.offchannel_link); 1089 1089 if (!mlink) 1090 - mlink = &mvif->deflink.mt76; 1090 + mlink = rcu_dereference(mvif->mt76.link[wcid->link_id]); 1091 1091 1092 - txp->fw.bss_idx = mlink->idx; 1092 + txp->fw.bss_idx = mlink ? mlink->idx : mvif->deflink.mt76.idx; 1093 1093 } 1094 1094 1095 1095 txp->fw.token = cpu_to_le16(id); ··· 1129 1129 } 1130 1130 1131 1131 static void 1132 - mt7996_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb) 1132 + mt7996_tx_check_aggr(struct ieee80211_link_sta *link_sta, 1133 + struct mt76_wcid *wcid, struct sk_buff *skb) 1133 1134 { 1134 1135 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1135 1136 bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP; 1136 - struct mt7996_sta_link *msta_link; 1137 - struct mt7996_sta *msta; 1138 1137 u16 fc, tid; 1139 1138 1140 - if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)) 1139 + if (!(link_sta->ht_cap.ht_supported || link_sta->he_cap.has_he)) 1141 1140 return; 1142 1141 1143 1142 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; ··· 1145 1146 1146 1147 if (is_8023) { 1147 1148 fc = IEEE80211_FTYPE_DATA | 1148 - (sta->wme ? IEEE80211_STYPE_QOS_DATA : IEEE80211_STYPE_DATA); 1149 + (link_sta->sta->wme ? IEEE80211_STYPE_QOS_DATA 1150 + : IEEE80211_STYPE_DATA); 1149 1151 } else { 1150 1152 /* No need to get precise TID for Action/Management Frame, 1151 1153 * since it will not meet the following Frame Control ··· 1162 1162 if (unlikely(fc != (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA))) 1163 1163 return; 1164 1164 1165 - msta = (struct mt7996_sta *)sta->drv_priv; 1166 - msta_link = &msta->deflink; 1167 - 1168 - if (!test_and_set_bit(tid, &msta_link->wcid.ampdu_state)) 1169 - ieee80211_start_tx_ba_session(sta, tid, 0); 1165 + if (!test_and_set_bit(tid, &wcid->ampdu_state)) 1166 + ieee80211_start_tx_ba_session(link_sta->sta, tid, 0); 1170 1167 } 1171 1168 1172 1169 static void 1173 1170 mt7996_txwi_free(struct mt7996_dev *dev, struct mt76_txwi_cache *t, 1174 - struct ieee80211_sta *sta, struct list_head *free_list) 1171 + struct ieee80211_link_sta *link_sta, 1172 + struct mt76_wcid *wcid, struct list_head *free_list) 1175 1173 { 1176 1174 struct mt76_dev *mdev = &dev->mt76; 1177 - struct mt76_wcid *wcid; 1178 1175 __le32 *txwi; 1179 1176 u16 wcid_idx; 1180 1177 ··· 1180 1183 goto out; 1181 1184 1182 1185 txwi = (__le32 *)mt76_get_txwi_ptr(mdev, t); 1183 - if (sta) { 1184 - wcid = (struct mt76_wcid *)sta->drv_priv; 1186 + if (link_sta) { 1185 1187 wcid_idx = wcid->idx; 1186 - 1187 1188 if (likely(t->skb->protocol != cpu_to_be16(ETH_P_PAE))) 1188 - mt7996_tx_check_aggr(sta, t->skb); 1189 + mt7996_tx_check_aggr(link_sta, wcid, t->skb); 1189 1190 } else { 1190 1191 wcid_idx = le32_get_bits(txwi[9], MT_TXD9_WLAN_IDX); 1191 1192 } ··· 1202 1207 struct mt76_dev *mdev = &dev->mt76; 1203 1208 struct mt76_phy *phy2 = mdev->phys[MT_BAND1]; 1204 1209 struct mt76_phy *phy3 = mdev->phys[MT_BAND2]; 1210 + struct ieee80211_link_sta *link_sta = NULL; 1205 1211 struct mt76_txwi_cache *txwi; 1206 - struct ieee80211_sta *sta = NULL; 1207 1212 struct mt76_wcid *wcid = NULL; 1208 1213 LIST_HEAD(free_list); 1209 1214 struct sk_buff *skb, *tmp; ··· 1240 1245 */ 1241 1246 info = le32_to_cpu(*cur_info); 1242 1247 if (info & MT_TXFREE_INFO_PAIR) { 1243 - struct mt7996_sta_link *msta_link; 1248 + struct ieee80211_sta *sta; 1244 1249 u16 idx; 1245 1250 1246 1251 idx = FIELD_GET(MT_TXFREE_INFO_WLAN_ID, info); ··· 1249 1254 if (!sta) 1250 1255 goto next; 1251 1256 1252 - msta_link = container_of(wcid, struct mt7996_sta_link, 1253 - wcid); 1254 - mt76_wcid_add_poll(&dev->mt76, &msta_link->wcid); 1257 + link_sta = rcu_dereference(sta->link[wcid->link_id]); 1258 + if (!link_sta) 1259 + goto next; 1260 + 1261 + mt76_wcid_add_poll(&dev->mt76, wcid); 1255 1262 next: 1256 1263 /* ver 7 has a new DW with pair = 1, skip it */ 1257 1264 if (ver == 7 && ((void *)(cur_info + 1) < end) && ··· 1286 1289 if (!txwi) 1287 1290 continue; 1288 1291 1289 - mt7996_txwi_free(dev, txwi, sta, &free_list); 1292 + mt7996_txwi_free(dev, txwi, link_sta, wcid, 1293 + &free_list); 1290 1294 } 1291 1295 } 1292 1296 ··· 1746 1748 1747 1749 spin_lock_bh(&dev->mt76.token_lock); 1748 1750 idr_for_each_entry(&dev->mt76.token, txwi, id) { 1749 - mt7996_txwi_free(dev, txwi, NULL, NULL); 1751 + mt7996_txwi_free(dev, txwi, NULL, NULL, NULL); 1750 1752 dev->mt76.token_count--; 1751 1753 } 1752 1754 spin_unlock_bh(&dev->mt76.token_lock);
+46 -34
drivers/net/wireless/mediatek/mt76/mt7996/main.c
··· 960 960 } 961 961 962 962 static void 963 - mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_sta *sta, 964 - unsigned long links) 963 + mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif, 964 + struct ieee80211_sta *sta, unsigned long links) 965 965 { 966 966 struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; 967 967 struct mt76_dev *mdev = &dev->mt76; ··· 969 969 970 970 for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) { 971 971 struct mt7996_sta_link *msta_link = NULL; 972 + struct mt7996_vif_link *link; 973 + struct mt76_phy *mphy; 972 974 973 975 msta_link = rcu_replace_pointer(msta->link[link_id], msta_link, 974 976 lockdep_is_held(&mdev->mutex)); ··· 978 976 continue; 979 977 980 978 mt7996_mac_sta_deinit_link(dev, msta_link); 979 + link = mt7996_vif_link(dev, vif, link_id); 980 + if (!link) 981 + continue; 982 + 983 + mphy = mt76_vif_link_phy(&link->mt76); 984 + if (!mphy) 985 + continue; 986 + 987 + mphy->num_sta--; 981 988 if (msta->deflink_id == link_id) { 982 989 msta->deflink_id = IEEE80211_LINK_UNSPECIFIED; 983 990 continue; ··· 1008 997 struct ieee80211_bss_conf *link_conf; 1009 998 struct ieee80211_link_sta *link_sta; 1010 999 struct mt7996_vif_link *link; 1000 + struct mt76_phy *mphy; 1011 1001 1012 1002 if (rcu_access_pointer(msta->link[link_id])) 1013 1003 continue; ··· 1035 1023 link_id); 1036 1024 if (err) 1037 1025 goto error_unlink; 1026 + 1027 + mphy = mt76_vif_link_phy(&link->mt76); 1028 + if (!mphy) { 1029 + err = -EINVAL; 1030 + goto error_unlink; 1031 + } 1032 + mphy->num_sta++; 1038 1033 } 1039 1034 1040 1035 return 0; 1041 1036 1042 1037 error_unlink: 1043 - mt7996_mac_sta_remove_links(dev, sta, new_links); 1038 + mt7996_mac_sta_remove_links(dev, vif, sta, new_links); 1044 1039 1045 1040 return err; 1046 1041 } ··· 1064 1045 1065 1046 mutex_lock(&dev->mt76.mutex); 1066 1047 1067 - mt7996_mac_sta_remove_links(dev, sta, rem); 1048 + mt7996_mac_sta_remove_links(dev, vif, sta, rem); 1068 1049 ret = mt7996_mac_sta_add_links(dev, vif, sta, add); 1069 1050 1070 1051 mutex_unlock(&dev->mt76.mutex); ··· 1073 1054 } 1074 1055 1075 1056 static int 1076 - mt7996_mac_sta_add(struct mt76_phy *mphy, struct ieee80211_vif *vif, 1057 + mt7996_mac_sta_add(struct mt7996_dev *dev, struct ieee80211_vif *vif, 1077 1058 struct ieee80211_sta *sta) 1078 1059 { 1079 - struct mt76_dev *mdev = mphy->dev; 1080 - struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76); 1081 1060 struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; 1082 1061 struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; 1083 - unsigned long links = sta->mlo ? sta->valid_links : BIT(0); 1062 + unsigned long links = sta->valid_links ? sta->valid_links : BIT(0); 1084 1063 int err; 1085 1064 1086 - mutex_lock(&mdev->mutex); 1065 + mutex_lock(&dev->mt76.mutex); 1087 1066 1088 1067 msta->deflink_id = IEEE80211_LINK_UNSPECIFIED; 1089 1068 msta->vif = mvif; 1090 1069 err = mt7996_mac_sta_add_links(dev, vif, sta, links); 1091 - if (!err) 1092 - mphy->num_sta++; 1093 1070 1094 - mutex_unlock(&mdev->mutex); 1071 + mutex_unlock(&dev->mt76.mutex); 1095 1072 1096 1073 return err; 1097 1074 } ··· 1134 1119 return err; 1135 1120 1136 1121 msta_link->wcid.tx_info |= MT_WCID_TX_INFO_SET; 1137 - msta_link->wcid.sta = 1; 1138 1122 break; 1139 1123 case MT76_STA_EVENT_AUTHORIZE: 1140 1124 err = mt7996_mcu_add_sta(dev, link_conf, link_sta, ··· 1165 1151 } 1166 1152 1167 1153 static void 1168 - mt7996_mac_sta_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif, 1154 + mt7996_mac_sta_remove(struct mt7996_dev *dev, struct ieee80211_vif *vif, 1169 1155 struct ieee80211_sta *sta) 1170 1156 { 1171 - struct mt76_dev *mdev = mphy->dev; 1172 - struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76); 1173 - unsigned long links = sta->mlo ? sta->valid_links : BIT(0); 1157 + unsigned long links = sta->valid_links ? sta->valid_links : BIT(0); 1174 1158 1175 - mutex_lock(&mdev->mutex); 1176 - 1177 - mt7996_mac_sta_remove_links(dev, sta, links); 1178 - mphy->num_sta--; 1179 - 1180 - mutex_unlock(&mdev->mutex); 1159 + mutex_lock(&dev->mt76.mutex); 1160 + mt7996_mac_sta_remove_links(dev, vif, sta, links); 1161 + mutex_unlock(&dev->mt76.mutex); 1181 1162 } 1182 1163 1183 1164 static int ··· 1180 1171 struct ieee80211_sta *sta, enum ieee80211_sta_state old_state, 1181 1172 enum ieee80211_sta_state new_state) 1182 1173 { 1183 - struct mt76_phy *mphy = mt76_vif_phy(hw, vif); 1184 1174 struct mt7996_dev *dev = mt7996_hw_dev(hw); 1185 1175 enum mt76_sta_event ev; 1186 1176 1187 - if (!mphy) 1188 - return -EINVAL; 1189 - 1190 1177 if (old_state == IEEE80211_STA_NOTEXIST && 1191 1178 new_state == IEEE80211_STA_NONE) 1192 - return mt7996_mac_sta_add(mphy, vif, sta); 1179 + return mt7996_mac_sta_add(dev, vif, sta); 1193 1180 1194 1181 if (old_state == IEEE80211_STA_NONE && 1195 1182 new_state == IEEE80211_STA_NOTEXIST) 1196 - mt7996_mac_sta_remove(mphy, vif, sta); 1183 + mt7996_mac_sta_remove(dev, vif, sta); 1197 1184 1198 1185 if (old_state == IEEE80211_STA_AUTH && 1199 1186 new_state == IEEE80211_STA_ASSOC) ··· 1222 1217 1223 1218 if (vif) { 1224 1219 struct mt7996_vif *mvif = (void *)vif->drv_priv; 1225 - struct mt76_vif_link *mlink; 1220 + struct mt76_vif_link *mlink = &mvif->deflink.mt76; 1226 1221 1227 - mlink = rcu_dereference(mvif->mt76.link[link_id]); 1228 - if (mlink && mlink->wcid) 1222 + if (link_id < IEEE80211_LINK_UNSPECIFIED) 1223 + mlink = rcu_dereference(mvif->mt76.link[link_id]); 1224 + 1225 + if (!mlink) { 1226 + ieee80211_free_txskb(hw, skb); 1227 + goto unlock; 1228 + } 1229 + 1230 + if (mlink->wcid) 1229 1231 wcid = mlink->wcid; 1230 1232 1231 1233 if (mvif->mt76.roc_phy && ··· 1241 1229 if (mphy->roc_link) 1242 1230 wcid = mphy->roc_link->wcid; 1243 1231 } else { 1244 - mphy = mt76_vif_link_phy(&mvif->deflink.mt76); 1232 + mphy = mt76_vif_link_phy(mlink); 1245 1233 } 1246 1234 } 1247 1235 ··· 1250 1238 goto unlock; 1251 1239 } 1252 1240 1253 - if (control->sta) { 1241 + if (control->sta && link_id < IEEE80211_LINK_UNSPECIFIED) { 1254 1242 struct mt7996_sta *msta = (void *)control->sta->drv_priv; 1255 1243 struct mt7996_sta_link *msta_link; 1256 1244
+8 -9
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
··· 2216 2216 2217 2217 static void 2218 2218 mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb, 2219 + struct ieee80211_vif *vif, 2219 2220 struct ieee80211_sta *sta) 2220 2221 { 2221 2222 struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; 2222 - unsigned long links = sta->valid_links; 2223 - unsigned int nlinks = hweight16(links); 2223 + unsigned int nlinks = hweight16(sta->valid_links); 2224 2224 struct mld_setup_link *mld_setup_link; 2225 + struct ieee80211_link_sta *link_sta; 2225 2226 struct sta_rec_mld_setup *mld_setup; 2226 2227 struct mt7996_sta_link *msta_link; 2227 - struct ieee80211_vif *vif; 2228 2228 unsigned int link_id; 2229 2229 struct tlv *tlv; 2230 2230 ··· 2242 2242 mld_setup->primary_id = cpu_to_le16(msta_link->wcid.idx); 2243 2243 2244 2244 if (nlinks > 1) { 2245 - link_id = __ffs(links & ~BIT(msta->deflink_id)); 2246 - msta_link = mt76_dereference(msta->link[msta->deflink_id], 2247 - &dev->mt76); 2245 + link_id = __ffs(sta->valid_links & ~BIT(msta->deflink_id)); 2246 + msta_link = mt76_dereference(msta->link[link_id], &dev->mt76); 2248 2247 if (!msta_link) 2249 2248 return; 2250 2249 } 2251 2250 mld_setup->seconed_id = cpu_to_le16(msta_link->wcid.idx); 2252 2251 mld_setup->link_num = nlinks; 2253 2252 2254 - vif = container_of((void *)msta->vif, struct ieee80211_vif, drv_priv); 2255 2253 mld_setup_link = (struct mld_setup_link *)mld_setup->link_info; 2256 - for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) { 2254 + for_each_sta_active_link(vif, sta, link_sta, link_id) { 2257 2255 struct mt7996_vif_link *link; 2258 2256 2259 2257 msta_link = mt76_dereference(msta->link[link_id], &dev->mt76); ··· 2343 2345 mt7996_mcu_sta_muru_tlv(dev, skb, link_conf, link_sta); 2344 2346 2345 2347 if (sta->mlo) { 2346 - mt7996_mcu_sta_mld_setup_tlv(dev, skb, sta); 2348 + mt7996_mcu_sta_mld_setup_tlv(dev, skb, link_conf->vif, 2349 + sta); 2347 2350 mt7996_mcu_sta_eht_mld_tlv(dev, skb, sta); 2348 2351 } 2349 2352 }
+4 -2
drivers/net/wireless/mediatek/mt76/sdio_txrx.c
··· 112 112 113 113 if (err < 0) { 114 114 dev_err(dev->dev, "sdio read data failed:%d\n", err); 115 + atomic_set(&dev->bus_hung, true); 115 116 put_page(page); 116 117 return err; 117 118 } ··· 235 234 err = sdio_writesb(sdio->func, MCR_WTDR1, data, len); 236 235 sdio_release_host(sdio->func); 237 236 238 - if (err) 237 + if (err) { 239 238 dev_err(dev->dev, "sdio write failed: %d\n", err); 240 - 239 + atomic_set(&dev->bus_hung, true); 240 + } 241 241 return err; 242 242 } 243 243
+1 -5
drivers/net/wireless/mediatek/mt76/wed.c
··· 34 34 struct mt76_dev *dev = container_of(wed, struct mt76_dev, mmio.wed); 35 35 struct mtk_wed_bm_desc *desc = wed->rx_buf_ring.desc; 36 36 struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN]; 37 - int i, len = SKB_WITH_OVERHEAD(q->buf_size); 38 37 struct mt76_txwi_cache *t = NULL; 38 + int i; 39 39 40 40 for (i = 0; i < size; i++) { 41 - enum dma_data_direction dir; 42 41 dma_addr_t addr; 43 42 u32 offset; 44 43 int token; ··· 52 53 goto unmap; 53 54 54 55 addr = page_pool_get_dma_addr(virt_to_head_page(buf)) + offset; 55 - dir = page_pool_get_dma_dir(q->page_pool); 56 - dma_sync_single_for_device(dev->dma_dev, addr, len, dir); 57 - 58 56 desc->buf0 = cpu_to_le32(addr); 59 57 token = mt76_rx_token_consume(dev, buf, t, addr); 60 58 if (token < 0) {
+36 -7
include/linux/ieee80211.h
··· 9 9 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> 10 10 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH 11 11 * Copyright (c) 2016 - 2017 Intel Deutschland GmbH 12 - * Copyright (c) 2018 - 2024 Intel Corporation 12 + * Copyright (c) 2018 - 2025 Intel Corporation 13 13 */ 14 14 15 15 #ifndef LINUX_IEEE80211_H ··· 2837 2837 #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR 0x40000000 2838 2838 #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x80000000 2839 2839 2840 - #define IEEE80211_6GHZ_CTRL_REG_LPI_AP 0 2841 - #define IEEE80211_6GHZ_CTRL_REG_SP_AP 1 2842 - #define IEEE80211_6GHZ_CTRL_REG_VLP_AP 2 2843 - #define IEEE80211_6GHZ_CTRL_REG_INDOOR_LPI_AP 3 2844 - #define IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP 4 2840 + #define IEEE80211_6GHZ_CTRL_REG_LPI_AP 0 2841 + #define IEEE80211_6GHZ_CTRL_REG_SP_AP 1 2842 + #define IEEE80211_6GHZ_CTRL_REG_VLP_AP 2 2843 + #define IEEE80211_6GHZ_CTRL_REG_INDOOR_LPI_AP 3 2844 + #define IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP_OLD 4 2845 + #define IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP 8 2845 2846 2846 2847 /** 2847 2848 * struct ieee80211_he_6ghz_oper - HE 6 GHz operation Information field ··· 2860 2859 #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_80MHZ 2 2861 2860 #define IEEE80211_HE_6GHZ_OPER_CTRL_CHANWIDTH_160MHZ 3 2862 2861 #define IEEE80211_HE_6GHZ_OPER_CTRL_DUP_BEACON 0x4 2863 - #define IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO 0x38 2862 + #define IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO 0x78 2864 2863 u8 control; 2865 2864 u8 ccfs0; 2866 2865 u8 ccfs1; 2867 2866 u8 minrate; 2868 2867 } __packed; 2868 + 2869 + /** 2870 + * enum ieee80211_reg_conn_bits - represents Regulatory connectivity field bits. 2871 + * 2872 + * This enumeration defines bit flags used to represent regulatory connectivity 2873 + * field bits. 2874 + * 2875 + * @IEEE80211_REG_CONN_LPI_VALID: Indicates whether the LPI bit is valid. 2876 + * @IEEE80211_REG_CONN_LPI_VALUE: Represents the value of the LPI bit. 2877 + * @IEEE80211_REG_CONN_SP_VALID: Indicates whether the SP bit is valid. 2878 + * @IEEE80211_REG_CONN_SP_VALUE: Represents the value of the SP bit. 2879 + */ 2880 + enum ieee80211_reg_conn_bits { 2881 + IEEE80211_REG_CONN_LPI_VALID = BIT(0), 2882 + IEEE80211_REG_CONN_LPI_VALUE = BIT(1), 2883 + IEEE80211_REG_CONN_SP_VALID = BIT(2), 2884 + IEEE80211_REG_CONN_SP_VALUE = BIT(3), 2885 + }; 2869 2886 2870 2887 /* transmit power interpretation type of transmit power envelope element */ 2871 2888 enum ieee80211_tx_power_intrpt_type { ··· 3866 3847 WLAN_EID_EXT_FILS_PUBLIC_KEY = 12, 3867 3848 WLAN_EID_EXT_FILS_NONCE = 13, 3868 3849 WLAN_EID_EXT_FUTURE_CHAN_GUIDANCE = 14, 3850 + WLAN_EID_EXT_DH_PARAMETER = 32, 3869 3851 WLAN_EID_EXT_HE_CAPABILITY = 35, 3870 3852 WLAN_EID_EXT_HE_OPERATION = 36, 3871 3853 WLAN_EID_EXT_UORA = 37, ··· 3890 3870 WLAN_EID_EXT_EHT_CAPABILITY = 108, 3891 3871 WLAN_EID_EXT_TID_TO_LINK_MAPPING = 109, 3892 3872 WLAN_EID_EXT_BANDWIDTH_INDICATION = 135, 3873 + WLAN_EID_EXT_KNOWN_STA_IDENTIFCATION = 136, 3874 + WLAN_EID_EXT_NON_AP_STA_REG_CON = 137, 3893 3875 }; 3894 3876 3895 3877 /* Action category code */ ··· 5354 5332 5355 5333 return get_unaligned_le16(common); 5356 5334 } 5335 + 5336 + /* Defined in Figure 9-1074t in P802.11be_D7.0 */ 5337 + #define IEEE80211_EHT_ML_EXT_MLD_CAPA_OP_PARAM_UPDATE 0x0001 5338 + #define IEEE80211_EHT_ML_EXT_MLD_CAPA_OP_RECO_MAX_LINKS_MASK 0x001e 5339 + #define IEEE80211_EHT_ML_EXT_MLD_CAPA_NSTR_UPDATE 0x0020 5340 + #define IEEE80211_EHT_ML_EXT_MLD_CAPA_EMLSR_ENA_ON_ONE_LINK 0x0040 5341 + #define IEEE80211_EHT_ML_EXT_MLD_CAPA_BTM_MLD_RECO_MULTI_AP 0x0080 5357 5342 5358 5343 /** 5359 5344 * ieee80211_mle_get_ext_mld_capa_op - returns the extended MLD capabilities
+5 -7
include/net/cfg80211.h
··· 2748 2748 * @wiphy: the wiphy this was for 2749 2749 * @scan_start: time (in jiffies) when the scan started 2750 2750 * @wdev: the wireless device to scan for 2751 - * @info: (internal) information about completed scan 2752 - * @notified: (internal) scan request was notified as done or aborted 2753 2751 * @no_cck: used to send probe requests at non CCK rate in 2GHz band 2754 2752 * @mac_addr: MAC address used with randomisation 2755 2753 * @mac_addr_mask: MAC address mask used with randomisation, bits that 2756 2754 * are 0 in the mask should be randomised, bits that are 1 should 2757 2755 * be taken from the @mac_addr 2758 2756 * @scan_6ghz: relevant for split scan request only, 2759 - * true if this is the second scan request 2757 + * true if this is a 6 GHz scan request 2758 + * @first_part: %true if this is the first part of a split scan request or a 2759 + * scan that was not split. May be %true for a @scan_6ghz scan if no other 2760 + * channels were requested 2760 2761 * @n_6ghz_params: number of 6 GHz params 2761 2762 * @scan_6ghz_params: 6 GHz params 2762 2763 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID) ··· 2781 2780 u8 mac_addr[ETH_ALEN] __aligned(2); 2782 2781 u8 mac_addr_mask[ETH_ALEN] __aligned(2); 2783 2782 u8 bssid[ETH_ALEN] __aligned(2); 2784 - 2785 - /* internal */ 2786 2783 struct wiphy *wiphy; 2787 2784 unsigned long scan_start; 2788 - struct cfg80211_scan_info info; 2789 - bool notified; 2790 2785 bool no_cck; 2791 2786 bool scan_6ghz; 2787 + bool first_part; 2792 2788 u32 n_6ghz_params; 2793 2789 struct cfg80211_scan_6ghz_params *scan_6ghz_params; 2794 2790 s8 tsf_report_link_id;
+4 -3
include/net/mac80211.h
··· 2852 2852 * 2853 2853 * @IEEE80211_HW_DISALLOW_PUNCTURING: HW requires disabling puncturing in EHT 2854 2854 * and connecting with a lower bandwidth instead 2855 - * @IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ: HW requires disabling puncturing in 2856 - * EHT in 5 GHz and connecting with a lower bandwidth instead 2857 2855 * 2858 2856 * @IEEE80211_HW_HANDLES_QUIET_CSA: HW/driver handles quieting for CSA, so 2859 2857 * no need to stop queues. This really should be set by a driver that ··· 2921 2923 IEEE80211_HW_DETECTS_COLOR_COLLISION, 2922 2924 IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX, 2923 2925 IEEE80211_HW_DISALLOW_PUNCTURING, 2924 - IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ, 2925 2926 IEEE80211_HW_HANDLES_QUIET_CSA, 2926 2927 IEEE80211_HW_STRICT, 2927 2928 ··· 4310 4313 * @mgd_complete_tx: Notify the driver that the response frame for a previously 4311 4314 * transmitted frame announced with @mgd_prepare_tx was received, the data 4312 4315 * is filled similarly to @mgd_prepare_tx though the duration is not used. 4316 + * Note that this isn't always called for each mgd_prepare_tx() call, for 4317 + * example for SAE the 'confirm' messages can be on the air in any order. 4313 4318 * 4314 4319 * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending 4315 4320 * a TDLS discovery-request, we expect a reply to arrive on the AP's ··· 4476 4477 * new links bitmaps may be 0 if going from/to a non-MLO situation. 4477 4478 * The @old array contains pointers to the old bss_conf structures 4478 4479 * that were already removed, in case they're needed. 4480 + * Note that removal of link should always succeed, so the return value 4481 + * will be ignored in a removal only case. 4479 4482 * This callback can sleep. 4480 4483 * @change_sta_links: Change the valid links of a station, similar to 4481 4484 * @change_vif_links. This callback can sleep.
+1 -2
net/mac80211/debugfs.c
··· 4 4 * 5 5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 6 6 * Copyright 2013-2014 Intel Mobile Communications GmbH 7 - * Copyright (C) 2018 - 2019, 2021-2024 Intel Corporation 7 + * Copyright (C) 2018 - 2019, 2021-2025 Intel Corporation 8 8 */ 9 9 10 10 #include <linux/debugfs.h> ··· 490 490 FLAG(DETECTS_COLOR_COLLISION), 491 491 FLAG(MLO_MCAST_MULTI_LINK_TX), 492 492 FLAG(DISALLOW_PUNCTURING), 493 - FLAG(DISALLOW_PUNCTURING_5GHZ), 494 493 FLAG(HANDLES_QUIET_CSA), 495 494 FLAG(STRICT), 496 495 #undef FLAG
+2
net/mac80211/ieee80211_i.h
··· 2642 2642 struct ieee80211_sub_if_data *sdata, 2643 2643 const struct ieee80211_supported_band *sband, 2644 2644 const struct ieee80211_conn_settings *conn); 2645 + int ieee80211_put_reg_conn(struct sk_buff *skb, 2646 + enum ieee80211_channel_flags flags); 2645 2647 2646 2648 /* channel management */ 2647 2649 bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,
+8 -1
net/mac80211/link.c
··· 2 2 /* 3 3 * MLO link handling 4 4 * 5 - * Copyright (C) 2022-2024 Intel Corporation 5 + * Copyright (C) 2022-2025 Intel Corporation 6 6 */ 7 7 #include <linux/slab.h> 8 8 #include <linux/kernel.h> ··· 367 367 if (sdata->vif.type == NL80211_IFTYPE_AP) 368 368 ieee80211_update_apvlan_links(sdata); 369 369 } 370 + 371 + /* 372 + * Ignore errors if we are only removing links as removal should 373 + * always succeed 374 + */ 375 + if (!new_links) 376 + ret = 0; 370 377 371 378 if (ret) { 372 379 /* restore config */
+125 -23
net/mac80211/mlme.c
··· 776 776 ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING)) 777 777 return false; 778 778 779 - if (chandef->punctured && chandef->chan->band == NL80211_BAND_5GHZ && 780 - ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING_5GHZ)) 781 - return false; 782 - 783 779 return true; 784 780 } 785 781 ··· 1641 1645 return noffset; 1642 1646 } 1643 1647 1648 + static size_t ieee80211_add_before_reg_conn(struct sk_buff *skb, 1649 + const u8 *elems, size_t elems_len, 1650 + size_t offset) 1651 + { 1652 + static const u8 before_reg_conn[] = { 1653 + /* 1654 + * no need to list the ones split off before HE 1655 + * or generated here 1656 + */ 1657 + WLAN_EID_EXTENSION, WLAN_EID_EXT_DH_PARAMETER, 1658 + WLAN_EID_EXTENSION, WLAN_EID_EXT_KNOWN_STA_IDENTIFCATION, 1659 + }; 1660 + size_t noffset; 1661 + 1662 + if (!elems_len) 1663 + return offset; 1664 + 1665 + noffset = ieee80211_ie_split(elems, elems_len, before_reg_conn, 1666 + ARRAY_SIZE(before_reg_conn), offset); 1667 + skb_put_data(skb, elems + offset, noffset - offset); 1668 + 1669 + return noffset; 1670 + } 1671 + 1644 1672 #define PRESENT_ELEMS_MAX 8 1645 1673 #define PRESENT_ELEM_EXT_OFFS 0x100 1646 1674 ··· 1826 1806 } 1827 1807 1828 1808 /* 1809 + * if present, add any custom IEs that go before regulatory 1810 + * connectivity element 1811 + */ 1812 + offset = ieee80211_add_before_reg_conn(skb, extra_elems, 1813 + extra_elems_len, offset); 1814 + 1815 + if (sband->band == NL80211_BAND_6GHZ) { 1816 + /* 1817 + * as per Section E.2.7 of IEEE 802.11 REVme D7.0, non-AP STA 1818 + * capable of operating on the 6 GHz band shall transmit 1819 + * regulatory connectivity element. 1820 + */ 1821 + ieee80211_put_reg_conn(skb, chan->flags); 1822 + } 1823 + 1824 + /* 1829 1825 * careful - need to know about all the present elems before 1830 1826 * calling ieee80211_assoc_add_ml_elem(), so add this one if 1831 1827 * we're going to put it after the ML element ··· 1979 1943 } 1980 1944 skb_put_data(skb, &mld_capa_ops, sizeof(mld_capa_ops)); 1981 1945 1982 - /* Many APs have broken parsing of the extended MLD capa/ops field, 1983 - * dropping (re-)association request frames or replying with association 1984 - * response with a failure status if it's present. Without a clear 1985 - * indication as to whether the AP supports parsing this field or not do 1986 - * not include it in the common information unless strict mode is set. 1987 - */ 1988 - if (ieee80211_hw_check(&local->hw, STRICT) && 1989 - assoc_data->ext_mld_capa_ops) { 1946 + if (assoc_data->ext_mld_capa_ops) { 1990 1947 ml_elem->control |= 1991 1948 cpu_to_le16(IEEE80211_MLC_BASIC_PRES_EXT_MLD_CAPA_OP); 1992 1949 common->len += 2; ··· 2410 2381 * update cfg80211 directly. 2411 2382 */ 2412 2383 if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) { 2384 + struct link_sta_info *link_sta; 2385 + struct sta_info *ap_sta; 2386 + 2413 2387 link->conf->chanreq = link->csa.chanreq; 2414 2388 cfg80211_ch_switch_notify(sdata->dev, &link->csa.chanreq.oper, 2415 2389 link->link_id); 2390 + link->conf->csa_active = false; 2391 + 2392 + ap_sta = sta_info_get(sdata, sdata->vif.cfg.ap_addr); 2393 + if (WARN_ON(!ap_sta)) 2394 + return; 2395 + 2396 + link_sta = wiphy_dereference(wiphy, 2397 + ap_sta->link[link->link_id]); 2398 + if (WARN_ON(!link_sta)) 2399 + return; 2400 + 2401 + link_sta->pub->bandwidth = 2402 + _ieee80211_sta_cur_vht_bw(link_sta, 2403 + &link->csa.chanreq.oper); 2416 2404 return; 2417 2405 } 2418 2406 ··· 4780 4734 struct ieee80211_prep_tx_info info = { 4781 4735 .subtype = IEEE80211_STYPE_AUTH, 4782 4736 }; 4737 + bool sae_need_confirm = false; 4783 4738 4784 4739 lockdep_assert_wiphy(sdata->local->hw.wiphy); 4785 4740 ··· 4826 4779 jiffies + IEEE80211_AUTH_WAIT_SAE_RETRY; 4827 4780 ifmgd->auth_data->timeout_started = true; 4828 4781 run_again(sdata, ifmgd->auth_data->timeout); 4782 + if (auth_transaction == 1) 4783 + sae_need_confirm = true; 4829 4784 goto notify_driver; 4830 4785 } 4831 4786 ··· 4871 4822 if (!ieee80211_mark_sta_auth(sdata)) 4872 4823 return; /* ignore frame -- wait for timeout */ 4873 4824 } else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE && 4825 + auth_transaction == 1) { 4826 + sae_need_confirm = true; 4827 + } else if (ifmgd->auth_data->algorithm == WLAN_AUTH_SAE && 4874 4828 auth_transaction == 2) { 4875 4829 sdata_info(sdata, "SAE peer confirmed\n"); 4876 4830 ifmgd->auth_data->peer_confirmed = true; ··· 4881 4829 4882 4830 cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len); 4883 4831 notify_driver: 4884 - drv_mgd_complete_tx(sdata->local, sdata, &info); 4832 + if (!sae_need_confirm) 4833 + drv_mgd_complete_tx(sdata->local, sdata, &info); 4885 4834 } 4886 4835 4887 4836 #define case_WLAN(type) \ ··· 5978 5925 return IEEE80211_REG_LPI_AP; 5979 5926 case IEEE80211_6GHZ_CTRL_REG_SP_AP: 5980 5927 case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP: 5928 + case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP_OLD: 5981 5929 return IEEE80211_REG_SP_AP; 5982 5930 case IEEE80211_6GHZ_CTRL_REG_VLP_AP: 5983 5931 return IEEE80211_REG_VLP_AP; ··· 8752 8698 bool have_sta = false; 8753 8699 bool mlo; 8754 8700 int err; 8701 + u16 new_links; 8755 8702 8756 8703 if (link_id >= 0) { 8757 8704 mlo = true; 8758 8705 if (WARN_ON(!ap_mld_addr)) 8759 8706 return -EINVAL; 8760 - err = ieee80211_vif_set_links(sdata, BIT(link_id), 0); 8707 + new_links = BIT(link_id); 8761 8708 } else { 8762 8709 if (WARN_ON(ap_mld_addr)) 8763 8710 return -EINVAL; 8764 8711 ap_mld_addr = cbss->bssid; 8765 - err = ieee80211_vif_set_links(sdata, 0, 0); 8712 + new_links = 0; 8766 8713 link_id = 0; 8767 8714 mlo = false; 8768 8715 } 8769 8716 8717 + if (assoc) { 8718 + rcu_read_lock(); 8719 + have_sta = sta_info_get(sdata, ap_mld_addr); 8720 + rcu_read_unlock(); 8721 + } 8722 + 8723 + if (mlo && !have_sta && 8724 + WARN_ON(sdata->vif.valid_links || sdata->vif.active_links)) 8725 + return -EINVAL; 8726 + 8727 + err = ieee80211_vif_set_links(sdata, new_links, 0); 8770 8728 if (err) 8771 8729 return err; 8772 8730 ··· 8797 8731 if (local->in_reconfig) { 8798 8732 err = -EBUSY; 8799 8733 goto out_err; 8800 - } 8801 - 8802 - if (assoc) { 8803 - rcu_read_lock(); 8804 - have_sta = sta_info_get(sdata, ap_mld_addr); 8805 - rcu_read_unlock(); 8806 8734 } 8807 8735 8808 8736 if (!have_sta) { ··· 9398 9338 return err; 9399 9339 } 9400 9340 9341 + static bool 9342 + ieee80211_mgd_assoc_bss_has_mld_ext_capa_ops(struct cfg80211_assoc_request *req) 9343 + { 9344 + const struct cfg80211_bss_ies *ies; 9345 + struct cfg80211_bss *bss; 9346 + const struct element *ml; 9347 + 9348 + /* not an MLO connection if link_id < 0, so irrelevant */ 9349 + if (req->link_id < 0) 9350 + return false; 9351 + 9352 + bss = req->links[req->link_id].bss; 9353 + 9354 + guard(rcu)(); 9355 + ies = rcu_dereference(bss->ies); 9356 + for_each_element_extid(ml, WLAN_EID_EXT_EHT_MULTI_LINK, 9357 + ies->data, ies->len) { 9358 + const struct ieee80211_multi_link_elem *mle; 9359 + 9360 + if (!ieee80211_mle_type_ok(ml->data + 1, 9361 + IEEE80211_ML_CONTROL_TYPE_BASIC, 9362 + ml->datalen - 1)) 9363 + continue; 9364 + 9365 + mle = (void *)(ml->data + 1); 9366 + if (mle->control & cpu_to_le16(IEEE80211_MLC_BASIC_PRES_EXT_MLD_CAPA_OP)) 9367 + return true; 9368 + } 9369 + 9370 + return false; 9371 + 9372 + } 9373 + 9401 9374 int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, 9402 9375 struct cfg80211_assoc_request *req) 9403 9376 { ··· 9483 9390 else 9484 9391 memcpy(assoc_data->ap_addr, cbss->bssid, ETH_ALEN); 9485 9392 9486 - assoc_data->ext_mld_capa_ops = cpu_to_le16(req->ext_mld_capa_ops); 9393 + /* 9394 + * Many APs have broken parsing of the extended MLD capa/ops field, 9395 + * dropping (re-)association request frames or replying with association 9396 + * response with a failure status if it's present. 9397 + * Set our value from the userspace request only in strict mode or if 9398 + * the AP also had that field present. 9399 + */ 9400 + if (ieee80211_hw_check(&local->hw, STRICT) || 9401 + ieee80211_mgd_assoc_bss_has_mld_ext_capa_ops(req)) 9402 + assoc_data->ext_mld_capa_ops = 9403 + cpu_to_le16(req->ext_mld_capa_ops); 9487 9404 9488 9405 if (ifmgd->associated) { 9489 9406 u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; ··· 10136 10033 for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) { 10137 10034 if (!add_links_data->link[link_id].bss || 10138 10035 !(sdata->u.mgd.reconf.added_links & BIT(link_id))) 10139 - 10140 10036 continue; 10141 10037 10142 10038 valid_links |= BIT(link_id);
+9 -3
net/mac80211/rx.c
··· 4245 4245 rx->link_sta = NULL; 4246 4246 } 4247 4247 4248 - if (link_id < 0) 4249 - rx->link = &rx->sdata->deflink; 4250 - else if (!ieee80211_rx_data_set_link(rx, link_id)) 4248 + if (link_id < 0) { 4249 + if (ieee80211_vif_is_mld(&rx->sdata->vif) && 4250 + sta && !sta->sta.valid_links) 4251 + rx->link = 4252 + rcu_dereference(rx->sdata->link[sta->deflink.link_id]); 4253 + else 4254 + rx->link = &rx->sdata->deflink; 4255 + } else if (!ieee80211_rx_data_set_link(rx, link_id)) { 4251 4256 return false; 4257 + } 4252 4258 4253 4259 return true; 4254 4260 }
+2 -1
net/mac80211/scan.c
··· 9 9 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 10 10 * Copyright 2013-2015 Intel Mobile Communications GmbH 11 11 * Copyright 2016-2017 Intel Deutschland GmbH 12 - * Copyright (C) 2018-2024 Intel Corporation 12 + * Copyright (C) 2018-2025 Intel Corporation 13 13 */ 14 14 15 15 #include <linux/if_arp.h> ··· 800 800 local->hw_scan_req->req.scan_6ghz_params = 801 801 req->scan_6ghz_params; 802 802 local->hw_scan_req->req.scan_6ghz = req->scan_6ghz; 803 + local->hw_scan_req->req.first_part = req->first_part; 803 804 804 805 /* 805 806 * After allocating local->hw_scan_req, we must
+2 -1
net/mac80211/sta_info.c
··· 4 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 5 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 6 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH 7 - * Copyright (C) 2018-2024 Intel Corporation 7 + * Copyright (C) 2018-2025 Intel Corporation 8 8 */ 9 9 10 10 #include <linux/module.h> ··· 729 729 IEEE80211_RATE_MANDATORY_G; 730 730 break; 731 731 case NL80211_BAND_5GHZ: 732 + case NL80211_BAND_6GHZ: 732 733 mandatory = IEEE80211_RATE_MANDATORY_A; 733 734 break; 734 735 case NL80211_BAND_60GHZ:
+17
net/mac80211/util.c
··· 2556 2556 return 0; 2557 2557 } 2558 2558 2559 + int ieee80211_put_reg_conn(struct sk_buff *skb, 2560 + enum ieee80211_channel_flags flags) 2561 + { 2562 + u8 reg_conn = IEEE80211_REG_CONN_LPI_VALID | 2563 + IEEE80211_REG_CONN_LPI_VALUE | 2564 + IEEE80211_REG_CONN_SP_VALID; 2565 + 2566 + if (!(flags & IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT)) 2567 + reg_conn |= IEEE80211_REG_CONN_SP_VALUE; 2568 + 2569 + skb_put_u8(skb, WLAN_EID_EXTENSION); 2570 + skb_put_u8(skb, 1 + sizeof(reg_conn)); 2571 + skb_put_u8(skb, WLAN_EID_EXT_NON_AP_STA_REG_CON); 2572 + skb_put_u8(skb, reg_conn); 2573 + return 0; 2574 + } 2575 + 2559 2576 int ieee80211_put_he_6ghz_cap(struct sk_buff *skb, 2560 2577 struct ieee80211_sub_if_data *sdata, 2561 2578 enum ieee80211_smps_mode smps_mode)
+2 -2
net/wireless/core.c
··· 239 239 240 240 rdev->opencount--; 241 241 242 - if (rdev->scan_req && rdev->scan_req->wdev == wdev) { 242 + if (rdev->scan_req && rdev->scan_req->req.wdev == wdev) { 243 243 if (WARN_ON(!rdev->scan_req->notified && 244 244 (!rdev->int_scan_req || 245 245 !rdev->int_scan_req->notified))) ··· 1574 1574 case NETDEV_DOWN: 1575 1575 wiphy_lock(&rdev->wiphy); 1576 1576 cfg80211_update_iface_num(rdev, wdev->iftype, -1); 1577 - if (rdev->scan_req && rdev->scan_req->wdev == wdev) { 1577 + if (rdev->scan_req && rdev->scan_req->req.wdev == wdev) { 1578 1578 if (WARN_ON(!rdev->scan_req->notified && 1579 1579 (!rdev->int_scan_req || 1580 1580 !rdev->int_scan_req->notified)))
+9 -2
net/wireless/core.h
··· 21 21 22 22 #define WIPHY_IDX_INVALID -1 23 23 24 + struct cfg80211_scan_request_int { 25 + struct cfg80211_scan_info info; 26 + bool notified; 27 + /* must be last - variable members */ 28 + struct cfg80211_scan_request req; 29 + }; 30 + 24 31 struct cfg80211_registered_device { 25 32 const struct cfg80211_ops *ops; 26 33 struct list_head list; ··· 77 70 struct rb_root bss_tree; 78 71 u32 bss_generation; 79 72 u32 bss_entries; 80 - struct cfg80211_scan_request *scan_req; /* protected by RTNL */ 81 - struct cfg80211_scan_request *int_scan_req; 73 + struct cfg80211_scan_request_int *scan_req; /* protected by RTNL */ 74 + struct cfg80211_scan_request_int *int_scan_req; 82 75 struct sk_buff *scan_msg; 83 76 struct list_head sched_scan_req_list; 84 77 time64_t suspend_at;
+19 -2
net/wireless/mlme.c
··· 352 352 return -EINVAL; 353 353 } 354 354 355 - if (ieee80211_mle_get_ext_mld_capa_op((const u8 *)mle_a) != 356 - ieee80211_mle_get_ext_mld_capa_op((const u8 *)mle_b)) { 355 + /* 356 + * Only verify the values in Extended MLD Capabilities that are 357 + * not reserved when transmitted by an AP (and expected to remain the 358 + * same over time). 359 + * The Recommended Max Simultaneous Links subfield in particular is 360 + * reserved when included in a unicast Probe Response frame and may 361 + * also change when the AP adds/removes links. The BTM MLD 362 + * Recommendation For Multiple APs Support subfield is reserved when 363 + * transmitted by an AP. All other bits are currently reserved. 364 + * See IEEE P802.11be/D7.0, Table 9-417o. 365 + */ 366 + if ((ieee80211_mle_get_ext_mld_capa_op((const u8 *)mle_a) & 367 + (IEEE80211_EHT_ML_EXT_MLD_CAPA_OP_PARAM_UPDATE | 368 + IEEE80211_EHT_ML_EXT_MLD_CAPA_NSTR_UPDATE | 369 + IEEE80211_EHT_ML_EXT_MLD_CAPA_EMLSR_ENA_ON_ONE_LINK)) != 370 + (ieee80211_mle_get_ext_mld_capa_op((const u8 *)mle_b) & 371 + (IEEE80211_EHT_ML_EXT_MLD_CAPA_OP_PARAM_UPDATE | 372 + IEEE80211_EHT_ML_EXT_MLD_CAPA_NSTR_UPDATE | 373 + IEEE80211_EHT_ML_EXT_MLD_CAPA_EMLSR_ENA_ON_ONE_LINK))) { 357 374 NL_SET_ERR_MSG(extack, 358 375 "extended link MLD capabilities/ops mismatch"); 359 376 return -EINVAL;
+75 -69
net/wireless/nl80211.c
··· 9811 9811 9812 9812 static int 9813 9813 nl80211_check_scan_flags(struct wiphy *wiphy, struct wireless_dev *wdev, 9814 - void *request, struct nlattr **attrs, 9815 - bool is_sched_scan) 9814 + struct nlattr **attrs, u8 *mac_addr, u8 *mac_addr_mask, 9815 + u32 *flags, enum nl80211_feature_flags randomness_flag) 9816 9816 { 9817 - u8 *mac_addr, *mac_addr_mask; 9818 - u32 *flags; 9819 - enum nl80211_feature_flags randomness_flag; 9820 - 9821 9817 if (!attrs[NL80211_ATTR_SCAN_FLAGS]) 9822 9818 return 0; 9823 - 9824 - if (is_sched_scan) { 9825 - struct cfg80211_sched_scan_request *req = request; 9826 - 9827 - randomness_flag = wdev ? 9828 - NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR : 9829 - NL80211_FEATURE_ND_RANDOM_MAC_ADDR; 9830 - flags = &req->flags; 9831 - mac_addr = req->mac_addr; 9832 - mac_addr_mask = req->mac_addr_mask; 9833 - } else { 9834 - struct cfg80211_scan_request *req = request; 9835 - 9836 - randomness_flag = NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR; 9837 - flags = &req->flags; 9838 - mac_addr = req->mac_addr; 9839 - mac_addr_mask = req->mac_addr_mask; 9840 - } 9841 9819 9842 9820 *flags = nla_get_u32(attrs[NL80211_ATTR_SCAN_FLAGS]); 9843 9821 ··· 9865 9887 return 0; 9866 9888 } 9867 9889 9890 + static int 9891 + nl80211_check_scan_flags_sched(struct wiphy *wiphy, struct wireless_dev *wdev, 9892 + struct nlattr **attrs, 9893 + struct cfg80211_sched_scan_request *req) 9894 + { 9895 + return nl80211_check_scan_flags(wiphy, wdev, attrs, 9896 + req->mac_addr, req->mac_addr_mask, 9897 + &req->flags, 9898 + wdev ? NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR : 9899 + NL80211_FEATURE_ND_RANDOM_MAC_ADDR); 9900 + } 9901 + 9902 + static int 9903 + nl80211_check_scan_flags_reg(struct wiphy *wiphy, struct wireless_dev *wdev, 9904 + struct nlattr **attrs, 9905 + struct cfg80211_scan_request_int *req) 9906 + { 9907 + return nl80211_check_scan_flags(wiphy, wdev, attrs, 9908 + req->req.mac_addr, 9909 + req->req.mac_addr_mask, 9910 + &req->req.flags, 9911 + NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR); 9912 + } 9913 + 9868 9914 static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) 9869 9915 { 9870 9916 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 9871 9917 struct wireless_dev *wdev = info->user_ptr[1]; 9872 - struct cfg80211_scan_request *request; 9918 + struct cfg80211_scan_request_int *request; 9873 9919 struct nlattr *scan_freqs = NULL; 9874 9920 bool scan_freqs_khz = false; 9875 9921 struct nlattr *attr; ··· 9945 9943 if (ie_len > wiphy->max_scan_ie_len) 9946 9944 return -EINVAL; 9947 9945 9948 - size = struct_size(request, channels, n_channels); 9946 + size = struct_size(request, req.channels, n_channels); 9949 9947 ssids_offset = size; 9950 - size = size_add(size, array_size(sizeof(*request->ssids), n_ssids)); 9948 + size = size_add(size, array_size(sizeof(*request->req.ssids), n_ssids)); 9951 9949 ie_offset = size; 9952 9950 size = size_add(size, ie_len); 9953 9951 request = kzalloc(size, GFP_KERNEL); 9954 9952 if (!request) 9955 9953 return -ENOMEM; 9956 - request->n_channels = n_channels; 9954 + request->req.n_channels = n_channels; 9957 9955 9958 9956 if (n_ssids) 9959 - request->ssids = (void *)request + ssids_offset; 9960 - request->n_ssids = n_ssids; 9957 + request->req.ssids = (void *)request + ssids_offset; 9958 + request->req.n_ssids = n_ssids; 9961 9959 if (ie_len) 9962 - request->ie = (void *)request + ie_offset; 9960 + request->req.ie = (void *)request + ie_offset; 9963 9961 9964 9962 i = 0; 9965 9963 if (scan_freqs) { ··· 9982 9980 !cfg80211_wdev_channel_allowed(wdev, chan)) 9983 9981 continue; 9984 9982 9985 - request->channels[i] = chan; 9983 + request->req.channels[i] = chan; 9986 9984 i++; 9987 9985 } 9988 9986 } else { ··· 10003 10001 !cfg80211_wdev_channel_allowed(wdev, chan)) 10004 10002 continue; 10005 10003 10006 - request->channels[i] = chan; 10004 + request->req.channels[i] = chan; 10007 10005 i++; 10008 10006 } 10009 10007 } ··· 10014 10012 goto out_free; 10015 10013 } 10016 10014 10017 - request->n_channels = i; 10015 + request->req.n_channels = i; 10018 10016 10019 - for (i = 0; i < request->n_channels; i++) { 10020 - struct ieee80211_channel *chan = request->channels[i]; 10017 + for (i = 0; i < request->req.n_channels; i++) { 10018 + struct ieee80211_channel *chan = request->req.channels[i]; 10021 10019 10022 10020 /* if we can go off-channel to the target channel we're good */ 10023 10021 if (cfg80211_off_channel_oper_allowed(wdev, chan)) ··· 10036 10034 err = -EINVAL; 10037 10035 goto out_free; 10038 10036 } 10039 - request->ssids[i].ssid_len = nla_len(attr); 10040 - memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr)); 10037 + request->req.ssids[i].ssid_len = nla_len(attr); 10038 + memcpy(request->req.ssids[i].ssid, 10039 + nla_data(attr), nla_len(attr)); 10041 10040 i++; 10042 10041 } 10043 10042 } 10044 10043 10045 10044 if (info->attrs[NL80211_ATTR_IE]) { 10046 - request->ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); 10047 - memcpy((void *)request->ie, 10045 + request->req.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); 10046 + memcpy((void *)request->req.ie, 10048 10047 nla_data(info->attrs[NL80211_ATTR_IE]), 10049 - request->ie_len); 10048 + request->req.ie_len); 10050 10049 } 10051 10050 10052 10051 for (i = 0; i < NUM_NL80211_BANDS; i++) 10053 10052 if (wiphy->bands[i]) 10054 - request->rates[i] = 10053 + request->req.rates[i] = 10055 10054 (1 << wiphy->bands[i]->n_bitrates) - 1; 10056 10055 10057 10056 if (info->attrs[NL80211_ATTR_SCAN_SUPP_RATES]) { ··· 10072 10069 err = ieee80211_get_ratemask(wiphy->bands[band], 10073 10070 nla_data(attr), 10074 10071 nla_len(attr), 10075 - &request->rates[band]); 10072 + &request->req.rates[band]); 10076 10073 if (err) 10077 10074 goto out_free; 10078 10075 } 10079 10076 } 10080 10077 10081 10078 if (info->attrs[NL80211_ATTR_MEASUREMENT_DURATION]) { 10082 - request->duration = 10079 + request->req.duration = 10083 10080 nla_get_u16(info->attrs[NL80211_ATTR_MEASUREMENT_DURATION]); 10084 - request->duration_mandatory = 10081 + request->req.duration_mandatory = 10085 10082 nla_get_flag(info->attrs[NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY]); 10086 10083 } 10087 10084 10088 - err = nl80211_check_scan_flags(wiphy, wdev, request, info->attrs, 10089 - false); 10085 + err = nl80211_check_scan_flags_reg(wiphy, wdev, info->attrs, request); 10090 10086 if (err) 10091 10087 goto out_free; 10092 10088 10093 - request->no_cck = 10089 + request->req.no_cck = 10094 10090 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); 10095 10091 10096 10092 /* Initial implementation used NL80211_ATTR_MAC to set the specific ··· 10102 10100 * (NL80211_ATTR_SCAN_FLAGS is used to enable random MAC address use). 10103 10101 */ 10104 10102 if (info->attrs[NL80211_ATTR_BSSID]) 10105 - memcpy(request->bssid, 10103 + memcpy(request->req.bssid, 10106 10104 nla_data(info->attrs[NL80211_ATTR_BSSID]), ETH_ALEN); 10107 - else if (!(request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) && 10105 + else if (!(request->req.flags & NL80211_SCAN_FLAG_RANDOM_ADDR) && 10108 10106 info->attrs[NL80211_ATTR_MAC]) 10109 - memcpy(request->bssid, nla_data(info->attrs[NL80211_ATTR_MAC]), 10107 + memcpy(request->req.bssid, 10108 + nla_data(info->attrs[NL80211_ATTR_MAC]), 10110 10109 ETH_ALEN); 10111 10110 else 10112 - eth_broadcast_addr(request->bssid); 10111 + eth_broadcast_addr(request->req.bssid); 10113 10112 10114 - request->tsf_report_link_id = nl80211_link_id_or_invalid(info->attrs); 10115 - request->wdev = wdev; 10116 - request->wiphy = &rdev->wiphy; 10117 - request->scan_start = jiffies; 10113 + request->req.tsf_report_link_id = 10114 + nl80211_link_id_or_invalid(info->attrs); 10115 + request->req.wdev = wdev; 10116 + request->req.wiphy = &rdev->wiphy; 10117 + request->req.scan_start = jiffies; 10118 10118 10119 10119 rdev->scan_req = request; 10120 10120 err = cfg80211_scan(rdev); ··· 10538 10534 request->ie_len); 10539 10535 } 10540 10536 10541 - err = nl80211_check_scan_flags(wiphy, wdev, request, attrs, true); 10537 + err = nl80211_check_scan_flags_sched(wiphy, wdev, attrs, request); 10542 10538 if (err) 10543 10539 goto out_free; 10544 10540 ··· 18418 18414 static int nl80211_add_scan_req(struct sk_buff *msg, 18419 18415 struct cfg80211_registered_device *rdev) 18420 18416 { 18421 - struct cfg80211_scan_request *req = rdev->scan_req; 18417 + struct cfg80211_scan_request_int *req = rdev->scan_req; 18422 18418 struct nlattr *nest; 18423 18419 int i; 18424 18420 struct cfg80211_scan_info *info; ··· 18429 18425 nest = nla_nest_start_noflag(msg, NL80211_ATTR_SCAN_SSIDS); 18430 18426 if (!nest) 18431 18427 goto nla_put_failure; 18432 - for (i = 0; i < req->n_ssids; i++) { 18433 - if (nla_put(msg, i, req->ssids[i].ssid_len, req->ssids[i].ssid)) 18428 + for (i = 0; i < req->req.n_ssids; i++) { 18429 + if (nla_put(msg, i, req->req.ssids[i].ssid_len, 18430 + req->req.ssids[i].ssid)) 18434 18431 goto nla_put_failure; 18435 18432 } 18436 18433 nla_nest_end(msg, nest); 18437 18434 18438 - if (req->flags & NL80211_SCAN_FLAG_FREQ_KHZ) { 18435 + if (req->req.flags & NL80211_SCAN_FLAG_FREQ_KHZ) { 18439 18436 nest = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQ_KHZ); 18440 18437 if (!nest) 18441 18438 goto nla_put_failure; 18442 - for (i = 0; i < req->n_channels; i++) { 18439 + for (i = 0; i < req->req.n_channels; i++) { 18443 18440 if (nla_put_u32(msg, i, 18444 - ieee80211_channel_to_khz(req->channels[i]))) 18441 + ieee80211_channel_to_khz(req->req.channels[i]))) 18445 18442 goto nla_put_failure; 18446 18443 } 18447 18444 nla_nest_end(msg, nest); ··· 18451 18446 NL80211_ATTR_SCAN_FREQUENCIES); 18452 18447 if (!nest) 18453 18448 goto nla_put_failure; 18454 - for (i = 0; i < req->n_channels; i++) { 18455 - if (nla_put_u32(msg, i, req->channels[i]->center_freq)) 18449 + for (i = 0; i < req->req.n_channels; i++) { 18450 + if (nla_put_u32(msg, i, 18451 + req->req.channels[i]->center_freq)) 18456 18452 goto nla_put_failure; 18457 18453 } 18458 18454 nla_nest_end(msg, nest); 18459 18455 } 18460 18456 18461 - if (req->ie && 18462 - nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie)) 18457 + if (req->req.ie && 18458 + nla_put(msg, NL80211_ATTR_IE, req->req.ie_len, req->req.ie)) 18463 18459 goto nla_put_failure; 18464 18460 18465 - if (req->flags && 18466 - nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags)) 18461 + if (req->req.flags && 18462 + nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->req.flags)) 18467 18463 goto nla_put_failure; 18468 18464 18469 18465 info = rdev->int_scan_req ? &rdev->int_scan_req->info :
+3 -3
net/wireless/rdev-ops.h
··· 456 456 } 457 457 458 458 static inline int rdev_scan(struct cfg80211_registered_device *rdev, 459 - struct cfg80211_scan_request *request) 459 + struct cfg80211_scan_request_int *request) 460 460 { 461 461 int ret; 462 462 463 - if (WARN_ON_ONCE(!request->n_ssids && request->ssids)) 463 + if (WARN_ON_ONCE(!request->req.n_ssids && request->req.ssids)) 464 464 return -EINVAL; 465 465 466 466 trace_rdev_scan(&rdev->wiphy, request); 467 - ret = rdev->ops->scan(&rdev->wiphy, request); 467 + ret = rdev->ops->scan(&rdev->wiphy, &request->req); 468 468 trace_rdev_return_int(&rdev->wiphy, ret); 469 469 return ret; 470 470 }
+14 -14
net/wireless/reg.c
··· 53 53 #include <linux/list.h> 54 54 #include <linux/ctype.h> 55 55 #include <linux/nl80211.h> 56 - #include <linux/platform_device.h> 56 + #include <linux/device/faux.h> 57 57 #include <linux/verification.h> 58 58 #include <linux/moduleparam.h> 59 59 #include <linux/firmware.h> ··· 105 105 (void __force __rcu *)&core_request_world; 106 106 107 107 /* To trigger userspace events and load firmware */ 108 - static struct platform_device *reg_pdev; 108 + static struct faux_device *reg_fdev; 109 109 110 110 /* 111 111 * Central wireless core regulatory domains, we only need two, ··· 583 583 else 584 584 pr_debug("Calling CRDA to update world regulatory domain\n"); 585 585 586 - ret = kobject_uevent_env(&reg_pdev->dev.kobj, KOBJ_CHANGE, env); 586 + ret = kobject_uevent_env(&reg_fdev->dev.kobj, KOBJ_CHANGE, env); 587 587 if (ret) 588 588 return ret; 589 589 ··· 779 779 const struct firmware *sig; 780 780 bool result; 781 781 782 - if (request_firmware(&sig, "regulatory.db.p7s", &reg_pdev->dev)) 782 + if (request_firmware(&sig, "regulatory.db.p7s", &reg_fdev->dev)) 783 783 return false; 784 784 785 785 result = verify_pkcs7_signature(data, size, sig->data, sig->size, ··· 1061 1061 return -ENOMEM; 1062 1062 1063 1063 err = request_firmware_nowait(THIS_MODULE, true, "regulatory.db", 1064 - &reg_pdev->dev, GFP_KERNEL, 1064 + &reg_fdev->dev, GFP_KERNEL, 1065 1065 (void *)alpha2, regdb_fw_cb); 1066 1066 if (err) 1067 1067 kfree(alpha2); ··· 1077 1077 const struct ieee80211_regdomain *current_regdomain; 1078 1078 struct regulatory_request *request; 1079 1079 1080 - err = request_firmware(&fw, "regulatory.db", &reg_pdev->dev); 1080 + err = request_firmware(&fw, "regulatory.db", &reg_fdev->dev); 1081 1081 if (err) 1082 1082 return err; 1083 1083 ··· 4300 4300 * in that case, don't try to do any further work here as 4301 4301 * it's doomed to lead to crashes. 4302 4302 */ 4303 - if (IS_ERR_OR_NULL(reg_pdev)) 4303 + if (!reg_fdev) 4304 4304 return -EINVAL; 4305 4305 4306 4306 err = load_builtin_regdb_keys(); 4307 4307 if (err) { 4308 - platform_device_unregister(reg_pdev); 4308 + faux_device_destroy(reg_fdev); 4309 4309 return err; 4310 4310 } 4311 4311 ··· 4313 4313 err = regulatory_hint_core(cfg80211_world_regdom->alpha2); 4314 4314 if (err) { 4315 4315 if (err == -ENOMEM) { 4316 - platform_device_unregister(reg_pdev); 4316 + faux_device_destroy(reg_fdev); 4317 4317 return err; 4318 4318 } 4319 4319 /* ··· 4342 4342 4343 4343 int __init regulatory_init(void) 4344 4344 { 4345 - reg_pdev = platform_device_register_simple("regulatory", 0, NULL, 0); 4346 - if (IS_ERR(reg_pdev)) 4347 - return PTR_ERR(reg_pdev); 4345 + reg_fdev = faux_device_create("regulatory", NULL, NULL); 4346 + if (!reg_fdev) 4347 + return -ENODEV; 4348 4348 4349 4349 rcu_assign_pointer(cfg80211_regdomain, cfg80211_world_regdom); 4350 4350 ··· 4372 4372 reset_regdomains(true, NULL); 4373 4373 rtnl_unlock(); 4374 4374 4375 - dev_set_uevent_suppress(&reg_pdev->dev, true); 4375 + dev_set_uevent_suppress(&reg_fdev->dev, true); 4376 4376 4377 - platform_device_unregister(reg_pdev); 4377 + faux_device_destroy(reg_fdev); 4378 4378 4379 4379 list_for_each_entry_safe(reg_beacon, btmp, &reg_pending_beacons, list) { 4380 4380 list_del(&reg_beacon->list);
+110 -94
net/wireless/scan.c
··· 782 782 } 783 783 EXPORT_SYMBOL_IF_CFG80211_KUNIT(cfg80211_parse_colocated_ap); 784 784 785 - static void cfg80211_scan_req_add_chan(struct cfg80211_scan_request *request, 786 - struct ieee80211_channel *chan, 787 - bool add_to_6ghz) 785 + static void cfg80211_scan_req_add_chan(struct cfg80211_scan_request *request, 786 + struct ieee80211_channel *chan, 787 + bool add_to_6ghz) 788 788 { 789 789 int i; 790 790 u32 n_channels = request->n_channels; ··· 838 838 return false; 839 839 } 840 840 841 - static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev) 841 + static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev, 842 + bool first_part) 842 843 { 843 844 u8 i; 844 845 struct cfg80211_colocated_ap *ap; 845 846 int n_channels, count = 0, err; 846 - struct cfg80211_scan_request *request, *rdev_req = rdev->scan_req; 847 + struct cfg80211_scan_request_int *request, *rdev_req = rdev->scan_req; 847 848 LIST_HEAD(coloc_ap_list); 848 849 bool need_scan_psc = true; 849 850 const struct ieee80211_sband_iftype_data *iftd; 850 851 size_t size, offs_ssids, offs_6ghz_params, offs_ies; 851 852 852 - rdev_req->scan_6ghz = true; 853 + rdev_req->req.scan_6ghz = true; 854 + rdev_req->req.first_part = first_part; 853 855 854 856 if (!rdev->wiphy.bands[NL80211_BAND_6GHZ]) 855 857 return -EOPNOTSUPP; 856 858 857 859 iftd = ieee80211_get_sband_iftype_data(rdev->wiphy.bands[NL80211_BAND_6GHZ], 858 - rdev_req->wdev->iftype); 860 + rdev_req->req.wdev->iftype); 859 861 if (!iftd || !iftd->he_cap.has_he) 860 862 return -EOPNOTSUPP; 861 863 862 864 n_channels = rdev->wiphy.bands[NL80211_BAND_6GHZ]->n_channels; 863 865 864 - if (rdev_req->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ) { 866 + if (rdev_req->req.flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ) { 865 867 struct cfg80211_internal_bss *intbss; 866 868 867 869 spin_lock_bh(&rdev->bss_lock); ··· 885 883 * This is relevant for ML probe requests when the lower 886 884 * band APs have not been discovered. 887 885 */ 888 - if (is_broadcast_ether_addr(rdev_req->bssid) || 889 - !ether_addr_equal(rdev_req->bssid, res->bssid) || 886 + if (is_broadcast_ether_addr(rdev_req->req.bssid) || 887 + !ether_addr_equal(rdev_req->req.bssid, res->bssid) || 890 888 res->channel->band != NL80211_BAND_6GHZ) 891 889 continue; 892 890 ··· 913 911 spin_unlock_bh(&rdev->bss_lock); 914 912 } 915 913 916 - size = struct_size(request, channels, n_channels); 914 + size = struct_size(request, req.channels, n_channels); 917 915 offs_ssids = size; 918 - size += sizeof(*request->ssids) * rdev_req->n_ssids; 916 + size += sizeof(*request->req.ssids) * rdev_req->req.n_ssids; 919 917 offs_6ghz_params = size; 920 - size += sizeof(*request->scan_6ghz_params) * count; 918 + size += sizeof(*request->req.scan_6ghz_params) * count; 921 919 offs_ies = size; 922 - size += rdev_req->ie_len; 920 + size += rdev_req->req.ie_len; 923 921 924 922 request = kzalloc(size, GFP_KERNEL); 925 923 if (!request) { ··· 928 926 } 929 927 930 928 *request = *rdev_req; 931 - request->n_channels = 0; 932 - request->n_6ghz_params = 0; 933 - if (rdev_req->n_ssids) { 929 + request->req.n_channels = 0; 930 + request->req.n_6ghz_params = 0; 931 + if (rdev_req->req.n_ssids) { 934 932 /* 935 933 * Add the ssids from the parent scan request to the new 936 934 * scan request, so the driver would be able to use them 937 935 * in its probe requests to discover hidden APs on PSC 938 936 * channels. 939 937 */ 940 - request->ssids = (void *)request + offs_ssids; 941 - memcpy(request->ssids, rdev_req->ssids, 942 - sizeof(*request->ssids) * request->n_ssids); 938 + request->req.ssids = (void *)request + offs_ssids; 939 + memcpy(request->req.ssids, rdev_req->req.ssids, 940 + sizeof(*request->req.ssids) * request->req.n_ssids); 943 941 } 944 - request->scan_6ghz_params = (void *)request + offs_6ghz_params; 942 + request->req.scan_6ghz_params = (void *)request + offs_6ghz_params; 945 943 946 - if (rdev_req->ie_len) { 944 + if (rdev_req->req.ie_len) { 947 945 void *ie = (void *)request + offs_ies; 948 946 949 - memcpy(ie, rdev_req->ie, rdev_req->ie_len); 950 - request->ie = ie; 947 + memcpy(ie, rdev_req->req.ie, rdev_req->req.ie_len); 948 + request->req.ie = ie; 951 949 } 952 950 953 951 /* ··· 955 953 * and at least one of the reported co-located APs with same SSID 956 954 * indicating that all APs in the same ESS are co-located 957 955 */ 958 - if (count && request->n_ssids == 1 && request->ssids[0].ssid_len) { 956 + if (count && 957 + request->req.n_ssids == 1 && 958 + request->req.ssids[0].ssid_len) { 959 959 list_for_each_entry(ap, &coloc_ap_list, list) { 960 960 if (ap->colocated_ess && 961 - cfg80211_find_ssid_match(ap, request)) { 961 + cfg80211_find_ssid_match(ap, &request->req)) { 962 962 need_scan_psc = false; 963 963 break; 964 964 } ··· 972 968 * regardless of the collocated APs (PSC channels or all channels 973 969 * in case that NL80211_SCAN_FLAG_COLOCATED_6GHZ is not set) 974 970 */ 975 - for (i = 0; i < rdev_req->n_channels; i++) { 976 - if (rdev_req->channels[i]->band == NL80211_BAND_6GHZ && 971 + for (i = 0; i < rdev_req->req.n_channels; i++) { 972 + if (rdev_req->req.channels[i]->band == NL80211_BAND_6GHZ && 977 973 ((need_scan_psc && 978 - cfg80211_channel_is_psc(rdev_req->channels[i])) || 979 - !(rdev_req->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ))) { 980 - cfg80211_scan_req_add_chan(request, 981 - rdev_req->channels[i], 974 + cfg80211_channel_is_psc(rdev_req->req.channels[i])) || 975 + !(rdev_req->req.flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ))) { 976 + cfg80211_scan_req_add_chan(&request->req, 977 + rdev_req->req.channels[i], 982 978 false); 983 979 } 984 980 } 985 981 986 - if (!(rdev_req->flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ)) 982 + if (!(rdev_req->req.flags & NL80211_SCAN_FLAG_COLOCATED_6GHZ)) 987 983 goto skip; 988 984 989 985 list_for_each_entry(ap, &coloc_ap_list, list) { 990 986 bool found = false; 991 987 struct cfg80211_scan_6ghz_params *scan_6ghz_params = 992 - &request->scan_6ghz_params[request->n_6ghz_params]; 988 + &request->req.scan_6ghz_params[request->req.n_6ghz_params]; 993 989 struct ieee80211_channel *chan = 994 990 ieee80211_get_channel(&rdev->wiphy, ap->center_freq); 995 991 996 992 if (!chan || chan->flags & IEEE80211_CHAN_DISABLED || 997 - !cfg80211_wdev_channel_allowed(rdev_req->wdev, chan)) 993 + !cfg80211_wdev_channel_allowed(rdev_req->req.wdev, chan)) 998 994 continue; 999 995 1000 - for (i = 0; i < rdev_req->n_channels; i++) { 1001 - if (rdev_req->channels[i] == chan) 996 + for (i = 0; i < rdev_req->req.n_channels; i++) { 997 + if (rdev_req->req.channels[i] == chan) 1002 998 found = true; 1003 999 } 1004 1000 1005 1001 if (!found) 1006 1002 continue; 1007 1003 1008 - if (request->n_ssids > 0 && 1009 - !cfg80211_find_ssid_match(ap, request)) 1004 + if (request->req.n_ssids > 0 && 1005 + !cfg80211_find_ssid_match(ap, &request->req)) 1010 1006 continue; 1011 1007 1012 - if (!is_broadcast_ether_addr(request->bssid) && 1013 - !ether_addr_equal(request->bssid, ap->bssid)) 1008 + if (!is_broadcast_ether_addr(request->req.bssid) && 1009 + !ether_addr_equal(request->req.bssid, ap->bssid)) 1014 1010 continue; 1015 1011 1016 - if (!request->n_ssids && ap->multi_bss && !ap->transmitted_bssid) 1012 + if (!request->req.n_ssids && ap->multi_bss && 1013 + !ap->transmitted_bssid) 1017 1014 continue; 1018 1015 1019 - cfg80211_scan_req_add_chan(request, chan, true); 1016 + cfg80211_scan_req_add_chan(&request->req, chan, true); 1020 1017 memcpy(scan_6ghz_params->bssid, ap->bssid, ETH_ALEN); 1021 1018 scan_6ghz_params->short_ssid = ap->short_ssid; 1022 1019 scan_6ghz_params->short_ssid_valid = ap->short_ssid_valid; ··· 1033 1028 if (cfg80211_channel_is_psc(chan) && !need_scan_psc) 1034 1029 scan_6ghz_params->psc_no_listen = true; 1035 1030 1036 - request->n_6ghz_params++; 1031 + request->req.n_6ghz_params++; 1037 1032 } 1038 1033 1039 1034 skip: 1040 1035 cfg80211_free_coloc_ap_list(&coloc_ap_list); 1041 1036 1042 - if (request->n_channels) { 1043 - struct cfg80211_scan_request *old = rdev->int_scan_req; 1037 + if (request->req.n_channels) { 1038 + struct cfg80211_scan_request_int *old = rdev->int_scan_req; 1044 1039 1045 1040 rdev->int_scan_req = request; 1046 1041 ··· 1048 1043 * If this scan follows a previous scan, save the scan start 1049 1044 * info from the first part of the scan 1050 1045 */ 1051 - if (old) 1046 + if (!first_part && !WARN_ON(!old)) 1052 1047 rdev->int_scan_req->info = old->info; 1053 1048 1054 1049 err = rdev_scan(rdev, request); ··· 1068 1063 1069 1064 int cfg80211_scan(struct cfg80211_registered_device *rdev) 1070 1065 { 1071 - struct cfg80211_scan_request *request; 1072 - struct cfg80211_scan_request *rdev_req = rdev->scan_req; 1066 + struct cfg80211_scan_request_int *request; 1067 + struct cfg80211_scan_request_int *rdev_req = rdev->scan_req; 1073 1068 u32 n_channels = 0, idx, i; 1074 1069 1075 - if (!(rdev->wiphy.flags & WIPHY_FLAG_SPLIT_SCAN_6GHZ)) 1070 + if (!(rdev->wiphy.flags & WIPHY_FLAG_SPLIT_SCAN_6GHZ)) { 1071 + rdev_req->req.first_part = true; 1076 1072 return rdev_scan(rdev, rdev_req); 1073 + } 1077 1074 1078 - for (i = 0; i < rdev_req->n_channels; i++) { 1079 - if (rdev_req->channels[i]->band != NL80211_BAND_6GHZ) 1075 + for (i = 0; i < rdev_req->req.n_channels; i++) { 1076 + if (rdev_req->req.channels[i]->band != NL80211_BAND_6GHZ) 1080 1077 n_channels++; 1081 1078 } 1082 1079 1083 1080 if (!n_channels) 1084 - return cfg80211_scan_6ghz(rdev); 1081 + return cfg80211_scan_6ghz(rdev, true); 1085 1082 1086 - request = kzalloc(struct_size(request, channels, n_channels), 1083 + request = kzalloc(struct_size(request, req.channels, n_channels), 1087 1084 GFP_KERNEL); 1088 1085 if (!request) 1089 1086 return -ENOMEM; 1090 1087 1091 1088 *request = *rdev_req; 1092 - request->n_channels = n_channels; 1089 + request->req.n_channels = n_channels; 1093 1090 1094 - for (i = idx = 0; i < rdev_req->n_channels; i++) { 1095 - if (rdev_req->channels[i]->band != NL80211_BAND_6GHZ) 1096 - request->channels[idx++] = rdev_req->channels[i]; 1091 + for (i = idx = 0; i < rdev_req->req.n_channels; i++) { 1092 + if (rdev_req->req.channels[i]->band != NL80211_BAND_6GHZ) 1093 + request->req.channels[idx++] = 1094 + rdev_req->req.channels[i]; 1097 1095 } 1098 1096 1099 - rdev_req->scan_6ghz = false; 1097 + rdev_req->req.scan_6ghz = false; 1098 + rdev_req->req.first_part = true; 1100 1099 rdev->int_scan_req = request; 1101 1100 return rdev_scan(rdev, request); 1102 1101 } ··· 1108 1099 void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, 1109 1100 bool send_message) 1110 1101 { 1111 - struct cfg80211_scan_request *request, *rdev_req; 1102 + struct cfg80211_scan_request_int *request, *rdev_req; 1112 1103 struct wireless_dev *wdev; 1113 1104 struct sk_buff *msg; 1114 1105 #ifdef CONFIG_CFG80211_WEXT ··· 1127 1118 if (!rdev_req) 1128 1119 return; 1129 1120 1130 - wdev = rdev_req->wdev; 1121 + wdev = rdev_req->req.wdev; 1131 1122 request = rdev->int_scan_req ? rdev->int_scan_req : rdev_req; 1132 1123 1133 1124 if (wdev_running(wdev) && 1134 1125 (rdev->wiphy.flags & WIPHY_FLAG_SPLIT_SCAN_6GHZ) && 1135 - !rdev_req->scan_6ghz && !request->info.aborted && 1136 - !cfg80211_scan_6ghz(rdev)) 1126 + !rdev_req->req.scan_6ghz && !request->info.aborted && 1127 + !cfg80211_scan_6ghz(rdev, false)) 1137 1128 return; 1138 1129 1139 1130 /* ··· 1145 1136 cfg80211_sme_scan_done(wdev->netdev); 1146 1137 1147 1138 if (!request->info.aborted && 1148 - request->flags & NL80211_SCAN_FLAG_FLUSH) { 1139 + request->req.flags & NL80211_SCAN_FLAG_FLUSH) { 1149 1140 /* flush entries from previous scans */ 1150 1141 spin_lock_bh(&rdev->bss_lock); 1151 - __cfg80211_bss_expire(rdev, request->scan_start); 1142 + __cfg80211_bss_expire(rdev, request->req.scan_start); 1152 1143 spin_unlock_bh(&rdev->bss_lock); 1153 1144 } 1154 1145 ··· 1184 1175 void cfg80211_scan_done(struct cfg80211_scan_request *request, 1185 1176 struct cfg80211_scan_info *info) 1186 1177 { 1187 - struct cfg80211_scan_info old_info = request->info; 1178 + struct cfg80211_scan_request_int *intreq = 1179 + container_of(request, struct cfg80211_scan_request_int, req); 1180 + struct cfg80211_registered_device *rdev = wiphy_to_rdev(request->wiphy); 1181 + struct cfg80211_scan_info old_info = intreq->info; 1188 1182 1189 - trace_cfg80211_scan_done(request, info); 1190 - WARN_ON(request != wiphy_to_rdev(request->wiphy)->scan_req && 1191 - request != wiphy_to_rdev(request->wiphy)->int_scan_req); 1183 + trace_cfg80211_scan_done(intreq, info); 1184 + WARN_ON(intreq != rdev->scan_req && 1185 + intreq != rdev->int_scan_req); 1192 1186 1193 - request->info = *info; 1187 + intreq->info = *info; 1194 1188 1195 1189 /* 1196 1190 * In case the scan is split, the scan_start_tsf and tsf_bssid should ··· 1201 1189 * be non zero. 1202 1190 */ 1203 1191 if (request->scan_6ghz && old_info.scan_start_tsf) { 1204 - request->info.scan_start_tsf = old_info.scan_start_tsf; 1205 - memcpy(request->info.tsf_bssid, old_info.tsf_bssid, 1206 - sizeof(request->info.tsf_bssid)); 1192 + intreq->info.scan_start_tsf = old_info.scan_start_tsf; 1193 + memcpy(intreq->info.tsf_bssid, old_info.tsf_bssid, 1194 + sizeof(intreq->info.tsf_bssid)); 1207 1195 } 1208 1196 1209 - request->notified = true; 1210 - wiphy_work_queue(request->wiphy, 1211 - &wiphy_to_rdev(request->wiphy)->scan_done_wk); 1197 + intreq->notified = true; 1198 + wiphy_work_queue(request->wiphy, &rdev->scan_done_wk); 1212 1199 } 1213 1200 EXPORT_SYMBOL(cfg80211_scan_done); 1214 1201 ··· 2231 2220 return IEEE80211_REG_LPI_AP; 2232 2221 case IEEE80211_6GHZ_CTRL_REG_SP_AP: 2233 2222 case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP: 2223 + case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP_OLD: 2234 2224 return IEEE80211_REG_SP_AP; 2235 2225 case IEEE80211_6GHZ_CTRL_REG_VLP_AP: 2236 2226 return IEEE80211_REG_VLP_AP; ··· 3508 3496 struct cfg80211_registered_device *rdev; 3509 3497 struct wiphy *wiphy; 3510 3498 struct iw_scan_req *wreq = NULL; 3511 - struct cfg80211_scan_request *creq; 3499 + struct cfg80211_scan_request_int *creq; 3512 3500 int i, err, n_channels = 0; 3513 3501 enum nl80211_band band; 3514 3502 ··· 3538 3526 n_channels = ieee80211_get_num_supported_channels(wiphy); 3539 3527 } 3540 3528 3541 - creq = kzalloc(struct_size(creq, channels, n_channels) + 3529 + creq = kzalloc(struct_size(creq, req.channels, n_channels) + 3542 3530 sizeof(struct cfg80211_ssid), 3543 3531 GFP_ATOMIC); 3544 3532 if (!creq) 3545 3533 return -ENOMEM; 3546 3534 3547 - creq->wiphy = wiphy; 3548 - creq->wdev = dev->ieee80211_ptr; 3535 + creq->req.wiphy = wiphy; 3536 + creq->req.wdev = dev->ieee80211_ptr; 3549 3537 /* SSIDs come after channels */ 3550 - creq->ssids = (void *)creq + struct_size(creq, channels, n_channels); 3551 - creq->n_channels = n_channels; 3552 - creq->n_ssids = 1; 3553 - creq->scan_start = jiffies; 3538 + creq->req.ssids = (void *)creq + 3539 + struct_size(creq, req.channels, n_channels); 3540 + creq->req.n_channels = n_channels; 3541 + creq->req.n_ssids = 1; 3542 + creq->req.scan_start = jiffies; 3554 3543 3555 3544 /* translate "Scan on frequencies" request */ 3556 3545 i = 0; ··· 3567 3554 /* ignore disabled channels */ 3568 3555 chan = &wiphy->bands[band]->channels[j]; 3569 3556 if (chan->flags & IEEE80211_CHAN_DISABLED || 3570 - !cfg80211_wdev_channel_allowed(creq->wdev, chan)) 3557 + !cfg80211_wdev_channel_allowed(creq->req.wdev, chan)) 3571 3558 continue; 3572 3559 3573 3560 /* If we have a wireless request structure and the ··· 3590 3577 } 3591 3578 3592 3579 wext_freq_found: 3593 - creq->channels[i] = &wiphy->bands[band]->channels[j]; 3580 + creq->req.channels[i] = 3581 + &wiphy->bands[band]->channels[j]; 3594 3582 i++; 3595 3583 wext_freq_not_found: ; 3596 3584 } ··· 3602 3588 goto out; 3603 3589 } 3604 3590 3605 - /* Set real number of channels specified in creq->channels[] */ 3606 - creq->n_channels = i; 3591 + /* Set real number of channels specified in creq->req.channels[] */ 3592 + creq->req.n_channels = i; 3607 3593 3608 3594 /* translate "Scan for SSID" request */ 3609 3595 if (wreq) { 3610 3596 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { 3611 3597 if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) 3612 3598 return -EINVAL; 3613 - memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len); 3614 - creq->ssids[0].ssid_len = wreq->essid_len; 3599 + memcpy(creq->req.ssids[0].ssid, wreq->essid, 3600 + wreq->essid_len); 3601 + creq->req.ssids[0].ssid_len = wreq->essid_len; 3615 3602 } 3616 3603 if (wreq->scan_type == IW_SCAN_TYPE_PASSIVE) { 3617 - creq->ssids = NULL; 3618 - creq->n_ssids = 0; 3604 + creq->req.ssids = NULL; 3605 + creq->req.n_ssids = 0; 3619 3606 } 3620 3607 } 3621 3608 3622 3609 for (i = 0; i < NUM_NL80211_BANDS; i++) 3623 3610 if (wiphy->bands[i]) 3624 - creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; 3611 + creq->req.rates[i] = 3612 + (1 << wiphy->bands[i]->n_bitrates) - 1; 3625 3613 3626 - eth_broadcast_addr(creq->bssid); 3614 + eth_broadcast_addr(creq->req.bssid); 3627 3615 3628 3616 scoped_guard(wiphy, &rdev->wiphy) { 3629 3617 rdev->scan_req = creq;
+20 -20
net/wireless/sme.c
··· 5 5 * (for nl80211's connect() and wext) 6 6 * 7 7 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> 8 - * Copyright (C) 2009, 2020, 2022-2024 Intel Corporation. All rights reserved. 8 + * Copyright (C) 2009, 2020, 2022-2025 Intel Corporation. All rights reserved. 9 9 * Copyright 2017 Intel Deutschland GmbH 10 10 */ 11 11 ··· 64 64 static int cfg80211_conn_scan(struct wireless_dev *wdev) 65 65 { 66 66 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); 67 - struct cfg80211_scan_request *request; 67 + struct cfg80211_scan_request_int *request; 68 68 int n_channels, err; 69 69 70 70 lockdep_assert_wiphy(wdev->wiphy); ··· 77 77 else 78 78 n_channels = ieee80211_get_num_supported_channels(wdev->wiphy); 79 79 80 - request = kzalloc(sizeof(*request) + sizeof(request->ssids[0]) + 81 - sizeof(request->channels[0]) * n_channels, 80 + request = kzalloc(sizeof(*request) + sizeof(request->req.ssids[0]) + 81 + sizeof(request->req.channels[0]) * n_channels, 82 82 GFP_KERNEL); 83 83 if (!request) 84 84 return -ENOMEM; 85 85 86 - request->n_channels = n_channels; 86 + request->req.n_channels = n_channels; 87 87 if (wdev->conn->params.channel) { 88 88 enum nl80211_band band = wdev->conn->params.channel->band; 89 89 struct ieee80211_supported_band *sband = ··· 93 93 kfree(request); 94 94 return -EINVAL; 95 95 } 96 - request->channels[0] = wdev->conn->params.channel; 97 - request->rates[band] = (1 << sband->n_bitrates) - 1; 96 + request->req.channels[0] = wdev->conn->params.channel; 97 + request->req.rates[band] = (1 << sband->n_bitrates) - 1; 98 98 } else { 99 99 int i = 0, j; 100 100 enum nl80211_band band; ··· 109 109 channel = &bands->channels[j]; 110 110 if (channel->flags & IEEE80211_CHAN_DISABLED) 111 111 continue; 112 - request->channels[i++] = channel; 112 + request->req.channels[i++] = channel; 113 113 } 114 - request->rates[band] = (1 << bands->n_bitrates) - 1; 114 + request->req.rates[band] = (1 << bands->n_bitrates) - 1; 115 115 } 116 116 n_channels = i; 117 117 } 118 - request->n_channels = n_channels; 119 - request->ssids = (void *)request + 120 - struct_size(request, channels, n_channels); 121 - request->n_ssids = 1; 118 + request->req.n_channels = n_channels; 119 + request->req.ssids = (void *)request + 120 + struct_size(request, req.channels, n_channels); 121 + request->req.n_ssids = 1; 122 122 123 - memcpy(request->ssids[0].ssid, wdev->conn->params.ssid, 124 - wdev->conn->params.ssid_len); 125 - request->ssids[0].ssid_len = wdev->conn->params.ssid_len; 123 + memcpy(request->req.ssids[0].ssid, wdev->conn->params.ssid, 124 + wdev->conn->params.ssid_len); 125 + request->req.ssids[0].ssid_len = wdev->conn->params.ssid_len; 126 126 127 - eth_broadcast_addr(request->bssid); 127 + eth_broadcast_addr(request->req.bssid); 128 128 129 - request->wdev = wdev; 130 - request->wiphy = &rdev->wiphy; 131 - request->scan_start = jiffies; 129 + request->req.wdev = wdev; 130 + request->req.wiphy = &rdev->wiphy; 131 + request->req.scan_start = jiffies; 132 132 133 133 rdev->scan_req = request; 134 134
+12 -11
net/wireless/trace.h
··· 373 373 ); 374 374 375 375 TRACE_EVENT(rdev_scan, 376 - TP_PROTO(struct wiphy *wiphy, struct cfg80211_scan_request *request), 376 + TP_PROTO(struct wiphy *wiphy, 377 + struct cfg80211_scan_request_int *request), 377 378 TP_ARGS(wiphy, request), 378 379 TP_STRUCT__entry( 379 380 WIPHY_ENTRY ··· 3717 3716 ); 3718 3717 3719 3718 TRACE_EVENT(cfg80211_scan_done, 3720 - TP_PROTO(struct cfg80211_scan_request *request, 3719 + TP_PROTO(struct cfg80211_scan_request_int *request, 3721 3720 struct cfg80211_scan_info *info), 3722 3721 TP_ARGS(request, info), 3723 3722 TP_STRUCT__entry( 3724 3723 __field(u32, n_channels) 3725 - __dynamic_array(u8, ie, request ? request->ie_len : 0) 3724 + __dynamic_array(u8, ie, request ? request->req.ie_len : 0) 3726 3725 __array(u32, rates, NUM_NL80211_BANDS) 3727 3726 __field(u32, wdev_id) 3728 3727 MAC_ENTRY(wiphy_mac) ··· 3733 3732 ), 3734 3733 TP_fast_assign( 3735 3734 if (request) { 3736 - memcpy(__get_dynamic_array(ie), request->ie, 3737 - request->ie_len); 3738 - memcpy(__entry->rates, request->rates, 3735 + memcpy(__get_dynamic_array(ie), request->req.ie, 3736 + request->req.ie_len); 3737 + memcpy(__entry->rates, request->req.rates, 3739 3738 NUM_NL80211_BANDS); 3740 - __entry->wdev_id = request->wdev ? 3741 - request->wdev->identifier : 0; 3742 - if (request->wiphy) 3739 + __entry->wdev_id = request->req.wdev ? 3740 + request->req.wdev->identifier : 0; 3741 + if (request->req.wiphy) 3743 3742 MAC_ASSIGN(wiphy_mac, 3744 - request->wiphy->perm_addr); 3745 - __entry->no_cck = request->no_cck; 3743 + request->req.wiphy->perm_addr); 3744 + __entry->no_cck = request->req.no_cck; 3746 3745 } 3747 3746 if (info) { 3748 3747 __entry->aborted = info->aborted;