Commit 8c4df83f authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by David S. Miller

net: mvneta: fix dma sync size in mvneta_run_xdp

Page pool API will start syncing (if requested) starting from
page->dma_addr + pool->p.offset. Fix dma sync length in
mvneta_run_xdp since we do not need to account xdp headroom

Fixes: 07e13edb ("net: mvneta: get rid of huge dma sync in mvneta_rx_refill")
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Acked-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 86f3f4cd
......@@ -2081,7 +2081,11 @@ static int
mvneta_run_xdp(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
struct bpf_prog *prog, struct xdp_buff *xdp)
{
u32 ret, act = bpf_prog_run_xdp(prog, xdp);
unsigned int len;
u32 ret, act;
len = xdp->data_end - xdp->data_hard_start - pp->rx_offset_correction;
act = bpf_prog_run_xdp(prog, xdp);
switch (act) {
case XDP_PASS:
......@@ -2095,8 +2099,7 @@ mvneta_run_xdp(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
ret = MVNETA_XDP_DROPPED;
__page_pool_put_page(rxq->page_pool,
virt_to_head_page(xdp->data),
xdp->data_end - xdp->data_hard_start,
true);
len, true);
} else {
ret = MVNETA_XDP_REDIR;
}
......@@ -2107,8 +2110,7 @@ mvneta_run_xdp(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
if (ret != MVNETA_XDP_TX)
__page_pool_put_page(rxq->page_pool,
virt_to_head_page(xdp->data),
xdp->data_end - xdp->data_hard_start,
true);
len, true);
break;
default:
bpf_warn_invalid_xdp_action(act);
......@@ -2119,8 +2121,7 @@ mvneta_run_xdp(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
case XDP_DROP:
__page_pool_put_page(rxq->page_pool,
virt_to_head_page(xdp->data),
xdp->data_end - xdp->data_hard_start,
true);
len, true);
ret = MVNETA_XDP_DROPPED;
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment