All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V1 net 0/2] Fix xdp in ena driver
@ 2020-06-02 13:21 sameehj
  2020-06-02 13:21 ` [PATCH V1 net 1/2] net: ena: xdp: XDP_TX: fix memory leak sameehj
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: sameehj @ 2020-06-02 13:21 UTC (permalink / raw)
  To: davem, netdev
  Cc: Sameeh Jubran, dwmw, zorik, matua, saeedb, msw, aliguori, nafea,
	gtzalik, netanel, alisaidi, benh, akiyano, ndagan

From: Sameeh Jubran <sameehj@amazon.com>

This patchset includes 2 XDP related bug fixes.

Sameeh Jubran (2):
  net: ena: xdp: XDP_TX: fix memory leak
  net: ena: xdp: update napi budget for DROP and ABORTED

 drivers/net/ethernet/amazon/ena/ena_netdev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.24.1.AMZN


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

* [PATCH V1 net 1/2] net: ena: xdp: XDP_TX: fix memory leak
  2020-06-02 13:21 [PATCH V1 net 0/2] Fix xdp in ena driver sameehj
@ 2020-06-02 13:21 ` sameehj
  2020-06-02 13:21 ` [PATCH V1 net 2/2] net: ena: xdp: update napi budget for DROP and ABORTED sameehj
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: sameehj @ 2020-06-02 13:21 UTC (permalink / raw)
  To: davem, netdev
  Cc: Sameeh Jubran, dwmw, zorik, matua, saeedb, msw, aliguori, nafea,
	gtzalik, netanel, alisaidi, benh, akiyano, ndagan

From: Sameeh Jubran <sameehj@amazon.com>

When sending very high packet rate, the XDP tx queues can get full and
start dropping packets. In this case we don't free the pages which
results in ena driver draining the system memory.

Fix:
Simply free the pages when necessary.

Fixes: cad451dd2427 ("net: ena: Implement XDP_TX action")
Signed-off-by: Sameeh Jubran <sameehj@amazon.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 281896542..ec115b753 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -355,7 +355,7 @@ error_unmap_dma:
 	ena_unmap_tx_buff(xdp_ring, tx_info);
 	tx_info->xdpf = NULL;
 error_drop_packet:
-
+	__free_page(tx_info->xdp_rx_page);
 	return NETDEV_TX_OK;
 }
 
-- 
2.24.1.AMZN


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

* [PATCH V1 net 2/2] net: ena: xdp: update napi budget for DROP and ABORTED
  2020-06-02 13:21 [PATCH V1 net 0/2] Fix xdp in ena driver sameehj
  2020-06-02 13:21 ` [PATCH V1 net 1/2] net: ena: xdp: XDP_TX: fix memory leak sameehj
