History

Merge tag 'wireless-next-2023-08-25' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next

Kalle Valo says: ==================== wireless-next patches for v6.6 The second pull request for v6.6, this time with both stack and driver changes. Unusually we have only one major new feature but lots of small cleanup all over, I guess this is due to people have been on vacation the last month. Major changes: rtw89 - Introduce Time Averaged SAR (TAS) support * tag 'wireless-next-2023-08-25' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (114 commits) wifi: rtlwifi: rtl8723: Remove unused function rtl8723_cmd_send_packet() wifi: rtw88: usb: kill and free rx urbs on probe failure wifi: rtw89: Fix clang -Wimplicit-fallthrough in rtw89_query_sar() wifi: rtw89: phy: modify register setting of ENV_MNTR, PHYSTS and DIG wifi: rtw89: phy: add phy_gen_def::cr_base to support WiFi 7 chips wifi: rtw89: mac: define register address of rx_filter to generalize code wifi: rtw89: mac: define internal memory address for WiFi 7 chip wifi: rtw89: mac: generalize code to indirectly access WiFi internal memory wifi: rtw89: mac: add mac_gen_def::band1_offset to map MAC band1 register address wifi: wlcore: sdio: Use module_sdio_driver macro to simplify the code wifi: rtw89: initialize multi-channel handling wifi: rtw89: provide functions to configure NoA for beacon update wifi: rtw89: call rtw89_chan_get() by vif chanctx if aware of vif wifi: rtw89: sar: let caller decide the center frequency to query wifi: rtw89: refine rtw89_correct_cck_chan() by rtw89_hw_to_nl80211_band() wifi: rtw89: add function prototype for coex request duration Fix nomenclature for USB and PCI wireless devices wifi: ath: Use is_multicast_ether_addr() to check multicast Ether address wifi: ath12k: Remove unused declarations wifi: ath12k: add check max message length while scanning with extraie ... ====================

Jakub Kicinski committed 3 years ago

Commit 1fa6ffa2 parents 3db3474 4dddbad150 files · +2232 −1155Browse files

Unified · Split

150 files
  1. drivers/net/wireless/ath/ath10k/ahb.c +1 −1
  2. drivers/net/wireless/ath/ath10k/htt.h +2 −2
  3. drivers/net/wireless/ath/ath10k/pci.c +2 −2
  4. drivers/net/wireless/ath/ath10k/sdio.c +1 −1
  5. drivers/net/wireless/ath/ath10k/usb.c +1 −1
  6. drivers/net/wireless/ath/ath10k/wmi.h +4 −4
  7. drivers/net/wireless/ath/ath11k/ahb.c +2 −12
  8. drivers/net/wireless/ath/ath11k/ce.h +0 −3
  9. drivers/net/wireless/ath/ath11k/dp.h +1 −1
  10. drivers/net/wireless/ath/ath11k/dp_rx.c +1 −1
  11. drivers/net/wireless/ath/ath11k/dp_tx.c +6 −6
  12. drivers/net/wireless/ath/ath11k/mac.c +32 −32
  13. drivers/net/wireless/ath/ath11k/pci.c +1 −1
  14. drivers/net/wireless/ath/ath11k/qmi.h +0 −2
  15. drivers/net/wireless/ath/ath11k/testmode.c +1 −1
  16. drivers/net/wireless/ath/ath12k/ce.h +0 −3
  17. drivers/net/wireless/ath/ath12k/core.h +0 −1
  18. drivers/net/wireless/ath/ath12k/dp.c +29 −1
  19. drivers/net/wireless/ath/ath12k/dp.h +3 −1
  20. drivers/net/wireless/ath/ath12k/dp_rx.c +1 −1
  21. drivers/net/wireless/ath/ath12k/dp_tx.c +1 −1
  22. drivers/net/wireless/ath/ath12k/mac.c +3 −4
  23. drivers/net/wireless/ath/ath12k/pci.c +1 −1
  24. drivers/net/wireless/ath/ath12k/qmi.h +0 −2
  25. drivers/net/wireless/ath/ath12k/rx_desc.h +1 −1
  26. drivers/net/wireless/ath/ath12k/wmi.c +13 −7
  27. drivers/net/wireless/ath/ath12k/wmi.h +0 −2
  28. drivers/net/wireless/ath/ath5k/ahb.c +0 −1
  29. drivers/net/wireless/ath/ath5k/mac80211-ops.c +0 −1
  30. drivers/net/wireless/ath/ath5k/phy.c +13 −16
  31. drivers/net/wireless/ath/ath9k/ath9k.h +0 −1
  32. drivers/net/wireless/ath/ath9k/common-spectral.c +16 −37
  33. drivers/net/wireless/ath/ath9k/common.h +0 −2
  34. drivers/net/wireless/ath/ath9k/debug.c +34 −74
  35. drivers/net/wireless/ath/ath9k/dfs_debug.c +4 −10
  36. drivers/net/wireless/ath/ath9k/eeprom_9287.c +1 −2
  37. drivers/net/wireless/ath/ath9k/hif_usb.c +1 −1
  38. drivers/net/wireless/ath/ath9k/htc_drv_debug.c +5 −10
  39. drivers/net/wireless/ath/ath9k/htc_drv_main.c +1 −2
  40. drivers/net/wireless/ath/ath9k/main.c +0 −1
  41. drivers/net/wireless/ath/ath9k/tx99.c +4 −10
  42. drivers/net/wireless/ath/ath9k/wmi.c +12 −8
  43. drivers/net/wireless/ath/key.c +1 −1
  44. drivers/net/wireless/atmel/at76c50x-usb.c +4 −4
  45. drivers/net/wireless/intel/ipw2x00/ipw2200.c +12 −27
  46. drivers/net/wireless/intel/iwlwifi/fw/acpi.c +5 −0
  47. drivers/net/wireless/intel/iwlwifi/fw/api/debug.h +7 −2
  48. drivers/net/wireless/intel/iwlwifi/fw/dump.c +1 −2
  49. drivers/net/wireless/intel/iwlwifi/iwl-fh.h +2 −0
  50. drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +2 −0
  51. drivers/net/wireless/intel/iwlwifi/iwl-trans.h +5 −2
  52. drivers/net/wireless/intel/iwlwifi/mei/main.c +36 −34
  53. drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +3 −8
  54. drivers/net/wireless/intel/iwlwifi/pcie/drv.c +1 −10
  55. drivers/net/wireless/intel/iwlwifi/pcie/internal.h +1 −3
  56. drivers/net/wireless/intel/iwlwifi/pcie/rx.c +1 −1
  57. drivers/net/wireless/intel/iwlwifi/pcie/trans.c +29 −2
  58. drivers/net/wireless/intel/iwlwifi/pcie/tx.c +6 −18
  59. drivers/net/wireless/intel/iwlwifi/queue/tx.c +78 −64
  60. drivers/net/wireless/intel/iwlwifi/queue/tx.h +16 −10
  61. drivers/net/wireless/intersil/orinoco/orinoco_usb.c +6 −6
  62. drivers/net/wireless/legacy/rndis_wlan.c +1 −1
  63. drivers/net/wireless/marvell/mwifiex/debugfs.c +15 −4
  64. drivers/net/wireless/marvell/mwifiex/decl.h +0 −1
  65. drivers/net/wireless/marvell/mwifiex/init.c +0 −2
  66. drivers/net/wireless/marvell/mwifiex/main.h +4 −16
  67. drivers/net/wireless/marvell/mwifiex/scan.c +1 −6
  68. drivers/net/wireless/marvell/mwifiex/sdio.c +14 −12
  69. drivers/net/wireless/marvell/mwifiex/sta_rx.c +1 −0
  70. drivers/net/wireless/marvell/mwifiex/sta_tx.c +2 −13
  71. drivers/net/wireless/marvell/mwifiex/txrx.c +26 −18
  72. drivers/net/wireless/marvell/mwifiex/uap_txrx.c +12 −14
  73. drivers/net/wireless/mediatek/mt76/mt7603/Kconfig +1 −1
  74. drivers/net/wireless/mediatek/mt76/mt7615/Kconfig +1 −1
  75. drivers/net/wireless/mediatek/mt76/mt76x0/Kconfig +2 −2
  76. drivers/net/wireless/mediatek/mt76/mt76x2/Kconfig +2 −2
  77. drivers/net/wireless/mediatek/mt76/mt7915/Kconfig +1 −1
  78. drivers/net/wireless/mediatek/mt76/mt7996/Kconfig +1 −1
  79. drivers/net/wireless/mediatek/mt7601u/Kconfig +1 −1
  80. drivers/net/wireless/microchip/wilc1000/cfg80211.h +0 −4
  81. drivers/net/wireless/purelifi/plfxlc/Kconfig +1 −1
  82. drivers/net/wireless/ralink/rt2x00/Kconfig +1 −1
  83. drivers/net/wireless/ralink/rt2x00/rt2800lib.c +41 −18
  84. drivers/net/wireless/realtek/rtlwifi/core.c +1 −1
  85. drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c +0 −28
  86. drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.h +0 −2
  87. drivers/net/wireless/realtek/rtw88/pci.c +1 −1
  88. drivers/net/wireless/realtek/rtw88/usb.c +5 −2
  89. drivers/net/wireless/realtek/rtw89/chan.c +124 −0
  90. drivers/net/wireless/realtek/rtw89/chan.h +5 −0
  91. drivers/net/wireless/realtek/rtw89/coex.c +2 −1
  92. drivers/net/wireless/realtek/rtw89/coex.h +9 −0
  93. drivers/net/wireless/realtek/rtw89/core.c +91 −33
  94. drivers/net/wireless/realtek/rtw89/core.h +104 −0
  95. drivers/net/wireless/realtek/rtw89/debug.c +17 −9
  96. drivers/net/wireless/realtek/rtw89/fw.c +19 −5
  97. drivers/net/wireless/realtek/rtw89/mac.c +108 −89
  98. drivers/net/wireless/realtek/rtw89/mac.h +55 −14
  99. drivers/net/wireless/realtek/rtw89/mac80211.c +10 −4
  100. drivers/net/wireless/realtek/rtw89/mac_be.c +38 −0
  101. drivers/net/wireless/realtek/rtw89/pci.c +1 −1
  102. drivers/net/wireless/realtek/rtw89/phy.c +188 −78
  103. drivers/net/wireless/realtek/rtw89/phy.h +103 −11
  104. drivers/net/wireless/realtek/rtw89/phy_be.c +77 −0
  105. drivers/net/wireless/realtek/rtw89/ps.c +72 −3
  106. drivers/net/wireless/realtek/rtw89/ps.h +4 −0
  107. drivers/net/wireless/realtek/rtw89/reg.h +38 −0
  108. drivers/net/wireless/realtek/rtw89/regd.c +14 −13
  109. drivers/net/wireless/realtek/rtw89/rtw8851b.c +12 −6
  110. drivers/net/wireless/realtek/rtw89/rtw8852a.c +12 −7
  111. drivers/net/wireless/realtek/rtw89/rtw8852b.c +12 −6
  112. drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c +2 −2
  113. drivers/net/wireless/realtek/rtw89/rtw8852c.c +14 −10
  114. drivers/net/wireless/realtek/rtw89/sar.c +209 −11
  115. drivers/net/wireless/realtek/rtw89/sar.h +7 −3
  116. drivers/net/wireless/realtek/rtw89/ser.c +13 −7
  117. drivers/net/wireless/realtek/rtw89/wow.c +2 −1
  118. drivers/net/wireless/rsi/rsi_91x_coex.c +4 −7
  119. drivers/net/wireless/rsi/rsi_91x_debugfs.c +1 −2
  120. drivers/net/wireless/rsi/rsi_91x_hal.c +1 −1
  121. drivers/net/wireless/rsi/rsi_91x_mac80211.c +2 −2
  122. drivers/net/wireless/rsi/rsi_91x_main.c +2 −2
  123. drivers/net/wireless/rsi/rsi_91x_sdio.c +14 −25
  124. drivers/net/wireless/rsi/rsi_91x_sdio_ops.c +5 −10
  125. drivers/net/wireless/rsi/rsi_91x_usb.c +10 −10
  126. drivers/net/wireless/rsi/rsi_91x_usb_ops.c +1 −1
  127. drivers/net/wireless/silabs/wfx/main.c +3 −4
  128. drivers/net/wireless/ti/wlcore/sdio.c +1 −12
  129. drivers/net/wireless/virtual/mac80211_hwsim.c +9 −9
  130. drivers/net/wireless/zydas/zd1201.c +3 −3
  131. drivers/platform/x86/eeepc-laptop.c +1 −1
  132. drivers/staging/wlan-ng/prism2usb.c +24 −24
  133. include/linux/ieee80211.h +177 −58
  134. include/net/cfg80211.h +12 −13
  135. include/net/ieee80211_radiotap.h +2 −1
  136. include/net/iw_handler.h +2 −9
  137. include/net/mac80211.h +4 −1
  138. net/mac80211/cfg.c +14 −13
  139. net/mac80211/fils_aead.c +1 −1
  140. net/mac80211/ieee80211_i.h +0 −2
  141. net/mac80211/key.c +1 −1
  142. net/mac80211/mesh.h +0 −1
  143. net/mac80211/rx.c +4 −0
  144. net/mac80211/wpa.c +1 −1
  145. net/wireless/core.h +1 −1
  146. net/wireless/mlme.c +13 −0
  147. net/wireless/nl80211.c +4 −4
  148. net/wireless/nl80211.h +0 −1
  149. net/wireless/ocb.c +3 −0
  150. net/wireless/pmsr.c +1 −2
drivers/net/wireless/ath/ath10k/ahb.c+1−1
@@ -733,7 +733,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev) · 732 unmodified lines
733733 int ret;
734734 struct ath10k_bus_params bus_params = {};
735735
736− hw_rev = (enum ath10k_hw_rev)of_device_get_match_data(&pdev->dev);
736+ hw_rev = (uintptr_t)of_device_get_match_data(&pdev->dev);
737737 if (!hw_rev) {
738738 dev_err(&pdev->dev, "OF data missing\n");
739739 return -EINVAL;
drivers/net/wireless/ath/ath10k/htt.h+2−2
@@ -69,7 +69,7 @@ struct htt_ver_req { · 68 unmodified lines
6969 * The HTT tx descriptor is defined in two manners: by a struct with
7070 * bitfields, and by a series of [dword offset, bit mask, bit shift]
7171 * definitions.
72− * The target should use the struct def, for simplicitly and clarity,
72+ * The target should use the struct def, for simplicity and clarity,
7373 * but the host shall use the bit-mast + bit-shift defs, to be endian-
7474 * neutral. Specifically, the host shall use the get/set macros built
7575 * around the mask + shift defs.
@@ -2086,7 +2086,7 @@ static inline bool ath10k_htt_rx_proc_rx_frag_ind(struct ath10k_htt *htt, · 2010 unmodified lines
20862086 * for correctly accessing rx descriptor data.
20872087 */
20882088
2089−/* base struct used for abstracting the rx descritor representation */
2089+/* base struct used for abstracting the rx descriptor representation */
20902090 struct htt_rx_desc {
20912091 union {
20922092 /* This field is filled on the host using the msdu buffer
drivers/net/wireless/ath/ath10k/pci.c+2−2
@@ -1636,7 +1636,7 @@ static int ath10k_pci_dump_memory_generic(struct ath10k *ar, · 1635 unmodified lines
16361636 buf,
16371637 current_region->len);
16381638
1639− /* No individiual memory sections defined so we can
1639+ /* No individual memory sections defined so we can
16401640 * copy the entire memory region.
16411641 */
16421642 ret = ath10k_pci_diag_read_mem(ar,
@@ -3816,7 +3816,7 @@ static void __exit ath10k_pci_exit(void) · 2173 unmodified lines
38163816 module_exit(ath10k_pci_exit);
38173817
38183818 MODULE_AUTHOR("Qualcomm Atheros");
3819−MODULE_DESCRIPTION("Driver support for Qualcomm Atheros 802.11ac WLAN PCIe/AHB devices");
3819+MODULE_DESCRIPTION("Driver support for Qualcomm Atheros PCIe/AHB 802.11ac WLAN devices");
38203820 MODULE_LICENSE("Dual BSD/GPL");
38213821
38223822 /* QCA988x 2.0 firmware files */
drivers/net/wireless/ath/ath10k/sdio.c+1−1
@@ -2389,7 +2389,7 @@ static int ath10k_sdio_dump_memory_generic(struct ath10k *ar, · 2388 unmodified lines
23892389 buf,
23902390 current_region->len);
23912391
2392− /* No individiual memory sections defined so we can
2392+ /* No individual memory sections defined so we can
23932393 * copy the entire memory region.
23942394 */
23952395 if (fast_dump)
drivers/net/wireless/ath/ath10k/usb.c+1−1
@@ -1126,5 +1126,5 @@ static struct usb_driver ath10k_usb_driver = { · 1125 unmodified lines
11261126 module_usb_driver(ath10k_usb_driver);
11271127
11281128 MODULE_AUTHOR("Atheros Communications, Inc.");
1129−MODULE_DESCRIPTION("Driver support for Qualcomm Atheros 802.11ac WLAN USB devices");
1129+MODULE_DESCRIPTION("Driver support for Qualcomm Atheros USB 802.11ac WLAN devices");
11301130 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/ath/ath10k/wmi.h+4−4
@@ -3854,9 +3854,9 @@ enum wmi_pdev_param { · 3853 unmodified lines
38543854 * retransmitting frames.
38553855 */
38563856 WMI_PDEV_PARAM_DYNAMIC_BW,
3857− /* Non aggregrate/ 11g sw retry threshold.0-disable */
3857+ /* Non aggregate/ 11g sw retry threshold.0-disable */
38583858 WMI_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
3859− /* aggregrate sw retry threshold. 0-disable*/
3859+ /* aggregate sw retry threshold. 0-disable*/
38603860 WMI_PDEV_PARAM_AGG_SW_RETRY_TH,
38613861 /* Station kickout threshold (non of consecutive failures).0-disable */
38623862 WMI_PDEV_PARAM_STA_KICKOUT_TH,
@@ -3953,9 +3953,9 @@ enum wmi_10x_pdev_param { · 90 unmodified lines
39533953 WMI_10X_PDEV_PARAM_PROTECTION_MODE,
39543954 /* Dynamic bandwidth 0: disable 1: enable */
39553955 WMI_10X_PDEV_PARAM_DYNAMIC_BW,
3956− /* Non aggregrate/ 11g sw retry threshold.0-disable */
3956+ /* Non aggregate/ 11g sw retry threshold.0-disable */
39573957 WMI_10X_PDEV_PARAM_NON_AGG_SW_RETRY_TH,
3958− /* aggregrate sw retry threshold. 0-disable*/
3958+ /* aggregate sw retry threshold. 0-disable*/
39593959 WMI_10X_PDEV_PARAM_AGG_SW_RETRY_TH,
39603960 /* Station kickout threshold (non of consecutive failures).0-disable */
39613961 WMI_10X_PDEV_PARAM_STA_KICKOUT_TH,
drivers/net/wireless/ath/ath11k/ahb.c+2−12
@@ -1096,7 +1096,7 @@ static int ath11k_ahb_probe(struct platform_device *pdev) · 1095 unmodified lines
10961096 return -EINVAL;
10971097 }
10981098
1099− hw_rev = (enum ath11k_hw_rev)of_id->data;
1099+ hw_rev = (uintptr_t)of_id->data;
11001100
11011101 switch (hw_rev) {
11021102 case ATH11K_HW_IPQ8074:
@@ -1306,17 +1306,7 @@ static struct platform_driver ath11k_ahb_driver = { · 203 unmodified lines
13061306 .shutdown = ath11k_ahb_shutdown,
13071307 };
13081308
1309−static int ath11k_ahb_init(void)
1310−{
1311− return platform_driver_register(&ath11k_ahb_driver);
1312−}
1313−module_init(ath11k_ahb_init);
1314−
1315−static void ath11k_ahb_exit(void)
1316−{
1317− platform_driver_unregister(&ath11k_ahb_driver);
1318−}
1319−module_exit(ath11k_ahb_exit);
1309+module_platform_driver(ath11k_ahb_driver);
13201310
13211311 MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax WLAN AHB devices");
13221312 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/ath/ath11k/ce.h+0−3
@@ -203,9 +203,6 @@ int ath11k_ce_alloc_pipes(struct ath11k_base *ab); · 202 unmodified lines
203203 void ath11k_ce_free_pipes(struct ath11k_base *ab);
204204 int ath11k_ce_get_attr_flags(struct ath11k_base *ab, int ce_id);
205205 void ath11k_ce_poll_send_completed(struct ath11k_base *ab, u8 pipe_id);
206−int ath11k_ce_map_service_to_pipe(struct ath11k_base *ab, u16 service_id,
207− u8 *ul_pipe, u8 *dl_pipe);
208−int ath11k_ce_attr_attach(struct ath11k_base *ab);
209206 void ath11k_ce_get_shadow_config(struct ath11k_base *ab,
210207 u32 **shadow_cfg, u32 *shadow_cfg_len);
211208 void ath11k_ce_stop_shadow_timers(struct ath11k_base *ab);
drivers/net/wireless/ath/ath11k/dp.h+1−1
@@ -635,7 +635,7 @@ enum htt_ppdu_stats_tag_type { · 634 unmodified lines
635635 * b'24 - status_swap: 1 is to swap status TLV
636636 * b'25 - pkt_swap: 1 is to swap packet TLV
637637 * b'26:31 - rsvd1: reserved for future use
638− * dword1 - b'0:16 - ring_buffer_size: size of bufferes referenced by rx ring,
638+ * dword1 - b'0:16 - ring_buffer_size: size of buffers referenced by rx ring,
639639 * in byte units.
640640 * Valid only for HW_TO_SW_RING and SW_TO_HW_RING
641641 * - b'16:31 - rsvd2: Reserved for future use
drivers/net/wireless/ath/ath11k/dp_rx.c+1−1
@@ -3423,7 +3423,7 @@ static int ath11k_dp_rx_h_defrag_reo_reinject(struct ath11k *ar, struct dp_rx_ti · 3422 unmodified lines
34233423 ath11k_hal_rx_buf_addr_info_set(msdu0, paddr, cookie,
34243424 ab->hw_params.hal_params->rx_buf_rbm);
34253425
3426− /* Fill mpdu details into reo entrace ring */
3426+ /* Fill mpdu details into reo entrance ring */
34273427 srng = &ab->hal.srng_list[ab->dp.reo_reinject_ring.ring_id];
34283428
34293429 spin_lock_bh(&srng->lock);
drivers/net/wireless/ath/ath11k/dp_tx.c+6−6
@@ -238,7 +238,7 @@ tcl_ring_sel: · 237 unmodified lines
238238 spin_unlock_bh(&tcl_ring->lock);
239239 ret = -ENOMEM;
240240
241− /* Checking for available tcl descritors in another ring in
241+ /* Checking for available tcl descriptors in another ring in
242242 * case of failure due to full tcl ring now, is better than
243243 * checking this ring earlier for each pkt tx.
244244 * Restart ring selection if some rings are not checked yet.
@@ -344,7 +344,7 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab, · 99 unmodified lines
344344 dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
345345
346346 if (!skb_cb->vif) {
347− dev_kfree_skb_any(msdu);
347+ ieee80211_free_txskb(ar->hw, msdu);
348348 return;
349349 }
350350
@@ -369,7 +369,7 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab, · 18 unmodified lines
369369 "dp_tx: failed to find the peer with peer_id %d\n",
370370 ts->peer_id);
371371 spin_unlock_bh(&ab->base_lock);
372− dev_kfree_skb_any(msdu);
372+ ieee80211_free_txskb(ar->hw, msdu);
373373 return;
374374 }
375375 spin_unlock_bh(&ab->base_lock);
@@ -566,12 +566,12 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar, · 190 unmodified lines
566566 dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
567567
568568 if (unlikely(!rcu_access_pointer(ab->pdevs_active[ar->pdev_idx]))) {
569− dev_kfree_skb_any(msdu);
569+ ieee80211_free_txskb(ar->hw, msdu);
570570 return;
571571 }
572572
573573 if (unlikely(!skb_cb->vif)) {
574− dev_kfree_skb_any(msdu);
574+ ieee80211_free_txskb(ar->hw, msdu);
575575 return;
576576 }
577577
@@ -624,7 +624,7 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar, · 46 unmodified lines
624624 "dp_tx: failed to find the peer with peer_id %d\n",
625625 ts->peer_id);
626626 spin_unlock_bh(&ab->base_lock);
627− dev_kfree_skb_any(msdu);
627+ ieee80211_free_txskb(ar->hw, msdu);
628628 return;
629629 }
630630 arsta = (struct ath11k_sta *)peer->sta->drv_priv;
drivers/net/wireless/ath/ath11k/mac.c+32−32
@@ -566,7 +566,7 @@ static void ath11k_get_arvif_iter(void *data, u8 *mac, · 565 unmodified lines
566566 struct ieee80211_vif *vif)
567567 {
568568 struct ath11k_vif_iter *arvif_iter = data;
569− struct ath11k_vif *arvif = (void *)vif->drv_priv;
569+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
570570
571571 if (arvif->vdev_id == arvif_iter->vdev_id)
572572 arvif_iter->arvif = arvif;
@@ -1464,7 +1464,7 @@ static int ath11k_mac_setup_bcn_tmpl_ema(struct ath11k_vif *arvif) · 891 unmodified lines
14641464 u32 params = 0;
14651465 u8 i = 0;
14661466
1467− tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv;
1467+ tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
14681468
14691469 beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw,
14701470 tx_arvif->vif, 0);
@@ -1520,8 +1520,8 @@ static int ath11k_mac_setup_bcn_tmpl_mbssid(struct ath11k_vif *arvif) · 49 unmodified lines
15201520 struct sk_buff *bcn;
15211521 int ret;
15221522
1523− if (arvif->vif->mbssid_tx_vif) {
1524− tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv;
1523+ if (vif->mbssid_tx_vif) {
1524+ tx_arvif = ath11k_vif_to_arvif(vif->mbssid_tx_vif);
15251525 if (tx_arvif != arvif) {
15261526 ar = tx_arvif->ar;
15271527 ab = ar->ab;
@@ -1562,7 +1562,7 @@ static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) · 34 unmodified lines
15621562 * non-transmitting interfaces, and results in a crash if sent.
15631563 */
15641564 if (vif->mbssid_tx_vif &&
1565− arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up)
1565+ arvif != ath11k_vif_to_arvif(vif->mbssid_tx_vif) && arvif->is_up)
15661566 return 0;
15671567
15681568 if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif)
@@ -1626,7 +1626,7 @@ static void ath11k_control_beaconing(struct ath11k_vif *arvif, · 57 unmodified lines
16261626 ether_addr_copy(arvif->bssid, info->bssid);
16271627
16281628 if (arvif->vif->mbssid_tx_vif)
1629− tx_arvif = (struct ath11k_vif *)arvif->vif->mbssid_tx_vif->drv_priv;
1629+ tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif);
16301630
16311631 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
16321632 arvif->bssid,
@@ -1649,7 +1649,7 @@ static void ath11k_mac_handle_beacon_iter(void *data, u8 *mac, · 16 unmodified lines
16491649 {
16501650 struct sk_buff *skb = data;
16511651 struct ieee80211_mgmt *mgmt = (void *)skb->data;
1652− struct ath11k_vif *arvif = (void *)vif->drv_priv;
1652+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
16531653
16541654 if (vif->type != NL80211_IFTYPE_STATION)
16551655 return;
@@ -1672,7 +1672,7 @@ static void ath11k_mac_handle_beacon_miss_iter(void *data, u8 *mac, · 16 unmodified lines
16721672 struct ieee80211_vif *vif)
16731673 {
16741674 u32 *vdev_id = data;
1675− struct ath11k_vif *arvif = (void *)vif->drv_priv;
1675+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
16761676 struct ath11k *ar = arvif->ar;
16771677 struct ieee80211_hw *hw = ar->hw;
16781678
@@ -1718,7 +1718,7 @@ static void ath11k_peer_assoc_h_basic(struct ath11k *ar, · 39 unmodified lines
17181718 struct ieee80211_sta *sta,
17191719 struct peer_assoc_params *arg)
17201720 {
1721− struct ath11k_vif *arvif = (void *)vif->drv_priv;
1721+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
17221722 u32 aid;
17231723
17241724 lockdep_assert_held(&ar->conf_mutex);
@@ -1746,7 +1746,7 @@ static void ath11k_peer_assoc_h_crypto(struct ath11k *ar, · 21 unmodified lines
17461746 struct ieee80211_bss_conf *info = &vif->bss_conf;
17471747 struct cfg80211_chan_def def;
17481748 struct cfg80211_bss *bss;
1749− struct ath11k_vif *arvif = (struct ath11k_vif *)vif->drv_priv;
1749+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
17501750 const u8 *rsnie = NULL;
17511751 const u8 *wpaie = NULL;
17521752
@@ -1804,7 +1804,7 @@ static void ath11k_peer_assoc_h_rates(struct ath11k *ar, · 51 unmodified lines
18041804 struct ieee80211_sta *sta,
18051805 struct peer_assoc_params *arg)
18061806 {
1807− struct ath11k_vif *arvif = (void *)vif->drv_priv;
1807+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
18081808 struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates;
18091809 struct cfg80211_chan_def def;
18101810 const struct ieee80211_supported_band *sband;
@@ -1867,7 +1867,7 @@ static void ath11k_peer_assoc_h_ht(struct ath11k *ar, · 56 unmodified lines
18671867 struct peer_assoc_params *arg)
18681868 {
18691869 const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap;
1870− struct ath11k_vif *arvif = (void *)vif->drv_priv;
1870+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
18711871 struct cfg80211_chan_def def;
18721872 enum nl80211_band band;
18731873 const u8 *ht_mcs_mask;
@@ -2064,7 +2064,7 @@ static void ath11k_peer_assoc_h_vht(struct ath11k *ar, · 190 unmodified lines
20642064 struct peer_assoc_params *arg)
20652065 {
20662066 const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap;
2067− struct ath11k_vif *arvif = (void *)vif->drv_priv;
2067+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
20682068 struct cfg80211_chan_def def;
20692069 enum nl80211_band band;
20702070 u16 *vht_mcs_mask;
@@ -2261,7 +2261,7 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar, · 190 unmodified lines
22612261 struct ieee80211_sta *sta,
22622262 struct peer_assoc_params *arg)
22632263 {
2264− struct ath11k_vif *arvif = (void *)vif->drv_priv;
2264+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
22652265 struct cfg80211_chan_def def;
22662266 const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
22672267 enum nl80211_band band;
@@ -2584,7 +2584,7 @@ static void ath11k_peer_assoc_h_qos(struct ath11k *ar, · 316 unmodified lines
25842584 struct ieee80211_sta *sta,
25852585 struct peer_assoc_params *arg)
25862586 {
2587− struct ath11k_vif *arvif = (void *)vif->drv_priv;
2587+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
25882588
25892589 switch (arvif->vdev_type) {
25902590 case WMI_VDEV_TYPE_AP:
@@ -2747,7 +2747,7 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar, · 156 unmodified lines
27472747 struct ieee80211_sta *sta,
27482748 struct peer_assoc_params *arg)
27492749 {
2750− struct ath11k_vif *arvif = (void *)vif->drv_priv;
2750+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
27512751 struct cfg80211_chan_def def;
27522752 enum nl80211_band band;
27532753 const u8 *ht_mcs_mask;
@@ -2933,7 +2933,7 @@ static bool ath11k_mac_vif_recalc_sta_he_txbf(struct ath11k *ar, · 179 unmodified lines
29332933 struct ieee80211_vif *vif,
29342934 struct ieee80211_sta_he_cap *he_cap)
29352935 {
2936− struct ath11k_vif *arvif = (void *)vif->drv_priv;
2936+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
29372937 struct ieee80211_he_cap_elem he_cap_elem = {0};
29382938 struct ieee80211_sta_he_cap *cap_band = NULL;
29392939 struct cfg80211_chan_def def;
@@ -2995,7 +2995,7 @@ static void ath11k_bss_assoc(struct ieee80211_hw *hw, · 55 unmodified lines
29952995 struct ieee80211_bss_conf *bss_conf)
29962996 {
29972997 struct ath11k *ar = hw->priv;
2998− struct ath11k_vif *arvif = (void *)vif->drv_priv;
2998+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
29992999 struct peer_assoc_params peer_arg;
30003000 struct ieee80211_sta *ap_sta;
30013001 struct ath11k_peer *peer;
@@ -3111,7 +3111,7 @@ static void ath11k_bss_disassoc(struct ieee80211_hw *hw, · 109 unmodified lines
31113111 struct ieee80211_vif *vif)
31123112 {
31133113 struct ath11k *ar = hw->priv;
3114− struct ath11k_vif *arvif = (void *)vif->drv_priv;
3114+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
31153115 int ret;
31163116
31173117 lockdep_assert_held(&ar->conf_mutex);
@@ -3160,7 +3160,7 @@ static void ath11k_recalculate_mgmt_rate(struct ath11k *ar, · 42 unmodified lines
31603160 struct ieee80211_vif *vif,
31613161 struct cfg80211_chan_def *def)
31623162 {
3163− struct ath11k_vif *arvif = (void *)vif->drv_priv;
3163+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
31643164 const struct ieee80211_supported_band *sband;
31653165 u8 basic_rate_idx;
31663166 int hw_rate_code;
@@ -4632,7 +4632,7 @@ static int ath11k_station_disassoc(struct ath11k *ar, · 1465 unmodified lines
46324632 struct ieee80211_vif *vif,
46334633 struct ieee80211_sta *sta)
46344634 {
4635− struct ath11k_vif *arvif = (void *)vif->drv_priv;
4635+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
46364636 int ret = 0;
46374637
46384638 lockdep_assert_held(&ar->conf_mutex);
@@ -5160,7 +5160,7 @@ static int ath11k_mac_op_sta_set_txpwr(struct ieee80211_hw *hw, · 521 unmodified lines
51605160 struct ieee80211_sta *sta)
51615161 {
51625162 struct ath11k *ar = hw->priv;
5163− struct ath11k_vif *arvif = (void *)vif->drv_priv;
5163+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
51645164 int ret = 0;
51655165 s16 txpwr;
51665166
@@ -5210,7 +5210,7 @@ static void ath11k_mac_op_sta_rc_update(struct ieee80211_hw *hw, · 43 unmodified lines
52105210 {
52115211 struct ath11k *ar = hw->priv;
52125212 struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv;
5213− struct ath11k_vif *arvif = (void *)vif->drv_priv;
5213+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
52145214 struct ath11k_peer *peer;
52155215 u32 bw, smps;
52165216
@@ -5337,7 +5337,7 @@ static int ath11k_mac_op_conf_tx(struct ieee80211_hw *hw, · 120 unmodified lines
53375337 const struct ieee80211_tx_queue_params *params)
53385338 {
53395339 struct ath11k *ar = hw->priv;
5340− struct ath11k_vif *arvif = (void *)vif->drv_priv;
5340+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
53415341 struct wmi_wmm_params_arg *p = NULL;
53425342 int ret;
53435343
@@ -6455,7 +6455,7 @@ static int ath11k_mac_setup_vdev_params_mbssid(struct ath11k_vif *arvif, · 1111 unmodified lines
64556455 return 0;
64566456 }
64576457
6458− tx_arvif = (void *)tx_vif->drv_priv;
6458+ tx_arvif = ath11k_vif_to_arvif(tx_vif);
64596459
64606460 if (arvif->vif->bss_conf.nontransmitted) {
64616461 if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy)
@@ -7408,7 +7408,7 @@ ath11k_mac_update_vif_chan(struct ath11k *ar, · 946 unmodified lines
74087408 /* TODO: Update ar->rx_channel */
74097409
74107410 for (i = 0; i < n_vifs; i++) {
7411− arvif = (void *)vifs[i].vif->drv_priv;
7411+ arvif = ath11k_vif_to_arvif(vifs[i].vif);
74127412
74137413 if (WARN_ON(!arvif->is_started))
74147414 continue;
@@ -7450,7 +7450,7 @@ ath11k_mac_update_vif_chan(struct ath11k *ar, · 35 unmodified lines
74507450
74517451 mbssid_tx_vif = arvif->vif->mbssid_tx_vif;
74527452 if (mbssid_tx_vif)
7453− tx_arvif = (struct ath11k_vif *)mbssid_tx_vif->drv_priv;
7453+ tx_arvif = ath11k_vif_to_arvif(mbssid_tx_vif);
74547454
74557455 ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid,
74567456 arvif->bssid,
@@ -7546,7 +7546,7 @@ static int ath11k_start_vdev_delay(struct ieee80211_hw *hw, · 89 unmodified lines
75467546 {
75477547 struct ath11k *ar = hw->priv;
75487548 struct ath11k_base *ab = ar->ab;
7549− struct ath11k_vif *arvif = (void *)vif->drv_priv;
7549+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
75507550 int ret;
75517551
75527552 if (WARN_ON(arvif->is_started))
@@ -7596,7 +7596,7 @@ ath11k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw, · 43 unmodified lines
75967596 {
75977597 struct ath11k *ar = hw->priv;
75987598 struct ath11k_base *ab = ar->ab;
7599− struct ath11k_vif *arvif = (void *)vif->drv_priv;
7599+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
76007600 int ret;
76017601 struct peer_create_params param;
76027602
@@ -7686,7 +7686,7 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw, · 83 unmodified lines
76867686 {
76877687 struct ath11k *ar = hw->priv;
76887688 struct ath11k_base *ab = ar->ab;
7689− struct ath11k_vif *arvif = (void *)vif->drv_priv;
7689+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
76907690 struct ath11k_peer *peer;
76917691 int ret;
76927692
@@ -8307,7 +8307,7 @@ ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw, · 614 unmodified lines
83078307 struct ieee80211_vif *vif,
83088308 const struct cfg80211_bitrate_mask *mask)
83098309 {
8310− struct ath11k_vif *arvif = (void *)vif->drv_priv;
8310+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
83118311 struct cfg80211_chan_def def;
83128312 struct ath11k_pdev_cap *cap;
83138313 struct ath11k *ar = arvif->ar;
@@ -8904,7 +8904,7 @@ static int ath11k_mac_op_remain_on_channel(struct ieee80211_hw *hw, · 590 unmodified lines
89048904 enum ieee80211_roc_type type)
89058905 {
89068906 struct ath11k *ar = hw->priv;
8907− struct ath11k_vif *arvif = (void *)vif->drv_priv;
8907+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
89088908 struct scan_req_params arg;
89098909 int ret;
89108910 u32 scan_time_msec;
drivers/net/wireless/ath/ath11k/pci.c+1−1
@@ -1036,7 +1036,7 @@ static void ath11k_pci_exit(void) · 1035 unmodified lines
10361036
10371037 module_exit(ath11k_pci_exit);
10381038
1039−MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax WLAN PCIe devices");
1039+MODULE_DESCRIPTION("Driver support for Qualcomm Technologies PCIe 802.11ax WLAN devices");
10401040 MODULE_LICENSE("Dual BSD/GPL");
10411041
10421042 /* firmware files */
drivers/net/wireless/ath/ath11k/qmi.h+0−2
@@ -514,8 +514,6 @@ struct qmi_wlanfw_wlan_ini_resp_msg_v01 { · 513 unmodified lines
514514 int ath11k_qmi_firmware_start(struct ath11k_base *ab,
515515 u32 mode);
516516 void ath11k_qmi_firmware_stop(struct ath11k_base *ab);
517−void ath11k_qmi_event_work(struct work_struct *work);
518−void ath11k_qmi_msg_recv_work(struct work_struct *work);
519517 void ath11k_qmi_deinit_service(struct ath11k_base *ab);
520518 int ath11k_qmi_init_service(struct ath11k_base *ab);
521519 void ath11k_qmi_free_resource(struct ath11k_base *ab);
drivers/net/wireless/ath/ath11k/testmode.c+1−1
@@ -350,7 +350,7 @@ static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[], · 349 unmodified lines
350350 if (ar->ab->fw_mode != ATH11K_FIRMWARE_MODE_FTM &&
351351 (tag == WMI_TAG_VDEV_SET_PARAM_CMD || tag == WMI_TAG_UNIT_TEST_CMD)) {
352352 if (vif) {
353− arvif = (struct ath11k_vif *)vif->drv_priv;
353+ arvif = ath11k_vif_to_arvif(vif);
354354 *ptr = arvif->vdev_id;
355355 } else {
356356 ret = -EINVAL;
drivers/net/wireless/ath/ath12k/ce.h+0−3
@@ -176,9 +176,6 @@ int ath12k_ce_alloc_pipes(struct ath12k_base *ab); · 175 unmodified lines
176176 void ath12k_ce_free_pipes(struct ath12k_base *ab);
177177 int ath12k_ce_get_attr_flags(struct ath12k_base *ab, int ce_id);
178178 void ath12k_ce_poll_send_completed(struct ath12k_base *ab, u8 pipe_id);
179−int ath12k_ce_map_service_to_pipe(struct ath12k_base *ab, u16 service_id,
180− u8 *ul_pipe, u8 *dl_pipe);
181−int ath12k_ce_attr_attach(struct ath12k_base *ab);
182179 void ath12k_ce_get_shadow_config(struct ath12k_base *ab,
183180 u32 **shadow_cfg, u32 *shadow_cfg_len);
184181 #endif
drivers/net/wireless/ath/ath12k/core.h+0−1
@@ -788,7 +788,6 @@ int ath12k_core_fetch_board_data_api_1(struct ath12k_base *ab, · 787 unmodified lines
788788 int ath12k_core_fetch_bdf(struct ath12k_base *ath12k,
789789 struct ath12k_board_data *bd);
790790 void ath12k_core_free_bdf(struct ath12k_base *ab, struct ath12k_board_data *bd);
791−int ath12k_core_check_dt(struct ath12k_base *ath12k);
792791
793792 void ath12k_core_halt(struct ath12k *ar);
794793 int ath12k_core_resume(struct ath12k_base *ab);
drivers/net/wireless/ath/ath12k/dp.c+29−1
@@ -1129,6 +1129,7 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab) · 1128 unmodified lines
11291129 struct ath12k_dp *dp = &ab->dp;
11301130 struct sk_buff *skb;
11311131 int i;
1132+ u32 pool_id, tx_spt_page;
11321133
11331134 if (!dp->spt_info)
11341135 return;
@@ -1148,6 +1149,14 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab) · 13 unmodified lines
11481149 dev_kfree_skb_any(skb);
11491150 }
11501151
1152+ for (i = 0; i < ATH12K_NUM_RX_SPT_PAGES; i++) {
1153+ if (!dp->spt_info->rxbaddr[i])
1154+ continue;
1155+
1156+ kfree(dp->spt_info->rxbaddr[i]);
1157+ dp->spt_info->rxbaddr[i] = NULL;
1158+ }
1159+
11511160 spin_unlock_bh(&dp->rx_desc_lock);
11521161
11531162 /* TX Descriptor cleanup */
@@ -1170,6 +1179,21 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab) · 16 unmodified lines
11701179 spin_unlock_bh(&dp->tx_desc_lock[i]);
11711180 }
11721181
1182+ for (pool_id = 0; pool_id < ATH12K_HW_MAX_QUEUES; pool_id++) {
1183+ spin_lock_bh(&dp->tx_desc_lock[pool_id]);
1184+
1185+ for (i = 0; i < ATH12K_TX_SPT_PAGES_PER_POOL; i++) {
1186+ tx_spt_page = i + pool_id * ATH12K_TX_SPT_PAGES_PER_POOL;
1187+ if (!dp->spt_info->txbaddr[tx_spt_page])
1188+ continue;
1189+
1190+ kfree(dp->spt_info->txbaddr[tx_spt_page]);
1191+ dp->spt_info->txbaddr[tx_spt_page] = NULL;
1192+ }
1193+
1194+ spin_unlock_bh(&dp->tx_desc_lock[pool_id]);
1195+ }
1196+
11731197 /* unmap SPT pages */
11741198 for (i = 0; i < dp->num_spt_pages; i++) {
11751199 if (!dp->spt_info[i].vaddr)
@@ -1343,6 +1367,8 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) · 167 unmodified lines
13431367 return -ENOMEM;
13441368 }
13451369
1370+ dp->spt_info->rxbaddr[i] = &rx_descs[0];
1371+
13461372 for (j = 0; j < ATH12K_MAX_SPT_ENTRIES; j++) {
13471373 rx_descs[j].cookie = ath12k_dp_cc_cookie_gen(i, j);
13481374 rx_descs[j].magic = ATH12K_DP_RX_DESC_MAGIC;
@@ -1368,8 +1394,10 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) · 19 unmodified lines
13681394 return -ENOMEM;
13691395 }
13701396
1397+ tx_spt_page = i + pool_id * ATH12K_TX_SPT_PAGES_PER_POOL;
1398+ dp->spt_info->txbaddr[tx_spt_page] = &tx_descs[0];
1399+
13711400 for (j = 0; j < ATH12K_MAX_SPT_ENTRIES; j++) {
1372− tx_spt_page = i + pool_id * ATH12K_TX_SPT_PAGES_PER_POOL;
13731401 ppt_idx = ATH12K_NUM_RX_SPT_PAGES + tx_spt_page;
13741402 tx_descs[j].desc_id = ath12k_dp_cc_cookie_gen(ppt_idx, j);
13751403 tx_descs[j].pool_id = pool_id;
drivers/net/wireless/ath/ath12k/dp.h+3−1
@@ -289,6 +289,8 @@ struct ath12k_tx_desc_info { · 288 unmodified lines
289289 struct ath12k_spt_info {
290290 dma_addr_t paddr;
291291 u64 *vaddr;
292+ struct ath12k_rx_desc_info *rxbaddr[ATH12K_NUM_RX_SPT_PAGES];
293+ struct ath12k_tx_desc_info *txbaddr[ATH12K_NUM_TX_SPT_PAGES];
292294 };
293295
294296 struct ath12k_reo_queue_ref {
@@ -712,7 +714,7 @@ enum htt_stats_internal_ppdu_frametype { · 417 unmodified lines
712714 * b'24 - status_swap: 1 is to swap status TLV
713715 * b'25 - pkt_swap: 1 is to swap packet TLV
714716 * b'26:31 - rsvd1: reserved for future use
715− * dword1 - b'0:16 - ring_buffer_size: size of bufferes referenced by rx ring,
717+ * dword1 - b'0:16 - ring_buffer_size: size of buffers referenced by rx ring,
716718 * in byte units.
717719 * Valid only for HW_TO_SW_RING and SW_TO_HW_RING
718720 * - b'16:31 - rsvd2: Reserved for future use
drivers/net/wireless/ath/ath12k/dp_rx.c+1−1
@@ -3027,7 +3027,7 @@ static int ath12k_dp_rx_h_defrag_reo_reinject(struct ath12k *ar, · 3026 unmodified lines
30273027 desc_info->cookie,
30283028 HAL_RX_BUF_RBM_SW3_BM);
30293029
3030− /* Fill mpdu details into reo entrace ring */
3030+ /* Fill mpdu details into reo entrance ring */
30313031 srng = &ab->hal.srng_list[dp->reo_reinject_ring.ring_id];
30323032
30333033 spin_lock_bh(&srng->lock);
drivers/net/wireless/ath/ath12k/dp_tx.c+1−1
@@ -301,7 +301,7 @@ tcl_ring_sel: · 300 unmodified lines
301301 spin_unlock_bh(&tcl_ring->lock);
302302 ret = -ENOMEM;
303303
304− /* Checking for available tcl descritors in another ring in
304+ /* Checking for available tcl descriptors in another ring in
305305 * case of failure due to full tcl ring now, is better than
306306 * checking this ring earlier for each pkt tx.
307307 * Restart ring selection if some rings are not checked yet.
drivers/net/wireless/ath/ath12k/mac.c+3−4
@@ -5660,7 +5660,6 @@ static void ath12k_mac_op_configure_filter(struct ieee80211_hw *hw, · 5659 unmodified lines
56605660
56615661 mutex_lock(&ar->conf_mutex);
56625662
5663− changed_flags &= SUPPORTED_FILTERS;
56645663 *total_flags &= SUPPORTED_FILTERS;
56655664 ar->filter_flags = *total_flags;
56665665
@@ -5678,8 +5677,8 @@ static void ath12k_mac_op_configure_filter(struct ieee80211_hw *hw, · 11 unmodified lines
56785677 "fail to set monitor filter: %d\n", ret);
56795678 }
56805679 ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
5681− "changed_flags:0x%x, total_flags:0x%x, reset_flag:%d\n",
5682− changed_flags, *total_flags, reset_flag);
5680+ "total_flags:0x%x, reset_flag:%d\n",
5681+ *total_flags, reset_flag);
56835682
56845683 mutex_unlock(&ar->conf_mutex);
56855684 }
@@ -6771,7 +6770,7 @@ ath12k_mac_op_reconfig_complete(struct ieee80211_hw *hw, · 1085 unmodified lines
67716770 /* After trigger disconnect, then upper layer will
67726771 * trigger connect again, then the PN number of
67736772 * upper layer will be reset to keep up with AP
6774− * side, hence PN number mis-match will not happened.
6773+ * side, hence PN number mismatch will not happen.
67756774 */
67766775 if (arvif->is_up &&
67776776 arvif->vdev_type == WMI_VDEV_TYPE_STA &&
drivers/net/wireless/ath/ath12k/pci.c+1−1
@@ -1409,5 +1409,5 @@ static void ath12k_pci_exit(void) · 1408 unmodified lines
14091409
14101410 module_exit(ath12k_pci_exit);
14111411
1412−MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11be WLAN PCIe devices");
1412+MODULE_DESCRIPTION("Driver support for Qualcomm Technologies PCIe 802.11be WLAN devices");
14131413 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/ath/ath12k/qmi.h+0−2
@@ -562,8 +562,6 @@ struct qmi_wlanfw_wlan_cfg_resp_msg_v01 { · 561 unmodified lines
562562 int ath12k_qmi_firmware_start(struct ath12k_base *ab,
563563 u32 mode);
564564 void ath12k_qmi_firmware_stop(struct ath12k_base *ab);
565−void ath12k_qmi_event_work(struct work_struct *work);
566−void ath12k_qmi_msg_recv_work(struct work_struct *work);
567565 void ath12k_qmi_deinit_service(struct ath12k_base *ab);
568566 int ath12k_qmi_init_service(struct ath12k_base *ab);
569567
drivers/net/wireless/ath/ath12k/rx_desc.h+1−1
@@ -221,7 +221,7 @@ struct rx_mpdu_start_qcn9274 { · 220 unmodified lines
221221 * PPE routing even if RXOLE CCE or flow search indicate 'Use_PPE'
222222 * This is set by SW for peers which are being handled by a
223223 * host SW/accelerator subsystem that also handles packet
224− * uffer management for WiFi-to-PPE routing.
224+ * buffer management for WiFi-to-PPE routing.
225225 *
226226 * This is cleared by SW for peers which are being handled
227227 * by a different subsystem, completely disabling WiFi-to-PPE
drivers/net/wireless/ath/ath12k/wmi.c+13−7
@@ -2239,12 +2239,6 @@ int ath12k_wmi_send_scan_start_cmd(struct ath12k *ar, · 2238 unmodified lines
22392239 if (arg->num_bssid)
22402240 len += sizeof(*bssid) * arg->num_bssid;
22412241
2242− len += TLV_HDR_SIZE;
2243− if (arg->extraie.len)
2244− extraie_len_with_pad =
2245− roundup(arg->extraie.len, sizeof(u32));
2246− len += extraie_len_with_pad;
2247−
22482242 if (arg->num_hint_bssid)
22492243 len += TLV_HDR_SIZE +
22502244 arg->num_hint_bssid * sizeof(*hint_bssid);
@@ -2253,6 +2247,18 @@ int ath12k_wmi_send_scan_start_cmd(struct ath12k *ar, · 2 unmodified lines
22532247 len += TLV_HDR_SIZE +
22542248 arg->num_hint_s_ssid * sizeof(*s_ssid);
22552249
2250+ len += TLV_HDR_SIZE;
2251+ if (arg->extraie.len)
2252+ extraie_len_with_pad =
2253+ roundup(arg->extraie.len, sizeof(u32));
2254+ if (extraie_len_with_pad <= (wmi->wmi_ab->max_msg_len[ar->pdev_idx] - len)) {
2255+ len += extraie_len_with_pad;
2256+ } else {
2257+ ath12k_warn(ar->ab, "discard large size %d bytes extraie for scan start\n",
2258+ arg->extraie.len);
2259+ extraie_len_with_pad = 0;
2260+ }
2261+
22562262 skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, len);
22572263 if (!skb)
22582264 return -ENOMEM;
@@ -2342,7 +2348,7 @@ int ath12k_wmi_send_scan_start_cmd(struct ath12k *ar, · 83 unmodified lines
23422348 tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_BYTE, len);
23432349 ptr += TLV_HDR_SIZE;
23442350
2345− if (arg->extraie.len)
2351+ if (extraie_len_with_pad)
23462352 memcpy(ptr, arg->extraie.ptr,
23472353 arg->extraie.len);
23482354
drivers/net/wireless/ath/ath12k/wmi.h+0−2
@@ -4855,8 +4855,6 @@ int ath12k_wmi_vdev_install_key(struct ath12k *ar, · 4854 unmodified lines
48554855 struct wmi_vdev_install_key_arg *arg);
48564856 int ath12k_wmi_pdev_bss_chan_info_request(struct ath12k *ar,
48574857 enum wmi_bss_chan_info_req_type type);
4858−int ath12k_wmi_send_stats_request_cmd(struct ath12k *ar, u32 stats_id,
4859− u32 vdev_id, u32 pdev_id);
48604858 int ath12k_wmi_send_pdev_temperature_cmd(struct ath12k *ar);
48614859 int ath12k_wmi_send_peer_flush_tids_cmd(struct ath12k *ar,
48624860 u8 peer_addr[ETH_ALEN],
drivers/net/wireless/ath/ath5k/ahb.c+0−1
@@ -115,7 +115,6 @@ static int ath_ahb_probe(struct platform_device *pdev) · 114 unmodified lines
115115
116116 irq = platform_get_irq(pdev, 0);
117117 if (irq < 0) {
118− dev_err(&pdev->dev, "no IRQ resource found: %d\n", irq);
119118 ret = irq;
120119 goto err_iounmap;
121120 }
drivers/net/wireless/ath/ath5k/mac80211-ops.c+0−1
@@ -382,7 +382,6 @@ ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, · 381 unmodified lines
382382 mfilt[1] = multicast >> 32;
383383
384384 /* Only deal with supported flags */
385− changed_flags &= SUPPORTED_FIF_FLAGS;
386385 *new_flags &= SUPPORTED_FIF_FLAGS;
387386
388387 /* If HW detects any phy or radar errors, leave those filters on.
drivers/net/wireless/ath/ath5k/phy.c+13−16
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626
2727 #include <linux/delay.h>
2828 #include <linux/slab.h>
29+#include <linux/sort.h>
2930 #include <asm/unaligned.h>
3031
3132 #include "ath5k.h"
@@ -1554,6 +1555,11 @@ static void ath5k_hw_update_nfcal_hist(struct ath5k_hw *ah, s16 noise_floor) · 1522 unmodified lines
15541555 hist->nfval[hist->index] = noise_floor;
15551556 }
15561557
1558+static int cmps16(const void *a, const void *b)
1559+{
1560+ return *(s16 *)a - *(s16 *)b;
1561+}
1562+
15571563 /**
15581564 * ath5k_hw_get_median_noise_floor() - Get median NF from history buffer
15591565 * @ah: The &struct ath5k_hw
@@ -1561,25 +1567,16 @@ static void ath5k_hw_update_nfcal_hist(struct ath5k_hw *ah, s16 noise_floor) · 1 unmodified line
15611567 static s16
15621568 ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah)
15631569 {
1564− s16 sort[ATH5K_NF_CAL_HIST_MAX];
1565− s16 tmp;
1566− int i, j;
1567−
1568− memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort));
1569− for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) {
1570− for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) {
1571− if (sort[j] > sort[j - 1]) {
1572− tmp = sort[j];
1573− sort[j] = sort[j - 1];
1574− sort[j - 1] = tmp;
1575− }
1576− }
1577− }
1570+ s16 sorted_nfval[ATH5K_NF_CAL_HIST_MAX];
1571+ int i;
1572+
1573+ memcpy(sorted_nfval, ah->ah_nfcal_hist.nfval, sizeof(sorted_nfval));
1574+ sort(sorted_nfval, ATH5K_NF_CAL_HIST_MAX, sizeof(s16), cmps16, NULL);
15781575 for (i = 0; i < ATH5K_NF_CAL_HIST_MAX; i++) {
15791576 ATH5K_DBG(ah, ATH5K_DEBUG_CALIBRATE,
1580− "cal %d:%d\n", i, sort[i]);
1577+ "cal %d:%d\n", i, sorted_nfval[i]);
15811578 }
1582− return sort[(ATH5K_NF_CAL_HIST_MAX - 1) / 2];
1579+ return sorted_nfval[(ATH5K_NF_CAL_HIST_MAX - 1) / 2];
15831580 }
15841581
15851582 /**
drivers/net/wireless/ath/ath9k/ath9k.h+0−1
@@ -1129,7 +1129,6 @@ void ath_restart_work(struct ath_softc *sc); · 1128 unmodified lines
11291129 int ath9k_init_device(u16 devid, struct ath_softc *sc,
11301130 const struct ath_bus_ops *bus_ops);
11311131 void ath9k_deinit_device(struct ath_softc *sc);
1132−void ath9k_reload_chainmask_settings(struct ath_softc *sc);
11331132 u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate);
11341133 void ath_start_rfkill_poll(struct ath_softc *sc);
11351134 void ath9k_rfkill_poll_state(struct ieee80211_hw *hw);
drivers/net/wireless/ath/ath9k/common-spectral.c+16−37
@@ -855,16 +855,11 @@ static ssize_t write_file_spectral_short_repeat(struct file *file, · 854 unmodified lines
855855 {
856856 struct ath_spec_scan_priv *spec_priv = file->private_data;
857857 unsigned long val;
858− char buf[32];
859− ssize_t len;
860−
861− len = min(count, sizeof(buf) - 1);
862− if (copy_from_user(buf, user_buf, len))
863− return -EFAULT;
858+ ssize_t ret;
864859
865− buf[len] = '\0';
866− if (kstrtoul(buf, 0, &val))
867− return -EINVAL;
860+ ret = kstrtoul_from_user(user_buf, count, 0, &val);
861+ if (ret)
862+ return ret;
868863
869864 if (val > 1)
870865 return -EINVAL;
@@ -903,17 +898,11 @@ static ssize_t write_file_spectral_count(struct file *file, · 32 unmodified lines
903898 {
904899 struct ath_spec_scan_priv *spec_priv = file->private_data;
905900 unsigned long val;
906− char buf[32];
907− ssize_t len;
908−
909− len = min(count, sizeof(buf) - 1);
910− if (copy_from_user(buf, user_buf, len))
911− return -EFAULT;
912−
913− buf[len] = '\0';
914− if (kstrtoul(buf, 0, &val))
915− return -EINVAL;
901+ ssize_t ret;
916902
903+ ret = kstrtoul_from_user(user_buf, count, 0, &val);
904+ if (ret)
905+ return ret;
917906 if (val > 255)
918907 return -EINVAL;
919908
@@ -951,16 +940,11 @@ static ssize_t write_file_spectral_period(struct file *file, · 31 unmodified lines
951940 {
952941 struct ath_spec_scan_priv *spec_priv = file->private_data;
953942 unsigned long val;
954− char buf[32];
955− ssize_t len;
956−
957− len = min(count, sizeof(buf) - 1);
958− if (copy_from_user(buf, user_buf, len))
959− return -EFAULT;
943+ ssize_t ret;
960944
961− buf[len] = '\0';
962− if (kstrtoul(buf, 0, &val))
963− return -EINVAL;
945+ ret = kstrtoul_from_user(user_buf, count, 0, &val);
946+ if (ret)
947+ return ret;
964948
965949 if (val > 255)
966950 return -EINVAL;
@@ -999,16 +983,11 @@ static ssize_t write_file_spectral_fft_period(struct file *file, · 32 unmodified lines
999983 {
1000984 struct ath_spec_scan_priv *spec_priv = file->private_data;
1001985 unsigned long val;
1002− char buf[32];
1003− ssize_t len;
1004−
1005− len = min(count, sizeof(buf) - 1);
1006− if (copy_from_user(buf, user_buf, len))
1007− return -EFAULT;
986+ ssize_t ret;
1008987
1009− buf[len] = '\0';
1010− if (kstrtoul(buf, 0, &val))
1011− return -EINVAL;
988+ ret = kstrtoul_from_user(user_buf, count, 0, &val);
989+ if (ret)
990+ return ret;
1012991
1013992 if (val > 15)
1014993 return -EINVAL;
drivers/net/wireless/ath/ath9k/common.h+0−2
@@ -85,8 +85,6 @@ struct ath9k_channel *ath9k_cmn_get_channel(struct ieee80211_hw *hw, · 84 unmodified lines
8585 struct ath_hw *ah,
8686 struct cfg80211_chan_def *chandef);
8787 int ath9k_cmn_count_streams(unsigned int chainmask, int max);
88−void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common,
89− enum ath_stomp_type stomp_type);
9088 void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow,
9189 u16 new_txpow, u16 *txpower);
9290 void ath9k_cmn_init_crypto(struct ath_hw *ah);
drivers/net/wireless/ath/ath9k/debug.c+34−74
@@ -96,21 +96,16 @@ static ssize_t read_file_debug(struct file *file, char __user *user_buf, · 95 unmodified lines
9696 }
9797
9898 static ssize_t write_file_debug(struct file *file, const char __user *user_buf,
99− size_t count, loff_t *ppos)
99+ size_t count, loff_t *ppos)
100100 {
101101 struct ath_softc *sc = file->private_data;
102102 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
103103 unsigned long mask;
104− char buf[32];
105− ssize_t len;
104+ ssize_t ret;
106105
107− len = min(count, sizeof(buf) - 1);
108− if (copy_from_user(buf, user_buf, len))
109− return -EFAULT;
110−
111− buf[len] = '\0';
112− if (kstrtoul(buf, 0, &mask))
113− return -EINVAL;
106+ ret = kstrtoul_from_user(user_buf, count, 0, &mask);
107+ if (ret)
108+ return ret;
114109
115110 common->debug_mask = mask;
116111 return count;
@@ -191,16 +186,11 @@ static ssize_t write_file_ani(struct file *file, · 74 unmodified lines
191186 struct ath_softc *sc = file->private_data;
192187 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
193188 unsigned long ani;
194− char buf[32];
195− ssize_t len;
189+ ssize_t ret;
196190
197− len = min(count, sizeof(buf) - 1);
198− if (copy_from_user(buf, user_buf, len))
199− return -EFAULT;
200−
201− buf[len] = '\0';
202− if (kstrtoul(buf, 0, &ani))
203− return -EINVAL;
191+ ret = kstrtoul_from_user(user_buf, count, 0, &ani);
192+ if (ret)
193+ return ret;
204194
205195 if (ani > 1)
206196 return -EINVAL;
@@ -248,20 +238,15 @@ static ssize_t write_file_bt_ant_diversity(struct file *file, · 41 unmodified lines
248238 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
249239 struct ath9k_hw_capabilities *pCap = &sc->sc_ah->caps;
250240 unsigned long bt_ant_diversity;
251− char buf[32];
252− ssize_t len;
241+ ssize_t ret;
253242
254− len = min(count, sizeof(buf) - 1);
255− if (copy_from_user(buf, user_buf, len))
256− return -EFAULT;
243+ ret = kstrtoul_from_user(user_buf, count, 0, &bt_ant_diversity);
244+ if (ret)
245+ return ret;
257246
258247 if (!(pCap->hw_caps & ATH9K_HW_CAP_BT_ANT_DIV))
259248 goto exit;
260249
261− buf[len] = '\0';
262− if (kstrtoul(buf, 0, &bt_ant_diversity))
263− return -EINVAL;
264−
265250 common->bt_ant_diversity = !!bt_ant_diversity;
266251 ath9k_ps_wakeup(sc);
267252 ath9k_hw_set_bt_ant_diversity(sc->sc_ah, common->bt_ant_diversity);
@@ -792,16 +777,11 @@ static ssize_t write_file_reset(struct file *file, · 524 unmodified lines
792777 struct ath_hw *ah = sc->sc_ah;
793778 struct ath_common *common = ath9k_hw_common(ah);
794779 unsigned long val;
795− char buf[32];
796− ssize_t len;
797−
798− len = min(count, sizeof(buf) - 1);
799− if (copy_from_user(buf, user_buf, len))
800− return -EFAULT;
780+ ssize_t ret;
801781
802− buf[len] = '\0';
803− if (kstrtoul(buf, 0, &val))
804− return -EINVAL;
782+ ret = kstrtoul_from_user(user_buf, count, 0, &val);
783+ if (ret)
784+ return ret;
805785
806786 if (val != 1)
807787 return -EINVAL;
@@ -886,16 +866,11 @@ static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, · 78 unmodified lines
886866 {
887867 struct ath_softc *sc = file->private_data;
888868 unsigned long regidx;
889− char buf[32];
890− ssize_t len;
869+ ssize_t ret;
891870
892− len = min(count, sizeof(buf) - 1);
893− if (copy_from_user(buf, user_buf, len))
894− return -EFAULT;
895−
896− buf[len] = '\0';
897− if (kstrtoul(buf, 0, &regidx))
898− return -EINVAL;
871+ ret = kstrtoul_from_user(user_buf, count, 0, &regidx);
872+ if (ret)
873+ return ret;
899874
900875 sc->debug.regidx = regidx;
901876 return count;
@@ -931,16 +906,11 @@ static ssize_t write_file_regval(struct file *file, const char __user *user_buf, · 29 unmodified lines
931906 struct ath_softc *sc = file->private_data;
932907 struct ath_hw *ah = sc->sc_ah;
933908 unsigned long regval;
934− char buf[32];
935− ssize_t len;
936−
937− len = min(count, sizeof(buf) - 1);
938− if (copy_from_user(buf, user_buf, len))
939− return -EFAULT;
909+ ssize_t ret;
940910
941− buf[len] = '\0';
942− if (kstrtoul(buf, 0, &regval))
943− return -EINVAL;
911+ ret = kstrtoul_from_user(user_buf, count, 0, &regval);
912+ if (ret)
913+ return ret;
944914
945915 ath9k_ps_wakeup(sc);
946916 REG_WRITE_D(ah, sc->debug.regidx, regval);
@@ -1128,16 +1098,11 @@ static ssize_t write_file_wow(struct file *file, const char __user *user_buf, · 181 unmodified lines
11281098 {
11291099 struct ath_softc *sc = file->private_data;
11301100 unsigned long val;
1131− char buf[32];
1132− ssize_t len;
1133−
1134− len = min(count, sizeof(buf) - 1);
1135− if (copy_from_user(buf, user_buf, len))
1136− return -EFAULT;
1101+ ssize_t ret;
11371102
1138− buf[len] = '\0';
1139− if (kstrtoul(buf, 0, &val))
1140− return -EINVAL;
1103+ ret = kstrtoul_from_user(user_buf, count, 0, &val);
1104+ if (ret)
1105+ return ret;
11411106
11421107 if (val != 1)
11431108 return -EINVAL;
@@ -1191,17 +1156,12 @@ static ssize_t write_file_tpc(struct file *file, const char __user *user_buf, · 47 unmodified lines
11911156 struct ath_softc *sc = file->private_data;
11921157 struct ath_hw *ah = sc->sc_ah;
11931158 unsigned long val;
1194− char buf[32];
1195− ssize_t len;
1159+ ssize_t ret;
11961160 bool tpc_enabled;
11971161
1198− len = min(count, sizeof(buf) - 1);
1199− if (copy_from_user(buf, user_buf, len))
1200− return -EFAULT;
1201−
1202− buf[len] = '\0';
1203− if (kstrtoul(buf, 0, &val))
1204− return -EINVAL;
1162+ ret = kstrtoul_from_user(user_buf, count, 0, &val);
1163+ if (ret)
1164+ return ret;
12051165
12061166 if (val > 1)
12071167 return -EINVAL;
@@ -1420,7 +1380,7 @@ int ath9k_init_debug(struct ath_hw *ah) · 212 unmodified lines
14201380
14211381 sc->debug.debugfs_phy = debugfs_create_dir("ath9k",
14221382 sc->hw->wiphy->debugfsdir);
1423− if (!sc->debug.debugfs_phy)
1383+ if (IS_ERR(sc->debug.debugfs_phy))
14241384 return -ENOMEM;
14251385
14261386 #ifdef CONFIG_ATH_DEBUG
drivers/net/wireless/ath/ath9k/dfs_debug.c+4−10
@@ -99,17 +99,11 @@ static ssize_t write_file_dfs(struct file *file, const char __user *user_buf, · 98 unmodified lines
9999 {
100100 struct ath_softc *sc = file->private_data;
101101 unsigned long val;
102− char buf[32];
103− ssize_t len;
104−
105− len = min(count, sizeof(buf) - 1);
106− if (copy_from_user(buf, user_buf, len))
107− return -EFAULT;
108−
109− buf[len] = '\0';
110− if (kstrtoul(buf, 0, &val))
111− return -EINVAL;
102+ ssize_t ret;
112103
104+ ret = kstrtoul_from_user(user_buf, count, 0, &val);
105+ if (ret)
106+ return ret;
113107 if (val == DFS_STATS_RESET_MAGIC)
114108 memset(&sc->debug.stats.dfs_stats, 0,
115109 sizeof(sc->debug.stats.dfs_stats));
drivers/net/wireless/ath/ath9k/eeprom_9287.c+1−2
@@ -572,8 +572,7 @@ static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah, · 571 unmodified lines
572572 }
573573
574574 for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
575− bool isHt40CtlMode =
576− (pCtlMode[ctlMode] == CTL_2GHT40) ? true : false;
575+ bool isHt40CtlMode = pCtlMode[ctlMode] == CTL_2GHT40;
577576
578577 if (isHt40CtlMode)
579578 freq = centers.synth_center;
drivers/net/wireless/ath/ath9k/hif_usb.c+1−1
@@ -1432,7 +1432,7 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface) · 1431 unmodified lines
14321432 {
14331433 struct usb_device *udev = interface_to_usbdev(interface);
14341434 struct hif_device_usb *hif_dev = usb_get_intfdata(interface);
1435− bool unplugged = (udev->state == USB_STATE_NOTATTACHED) ? true : false;
1435+ bool unplugged = udev->state == USB_STATE_NOTATTACHED;
14361436
14371437 if (!hif_dev)
14381438 return;
drivers/net/wireless/ath/ath9k/htc_drv_debug.c+5−10
@@ -375,16 +375,11 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf, · 374 unmodified lines
375375 struct ath9k_htc_priv *priv = file->private_data;
376376 struct ath_common *common = ath9k_hw_common(priv->ah);
377377 unsigned long mask;
378− char buf[32];
379− ssize_t len;
380−
381− len = min(count, sizeof(buf) - 1);
382− if (copy_from_user(buf, user_buf, len))
383− return -EFAULT;
378+ ssize_t ret;
384379
385− buf[len] = '\0';
386− if (kstrtoul(buf, 0, &mask))
387− return -EINVAL;
380+ ret = kstrtoul_from_user(user_buf, count, 0, &mask);
381+ if (ret)
382+ return ret;
388383
389384 common->debug_mask = mask;
390385 return count;
@@ -491,7 +486,7 @@ int ath9k_htc_init_debug(struct ath_hw *ah) · 100 unmodified lines
491486
492487 priv->debug.debugfs_phy = debugfs_create_dir(KBUILD_MODNAME,
493488 priv->hw->wiphy->debugfsdir);
494− if (!priv->debug.debugfs_phy)
489+ if (IS_ERR(priv->debug.debugfs_phy))
495490 return -ENOMEM;
496491
497492 ath9k_cmn_spectral_init_debug(&priv->spec_priv, priv->debug.debugfs_phy);
drivers/net/wireless/ath/ath9k/htc_drv_main.c+1−2
@@ -719,7 +719,7 @@ static int ath9k_htc_tx_aggr_oper(struct ath9k_htc_priv *priv, · 718 unmodified lines
719719
720720 aggr.sta_index = ista->index;
721721 aggr.tidno = tid & 0xf;
722− aggr.aggr_enable = (action == IEEE80211_AMPDU_TX_START) ? true : false;
722+ aggr.aggr_enable = action == IEEE80211_AMPDU_TX_START;
723723
724724 WMI_CMD_BUF(WMI_TX_AGGR_ENABLE_CMDID, &aggr);
725725 if (ret)
@@ -1264,7 +1264,6 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw, · 538 unmodified lines
12641264 u32 rfilt;
12651265
12661266 mutex_lock(&priv->mutex);
1267− changed_flags &= SUPPORTED_FILTERS;
12681267 *total_flags &= SUPPORTED_FILTERS;
12691268
12701269 if (test_bit(ATH_OP_INVALID, &common->op_flags)) {
drivers/net/wireless/ath/ath9k/main.c+0−1
@@ -1571,7 +1571,6 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw, · 1570 unmodified lines
15711571 struct ath_chanctx *ctx;
15721572 u32 rfilt;
15731573
1574− changed_flags &= SUPPORTED_FILTERS;
15751574 *total_flags &= SUPPORTED_FILTERS;
15761575
15771576 spin_lock_bh(&sc->chan_lock);
drivers/net/wireless/ath/ath9k/tx99.c+4−10
@@ -172,9 +172,8 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, · 171 unmodified lines
172172 {
173173 struct ath_softc *sc = file->private_data;
174174 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
175− char buf[32];
176175 bool start;
177− ssize_t len;
176+ ssize_t ret;
178177 int r;
179178
180179 if (count < 1)
@@ -183,14 +182,9 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, · 2 unmodified lines
183182 if (sc->cur_chan->nvifs > 1)
184183 return -EOPNOTSUPP;
185184
186− len = min(count, sizeof(buf) - 1);
187− if (copy_from_user(buf, user_buf, len))
188− return -EFAULT;
189−
190− buf[len] = '\0';
191−
192− if (kstrtobool(buf, &start))
193− return -EINVAL;
185+ ret = kstrtobool_from_user(user_buf, count, &start);
186+ if (ret)
187+ return ret;
194188
195189 mutex_lock(&sc->mutex);
196190
drivers/net/wireless/ath/ath9k/wmi.c+12−8
@@ -242,10 +242,10 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb, · 241 unmodified lines
242242 spin_unlock_irqrestore(&wmi->wmi_lock, flags);
243243 goto free_skb;
244244 }
245− spin_unlock_irqrestore(&wmi->wmi_lock, flags);
246245
247246 /* WMI command response */
248247 ath9k_wmi_rsp_callback(wmi, skb);
248+ spin_unlock_irqrestore(&wmi->wmi_lock, flags);
249249
250250 free_skb:
251251 kfree_skb(skb);
@@ -283,7 +283,8 @@ int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi, · 31 unmodified lines
283283
284284 static int ath9k_wmi_cmd_issue(struct wmi *wmi,
285285 struct sk_buff *skb,
286− enum wmi_cmd_id cmd, u16 len)
286+ enum wmi_cmd_id cmd, u16 len,
287+ u8 *rsp_buf, u32 rsp_len)
287288 {
288289 struct wmi_cmd_hdr *hdr;
289290 unsigned long flags;
@@ -293,6 +294,11 @@ static int ath9k_wmi_cmd_issue(struct wmi *wmi, · 3 unmodified lines
293294 hdr->seq_no = cpu_to_be16(++wmi->tx_seq_id);
294295
295296 spin_lock_irqsave(&wmi->wmi_lock, flags);
297+
298+ /* record the rsp buffer and length */
299+ wmi->cmd_rsp_buf = rsp_buf;
300+ wmi->cmd_rsp_len = rsp_len;
301+
296302 wmi->last_seq_id = wmi->tx_seq_id;
297303 spin_unlock_irqrestore(&wmi->wmi_lock, flags);
298304
@@ -308,8 +314,8 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, · 9 unmodified lines
308314 struct ath_common *common = ath9k_hw_common(ah);
309315 u16 headroom = sizeof(struct htc_frame_hdr) +
310316 sizeof(struct wmi_cmd_hdr);
317+ unsigned long time_left, flags;
311318 struct sk_buff *skb;
312− unsigned long time_left;
313319 int ret = 0;
314320
315321 if (ah->ah_flags & AH_UNPLUGGED)
@@ -333,11 +339,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, · 17 unmodified lines
333339 goto out;
334340 }
335341
336− /* record the rsp buffer and length */
337− wmi->cmd_rsp_buf = rsp_buf;
338− wmi->cmd_rsp_len = rsp_len;
339−
340− ret = ath9k_wmi_cmd_issue(wmi, skb, cmd_id, cmd_len);
342+ ret = ath9k_wmi_cmd_issue(wmi, skb, cmd_id, cmd_len, rsp_buf, rsp_len);
341343 if (ret)
342344 goto out;
343345
@@ -345,7 +347,9 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, · 1 unmodified line
345347 if (!time_left) {
346348 ath_dbg(common, WMI, "Timeout waiting for WMI command: %s\n",
347349 wmi_cmd_to_name(cmd_id));
350+ spin_lock_irqsave(&wmi->wmi_lock, flags);
348351 wmi->last_seq_id = 0;
352+ spin_unlock_irqrestore(&wmi->wmi_lock, flags);
349353 mutex_unlock(&wmi->op_mutex);
350354 return -ETIMEDOUT;
351355 }
drivers/net/wireless/ath/key.c+1−1
@@ -104,7 +104,7 @@ bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac) · 103 unmodified lines
104104 * Not setting this bit allows the hardware to use the key
105105 * for multicast frame decryption.
106106 */
107− if (mac[0] & 0x01)
107+ if (is_multicast_ether_addr(mac))
108108 unicast_flag = 0;
109109
110110 macLo = get_unaligned_le32(mac);
drivers/net/wireless/atmel/at76c50x-usb.c+4−4
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 * Copyright (c) 2007 Kalle Valo <kalle.valo@iki.fi>
1111 * Copyright (c) 2010 Sebastian Smolorz <sesmo@gmx.net>
1212 *
13− * This file is part of the Berlios driver for WLAN USB devices based on the
13+ * This file is part of the Berlios driver for USB WLAN devices based on the
1414 * Atmel AT76C503A/505/505A.
1515 *
1616 * Some iw_handler code was taken from airo.c, (C) 1999 Benjamin Reed
@@ -143,7 +143,7 @@ static const struct usb_device_id dev_table[] = { · 126 unmodified lines
143143 { USB_DEVICE(0x0cde, 0x0001), USB_DEVICE_DATA(BOARD_503_ISL3861) },
144144 /* Dynalink/Askey WLL013 (intersil) */
145145 { USB_DEVICE(0x069a, 0x0320), USB_DEVICE_DATA(BOARD_503_ISL3861) },
146− /* EZ connect 11Mpbs Wireless USB Adapter SMC2662W v1 */
146+ /* EZ connect 11Mpbs USB Wireless Adapter SMC2662W v1 */
147147 { USB_DEVICE(0x0d5c, 0xa001), USB_DEVICE_DATA(BOARD_503_ISL3861) },
148148 /* BenQ AWL300 */
149149 { USB_DEVICE(0x04a5, 0x9000), USB_DEVICE_DATA(BOARD_503_ISL3861) },
@@ -195,7 +195,7 @@ static const struct usb_device_id dev_table[] = { · 45 unmodified lines
195195 { USB_DEVICE(0x04a5, 0x9001), USB_DEVICE_DATA(BOARD_503) },
196196 /* 3Com 3CRSHEW696 */
197197 { USB_DEVICE(0x0506, 0x0a01), USB_DEVICE_DATA(BOARD_503) },
198− /* Siemens Santis ADSL WLAN USB adapter WLL 013 */
198+ /* Siemens Santis ADSL USB WLAN adapter WLL 013 */
199199 { USB_DEVICE(0x0681, 0x001b), USB_DEVICE_DATA(BOARD_503) },
200200 /* Belkin F5D6050, version 2 */
201201 { USB_DEVICE(0x050d, 0x0050), USB_DEVICE_DATA(BOARD_503) },
@@ -238,7 +238,7 @@ static const struct usb_device_id dev_table[] = { · 36 unmodified lines
238238 { USB_DEVICE(0x1915, 0x2233), USB_DEVICE_DATA(BOARD_505_2958) },
239239 /* Xterasys XN-2122B, IBlitzz BWU613B/BWU613SB */
240240 { USB_DEVICE(0x12fd, 0x1001), USB_DEVICE_DATA(BOARD_505_2958) },
241− /* Corega WLAN USB Stick 11 */
241+ /* Corega USB WLAN Stick 11 */
242242 { USB_DEVICE(0x07aa, 0x7613), USB_DEVICE_DATA(BOARD_505_2958) },
243243 /* Microstar MSI Box MS6978 */
244244 { USB_DEVICE(0x0db0, 0x1020), USB_DEVICE_DATA(BOARD_505_2958) },
drivers/net/wireless/intel/ipw2x00/ipw2200.c+12−27
@@ -1176,23 +1176,20 @@ static ssize_t debug_level_show(struct device_driver *d, char *buf) · 1175 unmodified lines
11761176 static ssize_t debug_level_store(struct device_driver *d, const char *buf,
11771177 size_t count)
11781178 {
1179− char *p = (char *)buf;
1180− u32 val;
1179+ unsigned long val;
11811180
1182− if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') {
1183− p++;
1184− if (p[0] == 'x' || p[0] == 'X')
1185− p++;
1186− val = simple_strtoul(p, &p, 16);
1187− } else
1188− val = simple_strtoul(p, &p, 10);
1189− if (p == buf)
1181+ int result = kstrtoul(buf, 0, &val);
1182+
1183+ if (result == -EINVAL)
11901184 printk(KERN_INFO DRV_NAME
11911185 ": %s is not in hex or decimal form.\n", buf);
1186+ else if (result == -ERANGE)
1187+ printk(KERN_INFO DRV_NAME
1188+ ": %s has overflowed.\n", buf);
11921189 else
11931190 ipw_debug_level = val;
11941191
1195− return strnlen(buf, count);
1192+ return count;
11961193 }
11971194 static DRIVER_ATTR_RW(debug_level);
11981195
@@ -1461,25 +1458,13 @@ static ssize_t scan_age_store(struct device *d, struct device_attribute *attr, · 262 unmodified lines
14611458 {
14621459 struct ipw_priv *priv = dev_get_drvdata(d);
14631460 struct net_device *dev = priv->net_dev;
1464− char buffer[] = "00000000";
1465− unsigned long len =
1466− (sizeof(buffer) - 1) > count ? count : sizeof(buffer) - 1;
1467− unsigned long val;
1468− char *p = buffer;
14691461
14701462 IPW_DEBUG_INFO("enter\n");
14711463
1472− strncpy(buffer, buf, len);
1473− buffer[len] = 0;
1464+ unsigned long val;
1465+ int result = kstrtoul(buf, 0, &val);
14741466
1475− if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') {
1476− p++;
1477− if (p[0] == 'x' || p[0] == 'X')
1478− p++;
1479− val = simple_strtoul(p, &p, 16);
1480− } else
1481− val = simple_strtoul(p, &p, 10);
1482− if (p == buffer) {
1467+ if (result == -EINVAL || result == -ERANGE) {
14831468 IPW_DEBUG_INFO("%s: user supplied invalid value.\n", dev->name);
14841469 } else {
14851470 priv->ieee->scan_age = val;
@@ -1487,7 +1472,7 @@ static ssize_t scan_age_store(struct device *d, struct device_attribute *attr, · 1 unmodified line
14871472 }
14881473
14891474 IPW_DEBUG_INFO("exit\n");
1490− return len;
1475+ return count;
14911476 }
14921477
14931478 static DEVICE_ATTR_RW(scan_age);
drivers/net/wireless/intel/iwlwifi/fw/acpi.c+5−0
@@ -69,6 +69,11 @@ static const struct dmi_system_id dmi_ppag_approved_list[] = { · 68 unmodified lines
6969 DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
7070 },
7171 },
72+ { .ident = "RAZER",
73+ .matches = {
74+ DMI_MATCH(DMI_SYS_VENDOR, "Razer"),
75+ },
76+ },
7277 {}
7378 };
7479
drivers/net/wireless/intel/iwlwifi/fw/api/debug.h+7−2
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
22 /*
3− * Copyright (C) 2005-2014, 2018-2022 Intel Corporation
3+ * Copyright (C) 2005-2014, 2018-2023 Intel Corporation
44 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55 * Copyright (C) 2016-2017 Intel Deutschland GmbH
66 */
@@ -29,6 +29,11 @@ enum iwl_debug_cmds { · 22 unmodified lines
2929 * &struct iwl_dbg_host_event_cfg_cmd
3030 */
3131 HOST_EVENT_CFG = 0x3,
32+ /**
33+ * @INVALID_WR_PTR_CMD: invalid write pointer, set in the TFD
34+ * when it's not in use
35+ */
36+ INVALID_WR_PTR_CMD = 0x6,
3237 /**
3338 * @DBGC_SUSPEND_RESUME:
3439 * DBGC suspend/resume commad. Uses a single dword as data:
@@ -377,7 +382,7 @@ struct iwl_buf_alloc_cmd { · 342 unmodified lines
377382 #define DRAM_INFO_SECOND_MAGIC_WORD 0x89ABCDEF
378383
379384 /**
380− * struct iwL_dram_info - DRAM fragments allocation struct
385+ * struct iwl_dram_info - DRAM fragments allocation struct
381386 *
382387 * Driver will fill in the first 1K(+) of the pointed DRAM fragment
383388 *
drivers/net/wireless/intel/iwlwifi/fw/dump.c+1−2
@@ -182,8 +182,7 @@ static void iwl_fwrt_dump_lmac_error_log(struct iwl_fw_runtime *fwrt, u8 lmac_nu · 181 unmodified lines
182182 base = fwrt->fw->inst_errlog_ptr;
183183 }
184184
185− if ((fwrt->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ && !base) ||
186− (fwrt->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_BZ && base < 0x400000)) {
185+ if (!base) {
187186 IWL_ERR(fwrt,
188187 "Not valid error log pointer 0x%08X for %s uCode\n",
189188 base,
drivers/net/wireless/intel/iwlwifi/iwl-fh.h+2−0
@@ -565,6 +565,8 @@ static inline unsigned int FH_MEM_CBBC_QUEUE(struct iwl_trans *trans, · 564 unmodified lines
565565 #define RX_QUEUE_MASK 255
566566 #define RX_QUEUE_SIZE_LOG 8
567567
568+#define IWL_DEFAULT_RX_QUEUE 0
569+
568570 /**
569571 * struct iwl_rb_status - reserve buffer status
570572 * host memory mapped FH registers
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c+2−0
@@ -990,6 +990,8 @@ iwl_nvm_fixup_sband_iftd(struct iwl_trans *trans, · 989 unmodified lines
990990 case IWL_CFG_RF_TYPE_GF:
991991 case IWL_CFG_RF_TYPE_MR:
992992 case IWL_CFG_RF_TYPE_MS:
993+ case IWL_CFG_RF_TYPE_FM:
994+ case IWL_CFG_RF_TYPE_WH:
993995 iftype_data->he_cap.he_cap_elem.phy_cap_info[9] |=
994996 IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU;
995997 if (!is_ap)
drivers/net/wireless/intel/iwlwifi/iwl-trans.h+5−2
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
22 /*
3− * Copyright (C) 2005-2014, 2018-2022 Intel Corporation
3+ * Copyright (C) 2005-2014, 2018-2023 Intel Corporation
44 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55 * Copyright (C) 2016-2017 Intel Deutschland GmbH
66 */
@@ -1069,6 +1069,7 @@ struct iwl_trans_txqs { · 1062 unmodified lines
10691069 * @mbx_addr_1_step: step address data 1
10701070 * @pcie_link_speed: current PCIe link speed (%PCI_EXP_LNKSTA_CLS_*),
10711071 * only valid for discrete (not integrated) NICs
1072+ * @invalid_tx_cmd: invalid TX command buffer
10721073 */
10731074 struct iwl_trans {
10741075 bool csme_own;
@@ -1133,6 +1134,8 @@ struct iwl_trans { · 58 unmodified lines
11331134
11341135 u8 pcie_link_speed;
11351136
1137+ struct iwl_dma_ptr invalid_tx_cmd;
1138+
11361139 /* pointer to trans specific struct */
11371140 /*Ensure that this pointer will always be aligned to sizeof pointer */
11381141 char trans_specific[] __aligned(sizeof(void *));
@@ -1490,7 +1493,7 @@ static inline u32 iwl_trans_read_mem32(struct iwl_trans *trans, u32 addr) · 351 unmodified lines
14901493 {
14911494 u32 value;
14921495
1493− if (WARN_ON(iwl_trans_read_mem(trans, addr, &value, 1)))
1496+ if (iwl_trans_read_mem(trans, addr, &value, 1))
14941497 return 0xa5a5a5a5;
14951498
14961499 return value;
drivers/net/wireless/intel/iwlwifi/mei/main.c+36−34
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 /*
3− * Copyright (C) 2021-2022 Intel Corporation
3+ * Copyright (C) 2021-2023 Intel Corporation
44 */
55
66 #include <linux/etherdevice.h>
@@ -774,9 +774,13 @@ static void iwl_mei_set_init_conf(struct iwl_mei *mei) · 767 unmodified lines
774774 iwl_mei_send_sap_msg_payload(mei->cldev, &sar_msg.hdr);
775775 }
776776
777− ether_addr_copy(nic_info_msg.mac_address, iwl_mei_cache.mac_address);
778− ether_addr_copy(nic_info_msg.nvm_address, iwl_mei_cache.nvm_address);
779− iwl_mei_send_sap_msg_payload(mei->cldev, &nic_info_msg.hdr);
777+ if (is_valid_ether_addr(iwl_mei_cache.mac_address)) {
778+ ether_addr_copy(nic_info_msg.mac_address,
779+ iwl_mei_cache.mac_address);
780+ ether_addr_copy(nic_info_msg.nvm_address,
781+ iwl_mei_cache.nvm_address);
782+ iwl_mei_send_sap_msg_payload(mei->cldev, &nic_info_msg.hdr);
783+ }
780784
781785 iwl_mei_send_sap_msg_payload(mei->cldev, &rfkill_msg.hdr);
782786 }
@@ -1532,7 +1536,7 @@ void iwl_mei_host_associated(const struct iwl_mei_conn_info *conn_info, · 749 unmodified lines
15321536
15331537 mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
15341538
1535− if (!mei && !mei->amt_enabled)
1539+ if (!mei || !mei->amt_enabled)
15361540 goto out;
15371541
15381542 iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
@@ -1561,7 +1565,7 @@ void iwl_mei_host_disassociated(void) · 22 unmodified lines
15611565
15621566 mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
15631567
1564− if (!mei && !mei->amt_enabled)
1568+ if (!mei || !mei->amt_enabled)
15651569 goto out;
15661570
15671571 iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
@@ -1597,7 +1601,7 @@ void iwl_mei_set_rfkill_state(bool hw_rfkill, bool sw_rfkill) · 29 unmodified lines
15971601
15981602 mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
15991603
1600− if (!mei && !mei->amt_enabled)
1604+ if (!mei || !mei->amt_enabled)
16011605 goto out;
16021606
16031607 iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
@@ -1626,7 +1630,7 @@ void iwl_mei_set_nic_info(const u8 *mac_address, const u8 *nvm_address) · 22 unmodified lines
16261630
16271631 mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
16281632
1629− if (!mei && !mei->amt_enabled)
1633+ if (!mei || !mei->amt_enabled)
16301634 goto out;
16311635
16321636 iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
@@ -1654,7 +1658,7 @@ void iwl_mei_set_country_code(u16 mcc) · 21 unmodified lines
16541658
16551659 mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
16561660
1657− if (!mei && !mei->amt_enabled)
1661+ if (!mei || !mei->amt_enabled)
16581662 goto out;
16591663
16601664 iwl_mei_send_sap_msg_payload(mei->cldev, &msg.hdr);
@@ -1680,7 +1684,7 @@ void iwl_mei_set_power_limit(const __le16 *power_limit) · 19 unmodified lines
16801684
16811685 mei = mei_cldev_get_drvdata(iwl_mei_global_cldev);
16821686
1683− if (!mei && !mei->amt_enabled)
1687+ if (!mei || !mei->amt_enabled)
16841688 goto out;
16851689
16861690 memcpy(msg.sar_chain_info_table, power_limit, sizeof(msg.sar_chain_info_table));
@@ -1832,7 +1836,9 @@ void iwl_mei_unregister_complete(void) · 145 unmodified lines
18321836 struct iwl_mei *mei =
18331837 mei_cldev_get_drvdata(iwl_mei_global_cldev);
18341838
1835− iwl_mei_send_sap_msg(mei->cldev, SAP_MSG_NOTIF_WIFIDR_DOWN);
1839+ if (mei->amt_enabled)
1840+ iwl_mei_send_sap_msg(mei->cldev,
1841+ SAP_MSG_NOTIF_WIFIDR_DOWN);
18361842 mei->got_ownership = false;
18371843 }
18381844
@@ -2070,33 +2076,29 @@ static void iwl_mei_remove(struct mei_cl_device *cldev) · 231 unmodified lines
20702076
20712077 mutex_lock(&iwl_mei_mutex);
20722078
2073− if (mei->amt_enabled) {
2074− /*
2075− * Tell CSME that we are going down so that it won't access the
2076− * memory anymore, make sure this message goes through immediately.
2077− */
2078− mei->csa_throttled = false;
2079− iwl_mei_send_sap_msg(mei->cldev,
2080− SAP_MSG_NOTIF_HOST_GOES_DOWN);
2081−
2082− for (i = 0; i < SEND_SAP_MAX_WAIT_ITERATION; i++) {
2083− if (!iwl_mei_host_to_me_data_pending(mei))
2084− break;
2079+ /* Tell CSME that we are going down so that it won't access the
2080+ * memory anymore, make sure this message goes through immediately.
2081+ */
2082+ mei->csa_throttled = false;
2083+ iwl_mei_send_sap_msg(mei->cldev,
2084+ SAP_MSG_NOTIF_HOST_GOES_DOWN);
20852085
2086− msleep(20);
2087− }
2086+ for (i = 0; i < SEND_SAP_MAX_WAIT_ITERATION; i++) {
2087+ if (!iwl_mei_host_to_me_data_pending(mei))
2088+ break;
20882089
2089− /*
2090− * If we couldn't make sure that CSME saw the HOST_GOES_DOWN
2091− * message, it means that it will probably keep reading memory
2092− * that we are going to unmap and free, expect IOMMU error
2093− * messages.
2094− */
2095− if (i == SEND_SAP_MAX_WAIT_ITERATION)
2096− dev_err(&mei->cldev->dev,
2097− "Couldn't get ACK from CSME on HOST_GOES_DOWN message\n");
2090+ msleep(20);
20982091 }
20992092
2093+ /* If we couldn't make sure that CSME saw the HOST_GOES_DOWN
2094+ * message, it means that it will probably keep reading memory
2095+ * that we are going to unmap and free, expect IOMMU error
2096+ * messages.
2097+ */
2098+ if (i == SEND_SAP_MAX_WAIT_ITERATION)
2099+ dev_err(&mei->cldev->dev,
2100+ "Couldn't get ACK from CSME on HOST_GOES_DOWN message\n");
2101+
21002102 mutex_unlock(&iwl_mei_mutex);
21012103
21022104 /*
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c+3−8
@@ -315,8 +315,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) · 314 unmodified lines
315315 ieee80211_hw_set(hw, STA_MMPDU_TXQ);
316316
317317 /* Set this early since we need to have it for the check below */
318− if (mvm->mld_api_is_used &&
319− mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
318+ if (mvm->mld_api_is_used && mvm->nvm_data->sku_cap_11be_enable &&
319+ !iwlwifi_mod_params.disable_11ax &&
320+ !iwlwifi_mod_params.disable_11be)
320321 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
321322
322323 /* With MLD FW API, it tracks timing by itself,
@@ -5604,9 +5605,6 @@ void iwl_mvm_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 5281 unmodified lines
56045605 return;
56055606 }
56065607
5607− if (vif->type != NL80211_IFTYPE_STATION)
5608− return;
5609−
56105608 /* Make sure we're done with the deferred traffic before flushing */
56115609 flush_work(&mvm->add_stream_wk);
56125610
@@ -5630,9 +5628,6 @@ void iwl_mvm_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 17 unmodified lines
56305628 ap_sta_done = true;
56315629 }
56325630
5633− /* make sure only TDLS peers or the AP are flushed */
5634− WARN_ON_ONCE(sta != mvmvif->ap_sta && !sta->tdls);
5635−
56365631 if (drop) {
56375632 if (iwl_mvm_flush_sta(mvm, mvmsta, false))
56385633 IWL_ERR(mvm, "flush request fail\n");
drivers/net/wireless/intel/iwlwifi/pcie/drv.c+1−10
@@ -1132,12 +1132,6 @@ static int get_crf_id(struct iwl_trans *iwl_trans) · 1131 unmodified lines
11321132 else
11331133 sd_reg_ver_addr = SD_REG_VER;
11341134
1135− if (!iwl_trans_grab_nic_access(iwl_trans)) {
1136− IWL_ERR(iwl_trans, "Failed to grab nic access before reading crf id\n");
1137− ret = -EIO;
1138− goto out;
1139− }
1140−
11411135 /* Enable access to peripheral registers */
11421136 val = iwl_read_umac_prph_no_grab(iwl_trans, WFPM_CTRL_REG);
11431137 val |= ENABLE_WFPM;
@@ -1157,9 +1151,6 @@ static int get_crf_id(struct iwl_trans *iwl_trans) · 13 unmodified lines
11571151 iwl_trans->hw_crf_id, iwl_trans->hw_cnv_id,
11581152 iwl_trans->hw_wfpm_id);
11591153
1160− iwl_trans_release_nic_access(iwl_trans);
1161−
1162−out:
11631154 return ret;
11641155 }
11651156
@@ -1351,6 +1342,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 185 unmodified lines
13511342 if (ret)
13521343 goto out_free_trans;
13531344 if (iwl_trans_grab_nic_access(iwl_trans)) {
1345+ get_crf_id(iwl_trans);
13541346 /* all good */
13551347 iwl_trans_release_nic_access(iwl_trans);
13561348 } else {
@@ -1360,7 +1352,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 3 unmodified lines
13601352 }
13611353
13621354 iwl_trans->hw_rf_id = iwl_read32(iwl_trans, CSR_HW_RF_ID);
1363− get_crf_id(iwl_trans);
13641355
13651356 /*
13661357 * The RF_ID is set to zero in blank OTP so read version to
drivers/net/wireless/intel/iwlwifi/pcie/internal.h+1−3
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
22 /*
3− * Copyright (C) 2003-2015, 2018-2022 Intel Corporation
3+ * Copyright (C) 2003-2015, 2018-2023 Intel Corporation
44 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55 * Copyright (C) 2016-2017 Intel Deutschland GmbH
66 */
@@ -315,7 +315,6 @@ enum iwl_pcie_imr_status { · 308 unmodified lines
315315 * @ucode_write_complete: indicates that the ucode has been copied.
316316 * @ucode_write_waitq: wait queue for uCode load
317317 * @cmd_queue - command queue number
318− * @def_rx_queue - default rx queue number
319318 * @rx_buf_size: Rx buffer size
320319 * @scd_set_active: should the transport configure the SCD for HCMD queue
321320 * @rx_page_order: page order for receive buffer size
@@ -398,7 +397,6 @@ struct iwl_trans_pcie { · 76 unmodified lines
398397 wait_queue_head_t ucode_write_waitq;
399398 wait_queue_head_t sx_waitq;
400399
401− u8 def_rx_queue;
402400 u8 n_no_reclaim_cmds;
403401 u8 no_reclaim_cmds[MAX_NO_RECLAIM_CMDS];
404402 u16 num_rx_bufs;
drivers/net/wireless/intel/iwlwifi/pcie/rx.c+1−1
@@ -1373,7 +1373,7 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans, · 1372 unmodified lines
13731373 }
13741374 }
13751375
1376− if (rxq->id == trans_pcie->def_rx_queue)
1376+ if (rxq->id == IWL_DEFAULT_RX_QUEUE)
13771377 iwl_op_mode_rx(trans->op_mode, &rxq->napi,
13781378 &rxcb);
13791379 else
drivers/net/wireless/intel/iwlwifi/pcie/trans.c+29−2
@@ -2018,6 +2018,30 @@ void iwl_trans_pcie_free_pnvm_dram_regions(struct iwl_dram_regions *dram_regions · 2017 unmodified lines
20182018 memset(desc_dram, 0, sizeof(*desc_dram));
20192019 }
20202020
2021+static void iwl_pcie_free_invalid_tx_cmd(struct iwl_trans *trans)
2022+{
2023+ iwl_pcie_free_dma_ptr(trans, &trans->invalid_tx_cmd);
2024+}
2025+
2026+static int iwl_pcie_alloc_invalid_tx_cmd(struct iwl_trans *trans)
2027+{
2028+ struct iwl_cmd_header_wide bad_cmd = {
2029+ .cmd = INVALID_WR_PTR_CMD,
2030+ .group_id = DEBUG_GROUP,
2031+ .sequence = cpu_to_le16(0xffff),
2032+ .length = cpu_to_le16(0),
2033+ .version = 0,
2034+ };
2035+ int ret;
2036+
2037+ ret = iwl_pcie_alloc_dma_ptr(trans, &trans->invalid_tx_cmd,
2038+ sizeof(bad_cmd));
2039+ if (ret)
2040+ return ret;
2041+ memcpy(trans->invalid_tx_cmd.addr, &bad_cmd, sizeof(bad_cmd));
2042+ return 0;
2043+}
2044+
20212045 void iwl_trans_pcie_free(struct iwl_trans *trans)
20222046 {
20232047 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
@@ -2048,6 +2072,8 @@ void iwl_trans_pcie_free(struct iwl_trans *trans) · 24 unmodified lines
20482072 iwl_pcie_free_ict(trans);
20492073 }
20502074
2075+ iwl_pcie_free_invalid_tx_cmd(trans);
2076+
20512077 iwl_pcie_free_fw_monitor(trans);
20522078
20532079 iwl_trans_pcie_free_pnvm_dram_regions(&trans_pcie->pnvm_data,
@@ -3617,8 +3643,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 1563 unmodified lines
36173643 PCIE_LINK_STATE_CLKPM);
36183644 }
36193645
3620− trans_pcie->def_rx_queue = 0;
3621−
36223646 pci_set_master(pdev);
36233647
36243648 addr_size = trans->txqs.tfd.addr_size;
@@ -3686,6 +3710,9 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 61 unmodified lines
36863710
36873711 init_waitqueue_head(&trans_pcie->sx_waitq);
36883712
3713+ ret = iwl_pcie_alloc_invalid_tx_cmd(trans);
3714+ if (ret)
3715+ goto out_no_pci;
36893716
36903717 if (trans_pcie->msix_enabled) {
36913718 ret = iwl_pcie_init_msix_handler(pdev, trans_pcie);
drivers/net/wireless/intel/iwlwifi/pcie/tx.c+6−18
@@ -132,22 +132,6 @@ void iwl_pcie_txq_check_wrptrs(struct iwl_trans *trans) · 131 unmodified lines
132132 }
133133 }
134134
135−static inline void iwl_pcie_tfd_set_tb(struct iwl_trans *trans, void *tfd,
136− u8 idx, dma_addr_t addr, u16 len)
137−{
138− struct iwl_tfd *tfd_fh = (void *)tfd;
139− struct iwl_tfd_tb *tb = &tfd_fh->tbs[idx];
140−
141− u16 hi_n_len = len << 4;
142−
143− put_unaligned_le32(addr, &tb->lo);
144− hi_n_len |= iwl_get_dma_hi_addr(addr);
145−
146− tb->hi_n_len = cpu_to_le16(hi_n_len);
147−
148− tfd_fh->num_tbs = idx + 1;
149−}
150−
151135 static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq,
152136 dma_addr_t addr, u16 len, bool reset)
153137 {
@@ -172,7 +156,7 @@ static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq, · 18 unmodified lines
172156 "Unaligned address = %llx\n", (unsigned long long)addr))
173157 return -EINVAL;
174158
175− iwl_pcie_tfd_set_tb(trans, tfd, num_tbs, addr, len);
159+ iwl_pcie_gen1_tfd_set_tb(trans, tfd, num_tbs, addr, len);
176160
177161 return num_tbs;
178162 }
@@ -1203,7 +1187,11 @@ void iwl_pcie_hcmd_complete(struct iwl_trans *trans, · 1024 unmodified lines
12031187 group_id = cmd->hdr.group_id;
12041188 cmd_id = WIDE_ID(group_id, cmd->hdr.cmd);
12051189
1206− iwl_txq_gen1_tfd_unmap(trans, meta, txq, index);
1190+ if (trans->trans_cfg->gen2)
1191+ iwl_txq_gen2_tfd_unmap(trans, meta,
1192+ iwl_txq_get_tfd(trans, txq, index));
1193+ else
1194+ iwl_txq_gen1_tfd_unmap(trans, meta, txq, index);
12071195
12081196 /* Input error checking is done when commands are added to queue. */
12091197 if (meta->flags & CMD_WANT_SKB) {
drivers/net/wireless/intel/iwlwifi/queue/tx.c+78−64
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include "fw/api/commands.h"
1111 #include "fw/api/tx.h"
1212 #include "fw/api/datapath.h"
13+#include "fw/api/debug.h"
1314 #include "queue/tx.h"
1415 #include "iwl-fh.h"
1516 #include "iwl-scd.h"
@@ -84,6 +85,50 @@ static u8 iwl_txq_gen2_get_num_tbs(struct iwl_trans *trans, · 68 unmodified lines
8485 return le16_to_cpu(tfd->num_tbs) & 0x1f;
8586 }
8687
88+int iwl_txq_gen2_set_tb(struct iwl_trans *trans, struct iwl_tfh_tfd *tfd,
89+ dma_addr_t addr, u16 len)
90+{
91+ int idx = iwl_txq_gen2_get_num_tbs(trans, tfd);
92+ struct iwl_tfh_tb *tb;
93+
94+ /* Only WARN here so we know about the issue, but we mess up our
95+ * unmap path because not every place currently checks for errors
96+ * returned from this function - it can only return an error if
97+ * there's no more space, and so when we know there is enough we
98+ * don't always check ...
99+ */
100+ WARN(iwl_txq_crosses_4g_boundary(addr, len),
101+ "possible DMA problem with iova:0x%llx, len:%d\n",
102+ (unsigned long long)addr, len);
103+
104+ if (WARN_ON(idx >= IWL_TFH_NUM_TBS))
105+ return -EINVAL;
106+ tb = &tfd->tbs[idx];
107+
108+ /* Each TFD can point to a maximum max_tbs Tx buffers */
109+ if (le16_to_cpu(tfd->num_tbs) >= trans->txqs.tfd.max_tbs) {
110+ IWL_ERR(trans, "Error can not send more than %d chunks\n",
111+ trans->txqs.tfd.max_tbs);
112+ return -EINVAL;
113+ }
114+
115+ put_unaligned_le64(addr, &tb->addr);
116+ tb->tb_len = cpu_to_le16(len);
117+
118+ tfd->num_tbs = cpu_to_le16(idx + 1);
119+
120+ return idx;
121+}
122+
123+static void iwl_txq_set_tfd_invalid_gen2(struct iwl_trans *trans,
124+ struct iwl_tfh_tfd *tfd)
125+{
126+ tfd->num_tbs = 0;
127+
128+ iwl_txq_gen2_set_tb(trans, tfd, trans->invalid_tx_cmd.dma,
129+ trans->invalid_tx_cmd.size);
130+}
131+
87132 void iwl_txq_gen2_tfd_unmap(struct iwl_trans *trans, struct iwl_cmd_meta *meta,
88133 struct iwl_tfh_tfd *tfd)
89134 {
@@ -111,7 +156,7 @@ void iwl_txq_gen2_tfd_unmap(struct iwl_trans *trans, struct iwl_cmd_meta *meta, · 21 unmodified lines
111156 DMA_TO_DEVICE);
112157 }
113158
114− tfd->num_tbs = 0;
159+ iwl_txq_set_tfd_invalid_gen2(trans, tfd);
115160 }
116161
117162 void iwl_txq_gen2_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq)
@@ -142,42 +187,6 @@ void iwl_txq_gen2_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq) · 24 unmodified lines
142187 }
143188 }
144189
145−int iwl_txq_gen2_set_tb(struct iwl_trans *trans, struct iwl_tfh_tfd *tfd,
146− dma_addr_t addr, u16 len)
147−{
148− int idx = iwl_txq_gen2_get_num_tbs(trans, tfd);
149− struct iwl_tfh_tb *tb;
150−
151− /*
152− * Only WARN here so we know about the issue, but we mess up our
153− * unmap path because not every place currently checks for errors
154− * returned from this function - it can only return an error if
155− * there's no more space, and so when we know there is enough we
156− * don't always check ...
157− */
158− WARN(iwl_txq_crosses_4g_boundary(addr, len),
159− "possible DMA problem with iova:0x%llx, len:%d\n",
160− (unsigned long long)addr, len);
161−
162− if (WARN_ON(idx >= IWL_TFH_NUM_TBS))
163− return -EINVAL;
164− tb = &tfd->tbs[idx];
165−
166− /* Each TFD can point to a maximum max_tbs Tx buffers */
167− if (le16_to_cpu(tfd->num_tbs) >= trans->txqs.tfd.max_tbs) {
168− IWL_ERR(trans, "Error can not send more than %d chunks\n",
169− trans->txqs.tfd.max_tbs);
170− return -EINVAL;
171− }
172−
173− put_unaligned_le64(addr, &tb->addr);
174− tb->tb_len = cpu_to_le16(len);
175−
176− tfd->num_tbs = cpu_to_le16(idx + 1);
177−
178− return idx;
179−}
180−
181190 static struct page *get_workaround_page(struct iwl_trans *trans,
182191 struct sk_buff *skb)
183192 {
@@ -1026,11 +1035,21 @@ static void iwl_txq_stuck_timer(struct timer_list *t) · 842 unmodified lines
10261035 iwl_force_nmi(trans);
10271036 }
10281037
1038+static void iwl_txq_set_tfd_invalid_gen1(struct iwl_trans *trans,
1039+ struct iwl_tfd *tfd)
1040+{
1041+ tfd->num_tbs = 0;
1042+
1043+ iwl_pcie_gen1_tfd_set_tb(trans, tfd, 0, trans->invalid_tx_cmd.dma,
1044+ trans->invalid_tx_cmd.size);
1045+}
1046+
10291047 int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num,
10301048 bool cmd_queue)
10311049 {
1032− size_t tfd_sz = trans->txqs.tfd.size *
1033− trans->trans_cfg->base_params->max_tfd_queue_size;
1050+ size_t num_entries = trans->trans_cfg->gen2 ?
1051+ slots_num : trans->trans_cfg->base_params->max_tfd_queue_size;
1052+ size_t tfd_sz;
10341053 size_t tb0_buf_sz;
10351054 int i;
10361055
@@ -1040,8 +1059,7 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num, · 3 unmodified lines
10401059 if (WARN_ON(txq->entries || txq->tfds))
10411060 return -EINVAL;
10421061
1043− if (trans->trans_cfg->gen2)
1044− tfd_sz = trans->txqs.tfd.size * slots_num;
1062+ tfd_sz = trans->txqs.tfd.size * num_entries;
10451063
10461064 timer_setup(&txq->stuck_timer, iwl_txq_stuck_timer, 0);
10471065 txq->trans = trans;
@@ -1081,6 +1099,15 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num, · 33 unmodified lines
10811099 if (!txq->first_tb_bufs)
10821100 goto err_free_tfds;
10831101
1102+ for (i = 0; i < num_entries; i++) {
1103+ void *tfd = iwl_txq_get_tfd(trans, txq, i);
1104+
1105+ if (trans->trans_cfg->gen2)
1106+ iwl_txq_set_tfd_invalid_gen2(trans, tfd);
1107+ else
1108+ iwl_txq_set_tfd_invalid_gen1(trans, tfd);
1109+ }
1110+
10841111 return 0;
10851112 err_free_tfds:
10861113 dma_free_coherent(trans->dev, tfd_sz, txq->tfds, txq->dma_addr);
@@ -1340,22 +1367,12 @@ error: · 253 unmodified lines
13401367 }
13411368
13421369 static inline dma_addr_t iwl_txq_gen1_tfd_tb_get_addr(struct iwl_trans *trans,
1343− void *_tfd, u8 idx)
1370+ struct iwl_tfd *tfd, u8 idx)
13441371 {
1345− struct iwl_tfd *tfd;
1346− struct iwl_tfd_tb *tb;
1372+ struct iwl_tfd_tb *tb = &tfd->tbs[idx];
13471373 dma_addr_t addr;
13481374 dma_addr_t hi_len;
13491375
1350− if (trans->trans_cfg->gen2) {
1351− struct iwl_tfh_tfd *tfh_tfd = _tfd;
1352− struct iwl_tfh_tb *tfh_tb = &tfh_tfd->tbs[idx];
1353−
1354− return (dma_addr_t)(le64_to_cpu(tfh_tb->addr));
1355− }
1356−
1357− tfd = _tfd;
1358− tb = &tfd->tbs[idx];
13591376 addr = get_unaligned_le32(&tb->lo);
13601377
13611378 if (sizeof(dma_addr_t) <= sizeof(u32))
@@ -1376,7 +1393,7 @@ void iwl_txq_gen1_tfd_unmap(struct iwl_trans *trans, · 14 unmodified lines
13761393 struct iwl_txq *txq, int index)
13771394 {
13781395 int i, num_tbs;
1379− void *tfd = iwl_txq_get_tfd(trans, txq, index);
1396+ struct iwl_tfd *tfd = iwl_txq_get_tfd(trans, txq, index);
13801397
13811398 /* Sanity check on number of chunks */
13821399 num_tbs = iwl_txq_gen1_tfd_get_num_tbs(trans, tfd);
@@ -1408,15 +1425,7 @@ void iwl_txq_gen1_tfd_unmap(struct iwl_trans *trans, · 25 unmodified lines
14081425
14091426 meta->tbs = 0;
14101427
1411− if (trans->trans_cfg->gen2) {
1412− struct iwl_tfh_tfd *tfd_fh = (void *)tfd;
1413−
1414− tfd_fh->num_tbs = 0;
1415− } else {
1416− struct iwl_tfd *tfd_fh = (void *)tfd;
1417−
1418− tfd_fh->num_tbs = 0;
1419− }
1428+ iwl_txq_set_tfd_invalid_gen1(trans, tfd);
14201429 }
14211430
14221431 #define IWL_TX_CRC_SIZE 4
@@ -1520,7 +1529,12 @@ void iwl_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq) · 97 unmodified lines
15201529 /* We have only q->n_window txq->entries, but we use
15211530 * TFD_QUEUE_SIZE_MAX tfds
15221531 */
1523− iwl_txq_gen1_tfd_unmap(trans, &txq->entries[idx].meta, txq, rd_ptr);
1532+ if (trans->trans_cfg->gen2)
1533+ iwl_txq_gen2_tfd_unmap(trans, &txq->entries[idx].meta,
1534+ iwl_txq_get_tfd(trans, txq, rd_ptr));
1535+ else
1536+ iwl_txq_gen1_tfd_unmap(trans, &txq->entries[idx].meta,
1537+ txq, rd_ptr);
15241538
15251539 /* free SKB */
15261540 skb = txq->entries[idx].skb;
drivers/net/wireless/intel/iwlwifi/queue/tx.h+16−10
@@ -131,17 +131,8 @@ struct iwl_tso_hdr_page *get_page_hdr(struct iwl_trans *trans, size_t len, · 130 unmodified lines
131131 struct sk_buff *skb);
132132 #endif
133133 static inline u8 iwl_txq_gen1_tfd_get_num_tbs(struct iwl_trans *trans,
134− void *_tfd)
134+ struct iwl_tfd *tfd)
135135 {
136− struct iwl_tfd *tfd;
137−
138− if (trans->trans_cfg->gen2) {
139− struct iwl_tfh_tfd *tfh_tfd = _tfd;
140−
141− return le16_to_cpu(tfh_tfd->num_tbs) & 0x1f;
142− }
143−
144− tfd = (struct iwl_tfd *)_tfd;
145136 return tfd->num_tbs & 0x1f;
146137 }
147138
@@ -164,6 +155,21 @@ static inline u16 iwl_txq_gen1_tfd_tb_get_len(struct iwl_trans *trans, · 16 unmodified lines
164155 return le16_to_cpu(tb->hi_n_len) >> 4;
165156 }
166157
158+static inline void iwl_pcie_gen1_tfd_set_tb(struct iwl_trans *trans,
159+ struct iwl_tfd *tfd,
160+ u8 idx, dma_addr_t addr, u16 len)
161+{
162+ struct iwl_tfd_tb *tb = &tfd->tbs[idx];
163+ u16 hi_n_len = len << 4;
164+
165+ put_unaligned_le32(addr, &tb->lo);
166+ hi_n_len |= iwl_get_dma_hi_addr(addr);
167+
168+ tb->hi_n_len = cpu_to_le16(hi_n_len);
169+
170+ tfd->num_tbs = idx + 1;
171+}
172+
167173 void iwl_txq_gen1_tfd_unmap(struct iwl_trans *trans,
168174 struct iwl_cmd_meta *meta,
169175 struct iwl_txq *txq, int index);
drivers/net/wireless/intersil/orinoco/orinoco_usb.c+6−6
@@ -129,18 +129,18 @@ MODULE_FIRMWARE("orinoco_ezusb_fw"); · 128 unmodified lines
129129
130130 #define USB_AVAYA8_VENDOR_ID 0x0D98
131131 #define USB_AVAYAE_VENDOR_ID 0x0D9E
132−#define USB_AVAYA_WIRELESS_ID 0x0300 /* Avaya Wireless USB Card */
132+#define USB_AVAYA_WIRELESS_ID 0x0300 /* Avaya USB Wireless Card */
133133
134134 #define USB_AGERE_VENDOR_ID 0x0D4E /* Agere Systems */
135−#define USB_AGERE_MODEL0801_ID 0x1000 /* Wireless USB Card Model 0801 */
136−#define USB_AGERE_MODEL0802_ID 0x1001 /* Wireless USB Card Model 0802 */
137−#define USB_AGERE_REBRANDED_ID 0x047A /* WLAN USB Card */
135+#define USB_AGERE_MODEL0801_ID 0x1000 /* USB Wireless Card Model 0801 */
136+#define USB_AGERE_MODEL0802_ID 0x1001 /* USB Wireless Card Model 0802 */
137+#define USB_AGERE_REBRANDED_ID 0x047A /* USB WLAN Card */
138138
139139 #define USB_ELSA_VENDOR_ID 0x05CC
140140 #define USB_ELSA_AIRLANCER_ID 0x3100 /* ELSA AirLancer USB-11 */
141141
142142 #define USB_LEGEND_VENDOR_ID 0x0E7C
143−#define USB_LEGEND_JOYNET_ID 0x0300 /* Joynet WLAN USB Card */
143+#define USB_LEGEND_JOYNET_ID 0x0300 /* Joynet USB WLAN Card */
144144
145145 #define USB_SAMSUNG_VENDOR_ID 0x04E8
146146 #define USB_SAMSUNG_SEW2001U1_ID 0x5002 /* Samsung SEW-2001u Card */
@@ -154,7 +154,7 @@ MODULE_FIRMWARE("orinoco_ezusb_fw"); · 7 unmodified lines
154154 #define USB_FUJITSU_E1100_ID 0x1002 /* connect2AIR WLAN E-1100 USB */
155155
156156 #define USB_2WIRE_VENDOR_ID 0x1630
157−#define USB_2WIRE_WIRELESS_ID 0xff81 /* 2Wire Wireless USB adapter */
157+#define USB_2WIRE_WIRELESS_ID 0xff81 /* 2Wire USB Wireless adapter */
158158
159159
160160 #define EZUSB_REQUEST_FW_TRANS 0xA0
drivers/net/wireless/legacy/rndis_wlan.c+1−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
22 /*
3− * Driver for RNDIS based wireless USB devices.
3+ * Driver for RNDIS based USB wireless devices.
44 *
55 * Copyright (C) 2007 by Bjorge Dijkstra <bjd@jooz.net>
66 * Copyright (C) 2008-2009 by Jussi Kivilinna <jussi.kivilinna@iki.fi>
drivers/net/wireless/marvell/mwifiex/debugfs.c+15−4
@@ -253,8 +253,11 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf, · 252 unmodified lines
253253 if (!p)
254254 return -ENOMEM;
255255
256− if (!priv || !priv->hist_data)
257− return -EFAULT;
256+ if (!priv || !priv->hist_data) {
257+ ret = -EFAULT;
258+ goto free_and_exit;
259+ }
260+
258261 phist_data = priv->hist_data;
259262
260263 p += sprintf(p, "\n"
@@ -309,6 +312,8 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf, · 48 unmodified lines
309312 ret = simple_read_from_buffer(ubuf, count, ppos, (char *)page,
310313 (unsigned long)p - page);
311314
315+free_and_exit:
316+ free_page(page);
312317 return ret;
313318 }
314319
@@ -420,7 +425,10 @@ mwifiex_regrdwr_write(struct file *file, · 105 unmodified lines
420425 if (IS_ERR(buf))
421426 return PTR_ERR(buf);
422427
423− sscanf(buf, "%u %x %x", &reg_type, &reg_offset, &reg_value);
428+ if (sscanf(buf, "%u %x %x", &reg_type, &reg_offset, &reg_value) != 3) {
429+ ret = -EINVAL;
430+ goto done;
431+ }
424432
425433 if (reg_type == 0 || reg_offset == 0) {
426434 ret = -EINVAL;
@@ -686,7 +694,10 @@ mwifiex_rdeeprom_write(struct file *file, · 259 unmodified lines
686694 if (IS_ERR(buf))
687695 return PTR_ERR(buf);
688696
689− sscanf(buf, "%d %d", &offset, &bytes);
697+ if (sscanf(buf, "%d %d", &offset, &bytes) != 2) {
698+ ret = -EINVAL;
699+ goto done;
700+ }
690701
691702 if (offset == -1 || bytes == -1) {
692703 ret = -EINVAL;
drivers/net/wireless/marvell/mwifiex/decl.h+0−1
@@ -180,7 +180,6 @@ struct mwifiex_rxinfo { · 179 unmodified lines
180180 };
181181
182182 struct mwifiex_txinfo {
183− u32 status_code;
184183 u8 flags;
185184 u8 bss_num;
186185 u8 bss_type;
drivers/net/wireless/marvell/mwifiex/init.c+0−2
@@ -282,14 +282,12 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) · 281 unmodified lines
282282 sleep_cfm_buf->action = cpu_to_le16(SLEEP_CONFIRM);
283283 sleep_cfm_buf->resp_ctrl = cpu_to_le16(RESP_NEEDED);
284284
285− memset(&adapter->sleep_params, 0, sizeof(adapter->sleep_params));
286285 memset(&adapter->sleep_period, 0, sizeof(adapter->sleep_period));
287286 adapter->tx_lock_flag = false;
288287 adapter->null_pkt_interval = 0;
289288 adapter->fw_bands = 0;
290289 adapter->config_bands = 0;
291290 adapter->adhoc_start_band = 0;
292− adapter->scan_channels = NULL;
293291 adapter->fw_release_number = 0;
294292 adapter->fw_cap_info = 0;
295293 memset(&adapter->upld_buf, 0, sizeof(adapter->upld_buf));
drivers/net/wireless/marvell/mwifiex/main.h+4−16
@@ -444,15 +444,6 @@ struct mwifiex_current_bss_params { · 443 unmodified lines
444444 u8 data_rates[MWIFIEX_SUPPORTED_RATES];
445445 };
446446
447−struct mwifiex_sleep_params {
448− u16 sp_error;
449− u16 sp_offset;
450− u16 sp_stable_time;
451− u8 sp_cal_control;
452− u8 sp_ext_sleep_clk;
453− u16 sp_reserved;
454−};
455−
456447 struct mwifiex_sleep_period {
457448 u16 period;
458449 u16 reserved;
@@ -681,7 +672,6 @@ struct mwifiex_private { · 222 unmodified lines
681672 struct cfg80211_chan_def dfs_chandef;
682673 struct workqueue_struct *dfs_cac_workqueue;
683674 struct delayed_work dfs_cac_work;
684− struct timer_list dfs_chan_switch_timer;
685675 struct workqueue_struct *dfs_chan_sw_workqueue;
686676 struct delayed_work dfs_chan_sw_work;
687677 struct cfg80211_beacon_data beacon_after;
@@ -888,8 +878,6 @@ struct mwifiex_adapter { · 200 unmodified lines
888878 struct work_struct main_work;
889879 struct workqueue_struct *rx_workqueue;
890880 struct work_struct rx_work;
891− struct workqueue_struct *dfs_workqueue;
892− struct work_struct dfs_work;
893881 bool rx_work_enabled;
894882 bool rx_processing;
895883 bool delay_main_work;
@@ -953,9 +941,7 @@ struct mwifiex_adapter { · 57 unmodified lines
953941 u8 fw_bands;
954942 u8 adhoc_start_band;
955943 u8 config_bands;
956− struct mwifiex_chan_scan_param_set *scan_channels;
957944 u8 tx_lock_flag;
958− struct mwifiex_sleep_params sleep_params;
959945 struct mwifiex_sleep_period sleep_period;
960946 u16 ps_mode;
961947 u32 ps_state;
@@ -1155,8 +1141,10 @@ int mwifiex_process_uap_event(struct mwifiex_private *); · 193 unmodified lines
11551141 void mwifiex_delete_all_station_list(struct mwifiex_private *priv);
11561142 void mwifiex_wmm_del_peer_ra_list(struct mwifiex_private *priv,
11571143 const u8 *ra_addr);
1158−void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb);
1159−void *mwifiex_process_uap_txpd(struct mwifiex_private *, struct sk_buff *skb);
1144+void mwifiex_process_sta_txpd(struct mwifiex_private *priv,
1145+ struct sk_buff *skb);
1146+void mwifiex_process_uap_txpd(struct mwifiex_private *priv,
1147+ struct sk_buff *skb);
11601148 int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta, bool init);
11611149 int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd,
11621150 struct mwifiex_scan_cmd_config *scan_cfg);
drivers/net/wireless/marvell/mwifiex/scan.c+1−6
@@ -612,7 +612,6 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv, · 611 unmodified lines
612612 struct mwifiex_adapter *adapter = priv->adapter;
613613 int ret = 0;
614614 struct mwifiex_chan_scan_param_set *tmp_chan_list;
615− struct mwifiex_chan_scan_param_set *start_chan;
616615 u32 tlv_idx, rates_size, cmd_no;
617616 u32 total_scan_time;
618617 u32 done_early;
@@ -643,7 +642,6 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv, · 24 unmodified lines
643642 total_scan_time = 0;
644643 radio_type = 0;
645644 chan_tlv_out->header.len = 0;
646− start_chan = tmp_chan_list;
647645 done_early = false;
648646
649647 /*
@@ -750,8 +748,6 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv, · 100 unmodified lines
750748 rates_size = mwifiex_append_rate_tlv(priv, scan_cfg_out,
751749 radio_type);
752750
753− priv->adapter->scan_channels = start_chan;
754−
755751 /* Send the scan command to the firmware with the specified
756752 cfg */
757753 if (priv->adapter->ext_scan)
@@ -828,7 +824,6 @@ mwifiex_config_scan(struct mwifiex_private *priv, · 70 unmodified lines
828824 u8 ssid_filter;
829825 struct mwifiex_ie_types_htcap *ht_cap;
830826 struct mwifiex_ie_types_bss_mode *bss_mode;
831− const u8 zero_mac[6] = {0, 0, 0, 0, 0, 0};
832827
833828 /* The tlv_buf_len is calculated for each scan command. The TLVs added
834829 in this routine will be preserved since the routine that sends the
@@ -966,7 +961,7 @@ mwifiex_config_scan(struct mwifiex_private *priv, · 131 unmodified lines
966961 sizeof(struct mwifiex_ie_types_scan_chan_gap);
967962 }
968963
969− if (!ether_addr_equal(user_scan_in->random_mac, zero_mac)) {
964+ if (!is_zero_ether_addr(user_scan_in->random_mac)) {
970965 random_mac_tlv = (void *)tlv_pos;
971966 random_mac_tlv->header.type =
972967 cpu_to_le16(TLV_TYPE_RANDOM_MAC);
drivers/net/wireless/marvell/mwifiex/sdio.c+14−12
@@ -1083,17 +1083,17 @@ cont: · 1082 unmodified lines
10831083 "info: SDIO FUNC1 IO port: %#x\n", adapter->ioport);
10841084
10851085 /* Set Host interrupt reset to read to clear */
1086− if (!mwifiex_read_reg(adapter, card->reg->host_int_rsr_reg, &reg))
1087− mwifiex_write_reg(adapter, card->reg->host_int_rsr_reg,
1088− reg | card->reg->sdio_int_mask);
1089− else
1086+ if (mwifiex_read_reg(adapter, card->reg->host_int_rsr_reg, &reg))
1087+ return -1;
1088+ if (mwifiex_write_reg(adapter, card->reg->host_int_rsr_reg,
1089+ reg | card->reg->sdio_int_mask))
10901090 return -1;
10911091
10921092 /* Dnld/Upld ready set to auto reset */
1093− if (!mwifiex_read_reg(adapter, card->reg->card_misc_cfg_reg, &reg))
1094− mwifiex_write_reg(adapter, card->reg->card_misc_cfg_reg,
1095− reg | AUTO_RE_ENABLE_INT);
1096− else
1093+ if (mwifiex_read_reg(adapter, card->reg->card_misc_cfg_reg, &reg))
1094+ return -1;
1095+ if (mwifiex_write_reg(adapter, card->reg->card_misc_cfg_reg,
1096+ reg | AUTO_RE_ENABLE_INT))
10971097 return -1;
10981098
10991099 return 0;
@@ -1556,7 +1556,7 @@ done: · 456 unmodified lines
15561556 }
15571557
15581558 /*
1559− * This function decode sdio aggreation pkt.
1559+ * This function decodes sdio aggregation pkt.
15601560 *
15611561 * Based on the data block size and pkt_len,
15621562 * skb data will be decoded to few packets.
@@ -2266,7 +2266,7 @@ static int mwifiex_host_to_card_mp_aggr(struct mwifiex_adapter *adapter, · 703 unmodified lines
22662266 ret = mwifiex_write_data_to_card(adapter, card->mpa_tx.buf,
22672267 card->mpa_tx.buf_len, mport);
22682268
2269− /* Save the last multi port tx aggreagation info to debug log */
2269+ /* Save the last multi port tx aggregation info to debug log. */
22702270 index = adapter->dbg.last_sdio_mp_index;
22712271 index = (index + 1) % MWIFIEX_DBG_SDIO_MP_NUM;
22722272 adapter->dbg.last_sdio_mp_index = index;
@@ -2525,7 +2525,8 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) · 252 unmodified lines
25252525 mwifiex_read_reg(adapter, card->reg->host_int_status_reg, &sdio_ireg);
25262526
25272527 /* Get SDIO ioport */
2528− mwifiex_init_sdio_ioport(adapter);
2528+ if (mwifiex_init_sdio_ioport(adapter))
2529+ return -EIO;
25292530
25302531 /* Initialize SDIO variables in card */
25312532 card->mp_rd_bitmap = 0;
@@ -3141,7 +3142,8 @@ static void mwifiex_sdio_up_dev(struct mwifiex_adapter *adapter) · 609 unmodified lines
31413142 */
31423143 mwifiex_read_reg(adapter, card->reg->host_int_status_reg, &sdio_ireg);
31433144
3144− mwifiex_init_sdio_ioport(adapter);
3145+ if (mwifiex_init_sdio_ioport(adapter))
3146+ dev_err(&card->func->dev, "error enabling SDIO port\n");
31453147 }
31463148
31473149 static struct mwifiex_if_ops sdio_ops = {
drivers/net/wireless/marvell/mwifiex/sta_rx.c+1−0
@@ -92,6 +92,7 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, · 91 unmodified lines
9292 skb->len, rx_pkt_off);
9393 priv->stats.rx_dropped++;
9494 dev_kfree_skb_any(skb);
95+ return -1;
9596 }
9697
9798 if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
drivers/net/wireless/marvell/mwifiex/sta_tx.c+2−13
@@ -29,8 +29,8 @@ · 28 unmodified lines
2929 * - Priority specific Tx control
3030 * - Flags
3131 */
32−void *mwifiex_process_sta_txpd(struct mwifiex_private *priv,
33− struct sk_buff *skb)
32+void mwifiex_process_sta_txpd(struct mwifiex_private *priv,
33+ struct sk_buff *skb)
3434 {
3535 struct mwifiex_adapter *adapter = priv->adapter;
3636 struct txpd *local_tx_pd;
@@ -39,15 +39,6 @@ void *mwifiex_process_sta_txpd(struct mwifiex_private *priv, · 2 unmodified lines
3939 u16 pkt_type, pkt_offset;
4040 int hroom = adapter->intf_hdr_len;
4141
42− if (!skb->len) {
43− mwifiex_dbg(adapter, ERROR,
44− "Tx: bad packet length: %d\n", skb->len);
45− tx_info->status_code = -1;
46− return skb->data;
47− }
48−
49− BUG_ON(skb_headroom(skb) < MWIFIEX_MIN_DATA_HEADER_LEN);
50−
5142 pkt_type = mwifiex_is_skb_mgmt_frame(skb) ? PKT_TYPE_MGMT : 0;
5243
5344 pad = ((uintptr_t)skb->data - (sizeof(*local_tx_pd) + hroom)) &
@@ -109,8 +100,6 @@ void *mwifiex_process_sta_txpd(struct mwifiex_private *priv, · 55 unmodified lines
109100 if (!local_tx_pd->tx_control)
110101 /* TxCtrl set by user or default */
111102 local_tx_pd->tx_control = cpu_to_le32(priv->pkt_tx_ctrl);
112−
113− return skb->data;
114103 }
115104
116105 /*
drivers/net/wireless/marvell/mwifiex/txrx.c+26−18
@@ -72,13 +72,18 @@ EXPORT_SYMBOL_GPL(mwifiex_handle_rx_packet); · 71 unmodified lines
7272 int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
7373 struct mwifiex_tx_param *tx_param)
7474 {
75− int hroom, ret = -1;
75+ int hroom, ret;
7676 struct mwifiex_adapter *adapter = priv->adapter;
77− u8 *head_ptr;
7877 struct txpd *local_tx_pd = NULL;
7978 struct mwifiex_sta_node *dest_node;
8079 struct ethhdr *hdr = (void *)skb->data;
8180
81+ if (unlikely(!skb->len ||
82+ skb_headroom(skb) < MWIFIEX_MIN_DATA_HEADER_LEN)) {
83+ ret = -EINVAL;
84+ goto out;
85+ }
86+
8287 hroom = adapter->intf_hdr_len;
8388
8489 if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) {
@@ -88,33 +93,31 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, · 3 unmodified lines
8893 dest_node->stats.tx_packets++;
8994 }
9095
91− head_ptr = mwifiex_process_uap_txpd(priv, skb);
96+ mwifiex_process_uap_txpd(priv, skb);
9297 } else {
93− head_ptr = mwifiex_process_sta_txpd(priv, skb);
98+ mwifiex_process_sta_txpd(priv, skb);
9499 }
95100
96− if ((adapter->data_sent || adapter->tx_lock_flag) && head_ptr) {
101+ if (adapter->data_sent || adapter->tx_lock_flag) {
97102 skb_queue_tail(&adapter->tx_data_q, skb);
98103 atomic_inc(&adapter->tx_queued);
99104 return 0;
100105 }
101106
102− if (head_ptr) {
103− if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA)
104− local_tx_pd = (struct txpd *)(head_ptr + hroom);
105− if (adapter->iface_type == MWIFIEX_USB) {
106− ret = adapter->if_ops.host_to_card(adapter,
107− priv->usb_port,
108− skb, tx_param);
109− } else {
110− ret = adapter->if_ops.host_to_card(adapter,
111− MWIFIEX_TYPE_DATA,
112− skb, tx_param);
113− }
107+ if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA)
108+ local_tx_pd = (struct txpd *)(skb->data + hroom);
109+ if (adapter->iface_type == MWIFIEX_USB) {
110+ ret = adapter->if_ops.host_to_card(adapter,
111+ priv->usb_port,
112+ skb, tx_param);
113+ } else {
114+ ret = adapter->if_ops.host_to_card(adapter,
115+ MWIFIEX_TYPE_DATA,
116+ skb, tx_param);
114117 }
115118 mwifiex_dbg_dump(adapter, DAT_D, "tx pkt:", skb->data,
116119 min_t(size_t, skb->len, DEBUG_DUMP_DATA_MAX_LEN));
117−
120+out:
118121 switch (ret) {
119122 case -ENOSR:
120123 mwifiex_dbg(adapter, DATA, "data: -ENOSR is returned\n");
@@ -137,6 +140,11 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, · 16 unmodified lines
137140 break;
138141 case -EINPROGRESS:
139142 break;
143+ case -EINVAL:
144+ mwifiex_dbg(adapter, ERROR,
145+ "malformed skb (length: %u, headroom: %u)\n",
146+ skb->len, skb_headroom(skb));
147+ fallthrough;
140148 case 0:
141149 mwifiex_write_data_complete(adapter, skb, 0, ret);
142150 break;
drivers/net/wireless/marvell/mwifiex/uap_txrx.c+12−14
@@ -110,6 +110,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, · 109 unmodified lines
110110 skb->len, le16_to_cpu(uap_rx_pd->rx_pkt_offset));
111111 priv->stats.rx_dropped++;
112112 dev_kfree_skb_any(skb);
113+ return;
113114 }
114115
115116 if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
@@ -252,7 +253,15 @@ int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv, · 136 unmodified lines
252253
253254 if (is_multicast_ether_addr(ra)) {
254255 skb_uap = skb_copy(skb, GFP_ATOMIC);
255− mwifiex_uap_queue_bridged_pkt(priv, skb_uap);
256+ if (likely(skb_uap)) {
257+ mwifiex_uap_queue_bridged_pkt(priv, skb_uap);
258+ } else {
259+ mwifiex_dbg(adapter, ERROR,
260+ "failed to copy skb for uAP\n");
261+ priv->stats.rx_dropped++;
262+ dev_kfree_skb_any(skb);
263+ return -1;
264+ }
256265 } else {
257266 if (mwifiex_get_sta_entry(priv, ra)) {
258267 /* Requeue Intra-BSS packet */
@@ -461,8 +470,8 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv, · 202 unmodified lines
461470 * - Priority specific Tx control
462471 * - Flags
463472 */
464−void *mwifiex_process_uap_txpd(struct mwifiex_private *priv,
465− struct sk_buff *skb)
473+void mwifiex_process_uap_txpd(struct mwifiex_private *priv,
474+ struct sk_buff *skb)
466475 {
467476 struct mwifiex_adapter *adapter = priv->adapter;
468477 struct uap_txpd *txpd;
@@ -471,15 +480,6 @@ void *mwifiex_process_uap_txpd(struct mwifiex_private *priv, · 2 unmodified lines
471480 u16 pkt_type, pkt_offset;
472481 int hroom = adapter->intf_hdr_len;
473482
474− if (!skb->len) {
475− mwifiex_dbg(adapter, ERROR,
476− "Tx: bad packet length: %d\n", skb->len);
477− tx_info->status_code = -1;
478− return skb->data;
479− }
480−
481− BUG_ON(skb_headroom(skb) < MWIFIEX_MIN_DATA_HEADER_LEN);
482−
483483 pkt_type = mwifiex_is_skb_mgmt_frame(skb) ? PKT_TYPE_MGMT : 0;
484484
485485 pad = ((uintptr_t)skb->data - (sizeof(*txpd) + hroom)) &
@@ -527,6 +527,4 @@ void *mwifiex_process_uap_txpd(struct mwifiex_private *priv, · 41 unmodified lines
527527 if (!txpd->tx_control)
528528 /* TxCtrl set by user or default */
529529 txpd->tx_control = cpu_to_le32(priv->pkt_tx_ctrl);
530−
531− return skb->data;
532530 }
drivers/net/wireless/mediatek/mt76/mt7603/Kconfig+1−1
@@ -5,7 +5,7 @@ config MT7603E · 4 unmodified lines
55 depends on MAC80211
66 depends on PCI
77 help
8− This adds support for MT7603E wireless PCIe devices and the WLAN core
8+ This adds support for MT7603E PCIe wireless devices and the WLAN core
99 on MT7628/MT7688 SoC devices. This family supports IEEE 802.11n 2x2
1010 to 300Mbps PHY rate
1111
drivers/net/wireless/mediatek/mt76/mt7615/Kconfig+1−1
@@ -11,7 +11,7 @@ config MT7615E · 10 unmodified lines
1111 depends on MAC80211
1212 depends on PCI
1313 help
14− This adds support for MT7615-based wireless PCIe devices,
14+ This adds support for MT7615-based PCIe wireless devices,
1515 which support concurrent dual-band operation at both 5GHz
1616 and 2.4GHz, IEEE 802.11ac 4x4:4SS 1733Mbps PHY rate, wave2
1717 MU-MIMO up to 4 users/group and 160MHz channels.
drivers/net/wireless/mediatek/mt76/mt76x0/Kconfig+2−2
@@ -10,7 +10,7 @@ config MT76x0U · 9 unmodified lines
1010 depends on MAC80211
1111 depends on USB
1212 help
13− This adds support for MT7610U-based wireless USB 2.0 dongles,
13+ This adds support for MT7610U-based USB 2.0 wireless dongles,
1414 which comply with IEEE 802.11ac standards and support 1x1
1515 433Mbps PHY rate.
1616
@@ -22,7 +22,7 @@ config MT76x0E · 5 unmodified lines
2222 depends on MAC80211
2323 depends on PCI
2424 help
25− This adds support for MT7610/MT7630-based wireless PCIe devices,
25+ This adds support for MT7610/MT7630-based PCIe wireless devices,
2626 which comply with IEEE 802.11ac standards and support 1x1
2727 433Mbps PHY rate.
2828
drivers/net/wireless/mediatek/mt76/mt76x2/Kconfig+2−2
@@ -9,7 +9,7 @@ config MT76x2E · 8 unmodified lines
99 depends on MAC80211
1010 depends on PCI
1111 help
12− This adds support for MT7612/MT7602/MT7662-based wireless PCIe
12+ This adds support for MT7612/MT7602/MT7662-based PCIe wireless
1313 devices, which comply with IEEE 802.11ac standards and support
1414 2SS to 866Mbit/s PHY rate.
1515
@@ -22,7 +22,7 @@ config MT76x2U · 6 unmodified lines
2222 depends on MAC80211
2323 depends on USB
2424 help
25− This adds support for MT7612U-based wireless USB 3.0 dongles,
25+ This adds support for MT7612U-based USB 3.0 wireless dongles,
2626 which comply with IEEE 802.11ac standards and support 2SS to
2727 866Mbit/s PHY rate.
2828
drivers/net/wireless/mediatek/mt76/mt7915/Kconfig+1−1
@@ -7,7 +7,7 @@ config MT7915E · 6 unmodified lines
77 depends on PCI
88 select RELAY
99 help
10− This adds support for MT7915-based wireless PCIe devices,
10+ This adds support for MT7915-based PCIe wireless devices,
1111 which support concurrent dual-band operation at both 5GHz
1212 and 2.4GHz IEEE 802.11ax 4x4:4SS 1024-QAM, 160MHz channels,
1313 OFDMA, spatial reuse and dual carrier modulation.
drivers/net/wireless/mediatek/mt76/mt7996/Kconfig+1−1
@@ -7,7 +7,7 @@ config MT7996E · 6 unmodified lines
77 depends on MAC80211
88 depends on PCI
99 help
10− This adds support for MT7996-based wireless PCIe devices,
10+ This adds support for MT7996-based PCIe wireless devices,
1111 which support concurrent tri-band operation at 6GHz, 5GHz,
1212 and 2.4GHz IEEE 802.11be 4x4:4SS 4096-QAM, 320MHz channels.
1313
drivers/net/wireless/mediatek/mt7601u/Kconfig+1−1
@@ -4,4 +4,4 @@ config MT7601U · 3 unmodified lines
44 depends on MAC80211
55 depends on USB
66 help
7− This adds support for MT7601U-based wireless USB dongles.
7+ This adds support for MT7601U-based USB wireless dongles.
drivers/net/wireless/microchip/wilc1000/cfg80211.h+0−4
@@ -8,15 +8,12 @@ · 7 unmodified lines
88 #define WILC_CFG80211_H
99 #include "netdev.h"
1010
11−struct wiphy *wilc_cfg_alloc(void);
1211 int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
1312 const struct wilc_hif_func *ops);
1413 struct wilc *wilc_create_wiphy(struct device *dev);
1514 void wilc_deinit_host_int(struct net_device *net);
1615 int wilc_init_host_int(struct net_device *net);
1716 void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size);
18−struct wilc_vif *wilc_netdev_interface(struct wilc *wl, const char *name,
19− enum nl80211_iftype type);
2017 void wilc_wfi_deinit_mon_interface(struct wilc *wl, bool rtnl_locked);
2118 struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
2219 const char *name,
@@ -24,7 +21,6 @@ struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl, · 1 unmodified line
2421 void wilc_update_mgmt_frame_registrations(struct wiphy *wiphy,
2522 struct wireless_dev *wdev,
2623 struct mgmt_frame_regs *upd);
27−struct wilc_vif *wilc_get_interface(struct wilc *wl);
2824 struct wilc_vif *wilc_get_wl_to_vif(struct wilc *wl);
2925 void wlan_deinit_locks(struct wilc *wilc);
3026 #endif
drivers/net/wireless/purelifi/plfxlc/Kconfig+1−1
@@ -3,7 +3,7 @@ config PLFXLC · 2 unmodified lines
33 tristate "pureLiFi X, XL, XC device support"
44 depends on CFG80211 && MAC80211 && USB
55 help
6− This option adds support for pureLiFi LiFi wireless USB
6+ This option adds support for pureLiFi LiFi USB wireless
77 adapters. The pureLiFi X, XL, XC USB devices are based on
88 802.11 OFDM PHY but uses light as the transmission medium.
99 The driver supports common 802.11 encryption/authentication
drivers/net/wireless/ralink/rt2x00/Kconfig+1−1
@@ -170,7 +170,7 @@ config RT2800USB_RT35XX · 169 unmodified lines
170170 config RT2800USB_RT3573
171171 bool "rt2800usb - Include support for rt3573 devices (EXPERIMENTAL)"
172172 help
173− This enables support for RT3573 chipset based wireless USB devices
173+ This enables support for RT3573 chipset based USB wireless devices
174174 in the rt2800usb driver.
175175
176176 config RT2800USB_RT53XX
drivers/net/wireless/ralink/rt2x00/rt2800lib.c+41−18
@@ -3865,28 +3865,51 @@ static void rt2800_config_channel_rf7620(struct rt2x00_dev *rt2x00dev, · 3864 unmodified lines
38653865 }
38663866 }
38673867
3868−static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev,
3869− struct ieee80211_channel *chan,
3870− int power_level) {
3871− u16 eeprom, target_power, max_power;
3868+static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev,
3869+ struct ieee80211_channel *chan,
3870+ int power_level)
3871+{
3872+ int cur_channel = rt2x00dev->rf_channel;
3873+ u16 eeprom, chan_power, rate_power, target_power;
3874+ u16 tx_power[2];
3875+ s8 *power_group[2];
38723876 u32 mac_sys_ctrl;
3873− u32 reg;
3877+ u32 cnt, reg;
38743878 u8 bbp;
38753879
3876− /* hardware unit is 0.5dBm, limited to 23.5dBm */
3877− power_level *= 2;
3878− if (power_level > 0x2f)
3879− power_level = 0x2f;
3880+ if (WARN_ON(cur_channel < 1 || cur_channel > 14))
3881+ return;
3882+
3883+ /* get per chain power, 2 chains in total, unit is 0.5dBm */
3884+ power_level = (power_level - 3) * 2;
38803885
3881− max_power = chan->max_power * 2;
3882− if (max_power > 0x2f)
3883− max_power = 0x2f;
3886+ /* We can't get the accurate TX power. Based on some tests, the real
3887+ * TX power is approximately equal to channel_power + (max)rate_power.
3888+ * Usually max rate_power is the gain of the OFDM 6M rate. The antenna
3889+ * gain and externel PA gain are not included as we are unable to
3890+ * obtain these values.
3891+ */
3892+ rate_power = rt2800_eeprom_read_from_array(rt2x00dev,
3893+ EEPROM_TXPOWER_BYRATE, 1);
3894+ rate_power &= 0x3f;
3895+ power_level -= rate_power;
3896+ if (power_level < 1)
3897+ power_level = 1;
3898+
3899+ power_group[0] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
3900+ power_group[1] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
3901+ for (cnt = 0; cnt < 2; cnt++) {
3902+ chan_power = power_group[cnt][cur_channel - 1];
3903+ if (chan_power >= 0x20 || chan_power == 0)
3904+ chan_power = 0x10;
3905+ tx_power[cnt] = power_level < chan_power ? power_level : chan_power;
3906+ }
38843907
38853908 reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_0);
3886− rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, power_level);
3887− rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, power_level);
3888− rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_0, max_power);
3889− rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_1, max_power);
3909+ rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_0, tx_power[0]);
3910+ rt2x00_set_field32(&reg, TX_ALC_CFG_0_CH_INIT_1, tx_power[1]);
3911+ rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_0, 0x2f);
3912+ rt2x00_set_field32(&reg, TX_ALC_CFG_0_LIMIT_1, 0x2f);
38903913
38913914 eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1);
38923915 if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_INTERNAL_TX_ALC)) {
@@ -5268,7 +5291,7 @@ static void rt2800_config_txpower_rt6352(struct rt2x00_dev *rt2x00dev, · 1375 unmodified lines
52685291 rt2x00_set_field32(&pwreg, TX_PWR_CFG_9B_STBC_MCS7, t);
52695292 rt2800_register_write(rt2x00dev, TX_PWR_CFG_9, pwreg);
52705293
5271− rt2800_config_alc(rt2x00dev, chan, power_level);
5294+ rt2800_config_alc_rt6352(rt2x00dev, chan, power_level);
52725295
52735296 /* TODO: temperature compensation code! */
52745297 }
@@ -8561,7 +8584,7 @@ static void rt2800_r_calibration(struct rt2x00_dev *rt2x00dev) · 3286 unmodified lines
85618584 rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n");
85628585
85638586 maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL);
8564− maccfg &= (~0x04);
8587+ maccfg &= (~0x08);
85658588 rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg);
85668589
85678590 if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX)))
drivers/net/wireless/realtek/rtlwifi/core.c+1−1
@@ -1656,7 +1656,7 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, · 1655 unmodified lines
16561656 memcpy(rtlpriv->sec.key_buf[key_idx],
16571657 key->key, key->keylen);
16581658 rtlpriv->sec.key_len[key_idx] = key->keylen;
1659− memcpy(mac_addr, bcast_addr, ETH_ALEN);
1659+ eth_broadcast_addr(mac_addr);
16601660 } else { /* pairwise key */
16611661 rtl_dbg(rtlpriv, COMP_SEC, DBG_DMESG,
16621662 "set pairwise key\n");
drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c+0−28
@@ -215,31 +215,3 @@ int rtl8723_download_fw(struct ieee80211_hw *hw, · 214 unmodified lines
215215 }
216216 EXPORT_SYMBOL_GPL(rtl8723_download_fw);
217217
218−bool rtl8723_cmd_send_packet(struct ieee80211_hw *hw,
219− struct sk_buff *skb)
220−{
221− struct rtl_priv *rtlpriv = rtl_priv(hw);
222− struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
223− struct rtl8192_tx_ring *ring;
224− struct rtl_tx_desc *pdesc;
225− struct sk_buff *pskb = NULL;
226− unsigned long flags;
227−
228− ring = &rtlpci->tx_ring[BEACON_QUEUE];
229−
230− pskb = __skb_dequeue(&ring->queue);
231− kfree_skb(pskb);
232− spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
233−
234− pdesc = &ring->desc[0];
235− rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *)pdesc, 1, 1, skb);
236−
237− __skb_queue_tail(&ring->queue, skb);
238−
239− spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags);
240−
241− rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE);
242−
243− return true;
244−}
245−EXPORT_SYMBOL_GPL(rtl8723_cmd_send_packet);
drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.h+0−2
@@ -66,7 +66,5 @@ void rtl8723_write_fw(struct ieee80211_hw *hw, · 65 unmodified lines
6666 u8 *buffer, u32 size, u8 max_page);
6767 int rtl8723_fw_free_to_go(struct ieee80211_hw *hw, bool is_8723be, int count);
6868 int rtl8723_download_fw(struct ieee80211_hw *hw, bool is_8723be, int count);
69−bool rtl8723_cmd_send_packet(struct ieee80211_hw *hw,
70− struct sk_buff *skb);
7169
7270 #endif
drivers/net/wireless/realtek/rtw88/pci.c+1−1
@@ -1828,5 +1828,5 @@ void rtw_pci_shutdown(struct pci_dev *pdev) · 1827 unmodified lines
18281828 EXPORT_SYMBOL(rtw_pci_shutdown);
18291829
18301830 MODULE_AUTHOR("Realtek Corporation");
1831−MODULE_DESCRIPTION("Realtek 802.11ac wireless PCI driver");
1831+MODULE_DESCRIPTION("Realtek PCI 802.11ac wireless driver");
18321832 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/realtek/rtw88/usb.c+5−2
@@ -826,7 +826,7 @@ int rtw_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) · 825 unmodified lines
826826
827827 ret = rtw_core_init(rtwdev);
828828 if (ret)
829− goto err_release_hw;
829+ goto err_free_rx_bufs;
830830
831831 ret = rtw_usb_intf_init(rtwdev, intf);
832832 if (ret) {
@@ -872,6 +872,9 @@ err_destroy_usb: · 39 unmodified lines
872872 err_deinit_core:
873873 rtw_core_deinit(rtwdev);
874874
875+err_free_rx_bufs:
876+ rtw_usb_free_rx_bufs(rtwusb);
877+
875878 err_release_hw:
876879 ieee80211_free_hw(hw);
877880
@@ -909,5 +912,5 @@ void rtw_usb_disconnect(struct usb_interface *intf) · 31 unmodified lines
909912 EXPORT_SYMBOL(rtw_usb_disconnect);
910913
911914 MODULE_AUTHOR("Realtek Corporation");
912−MODULE_DESCRIPTION("Realtek 802.11ac wireless USB driver");
915+MODULE_DESCRIPTION("Realtek USB 802.11ac wireless driver");
913916 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/realtek/rtw89/chan.c+124−0
@@ -4,6 +4,8 @@ · 3 unmodified lines
44
55 #include "chan.h"
66 #include "debug.h"
7+#include "fw.h"
8+#include "ps.h"
79 #include "util.h"
810
911 static enum rtw89_subband rtw89_get_subband_type(enum rtw89_band band,
@@ -116,6 +118,7 @@ bool rtw89_assign_entity_chan(struct rtw89_dev *rtwdev, · 106 unmodified lines
116118 rcd->prev_primary_channel = chan->primary_channel;
117119 rcd->prev_band_type = chan->band_type;
118120 band_changed = new->band_type != chan->band_type;
121+ rcd->band_changed = band_changed;
119122
120123 *chan = *new;
121124 return band_changed;
@@ -193,8 +196,12 @@ void rtw89_entity_init(struct rtw89_dev *rtwdev) · 71 unmodified lines
193196 enum rtw89_entity_mode rtw89_entity_recalc(struct rtw89_dev *rtwdev)
194197 {
195198 struct rtw89_hal *hal = &rtwdev->hal;
199+ const struct cfg80211_chan_def *chandef;
196200 enum rtw89_entity_mode mode;
201+ struct rtw89_chan chan;
197202 u8 weight;
203+ u8 last;
204+ u8 idx;
198205
199206 weight = bitmap_weight(hal->entity_map, NUM_OF_RTW89_SUB_ENTITY);
200207 switch (weight) {
@@ -206,14 +213,121 @@ enum rtw89_entity_mode rtw89_entity_recalc(struct rtw89_dev *rtwdev) · 5 unmodified lines
206213 rtw89_config_default_chandef(rtwdev);
207214 fallthrough;
208215 case 1:
216+ last = RTW89_SUB_ENTITY_0;
209217 mode = RTW89_ENTITY_MODE_SCC;
210218 break;
219+ case 2:
220+ last = RTW89_SUB_ENTITY_1;
221+ mode = rtw89_get_entity_mode(rtwdev);
222+ if (mode == RTW89_ENTITY_MODE_MCC)
223+ break;
224+
225+ mode = RTW89_ENTITY_MODE_MCC_PREPARE;
226+ break;
227+ }
228+
229+ for (idx = 0; idx <= last; idx++) {
230+ chandef = rtw89_chandef_get(rtwdev, idx);
231+ rtw89_get_channel_params(chandef, &chan);
232+ if (chan.channel == 0) {
233+ WARN(1, "Invalid channel on chanctx %d\n", idx);
234+ return RTW89_ENTITY_MODE_INVALID;
235+ }
236+
237+ rtw89_assign_entity_chan(rtwdev, idx, &chan);
211238 }
212239
213240 rtw89_set_entity_mode(rtwdev, mode);
214241 return mode;
215242 }
216243
244+static void rtw89_chanctx_notify(struct rtw89_dev *rtwdev,
245+ enum rtw89_chanctx_state state)
246+{
247+ const struct rtw89_chip_info *chip = rtwdev->chip;
248+ const struct rtw89_chanctx_listener *listener = chip->chanctx_listener;
249+ int i;
250+
251+ if (!listener)
252+ return;
253+
254+ for (i = 0; i < NUM_OF_RTW89_CHANCTX_CALLBACKS; i++) {
255+ if (!listener->callbacks[i])
256+ continue;
257+
258+ rtw89_debug(rtwdev, RTW89_DBG_CHAN,
259+ "chanctx notify listener: cb %d, state %d\n",
260+ i, state);
261+
262+ listener->callbacks[i](rtwdev, state);
263+ }
264+}
265+
266+static int rtw89_mcc_start(struct rtw89_dev *rtwdev)
267+{
268+ if (rtwdev->scanning)
269+ rtw89_hw_scan_abort(rtwdev, rtwdev->scan_info.scanning_vif);
270+
271+ rtw89_leave_lps(rtwdev);
272+
273+ rtw89_debug(rtwdev, RTW89_DBG_CHAN, "MCC start\n");
274+ rtw89_chanctx_notify(rtwdev, RTW89_CHANCTX_STATE_MCC_START);
275+ return 0;
276+}
277+
278+static void rtw89_mcc_stop(struct rtw89_dev *rtwdev)
279+{
280+ rtw89_debug(rtwdev, RTW89_DBG_CHAN, "MCC stop\n");
281+ rtw89_chanctx_notify(rtwdev, RTW89_CHANCTX_STATE_MCC_STOP);
282+}
283+
284+void rtw89_chanctx_work(struct work_struct *work)
285+{
286+ struct rtw89_dev *rtwdev = container_of(work, struct rtw89_dev,
287+ chanctx_work.work);
288+ enum rtw89_entity_mode mode;
289+ int ret;
290+
291+ mutex_lock(&rtwdev->mutex);
292+
293+ mode = rtw89_get_entity_mode(rtwdev);
294+ switch (mode) {
295+ case RTW89_ENTITY_MODE_MCC_PREPARE:
296+ rtw89_set_entity_mode(rtwdev, RTW89_ENTITY_MODE_MCC);
297+ rtw89_set_channel(rtwdev);
298+
299+ ret = rtw89_mcc_start(rtwdev);
300+ if (ret)
301+ rtw89_warn(rtwdev, "failed to start MCC: %d\n", ret);
302+ break;
303+ default:
304+ break;
305+ }
306+
307+ mutex_unlock(&rtwdev->mutex);
308+}
309+
310+void rtw89_queue_chanctx_work(struct rtw89_dev *rtwdev)
311+{
312+ enum rtw89_entity_mode mode;
313+ u32 delay;
314+
315+ mode = rtw89_get_entity_mode(rtwdev);
316+ switch (mode) {
317+ default:
318+ return;
319+ case RTW89_ENTITY_MODE_MCC_PREPARE:
320+ delay = ieee80211_tu_to_usec(RTW89_CHANCTX_TIME_MCC_PREPARE);
321+ break;
322+ }
323+
324+ rtw89_debug(rtwdev, RTW89_DBG_CHAN,
325+ "queue chanctx work for mode %d with delay %d us\n",
326+ mode, delay);
327+ ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->chanctx_work,
328+ usecs_to_jiffies(delay));
329+}
330+
217331 int rtw89_chanctx_ops_add(struct rtw89_dev *rtwdev,
218332 struct ieee80211_chanctx_conf *ctx)
219333 {
@@ -238,6 +352,7 @@ void rtw89_chanctx_ops_remove(struct rtw89_dev *rtwdev, · 18 unmodified lines
238352 {
239353 struct rtw89_hal *hal = &rtwdev->hal;
240354 struct rtw89_chanctx_cfg *cfg = (struct rtw89_chanctx_cfg *)ctx->drv_priv;
355+ enum rtw89_entity_mode mode;
241356 struct rtw89_vif *rtwvif;
242357 u8 drop, roll;
243358
@@ -267,6 +382,15 @@ void rtw89_chanctx_ops_remove(struct rtw89_dev *rtwdev, · 23 unmodified lines
267382 drop = roll;
268383
269384 out:
385+ mode = rtw89_get_entity_mode(rtwdev);
386+ switch (mode) {
387+ case RTW89_ENTITY_MODE_MCC:
388+ rtw89_mcc_stop(rtwdev);
389+ break;
390+ default:
391+ break;
392+ }
393+
270394 clear_bit(drop, hal->entity_map);
271395 rtw89_set_channel(rtwdev);
272396 }
drivers/net/wireless/realtek/rtw89/chan.h+5−0
@@ -7,6 +7,9 @@ · 6 unmodified lines
77
88 #include "core.h"
99
10+/* The dwell time in TU before doing rtw89_chanctx_work(). */
11+#define RTW89_CHANCTX_TIME_MCC_PREPARE 100
12+
1013 static inline bool rtw89_get_entity_state(struct rtw89_dev *rtwdev)
1114 {
1215 struct rtw89_hal *hal = &rtwdev->hal;
@@ -50,6 +53,8 @@ void rtw89_config_roc_chandef(struct rtw89_dev *rtwdev, · 37 unmodified lines
5053 const struct cfg80211_chan_def *chandef);
5154 void rtw89_entity_init(struct rtw89_dev *rtwdev);
5255 enum rtw89_entity_mode rtw89_entity_recalc(struct rtw89_dev *rtwdev);
56+void rtw89_chanctx_work(struct work_struct *work);
57+void rtw89_queue_chanctx_work(struct rtw89_dev *rtwdev);
5358 int rtw89_chanctx_ops_add(struct rtw89_dev *rtwdev,
5459 struct ieee80211_chanctx_conf *ctx);
5560 void rtw89_chanctx_ops_remove(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/coex.c+2−1
@@ -5666,7 +5666,8 @@ enum btc_wl_mode { · 5665 unmodified lines
56665666 void rtw89_btc_ntfy_role_info(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
56675667 struct rtw89_sta *rtwsta, enum btc_role_state state)
56685668 {
5669− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
5669+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
5670+ rtwvif->sub_entity_idx);
56705671 struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
56715672 struct ieee80211_sta *sta = rtwsta_to_sta(rtwsta);
56725673 struct rtw89_btc *btc = &rtwdev->btc;
drivers/net/wireless/realtek/rtw89/coex.h+9−0
@@ -193,4 +193,13 @@ static inline u8 rtw89_btc_path_phymap(struct rtw89_dev *rtwdev, · 192 unmodified lines
193193 return rtw89_btc_phymap(rtwdev, phy_idx, BIT(path));
194194 }
195195
196+/* return bt req len in TU */
197+static inline u16 rtw89_coex_query_bt_req_len(struct rtw89_dev *rtwdev,
198+ enum rtw89_phy_idx phy_idx)
199+{
200+ struct rtw89_btc *btc = &rtwdev->btc;
201+
202+ return btc->bt_req_len;
203+}
204+
196205 #endif
drivers/net/wireless/realtek/rtw89/core.c+91−33
@@ -256,8 +256,8 @@ void rtw89_get_default_chandef(struct cfg80211_chan_def *chandef) · 255 unmodified lines
256256 NL80211_CHAN_NO_HT);
257257 }
258258
259−static void rtw89_get_channel_params(const struct cfg80211_chan_def *chandef,
260− struct rtw89_chan *chan)
259+void rtw89_get_channel_params(const struct cfg80211_chan_def *chandef,
260+ struct rtw89_chan *chan)
261261 {
262262 struct ieee80211_channel *channel = chandef->chan;
263263 enum nl80211_chan_width width = chandef->width;
@@ -318,9 +318,11 @@ static void rtw89_get_channel_params(const struct cfg80211_chan_def *chandef, · 54 unmodified lines
318318
319319 void rtw89_core_set_chip_txpwr(struct rtw89_dev *rtwdev)
320320 {
321+ struct rtw89_hal *hal = &rtwdev->hal;
321322 const struct rtw89_chip_info *chip = rtwdev->chip;
322323 const struct rtw89_chan *chan;
323324 enum rtw89_sub_entity_idx sub_entity_idx;
325+ enum rtw89_sub_entity_idx roc_idx;
324326 enum rtw89_phy_idx phy_idx;
325327 enum rtw89_entity_mode mode;
326328 bool entity_active;
@@ -330,10 +332,23 @@ void rtw89_core_set_chip_txpwr(struct rtw89_dev *rtwdev) · 3 unmodified lines
330332 return;
331333
332334 mode = rtw89_get_entity_mode(rtwdev);
333− if (WARN(mode != RTW89_ENTITY_MODE_SCC, "Invalid ent mode: %d\n", mode))
335+ switch (mode) {
336+ case RTW89_ENTITY_MODE_SCC:
337+ case RTW89_ENTITY_MODE_MCC:
338+ sub_entity_idx = RTW89_SUB_ENTITY_0;
339+ break;
340+ case RTW89_ENTITY_MODE_MCC_PREPARE:
341+ sub_entity_idx = RTW89_SUB_ENTITY_1;
342+ break;
343+ default:
344+ WARN(1, "Invalid ent mode: %d\n", mode);
334345 return;
346+ }
347+
348+ roc_idx = atomic_read(&hal->roc_entity_idx);
349+ if (roc_idx != RTW89_SUB_ENTITY_IDLE)
350+ sub_entity_idx = roc_idx;
335351
336− sub_entity_idx = RTW89_SUB_ENTITY_0;
337352 phy_idx = RTW89_PHY_0;
338353 chan = rtw89_chan_get(rtwdev, sub_entity_idx);
339354 chip->ops->set_txpwr(rtwdev, chan, phy_idx);
@@ -341,43 +356,54 @@ void rtw89_core_set_chip_txpwr(struct rtw89_dev *rtwdev) · 1 unmodified line
341356
342357 void rtw89_set_channel(struct rtw89_dev *rtwdev)
343358 {
359+ struct rtw89_hal *hal = &rtwdev->hal;
344360 const struct rtw89_chip_info *chip = rtwdev->chip;
345− const struct cfg80211_chan_def *chandef;
361+ const struct rtw89_chan_rcd *chan_rcd;
362+ const struct rtw89_chan *chan;
346363 enum rtw89_sub_entity_idx sub_entity_idx;
364+ enum rtw89_sub_entity_idx roc_idx;
347365 enum rtw89_mac_idx mac_idx;
348366 enum rtw89_phy_idx phy_idx;
349− struct rtw89_chan chan;
350367 struct rtw89_channel_help_params bak;
351368 enum rtw89_entity_mode mode;
352− bool band_changed;
353369 bool entity_active;
354370
355371 entity_active = rtw89_get_entity_state(rtwdev);
356372
357373 mode = rtw89_entity_recalc(rtwdev);
358− if (WARN(mode != RTW89_ENTITY_MODE_SCC, "Invalid ent mode: %d\n", mode))
374+ switch (mode) {
375+ case RTW89_ENTITY_MODE_SCC:
376+ case RTW89_ENTITY_MODE_MCC:
377+ sub_entity_idx = RTW89_SUB_ENTITY_0;
378+ break;
379+ case RTW89_ENTITY_MODE_MCC_PREPARE:
380+ sub_entity_idx = RTW89_SUB_ENTITY_1;
381+ break;
382+ default:
383+ WARN(1, "Invalid ent mode: %d\n", mode);
359384 return;
385+ }
386+
387+ roc_idx = atomic_read(&hal->roc_entity_idx);
388+ if (roc_idx != RTW89_SUB_ENTITY_IDLE)
389+ sub_entity_idx = roc_idx;
360390
361− sub_entity_idx = RTW89_SUB_ENTITY_0;
362391 mac_idx = RTW89_MAC_0;
363392 phy_idx = RTW89_PHY_0;
364− chandef = rtw89_chandef_get(rtwdev, sub_entity_idx);
365− rtw89_get_channel_params(chandef, &chan);
366− if (WARN(chan.channel == 0, "Invalid channel\n"))
367− return;
368393
369− band_changed = rtw89_assign_entity_chan(rtwdev, sub_entity_idx, &chan);
394+ chan = rtw89_chan_get(rtwdev, sub_entity_idx);
395+ chan_rcd = rtw89_chan_rcd_get(rtwdev, sub_entity_idx);
370396
371− rtw89_chip_set_channel_prepare(rtwdev, &bak, &chan, mac_idx, phy_idx);
397+ rtw89_chip_set_channel_prepare(rtwdev, &bak, chan, mac_idx, phy_idx);
372398
373− chip->ops->set_channel(rtwdev, &chan, mac_idx, phy_idx);
399+ chip->ops->set_channel(rtwdev, chan, mac_idx, phy_idx);
374400
375− chip->ops->set_txpwr(rtwdev, &chan, phy_idx);
401+ chip->ops->set_txpwr(rtwdev, chan, phy_idx);
376402
377− rtw89_chip_set_channel_done(rtwdev, &bak, &chan, mac_idx, phy_idx);
403+ rtw89_chip_set_channel_done(rtwdev, &bak, chan, mac_idx, phy_idx);
378404
379− if (!entity_active || band_changed) {
380− rtw89_btc_ntfy_switch_band(rtwdev, phy_idx, chan.band_type);
405+ if (!entity_active || chan_rcd->band_changed) {
406+ rtw89_btc_ntfy_switch_band(rtwdev, phy_idx, chan->band_type);
381407 rtw89_chip_rfk_band_changed(rtwdev, phy_idx);
382408 }
383409
@@ -523,12 +549,12 @@ rtw89_core_tx_update_sec_key(struct rtw89_dev *rtwdev, · 139 unmodified lines
523549 }
524550
525551 static u16 rtw89_core_get_mgmt_rate(struct rtw89_dev *rtwdev,
526− struct rtw89_core_tx_request *tx_req)
552+ struct rtw89_core_tx_request *tx_req,
553+ const struct rtw89_chan *chan)
527554 {
528555 struct sk_buff *skb = tx_req->skb;
529556 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
530557 struct ieee80211_vif *vif = tx_info->control.vif;
531− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
532558 u16 lowest_rate;
533559
534560 if (tx_info->flags & IEEE80211_TX_CTL_NO_CCK_RATE ||
@@ -567,7 +593,8 @@ rtw89_core_tx_update_mgmt_info(struct rtw89_dev *rtwdev, · 32 unmodified lines
567593 struct ieee80211_vif *vif = tx_req->vif;
568594 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
569595 struct rtw89_tx_desc_info *desc_info = &tx_req->desc_info;
570− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
596+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
597+ rtwvif->sub_entity_idx);
571598 u8 qsel, ch_dma;
572599
573600 qsel = desc_info->hiq ? RTW89_TX_QSEL_B0_HI : RTW89_TX_QSEL_B0_MGMT;
@@ -584,7 +611,7 @@ rtw89_core_tx_update_mgmt_info(struct rtw89_dev *rtwdev, · 10 unmodified lines
584611 desc_info->en_wd_info = true;
585612 desc_info->use_rate = true;
586613 desc_info->dis_data_fb = true;
587− desc_info->data_rate = rtw89_core_get_mgmt_rate(rtwdev, tx_req);
614+ desc_info->data_rate = rtw89_core_get_mgmt_rate(rtwdev, tx_req, chan);
588615
589616 rtw89_debug(rtwdev, RTW89_DBG_TXRX,
590617 "tx mgmt frame with rate 0x%x on channel %d (band %d, bw %d)\n",
@@ -603,7 +630,8 @@ rtw89_core_tx_update_h2c_info(struct rtw89_dev *rtwdev, · 12 unmodified lines
603630 desc_info->ch_dma = RTW89_DMA_H2C;
604631 }
605632
606−static void rtw89_core_get_no_ul_ofdma_htc(struct rtw89_dev *rtwdev, __le32 *htc)
633+static void rtw89_core_get_no_ul_ofdma_htc(struct rtw89_dev *rtwdev, __le32 *htc,
634+ const struct rtw89_chan *chan)
607635 {
608636 static const u8 rtw89_bandwidth_to_om[] = {
609637 [RTW89_CHANNEL_WIDTH_20] = HTC_OM_CHANNEL_WIDTH_20,
@@ -614,7 +642,6 @@ static void rtw89_core_get_no_ul_ofdma_htc(struct rtw89_dev *rtwdev, __le32 *htc · 4 unmodified lines
614642 };
615643 const struct rtw89_chip_info *chip = rtwdev->chip;
616644 struct rtw89_hal *hal = &rtwdev->hal;
617− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
618645 u8 om_bandwidth;
619646
620647 if (!chip->dis_2g_40m_ul_ofdma ||
@@ -1659,8 +1686,7 @@ static void rtw89_correct_cck_chan(struct rtw89_dev *rtwdev, · 1038 unmodified lines
16591686 const struct rtw89_chan_rcd *rcd =
16601687 rtw89_chan_rcd_get(rtwdev, RTW89_SUB_ENTITY_0);
16611688 u16 chan = rcd->prev_primary_channel;
1662− u8 band = rcd->prev_band_type == RTW89_BAND_2G ?
1663− NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
1689+ u8 band = rtw89_hw_to_nl80211_band(rcd->prev_band_type);
16641690
16651691 if (status->band != NL80211_BAND_2GHZ &&
16661692 status->encoding == RX_ENC_LEGACY &&
@@ -1900,7 +1926,6 @@ static void rtw89_core_update_rx_status(struct rtw89_dev *rtwdev, · 233 unmodified lines
19001926 {
19011927 const struct cfg80211_chan_def *chandef =
19021928 rtw89_chandef_get(rtwdev, RTW89_SUB_ENTITY_0);
1903− const struct rtw89_chan *cur = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
19041929 u16 data_rate;
19051930 u8 data_rate_mode;
19061931
@@ -1910,6 +1935,7 @@ static void rtw89_core_update_rx_status(struct rtw89_dev *rtwdev, · 3 unmodified lines
19101935
19111936 if (rtwdev->scanning &&
19121937 RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD, &rtwdev->fw)) {
1938+ const struct rtw89_chan *cur = rtw89_scan_chan_get(rtwdev);
19131939 u8 chan = cur->primary_channel;
19141940 u8 band = cur->band_type;
19151941 enum nl80211_band nl_band;
@@ -2451,6 +2477,7 @@ out: · 535 unmodified lines
24512477
24522478 void rtw89_roc_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
24532479 {
2480+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
24542481 struct ieee80211_hw *hw = rtwdev->hw;
24552482 struct rtw89_roc *roc = &rtwvif->roc;
24562483 struct cfg80211_chan_def roc_chan;
@@ -2478,7 +2505,7 @@ void rtw89_roc_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif) · 21 unmodified lines
24782505 rtw89_config_roc_chandef(rtwdev, rtwvif->sub_entity_idx, &roc_chan);
24792506 rtw89_set_channel(rtwdev);
24802507 rtw89_write32_clr(rtwdev,
2481− rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0),
2508+ rtw89_mac_reg_by_idx(rtwdev, mac->rx_fltr, RTW89_MAC_0),
24822509 B_AX_A_UC_CAM_MATCH | B_AX_A_BC_CAM_MATCH);
24832510
24842511 ieee80211_ready_on_channel(hw);
@@ -2486,6 +2513,7 @@ void rtw89_roc_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif) · 1 unmodified line
24862513
24872514 void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
24882515 {
2516+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
24892517 struct ieee80211_hw *hw = rtwdev->hw;
24902518 struct rtw89_roc *roc = &rtwvif->roc;
24912519 struct rtw89_vif *tmp;
@@ -2499,7 +2527,7 @@ void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif) · 7 unmodified lines
24992527 rtw89_leave_lps(rtwdev);
25002528
25012529 rtw89_write32_mask(rtwdev,
2502− rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0),
2530+ rtw89_mac_reg_by_idx(rtwdev, mac->rx_fltr, RTW89_MAC_0),
25032531 B_AX_RX_FLTR_CFG_MASK,
25042532 rtwdev->hal.rx_fltr);
25052533
@@ -2682,6 +2710,7 @@ static void rtw89_track_work(struct work_struct *work) · 176 unmodified lines
26822710 rtw89_phy_tx_path_div_track(rtwdev);
26832711 rtw89_phy_antdiv_track(rtwdev);
26842712 rtw89_phy_ul_tb_ctrl_track(rtwdev);
2713+ rtw89_tas_track(rtwdev);
26852714
26862715 if (rtwdev->lps_enabled && !rtwdev->btc.lps)
26872716 rtw89_enter_lps_track(rtwdev);
@@ -2970,6 +2999,8 @@ int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev, · 282 unmodified lines
29702999 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
29713000 struct rtw89_sta *rtwsta = (struct rtw89_sta *)sta->drv_priv;
29723001 struct rtw89_bssid_cam_entry *bssid_cam = rtw89_get_bssid_cam_of(rtwvif, rtwsta);
3002+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
3003+ rtwvif->sub_entity_idx);
29733004 int ret;
29743005
29753006 if (vif->type == NL80211_IFTYPE_AP || sta->tdls) {
@@ -3023,7 +3054,7 @@ int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev, · 47 unmodified lines
30233054
30243055 rtw89_btc_ntfy_role_info(rtwdev, rtwvif, rtwsta,
30253056 BTC_ROLE_MSTS_STA_CONN_END);
3026− rtw89_core_get_no_ul_ofdma_htc(rtwdev, &rtwsta->htc_template);
3057+ rtw89_core_get_no_ul_ofdma_htc(rtwdev, &rtwsta->htc_template, chan);
30273058 rtw89_phy_ul_tb_assoc(rtwdev, rtwvif);
30283059
30293060 ret = rtw89_fw_h2c_general_pkt(rtwdev, rtwvif, rtwsta->mac_id);
@@ -3463,6 +3494,27 @@ void rtw89_complete_cond(struct rtw89_wait_info *wait, unsigned int cond, · 433 unmodified lines
34633494 complete(&wait->completion);
34643495 }
34653496
3497+void rtw89_core_ntfy_btc_event(struct rtw89_dev *rtwdev, enum rtw89_btc_hmsg event)
3498+{
3499+ u16 bt_req_len;
3500+
3501+ switch (event) {
3502+ case RTW89_BTC_HMSG_SET_BT_REQ_SLOT:
3503+ bt_req_len = rtw89_coex_query_bt_req_len(rtwdev, RTW89_PHY_0);
3504+ rtw89_debug(rtwdev, RTW89_DBG_BTC,
3505+ "coex updates BT req len to %d TU\n", bt_req_len);
3506+ break;
3507+ default:
3508+ if (event < NUM_OF_RTW89_BTC_HMSG)
3509+ rtw89_debug(rtwdev, RTW89_DBG_BTC,
3510+ "unhandled BTC HMSG event: %d\n", event);
3511+ else
3512+ rtw89_warn(rtwdev,
3513+ "unrecognized BTC HMSG event: %d\n", event);
3514+ break;
3515+ }
3516+}
3517+
34663518 int rtw89_core_start(struct rtw89_dev *rtwdev)
34673519 {
34683520 int ret;
@@ -3496,6 +3548,8 @@ int rtw89_core_start(struct rtw89_dev *rtwdev) · 27 unmodified lines
34963548 rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, true);
34973549 rtw89_mac_update_rts_threshold(rtwdev, RTW89_MAC_0);
34983550
3551+ rtw89_tas_reset(rtwdev);
3552+
34993553 ret = rtw89_hci_start(rtwdev);
35003554 if (ret) {
35013555 rtw89_err(rtwdev, "failed to start hci\n");
@@ -3536,6 +3590,7 @@ void rtw89_core_stop(struct rtw89_dev *rtwdev) · 34 unmodified lines
35363590 cancel_work_sync(&btc->icmp_notify_work);
35373591 cancel_delayed_work_sync(&rtwdev->txq_reinvoke_work);
35383592 cancel_delayed_work_sync(&rtwdev->track_work);
3593+ cancel_delayed_work_sync(&rtwdev->chanctx_work);
35393594 cancel_delayed_work_sync(&rtwdev->coex_act1_work);
35403595 cancel_delayed_work_sync(&rtwdev->coex_bt_devinfo_work);
35413596 cancel_delayed_work_sync(&rtwdev->coex_rfk_chk_work);
@@ -3572,6 +3627,7 @@ int rtw89_core_init(struct rtw89_dev *rtwdev) · 30 unmodified lines
35723627 INIT_WORK(&rtwdev->txq_work, rtw89_core_txq_work);
35733628 INIT_DELAYED_WORK(&rtwdev->txq_reinvoke_work, rtw89_core_txq_reinvoke_work);
35743629 INIT_DELAYED_WORK(&rtwdev->track_work, rtw89_track_work);
3630+ INIT_DELAYED_WORK(&rtwdev->chanctx_work, rtw89_chanctx_work);
35753631 INIT_DELAYED_WORK(&rtwdev->coex_act1_work, rtw89_coex_act1_work);
35763632 INIT_DELAYED_WORK(&rtwdev->coex_bt_devinfo_work, rtw89_coex_bt_devinfo_work);
35773633 INIT_DELAYED_WORK(&rtwdev->coex_rfk_chk_work, rtw89_coex_rfk_chk_work);
@@ -3612,6 +3668,7 @@ int rtw89_core_init(struct rtw89_dev *rtwdev) · 34 unmodified lines
36123668
36133669 rtw89_ser_init(rtwdev);
36143670 rtw89_entity_init(rtwdev);
3671+ rtw89_tas_init(rtwdev);
36153672
36163673 return 0;
36173674 }
@@ -3632,7 +3689,8 @@ EXPORT_SYMBOL(rtw89_core_deinit); · 14 unmodified lines
36323689 void rtw89_core_scan_start(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
36333690 const u8 *mac_addr, bool hw_scan)
36343691 {
3635− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
3692+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
3693+ rtwvif->sub_entity_idx);
36363694
36373695 rtwdev->scanning = true;
36383696 rtw89_leave_lps(rtwdev);
drivers/net/wireless/realtek/rtw89/core.h+104−0
@@ -14,6 +14,8 @@ · 13 unmodified lines
1414
1515 struct rtw89_dev;
1616 struct rtw89_pci_info;
17+struct rtw89_mac_gen_def;
18+struct rtw89_phy_gen_def;
1719
1820 extern const struct ieee80211_ops rtw89_ops;
1921
@@ -789,6 +791,7 @@ enum rtw89_phy_idx { · 769 unmodified lines
789791
790792 enum rtw89_sub_entity_idx {
791793 RTW89_SUB_ENTITY_0 = 0,
794+ RTW89_SUB_ENTITY_1 = 1,
792795
793796 NUM_OF_RTW89_SUB_ENTITY,
794797 RTW89_SUB_ENTITY_IDLE = NUM_OF_RTW89_SUB_ENTITY,
@@ -900,6 +903,7 @@ struct rtw89_chan { · 105 unmodified lines
900903 struct rtw89_chan_rcd {
901904 u8 prev_primary_channel;
902905 enum rtw89_band prev_band_type;
906+ bool band_changed;
903907 };
904908
905909 struct rtw89_channel_help_params {
@@ -2656,6 +2660,17 @@ struct rtw89_btc { · 1750 unmodified lines
26562660 bool lps;
26572661 };
26582662
2663+enum rtw89_btc_hmsg {
2664+ RTW89_BTC_HMSG_TMR_EN = 0x0,
2665+ RTW89_BTC_HMSG_BT_REG_READBACK = 0x1,
2666+ RTW89_BTC_HMSG_SET_BT_REQ_SLOT = 0x2,
2667+ RTW89_BTC_HMSG_FW_EV = 0x3,
2668+ RTW89_BTC_HMSG_BT_LINK_CHG = 0x4,
2669+ RTW89_BTC_HMSG_SET_BT_REQ_STBC = 0x5,
2670+
2671+ NUM_OF_RTW89_BTC_HMSG,
2672+};
2673+
26592674 enum rtw89_ra_mode {
26602675 RTW89_RA_MODE_CCK = BIT(0),
26612676 RTW89_RA_MODE_OFDM = BIT(1),
@@ -2885,6 +2900,32 @@ struct rtw89_roc { · 223 unmodified lines
28852900
28862901 #define RTW89_P2P_MAX_NOA_NUM 2
28872902
2903+struct rtw89_p2p_ie_head {
2904+ u8 eid;
2905+ u8 ie_len;
2906+ u8 oui[3];
2907+ u8 oui_type;
2908+} __packed;
2909+
2910+struct rtw89_noa_attr_head {
2911+ u8 attr_type;
2912+ __le16 attr_len;
2913+ u8 index;
2914+ u8 oppps_ctwindow;
2915+} __packed;
2916+
2917+struct rtw89_p2p_noa_ie {
2918+ struct rtw89_p2p_ie_head p2p_head;
2919+ struct rtw89_noa_attr_head noa_head;
2920+ struct ieee80211_p2p_noa_desc noa_desc[RTW89_P2P_MAX_NOA_NUM];
2921+} __packed;
2922+
2923+struct rtw89_p2p_noa_setter {
2924+ struct rtw89_p2p_noa_ie ie;
2925+ u8 noa_count;
2926+ u8 noa_index;
2927+};
2928+
28882929 struct rtw89_vif {
28892930 struct list_head list;
28902931 struct rtw89_dev *rtwdev;
@@ -2927,6 +2968,7 @@ struct rtw89_vif { · 36 unmodified lines
29272968 struct cfg80211_scan_request *scan_req;
29282969 struct ieee80211_scan_ies *scan_ies;
29292970 struct list_head general_pkt_list;
2971+ struct rtw89_p2p_noa_setter p2p_noa;
29302972 };
29312973
29322974 enum rtw89_lv1_rcvy_step {
@@ -3339,6 +3381,10 @@ struct rtw89_dig_regs { · 406 unmodified lines
33393381 u32 seg0_pd_reg;
33403382 u32 pd_lower_bound_mask;
33413383 u32 pd_spatial_reuse_en;
3384+ u32 bmode_pd_reg;
3385+ u32 bmode_cca_rssi_limit_en;
3386+ u32 bmode_pd_lower_bound_reg;
3387+ u32 bmode_rssi_nocca_low_th_mask;
33423388 struct rtw89_reg_def p0_lna_init;
33433389 struct rtw89_reg_def p1_lna_init;
33443390 struct rtw89_reg_def p0_tia_init;
@@ -3375,10 +3421,28 @@ struct rtw89_antdiv_info { · 30 unmodified lines
33753421 bool get_stats;
33763422 };
33773423
3424+enum rtw89_chanctx_state {
3425+ RTW89_CHANCTX_STATE_MCC_START,
3426+ RTW89_CHANCTX_STATE_MCC_STOP,
3427+};
3428+
3429+enum rtw89_chanctx_callbacks {
3430+ RTW89_CHANCTX_CALLBACK_PLACEHOLDER,
3431+
3432+ NUM_OF_RTW89_CHANCTX_CALLBACKS,
3433+};
3434+
3435+struct rtw89_chanctx_listener {
3436+ void (*callbacks[NUM_OF_RTW89_CHANCTX_CALLBACKS])
3437+ (struct rtw89_dev *rtwdev, enum rtw89_chanctx_state state);
3438+};
3439+
33783440 struct rtw89_chip_info {
33793441 enum rtw89_core_chip_id chip_id;
33803442 enum rtw89_chip_gen chip_gen;
33813443 const struct rtw89_chip_ops *ops;
3444+ const struct rtw89_mac_gen_def *mac_def;
3445+ const struct rtw89_phy_gen_def *phy_def;
33823446 const char *fw_basename;
33833447 u8 fw_format_max;
33843448 bool try_ce_fw;
@@ -3434,6 +3498,7 @@ struct rtw89_chip_info { · 49 unmodified lines
34343498 /* NULL if no rfe-specific, or a null-terminated array by rfe_parms */
34353499 const struct rtw89_rfe_parms_conf *rfe_parms_conf;
34363500 const struct rtw89_rfe_parms *dflt_parms;
3501+ const struct rtw89_chanctx_listener *chanctx_listener;
34373502
34383503 u8 txpwr_factor_rf;
34393504 u8 txpwr_factor_mac;
@@ -3690,12 +3755,34 @@ struct rtw89_sar_info { · 250 unmodified lines
36903755 };
36913756 };
36923757
3758+enum rtw89_tas_state {
3759+ RTW89_TAS_STATE_DPR_OFF,
3760+ RTW89_TAS_STATE_DPR_ON,
3761+ RTW89_TAS_STATE_DPR_FORBID,
3762+};
3763+
3764+#define RTW89_TAS_MAX_WINDOW 50
3765+struct rtw89_tas_info {
3766+ s16 txpwr_history[RTW89_TAS_MAX_WINDOW];
3767+ s32 total_txpwr;
3768+ u8 cur_idx;
3769+ s8 dpr_gap;
3770+ s8 delta;
3771+ enum rtw89_tas_state state;
3772+ bool enable;
3773+};
3774+
36933775 struct rtw89_chanctx_cfg {
36943776 enum rtw89_sub_entity_idx idx;
36953777 };
36963778
36973779 enum rtw89_entity_mode {
36983780 RTW89_ENTITY_MODE_SCC,
3781+ RTW89_ENTITY_MODE_MCC_PREPARE,
3782+ RTW89_ENTITY_MODE_MCC,
3783+
3784+ NUM_OF_RTW89_ENTITY_MODE,
3785+ RTW89_ENTITY_MODE_INVALID = NUM_OF_RTW89_ENTITY_MODE,
36993786 };
37003787
37013788 struct rtw89_sub_entity {
@@ -4352,6 +4439,7 @@ struct rtw89_dev { · 650 unmodified lines
43524439 struct rtw89_antdiv_info antdiv;
43534440
43544441 struct delayed_work track_work;
4442+ struct delayed_work chanctx_work;
43554443 struct delayed_work coex_act1_work;
43564444 struct delayed_work coex_bt_devinfo_work;
43574445 struct delayed_work coex_rfk_chk_work;
@@ -4365,6 +4453,7 @@ struct rtw89_dev { · 7 unmodified lines
43654453
43664454 struct rtw89_regulatory_info regulatory;
43674455 struct rtw89_sar_info sar;
4456+ struct rtw89_tas_info tas;
43684457
43694458 struct rtw89_btc btc;
43704459 enum rtw89_ps_mode ps_mode;
@@ -4900,6 +4989,18 @@ const struct rtw89_chan_rcd *rtw89_chan_rcd_get(struct rtw89_dev *rtwdev, · 529 unmodified lines
49004989 return &hal->sub[idx].rcd;
49014990 }
49024991
4992+static inline
4993+const struct rtw89_chan *rtw89_scan_chan_get(struct rtw89_dev *rtwdev)
4994+{
4995+ struct ieee80211_vif *vif = rtwdev->scan_info.scanning_vif;
4996+ struct rtw89_vif *rtwvif = vif_to_rtwvif_safe(vif);
4997+
4998+ if (rtwvif)
4999+ return rtw89_chan_get(rtwdev, rtwvif->sub_entity_idx);
5000+ else
5001+ return rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
5002+}
5003+
49035004 static inline void rtw89_chip_fem_setup(struct rtw89_dev *rtwdev)
49045005 {
49055006 const struct rtw89_chip_info *chip = rtwdev->chip;
@@ -5273,6 +5374,8 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device, · 367 unmodified lines
52735374 void rtw89_free_ieee80211_hw(struct rtw89_dev *rtwdev);
52745375 void rtw89_core_set_chip_txpwr(struct rtw89_dev *rtwdev);
52755376 void rtw89_get_default_chandef(struct cfg80211_chan_def *chandef);
5377+void rtw89_get_channel_params(const struct cfg80211_chan_def *chandef,
5378+ struct rtw89_chan *chan);
52765379 void rtw89_set_channel(struct rtw89_dev *rtwdev);
52775380 void rtw89_get_channel(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,
52785381 struct rtw89_chan *chan);
@@ -5307,5 +5410,6 @@ void rtw89_core_scan_complete(struct rtw89_dev *rtwdev, · 28 unmodified lines
53075410 struct ieee80211_vif *vif, bool hw_scan);
53085411 void rtw89_reg_6ghz_power_recalc(struct rtw89_dev *rtwdev,
53095412 struct rtw89_vif *rtwvif, bool active);
5413+void rtw89_core_ntfy_btc_event(struct rtw89_dev *rtwdev, enum rtw89_btc_hmsg event);
53105414
53115415 #endif
drivers/net/wireless/realtek/rtw89/debug.c+17−9
@@ -572,9 +572,9 @@ static int __print_txpwr_map(struct seq_file *m, struct rtw89_dev *rtwdev, · 571 unmodified lines
572572 seq_puts(m, #_regd "\n"); \
573573 break
574574
575−static void __print_regd(struct seq_file *m, struct rtw89_dev *rtwdev)
575+static void __print_regd(struct seq_file *m, struct rtw89_dev *rtwdev,
576+ const struct rtw89_chan *chan)
576577 {
577− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
578578 u8 band = chan->band_type;
579579 u8 regd = rtw89_regd_get(rtwdev, band);
580580
@@ -604,16 +604,21 @@ static int rtw89_debug_priv_txpwr_table_get(struct seq_file *m, void *v) · 23 unmodified lines
604604 {
605605 struct rtw89_debugfs_priv *debugfs_priv = m->private;
606606 struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;
607+ const struct rtw89_chan *chan;
607608 int ret = 0;
608609
609610 mutex_lock(&rtwdev->mutex);
610611 rtw89_leave_ps_mode(rtwdev);
612+ chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
611613
612614 seq_puts(m, "[Regulatory] ");
613− __print_regd(m, rtwdev);
615+ __print_regd(m, rtwdev, chan);
614616
615617 seq_puts(m, "[SAR]\n");
616− rtw89_print_sar(m, rtwdev);
618+ rtw89_print_sar(m, rtwdev, chan->freq);
619+
620+ seq_puts(m, "[TAS]\n");
621+ rtw89_print_tas(m, rtwdev);
617622
618623 seq_puts(m, "\n[TX power byrate]\n");
619624 ret = __print_txpwr_map(m, rtwdev, &__txpwr_map_byr);
@@ -790,6 +795,9 @@ static void rtw89_debug_dump_mac_mem(struct seq_file *m, · 170 unmodified lines
790795 struct rtw89_dev *rtwdev,
791796 u8 sel, u32 start_addr, u32 len)
792797 {
798+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
799+ u32 filter_model_addr = mac->filter_model_addr;
800+ u32 indir_access_addr = mac->indir_access_addr;
793801 u32 base_addr, start_page, residue;
794802 u32 i, j, p, pages;
795803 u32 dump_len, remain;
@@ -799,17 +807,17 @@ static void rtw89_debug_dump_mac_mem(struct seq_file *m, · 3 unmodified lines
799807 pages = len / MAC_MEM_DUMP_PAGE_SIZE + 1;
800808 start_page = start_addr / MAC_MEM_DUMP_PAGE_SIZE;
801809 residue = start_addr % MAC_MEM_DUMP_PAGE_SIZE;
802− base_addr = rtw89_mac_mem_base_addrs[sel];
810+ base_addr = mac->mem_base_addrs[sel];
803811 base_addr += start_page * MAC_MEM_DUMP_PAGE_SIZE;
804812
805813 for (p = 0; p < pages; p++) {
806814 dump_len = min_t(u32, remain, MAC_MEM_DUMP_PAGE_SIZE);
807− rtw89_write32(rtwdev, R_AX_FILTER_MODEL_ADDR, base_addr);
808− for (i = R_AX_INDIR_ACCESS_ENTRY + residue;
809− i < R_AX_INDIR_ACCESS_ENTRY + dump_len;) {
815+ rtw89_write32(rtwdev, filter_model_addr, base_addr);
816+ for (i = indir_access_addr + residue;
817+ i < indir_access_addr + dump_len;) {
810818 seq_printf(m, "%08xh:", i);
811819 for (j = 0;
812− j < 4 && i < R_AX_INDIR_ACCESS_ENTRY + dump_len;
820+ j < 4 && i < indir_access_addr + dump_len;
813821 j++, i += 4) {
814822 val = rtw89_read32(rtwdev, i);
815823 seq_printf(m, " %08x", val);
drivers/net/wireless/realtek/rtw89/fw.c+19−5
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include "fw.h"
1010 #include "mac.h"
1111 #include "phy.h"
12+#include "ps.h"
1213 #include "reg.h"
1314 #include "util.h"
1415
@@ -1165,7 +1166,7 @@ void rtw89_fw_log_dump(struct rtw89_dev *rtwdev, u8 *buf, u32 len) · 1150 unmodified lines
11651166 return;
11661167
11671168 plain_log:
1168− rtw89_info(rtwdev, "C2H log: %*s", len, buf);
1169+ rtw89_info(rtwdev, "C2H log: %.*s", len, buf);
11691170
11701171 }
11711172
@@ -1758,7 +1759,8 @@ int rtw89_fw_h2c_assoc_cmac_tbl(struct rtw89_dev *rtwdev, · 586 unmodified lines
17581759 const struct rtw89_chip_info *chip = rtwdev->chip;
17591760 struct rtw89_sta *rtwsta = sta_to_rtwsta_safe(sta);
17601761 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
1761− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
1762+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
1763+ rtwvif->sub_entity_idx);
17621764 struct sk_buff *skb;
17631765 u8 pads[RTW89_PPE_BW_NUM];
17641766 u8 mac_id = rtwsta ? rtwsta->mac_id : rtwvif->mac_id;
@@ -1915,12 +1917,15 @@ int rtw89_fw_h2c_update_beacon(struct rtw89_dev *rtwdev, · 150 unmodified lines
19151917 struct rtw89_vif *rtwvif)
19161918 {
19171919 struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
1918− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
1920+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
1921+ rtwvif->sub_entity_idx);
19191922 struct sk_buff *skb;
19201923 struct sk_buff *skb_beacon;
19211924 u16 tim_offset;
19221925 int bcn_total_len;
19231926 u16 beacon_rate;
1927+ void *noa_data;
1928+ u8 noa_len;
19241929 int ret;
19251930
19261931 if (vif->p2p)
@@ -1937,6 +1942,13 @@ int rtw89_fw_h2c_update_beacon(struct rtw89_dev *rtwdev, · 10 unmodified lines
19371942 return -ENOMEM;
19381943 }
19391944
1945+ noa_len = rtw89_p2p_noa_fetch(rtwvif, &noa_data);
1946+ if (noa_len &&
1947+ (noa_len <= skb_tailroom(skb_beacon) ||
1948+ pskb_expand_head(skb_beacon, 0, noa_len, GFP_KERNEL) == 0)) {
1949+ skb_put_data(skb_beacon, noa_data, noa_len);
1950+ }
1951+
19401952 bcn_total_len = H2C_BCN_BASE_LEN + skb_beacon->len;
19411953 skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, bcn_total_len);
19421954 if (!skb) {
@@ -3851,6 +3863,7 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, · 1908 unmodified lines
38513863 struct ieee80211_scan_request *scan_req)
38523864 {
38533865 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
3866+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
38543867 struct cfg80211_scan_request *req = &scan_req->req;
38553868 u32 rx_fltr = rtwdev->hal.rx_fltr;
38563869 u8 mac_addr[ETH_ALEN];
@@ -3873,7 +3886,7 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, · 16 unmodified lines
38733886 rx_fltr &= ~B_AX_A_BC;
38743887 rx_fltr &= ~B_AX_A_A1_MATCH;
38753888 rtw89_write32_mask(rtwdev,
3876− rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0),
3889+ rtw89_mac_reg_by_idx(rtwdev, mac->rx_fltr, RTW89_MAC_0),
38773890 B_AX_RX_FLTR_CFG_MASK,
38783891 rx_fltr);
38793892 }
@@ -3881,6 +3894,7 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, · 1 unmodified line
38813894 void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
38823895 bool aborted)
38833896 {
3897+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
38843898 struct rtw89_hw_scan_info *scan_info = &rtwdev->scan_info;
38853899 struct cfg80211_scan_info info = {
38863900 .aborted = aborted,
@@ -3891,7 +3905,7 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, · 4 unmodified lines
38913905 return;
38923906
38933907 rtw89_write32_mask(rtwdev,
3894− rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0),
3908+ rtw89_mac_reg_by_idx(rtwdev, mac->rx_fltr, RTW89_MAC_0),
38953909 B_AX_RX_FLTR_CFG_MASK,
38963910 rtwdev->hal.rx_fltr);
38973911
drivers/net/wireless/realtek/rtw89/mac.c+108−89
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212 #include "reg.h"
1313 #include "util.h"
1414
15−const u32 rtw89_mac_mem_base_addrs[RTW89_MAC_MEM_NUM] = {
15+static const u32 rtw89_mac_mem_base_addrs_ax[RTW89_MAC_MEM_NUM] = {
1616 [RTW89_MAC_MEM_AXIDMA] = AXIDMA_BASE_ADDR,
1717 [RTW89_MAC_MEM_SHARED_BUF] = SHARED_BUF_BASE_ADDR,
1818 [RTW89_MAC_MEM_DMAC_TBL] = DMAC_TBL_BASE_ADDR,
@@ -39,19 +39,21 @@ const u32 rtw89_mac_mem_base_addrs[RTW89_MAC_MEM_NUM] = { · 20 unmodified lines
3939 static void rtw89_mac_mem_write(struct rtw89_dev *rtwdev, u32 offset,
4040 u32 val, enum rtw89_mac_mem_sel sel)
4141 {
42− u32 addr = rtw89_mac_mem_base_addrs[sel] + offset;
42+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
43+ u32 addr = mac->mem_base_addrs[sel] + offset;
4344
44− rtw89_write32(rtwdev, R_AX_FILTER_MODEL_ADDR, addr);
45− rtw89_write32(rtwdev, R_AX_INDIR_ACCESS_ENTRY, val);
45+ rtw89_write32(rtwdev, mac->filter_model_addr, addr);
46+ rtw89_write32(rtwdev, mac->indir_access_addr, val);
4647 }
4748
4849 static u32 rtw89_mac_mem_read(struct rtw89_dev *rtwdev, u32 offset,
4950 enum rtw89_mac_mem_sel sel)
5051 {
51− u32 addr = rtw89_mac_mem_base_addrs[sel] + offset;
52+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
53+ u32 addr = mac->mem_base_addrs[sel] + offset;
5254
53− rtw89_write32(rtwdev, R_AX_FILTER_MODEL_ADDR, addr);
54− return rtw89_read32(rtwdev, R_AX_INDIR_ACCESS_ENTRY);
55+ rtw89_write32(rtwdev, mac->filter_model_addr, addr);
56+ return rtw89_read32(rtwdev, mac->indir_access_addr);
5557 }
5658
5759 int rtw89_mac_check_mac_en(struct rtw89_dev *rtwdev, u8 mac_idx,
@@ -2082,7 +2084,7 @@ static int addr_cam_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 2024 unmodified lines
20822084 if (ret)
20832085 return ret;
20842086
2085− reg = rtw89_mac_reg_by_idx(R_AX_ADDR_CAM_CTRL, mac_idx);
2087+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_ADDR_CAM_CTRL, mac_idx);
20862088
20872089 val = rtw89_read32(rtwdev, reg);
20882090 val |= u32_encode_bits(0x7f, B_AX_ADDR_CAM_RANGE_MASK) |
@@ -2109,7 +2111,7 @@ static int scheduler_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 20 unmodified lines
21092111 if (ret)
21102112 return ret;
21112113
2112− reg = rtw89_mac_reg_by_idx(R_AX_PREBKF_CFG_1, mac_idx);
2114+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PREBKF_CFG_1, mac_idx);
21132115 if (rtwdev->chip->chip_id == RTL8852C)
21142116 rtw89_write32_mask(rtwdev, reg, B_AX_SIFS_MACTXEN_T1_MASK,
21152117 SIFS_MACTXEN_T1_V1);
@@ -2118,14 +2120,14 @@ static int scheduler_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 2 unmodified lines
21182120 SIFS_MACTXEN_T1);
21192121
21202122 if (rtwdev->chip->chip_id == RTL8852B || rtwdev->chip->chip_id == RTL8851B) {
2121− reg = rtw89_mac_reg_by_idx(R_AX_SCH_EXT_CTRL, mac_idx);
2123+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_SCH_EXT_CTRL, mac_idx);
21222124 rtw89_write32_set(rtwdev, reg, B_AX_PORT_RST_TSF_ADV);
21232125 }
21242126
2125− reg = rtw89_mac_reg_by_idx(R_AX_CCA_CFG_0, mac_idx);
2127+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_CCA_CFG_0, mac_idx);
21262128 rtw89_write32_clr(rtwdev, reg, B_AX_BTCCA_EN);
21272129
2128− reg = rtw89_mac_reg_by_idx(R_AX_PREBKF_CFG_0, mac_idx);
2130+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PREBKF_CFG_0, mac_idx);
21292131 if (rtwdev->chip->chip_id == RTL8852C) {
21302132 val = rtw89_read32_mask(rtwdev, R_AX_SEC_ENG_CTRL,
21312133 B_AX_TX_PARTIAL_MODE);
@@ -2165,13 +2167,13 @@ int rtw89_mac_typ_fltr_opt(struct rtw89_dev *rtwdev, · 33 unmodified lines
21652167
21662168 switch (type) {
21672169 case RTW89_MGNT:
2168− reg = rtw89_mac_reg_by_idx(R_AX_MGNT_FLTR, mac_idx);
2170+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_MGNT_FLTR, mac_idx);
21692171 break;
21702172 case RTW89_CTRL:
2171− reg = rtw89_mac_reg_by_idx(R_AX_CTRL_FLTR, mac_idx);
2173+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_CTRL_FLTR, mac_idx);
21722174 break;
21732175 case RTW89_DATA:
2174− reg = rtw89_mac_reg_by_idx(R_AX_DATA_FLTR, mac_idx);
2176+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_DATA_FLTR, mac_idx);
21752177 break;
21762178 default:
21772179 rtw89_err(rtwdev, "[ERR]set rx filter type err\n");
@@ -2202,9 +2204,9 @@ static int rx_fltr_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 24 unmodified lines
22022204 B_AX_LSIG_PARITY_CHK_EN | B_AX_SIGA_CRC_CHK |
22032205 B_AX_VHT_SU_SIGB_CRC_CHK | B_AX_VHT_MU_SIGB_CRC_CHK |
22042206 B_AX_HE_SIGB_CRC_CHK;
2205− rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, mac_idx),
2207+ rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(rtwdev, R_AX_RX_FLTR_OPT, mac_idx),
22062208 mac_ftlr);
2207− rtw89_write16(rtwdev, rtw89_mac_reg_by_idx(R_AX_PLCP_HDR_FLTR, mac_idx),
2209+ rtw89_write16(rtwdev, rtw89_mac_reg_by_idx(rtwdev, R_AX_PLCP_HDR_FLTR, mac_idx),
22082210 plcp_ftlr);
22092211
22102212 return 0;
@@ -2224,20 +2226,20 @@ static void _patch_dis_resp_chk(struct rtw89_dev *rtwdev, u8 mac_idx) · 13 unmodified lines
22242226 switch (rtwdev->chip->chip_id) {
22252227 case RTL8852A:
22262228 case RTL8852B:
2227− reg = rtw89_mac_reg_by_idx(R_AX_RSP_CHK_SIG, mac_idx);
2229+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_RSP_CHK_SIG, mac_idx);
22282230 val32 = rtw89_read32(rtwdev, reg) & ~b_rsp_chk_nav;
22292231 rtw89_write32(rtwdev, reg, val32);
22302232
2231− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_0, mac_idx);
2233+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_0, mac_idx);
22322234 val32 = rtw89_read32(rtwdev, reg) & ~b_rsp_chk_cca;
22332235 rtw89_write32(rtwdev, reg, val32);
22342236 break;
22352237 default:
2236− reg = rtw89_mac_reg_by_idx(R_AX_RSP_CHK_SIG, mac_idx);
2238+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_RSP_CHK_SIG, mac_idx);
22372239 val32 = rtw89_read32(rtwdev, reg) | b_rsp_chk_nav;
22382240 rtw89_write32(rtwdev, reg, val32);
22392241
2240− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_0, mac_idx);
2242+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_0, mac_idx);
22412243 val32 = rtw89_read32(rtwdev, reg) | b_rsp_chk_cca;
22422244 rtw89_write32(rtwdev, reg, val32);
22432245 break;
@@ -2253,7 +2255,7 @@ static int cca_ctrl_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 9 unmodified lines
22532255 if (ret)
22542256 return ret;
22552257
2256− reg = rtw89_mac_reg_by_idx(R_AX_CCA_CONTROL, mac_idx);
2258+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_CCA_CONTROL, mac_idx);
22572259 val = rtw89_read32(rtwdev, reg);
22582260 val |= (B_AX_TB_CHK_BASIC_NAV | B_AX_TB_CHK_BTCCA |
22592261 B_AX_TB_CHK_EDCCA | B_AX_TB_CHK_CCA_P20 |
@@ -2294,7 +2296,7 @@ static int spatial_reuse_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 34 unmodified lines
22942296 ret = rtw89_mac_check_mac_en(rtwdev, mac_idx, RTW89_CMAC_SEL);
22952297 if (ret)
22962298 return ret;
2297− reg = rtw89_mac_reg_by_idx(R_AX_RX_SR_CTRL, mac_idx);
2299+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_RX_SR_CTRL, mac_idx);
22982300 rtw89_write8_clr(rtwdev, reg, B_AX_SR_EN);
22992301
23002302 return 0;
@@ -2309,13 +2311,13 @@ static int tmac_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 8 unmodified lines
23092311 if (ret)
23102312 return ret;
23112313
2312− reg = rtw89_mac_reg_by_idx(R_AX_MAC_LOOPBACK, mac_idx);
2314+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_MAC_LOOPBACK, mac_idx);
23132315 rtw89_write32_clr(rtwdev, reg, B_AX_MACLBK_EN);
23142316
2315− reg = rtw89_mac_reg_by_idx(R_AX_TCR0, mac_idx);
2317+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TCR0, mac_idx);
23162318 rtw89_write32_mask(rtwdev, reg, B_AX_TCR_UDF_THSD_MASK, TCR_UDF_THSD);
23172319
2318− reg = rtw89_mac_reg_by_idx(R_AX_TXD_FIFO_CTRL, mac_idx);
2320+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TXD_FIFO_CTRL, mac_idx);
23192321 rtw89_write32_mask(rtwdev, reg, B_AX_TXDFIFO_HIGH_MCS_THRE_MASK, TXDFIFO_HIGH_MCS_THRE);
23202322 rtw89_write32_mask(rtwdev, reg, B_AX_TXDFIFO_LOW_MCS_THRE_MASK, TXDFIFO_LOW_MCS_THRE);
23212323
@@ -2333,7 +2335,7 @@ static int trxptcl_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 11 unmodified lines
23332335 if (ret)
23342336 return ret;
23352337
2336− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_0, mac_idx);
2338+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_0, mac_idx);
23372339 val = rtw89_read32(rtwdev, reg);
23382340 val &= ~B_AX_WMAC_SPEC_SIFS_CCK_MASK;
23392341 val |= FIELD_PREP(B_AX_WMAC_SPEC_SIFS_CCK_MASK, WMAC_SPEC_SIFS_CCK);
@@ -2353,12 +2355,12 @@ static int trxptcl_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 13 unmodified lines
23532355 val |= FIELD_PREP(B_AX_WMAC_SPEC_SIFS_OFDM_MASK, sifs);
23542356 rtw89_write32(rtwdev, reg, val);
23552357
2356− reg = rtw89_mac_reg_by_idx(R_AX_RXTRIG_TEST_USER_2, mac_idx);
2358+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_RXTRIG_TEST_USER_2, mac_idx);
23572359 rtw89_write32_set(rtwdev, reg, B_AX_RXTRIG_FCSCHK_EN);
23582360
2359− reg = rtw89_mac_reg_by_idx(rrsr->ref_rate.addr, mac_idx);
2361+ reg = rtw89_mac_reg_by_idx(rtwdev, rrsr->ref_rate.addr, mac_idx);
23602362 rtw89_write32_mask(rtwdev, reg, rrsr->ref_rate.mask, rrsr->ref_rate.data);
2361− reg = rtw89_mac_reg_by_idx(rrsr->rsc.addr, mac_idx);
2363+ reg = rtw89_mac_reg_by_idx(rtwdev, rrsr->rsc.addr, mac_idx);
23622364 rtw89_write32_mask(rtwdev, reg, rrsr->rsc.mask, rrsr->rsc.data);
23632365
23642366 return 0;
@@ -2397,10 +2399,10 @@ static int rmac_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 32 unmodified lines
23972399 if (mac_idx == RTW89_MAC_0)
23982400 rst_bacam(rtwdev);
23992401
2400− reg = rtw89_mac_reg_by_idx(R_AX_RESPBA_CAM_CTRL, mac_idx);
2402+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_RESPBA_CAM_CTRL, mac_idx);
24012403 rtw89_write8_set(rtwdev, reg, B_AX_SSN_SEL);
24022404
2403− reg = rtw89_mac_reg_by_idx(R_AX_DLK_PROTECT_CTL, mac_idx);
2405+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_DLK_PROTECT_CTL, mac_idx);
24042406 val = rtw89_read16(rtwdev, reg);
24052407 val = u16_replace_bits(val, TRXCFG_RMAC_DATA_TO,
24062408 B_AX_RX_DLK_DATA_TIME_MASK);
@@ -2408,10 +2410,10 @@ static int rmac_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 1 unmodified line
24082410 B_AX_RX_DLK_CCA_TIME_MASK);
24092411 rtw89_write16(rtwdev, reg, val);
24102412
2411− reg = rtw89_mac_reg_by_idx(R_AX_RCR, mac_idx);
2413+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_RCR, mac_idx);
24122414 rtw89_write8_mask(rtwdev, reg, B_AX_CH_EN_MASK, 0x1);
24132415
2414− reg = rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, mac_idx);
2416+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_RX_FLTR_OPT, mac_idx);
24152417 if (mac_idx == RTW89_MAC_0)
24162418 rx_qta = rtwdev->mac.dle_info.c0_rx_qta;
24172419 else
@@ -2425,13 +2427,13 @@ static int rmac_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 7 unmodified lines
24252427 if (rtwdev->chip->chip_id == RTL8852A &&
24262428 rtwdev->hal.cv == CHIP_CBV) {
24272429 rtw89_write16_mask(rtwdev,
2428− rtw89_mac_reg_by_idx(R_AX_DLK_PROTECT_CTL, mac_idx),
2430+ rtw89_mac_reg_by_idx(rtwdev, R_AX_DLK_PROTECT_CTL, mac_idx),
24292431 B_AX_RX_DLK_CCA_TIME_MASK, 0);
2430− rtw89_write16_set(rtwdev, rtw89_mac_reg_by_idx(R_AX_RCR, mac_idx),
2432+ rtw89_write16_set(rtwdev, rtw89_mac_reg_by_idx(rtwdev, R_AX_RCR, mac_idx),
24312433 BIT(12));
24322434 }
24332435
2434− reg = rtw89_mac_reg_by_idx(R_AX_PLCP_HDR_FLTR, mac_idx);
2436+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PLCP_HDR_FLTR, mac_idx);
24352437 rtw89_write8_clr(rtwdev, reg, B_AX_VHT_SU_SIGB_CRC_CHK);
24362438
24372439 return ret;
@@ -2447,7 +2449,7 @@ static int cmac_com_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 9 unmodified lines
24472449 if (ret)
24482450 return ret;
24492451
2450− reg = rtw89_mac_reg_by_idx(R_AX_TX_SUB_CARRIER_VALUE, mac_idx);
2452+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TX_SUB_CARRIER_VALUE, mac_idx);
24512453 val = rtw89_read32(rtwdev, reg);
24522454 val = u32_replace_bits(val, 0, B_AX_TXSC_20M_MASK);
24532455 val = u32_replace_bits(val, 0, B_AX_TXSC_40M_MASK);
@@ -2455,7 +2457,7 @@ static int cmac_com_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 1 unmodified line
24552457 rtw89_write32(rtwdev, reg, val);
24562458
24572459 if (chip_id == RTL8852A || chip_id == RTL8852B) {
2458− reg = rtw89_mac_reg_by_idx(R_AX_PTCL_RRSR1, mac_idx);
2460+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PTCL_RRSR1, mac_idx);
24592461 rtw89_write32_mask(rtwdev, reg, B_AX_RRSR_RATE_EN_MASK, RRSR_OFDM_CCK_EN);
24602462 }
24612463
@@ -2485,7 +2487,7 @@ static int ptcl_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 23 unmodified lines
24852487 return ret;
24862488
24872489 if (rtwdev->hci.type == RTW89_HCI_TYPE_PCIE) {
2488− reg = rtw89_mac_reg_by_idx(R_AX_SIFS_SETTING, mac_idx);
2490+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_SIFS_SETTING, mac_idx);
24892491 val = rtw89_read32(rtwdev, reg);
24902492 val = u32_replace_bits(val, S_AX_CTS2S_TH_1K,
24912493 B_AX_HW_CTS2SELF_PKT_LEN_TH_MASK);
@@ -2494,7 +2496,7 @@ static int ptcl_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 2 unmodified lines
24942496 val |= B_AX_HW_CTS2SELF_EN;
24952497 rtw89_write32(rtwdev, reg, val);
24962498
2497− reg = rtw89_mac_reg_by_idx(R_AX_PTCL_FSM_MON, mac_idx);
2499+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PTCL_FSM_MON, mac_idx);
24982500 val = rtw89_read32(rtwdev, reg);
24992501 val = u32_replace_bits(val, S_AX_PTCL_TO_2MS, B_AX_PTCL_TX_ARB_TO_THR_MASK);
25002502 val &= ~B_AX_PTCL_TX_ARB_TO_MODE;
@@ -2531,7 +2533,7 @@ static int cmac_dma_init(struct rtw89_dev *rtwdev, u8 mac_idx) · 30 unmodified lines
25312533 if (ret)
25322534 return ret;
25332535
2534− reg = rtw89_mac_reg_by_idx(R_AX_RXDMA_CTRL_0, mac_idx);
2536+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_RXDMA_CTRL_0, mac_idx);
25352537 rtw89_write8_clr(rtwdev, reg, RX_FULL_MODE);
25362538
25372539 return 0;
@@ -2725,7 +2727,7 @@ static int rtw89_hw_sch_tx_en_h2c(struct rtw89_dev *rtwdev, u8 band, · 187 unmodified lines
27252727 static int rtw89_set_hw_sch_tx_en(struct rtw89_dev *rtwdev, u8 mac_idx,
27262728 u16 tx_en, u16 tx_en_mask)
27272729 {
2728− u32 reg = rtw89_mac_reg_by_idx(R_AX_CTN_TXEN, mac_idx);
2730+ u32 reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_CTN_TXEN, mac_idx);
27292731 u16 val;
27302732 int ret;
27312733
@@ -2747,7 +2749,7 @@ static int rtw89_set_hw_sch_tx_en(struct rtw89_dev *rtwdev, u8 mac_idx, · 15 unmodified lines
27472749 static int rtw89_set_hw_sch_tx_en_v1(struct rtw89_dev *rtwdev, u8 mac_idx,
27482750 u32 tx_en, u32 tx_en_mask)
27492751 {
2750− u32 reg = rtw89_mac_reg_by_idx(R_AX_CTN_DRV_TXEN, mac_idx);
2752+ u32 reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_CTN_DRV_TXEN, mac_idx);
27512753 u32 val;
27522754 int ret;
27532755
@@ -2768,7 +2770,7 @@ int rtw89_mac_stop_sch_tx(struct rtw89_dev *rtwdev, u8 mac_idx, · 14 unmodified lines
27682770 int ret;
27692771
27702772 *tx_en = rtw89_read16(rtwdev,
2771− rtw89_mac_reg_by_idx(R_AX_CTN_TXEN, mac_idx));
2773+ rtw89_mac_reg_by_idx(rtwdev, R_AX_CTN_TXEN, mac_idx));
27722774
27732775 switch (sel) {
27742776 case RTW89_SCH_TX_SEL_ALL:
@@ -2809,7 +2811,7 @@ int rtw89_mac_stop_sch_tx_v1(struct rtw89_dev *rtwdev, u8 mac_idx, · 34 unmodified lines
28092811 int ret;
28102812
28112813 *tx_en = rtw89_read32(rtwdev,
2812− rtw89_mac_reg_by_idx(R_AX_CTN_DRV_TXEN, mac_idx));
2814+ rtw89_mac_reg_by_idx(rtwdev, R_AX_CTN_DRV_TXEN, mac_idx));
28132815
28142816 switch (sel) {
28152817 case RTW89_SCH_TX_SEL_ALL:
@@ -3016,7 +3018,7 @@ static int band_idle_ck_b(struct rtw89_dev *rtwdev, u8 mac_idx) · 200 unmodified lines
30163018 if (ret)
30173019 return ret;
30183020
3019− reg = rtw89_mac_reg_by_idx(R_AX_PTCL_TX_CTN_SEL, mac_idx);
3021+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PTCL_TX_CTN_SEL, mac_idx);
30203022
30213023 ret = read_poll_timeout(rtw89_read8, val,
30223024 (val & B_AX_PTCL_TX_ON_STAT) == 0,
@@ -3224,7 +3226,7 @@ static void rtw89_scheduler_imr_enable(struct rtw89_dev *rtwdev, u8 mac_idx) · 201 unmodified lines
32243226 {
32253227 u32 reg;
32263228
3227− reg = rtw89_mac_reg_by_idx(R_AX_SCHEDULE_ERR_IMR, mac_idx);
3229+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_SCHEDULE_ERR_IMR, mac_idx);
32283230 rtw89_write32_clr(rtwdev, reg, B_AX_SORT_NON_IDLE_ERR_INT_EN |
32293231 B_AX_FSM_TIMEOUT_ERR_INT_EN);
32303232 rtw89_write32_set(rtwdev, reg, B_AX_FSM_TIMEOUT_ERR_INT_EN);
@@ -3235,7 +3237,7 @@ static void rtw89_ptcl_imr_enable(struct rtw89_dev *rtwdev, u8 mac_idx) · 4 unmodified lines
32353237 const struct rtw89_imr_info *imr = rtwdev->chip->imr_info;
32363238 u32 reg;
32373239
3238− reg = rtw89_mac_reg_by_idx(R_AX_PTCL_IMR0, mac_idx);
3240+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PTCL_IMR0, mac_idx);
32393241 rtw89_write32_clr(rtwdev, reg, imr->ptcl_imr_clr);
32403242 rtw89_write32_set(rtwdev, reg, imr->ptcl_imr_set);
32413243 }
@@ -3246,12 +3248,12 @@ static void rtw89_cdma_imr_enable(struct rtw89_dev *rtwdev, u8 mac_idx) · 4 unmodified lines
32463248 enum rtw89_core_chip_id chip_id = rtwdev->chip->chip_id;
32473249 u32 reg;
32483250
3249− reg = rtw89_mac_reg_by_idx(imr->cdma_imr_0_reg, mac_idx);
3251+ reg = rtw89_mac_reg_by_idx(rtwdev, imr->cdma_imr_0_reg, mac_idx);
32503252 rtw89_write32_clr(rtwdev, reg, imr->cdma_imr_0_clr);
32513253 rtw89_write32_set(rtwdev, reg, imr->cdma_imr_0_set);
32523254
32533255 if (chip_id == RTL8852C) {
3254− reg = rtw89_mac_reg_by_idx(imr->cdma_imr_1_reg, mac_idx);
3256+ reg = rtw89_mac_reg_by_idx(rtwdev, imr->cdma_imr_1_reg, mac_idx);
32553257 rtw89_write32_clr(rtwdev, reg, imr->cdma_imr_1_clr);
32563258 rtw89_write32_set(rtwdev, reg, imr->cdma_imr_1_set);
32573259 }
@@ -3262,7 +3264,7 @@ static void rtw89_phy_intf_imr_enable(struct rtw89_dev *rtwdev, u8 mac_idx) · 4 unmodified lines
32623264 const struct rtw89_imr_info *imr = rtwdev->chip->imr_info;
32633265 u32 reg;
32643266
3265− reg = rtw89_mac_reg_by_idx(imr->phy_intf_imr_reg, mac_idx);
3267+ reg = rtw89_mac_reg_by_idx(rtwdev, imr->phy_intf_imr_reg, mac_idx);
32663268 rtw89_write32_clr(rtwdev, reg, imr->phy_intf_imr_clr);
32673269 rtw89_write32_set(rtwdev, reg, imr->phy_intf_imr_set);
32683270 }
@@ -3272,7 +3274,7 @@ static void rtw89_rmac_imr_enable(struct rtw89_dev *rtwdev, u8 mac_idx) · 3 unmodified lines
32723274 const struct rtw89_imr_info *imr = rtwdev->chip->imr_info;
32733275 u32 reg;
32743276
3275− reg = rtw89_mac_reg_by_idx(imr->rmac_imr_reg, mac_idx);
3277+ reg = rtw89_mac_reg_by_idx(rtwdev, imr->rmac_imr_reg, mac_idx);
32763278 rtw89_write32_clr(rtwdev, reg, imr->rmac_imr_clr);
32773279 rtw89_write32_set(rtwdev, reg, imr->rmac_imr_set);
32783280 }
@@ -3282,7 +3284,7 @@ static void rtw89_tmac_imr_enable(struct rtw89_dev *rtwdev, u8 mac_idx) · 3 unmodified lines
32823284 const struct rtw89_imr_info *imr = rtwdev->chip->imr_info;
32833285 u32 reg;
32843286
3285− reg = rtw89_mac_reg_by_idx(imr->tmac_imr_reg, mac_idx);
3287+ reg = rtw89_mac_reg_by_idx(rtwdev, imr->tmac_imr_reg, mac_idx);
32863288 rtw89_write32_clr(rtwdev, reg, imr->tmac_imr_clr);
32873289 rtw89_write32_set(rtwdev, reg, imr->tmac_imr_set);
32883290 }
@@ -3661,6 +3663,9 @@ static void rtw89_mac_dmac_tbl_init(struct rtw89_dev *rtwdev, u8 macid) · 372 unmodified lines
36613663 {
36623664 u8 i;
36633665
3666+ if (rtwdev->chip->chip_gen != RTW89_CHIP_AX)
3667+ return;
3668+
36643669 for (i = 0; i < 4; i++) {
36653670 rtw89_write32(rtwdev, R_AX_FILTER_MODEL_ADDR,
36663671 DMAC_TBL_BASE_ADDR + (macid << 4) + (i << 2));
@@ -3670,6 +3675,9 @@ static void rtw89_mac_dmac_tbl_init(struct rtw89_dev *rtwdev, u8 macid) · 3 unmodified lines
36703675
36713676 static void rtw89_mac_cmac_tbl_init(struct rtw89_dev *rtwdev, u8 macid)
36723677 {
3678+ if (rtwdev->chip->chip_gen != RTW89_CHIP_AX)
3679+ return;
3680+
36733681 rtw89_write32(rtwdev, R_AX_FILTER_MODEL_ADDR,
36743682 CMAC_TBL_BASE_ADDR + macid * CCTL_INFO_SIZE);
36753683 rtw89_write32(rtwdev, R_AX_INDIR_ACCESS_ENTRY, 0x4);
@@ -3860,7 +3868,7 @@ static void rtw89_mac_port_cfg_hiq_win(struct rtw89_dev *rtwdev, · 184 unmodified lines
38603868 u8 port = rtwvif->port;
38613869 u32 reg;
38623870
3863− reg = rtw89_mac_reg_by_idx(hiq_win_addr[port], rtwvif->mac_idx);
3871+ reg = rtw89_mac_reg_by_idx(rtwdev, hiq_win_addr[port], rtwvif->mac_idx);
38643872 rtw89_write8(rtwdev, reg, win);
38653873 }
38663874
@@ -3871,7 +3879,7 @@ static void rtw89_mac_port_cfg_hiq_dtim(struct rtw89_dev *rtwdev, · 4 unmodified lines
38713879 const struct rtw89_port_reg *p = &rtw_port_base;
38723880 u32 addr;
38733881
3874− addr = rtw89_mac_reg_by_idx(R_AX_MD_TSFT_STMP_CTL, rtwvif->mac_idx);
3882+ addr = rtw89_mac_reg_by_idx(rtwdev, R_AX_MD_TSFT_STMP_CTL, rtwvif->mac_idx);
38753883 rtw89_write8_set(rtwdev, addr, B_AX_UPD_HGQMD | B_AX_UPD_TIMIE);
38763884
38773885 rtw89_write16_port_mask(rtwdev, rtwvif, p->dtim_ctrl, B_AX_DTIM_NUM_MASK,
@@ -3930,7 +3938,7 @@ static void rtw89_mac_port_cfg_bss_color(struct rtw89_dev *rtwdev, · 52 unmodified lines
39303938
39313939 bss_color = vif->bss_conf.he_bss_color.color;
39323940 reg_base = port >= 4 ? R_AX_PTCL_BSS_COLOR_1 : R_AX_PTCL_BSS_COLOR_0;
3933− reg = rtw89_mac_reg_by_idx(reg_base, rtwvif->mac_idx);
3941+ reg = rtw89_mac_reg_by_idx(rtwdev, reg_base, rtwvif->mac_idx);
39343942 rtw89_write32_mask(rtwdev, reg, masks[port], bss_color);
39353943 }
39363944
@@ -3944,7 +3952,7 @@ static void rtw89_mac_port_cfg_mbssid(struct rtw89_dev *rtwdev, · 7 unmodified lines
39443952 return;
39453953
39463954 if (port == 0) {
3947− reg = rtw89_mac_reg_by_idx(R_AX_MBSSID_CTRL, rtwvif->mac_idx);
3955+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_MBSSID_CTRL, rtwvif->mac_idx);
39483956 rtw89_write32_clr(rtwdev, reg, B_AX_P0MB_ALL_MASK);
39493957 }
39503958 }
@@ -3956,7 +3964,7 @@ static void rtw89_mac_port_cfg_hiq_drop(struct rtw89_dev *rtwdev, · 5 unmodified lines
39563964 u32 reg;
39573965 u32 val;
39583966
3959− reg = rtw89_mac_reg_by_idx(R_AX_MBSSID_DROP_0, rtwvif->mac_idx);
3967+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_MBSSID_DROP_0, rtwvif->mac_idx);
39603968 val = rtw89_read32(rtwdev, reg);
39613969 val &= ~FIELD_PREP(B_AX_PORT_DROP_4_0_MASK, BIT(port));
39623970 if (port == 0)
@@ -4014,7 +4022,7 @@ void rtw89_mac_port_tsf_sync(struct rtw89_dev *rtwdev, · 51 unmodified lines
40144022 u32 val, reg;
40154023
40164024 val = RTW89_PORT_OFFSET_TU_TO_32US(offset_tu);
4017− reg = rtw89_mac_reg_by_idx(R_AX_PORT0_TSF_SYNC + rtwvif->port * 4,
4025+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PORT0_TSF_SYNC + rtwvif->port * 4,
40184026 rtwvif->mac_idx);
40194027
40204028 rtw89_write32_mask(rtwdev, reg, B_AX_SYNC_PORT_SRC, rtwvif_src->port);
@@ -4204,7 +4212,7 @@ void rtw89_mac_set_he_obss_narrow_bw_ru(struct rtw89_dev *rtwdev, · 183 unmodified lines
42044212 rtw89_mac_check_he_obss_narrow_bw_ru_iter,
42054213 &tolerated);
42064214
4207− reg = rtw89_mac_reg_by_idx(R_AX_RXTRIG_TEST_USER_2, rtwvif->mac_idx);
4215+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_RXTRIG_TEST_USER_2, rtwvif->mac_idx);
42084216 if (tolerated)
42094217 rtw89_write32_clr(rtwdev, reg, B_AX_RXTRIG_RU26_DIS);
42104218 else
@@ -4731,7 +4739,7 @@ bool rtw89_mac_get_txpwr_cr(struct rtw89_dev *rtwdev, · 520 unmodified lines
47314739 {
47324740 const struct rtw89_dle_mem *dle_mem = rtwdev->chip->dle_mem;
47334741 enum rtw89_qta_mode mode = dle_mem->mode;
4734− u32 addr = rtw89_mac_reg_by_idx(reg_base, phy_idx);
4742+ u32 addr = rtw89_mac_reg_by_idx(rtwdev, reg_base, phy_idx);
47354743
47364744 if (addr < R_AX_PWR_RATE_CTRL || addr > CMAC1_END_ADDR) {
47374745 rtw89_err(rtwdev, "[TXPWR] addr=0x%x exceed txpwr cr\n",
@@ -4760,7 +4768,7 @@ EXPORT_SYMBOL(rtw89_mac_get_txpwr_cr); · 22 unmodified lines
47604768
47614769 int rtw89_mac_cfg_ppdu_status(struct rtw89_dev *rtwdev, u8 mac_idx, bool enable)
47624770 {
4763− u32 reg = rtw89_mac_reg_by_idx(R_AX_PPDU_STAT, mac_idx);
4771+ u32 reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PPDU_STAT, mac_idx);
47644772 int ret;
47654773
47664774 ret = rtw89_mac_check_mac_en(rtwdev, mac_idx, RTW89_CMAC_SEL);
@@ -4807,7 +4815,7 @@ void rtw89_mac_update_rts_threshold(struct rtw89_dev *rtwdev, u8 mac_idx) · 40 unmodified lines
48074815 time_th = min_t(u32, time_th >> MAC_AX_TIME_TH_SH, MAC_AX_TIME_TH_MAX);
48084816 len_th = min_t(u32, len_th >> MAC_AX_LEN_TH_SH, MAC_AX_LEN_TH_MAX);
48094817
4810− reg = rtw89_mac_reg_by_idx(R_AX_AGG_LEN_HT_0, mac_idx);
4818+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_AGG_LEN_HT_0, mac_idx);
48114819 rtw89_write16_mask(rtwdev, reg, B_AX_RTS_TXTIME_TH_MASK, time_th);
48124820 rtw89_write16_mask(rtwdev, reg, B_AX_RTS_LEN_TH_MASK, len_th);
48134821 }
@@ -5043,7 +5051,7 @@ int rtw89_mac_cfg_plt(struct rtw89_dev *rtwdev, struct rtw89_mac_ax_plt *plt) · 229 unmodified lines
50435051 if (ret)
50445052 return ret;
50455053
5046− reg = rtw89_mac_reg_by_idx(R_AX_BT_PLT, plt->band);
5054+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_BT_PLT, plt->band);
50475055 val = (plt->tx & RTW89_MAC_AX_PLT_LTE_RX ? B_AX_TX_PLT_GNT_LTE_RX : 0) |
50485056 (plt->tx & RTW89_MAC_AX_PLT_GNT_BT_TX ? B_AX_TX_PLT_GNT_BT_TX : 0) |
50495057 (plt->tx & RTW89_MAC_AX_PLT_GNT_BT_RX ? B_AX_TX_PLT_GNT_BT_RX : 0) |
@@ -5133,7 +5141,7 @@ u16 rtw89_mac_get_plt_cnt(struct rtw89_dev *rtwdev, u8 band) · 83 unmodified lines
51335141 u32 reg;
51345142 u16 cnt;
51355143
5136− reg = rtw89_mac_reg_by_idx(R_AX_BT_PLT, band);
5144+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_BT_PLT, band);
51375145 cnt = rtw89_read32_mask(rtwdev, reg, B_AX_BT_PLT_PKT_CNT_MASK);
51385146 rtw89_write16_set(rtwdev, reg, B_AX_BT_PLT_RST);
51395147
@@ -5146,7 +5154,7 @@ static void rtw89_mac_bfee_standby_timer(struct rtw89_dev *rtwdev, u8 mac_idx, · 6 unmodified lines
51465154 u32 reg;
51475155
51485156 rtw89_debug(rtwdev, RTW89_DBG_BF, "set bfee standby_timer to %d\n", keep);
5149− reg = rtw89_mac_reg_by_idx(R_AX_BFMEE_RESP_OPTION, mac_idx);
5157+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_BFMEE_RESP_OPTION, mac_idx);
51505158 if (keep) {
51515159 set_bit(RTW89_FLAG_BFEE_TIMER_KEEP, rtwdev->flags);
51525160 rtw89_write32_mask(rtwdev, reg, B_AX_BFMEE_BFRP_RX_STANDBY_TIMER_MASK,
@@ -5165,7 +5173,7 @@ static void rtw89_mac_bfee_ctrl(struct rtw89_dev *rtwdev, u8 mac_idx, bool en) · 12 unmodified lines
51655173 B_AX_BFMEE_HE_NDPA_EN;
51665174
51675175 rtw89_debug(rtwdev, RTW89_DBG_BF, "set bfee ndpa_en to %d\n", en);
5168− reg = rtw89_mac_reg_by_idx(R_AX_BFMEE_RESP_OPTION, mac_idx);
5176+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_BFMEE_RESP_OPTION, mac_idx);
51695177 if (en) {
51705178 set_bit(RTW89_FLAG_BFEE_EN, rtwdev->flags);
51715179 rtw89_write32_set(rtwdev, reg, mask);
@@ -5187,30 +5195,30 @@ static int rtw89_mac_init_bfee(struct rtw89_dev *rtwdev, u8 mac_idx) · 15 unmodified lines
51875195
51885196 /* AP mode set tx gid to 63 */
51895197 /* STA mode set tx gid to 0(default) */
5190− reg = rtw89_mac_reg_by_idx(R_AX_BFMER_CTRL_0, mac_idx);
5198+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_BFMER_CTRL_0, mac_idx);
51915199 rtw89_write32_set(rtwdev, reg, B_AX_BFMER_NDP_BFEN);
51925200
5193− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_CSI_RRSC, mac_idx);
5201+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_CSI_RRSC, mac_idx);
51945202 rtw89_write32(rtwdev, reg, CSI_RRSC_BMAP);
51955203
5196− reg = rtw89_mac_reg_by_idx(R_AX_BFMEE_RESP_OPTION, mac_idx);
5204+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_BFMEE_RESP_OPTION, mac_idx);
51975205 val32 = FIELD_PREP(B_AX_BFMEE_NDP_RX_STANDBY_TIMER_MASK, NDP_RX_STANDBY_TIMER);
51985206 rtw89_write32(rtwdev, reg, val32);
51995207 rtw89_mac_bfee_standby_timer(rtwdev, mac_idx, true);
52005208 rtw89_mac_bfee_ctrl(rtwdev, mac_idx, true);
52015209
5202− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_CSI_CTRL_0, mac_idx);
5210+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_CSI_CTRL_0, mac_idx);
52035211 rtw89_write32_set(rtwdev, reg, B_AX_BFMEE_BFPARAM_SEL |
52045212 B_AX_BFMEE_USE_NSTS |
52055213 B_AX_BFMEE_CSI_GID_SEL |
52065214 B_AX_BFMEE_CSI_FORCE_RETE_EN);
5207− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_CSI_RATE, mac_idx);
5215+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_CSI_RATE, mac_idx);
52085216 rtw89_write32(rtwdev, reg,
52095217 u32_encode_bits(CSI_INIT_RATE_HT, B_AX_BFMEE_HT_CSI_RATE_MASK) |
52105218 u32_encode_bits(CSI_INIT_RATE_VHT, B_AX_BFMEE_VHT_CSI_RATE_MASK) |
52115219 u32_encode_bits(CSI_INIT_RATE_HE, B_AX_BFMEE_HE_CSI_RATE_MASK));
52125220
5213− reg = rtw89_mac_reg_by_idx(R_AX_CSIRPT_OPTION, mac_idx);
5221+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_CSIRPT_OPTION, mac_idx);
52145222 rtw89_write32_set(rtwdev, reg,
52155223 B_AX_CSIPRT_VHTSU_AID_EN | B_AX_CSIPRT_HESU_AID_EN);
52165224
@@ -5254,7 +5262,7 @@ static int rtw89_mac_set_csi_para_reg(struct rtw89_dev *rtwdev, · 37 unmodified lines
52545262 nc = min(nc, sound_dim);
52555263 nr = min(nr, sound_dim);
52565264
5257− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_CSI_CTRL_0, mac_idx);
5265+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_CSI_CTRL_0, mac_idx);
52585266 rtw89_write32_set(rtwdev, reg, B_AX_BFMEE_BFPARAM_SEL);
52595267
52605268 val = FIELD_PREP(B_AX_BFMEE_CSIINFO0_NC_MASK, nc) |
@@ -5266,9 +5274,9 @@ static int rtw89_mac_set_csi_para_reg(struct rtw89_dev *rtwdev, · 5 unmodified lines
52665274 FIELD_PREP(B_AX_BFMEE_CSIINFO0_STBC_EN, stbc_en);
52675275
52685276 if (port_sel == 0)
5269− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_CSI_CTRL_0, mac_idx);
5277+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_CSI_CTRL_0, mac_idx);
52705278 else
5271− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_CSI_CTRL_1, mac_idx);
5279+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_CSI_CTRL_1, mac_idx);
52725280
52735281 rtw89_write16(rtwdev, reg, val);
52745282
@@ -5304,11 +5312,11 @@ static int rtw89_mac_csi_rrsc(struct rtw89_dev *rtwdev, · 29 unmodified lines
53045312 BIT(RTW89_MAC_BF_RRSC_HT_MSC3) |
53055313 BIT(RTW89_MAC_BF_RRSC_HT_MSC5));
53065314 }
5307− reg = rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_CSI_CTRL_0, mac_idx);
5315+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_CSI_CTRL_0, mac_idx);
53085316 rtw89_write32_set(rtwdev, reg, B_AX_BFMEE_BFPARAM_SEL);
53095317 rtw89_write32_clr(rtwdev, reg, B_AX_BFMEE_CSI_FORCE_RETE_EN);
53105318 rtw89_write32(rtwdev,
5311− rtw89_mac_reg_by_idx(R_AX_TRXPTCL_RESP_CSI_RRSC, mac_idx),
5319+ rtw89_mac_reg_by_idx(rtwdev, R_AX_TRXPTCL_RESP_CSI_RRSC, mac_idx),
53125320 rrsc);
53135321
53145322 return 0;
@@ -5346,19 +5354,21 @@ void rtw89_mac_bf_set_gid_table(struct rtw89_dev *rtwdev, struct ieee80211_vif * · 31 unmodified lines
53465354 rtw89_debug(rtwdev, RTW89_DBG_BF, "update bf GID table\n");
53475355
53485356 p = (__le32 *)conf->mu_group.membership;
5349− rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(R_AX_GID_POSITION_EN0, mac_idx),
5357+ rtw89_write32(rtwdev,
5358+ rtw89_mac_reg_by_idx(rtwdev, R_AX_GID_POSITION_EN0, mac_idx),
53505359 le32_to_cpu(p[0]));
5351− rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(R_AX_GID_POSITION_EN1, mac_idx),
5360+ rtw89_write32(rtwdev,
5361+ rtw89_mac_reg_by_idx(rtwdev, R_AX_GID_POSITION_EN1, mac_idx),
53525362 le32_to_cpu(p[1]));
53535363
53545364 p = (__le32 *)conf->mu_group.position;
5355− rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(R_AX_GID_POSITION0, mac_idx),
5365+ rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(rtwdev, R_AX_GID_POSITION0, mac_idx),
53565366 le32_to_cpu(p[0]));
5357− rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(R_AX_GID_POSITION1, mac_idx),
5367+ rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(rtwdev, R_AX_GID_POSITION1, mac_idx),
53585368 le32_to_cpu(p[1]));
5359− rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(R_AX_GID_POSITION2, mac_idx),
5369+ rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(rtwdev, R_AX_GID_POSITION2, mac_idx),
53605370 le32_to_cpu(p[2]));
5361− rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(R_AX_GID_POSITION3, mac_idx),
5371+ rtw89_write32(rtwdev, rtw89_mac_reg_by_idx(rtwdev, R_AX_GID_POSITION3, mac_idx),
53625372 le32_to_cpu(p[3]));
53635373 }
53645374
@@ -5449,7 +5459,7 @@ __rtw89_mac_set_tx_time(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta, · 84 unmodified lines
54495459 return ret;
54505460 }
54515461
5452− reg = rtw89_mac_reg_by_idx(R_AX_AMPDU_AGG_LIMIT, mac_idx);
5462+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_AMPDU_AGG_LIMIT, mac_idx);
54535463 rtw89_write32_mask(rtwdev, reg, B_AX_AMPDU_MAX_TIME_MASK,
54545464 max_tx_time >> 5);
54555465 }
@@ -5489,7 +5499,7 @@ int rtw89_mac_get_tx_time(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta, · 33 unmodified lines
54895499 return ret;
54905500 }
54915501
5492− reg = rtw89_mac_reg_by_idx(R_AX_AMPDU_AGG_LIMIT, mac_idx);
5502+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_AMPDU_AGG_LIMIT, mac_idx);
54935503 *tx_time = rtw89_read32_mask(rtwdev, reg, B_AX_AMPDU_MAX_TIME_MASK) << 5;
54945504 }
54955505
@@ -5531,7 +5541,7 @@ int rtw89_mac_get_tx_retry_limit(struct rtw89_dev *rtwdev, · 35 unmodified lines
55315541 return ret;
55325542 }
55335543
5534− reg = rtw89_mac_reg_by_idx(R_AX_TXCNT, mac_idx);
5544+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_TXCNT, mac_idx);
55355545 *tx_retry = rtw89_read32_mask(rtwdev, reg, B_AX_L_TXCNT_LMT_MASK);
55365546 }
55375547
@@ -5550,7 +5560,7 @@ int rtw89_mac_set_hw_muedca_ctrl(struct rtw89_dev *rtwdev, · 12 unmodified lines
55505560 if (ret)
55515561 return ret;
55525562
5553− reg = rtw89_mac_reg_by_idx(R_AX_MUEDCA_EN, mac_idx);
5563+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_MUEDCA_EN, mac_idx);
55545564 if (en)
55555565 rtw89_write16_set(rtwdev, reg, set);
55565566 else
@@ -5673,3 +5683,12 @@ int rtw89_mac_ptk_drop_by_band_and_wait(struct rtw89_dev *rtwdev, · 116 unmodified lines
56735683 }
56745684 return ret;
56755685 }
5686+
5687+const struct rtw89_mac_gen_def rtw89_mac_gen_ax = {
5688+ .band1_offset = RTW89_MAC_AX_BAND_REG_OFFSET,
5689+ .filter_model_addr = R_AX_FILTER_MODEL_ADDR,
5690+ .indir_access_addr = R_AX_INDIR_ACCESS_ENTRY,
5691+ .mem_base_addrs = rtw89_mac_mem_base_addrs_ax,
5692+ .rx_fltr = R_AX_RX_FLTR_OPT,
5693+};
5694+EXPORT_SYMBOL(rtw89_mac_gen_ax);
drivers/net/wireless/realtek/rtw89/mac.h+55−14
@@ -275,6 +275,7 @@ enum rtw89_mac_dbg_port_sel { · 274 unmodified lines
275275
276276 /* SRAM mem dump */
277277 #define R_AX_INDIR_ACCESS_ENTRY 0x40000
278+#define R_BE_INDIR_ACCESS_ENTRY 0x80000
278279
279280 #define AXIDMA_BASE_ADDR 0x18006000
280281 #define STA_SCHED_BASE_ADDR 0x18808000
@@ -298,6 +299,31 @@ enum rtw89_mac_dbg_port_sel { · 17 unmodified lines
298299 #define TXDATA_FIFO_1_BASE_ADDR 0x188A1000
299300 #define CPU_LOCAL_BASE_ADDR 0x18003000
300301
302+#define WD_PAGE_BASE_ADDR_BE 0x0
303+#define CPU_LOCAL_BASE_ADDR_BE 0x18003000
304+#define AXIDMA_BASE_ADDR_BE 0x18006000
305+#define SHARED_BUF_BASE_ADDR_BE 0x18700000
306+#define DMAC_TBL_BASE_ADDR_BE 0x18800000
307+#define SHCUT_MACHDR_BASE_ADDR_BE 0x18800800
308+#define STA_SCHED_BASE_ADDR_BE 0x18818000
309+#define NAT25_CAM_BASE_ADDR_BE 0x18820000
310+#define RXPLD_FLTR_CAM_BASE_ADDR_BE 0x18823000
311+#define SEC_CAM_BASE_ADDR_BE 0x18824000
312+#define WOW_CAM_BASE_ADDR_BE 0x18828000
313+#define MLD_TBL_BASE_ADDR_BE 0x18829000
314+#define RX_CLSF_CAM_BASE_ADDR_BE 0x1882A000
315+#define CMAC_TBL_BASE_ADDR_BE 0x18840000
316+#define ADDR_CAM_BASE_ADDR_BE 0x18850000
317+#define BSSID_CAM_BASE_ADDR_BE 0x18858000
318+#define BA_CAM_BASE_ADDR_BE 0x18859000
319+#define BCN_IE_CAM0_BASE_ADDR_BE 0x18860000
320+#define TXDATA_FIFO_0_BASE_ADDR_BE 0x18861000
321+#define TXD_FIFO_0_BASE_ADDR_BE 0x18862000
322+#define BCN_IE_CAM1_BASE_ADDR_BE 0x18880000
323+#define TXDATA_FIFO_1_BASE_ADDR_BE 0x18881000
324+#define TXD_FIFO_1_BASE_ADDR_BE 0x18881800
325+#define DCPU_LOCAL_BASE_ADDR_BE 0x19C02000
326+
301327 #define CCTL_INFO_SIZE 32
302328
303329 enum rtw89_mac_mem_sel {
@@ -322,13 +348,12 @@ enum rtw89_mac_mem_sel { · 18 unmodified lines
322348 RTW89_MAC_MEM_BSSID_CAM,
323349 RTW89_MAC_MEM_TXD_FIFO_0_V1,
324350 RTW89_MAC_MEM_TXD_FIFO_1_V1,
351+ RTW89_MAC_MEM_WD_PAGE,
325352
326353 /* keep last */
327354 RTW89_MAC_MEM_NUM,
328355 };
329356
330−extern const u32 rtw89_mac_mem_base_addrs[];
331−
332357 enum rtw89_rpwm_req_pwr_state {
333358 RTW89_MAC_RPWM_REQ_PWR_STATE_ACTIVE = 0,
334359 RTW89_MAC_RPWM_REQ_PWR_STATE_BAND0_RFON = 1,
@@ -478,6 +503,7 @@ enum rtw89_mac_bf_rrsc_rate { · 143 unmodified lines
478503 ({typeof(_addr) __addr = (_addr); \
479504 __addr >= R_AX_CMAC_REG_START && __addr <= R_AX_CMAC_REG_END; })
480505 #define RTW89_MAC_AX_BAND_REG_OFFSET 0x2000
506+#define RTW89_MAC_BE_BAND_REG_OFFSET 0x4000
481507
482508 #define PTCL_IDLE_POLL_CNT 10000
483509 #define SW_CVR_DUR_US 8
@@ -826,14 +852,29 @@ struct rtw89_mac_size_set { · 342 unmodified lines
826852
827853 extern const struct rtw89_mac_size_set rtw89_mac_size;
828854
829−static inline u32 rtw89_mac_reg_by_idx(u32 reg_base, u8 band)
855+struct rtw89_mac_gen_def {
856+ u32 band1_offset;
857+ u32 filter_model_addr;
858+ u32 indir_access_addr;
859+ const u32 *mem_base_addrs;
860+ u32 rx_fltr;
861+};
862+
863+extern const struct rtw89_mac_gen_def rtw89_mac_gen_ax;
864+extern const struct rtw89_mac_gen_def rtw89_mac_gen_be;
865+
866+static inline
867+u32 rtw89_mac_reg_by_idx(struct rtw89_dev *rtwdev, u32 reg_base, u8 band)
830868 {
831− return band == 0 ? reg_base : (reg_base + 0x2000);
869+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
870+
871+ return band == 0 ? reg_base : (reg_base + mac->band1_offset);
832872 }
833873
834−static inline u32 rtw89_mac_reg_by_port(u32 base, u8 port, u8 mac_idx)
874+static inline
875+u32 rtw89_mac_reg_by_port(struct rtw89_dev *rtwdev, u32 base, u8 port, u8 mac_idx)
835876 {
836− return rtw89_mac_reg_by_idx(base + port * 0x40, mac_idx);
877+ return rtw89_mac_reg_by_idx(rtwdev, base + port * 0x40, mac_idx);
837878 }
838879
839880 static inline u32
@@ -841,7 +882,7 @@ rtw89_read32_port(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, u32 base) · 1 unmodified line
841882 {
842883 u32 reg;
843884
844− reg = rtw89_mac_reg_by_port(base, rtwvif->port, rtwvif->mac_idx);
885+ reg = rtw89_mac_reg_by_port(rtwdev, base, rtwvif->port, rtwvif->mac_idx);
845886 return rtw89_read32(rtwdev, reg);
846887 }
847888
@@ -851,7 +892,7 @@ rtw89_read32_port_mask(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, · 3 unmodified lines
851892 {
852893 u32 reg;
853894
854− reg = rtw89_mac_reg_by_port(base, rtwvif->port, rtwvif->mac_idx);
895+ reg = rtw89_mac_reg_by_port(rtwdev, base, rtwvif->port, rtwvif->mac_idx);
855896 return rtw89_read32_mask(rtwdev, reg, mask);
856897 }
857898
@@ -861,7 +902,7 @@ rtw89_write32_port(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, u32 base, · 3 unmodified lines
861902 {
862903 u32 reg;
863904
864− reg = rtw89_mac_reg_by_port(base, rtwvif->port, rtwvif->mac_idx);
905+ reg = rtw89_mac_reg_by_port(rtwdev, base, rtwvif->port, rtwvif->mac_idx);
865906 rtw89_write32(rtwdev, reg, data);
866907 }
867908
@@ -871,7 +912,7 @@ rtw89_write32_port_mask(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, · 3 unmodified lines
871912 {
872913 u32 reg;
873914
874− reg = rtw89_mac_reg_by_port(base, rtwvif->port, rtwvif->mac_idx);
915+ reg = rtw89_mac_reg_by_port(rtwdev, base, rtwvif->port, rtwvif->mac_idx);
875916 rtw89_write32_mask(rtwdev, reg, mask, data);
876917 }
877918
@@ -881,7 +922,7 @@ rtw89_write16_port_mask(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, · 3 unmodified lines
881922 {
882923 u32 reg;
883924
884− reg = rtw89_mac_reg_by_port(base, rtwvif->port, rtwvif->mac_idx);
925+ reg = rtw89_mac_reg_by_port(rtwdev, base, rtwvif->port, rtwvif->mac_idx);
885926 rtw89_write16_mask(rtwdev, reg, mask, data);
886927 }
887928
@@ -891,7 +932,7 @@ rtw89_write32_port_clr(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, · 3 unmodified lines
891932 {
892933 u32 reg;
893934
894− reg = rtw89_mac_reg_by_port(base, rtwvif->port, rtwvif->mac_idx);
935+ reg = rtw89_mac_reg_by_port(rtwdev, base, rtwvif->port, rtwvif->mac_idx);
895936 rtw89_write32_clr(rtwdev, reg, bit);
896937 }
897938
@@ -901,7 +942,7 @@ rtw89_write16_port_clr(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, · 3 unmodified lines
901942 {
902943 u32 reg;
903944
904− reg = rtw89_mac_reg_by_port(base, rtwvif->port, rtwvif->mac_idx);
945+ reg = rtw89_mac_reg_by_port(rtwdev, base, rtwvif->port, rtwvif->mac_idx);
905946 rtw89_write16_clr(rtwdev, reg, bit);
906947 }
907948
@@ -911,7 +952,7 @@ rtw89_write32_port_set(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif, · 3 unmodified lines
911952 {
912953 u32 reg;
913954
914− reg = rtw89_mac_reg_by_port(base, rtwvif->port, rtwvif->mac_idx);
955+ reg = rtw89_mac_reg_by_port(rtwdev, base, rtwvif->port, rtwvif->mac_idx);
915956 rtw89_write32_set(rtwdev, reg, bit);
916957 }
917958
drivers/net/wireless/realtek/rtw89/mac80211.c+10−4
@@ -224,6 +224,7 @@ static void rtw89_ops_configure_filter(struct ieee80211_hw *hw, · 223 unmodified lines
224224 u64 multicast)
225225 {
226226 struct rtw89_dev *rtwdev = hw->priv;
227+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
227228
228229 mutex_lock(&rtwdev->mutex);
229230 rtw89_leave_ps_mode(rtwdev);
@@ -271,13 +272,13 @@ static void rtw89_ops_configure_filter(struct ieee80211_hw *hw, · 41 unmodified lines
271272 }
272273
273274 rtw89_write32_mask(rtwdev,
274− rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0),
275+ rtw89_mac_reg_by_idx(rtwdev, mac->rx_fltr, RTW89_MAC_0),
275276 B_AX_RX_FLTR_CFG_MASK,
276277 rtwdev->hal.rx_fltr);
277278 if (!rtwdev->dbcc_en)
278279 goto out;
279280 rtw89_write32_mask(rtwdev,
280− rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_1),
281+ rtw89_mac_reg_by_idx(rtwdev, mac->rx_fltr, RTW89_MAC_1),
281282 B_AX_RX_FLTR_CFG_MASK,
282283 rtwdev->hal.rx_fltr);
283284
@@ -296,7 +297,8 @@ static u8 rtw89_aifsn_to_aifs(struct rtw89_dev *rtwdev, · 12 unmodified lines
296297 struct rtw89_vif *rtwvif, u8 aifsn)
297298 {
298299 struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
299− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
300+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
301+ rtwvif->sub_entity_idx);
300302 u8 slot_time;
301303 u8 sifs;
302304
@@ -353,7 +355,7 @@ static void ____rtw89_conf_tx_mu_edca(struct rtw89_dev *rtwdev, · 50 unmodified lines
353355 val = FIELD_PREP(B_AX_MUEDCA_BE_PARAM_0_TIMER_MASK, timer_32us) |
354356 FIELD_PREP(B_AX_MUEDCA_BE_PARAM_0_CW_MASK, mu_edca->ecw_min_max) |
355357 FIELD_PREP(B_AX_MUEDCA_BE_PARAM_0_AIFS_MASK, aifs);
356− reg = rtw89_mac_reg_by_idx(ac_to_mu_edca_param[ac], rtwvif->mac_idx);
358+ reg = rtw89_mac_reg_by_idx(rtwdev, ac_to_mu_edca_param[ac], rtwvif->mac_idx);
357359 rtw89_write32(rtwdev, reg, val);
358360
359361 rtw89_mac_set_hw_muedca_ctrl(rtwdev, rtwvif, true);
@@ -413,6 +415,8 @@ static void rtw89_ops_bss_info_changed(struct ieee80211_hw *hw, · 53 unmodified lines
413415 rtw89_chip_cfg_txpwr_ul_tb_offset(rtwdev, vif);
414416 rtw89_mac_port_update(rtwdev, rtwvif);
415417 rtw89_mac_set_he_obss_narrow_bw_ru(rtwdev, vif);
418+
419+ rtw89_queue_chanctx_work(rtwdev);
416420 } else {
417421 /* Abort ongoing scan if cancel_scan isn't issued
418422 * when disconnected by peer
@@ -476,6 +480,8 @@ static int rtw89_ops_start_ap(struct ieee80211_hw *hw, · 57 unmodified lines
476480 rtw89_fw_h2c_join_info(rtwdev, rtwvif, NULL, true);
477481 rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL, NULL);
478482 rtw89_chip_rfk_channel(rtwdev);
483+
484+ rtw89_queue_chanctx_work(rtwdev);
479485 mutex_unlock(&rtwdev->mutex);
480486
481487 return 0;
drivers/net/wireless/realtek/rtw89/mac_be.c+38−0
@@ -0,0 +1,38 @@
1+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2+/* Copyright(c) 2019-2020 Realtek Corporation
3+ */
4+
5+#include "mac.h"
6+#include "reg.h"
7+
8+static const u32 rtw89_mac_mem_base_addrs_be[RTW89_MAC_MEM_NUM] = {
9+ [RTW89_MAC_MEM_AXIDMA] = AXIDMA_BASE_ADDR_BE,
10+ [RTW89_MAC_MEM_SHARED_BUF] = SHARED_BUF_BASE_ADDR_BE,
11+ [RTW89_MAC_MEM_DMAC_TBL] = DMAC_TBL_BASE_ADDR_BE,
12+ [RTW89_MAC_MEM_SHCUT_MACHDR] = SHCUT_MACHDR_BASE_ADDR_BE,
13+ [RTW89_MAC_MEM_STA_SCHED] = STA_SCHED_BASE_ADDR_BE,
14+ [RTW89_MAC_MEM_RXPLD_FLTR_CAM] = RXPLD_FLTR_CAM_BASE_ADDR_BE,
15+ [RTW89_MAC_MEM_SECURITY_CAM] = SEC_CAM_BASE_ADDR_BE,
16+ [RTW89_MAC_MEM_WOW_CAM] = WOW_CAM_BASE_ADDR_BE,
17+ [RTW89_MAC_MEM_CMAC_TBL] = CMAC_TBL_BASE_ADDR_BE,
18+ [RTW89_MAC_MEM_ADDR_CAM] = ADDR_CAM_BASE_ADDR_BE,
19+ [RTW89_MAC_MEM_BA_CAM] = BA_CAM_BASE_ADDR_BE,
20+ [RTW89_MAC_MEM_BCN_IE_CAM0] = BCN_IE_CAM0_BASE_ADDR_BE,
21+ [RTW89_MAC_MEM_BCN_IE_CAM1] = BCN_IE_CAM1_BASE_ADDR_BE,
22+ [RTW89_MAC_MEM_TXD_FIFO_0] = TXD_FIFO_0_BASE_ADDR_BE,
23+ [RTW89_MAC_MEM_TXD_FIFO_1] = TXD_FIFO_1_BASE_ADDR_BE,
24+ [RTW89_MAC_MEM_TXDATA_FIFO_0] = TXDATA_FIFO_0_BASE_ADDR_BE,
25+ [RTW89_MAC_MEM_TXDATA_FIFO_1] = TXDATA_FIFO_1_BASE_ADDR_BE,
26+ [RTW89_MAC_MEM_CPU_LOCAL] = CPU_LOCAL_BASE_ADDR_BE,
27+ [RTW89_MAC_MEM_BSSID_CAM] = BSSID_CAM_BASE_ADDR_BE,
28+ [RTW89_MAC_MEM_WD_PAGE] = WD_PAGE_BASE_ADDR_BE,
29+};
30+
31+const struct rtw89_mac_gen_def rtw89_mac_gen_be = {
32+ .band1_offset = RTW89_MAC_BE_BAND_REG_OFFSET,
33+ .filter_model_addr = R_BE_FILTER_MODEL_ADDR,
34+ .indir_access_addr = R_BE_INDIR_ACCESS_ENTRY,
35+ .mem_base_addrs = rtw89_mac_mem_base_addrs_be,
36+ .rx_fltr = R_BE_RX_FLTR_OPT,
37+};
38+EXPORT_SYMBOL(rtw89_mac_gen_be);
drivers/net/wireless/realtek/rtw89/pci.c+1−1
@@ -3939,5 +3939,5 @@ void rtw89_pci_remove(struct pci_dev *pdev) · 3938 unmodified lines
39393939 EXPORT_SYMBOL(rtw89_pci_remove);
39403940
39413941 MODULE_AUTHOR("Realtek Corporation");
3942−MODULE_DESCRIPTION("Realtek 802.11ax wireless PCI driver");
3942+MODULE_DESCRIPTION("Realtek PCI 802.11ax wireless driver");
39433943 MODULE_LICENSE("Dual BSD/GPL");
drivers/net/wireless/realtek/rtw89/phy.c+188−78
@@ -133,10 +133,10 @@ static u64 rtw89_phy_ra_mask_recover(u64 ra_mask, u64 ra_mask_bak) · 132 unmodified lines
133133 return ra_mask;
134134 }
135135
136−static u64 rtw89_phy_ra_mask_cfg(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta)
136+static u64 rtw89_phy_ra_mask_cfg(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta,
137+ const struct rtw89_chan *chan)
137138 {
138139 struct ieee80211_sta *sta = rtwsta_to_sta(rtwsta);
139− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
140140 struct cfg80211_bitrate_mask *mask = &rtwsta->mask;
141141 enum nl80211_band band;
142142 u64 cfg_mask;
@@ -197,9 +197,9 @@ rtw89_ra_mask_he_rates[4] = {RA_MASK_HE_1SS_RATES, RA_MASK_HE_2SS_RATES, · 54 unmodified lines
197197
198198 static void rtw89_phy_ra_gi_ltf(struct rtw89_dev *rtwdev,
199199 struct rtw89_sta *rtwsta,
200+ const struct rtw89_chan *chan,
200201 bool *fix_giltf_en, u8 *fix_giltf)
201202 {
202− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
203203 struct cfg80211_bitrate_mask *mask = &rtwsta->mask;
204204 u8 band = chan->band_type;
205205 enum nl80211_band nl_band = rtw89_hw_to_nl80211_band(band);
@@ -236,7 +236,8 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev, · 30 unmodified lines
236236 struct rtw89_vif *rtwvif = rtwsta->rtwvif;
237237 struct rtw89_phy_rate_pattern *rate_pattern = &rtwvif->rate_pattern;
238238 struct rtw89_ra_info *ra = &rtwsta->ra;
239− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
239+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
240+ rtwvif->sub_entity_idx);
240241 struct ieee80211_vif *vif = rtwvif_to_vif(rtwsta->rtwvif);
241242 const u64 *high_rate_masks = rtw89_ra_mask_ht_rates;
242243 u8 rssi = ewma_rssi_read(&rtwsta->avg_rssi);
@@ -265,7 +266,7 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev, · 22 unmodified lines
265266 if (sta->deflink.he_cap.he_cap_elem.phy_cap_info[1] &
266267 IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD)
267268 ldpc_en = 1;
268− rtw89_phy_ra_gi_ltf(rtwdev, rtwsta, &fix_giltf_en, &fix_giltf);
269+ rtw89_phy_ra_gi_ltf(rtwdev, rtwsta, chan, &fix_giltf_en, &fix_giltf);
269270 } else if (sta->deflink.vht_cap.vht_supported) {
270271 u16 mcs_map = le16_to_cpu(sta->deflink.vht_cap.vht_mcs.rx_mcs_map);
271272
@@ -332,7 +333,7 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev, · 60 unmodified lines
332333 ra_mask &= rtw89_phy_ra_mask_rssi(rtwdev, rssi, 0);
333334
334335 ra_mask = rtw89_phy_ra_mask_recover(ra_mask, ra_mask_bak);
335− ra_mask &= rtw89_phy_ra_mask_cfg(rtwdev, rtwsta);
336+ ra_mask &= rtw89_phy_ra_mask_cfg(rtwdev, rtwsta, chan);
336337
337338 switch (sta->deflink.bandwidth) {
338339 case IEEE80211_STA_RX_BW_160:
@@ -362,7 +363,7 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev, · 23 unmodified lines
362363 ra->dcm_cap = 1;
363364
364365 if (rate_pattern->enable && !vif->p2p) {
365− ra_mask = rtw89_phy_ra_mask_cfg(rtwdev, rtwsta);
366+ ra_mask = rtw89_phy_ra_mask_cfg(rtwdev, rtwsta, chan);
366367 ra_mask &= rate_pattern->ra_mask;
367368 mode = rate_pattern->ra_mode;
368369 }
@@ -457,7 +458,8 @@ void rtw89_phy_rate_pattern_vif(struct rtw89_dev *rtwdev, · 88 unmodified lines
457458 struct ieee80211_supported_band *sband;
458459 struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
459460 struct rtw89_phy_rate_pattern next_pattern = {0};
460− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
461+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
462+ rtwvif->sub_entity_idx);
461463 static const u16 hw_rate_he[][RTW89_CHIP_GEN_NUM] = {
462464 RTW89_HW_RATE_BY_CHIP_GEN(HE_NSS1_MCS0),
463465 RTW89_HW_RATE_BY_CHIP_GEN(HE_NSS2_MCS0),
@@ -1446,6 +1448,9 @@ static u32 rtw89_phy0_phy1_offset(struct rtw89_dev *rtwdev, u32 addr) · 982 unmodified lines
14461448 u32 phy_page = addr >> 8;
14471449 u32 ofst = 0;
14481450
1451+ if (rtwdev->chip->chip_gen == RTW89_CHIP_BE)
1452+ return addr < 0x10000 ? 0x20000 : 0;
1453+
14491454 switch (phy_page) {
14501455 case 0x6:
14511456 case 0x7:
@@ -1647,6 +1652,8 @@ s8 rtw89_phy_read_txpwr_limit(struct rtw89_dev *rtwdev, u8 band, · 195 unmodified lines
16471652 const struct rtw89_txpwr_rule_5ghz *rule_5ghz = &rfe_parms->rule_5ghz;
16481653 const struct rtw89_txpwr_rule_6ghz *rule_6ghz = &rfe_parms->rule_6ghz;
16491654 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
1655+ enum nl80211_band nl_band = rtw89_hw_to_nl80211_band(band);
1656+ u32 freq = ieee80211_channel_to_frequency(ch, nl_band);
16501657 u8 ch_idx = rtw89_channel_to_idx(rtwdev, band, ch);
16511658 u8 regd = rtw89_regd_get(rtwdev, band);
16521659 u8 reg6 = regulatory->reg_6ghz_power;
@@ -1682,7 +1689,7 @@ s8 rtw89_phy_read_txpwr_limit(struct rtw89_dev *rtwdev, u8 band, · 29 unmodified lines
16821689 }
16831690
16841691 lmt = _phy_txpwr_rf_to_mac(rtwdev, lmt);
1685− sar = rtw89_query_sar(rtwdev);
1692+ sar = rtw89_query_sar(rtwdev, freq);
16861693
16871694 return min(lmt, sar);
16881695 }
@@ -1902,6 +1909,8 @@ static s8 rtw89_phy_read_txpwr_limit_ru(struct rtw89_dev *rtwdev, u8 band, · 213 unmodified lines
19021909 const struct rtw89_txpwr_rule_5ghz *rule_5ghz = &rfe_parms->rule_5ghz;
19031910 const struct rtw89_txpwr_rule_6ghz *rule_6ghz = &rfe_parms->rule_6ghz;
19041911 struct rtw89_regulatory_info *regulatory = &rtwdev->regulatory;
1912+ enum nl80211_band nl_band = rtw89_hw_to_nl80211_band(band);
1913+ u32 freq = ieee80211_channel_to_frequency(ch, nl_band);
19051914 u8 ch_idx = rtw89_channel_to_idx(rtwdev, band, ch);
19061915 u8 regd = rtw89_regd_get(rtwdev, band);
19071916 u8 reg6 = regulatory->reg_6ghz_power;
@@ -1937,7 +1946,7 @@ static s8 rtw89_phy_read_txpwr_limit_ru(struct rtw89_dev *rtwdev, u8 band, · 29 unmodified lines
19371946 }
19381947
19391948 lmt_ru = _phy_txpwr_rf_to_mac(rtwdev, lmt_ru);
1940− sar = rtw89_query_sar(rtwdev);
1949+ sar = rtw89_query_sar(rtwdev, freq);
19411950
19421951 return min(lmt_ru, sar);
19431952 }
@@ -2885,7 +2894,8 @@ void rtw89_phy_cfo_parse(struct rtw89_dev *rtwdev, s16 cfo_val, · 941 unmodified lines
28852894 void rtw89_phy_ul_tb_assoc(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
28862895 {
28872896 const struct rtw89_chip_info *chip = rtwdev->chip;
2888− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
2897+ const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
2898+ rtwvif->sub_entity_idx);
28892899 struct rtw89_phy_ul_tb_info *ul_tb_info = &rtwdev->ul_tb_info;
28902900
28912901 if (!chip->support_ul_tb_ctrl)
@@ -3227,7 +3237,9 @@ static u32 rtw89_phy_ccx_idx_to_us(struct rtw89_dev *rtwdev, u16 idx) · 335 unmodified lines
32273237
32283238 static void rtw89_phy_ccx_top_setting_init(struct rtw89_dev *rtwdev)
32293239 {
3240+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
32303241 struct rtw89_env_monitor_info *env = &rtwdev->env_monitor;
3242+ const struct rtw89_ccx_regs *ccx = phy->ccx;
32313243
32323244 env->ccx_manual_ctrl = false;
32333245 env->ccx_ongoing = false;
@@ -3235,10 +3247,10 @@ static void rtw89_phy_ccx_top_setting_init(struct rtw89_dev *rtwdev) · 1 unmodified line
32353247 env->ccx_period = 0;
32363248 env->ccx_unit_idx = RTW89_CCX_32_US;
32373249
3238− rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_CCX_EN_MSK, 1);
3239− rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_CCX_TRIG_OPT_MSK, 1);
3240− rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_MEASUREMENT_TRIG_MSK, 1);
3241− rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_CCX_EDCCA_OPT_MSK,
3250+ rtw89_phy_set_phy_regs(rtwdev, ccx->setting_addr, ccx->en_mask, 1);
3251+ rtw89_phy_set_phy_regs(rtwdev, ccx->setting_addr, ccx->trig_opt_mask, 1);
3252+ rtw89_phy_set_phy_regs(rtwdev, ccx->setting_addr, ccx->measurement_trig_mask, 1);
3253+ rtw89_phy_set_phy_regs(rtwdev, ccx->setting_addr, ccx->edcca_opt_mask,
32423254 RTW89_CCX_EDCCA_BW20_0);
32433255 }
32443256
@@ -3353,25 +3365,27 @@ ifs_update_finished: · 108 unmodified lines
33533365
33543366 static void rtw89_phy_ifs_clm_set_th_reg(struct rtw89_dev *rtwdev)
33553367 {
3368+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
33563369 struct rtw89_env_monitor_info *env = &rtwdev->env_monitor;
3370+ const struct rtw89_ccx_regs *ccx = phy->ccx;
33573371 u8 i = 0;
33583372
3359− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T1, B_IFS_T1_TH_LOW_MSK,
3373+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t1_addr, ccx->ifs_t1_th_l_mask,
33603374 env->ifs_clm_th_l[0]);
3361− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T2, B_IFS_T2_TH_LOW_MSK,
3375+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t2_addr, ccx->ifs_t2_th_l_mask,
33623376 env->ifs_clm_th_l[1]);
3363− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T3, B_IFS_T3_TH_LOW_MSK,
3377+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t3_addr, ccx->ifs_t3_th_l_mask,
33643378 env->ifs_clm_th_l[2]);
3365− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T4, B_IFS_T4_TH_LOW_MSK,
3379+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t4_addr, ccx->ifs_t4_th_l_mask,
33663380 env->ifs_clm_th_l[3]);
33673381
3368− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T1, B_IFS_T1_TH_HIGH_MSK,
3382+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t1_addr, ccx->ifs_t1_th_h_mask,
33693383 env->ifs_clm_th_h[0]);
3370− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T2, B_IFS_T2_TH_HIGH_MSK,
3384+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t2_addr, ccx->ifs_t2_th_h_mask,
33713385 env->ifs_clm_th_h[1]);
3372− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T3, B_IFS_T3_TH_HIGH_MSK,
3386+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t3_addr, ccx->ifs_t3_th_h_mask,
33733387 env->ifs_clm_th_h[2]);
3374− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T4, B_IFS_T4_TH_HIGH_MSK,
3388+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t4_addr, ccx->ifs_t4_th_h_mask,
33753389 env->ifs_clm_th_h[3]);
33763390
33773391 for (i = 0; i < RTW89_IFS_CLM_NUM; i++)
@@ -3382,7 +3396,9 @@ static void rtw89_phy_ifs_clm_set_th_reg(struct rtw89_dev *rtwdev) · 4 unmodified lines
33823396
33833397 static void rtw89_phy_ifs_clm_setting_init(struct rtw89_dev *rtwdev)
33843398 {
3399+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
33853400 struct rtw89_env_monitor_info *env = &rtwdev->env_monitor;
3401+ const struct rtw89_ccx_regs *ccx = phy->ccx;
33863402 struct rtw89_ccx_para_info para = {0};
33873403
33883404 env->ifs_clm_app = RTW89_IFS_CLM_BACKGROUND;
@@ -3392,12 +3408,11 @@ static void rtw89_phy_ifs_clm_setting_init(struct rtw89_dev *rtwdev) · 3 unmodified lines
33923408 if (rtw89_phy_ifs_clm_th_update_check(rtwdev, &para))
33933409 rtw89_phy_ifs_clm_set_th_reg(rtwdev);
33943410
3395− rtw89_phy_set_phy_regs(rtwdev, R_IFS_COUNTER, B_IFS_COLLECT_EN,
3396− true);
3397− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T1, B_IFS_T1_EN_MSK, true);
3398− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T2, B_IFS_T2_EN_MSK, true);
3399− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T3, B_IFS_T3_EN_MSK, true);
3400− rtw89_phy_set_phy_regs(rtwdev, R_IFS_T4, B_IFS_T4_EN_MSK, true);
3411+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_cnt_addr, ccx->ifs_collect_en_mask, true);
3412+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t1_addr, ccx->ifs_t1_en_mask, true);
3413+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t2_addr, ccx->ifs_t2_en_mask, true);
3414+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t3_addr, ccx->ifs_t3_en_mask, true);
3415+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_t4_addr, ccx->ifs_t4_en_mask, true);
34013416 }
34023417
34033418 static int rtw89_phy_ccx_racing_ctrl(struct rtw89_dev *rtwdev,
@@ -3434,12 +3449,14 @@ static int rtw89_phy_ccx_racing_ctrl(struct rtw89_dev *rtwdev, · 30 unmodified lines
34343449
34353450 static void rtw89_phy_ccx_trigger(struct rtw89_dev *rtwdev)
34363451 {
3452+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
34373453 struct rtw89_env_monitor_info *env = &rtwdev->env_monitor;
3454+ const struct rtw89_ccx_regs *ccx = phy->ccx;
34383455
3439− rtw89_phy_set_phy_regs(rtwdev, R_IFS_COUNTER, B_IFS_COUNTER_CLR_MSK, 0);
3440− rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_MEASUREMENT_TRIG_MSK, 0);
3441− rtw89_phy_set_phy_regs(rtwdev, R_IFS_COUNTER, B_IFS_COUNTER_CLR_MSK, 1);
3442− rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_MEASUREMENT_TRIG_MSK, 1);
3456+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_cnt_addr, ccx->ifs_clm_cnt_clear_mask, 0);
3457+ rtw89_phy_set_phy_regs(rtwdev, ccx->setting_addr, ccx->measurement_trig_mask, 0);
3458+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_cnt_addr, ccx->ifs_clm_cnt_clear_mask, 1);
3459+ rtw89_phy_set_phy_regs(rtwdev, ccx->setting_addr, ccx->measurement_trig_mask, 1);
34433460
34443461 env->ccx_ongoing = true;
34453462 }
@@ -3511,63 +3528,79 @@ static void rtw89_phy_ifs_clm_get_utility(struct rtw89_dev *rtwdev) · 65 unmodified lines
35113528
35123529 static bool rtw89_phy_ifs_clm_get_result(struct rtw89_dev *rtwdev)
35133530 {
3531+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
35143532 struct rtw89_env_monitor_info *env = &rtwdev->env_monitor;
3533+ const struct rtw89_ccx_regs *ccx = phy->ccx;
35153534 u8 i = 0;
35163535
3517− if (rtw89_phy_read32_mask(rtwdev, R_IFSCNT, B_IFSCNT_DONE_MSK) == 0) {
3536+ if (rtw89_phy_read32_mask(rtwdev, ccx->ifs_total_addr,
3537+ ccx->ifs_cnt_done_mask) == 0) {
35183538 rtw89_debug(rtwdev, RTW89_DBG_PHY_TRACK,
35193539 "Get IFS_CLM report Fail\n");
35203540 return false;
35213541 }
35223542
35233543 env->ifs_clm_tx =
3524− rtw89_phy_read32_mask(rtwdev, R_IFS_CLM_TX_CNT,
3525− B_IFS_CLM_TX_CNT_MSK);
3544+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_clm_tx_cnt_addr,
3545+ ccx->ifs_clm_tx_cnt_msk);
35263546 env->ifs_clm_edcca_excl_cca =
3527− rtw89_phy_read32_mask(rtwdev, R_IFS_CLM_TX_CNT,
3528− B_IFS_CLM_EDCCA_EXCLUDE_CCA_FA_MSK);
3547+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_clm_tx_cnt_addr,
3548+ ccx->ifs_clm_edcca_excl_cca_fa_mask);
35293549 env->ifs_clm_cckcca_excl_fa =
3530− rtw89_phy_read32_mask(rtwdev, R_IFS_CLM_CCA,
3531− B_IFS_CLM_CCKCCA_EXCLUDE_FA_MSK);
3550+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_clm_cca_addr,
3551+ ccx->ifs_clm_cckcca_excl_fa_mask);
35323552 env->ifs_clm_ofdmcca_excl_fa =
3533− rtw89_phy_read32_mask(rtwdev, R_IFS_CLM_CCA,
3534− B_IFS_CLM_OFDMCCA_EXCLUDE_FA_MSK);
3553+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_clm_cca_addr,
3554+ ccx->ifs_clm_ofdmcca_excl_fa_mask);
35353555 env->ifs_clm_cckfa =
3536− rtw89_phy_read32_mask(rtwdev, R_IFS_CLM_FA,
3537− B_IFS_CLM_CCK_FA_MSK);
3556+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_clm_fa_addr,
3557+ ccx->ifs_clm_cck_fa_mask);
35383558 env->ifs_clm_ofdmfa =
3539− rtw89_phy_read32_mask(rtwdev, R_IFS_CLM_FA,
3540− B_IFS_CLM_OFDM_FA_MSK);
3559+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_clm_fa_addr,
3560+ ccx->ifs_clm_ofdm_fa_mask);
35413561
35423562 env->ifs_clm_his[0] =
3543− rtw89_phy_read32_mask(rtwdev, R_IFS_HIS, B_IFS_T1_HIS_MSK);
3563+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_his_addr,
3564+ ccx->ifs_t1_his_mask);
35443565 env->ifs_clm_his[1] =
3545− rtw89_phy_read32_mask(rtwdev, R_IFS_HIS, B_IFS_T2_HIS_MSK);
3566+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_his_addr,
3567+ ccx->ifs_t2_his_mask);
35463568 env->ifs_clm_his[2] =
3547− rtw89_phy_read32_mask(rtwdev, R_IFS_HIS, B_IFS_T3_HIS_MSK);
3569+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_his_addr,
3570+ ccx->ifs_t3_his_mask);
35483571 env->ifs_clm_his[3] =
3549− rtw89_phy_read32_mask(rtwdev, R_IFS_HIS, B_IFS_T4_HIS_MSK);
3572+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_his_addr,
3573+ ccx->ifs_t4_his_mask);
35503574
35513575 env->ifs_clm_avg[0] =
3552− rtw89_phy_read32_mask(rtwdev, R_IFS_AVG_L, B_IFS_T1_AVG_MSK);
3576+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_avg_l_addr,
3577+ ccx->ifs_t1_avg_mask);
35533578 env->ifs_clm_avg[1] =
3554− rtw89_phy_read32_mask(rtwdev, R_IFS_AVG_L, B_IFS_T2_AVG_MSK);
3579+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_avg_l_addr,
3580+ ccx->ifs_t2_avg_mask);
35553581 env->ifs_clm_avg[2] =
3556− rtw89_phy_read32_mask(rtwdev, R_IFS_AVG_H, B_IFS_T3_AVG_MSK);
3582+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_avg_h_addr,
3583+ ccx->ifs_t3_avg_mask);
35573584 env->ifs_clm_avg[3] =
3558− rtw89_phy_read32_mask(rtwdev, R_IFS_AVG_H, B_IFS_T4_AVG_MSK);
3585+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_avg_h_addr,
3586+ ccx->ifs_t4_avg_mask);
35593587
35603588 env->ifs_clm_cca[0] =
3561− rtw89_phy_read32_mask(rtwdev, R_IFS_CCA_L, B_IFS_T1_CCA_MSK);
3589+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_cca_l_addr,
3590+ ccx->ifs_t1_cca_mask);
35623591 env->ifs_clm_cca[1] =
3563− rtw89_phy_read32_mask(rtwdev, R_IFS_CCA_L, B_IFS_T2_CCA_MSK);
3592+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_cca_l_addr,
3593+ ccx->ifs_t2_cca_mask);
35643594 env->ifs_clm_cca[2] =
3565− rtw89_phy_read32_mask(rtwdev, R_IFS_CCA_H, B_IFS_T3_CCA_MSK);
3595+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_cca_h_addr,
3596+ ccx->ifs_t3_cca_mask);
35663597 env->ifs_clm_cca[3] =
3567− rtw89_phy_read32_mask(rtwdev, R_IFS_CCA_H, B_IFS_T4_CCA_MSK);
3598+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_cca_h_addr,
3599+ ccx->ifs_t4_cca_mask);
35683600
35693601 env->ifs_clm_total_ifs =
3570− rtw89_phy_read32_mask(rtwdev, R_IFSCNT, B_IFSCNT_TOTAL_CNT_MSK);
3602+ rtw89_phy_read32_mask(rtwdev, ccx->ifs_total_addr,
3603+ ccx->ifs_total_mask);
35713604
35723605 rtw89_debug(rtwdev, RTW89_DBG_PHY_TRACK, "IFS-CLM total_ifs = %d\n",
35733606 env->ifs_clm_total_ifs);
@@ -3595,7 +3628,9 @@ static bool rtw89_phy_ifs_clm_get_result(struct rtw89_dev *rtwdev) · 21 unmodified lines
35953628 static int rtw89_phy_ifs_clm_set(struct rtw89_dev *rtwdev,
35963629 struct rtw89_ccx_para_info *para)
35973630 {
3631+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
35983632 struct rtw89_env_monitor_info *env = &rtwdev->env_monitor;
3633+ const struct rtw89_ccx_regs *ccx = phy->ccx;
35993634 u32 period = 0;
36003635 u32 unit_idx = 0;
36013636
@@ -3611,10 +3646,11 @@ static int rtw89_phy_ifs_clm_set(struct rtw89_dev *rtwdev, · 9 unmodified lines
36113646 if (para->mntr_time != env->ifs_clm_mntr_time) {
36123647 rtw89_phy_ccx_ms_to_period_unit(rtwdev, para->mntr_time,
36133648 &period, &unit_idx);
3614− rtw89_phy_set_phy_regs(rtwdev, R_IFS_COUNTER,
3615− B_IFS_CLM_PERIOD_MSK, period);
3616− rtw89_phy_set_phy_regs(rtwdev, R_IFS_COUNTER,
3617− B_IFS_CLM_COUNTER_UNIT_MSK, unit_idx);
3649+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_cnt_addr,
3650+ ccx->ifs_clm_period_mask, period);
3651+ rtw89_phy_set_phy_regs(rtwdev, ccx->ifs_cnt_addr,
3652+ ccx->ifs_clm_cnt_unit_mask,
3653+ unit_idx);
36183654
36193655 rtw89_debug(rtwdev, RTW89_DBG_PHY_TRACK,
36203656 "Update IFS-CLM time ((%d)) -> ((%d))\n",
@@ -3732,16 +3768,19 @@ static void rtw89_physts_enable_fail_report(struct rtw89_dev *rtwdev, · 111 unmodified lines
37323768 bool enable,
37333769 enum rtw89_phy_idx phy_idx)
37343770 {
3771+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
3772+ const struct rtw89_physts_regs *physts = phy->physts;
3773+
37353774 if (enable) {
3736− rtw89_phy_write32_clr(rtwdev, R_PLCP_HISTOGRAM,
3737− B_STS_DIS_TRIG_BY_FAIL);
3738− rtw89_phy_write32_clr(rtwdev, R_PLCP_HISTOGRAM,
3739− B_STS_DIS_TRIG_BY_BRK);
3775+ rtw89_phy_write32_clr(rtwdev, physts->setting_addr,
3776+ physts->dis_trigger_fail_mask);
3777+ rtw89_phy_write32_clr(rtwdev, physts->setting_addr,
3778+ physts->dis_trigger_brk_mask);
37403779 } else {
3741− rtw89_phy_write32_set(rtwdev, R_PLCP_HISTOGRAM,
3742− B_STS_DIS_TRIG_BY_FAIL);
3743− rtw89_phy_write32_set(rtwdev, R_PLCP_HISTOGRAM,
3744− B_STS_DIS_TRIG_BY_BRK);
3780+ rtw89_phy_write32_set(rtwdev, physts->setting_addr,
3781+ physts->dis_trigger_fail_mask);
3782+ rtw89_phy_write32_set(rtwdev, physts->setting_addr,
3783+ physts->dis_trigger_brk_mask);
37453784 }
37463785 }
37473786
@@ -4169,10 +4208,10 @@ static void rtw89_phy_dig_dyn_pd_th(struct rtw89_dev *rtwdev, u8 rssi, · 421 unmodified lines
41694208 "igi=%d, cck_ccaTH=%d, backoff=%d, cck_PD_low=((%d))dB\n",
41704209 final_rssi, cck_cca_th, under_region, pd_val);
41714210
4172− rtw89_phy_write32_mask(rtwdev, R_BMODE_PDTH_EN_V1,
4173− B_BMODE_PDTH_LIMIT_EN_MSK_V1, enable);
4174− rtw89_phy_write32_mask(rtwdev, R_BMODE_PDTH_V1,
4175− B_BMODE_PDTH_LOWER_BOUND_MSK_V1, pd_val);
4211+ rtw89_phy_write32_mask(rtwdev, dig_regs->bmode_pd_reg,
4212+ dig_regs->bmode_cca_rssi_limit_en, enable);
4213+ rtw89_phy_write32_mask(rtwdev, dig_regs->bmode_pd_lower_bound_reg,
4214+ dig_regs->bmode_rssi_nocca_low_th_mask, pd_val);
41764215 }
41774216
41784217 void rtw89_phy_dig_reset(struct rtw89_dev *rtwdev)
@@ -4561,7 +4600,7 @@ void rtw89_phy_tssi_ctrl_set_fast_mode_cfg(struct rtw89_dev *rtwdev, · 382 unmodified lines
45614600 regs = rtw89_tssi_fastmode_regs_level;
45624601
45634602 for (i = 0; i < RTW89_TSSI_FAST_MODE_NUM; i++) {
4564− reg = rtw89_mac_reg_by_idx(regs[i].addr, mac_idx);
4603+ reg = rtw89_mac_reg_by_idx(rtwdev, regs[i].addr, mac_idx);
45654604 rtw89_write32_mask(rtwdev, reg, regs[i].mask, val);
45664605 }
45674606 }
@@ -4623,11 +4662,11 @@ void rtw89_phy_tssi_ctrl_set_bandedge_cfg(struct rtw89_dev *rtwdev, · 55 unmodified lines
46234662 data = chip->tssi_dbw_table->data[bandedge_cfg];
46244663
46254664 for (i = 0; i < RTW89_TSSI_SBW_NUM; i++) {
4626− reg = rtw89_mac_reg_by_idx(regs[i].addr, mac_idx);
4665+ reg = rtw89_mac_reg_by_idx(rtwdev, regs[i].addr, mac_idx);
46274666 rtw89_write32_mask(rtwdev, reg, regs[i].mask, data[i]);
46284667 }
46294668
4630− reg = rtw89_mac_reg_by_idx(R_AX_BANDEDGE_CFG, mac_idx);
4669+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_BANDEDGE_CFG, mac_idx);
46314670 rtw89_write32_mask(rtwdev, reg, B_AX_BANDEDGE_CFG_IDX_MASK, bandedge_cfg);
46324671
46334672 rtw89_phy_tssi_ctrl_set_fast_mode_cfg(rtwdev, mac_idx, bandedge_cfg,
@@ -4725,3 +4764,74 @@ void rtw89_phy_config_edcca(struct rtw89_dev *rtwdev, bool scan) · 91 unmodified lines
47254764 rtw89_phy_write32(rtwdev, reg, hal->edcca_bak);
47264765 }
47274766 }
4767+
4768+static const struct rtw89_ccx_regs rtw89_ccx_regs_ax = {
4769+ .setting_addr = R_CCX,
4770+ .edcca_opt_mask = B_CCX_EDCCA_OPT_MSK,
4771+ .measurement_trig_mask = B_MEASUREMENT_TRIG_MSK,
4772+ .trig_opt_mask = B_CCX_TRIG_OPT_MSK,
4773+ .en_mask = B_CCX_EN_MSK,
4774+ .ifs_cnt_addr = R_IFS_COUNTER,
4775+ .ifs_clm_period_mask = B_IFS_CLM_PERIOD_MSK,
4776+ .ifs_clm_cnt_unit_mask = B_IFS_CLM_COUNTER_UNIT_MSK,
4777+ .ifs_clm_cnt_clear_mask = B_IFS_COUNTER_CLR_MSK,
4778+ .ifs_collect_en_mask = B_IFS_COLLECT_EN,
4779+ .ifs_t1_addr = R_IFS_T1,
4780+ .ifs_t1_th_h_mask = B_IFS_T1_TH_HIGH_MSK,
4781+ .ifs_t1_en_mask = B_IFS_T1_EN_MSK,
4782+ .ifs_t1_th_l_mask = B_IFS_T1_TH_LOW_MSK,
4783+ .ifs_t2_addr = R_IFS_T2,
4784+ .ifs_t2_th_h_mask = B_IFS_T2_TH_HIGH_MSK,
4785+ .ifs_t2_en_mask = B_IFS_T2_EN_MSK,
4786+ .ifs_t2_th_l_mask = B_IFS_T2_TH_LOW_MSK,
4787+ .ifs_t3_addr = R_IFS_T3,
4788+ .ifs_t3_th_h_mask = B_IFS_T3_TH_HIGH_MSK,
4789+ .ifs_t3_en_mask = B_IFS_T3_EN_MSK,
4790+ .ifs_t3_th_l_mask = B_IFS_T3_TH_LOW_MSK,
4791+ .ifs_t4_addr = R_IFS_T4,
4792+ .ifs_t4_th_h_mask = B_IFS_T4_TH_HIGH_MSK,
4793+ .ifs_t4_en_mask = B_IFS_T4_EN_MSK,
4794+ .ifs_t4_th_l_mask = B_IFS_T4_TH_LOW_MSK,
4795+ .ifs_clm_tx_cnt_addr = R_IFS_CLM_TX_CNT,
4796+ .ifs_clm_edcca_excl_cca_fa_mask = B_IFS_CLM_EDCCA_EXCLUDE_CCA_FA_MSK,
4797+ .ifs_clm_tx_cnt_msk = B_IFS_CLM_TX_CNT_MSK,
4798+ .ifs_clm_cca_addr = R_IFS_CLM_CCA,
4799+ .ifs_clm_ofdmcca_excl_fa_mask = B_IFS_CLM_OFDMCCA_EXCLUDE_FA_MSK,
4800+ .ifs_clm_cckcca_excl_fa_mask = B_IFS_CLM_CCKCCA_EXCLUDE_FA_MSK,
4801+ .ifs_clm_fa_addr = R_IFS_CLM_FA,
4802+ .ifs_clm_ofdm_fa_mask = B_IFS_CLM_OFDM_FA_MSK,
4803+ .ifs_clm_cck_fa_mask = B_IFS_CLM_CCK_FA_MSK,
4804+ .ifs_his_addr = R_IFS_HIS,
4805+ .ifs_t4_his_mask = B_IFS_T4_HIS_MSK,
4806+ .ifs_t3_his_mask = B_IFS_T3_HIS_MSK,
4807+ .ifs_t2_his_mask = B_IFS_T2_HIS_MSK,
4808+ .ifs_t1_his_mask = B_IFS_T1_HIS_MSK,
4809+ .ifs_avg_l_addr = R_IFS_AVG_L,
4810+ .ifs_t2_avg_mask = B_IFS_T2_AVG_MSK,
4811+ .ifs_t1_avg_mask = B_IFS_T1_AVG_MSK,
4812+ .ifs_avg_h_addr = R_IFS_AVG_H,
4813+ .ifs_t4_avg_mask = B_IFS_T4_AVG_MSK,
4814+ .ifs_t3_avg_mask = B_IFS_T3_AVG_MSK,
4815+ .ifs_cca_l_addr = R_IFS_CCA_L,
4816+ .ifs_t2_cca_mask = B_IFS_T2_CCA_MSK,
4817+ .ifs_t1_cca_mask = B_IFS_T1_CCA_MSK,
4818+ .ifs_cca_h_addr = R_IFS_CCA_H,
4819+ .ifs_t4_cca_mask = B_IFS_T4_CCA_MSK,
4820+ .ifs_t3_cca_mask = B_IFS_T3_CCA_MSK,
4821+ .ifs_total_addr = R_IFSCNT,
4822+ .ifs_cnt_done_mask = B_IFSCNT_DONE_MSK,
4823+ .ifs_total_mask = B_IFSCNT_TOTAL_CNT_MSK,
4824+};
4825+
4826+static const struct rtw89_physts_regs rtw89_physts_regs_ax = {
4827+ .setting_addr = R_PLCP_HISTOGRAM,
4828+ .dis_trigger_fail_mask = B_STS_DIS_TRIG_BY_FAIL,
4829+ .dis_trigger_brk_mask = B_STS_DIS_TRIG_BY_BRK,
4830+};
4831+
4832+const struct rtw89_phy_gen_def rtw89_phy_gen_ax = {
4833+ .cr_base = 0x10000,
4834+ .ccx = &rtw89_ccx_regs_ax,
4835+ .physts = &rtw89_physts_regs_ax,
4836+};
4837+EXPORT_SYMBOL(rtw89_phy_gen_ax);
drivers/net/wireless/realtek/rtw89/phy.h+103−11
@@ -7,7 +7,6 @@ · 6 unmodified lines
77
88 #include "core.h"
99
10−#define RTW89_PHY_ADDR_OFFSET 0x10000
1110 #define RTW89_RF_ADDR_ADSEL_MASK BIT(16)
1211
1312 #define get_phy_headline(addr) FIELD_GET(GENMASK(31, 28), addr)
@@ -337,61 +336,154 @@ struct rtw89_nbi_reg_def { · 323 unmodified lines
337336 struct rtw89_reg_def notch2_en;
338337 };
339338
339+struct rtw89_ccx_regs {
340+ u32 setting_addr;
341+ u32 edcca_opt_mask;
342+ u32 measurement_trig_mask;
343+ u32 trig_opt_mask;
344+ u32 en_mask;
345+ u32 ifs_cnt_addr;
346+ u32 ifs_clm_period_mask;
347+ u32 ifs_clm_cnt_unit_mask;
348+ u32 ifs_clm_cnt_clear_mask;
349+ u32 ifs_collect_en_mask;
350+ u32 ifs_t1_addr;
351+ u32 ifs_t1_th_h_mask;
352+ u32 ifs_t1_en_mask;
353+ u32 ifs_t1_th_l_mask;
354+ u32 ifs_t2_addr;
355+ u32 ifs_t2_th_h_mask;
356+ u32 ifs_t2_en_mask;
357+ u32 ifs_t2_th_l_mask;
358+ u32 ifs_t3_addr;
359+ u32 ifs_t3_th_h_mask;
360+ u32 ifs_t3_en_mask;
361+ u32 ifs_t3_th_l_mask;
362+ u32 ifs_t4_addr;
363+ u32 ifs_t4_th_h_mask;
364+ u32 ifs_t4_en_mask;
365+ u32 ifs_t4_th_l_mask;
366+ u32 ifs_clm_tx_cnt_addr;
367+ u32 ifs_clm_edcca_excl_cca_fa_mask;
368+ u32 ifs_clm_tx_cnt_msk;
369+ u32 ifs_clm_cca_addr;
370+ u32 ifs_clm_ofdmcca_excl_fa_mask;
371+ u32 ifs_clm_cckcca_excl_fa_mask;
372+ u32 ifs_clm_fa_addr;
373+ u32 ifs_clm_ofdm_fa_mask;
374+ u32 ifs_clm_cck_fa_mask;
375+ u32 ifs_his_addr;
376+ u32 ifs_t4_his_mask;
377+ u32 ifs_t3_his_mask;
378+ u32 ifs_t2_his_mask;
379+ u32 ifs_t1_his_mask;
380+ u32 ifs_avg_l_addr;
381+ u32 ifs_t2_avg_mask;
382+ u32 ifs_t1_avg_mask;
383+ u32 ifs_avg_h_addr;
384+ u32 ifs_t4_avg_mask;
385+ u32 ifs_t3_avg_mask;
386+ u32 ifs_cca_l_addr;
387+ u32 ifs_t2_cca_mask;
388+ u32 ifs_t1_cca_mask;
389+ u32 ifs_cca_h_addr;
390+ u32 ifs_t4_cca_mask;
391+ u32 ifs_t3_cca_mask;
392+ u32 ifs_total_addr;
393+ u32 ifs_cnt_done_mask;
394+ u32 ifs_total_mask;
395+};
396+
397+struct rtw89_physts_regs {
398+ u32 setting_addr;
399+ u32 dis_trigger_fail_mask;
400+ u32 dis_trigger_brk_mask;
401+};
402+
403+struct rtw89_phy_gen_def {
404+ u32 cr_base;
405+ const struct rtw89_ccx_regs *ccx;
406+ const struct rtw89_physts_regs *physts;
407+};
408+
409+extern const struct rtw89_phy_gen_def rtw89_phy_gen_ax;
410+extern const struct rtw89_phy_gen_def rtw89_phy_gen_be;
411+
340412 static inline void rtw89_phy_write8(struct rtw89_dev *rtwdev,
341413 u32 addr, u8 data)
342414 {
343− rtw89_write8(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, data);
415+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
416+
417+ rtw89_write8(rtwdev, addr + phy->cr_base, data);
344418 }
345419
346420 static inline void rtw89_phy_write16(struct rtw89_dev *rtwdev,
347421 u32 addr, u16 data)
348422 {
349− rtw89_write16(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, data);
423+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
424+
425+ rtw89_write16(rtwdev, addr + phy->cr_base, data);
350426 }
351427
352428 static inline void rtw89_phy_write32(struct rtw89_dev *rtwdev,
353429 u32 addr, u32 data)
354430 {
355− rtw89_write32(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, data);
431+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
432+
433+ rtw89_write32(rtwdev, addr + phy->cr_base, data);
356434 }
357435
358436 static inline void rtw89_phy_write32_set(struct rtw89_dev *rtwdev,
359437 u32 addr, u32 bits)
360438 {
361− rtw89_write32_set(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, bits);
439+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
440+
441+ rtw89_write32_set(rtwdev, addr + phy->cr_base, bits);
362442 }
363443
364444 static inline void rtw89_phy_write32_clr(struct rtw89_dev *rtwdev,
365445 u32 addr, u32 bits)
366446 {
367− rtw89_write32_clr(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, bits);
447+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
448+
449+ rtw89_write32_clr(rtwdev, addr + phy->cr_base, bits);
368450 }
369451
370452 static inline void rtw89_phy_write32_mask(struct rtw89_dev *rtwdev,
371453 u32 addr, u32 mask, u32 data)
372454 {
373− rtw89_write32_mask(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, mask, data);
455+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
456+
457+ rtw89_write32_mask(rtwdev, addr + phy->cr_base, mask, data);
374458 }
375459
376460 static inline u8 rtw89_phy_read8(struct rtw89_dev *rtwdev, u32 addr)
377461 {
378− return rtw89_read8(rtwdev, addr | RTW89_PHY_ADDR_OFFSET);
462+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
463+
464+ return rtw89_read8(rtwdev, addr + phy->cr_base);
379465 }
380466
381467 static inline u16 rtw89_phy_read16(struct rtw89_dev *rtwdev, u32 addr)
382468 {
383− return rtw89_read16(rtwdev, addr | RTW89_PHY_ADDR_OFFSET);
469+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
470+
471+ return rtw89_read16(rtwdev, addr + phy->cr_base);
384472 }
385473
386474 static inline u32 rtw89_phy_read32(struct rtw89_dev *rtwdev, u32 addr)
387475 {
388− return rtw89_read32(rtwdev, addr | RTW89_PHY_ADDR_OFFSET);
476+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
477+
478+ return rtw89_read32(rtwdev, addr + phy->cr_base);
389479 }
390480
391481 static inline u32 rtw89_phy_read32_mask(struct rtw89_dev *rtwdev,
392482 u32 addr, u32 mask)
393483 {
394− return rtw89_read32_mask(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, mask);
484+ const struct rtw89_phy_gen_def *phy = rtwdev->chip->phy_def;
485+
486+ return rtw89_read32_mask(rtwdev, addr + phy->cr_base, mask);
395487 }
396488
397489 static inline
drivers/net/wireless/realtek/rtw89/phy_be.c+77−0
@@ -0,0 +1,77 @@
1+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2+/* Copyright(c) 2023 Realtek Corporation
3+ */
4+
5+#include "phy.h"
6+#include "reg.h"
7+
8+static const struct rtw89_ccx_regs rtw89_ccx_regs_be = {
9+ .setting_addr = R_CCX,
10+ .edcca_opt_mask = B_CCX_EDCCA_OPT_MSK_V1,
11+ .measurement_trig_mask = B_MEASUREMENT_TRIG_MSK,
12+ .trig_opt_mask = B_CCX_TRIG_OPT_MSK,
13+ .en_mask = B_CCX_EN_MSK,
14+ .ifs_cnt_addr = R_IFS_COUNTER,
15+ .ifs_clm_period_mask = B_IFS_CLM_PERIOD_MSK,
16+ .ifs_clm_cnt_unit_mask = B_IFS_CLM_COUNTER_UNIT_MSK,
17+ .ifs_clm_cnt_clear_mask = B_IFS_COUNTER_CLR_MSK,
18+ .ifs_collect_en_mask = B_IFS_COLLECT_EN,
19+ .ifs_t1_addr = R_IFS_T1,
20+ .ifs_t1_th_h_mask = B_IFS_T1_TH_HIGH_MSK,
21+ .ifs_t1_en_mask = B_IFS_T1_EN_MSK,
22+ .ifs_t1_th_l_mask = B_IFS_T1_TH_LOW_MSK,
23+ .ifs_t2_addr = R_IFS_T2,
24+ .ifs_t2_th_h_mask = B_IFS_T2_TH_HIGH_MSK,
25+ .ifs_t2_en_mask = B_IFS_T2_EN_MSK,
26+ .ifs_t2_th_l_mask = B_IFS_T2_TH_LOW_MSK,
27+ .ifs_t3_addr = R_IFS_T3,
28+ .ifs_t3_th_h_mask = B_IFS_T3_TH_HIGH_MSK,
29+ .ifs_t3_en_mask = B_IFS_T3_EN_MSK,
30+ .ifs_t3_th_l_mask = B_IFS_T3_TH_LOW_MSK,
31+ .ifs_t4_addr = R_IFS_T4,
32+ .ifs_t4_th_h_mask = B_IFS_T4_TH_HIGH_MSK,
33+ .ifs_t4_en_mask = B_IFS_T4_EN_MSK,
34+ .ifs_t4_th_l_mask = B_IFS_T4_TH_LOW_MSK,
35+ .ifs_clm_tx_cnt_addr = R_IFS_CLM_TX_CNT_V1,
36+ .ifs_clm_edcca_excl_cca_fa_mask = B_IFS_CLM_EDCCA_EXCLUDE_CCA_FA_MSK,
37+ .ifs_clm_tx_cnt_msk = B_IFS_CLM_TX_CNT_MSK,
38+ .ifs_clm_cca_addr = R_IFS_CLM_CCA_V1,
39+ .ifs_clm_ofdmcca_excl_fa_mask = B_IFS_CLM_OFDMCCA_EXCLUDE_FA_MSK,
40+ .ifs_clm_cckcca_excl_fa_mask = B_IFS_CLM_CCKCCA_EXCLUDE_FA_MSK,
41+ .ifs_clm_fa_addr = R_IFS_CLM_FA_V1,
42+ .ifs_clm_ofdm_fa_mask = B_IFS_CLM_OFDM_FA_MSK,
43+ .ifs_clm_cck_fa_mask = B_IFS_CLM_CCK_FA_MSK,
44+ .ifs_his_addr = R_IFS_HIS_V1,
45+ .ifs_t4_his_mask = B_IFS_T4_HIS_MSK,
46+ .ifs_t3_his_mask = B_IFS_T3_HIS_MSK,
47+ .ifs_t2_his_mask = B_IFS_T2_HIS_MSK,
48+ .ifs_t1_his_mask = B_IFS_T1_HIS_MSK,
49+ .ifs_avg_l_addr = R_IFS_AVG_L_V1,
50+ .ifs_t2_avg_mask = B_IFS_T2_AVG_MSK,
51+ .ifs_t1_avg_mask = B_IFS_T1_AVG_MSK,
52+ .ifs_avg_h_addr = R_IFS_AVG_H_V1,
53+ .ifs_t4_avg_mask = B_IFS_T4_AVG_MSK,
54+ .ifs_t3_avg_mask = B_IFS_T3_AVG_MSK,
55+ .ifs_cca_l_addr = R_IFS_CCA_L_V1,
56+ .ifs_t2_cca_mask = B_IFS_T2_CCA_MSK,
57+ .ifs_t1_cca_mask = B_IFS_T1_CCA_MSK,
58+ .ifs_cca_h_addr = R_IFS_CCA_H_V1,
59+ .ifs_t4_cca_mask = B_IFS_T4_CCA_MSK,
60+ .ifs_t3_cca_mask = B_IFS_T3_CCA_MSK,
61+ .ifs_total_addr = R_IFSCNT_V1,
62+ .ifs_cnt_done_mask = B_IFSCNT_DONE_MSK,
63+ .ifs_total_mask = B_IFSCNT_TOTAL_CNT_MSK,
64+};
65+
66+static const struct rtw89_physts_regs rtw89_physts_regs_be = {
67+ .setting_addr = R_PLCP_HISTOGRAM,
68+ .dis_trigger_fail_mask = B_STS_DIS_TRIG_BY_FAIL,
69+ .dis_trigger_brk_mask = B_STS_DIS_TRIG_BY_BRK,
70+};
71+
72+const struct rtw89_phy_gen_def rtw89_phy_gen_be = {
73+ .cr_base = 0x20000,
74+ .ccx = &rtw89_ccx_regs_be,
75+ .physts = &rtw89_physts_regs_be,
76+};
77+EXPORT_SYMBOL(rtw89_phy_gen_be);
drivers/net/wireless/realtek/rtw89/ps.c+72−3
@@ -2,6 +2,7 @@ · 1 unmodified line
22 /* Copyright(c) 2019-2020 Realtek Corporation
33 */
44
5+#include "chan.h"
56 #include "coex.h"
67 #include "core.h"
78 #include "debug.h"
@@ -257,8 +258,13 @@ void rtw89_recalc_lps(struct rtw89_dev *rtwdev) · 249 unmodified lines
257258 {
258259 struct ieee80211_vif *vif, *found_vif = NULL;
259260 struct rtw89_vif *rtwvif;
261+ enum rtw89_entity_mode mode;
260262 int count = 0;
261263
264+ mode = rtw89_get_entity_mode(rtwdev);
265+ if (mode == RTW89_ENTITY_MODE_MCC)
266+ goto disable_lps;
267+
262268 rtw89_for_each_rtwvif(rtwdev, rtwvif) {
263269 vif = rtwvif_to_vif(rtwvif);
264270
@@ -273,8 +279,71 @@ void rtw89_recalc_lps(struct rtw89_dev *rtwdev) · 8 unmodified lines
273279
274280 if (count == 1 && found_vif->cfg.ps) {
275281 rtwdev->lps_enabled = true;
276− } else {
277− rtw89_leave_lps(rtwdev);
278− rtwdev->lps_enabled = false;
282+ return;
279283 }
284+
285+disable_lps:
286+ rtw89_leave_lps(rtwdev);
287+ rtwdev->lps_enabled = false;
288+}
289+
290+void rtw89_p2p_noa_renew(struct rtw89_vif *rtwvif)
291+{
292+ struct rtw89_p2p_noa_setter *setter = &rtwvif->p2p_noa;
293+ struct rtw89_p2p_noa_ie *ie = &setter->ie;
294+ struct rtw89_p2p_ie_head *p2p_head = &ie->p2p_head;
295+ struct rtw89_noa_attr_head *noa_head = &ie->noa_head;
296+
297+ if (setter->noa_count) {
298+ setter->noa_index++;
299+ setter->noa_count = 0;
300+ }
301+
302+ memset(ie, 0, sizeof(*ie));
303+
304+ p2p_head->eid = WLAN_EID_VENDOR_SPECIFIC;
305+ p2p_head->ie_len = 4 + sizeof(*noa_head);
306+ p2p_head->oui[0] = (WLAN_OUI_WFA >> 16) & 0xff;
307+ p2p_head->oui[1] = (WLAN_OUI_WFA >> 8) & 0xff;
308+ p2p_head->oui[2] = (WLAN_OUI_WFA >> 0) & 0xff;
309+ p2p_head->oui_type = WLAN_OUI_TYPE_WFA_P2P;
310+
311+ noa_head->attr_type = IEEE80211_P2P_ATTR_ABSENCE_NOTICE;
312+ noa_head->attr_len = cpu_to_le16(2);
313+ noa_head->index = setter->noa_index;
314+ noa_head->oppps_ctwindow = 0;
315+}
316+
317+void rtw89_p2p_noa_append(struct rtw89_vif *rtwvif,
318+ const struct ieee80211_p2p_noa_desc *desc)
319+{
320+ struct rtw89_p2p_noa_setter *setter = &rtwvif->p2p_noa;
321+ struct rtw89_p2p_noa_ie *ie = &setter->ie;
322+ struct rtw89_p2p_ie_head *p2p_head = &ie->p2p_head;
323+ struct rtw89_noa_attr_head *noa_head = &ie->noa_head;
324+
325+ if (!desc->count || !desc->duration)
326+ return;
327+
328+ if (setter->noa_count >= RTW89_P2P_MAX_NOA_NUM)
329+ return;
330+
331+ p2p_head->ie_len += sizeof(*desc);
332+ le16_add_cpu(&noa_head->attr_len, sizeof(*desc));
333+
334+ ie->noa_desc[setter->noa_count++] = *desc;
335+}
336+
337+u8 rtw89_p2p_noa_fetch(struct rtw89_vif *rtwvif, void **data)
338+{
339+ struct rtw89_p2p_noa_setter *setter = &rtwvif->p2p_noa;
340+ struct rtw89_p2p_noa_ie *ie = &setter->ie;
341+ void *tail;
342+
343+ if (!setter->noa_count)
344+ return 0;
345+
346+ *data = ie;
347+ tail = ie->noa_desc + setter->noa_count;
348+ return tail - *data;
280349 }
drivers/net/wireless/realtek/rtw89/ps.h+4−0
@@ -16,6 +16,10 @@ void rtw89_leave_ips(struct rtw89_dev *rtwdev); · 15 unmodified lines
1616 void rtw89_set_coex_ctrl_lps(struct rtw89_dev *rtwdev, bool btc_ctrl);
1717 void rtw89_process_p2p_ps(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif);
1818 void rtw89_recalc_lps(struct rtw89_dev *rtwdev);
19+void rtw89_p2p_noa_renew(struct rtw89_vif *rtwvif);
20+void rtw89_p2p_noa_append(struct rtw89_vif *rtwvif,
21+ const struct ieee80211_p2p_noa_desc *desc);
22+u8 rtw89_p2p_noa_fetch(struct rtw89_vif *rtwvif, void **data);
1923
2024 static inline void rtw89_leave_ips_by_hwflags(struct rtw89_dev *rtwdev)
2125 {
drivers/net/wireless/realtek/rtw89/reg.h+38−0
@@ -3625,6 +3625,27 @@ · 3624 unmodified lines
36253625 #define B_AX_GNT_BT_TX_SW_VAL BIT(1)
36263626 #define B_AX_GNT_BT_TX_SW_CTRL BIT(0)
36273627
3628+#define R_BE_FILTER_MODEL_ADDR 0x0C04
3629+
3630+#define R_BE_RX_FLTR_OPT 0x11420
3631+#define R_BE_RX_FLTR_OPT_C1 0x15420
3632+#define B_BE_UID_FILTER_MASK GENMASK(31, 24)
3633+#define B_BE_UNSPT_TYPE BIT(22)
3634+#define B_BE_RX_MPDU_MAX_LEN_MASK GENMASK(21, 16)
3635+#define B_BE_A_FTM_REQ BIT(14)
3636+#define B_BE_A_ERR_PKT BIT(13)
3637+#define B_BE_A_UNSUP_PKT BIT(12)
3638+#define B_BE_A_CRC32_ERR BIT(11)
3639+#define B_BE_A_BCN_CHK_RULE_MASK GENMASK(9, 8)
3640+#define B_BE_A_BCN_CHK_EN BIT(7)
3641+#define B_BE_A_MC_LIST_CAM_MATCH BIT(6)
3642+#define B_BE_A_BC_CAM_MATCH BIT(5)
3643+#define B_BE_A_UC_CAM_MATCH BIT(4)
3644+#define B_BE_A_MC BIT(3)
3645+#define B_BE_A_BC BIT(2)
3646+#define B_BE_A_A1_MATCH BIT(1)
3647+#define B_BE_SNIFFER_MODE BIT(0)
3648+
36283649 #define RR_MOD 0x00
36293650 #define RR_MOD_V1 0x10000
36303651 #define RR_MOD_IQK GENMASK(19, 4)
@@ -3977,6 +3998,7 @@ · 346 unmodified lines
39773998 #define B_DBCC_80P80_SEL_EVM_RPT_EN BIT(0)
39783999 #define R_CCX 0x0C00
39794000 #define B_CCX_EDCCA_OPT_MSK GENMASK(6, 4)
4001+#define B_CCX_EDCCA_OPT_MSK_V1 GENMASK(7, 4)
39804002 #define B_MEASUREMENT_TRIG_MSK BIT(2)
39814003 #define B_CCX_TRIG_OPT_MSK BIT(1)
39824004 #define B_CCX_EN_MSK BIT(0)
@@ -4068,32 +4090,41 @@ · 85 unmodified lines
40684090 #define B_SWSI_R_DATA_DONE_V1 BIT(26)
40694091 #define R_TX_COUNTER 0x1A40
40704092 #define R_IFS_CLM_TX_CNT 0x1ACC
4093+#define R_IFS_CLM_TX_CNT_V1 0x0ECC
40714094 #define B_IFS_CLM_EDCCA_EXCLUDE_CCA_FA_MSK GENMASK(31, 16)
40724095 #define B_IFS_CLM_TX_CNT_MSK GENMASK(15, 0)
40734096 #define R_IFS_CLM_CCA 0x1AD0
4097+#define R_IFS_CLM_CCA_V1 0x0ED0
40744098 #define B_IFS_CLM_OFDMCCA_EXCLUDE_FA_MSK GENMASK(31, 16)
40754099 #define B_IFS_CLM_CCKCCA_EXCLUDE_FA_MSK GENMASK(15, 0)
40764100 #define R_IFS_CLM_FA 0x1AD4
4101+#define R_IFS_CLM_FA_V1 0x0ED4
40774102 #define B_IFS_CLM_OFDM_FA_MSK GENMASK(31, 16)
40784103 #define B_IFS_CLM_CCK_FA_MSK GENMASK(15, 0)
40794104 #define R_IFS_HIS 0x1AD8
4105+#define R_IFS_HIS_V1 0x0ED8
40804106 #define B_IFS_T4_HIS_MSK GENMASK(31, 24)
40814107 #define B_IFS_T3_HIS_MSK GENMASK(23, 16)
40824108 #define B_IFS_T2_HIS_MSK GENMASK(15, 8)
40834109 #define B_IFS_T1_HIS_MSK GENMASK(7, 0)
40844110 #define R_IFS_AVG_L 0x1ADC
4111+#define R_IFS_AVG_L_V1 0x0EDC
40854112 #define B_IFS_T2_AVG_MSK GENMASK(31, 16)
40864113 #define B_IFS_T1_AVG_MSK GENMASK(15, 0)
40874114 #define R_IFS_AVG_H 0x1AE0
4115+#define R_IFS_AVG_H_V1 0x0EE0
40884116 #define B_IFS_T4_AVG_MSK GENMASK(31, 16)
40894117 #define B_IFS_T3_AVG_MSK GENMASK(15, 0)
40904118 #define R_IFS_CCA_L 0x1AE4
4119+#define R_IFS_CCA_L_V1 0x0EE4
40914120 #define B_IFS_T2_CCA_MSK GENMASK(31, 16)
40924121 #define B_IFS_T1_CCA_MSK GENMASK(15, 0)
40934122 #define R_IFS_CCA_H 0x1AE8
4123+#define R_IFS_CCA_H_V1 0x0EE8
40944124 #define B_IFS_T4_CCA_MSK GENMASK(31, 16)
40954125 #define B_IFS_T3_CCA_MSK GENMASK(15, 0)
40964126 #define R_IFSCNT 0x1AEC
4127+#define R_IFSCNT_V1 0x0EEC
40974128 #define B_IFSCNT_DONE_MSK BIT(16)
40984129 #define B_IFSCNT_TOTAL_CNT_MSK GENMASK(15, 0)
40994130 #define R_TXAGC_TP 0x1C04
@@ -4109,6 +4140,8 @@ · 9 unmodified lines
41094140 #define B_TXAGC_BB_OFT GENMASK(31, 16)
41104141 #define B_TXAGC_BB GENMASK(31, 24)
41114142 #define B_TXAGC_RF GENMASK(5, 0)
4143+#define R_PATH0_TXPWR 0x1C78
4144+#define B_PATH0_TXPWR GENMASK(8, 0)
41124145 #define R_S0_ADDCK 0x1E00
41134146 #define B_S0_ADDCK_I GENMASK(9, 0)
41144147 #define B_S0_ADDCK_Q GENMASK(19, 10)
@@ -4184,6 +4217,8 @@ · 69 unmodified lines
41844217 #define R_TXAGC_BB_S1 0x3C60
41854218 #define B_TXAGC_BB_S1_OFT GENMASK(31, 16)
41864219 #define B_TXAGC_BB_S1 GENMASK(31, 24)
4220+#define R_PATH1_TXPWR 0x3C78
4221+#define B_PATH1_TXPWR GENMASK(8, 0)
41874222 #define R_S1_ADDCK 0x3E00
41884223 #define B_S1_ADDCK_I GENMASK(9, 0)
41894224 #define B_S1_ADDCK_Q GENMASK(19, 10)
@@ -4360,6 +4395,7 @@ · 170 unmodified lines
43604395 #define B_PKT_POP_EN BIT(8)
43614396 #define R_SEG0R_PD 0x481C
43624397 #define R_SEG0R_PD_V1 0x4860
4398+#define R_SEG0R_PD_V2 0x6A74
43634399 #define R_SEG0R_EDCCA_LVL 0x4840
43644400 #define R_SEG0R_EDCCA_LVL_V1 0x4884
43654401 #define B_SEG0R_PPDU_LVL_MSK GENMASK(31, 24)
@@ -4478,8 +4514,10 @@ · 112 unmodified lines
44784514 #define R_DCFO_COMP_S0_V1 0x4A40
44794515 #define B_DCFO_COMP_S0_V1_MSK GENMASK(13, 0)
44804516 #define R_BMODE_PDTH_V1 0x4B64
4517+#define R_BMODE_PDTH_V2 0x6708
44814518 #define B_BMODE_PDTH_LOWER_BOUND_MSK_V1 GENMASK(31, 24)
44824519 #define R_BMODE_PDTH_EN_V1 0x4B74
4520+#define R_BMODE_PDTH_EN_V2 0x6718
44834521 #define B_BMODE_PDTH_LIMIT_EN_MSK_V1 BIT(30)
44844522 #define R_CFO_COMP_SEG1_L 0x5384
44854523 #define R_CFO_COMP_SEG1_H 0x5388
drivers/net/wireless/realtek/rtw89/regd.c+14−13
@@ -13,10 +13,10 @@ · 12 unmodified lines
1313 }
1414
1515 static const struct rtw89_regd rtw89_ww_regd =
16− COUNTRY_REGD("00", RTW89_WW, RTW89_WW);
16+ COUNTRY_REGD("00", RTW89_WW, RTW89_WW, RTW89_WW);
1717
1818 static const struct rtw89_regd rtw89_regd_map[] = {
19− COUNTRY_REGD("AR", RTW89_MEXICO, RTW89_MEXICO, RTW89_NA),
19+ COUNTRY_REGD("AR", RTW89_MEXICO, RTW89_MEXICO, RTW89_FCC),
2020 COUNTRY_REGD("BO", RTW89_FCC, RTW89_FCC, RTW89_FCC),
2121 COUNTRY_REGD("BR", RTW89_FCC, RTW89_FCC, RTW89_FCC),
2222 COUNTRY_REGD("CL", RTW89_CHILE, RTW89_CHILE, RTW89_CHILE),
@@ -26,7 +26,7 @@ static const struct rtw89_regd rtw89_regd_map[] = { · 3 unmodified lines
2626 COUNTRY_REGD("SV", RTW89_FCC, RTW89_FCC, RTW89_FCC),
2727 COUNTRY_REGD("GT", RTW89_FCC, RTW89_FCC, RTW89_FCC),
2828 COUNTRY_REGD("HN", RTW89_FCC, RTW89_FCC, RTW89_FCC),
29− COUNTRY_REGD("MX", RTW89_MEXICO, RTW89_MEXICO, RTW89_NA),
29+ COUNTRY_REGD("MX", RTW89_MEXICO, RTW89_MEXICO, RTW89_FCC),
3030 COUNTRY_REGD("NI", RTW89_FCC, RTW89_FCC, RTW89_NA),
3131 COUNTRY_REGD("PA", RTW89_FCC, RTW89_FCC, RTW89_NA),
3232 COUNTRY_REGD("PY", RTW89_FCC, RTW89_FCC, RTW89_NA),
@@ -81,7 +81,7 @@ static const struct rtw89_regd rtw89_regd_map[] = { · 48 unmodified lines
8181 COUNTRY_REGD("KE", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
8282 COUNTRY_REGD("KW", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
8383 COUNTRY_REGD("KG", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
84− COUNTRY_REGD("LB", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
84+ COUNTRY_REGD("LB", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
8585 COUNTRY_REGD("LS", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
8686 COUNTRY_REGD("MK", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
8787 COUNTRY_REGD("MA", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
@@ -96,7 +96,7 @@ static const struct rtw89_regd rtw89_regd_map[] = { · 8 unmodified lines
9696 COUNTRY_REGD("SN", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
9797 COUNTRY_REGD("RS", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
9898 COUNTRY_REGD("ME", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
99− COUNTRY_REGD("ZA", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
99+ COUNTRY_REGD("ZA", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
100100 COUNTRY_REGD("TR", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
101101 COUNTRY_REGD("UA", RTW89_UKRAINE, RTW89_UKRAINE, RTW89_UKRAINE),
102102 COUNTRY_REGD("AE", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
@@ -115,7 +115,7 @@ static const struct rtw89_regd rtw89_regd_map[] = { · 12 unmodified lines
115115 COUNTRY_REGD("SG", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
116116 COUNTRY_REGD("LK", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
117117 COUNTRY_REGD("TW", RTW89_FCC, RTW89_FCC, RTW89_NA),
118− COUNTRY_REGD("TH", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
118+ COUNTRY_REGD("TH", RTW89_WW, RTW89_WW, RTW89_WW),
119119 COUNTRY_REGD("VN", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
120120 COUNTRY_REGD("AU", RTW89_ACMA, RTW89_ACMA, RTW89_ACMA),
121121 COUNTRY_REGD("NZ", RTW89_ACMA, RTW89_ACMA, RTW89_ACMA),
@@ -148,7 +148,7 @@ static const struct rtw89_regd rtw89_regd_map[] = { · 26 unmodified lines
148148 COUNTRY_REGD("IO", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
149149 COUNTRY_REGD("VG", RTW89_FCC, RTW89_FCC, RTW89_FCC),
150150 COUNTRY_REGD("BN", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
151− COUNTRY_REGD("BF", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
151+ COUNTRY_REGD("BF", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
152152 COUNTRY_REGD("MM", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
153153 COUNTRY_REGD("BI", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
154154 COUNTRY_REGD("CM", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
@@ -164,7 +164,7 @@ static const struct rtw89_regd rtw89_regd_map[] = { · 9 unmodified lines
164164 COUNTRY_REGD("CK", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
165165 COUNTRY_REGD("CI", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
166166 COUNTRY_REGD("DJ", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
167− COUNTRY_REGD("DM", RTW89_FCC, RTW89_FCC, RTW89_FCC),
167+ COUNTRY_REGD("DM", RTW89_FCC, RTW89_FCC, RTW89_NA),
168168 COUNTRY_REGD("GQ", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
169169 COUNTRY_REGD("ER", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
170170 COUNTRY_REGD("ET", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
@@ -179,20 +179,21 @@ static const struct rtw89_regd rtw89_regd_map[] = { · 8 unmodified lines
179179 COUNTRY_REGD("GE", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
180180 COUNTRY_REGD("GI", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
181181 COUNTRY_REGD("GL", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
182− COUNTRY_REGD("GD", RTW89_FCC, RTW89_FCC, RTW89_FCC),
182+ COUNTRY_REGD("GD", RTW89_FCC, RTW89_FCC, RTW89_NA),
183183 COUNTRY_REGD("GP", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
184184 COUNTRY_REGD("GU", RTW89_FCC, RTW89_FCC, RTW89_NA),
185185 COUNTRY_REGD("GG", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
186186 COUNTRY_REGD("GN", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
187187 COUNTRY_REGD("GW", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
188− COUNTRY_REGD("GY", RTW89_FCC, RTW89_FCC, RTW89_FCC),
189− COUNTRY_REGD("HT", RTW89_FCC, RTW89_FCC, RTW89_NA),
188+ COUNTRY_REGD("GY", RTW89_FCC, RTW89_FCC, RTW89_NA),
189+ COUNTRY_REGD("HT", RTW89_FCC, RTW89_FCC, RTW89_FCC),
190190 COUNTRY_REGD("HM", RTW89_ACMA, RTW89_ACMA, RTW89_NA),
191191 COUNTRY_REGD("VA", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
192192 COUNTRY_REGD("IM", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
193193 COUNTRY_REGD("JE", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
194194 COUNTRY_REGD("KI", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
195− COUNTRY_REGD("LA", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
195+ COUNTRY_REGD("XK", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
196+ COUNTRY_REGD("LA", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
196197 COUNTRY_REGD("LR", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
197198 COUNTRY_REGD("LY", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
198199 COUNTRY_REGD("MO", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
@@ -207,7 +208,7 @@ static const struct rtw89_regd rtw89_regd_map[] = { · 8 unmodified lines
207208 COUNTRY_REGD("YT", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
208209 COUNTRY_REGD("FM", RTW89_FCC, RTW89_FCC, RTW89_NA),
209210 COUNTRY_REGD("MD", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
210− COUNTRY_REGD("MN", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
211+ COUNTRY_REGD("MN", RTW89_ETSI, RTW89_ETSI, RTW89_ETSI),
211212 COUNTRY_REGD("MS", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
212213 COUNTRY_REGD("NR", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
213214 COUNTRY_REGD("NP", RTW89_ETSI, RTW89_ETSI, RTW89_NA),
drivers/net/wireless/realtek/rtw89/rtw8851b.c+12−6
@@ -185,6 +185,10 @@ static const struct rtw89_dig_regs rtw8851b_dig_regs = { · 184 unmodified lines
185185 .seg0_pd_reg = R_SEG0R_PD_V1,
186186 .pd_lower_bound_mask = B_SEG0R_PD_LOWER_BOUND_MSK,
187187 .pd_spatial_reuse_en = B_SEG0R_PD_SPATIAL_REUSE_EN_MSK_V1,
188+ .bmode_pd_reg = R_BMODE_PDTH_EN_V1,
189+ .bmode_cca_rssi_limit_en = B_BMODE_PDTH_LIMIT_EN_MSK_V1,
190+ .bmode_pd_lower_bound_reg = R_BMODE_PDTH_V1,
191+ .bmode_rssi_nocca_low_th_mask = B_BMODE_PDTH_LOWER_BOUND_MSK_V1,
188192 .p0_lna_init = {R_PATH0_LNA_INIT_V1, B_PATH0_LNA_INIT_IDX_MSK},
189193 .p1_lna_init = {R_PATH1_LNA_INIT_V1, B_PATH1_LNA_INIT_IDX_MSK},
190194 .p0_tia_init = {R_PATH0_TIA_INIT_V1, B_PATH0_TIA_INIT_IDX_MSK_V1},
@@ -756,9 +760,9 @@ static void rtw8851b_set_channel_mac(struct rtw89_dev *rtwdev, · 565 unmodified lines
756760 const struct rtw89_chan *chan,
757761 u8 mac_idx)
758762 {
759− u32 sub_carr = rtw89_mac_reg_by_idx(R_AX_TX_SUB_CARRIER_VALUE, mac_idx);
760− u32 chk_rate = rtw89_mac_reg_by_idx(R_AX_TXRATE_CHK, mac_idx);
761− u32 rf_mod = rtw89_mac_reg_by_idx(R_AX_WMAC_RFMOD, mac_idx);
763+ u32 sub_carr = rtw89_mac_reg_by_idx(rtwdev, R_AX_TX_SUB_CARRIER_VALUE, mac_idx);
764+ u32 chk_rate = rtw89_mac_reg_by_idx(rtwdev, R_AX_TXRATE_CHK, mac_idx);
765+ u32 rf_mod = rtw89_mac_reg_by_idx(rtwdev, R_AX_WMAC_RFMOD, mac_idx);
762766 u8 txsc20 = 0, txsc40 = 0;
763767
764768 switch (chan->band_width) {
@@ -1740,14 +1744,14 @@ void rtw8851b_set_txpwr_ul_tb_offset(struct rtw89_dev *rtwdev, · 975 unmodified lines
17401744 return;
17411745 }
17421746
1743− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_CTRL, mac_idx);
1747+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_CTRL, mac_idx);
17441748 rtw89_write32_set(rtwdev, reg, B_AX_PWR_UL_TB_CTRL_EN);
17451749
1746− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_1T, mac_idx);
1750+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_1T, mac_idx);
17471751 rtw89_write32_mask(rtwdev, reg, B_AX_PWR_UL_TB_1T_MASK, pw_ofst);
17481752
17491753 pw_ofst = max_t(s8, pw_ofst - 3, -16);
1750− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_2T, mac_idx);
1754+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_2T, mac_idx);
17511755 rtw89_write32_mask(rtwdev, reg, B_AX_PWR_UL_TB_2T_MASK, pw_ofst);
17521756 }
17531757
@@ -2336,6 +2340,8 @@ const struct rtw89_chip_info rtw8851b_chip_info = { · 582 unmodified lines
23362340 .chip_id = RTL8851B,
23372341 .chip_gen = RTW89_CHIP_AX,
23382342 .ops = &rtw8851b_chip_ops,
2343+ .mac_def = &rtw89_mac_gen_ax,
2344+ .phy_def = &rtw89_phy_gen_ax,
23392345 .fw_basename = RTW8851B_FW_BASENAME,
23402346 .fw_format_max = RTW8851B_FW_FORMAT_MAX,
23412347 .try_ce_fw = true,
drivers/net/wireless/realtek/rtw89/rtw8852a.c+12−7
@@ -478,6 +478,10 @@ static const struct rtw89_dig_regs rtw8852a_dig_regs = { · 477 unmodified lines
478478 .seg0_pd_reg = R_SEG0R_PD,
479479 .pd_lower_bound_mask = B_SEG0R_PD_LOWER_BOUND_MSK,
480480 .pd_spatial_reuse_en = B_SEG0R_PD_SPATIAL_REUSE_EN_MSK,
481+ .bmode_pd_reg = R_BMODE_PDTH_EN_V1,
482+ .bmode_cca_rssi_limit_en = B_BMODE_PDTH_LIMIT_EN_MSK_V1,
483+ .bmode_pd_lower_bound_reg = R_BMODE_PDTH_V1,
484+ .bmode_rssi_nocca_low_th_mask = B_BMODE_PDTH_LOWER_BOUND_MSK_V1,
481485 .p0_lna_init = {R_PATH0_LNA_INIT, B_PATH0_LNA_INIT_IDX_MSK},
482486 .p1_lna_init = {R_PATH1_LNA_INIT, B_PATH1_LNA_INIT_IDX_MSK},
483487 .p0_tia_init = {R_PATH0_TIA_INIT, B_PATH0_TIA_INIT_IDX_MSK},
@@ -704,10 +708,9 @@ static void rtw8852a_set_channel_mac(struct rtw89_dev *rtwdev, · 220 unmodified lines
704708 const struct rtw89_chan *chan,
705709 u8 mac_idx)
706710 {
707− u32 rf_mod = rtw89_mac_reg_by_idx(R_AX_WMAC_RFMOD, mac_idx);
708− u32 sub_carr = rtw89_mac_reg_by_idx(R_AX_TX_SUB_CARRIER_VALUE,
709− mac_idx);
710− u32 chk_rate = rtw89_mac_reg_by_idx(R_AX_TXRATE_CHK, mac_idx);
711+ u32 rf_mod = rtw89_mac_reg_by_idx(rtwdev, R_AX_WMAC_RFMOD, mac_idx);
712+ u32 sub_carr = rtw89_mac_reg_by_idx(rtwdev, R_AX_TX_SUB_CARRIER_VALUE, mac_idx);
713+ u32 chk_rate = rtw89_mac_reg_by_idx(rtwdev, R_AX_TXRATE_CHK, mac_idx);
711714 u8 txsc20 = 0, txsc40 = 0;
712715
713716 switch (chan->band_width) {
@@ -1380,13 +1383,13 @@ void rtw8852a_set_txpwr_ul_tb_offset(struct rtw89_dev *rtwdev, · 666 unmodified lines
13801383 pw_ofst);
13811384 return;
13821385 }
1383− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_CTRL, mac_idx);
1386+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_CTRL, mac_idx);
13841387 rtw89_write32_set(rtwdev, reg, B_AX_PWR_UL_TB_CTRL_EN);
13851388 val_1t = pw_ofst;
1386− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_1T, mac_idx);
1389+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_1T, mac_idx);
13871390 rtw89_write32_mask(rtwdev, reg, B_AX_PWR_UL_TB_1T_MASK, val_1t);
13881391 val_2t = max(val_1t - 3, -16);
1389− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_2T, mac_idx);
1392+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_2T, mac_idx);
13901393 rtw89_write32_mask(rtwdev, reg, B_AX_PWR_UL_TB_2T_MASK, val_2t);
13911394 rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[ULTB] Set TB pwr_offset=(%d, %d)\n",
13921395 val_1t, val_2t);
@@ -2073,6 +2076,8 @@ const struct rtw89_chip_info rtw8852a_chip_info = { · 680 unmodified lines
20732076 .chip_id = RTL8852A,
20742077 .chip_gen = RTW89_CHIP_AX,
20752078 .ops = &rtw8852a_chip_ops,
2079+ .mac_def = &rtw89_mac_gen_ax,
2080+ .phy_def = &rtw89_phy_gen_ax,
20762081 .fw_basename = RTW8852A_FW_BASENAME,
20772082 .fw_format_max = RTW8852A_FW_FORMAT_MAX,
20782083 .try_ce_fw = false,
drivers/net/wireless/realtek/rtw89/rtw8852b.c+12−6
@@ -310,6 +310,10 @@ static const struct rtw89_dig_regs rtw8852b_dig_regs = { · 309 unmodified lines
310310 .seg0_pd_reg = R_SEG0R_PD_V1,
311311 .pd_lower_bound_mask = B_SEG0R_PD_LOWER_BOUND_MSK,
312312 .pd_spatial_reuse_en = B_SEG0R_PD_SPATIAL_REUSE_EN_MSK_V1,
313+ .bmode_pd_reg = R_BMODE_PDTH_EN_V1,
314+ .bmode_cca_rssi_limit_en = B_BMODE_PDTH_LIMIT_EN_MSK_V1,
315+ .bmode_pd_lower_bound_reg = R_BMODE_PDTH_V1,
316+ .bmode_rssi_nocca_low_th_mask = B_BMODE_PDTH_LOWER_BOUND_MSK_V1,
313317 .p0_lna_init = {R_PATH0_LNA_INIT_V1, B_PATH0_LNA_INIT_IDX_MSK},
314318 .p1_lna_init = {R_PATH1_LNA_INIT_V1, B_PATH1_LNA_INIT_IDX_MSK},
315319 .p0_tia_init = {R_PATH0_TIA_INIT_V1, B_PATH0_TIA_INIT_IDX_MSK_V1},
@@ -843,9 +847,9 @@ static void rtw8852b_set_channel_mac(struct rtw89_dev *rtwdev, · 527 unmodified lines
843847 const struct rtw89_chan *chan,
844848 u8 mac_idx)
845849 {
846− u32 rf_mod = rtw89_mac_reg_by_idx(R_AX_WMAC_RFMOD, mac_idx);
847− u32 sub_carr = rtw89_mac_reg_by_idx(R_AX_TX_SUB_CARRIER_VALUE, mac_idx);
848− u32 chk_rate = rtw89_mac_reg_by_idx(R_AX_TXRATE_CHK, mac_idx);
850+ u32 rf_mod = rtw89_mac_reg_by_idx(rtwdev, R_AX_WMAC_RFMOD, mac_idx);
851+ u32 sub_carr = rtw89_mac_reg_by_idx(rtwdev, R_AX_TX_SUB_CARRIER_VALUE, mac_idx);
852+ u32 chk_rate = rtw89_mac_reg_by_idx(rtwdev, R_AX_TXRATE_CHK, mac_idx);
849853 u8 txsc20 = 0, txsc40 = 0;
850854
851855 switch (chan->band_width) {
@@ -1725,14 +1729,14 @@ void rtw8852b_set_txpwr_ul_tb_offset(struct rtw89_dev *rtwdev, · 873 unmodified lines
17251729 return;
17261730 }
17271731
1728− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_CTRL, mac_idx);
1732+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_CTRL, mac_idx);
17291733 rtw89_write32_set(rtwdev, reg, B_AX_PWR_UL_TB_CTRL_EN);
17301734
1731− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_1T, mac_idx);
1735+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_1T, mac_idx);
17321736 rtw89_write32_mask(rtwdev, reg, B_AX_PWR_UL_TB_1T_MASK, pw_ofst);
17331737
17341738 pw_ofst = max_t(s8, pw_ofst - 3, -16);
1735− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_2T, mac_idx);
1739+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_2T, mac_idx);
17361740 rtw89_write32_mask(rtwdev, reg, B_AX_PWR_UL_TB_2T_MASK, pw_ofst);
17371741 }
17381742
@@ -2505,6 +2509,8 @@ const struct rtw89_chip_info rtw8852b_chip_info = { · 766 unmodified lines
25052509 .chip_id = RTL8852B,
25062510 .chip_gen = RTW89_CHIP_AX,
25072511 .ops = &rtw8852b_chip_ops,
2512+ .mac_def = &rtw89_mac_gen_ax,
2513+ .phy_def = &rtw89_phy_gen_ax,
25082514 .fw_basename = RTW8852B_FW_BASENAME,
25092515 .fw_format_max = RTW8852B_FW_FORMAT_MAX,
25102516 .try_ce_fw = true,
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c+2−2
@@ -846,7 +846,7 @@ static bool _iqk_one_shot(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, · 845 unmodified lines
846846 case ID_NBTXK:
847847 rtw89_phy_write32_mask(rtwdev, R_P0_RFCTM, B_P0_RFCTM_EN, 0x0);
848848 rtw89_phy_write32_mask(rtwdev, R_IQK_DIF4, B_IQK_DIF4_TXT, 0x011);
849− iqk_cmd = 0x308 | (1 << (4 + path));
849+ iqk_cmd = 0x408 | (1 << (4 + path));
850850 break;
851851 case ID_NBRXK:
852852 rtw89_phy_write32_mask(rtwdev, R_P0_RFCTM, B_P0_RFCTM_EN, 0x1);
@@ -1078,7 +1078,7 @@ static bool _iqk_nbtxk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx, u8 · 225 unmodified lines
10781078 {
10791079 struct rtw89_iqk_info *iqk_info = &rtwdev->iqk;
10801080 bool kfail;
1081− u8 gp = 0x3;
1081+ u8 gp = 0x2;
10821082
10831083 switch (iqk_info->iqk_band[path]) {
10841084 case RTW89_BAND_2G:
drivers/net/wireless/realtek/rtw89/rtw8852c.c+14−10
@@ -146,6 +146,10 @@ static const struct rtw89_dig_regs rtw8852c_dig_regs = { · 145 unmodified lines
146146 .seg0_pd_reg = R_SEG0R_PD,
147147 .pd_lower_bound_mask = B_SEG0R_PD_LOWER_BOUND_MSK,
148148 .pd_spatial_reuse_en = B_SEG0R_PD_SPATIAL_REUSE_EN_MSK,
149+ .bmode_pd_reg = R_BMODE_PDTH_EN_V1,
150+ .bmode_cca_rssi_limit_en = B_BMODE_PDTH_LIMIT_EN_MSK_V1,
151+ .bmode_pd_lower_bound_reg = R_BMODE_PDTH_V1,
152+ .bmode_rssi_nocca_low_th_mask = B_BMODE_PDTH_LOWER_BOUND_MSK_V1,
149153 .p0_lna_init = {R_PATH0_LNA_INIT_V1, B_PATH0_LNA_INIT_IDX_MSK},
150154 .p1_lna_init = {R_PATH1_LNA_INIT_V1, B_PATH1_LNA_INIT_IDX_MSK},
151155 .p0_tia_init = {R_PATH0_TIA_INIT_V1, B_PATH0_TIA_INIT_IDX_MSK_V1},
@@ -606,10 +610,9 @@ static void rtw8852c_set_channel_mac(struct rtw89_dev *rtwdev, · 454 unmodified lines
606610 const struct rtw89_chan *chan,
607611 u8 mac_idx)
608612 {
609− u32 rf_mod = rtw89_mac_reg_by_idx(R_AX_WMAC_RFMOD, mac_idx);
610− u32 sub_carr = rtw89_mac_reg_by_idx(R_AX_TX_SUB_CARRIER_VALUE,
611− mac_idx);
612− u32 chk_rate = rtw89_mac_reg_by_idx(R_AX_TXRATE_CHK, mac_idx);
613+ u32 rf_mod = rtw89_mac_reg_by_idx(rtwdev, R_AX_WMAC_RFMOD, mac_idx);
614+ u32 sub_carr = rtw89_mac_reg_by_idx(rtwdev, R_AX_TX_SUB_CARRIER_VALUE, mac_idx);
615+ u32 chk_rate = rtw89_mac_reg_by_idx(rtwdev, R_AX_TXRATE_CHK, mac_idx);
613616 u8 txsc20 = 0, txsc40 = 0, txsc80 = 0;
614617 u8 rf_mod_val = 0, chk_rate_mask = 0;
615618 u32 txsc;
@@ -1654,8 +1657,7 @@ static void rtw8852c_set_channel_bb(struct rtw89_dev *rtwdev, · 1038 unmodified lines
16541657 rtwdev->hal.cv != CHIP_CAV) {
16551658 rtw89_phy_write32_idx(rtwdev, R_P80_AT_HIGH_FREQ,
16561659 B_P80_AT_HIGH_FREQ, 0x0, phy_idx);
1657− reg = rtw89_mac_reg_by_idx(R_P80_AT_HIGH_FREQ_BB_WRP,
1658− phy_idx);
1660+ reg = rtw89_mac_reg_by_idx(rtwdev, R_P80_AT_HIGH_FREQ_BB_WRP, phy_idx);
16591661 if (chan->primary_channel > chan->channel) {
16601662 rtw89_phy_write32_mask(rtwdev,
16611663 R_P80_AT_HIGH_FREQ_RU_ALLOC,
@@ -1859,12 +1861,12 @@ void rtw8852c_set_txpwr_ul_tb_offset(struct rtw89_dev *rtwdev, · 197 unmodified lines
18591861
18601862 for (i = 0; i < 4; i++) {
18611863 /* 1TX */
1862− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_1T, mac_idx);
1864+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_1T, mac_idx);
18631865 rtw89_write32_mask(rtwdev, reg,
18641866 B_AX_PWR_UL_TB_1T_V1_MASK << (8 * i),
18651867 val_1t);
18661868 /* 2TX */
1867− reg = rtw89_mac_reg_by_idx(R_AX_PWR_UL_TB_2T, mac_idx);
1869+ reg = rtw89_mac_reg_by_idx(rtwdev, R_AX_PWR_UL_TB_2T, mac_idx);
18681870 rtw89_write32_mask(rtwdev, reg,
18691871 B_AX_PWR_UL_TB_2T_V1_MASK << (8 * i),
18701872 val_2t);
@@ -2181,7 +2183,7 @@ static void rtw8852c_ctrl_tx_path_tmac(struct rtw89_dev *rtwdev, u8 tx_path, · 310 unmodified lines
21812183
21822184 for (addr = R_AX_MACID_ANT_TABLE;
21832185 addr <= R_AX_MACID_ANT_TABLE_LAST; addr += 4) {
2184− reg = rtw89_mac_reg_by_idx(addr, mac_idx);
2186+ reg = rtw89_mac_reg_by_idx(rtwdev, addr, mac_idx);
21852187 rtw89_write32(rtwdev, reg, 0);
21862188 }
21872189
@@ -2211,7 +2213,7 @@ static void rtw8852c_ctrl_tx_path_tmac(struct rtw89_dev *rtwdev, u8 tx_path, · 23 unmodified lines
22112213 for (i = 0; i < cr_size; i++) {
22122214 rtw89_debug(rtwdev, RTW89_DBG_TSSI, "0x%x = 0x%x\n",
22132215 path_com[i].addr, path_com[i].data);
2214− reg = rtw89_mac_reg_by_idx(path_com[i].addr, mac_idx);
2216+ reg = rtw89_mac_reg_by_idx(rtwdev, path_com[i].addr, mac_idx);
22152217 rtw89_write32(rtwdev, reg, path_com[i].data);
22162218 }
22172219 }
@@ -2804,6 +2806,8 @@ const struct rtw89_chip_info rtw8852c_chip_info = { · 586 unmodified lines
28042806 .chip_id = RTL8852C,
28052807 .chip_gen = RTW89_CHIP_AX,
28062808 .ops = &rtw8852c_chip_ops,
2809+ .mac_def = &rtw89_mac_gen_ax,
2810+ .phy_def = &rtw89_phy_gen_ax,
28072811 .fw_basename = RTW8852C_FW_BASENAME,
28082812 .fw_format_max = RTW8852C_FW_FORMAT_MAX,
28092813 .try_ce_fw = false,
drivers/net/wireless/realtek/rtw89/sar.c+209−11
@@ -2,9 +2,16 @@ · 1 unmodified line
22 /* Copyright(c) 2019-2020 Realtek Corporation
33 */
44
5+#include "acpi.h"
56 #include "debug.h"
7+#include "phy.h"
8+#include "reg.h"
69 #include "sar.h"
710
11+#define RTW89_TAS_FACTOR 2 /* unit: 0.25 dBm */
12+#define RTW89_TAS_DPR_GAP (1 << RTW89_TAS_FACTOR)
13+#define RTW89_TAS_DELTA (2 << RTW89_TAS_FACTOR)
14+
815 static enum rtw89_sar_subband rtw89_sar_get_subband(struct rtw89_dev *rtwdev,
916 u32 center_freq)
1017 {
@@ -78,17 +85,15 @@ static const struct rtw89_sar_span rtw89_sar_overlapping_6ghz[] = { · 67 unmodified lines
7885 RTW89_DECL_SAR_6GHZ_SPAN(6885, SUBBAND_7_H, SUBBAND_8),
7986 };
8087
81−static int rtw89_query_sar_config_common(struct rtw89_dev *rtwdev, s32 *cfg)
88+static int rtw89_query_sar_config_common(struct rtw89_dev *rtwdev,
89+ u32 center_freq, s32 *cfg)
8290 {
8391 struct rtw89_sar_cfg_common *rtwsar = &rtwdev->sar.cfg_common;
84− const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
85− enum rtw89_band band = chan->band_type;
86− u32 center_freq = chan->freq;
8792 const struct rtw89_sar_span *span = NULL;
8893 enum rtw89_sar_subband subband_l, subband_h;
8994 int idx;
9095
91− if (band == RTW89_BAND_6G) {
96+ if (center_freq >= RTW89_SAR_6GHZ_SPAN_HEAD) {
9297 idx = RTW89_SAR_6GHZ_SPAN_IDX(center_freq);
9398 /* To decrease size of rtw89_sar_overlapping_6ghz[],
9499 * RTW89_SAR_6GHZ_SPAN_IDX() truncates the leading NULLs
@@ -108,8 +113,8 @@ static int rtw89_query_sar_config_common(struct rtw89_dev *rtwdev, s32 *cfg) · 13 unmodified lines
108113 }
109114
110115 rtw89_debug(rtwdev, RTW89_DBG_SAR,
111− "for {band %u, center_freq %u}, SAR subband: {%u, %u}\n",
112− band, center_freq, subband_l, subband_h);
116+ "center_freq %u: SAR subband {%u, %u}\n",
117+ center_freq, subband_l, subband_h);
113118
114119 if (!rtwsar->set[subband_l] && !rtwsar->set[subband_h])
115120 return -ENODATA;
@@ -157,11 +162,35 @@ static s8 rtw89_txpwr_sar_to_mac(struct rtw89_dev *rtwdev, u8 fct, s32 cfg) · 41 unmodified lines
157162 RTW89_SAR_TXPWR_MAC_MAX);
158163 }
159164
160−s8 rtw89_query_sar(struct rtw89_dev *rtwdev)
165+static s8 rtw89_txpwr_tas_to_sar(const struct rtw89_sar_handler *sar_hdl,
166+ s8 cfg)
167+{
168+ const u8 fct = sar_hdl->txpwr_factor_sar;
169+
170+ if (fct > RTW89_TAS_FACTOR)
171+ return cfg << (fct - RTW89_TAS_FACTOR);
172+ else
173+ return cfg >> (RTW89_TAS_FACTOR - fct);
174+}
175+
176+static s8 rtw89_txpwr_sar_to_tas(const struct rtw89_sar_handler *sar_hdl,
177+ s8 cfg)
178+{
179+ const u8 fct = sar_hdl->txpwr_factor_sar;
180+
181+ if (fct > RTW89_TAS_FACTOR)
182+ return cfg >> (fct - RTW89_TAS_FACTOR);
183+ else
184+ return cfg << (RTW89_TAS_FACTOR - fct);
185+}
186+
187+s8 rtw89_query_sar(struct rtw89_dev *rtwdev, u32 center_freq)
161188 {
162189 const enum rtw89_sar_sources src = rtwdev->sar.src;
163190 /* its members are protected by rtw89_sar_set_src() */
164191 const struct rtw89_sar_handler *sar_hdl = &rtw89_sar_handlers[src];
192+ struct rtw89_tas_info *tas = &rtwdev->tas;
193+ s8 delta;
165194 int ret;
166195 s32 cfg;
167196 u8 fct;
@@ -171,16 +200,30 @@ s8 rtw89_query_sar(struct rtw89_dev *rtwdev) · 3 unmodified lines
171200 if (src == RTW89_SAR_SOURCE_NONE)
172201 return RTW89_SAR_TXPWR_MAC_MAX;
173202
174− ret = sar_hdl->query_sar_config(rtwdev, &cfg);
203+ ret = sar_hdl->query_sar_config(rtwdev, center_freq, &cfg);
175204 if (ret)
176205 return RTW89_SAR_TXPWR_MAC_MAX;
177206
207+ if (tas->enable) {
208+ switch (tas->state) {
209+ case RTW89_TAS_STATE_DPR_OFF:
210+ return RTW89_SAR_TXPWR_MAC_MAX;
211+ case RTW89_TAS_STATE_DPR_ON:
212+ delta = rtw89_txpwr_tas_to_sar(sar_hdl, tas->delta);
213+ cfg -= delta;
214+ break;
215+ case RTW89_TAS_STATE_DPR_FORBID:
216+ default:
217+ break;
218+ }
219+ }
220+
178221 fct = sar_hdl->txpwr_factor_sar;
179222
180223 return rtw89_txpwr_sar_to_mac(rtwdev, fct, cfg);
181224 }
182225
183−void rtw89_print_sar(struct seq_file *m, struct rtw89_dev *rtwdev)
226+void rtw89_print_sar(struct seq_file *m, struct rtw89_dev *rtwdev, u32 center_freq)
184227 {
185228 const enum rtw89_sar_sources src = rtwdev->sar.src;
186229 /* its members are protected by rtw89_sar_set_src() */
@@ -199,7 +242,7 @@ void rtw89_print_sar(struct seq_file *m, struct rtw89_dev *rtwdev) · 12 unmodified lines
199242
200243 seq_printf(m, "source: %d (%s)\n", src, sar_hdl->descr_sar_source);
201244
202− ret = sar_hdl->query_sar_config(rtwdev, &cfg);
245+ ret = sar_hdl->query_sar_config(rtwdev, center_freq, &cfg);
203246 if (ret) {
204247 seq_printf(m, "config: return code: %d\n", ret);
205248 seq_printf(m, "assign: max setting: %d (unit: 1/%lu dBm)\n",
@@ -212,6 +255,19 @@ void rtw89_print_sar(struct seq_file *m, struct rtw89_dev *rtwdev) · 6 unmodified lines
212255 seq_printf(m, "config: %d (unit: 1/%lu dBm)\n", cfg, BIT(fct));
213256 }
214257
258+void rtw89_print_tas(struct seq_file *m, struct rtw89_dev *rtwdev)
259+{
260+ struct rtw89_tas_info *tas = &rtwdev->tas;
261+
262+ if (!tas->enable) {
263+ seq_puts(m, "no TAS is applied\n");
264+ return;
265+ }
266+
267+ seq_printf(m, "DPR gap: %d\n", tas->dpr_gap);
268+ seq_printf(m, "TAS delta: %d\n", tas->delta);
269+}
270+
215271 static int rtw89_apply_sar_common(struct rtw89_dev *rtwdev,
216272 const struct rtw89_sar_cfg_common *sar)
217273 {
@@ -292,3 +348,145 @@ int rtw89_ops_set_sar_specs(struct ieee80211_hw *hw, · 74 unmodified lines
292348
293349 return rtw89_apply_sar_common(rtwdev, &sar_common);
294350 }
351+
352+static void rtw89_tas_state_update(struct rtw89_dev *rtwdev)
353+{
354+ const enum rtw89_sar_sources src = rtwdev->sar.src;
355+ /* its members are protected by rtw89_sar_set_src() */
356+ const struct rtw89_sar_handler *sar_hdl = &rtw89_sar_handlers[src];
357+ struct rtw89_tas_info *tas = &rtwdev->tas;
358+ s32 txpwr_avg = tas->total_txpwr / RTW89_TAS_MAX_WINDOW / PERCENT;
359+ s32 dpr_on_threshold, dpr_off_threshold, cfg;
360+ enum rtw89_tas_state state = tas->state;
361+ const struct rtw89_chan *chan;
362+ int ret;
363+
364+ lockdep_assert_held(&rtwdev->mutex);
365+
366+ if (src == RTW89_SAR_SOURCE_NONE)
367+ return;
368+
369+ chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
370+ ret = sar_hdl->query_sar_config(rtwdev, chan->freq, &cfg);
371+ if (ret)
372+ return;
373+
374+ cfg = rtw89_txpwr_sar_to_tas(sar_hdl, cfg);
375+
376+ if (tas->delta >= cfg) {
377+ rtw89_debug(rtwdev, RTW89_DBG_SAR,
378+ "TAS delta exceed SAR limit\n");
379+ state = RTW89_TAS_STATE_DPR_FORBID;
380+ goto out;
381+ }
382+
383+ dpr_on_threshold = cfg;
384+ dpr_off_threshold = cfg - tas->dpr_gap;
385+ rtw89_debug(rtwdev, RTW89_DBG_SAR,
386+ "DPR_ON thold: %d, DPR_OFF thold: %d, txpwr_avg: %d\n",
387+ dpr_on_threshold, dpr_off_threshold, txpwr_avg);
388+
389+ if (txpwr_avg >= dpr_on_threshold)
390+ state = RTW89_TAS_STATE_DPR_ON;
391+ else if (txpwr_avg < dpr_off_threshold)
392+ state = RTW89_TAS_STATE_DPR_OFF;
393+
394+out:
395+ if (tas->state == state)
396+ return;
397+
398+ rtw89_debug(rtwdev, RTW89_DBG_SAR,
399+ "TAS old state: %d, new state: %d\n", tas->state, state);
400+ tas->state = state;
401+ rtw89_core_set_chip_txpwr(rtwdev);
402+}
403+
404+void rtw89_tas_init(struct rtw89_dev *rtwdev)
405+{
406+ struct rtw89_tas_info *tas = &rtwdev->tas;
407+ int ret;
408+ u8 val;
409+
410+ ret = rtw89_acpi_evaluate_dsm(rtwdev, RTW89_ACPI_DSM_FUNC_TAS_EN, &val);
411+ if (ret) {
412+ rtw89_debug(rtwdev, RTW89_DBG_SAR,
413+ "acpi: cannot get TAS: %d\n", ret);
414+ return;
415+ }
416+
417+ switch (val) {
418+ case 0:
419+ tas->enable = false;
420+ break;
421+ case 1:
422+ tas->enable = true;
423+ break;
424+ default:
425+ break;
426+ }
427+
428+ if (!tas->enable) {
429+ rtw89_debug(rtwdev, RTW89_DBG_SAR, "TAS not enable\n");
430+ return;
431+ }
432+
433+ tas->dpr_gap = RTW89_TAS_DPR_GAP;
434+ tas->delta = RTW89_TAS_DELTA;
435+}
436+
437+void rtw89_tas_reset(struct rtw89_dev *rtwdev)
438+{
439+ struct rtw89_tas_info *tas = &rtwdev->tas;
440+
441+ if (!tas->enable)
442+ return;
443+
444+ memset(&tas->txpwr_history, 0, sizeof(tas->txpwr_history));
445+ tas->total_txpwr = 0;
446+ tas->cur_idx = 0;
447+ tas->state = RTW89_TAS_STATE_DPR_OFF;
448+}
449+
450+static const struct rtw89_reg_def txpwr_regs[] = {
451+ {R_PATH0_TXPWR, B_PATH0_TXPWR},
452+ {R_PATH1_TXPWR, B_PATH1_TXPWR},
453+};
454+
455+void rtw89_tas_track(struct rtw89_dev *rtwdev)
456+{
457+ struct rtw89_env_monitor_info *env = &rtwdev->env_monitor;
458+ const enum rtw89_sar_sources src = rtwdev->sar.src;
459+ u8 max_nss_num = rtwdev->chip->rf_path_num;
460+ struct rtw89_tas_info *tas = &rtwdev->tas;
461+ s16 tmp, txpwr, instant_txpwr = 0;
462+ u32 val;
463+ int i;
464+
465+ if (!tas->enable || src == RTW89_SAR_SOURCE_NONE)
466+ return;
467+
468+ if (env->ccx_watchdog_result != RTW89_PHY_ENV_MON_IFS_CLM)
469+ return;
470+
471+ for (i = 0; i < max_nss_num; i++) {
472+ val = rtw89_phy_read32_mask(rtwdev, txpwr_regs[i].addr,
473+ txpwr_regs[i].mask);
474+ tmp = sign_extend32(val, 8);
475+ if (tmp <= 0)
476+ return;
477+ instant_txpwr += tmp;
478+ }
479+
480+ instant_txpwr /= max_nss_num;
481+ /* in unit of 0.25 dBm multiply by percentage */
482+ txpwr = instant_txpwr * env->ifs_clm_tx_ratio;
483+ tas->total_txpwr += txpwr - tas->txpwr_history[tas->cur_idx];
484+ tas->txpwr_history[tas->cur_idx] = txpwr;
485+ rtw89_debug(rtwdev, RTW89_DBG_SAR,
486+ "instant_txpwr: %d, tx_ratio: %d, txpwr: %d\n",
487+ instant_txpwr, env->ifs_clm_tx_ratio, txpwr);
488+
489+ tas->cur_idx = (tas->cur_idx + 1) % RTW89_TAS_MAX_WINDOW;
490+
491+ rtw89_tas_state_update(rtwdev);
492+}
drivers/net/wireless/realtek/rtw89/sar.h+7−3
@@ -13,14 +13,18 @@ · 12 unmodified lines
1313 struct rtw89_sar_handler {
1414 const char *descr_sar_source;
1515 u8 txpwr_factor_sar;
16− int (*query_sar_config)(struct rtw89_dev *rtwdev, s32 *cfg);
16+ int (*query_sar_config)(struct rtw89_dev *rtwdev, u32 center_freq, s32 *cfg);
1717 };
1818
1919 extern const struct cfg80211_sar_capa rtw89_sar_capa;
2020
21−s8 rtw89_query_sar(struct rtw89_dev *rtwdev);
22−void rtw89_print_sar(struct seq_file *m, struct rtw89_dev *rtwdev);
21+s8 rtw89_query_sar(struct rtw89_dev *rtwdev, u32 center_freq);
22+void rtw89_print_sar(struct seq_file *m, struct rtw89_dev *rtwdev, u32 center_freq);
23+void rtw89_print_tas(struct seq_file *m, struct rtw89_dev *rtwdev);
2324 int rtw89_ops_set_sar_specs(struct ieee80211_hw *hw,
2425 const struct cfg80211_sar_specs *sar);
26+void rtw89_tas_init(struct rtw89_dev *rtwdev);
27+void rtw89_tas_reset(struct rtw89_dev *rtwdev);
28+void rtw89_tas_track(struct rtw89_dev *rtwdev);
2529
2630 #endif
drivers/net/wireless/realtek/rtw89/ser.c+13−7
@@ -529,6 +529,9 @@ static void ser_do_hci_st_hdl(struct rtw89_ser *ser, u8 evt) · 528 unmodified lines
529529 static void ser_mac_mem_dump(struct rtw89_dev *rtwdev, u8 *buf,
530530 u8 sel, u32 start_addr, u32 len)
531531 {
532+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
533+ u32 filter_model_addr = mac->filter_model_addr;
534+ u32 indir_access_addr = mac->indir_access_addr;
532535 u32 *ptr = (u32 *)buf;
533536 u32 base_addr, start_page, residue;
534537 u32 cnt = 0;
@@ -536,14 +539,14 @@ static void ser_mac_mem_dump(struct rtw89_dev *rtwdev, u8 *buf, · 1 unmodified line
536539
537540 start_page = start_addr / MAC_MEM_DUMP_PAGE_SIZE;
538541 residue = start_addr % MAC_MEM_DUMP_PAGE_SIZE;
539− base_addr = rtw89_mac_mem_base_addrs[sel];
542+ base_addr = mac->mem_base_addrs[sel];
540543 base_addr += start_page * MAC_MEM_DUMP_PAGE_SIZE;
541544
542545 while (cnt < len) {
543− rtw89_write32(rtwdev, R_AX_FILTER_MODEL_ADDR, base_addr);
546+ rtw89_write32(rtwdev, filter_model_addr, base_addr);
544547
545− for (i = R_AX_INDIR_ACCESS_ENTRY + residue;
546− i < R_AX_INDIR_ACCESS_ENTRY + MAC_MEM_DUMP_PAGE_SIZE;
548+ for (i = indir_access_addr + residue;
549+ i < indir_access_addr + MAC_MEM_DUMP_PAGE_SIZE;
547550 i += 4, ptr++) {
548551 *ptr = rtw89_read32(rtwdev, i);
549552 cnt += 4;
@@ -585,6 +588,9 @@ static int rtw89_ser_fw_backtrace_dump(struct rtw89_dev *rtwdev, u8 *buf, · 35 unmodified lines
585588 const struct __fw_backtrace_entry *ent)
586589 {
587590 struct __fw_backtrace_info *ptr = (struct __fw_backtrace_info *)buf;
591+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
592+ u32 filter_model_addr = mac->filter_model_addr;
593+ u32 indir_access_addr = mac->indir_access_addr;
588594 u32 fwbt_addr = ent->wcpu_addr & RTW89_WCPU_BASE_MASK;
589595 u32 fwbt_size = ent->size;
590596 u32 fwbt_key = ent->key;
@@ -610,10 +616,10 @@ static int rtw89_ser_fw_backtrace_dump(struct rtw89_dev *rtwdev, u8 *buf, · 19 unmodified lines
610616 }
611617
612618 rtw89_debug(rtwdev, RTW89_DBG_SER, "dump fw backtrace start\n");
613− rtw89_write32(rtwdev, R_AX_FILTER_MODEL_ADDR, fwbt_addr);
619+ rtw89_write32(rtwdev, filter_model_addr, fwbt_addr);
614620
615− for (i = R_AX_INDIR_ACCESS_ENTRY;
616− i < R_AX_INDIR_ACCESS_ENTRY + fwbt_size;
621+ for (i = indir_access_addr;
622+ i < indir_access_addr + fwbt_size;
617623 i += RTW89_FW_BACKTRACE_INFO_SIZE, ptr++) {
618624 *ptr = (struct __fw_backtrace_info){
619625 .ra = rtw89_read32(rtwdev, i),
drivers/net/wireless/realtek/rtw89/wow.c+2−1
@@ -40,6 +40,7 @@ static void rtw89_wow_leave_lps(struct rtw89_dev *rtwdev) · 39 unmodified lines
4040
4141 static int rtw89_wow_config_mac(struct rtw89_dev *rtwdev, bool enable_wow)
4242 {
43+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
4344 int ret;
4445
4546 if (enable_wow) {
@@ -49,7 +50,7 @@ static int rtw89_wow_config_mac(struct rtw89_dev *rtwdev, bool enable_wow) · 3 unmodified lines
4950 return ret;
5051 }
5152 rtw89_write32_set(rtwdev, R_AX_RX_FUNCTION_STOP, B_AX_HDR_RX_STOP);
52− rtw89_write32_clr(rtwdev, R_AX_RX_FLTR_OPT, B_AX_SNIFFER_MODE);
53+ rtw89_write32_clr(rtwdev, mac->rx_fltr, B_AX_SNIFFER_MODE);
5354 rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, false);
5455 rtw89_write32(rtwdev, R_AX_ACTION_FWD0, 0);
5556 rtw89_write32(rtwdev, R_AX_ACTION_FWD1, 0);
drivers/net/wireless/rsi/rsi_91x_coex.c+4−7
@@ -52,8 +52,7 @@ static void rsi_coex_sched_tx_pkts(struct rsi_coex_ctrl_block *coex_cb) · 51 unmodified lines
5252
5353 static void rsi_coex_scheduler_thread(struct rsi_common *common)
5454 {
55− struct rsi_coex_ctrl_block *coex_cb =
56− (struct rsi_coex_ctrl_block *)common->coex_cb;
55+ struct rsi_coex_ctrl_block *coex_cb = common->coex_cb;
5756 u32 timeout = EVENT_WAIT_FOREVER;
5857
5958 do {
@@ -100,9 +99,8 @@ static inline int rsi_map_coex_q(u8 hal_queue) · 40 unmodified lines
10099
101100 int rsi_coex_send_pkt(void *priv, struct sk_buff *skb, u8 hal_queue)
102101 {
103− struct rsi_common *common = (struct rsi_common *)priv;
104− struct rsi_coex_ctrl_block *coex_cb =
105− (struct rsi_coex_ctrl_block *)common->coex_cb;
102+ struct rsi_common *common = priv;
103+ struct rsi_coex_ctrl_block *coex_cb = common->coex_cb;
106104 struct skb_info *tx_params = NULL;
107105 enum rsi_coex_queues coex_q;
108106 int status;
@@ -168,8 +166,7 @@ int rsi_coex_attach(struct rsi_common *common) · 59 unmodified lines
168166
169167 void rsi_coex_detach(struct rsi_common *common)
170168 {
171− struct rsi_coex_ctrl_block *coex_cb =
172− (struct rsi_coex_ctrl_block *)common->coex_cb;
169+ struct rsi_coex_ctrl_block *coex_cb = common->coex_cb;
173170 int cnt;
174171
175172 rsi_kill_thread(&coex_cb->coex_tx_thread);
drivers/net/wireless/rsi/rsi_91x_debugfs.c+1−2
@@ -28,8 +28,7 @@ static int rsi_sdio_stats_read(struct seq_file *seq, void *data) · 27 unmodified lines
2828 {
2929 struct rsi_common *common = seq->private;
3030 struct rsi_hw *adapter = common->priv;
31− struct rsi_91x_sdiodev *dev =
32− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
31+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
3332
3433 seq_printf(seq, "total_sdio_interrupts: %d\n",
3534 dev->rx_info.sdio_int_counter);
drivers/net/wireless/rsi/rsi_91x_hal.c+1−1
@@ -424,7 +424,7 @@ out: · 423 unmodified lines
424424
425425 int rsi_prepare_beacon(struct rsi_common *common, struct sk_buff *skb)
426426 {
427− struct rsi_hw *adapter = (struct rsi_hw *)common->priv;
427+ struct rsi_hw *adapter = common->priv;
428428 struct rsi_data_desc *bcn_frm;
429429 struct ieee80211_hw *hw = common->priv->hw;
430430 struct ieee80211_conf *conf = &hw->conf;
drivers/net/wireless/rsi/rsi_91x_mac80211.c+2−2
@@ -1763,8 +1763,8 @@ static int rsi_mac80211_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, · 1762 unmodified lines
17631763 struct ieee80211_channel *chan, int duration,
17641764 enum ieee80211_roc_type type)
17651765 {
1766− struct rsi_hw *adapter = (struct rsi_hw *)hw->priv;
1767− struct rsi_common *common = (struct rsi_common *)adapter->priv;
1766+ struct rsi_hw *adapter = hw->priv;
1767+ struct rsi_common *common = adapter->priv;
17681768 int status = 0;
17691769
17701770 rsi_dbg(INFO_ZONE, "***** Remain on channel *****\n");
drivers/net/wireless/rsi/rsi_91x_main.c+2−2
@@ -270,14 +270,14 @@ static void rsi_tx_scheduler_thread(struct rsi_common *common) · 269 unmodified lines
270270 #ifdef CONFIG_RSI_COEX
271271 enum rsi_host_intf rsi_get_host_intf(void *priv)
272272 {
273− struct rsi_common *common = (struct rsi_common *)priv;
273+ struct rsi_common *common = priv;
274274
275275 return common->priv->rsi_host_intf;
276276 }
277277
278278 void rsi_set_bt_context(void *priv, void *bt_context)
279279 {
280− struct rsi_common *common = (struct rsi_common *)priv;
280+ struct rsi_common *common = priv;
281281
282282 common->bt_adapter = bt_context;
283283 }
drivers/net/wireless/rsi/rsi_91x_sdio.c+14−25
@@ -144,8 +144,7 @@ static int rsi_issue_sdiocommand(struct sdio_func *func, · 143 unmodified lines
144144 static void rsi_handle_interrupt(struct sdio_func *function)
145145 {
146146 struct rsi_hw *adapter = sdio_get_drvdata(function);
147− struct rsi_91x_sdiodev *dev =
148− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
147+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
149148
150149 if (adapter->priv->fsm_state == FSM_FW_NOT_LOADED)
151150 return;
@@ -337,8 +336,7 @@ static void rsi_reset_card(struct sdio_func *pfunction) · 185 unmodified lines
337336 */
338337 static void rsi_setclock(struct rsi_hw *adapter, u32 freq)
339338 {
340− struct rsi_91x_sdiodev *dev =
341− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
339+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
342340 struct mmc_host *host = dev->pfunction->card->host;
343341 u32 clock;
344342
@@ -358,8 +356,7 @@ static void rsi_setclock(struct rsi_hw *adapter, u32 freq) · 13 unmodified lines
358356 */
359357 static int rsi_setblocklength(struct rsi_hw *adapter, u32 length)
360358 {
361− struct rsi_91x_sdiodev *dev =
362− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
359+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
363360 int status;
364361 rsi_dbg(INIT_ZONE, "%s: Setting the block length\n", __func__);
365362
@@ -380,8 +377,7 @@ static int rsi_setblocklength(struct rsi_hw *adapter, u32 length) · 14 unmodified lines
380377 */
381378 static int rsi_setupcard(struct rsi_hw *adapter)
382379 {
383− struct rsi_91x_sdiodev *dev =
384− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
380+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
385381 int status = 0;
386382
387383 rsi_setclock(adapter, 50000);
@@ -407,8 +403,7 @@ int rsi_sdio_read_register(struct rsi_hw *adapter, · 19 unmodified lines
407403 u32 addr,
408404 u8 *data)
409405 {
410− struct rsi_91x_sdiodev *dev =
411− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
406+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
412407 u8 fun_num = 0;
413408 int status;
414409
@@ -441,8 +436,7 @@ int rsi_sdio_write_register(struct rsi_hw *adapter, · 26 unmodified lines
441436 u32 addr,
442437 u8 *data)
443438 {
444− struct rsi_91x_sdiodev *dev =
445− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
439+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
446440 int status = 0;
447441
448442 if (likely(dev->sdio_irq_task != current))
@@ -495,8 +489,7 @@ static int rsi_sdio_read_register_multiple(struct rsi_hw *adapter, · 46 unmodified lines
495489 u8 *data,
496490 u16 count)
497491 {
498− struct rsi_91x_sdiodev *dev =
499− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
492+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
500493 u32 status;
501494
502495 if (likely(dev->sdio_irq_task != current))
@@ -527,8 +520,7 @@ int rsi_sdio_write_register_multiple(struct rsi_hw *adapter, · 24 unmodified lines
527520 u8 *data,
528521 u16 count)
529522 {
530− struct rsi_91x_sdiodev *dev =
531− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
523+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
532524 int status;
533525
534526 if (dev->write_fail > 1) {
@@ -762,8 +754,7 @@ static int rsi_sdio_host_intf_write_pkt(struct rsi_hw *adapter, · 227 unmodified lines
762754 u8 *pkt,
763755 u32 len)
764756 {
765− struct rsi_91x_sdiodev *dev =
766− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
757+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
767758 u32 block_size = dev->tx_blk_size;
768759 u32 num_blocks, address, length;
769760 u32 queueno;
@@ -1045,7 +1036,7 @@ static int rsi_probe(struct sdio_func *pfunction, · 275 unmodified lines
10451036 goto fail_free_adapter;
10461037 }
10471038
1048− sdev = (struct rsi_91x_sdiodev *)adapter->rsi_dev;
1039+ sdev = adapter->rsi_dev;
10491040 rsi_init_event(&sdev->rx_thread.event);
10501041 status = rsi_create_kthread(adapter->priv, &sdev->rx_thread,
10511042 rsi_sdio_rx_thread, "SDIO-RX-Thread");
@@ -1221,7 +1212,7 @@ static void rsi_disconnect(struct sdio_func *pfunction) · 169 unmodified lines
12211212 if (!adapter)
12221213 return;
12231214
1224− dev = (struct rsi_91x_sdiodev *)adapter->rsi_dev;
1215+ dev = adapter->rsi_dev;
12251216
12261217 rsi_kill_thread(&dev->rx_thread);
12271218 sdio_claim_host(pfunction);
@@ -1255,8 +1246,7 @@ static void rsi_disconnect(struct sdio_func *pfunction) · 27 unmodified lines
12551246 #ifdef CONFIG_PM
12561247 static int rsi_set_sdio_pm_caps(struct rsi_hw *adapter)
12571248 {
1258− struct rsi_91x_sdiodev *dev =
1259− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
1249+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
12601250 struct sdio_func *func = dev->pfunction;
12611251 int ret;
12621252
@@ -1407,7 +1397,7 @@ static int rsi_freeze(struct device *dev) · 144 unmodified lines
14071397 return -ENODEV;
14081398 }
14091399 common = adapter->priv;
1410− sdev = (struct rsi_91x_sdiodev *)adapter->rsi_dev;
1400+ sdev = adapter->rsi_dev;
14111401
14121402 if ((common->wow_flags & RSI_WOW_ENABLED) &&
14131403 (common->wow_flags & RSI_WOW_NO_CONNECTION))
@@ -1457,8 +1447,7 @@ static void rsi_shutdown(struct device *dev) · 43 unmodified lines
14571447 {
14581448 struct sdio_func *pfunction = dev_to_sdio_func(dev);
14591449 struct rsi_hw *adapter = sdio_get_drvdata(pfunction);
1460− struct rsi_91x_sdiodev *sdev =
1461− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
1450+ struct rsi_91x_sdiodev *sdev = adapter->rsi_dev;
14621451 struct ieee80211_hw *hw = adapter->hw;
14631452
14641453 rsi_dbg(ERR_ZONE, "SDIO Bus shutdown =====>\n");
drivers/net/wireless/rsi/rsi_91x_sdio_ops.c+5−10
@@ -88,8 +88,7 @@ void rsi_sdio_rx_thread(struct rsi_common *common) · 87 unmodified lines
8888 static int rsi_process_pkt(struct rsi_common *common)
8989 {
9090 struct rsi_hw *adapter = common->priv;
91− struct rsi_91x_sdiodev *dev =
92− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
91+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
9392 u8 num_blks = 0;
9493 u32 rcv_pkt_len = 0;
9594 int status = 0;
@@ -147,8 +146,7 @@ static int rsi_process_pkt(struct rsi_common *common) · 51 unmodified lines
147146 */
148147 int rsi_init_sdio_slave_regs(struct rsi_hw *adapter)
149148 {
150− struct rsi_91x_sdiodev *dev =
151− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
149+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
152150 u8 function = 0;
153151 u8 byte;
154152 int status = 0;
@@ -233,8 +231,7 @@ int rsi_init_sdio_slave_regs(struct rsi_hw *adapter) · 78 unmodified lines
233231 static void rsi_rx_handler(struct rsi_hw *adapter)
234232 {
235233 struct rsi_common *common = adapter->priv;
236− struct rsi_91x_sdiodev *dev =
237− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
234+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
238235 int status;
239236 u8 isr_status = 0;
240237 u8 fw_status = 0;
@@ -339,8 +336,7 @@ static void rsi_rx_handler(struct rsi_hw *adapter) · 98 unmodified lines
339336 int rsi_sdio_check_buffer_status(struct rsi_hw *adapter, u8 q_num)
340337 {
341338 struct rsi_common *common = adapter->priv;
342− struct rsi_91x_sdiodev *dev =
343− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
339+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
344340 u8 buf_status = 0;
345341 int status = 0;
346342 static int counter = 4;
@@ -409,8 +405,7 @@ out: · 62 unmodified lines
409405 */
410406 int rsi_sdio_determine_event_timeout(struct rsi_hw *adapter)
411407 {
412− struct rsi_91x_sdiodev *dev =
413− (struct rsi_91x_sdiodev *)adapter->rsi_dev;
408+ struct rsi_91x_sdiodev *dev = adapter->rsi_dev;
414409
415410 /* Once buffer full is seen, event timeout to occur every 2 msecs */
416411 if (dev->rx_info.buffer_full)
drivers/net/wireless/rsi/rsi_91x_usb.c+10−10
@@ -43,7 +43,7 @@ static int rsi_usb_card_write(struct rsi_hw *adapter, · 42 unmodified lines
4343 u16 len,
4444 u8 endpoint)
4545 {
46− struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
46+ struct rsi_91x_usbdev *dev = adapter->rsi_dev;
4747 int status;
4848 u8 *seg = dev->tx_buffer;
4949 int transfer;
@@ -91,7 +91,7 @@ static int rsi_write_multiple(struct rsi_hw *adapter, · 41 unmodified lines
9191 if (endpoint == 0)
9292 return -EINVAL;
9393
94− dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
94+ dev = adapter->rsi_dev;
9595 if (dev->write_fail)
9696 return -ENETDOWN;
9797
@@ -109,7 +109,7 @@ static int rsi_write_multiple(struct rsi_hw *adapter, · 11 unmodified lines
109109 static int rsi_find_bulk_in_and_out_endpoints(struct usb_interface *interface,
110110 struct rsi_hw *adapter)
111111 {
112− struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
112+ struct rsi_91x_usbdev *dev = adapter->rsi_dev;
113113 struct usb_host_interface *iface_desc;
114114 struct usb_endpoint_descriptor *endpoint;
115115 __le16 buffer_size;
@@ -306,7 +306,7 @@ out: · 190 unmodified lines
306306
307307 static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num)
308308 {
309− struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
309+ struct rsi_91x_usbdev *dev = adapter->rsi_dev;
310310 struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1];
311311 struct urb *urb = rx_cb->rx_urb;
312312
@@ -323,7 +323,7 @@ static void rsi_rx_urb_kill(struct rsi_hw *adapter, u8 ep_num) · 10 unmodified lines
323323 */
324324 static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags)
325325 {
326− struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
326+ struct rsi_91x_usbdev *dev = adapter->rsi_dev;
327327 struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1];
328328 struct urb *urb = rx_cb->rx_urb;
329329 int status;
@@ -362,7 +362,7 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags) · 32 unmodified lines
362362 static int rsi_usb_read_register_multiple(struct rsi_hw *adapter, u32 addr,
363363 u8 *data, u16 count)
364364 {
365− struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
365+ struct rsi_91x_usbdev *dev = adapter->rsi_dev;
366366 u8 *buf;
367367 u16 transfer;
368368 int status;
@@ -412,7 +412,7 @@ static int rsi_usb_read_register_multiple(struct rsi_hw *adapter, u32 addr, · 43 unmodified lines
412412 static int rsi_usb_write_register_multiple(struct rsi_hw *adapter, u32 addr,
413413 u8 *data, u16 count)
414414 {
415− struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
415+ struct rsi_91x_usbdev *dev = adapter->rsi_dev;
416416 u8 *buf;
417417 u16 transfer;
418418 int status = 0;
@@ -559,7 +559,7 @@ static struct rsi_host_intf_ops usb_host_intf_ops = { · 140 unmodified lines
559559 */
560560 static void rsi_deinit_usb_interface(struct rsi_hw *adapter)
561561 {
562− struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
562+ struct rsi_91x_usbdev *dev = adapter->rsi_dev;
563563
564564 rsi_kill_thread(&dev->rx_thread);
565565
@@ -572,7 +572,7 @@ static void rsi_deinit_usb_interface(struct rsi_hw *adapter) · 6 unmodified lines
572572
573573 static int rsi_usb_init_rx(struct rsi_hw *adapter)
574574 {
575− struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
575+ struct rsi_91x_usbdev *dev = adapter->rsi_dev;
576576 struct rx_usb_ctrl_block *rx_cb;
577577 u8 idx, num_rx_cb;
578578
@@ -822,7 +822,7 @@ static int rsi_probe(struct usb_interface *pfunction, · 243 unmodified lines
822822 goto err1;
823823 }
824824
825− dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
825+ dev = adapter->rsi_dev;
826826
827827 status = rsi_usb_reg_read(dev->usbdev, FW_STATUS_REG, &fw_status, 2);
828828 if (status < 0)
drivers/net/wireless/rsi/rsi_91x_usb_ops.c+1−1
@@ -28,7 +28,7 @@ · 27 unmodified lines
2828 void rsi_usb_rx_thread(struct rsi_common *common)
2929 {
3030 struct rsi_hw *adapter = common->priv;
31− struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
31+ struct rsi_91x_usbdev *dev = adapter->rsi_dev;
3232 int status;
3333 struct sk_buff *skb;
3434
drivers/net/wireless/silabs/wfx/main.c+3−4
@@ -293,13 +293,12 @@ struct wfx_dev *wfx_init_common(struct device *dev, const struct wfx_platform_da · 292 unmodified lines
293293 hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
294294 hw->wiphy->n_iface_combinations = ARRAY_SIZE(wfx_iface_combinations);
295295 hw->wiphy->iface_combinations = wfx_iface_combinations;
296− hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL);
296+ /* FIXME: also copy wfx_rates and wfx_2ghz_chantable */
297+ hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmemdup(dev, &wfx_band_2ghz,
298+ sizeof(wfx_band_2ghz), GFP_KERNEL);
297299 if (!hw->wiphy->bands[NL80211_BAND_2GHZ])
298300 goto err;
299301
300− /* FIXME: also copy wfx_rates and wfx_2ghz_chantable */
301− memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, sizeof(wfx_band_2ghz));
302−
303302 wdev = hw->priv;
304303 wdev->hw = hw;
305304 wdev->dev = dev;
drivers/net/wireless/ti/wlcore/sdio.c+1−12
@@ -442,18 +442,7 @@ static struct sdio_driver wl1271_sdio_driver = { · 441 unmodified lines
442442 #endif
443443 };
444444
445−static int __init wl1271_init(void)
446−{
447− return sdio_register_driver(&wl1271_sdio_driver);
448−}
449−
450−static void __exit wl1271_exit(void)
451−{
452− sdio_unregister_driver(&wl1271_sdio_driver);
453−}
454−
455−module_init(wl1271_init);
456−module_exit(wl1271_exit);
445+module_sdio_driver(wl1271_sdio_driver);
457446
458447 module_param(dump, bool, 0600);
459448 MODULE_PARM_DESC(dump, "Enable sdio read/write dumps.");
drivers/net/wireless/virtual/mac80211_hwsim.c+9−9
@@ -582,9 +582,8 @@ static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy, · 581 unmodified lines
582582 */
583583
584584 /* Add vendor data */
585− err = nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_TEST, val + 1);
586− if (err)
587− return err;
585+ nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_TEST, val + 1);
586+
588587 /* Send the event - this will call nla_nest_end() */
589588 cfg80211_vendor_event(skb, GFP_KERNEL);
590589 }
@@ -5626,14 +5625,15 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, · 5035 unmodified lines
56265625 frame_data_len = nla_len(info->attrs[HWSIM_ATTR_FRAME]);
56275626 frame_data = (void *)nla_data(info->attrs[HWSIM_ATTR_FRAME]);
56285627
5628+ if (frame_data_len < sizeof(struct ieee80211_hdr_3addr) ||
5629+ frame_data_len > IEEE80211_MAX_DATA_LEN)
5630+ goto err;
5631+
56295632 /* Allocate new skb here */
56305633 skb = alloc_skb(frame_data_len, GFP_KERNEL);
56315634 if (skb == NULL)
56325635 goto err;
56335636
5634− if (frame_data_len > IEEE80211_MAX_DATA_LEN)
5635− goto err;
5636−
56375637 /* Copy the data */
56385638 skb_put_data(skb, frame_data, frame_data_len);
56395639
@@ -6314,7 +6314,7 @@ static void hwsim_virtio_tx_done(struct virtqueue *vq) · 674 unmodified lines
63146314
63156315 spin_lock_irqsave(&hwsim_virtio_lock, flags);
63166316 while ((skb = virtqueue_get_buf(vq, &len)))
6317− nlmsg_free(skb);
6317+ dev_kfree_skb_irq(skb);
63186318 spin_unlock_irqrestore(&hwsim_virtio_lock, flags);
63196319 }
63206320
@@ -6383,14 +6383,14 @@ static void hwsim_virtio_rx_work(struct work_struct *work) · 62 unmodified lines
63836383
63846384 spin_lock_irqsave(&hwsim_virtio_lock, flags);
63856385 if (!hwsim_virtio_enabled) {
6386− nlmsg_free(skb);
6386+ dev_kfree_skb_irq(skb);
63876387 goto out_unlock;
63886388 }
63896389 vq = hwsim_vqs[HWSIM_VQ_RX];
63906390 sg_init_one(sg, skb->head, skb_end_offset(skb));
63916391 err = virtqueue_add_inbuf(vq, sg, 1, skb, GFP_ATOMIC);
63926392 if (WARN(err, "virtqueue_add_inbuf returned %d\n", err))
6393− nlmsg_free(skb);
6393+ dev_kfree_skb_irq(skb);
63946394 else
63956395 virtqueue_kick(vq);
63966396 schedule_work(&hwsim_virtio_rx);
drivers/net/wireless/zydas/zd1201.c+3−3
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 /*
3− * Driver for ZyDAS zd1201 based wireless USB devices.
3+ * Driver for ZyDAS zd1201 based USB wireless devices.
44 *
55 * Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org)
66 *
@@ -23,8 +23,8 @@ · 16 unmodified lines
2323 #include "zd1201.h"
2424
2525 static const struct usb_device_id zd1201_table[] = {
26− {USB_DEVICE(0x0586, 0x3400)}, /* Peabird Wireless USB Adapter */
27− {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */
26+ {USB_DEVICE(0x0586, 0x3400)}, /* Peabird USB Wireless Adapter */
27+ {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 USB Wireless Adapter */
2828 {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */
2929 {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */
3030 {USB_DEVICE(0x1044, 0x8004)}, /* Gigabyte GN-WLBZ101 */
drivers/platform/x86/eeepc-laptop.c+1−1
@@ -1394,7 +1394,7 @@ static int eeepc_acpi_add(struct acpi_device *device) · 1393 unmodified lines
13941394 * and machine-specific scripts find the fixed name convenient. But
13951395 * It's also good for us to exclude multiple instances because both
13961396 * our hwmon and our wlan rfkill subdevice use global ACPI objects
1397− * (the EC and the wlan PCI slot respectively).
1397+ * (the EC and the PCI wlan slot respectively).
13981398 */
13991399 result = eeepc_platform_init(eeepc);
14001400 if (result)
drivers/staging/wlan-ng/prism2usb.c+24−24
@@ -11,45 +11,45 @@ · 10 unmodified lines
1111
1212 static const struct usb_device_id usb_prism_tbl[] = {
1313 PRISM_DEV(0x04bb, 0x0922, "IOData AirPort WN-B11/USBS"),
14− PRISM_DEV(0x07aa, 0x0012, "Corega Wireless LAN USB Stick-11"),
15− PRISM_DEV(0x09aa, 0x3642, "Prism2.x 11Mbps WLAN USB Adapter"),
16− PRISM_DEV(0x1668, 0x0408, "Actiontec Prism2.5 11Mbps WLAN USB Adapter"),
17− PRISM_DEV(0x1668, 0x0421, "Actiontec Prism2.5 11Mbps WLAN USB Adapter"),
18− PRISM_DEV(0x1915, 0x2236, "Linksys WUSB11v3.0 11Mbps WLAN USB Adapter"),
19− PRISM_DEV(0x066b, 0x2212, "Linksys WUSB11v2.5 11Mbps WLAN USB Adapter"),
20− PRISM_DEV(0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps WLAN USB Adapter"),
14+ PRISM_DEV(0x07aa, 0x0012, "Corega USB Wireless LAN Stick-11"),
15+ PRISM_DEV(0x09aa, 0x3642, "Prism2.x 11Mbps USB WLAN Adapter"),
16+ PRISM_DEV(0x1668, 0x0408, "Actiontec Prism2.5 11Mbps USB WLAN Adapter"),
17+ PRISM_DEV(0x1668, 0x0421, "Actiontec Prism2.5 11Mbps USB WLAN Adapter"),
18+ PRISM_DEV(0x1915, 0x2236, "Linksys WUSB11v3.0 11Mbps USB WLAN Adapter"),
19+ PRISM_DEV(0x066b, 0x2212, "Linksys WUSB11v2.5 11Mbps USB WLAN Adapter"),
20+ PRISM_DEV(0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps USB WLAN Adapter"),
2121 PRISM_DEV(0x0411, 0x0016, "Melco WLI-USB-S11 11Mbps WLAN Adapter"),
22− PRISM_DEV(0x08de, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter"),
23− PRISM_DEV(0x8086, 0x1111, "Intel PRO/Wireless 2011B LAN USB Adapter"),
22+ PRISM_DEV(0x08de, 0x7a01, "PRISM25 USB IEEE 802.11 Mini Adapter"),
23+ PRISM_DEV(0x8086, 0x1111, "Intel PRO/Wireless 2011B USB LAN Adapter"),
2424 PRISM_DEV(0x0d8e, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter"),
25− PRISM_DEV(0x045e, 0x006e, "Microsoft MN510 Wireless USB Adapter"),
25+ PRISM_DEV(0x045e, 0x006e, "Microsoft MN510 USB Wireless Adapter"),
2626 PRISM_DEV(0x0967, 0x0204, "Acer Warplink USB Adapter"),
2727 PRISM_DEV(0x0cde, 0x0002, "Z-Com 725/726 Prism2.5 USB/USB Integrated"),
28− PRISM_DEV(0x0cde, 0x0005, "Z-Com Xl735 Wireless 802.11b USB Adapter"),
29− PRISM_DEV(0x413c, 0x8100, "Dell TrueMobile 1180 Wireless USB Adapter"),
30− PRISM_DEV(0x0b3b, 0x1601, "ALLNET 0193 11Mbps WLAN USB Adapter"),
31− PRISM_DEV(0x0b3b, 0x1602, "ZyXEL ZyAIR B200 Wireless USB Adapter"),
32− PRISM_DEV(0x0baf, 0x00eb, "USRobotics USR1120 Wireless USB Adapter"),
28+ PRISM_DEV(0x0cde, 0x0005, "Z-Com Xl735 USB Wireless 802.11b Adapter"),
29+ PRISM_DEV(0x413c, 0x8100, "Dell TrueMobile 1180 USB Wireless Adapter"),
30+ PRISM_DEV(0x0b3b, 0x1601, "ALLNET 0193 11Mbps USB WLAN Adapter"),
31+ PRISM_DEV(0x0b3b, 0x1602, "ZyXEL ZyAIR B200 USB Wireless Adapter"),
32+ PRISM_DEV(0x0baf, 0x00eb, "USRobotics USR1120 USB Wireless Adapter"),
3333 PRISM_DEV(0x0411, 0x0027, "Melco WLI-USB-KS11G 11Mbps WLAN Adapter"),
3434 PRISM_DEV(0x04f1, 0x3009, "JVC MP-XP7250 Builtin USB WLAN Adapter"),
3535 PRISM_DEV(0x0846, 0x4110, "NetGear MA111"),
3636 PRISM_DEV(0x03f3, 0x0020, "Adaptec AWN-8020 USB WLAN Adapter"),
37− PRISM_DEV(0x2821, 0x3300, "ASUS-WL140 / Hawking HighDB Wireless USB Adapter"),
38− PRISM_DEV(0x2001, 0x3700, "DWL-122 Wireless USB Adapter"),
39− PRISM_DEV(0x2001, 0x3702, "DWL-120 Rev F Wireless USB Adapter"),
37+ PRISM_DEV(0x2821, 0x3300, "ASUS-WL140 / Hawking HighDB USB Wireless Adapter"),
38+ PRISM_DEV(0x2001, 0x3700, "DWL-122 USB Wireless Adapter"),
39+ PRISM_DEV(0x2001, 0x3702, "DWL-120 Rev F USB Wireless Adapter"),
4040 PRISM_DEV(0x50c2, 0x4013, "Averatec USB WLAN Adapter"),
41− PRISM_DEV(0x2c02, 0x14ea, "Planex GW-US11H WLAN USB Adapter"),
42− PRISM_DEV(0x124a, 0x168b, "Airvast PRISM3 WLAN USB Adapter"),
41+ PRISM_DEV(0x2c02, 0x14ea, "Planex GW-US11H USB WLAN Adapter"),
42+ PRISM_DEV(0x124a, 0x168b, "Airvast PRISM3 USB WLAN Adapter"),
4343 PRISM_DEV(0x083a, 0x3503, "T-Sinus 111 USB WLAN Adapter"),
4444 PRISM_DEV(0x0411, 0x0044, "Melco WLI-USB-KB11 11Mbps WLAN Adapter"),
45− PRISM_DEV(0x1668, 0x6106, "ROPEX FreeLan 802.11b USB Adapter"),
46− PRISM_DEV(0x124a, 0x4017, "Pheenet WL-503IA 802.11b USB Adapter"),
45+ PRISM_DEV(0x1668, 0x6106, "ROPEX FreeLan USB 802.11b Adapter"),
46+ PRISM_DEV(0x124a, 0x4017, "Pheenet WL-503IA USB 802.11b Adapter"),
4747 PRISM_DEV(0x0bb2, 0x0302, "Ambit Microsystems Corp."),
48− PRISM_DEV(0x9016, 0x182d, "Sitecom WL-022 802.11b USB Adapter"),
48+ PRISM_DEV(0x9016, 0x182d, "Sitecom WL-022 USB 802.11b Adapter"),
4949 PRISM_DEV(0x0543, 0x0f01,
5050 "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)"),
5151 PRISM_DEV(0x067c, 0x1022,
52− "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter"),
52+ "Siemens SpeedStream 1022 11Mbps USB WLAN Adapter"),
5353 PRISM_DEV(0x049f, 0x0033,
5454 "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter"),
5555 { } /* terminator */
include/linux/ieee80211.h+177−58
@@ -836,9 +836,14 @@ enum ieee80211_preq_target_flags { · 835 unmodified lines
836836 };
837837
838838 /**
839− * struct ieee80211_quiet_ie
839+ * struct ieee80211_quiet_ie - Quiet element
840+ * @count: Quiet Count
841+ * @period: Quiet Period
842+ * @duration: Quiet Duration
843+ * @offset: Quiet Offset
840844 *
841− * This structure refers to "Quiet information element"
845+ * This structure represents the payload of the "Quiet element" as
846+ * described in IEEE Std 802.11-2020 section 9.4.2.22.
842847 */
843848 struct ieee80211_quiet_ie {
844849 u8 count;
@@ -848,9 +853,15 @@ struct ieee80211_quiet_ie { · 3 unmodified lines
848853 } __packed;
849854
850855 /**
851− * struct ieee80211_msrment_ie
856+ * struct ieee80211_msrment_ie - Measurement element
857+ * @token: Measurement Token
858+ * @mode: Measurement Report Mode
859+ * @type: Measurement Type
860+ * @request: Measurement Request or Measurement Report
852861 *
853− * This structure refers to "Measurement Request/Report information element"
862+ * This structure represents the payload of both the "Measurement
863+ * Request element" and the "Measurement Report element" as described
864+ * in IEEE Std 802.11-2020 sections 9.4.2.20 and 9.4.2.21.
854865 */
855866 struct ieee80211_msrment_ie {
856867 u8 token;
@@ -860,9 +871,14 @@ struct ieee80211_msrment_ie { · 3 unmodified lines
860871 } __packed;
861872
862873 /**
863− * struct ieee80211_channel_sw_ie
874+ * struct ieee80211_channel_sw_ie - Channel Switch Announcement element
875+ * @mode: Channel Switch Mode
876+ * @new_ch_num: New Channel Number
877+ * @count: Channel Switch Count
864878 *
865− * This structure refers to "Channel Switch Announcement information element"
879+ * This structure represents the payload of the "Channel Switch
880+ * Announcement element" as described in IEEE Std 802.11-2020 section
881+ * 9.4.2.18.
866882 */
867883 struct ieee80211_channel_sw_ie {
868884 u8 mode;
@@ -871,9 +887,14 @@ struct ieee80211_channel_sw_ie { · 2 unmodified lines
871887 } __packed;
872888
873889 /**
874− * struct ieee80211_ext_chansw_ie
890+ * struct ieee80211_ext_chansw_ie - Extended Channel Switch Announcement element
891+ * @mode: Channel Switch Mode
892+ * @new_operating_class: New Operating Class
893+ * @new_ch_num: New Channel Number
894+ * @count: Channel Switch Count
875895 *
876− * This structure represents the "Extended Channel Switch Announcement element"
896+ * This structure represents the "Extended Channel Switch Announcement
897+ * element" as described in IEEE Std 802.11-2020 section 9.4.2.52.
877898 */
878899 struct ieee80211_ext_chansw_ie {
879900 u8 mode;
@@ -894,8 +915,14 @@ struct ieee80211_sec_chan_offs_ie { · 14 unmodified lines
894915
895916 /**
896917 * struct ieee80211_mesh_chansw_params_ie - mesh channel switch parameters IE
918+ * @mesh_ttl: Time To Live
919+ * @mesh_flags: Flags
920+ * @mesh_reason: Reason Code
921+ * @mesh_pre_value: Precedence Value
897922 *
898− * This structure represents the "Mesh Channel Switch Paramters element"
923+ * This structure represents the payload of the "Mesh Channel Switch
924+ * Parameters element" as described in IEEE Std 802.11-2020 section
925+ * 9.4.2.102.
899926 */
900927 struct ieee80211_mesh_chansw_params_ie {
901928 u8 mesh_ttl;
@@ -906,6 +933,13 @@ struct ieee80211_mesh_chansw_params_ie { · 4 unmodified lines
906933
907934 /**
908935 * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE
936+ * @new_channel_width: New Channel Width
937+ * @new_center_freq_seg0: New Channel Center Frequency Segment 0
938+ * @new_center_freq_seg1: New Channel Center Frequency Segment 1
939+ *
940+ * This structure represents the payload of the "Wide Bandwidth
941+ * Channel Switch element" as described in IEEE Std 802.11-2020
942+ * section 9.4.2.160.
909943 */
910944 struct ieee80211_wide_bw_chansw_ie {
911945 u8 new_channel_width;
@@ -913,9 +947,14 @@ struct ieee80211_wide_bw_chansw_ie { · 1 unmodified line
913947 } __packed;
914948
915949 /**
916− * struct ieee80211_tim
950+ * struct ieee80211_tim_ie - Traffic Indication Map information element
951+ * @dtim_count: DTIM Count
952+ * @dtim_period: DTIM Period
953+ * @bitmap_ctrl: Bitmap Control
954+ * @virtual_map: Partial Virtual Bitmap
917955 *
918− * This structure refers to "Traffic Indication Map information element"
956+ * This structure represents the payload of the "TIM element" as
957+ * described in IEEE Std 802.11-2020 section 9.4.2.5.
919958 */
920959 struct ieee80211_tim_ie {
921960 u8 dtim_count;
@@ -926,9 +965,17 @@ struct ieee80211_tim_ie { · 4 unmodified lines
926965 } __packed;
927966
928967 /**
929− * struct ieee80211_meshconf_ie
968+ * struct ieee80211_meshconf_ie - Mesh Configuration element
969+ * @meshconf_psel: Active Path Selection Protocol Identifier
970+ * @meshconf_pmetric: Active Path Selection Metric Identifier
971+ * @meshconf_congest: Congestion Control Mode Identifier
972+ * @meshconf_synch: Synchronization Method Identifier
973+ * @meshconf_auth: Authentication Protocol Identifier
974+ * @meshconf_form: Mesh Formation Info
975+ * @meshconf_cap: Mesh Capability (see &enum mesh_config_capab_flags)
930976 *
931− * This structure refers to "Mesh Configuration information element"
977+ * This structure represents the payload of the "Mesh Configuration
978+ * element" as described in IEEE Std 802.11-2020 section 9.4.2.97.
932979 */
933980 struct ieee80211_meshconf_ie {
934981 u8 meshconf_psel;
@@ -950,6 +997,9 @@ struct ieee80211_meshconf_ie { · 15 unmodified lines
950997 * is ongoing
951998 * @IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL: STA is in deep sleep mode or has
952999 * neighbors in deep sleep mode
1000+ *
1001+ * Enumerates the "Mesh Capability" as described in IEEE Std
1002+ * 802.11-2020 section 9.4.2.97.7.
9531003 */
9541004 enum mesh_config_capab_flags {
9551005 IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01,
@@ -960,7 +1010,7 @@ enum mesh_config_capab_flags { · 4 unmodified lines
9601010
9611011 #define IEEE80211_MESHCONF_FORM_CONNECTED_TO_GATE 0x1
9621012
963−/**
1013+/*
9641014 * mesh channel switch parameters element's flag indicator
9651015 *
9661016 */
@@ -969,9 +1019,17 @@ enum mesh_config_capab_flags { · 2 unmodified lines
9691019 #define WLAN_EID_CHAN_SWITCH_PARAM_REASON BIT(2)
9701020
9711021 /**
972− * struct ieee80211_rann_ie
1022+ * struct ieee80211_rann_ie - RANN (root announcement) element
1023+ * @rann_flags: Flags
1024+ * @rann_hopcount: Hop Count
1025+ * @rann_ttl: Element TTL
1026+ * @rann_addr: Root Mesh STA Address
1027+ * @rann_seq: HWMP Sequence Number
1028+ * @rann_interval: Interval
1029+ * @rann_metric: Metric
9731030 *
974− * This structure refers to "Root Announcement information element"
1031+ * This structure represents the payload of the "RANN element" as
1032+ * described in IEEE Std 802.11-2020 section 9.4.2.111.
9751033 */
9761034 struct ieee80211_rann_ie {
9771035 u8 rann_flags;
@@ -993,7 +1051,7 @@ enum ieee80211_ht_chanwidth_values { · 15 unmodified lines
9931051 };
9941052
9951053 /**
996− * enum ieee80211_opmode_bits - VHT operating mode field bits
1054+ * enum ieee80211_vht_opmode_bits - VHT operating mode field bits
9971055 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK: channel width mask
9981056 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ: 20 MHz channel width
9991057 * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ: 40 MHz channel width
@@ -1042,9 +1100,12 @@ enum ieee80211_s1g_chanwidth { · 42 unmodified lines
10421100 #define WLAN_USER_POSITION_LEN 16
10431101
10441102 /**
1045− * struct ieee80211_tpc_report_ie
1103+ * struct ieee80211_tpc_report_ie - TPC Report element
1104+ * @tx_power: Transmit Power
1105+ * @link_margin: Link Margin
10461106 *
1047− * This structure refers to "TPC Report element"
1107+ * This structure represents the payload of the "TPC Report element" as
1108+ * described in IEEE Std 802.11-2020 section 9.4.2.16.
10481109 */
10491110 struct ieee80211_tpc_report_ie {
10501111 u8 tx_power;
@@ -1062,9 +1123,14 @@ struct ieee80211_addba_ext_ie { · 11 unmodified lines
10621123 } __packed;
10631124
10641125 /**
1065− * struct ieee80211_s1g_bcn_compat_ie
1126+ * struct ieee80211_s1g_bcn_compat_ie - S1G Beacon Compatibility element
1127+ * @compat_info: Compatibility Information
1128+ * @beacon_int: Beacon Interval
1129+ * @tsf_completion: TSF Completion
10661130 *
1067− * S1G Beacon Compatibility element
1131+ * This structure represents the payload of the "S1G Beacon
1132+ * Compatibility element" as described in IEEE Std 802.11-2020 section
1133+ * 9.4.2.196.
10681134 */
10691135 struct ieee80211_s1g_bcn_compat_ie {
10701136 __le16 compat_info;
@@ -1073,9 +1139,15 @@ struct ieee80211_s1g_bcn_compat_ie { · 2 unmodified lines
10731139 } __packed;
10741140
10751141 /**
1076− * struct ieee80211_s1g_oper_ie
1142+ * struct ieee80211_s1g_oper_ie - S1G Operation element
1143+ * @ch_width: S1G Operation Information Channel Width
1144+ * @oper_class: S1G Operation Information Operating Class
1145+ * @primary_ch: S1G Operation Information Primary Channel Number
1146+ * @oper_ch: S1G Operation Information Channel Center Frequency
1147+ * @basic_mcs_nss: Basic S1G-MCS and NSS Set
10771148 *
1078− * S1G Operation element
1149+ * This structure represents the payload of the "S1G Operation
1150+ * element" as described in IEEE Std 802.11-2020 section 9.4.2.212.
10791151 */
10801152 struct ieee80211_s1g_oper_ie {
10811153 u8 ch_width;
@@ -1086,9 +1158,13 @@ struct ieee80211_s1g_oper_ie { · 4 unmodified lines
10861158 } __packed;
10871159
10881160 /**
1089− * struct ieee80211_aid_response_ie
1161+ * struct ieee80211_aid_response_ie - AID Response element
1162+ * @aid: AID/Group AID
1163+ * @switch_count: AID Switch Count
1164+ * @response_int: AID Response Interval
10901165 *
1091− * AID Response element
1166+ * This structure represents the payload of the "AID Response element"
1167+ * as described in IEEE Std 802.11-2020 section 9.4.2.194.
10921168 */
10931169 struct ieee80211_aid_response_ie {
10941170 __le16 aid;
@@ -1489,7 +1565,7 @@ struct ieee80211_tdls_data { · 394 unmodified lines
14891565 /*
14901566 * Peer-to-Peer IE attribute related definitions.
14911567 */
1492−/**
1568+/*
14931569 * enum ieee80211_p2p_attr_id - identifies type of peer-to-peer attribute.
14941570 */
14951571 enum ieee80211_p2p_attr_id {
@@ -1539,11 +1615,17 @@ struct ieee80211_p2p_noa_attr { · 43 unmodified lines
15391615 #define IEEE80211_P2P_OPPPS_CTWINDOW_MASK 0x7F
15401616
15411617 /**
1542− * struct ieee80211_bar - HT Block Ack Request
1618+ * struct ieee80211_bar - Block Ack Request frame format
1619+ * @frame_control: Frame Control
1620+ * @duration: Duration
1621+ * @ra: RA
1622+ * @ta: TA
1623+ * @control: BAR Control
1624+ * @start_seq_num: Starting Sequence Number (see Figure 9-37)
15431625 *
1544− * This structure refers to "HT BlockAckReq" as
1545− * described in 802.11n draft section 7.2.1.7.1
1546− */
1626+ * This structure represents the "BlockAckReq frame format"
1627+ * as described in IEEE Std 802.11-2020 section 9.3.1.7.
1628+*/
15471629 struct ieee80211_bar {
15481630 __le16 frame_control;
15491631 __le16 duration;
@@ -1563,13 +1645,17 @@ struct ieee80211_bar { · 13 unmodified lines
15631645 #define IEEE80211_HT_MCS_MASK_LEN 10
15641646
15651647 /**
1566− * struct ieee80211_mcs_info - MCS information
1648+ * struct ieee80211_mcs_info - Supported MCS Set field
15671649 * @rx_mask: RX mask
15681650 * @rx_highest: highest supported RX rate. If set represents
15691651 * the highest supported RX data rate in units of 1 Mbps.
15701652 * If this field is 0 this value should not be used to
15711653 * consider the highest RX data rate supported.
15721654 * @tx_params: TX parameters
1655+ * @reserved: Reserved bits
1656+ *
1657+ * This structure represents the "Supported MCS Set field" as
1658+ * described in IEEE Std 802.11-2020 section 9.4.2.55.4.
15731659 */
15741660 struct ieee80211_mcs_info {
15751661 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
@@ -1600,10 +1686,16 @@ struct ieee80211_mcs_info { · 24 unmodified lines
16001686 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
16011687
16021688 /**
1603− * struct ieee80211_ht_cap - HT capabilities
1689+ * struct ieee80211_ht_cap - HT capabilities element
1690+ * @cap_info: HT Capability Information
1691+ * @ampdu_params_info: A-MPDU Parameters
1692+ * @mcs: Supported MCS Set
1693+ * @extended_ht_cap_info: HT Extended Capabilities
1694+ * @tx_BF_cap_info: Transmit Beamforming Capabilities
1695+ * @antenna_selection_info: ASEL Capability
16041696 *
1605− * This structure is the "HT capabilities element" as
1606− * described in 802.11n D5.0 7.3.2.57
1697+ * This structure represents the payload of the "HT Capabilities
1698+ * element" as described in IEEE Std 802.11-2020 section 9.4.2.55.
16071699 */
16081700 struct ieee80211_ht_cap {
16091701 __le16 cap_info;
@@ -1691,9 +1783,14 @@ enum ieee80211_min_mpdu_spacing { · 81 unmodified lines
16911783
16921784 /**
16931785 * struct ieee80211_ht_operation - HT operation IE
1786+ * @primary_chan: Primary Channel
1787+ * @ht_param: HT Operation Information parameters
1788+ * @operation_mode: HT Operation Information operation mode
1789+ * @stbc_param: HT Operation Information STBC params
1790+ * @basic_set: Basic HT-MCS Set
16941791 *
1695− * This structure is the "HT operation element" as
1696− * described in 802.11n-2009 7.3.2.57
1792+ * This structure represents the payload of the "HT Operation
1793+ * element" as described in IEEE Std 802.11-2020 section 9.4.2.56.
16971794 */
16981795 struct ieee80211_ht_operation {
16991796 u8 primary_chan;
@@ -1862,9 +1959,12 @@ struct ieee80211_vht_operation { · 162 unmodified lines
18621959
18631960 /**
18641961 * struct ieee80211_he_cap_elem - HE capabilities element
1962+ * @mac_cap_info: HE MAC Capabilities Information
1963+ * @phy_cap_info: HE PHY Capabilities Information
18651964 *
1866− * This structure is the "HE capabilities element" fixed fields as
1867− * described in P802.11ax_D4.0 section 9.4.2.242.2 and 9.4.2.242.3
1965+ * This structure represents the fixed fields of the payload of the
1966+ * "HE capabilities element" as described in IEEE Std 802.11ax-2021
1967+ * sections 9.4.2.248.2 and 9.4.2.248.3.
18681968 */
18691969 struct ieee80211_he_cap_elem {
18701970 u8 mac_cap_info[6];
@@ -1923,35 +2023,45 @@ struct ieee80211_he_mcs_nss_supp { · 52 unmodified lines
19232023 } __packed;
19242024
19252025 /**
1926− * struct ieee80211_he_operation - HE capabilities element
2026+ * struct ieee80211_he_operation - HE Operation element
2027+ * @he_oper_params: HE Operation Parameters + BSS Color Information
2028+ * @he_mcs_nss_set: Basic HE-MCS And NSS Set
2029+ * @optional: Optional fields VHT Operation Information, Max Co-Hosted
2030+ * BSSID Indicator, and 6 GHz Operation Information
19272031 *
1928− * This structure is the "HE operation element" fields as
1929− * described in P802.11ax_D4.0 section 9.4.2.243
2032+ * This structure represents the payload of the "HE Operation
2033+ * element" as described in IEEE Std 802.11ax-2021 section 9.4.2.249.
19302034 */
19312035 struct ieee80211_he_operation {
19322036 __le32 he_oper_params;
19332037 __le16 he_mcs_nss_set;
1934− /* Optional 0,1,3,4,5,7 or 8 bytes: depends on @he_oper_params */
19352038 u8 optional[];
19362039 } __packed;
19372040
19382041 /**
1939− * struct ieee80211_he_spr - HE spatial reuse element
2042+ * struct ieee80211_he_spr - Spatial Reuse Parameter Set element
2043+ * @he_sr_control: SR Control
2044+ * @optional: Optional fields Non-SRG OBSS PD Max Offset, SRG OBSS PD
2045+ * Min Offset, SRG OBSS PD Max Offset, SRG BSS Color
2046+ * Bitmap, and SRG Partial BSSID Bitmap
19402047 *
1941− * This structure is the "HE spatial reuse element" element as
1942− * described in P802.11ax_D4.0 section 9.4.2.241
2048+ * This structure represents the payload of the "Spatial Reuse
2049+ * Parameter Set element" as described in IEEE Std 802.11ax-2021
2050+ * section 9.4.2.252.
19432051 */
19442052 struct ieee80211_he_spr {
19452053 u8 he_sr_control;
1946− /* Optional 0 to 19 bytes: depends on @he_sr_control */
19472054 u8 optional[];
19482055 } __packed;
19492056
19502057 /**
19512058 * struct ieee80211_he_mu_edca_param_ac_rec - MU AC Parameter Record field
2059+ * @aifsn: ACI/AIFSN
2060+ * @ecw_min_max: ECWmin/ECWmax
2061+ * @mu_edca_timer: MU EDCA Timer
19522062 *
1953− * This structure is the "MU AC Parameter Record" fields as
1954− * described in P802.11ax_D4.0 section 9.4.2.245
2063+ * This structure represents the "MU AC Parameter Record" as described
2064+ * in IEEE Std 802.11ax-2021 section 9.4.2.251, Figure 9-788p.
19552065 */
19562066 struct ieee80211_he_mu_edca_param_ac_rec {
19572067 u8 aifsn;
@@ -1961,9 +2071,14 @@ struct ieee80211_he_mu_edca_param_ac_rec { · 3 unmodified lines
19612071
19622072 /**
19632073 * struct ieee80211_mu_edca_param_set - MU EDCA Parameter Set element
2074+ * @mu_qos_info: QoS Info
2075+ * @ac_be: MU AC_BE Parameter Record
2076+ * @ac_bk: MU AC_BK Parameter Record
2077+ * @ac_vi: MU AC_VI Parameter Record
2078+ * @ac_vo: MU AC_VO Parameter Record
19642079 *
1965− * This structure is the "MU EDCA Parameter Set element" fields as
1966− * described in P802.11ax_D4.0 section 9.4.2.245
2080+ * This structure represents the payload of the "MU EDCA Parameter Set
2081+ * element" as described in IEEE Std 802.11ax-2021 section 9.4.2.251.
19672082 */
19682083 struct ieee80211_mu_edca_param_set {
19692084 u8 mu_qos_info;
@@ -2177,9 +2292,9 @@ int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *cap, · 207 unmodified lines
21772292 * enum ieee80211_ap_reg_power - regulatory power for a Access Point
21782293 *
21792294 * @IEEE80211_REG_UNSET_AP: Access Point has no regulatory power mode
2180− * @IEEE80211_REG_LPI: Indoor Access Point
2181− * @IEEE80211_REG_SP: Standard power Access Point
2182− * @IEEE80211_REG_VLP: Very low power Access Point
2295+ * @IEEE80211_REG_LPI_AP: Indoor Access Point
2296+ * @IEEE80211_REG_SP_AP: Standard power Access Point
2297+ * @IEEE80211_REG_VLP_AP: Very low power Access Point
21832298 * @IEEE80211_REG_AP_POWER_AFTER_LAST: internal
21842299 * @IEEE80211_REG_AP_POWER_MAX: maximum value
21852300 */
@@ -2567,7 +2682,7 @@ static inline bool ieee80211_he_capa_size_ok(const u8 *data, u8 len) · 381 unmodified lines
25672682 #define IEEE80211_6GHZ_CTRL_REG_SP_AP 1
25682683
25692684 /**
2570− * ieee80211_he_6ghz_oper - HE 6 GHz operation Information field
2685+ * struct ieee80211_he_6ghz_oper - HE 6 GHz operation Information field
25712686 * @primary: primary channel
25722687 * @control: control flags
25732688 * @ccfs0: channel center frequency segment 0
@@ -2614,9 +2729,13 @@ enum ieee80211_tx_power_intrpt_type { · 40 unmodified lines
26142729 };
26152730
26162731 /**
2617− * struct ieee80211_tx_pwr_env
2732+ * struct ieee80211_tx_pwr_env - Transmit Power Envelope
2733+ * @tx_power_info: Transmit Power Information field
2734+ * @tx_power: Maximum Transmit Power field
26182735 *
2619− * This structure represents the "Transmit Power Envelope element"
2736+ * This structure represents the payload of the "Transmit Power
2737+ * Envelope element" as described in IEEE Std 802.11ax-2021 section
2738+ * 9.4.2.161
26202739 */
26212740 struct ieee80211_tx_pwr_env {
26222741 u8 tx_power_info;
@@ -4478,7 +4597,7 @@ static inline bool for_each_element_completed(const struct element *element, · 1855 unmodified lines
44784597 return (const u8 *)element == (const u8 *)data + datalen;
44794598 }
44804599
4481−/**
4600+/*
44824601 * RSNX Capabilities:
44834602 * bits 0-3: Field length (n-1)
44844603 */
@@ -4721,7 +4840,7 @@ ieee80211_mle_get_bss_param_ch_cnt(const struct ieee80211_multi_link_elem *mle) · 236 unmodified lines
47214840 }
47224841
47234842 /**
4724− * ieee80211_mle_get_eml_sync_delay - returns the medium sync delay
4843+ * ieee80211_mle_get_eml_med_sync_delay - returns the medium sync delay
47254844 * @data: pointer to the multi link EHT IE
47264845 *
47274846 * The element is assumed to be of the correct type (BASIC) and big enough,
include/net/cfg80211.h+12−13
@@ -263,7 +263,7 @@ enum ieee80211_privacy { · 262 unmodified lines
263263 * are only for driver use when pointers to this structure are
264264 * passed around.
265265 *
266− * @flags: rate-specific flags
266+ * @flags: rate-specific flags from &enum ieee80211_rate_flags
267267 * @bitrate: bitrate in units of 100 Kbps
268268 * @hw_value: driver/hardware value for this rate
269269 * @hw_value_short: driver/hardware value for this rate when
@@ -811,7 +811,7 @@ struct cfg80211_tid_cfg { · 541 unmodified lines
811811 struct cfg80211_tid_config {
812812 const u8 *peer;
813813 u32 n_tid_conf;
814− struct cfg80211_tid_cfg tid_conf[];
814+ struct cfg80211_tid_cfg tid_conf[] __counted_by(n_tid_conf);
815815 };
816816
817817 /**
@@ -1187,7 +1187,7 @@ struct cfg80211_mbssid_elems { · 369 unmodified lines
11871187 struct {
11881188 const u8 *data;
11891189 size_t len;
1190− } elem[];
1190+ } elem[] __counted_by(cnt);
11911191 };
11921192
11931193 /**
@@ -1204,7 +1204,7 @@ struct cfg80211_rnr_elems { · 10 unmodified lines
12041204 struct {
12051205 const u8 *data;
12061206 size_t len;
1207− } elem[];
1207+ } elem[] __counted_by(cnt);
12081208 };
12091209
12101210 /**
@@ -1282,7 +1282,7 @@ struct cfg80211_acl_data { · 71 unmodified lines
12821282 int n_acl_entries;
12831283
12841284 /* Keep it last */
1285− struct mac_address mac_addrs[];
1285+ struct mac_address mac_addrs[] __counted_by(n_acl_entries);
12861286 };
12871287
12881288 /**
@@ -1353,7 +1353,7 @@ struct cfg80211_unsol_bcast_probe_resp { · 64 unmodified lines
13531353 * @twt_responder: Enable Target Wait Time
13541354 * @he_required: stations must support HE
13551355 * @sae_h2e_required: stations must support direct H2E technique in SAE
1356− * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1356+ * @flags: flags, as defined in &enum nl80211_ap_settings_flags
13571357 * @he_obss_pd: OBSS Packet Detection settings
13581358 * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
13591359 * @fils_discovery: FILS discovery transmission parameters
@@ -1482,7 +1482,6 @@ struct iface_combination_params { · 122 unmodified lines
14821482 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
14831483 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
14841484 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
1485− * @STATION_PARAM_APPLY_STA_TXPOWER: apply tx power for STA
14861485 *
14871486 * Not all station parameters have in-band "no change" signalling,
14881487 * for those that don't these flags will are used.
@@ -2156,7 +2155,7 @@ enum mpath_info_flags { · 667 unmodified lines
21562155 * @sn: target sequence number
21572156 * @metric: metric (cost) of this mesh path
21582157 * @exptime: expiration time for the mesh path from now, in msecs
2159− * @flags: mesh path flags
2158+ * @flags: mesh path flags from &enum mesh_path_flags
21602159 * @discovery_timeout: total mesh path discovery timeout, in msecs
21612160 * @discovery_retries: mesh path discovery retries
21622161 * @generation: generation number for nl80211 dumps.
@@ -2496,7 +2495,7 @@ struct cfg80211_scan_6ghz_params { · 333 unmodified lines
24962495 * the actual dwell time may be shorter.
24972496 * @duration_mandatory: if set, the scan duration must be as specified by the
24982497 * %duration field.
2499− * @flags: bit field of flags controlling operation
2498+ * @flags: control flags from &enum nl80211_scan_flags
25002499 * @rates: bitmap of rates to advertise for each band
25012500 * @wiphy: the wiphy this was for
25022501 * @scan_start: time (in jiffies) when the scan started
@@ -2544,7 +2543,7 @@ struct cfg80211_scan_request { · 41 unmodified lines
25442543 struct cfg80211_scan_6ghz_params *scan_6ghz_params;
25452544
25462545 /* keep last */
2547− struct ieee80211_channel *channels[];
2546+ struct ieee80211_channel *channels[] __counted_by(n_channels);
25482547 };
25492548
25502549 static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
@@ -2616,7 +2615,7 @@ struct cfg80211_bss_select_adjust { · 65 unmodified lines
26162615 * @scan_width: channel width for scanning
26172616 * @ie: optional information element(s) to add into Probe Request or %NULL
26182617 * @ie_len: length of ie in octets
2619− * @flags: bit field of flags controlling operation
2618+ * @flags: control flags from &enum nl80211_scan_flags
26202619 * @match_sets: sets of parameters to be matched for a scan result
26212620 * entry to be considered valid and to be passed to the host
26222621 * (others are filtered out).
@@ -3948,7 +3947,7 @@ struct cfg80211_pmsr_request { · 1325 unmodified lines
39483947
39493948 struct list_head list;
39503949
3951− struct cfg80211_pmsr_request_peer peers[];
3950+ struct cfg80211_pmsr_request_peer peers[] __counted_by(n_peers);
39523951 };
39533952
39543953 /**
@@ -8118,7 +8117,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, · 4163 unmodified lines
81188117 * @link_id: the ID of the link the frame was received on
81198118 * @buf: Management frame (header + body)
81208119 * @len: length of the frame data
8121− * @flags: flags, as defined in enum nl80211_rxmgmt_flags
8120+ * @flags: flags, as defined in &enum nl80211_rxmgmt_flags
81228121 * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds
81238122 * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds
81248123 */
include/net/ieee80211_radiotap.h+2−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #include <asm/unaligned.h>
2222
2323 /**
24− * struct ieee82011_radiotap_header - base radiotap header
24+ * struct ieee80211_radiotap_header - base radiotap header
2525 */
2626 struct ieee80211_radiotap_header {
2727 /**
@@ -575,6 +575,7 @@ enum ieee80211_radiotap_eht_usig_tb { · 547 unmodified lines
575575
576576 /**
577577 * ieee80211_get_radiotap_len - get radiotap header length
578+ * @data: pointer to the header
578579 */
579580 static inline u16 ieee80211_get_radiotap_len(const char *data)
580581 {
include/net/iw_handler.h+2−9
@@ -426,17 +426,10 @@ struct iw_public_data { · 425 unmodified lines
426426
427427 /**************************** PROTOTYPES ****************************/
428428 /*
429− * Functions part of the Wireless Extensions (defined in net/core/wireless.c).
430− * Those may be called only within the kernel.
429+ * Functions part of the Wireless Extensions (defined in net/wireless/wext-core.c).
430+ * Those may be called by driver modules.
431431 */
432432
433−/* First : function strictly used inside the kernel */
434−
435−/* Handle /proc/net/wireless, called in net/code/dev.c */
436−int dev_get_wireless_info(char *buffer, char **start, off_t offset, int length);
437−
438−/* Second : functions that may be called by driver modules */
439−
440433 /* Send a single event to user space */
441434 void wireless_send_event(struct net_device *dev, unsigned int cmd,
442435 union iwreq_data *wrqu, const char *extra);
include/net/mac80211.h+4−1
@@ -1192,9 +1192,11 @@ struct ieee80211_tx_info { · 1191 unmodified lines
11921192 u8 ampdu_ack_len;
11931193 u8 ampdu_len;
11941194 u8 antenna;
1195+ u8 pad;
11951196 u16 tx_time;
11961197 u8 flags;
1197− void *status_driver_data[18 / sizeof(void *)];
1198+ u8 pad2;
1199+ void *status_driver_data[16 / sizeof(void *)];
11981200 } status;
11991201 struct {
12001202 struct ieee80211_tx_rate driver_rates[
@@ -2259,6 +2261,7 @@ struct ieee80211_sta_aggregates { · 1058 unmodified lines
22592261 * @he_cap: HE capabilities of this STA
22602262 * @he_6ghz_capa: on 6 GHz, holds the HE 6 GHz band capabilities
22612263 * @eht_cap: EHT capabilities of this STA
2264+ * @agg: per-link data for multi-link aggregation
22622265 * @bandwidth: current bandwidth the station can receive with
22632266 * @rx_nss: in HT/VHT, the maximum number of spatial streams the
22642267 * station can receive at the moment, changed by operating mode
net/mac80211/cfg.c+14−13
@@ -3648,12 +3648,6 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) · 3647 unmodified lines
36483648 lockdep_assert_held(&local->mtx);
36493649 lockdep_assert_held(&local->chanctx_mtx);
36503650
3651− if (sdata->vif.bss_conf.eht_puncturing != sdata->vif.bss_conf.csa_punct_bitmap) {
3652− sdata->vif.bss_conf.eht_puncturing =
3653− sdata->vif.bss_conf.csa_punct_bitmap;
3654− changed |= BSS_CHANGED_EHT_PUNCTURING;
3655− }
3656−
36573651 /*
36583652 * using reservation isn't immediate as it may be deferred until later
36593653 * with multi-vif. once reservation is complete it will re-schedule the
@@ -3683,6 +3677,12 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) · 23 unmodified lines
36833677 if (err)
36843678 return err;
36853679
3680+ if (sdata->vif.bss_conf.eht_puncturing != sdata->vif.bss_conf.csa_punct_bitmap) {
3681+ sdata->vif.bss_conf.eht_puncturing =
3682+ sdata->vif.bss_conf.csa_punct_bitmap;
3683+ changed |= BSS_CHANGED_EHT_PUNCTURING;
3684+ }
3685+
36863686 ieee80211_link_info_change_notify(sdata, &sdata->deflink, changed);
36873687
36883688 if (sdata->deflink.csa_block_tx) {
@@ -4133,19 +4133,20 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev, · 444 unmodified lines
41334133 mutex_lock(&local->mtx);
41344134
41354135 rcu_read_lock();
4136+ sta = sta_info_get_bss(sdata, peer);
4137+ if (!sta) {
4138+ ret = -ENOLINK;
4139+ goto unlock;
4140+ }
4141+
4142+ qos = sta->sta.wme;
4143+
41364144 chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
41374145 if (WARN_ON(!chanctx_conf)) {
41384146 ret = -EINVAL;
41394147 goto unlock;
41404148 }
41414149 band = chanctx_conf->def.chan->band;
4142− sta = sta_info_get_bss(sdata, peer);
4143− if (sta) {
4144− qos = sta->sta.wme;
4145− } else {
4146− ret = -ENOLINK;
4147− goto unlock;
4148− }
41494150
41504151 if (qos) {
41514152 fc = cpu_to_le16(IEEE80211_FTYPE_DATA |
net/mac80211/fils_aead.c+1−1
@@ -5,9 +5,9 @@ · 4 unmodified lines
55 */
66
77 #include <crypto/aes.h>
8−#include <crypto/algapi.h>
98 #include <crypto/hash.h>
109 #include <crypto/skcipher.h>
10+#include <crypto/utils.h>
1111
1212 #include "ieee80211_i.h"
1313 #include "aes_cmac.h"
net/mac80211/ieee80211_i.h+0−2
@@ -1872,7 +1872,6 @@ void ieee80211_send_pspoll(struct ieee80211_local *local, · 1871 unmodified lines
18721872 struct ieee80211_sub_if_data *sdata);
18731873 void ieee80211_recalc_ps(struct ieee80211_local *local);
18741874 void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata);
1875−int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
18761875 void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
18771876 void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
18781877 struct sk_buff *skb);
@@ -2564,7 +2563,6 @@ void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, · 685 unmodified lines
25642563 struct ieee80211_link_data *rsvd_for);
25652564 bool ieee80211_is_radar_required(struct ieee80211_local *local);
25662565
2567−void ieee80211_dfs_cac_timer(unsigned long data);
25682566 void ieee80211_dfs_cac_timer_work(struct work_struct *work);
25692567 void ieee80211_dfs_cac_cancel(struct ieee80211_local *local);
25702568 void ieee80211_dfs_radar_detected_work(struct work_struct *work);
net/mac80211/key.c+1−1
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 * Copyright 2018-2020, 2022-2023 Intel Corporation
1010 */
1111
12+#include <crypto/utils.h>
1213 #include <linux/if_ether.h>
1314 #include <linux/etherdevice.h>
1415 #include <linux/list.h>
@@ -17,7 +18,6 @@ · 2 unmodified lines
1718 #include <linux/slab.h>
1819 #include <linux/export.h>
1920 #include <net/mac80211.h>
20−#include <crypto/algapi.h>
2121 #include <asm/unaligned.h>
2222 #include "ieee80211_i.h"
2323 #include "driver-ops.h"
net/mac80211/mesh.h+0−1
@@ -212,7 +212,6 @@ int mesh_rmc_check(struct ieee80211_sub_if_data *sdata, · 211 unmodified lines
212212 const u8 *addr, struct ieee80211s_hdr *mesh_hdr);
213213 bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
214214 struct ieee802_11_elems *ie);
215−void mesh_ids_set_default(struct ieee80211_if_mesh *mesh);
216215 int mesh_add_meshconf_ie(struct ieee80211_sub_if_data *sdata,
217216 struct sk_buff *skb);
218217 int mesh_add_meshid_ie(struct ieee80211_sub_if_data *sdata,
net/mac80211/rx.c+4−0
@@ -3734,6 +3734,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) · 3733 unmodified lines
37343734 break;
37353735 goto queue;
37363736 case WLAN_CATEGORY_S1G:
3737+ if (len < offsetofend(typeof(*mgmt),
3738+ u.action.u.s1g.action_code))
3739+ break;
3740+
37373741 switch (mgmt->u.action.u.s1g.action_code) {
37383742 case WLAN_S1G_TWT_SETUP:
37393743 case WLAN_S1G_TWT_TEARDOWN:
net/mac80211/wpa.c+1−1
@@ -15,7 +15,7 @@ · 14 unmodified lines
1515 #include <asm/unaligned.h>
1616 #include <net/mac80211.h>
1717 #include <crypto/aes.h>
18−#include <crypto/algapi.h>
18+#include <crypto/utils.h>
1919
2020 #include "ieee80211_i.h"
2121 #include "michael.h"
net/wireless/core.h+1−1
@@ -298,7 +298,7 @@ struct cfg80211_cqm_config { · 297 unmodified lines
298298 u32 rssi_hyst;
299299 s32 last_rssi_event_value;
300300 int n_rssi_thresholds;
301− s32 rssi_thresholds[];
301+ s32 rssi_thresholds[] __counted_by(n_rssi_thresholds);
302302 };
303303
304304 void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev);
net/wireless/mlme.c+13−0
@@ -281,6 +281,11 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, · 280 unmodified lines
281281 ether_addr_equal(req->bss->bssid, wdev->u.client.connected_addr))
282282 return -EALREADY;
283283
284+ if (ether_addr_equal(req->bss->bssid, dev->dev_addr) ||
285+ (req->link_id >= 0 &&
286+ ether_addr_equal(req->ap_mld_addr, dev->dev_addr)))
287+ return -EINVAL;
288+
284289 return rdev_auth(rdev, dev, req);
285290 }
286291
@@ -335,6 +340,9 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, · 48 unmodified lines
335340 if (req->links[i].bss == req->links[j].bss)
336341 return -EINVAL;
337342 }
343+
344+ if (ether_addr_equal(req->links[i].bss->bssid, dev->dev_addr))
345+ return -EINVAL;
338346 }
339347
340348 if (wdev->connected &&
@@ -342,6 +350,11 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, · 1 unmodified line
342350 !ether_addr_equal(wdev->u.client.connected_addr, req->prev_bssid)))
343351 return -EALREADY;
344352
353+ if ((req->bss && ether_addr_equal(req->bss->bssid, dev->dev_addr)) ||
354+ (req->link_id >= 0 &&
355+ ether_addr_equal(req->ap_mld_addr, dev->dev_addr)))
356+ return -EINVAL;
357+
345358 cfg80211_oper_and_ht_capa(&req->ht_capa_mask,
346359 rdev->wiphy.ht_capa_mod_mask);
347360 cfg80211_oper_and_vht_capa(&req->vht_capa_mask,
net/wireless/nl80211.c+4−4
@@ -323,6 +323,7 @@ nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = { · 322 unmodified lines
323323 [NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED] = { .type = NLA_FLAG },
324324 [NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED] = { .type = NLA_FLAG },
325325 [NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK] = { .type = NLA_FLAG },
326+ [NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR] = { .type = NLA_U8 },
326327 };
327328
328329 static const struct nla_policy
@@ -4889,13 +4890,12 @@ static struct cfg80211_acl_data *parse_acl_data(struct wiphy *wiphy, · 4560 unmodified lines
48894890 acl = kzalloc(struct_size(acl, mac_addrs, n_entries), GFP_KERNEL);
48904891 if (!acl)
48914892 return ERR_PTR(-ENOMEM);
4893+ acl->n_acl_entries = n_entries;
48924894
48934895 nla_for_each_nested(attr, info->attrs[NL80211_ATTR_MAC_ADDRS], tmp) {
48944896 memcpy(acl->mac_addrs[i].addr, nla_data(attr), ETH_ALEN);
48954897 i++;
48964898 }
4897−
4898− acl->n_acl_entries = n_entries;
48994899 acl->acl_policy = acl_policy;
49004900
49014901 return acl;
@@ -5439,13 +5439,13 @@ nl80211_parse_mbssid_elems(struct wiphy *wiphy, struct nlattr *attrs) · 537 unmodified lines
54395439 elems = kzalloc(struct_size(elems, elem, num_elems), GFP_KERNEL);
54405440 if (!elems)
54415441 return ERR_PTR(-ENOMEM);
5442+ elems->cnt = num_elems;
54425443
54435444 nla_for_each_nested(nl_elems, attrs, rem_elems) {
54445445 elems->elem[i].data = nla_data(nl_elems);
54455446 elems->elem[i].len = nla_len(nl_elems);
54465447 i++;
54475448 }
5448− elems->cnt = num_elems;
54495449 return elems;
54505450 }
54515451
@@ -5471,13 +5471,13 @@ nl80211_parse_rnr_elems(struct wiphy *wiphy, struct nlattr *attrs, · 19 unmodified lines
54715471 elems = kzalloc(struct_size(elems, elem, num_elems), GFP_KERNEL);
54725472 if (!elems)
54735473 return ERR_PTR(-ENOMEM);
5474+ elems->cnt = num_elems;
54745475
54755476 nla_for_each_nested(nl_elems, attrs, rem_elems) {
54765477 elems->elem[i].data = nla_data(nl_elems);
54775478 elems->elem[i].len = nla_len(nl_elems);
54785479 i++;
54795480 }
5480− elems->cnt = num_elems;
54815481 return elems;
54825482 }
54835483
net/wireless/nl80211.h+0−1
@@ -120,6 +120,5 @@ void cfg80211_rdev_free_coalesce(struct cfg80211_registered_device *rdev); · 119 unmodified lines
120120
121121 /* peer measurement */
122122 int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info);
123−int nl80211_pmsr_dump_results(struct sk_buff *skb, struct netlink_callback *cb);
124123
125124 #endif /* __NET_WIRELESS_NL80211_H */
net/wireless/ocb.c+3−0
@@ -68,6 +68,9 @@ int __cfg80211_leave_ocb(struct cfg80211_registered_device *rdev, · 67 unmodified lines
6868 if (!rdev->ops->leave_ocb)
6969 return -EOPNOTSUPP;
7070
71+ if (!wdev->u.ocb.chandef.chan)
72+ return -ENOTCONN;
73+
7174 err = rdev_leave_ocb(rdev, dev);
7275 if (!err)
7376 memset(&wdev->u.ocb.chandef, 0, sizeof(wdev->u.ocb.chandef));
net/wireless/pmsr.c+1−2
@@ -291,6 +291,7 @@ int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info) · 290 unmodified lines
291291 req = kzalloc(struct_size(req, peers, count), GFP_KERNEL);
292292 if (!req)
293293 return -ENOMEM;
294+ req->n_peers = count;
294295
295296 if (info->attrs[NL80211_ATTR_TIMEOUT])
296297 req->timeout = nla_get_u32(info->attrs[NL80211_ATTR_TIMEOUT]);
@@ -321,8 +322,6 @@ int nl80211_pmsr_start(struct sk_buff *skb, struct genl_info *info) · 24 unmodified lines
321322 goto out_err;
322323 idx++;
323324 }
324−
325− req->n_peers = count;
326325 req->cookie = cfg80211_assign_cookie(rdev);
327326 req->nl_portid = info->snd_portid;
328327

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