[PATCH ath-current v3] wifi: ath12k: fix DMA direction for re-injected Rx buffers
Jeff Johnson
jeff.johnson at oss.qualcomm.com
Sat Nov 14 12:22:55 PST 2026
On 10/23/2026 9:49 AM, Lorenzo Bianconi wrote:
> Defragmented MPDUs that are re-injected into the REO are mapped with
> DMA_TO_DEVICE, but all the Rx reap and teardown paths unmap them with
> DMA_FROM_DEVICE. The DMA API requires the unmap direction to match the
> map direction, so this violates the contract.
>
> The mapping actually spans both directions, since the host has written
> the buffer before the REO reads it and the buffer is read back by the
> host afterwards, so DMA_BIDIRECTIONAL is the correct choice.
>
> Add a common ath12k_dp_unmap_rx_buf() helper that selects
> DMA_BIDIRECTIONAL for re-injected buffers, identified by the existing
> ath12k_skb_rxcb::is_frag flag, and DMA_FROM_DEVICE otherwise, then use it
> in all the Rx reap and cleanup paths. Map and unmap the re-injected buffer
> with DMA_BIDIRECTIONAL consistently.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
>
> Fixes: 33322e3ef074 ("wifi: ath12k: change DMA direction while mapping reinjected packets")
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at oss.qualcomm.com>
> ---
> Changes in v3:
> - Set ATH12K_SKB_RXCB()->paddr before err_unmap_dma condition in
> ath12k_wifi7_dp_rx_h_defrag_reo_reinject().
> - Link to v2: https://lore.kernel.org/r/20261023-ath12k-fix-dma-mapping-for-reinject-packets-v2-1-9f436a26dd72@oss.qualcomm.com
>
> Changes in v2:
> - Rely on ath12k_skb_rxcb is_frag field and drop reinjected one.
> - Link to v1: https://lore.kernel.org/r/20261017-ath12k-fix-dma-mapping-for-reinject-packets-v1-1-b94860e18ba4@oss.qualcomm.com
> ---
> drivers/net/wireless/ath/ath12k/dp.c | 6 ++---
> drivers/net/wireless/ath/ath12k/dp_mon.c | 5 ++--
> drivers/net/wireless/ath/ath12k/dp_rx.c | 3 +--
> drivers/net/wireless/ath/ath12k/dp_rx.h | 11 ++++++++
> drivers/net/wireless/ath/ath12k/wifi7/dp_mon.c | 17 +++---------
> drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c | 37 ++++++++------------------
> 6 files changed, 31 insertions(+), 48 deletions(-)
This conflicts with recently added:
febe1f8cbccc ("wifi: ath12k: avoid double DMA unmap of held monitor RX buffers")
Please rebase.
/jeff
More information about the ath12k
mailing list