Skip to content

Commit 096cbe3

Browse files
repkjglathe
authored andcommitted
wifi: BIG SQUASH of ath related branch into 1 commit
Not-signed-off-by: "Jens Glathe <[email protected]>" wifi: mac80211: Update skb's NULL key in ieee80211_tx_h_select_key() The ieee80211 skb control block key (set when skb was queued) could have been removed before ieee80211_tx_dequeue() call. ieee80211_tx_dequeue() already called ieee80211_tx_h_select_key() to get the current key, but the latter do not update the key in skb control block in case it is NULL. Because some drivers actually use this key in their TX callbacks (e.g. ath1{1,2}k_mac_op_tx()) this could lead to the use after free below: BUG: KASAN: slab-use-after-free in ath11k_mac_op_tx+0x590/0x61c Read of size 4 at addr ffffff803083c248 by task kworker/u16:4/1440 CPU: 3 UID: 0 PID: 1440 Comm: kworker/u16:4 Not tainted 6.13.0-ge128f627f404 #2 Hardware name: HW (DT) Workqueue: bat_events batadv_send_outstanding_bcast_packet Call trace: show_stack+0x14/0x1c (C) dump_stack_lvl+0x58/0x74 print_report+0x164/0x4c0 kasan_report+0xac/0xe8 __asan_report_load4_noabort+0x1c/0x24 ath11k_mac_op_tx+0x590/0x61c ieee80211_handle_wake_tx_queue+0x12c/0x1c8 ieee80211_queue_skb+0xdcc/0x1b4c ieee80211_tx+0x1ec/0x2bc ieee80211_xmit+0x224/0x324 __ieee80211_subif_start_xmit+0x85c/0xcf8 ieee80211_subif_start_xmit+0xc0/0xec4 dev_hard_start_xmit+0xf4/0x28c __dev_queue_xmit+0x6ac/0x318c batadv_send_skb_packet+0x38c/0x4b0 batadv_send_outstanding_bcast_packet+0x110/0x328 process_one_work+0x578/0xc10 worker_thread+0x4bc/0xc7c kthread+0x2f8/0x380 ret_from_fork+0x10/0x20 Allocated by task 1906: kasan_save_stack+0x28/0x4c kasan_save_track+0x1c/0x40 kasan_save_alloc_info+0x3c/0x4c __kasan_kmalloc+0xac/0xb0 __kmalloc_noprof+0x1b4/0x380 ieee80211_key_alloc+0x3c/0xb64 ieee80211_add_key+0x1b4/0x71c nl80211_new_key+0x2b4/0x5d8 genl_family_rcv_msg_doit+0x198/0x240 <...> Freed by task 1494: kasan_save_stack+0x28/0x4c kasan_save_track+0x1c/0x40 kasan_save_free_info+0x48/0x94 __kasan_slab_free+0x48/0x60 kfree+0xc8/0x31c kfree_sensitive+0x70/0x80 ieee80211_key_free_common+0x10c/0x174 ieee80211_free_keys+0x188/0x46c ieee80211_stop_mesh+0x70/0x2cc ieee80211_leave_mesh+0x1c/0x60 cfg80211_leave_mesh+0xe0/0x280 cfg80211_leave+0x1e0/0x244 <...> Update SKB control block key even when key is NULL to avoid that. Signed-off-by: Remi Pommarel <[email protected]> wifi: mac80211: Purge vif txq in ieee80211_do_stop() After ieee80211_do_stop() SKB from vif's txq could still be processed. Indeed another concurrent vif schedule_and_wake_txq call could cause those packets to be dequeued (see ieee80211_handle_wake_tx_queue()) without checking the sdata current state. Because vif.drv_priv is now cleared in this function, this could lead to driver crash. For example in ath12k, ahvif is store in vif.drv_priv. Thus if ath12k_mac_op_tx() is called after ieee80211_do_stop(), ahvif->ah can be NULL, leading the ath12k_warn(ahvif->ah,...) call in this function to trigger the NULL deref below. Unable to handle kernel paging request at virtual address dfffffc000000001 KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] batman_adv: bat0: Interface deactivated: brbh1337 Mem abort info: ESR = 0x0000000096000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [dfffffc000000001] address between user and kernel address ranges Internal error: Oops: 0000000096000004 [#1] SMP CPU: 1 UID: 0 PID: 978 Comm: lbd Not tainted 6.13.0-g633f875b8f1e #114 Hardware name: HW (DT) pstate: 10000005 (nzcV daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : ath12k_mac_op_tx+0x6cc/0x29b8 [ath12k] lr : ath12k_mac_op_tx+0x174/0x29b8 [ath12k] sp : ffffffc086ace450 x29: ffffffc086ace450 x28: 0000000000000000 x27: 1ffffff810d59ca4 x26: ffffff801d05f7c0 x25: 0000000000000000 x24: 000000004000001e x23: ffffff8009ce4926 x22: ffffff801f9c0800 x21: ffffff801d05f7f0 x20: ffffff8034a19f40 x19: 0000000000000000 x18: ffffff801f9c0958 x17: ffffff800bc0a504 x16: dfffffc000000000 x15: ffffffc086ace4f8 x14: ffffff801d05f83c x13: 0000000000000000 x12: ffffffb003a0bf03 x11: 0000000000000000 x10: ffffffb003a0bf02 x9 : ffffff8034a19f40 x8 : ffffff801d05f818 x7 : 1ffffff0069433dc x6 : ffffff8034a19ee0 x5 : ffffff801d05f7f0 x4 : 0000000000000000 x3 : 0000000000000001 x2 : 0000000000000000 x1 : dfffffc000000000 x0 : 0000000000000008 Call trace: ath12k_mac_op_tx+0x6cc/0x29b8 [ath12k] (P) ieee80211_handle_wake_tx_queue+0x16c/0x260 ieee80211_queue_skb+0xeec/0x1d20 ieee80211_tx+0x200/0x2c8 ieee80211_xmit+0x22c/0x338 __ieee80211_subif_start_xmit+0x7e8/0xc60 ieee80211_subif_start_xmit+0xc4/0xee0 __ieee80211_subif_start_xmit_8023.isra.0+0x854/0x17a0 ieee80211_subif_start_xmit_8023+0x124/0x488 dev_hard_start_xmit+0x160/0x5a8 __dev_queue_xmit+0x6f8/0x3120 br_dev_queue_push_xmit+0x120/0x4a8 __br_forward+0xe4/0x2b0 deliver_clone+0x5c/0xd0 br_flood+0x398/0x580 br_dev_xmit+0x454/0x9f8 dev_hard_start_xmit+0x160/0x5a8 __dev_queue_xmit+0x6f8/0x3120 ip6_finish_output2+0xc28/0x1b60 __ip6_finish_output+0x38c/0x638 ip6_output+0x1b4/0x338 ip6_local_out+0x7c/0xa8 ip6_send_skb+0x7c/0x1b0 ip6_push_pending_frames+0x94/0xd0 rawv6_sendmsg+0x1a98/0x2898 inet_sendmsg+0x94/0xe0 __sys_sendto+0x1e4/0x308 __arm64_sys_sendto+0xc4/0x140 do_el0_svc+0x110/0x280 el0_svc+0x20/0x60 el0t_64_sync_handler+0x104/0x138 el0t_64_sync+0x154/0x158 To avoid that, empty vif's txq at ieee80211_do_stop() so no packet could be dequeued after ieee80211_do_stop() (new packets cannot be queued because SDATA_STATE_RUNNING is cleared at this point). Signed-off-by: Remi Pommarel <[email protected]> wifi: ath9k: cleanup struct ath_tx_control and ath_tx_prepare() After switching to mac80211 software queues, pointer to 'struct ath_node' in 'struct ath_tx_control' is still assigned but not actually used. So drop it and cleanup related things in 'ath_tx_prepare()'. Compile tested only. Signed-off-by: Dmitry Antipov <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath9k: use unsigned long for activity check timestamp Since 'rx_active_check_time' of 'struct ath_softc' is in jiffies, prefer 'unsigned long' over 'u32' to avoid possible truncation in 'ath_hw_rx_inactive_check()'. Found with clang's -Wshorten-64-to-32, compile tested only. Signed-off-by: Dmitry Antipov <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Refactor the monitor Rx parser handler argument Currently, the monitor Rx parser handlers ath12k_dp_mon_rx_parse_status_tlv() and ath12k_dp_mon_parse_rx_dest() take the device handle from the caller. However, these handlers functionality is technically pdev specific. Additionally, the device handle can be retrieved from the pdev handle. Therefore, for better code understanding, change the monitor Rx parser handlers argument from the device handle to the pdev handle. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Karthikeyan Periyasamy <[email protected]> Acked-by: Kalle Valo <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Refactor the monitor Tx/RX handler procedure arguments Currently, the pdev handle is given along with the mac id to all the monitor Tx/Rx handler procedure arguments. The mac id information is derived from the pdev handle itself. Therefore, remove the unnecessary mac id argument from the handler. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Karthikeyan Periyasamy <[email protected]> Acked-by: Kalle Valo <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Refactor Rx status TLV parsing procedure argument Currently, ath12k_dp_mon_rx_parse_status_tlv() takes the TLV tag, TLV data and TLV userid as separate arguments from the caller. In the future, the TLV length will be needed for parsing the EHT TLV tag. Therefore, instead of increasing the number of arguments, pass the TLV header and retrieve the necessary fields from the TLV header itself. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Karthikeyan Periyasamy <[email protected]> Acked-by: Kalle Valo <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath11k: Fix DMA buffer allocation to resolve SWIOTLB issues Currently, the driver allocates cacheable DMA buffers for rings like HAL_REO_DST and HAL_WBM2SW_RELEASE. The buffers for HAL_WBM2SW_RELEASE are large (1024 KiB), exceeding the SWIOTLB slot size of 256 KiB. This leads to "swiotlb buffer is full" error messages on systems without an IOMMU that use SWIOTLB, causing driver initialization failures. The driver calls dma_map_single() with these large buffers obtained from kzalloc(), resulting in ring initialization errors on systems without an IOMMU that use SWIOTLB. To address these issues, replace the flawed buffer allocation mechanism with the appropriate DMA API. Specifically, use dma_alloc_noncoherent() for cacheable DMA buffers, ensuring proper freeing of buffers with dma_free_noncoherent(). Error log: [ 10.194343] ath11k_pci 0000:04:00.0: swiotlb buffer is full (sz:1048583 bytes), total 32768 (slots), used 2529 (slots) [ 10.194406] ath11k_pci 0000:04:00.0: failed to set up tcl_comp ring (0) :-12 [ 10.194781] ath11k_pci 0000:04:00.0: failed to init DP: -12 Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 Reported-by: Tim Harvey <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: P Praneesh <[email protected]> Tested-by: Tim Harvey <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath11k: Use dma_alloc_noncoherent for rx_tid buffer allocation Currently, the driver allocates cacheable DMA buffers for the rx_tid structure using kzalloc() and dma_map_single(). These buffers are long-lived and can persist for the lifetime of the peer, which is not advisable. Instead of using kzalloc() and dma_map_single() for allocating cacheable DMA buffers, utilize the dma_alloc_noncoherent() helper for the allocation of long-lived cacheable DMA buffers, such as the peer's rx_tid. Since dma_alloc_noncoherent() returns unaligned physical and virtual addresses, align them internally before use within the driver. This ensures proper allocation of non-coherent memory through the kernel helper. Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 Signed-off-by: P Praneesh <[email protected]> Tested-by: Tim Harvey <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath: create common testmode_i.h file for ath drivers User space application requires that the testmode interface is exactly same between ath drivers. Move testmode_i.h file in ath directory to ensure that all ath driver uses same testmode interface instead of duplicating testmode_i.h for each ath drivers. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aaradhana Sahu <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: export ath12k_wmi_tlv_hdr for testmode Export ath12k_wmi_tlv_hdr() to further use in the testmode command processing. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aaradhana Sahu <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: add factory test mode support Add support to process factory test mode commands(FTM) for calibration. By default firmware start with MISSION mode and to process the FTM commands firmware needs to be restarted in FTM mode using module parameter ftm_mode. The pre-request is all the radios should be down before starting the test. All ath12k test mode interface related commands specified in enum ath_tm_cmd. When start command ATH_TM_CMD_TESTMODE_START is received, ar state is set to test Mode and FTM daemon sends test mode command to wifi driver via cfg80211. Wifi driver sends these command to firmware as wmi events. If it is segmented commands it will be broken down into multiple segments and encoded with TLV header else it is sent to firmware as it is. Firmware response via UTF events, wifi driver creates skb and send to cfg80211, cfg80211 sends firmware response to FTM daemon via netlink message. Command to boot in ftm mode insmod ath12k ftm_mode=1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aaradhana Sahu <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Disable MLO in Factory Test Mode Factory test mode(FTM) is supported only in non-MLO(multi-link operation) mode. Therefore, disable MLO when driver boots in FTM mode. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aaradhana Sahu <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: fix skb_ext_desc leak in ath12k_dp_tx() error path When vlan support was added, we missed that when ath12k_dp_prepare_htt_metadata() returns an error we also need to free the skb holding the metadata before going on with the cleanup process. Compile tested only. Fixes: 26dd8ccdba4d ("wifi: ath12k: dynamic VLAN support") Signed-off-by: Nicolas Escande <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: report station mode transmit rate Currently, the transmit rate of "iw dev xxx station dump" command always show an invalid value. To address this issue, ath12k parse the info of transmit complete report from firmware and indicate the transmit rate to mac80211. This patch affects the station mode of WCN7850 and QCN9274. After that, "iw dev xxx station dump" show the correct transmit rate. Such as: Station 00:03:7f:12:03:03 (on wlo1) inactive time: 872 ms rx bytes: 219111 rx packets: 1133 tx bytes: 53767 tx packets: 462 tx retries: 51 tx failed: 0 beacon loss: 0 beacon rx: 403 rx drop misc: 74 signal: -95 dBm beacon signal avg: -18 dBm tx bitrate: 1441.1 MBit/s 80MHz EHT-MCS 13 EHT-NSS 2 EHT-GI 0 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00214-QCAHKSWPL_SILICONZ-1 Signed-off-by: Lingbo Kong <[email protected]> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219715 Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: report station mode receive rate for IEEE 802.11be Currently, the receive rate of EHT of "iw dev xxx station dump" command always show an invalid value. This is because ath12k does not pass information about the rx_status of EHT to mac80211. So, mac80211 not calculate the receive rate. To address this issue, add logic for handling rx_status of EHT to the ath12k_dp_rx_h_rate() function. After that, "iw dev xxx station dump" show the correct receive rate. Such as: Station 00:03:7f:12:03:03 (on wlo1) inactive time: 48 ms rx bytes: 59226 rx packets: 320 tx bytes: 26556 tx packets: 191 tx retries: 99 tx failed: 0 beacon loss: 0 beacon rx: 79 rx drop misc: 68 signal: -95 dBm beacon signal avg: -20 dBm tx bitrate: 688.2 MBit/s 40MHz EHT-MCS 13 EHT-NSS 2 EHT-GI 0 tx duration: 0 us rx bitrate: 619.5 MBit/s 40MHz EHT-MCS 8 EHT-NSS 3 EHT-GI 0 This patch affects the station mode of WCN7850 and QCN9274. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00214-QCAHKSWPL_SILICONZ-1 Signed-off-by: Lingbo Kong <[email protected]> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219715 Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: report station mode signal strength Currently, the signal strength of "iw dev xxx station dump" always show an invalid value. This is because signal strength is only set in ath12k_mgmt_rx_event() function, and not set for received data packet. So, change to get signal from firmware and report to mac80211. After that, "iw dev xxx station dump" show the correct signal strength. Such as: Station 00:03:7f:12:03:03 (on wlo1) inactive time: 36 ms rx bytes: 61571 rx packets: 336 tx bytes: 28204 tx packets: 205 tx retries: 49 tx failed: 0 beacon loss: 0 beacon rx: 83 rx drop misc: 66 signal: -24 dBm beacon signal avg: -22 dBm For WCN7850, the firmware supports db2dbm, so not need to add noise floor. For QCN9274, the firmware not support db2dbm, so need to add noise floor. This patch affects the station mode of WCN7850 and QCN9274. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00214-QCAHKSWPL_SILICONZ-1 Signed-off-by: Lingbo Kong <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath11k: fix memory leak in ath11k_xxx_remove() The firmware memory was allocated in ath11k_pci_probe() or ath11k_ahb_probe(), but not freed in ath11k_xxx_remove() in case ATH11K_FLAG_QMI_FAIL bit is set. So call ath11k_fw_destroy() to free the memory. Found while fixing the same problem in ath12k: https://lore.kernel.org/linux-wireless/[email protected] Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04546-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1 Signed-off-by: Miaoqing Pan <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: encode max Tx power in scan channel list command Currently, when sending the scan channel list command to the firmware, the maximum Tx power is not encoded in the reg2 member. This omission causes the firmware to be unaware of the host's maximum Tx power, leading to incorrect Tx power derivation at firmware level. To resolve this issue, encode the maximum Tx power in the scan channel list command before sending it to firmware. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Signed-off-by: Sathishkumar Muruganandam <[email protected]> Signed-off-by: Aditya Kumar Singh <[email protected]> Tested-by: Nicolas Escande <[email protected]> Link: https://patch.msgid.link/20250107-add_max_reg_pwr_in_scan_ch_list_cmd-v1-1-70d9963a21e4@quicinc.com Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: fix memory leak in ath12k_pci_remove() Kmemleak reported this error: unreferenced object 0xffff1c165cec3060 (size 32): comm "insmod", pid 560, jiffies 4296964570 (age 235.596s) backtrace: [<000000005434db68>] __kmem_cache_alloc_node+0x1f4/0x2c0 [<000000001203b155>] kmalloc_trace+0x40/0x88 [<0000000028adc9c8>] _request_firmware+0xb8/0x608 [<00000000cad1aef7>] firmware_request_nowarn+0x50/0x80 [<000000005011a682>] local_pci_probe+0x48/0xd0 [<00000000077cd295>] pci_device_probe+0xb4/0x200 [<0000000087184c94>] really_probe+0x150/0x2c0 The firmware memory was allocated in ath12k_pci_probe(), but not freed in ath12k_pci_remove() in case ATH12K_FLAG_QMI_FAIL bit is set. So call ath12k_fw_unmap() to free the memory. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.2.0-02280-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1 Signed-off-by: Miaoqing Pan <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Request vdev stats from firmware Add support to request and print vdev stats from firmware through WMI. Sample output: ------------- cat /sys/kernel/debug/ath12k/pci-0000\:06\:00.0/mac0/fw_stats/vdev_stats ath12k VDEV stats ================= VDEV ID 0 VDEV MAC address 00:03:7f:6c:9c:1a beacon snr 96 data snr 255 num rx frames 0 num rts fail 0 num rts success 0 num rx err 0 num rx discard 0 num tx not acked 0 num tx frames [00] 0 num tx frames [01] 0 num tx frames [02] 0 num tx frames [03] 2 num tx frames retries [00] 0 num tx frames retries [01] 0 num tx frames retries [02] 0 num tx frames retries [03] 0 num tx frames failures [00] 0 num tx frames failures [01] 0 num tx frames failures [02] 0 num tx frames failures [03] 0 tx rate history [00] 0x00000000 tx rate history [01] 0x00000000 tx rate history [02] 0x00000000 tx rate history [03] 0x00000000 tx rate history [04] 0x00000000 tx rate history [05] 0x00000000 tx rate history [06] 0x00000000 tx rate history [07] 0x00000000 tx rate history [08] 0x00000000 tx rate history [09] 0x00000000 beacon rssi history [00] 0 beacon rssi history [01] 0 beacon rssi history [02] 0 beacon rssi history [03] 0 beacon rssi history [04] 0 beacon rssi history [05] 0 beacon rssi history [06] 0 beacon rssi history [07] 0 beacon rssi history [08] 0 beacon rssi history [09] 0 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Ramya Gnanasekar <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Request beacon stats from firmware Add support to request and dump beacon statistics from firmware Sample output: ------------- cat /sys/kernel/debug/ath12k/pci-0000:06:00.0/mac0/fw_stats/beacon_stats ath12k Beacon stats (1) =================== VDEV ID 0 VDEV MAC address 00:03:7f:04:37:58 ================ Num of beacon tx success 20 Num of beacon tx failures 0 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Ramya Gnanasekar <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Request pdev stats from firmware Add support to request pdev stats from firmware through WMI and print the information Sample Output: ------------- cat /sys/kernel/debug/ath12k/pci-0000\:06\:00.0/mac0/fw_stats/pdev_stats ath12k PDEV stats ================= Channel noise floor -85 Channel TX power 126 TX frame count 0 RX frame count 8637 RX clear count 37424 Cycle count 4372024 PHY error count 0 soc drop count 0 ath12k PDEV TX stats ==================== HTT cookies queued 0 HTT cookies disp. 0 MSDU queued 0 MPDU queued 0 MSDUs dropped 0 Local enqued 0 Local freed 0 HW queued 0 PPDUs reaped 0 Num underruns 0 PPDUs cleaned 0 MPDUs requeued 0 Excessive retries 0 HW rate 0 Sched self triggers 0 Dropped due to SW retries 0 Illegal rate phy errors 0 PDEV continuous xretry 0 TX timeout 9 PDEV resets 0 Stateless TIDs alloc failures 0 PHY underrun 0 MPDU is more than txop limit 0 ath12k PDEV RX stats ==================== Mid PPDU route change 0 Tot. number of statuses 0 Extra frags on rings 0 0 Extra frags on rings 1 0 Extra frags on rings 2 0 Extra frags on rings 3 0 MSDUs delivered to HTT 0 MPDUs delivered to HTT 0 MSDUs delivered to stack 0 MPDUs delivered to stack 0 Oversized AMSUs 0 PHY errors 0 PHY errors drops 0 MPDU errors (FCS, MIC, ENC) 0 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Ramya Gnanasekar <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Fix pdev lookup in WBM error processing Currently in ath12k_dp_rx_process_wbm_err(), when processing packets received on the WBM error ring, pdev validation is done based upon the hw_link_id. But hw_link_id corresponds to link id of a given partner pdev in a MLO hardware group, and is not the correct index to use to lookup a pdev in an SoC(ab). As a result, pdev validation fails, and the reaped packets are dropped instead of being processed. The correct index to use is the pdev_id, which is already derived in the function. So update the logic to validate the pdev based upon the pdev_id instead of the hw_link_id. This matches the logic used in other Rx ring processing functions. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Fixes: 1a73acb5fba4 ("wifi: ath12k: move to HW link id based receive handling") Signed-off-by: Rameshkumar Sundaram <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Add HTT source ring ID for monitor rings Add source buffer ring and destination buffer ring ID for monitor rings. These IDs are used for ring configuration during initial ring setup. Since monitor rings are enabled based on the rxdma1_enable flag, enable it in the hardware param for the QCN9274 version 2 hardware and increase the destination ring size to handle MSDU data buffers. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Enable filter config for monitor destination ring Add provision to configure monitor filter for the destination ring. These filters are used for requesting statistics or monitor mode through the monitor destination ring. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Avoid multiple times configuring monitor filter ath12k_mac_op_configure_filter() gets called multiple times during interface bringup. Applying filter configuration from this function leads to writing same filter configurations multiple times. Resolve this issue by relocating the filter configuration to ath12k_mac_config_mon_status_default(), which is invoked by both ath12k_mac_op_start() and ath12k_mac_op_stop(). Additionally, set the rxmon_disable flag to true when called from ath12k_mac_op_stop() to disable the monitor destination ring. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Avoid code duplication in monitor ring processing The current implementation processes the monitor destination ring using two separate functions, ath12k_dp_mon_srng_process() for standalone monitor mode and ath12k_dp_mon_rx_process_stats() for statistics. However, both functions contain same code which performs monitor ring reaping and skb data processing. To eliminate redundancy, remove the duplicate code and use a single function to handle both the cases. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Restructure the code for monitor ring processing Currently, monitor ring reaping and processing occur in the same loop, which requires holding ring locks until skb processing is complete. However, only the ring reaping part requires the ring lock; the skb processing part does not need it. This approach is problematic because it unnecessarily extends the duration for which the ring locks are held, leading to increased contention and potential backpressure issues. Fix it by holding ring locks only during the reaping phase, as skb processing does not require them. First, reap the monitor destination ring with the ring lock and queue the skbs into an skb list. Then, process the skbs in this list in a separate loop without holding the ring lock. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Fix invalid entry fetch in ath12k_dp_mon_srng_process Currently, ath12k_dp_mon_srng_process uses ath12k_hal_srng_src_get_next_entry to fetch the next entry from the destination ring. This is incorrect because ath12k_hal_srng_src_get_next_entry is intended for source rings, not destination rings. This leads to invalid entry fetches, causing potential data corruption or crashes due to accessing incorrect memory locations. This happens because the source ring and destination ring have different handling mechanisms and using the wrong function results in incorrect pointer arithmetic and ring management. To fix this issue, replace the call to ath12k_hal_srng_src_get_next_entry with ath12k_hal_srng_dst_get_next_entry in ath12k_dp_mon_srng_process. This ensures that the correct function is used for fetching entries from the destination ring, preventing invalid memory accesses. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Fix end offset bit definition in monitor ring descriptor End offset for the monitor destination ring descriptor is defined as 16 bits, while the firmware definition specifies only 12 bits. The remaining bits (bit 12 to bit 15) are reserved and may contain junk values, leading to invalid information retrieval. Fix this issue by updating the correct genmask values. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Add drop descriptor handling for monitor ring When monitor block in Hardware experiences internal backpressure, a ring entry with the EMPTY_DESC reason is received in the monitor destination ring descriptor. The cookie field for this corresponding entry is invalid. Currently driver attempts to process this cookie resulting in invalid buf_id warning logs flooding the console. To fix this, skip processing the destination descriptor when the EMPTY_DESCRIPTOR bit is set to true in ring descriptor, thereby avoiding the processing of junk cookies. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Handle end reason for the monitor destination ring Currently, the monitor destination ring's descriptor includes a 2-bit field for the end reason. Out of all the end reason values, hardware uses HAL_MON_FLUSH_DETECTED and HAL_MON_PPDU_TRUNCATED to indicate buffers that should not be processed due to system level errors. Driver should not process entries with these end reasons, as they contain junk values. However, the current code lacks end reason-specific checks for the monitor destination ring, leading to the processing of invalid buffers. Fix this by adding checks for these two end reasons during the reaping phase. Free the skb if either HAL_MON_FLUSH_DETECTED or HAL_MON_PPDU_TRUNCATED is detected, preventing the driver from processing invalid entries. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Optimize NAPI budget by adjusting PPDU processing In the current implementation, when PPDU spans multiple ring descriptors, leading to inefficient use of the NAPI budget. The budget counter is decremented for each ring descriptor, causing rapid depletion of the budget even though the processing of a single PPDU might not be complete. To address this issue, modify the code to decrement the budget counter only when the driver receives HAL_MON_END_OF_PPDU as the end reason. This change ensures that the budget is decremented only once per PPDU, resulting in more efficient utilization of the NAPI budget and better handling of monitor destination ring. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Handle PPDU spread across multiple buffers Each PPDU contains numerous TLV tags. HAL_RX_PPDU_START marks the start of the PPDU, and HAL_RX_PPDU_END_STATUS_DONE marks the end. From the monitor destination rings, the driver retrieves skb containing these TLV tags and their corresponding data. Sometimes, one PPDU’s information spreads across multiple skbs. The current parsing logic uses memset on struct hal_rx_mon_ppdu_info after parsing each skb, leading to information loss if a PPDU spans multiple skbs. Fix this by setting the ppdu_continuation flag when the driver fails to get HAL_RX_PPDU_END_STATUS_DONE, and do memset on struct hal_rx_mon_ppdu_info only when the ppdu_continuation flag is not set. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Avoid memory leak while enabling statistics Driver uses monitor destination rings for extended statistics mode and standalone monitor mode. In extended statistics mode, TLVs are parsed from the buffer received from the monitor destination ring and assigned to the ppdu_info structure to update per-packet statistics. In standalone monitor mode, along with per-packet statistics, the packet data (payload) is captured, and the driver updates per MSDU to mac80211. When the AP interface is enabled, only extended statistics mode is activated. As part of enabling monitor rings for collecting statistics, the driver subscribes to HAL_RX_MPDU_START TLV in the filter configuration. This TLV is received from the monitor destination ring, and kzalloc for the mon_mpdu object occurs, which is not freed, leading to a memory leak. The kzalloc for the mon_mpdu object is only required while enabling the standalone monitor interface. This causes a memory leak while enabling extended statistics mode in the driver. Fix this memory leak by removing the kzalloc for the mon_mpdu object in the HAL_RX_MPDU_START TLV handling. Additionally, remove the standalone monitor mode handlings in the HAL_MON_BUF_ADDR and HAL_RX_MSDU_END TLVs. These TLV tags will be handled properly when enabling standalone monitor mode in the future. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Handle monitor drop TLVs scenario During monitor destination ring back-pressure, hardware failed to send HAL_RX_PPDU_END_STATUS_DONE TLV. But driver uses this TLV as a delimiter to complete one PPDU worth of data parsing. This causes driver to overwrite the existing PPDU information with the new PPDU information. Fix it by recording the end reason which is provided under each buffer's descriptor in skb->cb and uses it while parsing TLV tags to mark the PPDU end delimiter. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Enable monitor ring mask for QCN9274 QCN9274's monitor related rings are initialized properly. Hence enabling the corresponding ring mask in the hardware params. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Fetch regdb.bin file from board-2.bin Currently, ath12k_core_fetch_regdb() finds regdb.bin file through board id's but in board-2.bin file regdb.bin file is present with default board id because of which regdb.bin is not fetched. Add support to fetch regdb.bin file from board-2.bin through default board id. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aaradhana Sahu <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath9k: return by of_get_mac_address When using nvmem, ath9k could potentially be loaded before nvmem, which loads after mtd. This is an issue if DT contains an nvmem mac address. If nvmem is not ready in time for ath9k, -EPROBE_DEFER is returned. Pass it to _probe so that ath9k can properly grab a potentially present MAC address. Signed-off-by: Rosen Penev <[email protected]> Acked-by: Toke Høiland-Jørgensen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath9k: do not submit zero bytes to the entropy pool In 'ath_cmn_process_fft()', it doesn't make too much sense to add zero bytes in attempt to improve randomness. So swap calls to 'memset()' and 'add_device_randomness()' to feed the pool with actual FFT results rather than zeroes. Compile tested only. Signed-off-by: Dmitry Antipov <[email protected]> Fixes: 2aa56cca3571 ("ath9k: Mix the received FFT bins to the random pool") Acked-by: Toke Høiland-Jørgensen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath11k: remove peer extra rssi update Commit b205ce4c266c ("ath11k: support avg signal in station dump") added an extra assignment of arsta->rssi_comb in ath11k_dp_rx_update_peer_stats() when it added the average rssi support. So let's keep only one by removing the legacy assignment so the two statements about rssi stay next to each other. Compile tested only. Signed-off-by: Nicolas Escande <[email protected]> Reviewed-by: Vasanthakumar Thiagarajan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: fix ath12k_hal_tx_cmd_ext_desc_setup() info1 override Since inception there is an obvious typo laying around in ath12k_hal_tx_cmd_ext_desc_setup(). Instead of initializing + adding flags to tcl_ext_cmd->info1, we initialize + override. This will be needed in the future to make broadcast frames work with ethernet encapsulation. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Signed-off-by: Nicolas Escande <[email protected]> Reviewed-by: Vasanthakumar Thiagarajan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: remove return for empty tx bitrate in mac_op_sta_statistics Currently in ath12k_mac_op_sta_statistics() there is the following logic: if (!arsta->txrate.legacy && !arsta->txrate.nss) return; Because ath12k_sta_statistics is used to report many info to iw wlan0 link, if it return for empty legacy and nss of arsta->txrate, then the other stats after it will not be set. To address this issue remove the return and instead invert the logic to set the txrate logic if (arsta->txrate.legacy || arsta->txrate.nss). The same was done also in both ath10k with commit 1cd6ba8ae33e ("ath10k: remove return for NL80211_STA_INFO_TX_BITRATE") and ath11k as well with commit 1d795645e1ee ("ath11k: remove return for empty tx bitrate in mac_op_sta_statistics"). Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Remi Pommarel <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/38c2a7c4f7eaf57b9306bb95a9e6c42b7d987e05.1738169458.git.repk@triplefau.lt Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: update beacon template function to use arvif structure The current code has ath12k_wmi_bcn_tmpl() accepting separate ar and vdev_id parameters. However, ath12k_link_vif structure can be used to derive both of these. Hence, simplify the function signature. Later change needs arvif pointer access within the function hence it is better if arvif is directly passed now. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: fix handling of CSA offsets in beacon template command The driver is informed of the counter offsets in the beacon during CSA through the ieee80211_mutable_offsets structure. According to the documentation for the cntdwn_counter_offs member, "This array can contain zero values which should be ignored." However, the current implementation uses these values unconditionally, without checking for zeros. Whenever CSA is active, these offsets are guaranteed to be set. Therefore, add a check for CSA active status before setting the CSA switch count offsets. This ensures that the offsets are only set when CSA is active, preventing incorrect configurations. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: update the latest CSA counter At present, the driver configures the firmware to send the Channel Switch (CS) count event only when the count reaches zero during a Channel Switch Announcement (CSA). For frames managed by the upper layer, where the driver does not update the counter, the CS count in these frames remains unchanged throughout the entire CSA period. This is because the upper layer is not aware of the latest ongoing count. Indicating same count value throughout the CSA time is wrong and could lead to connection instabilities. Fix this by configuring firmware to send CS count event for every count and then accordingly decrementing the count in mac80211. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: prevent CSA counter to reach 0 and hit WARN_ON_ONCE Currently, when the driver receives a channel switch count WMI event from the firmware with a count greater than 1, it calls ieee80211_beacon_update_cntdwn(). If the beacon transmission fails, the event will be received again with the previous count value. In this scenario, the host decrements the mac80211 counter again, causing it to move ahead of the firmware counter. Ultimately, when the firmware count reaches 1, the mac80211 counter will reach zero, triggering a WARN_ON_ONCE(). Therefore, there is a need to check the count value in the event. Hence to fix this, maintain the current ongoing counter in arvif. If the count in the event does not match the expected value, silently discard the event. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Avoid napi_sync() before napi_enable() In case of MHI error a reset work will be queued which will try napi_disable() after napi_synchronize(). As the napi will be only enabled after qmi_firmware_ready event, trying napi_synchronize() before napi_enable() will result in indefinite sleep in case of a firmware crash in QMI init sequence. To avoid this, introduce napi_enabled flag to check if napi is enabled or not before calling napi_synchronize(). Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Avula Sri Charan <[email protected]> Signed-off-by: Tamizh Chelvam Raja <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: relocate ath12k_mac_ieee80211_sta_bw_to_wmi() An upcoming change will invoke ath12k_mac_ieee80211_sta_bw_to_wmi() from a line located above its current definition. Hence, relocate it to above so that it can be invoked later on. No functionality changes. Compile tested only. Signed-off-by: Aditya Kumar Singh <[email protected]> Acked-by: Kalle Valo <[email protected]> Acked-by: Jeff Johnson <[email protected]> Link: https://patch.msgid.link/20250110-fix_link_sta_bandwidth_update-v1-1-61b6f3ef2ea3@quicinc.com Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: handle ath12k_mac_ieee80211_sta_bw_to_wmi() for link sta Currently ath12k_mac_ieee80211_sta_bw_to_wmi() handles the bandwidth from sta's deflink member. This works only for non-ML station. Now that MLO support is there, extend this function to use link sta instead of deflink. Additionally, in ath12k_mac_handle_link_sta_state(), the link sta structure is not accessible, making it difficult to fetch the bandwidth there. However, ath12k_mac_station_assoc() does reference the link sta structure. Therefore, move the initial assignment of the arsta bandwidth member to ath12k_mac_station_assoc(). Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Signed-off-by: Aditya Kumar Singh <[email protected]> Acked-by: Jeff Johnson <[email protected]> Link: https://patch.msgid.link/20250110-fix_link_sta_bandwidth_update-v1-2-61b6f3ef2ea3@quicinc.com Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Add support for obtaining the buffer type ACPI function bitmap Currently, ath12k does not support obtaining the buffer type ACPI function bitmap. To solve this issue, change the code to support obtaining the buffer type ACPI function bitmap. This patch will not affect QCN9274, because only WCN7850 supports ACPI. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Lingbo Kong <[email protected]> Acked-by: Jeff Johnson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Add Support for enabling or disabling specific features based on ACPI bitflag Currently, ath12k does not support enable or disable specific features by ACPI bitflag. To address this issue, obtain the ACPI bitflag value and use it to selectively enable or disable specific features. This patch will not affect QCN9274, because only WCN7850 supports ACPI. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Lingbo Kong <[email protected]> Acked-by: Jeff Johnson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Adjust the timing to access ACPI table Currently, the timing for accessing the ACPI table is inappropriate. Due to special ACPI requirements, the ACPI table must be obtained before downloading the board data file. Therefore, adjust the timing for accessing the ACPI table accordingly. This patch will not affect QCN9274, because only WCN7850 supports ACPI. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Lingbo Kong <[email protected]> Acked-by: Jeff Johnson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Add support for reading variant from ACPI to download board data file Currently, ath12k does not support reading variant from ACPI board data filename extension for downloading board data file. To address this issue, obtain the string of the ACPI data filename extension and use it as part of the string to search for the board data file from board-2.bin. This patch will not affect QCN9274, because only WCN7850 supports ACPI. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Lingbo Kong <[email protected]> Acked-by: Jeff Johnson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath11k: add support for MU EDCA The current code does not have the MU EDCA feature, so it cannot support the use of EDCA by STA in specific UL MU HE TB PPDU transmissions. Refer to IEEE Std 802.11ax-2021 "9.4.2.251 MU EDCA Parameter Set element", "26.2.7 EDCA operation using MU EDCA parameters". Add ath11k_mac_op_conf_tx_mu_edca() to construct the MU EDCA parameters received from mac80211 into WMI WMM parameters,and send to the firmware according to the different WMM type flags. Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04523-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1 Signed-off-by: Yu Zhang (Yuriy) <[email protected]> Reviewed-by: Vasanthakumar Thiagarajan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath11k: fix wrong overriding for VHT Beamformee STS Capability Current code in ath11k_mac_set_txbf_conf overrides nsts, which is incorrect as it confuses nss and nsts. nss is Number of Spatial Streams,nsts is Number of Space-Time Streams. As mentioned in Fixes: 55b5ee3357d7, the nss used when acting as a beamformee in VHT mode should be reported by the firmware and should not be greater than the number of receiving antennas - 1. The num_rx_chains related nss rather than nsts. If STBC is enabled, nsts is greater than nss. About nss are mapped to nsts, refer to IEEE Std 802.11-2020: 19.3.11.9.2 Space-time block coding (STBC), Table 19-18—Constellation mapper output to spatial mapper input for STBC. Remove wrong overriding for nsts of VHT Beamformee STS Capability, acting DL MU-MIMO in VHT mode is working properly. Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04479-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1 Fixes: 55b5ee3357d7 ("wifi: ath11k: fix number of VHT beamformee spatial streams") Signed-off-by: Yu Zhang (Yuriy) <[email protected]> Reviewed-by: Vasanthakumar Thiagarajan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Dump PDEV transmit rate HTT stats Support to dump PDEV transmit rate stats through HTT debugfs stats type 9. Sample output: ------------------------- echo 9 > /sys/kernel/debug/ath12k/pci-0000\:03\:00.0/mac0/htt_stats_type cat /sys/kernel/debug/ath12k/pci-0000\:03\:00.0/mac0/htt_stats HTT_TX_PDEV_RATE_STATS_TLV: mac_id = 0 tx_ldpc = 1088 ac_mu_mimo_tx_ldpc = 0 ax_mu_mimo_tx_ldpc = 0 ofdma_tx_ldpc = 0 rts_cnt = 941 rts_success = 180 ack_rssi = 4294967168 Legacy CCK Rates: 1 Mbps: 830, 2 Mbps: 0, 5.5 Mbps: 0, 12 Mbps: 0 Legacy OFDM Rates: 6 Mbps: 942, 9 Mbps: 0, 12 Mbps: 0, 18 Mbps: 0 24 Mbps: 0, 36 Mbps: 0, 48 Mbps: 0, 54 Mbps: 0 HE LTF: 1x: 0, 2x: 957, 4x: 132 tx_mcs = 0:342, 1:260, 2:171, 3:148, 4:31, 5:34, 6:93, 7:10, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 ax_mu_mimo_tx_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 ofdma_tx_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 tx_nss = 1:754, 2:335, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0 ac_mu_mimo_tx_nss = 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0 ax_mu_mimo_tx_nss = 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0 ofdma_tx_nss = 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0 tx_bw = 0:1089, 1:0, 2:0, 3:0, 4:0 tx_stbc = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 tx_gi[0] = 0:210, 1:260, 2:171, 3:148, 4:31, 5:34, 6:93, 7:10, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 tx_gi[1] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 tx_gi[2] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 tx_gi[3] = 0:132, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 ac_mu_mimo_tx_gi[0] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 ac_mu_mimo_tx_gi[1] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 ac_mu_mimo_tx_gi[2] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 ac_mu_mimo_tx_gi[3] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 ax_mu_mimo_tx_gi[0] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 ax_mu_mimo_tx_gi[1] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 ax_mu_mimo_tx_gi[2] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 ax_mu_mimo_tx_gi[3] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 ofdma_tx_gi[0] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 ofdma_tx_gi[1] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 ofdma_tx_gi[2] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 ofdma_tx_gi[3] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 tx_su_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 tx_mu_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 ac_mu_mimo_tx_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 ac_mu_mimo_tx_bw = 0:0, 1:0, 2:0, 3:0 ax_mu_mimo_tx_bw = 0:0, 1:0, 2:0, 3:0 ofdma_tx_bw = 0:0, 1:0, 2:0, 3:0 tx_pream = 0:942, 1:830, 2:0, 3:0, 4:1850, 5:0, 6:0 tx_dcm = 0:131, 1:0, 2:0, 3:0, 4:0 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Signed-off-by: Lingbo Kong <[email protected]> Reviewed-by: Aditya Kumar Singh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> wifi: ath12k: Dump PDEV receive rate HTT stats Support to dump PDEV receive rate stats through HTT debugfs stats type 10. Sample output: ----------------- echo 10 > /sys/kernel/debug/ath12k/pci-0000\:03\:00.0/mac0/htt_stats_type cat /sys/kernel/debug/ath12k/pci-0000\:03\:00.0/mac0/htt_stats HTT_RX_PDEV_RATE_STATS_TLV: mac_id = 0 nsts = 0 rx_ldpc = 96 rts_cnt = 0 rssi_mgmt = 4294967240 rssi_data = 4294967250 rssi_comb = 4294967239 rssi_in_dbm = -46 rx_evm_nss_count = 0 rx_evm_pilot_count = 0 rx_11ax_su_ext = 0 rx_11ac_mumimo = 0 rx_11ax_mumimo = 0 rx_11ax_ofdma = 0 txbf = 0 rx_su_ndpa = 0 rx_mu_ndpa = 0 rx_br_poll = 0 rx_active_dur_us_low = 1000106 rx_active_dur_us_high = 0 rx_11ax_ul_ofdma = 0 ul_ofdma_rx_stbc = 0 ul_ofdma_rx_ldpc = 0 per_chain_rssi_pkt_type = 0x88 rx_nss = 0:40, 1:56, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_dcm = 0:0, 1:0, 2:0, 3:0, 4:0 rx_stbc = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 rx_bw = 0:1175, 1:0, 2:0, 3:0 rx_pream = 0:435, 1:644, 2:0, 3:0, 4:96, 5:0, 6:0 rx_11ax_su_txbf_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 rx_11ax_mu_txbf_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 rx_legacy_cck_rate = 0:641, 1:0, 2:3, 3:0 rx_legacy_ofdm_rate = 0:267, 1:0, 2:72, 3:0, 4:96, 5:0, 6:0, 7:0 ul_ofdma_rx_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 ul_ofdma_rx_nss = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 ul_ofdma_rx_bw = 0:0, 1:0, 2:0, 3:0 rx_ulofdma_non_data_ppdu = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_ulofdma_data_ppdu = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_ulofdma_mpdu_ok = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_ulofdma_mpdu_fail = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_ulofdma_non_data_nusers = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_ulofdma_data_nusers = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_11ax_dl_ofdma_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0 rx_11ax_dl_ofdma_ru = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0 rx_ulmumimo_non_data_ppdu = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_ulmumimo_data_ppdu = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_ulmumimo_mpdu_ok = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_ulmumimo_mpdu_fail = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 rx_mcs = 0:0, 1:0, 2:0, 3:0, 4:28, 5:8, 6:37, 7:21, 8:2, 9:0, 10:0, 11:0, 12:0, 13:0 pilot_evm_db[0] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 pilot_evm_db[1] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 pilot_evm_db[2] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 pilot_evm_db[3] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 pilot_evm_db[4] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 pilot_evm_db[5] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 pilot_evm_db[6] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 pilot_evm_db[7] = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 pilo…
1 parent 48c2cd2 commit 096cbe3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+8834
-984
lines changed

drivers/net/wireless/ath/ath11k/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ ath11k-$(CONFIG_ATH11K_TRACING) += trace.o
2727
ath11k-$(CONFIG_THERMAL) += thermal.o
2828
ath11k-$(CONFIG_ATH11K_SPECTRAL) += spectral.o
2929
ath11k-$(CONFIG_PM) += wow.o
30+
ath11k-$(CONFIG_DEV_COREDUMP) += coredump.o
3031

3132
obj-$(CONFIG_ATH11K_AHB) += ath11k_ahb.o
3233
ath11k_ahb-y += ahb.o

drivers/net/wireless/ath/ath11k/ahb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: BSD-3-Clause-Clear
22
/*
33
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4-
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4+
* Copyright (c) 2022-2025 Qualcomm Innovation Center, Inc. All rights reserved.
55
*/
66

77
#include <linux/module.h>
@@ -1290,6 +1290,7 @@ static void ath11k_ahb_remove(struct platform_device *pdev)
12901290
ath11k_core_deinit(ab);
12911291

12921292
qmi_fail:
1293+
ath11k_fw_destroy(ab);
12931294
ath11k_ahb_free_resources(ab);
12941295
}
12951296

