]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: mvpp2: sync RX data at the hardware packet offset
authorTil Kaiser <mail@tk154.de>
Sun, 7 Jun 2026 13:49:40 +0000 (15:49 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 11 Jun 2026 07:57:31 +0000 (09:57 +0200)
mvpp2 programs the RX queue packet offset, so hardware writes received
data at dma_addr + MVPP2_SKB_HEADROOM. The current CPU sync starts at
dma_addr and only covers rx_bytes + MVPP2_MH_SIZE bytes, which syncs the
unused headroom and misses the same number of bytes at the packet tail.

On non-coherent DMA systems this can leave the CPU reading stale cache
contents for the end of the received frame.

Use dma_sync_single_range_for_cpu() with MVPP2_SKB_HEADROOM as the range
offset so the sync covers the Marvell header and packet data actually
written by hardware.

Fixes: e1921168bbd4 ("mvpp2: sync only the received frame")
Signed-off-by: Til Kaiser <mail@tk154.de>
Link: https://patch.msgid.link/20260607134943.21996-2-mail@tk154.de
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

index f442b874bb5933b298773bee7e6140e753bce013..92a701f4fe3f57a31330ae871b0237ef9db799a9 100644 (file)
@@ -3946,9 +3946,10 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
                        dma_dir = DMA_FROM_DEVICE;
                }
 
-               dma_sync_single_for_cpu(dev->dev.parent, dma_addr,
-                                       rx_bytes + MVPP2_MH_SIZE,
-                                       dma_dir);
+               dma_sync_single_range_for_cpu(dev->dev.parent, dma_addr,
+                                             MVPP2_SKB_HEADROOM,
+                                             rx_bytes + MVPP2_MH_SIZE,
+                                             dma_dir);
 
                /* Buffer header not supported */
                if (rx_status & MVPP2_RXD_BUF_HDR)