netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 net 0/2] Fix xdp in ena driver
@ 2020-06-03  8:50 sameehj
  2020-06-03  8:50 ` [PATCH V2 net 1/2] net: ena: xdp: XDP_TX: fix memory leak sameehj
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sameehj @ 2020-06-03  8:50 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

Difference from v1:
* Fixed "Fixes" tag

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] 6+ messages in thread

* [PATCH V2 net 1/2] net: ena: xdp: XDP_TX: fix memory leak
  2020-06-03  8:50 [PATCH V2 net 0/2] Fix xdp in ena driver sameehj
@ 2020-06-03  8:50 ` sameehj
  2020-06-03  8:50 ` [PATCH V2 net 2/2] net: ena: xdp: update napi budget for DROP and ABORTED sameehj
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sameehj @ 2020-06-03  8:50 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: 548c4940b9f1 ("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] 6+ messages in thread

* [PATCH V2 net 2/2] net: ena: xdp: update napi budget for DROP and ABORTED
  2020-06-03  8:50 [PATCH V2 net 0/2] Fix xdp in ena driver sameehj
  2020-06-03  8:50 ` [PATCH V2 net 1/2] net: ena: xdp: XDP_TX: fix memory leak sameehj
@ 2020-06-03  8:50 ` sameehj
  2020-06-04  3:12 ` [PATCH V2 net 0/2] Fix xdp in ena driver Jakub Kicinski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sameehj @ 2020-06-03  8:50 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: 548c4940b9f1 ("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] 6+ messages in thread

* Re: [PATCH V2 net 0/2] Fix xdp in ena driver
  2020-06-03  8:50 [PATCH V2 net 0/2] Fix xdp in ena driver sameehj
  2020-06-03  8:50 ` [PATCH V2 net 1/2] net: ena: xdp: XDP_TX: fix memory leak sameehj
  2020-06-03  8:50 ` [PATCH V2 net 2/2] net: ena: xdp: update napi budget for DROP and ABORTED sameehj
@ 2020-06-04  3:12 ` Jakub Kicinski
  2020-06-04  9:24 ` Jesper Dangaard Brouer
  2020-06-04 22:43 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2020-06-04  3:12 UTC (permalink / raw)
  To: sameehj
  Cc: davem, netdev, dwmw, zorik, matua, saeedb, msw, aliguori, nafea,
	gtzalik, netanel, alisaidi, benh, akiyano, ndagan

On Wed, 3 Jun 2020 08:50:21 +0000 sameehj@amazon.com wrote:
> From: Sameeh Jubran <sameehj@amazon.com>
> 
> This patchset includes 2 XDP related bug fixes

All clean now :)

Acked-by: Jakub Kicinski <kuba@kernel.org>

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

* Re: [PATCH V2 net 0/2] Fix xdp in ena driver
  2020-06-03  8:50 [PATCH V2 net 0/2] Fix xdp in ena driver sameehj
                   ` (2 preceding siblings ...)
  2020-06-04  3:12 ` [PATCH V2 net 0/2] Fix xdp in ena driver Jakub Kicinski
@ 2020-06-04  9:24 ` Jesper Dangaard Brouer
  2020-06-04 22:43 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Jesper Dangaard Brouer @ 2020-06-04  9:24 UTC (permalink / raw)
  To: sameehj
  Cc: brouer, davem, netdev, dwmw, zorik, matua, saeedb, msw, aliguori,
	nafea, gtzalik, netanel, alisaidi, benh, akiyano, ndagan

On Wed, 3 Jun 2020 08:50:21 +0000
<sameehj@amazon.com> wrote:

> From: Sameeh Jubran <sameehj@amazon.com>
> 
> This patchset includes 2 XDP related bug fixes
> 
> Difference from v1:
> * Fixed "Fixes" tag
> 
> 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(-)

LGTM

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer


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

* Re: [PATCH V2 net 0/2] Fix xdp in ena driver
  2020-06-03  8:50 [PATCH V2 net 0/2] Fix xdp in ena driver sameehj
                   ` (3 preceding siblings ...)
  2020-06-04  9:24 ` Jesper Dangaard Brouer
@ 2020-06-04 22:43 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-06-04 22:43 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: Wed, 3 Jun 2020 08:50:21 +0000

> From: Sameeh Jubran <sameehj@amazon.com>
> 
> This patchset includes 2 XDP related bug fixes
> 
> Difference from v1:
> * Fixed "Fixes" tag

Series applied, thanks.

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

end of thread, other threads:[~2020-06-04 22:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03  8:50 [PATCH V2 net 0/2] Fix xdp in ena driver sameehj
2020-06-03  8:50 ` [PATCH V2 net 1/2] net: ena: xdp: XDP_TX: fix memory leak sameehj
2020-06-03  8:50 ` [PATCH V2 net 2/2] net: ena: xdp: update napi budget for DROP and ABORTED sameehj
2020-06-04  3:12 ` [PATCH V2 net 0/2] Fix xdp in ena driver Jakub Kicinski
2020-06-04  9:24 ` Jesper Dangaard Brouer
2020-06-04 22:43 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).