Skip to contentSkip to conversation

Fix xdp in ena driver

PATCH Superseded [email protected] 3 participants 7 messages Jun 2, 2020 – Jun 3, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix xdp in ena driver

From: Sameeh Jubran <[email protected]>

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(-)
Signature · 1 line
2.24.1.AMZN
#1 lore raw

PATCH 1/2 net: ena: xdp: XDP_TX: fix memory leak

From: Sameeh Jubran <[email protected]>

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")
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +1 -1
index 281896542..ec115b753 100644
@@ -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;
 }
 
Signature · 1 line
2.24.1.AMZN
#2 lore raw

PATCH 2/2 net: ena: xdp: update napi budget for DROP and ABORTED

In reply to [email protected]

From: Sameeh Jubran <[email protected]>

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")
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +4 -4
index ec115b753..2beccda7e 100644
@@ -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;
 		}
 
Signature · 1 line
2.24.1.AMZN
maintainer
#3 lore raw
In reply to [email protected]
Quoted 3 lines · On Tue, 2 Jun 2020 13:21:49 +0000 [email protected] wrote:

From: Sameeh Jubran <[email protected]>

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")'
maintainer
#4 lore raw
In reply to Jakub Kicinski

From: Jakub Kicinski <[email protected]>
Date: Tue, 2 Jun 2020 09:23:33 -0700

Quoted 5 lines · On Tue, 2 Jun 2020 13:21:49 +0000 [email protected] wrote:
Quoted 3 lines

From: Sameeh Jubran <[email protected]>

This patchset includes 2 XDP related bug fixes.

Quoted 7 lines

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.

#5 lore raw
Quoted 33 lines

-----Original Message-----
From: David Miller <[email protected]>
Sent: Wednesday, June 3, 2020 1:44 AM
To: [email protected]
Cc: Jubran, Samih <[email protected]>; [email protected]; Woodhouse, David <[email protected]>; Machulsky, Zorik <[email protected]>; Matushevsky, Alexander <[email protected]>; Bshara, Saeed <[email protected]>; Wilson, Matt <[email protected]>; Liguori, Anthony <[email protected]>; Bshara, Nafea <[email protected]>; Tzalik, Guy <[email protected]>; Belgazal, Netanel <[email protected]>; Saidi, Ali <[email protected]>; Herrenschmidt, Benjamin <[email protected]>; Kiyanovski, Arthur <[email protected]>; Dagan, Noam <[email protected]>
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 <[email protected]>
Date: Tue, 2 Jun 2020 09:23:33 -0700

Quoted 7 lines · On Tue, 2 Jun 2020 13:21:49 +0000 [email protected] wrote:
Quoted 3 lines

From: Sameeh Jubran <[email protected]>

This patchset includes 2 XDP related bug fixes.

Both of them have this problem

Quoted 7 lines
Quoted 5 lines

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.