summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/socionext
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2019-10-16 14:40:32 +0300
committerDavid S. Miller <davem@davemloft.net>2019-10-17 22:35:56 +0300
commitd9496f3ecfe4823c1e12aecbcc29220147fa012c (patch)
treec90fa3c1f00577454c6abed18e1a931b6832f1a6 /drivers/net/ethernet/socionext
parent4eab421bc339e719af1b4b9560dd0cb97ce29b73 (diff)
downloadlinux-d9496f3ecfe4823c1e12aecbcc29220147fa012c.tar.xz
net: netsec: Correct dma sync for XDP_TX frames
bpf_xdp_adjust_head() can change the frame boundaries. Account for the potential shift properly by calculating the new offset before syncing the buffer to the device for XDP_TX Fixes: ba2b232108d3 ("net: netsec: add XDP support") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/socionext')
-rw-r--r--drivers/net/ethernet/socionext/netsec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index c40294470bfa..869a498e3b5e 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -847,8 +847,8 @@ static u32 netsec_xdp_queue_one(struct netsec_priv *priv,
enum dma_data_direction dma_dir =
page_pool_get_dma_dir(rx_ring->page_pool);
- dma_handle = page_pool_get_dma_addr(page) +
- NETSEC_RXBUF_HEADROOM;
+ dma_handle = page_pool_get_dma_addr(page) + xdpf->headroom +
+ sizeof(*xdpf);
dma_sync_single_for_device(priv->dev, dma_handle, xdpf->len,
dma_dir);
tx_desc.buf_type = TYPE_NETSEC_XDP_TX;