Skip to content

Commit d58cebb

Browse files
Jakub Kicinskidavem330
authored andcommitted
nfp: correct DMA direction in XDP DMA sync
dma_sync_single_for_*() takes the direction in which the buffer was mapped, not the direction of the sync. We should sync XDP buffers bidirectionally. Fixes: ecd63a0 ("nfp: add XDP support in the driver") Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9383b33 commit d58cebb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/netronome/nfp/nfp_net_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ nfp_net_tx_xdp_buf(struct nfp_net *nn, struct nfp_net_rx_ring *rx_ring,
14981498
txbuf->real_len = pkt_len;
14991499

15001500
dma_sync_single_for_device(&nn->pdev->dev, rxbuf->dma_addr + pkt_off,
1501-
pkt_len, DMA_TO_DEVICE);
1501+
pkt_len, DMA_BIDIRECTIONAL);
15021502

15031503
/* Build TX descriptor */
15041504
txd = &tx_ring->txds[wr_idx];
@@ -1611,7 +1611,7 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)
16111611

16121612
dma_sync_single_for_cpu(&nn->pdev->dev,
16131613
rxbuf->dma_addr + pkt_off,
1614-
pkt_len, DMA_FROM_DEVICE);
1614+
pkt_len, DMA_BIDIRECTIONAL);
16151615
act = nfp_net_run_xdp(xdp_prog, rxbuf->frag + data_off,
16161616
pkt_len);
16171617
switch (act) {

0 commit comments

Comments
 (0)