@@ -1309,6 +1310,7 @@ static void ath11k_ahb_shutdown(struct platform_device *pdev)
13091310
ath11k_core_deinit(ab);
13101311

13111312
free_resources:
1313+
ath11k_fw_destroy(ab);
13121314
ath11k_ahb_free_resources(ab);
13131315
}
13141316

drivers/net/wireless/ath/ath11k/core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: BSD-3-Clause-Clear
22
/*
33
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4-
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4+
* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
55
*/
66

77
#include <linux/module.h>
@@ -2060,6 +2060,7 @@ void ath11k_core_halt(struct ath11k *ar)
20602060
ath11k_mac_scan_finish(ar);
20612061
ath11k_mac_peer_cleanup_all(ar);
20622062
cancel_delayed_work_sync(&ar->scan.timeout);
2063+
cancel_work_sync(&ar->channel_update_work);
20632064
cancel_work_sync(&ar->regd_update_work);
20642065
cancel_work_sync(&ab->update_11d_work);
20652066

@@ -2261,6 +2262,7 @@ static void ath11k_core_reset(struct work_struct *work)
22612262
reinit_completion(&ab->recovery_start);
22622263
atomic_set(&ab->recovery_start_count, 0);
22632264

2265+
ath11k_coredump_collect(ab);
22642266
ath11k_core_pre_reconfigure_recovery(ab);
22652267

