All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: use XDP helpers
@ 2021-05-14 18:39 ` Matteo Croce
  0 siblings, 0 replies; 10+ messages in thread
From: Matteo Croce @ 2021-05-14 18:39 UTC (permalink / raw)
  To: netdev, bpf, intel-wired-lan, linux-stm32, kvm, virtualization
  Cc: linux-kernel, Jesse Brandeburg, Tony Nguyen, David S. Miller,
	Jakub Kicinski, Giuseppe Cavallaro, Alexandre Torgue,
	Michael S. Tsirkin, Jason Wang

From: Matteo Croce <mcroce@microsoft.com>

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Intel-wired-lan] [PATCH net-next 0/3] net: use XDP helpers
@ 2021-05-14 18:39 ` Matteo Croce
  0 siblings, 0 replies; 10+ messages in thread
From: Matteo Croce @ 2021-05-14 18:39 UTC (permalink / raw)
  To: intel-wired-lan

From: Matteo Croce <mcroce@microsoft.com>

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net-next 1/3] stmmac: use XDP helpers
  2021-05-14 18:39 ` [Intel-wired-lan] " Matteo Croce
@ 2021-05-14 18:39   ` Matteo Croce
  -1 siblings, 0 replies; 10+ messages in thread
From: Matteo Croce @ 2021-05-14 18:39 UTC (permalink / raw)
  To: netdev, bpf, intel-wired-lan, linux-stm32, kvm, virtualization
  Cc: linux-kernel, Jesse Brandeburg, Tony Nguyen, David S. Miller,
	Jakub Kicinski, Giuseppe Cavallaro, Alexandre Torgue,
	Michael S. Tsirkin, Jason Wang

From: Matteo Croce <mcroce@microsoft.com>

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

Signed-off-by: Matteo Croce <mcroce@microsoft.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Intel-wired-lan] [PATCH net-next 1/3] stmmac: use XDP helpers
@ 2021-05-14 18:39   ` Matteo Croce
  0 siblings, 0 replies; 10+ messages in thread
From: Matteo Croce @ 2021-05-14 18:39 UTC (permalink / raw)
  To: intel-wired-lan

From: Matteo Croce <mcroce@microsoft.com>

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

Signed-off-by: Matteo Croce <mcroce@microsoft.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 2/3] igc: use XDP helpers
  2021-05-14 18:39 ` [Intel-wired-lan] " Matteo Croce
@ 2021-05-14 18:39   ` Matteo Croce
  -1 siblings, 0 replies; 10+ messages in thread
From: Matteo Croce @ 2021-05-14 18:39 UTC (permalink / raw)
  To: netdev, bpf, intel-wired-lan, linux-stm32, kvm, virtualization
  Cc: linux-kernel, Jesse Brandeburg, Tony Nguyen, David S. Miller,
	Jakub Kicinski, Giuseppe Cavallaro, Alexandre Torgue,
	Michael S. Tsirkin, Jason Wang

From: Matteo Croce <mcroce@microsoft.com>

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

Signed-off-by: Matteo Croce <mcroce@microsoft.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Intel-wired-lan] [PATCH net-next 2/3] igc: use XDP helpers
@ 2021-05-14 18:39   ` Matteo Croce
  0 siblings, 0 replies; 10+ messages in thread
From: Matteo Croce @ 2021-05-14 18:39 UTC (permalink / raw)
  To: intel-wired-lan

From: Matteo Croce <mcroce@microsoft.com>

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

Signed-off-by: Matteo Croce <mcroce@microsoft.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 3/3] vhost_net: use XDP helpers
  2021-05-14 18:39 ` [Intel-wired-lan] " Matteo Croce
@ 2021-05-14 18:39   ` Matteo Croce
  -1 siblings, 0 replies; 10+ messages in thread
From: Matteo Croce @ 2021-05-14 18:39 UTC (permalink / raw)
  To: netdev, bpf, intel-wired-lan, linux-stm32, kvm, virtualization
  Cc: linux-kernel, Jesse Brandeburg, Tony Nguyen, David S. Miller,
	Jakub Kicinski, Giuseppe Cavallaro, Alexandre Torgue,
	Michael S. Tsirkin, Jason Wang

From: Matteo Croce <mcroce@microsoft.com>

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 <mcroce@microsoft.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Intel-wired-lan] [PATCH net-next 3/3] vhost_net: use XDP helpers
@ 2021-05-14 18:39   ` Matteo Croce
  0 siblings, 0 replies; 10+ messages in thread
From: Matteo Croce @ 2021-05-14 18:39 UTC (permalink / raw)
  To: intel-wired-lan

From: Matteo Croce <mcroce@microsoft.com>

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 <mcroce@microsoft.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 0/3] net: use XDP helpers
  2021-05-14 18:39 ` [Intel-wired-lan] " Matteo Croce
@ 2021-05-14 22:30   ` patchwork-bot+netdevbpf
  -1 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-14 22:30 UTC (permalink / raw)
  To: Matteo Croce
  Cc: netdev, bpf, intel-wired-lan, linux-stm32, kvm, virtualization,
	linux-kernel, jesse.brandeburg, anthony.l.nguyen, davem, kuba,
	peppe.cavallaro, alexandre.torgue, mst, jasowang

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 <mcroce@microsoft.com>
> 
> 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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Intel-wired-lan] [PATCH net-next 0/3] net: use XDP helpers
@ 2021-05-14 22:30   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-14 22:30 UTC (permalink / raw)
  To: intel-wired-lan

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 <mcroce@microsoft.com>
> 
> 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



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-14 22:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 18:39 [PATCH net-next 0/3] net: use XDP helpers Matteo Croce
2021-05-14 18:39 ` [Intel-wired-lan] " Matteo Croce
2021-05-14 18:39 ` [PATCH net-next 1/3] stmmac: " Matteo Croce
2021-05-14 18:39   ` [Intel-wired-lan] " Matteo Croce
2021-05-14 18:39 ` [PATCH net-next 2/3] igc: " Matteo Croce
2021-05-14 18:39   ` [Intel-wired-lan] " Matteo Croce
2021-05-14 18:39 ` [PATCH net-next 3/3] vhost_net: " Matteo Croce
2021-05-14 18:39   ` [Intel-wired-lan] " Matteo Croce
2021-05-14 22:30 ` [PATCH net-next 0/3] net: " patchwork-bot+netdevbpf
2021-05-14 22:30   ` [Intel-wired-lan] " patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.