提交 d9496f3e 编写于 作者: I Ilias Apalodimas 提交者: David S. Miller

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: ba2b2321 ("net: netsec: add XDP support")
Signed-off-by: NIlias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4eab421b
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册