Skip to contentSkip to conversation

net: hibmcge: fix page_pool DMA direction mismatch

PATCH Applied Jijie Shao 2 participants 2 messages Aug 20 – Aug 22

Subsystems (4)
lore
Share & tools
lore

Jijie Shao

author maintainer
#0 lore raw

PATCH 1/1 net: hibmcge: fix page_pool DMA direction mismatch

From: Jian Shen <[email protected]>

The driver memsets the RX buffer page head to zero before submitting it to hardware, then calls dma_sync_single_for_device() with DMA_TO_DEVICE. This sync direction does not match the pool dma_dir which is DMA_FROM_DEVICE, violating the DMA API contract that the sync direction must match the mapping direction.

On swiotlb platforms the mismatch can cause incorrect bounce-buffer behaviour, and CONFIG_DMA_API_DEBUG emits a warning.

Switch the page_pool dma_dir to DMA_BIDIRECTIONAL so that the CPU-to-device memset sync becomes legal.

Fixes c30595917585 ("net: hibmcge: add support for pagepool on rx")
---
 drivers/net/ethernet/hisilicon/hibmcge/hbg_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hibmcge/hbg_txrx.c +1 -1
index 0ae314994676..3e6ae2aa0d4b 100644
@@ -553,7 +553,7 @@ static int hbg_ring_page_pool_init(struct hbg_priv *priv, struct hbg_ring *ring)
 		.nid = dev_to_node(&priv->pdev->dev),
 		.dev = &priv->pdev->dev,
 		.napi = &ring->napi,
-		.dma_dir = DMA_FROM_DEVICE,
+		.dma_dir = DMA_BIDIRECTIONAL,
 		.offset = 0,
 		.max_len = hbg_get_page_size(ring),
 	};

base-commit: e2466392a0b8496000e12181cb1ee1535eb0da25

Signature · 1 line
2.33.0
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 20 Aug 2026 20:43:46 +0800 you wrote:

From: Jian Shen <[email protected]>

The driver memsets the RX buffer page head to zero before submitting it to hardware, then calls dma_sync_single_for_device() with DMA_TO_DEVICE. This sync direction does not match the pool dma_dir which is DMA_FROM_DEVICE, violating the DMA API contract that the sync direction must match the mapping direction.

[...]

Here is the summary with links:
- [net] net: hibmcge: fix page_pool DMA direction mismatch

    https://git.kernel.org/netdev/net/c/11efd7963dac

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html