Skip to content

Commit c824125

Browse files
Yue Haibingkuba-moo
authored andcommitted
ixgbe: Fix passing 0 to ERR_PTR in ixgbe_run_xdp()
ixgbe_run_xdp() converts customed xdp action to a negative error code with the sk_buff pointer type which be checked with IS_ERR in ixgbe_clean_rx_irq(). Remove this error pointer handing instead use plain int return value. Reviewed-by: Jacob Keller <[email protected]> Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Yue Haibing <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Chandan Kumar Rout <[email protected]> (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8ae9466 commit c824125

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,10 +1923,6 @@ bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring,
19231923
{
19241924
struct net_device *netdev = rx_ring->netdev;
19251925

1926-
/* XDP packets use error pointer so abort at this point */
1927-
if (IS_ERR(skb))
1928-
return true;
1929-
19301926
/* Verify netdev is present, and that packet does not have any
19311927
* errors that would be unacceptable to the netdev.
19321928
*/
@@ -2234,9 +2230,9 @@ static struct sk_buff *ixgbe_build_skb(struct ixgbe_ring *rx_ring,
22342230
return skb;
22352231
}
22362232

2237-
static struct sk_buff *ixgbe_run_xdp(struct ixgbe_adapter *adapter,
2238-
struct ixgbe_ring *rx_ring,
2239-
struct xdp_buff *xdp)
2233+
static int ixgbe_run_xdp(struct ixgbe_adapter *adapter,
2234+
struct ixgbe_ring *rx_ring,
2235+
struct xdp_buff *xdp)
22402236
{
22412237
int err, result = IXGBE_XDP_PASS;
22422238
struct bpf_prog *xdp_prog;
@@ -2286,7 +2282,7 @@ static struct sk_buff *ixgbe_run_xdp(struct ixgbe_adapter *adapter,
22862282
break;
22872283
}
22882284
xdp_out:
2289-
return ERR_PTR(-result);
2285+
return result;
22902286
}
22912287

22922288
static unsigned int ixgbe_rx_frame_truesize(struct ixgbe_ring *rx_ring,
@@ -2344,6 +2340,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
23442340
unsigned int offset = rx_ring->rx_offset;
23452341
unsigned int xdp_xmit = 0;
23462342
struct xdp_buff xdp;
2343+
int xdp_res = 0;
23472344

23482345
/* Frame size depend on rx_ring setup when PAGE_SIZE=4K */
23492346
#if (PAGE_SIZE < 8192)
@@ -2389,12 +2386,10 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
23892386
/* At larger PAGE_SIZE, frame_sz depend on len size */
23902387
xdp.frame_sz = ixgbe_rx_frame_truesize(rx_ring, size);
23912388
#endif
2392-
skb = ixgbe_run_xdp(adapter, rx_ring, &xdp);
2389+
xdp_res = ixgbe_run_xdp(adapter, rx_ring, &xdp);
23932390
}
23942391

2395-
if (IS_ERR(skb)) {
2396-
unsigned int xdp_res = -PTR_ERR(skb);
2397-
2392+
if (xdp_res) {
23982393
if (xdp_res & (IXGBE_XDP_TX | IXGBE_XDP_REDIR)) {
23992394
xdp_xmit |= xdp_res;
24002395
ixgbe_rx_buffer_flip(rx_ring, rx_buffer, size);
@@ -2414,7 +2409,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
24142409
}
24152410

24162411
/* exit if we failed to retrieve a buffer */
2417-
if (!skb) {
2412+
if (!xdp_res && !skb) {
24182413
rx_ring->rx_stats.alloc_rx_buff_failed++;
24192414
rx_buffer->pagecnt_bias++;
24202415
break;
@@ -2428,7 +2423,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
24282423
continue;
24292424

24302425
/* verify the packet layout is correct */
2431-
if (ixgbe_cleanup_headers(rx_ring, rx_desc, skb))
2426+
if (xdp_res || ixgbe_cleanup_headers(rx_ring, rx_desc, skb))
24322427
continue;
24332428

24342429
/* probably a little skewed due to removing CRC */

0 commit comments

Comments
 (0)