@ 2020-06-02 13:21 ` sameehj
  2020-06-02 16:23 ` [PATCH V1 net 0/2] Fix xdp in ena driver Jakub Kicinski
  2020-06-02 22:42 ` David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: sameehj @ 2020-06-02 13:21 UTC (permalink / raw)
  To: davem, netdev
  Cc: Sameeh Jubran, dwmw, zorik, matua, saeedb, msw, aliguori, nafea,
	gtzalik, netanel, alisaidi, benh, akiyano, ndagan

From: Sameeh Jubran <sameehj@amazon.com>

This patch fixes two issues with XDP:

1. If the XDP verdict is XDP_ABORTED we break the loop, which results in
   us handling one buffer per napi cycle instead of the total budget
   (usually 64). To overcome this simply change the xdp_verdict check to
   != XDP_PASS. When the verdict is XDP_PASS, the skb is not expected to
   be NULL.

2. Update the residual budget for XDP_DROP and XDP_ABORTED, since
   packets are handled in these cases.

Fixes: cad451dd2427 ("net: ena: Implement XDP_TX action")
Signed-off-by: Sameeh Jubran <sameehj@amazon.com>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index ec115b753..2beccda7e 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1638,11 +1638,9 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
 					 &next_to_clean);
 
 		if (unlikely(!skb)) {
-			if (xdp_verdict == XDP_TX) {
+			if (xdp_verdict == XDP_TX)
 				ena_free_rx_page(rx_ring,
 						 &rx_ring->rx_buffer_info[rx_ring->ena_bufs[0].req_id]);
-				res_budget--;
-			}
 			for (i = 0; i < ena_rx_ctx.descs; i++) {
 				rx_ring->free_ids[next_to_clean] =
 					rx_ring->ena_bufs[i].req_id;
@@ -1650,8 +1648,10 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
 					ENA_RX_RING_IDX_NEXT(next_to_clean,
 							     rx_ring->ring_size);
 			}
-			if (xdp_verdict == XDP_TX || xdp_verdict == XDP_DROP)
+			if (xdp_verdict != XDP_PASS) {
+				res_budget--;
 				continue;
+			}
 			break;
 		}
 
-- 
2.24.1.AMZN


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

* Re: [PATCH V1 net 0/2] Fix xdp in ena driver
  2020-06-02 13:21 [PATCH V1 net 0/2] Fix xdp in ena driver sameehj
  2020-06-02 13:21 ` [PATCH V1 net 1/2] net: ena: xdp: XDP_TX: fix memory leak sameehj
  2020-06-02 13:21 ` [PATCH V1 net 2/2] net: ena: xdp: update napi budget for DROP and ABORTED sameehj
@ 2020-06-02 16:23 ` Jakub Kicinski
  2020-06-02 22:44   ` David Miller
  2020-06-02 22:42 ` David Miller
  3 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2020-06-02 16:23 UTC (permalink / raw)
  To: sameehj
  Cc: davem, netdev, dwmw, zorik, matua, saeedb, msw, aliguori, nafea,
	gtzalik, netanel, alisaidi, benh, akiyano, ndagan

On Tue, 2 Jun 2020 13:21:49 +0000 sameehj@amazon.com wrote:
> From: Sameeh Jubran <sameehj@amazon.com>
> 
> This patchset includes 2 XDP related bug fixes.

Both of them have this problem

Fixes tag: Fixes: cad451dd2427 ("net: ena: Implement XDP_TX action")
Has these problem(s):
	- Subject does not match target commit subject
	  Just use
		git log -1 --format='Fixes: %h ("%s")'

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

* Re: [PATCH V1 net 0/2] Fix xdp in ena driver
  2020-06-02 13:21 [PATCH V1 net 0/2] Fix xdp in ena driver sameehj
                   ` (2 preceding siblings ...)
  2020-06-02 16:23 ` [PATCH V1 net 0/2] Fix xdp in ena driver Jakub Kicinski
@ 2020-06-02 22:42 ` David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2020-06-02 22:42 UTC (permalink / raw)
  To: sameehj
  Cc: netdev, dwmw, zorik, matua, saeedb, msw, aliguori, nafea,
	gtzalik, netanel, alisaidi, benh, akiyano, ndagan

From: <sameehj@amazon.com>
Date: Tue, 2 Jun 2020 13:21:49 +0000

> From: Sameeh Jubran <sameehj@amazon.com>
> 
> This patchset includes 2 XDP related bug fixes.

Series applied and queued up for v5.6 -stable, thanks.

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

* Re: [PATCH V1 net 0/2] Fix xdp in ena driver
  2020-06-02 16:23 ` [PATCH V1 net 0/2] Fix xdp in ena driver Jakub Kicinski
@ 2020-06-02 22:44   ` David Miller
  2020-06-03  8:54     ` Jubran, Samih
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2020-06-02 22:44 UTC (permalink / raw)
  To: kuba
  Cc: sameehj, netdev, dwmw, zorik, matua, saeedb, msw, aliguori,
	nafea, gtzalik, netanel, alisaidi, benh, akiyano, ndagan

From: Jakub Kicinski <kuba@kernel.org>
Date: Tue, 2 Jun 2020 09:23:33 -0700