22662268
reinit_completion(&ab->reconfigure_complete);
@@ -2350,7 +2352,6 @@ void ath11k_core_deinit(struct ath11k_base *ab)
23502352
ath11k_hif_power_down(ab);
23512353
ath11k_mac_destroy(ab);
23522354
ath11k_core_soc_destroy(ab);
2353-
ath11k_fw_destroy(ab);
23542355
}
23552356
EXPORT_SYMBOL(ath11k_core_deinit);
23562357

@@ -2397,6 +2398,7 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev, size_t priv_size,
23972398
INIT_WORK(&ab->restart_work, ath11k_core_restart);
23982399
INIT_WORK(&ab->update_11d_work, ath11k_update_11d);
23992400
INIT_WORK(&ab->reset_work, ath11k_core_reset);
2401+
INIT_WORK(&ab->dump_work, ath11k_coredump_upload);
24002402
timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0);
24012403
init_completion(&ab->htc_suspend);
24022404
init_completion(&ab->wow.wakeup_completed);

drivers/net/wireless/ath/ath11k/core.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
22
/*
33
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4-
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4+
* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
55
*/
66

77
#ifndef ATH11K_CORE_H
@@ -32,6 +32,7 @@
3232
#include "spectral.h"
3333
#include "wow.h"
3434
#include "fw.h"
35+
#include "coredump.h"
3536

