All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: netsec: add xdp tx return bulking support
@ 2020-11-17  9:35 Lorenzo Bianconi
  2020-11-20 18:00 ` Jakub Kicinski
  0 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Bianconi @ 2020-11-17  9:35 UTC (permalink / raw)
  To: netdev; +Cc: lorenzo.bianconi, davem, kuba, brouer, ilias.apalodimas

Convert netsec driver to xdp_return_frame_bulk APIs.
Rely on xdp_return_frame_rx_napi for XDP_TX in order to try to recycle
the page in the "in-irq" page_pool cache.

Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
This patch is just compile tested, I have not carried out any run test
---
 drivers/net/ethernet/socionext/netsec.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index 1503cc9ec6e2..536aa8961dc6 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -631,6 +631,7 @@ static void netsec_set_rx_de(struct netsec_priv *priv,
 static bool netsec_clean_tx_dring(struct netsec_priv *priv)
 {
 	struct netsec_desc_ring *dring = &priv->desc_ring[NETSEC_RING_TX];
+	struct xdp_frame_bulk bq;
 	struct netsec_de *entry;
 	int tail = dring->tail;
 	unsigned int bytes;
@@ -639,8 +640,11 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv)
 	spin_lock(&dring->lock);
 
 	bytes = 0;
+	xdp_frame_bulk_init(&bq);
 	entry = dring->vaddr + DESC_SZ * tail;
 
+	rcu_read_lock(); /* need for xdp_return_frame_bulk */
+
 	while (!(entry->attr & (1U << NETSEC_TX_SHIFT_OWN_FIELD)) &&
 	       cnt < DESC_NUM) {
 		struct netsec_desc *desc;
@@ -665,7 +669,10 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv)
 			dev_kfree_skb(desc->skb);
 		} else {
 			bytes += desc->xdpf->len;
-			xdp_return_frame(desc->xdpf);
+			if (desc->buf_type == TYPE_NETSEC_XDP_TX)
+				xdp_return_frame_rx_napi(desc->xdpf);
+			else
+				xdp_return_frame_bulk(desc->xdpf, &bq);
 		}
 next:
 		/* clean up so netsec_uninit_pkt_dring() won't free the skb
@@ -684,6 +691,9 @@ static bool netsec_clean_tx_dring(struct netsec_priv *priv)
 		entry = dring->vaddr + DESC_SZ * tail;
 		cnt++;
 	}
+	xdp_flush_frame_bulk(&bq);
+
+	rcu_read_unlock();
 
 	spin_unlock(&dring->lock);
 
-- 
2.26.2


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

* Re: [PATCH net-next] net: netsec: add xdp tx return bulking support
  2020-11-17  9:35 [PATCH net-next] net: netsec: add xdp tx return bulking support Lorenzo Bianconi
@ 2020-11-20 18:00 ` Jakub Kicinski
  2020-11-20 18:07   ` Ilias Apalodimas
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2020-11-20 18:00 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: netdev, lorenzo.bianconi, davem, brouer, ilias.apalodimas

On Tue, 17 Nov 2020 10:35:28 +0100 Lorenzo Bianconi wrote:
> Convert netsec driver to xdp_return_frame_bulk APIs.
> Rely on xdp_return_frame_rx_napi for XDP_TX in order to try to recycle
> the page in the "in-irq" page_pool cache.
> 
> Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> This patch is just compile tested, I have not carried out any run test

Doesn't look like anyone will test this so applied, thanks!

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

* Re: [PATCH net-next] net: netsec: add xdp tx return bulking support
  2020-11-20 18:00 ` Jakub Kicinski
@ 2020-11-20 18:07   ` Ilias Apalodimas
  2020-11-20 18:14     ` Jakub Kicinski
  0 siblings, 1 reply; 6+ messages in thread
From: Ilias Apalodimas @ 2020-11-20 18:07 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Lorenzo Bianconi, netdev, lorenzo.bianconi, davem, brouer

Hi Jakub, 

On Fri, Nov 20, 2020 at 10:00:07AM -0800, Jakub Kicinski wrote:
> On Tue, 17 Nov 2020 10:35:28 +0100 Lorenzo Bianconi wrote:
> > Convert netsec driver to xdp_return_frame_bulk APIs.
> > Rely on xdp_return_frame_rx_napi for XDP_TX in order to try to recycle
> > the page in the "in-irq" page_pool cache.
> > 
> > Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > ---
> > This patch is just compile tested, I have not carried out any run test
> 
> Doesn't look like anyone will test this so applied, thanks!

I had everything applied trying to test, but there was an issue with the PHY the
socionext board uses [1].

In any case the patch looks correct, so you can keep it and I'll report any 
problems once I short the box out.

[1] https://lore.kernel.org/netdev/20201017151132.GK456889@lunn.ch/T/

Cheers
/Ilias

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

* Re: [PATCH net-next] net: netsec: add xdp tx return bulking support
  2020-11-20 18:07   ` Ilias Apalodimas
@ 2020-11-20 18:14     ` Jakub Kicinski
  2020-12-04 14:07       ` Ilias Apalodimas
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2020-11-20 18:14 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: Lorenzo Bianconi, netdev, lorenzo.bianconi, davem, brouer

On Fri, 20 Nov 2020 20:07:13 +0200 Ilias Apalodimas wrote:
> On Fri, Nov 20, 2020 at 10:00:07AM -0800, Jakub Kicinski wrote:
> > On Tue, 17 Nov 2020 10:35:28 +0100 Lorenzo Bianconi wrote:  
> > > Convert netsec driver to xdp_return_frame_bulk APIs.
> > > Rely on xdp_return_frame_rx_napi for XDP_TX in order to try to recycle
> > > the page in the "in-irq" page_pool cache.
> > > 
> > > Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > > ---
> > > This patch is just compile tested, I have not carried out any run test  
> > 
> > Doesn't look like anyone will test this so applied, thanks!  
> 
> I had everything applied trying to test, but there was an issue with the PHY the
> socionext board uses [1].

FWIW feel free to send a note saying you need more time.

> In any case the patch looks correct, so you can keep it and I'll report any 
> problems once I short the box out.

Cool, fingers crossed :)

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

* Re: [PATCH net-next] net: netsec: add xdp tx return bulking support
  2020-11-20 18:14     ` Jakub Kicinski
@ 2020-12-04 14:07       ` Ilias Apalodimas
  2020-12-04 16:08         ` Jakub Kicinski
  0 siblings, 1 reply; 6+ messages in thread
From: Ilias Apalodimas @ 2020-12-04 14:07 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Lorenzo Bianconi, netdev, lorenzo.bianconi, davem, brouer

Hi Jakub, 

On Fri, Nov 20, 2020 at 10:14:34AM -0800, Jakub Kicinski wrote:
> On Fri, 20 Nov 2020 20:07:13 +0200 Ilias Apalodimas wrote:
> > On Fri, Nov 20, 2020 at 10:00:07AM -0800, Jakub Kicinski wrote:
> > > On Tue, 17 Nov 2020 10:35:28 +0100 Lorenzo Bianconi wrote:  
> > > > Convert netsec driver to xdp_return_frame_bulk APIs.
> > > > Rely on xdp_return_frame_rx_napi for XDP_TX in order to try to recycle
> > > > the page in the "in-irq" page_pool cache.
> > > > 
> > > > Co-developed-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > > > Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
> > > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > > > ---
> > > > This patch is just compile tested, I have not carried out any run test  
> > > 
> > > Doesn't look like anyone will test this so applied, thanks!  
> > 
> > I had everything applied trying to test, but there was an issue with the PHY the
> > socionext board uses [1].
> 
> FWIW feel free to send a note saying you need more time.
> 
> > In any case the patch looks correct, so you can keep it and I'll report any 
> > problems once I short the box out.
> 
> Cool, fingers crossed :)

FWIW I did eventually test this. 
I can't see anything wrong with it.

Cheers
/Ilias

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

* Re: [PATCH net-next] net: netsec: add xdp tx return bulking support
  2020-12-04 14:07       ` Ilias Apalodimas
@ 2020-12-04 16:08         ` Jakub Kicinski
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2020-12-04 16:08 UTC (permalink / raw)
  To: Ilias Apalodimas
  Cc: Lorenzo Bianconi, netdev, lorenzo.bianconi, davem, brouer

On Fri, 4 Dec 2020 16:07:54 +0200 Ilias Apalodimas wrote:
> > > I had everything applied trying to test, but there was an issue with the PHY the
> > > socionext board uses [1].  
> > 
> > FWIW feel free to send a note saying you need more time.
> >   
> > > In any case the patch looks correct, so you can keep it and I'll report any 
> > > problems once I short the box out.  
> > 
> > Cool, fingers crossed :)  
> 
> FWIW I did eventually test this. 
> I can't see anything wrong with it.

Good to know, thank you!

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

end of thread, other threads:[~2020-12-04 16:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17  9:35 [PATCH net-next] net: netsec: add xdp tx return bulking support Lorenzo Bianconi
2020-11-20 18:00 ` Jakub Kicinski
2020-11-20 18:07   ` Ilias Apalodimas
2020-11-20 18:14     ` Jakub Kicinski
2020-12-04 14:07       ` Ilias Apalodimas
2020-12-04 16:08         ` Jakub Kicinski

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.