@@ -8658,9 +8658,8 @@ static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring,
86588658 return skb ;
86598659}
86608660
8661- static struct sk_buff * igb_run_xdp (struct igb_adapter * adapter ,
8662- struct igb_ring * rx_ring ,
8663- struct xdp_buff * xdp )
8661+ static int igb_run_xdp (struct igb_adapter * adapter , struct igb_ring * rx_ring ,
8662+ struct xdp_buff * xdp )
86648663{
86658664 int err , result = IGB_XDP_PASS ;
86668665 struct bpf_prog * xdp_prog ;
@@ -8700,7 +8699,7 @@ static struct sk_buff *igb_run_xdp(struct igb_adapter *adapter,
87008699 break ;
87018700 }
87028701xdp_out :
8703- return ERR_PTR ( - result ) ;
8702+ return result ;
87048703}
87058704
87068705static unsigned int igb_rx_frame_truesize (struct igb_ring * rx_ring ,
@@ -8826,10 +8825,6 @@ static bool igb_cleanup_headers(struct igb_ring *rx_ring,
88268825 union e1000_adv_rx_desc * rx_desc ,
88278826 struct sk_buff * skb )
88288827{
8829- /* XDP packets use error pointer so abort at this point */
8830- if (IS_ERR (skb ))
8831- return true;
8832-
88338828 if (unlikely ((igb_test_staterr (rx_desc ,
88348829 E1000_RXDEXT_ERR_FRAME_ERR_MASK )))) {
88358830 struct net_device * netdev = rx_ring -> netdev ;
@@ -8983,6 +8978,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
89838978 struct xdp_buff xdp ;
89848979 u32 frame_sz = 0 ;
89858980 int rx_buf_pgcnt ;
8981+ int xdp_res = 0 ;
89868982
89878983 /* Frame size depend on rx_ring setup when PAGE_SIZE=4K */
89888984#if (PAGE_SIZE < 8192 )
@@ -9040,12 +9036,10 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
90409036 /* At larger PAGE_SIZE, frame_sz depend on len size */
90419037 xdp .frame_sz = igb_rx_frame_truesize (rx_ring , size );
90429038#endif
9043- skb = igb_run_xdp (adapter , rx_ring , & xdp );
9039+ xdp_res = igb_run_xdp (adapter , rx_ring , & xdp );
90449040 }
90459041
9046- if (IS_ERR (skb )) {
9047- unsigned int xdp_res = - PTR_ERR (skb );
9048-
9042+ if (xdp_res ) {
90499043 if (xdp_res & (IGB_XDP_TX | IGB_XDP_REDIR )) {
90509044 xdp_xmit |= xdp_res ;
90519045 igb_rx_buffer_flip (rx_ring , rx_buffer , size );
@@ -9064,7 +9058,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
90649058 & xdp , timestamp );
90659059
90669060 /* exit if we failed to retrieve a buffer */
9067- if (!skb ) {
9061+ if (!xdp_res && ! skb ) {
90689062 rx_ring -> rx_stats .alloc_failed ++ ;
90699063 rx_buffer -> pagecnt_bias ++ ;
90709064 break ;
@@ -9078,7 +9072,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
90789072 continue ;
90799073
90809074 /* verify the packet layout is correct */
9081- if (igb_cleanup_headers (rx_ring , rx_desc , skb )) {
9075+ if (xdp_res || igb_cleanup_headers (rx_ring , rx_desc , skb )) {
90829076 skb = NULL ;
90839077 continue ;
90849078 }
0 commit comments