3637
#define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
3738

@@ -370,6 +371,7 @@ struct ath11k_vif {
370371
struct ieee80211_vif *vif;
371372

372373
struct wmi_wmm_params_all_arg wmm_params;
374+
struct wmi_wmm_params_all_arg muedca_params;
373375
struct list_head list;
374376
union {
375377
struct {
@@ -685,7 +687,7 @@ struct ath11k {
685687
struct mutex conf_mutex;
686688
/* protects the radio specific data like debug stats, ppdu_stats_info stats,
687689
* vdev_stop_status info, scan data, ath11k_sta info, ath11k_vif info,
688-
* channel context data, survey info, test mode data.
690+
* channel context data, survey info, test mode data, channel_update_queue.
689691
*/
690692
spinlock_t data_lock;
691693

@@ -743,6 +745,9 @@ struct ath11k {
743745
struct completion bss_survey_done;
744746

745747
struct work_struct regd_update_work;
748+
struct work_struct channel_update_work;
749+
/* protected with data_lock */
750+
struct list_head channel_update_queue;
746751

747752
struct work_struct wmi_mgmt_tx_work;
748753
struct sk_buff_head wmi_mgmt_tx_queue;
@@ -900,6 +905,10 @@ struct ath11k_base {
900905
/* HW channel counters frequency value in hertz common to all MACs */
901906
u32 cc_freq_hz;
902907

908+
struct ath11k_dump_file_data *dump_data;
909+
size_t ath11k_coredump_len;
910+
struct work_struct dump_work;
911+
903912
struct ath11k_htc htc;
904913

905914
struct ath11k_dp dp;
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// SPDX-License-Identifier: BSD-3-Clause-Clear
2+
/*
3+
* Copyright (c) 2020 The Linux Foundation. All rights reserved.
4+
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
5+
*/
6+
#include <linux/devcoredump.h>
7+
#include "hif.h"
8+
#include "coredump.h"
9+
#include "debug.h"
10+
11+
enum
12+
ath11k_fw_crash_dump_type ath11k_coredump_get_dump_type(int type)
13+
{
14+
enum ath11k_fw_crash_dump_type dump_type;
15+
16+
switch (type) {
17+
case HOST_DDR_REGION_TYPE:
18+
dump_type = FW_CRASH_DUMP_REMOTE_MEM_DATA;
19+
break;
20+
case M3_DUMP_REGION_TYPE:
21+
dump_type = FW_CRASH_DUMP_M3_DUMP;
22+
break;
23+
case PAGEABLE_MEM_REGION_TYPE:
24+
dump_type = FW_CRASH_DUMP_PAGEABLE_DATA;
25+
break;
26+
case BDF_MEM_REGION_TYPE:
27+
case CALDB_MEM_REGION_TYPE:
28+
dump_type = FW_CRASH_DUMP_NONE;
29+
break;
30+
default:
31+
dump_type = FW_CRASH_DUMP_TYPE_MAX;
32+
break;
33+
}
34+
35+
return dump_type;
36+
}
37+
EXPORT_SYMBOL(ath11k_coredump_get_dump_type);
38+
39+
void ath11k_coredump_upload(struct work_struct *work)
40+
{
41+
struct ath11k_base *ab = container_of(work, struct ath11k_base, dump_work);
42+
43+
ath11k_info(ab, "Uploading coredump\n");
44+
/* dev_coredumpv() takes ownership of the buffer */
45+
dev_coredumpv(ab->dev, ab->dump_data, ab->ath11k_coredump_len, GFP_KERNEL);
46+
ab->dump_data = NULL;
47+
}
48+
49+
void ath11k_coredump_collect(struct ath11k_base *ab)
50+
{
51+
ath11k_hif_coredump_download(ab);
52+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
2+
/*
3+
* Copyright (c) 2020 The Linux Foundation. All rights reserved.
4+
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
5+
*/
6+
#ifndef _ATH11K_COREDUMP_H_
7+
#define _ATH11K_COREDUMP_H_
8+
9+
#define ATH11K_FW_CRASH_DUMP_V2 2
10+
11+
enum ath11k_fw_crash_dump_type {
12+
FW_CRASH_DUMP_PAGING_DATA,
13+
FW_CRASH_DUMP_RDDM_DATA,
14+
FW_CRASH_DUMP_REMOTE_MEM_DATA,
15+
FW_CRASH_DUMP_PAGEABLE_DATA,
16+
FW_CRASH_DUMP_M3_DUMP,
17+
FW_CRASH_DUMP_NONE,
18+
19+
/* keep last */
20+
FW_CRASH_DUMP_TYPE_MAX,
21+
};
22+
23+
#define COREDUMP_TLV_HDR_SIZE 8
24+
25+
struct ath11k_tlv_dump_data {
26+
/* see ath11k_fw_crash_dump_type above */
27+
__le32 type;
28+
29+
/* in bytes */
30+
__le32 tlv_len;
31+
32+
/* pad to 32-bit boundaries as needed */
33+
u8 tlv_data[];
34+
} __packed;
35+
36+
struct ath11k_dump_file_data {
37+
/* "ATH11K-FW-DUMP" */
38+
char df_magic[16];
39+
/* total dump len in bytes */
40+
__le32 len;
41+
/* file dump version */
42+
__le32 version;
43+
/* pci device id */
44+
__le32 chip_id;
45+
/* qrtr instance id */
46+
__le32 qrtr_id;
47+
/* pci domain id */
48+
__le32 bus_id;
49+
guid_t guid;
50+
/* time-of-day stamp */
51+
__le64 tv_sec;
52+
/* time-of-day stamp, nano-seconds */
53+
__le64 tv_nsec;
54+
/* room for growth w/out changing binary format */
55+
u8 unused[128];
56+
u8 data[];
57+
} __packed;
58+
59+
#ifdef CONFIG_DEV_COREDUMP
60+
enum ath11k_fw_crash_dump_type ath11k_coredump_get_dump_type(int type);
61+
void ath11k_coredump_upload(struct work_struct *work);
62+
void ath11k_coredump_collect(struct ath11k_base *ab);
63+
#else
64+
static inline enum
65+
ath11k_fw_crash_dump_type ath11k_coredump_get_dump_type(int type)
66+
{
67+
return FW_CRASH_DUMP_TYPE_MAX;
68+
}
69+
70+
static inline void ath11k_coredump_upload(struct work_struct *work)
71+
{
72+
}
73+
74+
static inline void ath11k_coredump_collect(struct ath11k_base *ab)
75+
{
76+
}
77+
#endif
78+
79+
#endif

drivers/net/wireless/ath/ath11k/dp.c

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: BSD-3-Clause-Clear
22
/*
33
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4-
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4+
* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
55
*/
66

77
#include <crypto/hash.h>
@@ -104,14 +104,12 @@ void ath11k_dp_srng_cleanup(struct ath11k_base *ab, struct dp_srng *ring)
104104
if (!ring->vaddr_unaligned)
105105
return;
106106

107-
if (ring->cached) {
108-
dma_unmap_single(ab->dev, ring->paddr_unaligned, ring->size,
109-
DMA_FROM_DEVICE);
110-
kfree(ring->vaddr_unaligned);
111-
} else {
107+
if (ring->cached)
108+
dma_free_noncoherent(ab->dev, ring->size, ring->vaddr_unaligned,
109+
ring->paddr_unaligned, DMA_FROM_DEVICE);
110+
else
112111
dma_free_coherent(ab->dev, ring->size, ring->vaddr_unaligned,
113112
ring->paddr_unaligned);
114-
}
115113

116114
ring->vaddr_unaligned = NULL;
117115
}
@@ -249,25 +247,14 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,
249247
default:
250248
cached = false;
251249
}
252-
253-
if (cached) {
254-
ring->vaddr_unaligned = kzalloc(ring->size, GFP_KERNEL);
255-
if (!ring->vaddr_unaligned)
256-
return -ENOMEM;
257-
258-
ring->paddr_unaligned = dma_map_single(ab->dev,
259-
ring->vaddr_unaligned,
260-
ring->size,
261-
DMA_FROM_DEVICE);
262-
if (dma_mapping_error(ab->dev, ring->paddr_unaligned)) {
263-
kfree(ring->vaddr_unaligned);
264-
ring->vaddr_unaligned = NULL;
265-
return -ENOMEM;
266-
}
267-
}
268250
}
269251

270-
if (!cached)
252+
if (cached)
253+
ring->vaddr_unaligned = dma_alloc_noncoherent(ab->dev, ring->size,
254+
&ring->paddr_unaligned,
255+
DMA_FROM_DEVICE,
256+
GFP_KERNEL);
257+
else
271258
ring->vaddr_unaligned = dma_alloc_coherent(ab->dev, ring->size,
272259
&ring->paddr_unaligned,
273260
GFP_KERNEL);

drivers/net/wireless/ath/ath11k/dp.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
22
/*
33
* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4-
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4+
* Copyright (c) 2021-2023, 2025 Qualcomm Innovation Center, Inc. All rights reserved.
55
*/
66

77
#ifndef ATH11K_DP_H
@@ -20,7 +20,6 @@ struct ath11k_ext_irq_grp;
2020

2121
struct dp_rx_tid {
2222
u8 tid;
23-
u32 *vaddr;
2423
dma_addr_t paddr;
2524
u32 size;
2625
u32 ba_win_sz;
@@ -37,6 +36,9 @@ struct dp_rx_tid {
3736
/* Timer info related to fragments */
3837
struct timer_list frag_timer;
3938
struct ath11k_base *ab;
39+
u32 *vaddr_unaligned;
40+
dma_addr_t paddr_unaligned;
41+
u32 unaligned_size;
4042
};
4143

4244
#define DP_REO_DESC_FREE_THRESHOLD 64

0 commit comments

Comments
 (0)