Skip to contentSkip to conversation

Fix XDP bug in ENA driver

PATCH Applied Shay Agroskin 2 participants 3 messages Feb 5, 2021 – Feb 6, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Fix XDP bug in ENA driver

Hi all,
This single patch fixes a bug spotted in previous XDP Redirect implementation in ENA.

Shay Agroskin (1):
net: ena: Update XDP verdict upon failure

 drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 net: ena: Update XDP verdict upon failure

The verdict returned from ena_xdp_execute() is used to determine the fate of the RX buffer's page. In case of XDP Redirect/TX error the verdict should be set to XDP_ABORTED, otherwise the page won't be freed.

Fixes a318c70ad152 ("net: ena: introduce XDP redirect implementation")
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_netdev.c +5 -1
index 06596fa1f..a0596c073 100644
@@ -404,6 +404,7 @@ static int ena_xdp_execute(struct ena_ring *rx_ring, struct xdp_buff *xdp)
 		if (unlikely(!xdpf)) {
 			trace_xdp_exception(rx_ring->netdev, xdp_prog, verdict);
 			xdp_stat = &rx_ring->rx_stats.xdp_aborted;
+			verdict = XDP_ABORTED;
 			break;
 		}
 
@@ -424,7 +425,10 @@ static int ena_xdp_execute(struct ena_ring *rx_ring, struct xdp_buff *xdp)
 			xdp_stat = &rx_ring->rx_stats.xdp_redirect;
 			break;
 		}
-		fallthrough;
+		trace_xdp_exception(rx_ring->netdev, xdp_prog, verdict);
+		xdp_stat = &rx_ring->rx_stats.xdp_aborted;
+		verdict = XDP_ABORTED;
+		break;
 	case XDP_ABORTED:
 		trace_xdp_exception(rx_ring->netdev, xdp_prog, verdict);
 		xdp_stat = &rx_ring->rx_stats.xdp_aborted;
Signature · 1 line
2.17.1
#2 lore raw
In reply to Shay Agroskin
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 8 lines · On Fri, 5 Feb 2021 21:51:13 +0200 you wrote:

Hi all,
This single patch fixes a bug spotted in previous XDP Redirect implementation in ENA.

Shay Agroskin (1):
net: ena: Update XDP verdict upon failure

[...]

Here is the summary with links:
- [net,V1,1/1] net: ena: Update XDP verdict upon failure

    https://git.kernel.org/netdev/net/c/225353c070fd

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html