Skip to content

Commit ae4393d

Browse files
magnus-karlssonanguy11
authored andcommitted
i40e: fix broken XDP support
Commit 12738ac ("i40e: Fix sparse errors in i40e_txrx.c") broke XDP support in the i40e driver. That commit was fixing a sparse error in the code by introducing a new variable xdp_res instead of overloading this into the skb pointer. The problem is that the code later uses the skb pointer in if statements and these where not extended to also test for the new xdp_res variable. Fix this by adding the correct tests for xdp_res in these places. The skb pointer was used to store the result of the XDP program by overloading the results in the error pointer ERR_PTR(-result). Therefore, the allocation failure test that used to only test for !skb now need to be extended to also consider !xdp_res. i40e_cleanup_headers() had a check that based on the skb value being an error pointer, i.e. a result from the XDP program != XDP_PASS, and if so start to process a new packet immediately, instead of populating skb fields and sending the skb to the stack. This check is not needed anymore, since we have added an explicit test for xdp_res being set and if so just do continue to pick the next packet from the NIC. Fixes: 12738ac ("i40e: Fix sparse errors in i40e_txrx.c") Acked-by: Jesper Dangaard Brouer <[email protected]> Tested-by: Jesper Dangaard Brouer <[email protected]> Reported-by: Jesper Dangaard Brouer <[email protected]> Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Magnus Karlsson <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent a6f8ee5 commit ae4393d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,10 +1961,6 @@ static bool i40e_cleanup_headers(struct i40e_ring *rx_ring, struct sk_buff *skb,
19611961
union i40e_rx_desc *rx_desc)
19621962

19631963
{
1964-
/* XDP packets use error pointer so abort at this point */
1965-
if (IS_ERR(skb))
1966-
return true;
1967-
19681964
/* ERR_MASK will only have valid bits if EOP set, and
19691965
* what we are doing here is actually checking
19701966
* I40E_RX_DESC_ERROR_RXE_SHIFT, since it is the zeroth bit in
@@ -2534,7 +2530,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
25342530
}
25352531

25362532
/* exit if we failed to retrieve a buffer */
2537-
if (!skb) {
2533+
if (!xdp_res && !skb) {
25382534
rx_ring->rx_stats.alloc_buff_failed++;
25392535
rx_buffer->pagecnt_bias++;
25402536
break;
@@ -2547,7 +2543,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
25472543
if (i40e_is_non_eop(rx_ring, rx_desc))
25482544
continue;
25492545

2550-
if (i40e_cleanup_headers(rx_ring, skb, rx_desc)) {
2546+
if (xdp_res || i40e_cleanup_headers(rx_ring, skb, rx_desc)) {
25512547
skb = NULL;
25522548
continue;
25532549
}

0 commit comments

Comments
 (0)