net: use XDP helpers
Subsystems (8)
cover net: use XDP helpers
From: Matteo Croce <[email protected]>
The commit 43b5169d8355 ("net, xdp: Introduce xdp_init_buff utility routine") and commit be9df4aff65f ("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.
Matteo Croce (3):
stmmac: use XDP helpers
igc: use XDP helpers
vhost_net: use XDP helpers
drivers/net/ethernet/intel/igc/igc_main.c | 9 +++------ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++------ drivers/vhost/net.c | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/3 stmmac: use XDP helpers
From: Matteo Croce <[email protected]>
Make use of the xdp_{init,prepare}_buff() helpers instead of an open-coded version.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -6
@@ -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;
Signature · 1 line
2.31.1
PATCH 2/3 igc: use XDP helpers
In reply to Matteo CroceFrom: Matteo Croce <[email protected]>
Make use of the xdp_{init,prepare}_buff() helpers instead of an open-coded version.
--- drivers/net/ethernet/intel/igc/igc_main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +3 -6
@@ -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); }
Signature · 1 line
2.31.1
PATCH 3/3 vhost_net: use XDP helpers
In reply to Matteo CroceFrom: Matteo Croce <[email protected]>
Make use of the xdp_{init,prepare}_buff() helpers instead of an open-coded version.
Also, the field xdp->rxq was never set, so pass NULL to xdp_init_buff() to clear it.
--- drivers/vhost/net.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/vhost/net.c +2 -4
@@ -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;
Signature · 1 line
2.31.1
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 8 lines · On Fri, 14 May 2021 20:39:51 +0200 you wrote:
From: Matteo Croce <[email protected]>
The commit
43b5169d8355("net, xdp: Introducexdp_init_buffutility routine") and commitbe9df4aff65f("net, xdp: Introducexdp_prepare_buffutility routine") introduces two useful helpers to populatexdp_buff. Use it in drivers which still open codes that routines.[...]
Here is the summary with links:
- [net-next,1/3] stmmac: use XDP helpers
https://git.kernel.org/netdev/net-next/c/d172268f93cf - [net-next,2/3] igc: use XDP helpers https://git.kernel.org/netdev/net-next/c/082294f294f6 - [net-next,3/3] vhost_net: use XDP helpers https://git.kernel.org/netdev/net-next/c/224bf7db5518
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html