Commit 7466b60a authored by David S. Miller's avatar David S. Miller

Merge branch 'use-xdp-helpers'

Matteo Croce says:

====================
net: use XDP helpers

The commit 43b5169d ("net, xdp: Introduce xdp_init_buff utility
routine") and commit be9df4af ("net, xdp: Introduce xdp_prepare_buff
utility routine") introduces two useful helpers to populate xdp_buff.
Use it in drivers which still open codes that routines.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 76e3d7fa 224bf7db
......@@ -2151,12 +2151,9 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget)
}
if (!skb) {
xdp.data = pktbuf + pkt_offset;
xdp.data_end = xdp.data + size;
xdp.data_hard_start = pktbuf - igc_rx_offset(rx_ring);
xdp_set_data_meta_invalid(&xdp);
xdp.frame_sz = truesize;
xdp.rxq = &rx_ring->xdp_rxq;
xdp_init_buff(&xdp, truesize, &rx_ring->xdp_rxq);
xdp_prepare_buff(&xdp, pktbuf - igc_rx_offset(rx_ring),
igc_rx_offset(rx_ring) + pkt_offset, size, false);
skb = igc_xdp_run_prog(adapter, &xdp);
}
......
......@@ -5167,12 +5167,9 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
dma_sync_single_for_cpu(priv->device, buf->addr,
buf1_len, dma_dir);
xdp.data = page_address(buf->page) + buf->page_offset;
xdp.data_end = xdp.data + buf1_len;
xdp.data_hard_start = page_address(buf->page);
xdp_set_data_meta_invalid(&xdp);
xdp.frame_sz = buf_sz;
xdp.rxq = &rx_q->xdp_rxq;
xdp_init_buff(&xdp, buf_sz, &rx_q->xdp_rxq);
xdp_prepare_buff(&xdp, page_address(buf->page),
buf->page_offset, buf1_len, false);
pre_len = xdp.data_end - xdp.data_hard_start -
buf->page_offset;
......
......@@ -744,11 +744,9 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
if (copied != len)
return -EFAULT;
xdp->data_hard_start = buf;
xdp->data = buf + pad;
xdp->data_end = xdp->data + len;
xdp_init_buff(xdp, buflen, NULL);
xdp_prepare_buff(xdp, buf, pad, len, true);
hdr->buflen = buflen;
xdp->frame_sz = buflen;
--net->refcnt_bias;
alloc_frag->offset += buflen;
......
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