2021-05-14 20:20:59

by Matteo Croce

[permalink] [raw]
Subject: [PATCH net-next 0/3] 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(-)

--
2.31.1



2021-05-14 20:21:28

by Matteo Croce

[permalink] [raw]
Subject: [PATCH net-next 3/3] vhost_net: use XDP helpers

From: 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.

Signed-off-by: Matteo Croce <[email protected]>
---
drivers/vhost/net.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index df82b124170e..6414bd5741b8 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -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;
--
2.31.1


2021-05-15 07:14:38

by Matteo Croce

[permalink] [raw]
Subject: [PATCH net-next 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.

Signed-off-by: Matteo Croce <[email protected]>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 345b4c6d1fd4..bf9fe25fed69 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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;
--
2.31.1


2021-05-15 07:16:05

by Matteo Croce

[permalink] [raw]
Subject: [PATCH net-next 2/3] igc: use XDP helpers

From: Matteo Croce <[email protected]>

Make use of the xdp_{init,prepare}_buff() helpers instead of
an open-coded version.

Signed-off-by: Matteo Croce <[email protected]>
---
drivers/net/ethernet/intel/igc/igc_main.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 069471b7ffb0..92c0701e2a36 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -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);
}
--
2.31.1


2021-05-15 10:56:22

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next 0/3] net: use XDP helpers

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Fri, 14 May 2021 20:39:51 +0200 you wrote:
> 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.
>
> [...]

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