@@ -1811,7 +1811,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
18111811 skb = bnxt_copy_skb (bnapi , data_ptr , len , mapping );
18121812 if (!skb ) {
18131813 bnxt_abort_tpa (cpr , idx , agg_bufs );
1814- cpr -> bnapi -> cp_ring . sw_stats . rx .rx_oom_discards += 1 ;
1814+ cpr -> sw_stats -> rx .rx_oom_discards += 1 ;
18151815 return NULL ;
18161816 }
18171817 } else {
@@ -1821,7 +1821,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
18211821 new_data = __bnxt_alloc_rx_frag (bp , & new_mapping , GFP_ATOMIC );
18221822 if (!new_data ) {
18231823 bnxt_abort_tpa (cpr , idx , agg_bufs );
1824- cpr -> bnapi -> cp_ring . sw_stats . rx .rx_oom_discards += 1 ;
1824+ cpr -> sw_stats -> rx .rx_oom_discards += 1 ;
18251825 return NULL ;
18261826 }
18271827
@@ -1837,7 +1837,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
18371837 if (!skb ) {
18381838 skb_free_frag (data );
18391839 bnxt_abort_tpa (cpr , idx , agg_bufs );
1840- cpr -> bnapi -> cp_ring . sw_stats . rx .rx_oom_discards += 1 ;
1840+ cpr -> sw_stats -> rx .rx_oom_discards += 1 ;
18411841 return NULL ;
18421842 }
18431843 skb_reserve (skb , bp -> rx_offset );
@@ -1848,7 +1848,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
18481848 skb = bnxt_rx_agg_pages_skb (bp , cpr , skb , idx , agg_bufs , true);
18491849 if (!skb ) {
18501850 /* Page reuse already handled by bnxt_rx_pages(). */
1851- cpr -> bnapi -> cp_ring . sw_stats . rx .rx_oom_discards += 1 ;
1851+ cpr -> sw_stats -> rx .rx_oom_discards += 1 ;
18521852 return NULL ;
18531853 }
18541854 }
@@ -2106,7 +2106,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
21062106
21072107 rc = - EIO ;
21082108 if (rx_err & RX_CMPL_ERRORS_BUFFER_ERROR_MASK ) {
2109- bnapi -> cp_ring .sw_stats . rx .rx_buf_errors ++ ;
2109+ bnapi -> cp_ring .sw_stats -> rx .rx_buf_errors ++ ;
21102110 if (!(bp -> flags & BNXT_FLAG_CHIP_P5_PLUS ) &&
21112111 !(bp -> fw_cap & BNXT_FW_CAP_RING_MONITOR )) {
21122112 netdev_warn_once (bp -> dev , "RX buffer error %x\n" ,
@@ -2222,7 +2222,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
22222222 } else {
22232223 if (rxcmp1 -> rx_cmp_cfa_code_errors_v2 & RX_CMP_L4_CS_ERR_BITS ) {
22242224 if (dev -> features & NETIF_F_RXCSUM )
2225- bnapi -> cp_ring .sw_stats . rx .rx_l4_csum_errors ++ ;
2225+ bnapi -> cp_ring .sw_stats -> rx .rx_l4_csum_errors ++ ;
22262226 }
22272227 }
22282228
@@ -2259,7 +2259,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
22592259 return rc ;
22602260
22612261oom_next_rx :
2262- cpr -> bnapi -> cp_ring . sw_stats . rx .rx_oom_discards += 1 ;
2262+ cpr -> sw_stats -> rx .rx_oom_discards += 1 ;
22632263 rc = - ENOMEM ;
22642264 goto next_rx ;
22652265}
@@ -2308,7 +2308,7 @@ static int bnxt_force_rx_discard(struct bnxt *bp,
23082308 }
23092309 rc = bnxt_rx_pkt (bp , cpr , raw_cons , event );
23102310 if (rc && rc != - EBUSY )
2311- cpr -> bnapi -> cp_ring . sw_stats . rx .rx_netpoll_discards += 1 ;
2311+ cpr -> sw_stats -> rx .rx_netpoll_discards += 1 ;
23122312 return rc ;
23132313}
23142314
@@ -3951,6 +3951,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
39513951 if (rc )
39523952 return rc ;
39533953 cpr2 -> bnapi = bnapi ;
3954+ cpr2 -> sw_stats = cpr -> sw_stats ;
39543955 cpr2 -> cp_idx = k ;
39553956 if (!k && rx ) {
39563957 bp -> rx_ring [i ].rx_cpr = cpr2 ;
@@ -4792,6 +4793,9 @@ static void bnxt_free_ring_stats(struct bnxt *bp)
47924793 struct bnxt_cp_ring_info * cpr = & bnapi -> cp_ring ;
47934794
47944795 bnxt_free_stats_mem (bp , & cpr -> stats );
4796+
4797+ kfree (cpr -> sw_stats );
4798+ cpr -> sw_stats = NULL ;
47954799 }
47964800}
47974801
@@ -4806,6 +4810,10 @@ static int bnxt_alloc_stats(struct bnxt *bp)
48064810 struct bnxt_napi * bnapi = bp -> bnapi [i ];
48074811 struct bnxt_cp_ring_info * cpr = & bnapi -> cp_ring ;
48084812
4813+ cpr -> sw_stats = kzalloc (sizeof (* cpr -> sw_stats ), GFP_KERNEL );
4814+ if (!cpr -> sw_stats )
4815+ return - ENOMEM ;
4816+
48094817 cpr -> stats .len = size ;
48104818 rc = bnxt_alloc_stats_mem (bp , & cpr -> stats , !i );
48114819 if (rc )
@@ -10811,9 +10819,9 @@ static void bnxt_disable_napi(struct bnxt *bp)
1081110819
1081210820 cpr = & bnapi -> cp_ring ;
1081310821 if (bnapi -> tx_fault )
10814- cpr -> sw_stats . tx .tx_resets ++ ;
10822+ cpr -> sw_stats -> tx .tx_resets ++ ;
1081510823 if (bnapi -> in_reset )
10816- cpr -> sw_stats . rx .rx_resets ++ ;
10824+ cpr -> sw_stats -> rx .rx_resets ++ ;
1081710825 napi_disable (& bnapi -> napi );
1081810826 if (bnapi -> rx_ring )
1081910827 cancel_work_sync (& cpr -> dim .work );
@@ -12338,8 +12346,8 @@ static void bnxt_get_ring_stats(struct bnxt *bp,
1233812346 stats -> tx_dropped += BNXT_GET_RING_STATS64 (sw , tx_error_pkts );
1233912347
1234012348 stats -> rx_dropped +=
12341- cpr -> sw_stats . rx .rx_netpoll_discards +
12342- cpr -> sw_stats . rx .rx_oom_discards ;
12349+ cpr -> sw_stats -> rx .rx_netpoll_discards +
12350+ cpr -> sw_stats -> rx .rx_oom_discards ;
1234312351 }
1234412352}
1234512353
@@ -12406,7 +12414,7 @@ static void bnxt_get_one_ring_err_stats(struct bnxt *bp,
1240612414 struct bnxt_total_ring_err_stats * stats ,
1240712415 struct bnxt_cp_ring_info * cpr )
1240812416{
12409- struct bnxt_sw_stats * sw_stats = & cpr -> sw_stats ;
12417+ struct bnxt_sw_stats * sw_stats = cpr -> sw_stats ;
1241012418 u64 * hw_stats = cpr -> stats .sw_stats ;
1241112419
1241212420 stats -> rx_total_l4_csum_errors += sw_stats -> rx .rx_l4_csum_errors ;
@@ -13249,7 +13257,7 @@ static void bnxt_rx_ring_reset(struct bnxt *bp)
1324913257 rxr -> bnapi -> in_reset = false;
1325013258 bnxt_alloc_one_rx_ring (bp , i );
1325113259 cpr = & rxr -> bnapi -> cp_ring ;
13252- cpr -> sw_stats . rx .rx_resets ++ ;
13260+ cpr -> sw_stats -> rx .rx_resets ++ ;
1325313261 if (bp -> flags & BNXT_FLAG_AGG_RINGS )
1325413262 bnxt_db_write (bp , & rxr -> rx_agg_db , rxr -> rx_agg_prod );
1325513263 bnxt_db_write (bp , & rxr -> rx_db , rxr -> rx_prod );
@@ -13461,7 +13469,7 @@ static void bnxt_chk_missed_irq(struct bnxt *bp)
1346113469 bnxt_dbg_hwrm_ring_info_get (bp ,
1346213470 DBG_RING_INFO_GET_REQ_RING_TYPE_L2_CMPL ,
1346313471 fw_ring_id , & val [0 ], & val [1 ]);
13464- cpr -> sw_stats . cmn .missed_irqs ++ ;
13472+ cpr -> sw_stats -> cmn .missed_irqs ++ ;
1346513473 }
1346613474 }
1346713475}
@@ -14769,7 +14777,7 @@ static void bnxt_get_queue_stats_rx(struct net_device *dev, int i,
1476914777 stats -> bytes += BNXT_GET_RING_STATS64 (sw , rx_mcast_bytes );
1477014778 stats -> bytes += BNXT_GET_RING_STATS64 (sw , rx_bcast_bytes );
1477114779
14772- stats -> alloc_fail = cpr -> sw_stats . rx .rx_oom_discards ;
14780+ stats -> alloc_fail = cpr -> sw_stats -> rx .rx_oom_discards ;
1477314781}
1477414782
1477514783static void bnxt_get_queue_stats_tx (struct net_device * dev , int i ,
0 commit comments