> On Tue, 2 Jun 2020 13:21:49 +0000 sameehj@amazon.com wrote:
>> From: Sameeh Jubran <sameehj@amazon.com>
>> 
>> This patchset includes 2 XDP related bug fixes.
> 
> Both of them have this problem
> 
> Fixes tag: Fixes: cad451dd2427 ("net: ena: Implement XDP_TX action")
> Has these problem(s):
> 	- Subject does not match target commit subject
> 	  Just use
> 		git log -1 --format='Fixes: %h ("%s")'

Whoops, I'll revert, please fix this up.

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

* RE: [PATCH V1 net 0/2] Fix xdp in ena driver
  2020-06-02 22:44   ` David Miller
@ 2020-06-03  8:54     ` Jubran, Samih
  0 siblings, 0 replies; 7+ messages in thread
From: Jubran, Samih @ 2020-06-03  8:54 UTC (permalink / raw)
  To: David Miller, kuba
  Cc: netdev, Woodhouse, David, Machulsky, Zorik, Matushevsky,
	Alexander, Bshara, Saeed, Wilson, Matt, Liguori, Anthony, Bshara,
	Nafea, Tzalik, Guy, Belgazal, Netanel, Saidi, Ali, Herrenschmidt,
	Benjamin, Kiyanovski, Arthur, Dagan, Noam



> -----Original Message-----
> From: David Miller <davem@davemloft.net>
> Sent: Wednesday, June 3, 2020 1:44 AM
> To: kuba@kernel.org
> Cc: Jubran, Samih <sameehj@amazon.com>; netdev@vger.kernel.org;
> Woodhouse, David <dwmw@amazon.co.uk>; Machulsky, Zorik
> <zorik@amazon.com>; Matushevsky, Alexander <matua@amazon.com>;
> Bshara, Saeed <saeedb@amazon.com>; Wilson, Matt <msw@amazon.com>;
> Liguori, Anthony <aliguori@amazon.com>; Bshara, Nafea
> <nafea@amazon.com>; Tzalik, Guy <gtzalik@amazon.com>; Belgazal,
> Netanel <netanel@amazon.com>; Saidi, Ali <alisaidi@amazon.com>;
> Herrenschmidt, Benjamin <benh@amazon.com>; Kiyanovski, Arthur
> <akiyano@amazon.com>; Dagan, Noam <ndagan@amazon.com>
> Subject: RE: [EXTERNAL] [PATCH V1 net 0/2] Fix xdp in ena driver
> 
> CAUTION: This email originated from outside of the organization. Do not click
> links or open attachments unless you can confirm the sender and know the
> content is safe.
> 
> 
> 
> From: Jakub Kicinski <kuba@kernel.org>
> Date: Tue, 2 Jun 2020 09:23:33 -0700
> 
> > On Tue, 2 Jun 2020 13:21:49 +0000 sameehj@amazon.com wrote:
> >> From: Sameeh Jubran <sameehj@amazon.com>
> >>
> >> This patchset includes 2 XDP related bug fixes.
> >
> > Both of them have this problem
> >
> > Fixes tag: Fixes: cad451dd2427 ("net: ena: Implement XDP_TX action")
> > Has these problem(s):
> >       - Subject does not match target commit subject
> >         Just use
> >               git log -1 --format='Fixes: %h ("%s")'
> 
> Whoops, I'll revert, please fix this up.

Sorry, fixed in V2.

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

end of thread, other threads:[~2020-06-03  8:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 13:21 [PATCH V1 net 0/2] Fix xdp in ena driver sameehj
2020-06-02 13:21 ` [PATCH V1 net 1/2] net: ena: xdp: XDP_TX: fix memory leak sameehj
2020-06-02 13:21 ` [PATCH V1 net 2/2] net: ena: xdp: update napi budget for DROP and ABORTED sameehj
2020-06-02 16:23 ` [PATCH V1 net 0/2] Fix xdp in ena driver Jakub Kicinski
2020-06-02 22:44   ` David Miller
2020-06-03  8:54     ` Jubran, Samih
2020-06-02 22:42 ` David Miller

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.