@@ -117,6 +117,173 @@ static void fbnic_get_rpc_stats32(struct fbnic_dev *fbd,
117117 & rpc -> ovr_size_err );
118118}
119119
120+ static void fbnic_reset_rxb_fifo_stats (struct fbnic_dev * fbd , int i ,
121+ struct fbnic_rxb_fifo_stats * fifo )
122+ {
123+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_DROP_FRMS_STS (i ),
124+ & fifo -> drop .frames );
125+ fbnic_hw_stat_rst64 (fbd , FBNIC_RXB_DROP_BYTES_STS_L (i ), 1 ,
126+ & fifo -> drop .bytes );
127+
128+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_TRUN_FRMS_STS (i ),
129+ & fifo -> trunc .frames );
130+ fbnic_hw_stat_rst64 (fbd , FBNIC_RXB_TRUN_BYTES_STS_L (i ), 1 ,
131+ & fifo -> trunc .bytes );
132+
133+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_TRANS_DROP_STS (i ),
134+ & fifo -> trans_drop );
135+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_TRANS_ECN_STS (i ),
136+ & fifo -> trans_ecn );
137+
138+ fifo -> level .u .old_reg_value_32 = 0 ;
139+ }
140+
141+ static void fbnic_reset_rxb_enq_stats (struct fbnic_dev * fbd , int i ,
142+ struct fbnic_rxb_enqueue_stats * enq )
143+ {
144+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_DRBO_FRM_CNT_SRC (i ),
145+ & enq -> drbo .frames );
146+ fbnic_hw_stat_rst64 (fbd , FBNIC_RXB_DRBO_BYTE_CNT_SRC_L (i ), 4 ,
147+ & enq -> drbo .bytes );
148+
149+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_INTEGRITY_ERR (i ),
150+ & enq -> integrity_err );
151+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_MAC_ERR (i ),
152+ & enq -> mac_err );
153+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_PARSER_ERR (i ),
154+ & enq -> parser_err );
155+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_FRM_ERR (i ),
156+ & enq -> frm_err );
157+ }
158+
159+ static void fbnic_reset_rxb_deq_stats (struct fbnic_dev * fbd , int i ,
160+ struct fbnic_rxb_dequeue_stats * deq )
161+ {
162+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_INTF_FRM_CNT_DST (i ),
163+ & deq -> intf .frames );
164+ fbnic_hw_stat_rst64 (fbd , FBNIC_RXB_INTF_BYTE_CNT_DST_L (i ), 4 ,
165+ & deq -> intf .bytes );
166+
167+ fbnic_hw_stat_rst32 (fbd , FBNIC_RXB_PBUF_FRM_CNT_DST (i ),
168+ & deq -> pbuf .frames );
169+ fbnic_hw_stat_rst64 (fbd , FBNIC_RXB_PBUF_BYTE_CNT_DST_L (i ), 4 ,
170+ & deq -> pbuf .bytes );
171+ }
172+
173+ static void fbnic_reset_rxb_stats (struct fbnic_dev * fbd ,
174+ struct fbnic_rxb_stats * rxb )
175+ {
176+ int i ;
177+
178+ for (i = 0 ; i < FBNIC_RXB_FIFO_INDICES ; i ++ )
179+ fbnic_reset_rxb_fifo_stats (fbd , i , & rxb -> fifo [i ]);
180+
181+ for (i = 0 ; i < FBNIC_RXB_INTF_INDICES ; i ++ ) {
182+ fbnic_reset_rxb_enq_stats (fbd , i , & rxb -> enq [i ]);
183+ fbnic_reset_rxb_deq_stats (fbd , i , & rxb -> deq [i ]);
184+ }
185+ }
186+
187+ static void fbnic_get_rxb_fifo_stats32 (struct fbnic_dev * fbd , int i ,
188+ struct fbnic_rxb_fifo_stats * fifo )
189+ {
190+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_DROP_FRMS_STS (i ),
191+ & fifo -> drop .frames );
192+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_TRUN_FRMS_STS (i ),
193+ & fifo -> trunc .frames );
194+
195+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_TRANS_DROP_STS (i ),
196+ & fifo -> trans_drop );
197+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_TRANS_ECN_STS (i ),
198+ & fifo -> trans_ecn );
199+
200+ fifo -> level .value = rd32 (fbd , FBNIC_RXB_PBUF_FIFO_LEVEL (i ));
201+ }
202+
203+ static void fbnic_get_rxb_fifo_stats (struct fbnic_dev * fbd , int i ,
204+ struct fbnic_rxb_fifo_stats * fifo )
205+ {
206+ fbnic_hw_stat_rd64 (fbd , FBNIC_RXB_DROP_BYTES_STS_L (i ), 1 ,
207+ & fifo -> drop .bytes );
208+ fbnic_hw_stat_rd64 (fbd , FBNIC_RXB_TRUN_BYTES_STS_L (i ), 1 ,
209+ & fifo -> trunc .bytes );
210+
211+ fbnic_get_rxb_fifo_stats32 (fbd , i , fifo );
212+ }
213+
214+ static void fbnic_get_rxb_enq_stats32 (struct fbnic_dev * fbd , int i ,
215+ struct fbnic_rxb_enqueue_stats * enq )
216+ {
217+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_DRBO_FRM_CNT_SRC (i ),
218+ & enq -> drbo .frames );
219+
220+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_INTEGRITY_ERR (i ),
221+ & enq -> integrity_err );
222+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_MAC_ERR (i ),
223+ & enq -> mac_err );
224+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_PARSER_ERR (i ),
225+ & enq -> parser_err );
226+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_FRM_ERR (i ),
227+ & enq -> frm_err );
228+ }
229+
230+ static void fbnic_get_rxb_enq_stats (struct fbnic_dev * fbd , int i ,
231+ struct fbnic_rxb_enqueue_stats * enq )
232+ {
233+ fbnic_hw_stat_rd64 (fbd , FBNIC_RXB_DRBO_BYTE_CNT_SRC_L (i ), 4 ,
234+ & enq -> drbo .bytes );
235+
236+ fbnic_get_rxb_enq_stats32 (fbd , i , enq );
237+ }
238+
239+ static void fbnic_get_rxb_deq_stats32 (struct fbnic_dev * fbd , int i ,
240+ struct fbnic_rxb_dequeue_stats * deq )
241+ {
242+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_INTF_FRM_CNT_DST (i ),
243+ & deq -> intf .frames );
244+ fbnic_hw_stat_rd32 (fbd , FBNIC_RXB_PBUF_FRM_CNT_DST (i ),
245+ & deq -> pbuf .frames );
246+ }
247+
248+ static void fbnic_get_rxb_deq_stats (struct fbnic_dev * fbd , int i ,
249+ struct fbnic_rxb_dequeue_stats * deq )
250+ {
251+ fbnic_hw_stat_rd64 (fbd , FBNIC_RXB_INTF_BYTE_CNT_DST_L (i ), 4 ,
252+ & deq -> intf .bytes );
253+ fbnic_hw_stat_rd64 (fbd , FBNIC_RXB_PBUF_BYTE_CNT_DST_L (i ), 4 ,
254+ & deq -> pbuf .bytes );
255+
256+ fbnic_get_rxb_deq_stats32 (fbd , i , deq );
257+ }
258+
259+ static void fbnic_get_rxb_stats32 (struct fbnic_dev * fbd ,
260+ struct fbnic_rxb_stats * rxb )
261+ {
262+ int i ;
263+
264+ for (i = 0 ; i < FBNIC_RXB_FIFO_INDICES ; i ++ )
265+ fbnic_get_rxb_fifo_stats32 (fbd , i , & rxb -> fifo [i ]);
266+
267+ for (i = 0 ; i < FBNIC_RXB_INTF_INDICES ; i ++ ) {
268+ fbnic_get_rxb_enq_stats32 (fbd , i , & rxb -> enq [i ]);
269+ fbnic_get_rxb_deq_stats32 (fbd , i , & rxb -> deq [i ]);
270+ }
271+ }
272+
273+ static void fbnic_get_rxb_stats (struct fbnic_dev * fbd ,
274+ struct fbnic_rxb_stats * rxb )
275+ {
276+ int i ;
277+
278+ for (i = 0 ; i < FBNIC_RXB_FIFO_INDICES ; i ++ )
279+ fbnic_get_rxb_fifo_stats (fbd , i , & rxb -> fifo [i ]);
280+
281+ for (i = 0 ; i < FBNIC_RXB_INTF_INDICES ; i ++ ) {
282+ fbnic_get_rxb_enq_stats (fbd , i , & rxb -> enq [i ]);
283+ fbnic_get_rxb_deq_stats (fbd , i , & rxb -> deq [i ]);
284+ }
285+ }
286+
120287static void fbnic_reset_hw_rxq_stats (struct fbnic_dev * fbd ,
121288 struct fbnic_hw_q_stats * hw_q )
122289{
@@ -253,6 +420,7 @@ void fbnic_reset_hw_stats(struct fbnic_dev *fbd)
253420{
254421 spin_lock (& fbd -> hw_stats_lock );
255422 fbnic_reset_rpc_stats (fbd , & fbd -> hw_stats .rpc );
423+ fbnic_reset_rxb_stats (fbd , & fbd -> hw_stats .rxb );
256424 fbnic_reset_hw_rxq_stats (fbd , fbd -> hw_stats .hw_q );
257425 fbnic_reset_pcie_stats_asic (fbd , & fbd -> hw_stats .pcie );
258426 spin_unlock (& fbd -> hw_stats_lock );
@@ -261,6 +429,7 @@ void fbnic_reset_hw_stats(struct fbnic_dev *fbd)
261429static void __fbnic_get_hw_stats32 (struct fbnic_dev * fbd )
262430{
263431 fbnic_get_rpc_stats32 (fbd , & fbd -> hw_stats .rpc );
432+ fbnic_get_rxb_stats32 (fbd , & fbd -> hw_stats .rxb );
264433 fbnic_get_hw_rxq_stats32 (fbd , fbd -> hw_stats .hw_q );
265434}
266435
@@ -275,6 +444,8 @@ void fbnic_get_hw_stats(struct fbnic_dev *fbd)
275444{
276445 spin_lock (& fbd -> hw_stats_lock );
277446 __fbnic_get_hw_stats32 (fbd );
447+
448+ fbnic_get_rxb_stats (fbd , & fbd -> hw_stats .rxb );
278449 fbnic_get_pcie_stats_asic64 (fbd , & fbd -> hw_stats .pcie );
279450 spin_unlock (& fbd -> hw_stats_lock );
280451}
0 commit comments