Go to the documentation of this file.
20 #include <linux/types.h>
337 #define ADD_64(s_hi, a_hi, s_lo, a_lo) \
340 s_hi += a_hi + ((s_lo < a_lo) ? 1 : 0); \
343 #define LE32_0 ((__force __le32) 0)
344 #define LE16_0 ((__force __le16) 0)
347 #define ADD_64_LE(s_hi, a_hi_le, s_lo, a_lo_le) \
348 ADD_64(s_hi, le32_to_cpu(a_hi_le), \
349 s_lo, le32_to_cpu(a_lo_le))
351 #define ADD_64_LE16(s_hi, a_hi_le, s_lo, a_lo_le) \
352 ADD_64(s_hi, le16_to_cpu(a_hi_le), \
353 s_lo, le16_to_cpu(a_lo_le))
356 #define DIFF_64(d_hi, m_hi, s_hi, d_lo, m_lo, s_lo) \
360 d_hi = m_hi - s_hi; \
364 d_lo = m_lo + (UINT_MAX - s_lo) + 1; \
377 d_hi = m_hi - s_hi; \
378 d_lo = m_lo - s_lo; \
383 #define UPDATE_STAT64(s, t) \
385 DIFF_64(diff.hi, new->s##_hi, pstats->mac_stx[0].t##_hi, \
386 diff.lo, new->s##_lo, pstats->mac_stx[0].t##_lo); \
387 pstats->mac_stx[0].t##_hi = new->s##_hi; \
388 pstats->mac_stx[0].t##_lo = new->s##_lo; \
389 ADD_64(pstats->mac_stx[1].t##_hi, diff.hi, \
390 pstats->mac_stx[1].t##_lo, diff.lo); \
393 #define UPDATE_STAT64_NIG(s, t) \
395 DIFF_64(diff.hi, new->s##_hi, old->s##_hi, \
396 diff.lo, new->s##_lo, old->s##_lo); \
397 ADD_64(estats->t##_hi, diff.hi, \
398 estats->t##_lo, diff.lo); \
402 #define ADD_EXTEND_64(s_hi, s_lo, a) \
405 s_hi += (s_lo < a) ? 1 : 0; \
408 #define ADD_STAT64(diff, t) \
410 ADD_64(pstats->mac_stx[1].t##_hi, new->diff##_hi, \
411 pstats->mac_stx[1].t##_lo, new->diff##_lo); \
414 #define UPDATE_EXTEND_STAT(s) \
416 ADD_EXTEND_64(pstats->mac_stx[1].s##_hi, \
417 pstats->mac_stx[1].s##_lo, \
421 #define UPDATE_EXTEND_TSTAT(s, t) \
423 diff = le32_to_cpu(tclient->s) - le32_to_cpu(old_tclient->s); \
424 old_tclient->s = tclient->s; \
425 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
428 #define UPDATE_EXTEND_E_TSTAT(s, t) \
430 UPDATE_EXTEND_TSTAT(s, t); \
431 ADD_EXTEND_64(estats->t##_hi, estats->t##_lo, diff); \
434 #define UPDATE_EXTEND_USTAT(s, t) \
436 diff = le32_to_cpu(uclient->s) - le32_to_cpu(old_uclient->s); \
437 old_uclient->s = uclient->s; \
438 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
441 #define UPDATE_EXTEND_E_USTAT(s, t) \
443 UPDATE_EXTEND_USTAT(s, t); \
444 ADD_EXTEND_64(estats->t##_hi, estats->t##_lo, diff); \
447 #define UPDATE_EXTEND_XSTAT(s, t) \
449 diff = le32_to_cpu(xclient->s) - le32_to_cpu(old_xclient->s); \
450 old_xclient->s = xclient->s; \
451 ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
454 #define UPDATE_QSTAT(s, t) \
456 qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi); \
457 qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \
460 #define UPDATE_QSTAT_OLD(f) \
462 qstats_old->f = qstats->f; \
465 #define UPDATE_ESTAT_QSTAT_64(s) \
467 ADD_64(estats->s##_hi, qstats->s##_hi, \
468 estats->s##_lo, qstats->s##_lo); \
469 SUB_64(estats->s##_hi, qstats_old->s##_hi_old, \
470 estats->s##_lo, qstats_old->s##_lo_old); \
471 qstats_old->s##_hi_old = qstats->s##_hi; \
472 qstats_old->s##_lo_old = qstats->s##_lo; \
475 #define UPDATE_ESTAT_QSTAT(s) \
477 estats->s += qstats->s; \
478 estats->s -= qstats_old->s##_old; \
479 qstats_old->s##_old = qstats->s; \
482 #define UPDATE_FSTAT_QSTAT(s) \
484 ADD_64(fstats->s##_hi, qstats->s##_hi, \
485 fstats->s##_lo, qstats->s##_lo); \
486 SUB_64(fstats->s##_hi, qstats_old->s##_hi, \
487 fstats->s##_lo, qstats_old->s##_lo); \
488 estats->s##_hi = fstats->s##_hi; \
489 estats->s##_lo = fstats->s##_lo; \
490 qstats_old->s##_hi = qstats->s##_hi; \
491 qstats_old->s##_lo = qstats->s##_lo; \
494 #define UPDATE_FW_STAT(s) \
496 estats->s = le32_to_cpu(tport->s) + fwstats->s; \
499 #define UPDATE_FW_STAT_OLD(f) \
501 fwstats->f = estats->f; \
504 #define UPDATE_ESTAT(s, t) \
506 SUB_64(estats->s##_hi, estats_old->t##_hi, \
507 estats->s##_lo, estats_old->t##_lo); \
508 ADD_64(estats->s##_hi, estats->t##_hi, \
509 estats->s##_lo, estats->t##_lo); \
510 estats_old->t##_hi = estats->t##_hi; \
511 estats_old->t##_lo = estats->t##_lo; \
515 #define SUB_64(m_hi, s_hi, m_lo, s_lo) \
517 DIFF_64(m_hi, m_hi, s_hi, m_lo, m_lo, s_lo); \
521 #define SUB_EXTEND_64(m_hi, m_lo, s) \
523 SUB_64(m_hi, 0, m_lo, s); \
526 #define SUB_EXTEND_USTAT(s, t) \
528 diff = le32_to_cpu(uclient->s) - le32_to_cpu(old_uclient->s); \
529 SUB_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \