Skip to contentSkip to conversation

net: lan966x: fix the DB dataptr of frames from ndo_xdp_xmit

PATCH Applied Daniel Machon 2 participants 2 messages Oct 26 – Oct 27

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: lan966x: fix the DB dataptr of frames from ndo_xdp_xmit

lan966x_fdma_xmit_xdpf() transmits both XDP_TX frames and xdp_frames from ndo_xdp_xmit, and builds the DB with lan966x_fdma_xdp_tx_dataptr_cb(), which adds XDP_PACKET_HEADROOM to the stored DMA address.

Before this patch, the headroom is also added for xdp_frames. For XDP_TX the stored address is the start of the page pool page, but for an xdp_frame it is the mapping of the IFH placed in front of the frame data, so frames from ndo_xdp_xmit are read from XDP_PACKET_HEADROOM bytes after their IFH.

Use the plain tx dataptr callback for xdp_frames.

Found by an AI code review agent. Reproduced on a lan9668 board with an XDP program redirecting frames from one port to another: none of the 20 frames arrived intact on the link partner. With the fix all 20 did.

Fixes 29cc3a66a81d ("net: lan966x: use FDMA library for adding DCB's in the tx path")
---
 drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c +2 -1
index a7940eca5df31..8ea86b800af75 100644
@@ -686,7 +686,8 @@ int lan966x_fdma_xmit_xdpf(struct lan966x_port *port, void *ptr, u32 len)
 		       FDMA_DCB_STATUS_BLOCKO(0) |
 		       FDMA_DCB_STATUS_BLOCKL(next_dcb_buf->len),
 		       &fdma_nextptr_cb,
-		       &lan966x_fdma_xdp_tx_dataptr_cb);
+		       len ? &lan966x_fdma_xdp_tx_dataptr_cb :
+			     &lan966x_fdma_tx_dataptr_cb);
 
 	/* Start the transmission */
 	lan966x_fdma_tx_start(tx);

---
base-commit: 6430fb7f1cc4e329e386521b7b208df443de92f2
change-id: 20261023-lan966x-xdp-xmit-dataptr-b0aee56bcdb8

Best regards,

Signature · 1 line
Daniel Machon <[email protected]>
#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 5 lines · On Mon, 26 Oct 2026 14:46:39 +0100 you wrote:

lan966x_fdma_xmit_xdpf() transmits both XDP_TX frames and xdp_frames from ndo_xdp_xmit, and builds the DB with lan966x_fdma_xdp_tx_dataptr_cb(), which adds XDP_PACKET_HEADROOM to the stored DMA address.

Quoted 7 lines

Before this patch, the headroom is also added for xdp_frames. For XDP_TX the stored address is the start of the page pool page, but for an xdp_frame it is the mapping of the IFH placed in front of the frame data, so frames from ndo_xdp_xmit are read from XDP_PACKET_HEADROOM bytes after their IFH.

[...]

Here is the summary with links:
- [net] net: lan966x: fix the DB dataptr of frames from ndo_xdp_xmit

    https://git.kernel.org/netdev/net/c/ce3192e0dafa

You are awesome, thank you!

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