@@ -1778,7 +1778,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
1778
1778
skb = bnxt_copy_skb (bnapi , data_ptr , len , mapping );
1779
1779
if (!skb ) {
1780
1780
bnxt_abort_tpa (cpr , idx , agg_bufs );
1781
- cpr -> sw_stats .rx .rx_oom_discards += 1 ;
1781
+ cpr -> bnapi -> cp_ring . sw_stats .rx .rx_oom_discards += 1 ;
1782
1782
return NULL ;
1783
1783
}
1784
1784
} else {
@@ -1788,7 +1788,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
1788
1788
new_data = __bnxt_alloc_rx_frag (bp , & new_mapping , GFP_ATOMIC );
1789
1789
if (!new_data ) {
1790
1790
bnxt_abort_tpa (cpr , idx , agg_bufs );
1791
- cpr -> sw_stats .rx .rx_oom_discards += 1 ;
1791
+ cpr -> bnapi -> cp_ring . sw_stats .rx .rx_oom_discards += 1 ;
1792
1792
return NULL ;
1793
1793
}
1794
1794
@@ -1804,7 +1804,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
1804
1804
if (!skb ) {
1805
1805
skb_free_frag (data );
1806
1806
bnxt_abort_tpa (cpr , idx , agg_bufs );
1807
- cpr -> sw_stats .rx .rx_oom_discards += 1 ;
1807
+ cpr -> bnapi -> cp_ring . sw_stats .rx .rx_oom_discards += 1 ;
1808
1808
return NULL ;
1809
1809
}
1810
1810
skb_reserve (skb , bp -> rx_offset );
@@ -1815,7 +1815,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
1815
1815
skb = bnxt_rx_agg_pages_skb (bp , cpr , skb , idx , agg_bufs , true);
1816
1816
if (!skb ) {
1817
1817
/* Page reuse already handled by bnxt_rx_pages(). */
1818
- cpr -> sw_stats .rx .rx_oom_discards += 1 ;
1818
+ cpr -> bnapi -> cp_ring . sw_stats .rx .rx_oom_discards += 1 ;
1819
1819
return NULL ;
1820
1820
}
1821
1821
}
@@ -2094,11 +2094,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
2094
2094
u32 frag_len = bnxt_rx_agg_pages_xdp (bp , cpr , & xdp ,
2095
2095
cp_cons , agg_bufs ,
2096
2096
false);
2097
- if (!frag_len ) {
2098
- cpr -> sw_stats .rx .rx_oom_discards += 1 ;
2099
- rc = - ENOMEM ;
2100
- goto next_rx ;
2101
- }
2097
+ if (!frag_len )
2098
+ goto oom_next_rx ;
2102
2099
}
2103
2100
xdp_active = true;
2104
2101
}
@@ -2121,9 +2118,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
2121
2118
else
2122
2119
bnxt_xdp_buff_frags_free (rxr , & xdp );
2123
2120
}
2124
- cpr -> sw_stats .rx .rx_oom_discards += 1 ;
2125
- rc = - ENOMEM ;
2126
- goto next_rx ;
2121
+ goto oom_next_rx ;
2127
2122
}
2128
2123
} else {
2129
2124
u32 payload ;
@@ -2134,29 +2129,21 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
2134
2129
payload = 0 ;
2135
2130
skb = bp -> rx_skb_func (bp , rxr , cons , data , data_ptr , dma_addr ,
2136
2131
payload | len );
2137
- if (!skb ) {
2138
- cpr -> sw_stats .rx .rx_oom_discards += 1 ;
2139
- rc = - ENOMEM ;
2140
- goto next_rx ;
2141
- }
2132
+ if (!skb )
2133
+ goto oom_next_rx ;
2142
2134
}
2143
2135
2144
2136
if (agg_bufs ) {
2145
2137
if (!xdp_active ) {
2146
2138
skb = bnxt_rx_agg_pages_skb (bp , cpr , skb , cp_cons , agg_bufs , false);
2147
- if (!skb ) {
2148
- cpr -> sw_stats .rx .rx_oom_discards += 1 ;
2149
- rc = - ENOMEM ;
2150
- goto next_rx ;
2151
- }
2139
+ if (!skb )
2140
+ goto oom_next_rx ;
2152
2141
} else {
2153
2142
skb = bnxt_xdp_build_skb (bp , skb , agg_bufs , rxr -> page_pool , & xdp , rxcmp1 );
2154
2143
if (!skb ) {
2155
2144
/* we should be able to free the old skb here */
2156
2145
bnxt_xdp_buff_frags_free (rxr , & xdp );
2157
- cpr -> sw_stats .rx .rx_oom_discards += 1 ;
2158
- rc = - ENOMEM ;
2159
- goto next_rx ;
2146
+ goto oom_next_rx ;
2160
2147
}
2161
2148
}
2162
2149
}
@@ -2234,6 +2221,11 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
2234
2221
* raw_cons = tmp_raw_cons ;
2235
2222
2236
2223
return rc ;
2224
+
2225
+ oom_next_rx :
2226
+ cpr -> bnapi -> cp_ring .sw_stats .rx .rx_oom_discards += 1 ;
2227
+ rc = - ENOMEM ;
2228
+ goto next_rx ;
2237
2229
}
2238
2230
2239
2231
/* In netpoll mode, if we are using a combined completion ring, we need to
@@ -2280,7 +2272,7 @@ static int bnxt_force_rx_discard(struct bnxt *bp,
2280
2272
}
2281
2273
rc = bnxt_rx_pkt (bp , cpr , raw_cons , event );
2282
2274
if (rc && rc != - EBUSY )
2283
- cpr -> sw_stats .rx .rx_netpoll_discards += 1 ;
2275
+ cpr -> bnapi -> cp_ring . sw_stats .rx .rx_netpoll_discards += 1 ;
2284
2276
return rc ;
2285
2277
}
2286
2278
0 commit comments