History

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

Johannes Berg says: ==================== Plenty of things going on, notably: - iwlwifi: major cleanups/rework - brcmfmac: gets AP isolation support - mac80211: gets more S1G support * tag 'wireless-next-2025-09-11' of https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (94 commits) wifi: mwifiex: fix endianness handling in mwifiex_send_rgpower_table wifi: cfg80211: Remove the redundant wiphy_dev wifi: mac80211: fix incorrect comment wifi: cfg80211: update the time stamps in hidden ssid wifi: mac80211: Fix HE capabilities element check wifi: mac80211: add tx_handlers_drop statistics to ethtool wifi: mac80211: fix reporting of all valid links in sta_set_sinfo() wifi: iwlwifi: mld: CHANNEL_SURVEY_NOTIF is always supported wifi: iwlwifi: mld: remove support of iwl_esr_mode_notif version 1 wifi: iwlwifi: mld: remove support from of sta cmd version 1 wifi: iwlwifi: mld: remove support of roc cmd version 5 wifi: iwlwifi: mld: remove support of mac cmd ver 2 wifi: iwlwifi: mld: don't consider phy cmd version 5 wifi: iwlwifi: implement wowlan status notification API update wifi: iwlwifi: fw: Add ASUS to PPAG and TAS list wifi: iwlwifi: add kunit tests for nvm parse wifi: iwlwifi: api: add a flag to iwl_link_ctx_modify_flags wifi: iwlwifi: pcie: move ltr_enabled to the specific transport wifi: iwlwifi: pcie: move pm_support to the specific transport wifi: iwlwifi: rename iwl_finish_nic_init ... ====================

Jakub Kicinski committed 1 year ago

Commit d103f262 parents fc3a281 1b2e9fe123 files · +2915 −3863Browse files

Unified · Split

123 files
  1. drivers/net/wireless/ath/carl9170/rx.c +1 −1
  2. drivers/net/wireless/ath/wil6210/cfg80211.c +1 −0
  3. drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +1 −1
  4. drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +23 −0
  5. drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +2 −2
  6. drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +9 −5
  7. drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +4 −4
  8. drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +0 −1
  9. drivers/net/wireless/intel/iwlegacy/iwl-spectrum.h +0 −24
  10. drivers/net/wireless/intel/iwlwifi/cfg/bz.c +9 −9
  11. drivers/net/wireless/intel/iwlwifi/cfg/dr.c +5 −8
  12. drivers/net/wireless/intel/iwlwifi/cfg/rf-gf.c +17 −5
  13. drivers/net/wireless/intel/iwlwifi/cfg/rf-hr.c +1 −1
  14. drivers/net/wireless/intel/iwlwifi/cfg/sc.c +9 −9
  15. drivers/net/wireless/intel/iwlwifi/dvm/eeprom.c +1 −1
  16. drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c +2 −8
  17. drivers/net/wireless/intel/iwlwifi/dvm/power.c +1 −1
  18. drivers/net/wireless/intel/iwlwifi/fw/acpi.c +3 −3
  19. drivers/net/wireless/intel/iwlwifi/fw/acpi.h +0 −2
  20. drivers/net/wireless/intel/iwlwifi/fw/api/d3.h +106 −7
  21. drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h +3 −0
  22. drivers/net/wireless/intel/iwlwifi/fw/api/offload.h +1 −1
  23. drivers/net/wireless/intel/iwlwifi/fw/api/power.h +11 −23
  24. drivers/net/wireless/intel/iwlwifi/fw/api/rs.h +35 −0
  25. drivers/net/wireless/intel/iwlwifi/fw/dbg.c +4 −39
  26. drivers/net/wireless/intel/iwlwifi/fw/dump.c +1 −53
  27. drivers/net/wireless/intel/iwlwifi/fw/error-dump.h +2 −1
  28. drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +67 −14
  29. drivers/net/wireless/intel/iwlwifi/fw/regulatory.c +28 −25
  30. drivers/net/wireless/intel/iwlwifi/fw/regulatory.h +0 −1
  31. drivers/net/wireless/intel/iwlwifi/fw/runtime.h +0 −2
  32. drivers/net/wireless/intel/iwlwifi/fw/uefi.c +2 −5
  33. drivers/net/wireless/intel/iwlwifi/iwl-config.h +36 −4
  34. drivers/net/wireless/intel/iwlwifi/iwl-drv.c +36 −11
  35. drivers/net/wireless/intel/iwlwifi/iwl-io.c +5 −90
  36. drivers/net/wireless/intel/iwlwifi/iwl-io.h +1 −1
  37. drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +5 −75
  38. drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h +74 −0
  39. drivers/net/wireless/intel/iwlwifi/iwl-trans.c +34 −37
  40. drivers/net/wireless/intel/iwlwifi/iwl-trans.h +27 −54
  41. drivers/net/wireless/intel/iwlwifi/mei/sap.h +0 −2
  42. drivers/net/wireless/intel/iwlwifi/mld/d3.c +354 −199
  43. drivers/net/wireless/intel/iwlwifi/mld/debugfs.c +6 −2
  44. drivers/net/wireless/intel/iwlwifi/mld/iface.c +11 −28
  45. drivers/net/wireless/intel/iwlwifi/mld/iface.h +1 −4
  46. drivers/net/wireless/intel/iwlwifi/mld/key.c +38 −0
  47. drivers/net/wireless/intel/iwlwifi/mld/key.h +7 −0
  48. drivers/net/wireless/intel/iwlwifi/mld/link.c +18 −8
  49. drivers/net/wireless/intel/iwlwifi/mld/link.h +2 −0
  50. drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +6 −13
  51. drivers/net/wireless/intel/iwlwifi/mld/mld.c +4 −0
  52. drivers/net/wireless/intel/iwlwifi/mld/mlo.c +8 −26
  53. drivers/net/wireless/intel/iwlwifi/mld/notif.c +0 −1
  54. drivers/net/wireless/intel/iwlwifi/mld/regulatory.c +21 −7
  55. drivers/net/wireless/intel/iwlwifi/mld/roc.c +2 −8
  56. drivers/net/wireless/intel/iwlwifi/mld/rx.c +18 −8
  57. drivers/net/wireless/intel/iwlwifi/mld/scan.c +1 −3
  58. drivers/net/wireless/intel/iwlwifi/mld/sta.c +3 −5
  59. drivers/net/wireless/intel/iwlwifi/mld/stats.c +7 −4
  60. drivers/net/wireless/intel/iwlwifi/mld/tlc.c +56 −19
  61. drivers/net/wireless/intel/iwlwifi/mvm/coex.c +0 −131
  62. drivers/net/wireless/intel/iwlwifi/mvm/constants.h +1 −19
  63. drivers/net/wireless/intel/iwlwifi/mvm/d3.c +45 −339
  64. drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +0 −94
  65. drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +1 −2
  66. drivers/net/wireless/intel/iwlwifi/mvm/fw.c +1 −1
  67. drivers/net/wireless/intel/iwlwifi/mvm/link.c +0 −809
  68. drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +0 −38
  69. drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +6 −118
  70. drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +1 −137
  71. drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c +0 −2
  72. drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +5 −131
  73. drivers/net/wireless/intel/iwlwifi/mvm/ops.c +0 −53
  74. drivers/net/wireless/intel/iwlwifi/mvm/rx.c +0 −133
  75. drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +10 −13
  76. drivers/net/wireless/intel/iwlwifi/mvm/scan.c +0 −101
  77. drivers/net/wireless/intel/iwlwifi/mvm/sta.c +0 −89
  78. drivers/net/wireless/intel/iwlwifi/mvm/sta.h +0 −24
  79. drivers/net/wireless/intel/iwlwifi/mvm/tests/Makefile +1 −1
  80. drivers/net/wireless/intel/iwlwifi/mvm/tests/links.c +0 −433
  81. drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +0 −3
  82. drivers/net/wireless/intel/iwlwifi/mvm/tx.c +1 −7
  83. drivers/net/wireless/intel/iwlwifi/mvm/utils.c +0 −10
  84. drivers/net/wireless/intel/iwlwifi/pcie/drv.c +2 −7
  85. drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/internal.h +49 −4
  86. drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans-gen2.c +1 −1
  87. drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c +161 −76
  88. drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx.c +3 −2
  89. drivers/net/wireless/intel/iwlwifi/tests/Makefile +1 −1
  90. drivers/net/wireless/intel/iwlwifi/tests/nvm_parse.c +72 −0
  91. drivers/net/wireless/intersil/p54/txrx.c +1 −1
  92. drivers/net/wireless/marvell/mwifiex/cfg80211.c +3 −4
  93. drivers/net/wireless/marvell/mwifiex/main.c +5 −0
  94. drivers/net/wireless/marvell/mwifiex/main.h +3 −0
  95. drivers/net/wireless/marvell/mwifiex/sta_cmd.c +113 −0
  96. drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +57 −1
  97. drivers/net/wireless/microchip/wilc1000/cfg80211.c +0 −7
  98. drivers/net/wireless/ralink/rt2x00/rt2x00dev.c +1 −1
  99. drivers/net/wireless/realtek/rtlwifi/ps.c +1 −1
  100. drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +0 −8
  101. include/linux/ieee80211.h +256 −9
  102. include/linux/mmc/sdio_ids.h +1 −1
  103. include/net/cfg80211.h +33 −1
  104. include/uapi/linux/nl80211.h +48 −3
  105. net/mac80211/cfg.c +25 −19
  106. net/mac80211/chan.c +0 −11
  107. net/mac80211/ethtool.c +4 −2
  108. net/mac80211/ieee80211_i.h +9 −0
  109. net/mac80211/main.c +8 −3
  110. net/mac80211/mesh.c +3 −0
  111. net/mac80211/mesh_ps.c +1 −1
  112. net/mac80211/mlme.c +21 −17
  113. net/mac80211/sta_info.c +9 −4
  114. net/mac80211/tests/Makefile +1 −1
  115. net/mac80211/tests/s1g_tim.c +356 −0
  116. net/mac80211/tx.c +133 −40
  117. net/mac80211/util.c +9 −11
  118. net/wireless/core.c +9 −0
  119. net/wireless/ethtool.c +1 −1
  120. net/wireless/nl80211.c +305 −13
  121. net/wireless/scan.c +7 −2
  122. net/wireless/trace.h +0 −56
  123. net/wireless/util.c +1 −1
drivers/net/wireless/ath/carl9170/rx.c+1−1
@@ -555,7 +555,7 @@ static void carl9170_ps_beacon(struct ar9170 *ar, void *data, unsigned int len) · 554 unmodified lines
555555 /* Check whenever the PHY can be turned off again. */
556556
557557 /* 1. What about buffered unicast traffic for our AID? */
558− cam = ieee80211_check_tim(tim_ie, tim_len, ar->common.curaid);
558+ cam = ieee80211_check_tim(tim_ie, tim_len, ar->common.curaid, false);
559559
560560 /* 2. Maybe the AP wants to send multicast/broadcast data? */
561561 cam |= !!(tim_ie->bitmap_ctrl & 0x01);
drivers/net/wireless/ath/wil6210/cfg80211.c+1−0
@@ -2708,6 +2708,7 @@ static void wil_wiphy_init(struct wiphy *wiphy) · 2707 unmodified lines
27082708 wiphy->n_cipher_suites = ARRAY_SIZE(wil_cipher_suites);
27092709 wiphy->mgmt_stypes = wil_mgmt_stypes;
27102710 wiphy->features |= NL80211_FEATURE_SK_TX_STATUS;
2711+ wiphy->bss_param_support = WIPHY_BSS_PARAM_AP_ISOLATE;
27112712
27122713 wiphy->n_vendor_commands = ARRAY_SIZE(wil_nl80211_vendor_commands);
27132714 wiphy->vendor_commands = wil_nl80211_vendor_commands;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c+1−1
@@ -997,9 +997,9 @@ static const struct sdio_device_id brcmf_sdmmc_ids[] = { · 996 unmodified lines
997997 BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356, WCC),
998998 BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4359, WCC),
999999 BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43751, WCC),
1000+ BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43752, WCC),
10001001 BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373, CYW),
10011002 BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43012, CYW),
1002− BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752, CYW),
10031003 BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_89359, CYW),
10041004 CYW_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_CYPRESS_43439, CYW),
10051005 { /* end: all zeroes */ }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c+23−0
@@ -5958,6 +5958,26 @@ static int brcmf_cfg80211_del_pmk(struct wiphy *wiphy, struct net_device *dev, · 5957 unmodified lines
59585958 return brcmf_set_pmk(ifp, NULL, 0);
59595959 }
59605960
5961+static int brcmf_cfg80211_change_bss(struct wiphy *wiphy, struct net_device *dev,
5962+ struct bss_parameters *params)
5963+{
5964+ struct brcmf_if *ifp = netdev_priv(dev);
5965+ int ret = 0;
5966+
5967+ /* In AP mode, the "ap_isolate" value represents
5968+ * 0 = allow low-level bridging of frames between associated stations
5969+ * 1 = restrict low-level bridging of frames to isolate associated stations
5970+ * -1 = do not change existing setting
5971+ */
5972+ if (params->ap_isolate >= 0) {
5973+ ret = brcmf_fil_iovar_int_set(ifp, "ap_isolate", params->ap_isolate);
5974+ if (ret < 0)
5975+ brcmf_err("ap_isolate iovar failed: ret=%d\n", ret);
5976+ }
5977+
5978+ return ret;
5979+}
5980+
59615981 static struct cfg80211_ops brcmf_cfg80211_ops = {
59625982 .add_virtual_intf = brcmf_cfg80211_add_iface,
59635983 .del_virtual_intf = brcmf_cfg80211_del_iface,
@@ -6005,6 +6025,7 @@ static struct cfg80211_ops brcmf_cfg80211_ops = { · 41 unmodified lines
60056025 .update_connect_params = brcmf_cfg80211_update_conn_params,
60066026 .set_pmk = brcmf_cfg80211_set_pmk,
60076027 .del_pmk = brcmf_cfg80211_del_pmk,
6028+ .change_bss = brcmf_cfg80211_change_bss,
60086029 };
60096030
60106031 struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings)
@@ -7659,6 +7680,8 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp) · 1648 unmodified lines
76597680 BIT(NL80211_BSS_SELECT_ATTR_BAND_PREF) |
76607681 BIT(NL80211_BSS_SELECT_ATTR_RSSI_ADJUST);
76617682
7683+ wiphy->bss_param_support = WIPHY_BSS_PARAM_AP_ISOLATE;
7684+
76627685 wiphy->flags |= WIPHY_FLAG_NETNS_OK |
76637686 WIPHY_FLAG_PS_ON_BY_DEFAULT |
76647687 WIPHY_FLAG_HAVE_AP_SME |
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c+2−2
@@ -738,8 +738,8 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci) · 737 unmodified lines
738738 case BRCM_CC_4364_CHIP_ID:
739739 case CY_CC_4373_CHIP_ID:
740740 return 0x160000;
741− case CY_CC_43752_CHIP_ID:
742741 case BRCM_CC_43751_CHIP_ID:
742+ case BRCM_CC_43752_CHIP_ID:
743743 case BRCM_CC_4377_CHIP_ID:
744744 return 0x170000;
745745 case BRCM_CC_4378_CHIP_ID:
@@ -1452,7 +1452,7 @@ bool brcmf_chip_sr_capable(struct brcmf_chip *pub) · 706 unmodified lines
14521452 return (reg & CC_SR_CTL0_ENABLE_MASK) != 0;
14531453 case BRCM_CC_4359_CHIP_ID:
14541454 case BRCM_CC_43751_CHIP_ID:
1455− case CY_CC_43752_CHIP_ID:
1455+ case BRCM_CC_43752_CHIP_ID:
14561456 case CY_CC_43012_CHIP_ID:
14571457 addr = CORE_CC_REG(pmu->base, retention_ctl);
14581458 reg = chip->ops->read32(chip->ctx, addr);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c+9−5
@@ -554,12 +554,16 @@ static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) · 553 unmodified lines
554554 data = (u8 *)fw->data;
555555 data_len = fw->size;
556556 } else {
557− if ((data = bcm47xx_nvram_get_contents(&data_len)))
557+ data = bcm47xx_nvram_get_contents(&data_len);
558+ if (data) {
558559 free_bcm47xx_nvram = true;
559− else if ((data = brcmf_fw_nvram_from_efi(&data_len)))
560− kfree_nvram = true;
561− else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL))
562− goto fail;
560+ } else {
561+ data = brcmf_fw_nvram_from_efi(&data_len);
562+ if (data)
563+ kfree_nvram = true;
564+ else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL))
565+ goto fail;
566+ }
563567 }
564568
565569 if (data)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c+4−4
@@ -655,10 +655,10 @@ static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { · 654 unmodified lines
655655 BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356),
656656 BRCMF_FW_ENTRY(BRCM_CC_4359_CHIP_ID, 0xFFFFFFFF, 4359),
657657 BRCMF_FW_ENTRY(BRCM_CC_43751_CHIP_ID, 0xFFFFFFFF, 43752),
658+ BRCMF_FW_ENTRY(BRCM_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752),
658659 BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373),
659660 BRCMF_FW_ENTRY(CY_CC_43012_CHIP_ID, 0xFFFFFFFF, 43012),
660661 BRCMF_FW_ENTRY(CY_CC_43439_CHIP_ID, 0xFFFFFFFF, 43439),
661− BRCMF_FW_ENTRY(CY_CC_43752_CHIP_ID, 0xFFFFFFFF, 43752)
662662 };
663663
664664 #define TXCTL_CREDITS 2
@@ -3426,8 +3426,8 @@ err: · 2761 unmodified lines
34263426 static bool brcmf_sdio_aos_no_decode(struct brcmf_sdio *bus)
34273427 {
34283428 if (bus->ci->chip == BRCM_CC_43751_CHIP_ID ||
3429− bus->ci->chip == CY_CC_43012_CHIP_ID ||
3430− bus->ci->chip == CY_CC_43752_CHIP_ID)
3429+ bus->ci->chip == BRCM_CC_43752_CHIP_ID ||
3430+ bus->ci->chip == CY_CC_43012_CHIP_ID)
34313431 return true;
34323432 else
34333433 return false;
@@ -4278,8 +4278,8 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err, · 844 unmodified lines
42784278
42794279 switch (sdiod->func1->device) {
42804280 case SDIO_DEVICE_ID_BROADCOM_43751:
4281+ case SDIO_DEVICE_ID_BROADCOM_43752:
42814282 case SDIO_DEVICE_ID_BROADCOM_CYPRESS_4373:
4282− case SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752:
42834283 brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n",
42844284 CY_4373_F2_WATERMARK);
42854285 brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK,
drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h+0−1
@@ -60,7 +60,6 @@ · 59 unmodified lines
6060 #define CY_CC_4373_CHIP_ID 0x4373
6161 #define CY_CC_43012_CHIP_ID 43012
6262 #define CY_CC_43439_CHIP_ID 43439
63−#define CY_CC_43752_CHIP_ID 43752
6463
6564 /* USB Device IDs */
6665 #define BRCM_USB_43143_DEVICE_ID 0xbd1e
drivers/net/wireless/intel/iwlegacy/iwl-spectrum.h+0−24
@@ -50,28 +50,4 @@ struct ieee80211_measurement_params { · 49 unmodified lines
5050 __le16 duration;
5151 } __packed;
5252
53−struct ieee80211_info_element {
54− u8 id;
55− u8 len;
56− u8 data[];
57−} __packed;
58−
59−struct ieee80211_measurement_request {
60− struct ieee80211_info_element ie;
61− u8 token;
62− u8 mode;
63− u8 type;
64− struct ieee80211_measurement_params params[];
65−} __packed;
66−
67−struct ieee80211_measurement_report {
68− struct ieee80211_info_element ie;
69− u8 token;
70− u8 mode;
71− u8 type;
72− union {
73− struct ieee80211_basic_report basic[0];
74− } u;
75−} __packed;
76−
7753 #endif
drivers/net/wireless/intel/iwlwifi/cfg/bz.c+9−9
@@ -9,11 +9,11 @@ · 8 unmodified lines
99 #include "iwl-prph.h"
1010 #include "fw/api/txq.h"
1111
12−/* Highest firmware API version supported */
13−#define IWL_BZ_UCODE_API_MAX 102
12+/* Highest firmware core release supported */
13+#define IWL_BZ_UCODE_CORE_MAX 99
1414
1515 /* Lowest firmware API version supported */
16−#define IWL_BZ_UCODE_API_MIN 98
16+#define IWL_BZ_UCODE_API_MIN 100
1717
1818 /* Memory offsets and lengths */
1919 #define IWL_BZ_SMEM_OFFSET 0x400000
@@ -75,7 +75,7 @@ static const struct iwl_family_base_params iwl_bz_base = { · 55 unmodified lines
7575 },
7676 },
7777 .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,
78− .ucode_api_max = IWL_BZ_UCODE_API_MAX,
78+ .ucode_api_max = ENCODE_CORE_AS_API(IWL_BZ_UCODE_CORE_MAX),
7979 .ucode_api_min = IWL_BZ_UCODE_API_MIN,
8080 };
8181
@@ -101,8 +101,8 @@ const struct iwl_mac_cfg iwl_gl_mac_cfg = { · 19 unmodified lines
101101 .low_latency_xtal = true,
102102 };
103103
104−IWL_FW_AND_PNVM(IWL_BZ_A_FM_B_FW_PRE, IWL_BZ_UCODE_API_MAX);
105−IWL_FW_AND_PNVM(IWL_BZ_A_FM_C_FW_PRE, IWL_BZ_UCODE_API_MAX);
106−IWL_FW_AND_PNVM(IWL_BZ_A_FM4_B_FW_PRE, IWL_BZ_UCODE_API_MAX);
107−IWL_FW_AND_PNVM(IWL_GL_B_FM_B_FW_PRE, IWL_BZ_UCODE_API_MAX);
108−IWL_FW_AND_PNVM(IWL_GL_C_FM_C_FW_PRE, IWL_BZ_UCODE_API_MAX);
104+IWL_CORE_FW(IWL_BZ_A_FM_B_FW_PRE, IWL_BZ_UCODE_CORE_MAX);
105+IWL_CORE_FW(IWL_BZ_A_FM_C_FW_PRE, IWL_BZ_UCODE_CORE_MAX);
106+IWL_CORE_FW(IWL_BZ_A_FM4_B_FW_PRE, IWL_BZ_UCODE_CORE_MAX);
107+IWL_CORE_FW(IWL_GL_B_FM_B_FW_PRE, IWL_BZ_UCODE_CORE_MAX);
108+IWL_CORE_FW(IWL_GL_C_FM_C_FW_PRE, IWL_BZ_UCODE_CORE_MAX);
drivers/net/wireless/intel/iwlwifi/cfg/dr.c+5−8
@@ -8,11 +8,11 @@ · 7 unmodified lines
88 #include "iwl-prph.h"
99 #include "fw/api/txq.h"
1010
11−/* Highest firmware API version supported */
12−#define IWL_DR_UCODE_API_MAX 102
11+/* Highest firmware core release supported */
12+#define IWL_DR_UCODE_CORE_MAX 99
1313
1414 /* Lowest firmware API version supported */
15−#define IWL_DR_UCODE_API_MIN 98
15+#define IWL_DR_UCODE_API_MIN 100
1616
1717 /* Memory offsets and lengths */
1818 #define IWL_DR_SMEM_OFFSET 0x400000
@@ -20,9 +20,6 @@ · 1 unmodified line
2020
2121 #define IWL_DR_A_PE_A_FW_PRE "iwlwifi-dr-a0-pe-a0"
2222
23−#define IWL_DR_A_PE_A_FW_MODULE_FIRMWARE(api) \
24− IWL_DR_A_PE_A_FW_PRE "-" __stringify(api) ".ucode"
25−
2623 static const struct iwl_family_base_params iwl_dr_base = {
2724 .num_of_queues = 512,
2825 .max_tfd_queue_size = 65536,
@@ -73,7 +70,7 @@ static const struct iwl_family_base_params iwl_dr_base = { · 44 unmodified lines
7370 },
7471 },
7572 .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,
76− .ucode_api_max = IWL_DR_UCODE_API_MAX,
73+ .ucode_api_max = ENCODE_CORE_AS_API(IWL_DR_UCODE_CORE_MAX),
7774 .ucode_api_min = IWL_DR_UCODE_API_MIN,
7875 };
7976
@@ -89,5 +86,5 @@ const struct iwl_mac_cfg iwl_dr_mac_cfg = { · 9 unmodified lines
8986 .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US,
9087 };
9188
92−MODULE_FIRMWARE(IWL_DR_A_PE_A_FW_MODULE_FIRMWARE(IWL_DR_UCODE_API_MAX));
89+IWL_CORE_FW(IWL_DR_A_PE_A_FW_PRE, IWL_DR_UCODE_CORE_MAX);
9390
drivers/net/wireless/intel/iwlwifi/cfg/rf-gf.c+17−5
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 #define IWL_GF_UCODE_API_MAX 100
1010
1111 /* Lowest firmware API version supported */
12−#define IWL_GF_UCODE_API_MIN 98
12+#define IWL_GF_UCODE_API_MIN 100
1313
1414 #define IWL_SO_A_GF_A_FW_PRE "iwlwifi-so-a0-gf-a0"
1515 #define IWL_TY_A_GF_A_FW_PRE "iwlwifi-ty-a0-gf-a0"
@@ -23,6 +23,18 @@ · 7 unmodified lines
2323 #define IWL_SC_A_GF_A_FW_PRE "iwlwifi-sc-a0-gf-a0"
2424 #define IWL_SC_A_GF4_A_FW_PRE "iwlwifi-sc-a0-gf4-a0"
2525
26+#define IWL_BZ_A_GF_A_MODULE_FIRMWARE(api) \
27+ IWL_BZ_A_GF_A_FW_PRE "-" __stringify(api) ".ucode"
28+
29+#define IWL_BZ_A_GF4_A_MODULE_FIRMWARE(api) \
30+ IWL_BZ_A_GF4_A_FW_PRE "-" __stringify(api) ".ucode"
31+
32+#define IWL_SC_A_GF_A_MODULE_FIRMWARE(api) \
33+ IWL_SC_A_GF_A_FW_PRE "-" __stringify(api) ".ucode"
34+
35+#define IWL_SC_A_GF4_A_MODULE_FIRMWARE(api) \
36+ IWL_SC_A_GF4_A_FW_PRE "-" __stringify(api) ".ucode"
37+
2638 /* NVM versions */
2739 #define IWL_GF_NVM_VERSION 0x0a1d
2840
@@ -67,7 +79,7 @@ IWL_FW_AND_PNVM(IWL_MA_A_GF_A_FW_PRE, IWL_GF_UCODE_API_MAX); · 38 unmodified lines
6779 IWL_FW_AND_PNVM(IWL_MA_B_GF_A_FW_PRE, IWL_GF_UCODE_API_MAX);
6880 IWL_FW_AND_PNVM(IWL_MA_A_GF4_A_FW_PRE, IWL_GF_UCODE_API_MAX);
6981 IWL_FW_AND_PNVM(IWL_MA_B_GF4_A_FW_PRE, IWL_GF_UCODE_API_MAX);
70−IWL_FW_AND_PNVM(IWL_BZ_A_GF_A_FW_PRE, IWL_GF_UCODE_API_MAX);
71−IWL_FW_AND_PNVM(IWL_BZ_A_GF4_A_FW_PRE, IWL_GF_UCODE_API_MAX);
72−IWL_FW_AND_PNVM(IWL_SC_A_GF_A_FW_PRE, IWL_GF_UCODE_API_MAX);
73−IWL_FW_AND_PNVM(IWL_SC_A_GF4_A_FW_PRE, IWL_GF_UCODE_API_MAX);
82+MODULE_FIRMWARE(IWL_BZ_A_GF_A_MODULE_FIRMWARE(IWL_GF_UCODE_API_MAX));
83+MODULE_FIRMWARE(IWL_BZ_A_GF4_A_MODULE_FIRMWARE(IWL_GF_UCODE_API_MAX));
84+MODULE_FIRMWARE(IWL_SC_A_GF_A_MODULE_FIRMWARE(IWL_GF_UCODE_API_MAX));
85+MODULE_FIRMWARE(IWL_SC_A_GF4_A_MODULE_FIRMWARE(IWL_GF_UCODE_API_MAX));
drivers/net/wireless/intel/iwlwifi/cfg/rf-hr.c+1−1
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 #define IWL_HR_UCODE_API_MAX 100
1010
1111 /* Lowest firmware API version supported */
12−#define IWL_HR_UCODE_API_MIN 98
12+#define IWL_HR_UCODE_API_MIN 100
1313
1414 #define IWL_QU_B_HR_B_FW_PRE "iwlwifi-Qu-b0-hr-b0"
1515 #define IWL_QU_C_HR_B_FW_PRE "iwlwifi-Qu-c0-hr-b0"
drivers/net/wireless/intel/iwlwifi/cfg/sc.c+9−9
@@ -9,11 +9,11 @@ · 8 unmodified lines
99 #include "iwl-prph.h"
1010 #include "fw/api/txq.h"
1111
12−/* Highest firmware API version supported */
13−#define IWL_SC_UCODE_API_MAX 102
12+/* Highest firmware core release supported */
13+#define IWL_SC_UCODE_CORE_MAX 99
1414
1515 /* Lowest firmware API version supported */
16−#define IWL_SC_UCODE_API_MIN 98
16+#define IWL_SC_UCODE_API_MIN 100
1717
1818 /* NVM versions */
1919 #define IWL_SC_NVM_VERSION 0x0a1d
@@ -78,7 +78,7 @@ static const struct iwl_family_base_params iwl_sc_base = { · 58 unmodified lines
7878 },
7979 },
8080 .features = IWL_TX_CSUM_NETIF_FLAGS | NETIF_F_RXCSUM,
81− .ucode_api_max = IWL_SC_UCODE_API_MAX,
81+ .ucode_api_max = ENCODE_CORE_AS_API(IWL_SC_UCODE_CORE_MAX),
8282 .ucode_api_min = IWL_SC_UCODE_API_MIN,
8383 };
8484
@@ -94,8 +94,8 @@ const struct iwl_mac_cfg iwl_sc_mac_cfg = { · 9 unmodified lines
9494 .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US,
9595 };
9696
97−IWL_FW_AND_PNVM(IWL_SC_A_FM_B_FW_PRE, IWL_SC_UCODE_API_MAX);
98−IWL_FW_AND_PNVM(IWL_SC_A_FM_C_FW_PRE, IWL_SC_UCODE_API_MAX);
99−IWL_FW_AND_PNVM(IWL_SC_A_WH_A_FW_PRE, IWL_SC_UCODE_API_MAX);
100−IWL_FW_AND_PNVM(IWL_SC2_A_FM_C_FW_PRE, IWL_SC_UCODE_API_MAX);
101−IWL_FW_AND_PNVM(IWL_SC2_A_WH_A_FW_PRE, IWL_SC_UCODE_API_MAX);
97+IWL_CORE_FW(IWL_SC_A_FM_B_FW_PRE, IWL_SC_UCODE_CORE_MAX);
98+IWL_CORE_FW(IWL_SC_A_FM_C_FW_PRE, IWL_SC_UCODE_CORE_MAX);
99+IWL_CORE_FW(IWL_SC_A_WH_A_FW_PRE, IWL_SC_UCODE_CORE_MAX);
100+IWL_CORE_FW(IWL_SC2_A_FM_C_FW_PRE, IWL_SC_UCODE_CORE_MAX);
101+IWL_CORE_FW(IWL_SC2_A_WH_A_FW_PRE, IWL_SC_UCODE_CORE_MAX);
drivers/net/wireless/intel/iwlwifi/dvm/eeprom.c+1−1
@@ -766,7 +766,7 @@ static int iwl_init_otp_access(struct iwl_trans *trans) · 765 unmodified lines
766766 {
767767 int ret;
768768
769− ret = iwl_finish_nic_init(trans);
769+ ret = iwl_trans_activate_nic(trans);
770770 if (ret)
771771 return ret;
772772
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c+2−8
@@ -378,7 +378,7 @@ static int iwlagn_mac_suspend(struct ieee80211_hw *hw, · 377 unmodified lines
378378 iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_SET,
379379 CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE);
380380
381− iwl_trans_d3_suspend(priv->trans, false, true);
381+ iwl_trans_d3_suspend(priv->trans, true);
382382
383383 goto out;
384384
@@ -422,7 +422,6 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) · 37 unmodified lines
422422 struct ieee80211_vif *vif;
423423 u32 base;
424424 int ret;
425− enum iwl_d3_status d3_status;
426425 struct error_table_start {
427426 /* cf. struct iwl_error_event_table */
428427 u32 valid;
@@ -451,15 +450,10 @@ static int iwlagn_mac_resume(struct ieee80211_hw *hw) · 22 unmodified lines
451450 /* we'll clear ctx->vif during iwlagn_prepare_restart() */
452451 vif = ctx->vif;
453452
454− ret = iwl_trans_d3_resume(priv->trans, &d3_status, false, true);
453+ ret = iwl_trans_d3_resume(priv->trans, true);
455454 if (ret)
456455 goto out_unlock;
457456
458− if (d3_status != IWL_D3_STATUS_ALIVE) {
459− IWL_INFO(priv, "Device was reset during suspend\n");
460− goto out_unlock;
461− }
462−
463457 /* uCode is no longer operating by itself */
464458 iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR,
465459 CSR_UCODE_DRV_GP1_BIT_D3_CFG_COMPLETE);
drivers/net/wireless/intel/iwlwifi/dvm/power.c+1−1
@@ -368,7 +368,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force) · 367 unmodified lines
368368 /* initialize to default */
369369 void iwl_power_initialize(struct iwl_priv *priv)
370370 {
371− priv->power_data.bus_pm = priv->trans->pm_support;
371+ priv->power_data.bus_pm = iwl_trans_is_pm_supported(priv->trans);
372372
373373 priv->power_data.debug_sleep_level_override = -1;
374374
drivers/net/wireless/intel/iwlwifi/fw/acpi.c+3−3
@@ -9,9 +9,9 @@ · 8 unmodified lines
99 #include "acpi.h"
1010 #include "fw/runtime.h"
1111
12−const guid_t iwl_guid = GUID_INIT(0xF21202BF, 0x8F78, 0x4DC6,
13− 0xA5, 0xB3, 0x1F, 0x73,
14− 0x8E, 0x28, 0x5A, 0xDE);
12+static const guid_t iwl_guid = GUID_INIT(0xF21202BF, 0x8F78, 0x4DC6,
13+ 0xA5, 0xB3, 0x1F, 0x73,
14+ 0x8E, 0x28, 0x5A, 0xDE);
1515
1616 static const size_t acpi_dsm_size[DSM_FUNC_NUM_FUNCS] = {
1717 [DSM_FUNC_QUERY] = sizeof(u32),
drivers/net/wireless/intel/iwlwifi/fw/acpi.h+0−2
@@ -140,8 +140,6 @@ struct iwl_dsm_internal_product_reset_cmd { · 139 unmodified lines
140140
141141 struct iwl_fw_runtime;
142142
143−extern const guid_t iwl_guid;
144−
145143 union acpi_object *iwl_acpi_get_dsm_object(struct device *dev, int rev,
146144 int func, union acpi_object *args,
147145 const guid_t *guid);
drivers/net/wireless/intel/iwlwifi/fw/api/d3.h+106−7
@@ -367,6 +367,7 @@ enum iwl_wowlan_flags { · 366 unmodified lines
367367 ENABLE_NBNS_FILTERING = BIT(2),
368368 ENABLE_DHCP_FILTERING = BIT(3),
369369 ENABLE_STORE_BEACON = BIT(4),
370+ HAS_BEACON_PROTECTION = BIT(5),
370371 };
371372
372373 /**
@@ -631,9 +632,64 @@ struct iwl_wowlan_gtk_status_v3 { · 258 unmodified lines
631632 struct iwl_wowlan_all_rsc_tsc_v5 sc;
632633 } __packed; /* WOWLAN_GTK_MATERIAL_VER_3 */
633634
635+/**
636+ * enum iwl_wowlan_key_status - Status of security keys in WoWLAN notifications
637+ * @IWL_WOWLAN_NOTIF_NO_KEY: No key is present; this entry should be ignored.
638+ * @IWL_WOWLAN_STATUS_OLD_KEY: old key exists; no rekey occurred, and only
639+ * metadata is available.
640+ * @IWL_WOWLAN_STATUS_NEW_KEY: A new key was created after a rekey; new key
641+ * material is available.
642+ */
643+enum iwl_wowlan_key_status {
644+ IWL_WOWLAN_NOTIF_NO_KEY = 0,
645+ IWL_WOWLAN_STATUS_OLD_KEY = 1,
646+ IWL_WOWLAN_STATUS_NEW_KEY = 2
647+};
648+
649+/**
650+ * struct iwl_wowlan_gtk_status - GTK status
651+ * @key: GTK material
652+ * @key_len: GTK length, if set to 0, the key is not available
653+ * @key_flags: information about the key:
654+ * bits[0:1]: key index assigned by the AP
655+ * bits[2:6]: GTK index of the key in the internal DB
656+ * bit[7]: Set iff this is the currently used GTK
657+ * @key_status: key status, see &enum iwl_wowlan_key_status
658+ * @reserved: padding
659+ * @tkip_mic_key: TKIP RX MIC key
660+ * @sc: RSC/TSC counters
661+ */
662+struct iwl_wowlan_gtk_status {
663+ u8 key[WOWLAN_KEY_MAX_SIZE];
664+ u8 key_len;
665+ u8 key_flags;
666+ u8 key_status;
667+ u8 reserved;
668+ u8 tkip_mic_key[IWL_MIC_KEY_SIZE];
669+ struct iwl_wowlan_all_rsc_tsc_v5 sc;
670+} __packed; /* WOWLAN_GTK_MATERIAL_VER_4 */
671+
634672 #define IWL_WOWLAN_GTK_IDX_MASK (BIT(0) | BIT(1))
635673 #define IWL_WOWLAN_IGTK_BIGTK_IDX_MASK (BIT(0))
636674
675+/**
676+ * struct iwl_wowlan_igtk_status_v1 - IGTK status
677+ * @key: IGTK material
678+ * @ipn: the IGTK packet number (replay counter)
679+ * @key_len: IGTK length, if set to 0, the key is not available
680+ * @key_flags: information about the key:
681+ * bits[0]: key index assigned by the AP (0: index 4, 1: index 5)
682+ * (0: index 6, 1: index 7 with bigtk)
683+ * bits[1:5]: IGTK index of the key in the internal DB
684+ * bit[6]: Set iff this is the currently used IGTK
685+ */
686+struct iwl_wowlan_igtk_status_v1 {
687+ u8 key[WOWLAN_KEY_MAX_SIZE];
688+ u8 ipn[6];
689+ u8 key_len;
690+ u8 key_flags;
691+} __packed; /* WOWLAN_IGTK_MATERIAL_VER_1 */
692+
637693 /**
638694 * struct iwl_wowlan_igtk_status - IGTK status
639695 * @key: IGTK material
@@ -644,13 +700,17 @@ struct iwl_wowlan_gtk_status_v3 { · 4 unmodified lines
644700 * (0: index 6, 1: index 7 with bigtk)
645701 * bits[1:5]: IGTK index of the key in the internal DB
646702 * bit[6]: Set iff this is the currently used IGTK
703+ * @key_status: key status, see &enum iwl_wowlan_key_status
704+ * @reserved: padding
647705 */
648706 struct iwl_wowlan_igtk_status {
649707 u8 key[WOWLAN_KEY_MAX_SIZE];
650708 u8 ipn[6];
651709 u8 key_len;
652710 u8 key_flags;
653−} __packed; /* WOWLAN_IGTK_MATERIAL_VER_1 */
711+ u8 key_status;
712+ u8 reserved[3];
713+} __packed; /* WOWLAN_IGTK_MATERIAL_VER_2 */
654714
655715 /**
656716 * struct iwl_wowlan_status_v6 - WoWLAN status
@@ -700,7 +760,7 @@ struct iwl_wowlan_status_v6 { · 43 unmodified lines
700760 */
701761 struct iwl_wowlan_status_v7 {
702762 struct iwl_wowlan_gtk_status_v2 gtk[WOWLAN_GTK_KEYS_NUM];
703− struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
763+ struct iwl_wowlan_igtk_status_v1 igtk[WOWLAN_IGTK_KEYS_NUM];
704764 __le64 replay_ctr;
705765 __le16 pattern_number;
706766 __le16 non_qos_seq_ctr;
@@ -735,7 +795,7 @@ struct iwl_wowlan_status_v7 { · 28 unmodified lines
735795 */
736796 struct iwl_wowlan_info_notif_v1 {
737797 struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
738− struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
798+ struct iwl_wowlan_igtk_status_v1 igtk[WOWLAN_IGTK_KEYS_NUM];
739799 __le64 replay_ctr;
740800 __le16 pattern_number;
741801 __le16 reserved1;
@@ -817,8 +877,8 @@ struct iwl_wowlan_mlo_gtk { · 75 unmodified lines
817877 */
818878 struct iwl_wowlan_info_notif_v3 {
819879 struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
820− struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
821− struct iwl_wowlan_igtk_status bigtk[WOWLAN_BIGTK_KEYS_NUM];
880+ struct iwl_wowlan_igtk_status_v1 igtk[WOWLAN_IGTK_KEYS_NUM];
881+ struct iwl_wowlan_igtk_status_v1 bigtk[WOWLAN_BIGTK_KEYS_NUM];
822882 __le64 replay_ctr;
823883 __le16 pattern_number;
824884 __le16 reserved1;
@@ -832,6 +892,45 @@ struct iwl_wowlan_info_notif_v3 { · 7 unmodified lines
832892 u8 reserved2[2];
833893 } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_3 */
834894
895+/**
896+ * struct iwl_wowlan_info_notif_v5 - WoWLAN information notification
897+ * @gtk: GTK data
898+ * @igtk: IGTK data
899+ * @bigtk: BIGTK data
900+ * @replay_ctr: GTK rekey replay counter
901+ * @pattern_number: number of the matched patterns
902+ * @qos_seq_ctr: QoS sequence counters to use next
903+ * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
904+ * @num_of_gtk_rekeys: number of GTK rekeys
905+ * @transmitted_ndps: number of transmitted neighbor discovery packets
906+ * @received_beacons: number of received beacons
907+ * @tid_tear_down: bit mask of tids whose BA sessions were closed
908+ * in suspend state
909+ * @station_id: station id
910+ * @num_mlo_link_keys: number of &struct iwl_wowlan_mlo_gtk structs
911+ * following this notif
912+ * @tid_offloaded_tx: tid used by the firmware to transmit data packets
913+ * while in wowlan
914+ * @mlo_gtks: array of GTKs of size num_mlo_link_keys
915+ */
916+struct iwl_wowlan_info_notif_v5 {
917+ struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
918+ struct iwl_wowlan_igtk_status_v1 igtk[WOWLAN_IGTK_KEYS_NUM];
919+ struct iwl_wowlan_igtk_status_v1 bigtk[WOWLAN_BIGTK_KEYS_NUM];
920+ __le64 replay_ctr;
921+ __le16 pattern_number;
922+ __le16 qos_seq_ctr;
923+ __le32 wakeup_reasons;
924+ __le32 num_of_gtk_rekeys;
925+ __le32 transmitted_ndps;
926+ __le32 received_beacons;
927+ u8 tid_tear_down;
928+ u8 station_id;
929+ u8 num_mlo_link_keys;
930+ u8 tid_offloaded_tx;
931+ struct iwl_wowlan_mlo_gtk mlo_gtks[];
932+} __packed; /* WOWLAN_INFO_NTFY_API_S_VER_5 */
933+
835934 /**
836935 * struct iwl_wowlan_info_notif - WoWLAN information notification
837936 * @gtk: GTK data
@@ -854,7 +953,7 @@ struct iwl_wowlan_info_notif_v3 { · 16 unmodified lines
854953 * @mlo_gtks: array of GTKs of size num_mlo_link_keys
855954 */
856955 struct iwl_wowlan_info_notif {
857− struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
956+ struct iwl_wowlan_gtk_status gtk[WOWLAN_GTK_KEYS_NUM];
858957 struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
859958 struct iwl_wowlan_igtk_status bigtk[WOWLAN_BIGTK_KEYS_NUM];
860959 __le64 replay_ctr;
@@ -869,7 +968,7 @@ struct iwl_wowlan_info_notif { · 8 unmodified lines
869968 u8 num_mlo_link_keys;
870969 u8 tid_offloaded_tx;
871970 struct iwl_wowlan_mlo_gtk mlo_gtks[];
872−} __packed; /* WOWLAN_INFO_NTFY_API_S_VER_5 */
971+} __packed; /* WOWLAN_INFO_NTFY_API_S_VER_6 */
873972
874973 /**
875974 * struct iwl_wowlan_wake_pkt_notif - WoWLAN wake packet notification
drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h+3−0
@@ -420,6 +420,8 @@ struct iwl_mac_config_cmd { · 419 unmodified lines
420420 * eht_support set to true. No longer used since _VER_3 of this command.
421421 * @LINK_CONTEXT_MODIFY_BANDWIDTH: Covers iwl_link_ctx_cfg_cmd::modify_bandwidth.
422422 * Request RX OMI to the AP to modify bandwidth of this link.
423+ * @LINK_CONTEXT_MODIFY_UHR_PARAMS: covers iwl_link_ctx_cfg_cmd::npca_params and
424+ * iwl_link_ctx_cfg_cmd::prio_edca_params. Since _VER_7.
423425 * @LINK_CONTEXT_MODIFY_ALL: set all above flags
424426 */
425427 enum iwl_link_ctx_modify_flags {
@@ -432,6 +434,7 @@ enum iwl_link_ctx_modify_flags { · 6 unmodified lines
432434 LINK_CONTEXT_MODIFY_BSS_COLOR_DISABLE = BIT(6),
433435 LINK_CONTEXT_MODIFY_EHT_PARAMS = BIT(7),
434436 LINK_CONTEXT_MODIFY_BANDWIDTH = BIT(8),
437+ LINK_CONTEXT_MODIFY_UHR_PARAMS = BIT(9),
435438 LINK_CONTEXT_MODIFY_ALL = 0xff,
436439 }; /* LINK_CONTEXT_MODIFY_MASK_E_VER_1 */
437440
drivers/net/wireless/intel/iwlwifi/fw/api/offload.h+1−1
@@ -20,7 +20,7 @@ enum iwl_prot_offload_subcmd_ids { · 19 unmodified lines
2020 /**
2121 * @WOWLAN_INFO_NOTIFICATION: Notification in
2222 * &struct iwl_wowlan_info_notif_v1, iwl_wowlan_info_notif_v3,
23− * or &struct iwl_wowlan_info_notif
23+ * &struct iwl_wowlan_info_notif_v5 or &struct iwl_wowlan_info_notif
2424 */
2525 WOWLAN_INFO_NOTIFICATION = 0xFD,
2626
drivers/net/wireless/intel/iwlwifi/fw/api/power.h+11−23
@@ -571,17 +571,16 @@ enum iwl_ppag_flags { · 570 unmodified lines
571571 /**
572572 * union iwl_ppag_table_cmd - union for all versions of PPAG command
573573 * @v1: command version 1 structure.
574− * @v2: command version from 2 to 6 are same structure as v2.
575− * but has a different format of the flags bitmap
576− * @v3: command version 7 structure.
574+ * @v5: command version 5 structure.
575+ * @v7: command version 7 structure.
577576 * @v1.flags: values from &enum iwl_ppag_flags
578577 * @v1.gain: table of antenna gain values per chain and sub-band
579578 * @v1.reserved: reserved
580− * @v2.flags: values from &enum iwl_ppag_flags
581− * @v2.gain: table of antenna gain values per chain and sub-band
582− * @v3.ppag_config_info: see @struct bios_value_u32
583− * @v3.gain: table of antenna gain values per chain and sub-band
584− * @v3.reserved: reserved
579+ * @v5.flags: values from &enum iwl_ppag_flags
580+ * @v5.gain: table of antenna gain values per chain and sub-band
581+ * @v7.ppag_config_info: see @struct bios_value_u32
582+ * @v7.gain: table of antenna gain values per chain and sub-band
583+ * @v7.reserved: reserved
585584 */
586585 union iwl_ppag_table_cmd {
587586 struct {
@@ -593,30 +592,19 @@ union iwl_ppag_table_cmd { · 5 unmodified lines
593592 __le32 flags;
594593 s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
595594 s8 reserved[2];
596− } __packed v2; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_2, VER3, VER4,
597− * VER5, VER6
598− */
595+ } __packed v5; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_5 */
599596 struct {
600597 struct bios_value_u32 ppag_config_info;
601598 s8 gain[IWL_NUM_CHAIN_LIMITS][IWL_NUM_SUB_BANDS_V2];
602599 s8 reserved[2];
603− } __packed v3; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_7 */
600+ } __packed v7; /* PER_PLAT_ANTENNA_GAIN_CMD_API_S_VER_7 */
604601 } __packed;
605602
606−#define IWL_PPAG_CMD_V4_MASK (IWL_PPAG_ETSI_MASK | IWL_PPAG_CHINA_MASK)
607−#define IWL_PPAG_CMD_V5_MASK (IWL_PPAG_CMD_V4_MASK | \
603+#define IWL_PPAG_CMD_V1_MASK (IWL_PPAG_ETSI_MASK | IWL_PPAG_CHINA_MASK)
604+#define IWL_PPAG_CMD_V5_MASK (IWL_PPAG_CMD_V1_MASK | \
608605 IWL_PPAG_ETSI_LPI_UHB_MASK | \
609606 IWL_PPAG_USA_LPI_UHB_MASK)
610607
611−#define IWL_PPAG_CMD_V6_MASK (IWL_PPAG_CMD_V5_MASK | \
612− IWL_PPAG_ETSI_VLP_UHB_MASK | \
613− IWL_PPAG_ETSI_SP_UHB_MASK | \
614− IWL_PPAG_USA_VLP_UHB_MASK | \
615− IWL_PPAG_USA_SP_UHB_MASK | \
616− IWL_PPAG_CANADA_LPI_UHB_MASK | \
617− IWL_PPAG_CANADA_VLP_UHB_MASK | \
618− IWL_PPAG_CANADA_SP_UHB_MASK)
619−
620608 #define MCC_TO_SAR_OFFSET_TABLE_ROW_SIZE 26
621609 #define MCC_TO_SAR_OFFSET_TABLE_COL_SIZE 13
622610
drivers/net/wireless/intel/iwlwifi/fw/api/rs.h+35−0
@@ -24,6 +24,8 @@ · 23 unmodified lines
2424 * for BPSK (MCS 0) with 2 spatial
2525 * streams
2626 * @IWL_TLC_MNG_CFG_FLAGS_EHT_EXTRA_LTF_MSK: enable support for EHT extra LTF
27+ * @IWL_TLC_MNG_CFG_FLAGS_UHR_ELR_1_5_MBPS_MSK: support ELR 1.5 Mbps
28+ * @IWL_TLC_MNG_CFG_FLAGS_UHR_ELR_3_MBPS_MSK: support ELR 3 Mbps
2729 */
2830 enum iwl_tlc_mng_cfg_flags {
2931 IWL_TLC_MNG_CFG_FLAGS_STBC_MSK = BIT(0),
@@ -32,6 +34,8 @@ enum iwl_tlc_mng_cfg_flags { · 2 unmodified lines
3234 IWL_TLC_MNG_CFG_FLAGS_HE_DCM_NSS_1_MSK = BIT(3),
3335 IWL_TLC_MNG_CFG_FLAGS_HE_DCM_NSS_2_MSK = BIT(4),
3436 IWL_TLC_MNG_CFG_FLAGS_EHT_EXTRA_LTF_MSK = BIT(6),
37+ IWL_TLC_MNG_CFG_FLAGS_UHR_ELR_1_5_MBPS_MSK = BIT(7),
38+ IWL_TLC_MNG_CFG_FLAGS_UHR_ELR_3_MBPS_MSK = BIT(8),
3539 };
3640
3741 /**
@@ -200,6 +204,37 @@ struct iwl_tlc_config_cmd_v4 { · 162 unmodified lines
200204 __le16 max_tx_op;
201205 } __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_4 */
202206
207+/**
208+ * struct iwl_tlc_config_cmd - TLC configuration
209+ * @sta_id: station id
210+ * @reserved1: reserved
211+ * @max_ch_width: max supported channel width from &enum iwl_tlc_mng_cfg_cw
212+ * @mode: &enum iwl_tlc_mng_cfg_mode
213+ * @chains: bitmask of &enum iwl_tlc_mng_cfg_chains
214+ * @sgi_ch_width_supp: bitmap of SGI support per channel width
215+ * use BIT(&enum iwl_tlc_mng_cfg_cw)
216+ * @flags: bitmask of &enum iwl_tlc_mng_cfg_flags
217+ * @non_ht_rates: bitmap of supported legacy rates
218+ * @ht_rates: bitmap of &enum iwl_tlc_mng_ht_rates, per <nss, channel-width>
219+ * pair (0 - 80mhz width and below, 1 - 160mhz, 2 - 320mhz).
220+ * @max_mpdu_len: max MPDU length, in bytes
221+ * @max_tx_op: max TXOP in uSecs for all AC (BK, BE, VO, VI),
222+ * set zero for no limit.
223+ */
224+struct iwl_tlc_config_cmd {
225+ u8 sta_id;
226+ u8 reserved1[3];
227+ u8 max_ch_width;
228+ u8 mode;
229+ u8 chains;
230+ u8 sgi_ch_width_supp;
231+ __le16 flags;
232+ __le16 non_ht_rates;
233+ __le32 ht_rates[IWL_TLC_NSS_MAX][IWL_TLC_MCS_PER_BW_NUM_V4];
234+ __le16 max_mpdu_len;
235+ __le16 max_tx_op;
236+} __packed; /* TLC_MNG_CONFIG_CMD_API_S_VER_5 */
237+
203238 /**
204239 * enum iwl_tlc_update_flags - updated fields
205240 * @IWL_TLC_NOTIF_FLAG_RATE: last initial rate update
drivers/net/wireless/intel/iwlwifi/fw/dbg.c+4−39
@@ -830,7 +830,7 @@ iwl_fw_error_dump_file(struct iwl_fw_runtime *fwrt, · 829 unmodified lines
830830 }
831831
832832 /* reading RXF/TXF sizes */
833− if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status)) {
833+ if (iwl_trans_is_fw_error(fwrt->trans)) {
834834 fifo_len = iwl_fw_rxf_len(fwrt, mem_cfg);
835835 fifo_len += iwl_fw_txf_len(fwrt, mem_cfg);
836836
@@ -2393,7 +2393,7 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt, · 1556 unmodified lines
23932393 struct iwl_fw_ini_dump_cfg_name *cfg_name;
23942394 u32 size = sizeof(*tlv) + sizeof(*dump);
23952395 u32 num_of_cfg_names = 0;
2396− u32 hw_type, is_cdb, is_jacket;
2396+ u32 hw_type, is_cdb;
23972397
23982398 list_for_each_entry(node, &fwrt->trans->dbg.debug_info_tlv_list, list) {
23992399 size += sizeof(*cfg_name);
@@ -2426,11 +2426,7 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt, · 26 unmodified lines
24262426 hw_type = CSR_HW_REV_TYPE(fwrt->trans->info.hw_rev);
24272427
24282428 is_cdb = CSR_HW_RFID_IS_CDB(fwrt->trans->info.hw_rf_id);
2429− is_jacket = !!(iwl_read_umac_prph(fwrt->trans, WFPM_OTP_CFG1_ADDR) &
2430− WFPM_OTP_CFG1_IS_JACKET_BIT);
2431−
2432− /* Use bits 12 and 13 to indicate jacket/CDB, respectively */
2433− hw_type |= (is_jacket | (is_cdb << 1)) << IWL_JACKET_CDB_SHIFT;
2429+ hw_type |= IWL_CDB_MASK(is_cdb);
24342430
24352431 dump->hw_type = cpu_to_le32(hw_type);
24362432
@@ -2478,36 +2474,6 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt, · 41 unmodified lines
24782474 return entry->size;
24792475 }
24802476
2481−static u32 iwl_dump_ini_file_name_info(struct iwl_fw_runtime *fwrt,
2482− struct list_head *list)
2483−{
2484− struct iwl_fw_ini_dump_entry *entry;
2485− struct iwl_dump_file_name_info *tlv;
2486− u32 len = strnlen(fwrt->trans->dbg.dump_file_name_ext,
2487− IWL_FW_INI_MAX_NAME);
2488−
2489− if (!fwrt->trans->dbg.dump_file_name_ext_valid)
2490− return 0;
2491−
2492− entry = vzalloc(sizeof(*entry) + sizeof(*tlv) + len);
2493− if (!entry)
2494− return 0;
2495−
2496− entry->size = sizeof(*tlv) + len;
2497−
2498− tlv = (void *)entry->data;
2499− tlv->type = cpu_to_le32(IWL_INI_DUMP_NAME_TYPE);
2500− tlv->len = cpu_to_le32(len);
2501− memcpy(tlv->data, fwrt->trans->dbg.dump_file_name_ext, len);
2502−
2503− /* add the dump file name extension tlv to the list */
2504− list_add_tail(&entry->list, list);
2505−
2506− fwrt->trans->dbg.dump_file_name_ext_valid = false;
2507−
2508− return entry->size;
2509−}
2510−
25112477 static const struct iwl_dump_ini_mem_ops iwl_dump_ini_region_ops[] = {
25122478 [IWL_FW_INI_REGION_INVALID] = {},
25132479 [IWL_FW_INI_REGION_INTERNAL_BUFFER] = {
@@ -2764,7 +2730,6 @@ static u32 iwl_dump_ini_trigger(struct iwl_fw_runtime *fwrt, · 250 unmodified lines
27642730 &iwl_dump_ini_region_ops[IWL_FW_INI_REGION_DRAM_IMR]);
27652731
27662732 if (size) {
2767− size += iwl_dump_ini_file_name_info(fwrt, list);
27682733 size += iwl_dump_ini_info(fwrt, trigger, list);
27692734 }
27702735
@@ -3151,7 +3116,7 @@ static void iwl_send_dbg_dump_complete_cmd(struct iwl_fw_runtime *fwrt, · 380 unmodified lines
31513116 .len[0] = sizeof(hcmd_data),
31523117 };
31533118
3154− if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status))
3119+ if (iwl_trans_is_fw_error(fwrt->trans))
31553120 return;
31563121
31573122 if (fw_has_capa(&fwrt->fw->ucode_capa,
drivers/net/wireless/intel/iwlwifi/fw/dump.c+1−53
@@ -14,13 +14,6 @@ · 13 unmodified lines
1414 #include "iwl-csr.h"
1515 #include "pnvm.h"
1616
17−#define FW_ASSERT_LMAC_FATAL 0x70
18−#define FW_ASSERT_LMAC2_FATAL 0x72
19−#define FW_ASSERT_UMAC_FATAL 0x71
20−#define UMAC_RT_NMI_LMAC2_FATAL 0x72
21−#define RT_NMI_INTERRUPT_OTHER_LMAC_FATAL 0x73
22−#define FW_ASSERT_NMI_UNKNOWN 0x84
23−
2417 /*
2518 * Note: This structure is read from the device with IO accesses,
2619 * and the reading already does the endian conversion. As it is
@@ -103,17 +96,6 @@ struct iwl_umac_error_event_table { · 76 unmodified lines
10396 #define ERROR_START_OFFSET (1 * sizeof(u32))
10497 #define ERROR_ELEM_SIZE (7 * sizeof(u32))
10598
106−static bool iwl_fwrt_if_errorid_other_cpu(u32 err_id)
107−{
108− err_id &= 0xFF;
109−
110− if ((err_id >= FW_ASSERT_LMAC_FATAL &&
111− err_id <= RT_NMI_INTERRUPT_OTHER_LMAC_FATAL) ||
112− err_id == FW_ASSERT_NMI_UNKNOWN)
113− return true;
114− return false;
115−}
116−
11799 static void iwl_fwrt_dump_umac_error_log(struct iwl_fw_runtime *fwrt)
118100 {
119101 struct iwl_trans *trans = fwrt->trans;
@@ -131,13 +113,6 @@ static void iwl_fwrt_dump_umac_error_log(struct iwl_fw_runtime *fwrt) · 11 unmodified lines
131113 if (table.valid)
132114 fwrt->dump.umac_err_id = table.error_id;
133115
134− if (!iwl_fwrt_if_errorid_other_cpu(fwrt->dump.umac_err_id) &&
135− !fwrt->trans->dbg.dump_file_name_ext_valid) {
136− fwrt->trans->dbg.dump_file_name_ext_valid = true;
137− snprintf(fwrt->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME,
138− "0x%x", fwrt->dump.umac_err_id);
139− }
140−
141116 if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) {
142117 IWL_ERR(trans, "Start IWL Error Log Dump:\n");
143118 IWL_ERR(trans, "Transport status: 0x%08lX, valid: %d\n",
@@ -203,7 +178,7 @@ static void iwl_fwrt_dump_lmac_error_log(struct iwl_fw_runtime *fwrt, u8 lmac_nu · 59 unmodified lines
203178 if (err)
204179 return;
205180
206− err = iwl_finish_nic_init(trans);
181+ err = iwl_trans_activate_nic(trans);
207182 if (err)
208183 return;
209184 }
@@ -213,13 +188,6 @@ static void iwl_fwrt_dump_lmac_error_log(struct iwl_fw_runtime *fwrt, u8 lmac_nu · 3 unmodified lines
213188 if (table.valid)
214189 fwrt->dump.lmac_err_id[lmac_num] = table.error_id;
215190
216− if (!iwl_fwrt_if_errorid_other_cpu(fwrt->dump.lmac_err_id[lmac_num]) &&
217− !fwrt->trans->dbg.dump_file_name_ext_valid) {
218− fwrt->trans->dbg.dump_file_name_ext_valid = true;
219− snprintf(fwrt->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME,
220− "0x%x", fwrt->dump.lmac_err_id[lmac_num]);
221− }
222−
223191 if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) {
224192 IWL_ERR(trans, "Start IWL Error Log Dump:\n");
225193 IWL_ERR(trans, "Transport status: 0x%08lX, valid: %d\n",
@@ -305,16 +273,6 @@ static void iwl_fwrt_dump_tcm_error_log(struct iwl_fw_runtime *fwrt, int idx) · 79 unmodified lines
305273
306274 iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table));
307275
308− if (table.valid)
309− fwrt->dump.tcm_err_id[idx] = table.error_id;
310−
311− if (!iwl_fwrt_if_errorid_other_cpu(fwrt->dump.tcm_err_id[idx]) &&
312− !fwrt->trans->dbg.dump_file_name_ext_valid) {
313− fwrt->trans->dbg.dump_file_name_ext_valid = true;
314− snprintf(fwrt->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME,
315− "0x%x", fwrt->dump.tcm_err_id[idx]);
316− }
317−
318276 IWL_ERR(fwrt, "TCM%d status:\n", idx + 1);
319277 IWL_ERR(fwrt, "0x%08X | error ID\n", table.error_id);
320278 IWL_ERR(fwrt, "0x%08X | tcm branchlink2\n", table.blink2);
@@ -378,16 +336,6 @@ static void iwl_fwrt_dump_rcm_error_log(struct iwl_fw_runtime *fwrt, int idx) · 57 unmodified lines
378336
379337 iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table));
380338
381− if (table.valid)
382− fwrt->dump.rcm_err_id[idx] = table.error_id;
383−
384− if (!iwl_fwrt_if_errorid_other_cpu(fwrt->dump.rcm_err_id[idx]) &&
385− !fwrt->trans->dbg.dump_file_name_ext_valid) {
386− fwrt->trans->dbg.dump_file_name_ext_valid = true;
387− snprintf(fwrt->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME,
388− "0x%x", fwrt->dump.rcm_err_id[idx]);
389− }
390−
391339 IWL_ERR(fwrt, "RCM%d status:\n", idx + 1);
392340 IWL_ERR(fwrt, "0x%08X | error ID\n", table.error_id);
393341 IWL_ERR(fwrt, "0x%08X | rcm branchlink2\n", table.blink2);
drivers/net/wireless/intel/iwlwifi/fw/error-dump.h+2−1
@@ -372,7 +372,8 @@ struct iwl_fw_ini_dump_cfg_name { · 371 unmodified lines
372372 u8 cfg_name[IWL_FW_INI_MAX_CFG_NAME];
373373 } __packed;
374374
375−#define IWL_JACKET_CDB_SHIFT 12
375+#define IWL_CDB_MASK(val) val << 13
376+
376377
377378 /* struct iwl_fw_ini_dump_info - ini dump information
378379 * @version: dump version
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c+67−14
@@ -237,11 +237,12 @@ static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data, · 236 unmodified lines
237237 return -ENOENT;
238238 }
239239
240−static int iwl_pnvm_get_from_fs(struct iwl_trans *trans, u8 **data, size_t *len)
240+static u8 *iwl_pnvm_get_from_fs(struct iwl_trans *trans, size_t *len)
241241 {
242242 const struct firmware *pnvm;
243243 char pnvm_name[MAX_PNVM_NAME];
244244 size_t new_len;
245+ u8 *data;
245246 int ret;
246247
247248 iwl_pnvm_get_fs_name(trans, pnvm_name, sizeof(pnvm_name));
@@ -250,29 +251,73 @@ static int iwl_pnvm_get_from_fs(struct iwl_trans *trans, u8 **data, size_t *len) · 2 unmodified lines
250251 if (ret) {
251252 IWL_DEBUG_FW(trans, "PNVM file %s not found %d\n",
252253 pnvm_name, ret);
253− return ret;
254+ return NULL;
254255 }
255256
256257 new_len = pnvm->size;
257− *data = kvmemdup(pnvm->data, pnvm->size, GFP_KERNEL);
258+ data = kvmemdup(pnvm->data, pnvm->size, GFP_KERNEL);
258259 release_firmware(pnvm);
259260
260− if (!*data)
261− return -ENOMEM;
261+ if (!data)
262+ return NULL;
262263
263264 *len = new_len;
264265
265− return 0;
266+ return data;
267+}
268+
269+/**
270+ * enum iwl_pnvm_source - different PNVM possible sources
271+ *
272+ * @IWL_PNVM_SOURCE_NONE: No PNVM.
273+ * @IWL_PNVM_SOURCE_BIOS: PNVM should be read from BIOS.
274+ * @IWL_PNVM_SOURCE_EXTERNAL: read .pnvm external file
275+ * @IWL_PNVM_SOURCE_EMBEDDED: PNVM is embedded in the .ucode file.
276+ */
277+enum iwl_pnvm_source {
278+ IWL_PNVM_SOURCE_NONE,
279+ IWL_PNVM_SOURCE_BIOS,
280+ IWL_PNVM_SOURCE_EXTERNAL,
281+ IWL_PNVM_SOURCE_EMBEDDED
282+};
283+
284+static enum iwl_pnvm_source iwl_select_pnvm_source(struct iwl_trans *trans,
285+ bool intel_sku)
286+{
287+
288+ /* Get PNVM from BIOS for non-Intel SKU */
289+ if (!intel_sku)
290+ return IWL_PNVM_SOURCE_BIOS;
291+
292+ /* Before those devices, PNVM didn't exist at all */
293+ if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210)
294+ return IWL_PNVM_SOURCE_NONE;
295+
296+ /* After those devices, we moved to embedded PNVM */
297+ if (trans->mac_cfg->device_family > IWL_DEVICE_FAMILY_AX210)
298+ return IWL_PNVM_SOURCE_EMBEDDED;
299+
300+ /* For IWL_DEVICE_FAMILY_AX210, depends on the CRF */
301+ if (CSR_HW_RFID_TYPE(trans->info.hw_rf_id) == IWL_CFG_RF_TYPE_GF)
302+ return IWL_PNVM_SOURCE_EXTERNAL;
303+
304+ return IWL_PNVM_SOURCE_NONE;
266305 }
267306
268307 static const u8 *iwl_get_pnvm_image(struct iwl_trans *trans_p, size_t *len,
269308 __le32 sku_id[3], const struct iwl_fw *fw)
270309 {
271310 struct pnvm_sku_package *package;
311+ enum iwl_pnvm_source pnvm_src =
312+ iwl_select_pnvm_source(trans_p, sku_id[2] == 0);
272313 u8 *image = NULL;
273314
274− /* Get PNVM from BIOS for non-Intel SKU */
275− if (sku_id[2]) {
315+ IWL_DEBUG_FW(trans_p, "PNVM source %d\n", pnvm_src);
316+
317+ if (pnvm_src == IWL_PNVM_SOURCE_NONE)
318+ return NULL;
319+
320+ if (pnvm_src == IWL_PNVM_SOURCE_BIOS) {
276321 package = iwl_uefi_get_pnvm(trans_p, len);
277322 if (!IS_ERR_OR_NULL(package)) {
278323 if (*len >= sizeof(*package)) {
@@ -289,18 +334,26 @@ static const u8 *iwl_get_pnvm_image(struct iwl_trans *trans_p, size_t *len, · 10 unmodified lines
289334 if (image)
290335 return image;
291336 }
337+
338+ /* PNVM doesn't exist in BIOS. Find the fallback source */
339+ pnvm_src = iwl_select_pnvm_source(trans_p, true);
340+ IWL_DEBUG_FW(trans_p, "PNVM in BIOS doesn't exist, try %d\n",
341+ pnvm_src);
292342 }
293343
294− if (fw->pnvm_data) {
295− *len = fw->pnvm_size;
344+ if (pnvm_src == IWL_PNVM_SOURCE_EXTERNAL) {
345+ image = iwl_pnvm_get_from_fs(trans_p, len);
346+ if (image)
347+ return image;
348+ }
296349
350+ if (pnvm_src == IWL_PNVM_SOURCE_EMBEDDED && fw->pnvm_data) {
351+ *len = fw->pnvm_size;
297352 return fw->pnvm_data;
298353 }
299354
300− /* If it's not available, or for Intel SKU, try from the filesystem */
301− if (iwl_pnvm_get_from_fs(trans_p, &image, len))
302− return NULL;
303− return image;
355+ IWL_ERR(trans_p, "Couldn't get PNVM from required source: %d\n", pnvm_src);
356+ return NULL;
304357 }
305358
306359 static void
drivers/net/wireless/intel/iwlwifi/fw/regulatory.c+28−25
@@ -59,11 +59,16 @@ static const struct dmi_system_id dmi_ppag_approved_list[] = { · 58 unmodified lines
5959 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
6060 },
6161 },
62− { .ident = "ASUS",
62+ { .ident = "ASUSTEK",
6363 .matches = {
6464 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
6565 },
6666 },
67+ { .ident = "ASUS",
68+ .matches = {
69+ DMI_MATCH(DMI_SYS_VENDOR, "ASUS"),
70+ },
71+ },
6772 { .ident = "GOOGLE-HP",
6873 .matches = {
6974 DMI_MATCH(DMI_SYS_VENDOR, "Google"),
@@ -141,11 +146,16 @@ static const struct dmi_system_id dmi_tas_approved_list[] = { · 71 unmodified lines
141146 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
142147 },
143148 },
144− { .ident = "ASUS",
149+ { .ident = "ASUSTEK",
145150 .matches = {
146151 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
147152 },
148153 },
154+ { .ident = "ASUS",
155+ .matches = {
156+ DMI_MATCH(DMI_SYS_VENDOR, "ASUS"),
157+ },
158+ },
149159 { .ident = "GOOGLE-HP",
150160 .matches = {
151161 DMI_MATCH(DMI_SYS_VENDOR, "Google"),
@@ -305,6 +315,7 @@ static bool iwl_ppag_value_valid(struct iwl_fw_runtime *fwrt, int chain, · 153 unmodified lines
305315 return true;
306316 }
307317
318+/* Utility function for iwlmvm and iwlxvt */
308319 int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt,
309320 union iwl_ppag_table_cmd *cmd, int *cmd_size)
310321 {
@@ -344,18 +355,18 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt, · 33 unmodified lines
344355 num_sub_bands = IWL_NUM_SUB_BANDS_V1;
345356 gain = cmd->v1.gain[0];
346357 *cmd_size = sizeof(cmd->v1);
347− cmd->v1.flags = cpu_to_le32(fwrt->ppag_flags);
358+ cmd->v1.flags = cpu_to_le32(fwrt->ppag_flags & IWL_PPAG_CMD_V1_MASK);
348359 if (fwrt->ppag_bios_rev >= 1) {
349360 /* in this case FW supports revision 0 */
350361 IWL_DEBUG_RADIO(fwrt,
351362 "PPAG table rev is %d, send truncated table\n",
352363 fwrt->ppag_bios_rev);
353364 }
354− } else if (cmd_ver >= 2 && cmd_ver <= 6) {
365+ } else if (cmd_ver == 5) {
355366 num_sub_bands = IWL_NUM_SUB_BANDS_V2;
356− gain = cmd->v2.gain[0];
357− *cmd_size = sizeof(cmd->v2);
358− cmd->v2.flags = cpu_to_le32(fwrt->ppag_flags);
367+ gain = cmd->v5.gain[0];
368+ *cmd_size = sizeof(cmd->v5);
369+ cmd->v5.flags = cpu_to_le32(fwrt->ppag_flags & IWL_PPAG_CMD_V5_MASK);
359370 if (fwrt->ppag_bios_rev == 0) {
360371 /* in this case FW supports revisions 1,2 or 3 */
361372 IWL_DEBUG_RADIO(fwrt,
@@ -363,11 +374,11 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt, · 1 unmodified line
363374 }
364375 } else if (cmd_ver == 7) {
365376 num_sub_bands = IWL_NUM_SUB_BANDS_V2;
366− gain = cmd->v3.gain[0];
367− *cmd_size = sizeof(cmd->v3);
368− cmd->v3.ppag_config_info.table_source = fwrt->ppag_bios_source;
369− cmd->v3.ppag_config_info.table_revision = fwrt->ppag_bios_rev;
370− cmd->v3.ppag_config_info.value = cpu_to_le32(fwrt->ppag_flags);
377+ gain = cmd->v7.gain[0];
378+ *cmd_size = sizeof(cmd->v7);
379+ cmd->v7.ppag_config_info.table_source = fwrt->ppag_bios_source;
380+ cmd->v7.ppag_config_info.table_revision = fwrt->ppag_bios_rev;
381+ cmd->v7.ppag_config_info.value = cpu_to_le32(fwrt->ppag_flags);
371382 } else {
372383 IWL_DEBUG_RADIO(fwrt, "Unsupported PPAG command version\n");
373384 return -EINVAL;
@@ -378,30 +389,22 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt, · 4 unmodified lines
378389 "PPAG MODE bits were read from bios: %d\n",
379390 fwrt->ppag_flags);
380391
381− if (cmd_ver == 6)
382− cmd->v1.flags &= cpu_to_le32(IWL_PPAG_CMD_V6_MASK);
383− else if (cmd_ver == 5)
384− cmd->v1.flags &= cpu_to_le32(IWL_PPAG_CMD_V5_MASK);
385− else if (cmd_ver < 5)
386− cmd->v1.flags &= cpu_to_le32(IWL_PPAG_CMD_V4_MASK);
387−
388− if ((cmd_ver == 1 &&
389− !fw_has_capa(&fwrt->fw->ucode_capa,
390− IWL_UCODE_TLV_CAPA_PPAG_CHINA_BIOS_SUPPORT)) ||
391− (cmd_ver == 2 && fwrt->ppag_bios_rev >= 2)) {
392+ if (cmd_ver == 1 &&
393+ !fw_has_capa(&fwrt->fw->ucode_capa,
394+ IWL_UCODE_TLV_CAPA_PPAG_CHINA_BIOS_SUPPORT)) {
392395 cmd->v1.flags &= cpu_to_le32(IWL_PPAG_ETSI_MASK);
393396 IWL_DEBUG_RADIO(fwrt, "masking ppag China bit\n");
394397 } else {
395398 IWL_DEBUG_RADIO(fwrt, "isn't masking ppag China bit\n");
396399 }
397400
398− /* The 'flags' field is the same in v1 and v2 so we can just
401+ /* The 'flags' field is the same in v1 and v5 so we can just
399402 * use v1 to access it.
400403 */
401404 IWL_DEBUG_RADIO(fwrt,
402405 "PPAG MODE bits going to be sent: %d\n",
403406 (cmd_ver < 7) ? le32_to_cpu(cmd->v1.flags) :
404− le32_to_cpu(cmd->v3.ppag_config_info.value));
407+ le32_to_cpu(cmd->v7.ppag_config_info.value));
405408
406409 for (i = 0; i < IWL_NUM_CHAIN_LIMITS; i++) {
407410 for (j = 0; j < num_sub_bands; j++) {
drivers/net/wireless/intel/iwlwifi/fw/regulatory.h+0−1
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include "fw/api/phy.h"
1313 #include "fw/api/config.h"
1414 #include "fw/api/nvm-reg.h"
15−#include "fw/img.h"
1615 #include "iwl-trans.h"
1716
1817 #define BIOS_SAR_MAX_PROFILE_NUM 4
drivers/net/wireless/intel/iwlwifi/fw/runtime.h+0−2
@@ -150,8 +150,6 @@ struct iwl_fw_runtime { · 149 unmodified lines
150150 unsigned long non_collect_ts_start[IWL_FW_INI_TIME_POINT_NUM];
151151 u32 *d3_debug_data;
152152 u32 lmac_err_id[MAX_NUM_LMAC];
153− u32 tcm_err_id[MAX_NUM_TCM];
154− u32 rcm_err_id[MAX_NUM_RCM];
155153 u32 umac_err_id;
156154
157155 struct iwl_txf_iter_data txf_iter_data;
drivers/net/wireless/intel/iwlwifi/fw/uefi.c+2−5
@@ -727,6 +727,8 @@ int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func, · 726 unmodified lines
727727 struct uefi_cnv_var_general_cfg *data;
728728 int ret = -EINVAL;
729729
730+ BUILD_BUG_ON(ARRAY_SIZE(data->functions) < DSM_FUNC_NUM_FUNCS);
731+
730732 /* Not supported function index */
731733 if (func >= DSM_FUNC_NUM_FUNCS || func == 5)
732734 return -EOPNOTSUPP;
@@ -742,11 +744,6 @@ int iwl_uefi_get_dsm(struct iwl_fw_runtime *fwrt, enum iwl_dsm_funcs func, · 9 unmodified lines
742744 goto out;
743745 }
744746
745− if (ARRAY_SIZE(data->functions) != UEFI_MAX_DSM_FUNCS) {
746− IWL_DEBUG_RADIO(fwrt, "Invalid size of DSM functions array\n");
747− goto out;
748− }
749−
750747 if (!(data->functions[DSM_FUNC_QUERY] & BIT(func))) {
751748 IWL_DEBUG_RADIO(fwrt, "DSM func %d not in 0x%x\n",
752749 func, data->functions[DSM_FUNC_QUERY]);
drivers/net/wireless/intel/iwlwifi/iwl-config.h+36−4
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/netdevice.h>
1212 #include <linux/ieee80211.h>
1313 #include <linux/nl80211.h>
14+#include <linux/module.h>
1415 #include <linux/mod_devicetable.h>
1516 #include "iwl-csr.h"
1617 #include "iwl-drv.h"
@@ -107,6 +108,9 @@ enum iwl_nvm_type { · 90 unmodified lines
107108 MODULE_FIRMWARE(pfx "-" __stringify(api) ".ucode"); \
108109 MODULE_FIRMWARE(pfx ".pnvm")
109110
111+#define IWL_CORE_FW(pfx, core) \
112+ MODULE_FIRMWARE(pfx "-c" __stringify(core) ".ucode")
113+
110114 static inline u8 num_of_ant(u8 mask)
111115 {
112116 return !!((mask) & ANT_A) +
@@ -192,8 +196,8 @@ struct iwl_family_base_params { · 79 unmodified lines
192196
193197 u8 max_ll_items;
194198 u8 led_compensation;
195− u8 ucode_api_max;
196− u8 ucode_api_min;
199+ u16 ucode_api_max;
200+ u16 ucode_api_min;
197201 u32 mac_addr_from_csr:10;
198202 u8 nvm_hw_section_num;
199203 netdev_features_t features;
@@ -210,6 +214,34 @@ struct iwl_family_base_params { · 10 unmodified lines
210214 const struct iwl_fw_mon_regs mon_dbgi_regs;
211215 };
212216
217+/*
218+ * FW is released as "core N release", and we used to have a
219+ * gap of 3 between the API version and core number. Now the
220+ * reported API version will be 1000 + core and we encode it
221+ * in the filename as "c<core>".
222+ */
223+#define API_IS_CORE_START 1000
224+#define API_TO_CORE_OFFS 3
225+#define ENCODE_CORE_AS_API(core) (API_IS_CORE_START + (core))
226+
227+static inline bool iwl_api_is_core_number(int api)
228+{
229+ return api >= API_IS_CORE_START;
230+}
231+
232+static inline int iwl_api_to_core(int api)
233+{
234+ if (iwl_api_is_core_number(api))
235+ return api - API_IS_CORE_START;
236+
237+ return api - API_TO_CORE_OFFS;
238+}
239+
240+#define FW_API_FMT "%s%d"
241+#define FW_API_ARG(n) \
242+ iwl_api_is_core_number(n) ? "c" : "", \
243+ iwl_api_is_core_number(n) ? (n) - API_IS_CORE_START : (n)
244+
213245 /*
214246 * @stbc: support Tx STBC and 1*SS Rx STBC
215247 * @ldpc: support Tx/Rx with LDPC
@@ -422,8 +454,8 @@ struct iwl_rf_cfg { · 206 unmodified lines
422454 u8 valid_tx_ant;
423455 u8 valid_rx_ant;
424456 u8 non_shared_ant;
425− u8 ucode_api_max;
426− u8 ucode_api_min;
457+ u16 ucode_api_max;
458+ u16 ucode_api_min;
427459 u16 num_rbds;
428460 };
429461
drivers/net/wireless/intel/iwlwifi/iwl-drv.c+36−11
@@ -337,10 +337,18 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) · 336 unmodified lines
337337 return -EINVAL;
338338 }
339339
340+ if (CSR_HW_RFID_TYPE(drv->trans->info.hw_rf_id) == IWL_CFG_RF_TYPE_WH &&
341+ CSR_HW_RFID_STEP(drv->trans->info.hw_rf_id) == SILICON_A_STEP) {
342+ IWL_ERR(drv, "WH A step is not supported\n");
343+ return -EINVAL;
344+ }
345+
340346 fw_name_pre = iwl_drv_get_fwname_pre(drv->trans, _fw_name_pre);
341347
342348 if (first)
343349 drv->fw_index = ucode_api_max;
350+ else if (drv->fw_index == ENCODE_CORE_AS_API(99))
351+ drv->fw_index = 101; /* last API-scheme number below core 99 */
344352 else
345353 drv->fw_index--;
346354
@@ -348,13 +356,15 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) · 1 unmodified line
348356 IWL_ERR(drv, "no suitable firmware found!\n");
349357
350358 if (ucode_api_min == ucode_api_max) {
351− IWL_ERR(drv, "%s-%d is required\n", fw_name_pre,
352− ucode_api_max);
359+ IWL_ERR(drv, "%s-" FW_API_FMT " is required\n",
360+ fw_name_pre, FW_API_ARG(ucode_api_max));
353361 } else {
354− IWL_ERR(drv, "minimum version required: %s-%d\n",
355− fw_name_pre, ucode_api_min);
356− IWL_ERR(drv, "maximum version supported: %s-%d\n",
357− fw_name_pre, ucode_api_max);
362+ IWL_ERR(drv,
363+ "minimum version required: %s-" FW_API_FMT "\n",
364+ fw_name_pre, FW_API_ARG(ucode_api_min));
365+ IWL_ERR(drv,
366+ "maximum version supported: %s-" FW_API_FMT "\n",
367+ fw_name_pre, FW_API_ARG(ucode_api_max));
358368 }
359369
360370 IWL_ERR(drv,
@@ -362,8 +372,9 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) · 1 unmodified line
362372 return -ENOENT;
363373 }
364374
365− snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s-%d.ucode",
366− fw_name_pre, drv->fw_index);
375+ snprintf(drv->firmware_name, sizeof(drv->firmware_name),
376+ "%s-" FW_API_FMT ".ucode",
377+ fw_name_pre, FW_API_ARG(drv->fw_index));
367378
368379 IWL_DEBUG_FW_INFO(drv, "attempting to load firmware '%s'\n",
369380 drv->firmware_name);
@@ -1588,6 +1599,7 @@ static void _iwl_op_mode_stop(struct iwl_drv *drv) · 1218 unmodified lines
15881599 */
15891600 static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
15901601 {
1602+ unsigned int min_core, max_core, loaded_core;
15911603 struct iwl_drv *drv = context;
15921604 struct iwl_fw *fw = &drv->fw;
15931605 const struct iwl_ucode_header *ucode;
@@ -1650,11 +1662,24 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) · 56 unmodified lines
16501662 * firmware filename ... but we don't check for that and only rely
16511663 * on the API version read from firmware header from here on forward
16521664 */
1653− if (api_ver < api_min || api_ver > api_max) {
1665+
1666+ /*
1667+ * if -cN.ucode file was loaded, core version == file version,
1668+ * otherwise core version == file version (API version) - 3
1669+ */
1670+ if (iwl_api_is_core_number(drv->fw_index))
1671+ loaded_core = api_ver;
1672+ else
1673+ loaded_core = api_ver - API_TO_CORE_OFFS;
1674+
1675+ min_core = iwl_api_to_core(api_min);
1676+ max_core = iwl_api_to_core(api_max);
1677+
1678+ if (loaded_core < min_core || loaded_core > max_core) {
16541679 IWL_ERR(drv,
16551680 "Driver unable to support your firmware API. "
1656− "Driver supports v%u, firmware is v%u.\n",
1657− api_max, api_ver);
1681+ "Driver supports FW core %u..%u, firmware is %u.\n",
1682+ min_core, max_core, loaded_core);
16581683 goto try_again;
16591684 }
16601685
drivers/net/wireless/intel/iwlwifi/iwl-io.c+5−90
@@ -3,7 +3,6 @@ · 2 unmodified lines
33 * Copyright (C) 2003-2014, 2018-2022, 2024-2025 Intel Corporation
44 * Copyright (C) 2015-2016 Intel Deutschland GmbH
55 */
6−#include <linux/delay.h>
76 #include <linux/device.h>
87 #include <linux/export.h>
98
@@ -13,6 +12,7 @@ · 3 unmodified lines
1312 #include "iwl-debug.h"
1413 #include "iwl-prph.h"
1514 #include "iwl-fh.h"
15+#include "pcie/gen1_2/internal.h"
1616
1717 void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val)
1818 {
@@ -160,7 +160,7 @@ int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr, · 141 unmodified lines
160160
161161 do {
162162 if ((iwl_read_prph(trans, addr) & mask) == (bits & mask))
163− return t;
163+ return 0;
164164 udelay(IWL_POLL_INTERVAL);
165165 t += IWL_POLL_INTERVAL;
166166 } while (t < timeout);
@@ -396,96 +396,11 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf) · 229 unmodified lines
396396 return 0;
397397 }
398398
399−#define IWL_HOST_MON_BLOCK_PEMON 0x00
400−#define IWL_HOST_MON_BLOCK_HIPM 0x22
401−
402−#define IWL_HOST_MON_BLOCK_PEMON_VEC0 0x00
403−#define IWL_HOST_MON_BLOCK_PEMON_VEC1 0x01
404−#define IWL_HOST_MON_BLOCK_PEMON_WFPM 0x06
405−
406−static void iwl_dump_host_monitor_block(struct iwl_trans *trans,
407− u32 block, u32 vec, u32 iter)
408−{
409− int i;
410−
411− IWL_ERR(trans, "Host monitor block 0x%x vector 0x%x\n", block, vec);
412− iwl_write32(trans, CSR_MONITOR_CFG_REG, (block << 8) | vec);
413− for (i = 0; i < iter; i++)
414− IWL_ERR(trans, " value [iter %d]: 0x%08x\n",
415− i, iwl_read32(trans, CSR_MONITOR_STATUS_REG));
416−}
417−
418−static void iwl_dump_host_monitor(struct iwl_trans *trans)
419−{
420− switch (trans->mac_cfg->device_family) {
421− case IWL_DEVICE_FAMILY_22000:
422− case IWL_DEVICE_FAMILY_AX210:
423− IWL_ERR(trans, "CSR_RESET = 0x%x\n",
424− iwl_read32(trans, CSR_RESET));
425− iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON,
426− IWL_HOST_MON_BLOCK_PEMON_VEC0, 15);
427− iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON,
428− IWL_HOST_MON_BLOCK_PEMON_VEC1, 15);
429− iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON,
430− IWL_HOST_MON_BLOCK_PEMON_WFPM, 15);
431− iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_HIPM,
432− IWL_HOST_MON_BLOCK_PEMON_VEC0, 1);
433− break;
434− default:
435− /* not supported yet */
436− return;
437− }
438−}
439−
440−int iwl_finish_nic_init(struct iwl_trans *trans)
399+int iwl_trans_activate_nic(struct iwl_trans *trans)
441400 {
442− const struct iwl_mac_cfg *mac_cfg = trans->mac_cfg;
443− u32 poll_ready;
444− int err;
445−
446− if (mac_cfg->bisr_workaround) {
447− /* ensure the TOP FSM isn't still in previous reset */
448− mdelay(2);
449− }
450−
451− /*
452− * Set "initialization complete" bit to move adapter from
453− * D0U* --> D0A* (powered-up active) state.
454− */
455− if (mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) {
456− iwl_set_bit(trans, CSR_GP_CNTRL,
457− CSR_GP_CNTRL_REG_FLAG_BZ_MAC_ACCESS_REQ |
458− CSR_GP_CNTRL_REG_FLAG_MAC_INIT);
459− poll_ready = CSR_GP_CNTRL_REG_FLAG_MAC_STATUS;
460− } else {
461− iwl_set_bit(trans, CSR_GP_CNTRL,
462− CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
463− poll_ready = CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY;
464− }
465−
466− if (mac_cfg->device_family == IWL_DEVICE_FAMILY_8000)
467− udelay(2);
468−
469− /*
470− * Wait for clock stabilization; once stabilized, access to
471− * device-internal resources is supported, e.g. iwl_write_prph()
472− * and accesses to uCode SRAM.
473− */
474− err = iwl_poll_bits(trans, CSR_GP_CNTRL, poll_ready, 25000);
475− if (err < 0) {
476− IWL_DEBUG_INFO(trans, "Failed to wake NIC\n");
477−
478− iwl_dump_host_monitor(trans);
479− }
480−
481− if (mac_cfg->bisr_workaround) {
482− /* ensure BISR shift has finished */
483− udelay(200);
484− }
485−
486− return err < 0 ? err : 0;
401+ return iwl_pcie_gen1_2_activate_nic(trans);
487402 }
488−IWL_EXPORT_SYMBOL(iwl_finish_nic_init);
403+IWL_EXPORT_SYMBOL(iwl_trans_activate_nic);
489404
490405 void iwl_trans_sync_nmi_with_addr(struct iwl_trans *trans, u32 inta_addr,
491406 u32 sw_err_bit)
drivers/net/wireless/intel/iwlwifi/iwl-io.h+1−1
@@ -57,7 +57,7 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, · 56 unmodified lines
5757 void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
5858 void iwl_force_nmi(struct iwl_trans *trans);
5959
60−int iwl_finish_nic_init(struct iwl_trans *trans);
60+int iwl_trans_activate_nic(struct iwl_trans *trans);
6161
6262 /* Error handling */
6363 int iwl_dump_fh(struct iwl_trans *trans, char **buf);
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c+5−75
@@ -139,50 +139,6 @@ static struct ieee80211_rate iwl_cfg80211_rates[] = { · 138 unmodified lines
139139 #define RATES_52_OFFS 4
140140 #define N_RATES_52 (N_RATES_24 - RATES_52_OFFS)
141141
142−/**
143− * enum iwl_nvm_channel_flags - channel flags in NVM
144− * @NVM_CHANNEL_VALID: channel is usable for this SKU/geo
145− * @NVM_CHANNEL_IBSS: usable as an IBSS channel and deprecated
146− * when %IWL_NVM_SBANDS_FLAGS_LAR enabled.
147− * @NVM_CHANNEL_ALLOW_20MHZ_ACTIVITY: active scanning allowed and
148− * AP allowed only in 20 MHz. Valid only
149− * when %IWL_NVM_SBANDS_FLAGS_LAR enabled.
150− * @NVM_CHANNEL_ACTIVE: active scanning allowed and allows IBSS
151− * when %IWL_NVM_SBANDS_FLAGS_LAR enabled.
152− * @NVM_CHANNEL_RADAR: radar detection required
153− * @NVM_CHANNEL_INDOOR_ONLY: only indoor use is allowed
154− * @NVM_CHANNEL_GO_CONCURRENT: GO operation is allowed when connected to BSS
155− * on same channel on 2.4 or same UNII band on 5.2
156− * @NVM_CHANNEL_UNIFORM: uniform spreading required
157− * @NVM_CHANNEL_20MHZ: 20 MHz channel okay
158− * @NVM_CHANNEL_40MHZ: 40 MHz channel okay
159− * @NVM_CHANNEL_80MHZ: 80 MHz channel okay
160− * @NVM_CHANNEL_160MHZ: 160 MHz channel okay
161− * @NVM_CHANNEL_DC_HIGH: DC HIGH required/allowed (?)
162− * @NVM_CHANNEL_VLP: client support connection to UHB VLP AP
163− * @NVM_CHANNEL_AFC: client support connection to UHB AFC AP
164− * @NVM_CHANNEL_VLP_AP_NOT_ALLOWED: UHB VLP AP not allowed,
165− * Valid only when %NVM_CHANNEL_VLP is enabled.
166− */
167−enum iwl_nvm_channel_flags {
168− NVM_CHANNEL_VALID = BIT(0),
169− NVM_CHANNEL_IBSS = BIT(1),
170− NVM_CHANNEL_ALLOW_20MHZ_ACTIVITY = BIT(2),
171− NVM_CHANNEL_ACTIVE = BIT(3),
172− NVM_CHANNEL_RADAR = BIT(4),
173− NVM_CHANNEL_INDOOR_ONLY = BIT(5),
174− NVM_CHANNEL_GO_CONCURRENT = BIT(6),
175− NVM_CHANNEL_UNIFORM = BIT(7),
176− NVM_CHANNEL_20MHZ = BIT(8),
177− NVM_CHANNEL_40MHZ = BIT(9),
178− NVM_CHANNEL_80MHZ = BIT(10),
179− NVM_CHANNEL_160MHZ = BIT(11),
180− NVM_CHANNEL_DC_HIGH = BIT(12),
181− NVM_CHANNEL_VLP = BIT(13),
182− NVM_CHANNEL_AFC = BIT(14),
183− NVM_CHANNEL_VLP_AP_NOT_ALLOWED = BIT(15),
184−};
185−
186142 /**
187143 * enum iwl_reg_capa_flags_v1 - global flags applied for the whole regulatory
188144 * domain.
@@ -282,30 +238,6 @@ enum iwl_reg_capa_flags_v4 { · 93 unmodified lines
282238 */
283239 #define REG_CAPA_V4_RESP_VER 8
284240
285−/**
286− * struct iwl_reg_capa - struct for global regulatory capabilities, Used for
287− * handling the different APIs of reg_capa_flags.
288− *
289− * @allow_40mhz: 11n channel with a width of 40Mhz is allowed
290− * for this regulatory domain.
291− * @allow_80mhz: 11ac channel with a width of 80Mhz is allowed
292− * for this regulatory domain (valid only in 5 and 6 Ghz).
293− * @allow_160mhz: 11ac channel with a width of 160Mhz is allowed
294− * for this regulatory domain (valid only in 5 and 6 Ghz).
295− * @allow_320mhz: 11be channel with a width of 320Mhz is allowed
296− * for this regulatory domain (valid only in 6 Ghz).
297− * @disable_11ax: 11ax is forbidden for this regulatory domain.
298− * @disable_11be: 11be is forbidden for this regulatory domain.
299− */
300−struct iwl_reg_capa {
301− bool allow_40mhz;
302− bool allow_80mhz;
303− bool allow_160mhz;
304− bool allow_320mhz;
305− bool disable_11ax;
306− bool disable_11be;
307−};
308−
309241 static inline void iwl_nvm_print_channel_flags(struct device *dev, u32 level,
310242 int chan, u32 flags)
311243 {
@@ -1042,10 +974,6 @@ iwl_nvm_fixup_sband_iftd(struct iwl_trans *trans, · 730 unmodified lines
1042974 iftype_data->he_cap.he_cap_elem.phy_cap_info[2] |=
1043975 IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO;
1044976
1045− if (fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_BROADCAST_TWT))
1046− iftype_data->he_cap.he_cap_elem.mac_cap_info[2] |=
1047− IEEE80211_HE_MAC_CAP2_BCAST_TWT;
1048−
1049977 if (trans->mac_cfg->device_family == IWL_DEVICE_FAMILY_22000 &&
1050978 !is_ap) {
1051979 iftype_data->vendor_elems.data = iwl_vendor_caps;
@@ -1600,9 +1528,10 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, · 548 unmodified lines
16001528 }
16011529 IWL_EXPORT_SYMBOL(iwl_parse_nvm_data);
16021530
1603−static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan,
1604− int ch_idx, u16 nvm_flags,
1605− struct iwl_reg_capa reg_capa)
1531+VISIBLE_IF_IWLWIFI_KUNIT
1532+u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan,
1533+ int ch_idx, u16 nvm_flags,
1534+ struct iwl_reg_capa reg_capa)
16061535 {
16071536 u32 flags = NL80211_RRF_NO_HT40;
16081537
@@ -1692,6 +1621,7 @@ static u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan, · 83 unmodified lines
16921621
16931622 return flags;
16941623 }
1624+EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_nvm_get_regdom_bw_flags);
16951625
16961626 static struct iwl_reg_capa iwl_get_reg_capa(u32 flags, u8 resp_ver)
16971627 {
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h+74−0
@@ -21,6 +21,80 @@ enum iwl_nvm_sbands_flags { · 20 unmodified lines
2121 IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ = BIT(1),
2222 };
2323
24+/**
25+ * struct iwl_reg_capa - struct for global regulatory capabilities, Used for
26+ * handling the different APIs of reg_capa_flags.
27+ *
28+ * @allow_40mhz: 11n channel with a width of 40Mhz is allowed
29+ * for this regulatory domain.
30+ * @allow_80mhz: 11ac channel with a width of 80Mhz is allowed
31+ * for this regulatory domain (valid only in 5 and 6 Ghz).
32+ * @allow_160mhz: 11ac channel with a width of 160Mhz is allowed
33+ * for this regulatory domain (valid only in 5 and 6 Ghz).
34+ * @allow_320mhz: 11be channel with a width of 320Mhz is allowed
35+ * for this regulatory domain (valid only in 6 Ghz).
36+ * @disable_11ax: 11ax is forbidden for this regulatory domain.
37+ * @disable_11be: 11be is forbidden for this regulatory domain.
38+ */
39+struct iwl_reg_capa {
40+ bool allow_40mhz;
41+ bool allow_80mhz;
42+ bool allow_160mhz;
43+ bool allow_320mhz;
44+ bool disable_11ax;
45+ bool disable_11be;
46+};
47+
48+/**
49+ * enum iwl_nvm_channel_flags - channel flags in NVM
50+ * @NVM_CHANNEL_VALID: channel is usable for this SKU/geo
51+ * @NVM_CHANNEL_IBSS: usable as an IBSS channel and deprecated
52+ * when %IWL_NVM_SBANDS_FLAGS_LAR enabled.
53+ * @NVM_CHANNEL_ALLOW_20MHZ_ACTIVITY: active scanning allowed and
54+ * AP allowed only in 20 MHz. Valid only
55+ * when %IWL_NVM_SBANDS_FLAGS_LAR enabled.
56+ * @NVM_CHANNEL_ACTIVE: active scanning allowed and allows IBSS
57+ * when %IWL_NVM_SBANDS_FLAGS_LAR enabled.
58+ * @NVM_CHANNEL_RADAR: radar detection required
59+ * @NVM_CHANNEL_INDOOR_ONLY: only indoor use is allowed
60+ * @NVM_CHANNEL_GO_CONCURRENT: GO operation is allowed when connected to BSS
61+ * on same channel on 2.4 or same UNII band on 5.2
62+ * @NVM_CHANNEL_UNIFORM: uniform spreading required
63+ * @NVM_CHANNEL_20MHZ: 20 MHz channel okay
64+ * @NVM_CHANNEL_40MHZ: 40 MHz channel okay
65+ * @NVM_CHANNEL_80MHZ: 80 MHz channel okay
66+ * @NVM_CHANNEL_160MHZ: 160 MHz channel okay
67+ * @NVM_CHANNEL_DC_HIGH: DC HIGH required/allowed (?)
68+ * @NVM_CHANNEL_VLP: client support connection to UHB VLP AP
69+ * @NVM_CHANNEL_AFC: client support connection to UHB AFC AP
70+ * @NVM_CHANNEL_VLP_AP_NOT_ALLOWED: UHB VLP AP not allowed,
71+ * Valid only when %NVM_CHANNEL_VLP is enabled.
72+ */
73+enum iwl_nvm_channel_flags {
74+ NVM_CHANNEL_VALID = BIT(0),
75+ NVM_CHANNEL_IBSS = BIT(1),
76+ NVM_CHANNEL_ALLOW_20MHZ_ACTIVITY = BIT(2),
77+ NVM_CHANNEL_ACTIVE = BIT(3),
78+ NVM_CHANNEL_RADAR = BIT(4),
79+ NVM_CHANNEL_INDOOR_ONLY = BIT(5),
80+ NVM_CHANNEL_GO_CONCURRENT = BIT(6),
81+ NVM_CHANNEL_UNIFORM = BIT(7),
82+ NVM_CHANNEL_20MHZ = BIT(8),
83+ NVM_CHANNEL_40MHZ = BIT(9),
84+ NVM_CHANNEL_80MHZ = BIT(10),
85+ NVM_CHANNEL_160MHZ = BIT(11),
86+ NVM_CHANNEL_DC_HIGH = BIT(12),
87+ NVM_CHANNEL_VLP = BIT(13),
88+ NVM_CHANNEL_AFC = BIT(14),
89+ NVM_CHANNEL_VLP_AP_NOT_ALLOWED = BIT(15),
90+};
91+
92+#if IS_ENABLED(CONFIG_IWLWIFI_KUNIT_TESTS)
93+u32 iwl_nvm_get_regdom_bw_flags(const u16 *nvm_chan,
94+ int ch_idx, u16 nvm_flags,
95+ struct iwl_reg_capa reg_capa);
96+#endif
97+
2498 /*
2599 * iwl_parse_nvm_data - parse NVM data and return values
26100 *
drivers/net/wireless/intel/iwlwifi/iwl-trans.c+34−37
@@ -268,9 +268,7 @@ static void iwl_trans_restart_wk(struct work_struct *wk) · 267 unmodified lines
268268
269269 struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
270270 struct device *dev,
271− const struct iwl_mac_cfg *mac_cfg,
272− unsigned int txcmd_size,
273− unsigned int txcmd_align)
271+ const struct iwl_mac_cfg *mac_cfg)
274272 {
275273 struct iwl_trans *trans;
276274 #ifdef CONFIG_LOCKDEP
@@ -292,22 +290,12 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size, · 15 unmodified lines
292290
293291 INIT_DELAYED_WORK(&trans->restart.wk, iwl_trans_restart_wk);
294292
295− snprintf(trans->dev_cmd_pool_name, sizeof(trans->dev_cmd_pool_name),
296− "iwl_cmd_pool:%s", dev_name(trans->dev));
297− trans->dev_cmd_pool =
298− kmem_cache_create(trans->dev_cmd_pool_name,
299− txcmd_size, txcmd_align,
300− SLAB_HWCACHE_ALIGN, NULL);
301− if (!trans->dev_cmd_pool)
302− return NULL;
303−
304293 return trans;
305294 }
306295
307296 void iwl_trans_free(struct iwl_trans *trans)
308297 {
309298 cancel_delayed_work_sync(&trans->restart.wk);
310− kmem_cache_destroy(trans->dev_cmd_pool);
311299 }
312300
313301 int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
@@ -318,9 +306,6 @@ int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) · 4 unmodified lines
318306 test_bit(STATUS_RFKILL_OPMODE, &trans->status)))
319307 return -ERFKILL;
320308
321− if (unlikely(test_bit(STATUS_SUSPENDED, &trans->status)))
322− return -EHOSTDOWN;
323−
324309 if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status)))
325310 return -EIO;
326311
@@ -348,6 +333,19 @@ int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) · 21 unmodified lines
348333 }
349334 IWL_EXPORT_SYMBOL(iwl_trans_send_cmd);
350335
336+struct iwl_device_tx_cmd *iwl_trans_alloc_tx_cmd(struct iwl_trans *trans)
337+{
338+ return iwl_pcie_gen1_2_alloc_tx_cmd(trans);
339+}
340+IWL_EXPORT_SYMBOL(iwl_trans_alloc_tx_cmd);
341+
342+void iwl_trans_free_tx_cmd(struct iwl_trans *trans,
343+ struct iwl_device_tx_cmd *dev_cmd)
344+{
345+ iwl_pcie_gen1_2_free_tx_cmd(trans, dev_cmd);
346+}
347+IWL_EXPORT_SYMBOL(iwl_trans_free_tx_cmd);
348+
351349 /* Comparator for struct iwl_hcmd_names.
352350 * Used in the binary search over a list of host commands.
353351 *
@@ -399,7 +397,7 @@ void iwl_trans_op_mode_enter(struct iwl_trans *trans, · 45 unmodified lines
399397
400398 WARN_ON_ONCE(!trans->conf.rx_mpdu_cmd);
401399
402− iwl_trans_pcie_op_mode_enter(trans);
400+ iwl_pcie_gen1_2_op_mode_enter(trans);
403401 }
404402 IWL_EXPORT_SYMBOL(iwl_trans_op_mode_enter);
405403
@@ -408,8 +406,6 @@ int iwl_trans_start_hw(struct iwl_trans *trans) · 2 unmodified lines
408406 might_sleep();
409407
410408 clear_bit(STATUS_TRANS_RESET_IN_PROGRESS, &trans->status);
411− /* opmode may not resume if it detects errors */
412− clear_bit(STATUS_SUSPENDED, &trans->status);
413409
414410 return iwl_trans_pcie_start_hw(trans);
415411 }
@@ -507,33 +503,19 @@ iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask, · 91 unmodified lines
507503 sanitize_ops, sanitize_ctx);
508504 }
509505
510−int iwl_trans_d3_suspend(struct iwl_trans *trans, bool test, bool reset)
506+int iwl_trans_d3_suspend(struct iwl_trans *trans, bool reset)
511507 {
512− int err;
513−
514508 might_sleep();
515509
516− err = iwl_trans_pcie_d3_suspend(trans, test, reset);
517−
518− if (!err)
519− set_bit(STATUS_SUSPENDED, &trans->status);
520−
521− return err;
510+ return iwl_trans_pcie_d3_suspend(trans, reset);
522511 }
523512 IWL_EXPORT_SYMBOL(iwl_trans_d3_suspend);
524513
525−int iwl_trans_d3_resume(struct iwl_trans *trans, enum iwl_d3_status *status,
526− bool test, bool reset)
514+int iwl_trans_d3_resume(struct iwl_trans *trans, bool reset)
527515 {
528− int err;
529−
530516 might_sleep();
531517
532− err = iwl_trans_pcie_d3_resume(trans, status, test, reset);
533−
534− clear_bit(STATUS_SUSPENDED, &trans->status);
535−
536− return err;
518+ return iwl_trans_pcie_d3_resume(trans, reset);
537519 }
538520 IWL_EXPORT_SYMBOL(iwl_trans_d3_resume);
539521
@@ -825,3 +807,18 @@ void iwl_trans_set_reduce_power(struct iwl_trans *trans, · 285 unmodified lines
825807 {
826808 iwl_trans_pcie_ctx_info_v2_set_reduce_power(trans, capa);
827809 }
810+
811+bool iwl_trans_is_pm_supported(struct iwl_trans *trans)
812+{
813+ if (WARN_ON(trans->mac_cfg->gen2))
814+ return false;
815+
816+ return iwl_pcie_gen1_is_pm_supported(trans);
817+}
818+IWL_EXPORT_SYMBOL(iwl_trans_is_pm_supported);
819+
820+bool iwl_trans_is_ltr_enabled(struct iwl_trans *trans)
821+{
822+ return iwl_pcie_gen1_2_is_ltr_enabled(trans);
823+}
824+IWL_EXPORT_SYMBOL(iwl_trans_is_ltr_enabled);
drivers/net/wireless/intel/iwlwifi/iwl-trans.h+27−54
@@ -274,16 +274,6 @@ static inline void iwl_free_rxb(struct iwl_rx_cmd_buffer *r) · 273 unmodified lines
274274 #define IWL_MAX_RX_HW_QUEUES 16
275275 #define IWL_9000_MAX_RX_HW_QUEUES 1
276276
277−/**
278− * enum iwl_d3_status - WoWLAN image/device status
279− * @IWL_D3_STATUS_ALIVE: firmware is still running after resume
280− * @IWL_D3_STATUS_RESET: device was reset while suspended
281− */
282−enum iwl_d3_status {
283− IWL_D3_STATUS_ALIVE,
284− IWL_D3_STATUS_RESET,
285−};
286−
287277 /**
288278 * enum iwl_trans_status: transport status flags
289279 * @STATUS_SYNC_HCMD_ACTIVE: a SYNC command is being processed
@@ -294,16 +284,12 @@ enum iwl_d3_status { · 4 unmodified lines
294284 * @STATUS_RFKILL_OPMODE: RF-kill state reported to opmode
295285 * @STATUS_FW_ERROR: the fw is in error state
296286 * @STATUS_TRANS_DEAD: trans is dead - avoid any read/write operation
297− * @STATUS_SUPPRESS_CMD_ERROR_ONCE: suppress "FW error in SYNC CMD" once,
298− * e.g. for testing
299287 * @STATUS_IN_SW_RESET: device is undergoing reset, cleared by opmode
300288 * via iwl_trans_finish_sw_reset()
301289 * @STATUS_RESET_PENDING: reset worker was scheduled, but didn't dump
302290 * the firmware state yet
303291 * @STATUS_TRANS_RESET_IN_PROGRESS: reset is still in progress, don't
304292 * attempt another reset yet
305− * @STATUS_SUSPENDED: device is suspended, don't send commands that
306− * aren't marked accordingly
307293 */
308294 enum iwl_trans_status {
309295 STATUS_SYNC_HCMD_ACTIVE,
@@ -314,11 +300,9 @@ enum iwl_trans_status { · 4 unmodified lines
314300 STATUS_RFKILL_OPMODE,
315301 STATUS_FW_ERROR,
316302 STATUS_TRANS_DEAD,
317− STATUS_SUPPRESS_CMD_ERROR_ONCE,
318303 STATUS_IN_SW_RESET,
319304 STATUS_RESET_PENDING,
320305 STATUS_TRANS_RESET_IN_PROGRESS,
321− STATUS_SUSPENDED,
322306 };
323307
324308 static inline int
@@ -658,8 +642,6 @@ struct iwl_pc_data { · 333 unmodified lines
658642 * @restart_required: indicates debug restart is required
659643 * @last_tp_resetfw: last handling of reset during debug timepoint
660644 * @imr_data: IMR debug data allocation
661− * @dump_file_name_ext: dump file name extension
662− * @dump_file_name_ext_valid: dump file name extension if valid or not
663645 * @num_pc: number of program counter for cpu
664646 * @pc_data: details of the program counter
665647 * @yoyo_bin_loaded: tells if a yoyo debug file has been loaded
@@ -698,8 +680,6 @@ struct iwl_trans_debug { · 32 unmodified lines
698680 bool restart_required;
699681 u32 last_tp_resetfw;
700682 struct iwl_imr_data imr_data;
701− u8 dump_file_name_ext[IWL_FW_INI_MAX_NAME];
702− bool dump_file_name_ext_valid;
703683 u32 num_pc;
704684 struct iwl_pc_data *pc_data;
705685 bool yoyo_bin_loaded;
@@ -830,7 +810,6 @@ struct iwl_txq { · 124 unmodified lines
830810 * @hw_rf_id: the device RF ID
831811 * @hw_cnv_id: the device CNV ID
832812 * @hw_crf_id: the device CRF ID
833− * @hw_wfpm_id: the device wfpm ID
834813 * @hw_id: the ID of the device / sub-device
835814 * Bits 0:15 represent the sub-device ID
836815 * Bits 16:31 represent the device ID.
@@ -846,7 +825,6 @@ struct iwl_trans_info { · 9 unmodified lines
846825 u32 hw_rf_id;
847826 u32 hw_crf_id;
848827 u32 hw_cnv_id;
849− u32 hw_wfpm_id;
850828 u32 hw_id;
851829 u8 pcie_link_speed;
852830 u8 num_rxqs;
@@ -866,14 +844,11 @@ struct iwl_trans_info { · 13 unmodified lines
866844 * @dev: pointer to struct device * that represents the device
867845 * @info: device information for use by other layers
868846 * @pnvm_loaded: indicates PNVM was loaded
869− * @pm_support: set to true in start_hw if link pm is supported
870− * @ltr_enabled: set to true if the LTR is enabled
847+ * @suppress_cmd_error_once: suppress "FW error in SYNC CMD" once,
848+ * e.g. for testing
871849 * @fail_to_parse_pnvm_image: set to true if pnvm parsing failed
872850 * @reduce_power_loaded: indicates reduced power section was loaded
873851 * @failed_to_load_reduce_power_image: set to true if pnvm loading failed
874− * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only.
875− * The user should use iwl_trans_{alloc,free}_tx_cmd.
876− * @dev_cmd_pool_name: name for the TX command allocation pool
877852 * @dbgfs_dir: iwlwifi debugfs base dir for this device
878853 * @sync_cmd_lockdep_map: lockdep map for checking sync commands
879854 * @dbg: additional debug data, see &struct iwl_trans_debug
@@ -905,18 +880,13 @@ struct iwl_trans { · 25 unmodified lines
905880 const struct iwl_trans_info info;
906881 bool reduced_cap_sku;
907882 bool step_urm;
883+ bool suppress_cmd_error_once;
908884
909− bool pm_support;
910− bool ltr_enabled;
911885 u8 pnvm_loaded:1;
912886 u8 fail_to_parse_pnvm_image:1;
913887 u8 reduce_power_loaded:1;
914888 u8 failed_to_load_reduce_power_image:1;
915889
916− /* The following fields are internal only */
917− struct kmem_cache *dev_cmd_pool;
918− char dev_cmd_pool_name[50];
919−
920890 struct dentry *dbgfs_dir;
921891
922892 #ifdef CONFIG_LOCKDEP
@@ -956,29 +926,21 @@ int iwl_trans_start_fw(struct iwl_trans *trans, const struct iwl_fw *fw, · 33 unmodified lines
956926
957927 void iwl_trans_stop_device(struct iwl_trans *trans);
958928
959−int iwl_trans_d3_suspend(struct iwl_trans *trans, bool test, bool reset);
929+int iwl_trans_d3_suspend(struct iwl_trans *trans, bool reset);
960930
961−int iwl_trans_d3_resume(struct iwl_trans *trans, enum iwl_d3_status *status,
962− bool test, bool reset);
931+int iwl_trans_d3_resume(struct iwl_trans *trans, bool reset);
963932
964933 struct iwl_trans_dump_data *
965934 iwl_trans_dump_data(struct iwl_trans *trans, u32 dump_mask,
966935 const struct iwl_dump_sanitize_ops *sanitize_ops,
967936 void *sanitize_ctx);
968937
969−static inline struct iwl_device_tx_cmd *
970−iwl_trans_alloc_tx_cmd(struct iwl_trans *trans)
971−{
972− return kmem_cache_zalloc(trans->dev_cmd_pool, GFP_ATOMIC);
973−}
938+struct iwl_device_tx_cmd *iwl_trans_alloc_tx_cmd(struct iwl_trans *trans);
974939
975940 int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
976941
977−static inline void iwl_trans_free_tx_cmd(struct iwl_trans *trans,
978− struct iwl_device_tx_cmd *dev_cmd)
979−{
980− kmem_cache_free(trans->dev_cmd_pool, dev_cmd);
981−}
942+void iwl_trans_free_tx_cmd(struct iwl_trans *trans,
943+ struct iwl_device_tx_cmd *dev_cmd);
982944
983945 int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
984946 struct iwl_device_tx_cmd *dev_cmd, int queue);
@@ -1205,9 +1167,7 @@ static inline void iwl_trans_finish_sw_reset(struct iwl_trans *trans) · 220 unmodified lines
12051167 *****************************************************/
12061168 struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
12071169 struct device *dev,
1208− const struct iwl_mac_cfg *mac_cfg,
1209− unsigned int txcmd_size,
1210− unsigned int txcmd_align);
1170+ const struct iwl_mac_cfg *mac_cfg);
12111171 void iwl_trans_free(struct iwl_trans *trans);
12121172
12131173 static inline bool iwl_trans_is_hw_error_value(u32 val)
@@ -1230,11 +1190,6 @@ static inline u16 iwl_trans_get_num_rbds(struct iwl_trans *trans) · 16 unmodified lines
12301190 return result;
12311191 }
12321192
1233−static inline void iwl_trans_suppress_cmd_error_once(struct iwl_trans *trans)
1234−{
1235− set_bit(STATUS_SUPPRESS_CMD_ERROR_ONCE, &trans->status);
1236−}
1237−
12381193 static inline bool iwl_trans_device_enabled(struct iwl_trans *trans)
12391194 {
12401195 return test_bit(STATUS_DEVICE_ENABLED, &trans->status);
@@ -1245,6 +1200,20 @@ static inline bool iwl_trans_is_dead(struct iwl_trans *trans) · 4 unmodified lines
12451200 return test_bit(STATUS_TRANS_DEAD, &trans->status);
12461201 }
12471202
1203+static inline bool iwl_trans_is_fw_error(struct iwl_trans *trans)
1204+{
1205+ return test_bit(STATUS_FW_ERROR, &trans->status);
1206+}
1207+
1208+/*
1209+ * This function notifies the transport layer of firmware error, the recovery
1210+ * will be handled by the op mode
1211+ */
1212+static inline void iwl_trans_notify_fw_error(struct iwl_trans *trans)
1213+{
1214+ trans->state = IWL_TRANS_NO_FW;
1215+ set_bit(STATUS_FW_ERROR, &trans->status);
1216+}
12481217 /*****************************************************
12491218 * PCIe handling
12501219 *****************************************************/
@@ -1289,4 +1258,8 @@ static inline u16 iwl_trans_get_device_id(struct iwl_trans *trans) · 38 unmodified lines
12891258 return u32_get_bits(trans->info.hw_id, GENMASK(31, 16));
12901259 }
12911260
1261+bool iwl_trans_is_pm_supported(struct iwl_trans *trans);
1262+
1263+bool iwl_trans_is_ltr_enabled(struct iwl_trans *trans);
1264+
12921265 #endif /* __iwl_trans_h__ */
drivers/net/wireless/intel/iwlwifi/mei/sap.h+0−2
@@ -300,13 +300,11 @@ enum iwl_sap_msg { · 299 unmodified lines
300300 * @type: See &enum iwl_sap_msg.
301301 * @len: The length of the message (header not included).
302302 * @seq_num: For debug.
303− * @payload: The payload of the message.
304303 */
305304 struct iwl_sap_hdr {
306305 __le16 type;
307306 __le16 len;
308307 __le32 seq_num;
309− u8 payload[];
310308 };
311309
312310 /**
drivers/net/wireless/intel/iwlwifi/mld/d3.c+354−199
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include "mcc.h"
1212 #include "sta.h"
1313 #include "mlo.h"
14+#include "key.h"
1415
1516 #include "fw/api/d3.h"
1617 #include "fw/api/offload.h"
@@ -40,8 +41,6 @@ enum iwl_mld_d3_notif { · 23 unmodified lines
4041 struct iwl_mld_resume_key_iter_data {
4142 struct iwl_mld *mld;
4243 struct iwl_mld_wowlan_status *wowlan_status;
43− u32 num_keys, gtk_cipher, igtk_cipher, bigtk_cipher;
44− bool unhandled_cipher;
4544 };
4645
4746 struct iwl_mld_suspend_key_iter_data {
@@ -71,6 +70,12 @@ struct iwl_mld_mcast_key_data { · 23 unmodified lines
7170
7271 };
7372
73+struct iwl_mld_wowlan_mlo_key {
74+ u8 key[WOWLAN_KEY_MAX_SIZE];
75+ u8 idx, type, link_id;
76+ u8 pn[6];
77+};
78+
7479 /**
7580 * struct iwl_mld_wowlan_status - contains wowlan status data from
7681 * all wowlan notifications
@@ -89,6 +94,8 @@ struct iwl_mld_mcast_key_data { · 12 unmodified lines
8994 * @bigtk: data of the last two used gtk's by the FW upon resume
9095 * @ptk: last seq numbers per tid passed by the FW,
9196 * holds both in tkip and aes formats
97+ * @num_mlo_keys: number of &struct iwl_mld_wowlan_mlo_key structs
98+ * @mlo_keys: array of MLO keys
9299 */
93100 struct iwl_mld_wowlan_status {
94101 u32 wakeup_reasons;
@@ -108,6 +115,9 @@ struct iwl_mld_wowlan_status { · 13 unmodified lines
108115 struct ieee80211_key_seq tkip_seq[IWL_MAX_TID_COUNT];
109116
110117 } ptk;
118+
119+ int num_mlo_keys;
120+ struct iwl_mld_wowlan_mlo_key mlo_keys[WOWLAN_MAX_MLO_KEYS];
111121 };
112122
113123 #define NETDETECT_QUERY_BUF_LEN \
@@ -271,7 +281,7 @@ iwl_mld_convert_gtk_resume_seq(struct iwl_mld_mcast_key_data *gtk_data, · 157 unmodified lines
271281 static void
272282 iwl_mld_convert_gtk_resume_data(struct iwl_mld *mld,
273283 struct iwl_mld_wowlan_status *wowlan_status,
274− const struct iwl_wowlan_gtk_status_v3 *gtk_data,
284+ const struct iwl_wowlan_gtk_status *gtk_data,
275285 const struct iwl_wowlan_all_rsc_tsc_v5 *sc)
276286 {
277287 int status_idx = 0;
@@ -283,8 +293,9 @@ iwl_mld_convert_gtk_resume_data(struct iwl_mld *mld, · 5 unmodified lines
283293 for (int notif_idx = 0; notif_idx < ARRAY_SIZE(wowlan_status->gtk);
284294 notif_idx++) {
285295 int rsc_idx;
296+ u8 key_status = gtk_data[notif_idx].key_status;
286297
287− if (!(gtk_data[notif_idx].key_len))
298+ if (!key_status)
288299 continue;
289300
290301 wowlan_status->gtk[status_idx].len =
@@ -294,10 +305,6 @@ iwl_mld_convert_gtk_resume_data(struct iwl_mld *mld, · 3 unmodified lines
294305 wowlan_status->gtk[status_idx].id =
295306 wowlan_status->gtk[status_idx].flags &
296307 IWL_WOWLAN_GTK_IDX_MASK;
297− memcpy(wowlan_status->gtk[status_idx].key,
298− gtk_data[notif_idx].key,
299− sizeof(gtk_data[notif_idx].key));
300−
301308 /* The rsc for both gtk keys are stored in gtk[0]->sc->mcast_rsc
302309 * The gtk ids can be any two numbers between 0 and 3,
303310 * the id_map maps between the key id and the index in sc->mcast
@@ -307,13 +314,27 @@ iwl_mld_convert_gtk_resume_data(struct iwl_mld *mld, · 3 unmodified lines
307314 iwl_mld_convert_gtk_resume_seq(&wowlan_status->gtk[status_idx],
308315 sc, rsc_idx);
309316
310− /* if it's as long as the TKIP encryption key, copy MIC key */
311− if (wowlan_status->gtk[status_idx].len ==
312− NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY)
313− memcpy(wowlan_status->gtk[status_idx].key +
314− NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY,
315− gtk_data[notif_idx].tkip_mic_key,
316− sizeof(gtk_data[notif_idx].tkip_mic_key));
317+ if (key_status == IWL_WOWLAN_STATUS_NEW_KEY) {
318+ memcpy(wowlan_status->gtk[status_idx].key,
319+ gtk_data[notif_idx].key,
320+ sizeof(gtk_data[notif_idx].key));
321+
322+ /* if it's as long as the TKIP encryption key,
323+ * copy MIC key
324+ */
325+ if (wowlan_status->gtk[status_idx].len ==
326+ NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY)
327+ memcpy(wowlan_status->gtk[status_idx].key +
328+ NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY,
329+ gtk_data[notif_idx].tkip_mic_key,
330+ sizeof(gtk_data[notif_idx].tkip_mic_key));
331+ } else {
332+ /* If the key status is WOWLAN_STATUS_OLD_KEY, it
333+ * indicates that no key material is present, Set the
334+ * key length to 0 as an indication
335+ */
336+ wowlan_status->gtk[status_idx].len = 0;
337+ }
317338 status_idx++;
318339 }
319340 }
@@ -360,11 +381,11 @@ static void · 40 unmodified lines
360381 iwl_mld_convert_igtk_resume_data(struct iwl_mld_wowlan_status *wowlan_status,
361382 const struct iwl_wowlan_igtk_status *igtk)
362383 {
363− BUILD_BUG_ON(sizeof(wowlan_status->igtk.key) < sizeof(igtk->key));
364−
365− if (!igtk->key_len)
384+ if (!igtk->key_status)
366385 return;
367386
387+ BUILD_BUG_ON(sizeof(wowlan_status->igtk.key) < sizeof(igtk->key));
388+
368389 wowlan_status->igtk.len = igtk->key_len;
369390 wowlan_status->igtk.flags = igtk->key_flags;
370391 wowlan_status->igtk.id =
@@ -372,7 +393,15 @@ iwl_mld_convert_igtk_resume_data(struct iwl_mld_wowlan_status *wowlan_status, · 1 unmodified line
372393 IWL_WOWLAN_IGTK_BIGTK_IDX_MASK) +
373394 WOWLAN_IGTK_MIN_INDEX;
374395
375− memcpy(wowlan_status->igtk.key, igtk->key, sizeof(igtk->key));
396+ if (igtk->key_status == IWL_WOWLAN_STATUS_NEW_KEY)
397+ memcpy(wowlan_status->igtk.key, igtk->key, sizeof(igtk->key));
398+ else
399+ /* If the key status is WOWLAN_STATUS_OLD_KEY, it indicates
400+ * that no key material is present. Set the key length to 0
401+ * as an indication.
402+ */
403+ wowlan_status->igtk.len = 0;
404+
376405 iwl_mld_convert_mcast_ipn(&wowlan_status->igtk, igtk);
377406 }
378407
@@ -386,7 +415,7 @@ iwl_mld_convert_bigtk_resume_data(struct iwl_mld_wowlan_status *wowlan_status, · 7 unmodified lines
386415
387416 for (int notif_idx = 0; notif_idx < WOWLAN_BIGTK_KEYS_NUM;
388417 notif_idx++) {
389− if (!bigtk[notif_idx].key_len)
418+ if (!bigtk[notif_idx].key_status)
390419 continue;
391420
392421 wowlan_status->bigtk[status_idx].len = bigtk[notif_idx].key_len;
@@ -399,32 +428,218 @@ iwl_mld_convert_bigtk_resume_data(struct iwl_mld_wowlan_status *wowlan_status, · 6 unmodified lines
399428
400429 BUILD_BUG_ON(sizeof(wowlan_status->bigtk[status_idx].key) <
401430 sizeof(bigtk[notif_idx].key));
402− memcpy(wowlan_status->bigtk[status_idx].key,
403− bigtk[notif_idx].key, sizeof(bigtk[notif_idx].key));
431+ if (bigtk[notif_idx].key_status == IWL_WOWLAN_STATUS_NEW_KEY)
432+ memcpy(wowlan_status->bigtk[status_idx].key,
433+ bigtk[notif_idx].key,
434+ sizeof(bigtk[notif_idx].key));
435+ else
436+ /* If the key status is WOWLAN_STATUS_OLD_KEY, it
437+ * indicates that no key material is present. Set the
438+ * key length to 0 as an indication.
439+ */
440+ wowlan_status->bigtk[status_idx].len = 0;
441+
404442 iwl_mld_convert_mcast_ipn(&wowlan_status->bigtk[status_idx],
405443 &bigtk[notif_idx]);
406444 status_idx++;
407445 }
408446 }
409447
448+static void
449+iwl_mld_convert_mlo_keys(struct iwl_mld *mld,
450+ const struct iwl_wowlan_info_notif *notif,
451+ struct iwl_mld_wowlan_status *wowlan_status)
452+{
453+ if (!notif->num_mlo_link_keys)
454+ return;
455+
456+ wowlan_status->num_mlo_keys = notif->num_mlo_link_keys;
457+
458+ if (IWL_FW_CHECK(mld, wowlan_status->num_mlo_keys > WOWLAN_MAX_MLO_KEYS,
459+ "Too many MLO keys: %d, max %d\n",
460+ wowlan_status->num_mlo_keys, WOWLAN_MAX_MLO_KEYS))
461+ wowlan_status->num_mlo_keys = WOWLAN_MAX_MLO_KEYS;
462+
463+ for (int i = 0; i < wowlan_status->num_mlo_keys; i++) {
464+ const struct iwl_wowlan_mlo_gtk *fw_mlo_key = &notif->mlo_gtks[i];
465+ struct iwl_mld_wowlan_mlo_key *driver_mlo_key =
466+ &wowlan_status->mlo_keys[i];
467+ u16 flags = le16_to_cpu(fw_mlo_key->flags);
468+
469+ driver_mlo_key->link_id =
470+ u16_get_bits(flags, WOWLAN_MLO_GTK_FLAG_LINK_ID_MSK);
471+ driver_mlo_key->type =
472+ u16_get_bits(flags, WOWLAN_MLO_GTK_FLAG_KEY_TYPE_MSK);
473+ driver_mlo_key->idx =
474+ u16_get_bits(flags, WOWLAN_MLO_GTK_FLAG_KEY_ID_MSK);
475+
476+ BUILD_BUG_ON(sizeof(driver_mlo_key->key) != sizeof(fw_mlo_key->key));
477+ BUILD_BUG_ON(sizeof(driver_mlo_key->pn) != sizeof(fw_mlo_key->pn));
478+
479+ memcpy(driver_mlo_key->key, fw_mlo_key->key, sizeof(fw_mlo_key->key));
480+ memcpy(driver_mlo_key->pn, fw_mlo_key->pn, sizeof(fw_mlo_key->pn));
481+ }
482+}
483+
484+static void
485+iwl_mld_convert_wowlan_notif_v5(const struct iwl_wowlan_info_notif_v5 *notif_v5,
486+ struct iwl_wowlan_info_notif *notif)
487+{
488+ /* Convert GTK from v3 to the new format */
489+ BUILD_BUG_ON(ARRAY_SIZE(notif->gtk) != ARRAY_SIZE(notif_v5->gtk));
490+
491+ for (int i = 0; i < ARRAY_SIZE(notif_v5->gtk); i++) {
492+ const struct iwl_wowlan_gtk_status_v3 *gtk_v3 = &notif_v5->gtk[i];
493+ struct iwl_wowlan_gtk_status *gtk = &notif->gtk[i];
494+
495+ /* Copy key material and metadata */
496+ BUILD_BUG_ON(sizeof(gtk->key) != sizeof(gtk_v3->key));
497+ BUILD_BUG_ON(sizeof(gtk->tkip_mic_key) != sizeof(gtk_v3->tkip_mic_key));
498+
499+ memcpy(gtk->key, gtk_v3->key, sizeof(gtk_v3->key));
500+
501+ gtk->key_len = gtk_v3->key_len;
502+ gtk->key_flags = gtk_v3->key_flags;
503+
504+ memcpy(gtk->tkip_mic_key, gtk_v3->tkip_mic_key,
505+ sizeof(gtk_v3->tkip_mic_key));
506+ gtk->sc = gtk_v3->sc;
507+
508+ /* Set key_status based on whether key material is present.
509+ * in v5, a key is either invalid (should be skipped) or has
510+ * both meta data and the key itself.
511+ */
512+ if (gtk_v3->key_len)
513+ gtk->key_status = IWL_WOWLAN_STATUS_NEW_KEY;
514+ }
515+
516+ /* Convert IGTK from v1 to the new format, only one IGTK is passed by FW */
517+ BUILD_BUG_ON(offsetof(struct iwl_wowlan_igtk_status, key_status) !=
518+ sizeof(struct iwl_wowlan_igtk_status_v1));
519+
520+ memcpy(&notif->igtk[0], &notif_v5->igtk[0],
521+ offsetof(struct iwl_wowlan_igtk_status, key_status));
522+
523+ /* Set key_status based on whether key material is present.
524+ * in v5, a key is either invalid (should be skipped) or has
525+ * both meta data and the key itself.
526+ */
527+ if (notif_v5->igtk[0].key_len)
528+ notif->igtk[0].key_status = IWL_WOWLAN_STATUS_NEW_KEY;
529+
530+ /* Convert BIGTK from v1 to the new format */
531+ BUILD_BUG_ON(ARRAY_SIZE(notif->bigtk) != ARRAY_SIZE(notif_v5->bigtk));
532+
533+ for (int i = 0; i < ARRAY_SIZE(notif_v5->bigtk); i++) {
534+ /* Copy everything until key_status */
535+ memcpy(&notif->bigtk[i], &notif_v5->bigtk[i],
536+ offsetof(struct iwl_wowlan_igtk_status, key_status));
537+
538+ /* Set key_status based on whether key material is present.
539+ * in v5, a key is either invalid (should be skipped) or has
540+ * both meta data and the key itself.
541+ */
542+ if (notif_v5->bigtk[i].key_len)
543+ notif->bigtk[i].key_status = IWL_WOWLAN_STATUS_NEW_KEY;
544+ }
545+
546+ notif->replay_ctr = notif_v5->replay_ctr;
547+ notif->pattern_number = notif_v5->pattern_number;
548+ notif->qos_seq_ctr = notif_v5->qos_seq_ctr;
549+ notif->wakeup_reasons = notif_v5->wakeup_reasons;
550+ notif->num_of_gtk_rekeys = notif_v5->num_of_gtk_rekeys;
551+ notif->transmitted_ndps = notif_v5->transmitted_ndps;
552+ notif->received_beacons = notif_v5->received_beacons;
553+ notif->tid_tear_down = notif_v5->tid_tear_down;
554+ notif->station_id = notif_v5->station_id;
555+ notif->num_mlo_link_keys = notif_v5->num_mlo_link_keys;
556+ notif->tid_offloaded_tx = notif_v5->tid_offloaded_tx;
557+
558+ /* Copy MLO GTK keys */
559+ if (notif_v5->num_mlo_link_keys) {
560+ memcpy(notif->mlo_gtks, notif_v5->mlo_gtks,
561+ notif_v5->num_mlo_link_keys * sizeof(struct iwl_wowlan_mlo_gtk));
562+ }
563+}
564+
565+static bool iwl_mld_validate_wowlan_notif_size(struct iwl_mld *mld,
566+ u32 len,
567+ u32 expected_len,
568+ u8 num_mlo_keys,
569+ int version)
570+{
571+ u32 len_with_mlo_keys;
572+
573+ if (IWL_FW_CHECK(mld, len < expected_len,
574+ "Invalid wowlan_info_notif v%d (expected=%u got=%u)\n",
575+ version, expected_len, len))
576+ return false;
577+
578+ len_with_mlo_keys = expected_len +
579+ (num_mlo_keys * sizeof(struct iwl_wowlan_mlo_gtk));
580+
581+ if (IWL_FW_CHECK(mld, len < len_with_mlo_keys,
582+ "Invalid wowlan_info_notif v%d with MLO keys (expected=%u got=%u)\n",
583+ version, len_with_mlo_keys, len))
584+ return false;
585+
586+ return true;
587+}
588+
410589 static bool
411590 iwl_mld_handle_wowlan_info_notif(struct iwl_mld *mld,
412591 struct iwl_mld_wowlan_status *wowlan_status,
413592 struct iwl_rx_packet *pkt)
414593 {
415− const struct iwl_wowlan_info_notif *notif = (void *)pkt->data;
416− u32 expected_len, len = iwl_rx_packet_payload_len(pkt);
417−
418− expected_len = sizeof(*notif);
594+ const struct iwl_wowlan_info_notif *notif;
595+ struct iwl_wowlan_info_notif *converted_notif __free(kfree) = NULL;
596+ u32 len = iwl_rx_packet_payload_len(pkt);
597+ int wowlan_info_ver = iwl_fw_lookup_notif_ver(mld->fw,
598+ PROT_OFFLOAD_GROUP,
599+ WOWLAN_INFO_NOTIFICATION,
600+ IWL_FW_CMD_VER_UNKNOWN);
601+
602+ if (wowlan_info_ver == 5) {
603+ /* v5 format - validate before conversion */
604+ const struct iwl_wowlan_info_notif_v5 *notif_v5 = (void *)pkt->data;
605+
606+ if (!iwl_mld_validate_wowlan_notif_size(mld, len,
607+ sizeof(*notif_v5),
608+ notif_v5->num_mlo_link_keys,
609+ 5))
610+ return true;
611+
612+ converted_notif = kzalloc(struct_size(converted_notif,
613+ mlo_gtks,
614+ notif_v5->num_mlo_link_keys),
615+ GFP_ATOMIC);
616+ if (!converted_notif) {
617+ IWL_ERR(mld,
618+ "Failed to allocate memory for converted wowlan_info_notif\n");
619+ return true;
620+ }
419621
420− if (IWL_FW_CHECK(mld, len < expected_len,
421− "Invalid wowlan_info_notif (expected=%ud got=%ud)\n",
422− expected_len, len))
622+ iwl_mld_convert_wowlan_notif_v5(notif_v5,
623+ converted_notif);
624+ notif = converted_notif;
625+ } else if (wowlan_info_ver == 6) {
626+ notif = (void *)pkt->data;
627+ if (!iwl_mld_validate_wowlan_notif_size(mld, len,
628+ sizeof(*notif),
629+ notif->num_mlo_link_keys,
630+ 6))
631+ return true;
632+ } else {
633+ /* smaller versions are not supported */
634+ IWL_WARN(mld,
635+ "Unsupported wowlan_info_notif version %d\n",
636+ wowlan_info_ver);
423637 return true;
638+ }
424639
425640 if (IWL_FW_CHECK(mld, notif->tid_offloaded_tx != IWL_WOWLAN_OFFLOAD_TID,
426641 "Invalid tid_offloaded_tx %d\n",
427− wowlan_status->tid_offloaded_tx))
642+ notif->tid_offloaded_tx))
428643 return true;
429644
430645 iwl_mld_convert_gtk_resume_data(mld, wowlan_status, notif->gtk,
@@ -442,8 +657,10 @@ iwl_mld_handle_wowlan_info_notif(struct iwl_mld *mld, · 11 unmodified lines
442657 wowlan_status->num_of_gtk_rekeys =
443658 le32_to_cpu(notif->num_of_gtk_rekeys);
444659 wowlan_status->wakeup_reasons = le32_to_cpu(notif->wakeup_reasons);
660+
661+ iwl_mld_convert_mlo_keys(mld, notif, wowlan_status);
662+
445663 return false;
446− /* TODO: mlo_links (task=MLO)*/
447664 }
448665
449666 static bool
@@ -619,8 +836,8 @@ iwl_mld_set_key_rx_seq_tids(struct ieee80211_key_conf *key, · 169 unmodified lines
619836 }
620837
621838 static void
622−iwl_mld_set_key_rx_seq(struct ieee80211_key_conf *key,
623− struct iwl_mld_mcast_key_data *key_data)
839+iwl_mld_update_mcast_rx_seq(struct ieee80211_key_conf *key,
840+ struct iwl_mld_mcast_key_data *key_data)
624841 {
625842 switch (key->cipher) {
626843 case WLAN_CIPHER_SUITE_CCMP:
@@ -687,132 +904,53 @@ iwl_mld_resume_keys_iter(struct ieee80211_hw *hw, · 60 unmodified lines
687904 struct iwl_mld_wowlan_status *wowlan_status = data->wowlan_status;
688905 u8 status_idx;
689906
690− /* TODO: check key link id (task=MLO) */
691− if (data->unhandled_cipher)
692− return;
693−
694− switch (key->cipher) {
695− case WLAN_CIPHER_SUITE_WEP40:
696− case WLAN_CIPHER_SUITE_WEP104:
697− /* ignore WEP completely, nothing to do */
698− return;
699− case WLAN_CIPHER_SUITE_CCMP:
700− case WLAN_CIPHER_SUITE_GCMP:
701− case WLAN_CIPHER_SUITE_GCMP_256:
702− case WLAN_CIPHER_SUITE_TKIP:
907+ if (key->keyidx >= 0 && key->keyidx <= 3) {
908+ /* PTK */
703909 if (sta) {
704910 iwl_mld_update_ptk_rx_seq(data->mld, wowlan_status,
705911 sta, key,
706912 key->cipher ==
707913 WLAN_CIPHER_SUITE_TKIP);
708− return;
914+ /* GTK */
915+ } else {
916+ status_idx = key->keyidx == wowlan_status->gtk[1].id;
917+ iwl_mld_update_mcast_rx_seq(key,
918+ &wowlan_status->gtk[status_idx]);
709919 }
920+ }
710921
711− if (WARN_ON(data->gtk_cipher &&
712− data->gtk_cipher != key->cipher))
713− return;
922+ /* IGTK */
923+ if (key->keyidx == 4 || key->keyidx == 5) {
924+ if (key->keyidx == wowlan_status->igtk.id)
925+ iwl_mld_update_mcast_rx_seq(key, &wowlan_status->igtk);
926+ }
714927
715− data->gtk_cipher = key->cipher;
716− status_idx = key->keyidx == wowlan_status->gtk[1].id;
717− iwl_mld_set_key_rx_seq(key, &wowlan_status->gtk[status_idx]);
718− break;
719− case WLAN_CIPHER_SUITE_BIP_GMAC_128:
720− case WLAN_CIPHER_SUITE_BIP_GMAC_256:
721− case WLAN_CIPHER_SUITE_BIP_CMAC_256:
722− case WLAN_CIPHER_SUITE_AES_CMAC:
723− if (key->keyidx == 4 || key->keyidx == 5) {
724− if (WARN_ON(data->igtk_cipher &&
725− data->igtk_cipher != key->cipher))
726− return;
727−
728− data->igtk_cipher = key->cipher;
729− if (key->keyidx == wowlan_status->igtk.id)
730− iwl_mld_set_key_rx_seq(key, &wowlan_status->igtk);
731− }
732− if (key->keyidx == 6 || key->keyidx == 7) {
733− if (WARN_ON(data->bigtk_cipher &&
734− data->bigtk_cipher != key->cipher))
735− return;
736−
737− data->bigtk_cipher = key->cipher;
738− status_idx = key->keyidx == wowlan_status->bigtk[1].id;
739− iwl_mld_set_key_rx_seq(key, &wowlan_status->bigtk[status_idx]);
740− }
741− break;
742− default:
743− data->unhandled_cipher = true;
744− return;
928+ /* BIGTK */
929+ if (key->keyidx == 6 || key->keyidx == 7) {
930+ status_idx = key->keyidx == wowlan_status->bigtk[1].id;
931+ iwl_mld_update_mcast_rx_seq(key,
932+ &wowlan_status->bigtk[status_idx]);
745933 }
746− data->num_keys++;
747934 }
748935
749936 static void
750937 iwl_mld_add_mcast_rekey(struct ieee80211_vif *vif,
751938 struct iwl_mld *mld,
752939 struct iwl_mld_mcast_key_data *key_data,
753− struct ieee80211_bss_conf *link_conf,
754− u32 cipher)
940+ struct ieee80211_bss_conf *link_conf)
755941 {
756942 struct ieee80211_key_conf *key_config;
757− struct {
758− struct ieee80211_key_conf conf;
759− u8 key[WOWLAN_KEY_MAX_SIZE];
760− } conf = {
761− .conf.cipher = cipher,
762− .conf.keyidx = key_data->id,
763− };
764943 int link_id = vif->active_links ? __ffs(vif->active_links) : -1;
765− u8 key[WOWLAN_KEY_MAX_SIZE];
766−
767− BUILD_BUG_ON(WLAN_KEY_LEN_CCMP != WLAN_KEY_LEN_GCMP);
768− BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_CCMP);
769− BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_GCMP_256);
770− BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_TKIP);
771− BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_BIP_GMAC_128);
772− BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_BIP_GMAC_256);
773− BUILD_BUG_ON(sizeof(conf.key) < WLAN_KEY_LEN_AES_CMAC);
774− BUILD_BUG_ON(sizeof(conf.key) < sizeof(key_data->key));
775944
776945 if (!key_data->len)
777946 return;
778947
779− switch (cipher) {
780− case WLAN_CIPHER_SUITE_CCMP:
781− case WLAN_CIPHER_SUITE_GCMP:
782− conf.conf.keylen = WLAN_KEY_LEN_CCMP;
783− break;
784− case WLAN_CIPHER_SUITE_GCMP_256:
785− conf.conf.keylen = WLAN_KEY_LEN_GCMP_256;
786− break;
787− case WLAN_CIPHER_SUITE_TKIP:
788− conf.conf.keylen = WLAN_KEY_LEN_TKIP;
789− break;
790− case WLAN_CIPHER_SUITE_BIP_GMAC_128:
791− conf.conf.keylen = WLAN_KEY_LEN_BIP_GMAC_128;
792− break;
793− case WLAN_CIPHER_SUITE_BIP_GMAC_256:
794− conf.conf.keylen = WLAN_KEY_LEN_BIP_GMAC_256;
795− break;
796− case WLAN_CIPHER_SUITE_AES_CMAC:
797− conf.conf.keylen = WLAN_KEY_LEN_AES_CMAC;
798− break;
799− case WLAN_CIPHER_SUITE_BIP_CMAC_256:
800− conf.conf.keylen = WLAN_KEY_LEN_BIP_CMAC_256;
801− break;
802− default:
803− WARN_ON(1);
804− }
805−
806− memcpy(conf.conf.key, key_data->key, conf.conf.keylen);
807−
808− memcpy(key, key_data->key, sizeof(key_data->key));
809−
810− key_config = ieee80211_gtk_rekey_add(vif, key_data->id, key,
811− sizeof(key), link_id);
948+ key_config = ieee80211_gtk_rekey_add(vif, key_data->id, key_data->key,
949+ sizeof(key_data->key), link_id);
812950 if (IS_ERR(key_config))
813951 return;
814952
815− iwl_mld_set_key_rx_seq(key_config, key_data);
953+ iwl_mld_update_mcast_rx_seq(key_config, key_data);
816954
817955 /* The FW holds only one igtk so we keep track of the valid one */
818956 if (key_config->keyidx == 4 || key_config->keyidx == 5) {
@@ -831,37 +969,78 @@ iwl_mld_add_mcast_rekey(struct ieee80211_vif *vif, · 12 unmodified lines
831969 }
832970
833971 /* Also keep track of the new BIGTK */
834− if ((key_config->keyidx == 6 || key_config->keyidx == 7) &&
835− vif->type == NL80211_IFTYPE_STATION) {
836− struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
837−
838− rcu_assign_pointer(mld_vif->bigtks[key_config->keyidx - 6], key_config);
839− }
972+ if (key_config->keyidx == 6 || key_config->keyidx == 7)
973+ iwl_mld_track_bigtk(mld, vif, key_config, true);
840974 }
841975
842976 static void
843−iwl_mld_add_all_rekeys(struct ieee80211_vif *vif,
977+iwl_mld_add_all_rekeys(struct iwl_mld *mld,
978+ struct ieee80211_vif *vif,
844979 struct iwl_mld_wowlan_status *wowlan_status,
845− struct iwl_mld_resume_key_iter_data *key_iter_data,
846980 struct ieee80211_bss_conf *link_conf)
847981 {
848982 int i;
849983
850984 for (i = 0; i < ARRAY_SIZE(wowlan_status->gtk); i++)
851− iwl_mld_add_mcast_rekey(vif, key_iter_data->mld,
852− &wowlan_status->gtk[i],
853− link_conf,
854− key_iter_data->gtk_cipher);
985+ iwl_mld_add_mcast_rekey(vif, mld, &wowlan_status->gtk[i],
986+ link_conf);
855987
856− iwl_mld_add_mcast_rekey(vif, key_iter_data->mld,
857− &wowlan_status->igtk,
858− link_conf, key_iter_data->igtk_cipher);
988+ iwl_mld_add_mcast_rekey(vif, mld, &wowlan_status->igtk, link_conf);
859989
860990 for (i = 0; i < ARRAY_SIZE(wowlan_status->bigtk); i++)
861− iwl_mld_add_mcast_rekey(vif, key_iter_data->mld,
862− &wowlan_status->bigtk[i],
863− link_conf,
864− key_iter_data->bigtk_cipher);
991+ iwl_mld_add_mcast_rekey(vif, mld, &wowlan_status->bigtk[i],
992+ link_conf);
993+}
994+
995+static void iwl_mld_mlo_rekey(struct iwl_mld *mld,
996+ struct iwl_mld_wowlan_status *wowlan_status,
997+ struct ieee80211_vif *vif)
998+{
999+ struct iwl_mld_old_mlo_keys *old_keys __free(kfree) = NULL;
1000+
1001+ IWL_DEBUG_WOWLAN(mld, "Num of MLO Keys: %d\n", wowlan_status->num_mlo_keys);
1002+
1003+ if (!wowlan_status->num_mlo_keys)
1004+ return;
1005+
1006+ for (int i = 0; i < wowlan_status->num_mlo_keys; i++) {
1007+ struct iwl_mld_wowlan_mlo_key *mlo_key = &wowlan_status->mlo_keys[i];
1008+ struct ieee80211_key_conf *key;
1009+ struct ieee80211_key_seq seq;
1010+ u8 link_id = mlo_key->link_id;
1011+
1012+ if (IWL_FW_CHECK(mld, mlo_key->link_id >= IEEE80211_MLD_MAX_NUM_LINKS ||
1013+ mlo_key->idx >= 8 ||
1014+ mlo_key->type >= WOWLAN_MLO_GTK_KEY_NUM_TYPES,
1015+ "Invalid MLO key link_id %d, idx %d, type %d\n",
1016+ mlo_key->link_id, mlo_key->idx, mlo_key->type))
1017+ continue;
1018+
1019+ if (!(vif->valid_links & BIT(link_id)) ||
1020+ (vif->active_links & BIT(link_id)))
1021+ continue;
1022+
1023+ IWL_DEBUG_WOWLAN(mld, "Add MLO key id %d, link id %d\n",
1024+ mlo_key->idx, link_id);
1025+
1026+ key = ieee80211_gtk_rekey_add(vif, mlo_key->idx, mlo_key->key,
1027+ sizeof(mlo_key->key), link_id);
1028+
1029+ if (IS_ERR(key))
1030+ continue;
1031+
1032+ /*
1033+ * mac80211 expects the PN in big-endian
1034+ * also note that seq is a union of all cipher types
1035+ * (ccmp, gcmp, cmac, gmac), and they all have the same
1036+ * pn field (of length 6) so just copy it to ccmp.pn.
1037+ */
1038+ for (int j = 5; j >= 0; j--)
1039+ seq.ccmp.pn[5 - j] = mlo_key->pn[j];
1040+
1041+ /* group keys are non-QoS and use TID 0 */
1042+ ieee80211_set_key_rx_seq(key, 0, &seq);
1043+ }
8651044 }
8661045
8671046 static bool
@@ -884,23 +1063,19 @@ iwl_mld_update_sec_keys(struct iwl_mld *mld, · 16 unmodified lines
8841063 ieee80211_iter_keys(mld->hw, vif, iwl_mld_resume_keys_iter,
8851064 &key_iter_data);
8861065
887− if (key_iter_data.unhandled_cipher)
888− return false;
889−
890− IWL_DEBUG_WOWLAN(mld,
891− "Number of installed keys: %d, Number of rekeys: %d\n",
892− key_iter_data.num_keys,
1066+ IWL_DEBUG_WOWLAN(mld, "Number of rekeys: %d\n",
8931067 wowlan_status->num_of_gtk_rekeys);
8941068
895− if (!key_iter_data.num_keys || !wowlan_status->num_of_gtk_rekeys)
1069+ if (!wowlan_status->num_of_gtk_rekeys)
8961070 return true;
8971071
898− iwl_mld_add_all_rekeys(vif, wowlan_status, &key_iter_data,
1072+ iwl_mld_add_all_rekeys(mld, vif, wowlan_status,
8991073 link_conf);
9001074
1075+ iwl_mld_mlo_rekey(mld, wowlan_status, vif);
1076+
9011077 ieee80211_gtk_rekey_notify(vif, link_conf->bssid,
9021078 (void *)&replay_ctr, GFP_KERNEL);
903− /* TODO: MLO rekey (task=MLO) */
9041079 return true;
9051080 }
9061081
@@ -1179,7 +1354,6 @@ static int iwl_mld_wait_d3_notif(struct iwl_mld *mld, · 272 unmodified lines
11791354 WIDE_ID(PROT_OFFLOAD_GROUP, D3_END_NOTIFICATION)
11801355 };
11811356 struct iwl_notification_wait wait_d3_notif;
1182− enum iwl_d3_status d3_status;
11831357 int ret;
11841358
11851359 if (with_wowlan)
@@ -1195,14 +1369,10 @@ static int iwl_mld_wait_d3_notif(struct iwl_mld *mld, · 9 unmodified lines
11951369 iwl_mld_handle_d3_notif,
11961370 resume_data);
11971371
1198− ret = iwl_trans_d3_resume(mld->trans, &d3_status, false, false);
1199− if (ret || d3_status != IWL_D3_STATUS_ALIVE) {
1200− if (d3_status != IWL_D3_STATUS_ALIVE) {
1201− IWL_INFO(mld, "Device was reset during suspend\n");
1202− ret = -ENOENT;
1203− } else {
1204− IWL_ERR(mld, "Transport resume failed\n");
1205− }
1372+ ret = iwl_trans_d3_resume(mld->trans, false);
1373+ if (ret) {
1374+ /* Avoid sending commands if the FW is dead */
1375+ iwl_trans_notify_fw_error(mld->trans);
12061376 iwl_remove_notification(&mld->notif_wait, &wait_d3_notif);
12071377 return ret;
12081378 }
@@ -1236,16 +1406,11 @@ int iwl_mld_no_wowlan_suspend(struct iwl_mld *mld) · 27 unmodified lines
12361406
12371407 iwl_mld_low_latency_stop(mld);
12381408
1239− /* This will happen if iwl_mld_supsend failed with FW error */
1240− if (mld->trans->state == IWL_TRANS_NO_FW &&
1241− test_bit(STATUS_FW_ERROR, &mld->trans->status))
1242− return -ENODEV;
1243−
12441409 ret = iwl_mld_update_device_power(mld, true);
12451410 if (ret) {
12461411 IWL_ERR(mld,
12471412 "d3 suspend: couldn't send power_device %d\n", ret);
1248− goto out;
1413+ return ret;
12491414 }
12501415
12511416 ret = iwl_mld_send_cmd_pdu(mld, D3_CONFIG_CMD,
@@ -1253,24 +1418,20 @@ int iwl_mld_no_wowlan_suspend(struct iwl_mld *mld) · 1 unmodified line
12531418 if (ret) {
12541419 IWL_ERR(mld,
12551420 "d3 suspend: couldn't send D3_CONFIG_CMD %d\n", ret);
1256− goto out;
1421+ return ret;
12571422 }
12581423
1259− ret = iwl_trans_d3_suspend(mld->trans, false, false);
1424+ ret = iwl_trans_d3_suspend(mld->trans, false);
12601425 if (ret) {
12611426 IWL_ERR(mld, "d3 suspend: trans_d3_suspend failed %d\n", ret);
1427+ /* We are going to stop the FW. Avoid sending commands in that flow */
1428+ iwl_trans_notify_fw_error(mld->trans);
12621429 } else {
12631430 /* Async notification might send hcmds, which is not allowed in suspend */
12641431 iwl_mld_cancel_async_notifications(mld);
12651432 mld->fw_status.in_d3 = true;
12661433 }
12671434
1268− out:
1269− if (ret) {
1270− mld->trans->state = IWL_TRANS_NO_FW;
1271− set_bit(STATUS_FW_ERROR, &mld->trans->status);
1272− }
1273−
12741435 return ret;
12751436 }
12761437
@@ -1290,15 +1451,12 @@ int iwl_mld_no_wowlan_resume(struct iwl_mld *mld) · 13 unmodified lines
12901451 iwl_fw_dbg_read_d3_debug_data(&mld->fwrt);
12911452
12921453 ret = iwl_mld_wait_d3_notif(mld, &resume_data, false);
1454+ if (ret)
1455+ return ret;
12931456
12941457 if (!ret && (resume_data.d3_end_flags & IWL_D0I3_RESET_REQUIRE))
12951458 return -ENODEV;
12961459
1297− if (ret) {
1298− mld->trans->state = IWL_TRANS_NO_FW;
1299− set_bit(STATUS_FW_ERROR, &mld->trans->status);
1300− return ret;
1301− }
13021460 iwl_mld_low_latency_restart(mld);
13031461
13041462 return iwl_mld_update_device_power(mld, false);
@@ -1530,7 +1688,8 @@ static void · 225 unmodified lines
15301688 iwl_mld_set_wowlan_config_cmd(struct iwl_mld *mld,
15311689 struct cfg80211_wowlan *wowlan,
15321690 struct iwl_wowlan_config_cmd *wowlan_config_cmd,
1533− struct ieee80211_sta *ap_sta)
1691+ struct ieee80211_sta *ap_sta,
1692+ struct ieee80211_bss_conf *link)
15341693 {
15351694 wowlan_config_cmd->is_11n_connection =
15361695 ap_sta->deflink.ht_cap.ht_supported;
@@ -1540,6 +1699,9 @@ iwl_mld_set_wowlan_config_cmd(struct iwl_mld *mld, · 3 unmodified lines
15401699 if (ap_sta->mfp)
15411700 wowlan_config_cmd->flags |= IS_11W_ASSOC;
15421701
1702+ if (iwl_mld_beacon_protection_enabled(mld, link))
1703+ wowlan_config_cmd->flags |= HAS_BEACON_PROTECTION;
1704+
15431705 if (wowlan->disconnect)
15441706 wowlan_config_cmd->wakeup_filter |=
15451707 cpu_to_le32(IWL_WOWLAN_WAKEUP_BEACON_MISS |
@@ -1737,7 +1899,7 @@ iwl_mld_wowlan_config(struct iwl_mld *mld, struct ieee80211_vif *bss_vif, · 191 unmodified lines
17371899 return ret;
17381900
17391901 iwl_mld_set_wowlan_config_cmd(mld, wowlan,
1740− &wowlan_config_cmd, ap_sta);
1902+ &wowlan_config_cmd, ap_sta, link_conf);
17411903 ret = iwl_mld_send_cmd_pdu(mld, WOWLAN_CONFIGURATION,
17421904 &wowlan_config_cmd);
17431905 if (ret)
@@ -1807,7 +1969,6 @@ int iwl_mld_wowlan_resume(struct iwl_mld *mld) · 63 unmodified lines
18071969 };
18081970 int link_id;
18091971 int ret;
1810− bool fw_err = false;
18111972
18121973 lockdep_assert_wiphy(mld->wiphy);
18131974
@@ -1850,7 +2011,6 @@ int iwl_mld_wowlan_resume(struct iwl_mld *mld) · 36 unmodified lines
18502011 ret = iwl_mld_wait_d3_notif(mld, &resume_data, true);
18512012 if (ret) {
18522013 IWL_ERR(mld, "Couldn't get the d3 notifs %d\n", ret);
1853− fw_err = true;
18542014 goto err;
18552015 }
18562016
@@ -1887,11 +2047,6 @@ int iwl_mld_wowlan_resume(struct iwl_mld *mld) · 30 unmodified lines
18872047 goto out;
18882048
18892049 err:
1890− if (fw_err) {
1891− mld->trans->state = IWL_TRANS_NO_FW;
1892− set_bit(STATUS_FW_ERROR, &mld->trans->status);
1893− }
1894−
18952050 mld->fw_status.in_hw_restart = true;
18962051 ret = 1;
18972052 out:
drivers/net/wireless/intel/iwlwifi/mld/debugfs.c+6−2
@@ -86,7 +86,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mld *mld, char *buf, · 85 unmodified lines
8686
8787 if (count == 6 && !strcmp(buf, "nolog\n")) {
8888 mld->fw_status.do_not_dump_once = true;
89− iwl_trans_suppress_cmd_error_once(mld->trans);
89+ mld->trans->suppress_cmd_error_once = true;
9090 }
9191
9292 /* take the return value to make compiler happy - it will
@@ -1001,8 +1001,12 @@ void iwl_mld_add_link_debugfs(struct ieee80211_hw *hw, · 908 unmodified lines
10011001 * If not, this is a per-link dir of a MLO vif, add in it the iwlmld
10021002 * dir.
10031003 */
1004− if (!mld_link_dir)
1004+ if (!mld_link_dir) {
10051005 mld_link_dir = debugfs_create_dir("iwlmld", dir);
1006+ } else {
1007+ /* Release the reference from debugfs_lookup */
1008+ dput(mld_link_dir);
1009+ }
10061010 }
10071011
10081012 static ssize_t _iwl_dbgfs_fixed_rate_write(struct iwl_mld *mld, char *buf,
drivers/net/wireless/intel/iwlwifi/mld/iface.c+11−28
@@ -115,20 +115,12 @@ static bool iwl_mld_is_nic_ack_enabled(struct iwl_mld *mld, · 114 unmodified lines
115115
116116 static void iwl_mld_set_he_support(struct iwl_mld *mld,
117117 struct ieee80211_vif *vif,
118− struct iwl_mac_config_cmd *cmd,
119− int cmd_ver)
118+ struct iwl_mac_config_cmd *cmd)
120119 {
121− if (vif->type == NL80211_IFTYPE_AP) {
122− if (cmd_ver == 2)
123− cmd->wifi_gen_v2.he_ap_support = cpu_to_le16(1);
124− else
125− cmd->wifi_gen.he_ap_support = 1;
126− } else {
127− if (cmd_ver == 2)
128− cmd->wifi_gen_v2.he_support = cpu_to_le16(1);
129− else
130− cmd->wifi_gen.he_support = 1;
131− }
120+ if (vif->type == NL80211_IFTYPE_AP)
121+ cmd->wifi_gen.he_ap_support = 1;
122+ else
123+ cmd->wifi_gen.he_support = 1;
132124 }
133125
134126 /* fill the common part for all interface types */
@@ -140,9 +132,6 @@ static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld, · 5 unmodified lines
140132 struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
141133 struct ieee80211_bss_conf *link_conf;
142134 unsigned int link_id;
143− int cmd_ver = iwl_fw_lookup_cmd_ver(mld->fw,
144− WIDE_ID(MAC_CONF_GROUP,
145− MAC_CONFIG_CMD), 0);
146135
147136 lockdep_assert_wiphy(mld->wiphy);
148137
@@ -169,11 +158,8 @@ static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld, · 20 unmodified lines
169158 * and enable both when we have MLO.
170159 */
171160 if (ieee80211_vif_is_mld(vif)) {
172− iwl_mld_set_he_support(mld, vif, cmd, cmd_ver);
173− if (cmd_ver == 2)
174− cmd->wifi_gen_v2.eht_support = cpu_to_le32(1);
175− else
176− cmd->wifi_gen.eht_support = 1;
161+ iwl_mld_set_he_support(mld, vif, cmd);
162+ cmd->wifi_gen.eht_support = 1;
177163 return;
178164 }
179165
@@ -181,7 +167,7 @@ static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld, · 1 unmodified line
181167 if (!link_conf->he_support)
182168 continue;
183169
184− iwl_mld_set_he_support(mld, vif, cmd, cmd_ver);
170+ iwl_mld_set_he_support(mld, vif, cmd);
185171
186172 /* EHT, if supported, was already set above */
187173 break;
@@ -451,24 +437,21 @@ int iwl_mld_add_vif(struct iwl_mld *mld, struct ieee80211_vif *vif) · 263 unmodified lines
451437 return ret;
452438 }
453439
454−int iwl_mld_rm_vif(struct iwl_mld *mld, struct ieee80211_vif *vif)
440+void iwl_mld_rm_vif(struct iwl_mld *mld, struct ieee80211_vif *vif)
455441 {
456442 struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
457− int ret;
458443
459444 lockdep_assert_wiphy(mld->wiphy);
460445
461− ret = iwl_mld_mac_fw_action(mld, vif, FW_CTXT_ACTION_REMOVE);
446+ iwl_mld_mac_fw_action(mld, vif, FW_CTXT_ACTION_REMOVE);
462447
463448 if (WARN_ON(mld_vif->fw_id >= ARRAY_SIZE(mld->fw_id_to_vif)))
464− return -EINVAL;
449+ return;
465450
466451 RCU_INIT_POINTER(mld->fw_id_to_vif[mld_vif->fw_id], NULL);
467452
468453 iwl_mld_cancel_notifications_of_object(mld, IWL_MLD_OBJECT_TYPE_VIF,
469454 mld_vif->fw_id);
470−
471− return ret;
472455 }
473456
474457 void iwl_mld_set_vif_associated(struct iwl_mld *mld,
drivers/net/wireless/intel/iwlwifi/mld/iface.h+1−4
@@ -125,8 +125,6 @@ struct iwl_mld_emlsr { · 124 unmodified lines
125125 * @ap_sta: pointer to AP sta, for easier access to it.
126126 * Relevant only for STA vifs.
127127 * @authorized: indicates the AP station was set to authorized
128− * @bigtks: BIGTKs of the AP, for beacon protection.
129− * Only valid for STA. (FIXME: needs to be per link)
130128 * @num_associated_stas: number of associated STAs. Relevant only for AP mode.
131129 * @ap_ibss_active: whether the AP/IBSS was started
132130 * @cca_40mhz_workaround: When we are connected in 2.4 GHz and 40 MHz, and the
@@ -158,7 +156,6 @@ struct iwl_mld_vif { · 25 unmodified lines
158156 struct iwl_mld_session_protect session_protect;
159157 struct ieee80211_sta *ap_sta;
160158 bool authorized;
161− struct ieee80211_key_conf __rcu *bigtks[2];
162159 u8 num_associated_stas;
163160 bool ap_ibss_active;
164161 enum iwl_mld_cca_40mhz_wa_status cca_40mhz_workaround;
@@ -227,7 +224,7 @@ void iwl_mld_cleanup_vif(void *data, u8 *mac, struct ieee80211_vif *vif); · 62 unmodified lines
227224 int iwl_mld_mac_fw_action(struct iwl_mld *mld, struct ieee80211_vif *vif,
228225 u32 action);
229226 int iwl_mld_add_vif(struct iwl_mld *mld, struct ieee80211_vif *vif);
230−int iwl_mld_rm_vif(struct iwl_mld *mld, struct ieee80211_vif *vif);
227+void iwl_mld_rm_vif(struct iwl_mld *mld, struct ieee80211_vif *vif);
231228 void iwl_mld_set_vif_associated(struct iwl_mld *mld,
232229 struct ieee80211_vif *vif);
233230 u8 iwl_mld_get_fw_bss_vifs_ids(struct iwl_mld *mld);
drivers/net/wireless/intel/iwlwifi/mld/key.c+38−0
@@ -368,3 +368,41 @@ int iwl_mld_update_sta_keys(struct iwl_mld *mld, · 367 unmodified lines
368368 &data);
369369 return data.err;
370370 }
371+
372+void iwl_mld_track_bigtk(struct iwl_mld *mld,
373+ struct ieee80211_vif *vif,
374+ struct ieee80211_key_conf *key, bool add)
375+{
376+ struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
377+ struct iwl_mld_link *link;
378+
379+ if (vif->type != NL80211_IFTYPE_STATION)
380+ return;
381+
382+ if (WARN_ON(key->keyidx < 6 || key->keyidx > 7))
383+ return;
384+
385+ if (WARN_ON(key->link_id < 0))
386+ return;
387+
388+ link = iwl_mld_link_dereference_check(mld_vif, key->link_id);
389+ if (WARN_ON(!link))
390+ return;
391+
392+ if (add)
393+ rcu_assign_pointer(link->bigtks[key->keyidx - 6], key);
394+ else
395+ RCU_INIT_POINTER(link->bigtks[key->keyidx - 6], NULL);
396+}
397+
398+bool iwl_mld_beacon_protection_enabled(struct iwl_mld *mld,
399+ struct ieee80211_bss_conf *link)
400+{
401+ struct iwl_mld_link *mld_link = iwl_mld_link_from_mac80211(link);
402+
403+ if (WARN_ON(!mld_link))
404+ return false;
405+
406+ return rcu_access_pointer(mld_link->bigtks[0]) ||
407+ rcu_access_pointer(mld_link->bigtks[1]);
408+}
drivers/net/wireless/intel/iwlwifi/mld/key.h+7−0
@@ -36,4 +36,11 @@ iwl_mld_cleanup_keys_iter(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 35 unmodified lines
3636 key->hw_key_idx = STA_KEY_IDX_INVALID;
3737 }
3838
39+void iwl_mld_track_bigtk(struct iwl_mld *mld,
40+ struct ieee80211_vif *vif,
41+ struct ieee80211_key_conf *key, bool add);
42+
43+bool iwl_mld_beacon_protection_enabled(struct iwl_mld *mld,
44+ struct ieee80211_bss_conf *link);
45+
3946 #endif /* __iwl_mld_key_h__ */
drivers/net/wireless/intel/iwlwifi/mld/link.c+18−8
@@ -532,7 +532,8 @@ void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld, · 531 unmodified lines
532532 le32_to_cpu(notif->consec_missed_beacons_other_link);
533533 struct ieee80211_bss_conf *link_conf =
534534 iwl_mld_fw_id_to_link_conf(mld, fw_link_id);
535− u32 bss_param_ch_cnt_link_id;
535+ struct ieee80211_bss_conf *other_link;
536+ u32 bss_param_ch_cnt_link_id, other_link_fw_id;
536537 struct ieee80211_vif *vif;
537538 u8 link_id;
538539
@@ -550,11 +551,6 @@ void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld, · 11 unmodified lines
550551 if (WARN_ON(!vif))
551552 return;
552553
553− mld->trans->dbg.dump_file_name_ext_valid = true;
554− snprintf(mld->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME,
555− "LinkId_%d_MacType_%d", fw_link_id,
556− iwl_mld_mac80211_iftype_to_fw(vif));
557−
558554 iwl_dbg_tlv_time_point(&mld->fwrt,
559555 IWL_FW_INI_TIME_POINT_MISSED_BEACONS, &tp_data);
560556
@@ -572,8 +568,11 @@ void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld, · 11 unmodified lines
572568 if (missed_bcon_since_rx > IWL_MLD_MISSED_BEACONS_THRESHOLD) {
573569 ieee80211_cqm_beacon_loss_notify(vif, GFP_ATOMIC);
574570
575− /* try to switch links, no-op if we don't have MLO */
576− iwl_mld_int_mlo_scan(mld, vif);
571+ /* Not in EMLSR and we can't hear the link.
572+ * Try to switch to a better link. EMLSR case is handled below.
573+ */
574+ if (!iwl_mld_emlsr_active(vif))
575+ iwl_mld_int_mlo_scan(mld, vif);
577576 }
578577
579578 /* no more logic if we're not in EMLSR */
@@ -584,6 +583,17 @@ void iwl_mld_handle_missed_beacon_notif(struct iwl_mld *mld, · 4 unmodified lines
584583 if (le32_to_cpu(notif->other_link_id) == FW_CTXT_ID_INVALID)
585584 return;
586585
586+ other_link_fw_id = le32_to_cpu(notif->other_link_id);
587+ other_link = iwl_mld_fw_id_to_link_conf(mld, other_link_fw_id);
588+
589+ if (IWL_FW_CHECK(mld, !other_link, "link doesn't exist for: %d\n",
590+ other_link_fw_id))
591+ return;
592+
593+ IWL_DEBUG_EHT(mld,
594+ "missed bcn on the other link (link_id=%u): %u\n",
595+ other_link->link_id, scnd_lnk_bcn_lost);
596+
587597 /* Exit EMLSR if we lost more than
588598 * IWL_MLD_MISSED_BEACONS_EXIT_ESR_THRESH beacons on boths links
589599 * OR more than IWL_MLD_BCN_LOSS_EXIT_ESR_THRESH on current link.
drivers/net/wireless/intel/iwlwifi/mld/link.h+2−0
@@ -36,6 +36,7 @@ struct iwl_probe_resp_data { · 35 unmodified lines
3636 * @he_ru_2mhz_block: 26-tone RU OFDMA transmissions should be blocked.
3737 * @igtk: fw can only have one IGTK at a time, whereas mac80211 can have two.
3838 * This tracks the one IGTK that currently exists in FW.
39+ * @bigtks: BIGTKs of the AP. Only valid for STA mode.
3940 * @bcast_sta: station used for broadcast packets. Used in AP, GO and IBSS.
4041 * @mcast_sta: station used for multicast packets. Used in AP, GO and IBSS.
4142 * @mon_sta: station used for TX injection in monitor interface.
@@ -59,6 +60,7 @@ struct iwl_mld_link { · 17 unmodified lines
5960 struct ieee80211_chanctx_conf __rcu *chan_ctx;
6061 bool he_ru_2mhz_block;
6162 struct ieee80211_key_conf *igtk;
63+ struct ieee80211_key_conf __rcu *bigtks[2];
6264 );
6365 /* And here fields that survive a fw restart */
6466 struct iwl_mld_int_sta bcast_sta;
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c+6−13
@@ -626,7 +626,7 @@ int iwl_mld_mac80211_add_interface(struct ieee80211_hw *hw, · 625 unmodified lines
626626 IEEE80211_VIF_SUPPORTS_CQM_RSSI;
627627 }
628628
629− if (vif->p2p || iwl_fw_lookup_cmd_ver(mld->fw, PHY_CONTEXT_CMD, 0) < 5)
629+ if (vif->p2p)
630630 vif->driver_flags |= IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW;
631631
632632 /*
@@ -1966,13 +1966,8 @@ iwl_mld_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) · 1333 unmodified lines
19661966 iwl_fw_runtime_suspend(&mld->fwrt);
19671967
19681968 ret = iwl_mld_wowlan_suspend(mld, wowlan);
1969− if (ret) {
1970− if (ret < 0) {
1971− mld->trans->state = IWL_TRANS_NO_FW;
1972− set_bit(STATUS_FW_ERROR, &mld->trans->status);
1973− }
1969+ if (ret)
19741970 return 1;
1975− }
19761971
19771972 if (iwl_mld_no_wowlan_suspend(mld))
19781973 return 1;
@@ -2065,9 +2060,8 @@ static int iwl_mld_set_key_add(struct iwl_mld *mld, · 86 unmodified lines
20652060 return -EOPNOTSUPP;
20662061 }
20672062
2068− if (vif->type == NL80211_IFTYPE_STATION &&
2069− (keyidx == 6 || keyidx == 7))
2070− rcu_assign_pointer(mld_vif->bigtks[keyidx - 6], key);
2063+ if (keyidx == 6 || keyidx == 7)
2064+ iwl_mld_track_bigtk(mld, vif, key, true);
20712065
20722066 /* After exiting from RFKILL, hostapd configures GTK/ITGK before the
20732067 * AP is started, but those keys can't be sent to the FW before the
@@ -2116,9 +2110,8 @@ static void iwl_mld_set_key_remove(struct iwl_mld *mld, · 42 unmodified lines
21162110 sta ? iwl_mld_sta_from_mac80211(sta) : NULL;
21172111 int keyidx = key->keyidx;
21182112
2119− if (vif->type == NL80211_IFTYPE_STATION &&
2120− (keyidx == 6 || keyidx == 7))
2121− RCU_INIT_POINTER(mld_vif->bigtks[keyidx - 6], NULL);
2113+ if (keyidx == 6 || keyidx == 7)
2114+ iwl_mld_track_bigtk(mld, vif, key, false);
21222115
21232116 if (mld_sta && key->flags & IEEE80211_KEY_FLAG_PAIRWISE &&
21242117 (key->cipher == WLAN_CIPHER_SUITE_CCMP ||
drivers/net/wireless/intel/iwlwifi/mld/mld.c+4−0
@@ -147,6 +147,7 @@ iwl_mld_construct_fw_runtime(struct iwl_mld *mld, struct iwl_trans *trans, · 146 unmodified lines
147147 */
148148 static const struct iwl_hcmd_names iwl_mld_legacy_names[] = {
149149 HCMD_NAME(UCODE_ALIVE_NTFY),
150+ HCMD_NAME(REPLY_ERROR),
150151 HCMD_NAME(INIT_COMPLETE_NOTIF),
151152 HCMD_NAME(PHY_CONTEXT_CMD),
152153 HCMD_NAME(SCAN_CFG_CMD),
@@ -158,12 +159,14 @@ static const struct iwl_hcmd_names iwl_mld_legacy_names[] = { · 5 unmodified lines
158159 HCMD_NAME(LEDS_CMD),
159160 HCMD_NAME(WNM_80211V_TIMING_MEASUREMENT_NOTIFICATION),
160161 HCMD_NAME(WNM_80211V_TIMING_MEASUREMENT_CONFIRM_NOTIFICATION),
162+ HCMD_NAME(PHY_CONFIGURATION_CMD),
161163 HCMD_NAME(SCAN_OFFLOAD_UPDATE_PROFILES_CMD),
162164 HCMD_NAME(POWER_TABLE_CMD),
163165 HCMD_NAME(PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION),
164166 HCMD_NAME(BEACON_NOTIFICATION),
165167 HCMD_NAME(BEACON_TEMPLATE_CMD),
166168 HCMD_NAME(TX_ANT_CONFIGURATION_CMD),
169+ HCMD_NAME(BT_CONFIG),
167170 HCMD_NAME(REDUCE_TX_POWER_CMD),
168171 HCMD_NAME(MISSED_BEACONS_NOTIFICATION),
169172 HCMD_NAME(MAC_PM_POWER_TABLE),
@@ -251,6 +254,7 @@ static const struct iwl_hcmd_names iwl_mld_data_path_names[] = { · 81 unmodified lines
251254 HCMD_NAME(TLC_MNG_CONFIG_CMD),
252255 HCMD_NAME(RX_BAID_ALLOCATION_CONFIG_CMD),
253256 HCMD_NAME(SCD_QUEUE_CONFIG_CMD),
257+ HCMD_NAME(SEC_KEY_CMD),
254258 HCMD_NAME(ESR_MODE_NOTIF),
255259 HCMD_NAME(MONITOR_NOTIF),
256260 HCMD_NAME(TLC_MNG_UPDATE_NOTIF),
drivers/net/wireless/intel/iwlwifi/mld/mlo.c+8−26
@@ -357,38 +357,26 @@ iwl_mld_vif_iter_emlsr_mode_notif(void *data, u8 *mac, · 356 unmodified lines
357357 struct ieee80211_vif *vif)
358358 {
359359 const struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
360− enum iwl_mvm_fw_esr_recommendation action;
361− const struct iwl_esr_mode_notif *notif = NULL;
362−
363− if (iwl_fw_lookup_notif_ver(mld_vif->mld->fw, DATA_PATH_GROUP,
364− ESR_MODE_NOTIF, 0) > 1) {
365− notif = (void *)data;
366− action = le32_to_cpu(notif->action);
367− } else {
368− const struct iwl_esr_mode_notif_v1 *notif_v1 = (void *)data;
369−
370− action = le32_to_cpu(notif_v1->action);
371− }
360+ const struct iwl_esr_mode_notif *notif = (void *)data;
361+ enum iwl_mvm_fw_esr_recommendation action = le32_to_cpu(notif->action);
372362
373363 if (!iwl_mld_vif_has_emlsr_cap(vif))
374364 return;
375365
376366 switch (action) {
377367 case ESR_RECOMMEND_LEAVE:
378− if (notif)
379− IWL_DEBUG_INFO(mld_vif->mld,
380− "FW recommend leave reason = 0x%x\n",
381− le32_to_cpu(notif->leave_reason_mask));
368+ IWL_DEBUG_INFO(mld_vif->mld,
369+ "FW recommend leave reason = 0x%x\n",
370+ le32_to_cpu(notif->leave_reason_mask));
382371
383372 iwl_mld_exit_emlsr(mld_vif->mld, vif,
384373 IWL_MLD_EMLSR_EXIT_FW_REQUEST,
385374 iwl_mld_get_primary_link(vif));
386375 break;
387376 case ESR_FORCE_LEAVE:
388− if (notif)
389− IWL_DEBUG_INFO(mld_vif->mld,
390− "FW force leave reason = 0x%x\n",
391− le32_to_cpu(notif->leave_reason_mask));
377+ IWL_DEBUG_INFO(mld_vif->mld,
378+ "FW force leave reason = 0x%x\n",
379+ le32_to_cpu(notif->leave_reason_mask));
392380 fallthrough;
393381 case ESR_RECOMMEND_ENTER:
394382 default:
@@ -735,12 +723,6 @@ iwl_mld_set_link_sel_data(struct iwl_mld *mld, · 340 unmodified lines
735723 u16 max_grade = 0;
736724 unsigned long link_id;
737725
738− /*
739− * TODO: don't select links that weren't discovered in the last scan
740− * This requires mac80211 (or cfg80211) changes to forward/track when
741− * a BSS was last updated. cfg80211 already tracks this information but
742− * it is not exposed within the kernel.
743− */
744726 for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) {
745727 struct ieee80211_bss_conf *link_conf =
746728 link_conf_dereference_protected(vif, link_id);
drivers/net/wireless/intel/iwlwifi/mld/notif.c+0−1
@@ -333,7 +333,6 @@ CMD_VERSIONS(bt_coex_notif, · 332 unmodified lines
333333 CMD_VERSIONS(beacon_notification,
334334 CMD_VER_ENTRY(6, iwl_extended_beacon_notif))
335335 CMD_VERSIONS(emlsr_mode_notif,
336− CMD_VER_ENTRY(1, iwl_esr_mode_notif_v1)
337336 CMD_VER_ENTRY(2, iwl_esr_mode_notif))
338337 CMD_VERSIONS(emlsr_trans_fail_notif,
339338 CMD_VER_ENTRY(1, iwl_esr_trans_fail_notif))
drivers/net/wireless/intel/iwlwifi/mld/regulatory.c+21−7
@@ -163,18 +163,32 @@ int iwl_mld_init_sgom(struct iwl_mld *mld) · 162 unmodified lines
163163
164164 static int iwl_mld_ppag_send_cmd(struct iwl_mld *mld)
165165 {
166− union iwl_ppag_table_cmd cmd = {};
167− int ret, len;
166+ struct iwl_fw_runtime *fwrt = &mld->fwrt;
167+ union iwl_ppag_table_cmd cmd = {
168+ .v7.ppag_config_info.table_source = fwrt->ppag_bios_source,
169+ .v7.ppag_config_info.table_revision = fwrt->ppag_bios_rev,
170+ .v7.ppag_config_info.value = cpu_to_le32(fwrt->ppag_flags),
171+ };
172+ int ret;
168173
169− ret = iwl_fill_ppag_table(&mld->fwrt, &cmd, &len);
170− /* Not supporting PPAG table is a valid scenario */
171− if (ret < 0)
172− return 0;
174+ IWL_DEBUG_RADIO(fwrt,
175+ "PPAG MODE bits going to be sent: %d\n",
176+ fwrt->ppag_flags);
177+
178+ for (int chain = 0; chain < IWL_NUM_CHAIN_LIMITS; chain++) {
179+ for (int subband = 0; subband < IWL_NUM_SUB_BANDS_V2; subband++) {
180+ cmd.v7.gain[chain][subband] =
181+ fwrt->ppag_chains[chain].subbands[subband];
182+ IWL_DEBUG_RADIO(fwrt,
183+ "PPAG table: chain[%d] band[%d]: gain = %d\n",
184+ chain, subband, cmd.v7.gain[chain][subband]);
185+ }
186+ }
173187
174188 IWL_DEBUG_RADIO(mld, "Sending PER_PLATFORM_ANT_GAIN_CMD\n");
175189 ret = iwl_mld_send_cmd_pdu(mld, WIDE_ID(PHY_OPS_GROUP,
176190 PER_PLATFORM_ANT_GAIN_CMD),
177− &cmd, len);
191+ &cmd, sizeof(cmd.v7));
178192 if (ret < 0)
179193 IWL_ERR(mld, "failed to send PER_PLATFORM_ANT_GAIN_CMD (%d)\n",
180194 ret);
drivers/net/wireless/intel/iwlwifi/mld/roc.c+2−8
@@ -82,9 +82,6 @@ int iwl_mld_start_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 81 unmodified lines
8282 struct iwl_roc_req cmd = {
8383 .action = cpu_to_le32(FW_CTXT_ACTION_ADD),
8484 };
85− u8 ver = iwl_fw_lookup_cmd_ver(mld->fw,
86− WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0);
87− u16 cmd_len = ver < 6 ? sizeof(struct iwl_roc_req_v5) : sizeof(cmd);
8885 enum iwl_roc_activity activity;
8986 int ret = 0;
9087
@@ -140,7 +137,7 @@ int iwl_mld_start_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 49 unmodified lines
140137 memcpy(cmd.node_addr, vif->addr, ETH_ALEN);
141138
142139 ret = iwl_mld_send_cmd_pdu(mld, WIDE_ID(MAC_CONF_GROUP, ROC_CMD),
143− &cmd, cmd_len);
140+ &cmd);
144141 if (ret) {
145142 IWL_ERR(mld, "Couldn't send the ROC_CMD\n");
146143 return ret;
@@ -190,9 +187,6 @@ int iwl_mld_cancel_roc(struct ieee80211_hw *hw, · 43 unmodified lines
190187 struct iwl_roc_req cmd = {
191188 .action = cpu_to_le32(FW_CTXT_ACTION_REMOVE),
192189 };
193− u8 ver = iwl_fw_lookup_cmd_ver(mld->fw,
194− WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0);
195− u16 cmd_len = ver < 6 ? sizeof(struct iwl_roc_req_v5) : sizeof(cmd);
196190 int ret;
197191
198192 lockdep_assert_wiphy(mld->wiphy);
@@ -208,7 +202,7 @@ int iwl_mld_cancel_roc(struct ieee80211_hw *hw, · 9 unmodified lines
208202 cmd.activity = cpu_to_le32(mld_vif->roc_activity);
209203
210204 ret = iwl_mld_send_cmd_pdu(mld, WIDE_ID(MAC_CONF_GROUP, ROC_CMD),
211− &cmd, cmd_len);
205+ &cmd);
212206 if (ret)
213207 IWL_ERR(mld, "Couldn't send the command to cancel the ROC\n");
214208
drivers/net/wireless/intel/iwlwifi/mld/rx.c+18−8
@@ -1611,20 +1611,21 @@ iwl_mld_rx_with_sta(struct iwl_mld *mld, struct ieee80211_hdr *hdr, · 1610 unmodified lines
16111611 return sta;
16121612 }
16131613
1614−#define KEY_IDX_LEN 2
1615−
16161614 static int iwl_mld_rx_mgmt_prot(struct ieee80211_sta *sta,
16171615 struct ieee80211_hdr *hdr,
16181616 struct ieee80211_rx_status *rx_status,
16191617 u32 mpdu_status,
16201618 u32 mpdu_len)
16211619 {
1620+ struct iwl_mld_link *link;
16221621 struct wireless_dev *wdev;
16231622 struct iwl_mld_sta *mld_sta;
16241623 struct iwl_mld_vif *mld_vif;
16251624 u8 keyidx;
16261625 struct ieee80211_key_conf *key;
16271626 const u8 *frame = (void *)hdr;
1627+ const u8 *mmie;
1628+ u8 link_id;
16281629
16291630 if ((mpdu_status & IWL_RX_MPDU_STATUS_SEC_MASK) ==
16301631 IWL_RX_MPDU_STATUS_SEC_NONE)
@@ -1657,21 +1658,30 @@ static int iwl_mld_rx_mgmt_prot(struct ieee80211_sta *sta, · 26 unmodified lines
16571658 return 0;
16581659 }
16591660
1661+ link_id = rx_status->link_valid ? rx_status->link_id : 0;
1662+ link = rcu_dereference(mld_vif->link[link_id]);
1663+ if (WARN_ON_ONCE(!link))
1664+ return -1;
1665+
16601666 /* both keys will have the same cipher and MIC length, use
16611667 * whichever one is available
16621668 */
1663− key = rcu_dereference(mld_vif->bigtks[0]);
1669+ key = rcu_dereference(link->bigtks[0]);
16641670 if (!key) {
1665− key = rcu_dereference(mld_vif->bigtks[1]);
1671+ key = rcu_dereference(link->bigtks[1]);
16661672 if (!key)
16671673 goto report;
16681674 }
16691675
1670− if (mpdu_len < key->icv_len + IEEE80211_GMAC_PN_LEN + KEY_IDX_LEN)
1676+ /* get the real key ID */
1677+ if (mpdu_len < key->icv_len)
16711678 goto report;
16721679
1673− /* get the real key ID */
1674− keyidx = frame[mpdu_len - key->icv_len - IEEE80211_GMAC_PN_LEN - KEY_IDX_LEN];
1680+ mmie = frame + (mpdu_len - key->icv_len);
1681+
1682+ /* the position of the key_id in ieee80211_mmie_16 is the same */
1683+ keyidx = le16_to_cpu(((const struct ieee80211_mmie *) mmie)->key_id);
1684+
16751685 /* and if that's the other key, look it up */
16761686 if (keyidx != key->keyidx) {
16771687 /* shouldn't happen since firmware checked, but be safe
@@ -1680,7 +1690,7 @@ static int iwl_mld_rx_mgmt_prot(struct ieee80211_sta *sta, · 2 unmodified lines
16801690 if (keyidx != 6 && keyidx != 7)
16811691 return -1;
16821692
1683− key = rcu_dereference(mld_vif->bigtks[keyidx - 6]);
1693+ key = rcu_dereference(link->bigtks[keyidx - 6]);
16841694 if (!key)
16851695 goto report;
16861696 }
drivers/net/wireless/intel/iwlwifi/mld/scan.c+1−3
@@ -504,9 +504,7 @@ iwl_mld_scan_get_cmd_gen_flags2(struct iwl_mld *mld, · 503 unmodified lines
504504 */
505505 if (scan_status == IWL_MLD_SCAN_REGULAR &&
506506 ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_AP &&
507− gen_flags & IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE &&
508− iwl_fw_lookup_notif_ver(mld->fw, SCAN_GROUP,
509− CHANNEL_SURVEY_NOTIF, 0) >= 1)
507+ gen_flags & IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE)
510508 flags |= IWL_UMAC_SCAN_GEN_FLAGS2_COLLECT_CHANNEL_STATS;
511509
512510 return flags;
drivers/net/wireless/intel/iwlwifi/mld/sta.c+3−5
@@ -401,11 +401,9 @@ static u32 iwl_mld_get_htc_flags(struct ieee80211_link_sta *link_sta) · 400 unmodified lines
401401 static int iwl_mld_send_sta_cmd(struct iwl_mld *mld,
402402 const struct iwl_sta_cfg_cmd *cmd)
403403 {
404− u32 cmd_id = WIDE_ID(MAC_CONF_GROUP, STA_CONFIG_CMD);
405− int cmd_len = iwl_fw_lookup_cmd_ver(mld->fw, cmd_id, 0) > 1 ?
406− sizeof(*cmd) :
407− sizeof(struct iwl_sta_cfg_cmd_v1);
408− int ret = iwl_mld_send_cmd_pdu(mld, cmd_id, cmd, cmd_len);
404+ int ret = iwl_mld_send_cmd_pdu(mld,
405+ WIDE_ID(MAC_CONF_GROUP, STA_CONFIG_CMD),
406+ cmd);
409407 if (ret)
410408 IWL_ERR(mld, "STA_CONFIG_CMD send failed, ret=0x%x\n", ret);
411409 return ret;
drivers/net/wireless/intel/iwlwifi/mld/stats.c+7−4
@@ -379,11 +379,14 @@ static void iwl_mld_update_link_sig(struct ieee80211_vif *vif, int sig, · 378 unmodified lines
379379
380380 /* TODO: task=statistics handle CQM notifications */
381381
382− if (sig < IWL_MLD_LOW_RSSI_MLO_SCAN_THRESH)
383− iwl_mld_int_mlo_scan(mld, vif);
384−
385− if (!iwl_mld_emlsr_active(vif))
382+ if (!iwl_mld_emlsr_active(vif)) {
383+ /* We're not in EMLSR and our signal is bad,
384+ * try to switch link maybe. EMLSR will be handled below.
385+ */
386+ if (sig < IWL_MLD_LOW_RSSI_MLO_SCAN_THRESH)
387+ iwl_mld_int_mlo_scan(mld, vif);
386388 return;
389+ }
387390
388391 /* We are in EMLSR, check if we need to exit */
389392 exit_emlsr_thresh =
drivers/net/wireless/intel/iwlwifi/mld/tlc.c+56−19
@@ -157,9 +157,9 @@ iwl_mld_get_highest_fw_mcs(const struct ieee80211_sta_vht_cap *vht_cap, · 156 unmodified lines
157157 static void
158158 iwl_mld_fill_vht_rates(const struct ieee80211_link_sta *link_sta,
159159 const struct ieee80211_sta_vht_cap *vht_cap,
160− struct iwl_tlc_config_cmd_v4 *cmd)
160+ struct iwl_tlc_config_cmd *cmd)
161161 {
162− u16 supp;
162+ u32 supp;
163163 int i, highest_mcs;
164164 u8 max_nss = link_sta->rx_nss;
165165 struct ieee80211_vht_cap ieee_vht_cap = {
@@ -182,7 +182,7 @@ iwl_mld_fill_vht_rates(const struct ieee80211_link_sta *link_sta, · 16 unmodified lines
182182 if (link_sta->bandwidth == IEEE80211_STA_RX_BW_20)
183183 supp &= ~BIT(IWL_TLC_MNG_HT_RATE_MCS9);
184184
185− cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_80] = cpu_to_le16(supp);
185+ cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_80] = cpu_to_le32(supp);
186186 /* Check if VHT extended NSS indicates that the bandwidth/NSS
187187 * configuration is supported - only for MCS 0 since we already
188188 * decoded the MCS bits anyway ourselves.
@@ -196,7 +196,7 @@ iwl_mld_fill_vht_rates(const struct ieee80211_link_sta *link_sta, · 7 unmodified lines
196196 }
197197 }
198198
199−static u16 iwl_mld_he_mac80211_mcs_to_fw_mcs(u16 mcs)
199+static u32 iwl_mld_he_mac80211_mcs_to_fw_mcs(u16 mcs)
200200 {
201201 switch (mcs) {
202202 case IEEE80211_HE_MCS_SUPPORT_0_7:
@@ -216,7 +216,7 @@ static u16 iwl_mld_he_mac80211_mcs_to_fw_mcs(u16 mcs) · 13 unmodified lines
216216 static void
217217 iwl_mld_fill_he_rates(const struct ieee80211_link_sta *link_sta,
218218 const struct ieee80211_sta_he_cap *own_he_cap,
219− struct iwl_tlc_config_cmd_v4 *cmd)
219+ struct iwl_tlc_config_cmd *cmd)
220220 {
221221 const struct ieee80211_sta_he_cap *he_cap = &link_sta->he_cap;
222222 u16 mcs_160 = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160);
@@ -245,7 +245,7 @@ iwl_mld_fill_he_rates(const struct ieee80211_link_sta *link_sta, · 22 unmodified lines
245245 if (_mcs_80 > _tx_mcs_80)
246246 _mcs_80 = _tx_mcs_80;
247247 cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_80] =
248− cpu_to_le16(iwl_mld_he_mac80211_mcs_to_fw_mcs(_mcs_80));
248+ cpu_to_le32(iwl_mld_he_mac80211_mcs_to_fw_mcs(_mcs_80));
249249
250250 /* If one side doesn't support - mark both as not supporting */
251251 if (_mcs_160 == IEEE80211_HE_MCS_NOT_SUPPORTED ||
@@ -256,19 +256,19 @@ iwl_mld_fill_he_rates(const struct ieee80211_link_sta *link_sta, · 4 unmodified lines
256256 if (_mcs_160 > _tx_mcs_160)
257257 _mcs_160 = _tx_mcs_160;
258258 cmd->ht_rates[i][IWL_TLC_MCS_PER_BW_160] =
259− cpu_to_le16(iwl_mld_he_mac80211_mcs_to_fw_mcs(_mcs_160));
259+ cpu_to_le32(iwl_mld_he_mac80211_mcs_to_fw_mcs(_mcs_160));
260260 }
261261 }
262262
263−static void iwl_mld_set_eht_mcs(__le16 ht_rates[][3],
263+static void iwl_mld_set_eht_mcs(__le32 ht_rates[][3],
264264 enum IWL_TLC_MCS_PER_BW bw,
265− u8 max_nss, u16 mcs_msk)
265+ u8 max_nss, u32 mcs_msk)
266266 {
267267 if (max_nss >= 2)
268− ht_rates[IWL_TLC_NSS_2][bw] |= cpu_to_le16(mcs_msk);
268+ ht_rates[IWL_TLC_NSS_2][bw] |= cpu_to_le32(mcs_msk);
269269
270270 if (max_nss >= 1)
271− ht_rates[IWL_TLC_NSS_1][bw] |= cpu_to_le16(mcs_msk);
271+ ht_rates[IWL_TLC_NSS_1][bw] |= cpu_to_le32(mcs_msk);
272272 }
273273
274274 static const
@@ -307,7 +307,7 @@ iwl_mld_fill_eht_rates(struct ieee80211_vif *vif, · 32 unmodified lines
307307 const struct ieee80211_link_sta *link_sta,
308308 const struct ieee80211_sta_he_cap *own_he_cap,
309309 const struct ieee80211_sta_eht_cap *own_eht_cap,
310− struct iwl_tlc_config_cmd_v4 *cmd)
310+ struct iwl_tlc_config_cmd *cmd)
311311 {
312312 /* peer RX mcs capa */
313313 const struct ieee80211_eht_mcs_nss_supp *eht_rx_mcs =
@@ -405,7 +405,7 @@ iwl_mld_fill_supp_rates(struct iwl_mld *mld, struct ieee80211_vif *vif, · 91 unmodified lines
405405 struct ieee80211_supported_band *sband,
406406 const struct ieee80211_sta_he_cap *own_he_cap,
407407 const struct ieee80211_sta_eht_cap *own_eht_cap,
408− struct iwl_tlc_config_cmd_v4 *cmd)
408+ struct iwl_tlc_config_cmd *cmd)
409409 {
410410 int i;
411411 u16 non_ht_rates = 0;
@@ -435,7 +435,7 @@ iwl_mld_fill_supp_rates(struct iwl_mld *mld, struct ieee80211_vif *vif, · 23 unmodified lines
435435 } else if (ht_cap->ht_supported) {
436436 cmd->mode = IWL_TLC_MNG_MODE_HT;
437437 cmd->ht_rates[IWL_TLC_NSS_1][IWL_TLC_MCS_PER_BW_80] =
438− cpu_to_le16(ht_cap->mcs.rx_mask[0]);
438+ cpu_to_le32(ht_cap->mcs.rx_mask[0]);
439439
440440 /* the station support only a single receive chain */
441441 if (link_sta->smps_mode == IEEE80211_SMPS_STATIC)
@@ -443,10 +443,30 @@ iwl_mld_fill_supp_rates(struct iwl_mld *mld, struct ieee80211_vif *vif, · 1 unmodified line
443443 0;
444444 else
445445 cmd->ht_rates[IWL_TLC_NSS_2][IWL_TLC_MCS_PER_BW_80] =
446− cpu_to_le16(ht_cap->mcs.rx_mask[1]);
446+ cpu_to_le32(ht_cap->mcs.rx_mask[1]);
447447 }
448448 }
449449
450+static void iwl_mld_convert_tlc_cmd_to_v4(struct iwl_tlc_config_cmd *cmd,
451+ struct iwl_tlc_config_cmd_v4 *cmd_v4)
452+{
453+ /* Copy everything until ht_rates */
454+ memcpy(cmd_v4, cmd, offsetof(struct iwl_tlc_config_cmd, ht_rates));
455+
456+ /* Convert ht_rates from __le32 to __le16 */
457+ BUILD_BUG_ON(ARRAY_SIZE(cmd_v4->ht_rates) != ARRAY_SIZE(cmd->ht_rates));
458+ BUILD_BUG_ON(ARRAY_SIZE(cmd_v4->ht_rates[0]) != ARRAY_SIZE(cmd->ht_rates[0]));
459+
460+ for (int nss = 0; nss < ARRAY_SIZE(cmd->ht_rates); nss++)
461+ for (int bw = 0; bw < ARRAY_SIZE(cmd->ht_rates[nss]); bw++)
462+ cmd_v4->ht_rates[nss][bw] =
463+ cpu_to_le16(le32_to_cpu(cmd->ht_rates[nss][bw]));
464+
465+ /* Copy the rest */
466+ cmd_v4->max_mpdu_len = cmd->max_mpdu_len;
467+ cmd_v4->max_tx_op = cmd->max_tx_op;
468+}
469+
450470 static void iwl_mld_send_tlc_cmd(struct iwl_mld *mld,
451471 struct ieee80211_vif *vif,
452472 struct ieee80211_link_sta *link_sta,
@@ -458,7 +478,7 @@ static void iwl_mld_send_tlc_cmd(struct iwl_mld *mld, · 5 unmodified lines
458478 ieee80211_get_he_iftype_cap_vif(sband, vif);
459479 const struct ieee80211_sta_eht_cap *own_eht_cap =
460480 ieee80211_get_eht_iftype_cap_vif(sband, vif);
461− struct iwl_tlc_config_cmd_v4 cmd = {
481+ struct iwl_tlc_config_cmd cmd = {
462482 /* For AP mode, use 20 MHz until the STA is authorized */
463483 .max_ch_width = mld_sta->sta_state > IEEE80211_STA_ASSOC ?
464484 iwl_mld_fw_bw_from_sta_bw(link_sta) :
@@ -470,6 +490,11 @@ static void iwl_mld_send_tlc_cmd(struct iwl_mld *mld, · 5 unmodified lines
470490 .max_mpdu_len = cpu_to_le16(link_sta->agg.max_amsdu_len),
471491 };
472492 int fw_sta_id = iwl_mld_fw_sta_id_from_link_sta(mld, link_sta);
493+ u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, TLC_MNG_CONFIG_CMD);
494+ u8 cmd_ver = iwl_fw_lookup_cmd_ver(mld->fw, cmd_id, 0);
495+ struct iwl_tlc_config_cmd_v4 cmd_v4;
496+ void *cmd_ptr;
497+ u8 cmd_size;
473498 int ret;
474499
475500 if (fw_sta_id < 0)
@@ -481,14 +506,26 @@ static void iwl_mld_send_tlc_cmd(struct iwl_mld *mld, · 5 unmodified lines
481506 own_he_cap, own_eht_cap,
482507 &cmd);
483508
509+ if (cmd_ver == 5) {
510+ cmd_ptr = &cmd;
511+ cmd_size = sizeof(cmd);
512+ } else if (cmd_ver == 4) {
513+ iwl_mld_convert_tlc_cmd_to_v4(&cmd, &cmd_v4);
514+ cmd_ptr = &cmd_v4;
515+ cmd_size = sizeof(cmd_v4);
516+ } else {
517+ IWL_ERR(mld, "Unsupported TLC config cmd version %d\n",
518+ cmd_ver);
519+ return;
520+ }
521+
484522 IWL_DEBUG_RATE(mld,
485523 "TLC CONFIG CMD, sta_id=%d, max_ch_width=%d, mode=%d\n",
486524 cmd.sta_id, cmd.max_ch_width, cmd.mode);
487525
488526 /* Send async since this can be called within a RCU-read section */
489− ret = iwl_mld_send_cmd_with_flags_pdu(mld, WIDE_ID(DATA_PATH_GROUP,
490− TLC_MNG_CONFIG_CMD),
491− CMD_ASYNC, &cmd);
527+ ret = iwl_mld_send_cmd_with_flags_pdu(mld, cmd_id, CMD_ASYNC, cmd_ptr,
528+ cmd_size);
492529 if (ret)
493530 IWL_ERR(mld, "Failed to send TLC cmd (%d)\n", ret);
494531 }
drivers/net/wireless/intel/iwlwifi/mvm/coex.c+0−131
@@ -253,93 +253,6 @@ static void iwl_mvm_bt_coex_tcm_based_ci(struct iwl_mvm *mvm, · 252 unmodified lines
253253 swap(data->primary, data->secondary);
254254 }
255255
256−/*
257− * This function receives the LB link id and checks if eSR should be
258− * enabled or disabled (due to BT coex)
259− */
260−bool
261−iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,
262− struct ieee80211_vif *vif,
263− s32 link_rssi,
264− bool primary)
265−{
266− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
267− bool have_wifi_loss_rate =
268− iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
269− BT_PROFILE_NOTIFICATION, 0) > 4 ||
270− iwl_fw_lookup_notif_ver(mvm->fw, BT_COEX_GROUP,
271− PROFILE_NOTIF, 0) >= 1;
272− u8 wifi_loss_mid_high_rssi;
273− u8 wifi_loss_low_rssi;
274− u8 wifi_loss_rate;
275−
276− if (iwl_fw_lookup_notif_ver(mvm->fw, BT_COEX_GROUP,
277− PROFILE_NOTIF, 0) >= 1) {
278− /* For now, we consider 2.4 GHz band / ANT_A only */
279− wifi_loss_mid_high_rssi =
280− mvm->last_bt_wifi_loss.wifi_loss_mid_high_rssi[PHY_BAND_24][0];
281− wifi_loss_low_rssi =
282− mvm->last_bt_wifi_loss.wifi_loss_low_rssi[PHY_BAND_24][0];
283− } else {
284− wifi_loss_mid_high_rssi = mvm->last_bt_notif.wifi_loss_mid_high_rssi;
285− wifi_loss_low_rssi = mvm->last_bt_notif.wifi_loss_low_rssi;
286− }
287−
288− if (wifi_loss_low_rssi == BT_OFF)
289− return true;
290−
291− if (primary)
292− return false;
293−
294− /* The feature is not supported */
295− if (!have_wifi_loss_rate)
296− return true;
297−
298−
299− /*
300− * In case we don't know the RSSI - take the lower wifi loss,
301− * so we will more likely enter eSR, and if RSSI is low -
302− * we will get an update on this and exit eSR.
303− */
304− if (!link_rssi)
305− wifi_loss_rate = wifi_loss_mid_high_rssi;
306−
307− else if (mvmvif->esr_active)
308− /* RSSI needs to get really low to disable eSR... */
309− wifi_loss_rate =
310− link_rssi <= -IWL_MVM_BT_COEX_DISABLE_ESR_THRESH ?
311− wifi_loss_low_rssi :
312− wifi_loss_mid_high_rssi;
313− else
314− /* ...And really high before we enable it back */
315− wifi_loss_rate =
316− link_rssi <= -IWL_MVM_BT_COEX_ENABLE_ESR_THRESH ?
317− wifi_loss_low_rssi :
318− wifi_loss_mid_high_rssi;
319−
320− return wifi_loss_rate <= IWL_MVM_BT_COEX_WIFI_LOSS_THRESH;
321−}
322−
323−void iwl_mvm_bt_coex_update_link_esr(struct iwl_mvm *mvm,
324− struct ieee80211_vif *vif,
325− int link_id)
326−{
327− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
328− struct iwl_mvm_vif_link_info *link = mvmvif->link[link_id];
329−
330− if (!ieee80211_vif_is_mld(vif) ||
331− !iwl_mvm_vif_from_mac80211(vif)->authorized ||
332− WARN_ON(!link))
333− return;
334−
335− if (!iwl_mvm_bt_coex_calculate_esr_mode(mvm, vif,
336− (s8)link->beacon_stats.avg_signal,
337− link_id == iwl_mvm_get_primary_link(vif)))
338− /* In case we decided to exit eSR - stay with the primary */
339− iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_COEX,
340− iwl_mvm_get_primary_link(vif));
341−}
342−
343256 static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm,
344257 struct ieee80211_vif *vif,
345258 struct iwl_bt_iterator_data *data,
@@ -385,8 +298,6 @@ static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm, · 39 unmodified lines
385298 return;
386299 }
387300
388− iwl_mvm_bt_coex_update_link_esr(mvm, vif, link_id);
389−
390301 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2))
391302 min_ag_for_static_smps = BT_VERY_HIGH_TRAFFIC;
392303 else
@@ -525,32 +436,6 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, · 132 unmodified lines
525436 iwl_mvm_bt_notif_per_link(mvm, vif, data, link_id);
526437 }
527438
528−/* must be called under rcu_read_lock */
529−static void iwl_mvm_bt_coex_notif_iterator(void *_data, u8 *mac,
530− struct ieee80211_vif *vif)
531−{
532− struct iwl_mvm *mvm = _data;
533− struct ieee80211_bss_conf *link_conf;
534− unsigned int link_id;
535−
536− lockdep_assert_held(&mvm->mutex);
537−
538− if (vif->type != NL80211_IFTYPE_STATION)
539− return;
540−
541− for_each_vif_active_link(vif, link_conf, link_id) {
542− struct ieee80211_chanctx_conf *chanctx_conf =
543− rcu_dereference_check(link_conf->chanctx_conf,
544− lockdep_is_held(&mvm->mutex));
545−
546− if ((!chanctx_conf ||
547− chanctx_conf->def.chan->band != NL80211_BAND_2GHZ))
548− continue;
549−
550− iwl_mvm_bt_coex_update_link_esr(mvm, vif, link_id);
551− }
552−}
553−
554439 static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm)
555440 {
556441 struct iwl_bt_iterator_data data = {
@@ -654,22 +539,6 @@ void iwl_mvm_rx_bt_coex_old_notif(struct iwl_mvm *mvm, · 97 unmodified lines
654539 iwl_mvm_bt_coex_notif_handle(mvm);
655540 }
656541
657−void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
658− struct iwl_rx_cmd_buffer *rxb)
659−{
660− const struct iwl_rx_packet *pkt = rxb_addr(rxb);
661− const struct iwl_bt_coex_profile_notif *notif = (const void *)pkt->data;
662−
663− lockdep_assert_held(&mvm->mutex);
664−
665− mvm->last_bt_wifi_loss = *notif;
666−
667− ieee80211_iterate_active_interfaces(mvm->hw,
668− IEEE80211_IFACE_ITER_NORMAL,
669− iwl_mvm_bt_coex_notif_iterator,
670− mvm);
671−}
672−
673542 void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
674543 enum ieee80211_rssi_event_data rssi_event)
675544 {
drivers/net/wireless/intel/iwlwifi/mvm/constants.h+1−19
@@ -1,7 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
22 /*
33 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
4− * Copyright (C) 2013-2014, 2018-2024 Intel Corporation
4+ * Copyright (C) 2013-2014, 2018-2025 Intel Corporation
55 * Copyright (C) 2015 Intel Deutschland GmbH
66 */
77 #ifndef __MVM_CONSTANTS_H
@@ -11,15 +11,7 @@ · 3 unmodified lines
1111 #include "fw-api.h"
1212
1313 #define IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM 20
14−#define IWL_MVM_BT_COEX_DISABLE_ESR_THRESH 69
15−#define IWL_MVM_BT_COEX_ENABLE_ESR_THRESH 63
16−#define IWL_MVM_BT_COEX_WIFI_LOSS_THRESH 0
1714 #define IWL_MVM_TRIGGER_LINK_SEL_TIME_SEC 30
18−#define IWL_MVM_TPT_COUNT_WINDOW_SEC 5
19−#define IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS 5
20−#define IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH 15
21−#define IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_BSS_PARAM_CHANGED 11
22−#define IWL_MVM_LOW_RSSI_MLO_SCAN_THRESH -72
2315
2416 #define IWL_MVM_DEFAULT_PS_TX_DATA_TIMEOUT (100 * USEC_PER_MSEC)
2517 #define IWL_MVM_DEFAULT_PS_RX_DATA_TIMEOUT (100 * USEC_PER_MSEC)
@@ -129,14 +121,4 @@ · 103 unmodified lines
129121 #define IWL_MVM_MIN_BEACON_INTERVAL_TU 16
130122 #define IWL_MVM_AUTO_EML_ENABLE true
131123
132−#define IWL_MVM_HIGH_RSSI_THRESH_20MHZ -67
133−#define IWL_MVM_LOW_RSSI_THRESH_20MHZ -71
134−#define IWL_MVM_HIGH_RSSI_THRESH_40MHZ -64
135−#define IWL_MVM_LOW_RSSI_THRESH_40MHZ -67
136−#define IWL_MVM_HIGH_RSSI_THRESH_80MHZ -61
137−#define IWL_MVM_LOW_RSSI_THRESH_80MHZ -74
138−#define IWL_MVM_HIGH_RSSI_THRESH_160MHZ -58
139−#define IWL_MVM_LOW_RSSI_THRESH_160MHZ -61
140−
141−#define IWL_MVM_ENTER_ESR_TPT_THRESH 400
142124 #endif /* __MVM_CONSTANTS_H */
drivers/net/wireless/intel/iwlwifi/mvm/d3.c+45−339
@@ -928,6 +928,10 @@ iwl_mvm_get_wowlan_config(struct iwl_mvm *mvm, · 927 unmodified lines
928928 if (ap_sta->mfp)
929929 wowlan_config_cmd->flags |= IS_11W_ASSOC;
930930
931+ if (rcu_access_pointer(mvmvif->bcn_prot.keys[0]) ||
932+ rcu_access_pointer(mvmvif->bcn_prot.keys[1]))
933+ wowlan_config_cmd->flags |= HAS_BEACON_PROTECTION;
934+
931935 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_CONFIGURATION, 0) < 6) {
932936 /* Query the last used seqno and set it */
933937 int ret = iwl_mvm_get_last_nonqos_seq(mvm, vif);
@@ -1238,15 +1242,14 @@ static void iwl_mvm_free_nd(struct iwl_mvm *mvm) · 304 unmodified lines
12381242 }
12391243
12401244 static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
1241− struct cfg80211_wowlan *wowlan,
1242− bool test)
1245+ struct cfg80211_wowlan *wowlan)
12431246 {
12441247 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
12451248 struct ieee80211_vif *vif = NULL;
12461249 struct iwl_mvm_vif *mvmvif = NULL;
12471250 struct ieee80211_sta *ap_sta = NULL;
12481251 struct iwl_mvm_vif_link_info *mvm_link;
1249− struct iwl_d3_manager_config d3_cfg_cmd_data = {
1252+ struct iwl_d3_manager_config d3_cfg_cmd = {
12501253 /*
12511254 * Program the minimum sleep time to 10 seconds, as many
12521255 * platforms have issues processing a wakeup signal while
@@ -1254,23 +1257,14 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 1 unmodified line
12541257 */
12551258 .min_sleep_time = cpu_to_le32(10 * 1000 * 1000),
12561259 };
1257− struct iwl_host_cmd d3_cfg_cmd = {
1258− .id = D3_CONFIG_CMD,
1259− .flags = CMD_WANT_SKB,
1260− .data[0] = &d3_cfg_cmd_data,
1261− .len[0] = sizeof(d3_cfg_cmd_data),
1262− };
12631260 int ret;
12641261 int len __maybe_unused;
12651262 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa,
12661263 IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG);
12671264
12681265 if (!wowlan) {
1269− /*
1270− * mac80211 shouldn't get here, but for D3 test
1271− * it doesn't warrant a warning
1272− */
1273− WARN_ON(!test);
1266+ /* mac80211 shouldn't get here */
1267+ WARN_ON(1);
12741268 return -EINVAL;
12751269 }
12761270
@@ -1278,10 +1272,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 1 unmodified line
12781272 if (IS_ERR_OR_NULL(vif))
12791273 return 1;
12801274
1281− ret = iwl_mvm_block_esr_sync(mvm, vif, IWL_MVM_ESR_BLOCKED_WOWLAN);
1282− if (ret)
1283− return ret;
1284−
12851275 mutex_lock(&mvm->mutex);
12861276
12871277 set_bit(IWL_MVM_STATUS_IN_D3, &mvm->status);
@@ -1351,7 +1341,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 63 unmodified lines
13511341
13521342 #ifdef CONFIG_IWLWIFI_DEBUGFS
13531343 if (mvm->d3_wake_sysassert)
1354− d3_cfg_cmd_data.wakeup_flags |=
1344+ d3_cfg_cmd.wakeup_flags |=
13551345 cpu_to_le32(IWL_WAKEUP_D3_CONFIG_FW_ERROR);
13561346 #endif
13571347
@@ -1364,21 +1354,14 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, · 6 unmodified lines
13641354 iwl_fw_dbg_stop_restart_recording(&mvm->fwrt, NULL, true);
13651355
13661356 /* must be last -- this switches firmware state */
1367− ret = iwl_mvm_send_cmd(mvm, &d3_cfg_cmd);
1357+ ret = iwl_mvm_send_cmd_pdu(mvm, D3_CONFIG_CMD, 0, sizeof(d3_cfg_cmd),
1358+ &d3_cfg_cmd);
13681359 if (ret)
13691360 goto out;
1370−#ifdef CONFIG_IWLWIFI_DEBUGFS
1371− len = iwl_rx_packet_payload_len(d3_cfg_cmd.resp_pkt);
1372− if (len >= sizeof(u32)) {
1373− mvm->d3_test_pme_ptr =
1374− le32_to_cpup((__le32 *)d3_cfg_cmd.resp_pkt->data);
1375− }
1376−#endif
1377− iwl_free_resp(&d3_cfg_cmd);
13781361
13791362 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
13801363
1381− ret = iwl_trans_d3_suspend(mvm->trans, test, !unified_image);
1364+ ret = iwl_trans_d3_suspend(mvm->trans, !unified_image);
13821365 out:
13831366 if (ret < 0) {
13841367 iwl_mvm_free_nd(mvm);
@@ -1401,7 +1384,7 @@ int iwl_mvm_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) · 16 unmodified lines
14011384 iwl_fw_runtime_suspend(&mvm->fwrt);
14021385 mutex_unlock(&mvm->mutex);
14031386
1404− return __iwl_mvm_suspend(hw, wowlan, false);
1387+ return __iwl_mvm_suspend(hw, wowlan);
14051388 }
14061389
14071390 struct iwl_multicast_key_data {
@@ -1794,63 +1777,8 @@ static void iwl_mvm_set_key_rx_seq(struct ieee80211_key_conf *key, · 386 unmodified lines
17941777 struct iwl_mvm_d3_gtk_iter_data {
17951778 struct iwl_mvm *mvm;
17961779 struct iwl_wowlan_status_data *status;
1797− u32 gtk_cipher, igtk_cipher, bigtk_cipher;
1798− bool unhandled_cipher, igtk_support, bigtk_support;
1799− int num_keys;
18001780 };
18011781
1802−static void iwl_mvm_d3_find_last_keys(struct ieee80211_hw *hw,
1803− struct ieee80211_vif *vif,
1804− struct ieee80211_sta *sta,
1805− struct ieee80211_key_conf *key,
1806− void *_data)
1807−{
1808− struct iwl_mvm_d3_gtk_iter_data *data = _data;
1809− int link_id = vif->active_links ? __ffs(vif->active_links) : -1;
1810−
1811− if (link_id >= 0 && key->link_id >= 0 && link_id != key->link_id)
1812− return;
1813−
1814− if (data->unhandled_cipher)
1815− return;
1816−
1817− switch (key->cipher) {
1818− case WLAN_CIPHER_SUITE_WEP40:
1819− case WLAN_CIPHER_SUITE_WEP104:
1820− /* ignore WEP completely, nothing to do */
1821− return;
1822− case WLAN_CIPHER_SUITE_CCMP:
1823− case WLAN_CIPHER_SUITE_GCMP:
1824− case WLAN_CIPHER_SUITE_GCMP_256:
1825− case WLAN_CIPHER_SUITE_TKIP:
1826− /* we support these */
1827− data->gtk_cipher = key->cipher;
1828− break;
1829− case WLAN_CIPHER_SUITE_BIP_GMAC_128:
1830− case WLAN_CIPHER_SUITE_BIP_GMAC_256:
1831− case WLAN_CIPHER_SUITE_BIP_CMAC_256:
1832− case WLAN_CIPHER_SUITE_AES_CMAC:
1833− /* we support these */
1834− if (data->igtk_support &&
1835− (key->keyidx == 4 || key->keyidx == 5)) {
1836− data->igtk_cipher = key->cipher;
1837− } else if (data->bigtk_support &&
1838− (key->keyidx == 6 || key->keyidx == 7)) {
1839− data->bigtk_cipher = key->cipher;
1840− } else {
1841− data->unhandled_cipher = true;
1842− return;
1843− }
1844− break;
1845− default:
1846− /* everything else - disconnect from AP */
1847− data->unhandled_cipher = true;
1848− return;
1849− }
1850−
1851− data->num_keys++;
1852−}
1853−
18541782 static void
18551783 iwl_mvm_d3_set_igtk_bigtk_ipn(const struct iwl_multicast_key_data *key,
18561784 struct ieee80211_key_seq *seq, u32 cipher)
@@ -1896,9 +1824,6 @@ static void iwl_mvm_d3_update_keys(struct ieee80211_hw *hw, · 39 unmodified lines
18961824 if (link_id >= 0 && key->link_id >= 0 && link_id != key->link_id)
18971825 return;
18981826
1899− if (data->unhandled_cipher)
1900− return;
1901−
19021827 switch (key->cipher) {
19031828 case WLAN_CIPHER_SUITE_WEP40:
19041829 case WLAN_CIPHER_SUITE_WEP104:
@@ -1947,52 +1872,24 @@ static void iwl_mvm_d3_update_keys(struct ieee80211_hw *hw, · 42 unmodified lines
19471872
19481873 static bool iwl_mvm_gtk_rekey(struct iwl_wowlan_status_data *status,
19491874 struct ieee80211_vif *vif,
1950− struct iwl_mvm *mvm, u32 gtk_cipher)
1875+ struct iwl_mvm *mvm)
19511876 {
19521877 int i, j;
19531878 struct ieee80211_key_conf *key;
1954− DEFINE_RAW_FLEX(struct ieee80211_key_conf, conf, key,
1955− WOWLAN_KEY_MAX_SIZE);
19561879 int link_id = vif->active_links ? __ffs(vif->active_links) : -1;
1957− u8 key_data[WOWLAN_KEY_MAX_SIZE];
1958−
1959− conf->cipher = gtk_cipher;
1960−
1961− BUILD_BUG_ON(WLAN_KEY_LEN_CCMP != WLAN_KEY_LEN_GCMP);
1962− BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < WLAN_KEY_LEN_CCMP);
1963− BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < WLAN_KEY_LEN_GCMP_256);
1964− BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < WLAN_KEY_LEN_TKIP);
1965− BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < sizeof(status->gtk[0].key));
1966−
1967− switch (gtk_cipher) {
1968− case WLAN_CIPHER_SUITE_CCMP:
1969− case WLAN_CIPHER_SUITE_GCMP:
1970− conf->keylen = WLAN_KEY_LEN_CCMP;
1971− break;
1972− case WLAN_CIPHER_SUITE_GCMP_256:
1973− conf->keylen = WLAN_KEY_LEN_GCMP_256;
1974− break;
1975− case WLAN_CIPHER_SUITE_TKIP:
1976− conf->keylen = WLAN_KEY_LEN_TKIP;
1977− break;
1978− default:
1979− WARN_ON(1);
1980− }
19811880
19821881 for (i = 0; i < ARRAY_SIZE(status->gtk); i++) {
19831882 if (!status->gtk[i].len)
19841883 continue;
19851884
1986− conf->keyidx = status->gtk[i].id;
19871885 IWL_DEBUG_WOWLAN(mvm,
1988− "Received from FW GTK cipher %d, key index %d\n",
1989− conf->cipher, conf->keyidx);
1990− memcpy(conf->key, status->gtk[i].key,
1991− sizeof(status->gtk[i].key));
1992− memcpy(key_data, status->gtk[i].key, sizeof(status->gtk[i].key));
1993−
1994− key = ieee80211_gtk_rekey_add(vif, status->gtk[i].id, key_data,
1995− sizeof(key_data), link_id);
1886+ "Received from FW GTK: key index %d\n",
1887+ status->gtk[i].id);
1888+
1889+ key = ieee80211_gtk_rekey_add(vif, status->gtk[i].id,
1890+ status->gtk[i].key,
1891+ sizeof(status->gtk[i].key),
1892+ link_id);
19961893 if (IS_ERR(key)) {
19971894 /* FW may send also the old keys */
19981895 if (PTR_ERR(key) == -EALREADY)
@@ -2015,53 +1912,26 @@ static bool iwl_mvm_gtk_rekey(struct iwl_wowlan_status_data *status, · 16 unmodified lines
20151912
20161913 static bool
20171914 iwl_mvm_d3_igtk_bigtk_rekey_add(struct iwl_wowlan_status_data *status,
2018− struct ieee80211_vif *vif, u32 cipher,
1915+ struct ieee80211_vif *vif,
20191916 struct iwl_multicast_key_data *key_data)
20201917 {
20211918 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
2022− DEFINE_RAW_FLEX(struct ieee80211_key_conf, conf, key,
2023− WOWLAN_KEY_MAX_SIZE);
20241919 struct ieee80211_key_conf *key_config;
20251920 struct ieee80211_key_seq seq;
20261921 int link_id = vif->active_links ? __ffs(vif->active_links) : -1;
2027− u8 key[WOWLAN_KEY_MAX_SIZE];
20281922 s8 keyidx = key_data->id;
20291923
2030− conf->cipher = cipher;
2031− conf->keyidx = keyidx;
2032−
20331924 if (!key_data->len)
20341925 return true;
20351926
2036− iwl_mvm_d3_set_igtk_bigtk_ipn(key_data, &seq, conf->cipher);
2037−
2038− switch (cipher) {
2039− case WLAN_CIPHER_SUITE_BIP_GMAC_128:
2040− conf->keylen = WLAN_KEY_LEN_BIP_GMAC_128;
2041− break;
2042− case WLAN_CIPHER_SUITE_BIP_GMAC_256:
2043− conf->keylen = WLAN_KEY_LEN_BIP_GMAC_256;
2044− break;
2045− case WLAN_CIPHER_SUITE_AES_CMAC:
2046− conf->keylen = WLAN_KEY_LEN_AES_CMAC;
2047− break;
2048− case WLAN_CIPHER_SUITE_BIP_CMAC_256:
2049− conf->keylen = WLAN_KEY_LEN_BIP_CMAC_256;
2050− break;
2051− default:
2052− WARN_ON(1);
2053− }
2054− BUILD_BUG_ON(WOWLAN_KEY_MAX_SIZE < sizeof(key_data->key));
2055− memcpy(conf->key, key_data->key, conf->keylen);
2056−
2057− memcpy(key, key_data->key, sizeof(key_data->key));
2058−
2059− key_config = ieee80211_gtk_rekey_add(vif, keyidx, key, sizeof(key),
2060− link_id);
1927+ key_config = ieee80211_gtk_rekey_add(vif, keyidx, key_data->key,
1928+ sizeof(key_data->key), link_id);
20611929 if (IS_ERR(key_config)) {
20621930 /* FW may send also the old keys */
20631931 return PTR_ERR(key_config) == -EALREADY;
20641932 }
1933+
1934+ iwl_mvm_d3_set_igtk_bigtk_ipn(key_data, &seq, key_config->cipher);
20651935 ieee80211_set_key_rx_seq(key_config, 0, &seq);
20661936
20671937 if (keyidx == 4 || keyidx == 5) {
@@ -2115,27 +1985,6 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, · 47 unmodified lines
21151985
21161986 if (!status || !vif->bss_conf.bssid)
21171987 return false;
2118−
2119− if (iwl_mvm_lookup_wowlan_status_ver(mvm) > 6 ||
2120− iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP,
2121− WOWLAN_INFO_NOTIFICATION,
2122− 0))
2123− gtkdata.igtk_support = true;
2124−
2125− if (iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP,
2126− WOWLAN_INFO_NOTIFICATION,
2127− 0) >= 3)
2128− gtkdata.bigtk_support = true;
2129−
2130− /* find last GTK that we used initially, if any */
2131− ieee80211_iter_keys(mvm->hw, vif,
2132− iwl_mvm_d3_find_last_keys, &gtkdata);
2133− /* not trying to keep connections with MFP/unhandled ciphers */
2134− if (gtkdata.unhandled_cipher)
2135− return false;
2136− if (!gtkdata.num_keys)
2137− goto out;
2138−
21391988 /*
21401989 * invalidate all other GTKs that might still exist and update
21411990 * the one that we used
@@ -2149,17 +1998,15 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, · 7 unmodified lines
21491998 IWL_DEBUG_WOWLAN(mvm, "num of GTK rekeying %d\n",
21501999 status->num_of_gtk_rekeys);
21512000
2152− if (!iwl_mvm_gtk_rekey(status, vif, mvm, gtkdata.gtk_cipher))
2001+ if (!iwl_mvm_gtk_rekey(status, vif, mvm))
21532002 return false;
21542003
21552004 if (!iwl_mvm_d3_igtk_bigtk_rekey_add(status, vif,
2156− gtkdata.igtk_cipher,
21572005 &status->igtk))
21582006 return false;
21592007
21602008 for (i = 0; i < ARRAY_SIZE(status->bigtk); i++) {
21612009 if (!iwl_mvm_d3_igtk_bigtk_rekey_add(status, vif,
2162− gtkdata.bigtk_cipher,
21632010 &status->bigtk[i]))
21642011 return false;
21652012 }
@@ -2168,7 +2015,6 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, · 2 unmodified lines
21682015 (void *)&replay_ctr, GFP_KERNEL);
21692016 }
21702017
2171−out:
21722018 if (iwl_fw_lookup_notif_ver(mvm->fw, LONG_GROUP,
21732019 WOWLAN_GET_STATUSES,
21742020 IWL_FW_CMD_VER_UNKNOWN) < 10) {
@@ -2236,7 +2082,7 @@ static void iwl_mvm_convert_gtk_v3(struct iwl_wowlan_status_data *status, · 61 unmodified lines
22362082 }
22372083
22382084 static void iwl_mvm_convert_igtk(struct iwl_wowlan_status_data *status,
2239− struct iwl_wowlan_igtk_status *data)
2085+ struct iwl_wowlan_igtk_status_v1 *data)
22402086 {
22412087 int i;
22422088
@@ -2260,7 +2106,7 @@ static void iwl_mvm_convert_igtk(struct iwl_wowlan_status_data *status, · 17 unmodified lines
22602106 }
22612107
22622108 static void iwl_mvm_convert_bigtk(struct iwl_wowlan_status_data *status,
2263− const struct iwl_wowlan_igtk_status *data)
2109+ const struct iwl_wowlan_igtk_status_v1 *data)
22642110 {
22652111 int data_idx, status_idx = 0;
22662112
@@ -2291,7 +2137,7 @@ static void iwl_mvm_convert_bigtk(struct iwl_wowlan_status_data *status, · 24 unmodified lines
22912137 }
22922138
22932139 static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm,
2294− struct iwl_wowlan_info_notif *data,
2140+ struct iwl_wowlan_info_notif_v5 *data,
22952141 struct iwl_wowlan_status_data *status,
22962142 u32 len)
22972143 {
@@ -2727,7 +2573,6 @@ enum iwl_d3_notif { · 429 unmodified lines
27272573 /* manage d3 resume data */
27282574 struct iwl_d3_data {
27292575 struct iwl_wowlan_status_data *status;
2730− bool test;
27312576 u32 d3_end_flags;
27322577 u32 notif_expected; /* bitmap - see &enum iwl_d3_notif */
27332578 u32 notif_received; /* bitmap - see &enum iwl_d3_notif */
@@ -2919,18 +2764,11 @@ iwl_mvm_choose_query_wakeup_reasons(struct iwl_mvm *mvm, · 185 unmodified lines
29192764
29202765 if (mvm->net_detect) {
29212766 iwl_mvm_query_netdetect_reasons(mvm, vif, d3_data);
2922− } else {
2923− bool keep = iwl_mvm_query_wakeup_reasons(mvm, vif,
2924− d3_data->status);
2925−
2926−#ifdef CONFIG_IWLWIFI_DEBUGFS
2927− if (keep)
2928− mvm->keep_vif = vif;
2929−#endif
2930−
2931− return keep;
2767+ return false;
29322768 }
2933− return false;
2769+
2770+ return iwl_mvm_query_wakeup_reasons(mvm, vif,
2771+ d3_data->status);
29342772 }
29352773
29362774 #define IWL_WOWLAN_WAKEUP_REASON_HAS_WAKEUP_PKT (IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET | \
@@ -3069,7 +2907,7 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait, · 132 unmodified lines
30692907 iwl_mvm_parse_wowlan_info_notif_v3(mvm, notif,
30702908 d3_data->status, len);
30712909 } else if (wowlan_info_ver == 5) {
3072− struct iwl_wowlan_info_notif *notif =
2910+ struct iwl_wowlan_info_notif_v5 *notif =
30732911 (void *)pkt->data;
30742912
30752913 iwl_mvm_parse_wowlan_info_notif(mvm, notif,
@@ -3143,10 +2981,9 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait, · 67 unmodified lines
31432981 return d3_data->notif_received == d3_data->notif_expected;
31442982 }
31452983
3146−static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm, bool test)
2984+static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm)
31472985 {
31482986 int ret;
3149− enum iwl_d3_status d3_status;
31502987 struct iwl_host_cmd cmd = {
31512988 .id = D0I3_END_CMD,
31522989 .flags = CMD_WANT_SKB,
@@ -3154,15 +2991,10 @@ static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm, bool test) · 1 unmodified line
31542991 bool reset = fw_has_capa(&mvm->fw->ucode_capa,
31552992 IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG);
31562993
3157− ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test, !reset);
2994+ ret = iwl_trans_d3_resume(mvm->trans, !reset);
31582995 if (ret)
31592996 return ret;
31602997
3161− if (d3_status != IWL_D3_STATUS_ALIVE) {
3162− IWL_INFO(mvm, "Device was reset during suspend\n");
3163− return -ENOENT;
3164− }
3165−
31662998 /*
31672999 * We should trigger resume flow using command only for 22000 family
31683000 * AX210 and above don't need the command since they have
@@ -3207,7 +3039,7 @@ static int iwl_mvm_d3_notif_wait(struct iwl_mvm *mvm, · 38 unmodified lines
32073039 ARRAY_SIZE(d3_resume_notif),
32083040 iwl_mvm_wait_d3_notif, d3_data);
32093041
3210− ret = iwl_mvm_resume_firmware(mvm, d3_data->test);
3042+ ret = iwl_mvm_resume_firmware(mvm);
32113043 if (ret) {
32123044 iwl_remove_notification(&mvm->notif_wait, &wait_d3_notif);
32133045 return ret;
@@ -3227,13 +3059,12 @@ static inline bool iwl_mvm_d3_resume_notif_based(struct iwl_mvm *mvm) · 13 unmodified lines
32273059 D3_END_NOTIFICATION, 0);
32283060 }
32293061
3230−static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
3062+static int __iwl_mvm_resume(struct iwl_mvm *mvm)
32313063 {
32323064 struct ieee80211_vif *vif = NULL;
32333065 int ret = 1;
32343066 struct iwl_mvm_nd_results results = {};
32353067 struct iwl_d3_data d3_data = {
3236− .test = test,
32373068 .notif_expected =
32383069 IWL_D3_NOTIF_WOWLAN_INFO |
32393070 IWL_D3_NOTIF_D3_END_NOTIF,
@@ -3271,7 +3102,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) · 31 unmodified lines
32713102
32723103 rt_status = iwl_mvm_check_rt_status(mvm, vif);
32733104 if (rt_status != FW_ALIVE) {
3274− set_bit(STATUS_FW_ERROR, &mvm->trans->status);
3105+ iwl_trans_notify_fw_error(mvm->trans);
32753106 if (rt_status == FW_ERROR) {
32763107 IWL_ERR(mvm, "FW Error occurred during suspend. Restarting.\n");
32773108 iwl_mvm_dump_nic_error_log(mvm);
@@ -3298,13 +3129,11 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) · 20 unmodified lines
32983129 if (ret)
32993130 goto err;
33003131 } else {
3301− ret = iwl_mvm_resume_firmware(mvm, test);
3132+ ret = iwl_mvm_resume_firmware(mvm);
33023133 if (ret < 0)
33033134 goto err;
33043135 }
33053136
3306− iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_WOWLAN);
3307−
33083137 /* when reset is required we can't send these following commands */
33093138 if (d3_data.d3_end_flags & IWL_D0I3_RESET_REQUIRE)
33103139 goto query_wakeup_reasons;
@@ -3346,7 +3175,7 @@ out: · 35 unmodified lines
33463175 kfree(d3_data.status);
33473176 iwl_mvm_free_nd(mvm);
33483177
3349− if (!d3_data.test && !mvm->net_detect)
3178+ if (!mvm->net_detect)
33503179 ieee80211_iterate_active_interfaces_mtx(mvm->hw,
33513180 IEEE80211_IFACE_ITER_NORMAL,
33523181 iwl_mvm_d3_disconnect_iter,
@@ -3385,7 +3214,7 @@ int iwl_mvm_resume(struct ieee80211_hw *hw) · 32 unmodified lines
33853214 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
33863215 int ret;
33873216
3388− ret = __iwl_mvm_resume(mvm, false);
3217+ ret = __iwl_mvm_resume(mvm);
33893218
33903219 iwl_mvm_resume_tcm(mvm);
33913220
@@ -3420,7 +3249,7 @@ void iwl_mvm_fast_suspend(struct iwl_mvm *mvm) · 28 unmodified lines
34203249 IWL_ERR(mvm,
34213250 "fast suspend: couldn't send D3_CONFIG_CMD %d\n", ret);
34223251
3423− ret = iwl_trans_d3_suspend(mvm->trans, false, false);
3252+ ret = iwl_trans_d3_suspend(mvm->trans, false);
34243253 if (ret)
34253254 IWL_ERR(mvm, "fast suspend: trans_d3_suspend failed %d\n", ret);
34263255 }
@@ -3443,7 +3272,7 @@ int iwl_mvm_fast_resume(struct iwl_mvm *mvm) · 16 unmodified lines
34433272
34443273 rt_status = iwl_mvm_check_rt_status(mvm, NULL);
34453274 if (rt_status != FW_ALIVE) {
3446− set_bit(STATUS_FW_ERROR, &mvm->trans->status);
3275+ iwl_trans_notify_fw_error(mvm->trans);
34473276 if (rt_status == FW_ERROR) {
34483277 IWL_ERR(mvm,
34493278 "iwl_mvm_check_rt_status failed, device is gone during suspend\n");
@@ -3455,7 +3284,6 @@ int iwl_mvm_fast_resume(struct iwl_mvm *mvm) · 5 unmodified lines
34553284 &iwl_dump_desc_assert,
34563285 false, 0);
34573286 }
3458− mvm->trans->state = IWL_TRANS_NO_FW;
34593287 ret = -ENODEV;
34603288
34613289 goto out;
@@ -3473,125 +3301,3 @@ out: · 11 unmodified lines
34733301
34743302 return ret;
34753303 }
3476−
3477−#ifdef CONFIG_IWLWIFI_DEBUGFS
3478−static int iwl_mvm_d3_test_open(struct inode *inode, struct file *file)
3479−{
3480− struct iwl_mvm *mvm = inode->i_private;
3481− int err;
3482−
3483− if (mvm->d3_test_active)
3484− return -EBUSY;
3485−
3486− file->private_data = inode->i_private;
3487−
3488− iwl_mvm_pause_tcm(mvm, true);
3489−
3490− iwl_fw_runtime_suspend(&mvm->fwrt);
3491−
3492− /* start pseudo D3 */
3493− rtnl_lock();
3494− wiphy_lock(mvm->hw->wiphy);
3495− err = __iwl_mvm_suspend(mvm->hw, mvm->hw->wiphy->wowlan_config, true);
3496− wiphy_unlock(mvm->hw->wiphy);
3497− rtnl_unlock();
3498− if (err > 0)
3499− err = -EINVAL;
3500− if (err)
3501− return err;
3502−
3503− mvm->d3_test_active = true;
3504− mvm->keep_vif = NULL;
3505− return 0;
3506−}
3507−
3508−static ssize_t iwl_mvm_d3_test_read(struct file *file, char __user *user_buf,
3509− size_t count, loff_t *ppos)
3510−{
3511− struct iwl_mvm *mvm = file->private_data;
3512− unsigned long end = jiffies + 60 * HZ;
3513− u32 pme_asserted;
3514−
3515− while (true) {
3516− /* read pme_ptr if available */
3517− if (mvm->d3_test_pme_ptr) {
3518− pme_asserted = iwl_trans_read_mem32(mvm->trans,
3519− mvm->d3_test_pme_ptr);
3520− if (pme_asserted)
3521− break;
3522− }
3523−
3524− if (msleep_interruptible(100))
3525− break;
3526−
3527− if (time_is_before_jiffies(end)) {
3528− IWL_ERR(mvm,
3529− "ending pseudo-D3 with timeout after ~60 seconds\n");
3530− return -ETIMEDOUT;
3531− }
3532− }
3533−
3534− return 0;
3535−}
3536−
3537−static void iwl_mvm_d3_test_disconn_work_iter(void *_data, u8 *mac,
3538− struct ieee80211_vif *vif)
3539−{
3540− /* skip the one we keep connection on */
3541− if (_data == vif)
3542− return;
3543−
3544− if (vif->type == NL80211_IFTYPE_STATION)
3545− ieee80211_connection_loss(vif);
3546−}
3547−
3548−static int iwl_mvm_d3_test_release(struct inode *inode, struct file *file)
3549−{
3550− struct iwl_mvm *mvm = inode->i_private;
3551− bool unified_image = fw_has_capa(&mvm->fw->ucode_capa,
3552− IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG);
3553−
3554− mvm->d3_test_active = false;
3555−
3556− iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt);
3557−
3558− rtnl_lock();
3559− wiphy_lock(mvm->hw->wiphy);
3560− __iwl_mvm_resume(mvm, true);
3561− wiphy_unlock(mvm->hw->wiphy);
3562− rtnl_unlock();
3563−
3564− iwl_mvm_resume_tcm(mvm);
3565−
3566− iwl_fw_runtime_resume(&mvm->fwrt);
3567−
3568− iwl_abort_notification_waits(&mvm->notif_wait);
3569− if (!unified_image) {
3570− int remaining_time = 10;
3571−
3572− ieee80211_restart_hw(mvm->hw);
3573−
3574− /* wait for restart and disconnect all interfaces */
3575− while (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
3576− remaining_time > 0) {
3577− remaining_time--;
3578− msleep(1000);
3579− }
3580−
3581− if (remaining_time == 0)
3582− IWL_ERR(mvm, "Timed out waiting for HW restart!\n");
3583− }
3584−
3585− ieee80211_iterate_active_interfaces_atomic(
3586− mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
3587− iwl_mvm_d3_test_disconn_work_iter, mvm->keep_vif);
3588−
3589− return 0;
3590−}
3591−
3592−const struct file_operations iwl_dbgfs_d3_test_ops = {
3593− .open = iwl_mvm_d3_test_open,
3594− .read = iwl_mvm_d3_test_read,
3595− .release = iwl_mvm_d3_test_release,
3596−};
3597−#endif
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c+0−94
@@ -762,96 +762,6 @@ static ssize_t iwl_dbgfs_max_tx_op_read(struct file *file, · 761 unmodified lines
762762 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
763763 }
764764
765−static ssize_t iwl_dbgfs_int_mlo_scan_write(struct ieee80211_vif *vif,
766− char *buf, size_t count,
767− loff_t *ppos)
768−{
769− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
770− struct iwl_mvm *mvm = mvmvif->mvm;
771− u32 action;
772− int ret;
773−
774− if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif))
775− return -EINVAL;
776−
777− if (kstrtou32(buf, 0, &action))
778− return -EINVAL;
779−
780− mutex_lock(&mvm->mutex);
781−
782− if (!action) {
783− ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_INT_MLO, false);
784− } else if (action == 1) {
785− ret = iwl_mvm_int_mlo_scan(mvm, vif);
786− } else {
787− ret = -EINVAL;
788− }
789−
790− mutex_unlock(&mvm->mutex);
791−
792− return ret ?: count;
793−}
794−
795−static ssize_t iwl_dbgfs_esr_disable_reason_read(struct file *file,
796− char __user *user_buf,
797− size_t count, loff_t *ppos)
798−{
799− struct ieee80211_vif *vif = file->private_data;
800− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
801− struct iwl_mvm *mvm = mvmvif->mvm;
802− unsigned long esr_mask;
803− char *buf;
804− int bufsz, pos, i;
805− ssize_t rv;
806−
807− mutex_lock(&mvm->mutex);
808− esr_mask = mvmvif->esr_disable_reason;
809− mutex_unlock(&mvm->mutex);
810−
811− bufsz = hweight32(esr_mask) * 32 + 40;
812− buf = kmalloc(bufsz, GFP_KERNEL);
813− if (!buf)
814− return -ENOMEM;
815−
816− pos = scnprintf(buf, bufsz, "EMLSR state: '0x%lx'\nreasons:\n",
817− esr_mask);
818− for_each_set_bit(i, &esr_mask, BITS_PER_LONG)
819− pos += scnprintf(buf + pos, bufsz - pos, " - %s\n",
820− iwl_get_esr_state_string(BIT(i)));
821−
822− rv = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
823− kfree(buf);
824− return rv;
825−}
826−
827−static ssize_t iwl_dbgfs_esr_disable_reason_write(struct ieee80211_vif *vif,
828− char *buf, size_t count,
829− loff_t *ppos)
830−{
831− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
832− struct iwl_mvm *mvm = mvmvif->mvm;
833− u32 reason;
834− u8 block;
835− int ret;
836−
837− ret = sscanf(buf, "%u %hhu", &reason, &block);
838− if (ret < 0)
839− return ret;
840−
841− if (hweight16(reason) != 1 || !(reason & IWL_MVM_BLOCK_ESR_REASONS))
842− return -EINVAL;
843−
844− mutex_lock(&mvm->mutex);
845− if (block)
846− iwl_mvm_block_esr(mvm, vif, reason,
847− iwl_mvm_get_primary_link(vif));
848− else
849− iwl_mvm_unblock_esr(mvm, vif, reason);
850− mutex_unlock(&mvm->mutex);
851−
852− return count;
853−}
854−
855765 #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \
856766 _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif)
857767 #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \
@@ -884,8 +794,6 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(rx_phyinfo, 10); · 26 unmodified lines
884794 MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32);
885795 MVM_DEBUGFS_READ_FILE_OPS(os_device_timediff);
886796 MVM_DEBUGFS_READ_WRITE_FILE_OPS(max_tx_op, 10);
887−MVM_DEBUGFS_WRITE_FILE_OPS(int_mlo_scan, 32);
888−MVM_DEBUGFS_READ_WRITE_FILE_OPS(esr_disable_reason, 32);
889797
890798 void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
891799 {
@@ -916,8 +824,6 @@ void iwl_mvm_vif_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif) · 24 unmodified lines
916824 MVM_DEBUGFS_ADD_FILE_VIF(max_tx_op, mvmvif->dbgfs_dir, 0600);
917825 debugfs_create_bool("ftm_unprotected", 0200, mvmvif->dbgfs_dir,
918826 &mvmvif->ftm_unprotected);
919− MVM_DEBUGFS_ADD_FILE_VIF(int_mlo_scan, mvmvif->dbgfs_dir, 0200);
920− MVM_DEBUGFS_ADD_FILE_VIF(esr_disable_reason, mvmvif->dbgfs_dir, 0600);
921827
922828 if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
923829 mvmvif == mvm->bf_allowed_vif)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c+1−2
@@ -1134,7 +1134,7 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf, · 1133 unmodified lines
11341134
11351135 if (count == 6 && !strcmp(buf, "nolog\n")) {
11361136 set_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, &mvm->status);
1137− iwl_trans_suppress_cmd_error_once(mvm->trans);
1137+ mvm->trans->suppress_cmd_error_once = true;
11381138 }
11391139
11401140 /* take the return value to make compiler happy - it will fail anyway */
@@ -2159,7 +2159,6 @@ void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm) · 1018 unmodified lines
21592159 MVM_DEBUGFS_ADD_FILE(uapsd_noagg_bssids, mvm->debugfs_dir, S_IRUSR);
21602160
21612161 #ifdef CONFIG_PM_SLEEP
2162− MVM_DEBUGFS_ADD_FILE(d3_test, mvm->debugfs_dir, 0400);
21632162 debugfs_create_bool("d3_wake_sysassert", 0600, mvm->debugfs_dir,
21642163 &mvm->d3_wake_sysassert);
21652164 debugfs_create_u32("last_netdetect_scans", 0400, mvm->debugfs_dir,
drivers/net/wireless/intel/iwlwifi/mvm/fw.c+1−1
@@ -837,7 +837,7 @@ static int iwl_mvm_config_ltr(struct iwl_mvm *mvm) · 836 unmodified lines
837837 .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE),
838838 };
839839
840− if (!mvm->trans->ltr_enabled)
840+ if (!iwl_trans_is_ltr_enabled(mvm->trans))
841841 return 0;
842842
843843 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0,
drivers/net/wireless/intel/iwlwifi/mvm/link.c+0−809
@@ -5,50 +5,6 @@ · 4 unmodified lines
55 #include "mvm.h"
66 #include "time-event.h"
77
8−#define HANDLE_ESR_REASONS(HOW) \
9− HOW(BLOCKED_PREVENTION) \
10− HOW(BLOCKED_WOWLAN) \
11− HOW(BLOCKED_TPT) \
12− HOW(BLOCKED_FW) \
13− HOW(BLOCKED_NON_BSS) \
14− HOW(BLOCKED_ROC) \
15− HOW(BLOCKED_TMP_NON_BSS) \
16− HOW(EXIT_MISSED_BEACON) \
17− HOW(EXIT_LOW_RSSI) \
18− HOW(EXIT_COEX) \
19− HOW(EXIT_BANDWIDTH) \
20− HOW(EXIT_CSA) \
21− HOW(EXIT_LINK_USAGE)
22−
23−static const char *const iwl_mvm_esr_states_names[] = {
24−#define NAME_ENTRY(x) [ilog2(IWL_MVM_ESR_##x)] = #x,
25− HANDLE_ESR_REASONS(NAME_ENTRY)
26−};
27−
28−const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state)
29−{
30− int offs = ilog2(state);
31−
32− if (offs >= ARRAY_SIZE(iwl_mvm_esr_states_names) ||
33− !iwl_mvm_esr_states_names[offs])
34− return "UNKNOWN";
35−
36− return iwl_mvm_esr_states_names[offs];
37−}
38−
39−static void iwl_mvm_print_esr_state(struct iwl_mvm *mvm, u32 mask)
40−{
41−#define NAME_FMT(x) "%s"
42−#define NAME_PR(x) (mask & IWL_MVM_ESR_##x) ? "[" #x "]" : "",
43− IWL_DEBUG_INFO(mvm,
44− "EMLSR state = " HANDLE_ESR_REASONS(NAME_FMT)
45− " (0x%x)\n",
46− HANDLE_ESR_REASONS(NAME_PR)
47− mask);
48−#undef NAME_FMT
49−#undef NAME_PR
50−}
51−
528 static int iwl_mvm_link_cmd_send(struct iwl_mvm *mvm,
539 struct iwl_link_config_cmd *cmd,
5410 enum iwl_ctxt_action action)
@@ -114,65 +70,6 @@ int iwl_mvm_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 59 unmodified lines
11470 return iwl_mvm_link_cmd_send(mvm, &cmd, FW_CTXT_ACTION_ADD);
11571 }
11672
117−struct iwl_mvm_esr_iter_data {
118− struct ieee80211_vif *vif;
119− unsigned int link_id;
120− bool lift_block;
121−};
122−
123−static void iwl_mvm_esr_vif_iterator(void *_data, u8 *mac,
124− struct ieee80211_vif *vif)
125−{
126− struct iwl_mvm_esr_iter_data *data = _data;
127− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
128− int link_id;
129−
130− if (ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_STATION)
131− return;
132−
133− for_each_mvm_vif_valid_link(mvmvif, link_id) {
134− struct iwl_mvm_vif_link_info *link_info =
135− mvmvif->link[link_id];
136− if (vif == data->vif && link_id == data->link_id)
137− continue;
138− if (link_info->active)
139− data->lift_block = false;
140− }
141−}
142−
143−int iwl_mvm_esr_non_bss_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
144− unsigned int link_id, bool active)
145−{
146− /* An active link of a non-station vif blocks EMLSR. Upon activation
147− * block EMLSR on the bss vif. Upon deactivation, check if this link
148− * was the last non-station link active, and if so unblock the bss vif
149− */
150− struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm);
151− struct iwl_mvm_esr_iter_data data = {
152− .vif = vif,
153− .link_id = link_id,
154− .lift_block = true,
155− };
156−
157− if (IS_ERR_OR_NULL(bss_vif))
158− return 0;
159−
160− if (active)
161− return iwl_mvm_block_esr_sync(mvm, bss_vif,
162− IWL_MVM_ESR_BLOCKED_NON_BSS);
163−
164− ieee80211_iterate_active_interfaces(mvm->hw,
165− IEEE80211_IFACE_ITER_NORMAL,
166− iwl_mvm_esr_vif_iterator, &data);
167− if (data.lift_block) {
168− mutex_lock(&mvm->mutex);
169− iwl_mvm_unblock_esr(mvm, bss_vif, IWL_MVM_ESR_BLOCKED_NON_BSS);
170− mutex_unlock(&mvm->mutex);
171− }
172−
173− return 0;
174−}
175−
17673 int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
17774 struct ieee80211_bss_conf *link_conf,
17875 u32 changes, bool active)
@@ -388,452 +285,6 @@ int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 209 unmodified lines
388285 return ret;
389286 }
390287
391−struct iwl_mvm_rssi_to_grade {
392− s8 rssi[2];
393− u16 grade;
394−};
395−
396−#define RSSI_TO_GRADE_LINE(_lb, _hb_uhb, _grade) \
397− { \
398− .rssi = {_lb, _hb_uhb}, \
399− .grade = _grade \
400− }
401−
402−/*
403− * This array must be sorted by increasing RSSI for proper functionality.
404− * The grades are actually estimated throughput, represented as fixed-point
405− * with a scale factor of 1/10.
406− */
407−static const struct iwl_mvm_rssi_to_grade rssi_to_grade_map[] = {
408− RSSI_TO_GRADE_LINE(-85, -89, 177),
409− RSSI_TO_GRADE_LINE(-83, -86, 344),
410− RSSI_TO_GRADE_LINE(-82, -85, 516),
411− RSSI_TO_GRADE_LINE(-80, -83, 688),
412− RSSI_TO_GRADE_LINE(-77, -79, 1032),
413− RSSI_TO_GRADE_LINE(-73, -76, 1376),
414− RSSI_TO_GRADE_LINE(-70, -74, 1548),
415− RSSI_TO_GRADE_LINE(-69, -72, 1750),
416− RSSI_TO_GRADE_LINE(-65, -68, 2064),
417− RSSI_TO_GRADE_LINE(-61, -66, 2294),
418− RSSI_TO_GRADE_LINE(-58, -61, 2580),
419− RSSI_TO_GRADE_LINE(-55, -58, 2868),
420− RSSI_TO_GRADE_LINE(-46, -55, 3098),
421− RSSI_TO_GRADE_LINE(-43, -54, 3442)
422−};
423−
424−#define MAX_GRADE (rssi_to_grade_map[ARRAY_SIZE(rssi_to_grade_map) - 1].grade)
425−
426−#define DEFAULT_CHAN_LOAD_LB 30
427−#define DEFAULT_CHAN_LOAD_HB 15
428−#define DEFAULT_CHAN_LOAD_UHB 0
429−
430−/* Factors calculation is done with fixed-point with a scaling factor of 1/256 */
431−#define SCALE_FACTOR 256
432−
433−/* Convert a percentage from [0,100] to [0,255] */
434−#define NORMALIZE_PERCENT_TO_255(percentage) ((percentage) * SCALE_FACTOR / 100)
435−
436−static unsigned int
437−iwl_mvm_get_puncturing_factor(const struct ieee80211_bss_conf *link_conf)
438−{
439− enum nl80211_chan_width chan_width =
440− link_conf->chanreq.oper.width;
441− int mhz = nl80211_chan_width_to_mhz(chan_width);
442− unsigned int n_subchannels, n_punctured, puncturing_penalty;
443−
444− if (WARN_ONCE(mhz < 20 || mhz > 320,
445− "Invalid channel width : (%d)\n", mhz))
446− return SCALE_FACTOR;
447−
448− /* No puncturing, no penalty */
449− if (mhz < 80)
450− return SCALE_FACTOR;
451−
452− /* total number of subchannels */
453− n_subchannels = mhz / 20;
454− /* how many of these are punctured */
455− n_punctured = hweight16(link_conf->chanreq.oper.punctured);
456−
457− puncturing_penalty = n_punctured * SCALE_FACTOR / n_subchannels;
458− return SCALE_FACTOR - puncturing_penalty;
459−}
460−
461−static unsigned int
462−iwl_mvm_get_chan_load(struct ieee80211_bss_conf *link_conf)
463−{
464− struct ieee80211_vif *vif = link_conf->vif;
465− struct iwl_mvm_vif_link_info *mvm_link =
466− iwl_mvm_vif_from_mac80211(link_conf->vif)->link[link_conf->link_id];
467− const struct element *bss_load_elem;
468− const struct ieee80211_bss_load_elem *bss_load;
469− enum nl80211_band band = link_conf->chanreq.oper.chan->band;
470− const struct cfg80211_bss_ies *ies;
471− unsigned int chan_load;
472− u32 chan_load_by_us;
473−
474− rcu_read_lock();
475− if (ieee80211_vif_link_active(vif, link_conf->link_id))
476− ies = rcu_dereference(link_conf->bss->beacon_ies);
477− else
478− ies = rcu_dereference(link_conf->bss->ies);
479−
480− if (ies)
481− bss_load_elem = cfg80211_find_elem(WLAN_EID_QBSS_LOAD,
482− ies->data, ies->len);
483− else
484− bss_load_elem = NULL;
485−
486− /* If there isn't BSS Load element, take the defaults */
487− if (!bss_load_elem ||
488− bss_load_elem->datalen != sizeof(*bss_load)) {
489− rcu_read_unlock();
490− switch (band) {
491− case NL80211_BAND_2GHZ:
492− chan_load = DEFAULT_CHAN_LOAD_LB;
493− break;
494− case NL80211_BAND_5GHZ:
495− chan_load = DEFAULT_CHAN_LOAD_HB;
496− break;
497− case NL80211_BAND_6GHZ:
498− chan_load = DEFAULT_CHAN_LOAD_UHB;
499− break;
500− default:
501− chan_load = 0;
502− break;
503− }
504− /* The defaults are given in percentage */
505− return NORMALIZE_PERCENT_TO_255(chan_load);
506− }
507−
508− bss_load = (const void *)bss_load_elem->data;
509− /* Channel util is in range 0-255 */
510− chan_load = bss_load->channel_util;
511− rcu_read_unlock();
512−
513− if (!mvm_link || !mvm_link->active)
514− return chan_load;
515−
516− if (WARN_ONCE(!mvm_link->phy_ctxt,
517− "Active link (%u) without phy ctxt assigned!\n",
518− link_conf->link_id))
519− return chan_load;
520−
521− /* channel load by us is given in percentage */
522− chan_load_by_us =
523− NORMALIZE_PERCENT_TO_255(mvm_link->phy_ctxt->channel_load_by_us);
524−
525− /* Use only values that firmware sends that can possibly be valid */
526− if (chan_load_by_us <= chan_load)
527− chan_load -= chan_load_by_us;
528−
529− return chan_load;
530−}
531−
532−static unsigned int
533−iwl_mvm_get_chan_load_factor(struct ieee80211_bss_conf *link_conf)
534−{
535− return SCALE_FACTOR - iwl_mvm_get_chan_load(link_conf);
536−}
537−
538−/* This function calculates the grade of a link. Returns 0 in error case */
539−VISIBLE_IF_IWLWIFI_KUNIT
540−unsigned int iwl_mvm_get_link_grade(struct ieee80211_bss_conf *link_conf)
541−{
542− enum nl80211_band band;
543− int i, rssi_idx;
544− s32 link_rssi;
545− unsigned int grade = MAX_GRADE;
546−
547− if (WARN_ON_ONCE(!link_conf))
548− return 0;
549−
550− band = link_conf->chanreq.oper.chan->band;
551− if (WARN_ONCE(band != NL80211_BAND_2GHZ &&
552− band != NL80211_BAND_5GHZ &&
553− band != NL80211_BAND_6GHZ,
554− "Invalid band (%u)\n", band))
555− return 0;
556−
557− link_rssi = MBM_TO_DBM(link_conf->bss->signal);
558− /*
559− * For 6 GHz the RSSI of the beacons is lower than
560− * the RSSI of the data.
561− */
562− if (band == NL80211_BAND_6GHZ)
563− link_rssi += 4;
564−
565− rssi_idx = band == NL80211_BAND_2GHZ ? 0 : 1;
566−
567− /* No valid RSSI - take the lowest grade */
568− if (!link_rssi)
569− link_rssi = rssi_to_grade_map[0].rssi[rssi_idx];
570−
571− /* Get grade based on RSSI */
572− for (i = 0; i < ARRAY_SIZE(rssi_to_grade_map); i++) {
573− const struct iwl_mvm_rssi_to_grade *line =
574− &rssi_to_grade_map[i];
575−
576− if (link_rssi > line->rssi[rssi_idx])
577− continue;
578− grade = line->grade;
579− break;
580− }
581−
582− /* apply the channel load and puncturing factors */
583− grade = grade * iwl_mvm_get_chan_load_factor(link_conf) / SCALE_FACTOR;
584− grade = grade * iwl_mvm_get_puncturing_factor(link_conf) / SCALE_FACTOR;
585− return grade;
586−}
587−EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mvm_get_link_grade);
588−
589−static
590−u8 iwl_mvm_set_link_selection_data(struct ieee80211_vif *vif,
591− struct iwl_mvm_link_sel_data *data,
592− unsigned long usable_links,
593− u8 *best_link_idx)
594−{
595− u8 n_data = 0;
596− u16 max_grade = 0;
597− unsigned long link_id;
598−
599− /* TODO: don't select links that weren't discovered in the last scan */
600− for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) {
601− struct ieee80211_bss_conf *link_conf =
602− link_conf_dereference_protected(vif, link_id);
603−
604− if (WARN_ON_ONCE(!link_conf))
605− continue;
606−
607− data[n_data].link_id = link_id;
608− data[n_data].chandef = &link_conf->chanreq.oper;
609− data[n_data].signal = link_conf->bss->signal / 100;
610− data[n_data].grade = iwl_mvm_get_link_grade(link_conf);
611−
612− if (data[n_data].grade > max_grade) {
613− max_grade = data[n_data].grade;
614− *best_link_idx = n_data;
615− }
616− n_data++;
617− }
618−
619− return n_data;
620−}
621−
622−struct iwl_mvm_bw_to_rssi_threshs {
623− s8 low;
624− s8 high;
625−};
626−
627−#define BW_TO_RSSI_THRESHOLDS(_bw) \
628− [IWL_PHY_CHANNEL_MODE ## _bw] = { \
629− .low = IWL_MVM_LOW_RSSI_THRESH_##_bw##MHZ, \
630− .high = IWL_MVM_HIGH_RSSI_THRESH_##_bw##MHZ \
631− }
632−
633−s8 iwl_mvm_get_esr_rssi_thresh(struct iwl_mvm *mvm,
634− const struct cfg80211_chan_def *chandef,
635− bool low)
636−{
637− const struct iwl_mvm_bw_to_rssi_threshs bw_to_rssi_threshs_map[] = {
638− BW_TO_RSSI_THRESHOLDS(20),
639− BW_TO_RSSI_THRESHOLDS(40),
640− BW_TO_RSSI_THRESHOLDS(80),
641− BW_TO_RSSI_THRESHOLDS(160)
642− /* 320 MHz has the same thresholds as 20 MHz */
643− };
644− const struct iwl_mvm_bw_to_rssi_threshs *threshs;
645− u8 chan_width = iwl_mvm_get_channel_width(chandef);
646−
647− if (WARN_ON(chandef->chan->band != NL80211_BAND_2GHZ &&
648− chandef->chan->band != NL80211_BAND_5GHZ &&
649− chandef->chan->band != NL80211_BAND_6GHZ))
650− return S8_MAX;
651−
652− /* 6 GHz will always use 20 MHz thresholds, regardless of the BW */
653− if (chan_width == IWL_PHY_CHANNEL_MODE320)
654− chan_width = IWL_PHY_CHANNEL_MODE20;
655−
656− threshs = &bw_to_rssi_threshs_map[chan_width];
657−
658− return low ? threshs->low : threshs->high;
659−}
660−
661−static u32
662−iwl_mvm_esr_disallowed_with_link(struct iwl_mvm *mvm,
663− struct ieee80211_vif *vif,
664− const struct iwl_mvm_link_sel_data *link,
665− bool primary)
666−{
667− struct wiphy *wiphy = mvm->hw->wiphy;
668− struct ieee80211_bss_conf *conf;
669− enum iwl_mvm_esr_state ret = 0;
670− s8 thresh;
671−
672− conf = wiphy_dereference(wiphy, vif->link_conf[link->link_id]);
673− if (WARN_ON_ONCE(!conf))
674− return false;
675−
676− /* BT Coex effects eSR mode only if one of the links is on LB */
677− if (link->chandef->chan->band == NL80211_BAND_2GHZ &&
678− (!iwl_mvm_bt_coex_calculate_esr_mode(mvm, vif, link->signal,
679− primary)))
680− ret |= IWL_MVM_ESR_EXIT_COEX;
681−
682− thresh = iwl_mvm_get_esr_rssi_thresh(mvm, link->chandef,
683− false);
684−
685− if (link->signal < thresh)
686− ret |= IWL_MVM_ESR_EXIT_LOW_RSSI;
687−
688− if (conf->csa_active)
689− ret |= IWL_MVM_ESR_EXIT_CSA;
690−
691− if (ret) {
692− IWL_DEBUG_INFO(mvm,
693− "Link %d is not allowed for esr\n",
694− link->link_id);
695− iwl_mvm_print_esr_state(mvm, ret);
696− }
697− return ret;
698−}
699−
700−VISIBLE_IF_IWLWIFI_KUNIT
701−bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif,
702− const struct iwl_mvm_link_sel_data *a,
703− const struct iwl_mvm_link_sel_data *b)
704−{
705− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
706− struct iwl_mvm *mvm = mvmvif->mvm;
707− enum iwl_mvm_esr_state ret = 0;
708−
709− /* Per-link considerations */
710− if (iwl_mvm_esr_disallowed_with_link(mvm, vif, a, true) ||
711− iwl_mvm_esr_disallowed_with_link(mvm, vif, b, false))
712− return false;
713−
714− if (a->chandef->chan->band == b->chandef->chan->band ||
715− a->chandef->width != b->chandef->width)
716− ret |= IWL_MVM_ESR_EXIT_BANDWIDTH;
717−
718− if (ret) {
719− IWL_DEBUG_INFO(mvm,
720− "Links %d and %d are not a valid pair for EMLSR\n",
721− a->link_id, b->link_id);
722− iwl_mvm_print_esr_state(mvm, ret);
723− return false;
724− }
725−
726− return true;
727−
728−}
729−EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mvm_mld_valid_link_pair);
730−
731−/*
732− * Returns the combined eSR grade of two given links.
733− * Returns 0 if eSR is not allowed with these 2 links.
734− */
735−static
736−unsigned int iwl_mvm_get_esr_grade(struct ieee80211_vif *vif,
737− const struct iwl_mvm_link_sel_data *a,
738− const struct iwl_mvm_link_sel_data *b,
739− u8 *primary_id)
740−{
741− struct ieee80211_bss_conf *primary_conf;
742− struct wiphy *wiphy = ieee80211_vif_to_wdev(vif)->wiphy;
743− unsigned int primary_load;
744−
745− lockdep_assert_wiphy(wiphy);
746−
747− /* a is always primary, b is always secondary */
748− if (b->grade > a->grade)
749− swap(a, b);
750−
751− *primary_id = a->link_id;
752−
753− if (!iwl_mvm_mld_valid_link_pair(vif, a, b))
754− return 0;
755−
756− primary_conf = wiphy_dereference(wiphy, vif->link_conf[*primary_id]);
757−
758− if (WARN_ON_ONCE(!primary_conf))
759− return 0;
760−
761− primary_load = iwl_mvm_get_chan_load(primary_conf);
762−
763− return a->grade +
764− ((b->grade * primary_load) / SCALE_FACTOR);
765−}
766−
767−void iwl_mvm_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
768−{
769− struct iwl_mvm_link_sel_data data[IEEE80211_MLD_MAX_NUM_LINKS];
770− struct iwl_mvm_link_sel_data *best_link;
771− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
772− u32 max_active_links = iwl_mvm_max_active_links(mvm, vif);
773− u16 usable_links = ieee80211_vif_usable_links(vif);
774− u8 best, primary_link, best_in_pair, n_data;
775− u16 max_esr_grade = 0, new_active_links;
776−
777− lockdep_assert_wiphy(mvm->hw->wiphy);
778−
779− if (!mvmvif->authorized || !ieee80211_vif_is_mld(vif))
780− return;
781−
782− if (!IWL_MVM_AUTO_EML_ENABLE)
783− return;
784−
785− /* The logic below is a simple version that doesn't suit more than 2
786− * links
787− */
788− WARN_ON_ONCE(max_active_links > 2);
789−
790− n_data = iwl_mvm_set_link_selection_data(vif, data, usable_links,
791− &best);
792−
793− if (WARN(!n_data, "Couldn't find a valid grade for any link!\n"))
794− return;
795−
796− best_link = &data[best];
797− primary_link = best_link->link_id;
798− new_active_links = BIT(best_link->link_id);
799−
800− /* eSR is not supported/blocked, or only one usable link */
801− if (max_active_links == 1 || !iwl_mvm_vif_has_esr_cap(mvm, vif) ||
802− mvmvif->esr_disable_reason || n_data == 1)
803− goto set_active;
804−
805− for (u8 a = 0; a < n_data; a++)
806− for (u8 b = a + 1; b < n_data; b++) {
807− u16 esr_grade = iwl_mvm_get_esr_grade(vif, &data[a],
808− &data[b],
809− &best_in_pair);
810−
811− if (esr_grade <= max_esr_grade)
812− continue;
813−
814− max_esr_grade = esr_grade;
815− primary_link = best_in_pair;
816− new_active_links = BIT(data[a].link_id) |
817− BIT(data[b].link_id);
818− }
819−
820− /* No valid pair was found, go with the best link */
821− if (hweight16(new_active_links) <= 1)
822− goto set_active;
823−
824− /* For equal grade - prefer EMLSR */
825− if (best_link->grade > max_esr_grade) {
826− primary_link = best_link->link_id;
827− new_active_links = BIT(best_link->link_id);
828− }
829−set_active:
830− IWL_DEBUG_INFO(mvm, "Link selection result: 0x%x. Primary = %d\n",
831− new_active_links, primary_link);
832− ieee80211_set_active_links_async(vif, new_active_links);
833− mvmvif->link_selection_res = new_active_links;
834− mvmvif->link_selection_primary = primary_link;
835−}
836−
837288 u8 iwl_mvm_get_primary_link(struct ieee80211_vif *vif)
838289 {
839290 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
@@ -856,266 +307,6 @@ u8 iwl_mvm_get_primary_link(struct ieee80211_vif *vif) · 16 unmodified lines
856307 return __ffs(vif->active_links);
857308 }
858309
859−/*
860− * For non-MLO/single link, this will return the deflink/single active link,
861− * respectively
862− */
863−u8 iwl_mvm_get_other_link(struct ieee80211_vif *vif, u8 link_id)
864−{
865− switch (hweight16(vif->active_links)) {
866− case 0:
867− return 0;
868− default:
869− WARN_ON(1);
870− fallthrough;
871− case 1:
872− return __ffs(vif->active_links);
873− case 2:
874− return __ffs(vif->active_links & ~BIT(link_id));
875− }
876−}
877−
878−/* Reasons that can cause esr prevention */
879−#define IWL_MVM_ESR_PREVENT_REASONS IWL_MVM_ESR_EXIT_MISSED_BEACON
880−#define IWL_MVM_PREVENT_ESR_TIMEOUT (HZ * 400)
881−#define IWL_MVM_ESR_PREVENT_SHORT (HZ * 300)
882−#define IWL_MVM_ESR_PREVENT_LONG (HZ * 600)
883−
884−static bool iwl_mvm_check_esr_prevention(struct iwl_mvm *mvm,
885− struct iwl_mvm_vif *mvmvif,
886− enum iwl_mvm_esr_state reason)
887−{
888− bool timeout_expired = time_after(jiffies,
889− mvmvif->last_esr_exit.ts +
890− IWL_MVM_PREVENT_ESR_TIMEOUT);
891− unsigned long delay;
892−
893− lockdep_assert_held(&mvm->mutex);
894−
895− /* Only handle reasons that can cause prevention */
896− if (!(reason & IWL_MVM_ESR_PREVENT_REASONS))
897− return false;
898−
899− /*
900− * Reset the counter if more than 400 seconds have passed between one
901− * exit and the other, or if we exited due to a different reason.
902− * Will also reset the counter after the long prevention is done.
903− */
904− if (timeout_expired || mvmvif->last_esr_exit.reason != reason) {
905− mvmvif->exit_same_reason_count = 1;
906− return false;
907− }
908−
909− mvmvif->exit_same_reason_count++;
910− if (WARN_ON(mvmvif->exit_same_reason_count < 2 ||
911− mvmvif->exit_same_reason_count > 3))
912− return false;
913−
914− mvmvif->esr_disable_reason |= IWL_MVM_ESR_BLOCKED_PREVENTION;
915−
916− /*
917− * For the second exit, use a short prevention, and for the third one,
918− * use a long prevention.
919− */
920− delay = mvmvif->exit_same_reason_count == 2 ?
921− IWL_MVM_ESR_PREVENT_SHORT :
922− IWL_MVM_ESR_PREVENT_LONG;
923−
924− IWL_DEBUG_INFO(mvm,
925− "Preventing EMLSR for %ld seconds due to %u exits with the reason = %s (0x%x)\n",
926− delay / HZ, mvmvif->exit_same_reason_count,
927− iwl_get_esr_state_string(reason), reason);
928−
929− wiphy_delayed_work_queue(mvm->hw->wiphy,
930− &mvmvif->prevent_esr_done_wk, delay);
931− return true;
932−}
933−
934−#define IWL_MVM_TRIGGER_LINK_SEL_TIME (IWL_MVM_TRIGGER_LINK_SEL_TIME_SEC * HZ)
935−
936−/* API to exit eSR mode */
937−void iwl_mvm_exit_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
938− enum iwl_mvm_esr_state reason,
939− u8 link_to_keep)
940−{
941− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
942− u16 new_active_links;
943− bool prevented;
944−
945− lockdep_assert_held(&mvm->mutex);
946−
947− if (!IWL_MVM_AUTO_EML_ENABLE)
948− return;
949−
950− /* Nothing to do */
951− if (!mvmvif->esr_active)
952− return;
953−
954− if (WARN_ON(!ieee80211_vif_is_mld(vif) || !mvmvif->authorized))
955− return;
956−
957− if (WARN_ON(!(vif->active_links & BIT(link_to_keep))))
958− link_to_keep = __ffs(vif->active_links);
959−
960− new_active_links = BIT(link_to_keep);
961− IWL_DEBUG_INFO(mvm,
962− "Exiting EMLSR. reason = %s (0x%x). Current active links=0x%x, new active links = 0x%x\n",
963− iwl_get_esr_state_string(reason), reason,
964− vif->active_links, new_active_links);
965−
966− ieee80211_set_active_links_async(vif, new_active_links);
967−
968− /* Prevent EMLSR if needed */
969− prevented = iwl_mvm_check_esr_prevention(mvm, mvmvif, reason);
970−
971− /* Remember why and when we exited EMLSR */
972− mvmvif->last_esr_exit.ts = jiffies;
973− mvmvif->last_esr_exit.reason = reason;
974−
975− /*
976− * If EMLSR is prevented now - don't try to get back to EMLSR.
977− * If we exited due to a blocking event, we will try to get back to
978− * EMLSR when the corresponding unblocking event will happen.
979− */
980− if (prevented || reason & IWL_MVM_BLOCK_ESR_REASONS)
981− return;
982−
983− /* If EMLSR is not blocked - try enabling it again in 30 seconds */
984− wiphy_delayed_work_queue(mvm->hw->wiphy,
985− &mvmvif->mlo_int_scan_wk,
986− round_jiffies_relative(IWL_MVM_TRIGGER_LINK_SEL_TIME));
987−}
988−
989−void iwl_mvm_block_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
990− enum iwl_mvm_esr_state reason,
991− u8 link_to_keep)
992−{
993− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
994−
995− lockdep_assert_held(&mvm->mutex);
996−
997− if (!IWL_MVM_AUTO_EML_ENABLE)
998− return;
999−
1000− /* This should be called only with disable reasons */
1001− if (WARN_ON(!(reason & IWL_MVM_BLOCK_ESR_REASONS)))
1002− return;
1003−
1004− if (mvmvif->esr_disable_reason & reason)
1005− return;
1006−
1007− IWL_DEBUG_INFO(mvm,
1008− "Blocking EMLSR mode. reason = %s (0x%x)\n",
1009− iwl_get_esr_state_string(reason), reason);
1010−
1011− mvmvif->esr_disable_reason |= reason;
1012−
1013− iwl_mvm_print_esr_state(mvm, mvmvif->esr_disable_reason);
1014−
1015− iwl_mvm_exit_esr(mvm, vif, reason, link_to_keep);
1016−}
1017−
1018−int iwl_mvm_block_esr_sync(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1019− enum iwl_mvm_esr_state reason)
1020−{
1021− int primary_link = iwl_mvm_get_primary_link(vif);
1022− int ret;
1023−
1024− if (!IWL_MVM_AUTO_EML_ENABLE || !ieee80211_vif_is_mld(vif))
1025− return 0;
1026−
1027− /* This should be called only with blocking reasons */
1028− if (WARN_ON(!(reason & IWL_MVM_BLOCK_ESR_REASONS)))
1029− return 0;
1030−
1031− /* leave ESR immediately, not only async with iwl_mvm_block_esr() */
1032− ret = ieee80211_set_active_links(vif, BIT(primary_link));
1033− if (ret)
1034− return ret;
1035−
1036− mutex_lock(&mvm->mutex);
1037− /* only additionally block for consistency and to avoid concurrency */
1038− iwl_mvm_block_esr(mvm, vif, reason, primary_link);
1039− mutex_unlock(&mvm->mutex);
1040−
1041− return 0;
1042−}
1043−
1044−static void iwl_mvm_esr_unblocked(struct iwl_mvm *mvm,
1045− struct ieee80211_vif *vif)
1046−{
1047− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1048− bool need_new_sel = time_after(jiffies, mvmvif->last_esr_exit.ts +
1049− IWL_MVM_TRIGGER_LINK_SEL_TIME);
1050−
1051− lockdep_assert_held(&mvm->mutex);
1052−
1053− if (!ieee80211_vif_is_mld(vif) || !mvmvif->authorized ||
1054− mvmvif->esr_active)
1055− return;
1056−
1057− IWL_DEBUG_INFO(mvm, "EMLSR is unblocked\n");
1058−
1059− /* If we exited due to an EXIT reason, and the exit was in less than
1060− * 30 seconds, then a MLO scan was scheduled already.
1061− */
1062− if (!need_new_sel &&
1063− !(mvmvif->last_esr_exit.reason & IWL_MVM_BLOCK_ESR_REASONS)) {
1064− IWL_DEBUG_INFO(mvm, "Wait for MLO scan\n");
1065− return;
1066− }
1067−
1068− /*
1069− * If EMLSR was blocked for more than 30 seconds, or the last link
1070− * selection decided to not enter EMLSR, trigger a new scan.
1071− */
1072− if (need_new_sel || hweight16(mvmvif->link_selection_res) < 2) {
1073− IWL_DEBUG_INFO(mvm, "Trigger MLO scan\n");
1074− wiphy_delayed_work_queue(mvm->hw->wiphy,
1075− &mvmvif->mlo_int_scan_wk, 0);
1076− /*
1077− * If EMLSR was blocked for less than 30 seconds, and the last link
1078− * selection decided to use EMLSR, activate EMLSR using the previous
1079− * link selection result.
1080− */
1081− } else {
1082− IWL_DEBUG_INFO(mvm,
1083− "Use the latest link selection result: 0x%x\n",
1084− mvmvif->link_selection_res);
1085− ieee80211_set_active_links_async(vif,
1086− mvmvif->link_selection_res);
1087− }
1088−}
1089−
1090−void iwl_mvm_unblock_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1091− enum iwl_mvm_esr_state reason)
1092−{
1093− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1094−
1095− lockdep_assert_held(&mvm->mutex);
1096−
1097− if (!IWL_MVM_AUTO_EML_ENABLE)
1098− return;
1099−
1100− /* This should be called only with disable reasons */
1101− if (WARN_ON(!(reason & IWL_MVM_BLOCK_ESR_REASONS)))
1102− return;
1103−
1104− /* No Change */
1105− if (!(mvmvif->esr_disable_reason & reason))
1106− return;
1107−
1108− mvmvif->esr_disable_reason &= ~reason;
1109−
1110− IWL_DEBUG_INFO(mvm,
1111− "Unblocking EMLSR mode. reason = %s (0x%x)\n",
1112− iwl_get_esr_state_string(reason), reason);
1113− iwl_mvm_print_esr_state(mvm, mvmvif->esr_disable_reason);
1114−
1115− if (!mvmvif->esr_disable_reason)
1116− iwl_mvm_esr_unblocked(mvm, vif);
1117−}
1118−
1119310 void iwl_mvm_init_link(struct iwl_mvm_vif_link_info *link)
1120311 {
1121312 link->bcast_sta.sta_id = IWL_INVALID_STA;
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c+0−38
@@ -1586,13 +1586,11 @@ iwl_mvm_handle_missed_beacons_notif(struct iwl_mvm *mvm, · 1585 unmodified lines
15861586 u32 id = le32_to_cpu(mb->link_id);
15871587 union iwl_dbg_tlv_tp_data tp_data = { .fw_pkt = pkt };
15881588 u32 mac_type;
1589− int link_id;
15901589 u8 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
15911590 MISSED_BEACONS_NOTIFICATION,
15921591 0);
15931592 u8 new_notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP,
15941593 MISSED_BEACONS_NOTIF, 0);
1595− struct ieee80211_bss_conf *bss_conf;
15961594
15971595 /* If the firmware uses the new notification (from MAC_CONF_GROUP),
15981596 * refer to that notification's version.
@@ -1617,16 +1615,10 @@ iwl_mvm_handle_missed_beacons_notif(struct iwl_mvm *mvm, · 18 unmodified lines
16171615 if (!vif)
16181616 return;
16191617
1620− bss_conf = &vif->bss_conf;
1621− link_id = bss_conf->link_id;
16221618 mac_type = iwl_mvm_get_mac_type(vif);
16231619
16241620 IWL_DEBUG_INFO(mvm, "missed beacon mac_type=%u,\n", mac_type);
16251621
1626− mvm->trans->dbg.dump_file_name_ext_valid = true;
1627− snprintf(mvm->trans->dbg.dump_file_name_ext, IWL_FW_INI_MAX_NAME,
1628− "MacId_%d_MacType_%d", id, mac_type);
1629−
16301622 rx_missed_bcon = le32_to_cpu(mb->consec_missed_beacons);
16311623 rx_missed_bcon_since_rx =
16321624 le32_to_cpu(mb->consec_missed_beacons_since_last_rx);
@@ -1644,41 +1636,11 @@ iwl_mvm_handle_missed_beacons_notif(struct iwl_mvm *mvm, · 11 unmodified lines
16441636 "missed_beacons:%d, missed_beacons_since_rx:%d\n",
16451637 rx_missed_bcon, rx_missed_bcon_since_rx);
16461638 }
1647− } else if (link_id >= 0 && hweight16(vif->active_links) > 1) {
1648− u32 bss_param_ch_cnt_link_id =
1649− bss_conf->bss_param_ch_cnt_link_id;
1650− u32 scnd_lnk_bcn_lost = 0;
1651−
1652− if (notif_ver >= 5 &&
1653− !IWL_FW_CHECK(mvm,
1654− le32_to_cpu(mb->other_link_id) == IWL_MVM_FW_LINK_ID_INVALID,
1655− "No data for other link id but we are in EMLSR active_links: 0x%x\n",
1656− vif->active_links))
1657− scnd_lnk_bcn_lost =
1658− le32_to_cpu(mb->consec_missed_beacons_other_link);
1659−
1660− /* Exit EMLSR if we lost more than
1661− * IWL_MVM_MISSED_BEACONS_EXIT_ESR_THRESH beacons on boths links
1662− * OR more than IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH on any link.
1663− * OR more than IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_BSS_PARAM_CHANGED
1664− * and the link's bss_param_ch_count has changed.
1665− */
1666− if ((rx_missed_bcon >= IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS &&
1667− scnd_lnk_bcn_lost >= IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_2_LINKS) ||
1668− rx_missed_bcon >= IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH ||
1669− (bss_param_ch_cnt_link_id != link_id &&
1670− rx_missed_bcon >= IWL_MVM_BCN_LOSS_EXIT_ESR_THRESH_BSS_PARAM_CHANGED))
1671− iwl_mvm_exit_esr(mvm, vif,
1672− IWL_MVM_ESR_EXIT_MISSED_BEACON,
1673− iwl_mvm_get_primary_link(vif));
16741639 } else if (rx_missed_bcon_since_rx > IWL_MVM_MISSED_BEACONS_THRESHOLD) {
16751640 if (!iwl_mvm_has_new_tx_api(mvm))
16761641 ieee80211_beacon_loss(vif);
16771642 else
16781643 ieee80211_cqm_beacon_loss_notify(vif, GFP_ATOMIC);
1679−
1680− /* try to switch links, no-op if we don't have MLO */
1681− iwl_mvm_int_mlo_scan(mvm, vif);
16821644 }
16831645
16841646 iwl_dbg_tlv_time_point(&mvm->fwrt,
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c+6−118
@@ -1425,12 +1425,6 @@ void iwl_mvm_mac_stop(struct ieee80211_hw *hw, bool suspend) · 1424 unmodified lines
14251425 {
14261426 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
14271427
1428− /* Stop internal MLO scan, if running */
1429− mutex_lock(&mvm->mutex);
1430− iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_INT_MLO, false);
1431− mutex_unlock(&mvm->mutex);
1432−
1433− wiphy_work_cancel(mvm->hw->wiphy, &mvm->trig_link_selection_wk);
14341428 wiphy_work_flush(mvm->hw->wiphy, &mvm->async_handlers_wiphy_wk);
14351429 flush_work(&mvm->async_handlers_wk);
14361430 flush_work(&mvm->add_stream_wk);
@@ -1715,57 +1709,6 @@ static int iwl_mvm_alloc_bcast_mcast_sta(struct iwl_mvm *mvm, · 278 unmodified lines
17151709 IWL_STA_MULTICAST);
17161710 }
17171711
1718−static void iwl_mvm_prevent_esr_done_wk(struct wiphy *wiphy,
1719− struct wiphy_work *wk)
1720−{
1721− struct iwl_mvm_vif *mvmvif =
1722− container_of(wk, struct iwl_mvm_vif, prevent_esr_done_wk.work);
1723− struct iwl_mvm *mvm = mvmvif->mvm;
1724− struct ieee80211_vif *vif =
1725− container_of((void *)mvmvif, struct ieee80211_vif, drv_priv);
1726−
1727− guard(mvm)(mvm);
1728− iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_PREVENTION);
1729−}
1730−
1731−static void iwl_mvm_mlo_int_scan_wk(struct wiphy *wiphy, struct wiphy_work *wk)
1732−{
1733− struct iwl_mvm_vif *mvmvif = container_of(wk, struct iwl_mvm_vif,
1734− mlo_int_scan_wk.work);
1735− struct ieee80211_vif *vif =
1736− container_of((void *)mvmvif, struct ieee80211_vif, drv_priv);
1737−
1738− guard(mvm)(mvmvif->mvm);
1739− iwl_mvm_int_mlo_scan(mvmvif->mvm, vif);
1740−}
1741−
1742−static void iwl_mvm_unblock_esr_tpt(struct wiphy *wiphy, struct wiphy_work *wk)
1743−{
1744− struct iwl_mvm_vif *mvmvif =
1745− container_of(wk, struct iwl_mvm_vif, unblock_esr_tpt_wk);
1746− struct iwl_mvm *mvm = mvmvif->mvm;
1747− struct ieee80211_vif *vif =
1748− container_of((void *)mvmvif, struct ieee80211_vif, drv_priv);
1749−
1750− guard(mvm)(mvm);
1751− iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_TPT);
1752−}
1753−
1754−static void iwl_mvm_unblock_esr_tmp_non_bss(struct wiphy *wiphy,
1755− struct wiphy_work *wk)
1756−{
1757− struct iwl_mvm_vif *mvmvif =
1758− container_of(wk, struct iwl_mvm_vif,
1759− unblock_esr_tmp_non_bss_wk.work);
1760− struct iwl_mvm *mvm = mvmvif->mvm;
1761− struct ieee80211_vif *vif =
1762− container_of((void *)mvmvif, struct ieee80211_vif, drv_priv);
1763−
1764− mutex_lock(&mvm->mutex);
1765− iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_TMP_NON_BSS);
1766− mutex_unlock(&mvm->mutex);
1767−}
1768−
17691712 void iwl_mvm_mac_init_mvmvif(struct iwl_mvm *mvm, struct iwl_mvm_vif *mvmvif)
17701713 {
17711714 lockdep_assert_held(&mvm->mutex);
@@ -1777,18 +1720,6 @@ void iwl_mvm_mac_init_mvmvif(struct iwl_mvm *mvm, struct iwl_mvm_vif *mvmvif) · 5 unmodified lines
17771720
17781721 INIT_DELAYED_WORK(&mvmvif->csa_work,
17791722 iwl_mvm_channel_switch_disconnect_wk);
1780−
1781− wiphy_delayed_work_init(&mvmvif->prevent_esr_done_wk,
1782− iwl_mvm_prevent_esr_done_wk);
1783−
1784− wiphy_delayed_work_init(&mvmvif->mlo_int_scan_wk,
1785− iwl_mvm_mlo_int_scan_wk);
1786−
1787− wiphy_work_init(&mvmvif->unblock_esr_tpt_wk,
1788− iwl_mvm_unblock_esr_tpt);
1789−
1790− wiphy_delayed_work_init(&mvmvif->unblock_esr_tmp_non_bss_wk,
1791− iwl_mvm_unblock_esr_tmp_non_bss);
17921723 }
17931724
17941725 static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
@@ -1926,16 +1857,6 @@ void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm, · 131 unmodified lines
19261857 flush_work(&mvm->roc_done_wk);
19271858 }
19281859
1929− wiphy_delayed_work_cancel(mvm->hw->wiphy,
1930− &mvmvif->prevent_esr_done_wk);
1931−
1932− wiphy_delayed_work_cancel(mvm->hw->wiphy,
1933− &mvmvif->mlo_int_scan_wk);
1934−
1935− wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk);
1936− wiphy_delayed_work_cancel(mvm->hw->wiphy,
1937− &mvmvif->unblock_esr_tmp_non_bss_wk);
1938−
19391860 cancel_delayed_work_sync(&mvmvif->csa_work);
19401861 }
19411862
@@ -4008,21 +3929,6 @@ iwl_mvm_sta_state_assoc_to_authorized(struct iwl_mvm *mvm, · 2066 unmodified lines
40083929
40093930 callbacks->mac_ctxt_changed(mvm, vif, false);
40103931 iwl_mvm_mei_host_associated(mvm, vif, mvm_sta);
4011−
4012− memset(&mvmvif->last_esr_exit, 0,
4013− sizeof(mvmvif->last_esr_exit));
4014−
4015− iwl_mvm_block_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_TPT, 0);
4016−
4017− /* Block until FW notif will arrive */
4018− iwl_mvm_block_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_FW, 0);
4019−
4020− /* when client is authorized (AP station marked as such),
4021− * try to enable the best link(s).
4022− */
4023− if (vif->type == NL80211_IFTYPE_STATION &&
4024− !test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
4025− iwl_mvm_select_links(mvm, vif);
40263932 }
40273933
40283934 mvm_sta->authorized = true;
@@ -4070,16 +3976,6 @@ iwl_mvm_sta_state_authorized_to_assoc(struct iwl_mvm *mvm, · 41 unmodified lines
40703976
40713977 /* disable beacon filtering */
40723978 iwl_mvm_disable_beacon_filter(mvm, vif);
4073−
4074− wiphy_delayed_work_cancel(mvm->hw->wiphy,
4075− &mvmvif->prevent_esr_done_wk);
4076−
4077− wiphy_delayed_work_cancel(mvm->hw->wiphy,
4078− &mvmvif->mlo_int_scan_wk);
4079−
4080− wiphy_work_cancel(mvm->hw->wiphy, &mvmvif->unblock_esr_tpt_wk);
4081− wiphy_delayed_work_cancel(mvm->hw->wiphy,
4082− &mvmvif->unblock_esr_tmp_non_bss_wk);
40833979 }
40843980
40853981 return 0;
@@ -4920,7 +4816,6 @@ int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 834 unmodified lines
49204816 const struct iwl_mvm_roc_ops *ops)
49214817 {
49224818 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
4923− struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm);
49244819 u32 lmac_id;
49254820 int ret;
49264821
@@ -4933,13 +4828,6 @@ int iwl_mvm_roc_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 6 unmodified lines
49334828 */
49344829 flush_work(&mvm->roc_done_wk);
49354830
4936− if (!IS_ERR_OR_NULL(bss_vif)) {
4937− ret = iwl_mvm_block_esr_sync(mvm, bss_vif,
4938− IWL_MVM_ESR_BLOCKED_ROC);
4939− if (ret)
4940− return ret;
4941− }
4942−
49434831 guard(mvm)(mvm);
49444832
49454833 switch (vif->type) {
@@ -5604,9 +5492,9 @@ static void iwl_mvm_csa_block_txqs(void *data, struct ieee80211_sta *sta) · 658 unmodified lines
56045492 }
56055493
56065494 #define IWL_MAX_CSA_BLOCK_TX 1500
5607−int iwl_mvm_pre_channel_switch(struct iwl_mvm *mvm,
5608− struct ieee80211_vif *vif,
5609− struct ieee80211_channel_switch *chsw)
5495+static int iwl_mvm_pre_channel_switch(struct iwl_mvm *mvm,
5496+ struct ieee80211_vif *vif,
5497+ struct ieee80211_channel_switch *chsw)
56105498 {
56115499 struct ieee80211_vif *csa_vif;
56125500 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
@@ -5724,9 +5612,9 @@ int iwl_mvm_pre_channel_switch(struct iwl_mvm *mvm, · 111 unmodified lines
57245612 return ret;
57255613 }
57265614
5727−static int iwl_mvm_mac_pre_channel_switch(struct ieee80211_hw *hw,
5728− struct ieee80211_vif *vif,
5729− struct ieee80211_channel_switch *chsw)
5615+int iwl_mvm_mac_pre_channel_switch(struct ieee80211_hw *hw,
5616+ struct ieee80211_vif *vif,
5617+ struct ieee80211_channel_switch *chsw)
57305618 {
57315619 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
57325620
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c+1−137
@@ -340,20 +340,6 @@ static int iwl_mvm_mld_assign_vif_chanctx(struct ieee80211_hw *hw, · 339 unmodified lines
340340 {
341341 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
342342
343− /* update EMLSR mode */
344− if (ieee80211_vif_type_p2p(vif) != NL80211_IFTYPE_STATION) {
345− int ret;
346−
347− ret = iwl_mvm_esr_non_bss_link(mvm, vif, link_conf->link_id,
348− true);
349− /*
350− * Don't activate this link if failed to exit EMLSR in
351− * the BSS interface
352− */
353− if (ret)
354− return ret;
355− }
356−
357343 guard(mvm)(mvm);
358344 return __iwl_mvm_mld_assign_vif_chanctx(mvm, vif, link_conf, ctx, false);
359345 }
@@ -472,10 +458,6 @@ static void iwl_mvm_mld_unassign_vif_chanctx(struct ieee80211_hw *hw, · 112 unmodified lines
472458 iwl_mvm_add_link(mvm, vif, link_conf);
473459 }
474460 mutex_unlock(&mvm->mutex);
475−
476− /* update EMLSR mode */
477− if (ieee80211_vif_type_p2p(vif) != NL80211_IFTYPE_STATION)
478− iwl_mvm_esr_non_bss_link(mvm, vif, link_conf->link_id, false);
479461 }
480462
481463 static void
@@ -684,25 +666,6 @@ static int iwl_mvm_mld_mac_sta_state(struct ieee80211_hw *hw, · 202 unmodified lines
684666 &callbacks);
685667 }
686668
687−static bool iwl_mvm_esr_bw_criteria(struct iwl_mvm *mvm,
688− struct ieee80211_vif *vif,
689− struct ieee80211_bss_conf *link_conf)
690−{
691− struct ieee80211_bss_conf *other_link;
692− int link_id;
693−
694− /* Exit EMLSR if links don't have equal bandwidths */
695− for_each_vif_active_link(vif, other_link, link_id) {
696− if (link_id == link_conf->link_id)
697− continue;
698− if (link_conf->chanreq.oper.width ==
699− other_link->chanreq.oper.width)
700− return true;
701− }
702−
703− return false;
704−}
705−
706669 static void
707670 iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm,
708671 struct ieee80211_vif *vif,
@@ -737,14 +700,6 @@ iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm, · 28 unmodified lines
737700 link_changes |= LINK_CONTEXT_MODIFY_HE_PARAMS;
738701 }
739702
740− if ((changes & BSS_CHANGED_BANDWIDTH) &&
741− ieee80211_vif_link_active(vif, link_conf->link_id) &&
742− mvmvif->esr_active &&
743− !iwl_mvm_esr_bw_criteria(mvm, vif, link_conf))
744− iwl_mvm_exit_esr(mvm, vif,
745− IWL_MVM_ESR_EXIT_BANDWIDTH,
746− iwl_mvm_get_primary_link(vif));
747−
748703 /* if associated, maybe puncturing changed - we'll check later */
749704 if (vif->cfg.assoc)
750705 link_changes |= LINK_CONTEXT_MODIFY_EHT_PARAMS;
@@ -879,11 +834,6 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm, · 128 unmodified lines
879834 if (ret)
880835 IWL_ERR(mvm, "failed to update power mode\n");
881836 }
882−
883− if (changes & (BSS_CHANGED_MLD_VALID_LINKS | BSS_CHANGED_MLD_TTLM) &&
884− ieee80211_vif_is_mld(vif) && mvmvif->authorized)
885− wiphy_delayed_work_queue(mvm->hw->wiphy,
886− &mvmvif->mlo_int_scan_wk, 0);
887837 }
888838
889839 static void
@@ -1239,91 +1189,6 @@ iwl_mvm_mld_can_neg_ttlm(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 349 unmodified lines
12391189 return NEG_TTLM_RES_ACCEPT;
12401190 }
12411191
1242−static int
1243−iwl_mvm_mld_mac_pre_channel_switch(struct ieee80211_hw *hw,
1244− struct ieee80211_vif *vif,
1245− struct ieee80211_channel_switch *chsw)
1246−{
1247− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1248− struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1249− int ret;
1250−
1251− mutex_lock(&mvm->mutex);
1252− if (mvmvif->esr_active) {
1253− u8 primary = iwl_mvm_get_primary_link(vif);
1254− int selected;
1255−
1256− /* prefer primary unless quiet CSA on it */
1257− if (chsw->link_id == primary && chsw->block_tx)
1258− selected = iwl_mvm_get_other_link(vif, primary);
1259− else
1260− selected = primary;
1261−
1262− /*
1263− * remembers to tell the firmware that this link can't tx
1264− * Note that this logic seems to be unrelated to esr, but it
1265− * really is needed only when esr is active. When we have a
1266− * single link, the firmware will handle all this on its own.
1267− * In multi-link scenarios, we can learn about the CSA from
1268− * another link and this logic is too complex for the firmware
1269− * to track.
1270− * Since we want to de-activate the link that got a CSA, we
1271− * need to tell the firmware not to send any frame on that link
1272− * as the firmware may not be aware that link is under a CSA
1273− * with mode=1 (no Tx allowed).
1274− */
1275− if (chsw->block_tx && mvmvif->link[chsw->link_id])
1276− mvmvif->link[chsw->link_id]->csa_block_tx = true;
1277−
1278− iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_CSA, selected);
1279− mutex_unlock(&mvm->mutex);
1280−
1281− /*
1282− * If we've not kept the link active that's doing the CSA
1283− * then we don't need to do anything else, just return.
1284− */
1285− if (selected != chsw->link_id)
1286− return 0;
1287−
1288− mutex_lock(&mvm->mutex);
1289− }
1290−
1291− ret = iwl_mvm_pre_channel_switch(mvm, vif, chsw);
1292− mutex_unlock(&mvm->mutex);
1293−
1294− return ret;
1295−}
1296−
1297−#define IWL_MVM_MLD_UNBLOCK_ESR_NON_BSS_TIMEOUT (5 * HZ)
1298−
1299−static void iwl_mvm_mld_prep_add_interface(struct ieee80211_hw *hw,
1300− enum nl80211_iftype type)
1301−{
1302− struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
1303− struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm);
1304− struct iwl_mvm_vif *mvmvif;
1305− int ret;
1306−
1307− IWL_DEBUG_MAC80211(mvm, "prep_add_interface: type=%u\n",
1308− type);
1309−
1310− if (IS_ERR_OR_NULL(bss_vif) ||
1311− !(type == NL80211_IFTYPE_AP ||
1312− type == NL80211_IFTYPE_P2P_GO ||
1313− type == NL80211_IFTYPE_P2P_CLIENT))
1314− return;
1315−
1316− mvmvif = iwl_mvm_vif_from_mac80211(bss_vif);
1317− ret = iwl_mvm_block_esr_sync(mvm, bss_vif,
1318− IWL_MVM_ESR_BLOCKED_TMP_NON_BSS);
1319− if (ret)
1320− return;
1321−
1322− wiphy_delayed_work_queue(mvmvif->mvm->hw->wiphy,
1323− &mvmvif->unblock_esr_tmp_non_bss_wk,
1324− IWL_MVM_MLD_UNBLOCK_ESR_NON_BSS_TIMEOUT);
1325−}
1326−
13271192 const struct ieee80211_ops iwl_mvm_mld_hw_ops = {
13281193 .tx = iwl_mvm_mac_tx,
13291194 .wake_tx_queue = iwl_mvm_mac_wake_tx_queue,
@@ -1377,7 +1242,7 @@ const struct ieee80211_ops iwl_mvm_mld_hw_ops = { · 47 unmodified lines
13771242 .tx_last_beacon = iwl_mvm_tx_last_beacon,
13781243
13791244 .channel_switch = iwl_mvm_channel_switch,
1380− .pre_channel_switch = iwl_mvm_mld_mac_pre_channel_switch,
1245+ .pre_channel_switch = iwl_mvm_mac_pre_channel_switch,
13811246 .post_channel_switch = iwl_mvm_post_channel_switch,
13821247 .abort_channel_switch = iwl_mvm_abort_channel_switch,
13831248 .channel_switch_rx_beacon = iwl_mvm_channel_switch_rx_beacon,
@@ -1418,5 +1283,4 @@ const struct ieee80211_ops iwl_mvm_mld_hw_ops = { · 34 unmodified lines
14181283 .change_sta_links = iwl_mvm_mld_change_sta_links,
14191284 .can_activate_links = iwl_mvm_mld_can_activate_links,
14201285 .can_neg_ttlm = iwl_mvm_mld_can_neg_ttlm,
1421− .prep_add_interface = iwl_mvm_mld_prep_add_interface,
14221286 };
drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c+0−2
@@ -852,8 +852,6 @@ int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 851 unmodified lines
852852
853853 iwl_mvm_mld_free_sta_link(mvm, mvm_sta, mvm_link_sta, link_id);
854854 }
855− kfree(mvm_sta->mpdu_counters);
856− mvm_sta->mpdu_counters = NULL;
857855
858856 return ret;
859857 }
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h+5−131
@@ -347,68 +347,6 @@ struct iwl_mvm_vif_link_info { · 346 unmodified lines
347347 u32 average_beacon_energy;
348348 };
349349
350−/**
351− * enum iwl_mvm_esr_state - defines reasons for which the EMLSR is exited or
352− * blocked.
353− * The low 16 bits are used for blocking reasons, and the 16 higher bits
354− * are used for exit reasons.
355− * For the blocking reasons - use iwl_mvm_(un)block_esr(), and for the exit
356− * reasons - use iwl_mvm_exit_esr().
357− *
358− * Note: new reasons shall be added to HANDLE_ESR_REASONS as well (for logs)
359− *
360− * @IWL_MVM_ESR_BLOCKED_PREVENTION: Prevent EMLSR to avoid entering and exiting
361− * in a loop.
362− * @IWL_MVM_ESR_BLOCKED_WOWLAN: WOWLAN is preventing the enablement of EMLSR
363− * @IWL_MVM_ESR_BLOCKED_TPT: block EMLSR when there is not enough traffic
364− * @IWL_MVM_ESR_BLOCKED_FW: FW didn't recommended/forced exit from EMLSR
365− * @IWL_MVM_ESR_BLOCKED_NON_BSS: An active non-BSS interface's link is
366− * preventing EMLSR
367− * @IWL_MVM_ESR_BLOCKED_ROC: remain-on-channel is preventing EMLSR
368− * @IWL_MVM_ESR_BLOCKED_TMP_NON_BSS: An expected active non-BSS interface's link
369− * is preventing EMLSR. This is a temporary blocking that is set when there
370− * is an indication that a non-BSS interface is to be added.
371− * @IWL_MVM_ESR_EXIT_MISSED_BEACON: exited EMLSR due to missed beacons
372− * @IWL_MVM_ESR_EXIT_LOW_RSSI: link is deactivated/not allowed for EMLSR
373− * due to low RSSI.
374− * @IWL_MVM_ESR_EXIT_COEX: link is deactivated/not allowed for EMLSR
375− * due to BT Coex.
376− * @IWL_MVM_ESR_EXIT_BANDWIDTH: Bandwidths of primary and secondry links
377− * preventing the enablement of EMLSR
378− * @IWL_MVM_ESR_EXIT_CSA: CSA happened, so exit EMLSR
379− * @IWL_MVM_ESR_EXIT_LINK_USAGE: Exit EMLSR due to low tpt on secondary link
380− */
381−enum iwl_mvm_esr_state {
382− IWL_MVM_ESR_BLOCKED_PREVENTION = 0x1,
383− IWL_MVM_ESR_BLOCKED_WOWLAN = 0x2,
384− IWL_MVM_ESR_BLOCKED_TPT = 0x4,
385− IWL_MVM_ESR_BLOCKED_FW = 0x8,
386− IWL_MVM_ESR_BLOCKED_NON_BSS = 0x10,
387− IWL_MVM_ESR_BLOCKED_ROC = 0x20,
388− IWL_MVM_ESR_BLOCKED_TMP_NON_BSS = 0x40,
389− IWL_MVM_ESR_EXIT_MISSED_BEACON = 0x10000,
390− IWL_MVM_ESR_EXIT_LOW_RSSI = 0x20000,
391− IWL_MVM_ESR_EXIT_COEX = 0x40000,
392− IWL_MVM_ESR_EXIT_BANDWIDTH = 0x80000,
393− IWL_MVM_ESR_EXIT_CSA = 0x100000,
394− IWL_MVM_ESR_EXIT_LINK_USAGE = 0x200000,
395−};
396−
397−#define IWL_MVM_BLOCK_ESR_REASONS 0xffff
398−
399−const char *iwl_get_esr_state_string(enum iwl_mvm_esr_state state);
400−
401−/**
402− * struct iwl_mvm_esr_exit - details of the last exit from EMLSR mode.
403− * @reason: The reason for the last exit from EMLSR.
404− * &iwl_mvm_prevent_esr_reasons. Will be 0 before exiting EMLSR.
405− * @ts: the time stamp of the last time we existed EMLSR.
406− */
407−struct iwl_mvm_esr_exit {
408− unsigned long ts;
409− enum iwl_mvm_esr_state reason;
410−};
411−
412350 /**
413351 * struct iwl_mvm_vif - data per Virtual Interface, it is a MAC context
414352 * @mvm: pointer back to the mvm struct
@@ -443,7 +381,6 @@ struct iwl_mvm_esr_exit { · 28 unmodified lines
443381 * @deflink: default link data for use in non-MLO
444382 * @link: link data for each link in MLO
445383 * @esr_active: indicates eSR mode is active
446− * @esr_disable_reason: a bitmap of &enum iwl_mvm_esr_state
447384 * @pm_enabled: indicates powersave is enabled
448385 * @link_selection_res: bitmap of active links as it was decided in the last
449386 * link selection. Valid only for a MLO vif after assoc. 0 if there wasn't
@@ -451,15 +388,6 @@ struct iwl_mvm_esr_exit { · 1 unmodified line
451388 * @link_selection_primary: primary link selected by link selection
452389 * @primary_link: primary link in eSR. Valid only for an associated MLD vif,
453390 * and in eSR mode. Valid only for a STA.
454− * @last_esr_exit: Details of the last exit from EMLSR.
455− * @exit_same_reason_count: The number of times we exited due to the specified
456− * @last_esr_exit::reason, only counting exits due to
457− * &IWL_MVM_ESR_PREVENT_REASONS.
458− * @prevent_esr_done_wk: work that should be done when esr prevention ends.
459− * @mlo_int_scan_wk: work for the internal MLO scan.
460− * @unblock_esr_tpt_wk: work for unblocking EMLSR when tpt is high enough.
461− * @unblock_esr_tmp_non_bss_wk: work for removing the
462− * IWL_MVM_ESR_BLOCKED_TMP_NON_BSS blocking for EMLSR.
463391 * @roc_activity: currently running ROC activity for this vif (or
464392 * ROC_NUM_ACTIVITIES if no activity is running).
465393 * @session_prot_connection_loss: the connection was lost due to session
@@ -515,7 +443,6 @@ struct iwl_mvm_vif { · 49 unmodified lines
515443 u8 authorized:1;
516444 bool ps_disabled;
517445
518− u32 esr_disable_reason;
519446 u32 ap_beacon_time;
520447 bool bf_enabled;
521448 bool ba_enabled;
@@ -591,12 +518,6 @@ struct iwl_mvm_vif { · 69 unmodified lines
591518 u16 link_selection_res;
592519 u8 link_selection_primary;
593520 u8 primary_link;
594− struct iwl_mvm_esr_exit last_esr_exit;
595− u8 exit_same_reason_count;
596− struct wiphy_delayed_work prevent_esr_done_wk;
597− struct wiphy_delayed_work mlo_int_scan_wk;
598− struct wiphy_work unblock_esr_tpt_wk;
599− struct wiphy_delayed_work unblock_esr_tmp_non_bss_wk;
600521
601522 struct iwl_mvm_vif_link_info deflink;
602523 struct iwl_mvm_vif_link_info *link[IEEE80211_MLD_MAX_NUM_LINKS];
@@ -622,7 +543,6 @@ enum iwl_scan_status { · 19 unmodified lines
622543 IWL_MVM_SCAN_REGULAR = BIT(0),
623544 IWL_MVM_SCAN_SCHED = BIT(1),
624545 IWL_MVM_SCAN_NETDETECT = BIT(2),
625− IWL_MVM_SCAN_INT_MLO = BIT(3),
626546
627547 IWL_MVM_SCAN_STOPPING_REGULAR = BIT(8),
628548 IWL_MVM_SCAN_STOPPING_SCHED = BIT(9),
@@ -635,8 +555,6 @@ enum iwl_scan_status { · 6 unmodified lines
635555 IWL_MVM_SCAN_STOPPING_SCHED,
636556 IWL_MVM_SCAN_NETDETECT_MASK = IWL_MVM_SCAN_NETDETECT |
637557 IWL_MVM_SCAN_STOPPING_NETDETECT,
638− IWL_MVM_SCAN_INT_MLO_MASK = IWL_MVM_SCAN_INT_MLO |
639− IWL_MVM_SCAN_STOPPING_INT_MLO,
640558
641559 IWL_MVM_SCAN_STOPPING_MASK = 0xff << IWL_MVM_SCAN_STOPPING_SHIFT,
642560 IWL_MVM_SCAN_MASK = 0xff,
@@ -1017,8 +935,6 @@ struct iwl_mvm { · 374 unmodified lines
1017935 /* For async rx handlers that require the wiphy lock */
1018936 struct wiphy_work async_handlers_wiphy_wk;
1019937
1020− struct wiphy_work trig_link_selection_wk;
1021−
1022938 struct work_struct roc_done_wk;
1023939
1024940 unsigned long init_status;
@@ -1203,20 +1119,13 @@ struct iwl_mvm { · 178 unmodified lines
12031119 u8 offload_tid;
12041120 #ifdef CONFIG_IWLWIFI_DEBUGFS
12051121 bool d3_wake_sysassert;
1206− bool d3_test_active;
1207− u32 d3_test_pme_ptr;
1208− struct ieee80211_vif *keep_vif;
12091122 u32 last_netdetect_scans; /* no. of scans in the last net-detect wake */
12101123 #endif
12111124 #endif
12121125
12131126 wait_queue_head_t rx_sync_waitq;
12141127
1215− /* BT-Coex - only one of those will be used */
1216− union {
1217− struct iwl_bt_coex_prof_old_notif last_bt_notif;
1218− struct iwl_bt_coex_profile_notif last_bt_wifi_loss;
1219− };
1128+ struct iwl_bt_coex_prof_old_notif last_bt_notif;
12201129 struct iwl_bt_coex_ci_cmd last_bt_ci_cmd;
12211130
12221131 u8 bt_tx_prio;
@@ -2099,9 +2008,7 @@ int iwl_mvm_remove_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 876 unmodified lines
20992008 int iwl_mvm_disable_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
21002009 struct ieee80211_bss_conf *link_conf);
21012010
2102−void iwl_mvm_select_links(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
21032011 u8 iwl_mvm_get_primary_link(struct ieee80211_vif *vif);
2104−u8 iwl_mvm_get_other_link(struct ieee80211_vif *vif, u8 link_id);
21052012
21062013 struct iwl_mvm_link_sel_data {
21072014 u8 link_id;
@@ -2111,13 +2018,6 @@ struct iwl_mvm_link_sel_data { · 3 unmodified lines
21112018 };
21122019
21132020 #if IS_ENABLED(CONFIG_IWLWIFI_KUNIT_TESTS)
2114−unsigned int iwl_mvm_get_link_grade(struct ieee80211_bss_conf *link_conf);
2115−bool iwl_mvm_mld_valid_link_pair(struct ieee80211_vif *vif,
2116− const struct iwl_mvm_link_sel_data *a,
2117− const struct iwl_mvm_link_sel_data *b);
2118−
2119−s8 iwl_mvm_average_dbm_values(const struct iwl_umac_scan_channel_survey_notif *notif);
2120−
21212021 extern const struct iwl_hcmd_arr iwl_mvm_groups[];
21222022 extern const unsigned int iwl_mvm_groups_size;
21232023 #endif
@@ -2201,7 +2101,6 @@ int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify); · 77 unmodified lines
22012101 int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm);
22022102 void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm);
22032103 void iwl_mvm_scan_timeout_wk(struct work_struct *work);
2204−int iwl_mvm_int_mlo_scan(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
22052104 void iwl_mvm_rx_channel_survey_notif(struct iwl_mvm *mvm,
22062105 struct iwl_rx_cmd_buffer *rxb);
22072106
@@ -2327,8 +2226,6 @@ int iwl_mvm_send_proto_offload(struct iwl_mvm *mvm, · 119 unmodified lines
23272226 int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm);
23282227 void iwl_mvm_rx_bt_coex_old_notif(struct iwl_mvm *mvm,
23292228 struct iwl_rx_cmd_buffer *rxb);
2330−void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
2331− struct iwl_rx_cmd_buffer *rxb);
23322229 void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
23332230 enum ieee80211_rssi_event_data);
23342231 void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm);
@@ -2929,9 +2826,10 @@ void iwl_mvm_change_chanctx(struct ieee80211_hw *hw, · 594 unmodified lines
29292826 int iwl_mvm_tx_last_beacon(struct ieee80211_hw *hw);
29302827 void iwl_mvm_channel_switch(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
29312828 struct ieee80211_channel_switch *chsw);
2932−int iwl_mvm_pre_channel_switch(struct iwl_mvm *mvm,
2933− struct ieee80211_vif *vif,
2934− struct ieee80211_channel_switch *chsw);
2829+int iwl_mvm_mac_pre_channel_switch(struct ieee80211_hw *hw,
2830+ struct ieee80211_vif *vif,
2831+ struct ieee80211_channel_switch *chsw);
2832+
29352833 void iwl_mvm_abort_channel_switch(struct ieee80211_hw *hw,
29362834 struct ieee80211_vif *vif,
29372835 struct ieee80211_bss_conf *link_conf);
@@ -2988,30 +2886,6 @@ int iwl_mvm_roc_add_cmd(struct iwl_mvm *mvm, · 50 unmodified lines
29882886
29892887 /* EMLSR */
29902888 bool iwl_mvm_vif_has_esr_cap(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
2991−void iwl_mvm_block_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2992− enum iwl_mvm_esr_state reason,
2993− u8 link_to_keep);
2994−int iwl_mvm_block_esr_sync(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2995− enum iwl_mvm_esr_state reason);
2996−void iwl_mvm_unblock_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2997− enum iwl_mvm_esr_state reason);
2998−void iwl_mvm_exit_esr(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2999− enum iwl_mvm_esr_state reason,
3000− u8 link_to_keep);
3001−s8 iwl_mvm_get_esr_rssi_thresh(struct iwl_mvm *mvm,
3002− const struct cfg80211_chan_def *chandef,
3003− bool low);
3004−void iwl_mvm_bt_coex_update_link_esr(struct iwl_mvm *mvm,
3005− struct ieee80211_vif *vif,
3006− int link_id);
3007−bool
3008−iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,
3009− struct ieee80211_vif *vif,
3010− s32 link_rssi,
3011− bool primary);
3012−int iwl_mvm_esr_non_bss_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
3013− unsigned int link_id, bool active);
3014−
30152889 void
30162890 iwl_mvm_send_ap_tx_power_constraint_cmd(struct iwl_mvm *mvm,
30172891 struct ieee80211_vif *vif,
drivers/net/wireless/intel/iwlwifi/mvm/ops.c+0−53
@@ -143,24 +143,6 @@ static void iwl_mvm_nic_config(struct iwl_op_mode *op_mode) · 142 unmodified lines
143143 ~APMG_PS_CTRL_EARLY_PWR_OFF_RESET_DIS);
144144 }
145145
146−static void iwl_mvm_rx_esr_mode_notif(struct iwl_mvm *mvm,
147− struct iwl_rx_cmd_buffer *rxb)
148−{
149− struct iwl_rx_packet *pkt = rxb_addr(rxb);
150− struct iwl_esr_mode_notif *notif = (void *)pkt->data;
151− struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm);
152−
153− /* FW recommendations is only for entering EMLSR */
154− if (IS_ERR_OR_NULL(vif) || iwl_mvm_vif_from_mac80211(vif)->esr_active)
155− return;
156−
157− if (le32_to_cpu(notif->action) == ESR_RECOMMEND_ENTER)
158− iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_FW);
159− else
160− iwl_mvm_block_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_FW,
161− iwl_mvm_get_primary_link(vif));
162−}
163−
164146 static void iwl_mvm_rx_monitor_notif(struct iwl_mvm *mvm,
165147 struct iwl_rx_cmd_buffer *rxb)
166148 {
@@ -345,9 +327,6 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { · 178 unmodified lines
345327 RX_HANDLER(BT_PROFILE_NOTIFICATION, iwl_mvm_rx_bt_coex_old_notif,
346328 RX_HANDLER_ASYNC_LOCKED_WIPHY,
347329 struct iwl_bt_coex_prof_old_notif),
348− RX_HANDLER_GRP(BT_COEX_GROUP, PROFILE_NOTIF, iwl_mvm_rx_bt_coex_notif,
349− RX_HANDLER_ASYNC_LOCKED_WIPHY,
350− struct iwl_bt_coex_profile_notif),
351330 RX_HANDLER_NO_SIZE(BEACON_NOTIFICATION, iwl_mvm_rx_beacon_notif,
352331 RX_HANDLER_ASYNC_LOCKED),
353332 RX_HANDLER_NO_SIZE(STATISTICS_NOTIFICATION, iwl_mvm_rx_statistics,
@@ -457,11 +436,6 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = { · 103 unmodified lines
457436 RX_HANDLER_ASYNC_UNLOCKED,
458437 struct iwl_channel_switch_error_notif),
459438
460− RX_HANDLER_GRP(DATA_PATH_GROUP, ESR_MODE_NOTIF,
461− iwl_mvm_rx_esr_mode_notif,
462− RX_HANDLER_ASYNC_LOCKED_WIPHY,
463− struct iwl_esr_mode_notif),
464−
465439 RX_HANDLER_GRP(DATA_PATH_GROUP, MONITOR_NOTIF,
466440 iwl_mvm_rx_monitor_notif, RX_HANDLER_ASYNC_LOCKED,
467441 struct iwl_datapath_monitor_notif),
@@ -661,7 +635,6 @@ static const struct iwl_hcmd_names iwl_mvm_data_path_names[] = { · 193 unmodified lines
661635 HCMD_NAME(CHEST_COLLECTOR_FILTER_CONFIG_CMD),
662636 HCMD_NAME(SCD_QUEUE_CONFIG_CMD),
663637 HCMD_NAME(SEC_KEY_CMD),
664− HCMD_NAME(ESR_MODE_NOTIF),
665638 HCMD_NAME(MONITOR_NOTIF),
666639 HCMD_NAME(THERMAL_DUAL_CHAIN_REQUEST),
667640 HCMD_NAME(BEACON_FILTER_IN_NOTIF),
@@ -1220,29 +1193,6 @@ static const struct iwl_mei_ops mei_ops = { · 552 unmodified lines
12201193 .nic_stolen = iwl_mvm_mei_nic_stolen,
12211194 };
12221195
1223−static void iwl_mvm_find_link_selection_vif(void *_data, u8 *mac,
1224− struct ieee80211_vif *vif)
1225−{
1226− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1227−
1228− if (ieee80211_vif_is_mld(vif) && mvmvif->authorized)
1229− iwl_mvm_select_links(mvmvif->mvm, vif);
1230−}
1231−
1232−static void iwl_mvm_trig_link_selection(struct wiphy *wiphy,
1233− struct wiphy_work *wk)
1234−{
1235− struct iwl_mvm *mvm =
1236− container_of(wk, struct iwl_mvm, trig_link_selection_wk);
1237−
1238− mutex_lock(&mvm->mutex);
1239− ieee80211_iterate_active_interfaces(mvm->hw,
1240− IEEE80211_IFACE_ITER_NORMAL,
1241− iwl_mvm_find_link_selection_vif,
1242− NULL);
1243− mutex_unlock(&mvm->mutex);
1244−}
1245−
12461196 static struct iwl_op_mode *
12471197 iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg,
12481198 const struct iwl_fw *fw, struct dentry *dbgfs_dir)
@@ -1411,9 +1361,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_rf_cfg *cfg, · 162 unmodified lines
14111361 wiphy_work_init(&mvm->async_handlers_wiphy_wk,
14121362 iwl_mvm_async_handlers_wiphy_wk);
14131363
1414− wiphy_work_init(&mvm->trig_link_selection_wk,
1415− iwl_mvm_trig_link_selection);
1416−
14171364 init_waitqueue_head(&mvm->rx_sync_waitq);
14181365
14191366 mvm->queue_sync_state = 0;
drivers/net/wireless/intel/iwlwifi/mvm/rx.c+0−133
@@ -563,7 +563,6 @@ static void iwl_mvm_update_link_sig(struct ieee80211_vif *vif, int sig, · 562 unmodified lines
563563 int thold = bss_conf->cqm_rssi_thold;
564564 int hyst = bss_conf->cqm_rssi_hyst;
565565 int last_event;
566− s8 exit_esr_thresh;
567566
568567 if (sig == 0) {
569568 IWL_DEBUG_RX(mvm, "RSSI is 0 - skip signal based decision\n");
@@ -619,27 +618,6 @@ static void iwl_mvm_update_link_sig(struct ieee80211_vif *vif, int sig, · 49 unmodified lines
619618 sig,
620619 GFP_KERNEL);
621620 }
622−
623− /* ESR recalculation */
624− if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif))
625− return;
626−
627− /* We're not in EMLSR and our signal is bad, try to switch link maybe */
628− if (sig < IWL_MVM_LOW_RSSI_MLO_SCAN_THRESH && !mvmvif->esr_active) {
629− iwl_mvm_int_mlo_scan(mvm, vif);
630− return;
631− }
632−
633− /* We are in EMLSR, check if we need to exit */
634− exit_esr_thresh =
635− iwl_mvm_get_esr_rssi_thresh(mvm,
636− &bss_conf->chanreq.oper,
637− true);
638−
639− if (sig < exit_esr_thresh)
640− iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_LOW_RSSI,
641− iwl_mvm_get_other_link(vif,
642− bss_conf->link_id));
643621 }
644622
645623 static void iwl_mvm_stat_iterator(void *_data, u8 *mac,
@@ -914,10 +892,6 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, · 268 unmodified lines
914892 link_info->beacon_stats.avg_signal =
915893 -le32_to_cpu(link_stats->beacon_average_energy);
916894
917− if (link_info->phy_ctxt &&
918− link_info->phy_ctxt->channel->band == NL80211_BAND_2GHZ)
919− iwl_mvm_bt_coex_update_link_esr(mvm, vif, link_id);
920−
921895 /* make sure that beacon statistics don't go backwards with TCM
922896 * request to clear statistics
923897 */
@@ -956,111 +930,6 @@ iwl_mvm_stat_iterator_all_links(struct iwl_mvm *mvm, · 32 unmodified lines
956930 }
957931 }
958932
959−#define SEC_LINK_MIN_PERC 10
960−#define SEC_LINK_MIN_TX 3000
961−#define SEC_LINK_MIN_RX 400
962−
963−/* Accept a ~20% short window to avoid issues due to jitter */
964−#define IWL_MVM_TPT_MIN_COUNT_WINDOW (IWL_MVM_TPT_COUNT_WINDOW_SEC * HZ * 4 / 5)
965−
966−static void iwl_mvm_update_esr_mode_tpt(struct iwl_mvm *mvm)
967−{
968− struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm);
969− struct iwl_mvm_vif *mvmvif;
970− struct iwl_mvm_sta *mvmsta;
971− unsigned long total_tx = 0, total_rx = 0;
972− unsigned long sec_link_tx = 0, sec_link_rx = 0;
973− u8 sec_link_tx_perc, sec_link_rx_perc;
974− u8 sec_link;
975− bool skip = false;
976−
977− lockdep_assert_held(&mvm->mutex);
978−
979− if (IS_ERR_OR_NULL(bss_vif))
980− return;
981−
982− mvmvif = iwl_mvm_vif_from_mac80211(bss_vif);
983−
984− if (!mvmvif->esr_active || !mvmvif->ap_sta)
985− return;
986−
987− mvmsta = iwl_mvm_sta_from_mac80211(mvmvif->ap_sta);
988− /* We only count for the AP sta in a MLO connection */
989− if (!mvmsta->mpdu_counters)
990− return;
991−
992− /* Get the FW ID of the secondary link */
993− sec_link = iwl_mvm_get_other_link(bss_vif,
994− iwl_mvm_get_primary_link(bss_vif));
995− if (WARN_ON(!mvmvif->link[sec_link]))
996− return;
997− sec_link = mvmvif->link[sec_link]->fw_link_id;
998−
999− /* Sum up RX and TX MPDUs from the different queues/links */
1000− for (int q = 0; q < mvm->trans->info.num_rxqs; q++) {
1001− spin_lock_bh(&mvmsta->mpdu_counters[q].lock);
1002−
1003− /* The link IDs that doesn't exist will contain 0 */
1004− for (int link = 0; link < IWL_FW_MAX_LINK_ID; link++) {
1005− total_tx += mvmsta->mpdu_counters[q].per_link[link].tx;
1006− total_rx += mvmsta->mpdu_counters[q].per_link[link].rx;
1007− }
1008−
1009− sec_link_tx += mvmsta->mpdu_counters[q].per_link[sec_link].tx;
1010− sec_link_rx += mvmsta->mpdu_counters[q].per_link[sec_link].rx;
1011−
1012− /*
1013− * In EMLSR we have statistics every 5 seconds, so we can reset
1014− * the counters upon every statistics notification.
1015− * The FW sends the notification regularly, but it will be
1016− * misaligned at the start. Skipping the measurement if it is
1017− * short will synchronize us.
1018− */
1019− if (jiffies - mvmsta->mpdu_counters[q].window_start <
1020− IWL_MVM_TPT_MIN_COUNT_WINDOW)
1021− skip = true;
1022− mvmsta->mpdu_counters[q].window_start = jiffies;
1023− memset(mvmsta->mpdu_counters[q].per_link, 0,
1024− sizeof(mvmsta->mpdu_counters[q].per_link));
1025−
1026− spin_unlock_bh(&mvmsta->mpdu_counters[q].lock);
1027− }
1028−
1029− if (skip) {
1030− IWL_DEBUG_INFO(mvm, "MPDU statistics window was short\n");
1031− return;
1032− }
1033−
1034− IWL_DEBUG_INFO(mvm, "total Tx MPDUs: %ld. total Rx MPDUs: %ld\n",
1035− total_tx, total_rx);
1036−
1037− /* If we don't have enough MPDUs - exit EMLSR */
1038− if (total_tx < IWL_MVM_ENTER_ESR_TPT_THRESH &&
1039− total_rx < IWL_MVM_ENTER_ESR_TPT_THRESH) {
1040− iwl_mvm_block_esr(mvm, bss_vif, IWL_MVM_ESR_BLOCKED_TPT,
1041− iwl_mvm_get_primary_link(bss_vif));
1042− return;
1043− }
1044−
1045− IWL_DEBUG_INFO(mvm, "Secondary Link %d: Tx MPDUs: %ld. Rx MPDUs: %ld\n",
1046− sec_link, sec_link_tx, sec_link_rx);
1047−
1048− /* Calculate the percentage of the secondary link TX/RX */
1049− sec_link_tx_perc = total_tx ? sec_link_tx * 100 / total_tx : 0;
1050− sec_link_rx_perc = total_rx ? sec_link_rx * 100 / total_rx : 0;
1051−
1052− /*
1053− * The TX/RX percentage is checked only if it exceeds the required
1054− * minimum. In addition, RX is checked only if the TX check failed.
1055− */
1056− if ((total_tx > SEC_LINK_MIN_TX &&
1057− sec_link_tx_perc < SEC_LINK_MIN_PERC) ||
1058− (total_rx > SEC_LINK_MIN_RX &&
1059− sec_link_rx_perc < SEC_LINK_MIN_PERC))
1060− iwl_mvm_exit_esr(mvm, bss_vif, IWL_MVM_ESR_EXIT_LINK_USAGE,
1061− iwl_mvm_get_primary_link(bss_vif));
1062−}
1063−
1064933 void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm,
1065934 struct iwl_rx_cmd_buffer *rxb)
1066935 {
@@ -1088,8 +957,6 @@ void iwl_mvm_handle_rx_system_oper_stats(struct iwl_mvm *mvm, · 21 unmodified lines
1088957 ieee80211_iterate_stations_atomic(mvm->hw, iwl_mvm_stats_energy_iter,
1089958 average_energy);
1090959 iwl_mvm_handle_per_phy_stats(mvm, stats->per_phy);
1091−
1092− iwl_mvm_update_esr_mode_tpt(mvm);
1093960 }
1094961
1095962 void iwl_mvm_handle_rx_system_oper_part1_stats(struct iwl_mvm *mvm,
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c+10−13
@@ -332,6 +332,7 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta, · 331 unmodified lines
332332 struct ieee80211_key_conf *key;
333333 u32 len = le16_to_cpu(desc->mpdu_len);
334334 const u8 *frame = (void *)hdr;
335+ const u8 *mmie;
335336
336337 if ((status & IWL_RX_MPDU_STATUS_SEC_MASK) == IWL_RX_MPDU_STATUS_SEC_NONE)
337338 return 0;
@@ -375,11 +376,15 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta, · 37 unmodified lines
375376 goto report;
376377 }
377378
378− if (len < key->icv_len + IEEE80211_GMAC_PN_LEN + 2)
379+ if (len < key->icv_len)
379380 goto report;
380381
381382 /* get the real key ID */
382− keyid = frame[len - key->icv_len - IEEE80211_GMAC_PN_LEN - 2];
383+ mmie = frame + (len - key->icv_len);
384+
385+ /* the position of the key_id in ieee80211_mmie_16 is the same */
386+ keyid = le16_to_cpu(((const struct ieee80211_mmie *) mmie)->key_id);
387+
383388 /* and if that's the other key, look it up */
384389 if (keyid != key->keyidx) {
385390 /*
@@ -2099,7 +2104,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, · 1713 unmodified lines
20992104 struct ieee80211_sta *sta = NULL;
21002105 struct sk_buff *skb;
21012106 u8 crypt_len = 0;
2102− u8 sta_id = le32_get_bits(desc->status, IWL_RX_MPDU_STATUS_STA_ID);
21032107 size_t desc_size;
21042108 struct iwl_mvm_rx_phy_data phy_data = {};
21052109 u32 format;
@@ -2246,6 +2250,9 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, · 140 unmodified lines
22462250 rcu_read_lock();
22472251
22482252 if (desc->status & cpu_to_le32(IWL_RX_MPDU_STATUS_SRC_STA_FOUND)) {
2253+ u8 sta_id = le32_get_bits(desc->status,
2254+ IWL_RX_MPDU_STATUS_STA_ID);
2255+
22492256 if (!WARN_ON_ONCE(sta_id >= mvm->fw->ucode_capa.num_stations)) {
22502257 struct ieee80211_link_sta *link_sta;
22512258
@@ -2373,16 +2380,6 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, · 121 unmodified lines
23732380
23742381 iwl_mvm_agg_rx_received(mvm, reorder_data, baid);
23752382 }
2376−
2377− if (ieee80211_is_data(hdr->frame_control)) {
2378− u8 sub_frame_idx = desc->amsdu_info &
2379− IWL_RX_MPDU_AMSDU_SUBFRAME_IDX_MASK;
2380−
2381− /* 0 means not an A-MSDU, and 1 means a new A-MSDU */
2382− if (!sub_frame_idx || sub_frame_idx == 1)
2383− iwl_mvm_count_mpdu(mvmsta, sta_id, 1, false,
2384− queue);
2385− }
23862383 }
23872384
23882385 /* management stuff on default queue */
drivers/net/wireless/intel/iwlwifi/mvm/scan.c+0−101
@@ -1392,8 +1392,6 @@ static u32 iwl_mvm_scan_umac_ooc_priority(int type) · 1391 unmodified lines
13921392 {
13931393 if (type == IWL_MVM_SCAN_REGULAR)
13941394 return IWL_SCAN_PRIORITY_EXT_6;
1395− if (type == IWL_MVM_SCAN_INT_MLO)
1396− return IWL_SCAN_PRIORITY_EXT_4;
13971395
13981396 return IWL_SCAN_PRIORITY_EXT_2;
13991397 }
@@ -3220,7 +3218,6 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, · 1820 unmodified lines
32203218 struct iwl_umac_scan_complete *notif = (void *)pkt->data;
32213219 u32 uid = __le32_to_cpu(notif->uid);
32223220 bool aborted = (notif->status == IWL_SCAN_OFFLOAD_ABORTED);
3223− bool select_links = false;
32243221
32253222 mvm->mei_scan_filter.is_mei_limited_scan = false;
32263223
@@ -3267,13 +3264,6 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, · 40 unmodified lines
32673264 } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) {
32683265 ieee80211_sched_scan_stopped(mvm->hw);
32693266 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
3270− } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_INT_MLO) {
3271− IWL_DEBUG_SCAN(mvm, "Internal MLO scan completed\n");
3272− /*
3273− * Other scan types won't necessarily scan for the MLD links channels.
3274− * Therefore, only select links after successful internal scan.
3275− */
3276− select_links = notif->status == IWL_SCAN_OFFLOAD_COMPLETED;
32773267 }
32783268
32793269 mvm->scan_status &= ~mvm->scan_uid_status[uid];
@@ -3286,9 +3276,6 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, · 6 unmodified lines
32863276 mvm->last_ebs_successful = false;
32873277
32883278 mvm->scan_uid_status[uid] = 0;
3289−
3290− if (select_links)
3291− wiphy_work_queue(mvm->hw->wiphy, &mvm->trig_link_selection_wk);
32923279 }
32933280
32943281 void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
@@ -3483,11 +3470,6 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm) · 188 unmodified lines
34833470 mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
34843471 mvm->scan_uid_status[uid] = 0;
34853472 }
3486− uid = iwl_mvm_scan_uid_by_status(mvm, IWL_MVM_SCAN_INT_MLO);
3487− if (uid >= 0) {
3488− IWL_DEBUG_SCAN(mvm, "Internal MLO scan aborted\n");
3489− mvm->scan_uid_status[uid] = 0;
3490− }
34913473
34923474 uid = iwl_mvm_scan_uid_by_status(mvm,
34933475 IWL_MVM_SCAN_STOPPING_REGULAR);
@@ -3583,89 +3565,6 @@ out: · 89 unmodified lines
35833565 return ret;
35843566 }
35853567
3586−static int iwl_mvm_int_mlo_scan_start(struct iwl_mvm *mvm,
3587− struct ieee80211_vif *vif,
3588− struct ieee80211_channel **channels,
3589− size_t n_channels)
3590−{
3591− struct cfg80211_scan_request *req = NULL;
3592− struct ieee80211_scan_ies ies = {};
3593− size_t size, i;
3594− int ret;
3595−
3596− lockdep_assert_held(&mvm->mutex);
3597−
3598− IWL_DEBUG_SCAN(mvm, "Starting Internal MLO scan: n_channels=%zu\n",
3599− n_channels);
3600−
3601− if (!vif->cfg.assoc || !ieee80211_vif_is_mld(vif) ||
3602− hweight16(vif->valid_links) == 1)
3603− return -EINVAL;
3604−
3605− size = struct_size(req, channels, n_channels);
3606− req = kzalloc(size, GFP_KERNEL);
3607− if (!req)
3608− return -ENOMEM;
3609−
3610− /* set the requested channels */
3611− for (i = 0; i < n_channels; i++)
3612− req->channels[i] = channels[i];
3613−
3614− req->n_channels = n_channels;
3615−
3616− /* set the rates */
3617− for (i = 0; i < NUM_NL80211_BANDS; i++)
3618− if (mvm->hw->wiphy->bands[i])
3619− req->rates[i] =
3620− (1 << mvm->hw->wiphy->bands[i]->n_bitrates) - 1;
3621−
3622− req->wdev = ieee80211_vif_to_wdev(vif);
3623− req->wiphy = mvm->hw->wiphy;
3624− req->scan_start = jiffies;
3625− req->tsf_report_link_id = -1;
3626−
3627− ret = _iwl_mvm_single_scan_start(mvm, vif, req, &ies,
3628− IWL_MVM_SCAN_INT_MLO);
3629− kfree(req);
3630−
3631− IWL_DEBUG_SCAN(mvm, "Internal MLO scan: ret=%d\n", ret);
3632− return ret;
3633−}
3634−
3635−int iwl_mvm_int_mlo_scan(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
3636−{
3637− struct ieee80211_channel *channels[IEEE80211_MLD_MAX_NUM_LINKS];
3638− unsigned long usable_links = ieee80211_vif_usable_links(vif);
3639− size_t n_channels = 0;
3640− u8 link_id;
3641−
3642− lockdep_assert_held(&mvm->mutex);
3643−
3644− if (mvm->scan_status & IWL_MVM_SCAN_INT_MLO) {
3645− IWL_DEBUG_SCAN(mvm, "Internal MLO scan is already running\n");
3646− return -EBUSY;
3647− }
3648−
3649− rcu_read_lock();
3650−
3651− for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) {
3652− struct ieee80211_bss_conf *link_conf =
3653− rcu_dereference(vif->link_conf[link_id]);
3654−
3655− if (WARN_ON_ONCE(!link_conf))
3656− continue;
3657−
3658− channels[n_channels++] = link_conf->chanreq.oper.chan;
3659− }
3660−
3661− rcu_read_unlock();
3662−
3663− if (!n_channels)
3664− return -EINVAL;
3665−
3666− return iwl_mvm_int_mlo_scan_start(mvm, vif, channels, n_channels);
3667−}
3668−
36693568 static int iwl_mvm_chanidx_from_phy(struct iwl_mvm *mvm,
36703569 enum nl80211_band band,
36713570 u16 phy_chan_num)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c+0−89
@@ -1835,18 +1835,6 @@ int iwl_mvm_sta_init(struct iwl_mvm *mvm, struct ieee80211_vif *vif, · 1834 unmodified lines
18351835
18361836 iwl_mvm_toggle_tx_ant(mvm, &mvm_sta->tx_ant);
18371837
1838− /* MPDUs are counted only when EMLSR is possible */
1839− if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
1840− !sta->tdls && ieee80211_vif_is_mld(vif)) {
1841− mvm_sta->mpdu_counters =
1842− kcalloc(mvm->trans->info.num_rxqs,
1843− sizeof(*mvm_sta->mpdu_counters),
1844− GFP_KERNEL);
1845− if (mvm_sta->mpdu_counters)
1846− for (int q = 0; q < mvm->trans->info.num_rxqs; q++)
1847− spin_lock_init(&mvm_sta->mpdu_counters[q].lock);
1848− }
1849−
18501838 return 0;
18511839 }
18521840
@@ -4328,80 +4316,3 @@ void iwl_mvm_cancel_channel_switch(struct iwl_mvm *mvm, · 2475 unmodified lines
43284316 if (ret)
43294317 IWL_ERR(mvm, "Failed to cancel the channel switch\n");
43304318 }
4331−
4332−static int iwl_mvm_fw_sta_id_to_fw_link_id(struct iwl_mvm_vif *mvmvif,
4333− u8 fw_sta_id)
4334−{
4335− struct ieee80211_link_sta *link_sta =
4336− rcu_dereference(mvmvif->mvm->fw_id_to_link_sta[fw_sta_id]);
4337− struct iwl_mvm_vif_link_info *link;
4338−
4339− if (WARN_ON_ONCE(!link_sta))
4340− return -EINVAL;
4341−
4342− link = mvmvif->link[link_sta->link_id];
4343−
4344− if (WARN_ON_ONCE(!link))
4345− return -EINVAL;
4346−
4347− return link->fw_link_id;
4348−}
4349−
4350−#define IWL_MVM_TPT_COUNT_WINDOW (IWL_MVM_TPT_COUNT_WINDOW_SEC * HZ)
4351−
4352−void iwl_mvm_count_mpdu(struct iwl_mvm_sta *mvm_sta, u8 fw_sta_id, u32 count,
4353− bool tx, int queue)
4354−{
4355− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvm_sta->vif);
4356− struct iwl_mvm *mvm = mvmvif->mvm;
4357− struct iwl_mvm_tpt_counter *queue_counter;
4358− struct iwl_mvm_mpdu_counter *link_counter;
4359− u32 total_mpdus = 0;
4360− int fw_link_id;
4361−
4362− /* Count only for a BSS sta, and only when EMLSR is possible */
4363− if (!mvm_sta->mpdu_counters)
4364− return;
4365−
4366− /* Map sta id to link id */
4367− fw_link_id = iwl_mvm_fw_sta_id_to_fw_link_id(mvmvif, fw_sta_id);
4368− if (fw_link_id < 0)
4369− return;
4370−
4371− queue_counter = &mvm_sta->mpdu_counters[queue];
4372− link_counter = &queue_counter->per_link[fw_link_id];
4373−
4374− spin_lock_bh(&queue_counter->lock);
4375−
4376− if (tx)
4377− link_counter->tx += count;
4378− else
4379− link_counter->rx += count;
4380−
4381− /*
4382− * When not in EMLSR, the window and the decision to enter EMLSR are
4383− * handled during counting, when in EMLSR - in the statistics flow
4384− */
4385− if (mvmvif->esr_active)
4386− goto out;
4387−
4388− if (time_is_before_jiffies(queue_counter->window_start +
4389− IWL_MVM_TPT_COUNT_WINDOW)) {
4390− memset(queue_counter->per_link, 0,
4391− sizeof(queue_counter->per_link));
4392− queue_counter->window_start = jiffies;
4393−
4394− IWL_DEBUG_INFO(mvm, "MPDU counters are cleared\n");
4395− }
4396−
4397− for (int i = 0; i < IWL_FW_MAX_LINK_ID; i++)
4398− total_mpdus += tx ? queue_counter->per_link[i].tx :
4399− queue_counter->per_link[i].rx;
4400−
4401− if (total_mpdus > IWL_MVM_ENTER_ESR_TPT_THRESH)
4402− wiphy_work_queue(mvmvif->mvm->hw->wiphy,
4403− &mvmvif->unblock_esr_tpt_wk);
4404−
4405−out:
4406− spin_unlock_bh(&queue_counter->lock);
4407−}
drivers/net/wireless/intel/iwlwifi/mvm/sta.h+0−24
@@ -344,24 +344,6 @@ struct iwl_mvm_link_sta { · 343 unmodified lines
344344 u8 avg_energy;
345345 };
346346
347−struct iwl_mvm_mpdu_counter {
348− u32 tx;
349− u32 rx;
350−};
351−
352−/**
353− * struct iwl_mvm_tpt_counter - per-queue MPDU counter
354− *
355− * @lock: Needed to protect the counters when modified from statistics.
356− * @per_link: per-link counters.
357− * @window_start: timestamp of the counting-window start
358− */
359−struct iwl_mvm_tpt_counter {
360− spinlock_t lock;
361− struct iwl_mvm_mpdu_counter per_link[IWL_FW_MAX_LINK_ID];
362− unsigned long window_start;
363−} ____cacheline_aligned_in_smp;
364−
365347 /**
366348 * struct iwl_mvm_sta - representation of a station in the driver
367349 * @vif: the interface the station belongs to
@@ -409,7 +391,6 @@ struct iwl_mvm_tpt_counter { · 41 unmodified lines
409391 * @link: per link sta entries. For non-MLO only link[0] holds data. For MLO,
410392 * link[0] points to deflink and link[link_id] is allocated when new link
411393 * sta is added.
412− * @mpdu_counters: RX/TX MPDUs counters for each queue.
413394 *
414395 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
415396 * in the structure for use by driver. This structure is placed in that
@@ -449,8 +430,6 @@ struct iwl_mvm_sta { · 33 unmodified lines
449430
450431 struct iwl_mvm_link_sta deflink;
451432 struct iwl_mvm_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
452−
453− struct iwl_mvm_tpt_counter *mpdu_counters;
454433 };
455434
456435 u16 iwl_mvm_tid_queued(struct iwl_mvm *mvm, struct iwl_mvm_tid_data *tid_data);
@@ -533,9 +512,6 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, · 76 unmodified lines
533512 void iwl_mvm_rx_eosp_notif(struct iwl_mvm *mvm,
534513 struct iwl_rx_cmd_buffer *rxb);
535514
536−void iwl_mvm_count_mpdu(struct iwl_mvm_sta *mvm_sta, u8 fw_sta_id, u32 count,
537− bool tx, int queue);
538−
539515 /* AMPDU */
540516 int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
541517 int tid, u16 ssn, bool start, u16 buf_size, u16 timeout);
drivers/net/wireless/intel/iwlwifi/mvm/tests/Makefile+1−1
@@ -1,3 +1,3 @@
1−iwlmvm-tests-y += module.o links.o hcmd.o
1+iwlmvm-tests-y += module.o hcmd.o
22
33 obj-$(CONFIG_IWLWIFI_KUNIT_TESTS) += iwlmvm-tests.o
drivers/net/wireless/intel/iwlwifi/mvm/tests/links.c+0−433
@@ -1,433 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-only
2−/*
3− * KUnit tests for channel helper functions
4− *
5− * Copyright (C) 2024 Intel Corporation
6− */
7−#include <net/mac80211.h>
8−#include "../mvm.h"
9−#include <kunit/test.h>
10−
11−MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
12−
13−static struct wiphy wiphy = {
14− .mtx = __MUTEX_INITIALIZER(wiphy.mtx),
15−};
16−
17−static struct ieee80211_hw hw = {
18− .wiphy = &wiphy,
19−};
20−
21−static struct ieee80211_channel chan_5ghz = {
22− .band = NL80211_BAND_5GHZ,
23−};
24−
25−static struct ieee80211_channel chan_6ghz = {
26− .band = NL80211_BAND_6GHZ,
27−};
28−
29−static struct ieee80211_channel chan_2ghz = {
30− .band = NL80211_BAND_2GHZ,
31−};
32−
33−static struct cfg80211_chan_def chandef_a = {};
34−
35−static struct cfg80211_chan_def chandef_b = {};
36−
37−static struct iwl_mvm_phy_ctxt ctx = {};
38−
39−static struct iwl_mvm_vif_link_info mvm_link = {
40− .phy_ctxt = &ctx,
41− .active = true
42−};
43−
44−static struct cfg80211_bss bss = {};
45−
46−static struct ieee80211_bss_conf link_conf = {.bss = &bss};
47−
48−static const struct iwl_fw_cmd_version entry = {
49− .group = LEGACY_GROUP,
50− .cmd = BT_PROFILE_NOTIFICATION,
51− .notif_ver = 4
52−};
53−
54−static struct iwl_fw fw = {
55− .ucode_capa = {
56− .n_cmd_versions = 1,
57− .cmd_versions = &entry,
58− },
59−};
60−
61−static struct iwl_mvm mvm = {
62− .hw = &hw,
63− .fw = &fw,
64−};
65−
66−static const struct link_grading_case {
67− const char *desc;
68− const struct cfg80211_chan_def chandef;
69− s32 signal;
70− s16 channel_util;
71− int chan_load_by_us;
72− unsigned int grade;
73−} link_grading_cases[] = {
74− {
75− .desc = "UHB, RSSI below range, no factors",
76− .chandef = {
77− .chan = &chan_6ghz,
78− .width = NL80211_CHAN_WIDTH_20,
79− },
80− .signal = -100,
81− .grade = 177,
82− },
83− {
84− .desc = "LB, RSSI in range, no factors",
85− .chandef = {
86− .chan = &chan_2ghz,
87− .width = NL80211_CHAN_WIDTH_20,
88− },
89− .signal = -84,
90− .grade = 344,
91− },
92− {
93− .desc = "HB, RSSI above range, no factors",
94− .chandef = {
95− .chan = &chan_5ghz,
96− .width = NL80211_CHAN_WIDTH_20,
97− },
98− .signal = -50,
99− .grade = 3442,
100− },
101− {
102− .desc = "HB, BSS Load IE (20 percent), inactive link, no puncturing factor",
103− .chandef = {
104− .chan = &chan_5ghz,
105− .width = NL80211_CHAN_WIDTH_20,
106− },
107− .signal = -66,
108− .channel_util = 51,
109− .grade = 1836,
110− },
111− {
112− .desc = "LB, BSS Load IE (20 percent), active link, chan_load_by_us=10 percent. No puncturing factor",
113− .chandef = {
114− .chan = &chan_2ghz,
115− .width = NL80211_CHAN_WIDTH_20,
116− },
117− .signal = -61,
118− .channel_util = 51,
119− .chan_load_by_us = 10,
120− .grade = 2061,
121− },
122− {
123− .desc = "UHB, BSS Load IE (40 percent), active link, chan_load_by_us=50 (invalid) percent. No puncturing factor",
124− .chandef = {
125− .chan = &chan_6ghz,
126− .width = NL80211_CHAN_WIDTH_20,
127− },
128− .signal = -66,
129− .channel_util = 102,
130− .chan_load_by_us = 50,
131− .grade = 1552,
132− },
133− { .desc = "HB, 80 MHz, no channel load factor, punctured percentage 0",
134− .chandef = {
135− .chan = &chan_5ghz,
136− .width = NL80211_CHAN_WIDTH_80,
137− .punctured = 0x0000
138− },
139− .signal = -72,
140− .grade = 1750,
141− },
142− { .desc = "HB, 160 MHz, no channel load factor, punctured percentage 25",
143− .chandef = {
144− .chan = &chan_5ghz,
145− .width = NL80211_CHAN_WIDTH_160,
146− .punctured = 0x3
147− },
148− .signal = -72,
149− .grade = 1312,
150− },
151− { .desc = "UHB, 320 MHz, no channel load factor, punctured percentage 12.5 (2/16)",
152− .chandef = {
153− .chan = &chan_6ghz,
154− .width = NL80211_CHAN_WIDTH_320,
155− .punctured = 0x3
156− },
157− .signal = -72,
158− .grade = 1806,
159− },
160− { .desc = "HB, 160 MHz, channel load 20, channel load by us 10, punctured percentage 25",
161− .chandef = {
162− .chan = &chan_5ghz,
163− .width = NL80211_CHAN_WIDTH_160,
164− .punctured = 0x3
165− },
166− .channel_util = 51,
167− .chan_load_by_us = 10,
168− .signal = -72,
169− .grade = 1179,
170− },
171−};
172−
173−KUNIT_ARRAY_PARAM_DESC(link_grading, link_grading_cases, desc)
174−
175−static void setup_link_conf(struct kunit *test)
176−{
177− const struct link_grading_case *params = test->param_value;
178− size_t vif_size = sizeof(struct ieee80211_vif) +
179− sizeof(struct iwl_mvm_vif);
180− struct ieee80211_vif *vif = kunit_kzalloc(test, vif_size, GFP_KERNEL);
181− struct ieee80211_bss_load_elem *bss_load;
182− struct element *element;
183− size_t ies_size = sizeof(struct cfg80211_bss_ies) + sizeof(*bss_load) + sizeof(element);
184− struct cfg80211_bss_ies *ies;
185− struct iwl_mvm_vif *mvmvif;
186−
187− KUNIT_ASSERT_NOT_NULL(test, vif);
188−
189− mvmvif = iwl_mvm_vif_from_mac80211(vif);
190− if (params->chan_load_by_us > 0) {
191− ctx.channel_load_by_us = params->chan_load_by_us;
192− mvmvif->link[0] = &mvm_link;
193− }
194−
195− link_conf.vif = vif;
196− link_conf.chanreq.oper = params->chandef;
197− bss.signal = DBM_TO_MBM(params->signal);
198−
199− ies = kunit_kzalloc(test, ies_size, GFP_KERNEL);
200− KUNIT_ASSERT_NOT_NULL(test, ies);
201− ies->len = sizeof(*bss_load) + sizeof(struct element);
202−
203− element = (void *)ies->data;
204− element->datalen = sizeof(*bss_load);
205− element->id = 11;
206−
207− bss_load = (void *)element->data;
208− bss_load->channel_util = params->channel_util;
209−
210− rcu_assign_pointer(bss.ies, ies);
211− rcu_assign_pointer(bss.beacon_ies, ies);
212−}
213−
214−static void test_link_grading(struct kunit *test)
215−{
216− const struct link_grading_case *params = test->param_value;
217− unsigned int ret;
218−
219− setup_link_conf(test);
220−
221− rcu_read_lock();
222− ret = iwl_mvm_get_link_grade(&link_conf);
223− rcu_read_unlock();
224−
225− KUNIT_EXPECT_EQ(test, ret, params->grade);
226−
227− kunit_kfree(test, link_conf.vif);
228− RCU_INIT_POINTER(bss.ies, NULL);
229−}
230−
231−static struct kunit_case link_grading_test_cases[] = {
232− KUNIT_CASE_PARAM(test_link_grading, link_grading_gen_params),
233− {}
234−};
235−
236−static struct kunit_suite link_grading = {
237− .name = "iwlmvm-link-grading",
238− .test_cases = link_grading_test_cases,
239−};
240−
241−kunit_test_suite(link_grading);
242−
243−static const struct valid_link_pair_case {
244− const char *desc;
245− bool bt;
246− struct ieee80211_channel *chan_a;
247− struct ieee80211_channel *chan_b;
248− enum nl80211_chan_width cw_a;
249− enum nl80211_chan_width cw_b;
250− s32 sig_a;
251− s32 sig_b;
252− bool csa_a;
253− bool valid;
254−} valid_link_pair_cases[] = {
255− {
256− .desc = "HB + UHB, valid.",
257− .chan_a = &chan_6ghz,
258− .chan_b = &chan_5ghz,
259− .valid = true,
260− },
261− {
262− .desc = "LB + HB, no BT.",
263− .chan_a = &chan_2ghz,
264− .chan_b = &chan_5ghz,
265− .valid = true,
266− },
267− {
268− .desc = "LB + HB, with BT.",
269− .bt = true,
270− .chan_a = &chan_2ghz,
271− .chan_b = &chan_5ghz,
272− .valid = false,
273− },
274− {
275− .desc = "Same band",
276− .chan_a = &chan_2ghz,
277− .chan_b = &chan_2ghz,
278− .valid = false,
279− },
280− {
281− .desc = "RSSI: LB, 20 MHz, low",
282− .chan_a = &chan_2ghz,
283− .cw_a = NL80211_CHAN_WIDTH_20,
284− .sig_a = -68,
285− .chan_b = &chan_5ghz,
286− .valid = false,
287− },
288− {
289− .desc = "RSSI: UHB, 20 MHz, high",
290− .chan_a = &chan_6ghz,
291− .cw_a = NL80211_CHAN_WIDTH_20,
292− .sig_a = -66,
293− .chan_b = &chan_5ghz,
294− .cw_b = NL80211_CHAN_WIDTH_20,
295− .valid = true,
296− },
297− {
298− .desc = "RSSI: UHB, 40 MHz, low",
299− .chan_a = &chan_6ghz,
300− .cw_a = NL80211_CHAN_WIDTH_40,
301− .sig_a = -65,
302− .chan_b = &chan_5ghz,
303− .cw_b = NL80211_CHAN_WIDTH_40,
304− .valid = false,
305− },
306− {
307− .desc = "RSSI: UHB, 40 MHz, high",
308− .chan_a = &chan_6ghz,
309− .cw_a = NL80211_CHAN_WIDTH_40,
310− .sig_a = -63,
311− .chan_b = &chan_5ghz,
312− .cw_b = NL80211_CHAN_WIDTH_40,
313− .valid = true,
314− },
315− {
316− .desc = "RSSI: UHB, 80 MHz, low",
317− .chan_a = &chan_6ghz,
318− .cw_a = NL80211_CHAN_WIDTH_80,
319− .sig_a = -62,
320− .chan_b = &chan_5ghz,
321− .cw_b = NL80211_CHAN_WIDTH_80,
322− .valid = false,
323− },
324− {
325− .desc = "RSSI: UHB, 80 MHz, high",
326− .chan_a = &chan_6ghz,
327− .cw_a = NL80211_CHAN_WIDTH_80,
328− .sig_a = -60,
329− .chan_b = &chan_5ghz,
330− .cw_b = NL80211_CHAN_WIDTH_80,
331− .valid = true,
332− },
333− {
334− .desc = "RSSI: UHB, 160 MHz, low",
335− .chan_a = &chan_6ghz,
336− .cw_a = NL80211_CHAN_WIDTH_160,
337− .sig_a = -59,
338− .chan_b = &chan_5ghz,
339− .cw_b = NL80211_CHAN_WIDTH_160,
340− .valid = false,
341− },
342− {
343− .desc = "RSSI: HB, 160 MHz, high",
344− .chan_a = &chan_6ghz,
345− .cw_a = NL80211_CHAN_WIDTH_160,
346− .sig_a = -5,
347− .chan_b = &chan_5ghz,
348− .cw_b = NL80211_CHAN_WIDTH_160,
349− .valid = true,
350− },
351− {
352− .desc = "CSA active",
353− .chan_a = &chan_6ghz,
354− .cw_a = NL80211_CHAN_WIDTH_160,
355− .sig_a = -5,
356− .chan_b = &chan_5ghz,
357− .cw_b = NL80211_CHAN_WIDTH_160,
358− .valid = false,
359− /* same as previous entry with valid=true except for CSA */
360− .csa_a = true,
361− },
362−};
363−
364−KUNIT_ARRAY_PARAM_DESC(valid_link_pair, valid_link_pair_cases, desc)
365−
366−static void test_valid_link_pair(struct kunit *test)
367−{
368− const struct valid_link_pair_case *params = test->param_value;
369− size_t vif_size = sizeof(struct ieee80211_vif) +
370− sizeof(struct iwl_mvm_vif);
371− struct ieee80211_vif *vif = kunit_kzalloc(test, vif_size, GFP_KERNEL);
372− struct iwl_trans *trans = kunit_kzalloc(test, sizeof(struct iwl_trans),
373− GFP_KERNEL);
374− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
375− struct iwl_mvm_link_sel_data link_a = {
376− .chandef = &chandef_a,
377− .link_id = 1,
378− .signal = params->sig_a,
379− };
380− struct iwl_mvm_link_sel_data link_b = {
381− .chandef = &chandef_b,
382− .link_id = 5,
383− .signal = params->sig_b,
384− };
385− struct ieee80211_bss_conf *conf;
386− bool result;
387−
388− KUNIT_ASSERT_NOT_NULL(test, vif);
389− KUNIT_ASSERT_NOT_NULL(test, trans);
390−
391− chandef_a.chan = params->chan_a;
392− chandef_b.chan = params->chan_b;
393−
394− chandef_a.width = params->cw_a ?: NL80211_CHAN_WIDTH_20;
395− chandef_b.width = params->cw_b ?: NL80211_CHAN_WIDTH_20;
396−
397− mvm.trans = trans;
398−
399− mvm.last_bt_notif.wifi_loss_low_rssi = params->bt;
400− mvmvif->mvm = &mvm;
401−
402− conf = kunit_kzalloc(test, sizeof(*vif->link_conf[0]), GFP_KERNEL);
403− KUNIT_ASSERT_NOT_NULL(test, conf);
404− conf->chanreq.oper = chandef_a;
405− conf->csa_active = params->csa_a;
406− vif->link_conf[link_a.link_id] = (void __rcu *)conf;
407−
408− conf = kunit_kzalloc(test, sizeof(*vif->link_conf[0]), GFP_KERNEL);
409− KUNIT_ASSERT_NOT_NULL(test, conf);
410− conf->chanreq.oper = chandef_b;
411− vif->link_conf[link_b.link_id] = (void __rcu *)conf;
412−
413− wiphy_lock(&wiphy);
414− result = iwl_mvm_mld_valid_link_pair(vif, &link_a, &link_b);
415− wiphy_unlock(&wiphy);
416−
417− KUNIT_EXPECT_EQ(test, result, params->valid);
418−
419− kunit_kfree(test, vif);
420− kunit_kfree(test, trans);
421−}
422−
423−static struct kunit_case valid_link_pair_test_cases[] = {
424− KUNIT_CASE_PARAM(test_valid_link_pair, valid_link_pair_gen_params),
425− {},
426−};
427−
428−static struct kunit_suite valid_link_pair = {
429− .name = "iwlmvm-valid-link-pair",
430− .test_cases = valid_link_pair_test_cases,
431−};
432−
433−kunit_test_suite(valid_link_pair);
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c+0−3
@@ -47,7 +47,6 @@ void iwl_mvm_te_clear_data(struct iwl_mvm *mvm, · 46 unmodified lines
4747
4848 static void iwl_mvm_cleanup_roc(struct iwl_mvm *mvm)
4949 {
50− struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm);
5150 struct ieee80211_vif *vif = mvm->p2p_device_vif;
5251
5352 lockdep_assert_held(&mvm->mutex);
@@ -125,8 +124,6 @@ static void iwl_mvm_cleanup_roc(struct iwl_mvm *mvm) · 71 unmodified lines
125124 iwl_mvm_rm_aux_sta(mvm);
126125 }
127126
128− if (!IS_ERR_OR_NULL(bss_vif))
129− iwl_mvm_unblock_esr(mvm, bss_vif, IWL_MVM_ESR_BLOCKED_ROC);
130127 mutex_unlock(&mvm->mutex);
131128 }
132129
drivers/net/wireless/intel/iwlwifi/mvm/tx.c+1−7
@@ -1769,9 +1769,6 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 1768 unmodified lines
17691769 IWL_DEBUG_TX_REPLY(mvm,
17701770 "Next reclaimed packet:%d\n",
17711771 next_reclaimed);
1772− if (tid < IWL_MAX_TID_COUNT)
1773− iwl_mvm_count_mpdu(mvmsta, sta_id, 1,
1774− true, 0);
17751772 } else {
17761773 IWL_DEBUG_TX_REPLY(mvm,
17771774 "NDP - don't update next_reclaimed\n");
@@ -2150,13 +2147,10 @@ void iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) · 372 unmodified lines
21502147 ba_res->tx_rate, false);
21512148 }
21522149
2153− if (mvmsta) {
2150+ if (mvmsta)
21542151 iwl_mvm_tx_airtime(mvm, mvmsta,
21552152 le32_to_cpu(ba_res->wireless_time));
21562153
2157− iwl_mvm_count_mpdu(mvmsta, sta_id,
2158− le16_to_cpu(ba_res->txed), true, 0);
2159− }
21602154 rcu_read_unlock();
21612155 return;
21622156 }
drivers/net/wireless/intel/iwlwifi/mvm/utils.c+0−10
@@ -22,11 +22,6 @@ int iwl_mvm_send_cmd(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd) · 21 unmodified lines
2222 {
2323 int ret;
2424
25−#if defined(CONFIG_IWLWIFI_DEBUGFS) && defined(CONFIG_PM_SLEEP)
26− if (WARN_ON(mvm->d3_test_active))
27− return -EIO;
28−#endif
29−
3025 /*
3126 * Synchronous commands from this op-mode must hold
3227 * the mutex, this ensures we don't try to send two
@@ -79,11 +74,6 @@ int iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd, · 46 unmodified lines
7974
8075 lockdep_assert_held(&mvm->mutex);
8176
82−#if defined(CONFIG_IWLWIFI_DEBUGFS) && defined(CONFIG_PM_SLEEP)
83− if (WARN_ON(mvm->d3_test_active))
84− return -EIO;
85−#endif
86−
8777 /*
8878 * Only synchronous commands can wait for status,
8979 * we use WANT_SKB so the caller can't.
drivers/net/wireless/intel/iwlwifi/pcie/drv.c+2−7
@@ -1179,16 +1179,11 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 1178 unmodified lines
11791179 static void iwl_pci_remove(struct pci_dev *pdev)
11801180 {
11811181 struct iwl_trans *trans = pci_get_drvdata(pdev);
1182− struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
11831182
11841183 if (!trans)
11851184 return;
11861185
1187− cancel_delayed_work_sync(&trans_pcie->me_recheck_wk);
1188−
1189− iwl_drv_stop(trans->drv);
1190−
1191− iwl_trans_pcie_free(trans);
1186+ iwl_pcie_gen1_2_remove(trans);
11921187 }
11931188
11941189 #ifdef CONFIG_PM_SLEEP
@@ -1260,7 +1255,7 @@ static int _iwl_pci_resume(struct device *device, bool restore) · 65 unmodified lines
12601255 * won't really know how to recover.
12611256 */
12621257 iwl_pcie_prepare_card_hw(trans);
1263− iwl_finish_nic_init(trans);
1258+ iwl_trans_activate_nic(trans);
12641259 iwl_op_mode_device_powered_off(trans->op_mode);
12651260 }
12661261
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/internal.h+49−4
@@ -400,6 +400,11 @@ struct iwl_pcie_txqs { · 399 unmodified lines
400400 * @me_recheck_wk: worker to recheck WiAMT/CSME presence
401401 * @invalid_tx_cmd: invalid TX command buffer
402402 * @wait_command_queue: wait queue for sync commands
403+ * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only.
404+ * The user should use iwl_trans_{alloc,free}_tx_cmd.
405+ * @dev_cmd_pool_name: name for the TX command allocation pool
406+ * @pm_support: set to true in start_hw if link pm is supported
407+ * @ltr_enabled: set to true if the LTR is enabled
403408 */
404409 struct iwl_trans_pcie {
405410 struct iwl_rxq *rxq;
@@ -506,6 +511,12 @@ struct iwl_trans_pcie { · 100 unmodified lines
506511 struct iwl_dma_ptr invalid_tx_cmd;
507512
508513 wait_queue_head_t wait_command_queue;
514+
515+ struct kmem_cache *dev_cmd_pool;
516+ char dev_cmd_pool_name[50];
517+
518+ bool pm_support;
519+ bool ltr_enabled;
509520 };
510521
511522 static inline struct iwl_trans_pcie *
@@ -783,6 +794,23 @@ static inline u16 iwl_txq_gen1_tfd_tb_get_len(struct iwl_trans *trans, · 271 unmodified lines
783794 return le16_to_cpu(tb->hi_n_len) >> 4;
784795 }
785796
797+static inline struct iwl_device_tx_cmd *
798+iwl_pcie_gen1_2_alloc_tx_cmd(struct iwl_trans *trans)
799+{
800+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
801+
802+ return kmem_cache_zalloc(trans_pcie->dev_cmd_pool, GFP_ATOMIC);
803+}
804+
805+static inline void
806+iwl_pcie_gen1_2_free_tx_cmd(struct iwl_trans *trans,
807+ struct iwl_device_tx_cmd *dev_cmd)
808+{
809+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
810+
811+ kmem_cache_free(trans_pcie->dev_cmd_pool, dev_cmd);
812+}
813+
786814 void iwl_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
787815 struct sk_buff_head *skbs, bool is_flush);
788816 void iwl_pcie_set_q_ptrs(struct iwl_trans *trans, int txq_id, int ptr);
@@ -818,6 +846,8 @@ static inline void _iwl_disable_interrupts(struct iwl_trans *trans) · 29 unmodified lines
818846 trans_pcie->fh_init_mask);
819847 iwl_write32(trans, CSR_MSIX_HW_INT_MASK_AD,
820848 trans_pcie->hw_init_mask);
849+ trans_pcie->fh_mask = 0;
850+ trans_pcie->hw_mask = 0;
821851 }
822852 IWL_DEBUG_ISR(trans, "Disabled interrupts\n");
823853 }
@@ -1000,6 +1030,7 @@ static inline void iwl_enable_rfkill_int(struct iwl_trans *trans) · 176 unmodified lines
10001030 } else {
10011031 iwl_write32(trans, CSR_MSIX_FH_INT_MASK_AD,
10021032 trans_pcie->fh_init_mask);
1033+ trans_pcie->fh_mask = 0;
10031034 iwl_enable_hw_int_msk_msix(trans,
10041035 MSIX_HW_INT_CAUSES_REG_RF_KILL);
10051036 }
@@ -1047,7 +1078,7 @@ static inline void iwl_trans_pcie_dbgfs_register(struct iwl_trans *trans) { } · 41 unmodified lines
10471078 void iwl_pcie_rx_allocator_work(struct work_struct *data);
10481079
10491080 /* common trans ops for all generations transports */
1050−void iwl_trans_pcie_op_mode_enter(struct iwl_trans *trans);
1081+void iwl_pcie_gen1_2_op_mode_enter(struct iwl_trans *trans);
10511082 int _iwl_trans_pcie_start_hw(struct iwl_trans *trans);
10521083 int iwl_trans_pcie_start_hw(struct iwl_trans *trans);
10531084 void iwl_trans_pcie_op_mode_leave(struct iwl_trans *trans);
@@ -1064,9 +1095,8 @@ iwl_trans_pcie_dump_data(struct iwl_trans *trans, u32 dump_mask, · 10 unmodified lines
10641095 const struct iwl_dump_sanitize_ops *sanitize_ops,
10651096 void *sanitize_ctx);
10661097 int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
1067− enum iwl_d3_status *status,
1068− bool test, bool reset);
1069−int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool test, bool reset);
1098+ bool reset);
1099+int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool reset);
10701100 void iwl_trans_pci_interrupts(struct iwl_trans *trans, bool enable);
10711101 void iwl_trans_pcie_sync_nmi(struct iwl_trans *trans);
10721102 void iwl_trans_pcie_set_bits_mask(struct iwl_trans *trans, u32 reg,
@@ -1081,6 +1111,7 @@ int iwl_pci_gen1_2_probe(struct pci_dev *pdev, · 8 unmodified lines
10811111 const struct pci_device_id *ent,
10821112 const struct iwl_mac_cfg *mac_cfg,
10831113 u8 __iomem *hw_base, u32 hw_rev);
1114+void iwl_pcie_gen1_2_remove(struct iwl_trans *trans);
10841115
10851116 /* transport gen 1 exported functions */
10861117 void iwl_trans_pcie_fw_alive(struct iwl_trans *trans);
@@ -1105,6 +1136,7 @@ int iwl_pcie_alloc_dma_ptr(struct iwl_trans *trans, · 18 unmodified lines
11051136 struct iwl_dma_ptr *ptr, size_t size);
11061137 void iwl_pcie_free_dma_ptr(struct iwl_trans *trans, struct iwl_dma_ptr *ptr);
11071138 void iwl_pcie_apply_destination(struct iwl_trans *trans);
1139+int iwl_pcie_gen1_2_activate_nic(struct iwl_trans *trans);
11081140
11091141 /* transport gen 2 exported functions */
11101142 int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans,
@@ -1124,4 +1156,17 @@ int iwl_trans_pcie_copy_imr(struct iwl_trans *trans, · 13 unmodified lines
11241156 int iwl_trans_pcie_rxq_dma_data(struct iwl_trans *trans, int queue,
11251157 struct iwl_trans_rxq_dma_data *data);
11261158
1159+static inline bool iwl_pcie_gen1_is_pm_supported(struct iwl_trans *trans)
1160+{
1161+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
1162+
1163+ return trans_pcie->pm_support;
1164+}
1165+
1166+static inline bool iwl_pcie_gen1_2_is_ltr_enabled(struct iwl_trans *trans)
1167+{
1168+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
1169+
1170+ return trans_pcie->ltr_enabled;
1171+}
11271172 #endif /* __iwl_trans_int_pcie_h__ */
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans-gen2.c+1−1
@@ -47,7 +47,7 @@ int iwl_pcie_gen2_apm_init(struct iwl_trans *trans) · 46 unmodified lines
4747
4848 iwl_pcie_apm_config(trans);
4949
50− ret = iwl_finish_nic_init(trans);
50+ ret = iwl_trans_activate_nic(trans);
5151 if (ret)
5252 return ret;
5353
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c+161−76
@@ -25,13 +25,52 @@ · 24 unmodified lines
2525 #include "fw/dbg.h"
2626 #include "fw/api/tx.h"
2727 #include "fw/acpi.h"
28−#include "fw/api/tx.h"
2928 #include "mei/iwl-mei.h"
3029 #include "internal.h"
3130 #include "iwl-fh.h"
3231 #include "pcie/iwl-context-info-v2.h"
3332 #include "pcie/utils.h"
3433
34+#define IWL_HOST_MON_BLOCK_PEMON 0x00
35+#define IWL_HOST_MON_BLOCK_HIPM 0x22
36+
37+#define IWL_HOST_MON_BLOCK_PEMON_VEC0 0x00
38+#define IWL_HOST_MON_BLOCK_PEMON_VEC1 0x01
39+#define IWL_HOST_MON_BLOCK_PEMON_WFPM 0x06
40+
41+static void iwl_dump_host_monitor_block(struct iwl_trans *trans,
42+ u32 block, u32 vec, u32 iter)
43+{
44+ int i;
45+
46+ IWL_ERR(trans, "Host monitor block 0x%x vector 0x%x\n", block, vec);
47+ iwl_write32(trans, CSR_MONITOR_CFG_REG, (block << 8) | vec);
48+ for (i = 0; i < iter; i++)
49+ IWL_ERR(trans, " value [iter %d]: 0x%08x\n",
50+ i, iwl_read32(trans, CSR_MONITOR_STATUS_REG));
51+}
52+
53+static void iwl_pcie_dump_host_monitor(struct iwl_trans *trans)
54+{
55+ switch (trans->mac_cfg->device_family) {
56+ case IWL_DEVICE_FAMILY_22000:
57+ case IWL_DEVICE_FAMILY_AX210:
58+ IWL_ERR(trans, "CSR_RESET = 0x%x\n",
59+ iwl_read32(trans, CSR_RESET));
60+ iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON,
61+ IWL_HOST_MON_BLOCK_PEMON_VEC0, 15);
62+ iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON,
63+ IWL_HOST_MON_BLOCK_PEMON_VEC1, 15);
64+ iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_PEMON,
65+ IWL_HOST_MON_BLOCK_PEMON_WFPM, 15);
66+ iwl_dump_host_monitor_block(trans, IWL_HOST_MON_BLOCK_HIPM,
67+ IWL_HOST_MON_BLOCK_PEMON_VEC0, 1);
68+ break;
69+ default:
70+ return;
71+ }
72+}
73+
3574 /* extended range in FW SRAM */
3675 #define IWL_FW_MEM_EXTENDED_START 0x40000
3776 #define IWL_FW_MEM_EXTENDED_END 0x57FFF
@@ -175,13 +214,13 @@ void iwl_pcie_apm_config(struct iwl_trans *trans) · 137 unmodified lines
175214 iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_DISABLED);
176215
177216 pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl);
178− trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S);
217+ trans_pcie->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S);
179218
180219 pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_DEVCTL2, &cap);
181− trans->ltr_enabled = cap & PCI_EXP_DEVCTL2_LTR_EN;
220+ trans_pcie->ltr_enabled = cap & PCI_EXP_DEVCTL2_LTR_EN;
182221 IWL_DEBUG_POWER(trans, "L1 %sabled - LTR %sabled\n",
183222 (lctl & PCI_EXP_LNKCTL_ASPM_L1) ? "En" : "Dis",
184− trans->ltr_enabled ? "En" : "Dis");
223+ trans_pcie->ltr_enabled ? "En" : "Dis");
185224 }
186225
187226 /*
@@ -228,7 +267,7 @@ static int iwl_pcie_apm_init(struct iwl_trans *trans) · 40 unmodified lines
228267 if (trans->mac_cfg->base->pll_cfg)
229268 iwl_set_bit(trans, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
230269
231− ret = iwl_finish_nic_init(trans);
270+ ret = iwl_trans_activate_nic(trans);
232271 if (ret)
233272 return ret;
234273
@@ -301,7 +340,7 @@ static void iwl_pcie_apm_lp_xtal_enable(struct iwl_trans *trans) · 66 unmodified lines
301340 ret = iwl_trans_pcie_sw_reset(trans, true);
302341
303342 if (!ret)
304− ret = iwl_finish_nic_init(trans);
343+ ret = iwl_trans_activate_nic(trans);
305344
306345 if (WARN_ON(ret)) {
307346 /* Release XTAL ON request */
@@ -1397,17 +1436,10 @@ void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state, bool from_irq) · 1089 unmodified lines
13971436 }
13981437
13991438 static void iwl_pcie_d3_complete_suspend(struct iwl_trans *trans,
1400− bool test, bool reset)
1439+ bool reset)
14011440 {
14021441 iwl_disable_interrupts(trans);
14031442
1404− /*
1405− * in testing mode, the host stays awake and the
1406− * hardware won't be reset (not even partially)
1407− */
1408− if (test)
1409− return;
1410−
14111443 iwl_pcie_disable_ict(trans);
14121444
14131445 iwl_pcie_synchronize_irqs(trans);
@@ -1478,7 +1510,7 @@ static int iwl_pcie_d3_handshake(struct iwl_trans *trans, bool suspend) · 64 unmodified lines
14781510 return ret;
14791511 }
14801512
1481−int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool test, bool reset)
1513+int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool reset)
14821514 {
14831515 int ret;
14841516
@@ -1491,26 +1523,18 @@ int iwl_trans_pcie_d3_suspend(struct iwl_trans *trans, bool test, bool reset) · 6 unmodified lines
14911523 if (ret)
14921524 return ret;
14931525
1494− iwl_pcie_d3_complete_suspend(trans, test, reset);
1526+ iwl_pcie_d3_complete_suspend(trans, reset);
14951527
14961528 return 0;
14971529 }
14981530
14991531 int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
1500− enum iwl_d3_status *status,
1501− bool test, bool reset)
1532+ bool reset)
15021533 {
15031534 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
15041535 u32 val;
15051536 int ret;
15061537
1507− if (test) {
1508− iwl_enable_interrupts(trans);
1509− *status = IWL_D3_STATUS_ALIVE;
1510− ret = 0;
1511− goto out;
1512− }
1513−
15141538 if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
15151539 iwl_set_bit(trans, CSR_GP_CNTRL,
15161540 CSR_GP_CNTRL_REG_FLAG_BZ_MAC_ACCESS_REQ);
@@ -1518,9 +1542,12 @@ int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, · 1 unmodified line
15181542 iwl_set_bit(trans, CSR_GP_CNTRL,
15191543 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
15201544
1521− ret = iwl_finish_nic_init(trans);
1522− if (ret)
1545+ ret = iwl_trans_activate_nic(trans);
1546+ if (ret) {
1547+ IWL_ERR(trans, "Failed to init nic upon resume. err = %d\n",
1548+ ret);
15231549 return ret;
1550+ }
15241551
15251552 /*
15261553 * Reconfigure IVAR table in case of MSIX or reset ict table in
@@ -1554,18 +1581,13 @@ int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, · 27 unmodified lines
15541581 iwl_read_umac_prph(trans, WFPM_GP2));
15551582
15561583 val = iwl_read32(trans, CSR_RESET);
1557− if (val & CSR_RESET_REG_FLAG_NEVO_RESET)
1558− *status = IWL_D3_STATUS_RESET;
1559− else
1560− *status = IWL_D3_STATUS_ALIVE;
1561−
1562−out:
1563− if (*status == IWL_D3_STATUS_ALIVE)
1564− ret = iwl_pcie_d3_handshake(trans, false);
1565− else
1584+ if (val & CSR_RESET_REG_FLAG_NEVO_RESET) {
1585+ IWL_INFO(trans, "Device was reset during suspend\n");
15661586 trans->state = IWL_TRANS_NO_FW;
1587+ return -ENOENT;
1588+ }
15671589
1568− return ret;
1590+ return iwl_pcie_d3_handshake(trans, false);
15691591 }
15701592
15711593 static void
@@ -1744,7 +1766,7 @@ static int iwl_pcie_gen2_force_power_gating(struct iwl_trans *trans) · 172 unmodified lines
17441766 {
17451767 int ret;
17461768
1747− ret = iwl_finish_nic_init(trans);
1769+ ret = iwl_trans_activate_nic(trans);
17481770 if (ret < 0)
17491771 return ret;
17501772
@@ -1882,7 +1904,7 @@ void iwl_trans_pcie_write_prph(struct iwl_trans *trans, u32 addr, u32 val) · 131 unmodified lines
18821904 iwl_trans_pcie_write32(trans, HBUS_TARG_PRPH_WDAT, val);
18831905 }
18841906
1885−void iwl_trans_pcie_op_mode_enter(struct iwl_trans *trans)
1907+void iwl_pcie_gen1_2_op_mode_enter(struct iwl_trans *trans)
18861908 {
18871909 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
18881910
@@ -2000,6 +2022,7 @@ void iwl_trans_pcie_free(struct iwl_trans *trans) · 111 unmodified lines
20002022 free_percpu(trans_pcie->txqs.tso_hdr_page);
20012023 }
20022024
2025+ kmem_cache_destroy(trans_pcie->dev_cmd_pool);
20032026 iwl_trans_free(trans);
20042027 }
20052028
@@ -3516,7 +3539,7 @@ iwl_trans_pcie_dump_data(struct iwl_trans *trans, u32 dump_mask, · 1510 unmodified lines
35163539 struct iwl_trans_dump_data *dump_data;
35173540 u32 len, num_rbs = 0, monitor_len = 0;
35183541 int i, ptr;
3519− bool dump_rbs = test_bit(STATUS_FW_ERROR, &trans->status) &&
3542+ bool dump_rbs = iwl_trans_is_fw_error(trans) &&
35203543 !trans->mac_cfg->mq_rx_supported &&
35213544 dump_mask & BIT(IWL_FW_ERROR_DUMP_RB);
35223545
@@ -3684,28 +3707,40 @@ void iwl_trans_pcie_sync_nmi(struct iwl_trans *trans) · 161 unmodified lines
36843707 iwl_trans_sync_nmi_with_addr(trans, inta_addr, sw_err_bit);
36853708 }
36863709
3687−static int iwl_trans_pcie_set_txcmd_info(const struct iwl_mac_cfg *mac_cfg,
3688− unsigned int *txcmd_size,
3689− unsigned int *txcmd_align)
3710+static int iwl_trans_pcie_alloc_txcmd_pool(struct iwl_trans *trans)
36903711 {
3691− if (!mac_cfg->gen2) {
3692− *txcmd_size = sizeof(struct iwl_tx_cmd_v6);
3693− *txcmd_align = sizeof(void *);
3694− } else if (mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210) {
3695− *txcmd_size = sizeof(struct iwl_tx_cmd_v9);
3696− *txcmd_align = 64;
3712+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
3713+ unsigned int txcmd_size, txcmd_align;
3714+
3715+ if (!trans->mac_cfg->gen2) {
3716+ txcmd_size = sizeof(struct iwl_tx_cmd_v6);
3717+ txcmd_align = sizeof(void *);
3718+ } else if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_AX210) {
3719+ txcmd_size = sizeof(struct iwl_tx_cmd_v9);
3720+ txcmd_align = 64;
36973721 } else {
3698− *txcmd_size = sizeof(struct iwl_tx_cmd);
3699− *txcmd_align = 128;
3722+ txcmd_size = sizeof(struct iwl_tx_cmd);
3723+ txcmd_align = 128;
37003724 }
37013725
3702− *txcmd_size += sizeof(struct iwl_cmd_header);
3703− *txcmd_size += 36; /* biggest possible 802.11 header */
3726+ txcmd_size += sizeof(struct iwl_cmd_header);
3727+ txcmd_size += 36; /* biggest possible 802.11 header */
37043728
37053729 /* Ensure device TX cmd cannot reach/cross a page boundary in gen2 */
3706− if (WARN_ON((mac_cfg->gen2 && *txcmd_size >= *txcmd_align)))
3730+ if (WARN_ON((trans->mac_cfg->gen2 && txcmd_size >= txcmd_align)))
37073731 return -EINVAL;
37083732
3733+ snprintf(trans_pcie->dev_cmd_pool_name,
3734+ sizeof(trans_pcie->dev_cmd_pool_name),
3735+ "iwl_cmd_pool:%s", dev_name(trans->dev));
3736+
3737+ trans_pcie->dev_cmd_pool =
3738+ kmem_cache_create(trans_pcie->dev_cmd_pool_name,
3739+ txcmd_size, txcmd_align,
3740+ SLAB_HWCACHE_ALIGN, NULL);
3741+ if (!trans_pcie->dev_cmd_pool)
3742+ return -ENOMEM;
3743+
37093744 return 0;
37103745 }
37113746
@@ -3715,18 +3750,12 @@ iwl_trans_pcie_alloc(struct pci_dev *pdev, · 3 unmodified lines
37153750 struct iwl_trans_info *info, u8 __iomem *hw_base)
37163751 {
37173752 struct iwl_trans_pcie *trans_pcie, **priv;
3718− unsigned int txcmd_size, txcmd_align;
37193753 struct iwl_trans *trans;
37203754 unsigned int bc_tbl_n_entries;
37213755 int ret, addr_size;
37223756
3723− ret = iwl_trans_pcie_set_txcmd_info(mac_cfg, &txcmd_size,
3724− &txcmd_align);
3725− if (ret)
3726− return ERR_PTR(ret);
3727−
37283757 trans = iwl_trans_alloc(sizeof(struct iwl_trans_pcie), &pdev->dev,
3729− mac_cfg, txcmd_size, txcmd_align);
3758+ mac_cfg);
37303759 if (!trans)
37313760 return ERR_PTR(-ENOMEM);
37323761
@@ -3737,6 +3766,10 @@ iwl_trans_pcie_alloc(struct pci_dev *pdev, · 4 unmodified lines
37373766 /* Initialize the wait queue for commands */
37383767 init_waitqueue_head(&trans_pcie->wait_command_queue);
37393768
3769+ ret = iwl_trans_pcie_alloc_txcmd_pool(trans);
3770+ if (ret)
3771+ goto out_free_trans;
3772+
37403773 if (trans->mac_cfg->gen2) {
37413774 trans_pcie->txqs.tfd.addr_size = 64;
37423775 trans_pcie->txqs.tfd.max_tbs = IWL_TFH_NUM_TBS;
@@ -3756,7 +3789,7 @@ iwl_trans_pcie_alloc(struct pci_dev *pdev, · 13 unmodified lines
37563789 trans_pcie->txqs.tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page);
37573790 if (!trans_pcie->txqs.tso_hdr_page) {
37583791 ret = -ENOMEM;
3759− goto out_free_trans;
3792+ goto out_free_txcmd_pool;
37603793 }
37613794
37623795 if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
@@ -3906,6 +3939,8 @@ out_free_ndev: · 143 unmodified lines
39063939 free_netdev(trans_pcie->napi_dev);
39073940 out_free_tso:
39083941 free_percpu(trans_pcie->txqs.tso_hdr_page);
3942+out_free_txcmd_pool:
3943+ kmem_cache_destroy(trans_pcie->dev_cmd_pool);
39093944 out_free_trans:
39103945 iwl_trans_free(trans);
39113946 return ERR_PTR(ret);
@@ -3999,6 +4034,7 @@ static void get_crf_id(struct iwl_trans *iwl_trans, · 87 unmodified lines
39994034
40004035 /* Read cdb info (also contains the jacket info if needed in the future */
40014036 hw_wfpm_id = iwl_read_umac_prph_no_grab(iwl_trans, WFPM_OTP_CFG1_ADDR);
4037+
40024038 IWL_INFO(iwl_trans, "Detected crf-id 0x%x, cnv-id 0x%x wfpm id 0x%x\n",
40034039 info->hw_crf_id, info->hw_cnv_id, hw_wfpm_id);
40044040 }
@@ -4014,10 +4050,8 @@ static int map_crf_id(struct iwl_trans *iwl_trans, · 9 unmodified lines
40144050 u32 val = info->hw_crf_id;
40154051 u32 step_id = REG_CRF_ID_STEP(val);
40164052 u32 slave_id = REG_CRF_ID_SLAVE(val);
4017− u32 jacket_id_cnv = REG_CRF_ID_SLAVE(info->hw_cnv_id);
40184053 u32 hw_wfpm_id = iwl_read_umac_prph_no_grab(iwl_trans,
40194054 WFPM_OTP_CFG1_ADDR);
4020− u32 jacket_id_wfpm = WFPM_OTP_CFG1_IS_JACKET(hw_wfpm_id);
40214055 u32 cdb_id_wfpm = WFPM_OTP_CFG1_IS_CDB(hw_wfpm_id);
40224056
40234057 /* Map between crf id to rf id */
@@ -4066,21 +4100,12 @@ static int map_crf_id(struct iwl_trans *iwl_trans, · 42 unmodified lines
40664100 IWL_INFO(iwl_trans, "Adding cdb to rf id\n");
40674101 }
40684102
4069− /* Set Jacket capabilities */
4070− if (jacket_id_wfpm || jacket_id_cnv) {
4071− info->hw_rf_id += BIT(29);
4072− IWL_INFO(iwl_trans, "Adding jacket to rf id\n");
4073− }
4074−
40754103 IWL_INFO(iwl_trans,
40764104 "Detected rf-type 0x%x step-id 0x%x slave-id 0x%x from crf id 0x%x\n",
40774105 REG_CRF_ID_TYPE(val), step_id, slave_id, info->hw_rf_id);
40784106 IWL_INFO(iwl_trans,
4079− "Detected cdb-id 0x%x jacket-id 0x%x from wfpm id 0x%x\n",
4080− cdb_id_wfpm, jacket_id_wfpm, hw_wfpm_id);
4081− IWL_INFO(iwl_trans, "Detected jacket-id 0x%x from cnvi id 0x%x\n",
4082− jacket_id_cnv, info->hw_cnv_id);
4083−
4107+ "Detected cdb-id 0x%x from wfpm id 0x%x\n",
4108+ cdb_id_wfpm, hw_wfpm_id);
40844109 out:
40854110 return ret;
40864111 }
@@ -4163,7 +4188,7 @@ int iwl_pci_gen1_2_probe(struct pci_dev *pdev, · 76 unmodified lines
41634188 */
41644189 ret = iwl_pcie_prepare_card_hw(iwl_trans);
41654190 if (!ret) {
4166− ret = iwl_finish_nic_init(iwl_trans);
4191+ ret = iwl_trans_activate_nic(iwl_trans);
41674192 if (ret)
41684193 goto out_free_trans;
41694194 if (iwl_trans_grab_nic_access(iwl_trans)) {
@@ -4271,3 +4296,63 @@ out_free_trans: · 101 unmodified lines
42714296 iwl_trans_pcie_free(iwl_trans);
42724297 return ret;
42734298 }
4299+
4300+void iwl_pcie_gen1_2_remove(struct iwl_trans *trans)
4301+{
4302+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
4303+
4304+ cancel_delayed_work_sync(&trans_pcie->me_recheck_wk);
4305+
4306+ iwl_drv_stop(trans->drv);
4307+
4308+ iwl_trans_pcie_free(trans);
4309+}
4310+
4311+int iwl_pcie_gen1_2_activate_nic(struct iwl_trans *trans)
4312+{
4313+ const struct iwl_mac_cfg *mac_cfg = trans->mac_cfg;
4314+ u32 poll_ready;
4315+ int err;
4316+
4317+ if (mac_cfg->bisr_workaround) {
4318+ /* ensure the TOP FSM isn't still in previous reset */
4319+ mdelay(2);
4320+ }
4321+
4322+ /*
4323+ * Set "initialization complete" bit to move adapter from
4324+ * D0U* --> D0A* (powered-up active) state.
4325+ */
4326+ if (mac_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) {
4327+ iwl_set_bit(trans, CSR_GP_CNTRL,
4328+ CSR_GP_CNTRL_REG_FLAG_BZ_MAC_ACCESS_REQ |
4329+ CSR_GP_CNTRL_REG_FLAG_MAC_INIT);
4330+ poll_ready = CSR_GP_CNTRL_REG_FLAG_MAC_STATUS;
4331+ } else {
4332+ iwl_set_bit(trans, CSR_GP_CNTRL,
4333+ CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
4334+ poll_ready = CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY;
4335+ }
4336+
4337+ if (mac_cfg->device_family == IWL_DEVICE_FAMILY_8000)
4338+ udelay(2);
4339+
4340+ /*
4341+ * Wait for clock stabilization; once stabilized, access to
4342+ * device-internal resources is supported, e.g. iwl_write_prph()
4343+ * and accesses to uCode SRAM.
4344+ */
4345+ err = iwl_poll_bits(trans, CSR_GP_CNTRL, poll_ready, 25000);
4346+ if (err < 0) {
4347+ IWL_DEBUG_INFO(trans, "Failed to wake NIC\n");
4348+
4349+ iwl_pcie_dump_host_monitor(trans);
4350+ }
4351+
4352+ if (mac_cfg->bisr_workaround) {
4353+ /* ensure BISR shift has finished */
4354+ udelay(200);
4355+ }
4356+
4357+ return err;
4358+}
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/tx.c+3−2
@@ -2602,8 +2602,9 @@ static int iwl_trans_pcie_send_hcmd_sync(struct iwl_trans *trans, · 2601 unmodified lines
26022602 }
26032603
26042604 if (test_bit(STATUS_FW_ERROR, &trans->status)) {
2605− if (!test_and_clear_bit(STATUS_SUPPRESS_CMD_ERROR_ONCE,
2606− &trans->status)) {
2605+ if (trans->suppress_cmd_error_once) {
2606+ trans->suppress_cmd_error_once = false;
2607+ } else {
26072608 IWL_ERR(trans, "FW error in SYNC CMD %s\n", cmd_str);
26082609 dump_stack();
26092610 }
drivers/net/wireless/intel/iwlwifi/tests/Makefile+1−1
@@ -1,6 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22
3−iwlwifi-tests-y += module.o devinfo.o utils.o
3+iwlwifi-tests-y += module.o devinfo.o utils.o nvm_parse.o
44
55 ccflags-y += -I$(src)/../
66
drivers/net/wireless/intel/iwlwifi/tests/nvm_parse.c+72−0
@@ -0,0 +1,72 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * KUnit tests for NVM parse
4+ *
5+ * Copyright (C) 2025 Intel Corporation
6+ */
7+#include <kunit/static_stub.h>
8+#include <kunit/test.h>
9+#include <iwl-nvm-parse.h>
10+
11+MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
12+
13+static const struct nvm_flag_case {
14+ const char *desc;
15+ u16 nvm_flags;
16+ u32 reg_rule_flags;
17+ u32 set_reg_rule_flags;
18+ u32 clear_reg_rule_flags;
19+} nvm_flag_cases[] = {
20+ {
21+ .desc = "Restricting VLP client and AP access",
22+ .nvm_flags = 0,
23+ .set_reg_rule_flags = NL80211_RRF_NO_6GHZ_VLP_CLIENT,
24+ .clear_reg_rule_flags = NL80211_RRF_ALLOW_6GHZ_VLP_AP,
25+ },
26+ {
27+ .desc = "Allow VLP client and AP access",
28+ .nvm_flags = NVM_CHANNEL_VLP,
29+ .set_reg_rule_flags = NL80211_RRF_ALLOW_6GHZ_VLP_AP,
30+ .clear_reg_rule_flags = NL80211_RRF_NO_6GHZ_VLP_CLIENT,
31+ },
32+ {
33+ .desc = "Allow VLP client access, while restricting AP access",
34+ .nvm_flags = NVM_CHANNEL_VLP | NVM_CHANNEL_VLP_AP_NOT_ALLOWED,
35+ .set_reg_rule_flags = 0,
36+ .clear_reg_rule_flags = NL80211_RRF_ALLOW_6GHZ_VLP_AP |
37+ NL80211_RRF_NO_6GHZ_VLP_CLIENT,
38+ },
39+};
40+
41+KUNIT_ARRAY_PARAM_DESC(nvm_flag, nvm_flag_cases, desc)
42+
43+static void test_nvm_flags(struct kunit *test)
44+{
45+ const struct nvm_flag_case *params = test->param_value;
46+ struct iwl_reg_capa reg_capa = {};
47+ u32 flags = 0;
48+
49+ flags = iwl_nvm_get_regdom_bw_flags(NULL, 0, params->nvm_flags,
50+ reg_capa);
51+
52+ if ((params->set_reg_rule_flags & flags) != params->set_reg_rule_flags)
53+ KUNIT_FAIL(test, "Expected set bits:0x%08x flags:0x%08x\n",
54+ params->set_reg_rule_flags, flags);
55+
56+ if (params->clear_reg_rule_flags & flags)
57+ KUNIT_FAIL(test, "Expected clear bits:0x%08x flags:0x%08x\n",
58+ params->clear_reg_rule_flags, flags);
59+}
60+
61+static struct kunit_case nvm_flags_test_cases[] = {
62+ KUNIT_CASE_PARAM(test_nvm_flags,
63+ nvm_flag_gen_params),
64+ {},
65+};
66+
67+static struct kunit_suite nvm_flags_suite = {
68+ .name = "iwlwifi-nvm_flags",
69+ .test_cases = nvm_flags_test_cases,
70+};
71+
72+kunit_test_suite(nvm_flags_suite);
drivers/net/wireless/intersil/p54/txrx.c+1−1
@@ -317,7 +317,7 @@ static void p54_pspoll_workaround(struct p54_common *priv, struct sk_buff *skb) · 316 unmodified lines
317317 tim_len = tim[1];
318318 tim_ie = (struct ieee80211_tim_ie *) &tim[2];
319319
320− new_psm = ieee80211_check_tim(tim_ie, tim_len, priv->aid);
320+ new_psm = ieee80211_check_tim(tim_ie, tim_len, priv->aid, false);
321321 if (new_psm != priv->powersave_override) {
322322 priv->powersave_override = new_psm;
323323 p54_set_ps(priv);
drivers/net/wireless/marvell/mwifiex/cfg80211.c+3−4
@@ -686,10 +686,9 @@ static void mwifiex_reg_notifier(struct wiphy *wiphy, · 685 unmodified lines
686686 return;
687687 }
688688
689− /* Don't send world or same regdom info to firmware */
690− if (strncmp(request->alpha2, "00", 2) &&
691− strncmp(request->alpha2, adapter->country_code,
692− sizeof(request->alpha2))) {
689+ /* Don't send same regdom info to firmware */
690+ if (strncmp(request->alpha2, adapter->country_code,
691+ sizeof(request->alpha2)) != 0) {
693692 memcpy(adapter->country_code, request->alpha2,
694693 sizeof(request->alpha2));
695694 mwifiex_send_domain_info_cmd_fw(wiphy);
drivers/net/wireless/marvell/mwifiex/main.c+5−0
@@ -494,6 +494,11 @@ static void mwifiex_free_adapter(struct mwifiex_adapter *adapter) · 493 unmodified lines
494494 return;
495495 }
496496
497+ if (adapter->rgpower_data) {
498+ release_firmware(adapter->rgpower_data);
499+ adapter->rgpower_data = NULL;
500+ }
501+
497502 mwifiex_unregister(adapter);
498503 pr_debug("info: %s: free adapter\n", __func__);
499504 }
drivers/net/wireless/marvell/mwifiex/main.h+3−0
@@ -982,6 +982,7 @@ struct mwifiex_adapter { · 981 unmodified lines
982982 u8 country_code[IEEE80211_COUNTRY_STRING_LEN];
983983 u16 max_mgmt_ie_index;
984984 const struct firmware *cal_data;
985+ const struct firmware *rgpower_data;
985986 struct device_node *dt_node;
986987
987988 /* 11AC */
@@ -1579,6 +1580,8 @@ int mwifiex_11h_handle_event_chanswann(struct mwifiex_private *priv); · 591 unmodified lines
15791580 int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv,
15801581 struct device_node *node, const char *prefix);
15811582 void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv);
1583+int mwifiex_send_rgpower_table(struct mwifiex_private *priv, const u8 *data,
1584+ const size_t size);
15821585
15831586 extern const struct ethtool_ops mwifiex_ethtool_ops;
15841587
drivers/net/wireless/marvell/mwifiex/sta_cmd.c+113−0
@@ -1483,6 +1483,119 @@ int mwifiex_dnld_dt_cfgdata(struct mwifiex_private *priv, · 1482 unmodified lines
14831483 return 0;
14841484 }
14851485
1486+static int mwifiex_rgpower_table_advance_to_content(u8 **pos, const u8 *data,
1487+ const size_t size)
1488+{
1489+ while (*pos - data < size) {
1490+ /* skip spaces, tabs and empty lines */
1491+ if (**pos == '\r' || **pos == '\n' || **pos == '\0' ||
1492+ isspace(**pos)) {
1493+ (*pos)++;
1494+ continue;
1495+ }
1496+ /* skip line comments */
1497+ if (**pos == '#') {
1498+ *pos = strchr(*pos, '\n');
1499+ if (!*pos)
1500+ return -EINVAL;
1501+ (*pos)++;
1502+ continue;
1503+ }
1504+ return 0;
1505+ }
1506+ return 0;
1507+}
1508+
1509+int mwifiex_send_rgpower_table(struct mwifiex_private *priv, const u8 *data,
1510+ const size_t size)
1511+{
1512+ int ret = 0;
1513+ bool start_raw = false;
1514+ u8 *ptr, *token, *pos = NULL;
1515+ u8 *_data __free(kfree) = NULL;
1516+ struct mwifiex_adapter *adapter = priv->adapter;
1517+ struct mwifiex_ds_misc_cmd *hostcmd __free(kfree) = NULL;
1518+
1519+ hostcmd = kzalloc(sizeof(*hostcmd), GFP_KERNEL);
1520+ if (!hostcmd)
1521+ return -ENOMEM;
1522+
1523+ _data = kmemdup(data, size, GFP_KERNEL);
1524+ if (!_data)
1525+ return -ENOMEM;
1526+
1527+ pos = _data;
1528+ ptr = hostcmd->cmd;
1529+ while ((pos - _data) < size) {
1530+ ret = mwifiex_rgpower_table_advance_to_content(&pos, _data, size);
1531+ if (ret) {
1532+ mwifiex_dbg(
1533+ adapter, ERROR,
1534+ "%s: failed to advance to content in rgpower table\n",
1535+ __func__);
1536+ return ret;
1537+ }
1538+
1539+ if (*pos == '}' && start_raw) {
1540+ hostcmd->len = get_unaligned_le16(&hostcmd->cmd[2]);
1541+ ret = mwifiex_send_cmd(priv, 0, 0, 0, hostcmd, false);
1542+ if (ret) {
1543+ mwifiex_dbg(adapter, ERROR,
1544+ "%s: failed to send hostcmd %d\n",
1545+ __func__, ret);
1546+ return ret;
1547+ }
1548+
1549+ memset(hostcmd->cmd, 0, MWIFIEX_SIZE_OF_CMD_BUFFER);
1550+ ptr = hostcmd->cmd;
1551+ start_raw = false;
1552+ pos++;
1553+ continue;
1554+ }
1555+
1556+ if (!start_raw) {
1557+ pos = strchr(pos, '=');
1558+ if (pos) {
1559+ pos = strchr(pos, '{');
1560+ if (pos) {
1561+ start_raw = true;
1562+ pos++;
1563+ continue;
1564+ }
1565+ }
1566+ mwifiex_dbg(adapter, ERROR,
1567+ "%s: syntax error in hostcmd\n", __func__);
1568+ return -EINVAL;
1569+ }
1570+
1571+ if (start_raw) {
1572+ while ((*pos != '\r' && *pos != '\n') &&
1573+ (token = strsep((char **)&pos, " "))) {
1574+ if (ptr - hostcmd->cmd >=
1575+ MWIFIEX_SIZE_OF_CMD_BUFFER) {
1576+ mwifiex_dbg(
1577+ adapter, ERROR,
1578+ "%s: hostcmd is larger than %d, aborting\n",
1579+ __func__, MWIFIEX_SIZE_OF_CMD_BUFFER);
1580+ return -ENOMEM;
1581+ }
1582+
1583+ ret = kstrtou8(token, 16, ptr);
1584+ if (ret < 0) {
1585+ mwifiex_dbg(
1586+ adapter, ERROR,
1587+ "%s: failed to parse hostcmd %d token: %s\n",
1588+ __func__, ret, token);
1589+ return ret;
1590+ }
1591+ ptr++;
1592+ }
1593+ }
1594+ }
1595+
1596+ return ret;
1597+}
1598+
14861599 /* This function prepares command of set_cfg_data. */
14871600 static int mwifiex_cmd_cfg_data(struct mwifiex_private *priv,
14881601 struct host_cmd_ds_command *cmd, void *data_buf)
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c+57−1
@@ -180,7 +180,7 @@ int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, · 179 unmodified lines
180180 return mwifiex_update_bss_desc_with_ie(priv->adapter, bss_desc);
181181 }
182182
183−void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv)
183+static void mwifiex_dnld_dt_txpwr_table(struct mwifiex_private *priv)
184184 {
185185 if (priv->adapter->dt_node) {
186186 char txpwr[] = {"marvell,00_txpwrlimit"};
@@ -190,6 +190,62 @@ void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv) · 3 unmodified lines
190190 }
191191 }
192192
193+static int mwifiex_request_rgpower_table(struct mwifiex_private *priv)
194+{
195+ struct mwifiex_802_11d_domain_reg *domain_info = &priv->adapter->domain_reg;
196+ struct mwifiex_adapter *adapter = priv->adapter;
197+ char rgpower_table_name[30];
198+ char country_code[3];
199+
200+ strscpy(country_code, domain_info->country_code, sizeof(country_code));
201+
202+ /* World regulatory domain "00" has WW as country code */
203+ if (strncmp(country_code, "00", 2) == 0)
204+ strscpy(country_code, "WW", sizeof(country_code));
205+
206+ snprintf(rgpower_table_name, sizeof(rgpower_table_name),
207+ "nxp/rgpower_%s.bin", country_code);
208+
209+ mwifiex_dbg(adapter, INFO, "info: %s: requesting regulatory power table %s\n",
210+ __func__, rgpower_table_name);
211+
212+ if (adapter->rgpower_data) {
213+ release_firmware(adapter->rgpower_data);
214+ adapter->rgpower_data = NULL;
215+ }
216+
217+ if ((request_firmware(&adapter->rgpower_data, rgpower_table_name,
218+ adapter->dev))) {
219+ mwifiex_dbg(
220+ adapter, INFO,
221+ "info: %s: failed to request regulatory power table\n",
222+ __func__);
223+ return -EIO;
224+ }
225+
226+ return 0;
227+}
228+
229+static int mwifiex_dnld_rgpower_table(struct mwifiex_private *priv)
230+{
231+ int ret;
232+
233+ ret = mwifiex_request_rgpower_table(priv);
234+ if (ret)
235+ return ret;
236+
237+ return mwifiex_send_rgpower_table(priv, priv->adapter->rgpower_data->data,
238+ priv->adapter->rgpower_data->size);
239+}
240+
241+void mwifiex_dnld_txpwr_table(struct mwifiex_private *priv)
242+{
243+ if (mwifiex_dnld_rgpower_table(priv) == 0)
244+ return;
245+
246+ mwifiex_dnld_dt_txpwr_table(priv);
247+}
248+
193249 static int mwifiex_process_country_ie(struct mwifiex_private *priv,
194250 struct cfg80211_bss *bss)
195251 {
drivers/net/wireless/microchip/wilc1000/cfg80211.c+0−7
@@ -794,12 +794,6 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev, · 793 unmodified lines
794794 return 0;
795795 }
796796
797−static int change_bss(struct wiphy *wiphy, struct net_device *dev,
798− struct bss_parameters *params)
799−{
800− return 0;
801−}
802−
803797 static int set_wiphy_params(struct wiphy *wiphy, int radio_idx, u32 changed)
804798 {
805799 int ret = -EINVAL;
@@ -1709,7 +1703,6 @@ static const struct cfg80211_ops wilc_cfg80211_ops = { · 903 unmodified lines
17091703 .change_station = change_station,
17101704 .get_station = get_station,
17111705 .dump_station = dump_station,
1712− .change_bss = change_bss,
17131706 .set_wiphy_params = set_wiphy_params,
17141707
17151708 .external_auth = external_auth,
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c+1−1
@@ -679,7 +679,7 @@ static void rt2x00lib_rxdone_check_ps(struct rt2x00_dev *rt2x00dev, · 678 unmodified lines
679679 /* Check whenever the PHY can be turned off again. */
680680
681681 /* 1. What about buffered unicast traffic for our AID? */
682− cam = ieee80211_check_tim(tim_ie, tim_len, rt2x00dev->aid);
682+ cam = ieee80211_check_tim(tim_ie, tim_len, rt2x00dev->aid, false);
683683
684684 /* 2. Maybe the AP wants to send multicast/broadcast data? */
685685 cam |= (tim_ie->bitmap_ctrl & 0x01);
drivers/net/wireless/realtek/rtlwifi/ps.c+1−1
@@ -519,7 +519,7 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len) · 518 unmodified lines
519519
520520 /* 1. What about buffered unicast traffic for our AID? */
521521 u_buffed = ieee80211_check_tim(tim_ie, tim_len,
522− rtlpriv->mac80211.assoc_id);
522+ rtlpriv->mac80211.assoc_id, false);
523523
524524 /* 2. Maybe the AP wants to send multicast/broadcast data? */
525525 m_buffed = tim_ie->bitmap_ctrl & 0x01;
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c+0−8
@@ -2441,13 +2441,6 @@ exit: · 2440 unmodified lines
24412441 return ret;
24422442 }
24432443
2444−static int cfg80211_rtw_change_bss(struct wiphy *wiphy,
2445− struct net_device *ndev,
2446− struct bss_parameters *params)
2447−{
2448− return 0;
2449−}
2450−
24512444 void rtw_cfg80211_rx_action(struct adapter *adapter, u8 *frame, uint frame_len, const char *msg)
24522445 {
24532446 s32 freq;
@@ -2704,7 +2697,6 @@ static struct cfg80211_ops rtw_cfg80211_ops = { · 250 unmodified lines
27042697 .del_station = cfg80211_rtw_del_station,
27052698 .change_station = cfg80211_rtw_change_station,
27062699 .dump_station = cfg80211_rtw_dump_station,
2707− .change_bss = cfg80211_rtw_change_bss,
27082700
27092701 .mgmt_tx = cfg80211_rtw_mgmt_tx,
27102702 };
include/linux/ieee80211.h+256−9
@@ -220,6 +220,12 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2) · 219 unmodified lines
220220 #define IEEE80211_MAX_AID_S1G 8191
221221 #define IEEE80211_MAX_TIM_LEN 251
222222 #define IEEE80211_MAX_MESH_PEERINGS 63
223+
224+/* S1G encoding types */
225+#define IEEE80211_S1G_TIM_ENC_MODE_BLOCK 0
226+#define IEEE80211_S1G_TIM_ENC_MODE_SINGLE 1
227+#define IEEE80211_S1G_TIM_ENC_MODE_OLB 2
228+
223229 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
224230 6.2.1.1.2.
225231
@@ -4757,15 +4763,8 @@ static inline unsigned long ieee80211_tu_to_usec(unsigned long tu) · 4531 unmodified lines
47574763 return 1024 * tu;
47584764 }
47594765
4760−/**
4761− * ieee80211_check_tim - check if AID bit is set in TIM
4762− * @tim: the TIM IE
4763− * @tim_len: length of the TIM IE
4764− * @aid: the AID to look for
4765− * Return: whether or not traffic is indicated in the TIM for the given AID
4766− */
4767−static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
4768− u8 tim_len, u16 aid)
4766+static inline bool __ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
4767+ u8 tim_len, u16 aid)
47694768 {
47704769 u8 mask;
47714770 u8 index, indexn1, indexn2;
@@ -4788,6 +4787,254 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim, · 16 unmodified lines
47884787 return !!(tim->virtual_map[index] & mask);
47894788 }
47904789
4790+struct s1g_tim_aid {
4791+ u16 aid;
4792+ u8 target_blk; /* Target block index */
4793+ u8 target_subblk; /* Target subblock index */
4794+ u8 target_subblk_bit; /* Target subblock bit */
4795+};
4796+
4797+struct s1g_tim_enc_block {
4798+ u8 enc_mode;
4799+ bool inverse;
4800+ const u8 *ptr;
4801+ u8 len;
4802+
4803+ /*
4804+ * For an OLB encoded block that spans multiple blocks, this
4805+ * is the offset into the span described by that encoded block.
4806+ */
4807+ u8 olb_blk_offset;
4808+};
4809+
4810+/*
4811+ * Helper routines to quickly extract the length of an encoded block. Validation
4812+ * is also performed to ensure the length extracted lies within the TIM.
4813+ */
4814+
4815+static inline int ieee80211_s1g_len_bitmap(const u8 *ptr, const u8 *end)
4816+{
4817+ u8 blkmap;
4818+ u8 n_subblks;
4819+
4820+ if (ptr >= end)
4821+ return -EINVAL;
4822+
4823+ blkmap = *ptr;
4824+ n_subblks = hweight8(blkmap);
4825+
4826+ if (ptr + 1 + n_subblks > end)
4827+ return -EINVAL;
4828+
4829+ return 1 + n_subblks;
4830+}
4831+
4832+static inline int ieee80211_s1g_len_single(const u8 *ptr, const u8 *end)
4833+{
4834+ return (ptr + 1 > end) ? -EINVAL : 1;
4835+}
4836+
4837+static inline int ieee80211_s1g_len_olb(const u8 *ptr, const u8 *end)
4838+{
4839+ if (ptr >= end)
4840+ return -EINVAL;
4841+
4842+ return (ptr + 1 + *ptr > end) ? -EINVAL : 1 + *ptr;
4843+}
4844+
4845+/*
4846+ * Enumerate all encoded blocks until we find the encoded block that describes
4847+ * our target AID. OLB is a special case as a single encoded block can describe
4848+ * multiple blocks as a single encoded block.
4849+ */
4850+static inline int ieee80211_s1g_find_target_block(struct s1g_tim_enc_block *enc,
4851+ const struct s1g_tim_aid *aid,
4852+ const u8 *ptr, const u8 *end)
4853+{
4854+ /* need at least block-control octet */
4855+ while (ptr + 1 <= end) {
4856+ u8 ctrl = *ptr++;
4857+ u8 mode = ctrl & 0x03;
4858+ bool contains, inverse = ctrl & BIT(2);
4859+ u8 span, blk_off = ctrl >> 3;
4860+ int len;
4861+
4862+ switch (mode) {
4863+ case IEEE80211_S1G_TIM_ENC_MODE_BLOCK:
4864+ len = ieee80211_s1g_len_bitmap(ptr, end);
4865+ contains = blk_off == aid->target_blk;
4866+ break;
4867+ case IEEE80211_S1G_TIM_ENC_MODE_SINGLE:
4868+ len = ieee80211_s1g_len_single(ptr, end);
4869+ contains = blk_off == aid->target_blk;
4870+ break;
4871+ case IEEE80211_S1G_TIM_ENC_MODE_OLB:
4872+ len = ieee80211_s1g_len_olb(ptr, end);
4873+ /*
4874+ * An OLB encoded block can describe more then one
4875+ * block, meaning an encoded OLB block can span more
4876+ * then a single block.
4877+ */
4878+ if (len > 0) {
4879+ /* Minus one for the length octet */
4880+ span = DIV_ROUND_UP(len - 1, 8);
4881+ /*
4882+ * Check if our target block lies within the
4883+ * block span described by this encoded block.
4884+ */
4885+ contains = (aid->target_blk >= blk_off) &&
4886+ (aid->target_blk < blk_off + span);
4887+ }
4888+ break;
4889+ default:
4890+ return -EOPNOTSUPP;
4891+ }
4892+
4893+ if (len < 0)
4894+ return len;
4895+
4896+ if (contains) {
4897+ enc->enc_mode = mode;
4898+ enc->inverse = inverse;
4899+ enc->ptr = ptr;
4900+ enc->len = (u8)len;
4901+ enc->olb_blk_offset = blk_off;
4902+ return 0;
4903+ }
4904+
4905+ ptr += len;
4906+ }
4907+
4908+ return -ENOENT;
4909+}
4910+
4911+static inline bool ieee80211_s1g_parse_bitmap(struct s1g_tim_enc_block *enc,
4912+ struct s1g_tim_aid *aid)
4913+{
4914+ const u8 *ptr = enc->ptr;
4915+ u8 blkmap = *ptr++;
4916+
4917+ /*
4918+ * If our block bitmap does not contain a set bit that corresponds
4919+ * to our AID, it could mean a variety of things depending on if
4920+ * the encoding mode is inverted or not.
4921+ *
4922+ * 1. If inverted, it means the entire subblock is present and hence
4923+ * our AID has been set.
4924+ * 2. If not inverted, it means our subblock is not present and hence
4925+ * it is all zero meaning our AID is not set.
4926+ */
4927+ if (!(blkmap & BIT(aid->target_subblk)))
4928+ return enc->inverse;
4929+
4930+ /*
4931+ * Increment ptr by the number of set subblocks that appear before our
4932+ * target subblock. If our target subblock is 0, do nothing as ptr
4933+ * already points to our target subblock.
4934+ */
4935+ if (aid->target_subblk)
4936+ ptr += hweight8(blkmap & GENMASK(aid->target_subblk - 1, 0));
4937+
4938+ return !!(*ptr & BIT(aid->target_subblk_bit)) ^ enc->inverse;
4939+}
4940+
4941+static inline bool ieee80211_s1g_parse_single(struct s1g_tim_enc_block *enc,
4942+ struct s1g_tim_aid *aid)
4943+{
4944+ /*
4945+ * Single AID mode describes, as the name suggests, a single AID
4946+ * within the block described by the encoded block. The octet
4947+ * contains the 6 LSBs of the AID described in the block. The other
4948+ * 2 bits are reserved. When inversed, every single AID described
4949+ * by the current block have buffered traffic except for the AID
4950+ * described in the single AID octet.
4951+ */
4952+ return ((*enc->ptr & 0x3f) == (aid->aid & 0x3f)) ^ enc->inverse;
4953+}
4954+
4955+static inline bool ieee80211_s1g_parse_olb(struct s1g_tim_enc_block *enc,
4956+ struct s1g_tim_aid *aid)
4957+{
4958+ const u8 *ptr = enc->ptr;
4959+ u8 blk_len = *ptr++;
4960+ /*
4961+ * Given an OLB encoded block that describes multiple blocks,
4962+ * calculate the offset into the span. Then calculate the
4963+ * subblock location normally.
4964+ */
4965+ u16 span_offset = aid->target_blk - enc->olb_blk_offset;
4966+ u16 subblk_idx = span_offset * 8 + aid->target_subblk;
4967+
4968+ if (subblk_idx >= blk_len)
4969+ return enc->inverse;
4970+
4971+ return !!(ptr[subblk_idx] & BIT(aid->target_subblk_bit)) ^ enc->inverse;
4972+}
4973+
4974+/*
4975+ * An S1G PVB has 3 non optional encoding types, each that can be inverted.
4976+ * An S1G PVB is constructed with zero or more encoded block subfields. Each
4977+ * encoded block represents a single "block" of AIDs (64), and each encoded
4978+ * block can contain one of the 3 encoding types alongside a single bit for
4979+ * whether the bits should be inverted.
4980+ *
4981+ * As the standard makes no guarantee about the ordering of encoded blocks,
4982+ * we must parse every encoded block in the worst case scenario given an
4983+ * AID that lies within the last block.
4984+ */
4985+static inline bool ieee80211_s1g_check_tim(const struct ieee80211_tim_ie *tim,
4986+ u8 tim_len, u16 aid)
4987+{
4988+ int err;
4989+ struct s1g_tim_aid target_aid;
4990+ struct s1g_tim_enc_block enc_blk;
4991+
4992+ if (tim_len < 3)
4993+ return false;
4994+
4995+ target_aid.aid = aid;
4996+ target_aid.target_blk = (aid >> 6) & 0x1f;
4997+ target_aid.target_subblk = (aid >> 3) & 0x7;
4998+ target_aid.target_subblk_bit = aid & 0x7;
4999+
5000+ /*
5001+ * Find our AIDs target encoded block and fill &enc_blk with the
5002+ * encoded blocks information. If no entry is found or an error
5003+ * occurs return false.
5004+ */
5005+ err = ieee80211_s1g_find_target_block(&enc_blk, &target_aid,
5006+ tim->virtual_map,
5007+ (const u8 *)tim + tim_len + 2);
5008+ if (err)
5009+ return false;
5010+
5011+ switch (enc_blk.enc_mode) {
5012+ case IEEE80211_S1G_TIM_ENC_MODE_BLOCK:
5013+ return ieee80211_s1g_parse_bitmap(&enc_blk, &target_aid);
5014+ case IEEE80211_S1G_TIM_ENC_MODE_SINGLE:
5015+ return ieee80211_s1g_parse_single(&enc_blk, &target_aid);
5016+ case IEEE80211_S1G_TIM_ENC_MODE_OLB:
5017+ return ieee80211_s1g_parse_olb(&enc_blk, &target_aid);
5018+ default:
5019+ return false;
5020+ }
5021+}
5022+
5023+/**
5024+ * ieee80211_check_tim - check if AID bit is set in TIM
5025+ * @tim: the TIM IE
5026+ * @tim_len: length of the TIM IE
5027+ * @aid: the AID to look for
5028+ * @s1g: whether the TIM is from an S1G PPDU
5029+ * Return: whether or not traffic is indicated in the TIM for the given AID
5030+ */
5031+static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
5032+ u8 tim_len, u16 aid, bool s1g)
5033+{
5034+ return s1g ? ieee80211_s1g_check_tim(tim, tim_len, aid) :
5035+ __ieee80211_check_tim(tim, tim_len, aid);
5036+}
5037+
47915038 /**
47925039 * ieee80211_get_tdls_action - get TDLS action code
47935040 * @skb: the skb containing the frame, length will not be checked
include/linux/mmc/sdio_ids.h+1−1
@@ -77,7 +77,7 @@ · 76 unmodified lines
7777 #define SDIO_DEVICE_ID_BROADCOM_43439 0xa9af
7878 #define SDIO_DEVICE_ID_BROADCOM_43455 0xa9bf
7979 #define SDIO_DEVICE_ID_BROADCOM_43751 0xaae7
80−#define SDIO_DEVICE_ID_BROADCOM_CYPRESS_43752 0xaae8
80+#define SDIO_DEVICE_ID_BROADCOM_43752 0xaae8
8181
8282 #define SDIO_VENDOR_ID_CYPRESS 0x04b4
8383 #define SDIO_DEVICE_ID_BROADCOM_CYPRESS_43439 0xbd3d
include/net/cfg80211.h+33−1
@@ -841,9 +841,12 @@ struct cfg80211_bitrate_mask { · 840 unmodified lines
841841 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
842842 u16 vht_mcs[NL80211_VHT_NSS_MAX];
843843 u16 he_mcs[NL80211_HE_NSS_MAX];
844+ u16 eht_mcs[NL80211_EHT_NSS_MAX];
844845 enum nl80211_txrate_gi gi;
845846 enum nl80211_he_gi he_gi;
847+ enum nl80211_eht_gi eht_gi;
846848 enum nl80211_he_ltf he_ltf;
849+ enum nl80211_eht_ltf eht_ltf;
847850 } control[NUM_NL80211_BANDS];
848851 };
849852
@@ -2456,6 +2459,29 @@ struct mpath_info { · 1606 unmodified lines
24562459 int generation;
24572460 };
24582461
2462+/**
2463+ * enum wiphy_bss_param_flags - bit positions for supported bss parameters.
2464+ *
2465+ * @WIPHY_BSS_PARAM_CTS_PROT: support changing CTS protection.
2466+ * @WIPHY_BSS_PARAM_SHORT_PREAMBLE: support changing short preamble usage.
2467+ * @WIPHY_BSS_PARAM_SHORT_SLOT_TIME: support changing short slot time usage.
2468+ * @WIPHY_BSS_PARAM_BASIC_RATES: support reconfiguring basic rates.
2469+ * @WIPHY_BSS_PARAM_AP_ISOLATE: support changing AP isolation.
2470+ * @WIPHY_BSS_PARAM_HT_OPMODE: support changing HT operating mode.
2471+ * @WIPHY_BSS_PARAM_P2P_CTWINDOW: support reconfiguring ctwindow.
2472+ * @WIPHY_BSS_PARAM_P2P_OPPPS: support changing P2P opportunistic power-save.
2473+ */
2474+enum wiphy_bss_param_flags {
2475+ WIPHY_BSS_PARAM_CTS_PROT = BIT(0),
2476+ WIPHY_BSS_PARAM_SHORT_PREAMBLE = BIT(1),
2477+ WIPHY_BSS_PARAM_SHORT_SLOT_TIME = BIT(2),
2478+ WIPHY_BSS_PARAM_BASIC_RATES = BIT(3),
2479+ WIPHY_BSS_PARAM_AP_ISOLATE = BIT(4),
2480+ WIPHY_BSS_PARAM_HT_OPMODE = BIT(5),
2481+ WIPHY_BSS_PARAM_P2P_CTWINDOW = BIT(6),
2482+ WIPHY_BSS_PARAM_P2P_OPPPS = BIT(7),
2483+};
2484+
24592485 /**
24602486 * struct bss_parameters - BSS parameters
24612487 *
@@ -5782,6 +5808,11 @@ struct wiphy_radio { · 3320 unmodified lines
57825808 * and probe responses. This value should be set if the driver
57835809 * wishes to limit the number of csa counters. Default (0) means
57845810 * infinite.
5811+ * @bss_param_support: bitmask indicating which bss_parameters as defined in
5812+ * &struct bss_parameters the driver can actually handle in the
5813+ * .change_bss() callback. The bit positions are defined in &enum
5814+ * wiphy_bss_param_flags.
5815+ *
57855816 * @bss_select_support: bitmask indicating the BSS selection criteria supported
57865817 * by the driver in the .connect() callback. The bit position maps to the
57875818 * attribute indices defined in &enum nl80211_bss_select_attr.
@@ -5967,6 +5998,7 @@ struct wiphy { · 179 unmodified lines
59675998
59685999 u8 max_num_csa_counters;
59696000
6001+ u32 bss_param_support;
59706002 u32 bss_select_support;
59716003
59726004 u8 nan_supported_bands;
@@ -9548,7 +9580,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 3575 unmodified lines
95489580 * @wiphy: the wiphy
95499581 * @chan: channel for which the supported radio index is required
95509582 *
9551− * Return: radio index on success or a negative error code
9583+ * Return: radio index on success or -EINVAL otherwise
95529584 */
95539585 int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy,
95549586 const struct ieee80211_channel *chan);
include/uapi/linux/nl80211.h+48−3
@@ -1943,8 +1943,9 @@ enum nl80211_commands { · 1942 unmodified lines
19431943 * The driver must also specify support for this with the extended
19441944 * features NL80211_EXT_FEATURE_BEACON_RATE_LEGACY,
19451945 * NL80211_EXT_FEATURE_BEACON_RATE_HT,
1946− * NL80211_EXT_FEATURE_BEACON_RATE_VHT and
1947− * NL80211_EXT_FEATURE_BEACON_RATE_HE.
1946+ * NL80211_EXT_FEATURE_BEACON_RATE_VHT,
1947+ * NL80211_EXT_FEATURE_BEACON_RATE_HE and
1948+ * NL80211_EXT_FEATURE_BEACON_RATE_EHT.
19481949 *
19491950 * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain
19501951 * at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME.
@@ -2283,7 +2284,8 @@ enum nl80211_commands { · 332 unmodified lines
22832284 * @NL80211_ATTR_PEER_AID: Association ID for the peer TDLS station (u16).
22842285 * This is similar to @NL80211_ATTR_STA_AID but with a difference of being
22852286 * allowed to be used with the first @NL80211_CMD_SET_STATION command to
2286− * update a TDLS peer STA entry.
2287+ * update a TDLS peer STA entry. For S1G interfaces, this is limited to
2288+ * 1600 for the current mac80211 implementation.
22872289 *
22882290 * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information.
22892291 *
@@ -2928,6 +2930,12 @@ enum nl80211_commands { · 638 unmodified lines
29282930 * required alongside this attribute. Refer to
29292931 * @enum nl80211_s1g_short_beacon_attrs for the attribute definitions.
29302932 *
2933+ * @NL80211_ATTR_BSS_PARAM: nested attribute used with %NL80211_CMD_GET_WIPHY
2934+ * which indicates which BSS parameters can be modified. The attribute can
2935+ * also be used as flag attribute by user-space in %NL80211_CMD_SET_BSS to
2936+ * indicate that it wants strict checking on the BSS parameters to be
2937+ * modified.
2938+ *
29312939 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
29322940 * @NL80211_ATTR_MAX: highest attribute number currently defined
29332941 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3489,6 +3497,7 @@ enum nl80211_attrs { · 555 unmodified lines
34893497
34903498 NL80211_ATTR_S1G_LONG_BEACON_PERIOD,
34913499 NL80211_ATTR_S1G_SHORT_BEACON,
3500+ NL80211_ATTR_BSS_PARAM,
34923501
34933502 /* add attributes here, update the policy in nl80211.c */
34943503
@@ -3735,6 +3744,22 @@ enum nl80211_eht_gi { · 240 unmodified lines
37353744 NL80211_RATE_INFO_EHT_GI_3_2,
37363745 };
37373746
3747+/**
3748+ * enum nl80211_eht_ltf - EHT long training field
3749+ * @NL80211_RATE_INFO_EHT_1XLTF: 3.2 usec
3750+ * @NL80211_RATE_INFO_EHT_2XLTF: 6.4 usec
3751+ * @NL80211_RATE_INFO_EHT_4XLTF: 12.8 usec
3752+ * @NL80211_RATE_INFO_EHT_6XLTF: 19.2 usec
3753+ * @NL80211_RATE_INFO_EHT_8XLTF: 25.6 usec
3754+ */
3755+enum nl80211_eht_ltf {
3756+ NL80211_RATE_INFO_EHT_1XLTF,
3757+ NL80211_RATE_INFO_EHT_2XLTF,
3758+ NL80211_RATE_INFO_EHT_4XLTF,
3759+ NL80211_RATE_INFO_EHT_6XLTF,
3760+ NL80211_RATE_INFO_EHT_8XLTF,
3761+};
3762+
37383763 /**
37393764 * enum nl80211_eht_ru_alloc - EHT RU allocation values
37403765 * @NL80211_RATE_INFO_EHT_RU_ALLOC_26: 26-tone RU allocation
@@ -5481,6 +5506,10 @@ enum nl80211_key_attributes { · 1740 unmodified lines
54815506 * see &struct nl80211_txrate_he
54825507 * @NL80211_TXRATE_HE_GI: configure HE GI, 0.8us, 1.6us and 3.2us.
54835508 * @NL80211_TXRATE_HE_LTF: configure HE LTF, 1XLTF, 2XLTF and 4XLTF.
5509+ * @NL80211_TXRATE_EHT: EHT rates allowed for TX rate selection,
5510+ * see &struct nl80211_txrate_eht
5511+ * @NL80211_TXRATE_EHT_GI: configure EHT GI, (u8, see &enum nl80211_eht_gi)
5512+ * @NL80211_TXRATE_EHT_LTF: configure EHT LTF, (u8, see &enum nl80211_eht_ltf)
54845513 * @__NL80211_TXRATE_AFTER_LAST: internal
54855514 * @NL80211_TXRATE_MAX: highest TX rate attribute
54865515 */
@@ -5493,6 +5522,9 @@ enum nl80211_tx_rate_attributes { · 6 unmodified lines
54935522 NL80211_TXRATE_HE,
54945523 NL80211_TXRATE_HE_GI,
54955524 NL80211_TXRATE_HE_LTF,
5525+ NL80211_TXRATE_EHT,
5526+ NL80211_TXRATE_EHT_GI,
5527+ NL80211_TXRATE_EHT_LTF,
54965528
54975529 /* keep last */
54985530 __NL80211_TXRATE_AFTER_LAST,
@@ -5525,6 +5557,15 @@ enum nl80211_txrate_gi { · 26 unmodified lines
55255557 NL80211_TXRATE_FORCE_LGI,
55265558 };
55275559
5560+#define NL80211_EHT_NSS_MAX 16
5561+/**
5562+ * struct nl80211_txrate_eht - EHT MCS/NSS txrate bitmap
5563+ * @mcs: MCS bitmap table for each NSS (array index 0 for 1 stream, etc.)
5564+ */
5565+struct nl80211_txrate_eht {
5566+ __u16 mcs[NL80211_EHT_NSS_MAX];
5567+};
5568+
55285569 /**
55295570 * enum nl80211_band - Frequency band
55305571 * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
@@ -6649,6 +6690,9 @@ enum nl80211_feature_flags { · 1118 unmodified lines
66496690 * (signaling and payload protected) A-MSDUs and this shall be advertised
66506691 * in the RSNXE.
66516692 *
6693+ * @NL80211_EXT_FEATURE_BEACON_RATE_EHT: Driver supports beacon rate
6694+ * configuration (AP/mesh) with EHT rates.
6695+ *
66526696 * @NUM_NL80211_EXT_FEATURES: number of extended features.
66536697 * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
66546698 */
@@ -6724,6 +6768,7 @@ enum nl80211_ext_feature_index { · 69 unmodified lines
67246768 NL80211_EXT_FEATURE_OWE_OFFLOAD_AP,
67256769 NL80211_EXT_FEATURE_DFS_CONCURRENT,
67266770 NL80211_EXT_FEATURE_SPP_AMSDU_SUPPORT,
6771+ NL80211_EXT_FEATURE_BEACON_RATE_EHT,
67276772
67286773 /* add new features before the definition below */
67296774 NUM_NL80211_EXT_FEATURES,
net/mac80211/cfg.c+25−19
@@ -2171,10 +2171,16 @@ static int sta_apply_parameters(struct ieee80211_local *local, · 2170 unmodified lines
21712171
21722172 /*
21732173 * cfg80211 validates this (1-2007) and allows setting the AID
2174− * only when creating a new station entry
2174+ * only when creating a new station entry. For S1G APs, the current
2175+ * implementation supports a maximum of 1600 AIDs.
21752176 */
2176− if (params->aid)
2177+ if (params->aid) {
2178+ if (sdata->vif.cfg.s1g &&
2179+ params->aid > IEEE80211_MAX_SUPPORTED_S1G_AID)
2180+ return -EINVAL;
2181+
21772182 sta->sta.aid = params->aid;
2183+ }
21782184
21792185 /*
21802186 * Some of the following updates would be racy if called on an
@@ -3001,6 +3007,9 @@ static int ieee80211_scan(struct wiphy *wiphy, · 820 unmodified lines
30013007 struct cfg80211_scan_request *req)
30023008 {
30033009 struct ieee80211_sub_if_data *sdata;
3010+ struct ieee80211_link_data *link;
3011+ struct ieee80211_channel *chan;
3012+ int radio_idx;
30043013
30053014 sdata = IEEE80211_WDEV_TO_SUB_IF(req->wdev);
30063015
@@ -3028,10 +3037,20 @@ static int ieee80211_scan(struct wiphy *wiphy, · 21 unmodified lines
30283037 * the frames sent while scanning on other channel will be
30293038 * lost)
30303039 */
3031− if (ieee80211_num_beaconing_links(sdata) &&
3032− (!(wiphy->features & NL80211_FEATURE_AP_SCAN) ||
3033− !(req->flags & NL80211_SCAN_FLAG_AP)))
3034− return -EOPNOTSUPP;
3040+ for_each_link_data(sdata, link) {
3041+ /* if the link is not beaconing, ignore it */
3042+ if (!sdata_dereference(link->u.ap.beacon, sdata))
3043+ continue;
3044+
3045+ chan = link->conf->chanreq.oper.chan;
3046+ radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, chan);
3047+
3048+ if (ieee80211_is_radio_idx_in_scan_req(wiphy, req,
3049+ radio_idx) &&
3050+ (!(wiphy->features & NL80211_FEATURE_AP_SCAN) ||
3051+ !(req->flags & NL80211_SCAN_FLAG_AP)))
3052+ return -EOPNOTSUPP;
3053+ }
30353054 break;
30363055 case NL80211_IFTYPE_NAN:
30373056 default:
@@ -3677,12 +3696,7 @@ static bool ieee80211_is_scan_ongoing(struct wiphy *wiphy, · 639 unmodified lines
36773696 if (list_empty(&local->roc_list) && !local->scanning)
36783697 return false;
36793698
3680− if (wiphy->n_radio < 2)
3681− return true;
3682−
36833699 req_radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, chandef->chan);
3684− if (req_radio_idx < 0)
3685− return true;
36863700
36873701 if (local->scanning) {
36883702 scan_req = wiphy_dereference(wiphy, local->scan_req);
@@ -3701,14 +3715,6 @@ static bool ieee80211_is_scan_ongoing(struct wiphy *wiphy, · 12 unmodified lines
37013715 list_for_each_entry(roc, &local->roc_list, list) {
37023716 chan_radio_idx = cfg80211_get_radio_idx_by_chan(wiphy,
37033717 roc->chan);
3704− /*
3705− * The roc work is added but chan_radio_idx is invalid.
3706− * Should not happen but if it does, let's not take
3707− * risk and return true.
3708− */
3709− if (chan_radio_idx < 0)
3710− return true;
3711−
37123718 if (chan_radio_idx == req_radio_idx)
37133719 return true;
37143720 }
net/mac80211/chan.c+0−11
@@ -659,19 +659,8 @@ bool ieee80211_is_radar_required(struct ieee80211_local *local, · 658 unmodified lines
659659
660660 for_each_sdata_link(local, link) {
661661 if (link->radar_required) {
662− if (wiphy->n_radio < 2)
663− return true;
664−
665662 chan = link->conf->chanreq.oper.chan;
666663 radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, chan);
667− /*
668− * The radio index (radio_idx) is expected to be valid,
669− * as it's derived from a channel tied to a link. If
670− * it's invalid (i.e., negative), return true to avoid
671− * potential issues with radar-sensitive operations.
672− */
673− if (radio_idx < 0)
674− return true;
675664
676665 if (ieee80211_is_radio_idx_in_scan_req(wiphy, req,
677666 radio_idx))
net/mac80211/ethtool.c+4−2
@@ -48,8 +48,8 @@ static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = { · 47 unmodified lines
4848 "rx_duplicates", "rx_fragments", "rx_dropped",
4949 "tx_packets", "tx_bytes",
5050 "tx_filtered", "tx_retry_failed", "tx_retries",
51− "sta_state", "txrate", "rxrate", "signal",
52− "channel", "noise", "ch_time", "ch_time_busy",
51+ "tx_handlers_drop", "sta_state", "txrate", "rxrate",
52+ "signal", "channel", "noise", "ch_time", "ch_time_busy",
5353 "ch_time_ext_busy", "ch_time_rx", "ch_time_tx"
5454 };
5555 #define STA_STATS_LEN ARRAY_SIZE(ieee80211_gstrings_sta_stats)
@@ -120,6 +120,7 @@ static void ieee80211_get_stats(struct net_device *dev, · 64 unmodified lines
120120 i = 0;
121121 ADD_STA_STATS(&sta->deflink);
122122
123+ data[i++] = sdata->tx_handlers_drop;
123124 data[i++] = sta->sta_state;
124125
125126
@@ -145,6 +146,7 @@ static void ieee80211_get_stats(struct net_device *dev, · 19 unmodified lines
145146 sta_set_sinfo(sta, &sinfo, false);
146147 i = 0;
147148 ADD_STA_STATS(&sta->deflink);
149+ data[i++] = sdata->tx_handlers_drop;
148150 }
149151 }
150152
net/mac80211/ieee80211_i.h+9−0
@@ -86,6 +86,14 @@ extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS]; · 85 unmodified lines
8686
8787 #define IEEE80211_MAX_NAN_INSTANCE_ID 255
8888
89+/*
90+ * Current mac80211 implementation supports a maximum of 1600 AIDS
91+ * for S1G interfaces. With regards to an S1G TIM, this covers 25 blocks
92+ * as each block is 64 AIDs.
93+ */
94+#define IEEE80211_MAX_SUPPORTED_S1G_AID 1600
95+#define IEEE80211_MAX_SUPPORTED_S1G_TIM_BLOCKS 25
96+
8997 enum ieee80211_status_data {
9098 IEEE80211_STATUS_TYPE_MASK = 0x00f,
9199 IEEE80211_STATUS_TYPE_INVALID = 0,
@@ -1210,6 +1218,7 @@ struct ieee80211_sub_if_data { · 1118 unmodified lines
12101218 } debugfs;
12111219 #endif
12121220
1221+ u32 tx_handlers_drop;
12131222 /* must be last, dynamically sized area in this! */
12141223 struct ieee80211_vif vif;
12151224 };
net/mac80211/main.c+8−3
@@ -862,6 +862,14 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, · 861 unmodified lines
862862 if (emulate_chanctx || ops->remain_on_channel)
863863 wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
864864
865+ wiphy->bss_param_support = WIPHY_BSS_PARAM_CTS_PROT |
866+ WIPHY_BSS_PARAM_SHORT_PREAMBLE |
867+ WIPHY_BSS_PARAM_SHORT_SLOT_TIME |
868+ WIPHY_BSS_PARAM_BASIC_RATES |
869+ WIPHY_BSS_PARAM_AP_ISOLATE |
870+ WIPHY_BSS_PARAM_HT_OPMODE |
871+ WIPHY_BSS_PARAM_P2P_CTWINDOW |
872+ WIPHY_BSS_PARAM_P2P_OPPPS;
865873 wiphy->features |= NL80211_FEATURE_SK_TX_STATUS |
866874 NL80211_FEATURE_SAE |
867875 NL80211_FEATURE_HT_IBSS |
@@ -1164,9 +1172,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 296 unmodified lines
11641172 if (WARN_ON(!ieee80211_hw_check(hw, MFP_CAPABLE)))
11651173 return -EINVAL;
11661174
1167− if (WARN_ON(!ieee80211_hw_check(hw, CONNECTION_MONITOR)))
1168− return -EINVAL;
1169−
11701175 if (WARN_ON(ieee80211_hw_check(hw, NEED_DTIM_BEFORE_ASSOC)))
11711176 return -EINVAL;
11721177
net/mac80211/mesh.c+3−0
@@ -624,6 +624,9 @@ int mesh_add_he_6ghz_cap_ie(struct ieee80211_sub_if_data *sdata, · 623 unmodified lines
624624 if (!sband)
625625 return -EINVAL;
626626
627+ if (sband->band != NL80211_BAND_6GHZ)
628+ return 0;
629+
627630 iftd = ieee80211_get_sband_iftype_data(sband,
628631 NL80211_IFTYPE_MESH_POINT);
629632 /* The device doesn't support HE in mesh mode or at all */
net/mac80211/mesh_ps.c+1−1
@@ -586,7 +586,7 @@ void ieee80211_mps_frame_release(struct sta_info *sta, · 585 unmodified lines
586586
587587 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB)
588588 has_buffered = ieee80211_check_tim(elems->tim, elems->tim_len,
589− sta->mesh->aid);
589+ sta->mesh->aid, false);
590590
591591 if (has_buffered)
592592 mps_dbg(sta->sdata, "%pM indicates buffered frames\n",
net/mac80211/mlme.c+21−17
@@ -1850,7 +1850,8 @@ ieee80211_add_link_elems(struct ieee80211_sub_if_data *sdata, · 1849 unmodified lines
18501850 ieee80211_put_he_cap(skb, sdata, sband,
18511851 &assoc_data->link[link_id].conn);
18521852 ADD_PRESENT_EXT_ELEM(WLAN_EID_EXT_HE_CAPABILITY);
1853− ieee80211_put_he_6ghz_cap(skb, sdata, smps_mode);
1853+ if (sband->band == NL80211_BAND_6GHZ)
1854+ ieee80211_put_he_6ghz_cap(skb, sdata, smps_mode);
18541855 }
18551856
18561857 /*
@@ -2112,8 +2113,11 @@ ieee80211_link_common_elems_size(struct ieee80211_sub_if_data *sdata, · 255 unmodified lines
21122113 sizeof(struct ieee80211_he_mcs_nss_supp) +
21132114 IEEE80211_HE_PPE_THRES_MAX_LEN;
21142115
2115− if (sband->band == NL80211_BAND_6GHZ)
2116+ if (sband->band == NL80211_BAND_6GHZ) {
21162117 size += 2 + 1 + sizeof(struct ieee80211_he_6ghz_capa);
2118+ /* reg connection */
2119+ size += 4;
2120+ }
21172121
21182122 size += 2 + 1 + sizeof(struct ieee80211_eht_cap_elem) +
21192123 sizeof(struct ieee80211_eht_mcs_nss_supp) +
@@ -2187,11 +2191,7 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 67 unmodified lines
21872191 2 + /* ext capa & op */
21882192 2; /* EML capa */
21892193
2190− /*
2191− * The capability elements were already considered above;
2192− * note this over-estimates a bit because there's no
2193− * STA profile for the assoc link.
2194− */
2194+ /* The capability elements were already considered above */
21952195 size += (n_links - 1) *
21962196 (1 + 1 + /* subelement ID/length */
21972197 2 + /* STA control */
@@ -5729,7 +5729,7 @@ static u8 ieee80211_max_rx_chains(struct ieee80211_link_data *link, · 3531 unmodified lines
57295729 he_cap_elem = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_CAPABILITY,
57305730 ies->data, ies->len);
57315731
5732− if (!he_cap_elem || he_cap_elem->datalen < sizeof(*he_cap))
5732+ if (!he_cap_elem || he_cap_elem->datalen < sizeof(*he_cap) + 1)
57335733 return chains;
57345734
57355735 /* skip one byte ext_tag_id */
@@ -6356,6 +6356,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 620 unmodified lines
63566356 };
63576357 u8 ap_mld_addr[ETH_ALEN] __aligned(2);
63586358 unsigned int link_id;
6359+ u16 max_aid = IEEE80211_MAX_AID;
63596360
63606361 lockdep_assert_wiphy(sdata->local->hw.wiphy);
63616362
@@ -6382,10 +6383,12 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 20 unmodified lines
63826383 reassoc = ieee80211_is_reassoc_resp(mgmt->frame_control);
63836384 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
63846385 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
6385− if (assoc_data->s1g)
6386+ if (assoc_data->s1g) {
63866387 elem_start = mgmt->u.s1g_assoc_resp.variable;
6387− else
6388+ max_aid = IEEE80211_MAX_SUPPORTED_S1G_AID;
6389+ } else {
63886390 elem_start = mgmt->u.assoc_resp.variable;
6391+ }
63896392
63906393 /*
63916394 * Note: this may not be perfect, AP might misbehave - if
@@ -6409,16 +6412,15 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 17 unmodified lines
64096412
64106413 if (elems->aid_resp)
64116414 aid = le16_to_cpu(elems->aid_resp->aid);
6412− else if (assoc_data->s1g)
6413− aid = 0; /* TODO */
64146415 else
64156416 aid = le16_to_cpu(mgmt->u.assoc_resp.aid);
64166417
64176418 /*
6418− * The 5 MSB of the AID field are reserved
6419− * (802.11-2016 9.4.1.8 AID field)
6419+ * The 5 MSB of the AID field are reserved for a non-S1G STA. For
6420+ * an S1G STA the 3 MSBs are reserved.
6421+ * (802.11-2016 9.4.1.8 AID field).
64206422 */
6421− aid &= 0x7ff;
6423+ aid &= assoc_data->s1g ? 0x1fff : 0x7ff;
64226424
64236425 sdata_info(sdata,
64246426 "RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n",
@@ -6455,7 +6457,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 30 unmodified lines
64556457 event.u.mlme.reason = status_code;
64566458 drv_event_callback(sdata->local, sdata, &event);
64576459 } else {
6458− if (aid == 0 || aid > IEEE80211_MAX_AID) {
6460+ if (aid == 0 || aid > max_aid) {
64596461 sdata_info(sdata,
64606462 "invalid AID value %d (out of range), turn off PS\n",
64616463 aid);
@@ -6493,6 +6495,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 31 unmodified lines
64936495 }
64946496
64956497 sdata->vif.cfg.aid = aid;
6498+ sdata->vif.cfg.s1g = assoc_data->s1g;
64966499
64976500 if (!ieee80211_assoc_success(sdata, mgmt, elems,
64986501 elem_start, elem_len)) {
@@ -7440,7 +7443,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, · 941 unmodified lines
74407443 ncrc = elems->crc;
74417444
74427445 if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) &&
7443− ieee80211_check_tim(elems->tim, elems->tim_len, vif_cfg->aid)) {
7446+ ieee80211_check_tim(elems->tim, elems->tim_len, vif_cfg->aid,
7447+ vif_cfg->s1g)) {
74447448 if (local->hw.conf.dynamic_ps_timeout > 0) {
74457449 if (local->hw.conf.flags & IEEE80211_CONF_PS) {
74467450 local->hw.conf.flags &= ~IEEE80211_CONF_PS;
net/mac80211/sta_info.c+9−4
@@ -2962,7 +2962,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, · 2961 unmodified lines
29622962 struct ieee80211_sub_if_data *sdata = sta->sdata;
29632963 struct ieee80211_local *local = sdata->local;
29642964 u32 thr = 0;
2965− int i, ac, cpu, link_id;
2965+ int i, ac, cpu;
29662966 struct ieee80211_sta_rx_stats *last_rxstats;
29672967
29682968 last_rxstats = sta_get_last_rx_stats(sta, -1);
@@ -3204,18 +3204,23 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, · 235 unmodified lines
32043204 if (sta->sta.valid_links) {
32053205 struct ieee80211_link_data *link;
32063206 struct link_sta_info *link_sta;
3207+ int link_id;
32073208
32083209 ether_addr_copy(sinfo->mld_addr, sta->addr);
3210+
3211+ /* assign valid links first for iteration */
3212+ sinfo->valid_links = sta->sta.valid_links;
3213+
32093214 for_each_valid_link(sinfo, link_id) {
32103215 link_sta = wiphy_dereference(sta->local->hw.wiphy,
32113216 sta->link[link_id]);
32123217 link = wiphy_dereference(sdata->local->hw.wiphy,
32133218 sdata->link[link_id]);
32143219
3215− if (!link_sta || !sinfo->links[link_id] || !link)
3220+ if (!link_sta || !sinfo->links[link_id] || !link) {
3221+ sinfo->valid_links &= ~BIT(link_id);
32163222 continue;
3217−
3218− sinfo->valid_links = sta->sta.valid_links;
3223+ }
32193224 sta_set_link_sinfo(sta, sinfo->links[link_id],
32203225 link, tidstats);
32213226 }
net/mac80211/tests/Makefile+1−1
@@ -1,3 +1,3 @@
1−mac80211-tests-y += module.o util.o elems.o mfp.o tpe.o chan-mode.o
1+mac80211-tests-y += module.o util.o elems.o mfp.o tpe.o chan-mode.o s1g_tim.o
22
33 obj-$(CONFIG_MAC80211_KUNIT_TEST) += mac80211-tests.o
net/mac80211/tests/s1g_tim.c+356−0
@@ -0,0 +1,356 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * KUnit tests for S1G TIM PVB decoding. This test suite covers
4+ * IEEE80211-2024 Annex L figures 8, 9, 10, 12, 13, 14. ADE mode
5+ * is not covered as it is an optional encoding format and is not
6+ * currently supported by mac80211.
7+ *
8+ * Copyright (C) 2025 Morse Micro
9+ */
10+#include <linux/ieee80211.h>
11+#include <kunit/test.h>
12+#include <kunit/test-bug.h>
13+
14+#define MAX_AID 128
15+
16+#define BC(enc_mode, inverse, blk_off) \
17+ ((((blk_off) & 0x1f) << 3) | ((inverse) ? BIT(2) : 0) | \
18+ ((enc_mode) & 0x3))
19+
20+static void byte_to_bitstr(u8 v, char *out)
21+{
22+ for (int b = 7; b >= 0; b--)
23+ *out++ = (v & BIT(b)) ? '1' : '0';
24+ *out = '\0';
25+}
26+
27+static void dump_tim_bits(struct kunit *test,
28+ const struct ieee80211_tim_ie *tim, u8 tim_len)
29+{
30+ const u8 *ptr = tim->virtual_map;
31+ const u8 *end = (const u8 *)tim + tim_len;
32+ unsigned int oct = 1;
33+ unsigned int blk = 0;
34+ char bits[9];
35+
36+ while (ptr < end) {
37+ u8 ctrl = *ptr++;
38+ u8 mode = ctrl & 0x03;
39+ bool inverse = ctrl & BIT(2);
40+ u8 blk_off = ctrl >> 3;
41+
42+ kunit_info(
43+ test, "Block %u (ENC=%s, blk_off=%u, inverse=%u)", blk,
44+ (mode == IEEE80211_S1G_TIM_ENC_MODE_BLOCK) ? "BLOCK" :
45+ (mode == IEEE80211_S1G_TIM_ENC_MODE_SINGLE) ? "SINGLE" :
46+ "OLB",
47+ blk_off, inverse);
48+
49+ byte_to_bitstr(ctrl, bits);
50+ kunit_info(test, " octet %2u (ctrl) : %s (0x%02x)", oct,
51+ bits, ctrl);
52+ ++oct;
53+
54+ switch (mode) {
55+ case IEEE80211_S1G_TIM_ENC_MODE_BLOCK: {
56+ u8 blkmap = *ptr++;
57+
58+ byte_to_bitstr(blkmap, bits);
59+ kunit_info(test, " octet %2u (blk-map) : %s (0x%02x)",
60+ oct, bits, blkmap);
61+ ++oct;
62+
63+ for (u8 sb = 0; sb < 8; sb++) {
64+ if (!(blkmap & BIT(sb)))
65+ continue;
66+ u8 sub = *ptr++;
67+
68+ byte_to_bitstr(sub, bits);
69+ kunit_info(
70+ test,
71+ " octet %2u (SB %2u) : %s (0x%02x)",
72+ oct, sb, bits, sub);
73+ ++oct;
74+ }
75+ break;
76+ }
77+ case IEEE80211_S1G_TIM_ENC_MODE_SINGLE: {
78+ u8 single = *ptr++;
79+
80+ byte_to_bitstr(single, bits);
81+ kunit_info(test, " octet %2u (single) : %s (0x%02x)",
82+ oct, bits, single);
83+ ++oct;
84+ break;
85+ }
86+ case IEEE80211_S1G_TIM_ENC_MODE_OLB: {
87+ u8 len = *ptr++;
88+
89+ byte_to_bitstr(len, bits);
90+ kunit_info(test, " octet %2u (len=%2u) : %s (0x%02x)",
91+ oct, len, bits, len);
92+ ++oct;
93+
94+ for (u8 i = 0; i < len && ptr < end; i++) {
95+ u8 sub = *ptr++;
96+
97+ byte_to_bitstr(sub, bits);
98+ kunit_info(
99+ test,
100+ " octet %2u (SB %2u) : %s (0x%02x)",
101+ oct, i, bits, sub);
102+ ++oct;
103+ }
104+ break;
105+ }
106+ default:
107+ kunit_info(test, " ** unknown encoding 0x%x **", mode);
108+ return;
109+ }
110+ blk++;
111+ }
112+}
113+
114+static void tim_push(u8 **p, u8 v)
115+{
116+ *(*p)++ = v;
117+}
118+
119+static void tim_begin(struct ieee80211_tim_ie *tim, u8 **p)
120+{
121+ tim->dtim_count = 0;
122+ tim->dtim_period = 1;
123+ tim->bitmap_ctrl = 0;
124+ *p = tim->virtual_map;
125+}
126+
127+static u8 tim_end(struct ieee80211_tim_ie *tim, u8 *tail)
128+{
129+ return tail - (u8 *)tim;
130+}
131+
132+static void pvb_add_block_bitmap(u8 **p, u8 blk_off, bool inverse, u8 blk_bmap,
133+ const u8 *subblocks)
134+{
135+ u8 enc = IEEE80211_S1G_TIM_ENC_MODE_BLOCK;
136+ u8 n = hweight8(blk_bmap);
137+
138+ tim_push(p, BC(enc, inverse, blk_off));
139+ tim_push(p, blk_bmap);
140+
141+ for (u8 i = 0; i < n; i++)
142+ tim_push(p, subblocks[i]);
143+}
144+
145+static void pvb_add_single_aid(u8 **p, u8 blk_off, bool inverse, u8 single6)
146+{
147+ u8 enc = IEEE80211_S1G_TIM_ENC_MODE_SINGLE;
148+
149+ tim_push(p, BC(enc, inverse, blk_off));
150+ tim_push(p, single6 & GENMASK(5, 0));
151+}
152+
153+static void pvb_add_olb(u8 **p, u8 blk_off, bool inverse, const u8 *subblocks,
154+ u8 len)
155+{
156+ u8 enc = IEEE80211_S1G_TIM_ENC_MODE_OLB;
157+
158+ tim_push(p, BC(enc, inverse, blk_off));
159+ tim_push(p, len);
160+ for (u8 i = 0; i < len; i++)
161+ tim_push(p, subblocks[i]);
162+}
163+
164+static void check_all_aids(struct kunit *test,
165+ const struct ieee80211_tim_ie *tim, u8 tim_len,
166+ const unsigned long *expected)
167+{
168+ for (u16 aid = 1; aid <= MAX_AID; aid++) {
169+ bool want = test_bit(aid, expected);
170+ bool got = ieee80211_s1g_check_tim(tim, tim_len, aid);
171+
172+ KUNIT_ASSERT_EQ_MSG(test, got, want,
173+ "AID %u mismatch (got=%d want=%d)", aid,
174+ got, want);
175+ }
176+}
177+
178+static void fill_bitmap(unsigned long *bm, const u16 *list, size_t n)
179+{
180+ size_t i;
181+
182+ bitmap_zero(bm, MAX_AID + 1);
183+ for (i = 0; i < n; i++)
184+ __set_bit(list[i], bm);
185+}
186+
187+static void fill_bitmap_inverse(unsigned long *bm, u16 max_aid,
188+ const u16 *except, size_t n_except)
189+{
190+ bitmap_zero(bm, MAX_AID + 1);
191+ for (u16 aid = 1; aid <= max_aid; aid++)
192+ __set_bit(aid, bm);
193+
194+ for (size_t i = 0; i < n_except; i++)
195+ if (except[i] <= max_aid)
196+ __clear_bit(except[i], bm);
197+}
198+
199+static void s1g_tim_block_test(struct kunit *test)
200+{
201+ u8 buf[256] = {};
202+ struct ieee80211_tim_ie *tim = (void *)buf;
203+ u8 *p, tim_len;
204+ static const u8 subblocks[] = {
205+ 0x42, /* SB m=0: AIDs 1,6 */
206+ 0xA0, /* SB m=2: AIDs 21,23 */
207+ };
208+ u8 blk_bmap = 0x05; /* bits 0 and 2 set */
209+ bool inverse = false;
210+ static const u16 set_list[] = { 1, 6, 21, 23 };
211+ DECLARE_BITMAP(exp, MAX_AID + 1);
212+
213+ tim_begin(tim, &p);
214+ pvb_add_block_bitmap(&p, 0, inverse, blk_bmap, subblocks);
215+ tim_len = tim_end(tim, p);
216+
217+ fill_bitmap(exp, set_list, ARRAY_SIZE(set_list));
218+
219+ dump_tim_bits(test, tim, tim_len);
220+ check_all_aids(test, tim, tim_len, exp);
221+}
222+
223+static void s1g_tim_single_test(struct kunit *test)
224+{
225+ u8 buf[256] = {};
226+ struct ieee80211_tim_ie *tim = (void *)buf;
227+ u8 *p, tim_len;
228+ bool inverse = false;
229+ u8 blk_off = 0;
230+ u8 single6 = 0x1f; /* 31 */
231+ static const u16 set_list[] = { 31 };
232+ DECLARE_BITMAP(exp, MAX_AID + 1);
233+
234+ tim_begin(tim, &p);
235+ pvb_add_single_aid(&p, blk_off, inverse, single6);
236+ tim_len = tim_end(tim, p);
237+
238+ fill_bitmap(exp, set_list, ARRAY_SIZE(set_list));
239+
240+ dump_tim_bits(test, tim, tim_len);
241+ check_all_aids(test, tim, tim_len, exp);
242+}
243+
244+static void s1g_tim_olb_test(struct kunit *test)
245+{
246+ u8 buf[256] = {};
247+ struct ieee80211_tim_ie *tim = (void *)buf;
248+ u8 *p, tim_len;
249+ bool inverse = false;
250+ u8 blk_off = 0;
251+ static const u16 set_list[] = { 1, 6, 13, 15, 17, 22, 29, 31, 33,
252+ 38, 45, 47, 49, 54, 61, 63, 65, 70 };
253+ static const u8 subblocks[] = { 0x42, 0xA0, 0x42, 0xA0, 0x42,
254+ 0xA0, 0x42, 0xA0, 0x42 };
255+ u8 len = ARRAY_SIZE(subblocks);
256+ DECLARE_BITMAP(exp, MAX_AID + 1);
257+
258+ tim_begin(tim, &p);
259+ pvb_add_olb(&p, blk_off, inverse, subblocks, len);
260+ tim_len = tim_end(tim, p);
261+
262+ fill_bitmap(exp, set_list, ARRAY_SIZE(set_list));
263+
264+ dump_tim_bits(test, tim, tim_len);
265+ check_all_aids(test, tim, tim_len, exp);
266+}
267+
268+static void s1g_tim_inverse_block_test(struct kunit *test)
269+{
270+ u8 buf[256] = {};
271+ struct ieee80211_tim_ie *tim = (void *)buf;
272+ u8 *p, tim_len;
273+ /* Same sub-block content as Figure L-8, but inverse = true */
274+ static const u8 subblocks[] = {
275+ 0x42, /* SB m=0: AIDs 1,6 */
276+ 0xA0, /* SB m=2: AIDs 21,23 */
277+ };
278+ u8 blk_bmap = 0x05;
279+ bool inverse = true;
280+ /* All AIDs except 1,6,21,23 are set */
281+ static const u16 except[] = { 1, 6, 21, 23 };
282+ DECLARE_BITMAP(exp, MAX_AID + 1);
283+
284+ tim_begin(tim, &p);
285+ pvb_add_block_bitmap(&p, 0, inverse, blk_bmap, subblocks);
286+ tim_len = tim_end(tim, p);
287+
288+ fill_bitmap_inverse(exp, 63, except, ARRAY_SIZE(except));
289+
290+ dump_tim_bits(test, tim, tim_len);
291+ check_all_aids(test, tim, tim_len, exp);
292+}
293+
294+static void s1g_tim_inverse_single_test(struct kunit *test)
295+{
296+ u8 buf[256] = {};
297+ struct ieee80211_tim_ie *tim = (void *)buf;
298+ u8 *p, tim_len;
299+ bool inverse = true;
300+ u8 blk_off = 0;
301+ u8 single6 = 0x1f; /* 31 */
302+ /* All AIDs except 31 are set */
303+ static const u16 except[] = { 31 };
304+ DECLARE_BITMAP(exp, MAX_AID + 1);
305+
306+ tim_begin(tim, &p);
307+ pvb_add_single_aid(&p, blk_off, inverse, single6);
308+ tim_len = tim_end(tim, p);
309+
310+ fill_bitmap_inverse(exp, 63, except, ARRAY_SIZE(except));
311+
312+ dump_tim_bits(test, tim, tim_len);
313+ check_all_aids(test, tim, tim_len, exp);
314+}
315+
316+static void s1g_tim_inverse_olb_test(struct kunit *test)
317+{
318+ u8 buf[256] = {};
319+ struct ieee80211_tim_ie *tim = (void *)buf;
320+ u8 *p, tim_len;
321+ bool inverse = true;
322+ u8 blk_off = 0, len;
323+ /* All AIDs except the list below are set */
324+ static const u16 except[] = { 1, 6, 13, 15, 17, 22, 29, 31, 33,
325+ 38, 45, 47, 49, 54, 61, 63, 65, 70 };
326+ static const u8 subblocks[] = { 0x42, 0xA0, 0x42, 0xA0, 0x42,
327+ 0xA0, 0x42, 0xA0, 0x42 };
328+ len = ARRAY_SIZE(subblocks);
329+ DECLARE_BITMAP(exp, MAX_AID + 1);
330+
331+ tim_begin(tim, &p);
332+ pvb_add_olb(&p, blk_off, inverse, subblocks, len);
333+ tim_len = tim_end(tim, p);
334+
335+ fill_bitmap_inverse(exp, 127, except, ARRAY_SIZE(except));
336+
337+ dump_tim_bits(test, tim, tim_len);
338+ check_all_aids(test, tim, tim_len, exp);
339+}
340+
341+static struct kunit_case s1g_tim_test_cases[] = {
342+ KUNIT_CASE(s1g_tim_block_test),
343+ KUNIT_CASE(s1g_tim_single_test),
344+ KUNIT_CASE(s1g_tim_olb_test),
345+ KUNIT_CASE(s1g_tim_inverse_block_test),
346+ KUNIT_CASE(s1g_tim_inverse_single_test),
347+ KUNIT_CASE(s1g_tim_inverse_olb_test),
348+ {}
349+};
350+
351+static struct kunit_suite s1g_tim = {
352+ .name = "mac80211-s1g-tim",
353+ .test_cases = s1g_tim_test_cases,
354+};
355+
356+kunit_test_suite(s1g_tim);
net/mac80211/tx.c+133−40
@@ -1814,6 +1814,7 @@ static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx) · 1813 unmodified lines
18141814
18151815 txh_done:
18161816 if (unlikely(res == TX_DROP)) {
1817+ tx->sdata->tx_handlers_drop++;
18171818 I802_DEBUG_INC(tx->local->tx_handlers_drop);
18181819 if (tx->skb)
18191820 ieee80211_free_txskb(&tx->local->hw, tx->skb);
@@ -1858,6 +1859,7 @@ static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx) · 38 unmodified lines
18581859
18591860 txh_done:
18601861 if (unlikely(res == TX_DROP)) {
1862+ tx->sdata->tx_handlers_drop++;
18611863 I802_DEBUG_INC(tx->local->tx_handlers_drop);
18621864 if (tx->skb)
18631865 ieee80211_free_txskb(&tx->local->hw, tx->skb);
@@ -1942,6 +1944,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, · 78 unmodified lines
19421944
19431945 if (unlikely(res_prepare == TX_DROP)) {
19441946 ieee80211_free_txskb(&local->hw, skb);
1947+ tx.sdata->tx_handlers_drop++;
19451948 return true;
19461949 } else if (unlikely(res_prepare == TX_QUEUED)) {
19471950 return true;
@@ -3728,8 +3731,10 @@ void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, · 1780 unmodified lines
37283731 r = ieee80211_xmit_fast_finish(sdata, sta, fast_tx->pn_offs,
37293732 fast_tx->key, &tx);
37303733 tx.skb = NULL;
3731− if (r == TX_DROP)
3734+ if (r == TX_DROP) {
3735+ tx.sdata->tx_handlers_drop++;
37323736 goto free;
3737+ }
37333738
37343739 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
37353740 sdata = container_of(sdata->bss,
@@ -4882,15 +4887,114 @@ void ieee80211_tx_pending(struct tasklet_struct *t) · 1146 unmodified lines
48824887
48834888 /* functions for drivers to get certain frames */
48844889
4890+static void ieee80211_beacon_add_tim_pvb(struct ps_data *ps,
4891+ struct sk_buff *skb,
4892+ bool mcast_traffic)
4893+{
4894+ int i, n1 = 0, n2;
4895+
4896+ /*
4897+ * Find largest even number N1 so that bits numbered 1 through
4898+ * (N1 x 8) - 1 in the bitmap are 0 and number N2 so that bits
4899+ * (N2 + 1) x 8 through 2007 are 0.
4900+ */
4901+ for (i = 0; i < IEEE80211_MAX_TIM_LEN; i++) {
4902+ if (ps->tim[i]) {
4903+ n1 = i & 0xfe;
4904+ break;
4905+ }
4906+ }
4907+ n2 = n1;
4908+ for (i = IEEE80211_MAX_TIM_LEN - 1; i >= n1; i--) {
4909+ if (ps->tim[i]) {
4910+ n2 = i;
4911+ break;
4912+ }
4913+ }
4914+
4915+ /* Bitmap control */
4916+ skb_put_u8(skb, n1 | mcast_traffic);
4917+ /* Part Virt Bitmap */
4918+ skb_put_data(skb, ps->tim + n1, n2 - n1 + 1);
4919+}
4920+
4921+/*
4922+ * mac80211 currently supports encoding using block bitmap mode, non
4923+ * inversed. The current implementation supports up to 1600 AIDs.
4924+ *
4925+ * Block bitmap encoding breaks down the AID bitmap into blocks of 64
4926+ * AIDs. Each block contains between 0 and 8 subblocks. Each subblock
4927+ * describes 8 AIDs and the presence of a subblock is determined by
4928+ * the block bitmap.
4929+ */
4930+static void ieee80211_s1g_beacon_add_tim_pvb(struct ps_data *ps,
4931+ struct sk_buff *skb,
4932+ bool mcast_traffic)
4933+{
4934+ int blk;
4935+
4936+ /*
4937+ * Emit a bitmap control block with a page slice number of 31 and a
4938+ * page index of 0 which indicates as per IEEE80211-2024 9.4.2.5.1
4939+ * that the entire page (2048 bits) indicated by the page index
4940+ * is encoded in the partial virtual bitmap.
4941+ */
4942+ skb_put_u8(skb, mcast_traffic | (31 << 1));
4943+
4944+ /* Emit an encoded block for each non-zero sub-block */
4945+ for (blk = 0; blk < IEEE80211_MAX_SUPPORTED_S1G_TIM_BLOCKS; blk++) {
4946+ u8 blk_bmap = 0;
4947+ int sblk;
4948+
4949+ for (sblk = 0; sblk < 8; sblk++) {
4950+ int sblk_idx = blk * 8 + sblk;
4951+
4952+ /*
4953+ * If the current subblock is non-zero, increase the
4954+ * number of subblocks to emit for the current block.
4955+ */
4956+ if (ps->tim[sblk_idx])
4957+ blk_bmap |= BIT(sblk);
4958+ }
4959+
4960+ /* If the current block contains no non-zero sublocks */
4961+ if (!blk_bmap)
4962+ continue;
4963+
4964+ /*
4965+ * Emit a block control byte for the current encoded block
4966+ * with an encoding mode of block bitmap (0x0), not inverse
4967+ * (0x0) and the current block offset (5 bits)
4968+ */
4969+ skb_put_u8(skb, blk << 3);
4970+
4971+ /*
4972+ * Emit the block bitmap for the current encoded block which
4973+ * contains the present subblocks.
4974+ */
4975+ skb_put_u8(skb, blk_bmap);
4976+
4977+ /* Emit the present subblocks */
4978+ for (sblk = 0; sblk < 8; sblk++) {
4979+ int sblk_idx = blk * 8 + sblk;
4980+
4981+ if (!(blk_bmap & BIT(sblk)))
4982+ continue;
4983+
4984+ skb_put_u8(skb, ps->tim[sblk_idx]);
4985+ }
4986+ }
4987+}
4988+
48854989 static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata,
48864990 struct ieee80211_link_data *link,
48874991 struct ps_data *ps, struct sk_buff *skb,
48884992 bool is_template)
48894993 {
4890− u8 *pos, *tim;
4891− int aid0 = 0;
4892− int i, have_bits = 0, n1, n2;
4994+ struct element *tim;
4995+ bool mcast_traffic = false, have_bits = false;
48934996 struct ieee80211_bss_conf *link_conf = link->conf;
4997+ bool s1g = ieee80211_get_link_sband(link)->band == NL80211_BAND_S1GHZ;
48944998
48954999 /* Generate bitmap for TIM only if there are any STAs in power save
48965000 * mode. */
@@ -4898,7 +5002,8 @@ static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, · 1 unmodified line
48985002 /* in the hope that this is faster than
48995003 * checking byte-for-byte */
49005004 have_bits = !bitmap_empty((unsigned long *)ps->tim,
4901− IEEE80211_MAX_AID+1);
5005+ IEEE80211_MAX_AID + 1);
5006+
49025007 if (!is_template) {
49035008 if (ps->dtim_count == 0)
49045009 ps->dtim_count = link_conf->dtim_period - 1;
@@ -4906,51 +5011,39 @@ static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, · 1 unmodified line
49065011 ps->dtim_count--;
49075012 }
49085013
4909− tim = pos = skb_put(skb, 5);
4910− *pos++ = WLAN_EID_TIM;
4911− *pos++ = 3;
4912− *pos++ = ps->dtim_count;
4913− *pos++ = link_conf->dtim_period;
5014+ /* Length is set after parsing the AID bitmap */
5015+ tim = skb_put(skb, sizeof(struct element));
5016+ tim->id = WLAN_EID_TIM;
5017+ skb_put_u8(skb, ps->dtim_count);
5018+ skb_put_u8(skb, link_conf->dtim_period);
49145019
49155020 if (ps->dtim_count == 0 && !skb_queue_empty(&ps->bc_buf))
4916− aid0 = 1;
5021+ mcast_traffic = true;
49175022
4918− ps->dtim_bc_mc = aid0 == 1;
5023+ ps->dtim_bc_mc = mcast_traffic;
49195024
49205025 if (have_bits) {
4921− /* Find largest even number N1 so that bits numbered 1 through
4922− * (N1 x 8) - 1 in the bitmap are 0 and number N2 so that bits
4923− * (N2 + 1) x 8 through 2007 are 0. */
4924− n1 = 0;
4925− for (i = 0; i < IEEE80211_MAX_TIM_LEN; i++) {
4926− if (ps->tim[i]) {
4927− n1 = i & 0xfe;
4928− break;
4929− }
4930− }
4931− n2 = n1;
4932− for (i = IEEE80211_MAX_TIM_LEN - 1; i >= n1; i--) {
4933− if (ps->tim[i]) {
4934− n2 = i;
4935− break;
4936− }
4937− }
4938−
4939− /* Bitmap control */
4940− *pos++ = n1 | aid0;
4941− /* Part Virt Bitmap */
4942− skb_put_data(skb, ps->tim + n1, n2 - n1 + 1);
4943−
4944− tim[1] = n2 - n1 + 4;
5026+ if (s1g)
5027+ ieee80211_s1g_beacon_add_tim_pvb(ps, skb,
5028+ mcast_traffic);
5029+ else
5030+ ieee80211_beacon_add_tim_pvb(ps, skb, mcast_traffic);
49455031 } else {
4946− *pos++ = aid0; /* Bitmap control */
4947−
4948− if (ieee80211_get_link_sband(link)->band != NL80211_BAND_S1GHZ) {
4949− tim[1] = 4;
5032+ /*
5033+ * If there is no buffered unicast traffic for an S1G
5034+ * interface, we can exclude the bitmap control. This is in
5035+ * contrast to other phy types as they do include the bitmap
5036+ * control and pvb even when there is no buffered traffic.
5037+ */
5038+ if (!s1g) {
5039+ /* Bitmap control */
5040+ skb_put_u8(skb, mcast_traffic);
49505041 /* Part Virt Bitmap */
49515042 skb_put_u8(skb, 0);
49525043 }
49535044 }
5045+
5046+ tim->datalen = skb_tail_pointer(skb) - tim->data;
49545047 }
49555048
49565049 static int ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata,
net/mac80211/util.c+9−11
@@ -1756,7 +1756,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 1755 unmodified lines
17561756 bool sched_scan_stopped = false;
17571757 bool suspended = local->suspended;
17581758 bool in_reconfig = false;
1759− u32 rts_threshold;
17601759
17611760 lockdep_assert_wiphy(local->hw.wiphy);
17621761
@@ -1832,7 +1831,9 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 69 unmodified lines
18321831 /* setup RTS threshold */
18331832 if (hw->wiphy->n_radio > 0) {
18341833 for (i = 0; i < hw->wiphy->n_radio; i++) {
1835− rts_threshold = hw->wiphy->radio_cfg[i].rts_threshold;
1834+ u32 rts_threshold =
1835+ hw->wiphy->radio_cfg[i].rts_threshold;
1836+
18361837 drv_set_rts_threshold(local, i, rts_threshold);
18371838 }
18381839 } else {
@@ -4022,16 +4023,13 @@ bool ieee80211_is_radio_idx_in_scan_req(struct wiphy *wiphy, · 2183 unmodified lines
40224023 for (i = 0; i < scan_req->n_channels; i++) {
40234024 chan = scan_req->channels[i];
40244025 chan_radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, chan);
4025− /*
4026− * The chan_radio_idx should be valid since it's taken from a
4027− * valid scan request.
4028− * However, if chan_radio_idx is unexpectedly invalid (negative),
4029− * we take a conservative approach and assume the scan request
4030− * might use the specified radio_idx. Hence, return true.
4031− */
4032− if (WARN_ON(chan_radio_idx < 0))
4033− return true;
40344026
4027+ /* The radio index either matched successfully, or an error
4028+ * occurred. For example, if radio-level information is
4029+ * missing, the same error value is returned. This
4030+ * typically implies a single-radio setup, in which case
4031+ * the operation should not be allowed.
4032+ */
40354033 if (chan_radio_idx == radio_idx)
40364034 return true;
40374035 }
net/wireless/core.c+9−0
@@ -1018,6 +1018,15 @@ int wiphy_register(struct wiphy *wiphy) · 1017 unmodified lines
10181018
10191019 rdev->wiphy.features |= NL80211_FEATURE_SCAN_FLUSH;
10201020
1021+ if (rdev->wiphy.bss_param_support & WIPHY_BSS_PARAM_P2P_CTWINDOW)
1022+ rdev->wiphy.features |= NL80211_FEATURE_P2P_GO_CTWIN;
1023+ else if (rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN)
1024+ rdev->wiphy.bss_param_support |= WIPHY_BSS_PARAM_P2P_CTWINDOW;
1025+ if (rdev->wiphy.bss_param_support & WIPHY_BSS_PARAM_P2P_OPPPS)
1026+ rdev->wiphy.features |= NL80211_FEATURE_P2P_GO_OPPPS;
1027+ else if (rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS)
1028+ rdev->wiphy.bss_param_support |= WIPHY_BSS_PARAM_P2P_OPPPS;
1029+
10211030 rtnl_lock();
10221031 wiphy_lock(&rdev->wiphy);
10231032 res = device_add(&rdev->wiphy.dev);
net/wireless/ethtool.c+1−1
@@ -23,7 +23,7 @@ void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) · 22 unmodified lines
2323 else
2424 strscpy(info->fw_version, "N/A", sizeof(info->fw_version));
2525
26− strscpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)),
26+ strscpy(info->bus_info, dev_name(pdev),
2727 sizeof(info->bus_info));
2828 }
2929 EXPORT_SYMBOL(cfg80211_get_drvinfo);
net/wireless/nl80211.c+305−13
@@ -411,6 +411,14 @@ static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = { · 410 unmodified lines
411411 [NL80211_TXRATE_HE_LTF] = NLA_POLICY_RANGE(NLA_U8,
412412 NL80211_RATE_INFO_HE_1XLTF,
413413 NL80211_RATE_INFO_HE_4XLTF),
414+ [NL80211_TXRATE_EHT] = NLA_POLICY_EXACT_LEN(sizeof(struct nl80211_txrate_eht)),
415+ [NL80211_TXRATE_EHT_GI] = NLA_POLICY_RANGE(NLA_U8,
416+ NL80211_RATE_INFO_EHT_GI_0_8,
417+ NL80211_RATE_INFO_EHT_GI_3_2),
418+ [NL80211_TXRATE_EHT_LTF] = NLA_POLICY_RANGE(NLA_U8,
419+ NL80211_RATE_INFO_EHT_1XLTF,
420+ NL80211_RATE_INFO_EHT_8XLTF),
421+
414422 };
415423
416424 static const struct nla_policy
@@ -871,6 +879,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 454 unmodified lines
871879 [NL80211_ATTR_S1G_LONG_BEACON_PERIOD] = NLA_POLICY_MIN(NLA_U8, 2),
872880 [NL80211_ATTR_S1G_SHORT_BEACON] =
873881 NLA_POLICY_NESTED(nl80211_s1g_short_beacon),
882+ [NL80211_ATTR_BSS_PARAM] = { .type = NLA_FLAG },
874883 };
875884
876885 /* policy for the key attributes */
@@ -3019,6 +3028,40 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, · 2142 unmodified lines
30193028 rdev->wiphy.ext_features))
30203029 goto nla_put_failure;
30213030
3031+ if (rdev->wiphy.bss_param_support) {
3032+ struct nlattr *nested;
3033+ u32 parsup = rdev->wiphy.bss_param_support;
3034+
3035+ nested = nla_nest_start(msg, NL80211_ATTR_BSS_PARAM);
3036+ if (!nested)
3037+ goto nla_put_failure;
3038+
3039+ if ((parsup & WIPHY_BSS_PARAM_CTS_PROT) &&
3040+ nla_put_flag(msg, NL80211_ATTR_BSS_CTS_PROT))
3041+ goto nla_put_failure;
3042+ if ((parsup & WIPHY_BSS_PARAM_SHORT_PREAMBLE) &&
3043+ nla_put_flag(msg, NL80211_ATTR_BSS_SHORT_PREAMBLE))
3044+ goto nla_put_failure;
3045+ if ((parsup & WIPHY_BSS_PARAM_SHORT_SLOT_TIME) &&
3046+ nla_put_flag(msg, NL80211_ATTR_BSS_SHORT_SLOT_TIME))
3047+ goto nla_put_failure;
3048+ if ((parsup & WIPHY_BSS_PARAM_BASIC_RATES) &&
3049+ nla_put_flag(msg, NL80211_ATTR_BSS_BASIC_RATES))
3050+ goto nla_put_failure;
3051+ if ((parsup & WIPHY_BSS_PARAM_AP_ISOLATE) &&
3052+ nla_put_flag(msg, NL80211_ATTR_AP_ISOLATE))
3053+ goto nla_put_failure;
3054+ if ((parsup & WIPHY_BSS_PARAM_HT_OPMODE) &&
3055+ nla_put_flag(msg, NL80211_ATTR_BSS_HT_OPMODE))
3056+ goto nla_put_failure;
3057+ if ((parsup & WIPHY_BSS_PARAM_P2P_CTWINDOW) &&
3058+ nla_put_flag(msg, NL80211_ATTR_P2P_CTWINDOW))
3059+ goto nla_put_failure;
3060+ if ((parsup & WIPHY_BSS_PARAM_P2P_OPPPS) &&
3061+ nla_put_flag(msg, NL80211_ATTR_P2P_OPPPS))
3062+ goto nla_put_failure;
3063+ nla_nest_end(msg, nested);
3064+ }
30223065 if (rdev->wiphy.bss_select_support) {
30233066 struct nlattr *nested;
30243067 u32 bss_select_support = rdev->wiphy.bss_select_support;
@@ -5393,6 +5436,164 @@ static bool he_set_mcs_mask(struct genl_info *info, · 2368 unmodified lines
53935436 return true;
53945437 }
53955438
5439+static void eht_build_mcs_mask(struct genl_info *info,
5440+ const struct ieee80211_sta_eht_cap *eht_cap,
5441+ u8 mcs_nss_len, u16 *mcs_mask)
5442+{
5443+ struct net_device *dev = info->user_ptr[1];
5444+ struct wireless_dev *wdev = dev->ieee80211_ptr;
5445+ u8 nss, mcs_7 = 0, mcs_9 = 0, mcs_11 = 0, mcs_13 = 0;
5446+ unsigned int link_id = nl80211_link_id(info->attrs);
5447+
5448+ if (mcs_nss_len == 4) {
5449+ const struct ieee80211_eht_mcs_nss_supp_20mhz_only *mcs =
5450+ &eht_cap->eht_mcs_nss_supp.only_20mhz;
5451+
5452+ mcs_7 = u8_get_bits(mcs->rx_tx_mcs7_max_nss,
5453+ IEEE80211_EHT_MCS_NSS_TX);
5454+ mcs_9 = u8_get_bits(mcs->rx_tx_mcs9_max_nss,
5455+ IEEE80211_EHT_MCS_NSS_TX);
5456+ mcs_11 = u8_get_bits(mcs->rx_tx_mcs11_max_nss,
5457+ IEEE80211_EHT_MCS_NSS_TX);
5458+ mcs_13 = u8_get_bits(mcs->rx_tx_mcs13_max_nss,
5459+ IEEE80211_EHT_MCS_NSS_TX);
5460+
5461+ } else {
5462+ const struct ieee80211_eht_mcs_nss_supp_bw *mcs;
5463+ enum nl80211_chan_width width;
5464+
5465+ switch (wdev->iftype) {
5466+ case NL80211_IFTYPE_ADHOC:
5467+ width = wdev->u.ibss.chandef.width;
5468+ break;
5469+ case NL80211_IFTYPE_MESH_POINT:
5470+ width = wdev->u.mesh.chandef.width;
5471+ break;
5472+ case NL80211_IFTYPE_OCB:
5473+ width = wdev->u.ocb.chandef.width;
5474+ break;
5475+ default:
5476+ if (wdev->valid_links)
5477+ width = wdev->links[link_id].ap.chandef.width;
5478+ else
5479+ width = wdev->u.ap.preset_chandef.width;
5480+ break;
5481+ }
5482+
5483+ switch (width) {
5484+ case NL80211_CHAN_WIDTH_320:
5485+ mcs = &eht_cap->eht_mcs_nss_supp.bw._320;
5486+ break;
5487+ case NL80211_CHAN_WIDTH_160:
5488+ mcs = &eht_cap->eht_mcs_nss_supp.bw._160;
5489+ break;
5490+ default:
5491+ mcs = &eht_cap->eht_mcs_nss_supp.bw._80;
5492+ break;
5493+ }
5494+
5495+ mcs_7 = u8_get_bits(mcs->rx_tx_mcs9_max_nss,
5496+ IEEE80211_EHT_MCS_NSS_TX);
5497+ mcs_9 = u8_get_bits(mcs->rx_tx_mcs9_max_nss,
5498+ IEEE80211_EHT_MCS_NSS_TX);
5499+ mcs_11 = u8_get_bits(mcs->rx_tx_mcs11_max_nss,
5500+ IEEE80211_EHT_MCS_NSS_TX);
5501+ mcs_13 = u8_get_bits(mcs->rx_tx_mcs13_max_nss,
5502+ IEEE80211_EHT_MCS_NSS_TX);
5503+ }
5504+
5505+ /* Enable MCS 14 for NSS 0 */
5506+ if (eht_cap->eht_cap_elem.phy_cap_info[6] &
5507+ IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP)
5508+ mcs_mask[0] |= 0x4000;
5509+
5510+ /* Enable MCS 15 for NSS 0 */
5511+ mcs_mask[0] |= 0x8000;
5512+
5513+ for (nss = 0; nss < NL80211_EHT_NSS_MAX; nss++) {
5514+ if (!mcs_7)
5515+ continue;
5516+ mcs_mask[nss] |= 0x00FF;
5517+ mcs_7--;
5518+
5519+ if (!mcs_9)
5520+ continue;
5521+ mcs_mask[nss] |= 0x0300;
5522+ mcs_9--;
5523+
5524+ if (!mcs_11)
5525+ continue;
5526+ mcs_mask[nss] |= 0x0C00;
5527+ mcs_11--;
5528+
5529+ if (!mcs_13)
5530+ continue;
5531+ mcs_mask[nss] |= 0x3000;
5532+ mcs_13--;
5533+ }
5534+}
5535+
5536+static bool eht_set_mcs_mask(struct genl_info *info, struct wireless_dev *wdev,
5537+ struct ieee80211_supported_band *sband,
5538+ struct nl80211_txrate_eht *txrate,
5539+ u16 mcs[NL80211_EHT_NSS_MAX])
5540+{
5541+ const struct ieee80211_sta_he_cap *he_cap;
5542+ const struct ieee80211_sta_eht_cap *eht_cap;
5543+ u16 tx_mcs_mask[NL80211_EHT_NSS_MAX] = { 0 };
5544+ u8 i, mcs_nss_len;
5545+
5546+ he_cap = ieee80211_get_he_iftype_cap(sband, wdev->iftype);
5547+ if (!he_cap)
5548+ return false;
5549+
5550+ eht_cap = ieee80211_get_eht_iftype_cap(sband, wdev->iftype);
5551+ if (!eht_cap)
5552+ return false;
5553+
5554+ /* Checks for MCS 14 */
5555+ if (txrate->mcs[0] & 0x4000) {
5556+ if (sband->band != NL80211_BAND_6GHZ)
5557+ return false;
5558+
5559+ if (!(eht_cap->eht_cap_elem.phy_cap_info[6] &
5560+ IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP))
5561+ return false;
5562+ }
5563+
5564+ mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem,
5565+ &eht_cap->eht_cap_elem,
5566+ wdev->iftype ==
5567+ NL80211_IFTYPE_STATION);
5568+
5569+ if (mcs_nss_len == 3) {
5570+ /* Supported iftypes for setting non-20 MHZ only EHT MCS */
5571+ switch (wdev->iftype) {
5572+ case NL80211_IFTYPE_ADHOC:
5573+ case NL80211_IFTYPE_AP:
5574+ case NL80211_IFTYPE_P2P_GO:
5575+ case NL80211_IFTYPE_MESH_POINT:
5576+ case NL80211_IFTYPE_OCB:
5577+ break;
5578+ default:
5579+ return false;
5580+ }
5581+ }
5582+
5583+ /* Build eht_mcs_mask from EHT and HE capabilities */
5584+ eht_build_mcs_mask(info, eht_cap, mcs_nss_len, tx_mcs_mask);
5585+
5586+ memset(mcs, 0, sizeof(u16) * NL80211_EHT_NSS_MAX);
5587+ for (i = 0; i < NL80211_EHT_NSS_MAX; i++) {
5588+ if ((tx_mcs_mask[i] & txrate->mcs[i]) == txrate->mcs[i])
5589+ mcs[i] = txrate->mcs[i];
5590+ else
5591+ return false;
5592+ }
5593+
5594+ return true;
5595+}
5596+
53965597 static int nl80211_parse_tx_bitrate_mask(struct genl_info *info,
53975598 struct nlattr *attrs[],
53985599 enum nl80211_attrs attr,
@@ -5413,6 +5614,8 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, · 14 unmodified lines
54135614 /* Default to all rates enabled */
54145615 for (i = 0; i < NUM_NL80211_BANDS; i++) {
54155616 const struct ieee80211_sta_he_cap *he_cap;
5617+ const struct ieee80211_sta_eht_cap *eht_cap;
5618+ u8 mcs_nss_len;
54165619
54175620 if (!default_all_enabled)
54185621 break;
@@ -5441,6 +5644,21 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, · 22 unmodified lines
54415644
54425645 mask->control[i].he_gi = 0xFF;
54435646 mask->control[i].he_ltf = 0xFF;
5647+
5648+ eht_cap = ieee80211_get_eht_iftype_cap(sband, wdev->iftype);
5649+ if (!eht_cap)
5650+ continue;
5651+
5652+ mcs_nss_len = ieee80211_eht_mcs_nss_size(&he_cap->he_cap_elem,
5653+ &eht_cap->eht_cap_elem,
5654+ wdev->iftype ==
5655+ NL80211_IFTYPE_STATION);
5656+
5657+ eht_build_mcs_mask(info, eht_cap, mcs_nss_len,
5658+ mask->control[i].eht_mcs);
5659+
5660+ mask->control[i].eht_gi = 0xFF;
5661+ mask->control[i].eht_ltf = 0xFF;
54445662 }
54455663
54465664 /* if no rates are given set it back to the defaults */
@@ -5512,13 +5730,27 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, · 65 unmodified lines
55125730 mask->control[band].he_ltf =
55135731 nla_get_u8(tb[NL80211_TXRATE_HE_LTF]);
55145732
5733+ if (tb[NL80211_TXRATE_EHT] &&
5734+ !eht_set_mcs_mask(info, wdev, sband,
5735+ nla_data(tb[NL80211_TXRATE_EHT]),
5736+ mask->control[band].eht_mcs))
5737+ return -EINVAL;
5738+
5739+ if (tb[NL80211_TXRATE_EHT_GI])
5740+ mask->control[band].eht_gi =
5741+ nla_get_u8(tb[NL80211_TXRATE_EHT_GI]);
5742+ if (tb[NL80211_TXRATE_EHT_LTF])
5743+ mask->control[band].eht_ltf =
5744+ nla_get_u8(tb[NL80211_TXRATE_EHT_LTF]);
5745+
55155746 if (mask->control[band].legacy == 0) {
5516− /* don't allow empty legacy rates if HT, VHT or HE
5747+ /* don't allow empty legacy rates if HT, VHT, HE or EHT
55175748 * are not even supported.
55185749 */
55195750 if (!(rdev->wiphy.bands[band]->ht_cap.ht_supported ||
55205751 rdev->wiphy.bands[band]->vht_cap.vht_supported ||
5521− ieee80211_get_he_iftype_cap(sband, wdev->iftype)))
5752+ ieee80211_get_he_iftype_cap(sband, wdev->iftype) ||
5753+ ieee80211_get_eht_iftype_cap(sband, wdev->iftype)))
55225754 return -EINVAL;
55235755
55245756 for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++)
@@ -5533,6 +5765,10 @@ static int nl80211_parse_tx_bitrate_mask(struct genl_info *info, · 8 unmodified lines
55335765 if (mask->control[band].he_mcs[i])
55345766 goto out;
55355767
5768+ for (i = 0; i < NL80211_EHT_NSS_MAX; i++)
5769+ if (mask->control[band].eht_mcs[i])
5770+ goto out;
5771+
55365772 /* legacy and mcs rates may not be both empty */
55375773 return -EINVAL;
55385774 }
@@ -5546,7 +5782,7 @@ static int validate_beacon_tx_rate(struct cfg80211_registered_device *rdev, · 7 unmodified lines
55465782 enum nl80211_band band,
55475783 struct cfg80211_bitrate_mask *beacon_rate)
55485784 {
5549− u32 count_ht, count_vht, count_he, i;
5785+ u32 count_ht, count_vht, count_he, count_eht, i;
55505786 u32 rate = beacon_rate->control[band].legacy;
55515787
55525788 /* Allow only one rate */
@@ -5592,8 +5828,21 @@ static int validate_beacon_tx_rate(struct cfg80211_registered_device *rdev, · 39 unmodified lines
55925828 return -EINVAL;
55935829 }
55945830
5595− if ((count_ht && count_vht && count_he) ||
5596− (!rate && !count_ht && !count_vht && !count_he))
5831+ count_eht = 0;
5832+ for (i = 0; i < NL80211_EHT_NSS_MAX; i++) {
5833+ if (hweight16(beacon_rate->control[band].eht_mcs[i]) > 1) {
5834+ return -EINVAL;
5835+ } else if (beacon_rate->control[band].eht_mcs[i]) {
5836+ count_eht++;
5837+ if (count_eht > 1)
5838+ return -EINVAL;
5839+ }
5840+ if (count_eht && rate)
5841+ return -EINVAL;
5842+ }
5843+
5844+ if ((count_ht && count_vht && count_he && count_eht) ||
5845+ (!rate && !count_ht && !count_vht && !count_he && !count_eht))
55975846 return -EINVAL;
55985847
55995848 if (rate &&
@@ -5613,6 +5862,11 @@ static int validate_beacon_tx_rate(struct cfg80211_registered_device *rdev, · 13 unmodified lines
56135862 NL80211_EXT_FEATURE_BEACON_RATE_HE))
56145863 return -EINVAL;
56155864
5865+ if (count_eht &&
5866+ !wiphy_ext_feature_isset(&rdev->wiphy,
5867+ NL80211_EXT_FEATURE_BEACON_RATE_EHT))
5868+ return -EINVAL;
5869+
56165870 return 0;
56175871 }
56185872
@@ -8830,6 +9084,9 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 3211 unmodified lines
88309084 struct cfg80211_registered_device *rdev = info->user_ptr[0];
88319085 struct net_device *dev = info->user_ptr[1];
88329086 struct bss_parameters params;
9087+ u32 bss_param_support = rdev->wiphy.bss_param_support;
9088+ u32 changed = 0;
9089+ bool strict;
88339090
88349091 memset(&params, 0, sizeof(params));
88359092 params.link_id = nl80211_link_id_or_invalid(info->attrs);
@@ -8842,26 +9099,54 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 6 unmodified lines
88429099 params.p2p_ctwindow = -1;
88439100 params.p2p_opp_ps = -1;
88449101
8845− if (info->attrs[NL80211_ATTR_BSS_CTS_PROT])
9102+ strict = nla_get_flag(info->attrs[NL80211_ATTR_BSS_PARAM]);
9103+ if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) {
9104+ if (strict && !(bss_param_support & WIPHY_BSS_PARAM_CTS_PROT))
9105+ return -EINVAL;
88469106 params.use_cts_prot =
88479107 nla_get_u8(info->attrs[NL80211_ATTR_BSS_CTS_PROT]);
8848− if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE])
9108+ changed |= WIPHY_BSS_PARAM_CTS_PROT;
9109+ }
9110+ if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]) {
9111+ if (strict &&
9112+ !(bss_param_support & WIPHY_BSS_PARAM_SHORT_PREAMBLE))
9113+ return -EINVAL;
88499114 params.use_short_preamble =
88509115 nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]);
8851− if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME])
9116+ changed |= WIPHY_BSS_PARAM_SHORT_PREAMBLE;
9117+ }
9118+ if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) {
9119+ if (strict &&
9120+ !(bss_param_support & WIPHY_BSS_PARAM_SHORT_SLOT_TIME))
9121+ return -EINVAL;
88529122 params.use_short_slot_time =
88539123 nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]);
9124+ changed |= WIPHY_BSS_PARAM_SHORT_SLOT_TIME;
9125+ }
88549126 if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) {
9127+ if (strict &&
9128+ !(bss_param_support & WIPHY_BSS_PARAM_BASIC_RATES))
9129+ return -EINVAL;
88559130 params.basic_rates =
88569131 nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
88579132 params.basic_rates_len =
88589133 nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]);
9134+ changed |= WIPHY_BSS_PARAM_BASIC_RATES;
9135+ }
9136+ if (info->attrs[NL80211_ATTR_AP_ISOLATE]) {
9137+ if (strict && !(bss_param_support & WIPHY_BSS_PARAM_AP_ISOLATE))
9138+ return -EINVAL;
9139+ params.ap_isolate =
9140+ !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]);
9141+ changed |= WIPHY_BSS_PARAM_AP_ISOLATE;
88599142 }
8860− if (info->attrs[NL80211_ATTR_AP_ISOLATE])
8861− params.ap_isolate = !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]);
8862− if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE])
9143+ if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE]) {
9144+ if (strict && !(bss_param_support & WIPHY_BSS_PARAM_HT_OPMODE))
9145+ return -EINVAL;
88639146 params.ht_opmode =
88649147 nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]);
9148+ changed |= WIPHY_BSS_PARAM_HT_OPMODE;
9149+ }
88659150
88669151 if (info->attrs[NL80211_ATTR_P2P_CTWINDOW]) {
88679152 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
@@ -8869,8 +9154,9 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 1 unmodified line
88699154 params.p2p_ctwindow =
88709155 nla_get_u8(info->attrs[NL80211_ATTR_P2P_CTWINDOW]);
88719156 if (params.p2p_ctwindow != 0 &&
8872− !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_CTWIN))
9157+ !(bss_param_support & WIPHY_BSS_PARAM_P2P_CTWINDOW))
88739158 return -EINVAL;
9159+ changed |= WIPHY_BSS_PARAM_P2P_CTWINDOW;
88749160 }
88759161
88769162 if (info->attrs[NL80211_ATTR_P2P_OPPPS]) {
@@ -8879,9 +9165,11 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 2 unmodified lines
88799165 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
88809166 return -EINVAL;
88819167 tmp = nla_get_u8(info->attrs[NL80211_ATTR_P2P_OPPPS]);
9168+ if (tmp && !(bss_param_support & WIPHY_BSS_PARAM_P2P_OPPPS))
9169+ return -EINVAL;
88829170 params.p2p_opp_ps = tmp;
88839171 if (params.p2p_opp_ps &&
8884− !(rdev->wiphy.features & NL80211_FEATURE_P2P_GO_OPPPS))
9172+ !(rdev->wiphy.bss_param_support & WIPHY_BSS_PARAM_P2P_OPPPS))
88859173 return -EINVAL;
88869174 }
88879175
@@ -8892,6 +9180,10 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) · 4 unmodified lines
88929180 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
88939181 return -EOPNOTSUPP;
88949182
9183+ changed &= rdev->wiphy.bss_param_support;
9184+ if (!changed)
9185+ return 0;
9186+
88959187 return rdev_change_bss(rdev, dev, &params);
88969188 }
88979189
net/wireless/scan.c+7−2
@@ -1816,6 +1816,9 @@ static void cfg80211_update_hidden_bsses(struct cfg80211_internal_bss *known, · 1815 unmodified lines
18161816 WARN_ON(ies != old_ies);
18171817
18181818 rcu_assign_pointer(bss->pub.beacon_ies, new_ies);
1819+
1820+ bss->ts = known->ts;
1821+ bss->pub.ts_boottime = known->pub.ts_boottime;
18191822 }
18201823 }
18211824
@@ -1882,6 +1885,10 @@ cfg80211_update_known_bss(struct cfg80211_registered_device *rdev, · 60 unmodified lines
18821885 {
18831886 lockdep_assert_held(&rdev->bss_lock);
18841887
1888+ /* Update time stamps */
1889+ known->ts = new->ts;
1890+ known->pub.ts_boottime = new->pub.ts_boottime;
1891+
18851892 /* Update IEs */
18861893 if (rcu_access_pointer(new->pub.proberesp_ies)) {
18871894 const struct cfg80211_bss_ies *old;
@@ -1945,8 +1952,6 @@ cfg80211_update_known_bss(struct cfg80211_registered_device *rdev, · 57 unmodified lines
19451952 if (signal_valid)
19461953 known->pub.signal = new->pub.signal;
19471954 known->pub.capability = new->pub.capability;
1948− known->ts = new->ts;
1949− known->pub.ts_boottime = new->pub.ts_boottime;
19501955 known->parent_tsf = new->parent_tsf;
19511956 known->pub.chains = new->pub.chains;
19521957 memcpy(known->pub.chain_signal, new->pub.chain_signal,
net/wireless/trace.h+0−56
@@ -3137,23 +3137,6 @@ DEFINE_EVENT(cfg80211_netdev_mac_evt, cfg80211_notify_new_peer_candidate, · 3136 unmodified lines
31373137 TP_ARGS(netdev, macaddr)
31383138 );
31393139
3140−DECLARE_EVENT_CLASS(netdev_evt_only,
3141− TP_PROTO(struct net_device *netdev),
3142− TP_ARGS(netdev),
3143− TP_STRUCT__entry(
3144− NETDEV_ENTRY
3145− ),
3146− TP_fast_assign(
3147− NETDEV_ASSIGN;
3148− ),
3149− TP_printk(NETDEV_PR_FMT , NETDEV_PR_ARG)
3150−);
3151−
3152−DEFINE_EVENT(netdev_evt_only, cfg80211_send_rx_auth,
3153− TP_PROTO(struct net_device *netdev),
3154− TP_ARGS(netdev)
3155−);
3156−
31573140 TRACE_EVENT(cfg80211_send_rx_assoc,
31583141 TP_PROTO(struct net_device *netdev,
31593142 const struct cfg80211_rx_assoc_resp_data *data),
@@ -3480,21 +3463,6 @@ TRACE_EVENT(cfg80211_reg_can_beacon, · 320 unmodified lines
34803463 __entry->prohibited_flags, __entry->permitting_flags)
34813464 );
34823465
3483−TRACE_EVENT(cfg80211_chandef_dfs_required,
3484− TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef),
3485− TP_ARGS(wiphy, chandef),
3486− TP_STRUCT__entry(
3487− WIPHY_ENTRY
3488− CHAN_DEF_ENTRY
3489− ),
3490− TP_fast_assign(
3491− WIPHY_ASSIGN;
3492− CHAN_DEF_ASSIGN(chandef);
3493− ),
3494− TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT,
3495− WIPHY_PR_ARG, CHAN_DEF_PR_ARG)
3496−);
3497−
34983466 TRACE_EVENT(cfg80211_ch_switch_notify,
34993467 TP_PROTO(struct net_device *netdev,
35003468 struct cfg80211_chan_def *chandef,
@@ -3862,30 +3830,6 @@ DEFINE_EVENT(cfg80211_bss_evt, cfg80211_return_bss, · 361 unmodified lines
38623830 TP_ARGS(pub)
38633831 );
38643832
3865−TRACE_EVENT(cfg80211_return_uint,
3866− TP_PROTO(unsigned int ret),
3867− TP_ARGS(ret),
3868− TP_STRUCT__entry(
3869− __field(unsigned int, ret)
3870− ),
3871− TP_fast_assign(
3872− __entry->ret = ret;
3873− ),
3874− TP_printk("ret: %d", __entry->ret)
3875−);
3876−
3877−TRACE_EVENT(cfg80211_return_u32,
3878− TP_PROTO(u32 ret),
3879− TP_ARGS(ret),
3880− TP_STRUCT__entry(
3881− __field(u32, ret)
3882− ),
3883− TP_fast_assign(
3884− __entry->ret = ret;
3885− ),
3886− TP_printk("ret: %u", __entry->ret)
3887−);
3888−
38893833 TRACE_EVENT(cfg80211_report_wowlan_wakeup,
38903834 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
38913835 struct cfg80211_wowlan_wakeup *wakeup),
net/wireless/util.c+1−1
@@ -2584,7 +2584,7 @@ int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy, · 2583 unmodified lines
25842584 }
25852585 }
25862586
2587− return -ENOENT;
2587+ return -EINVAL;
25882588 }
25892589 EXPORT_SYMBOL(cfg80211_get_radio_idx_by_chan);
25902590

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t