mlx4_stats.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #ifndef _MLX4_STATS_
  2. #define _MLX4_STATS_
  3. #ifdef MLX4_EN_PERF_STAT
  4. #define NUM_PERF_STATS NUM_PERF_COUNTERS
  5. #else
  6. #define NUM_PERF_STATS 0
  7. #endif
  8. #define NUM_PRIORITIES 9
  9. #define NUM_PRIORITY_STATS 2
  10. struct mlx4_en_pkt_stats {
  11. unsigned long rx_multicast_packets;
  12. unsigned long rx_broadcast_packets;
  13. unsigned long rx_jabbers;
  14. unsigned long rx_in_range_length_error;
  15. unsigned long rx_out_range_length_error;
  16. unsigned long tx_multicast_packets;
  17. unsigned long tx_broadcast_packets;
  18. unsigned long rx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS];
  19. unsigned long tx_prio[NUM_PRIORITIES][NUM_PRIORITY_STATS];
  20. #define NUM_PKT_STATS 43
  21. };
  22. struct mlx4_en_counter_stats {
  23. unsigned long rx_packets;
  24. unsigned long rx_bytes;
  25. unsigned long tx_packets;
  26. unsigned long tx_bytes;
  27. #define NUM_PF_STATS 4
  28. };
  29. struct mlx4_en_port_stats {
  30. unsigned long tso_packets;
  31. unsigned long xmit_more;
  32. unsigned long queue_stopped;
  33. unsigned long wake_queue;
  34. unsigned long tx_timeout;
  35. unsigned long rx_alloc_failed;
  36. unsigned long rx_chksum_good;
  37. unsigned long rx_chksum_none;
  38. unsigned long rx_chksum_complete;
  39. unsigned long tx_chksum_offload;
  40. #define NUM_PORT_STATS 10
  41. };
  42. struct mlx4_en_perf_stats {
  43. u32 tx_poll;
  44. u64 tx_pktsz_avg;
  45. u32 inflight_avg;
  46. u16 tx_coal_avg;
  47. u16 rx_coal_avg;
  48. u32 napi_quota;
  49. #define NUM_PERF_COUNTERS 6
  50. };
  51. #define NUM_MAIN_STATS 21
  52. #define MLX4_NUM_PRIORITIES 8
  53. struct mlx4_en_flow_stats_rx {
  54. u64 rx_pause;
  55. u64 rx_pause_duration;
  56. u64 rx_pause_transition;
  57. #define NUM_FLOW_STATS_RX 3
  58. #define NUM_FLOW_PRIORITY_STATS_RX (NUM_FLOW_STATS_RX * \
  59. MLX4_NUM_PRIORITIES)
  60. };
  61. struct mlx4_en_flow_stats_tx {
  62. u64 tx_pause;
  63. u64 tx_pause_duration;
  64. u64 tx_pause_transition;
  65. #define NUM_FLOW_STATS_TX 3
  66. #define NUM_FLOW_PRIORITY_STATS_TX (NUM_FLOW_STATS_TX * \
  67. MLX4_NUM_PRIORITIES)
  68. };
  69. #define NUM_FLOW_STATS (NUM_FLOW_STATS_RX + NUM_FLOW_STATS_TX + \
  70. NUM_FLOW_PRIORITY_STATS_TX + \
  71. NUM_FLOW_PRIORITY_STATS_RX)
  72. struct mlx4_en_stat_out_flow_control_mbox {
  73. /* Total number of PAUSE frames received from the far-end port */
  74. __be64 rx_pause;
  75. /* Total number of microseconds that far-end port requested to pause
  76. * transmission of packets
  77. */
  78. __be64 rx_pause_duration;
  79. /* Number of received transmission from XOFF state to XON state */
  80. __be64 rx_pause_transition;
  81. /* Total number of PAUSE frames sent from the far-end port */
  82. __be64 tx_pause;
  83. /* Total time in microseconds that transmission of packets has been
  84. * paused
  85. */
  86. __be64 tx_pause_duration;
  87. /* Number of transmitter transitions from XOFF state to XON state */
  88. __be64 tx_pause_transition;
  89. /* Reserverd */
  90. __be64 reserved[2];
  91. };
  92. enum {
  93. MLX4_DUMP_ETH_STATS_FLOW_CONTROL = 1 << 12
  94. };
  95. #define NUM_ALL_STATS (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + \
  96. NUM_FLOW_STATS + NUM_PERF_STATS + NUM_PF_STATS)
  97. #define MLX4_FIND_NETDEV_STAT(n) (offsetof(struct net_device_stats, n) / \
  98. sizeof(((struct net_device_stats *)0)->n))
  99. #endif