]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
wifi: ath12k: avoid dynamic alloc when parsing wmi tb
authorNicolas Escande <nico.escande@gmail.com>
Tue, 7 Apr 2026 09:54:26 +0000 (11:54 +0200)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Fri, 10 Apr 2026 16:22:33 +0000 (09:22 -0700)
commit9a4f673eb08d2a7713b258d671b4a45f2a6e68b7
tree1943adde9eb402f224c1205c37efa6e674df78d7
parent929298742bb5dfacd53ea99cf989cc81210f90a3
wifi: ath12k: avoid dynamic alloc when parsing wmi tb

On each WMI message received from the hardware, we alloc a temporary array
of WMI_TAG_MAX entries of type void *. This array is then populated with
pointers of parsed structs depending on the WMI type, and then freed. This
alloc can fail when memory pressure in the system is high enough.

Given the fact that it is scheduled in softirq with the system_bh_wq, we
should not be able to parse more than one WMI message per CPU at any time.

So instead lets move to a per cpu allocated array, that is reused across
calls. This memory is allocated as needed and refcounted to exist only
as long as one struct ath12k_base lives.

ath12k_wmi_tlv_parse_alloc() and ath12k_wmi_tlv_parse() are merged
together as it no longer allocs mem but returns the existing per-cpu one.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00218-QCAHKSWPL_SILICONZ-1

Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Reviewed-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Link: https://patch.msgid.link/20260407095426.3285574-1-nico.escande@gmail.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/core.c
drivers/net/wireless/ath/ath12k/wmi.c
drivers/net/wireless/ath/ath12k/wmi.h