2 * Copyright (c) 2007-2013 QLogic Corporation. All rights reserved.
4 * Eric Davis <edavis@broadcom.com>
5 * David Christensen <davidch@broadcom.com>
6 * Gary Zambrano <zambrano@broadcom.com>
8 * Copyright (c) 2013-2015 Brocade Communications Systems, Inc.
9 * Copyright (c) 2015 QLogic Corporation.
10 * All rights reserved.
13 * See LICENSE.bnx2x_pmd for copyright and licensing details.
19 #include <sys/types.h>
24 uint32_t brb_truncate
;
25 uint32_t flow_ctrl_discard
;
26 uint32_t flow_ctrl_octets
;
27 uint32_t flow_ctrl_packet
;
29 uint32_t mng_octet_inp
;
30 uint32_t mng_octet_out
;
31 uint32_t mng_packet_inp
;
32 uint32_t mng_packet_out
;
36 uint32_t egress_mac_pkt0_lo
;
37 uint32_t egress_mac_pkt0_hi
;
38 uint32_t egress_mac_pkt1_lo
;
39 uint32_t egress_mac_pkt1_hi
;
43 enum bnx2x_stats_event
{
51 enum bnx2x_stats_state
{
52 STATS_STATE_DISABLED
= 0,
57 struct bnx2x_eth_stats
{
58 uint32_t total_bytes_received_hi
;
59 uint32_t total_bytes_received_lo
;
60 uint32_t total_bytes_transmitted_hi
;
61 uint32_t total_bytes_transmitted_lo
;
62 uint32_t total_unicast_packets_received_hi
;
63 uint32_t total_unicast_packets_received_lo
;
64 uint32_t total_multicast_packets_received_hi
;
65 uint32_t total_multicast_packets_received_lo
;
66 uint32_t total_broadcast_packets_received_hi
;
67 uint32_t total_broadcast_packets_received_lo
;
68 uint32_t total_unicast_packets_transmitted_hi
;
69 uint32_t total_unicast_packets_transmitted_lo
;
70 uint32_t total_multicast_packets_transmitted_hi
;
71 uint32_t total_multicast_packets_transmitted_lo
;
72 uint32_t total_broadcast_packets_transmitted_hi
;
73 uint32_t total_broadcast_packets_transmitted_lo
;
74 uint32_t valid_bytes_received_hi
;
75 uint32_t valid_bytes_received_lo
;
77 uint32_t error_bytes_received_hi
;
78 uint32_t error_bytes_received_lo
;
79 uint32_t etherstatsoverrsizepkts_hi
;
80 uint32_t etherstatsoverrsizepkts_lo
;
81 uint32_t no_buff_discard_hi
;
82 uint32_t no_buff_discard_lo
;
84 uint32_t rx_stat_ifhcinbadoctets_hi
;
85 uint32_t rx_stat_ifhcinbadoctets_lo
;
86 uint32_t tx_stat_ifhcoutbadoctets_hi
;
87 uint32_t tx_stat_ifhcoutbadoctets_lo
;
88 uint32_t rx_stat_dot3statsfcserrors_hi
;
89 uint32_t rx_stat_dot3statsfcserrors_lo
;
90 uint32_t rx_stat_dot3statsalignmenterrors_hi
;
91 uint32_t rx_stat_dot3statsalignmenterrors_lo
;
92 uint32_t rx_stat_dot3statscarriersenseerrors_hi
;
93 uint32_t rx_stat_dot3statscarriersenseerrors_lo
;
94 uint32_t rx_stat_falsecarriererrors_hi
;
95 uint32_t rx_stat_falsecarriererrors_lo
;
96 uint32_t rx_stat_etherstatsundersizepkts_hi
;
97 uint32_t rx_stat_etherstatsundersizepkts_lo
;
98 uint32_t rx_stat_dot3statsframestoolong_hi
;
99 uint32_t rx_stat_dot3statsframestoolong_lo
;
100 uint32_t rx_stat_etherstatsfragments_hi
;
101 uint32_t rx_stat_etherstatsfragments_lo
;
102 uint32_t rx_stat_etherstatsjabbers_hi
;
103 uint32_t rx_stat_etherstatsjabbers_lo
;
104 uint32_t rx_stat_maccontrolframesreceived_hi
;
105 uint32_t rx_stat_maccontrolframesreceived_lo
;
106 uint32_t rx_stat_bmac_xpf_hi
;
107 uint32_t rx_stat_bmac_xpf_lo
;
108 uint32_t rx_stat_bmac_xcf_hi
;
109 uint32_t rx_stat_bmac_xcf_lo
;
110 uint32_t rx_stat_xoffstateentered_hi
;
111 uint32_t rx_stat_xoffstateentered_lo
;
112 uint32_t rx_stat_xonpauseframesreceived_hi
;
113 uint32_t rx_stat_xonpauseframesreceived_lo
;
114 uint32_t rx_stat_xoffpauseframesreceived_hi
;
115 uint32_t rx_stat_xoffpauseframesreceived_lo
;
116 uint32_t tx_stat_outxonsent_hi
;
117 uint32_t tx_stat_outxonsent_lo
;
118 uint32_t tx_stat_outxoffsent_hi
;
119 uint32_t tx_stat_outxoffsent_lo
;
120 uint32_t tx_stat_flowcontroldone_hi
;
121 uint32_t tx_stat_flowcontroldone_lo
;
122 uint32_t tx_stat_etherstatscollisions_hi
;
123 uint32_t tx_stat_etherstatscollisions_lo
;
124 uint32_t tx_stat_dot3statssinglecollisionframes_hi
;
125 uint32_t tx_stat_dot3statssinglecollisionframes_lo
;
126 uint32_t tx_stat_dot3statsmultiplecollisionframes_hi
;
127 uint32_t tx_stat_dot3statsmultiplecollisionframes_lo
;
128 uint32_t tx_stat_dot3statsdeferredtransmissions_hi
;
129 uint32_t tx_stat_dot3statsdeferredtransmissions_lo
;
130 uint32_t tx_stat_dot3statsexcessivecollisions_hi
;
131 uint32_t tx_stat_dot3statsexcessivecollisions_lo
;
132 uint32_t tx_stat_dot3statslatecollisions_hi
;
133 uint32_t tx_stat_dot3statslatecollisions_lo
;
134 uint32_t tx_stat_etherstatspkts64octets_hi
;
135 uint32_t tx_stat_etherstatspkts64octets_lo
;
136 uint32_t tx_stat_etherstatspkts65octetsto127octets_hi
;
137 uint32_t tx_stat_etherstatspkts65octetsto127octets_lo
;
138 uint32_t tx_stat_etherstatspkts128octetsto255octets_hi
;
139 uint32_t tx_stat_etherstatspkts128octetsto255octets_lo
;
140 uint32_t tx_stat_etherstatspkts256octetsto511octets_hi
;
141 uint32_t tx_stat_etherstatspkts256octetsto511octets_lo
;
142 uint32_t tx_stat_etherstatspkts512octetsto1023octets_hi
;
143 uint32_t tx_stat_etherstatspkts512octetsto1023octets_lo
;
144 uint32_t tx_stat_etherstatspkts1024octetsto1522octets_hi
;
145 uint32_t tx_stat_etherstatspkts1024octetsto1522octets_lo
;
146 uint32_t tx_stat_etherstatspktsover1522octets_hi
;
147 uint32_t tx_stat_etherstatspktsover1522octets_lo
;
148 uint32_t tx_stat_bmac_2047_hi
;
149 uint32_t tx_stat_bmac_2047_lo
;
150 uint32_t tx_stat_bmac_4095_hi
;
151 uint32_t tx_stat_bmac_4095_lo
;
152 uint32_t tx_stat_bmac_9216_hi
;
153 uint32_t tx_stat_bmac_9216_lo
;
154 uint32_t tx_stat_bmac_16383_hi
;
155 uint32_t tx_stat_bmac_16383_lo
;
156 uint32_t tx_stat_dot3statsinternalmactransmiterrors_hi
;
157 uint32_t tx_stat_dot3statsinternalmactransmiterrors_lo
;
158 uint32_t tx_stat_bmac_ufl_hi
;
159 uint32_t tx_stat_bmac_ufl_lo
;
161 uint32_t pause_frames_received_hi
;
162 uint32_t pause_frames_received_lo
;
163 uint32_t pause_frames_sent_hi
;
164 uint32_t pause_frames_sent_lo
;
166 uint32_t etherstatspkts1024octetsto1522octets_hi
;
167 uint32_t etherstatspkts1024octetsto1522octets_lo
;
168 uint32_t etherstatspktsover1522octets_hi
;
169 uint32_t etherstatspktsover1522octets_lo
;
171 uint32_t brb_drop_hi
;
172 uint32_t brb_drop_lo
;
173 uint32_t brb_truncate_hi
;
174 uint32_t brb_truncate_lo
;
176 uint32_t mac_filter_discard
;
177 uint32_t mf_tag_discard
;
178 uint32_t brb_truncate_discard
;
179 uint32_t mac_discard
;
181 uint32_t nig_timer_max
;
184 uint32_t pfc_frames_received_hi
;
185 uint32_t pfc_frames_received_lo
;
186 uint32_t pfc_frames_sent_hi
;
187 uint32_t pfc_frames_sent_lo
;
190 uint32_t recoverable_error
;
191 uint32_t unrecoverable_error
;
193 /* src: Clear-on-Read register; Will not survive PMF Migration */
196 /* receive path driver statistics */
199 uint32_t rx_soft_errors
;
200 uint32_t rx_hw_csum_errors
;
201 uint32_t rx_ofld_frames_csum_ip
;
202 uint32_t rx_ofld_frames_csum_tcp_udp
;
203 uint32_t rx_budget_reached
;
205 /* tx path driver statistics */
207 uint32_t tx_soft_errors
;
208 uint32_t tx_ofld_frames_csum_ip
;
209 uint32_t tx_ofld_frames_csum_tcp
;
210 uint32_t tx_ofld_frames_csum_udp
;
211 uint32_t tx_encap_failures
;
212 uint32_t tx_hw_queue_full
;
213 uint32_t tx_hw_max_queue_depth
;
214 uint32_t tx_dma_mapping_failure
;
215 uint32_t tx_max_drbr_queue_depth
;
216 uint32_t tx_window_violation_std
;
217 uint32_t tx_chain_lost_mbuf
;
218 uint32_t tx_frames_deferred
;
219 uint32_t tx_queue_xoff
;
221 /* mbuf driver statistics */
222 uint32_t mbuf_defrag_attempts
;
223 uint32_t mbuf_defrag_failures
;
224 uint32_t mbuf_rx_bd_alloc_failed
;
225 uint32_t mbuf_rx_bd_mapping_failed
;
227 /* track the number of allocated mbufs */
228 uint32_t mbuf_alloc_tx
;
229 uint32_t mbuf_alloc_rx
;
233 struct bnx2x_eth_q_stats
{
234 uint32_t total_unicast_bytes_received_hi
;
235 uint32_t total_unicast_bytes_received_lo
;
236 uint32_t total_broadcast_bytes_received_hi
;
237 uint32_t total_broadcast_bytes_received_lo
;
238 uint32_t total_multicast_bytes_received_hi
;
239 uint32_t total_multicast_bytes_received_lo
;
240 uint32_t total_bytes_received_hi
;
241 uint32_t total_bytes_received_lo
;
242 uint32_t total_unicast_bytes_transmitted_hi
;
243 uint32_t total_unicast_bytes_transmitted_lo
;
244 uint32_t total_broadcast_bytes_transmitted_hi
;
245 uint32_t total_broadcast_bytes_transmitted_lo
;
246 uint32_t total_multicast_bytes_transmitted_hi
;
247 uint32_t total_multicast_bytes_transmitted_lo
;
248 uint32_t total_bytes_transmitted_hi
;
249 uint32_t total_bytes_transmitted_lo
;
250 uint32_t total_unicast_packets_received_hi
;
251 uint32_t total_unicast_packets_received_lo
;
252 uint32_t total_multicast_packets_received_hi
;
253 uint32_t total_multicast_packets_received_lo
;
254 uint32_t total_broadcast_packets_received_hi
;
255 uint32_t total_broadcast_packets_received_lo
;
256 uint32_t total_unicast_packets_transmitted_hi
;
257 uint32_t total_unicast_packets_transmitted_lo
;
258 uint32_t total_multicast_packets_transmitted_hi
;
259 uint32_t total_multicast_packets_transmitted_lo
;
260 uint32_t total_broadcast_packets_transmitted_hi
;
261 uint32_t total_broadcast_packets_transmitted_lo
;
262 uint32_t valid_bytes_received_hi
;
263 uint32_t valid_bytes_received_lo
;
265 uint32_t etherstatsoverrsizepkts_hi
;
266 uint32_t etherstatsoverrsizepkts_lo
;
267 uint32_t no_buff_discard_hi
;
268 uint32_t no_buff_discard_lo
;
270 uint32_t total_packets_received_checksum_discarded_hi
;
271 uint32_t total_packets_received_checksum_discarded_lo
;
272 uint32_t total_packets_received_ttl0_discarded_hi
;
273 uint32_t total_packets_received_ttl0_discarded_lo
;
274 uint32_t total_transmitted_dropped_packets_error_hi
;
275 uint32_t total_transmitted_dropped_packets_error_lo
;
277 /* receive path driver statistics */
280 uint32_t rx_soft_errors
;
281 uint32_t rx_hw_csum_errors
;
282 uint32_t rx_ofld_frames_csum_ip
;
283 uint32_t rx_ofld_frames_csum_tcp_udp
;
284 uint32_t rx_budget_reached
;
286 /* tx path driver statistics */
288 uint32_t tx_soft_errors
;
289 uint32_t tx_ofld_frames_csum_ip
;
290 uint32_t tx_ofld_frames_csum_tcp
;
291 uint32_t tx_ofld_frames_csum_udp
;
292 uint32_t tx_encap_failures
;
293 uint32_t tx_hw_queue_full
;
294 uint32_t tx_hw_max_queue_depth
;
295 uint32_t tx_dma_mapping_failure
;
296 uint32_t tx_max_drbr_queue_depth
;
297 uint32_t tx_window_violation_std
;
298 uint32_t tx_chain_lost_mbuf
;
299 uint32_t tx_frames_deferred
;
300 uint32_t tx_queue_xoff
;
302 /* mbuf driver statistics */
303 uint32_t mbuf_defrag_attempts
;
304 uint32_t mbuf_defrag_failures
;
305 uint32_t mbuf_rx_bd_alloc_failed
;
306 uint32_t mbuf_rx_bd_mapping_failed
;
308 /* track the number of allocated mbufs */
309 uint32_t mbuf_alloc_tx
;
310 uint32_t mbuf_alloc_rx
;
313 struct bnx2x_eth_stats_old
{
314 uint32_t rx_stat_dot3statsframestoolong_hi
;
315 uint32_t rx_stat_dot3statsframestoolong_lo
;
318 struct bnx2x_eth_q_stats_old
{
319 /* Fields to perserve over fw reset*/
320 uint32_t total_unicast_bytes_received_hi
;
321 uint32_t total_unicast_bytes_received_lo
;
322 uint32_t total_broadcast_bytes_received_hi
;
323 uint32_t total_broadcast_bytes_received_lo
;
324 uint32_t total_multicast_bytes_received_hi
;
325 uint32_t total_multicast_bytes_received_lo
;
326 uint32_t total_unicast_bytes_transmitted_hi
;
327 uint32_t total_unicast_bytes_transmitted_lo
;
328 uint32_t total_broadcast_bytes_transmitted_hi
;
329 uint32_t total_broadcast_bytes_transmitted_lo
;
330 uint32_t total_multicast_bytes_transmitted_hi
;
331 uint32_t total_multicast_bytes_transmitted_lo
;
333 /* Fields to perserve last of */
334 uint32_t total_bytes_received_hi
;
335 uint32_t total_bytes_received_lo
;
336 uint32_t total_bytes_transmitted_hi
;
337 uint32_t total_bytes_transmitted_lo
;
338 uint32_t total_unicast_packets_received_hi
;
339 uint32_t total_unicast_packets_received_lo
;
340 uint32_t total_multicast_packets_received_hi
;
341 uint32_t total_multicast_packets_received_lo
;
342 uint32_t total_broadcast_packets_received_hi
;
343 uint32_t total_broadcast_packets_received_lo
;
344 uint32_t total_unicast_packets_transmitted_hi
;
345 uint32_t total_unicast_packets_transmitted_lo
;
346 uint32_t total_multicast_packets_transmitted_hi
;
347 uint32_t total_multicast_packets_transmitted_lo
;
348 uint32_t total_broadcast_packets_transmitted_hi
;
349 uint32_t total_broadcast_packets_transmitted_lo
;
350 uint32_t valid_bytes_received_hi
;
351 uint32_t valid_bytes_received_lo
;
353 /* receive path driver statistics */
354 uint32_t rx_calls_old
;
355 uint32_t rx_pkts_old
;
356 uint32_t rx_soft_errors_old
;
357 uint32_t rx_hw_csum_errors_old
;
358 uint32_t rx_ofld_frames_csum_ip_old
;
359 uint32_t rx_ofld_frames_csum_tcp_udp_old
;
360 uint32_t rx_budget_reached_old
;
362 /* tx path driver statistics */
363 uint32_t tx_pkts_old
;
364 uint32_t tx_soft_errors_old
;
365 uint32_t tx_ofld_frames_csum_ip_old
;
366 uint32_t tx_ofld_frames_csum_tcp_old
;
367 uint32_t tx_ofld_frames_csum_udp_old
;
368 uint32_t tx_encap_failures_old
;
369 uint32_t tx_hw_queue_full_old
;
370 uint32_t tx_hw_max_queue_depth_old
;
371 uint32_t tx_dma_mapping_failure_old
;
372 uint32_t tx_max_drbr_queue_depth_old
;
373 uint32_t tx_window_violation_std_old
;
374 uint32_t tx_chain_lost_mbuf_old
;
375 uint32_t tx_frames_deferred_old
;
376 uint32_t tx_queue_xoff_old
;
378 /* mbuf driver statistics */
379 uint32_t mbuf_defrag_attempts_old
;
380 uint32_t mbuf_defrag_failures_old
;
381 uint32_t mbuf_rx_bd_alloc_failed_old
;
382 uint32_t mbuf_rx_bd_mapping_failed_old
;
384 /* track the number of allocated mbufs */
385 int mbuf_alloc_tx_old
;
386 int mbuf_alloc_rx_old
;
389 struct bnx2x_net_stats_old
{
393 struct bnx2x_fw_port_stats_old
{
394 uint32_t pfc_frames_tx_hi
;
395 uint32_t pfc_frames_tx_lo
;
396 uint32_t pfc_frames_rx_hi
;
397 uint32_t pfc_frames_rx_lo
;
399 uint32_t mac_filter_discard
;
400 uint32_t mf_tag_discard
;
401 uint32_t brb_truncate_discard
;
402 uint32_t mac_discard
;
405 /* sum[hi:lo] += add[hi:lo] */
406 #define ADD_64(s_hi, a_hi, s_lo, a_lo) \
409 s_hi += a_hi + ((s_lo < a_lo) ? 1 : 0); \
412 #define LE32_0 ((uint32_t) 0)
413 #define LE16_0 ((uint16_t) 0)
415 /* The _force is for cases where high value is 0 */
416 #define ADD_64_LE(s_hi, a_hi_le, s_lo, a_lo_le) \
417 ADD_64(s_hi, le32toh(a_hi_le), \
418 s_lo, le32toh(a_lo_le))
420 #define ADD_64_LE16(s_hi, a_hi_le, s_lo, a_lo_le) \
421 ADD_64(s_hi, le16toh(a_hi_le), \
422 s_lo, le16toh(a_lo_le))
424 /* difference = minuend - subtrahend */
425 #define DIFF_64(d_hi, m_hi, s_hi, d_lo, m_lo, s_lo) \
429 d_hi = m_hi - s_hi; \
431 /* we can 'loan' 1 */ \
433 d_lo = m_lo + (UINT_MAX - s_lo) + 1; \
446 d_hi = m_hi - s_hi; \
447 d_lo = m_lo - s_lo; \
452 #define UPDATE_STAT64(s, t) \
454 DIFF_64(diff.hi, new->s##_hi, pstats->mac_stx[0].t##_hi, \
455 diff.lo, new->s##_lo, pstats->mac_stx[0].t##_lo); \
456 pstats->mac_stx[0].t##_hi = new->s##_hi; \
457 pstats->mac_stx[0].t##_lo = new->s##_lo; \
458 ADD_64(pstats->mac_stx[1].t##_hi, diff.hi, \
459 pstats->mac_stx[1].t##_lo, diff.lo); \
462 #define UPDATE_STAT64_NIG(s, t) \
464 DIFF_64(diff.hi, new->s##_hi, old->s##_hi, \
465 diff.lo, new->s##_lo, old->s##_lo); \
466 ADD_64(estats->t##_hi, diff.hi, \
467 estats->t##_lo, diff.lo); \
470 /* sum[hi:lo] += add */
471 #define ADD_EXTEND_64(s_hi, s_lo, a) \
474 s_hi += (s_lo < a) ? 1 : 0; \
477 #define ADD_STAT64(diff, t) \
479 ADD_64(pstats->mac_stx[1].t##_hi, new->diff##_hi, \
480 pstats->mac_stx[1].t##_lo, new->diff##_lo); \
483 #define UPDATE_EXTEND_STAT(s) \
485 ADD_EXTEND_64(pstats->mac_stx[1].s##_hi, \
486 pstats->mac_stx[1].s##_lo, \
490 #define UPDATE_EXTEND_TSTAT_X(s, t, size) \
492 diff = le##size##toh(tclient->s) - \
493 le##size##toh(old_tclient->s); \
494 old_tclient->s = tclient->s; \
495 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
498 #define UPDATE_EXTEND_TSTAT(s, t) UPDATE_EXTEND_TSTAT_X(s, t, 32)
500 #define UPDATE_EXTEND_E_TSTAT(s, t, size) \
502 UPDATE_EXTEND_TSTAT_X(s, t, size); \
503 ADD_EXTEND_64(estats->t##_hi, estats->t##_lo, diff); \
506 #define UPDATE_EXTEND_USTAT(s, t) \
508 diff = le32toh(uclient->s) - le32toh(old_uclient->s); \
509 old_uclient->s = uclient->s; \
510 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
513 #define UPDATE_EXTEND_E_USTAT(s, t) \
515 UPDATE_EXTEND_USTAT(s, t); \
516 ADD_EXTEND_64(estats->t##_hi, estats->t##_lo, diff); \
519 #define UPDATE_EXTEND_XSTAT(s, t) \
521 diff = le32toh(xclient->s) - le32toh(old_xclient->s); \
522 old_xclient->s = xclient->s; \
523 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
526 #define UPDATE_QSTAT(s, t) \
528 qstats->t##_hi = qstats_old->t##_hi + le32toh(s.hi); \
529 qstats->t##_lo = qstats_old->t##_lo + le32toh(s.lo); \
532 #define UPDATE_QSTAT_OLD(f) \
534 qstats_old->f = qstats->f; \
537 #define UPDATE_ESTAT_QSTAT_64(s) \
539 ADD_64(estats->s##_hi, qstats->s##_hi, \
540 estats->s##_lo, qstats->s##_lo); \
541 SUB_64(estats->s##_hi, qstats_old->s##_hi_old, \
542 estats->s##_lo, qstats_old->s##_lo_old); \
543 qstats_old->s##_hi_old = qstats->s##_hi; \
544 qstats_old->s##_lo_old = qstats->s##_lo; \
547 #define UPDATE_ESTAT_QSTAT(s) \
549 estats->s += qstats->s; \
550 estats->s -= qstats_old->s##_old; \
551 qstats_old->s##_old = qstats->s; \
554 #define UPDATE_FSTAT_QSTAT(s) \
556 ADD_64(fstats->s##_hi, qstats->s##_hi, \
557 fstats->s##_lo, qstats->s##_lo); \
558 SUB_64(fstats->s##_hi, qstats_old->s##_hi, \
559 fstats->s##_lo, qstats_old->s##_lo); \
560 estats->s##_hi = fstats->s##_hi; \
561 estats->s##_lo = fstats->s##_lo; \
562 qstats_old->s##_hi = qstats->s##_hi; \
563 qstats_old->s##_lo = qstats->s##_lo; \
566 #define UPDATE_FW_STAT(s) \
568 estats->s = le32toh(tport->s) + fwstats->s; \
571 #define UPDATE_FW_STAT_OLD(f) \
573 fwstats->f = estats->f; \
576 #define UPDATE_ESTAT(s, t) \
578 SUB_64(estats->s##_hi, estats_old->t##_hi, \
579 estats->s##_lo, estats_old->t##_lo); \
580 ADD_64(estats->s##_hi, estats->t##_hi, \
581 estats->s##_lo, estats->t##_lo); \
582 estats_old->t##_hi = estats->t##_hi; \
583 estats_old->t##_lo = estats->t##_lo; \
586 /* minuend -= subtrahend */
587 #define SUB_64(m_hi, s_hi, m_lo, s_lo) \
589 DIFF_64(m_hi, m_hi, s_hi, m_lo, m_lo, s_lo); \
592 /* minuend[hi:lo] -= subtrahend */
593 #define SUB_EXTEND_64(m_hi, m_lo, s) \
596 SUB_64(m_hi, s_hi, m_lo, s); \
599 #define SUB_EXTEND_USTAT(s, t) \
601 diff = le32toh(uclient->s) - le32toh(old_uclient->s); \
602 SUB_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
606 void bnx2x_stats_init(struct bnx2x_softc
*sc
);
607 void bnx2x_stats_handle(struct bnx2x_softc
*sc
, enum bnx2x_stats_event event
);
608 void bnx2x_save_statistics(struct bnx2x_softc
*sc
);
609 void bnx2x_memset_stats(struct bnx2x_softc
*sc
);
611 #endif /* BNX2X_STATS_H */