mlx4_stats.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_pages;
  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. struct mlx4_en_xdp_stats {
  52. unsigned long rx_xdp_drop;
  53. unsigned long rx_xdp_tx;
  54. unsigned long rx_xdp_tx_full;
  55. #define NUM_XDP_STATS 3
  56. };
  57. #define NUM_MAIN_STATS 21
  58. #define MLX4_NUM_PRIORITIES 8
  59. struct mlx4_en_flow_stats_rx {
  60. u64 rx_pause;
  61. u64 rx_pause_duration;
  62. u64 rx_pause_transition;
  63. #define NUM_FLOW_STATS_RX 3
  64. #define NUM_FLOW_PRIORITY_STATS_RX (NUM_FLOW_STATS_RX * \
  65. MLX4_NUM_PRIORITIES)
  66. };
  67. struct mlx4_en_flow_stats_tx {
  68. u64 tx_pause;
  69. u64 tx_pause_duration;
  70. u64 tx_pause_transition;
  71. #define NUM_FLOW_STATS_TX 3
  72. #define NUM_FLOW_PRIORITY_STATS_TX (NUM_FLOW_STATS_TX * \
  73. MLX4_NUM_PRIORITIES)
  74. };
  75. #define NUM_FLOW_STATS (NUM_FLOW_STATS_RX + NUM_FLOW_STATS_TX + \
  76. NUM_FLOW_PRIORITY_STATS_TX + \
  77. NUM_FLOW_PRIORITY_STATS_RX)
  78. struct mlx4_en_stat_out_flow_control_mbox {
  79. /* Total number of PAUSE frames received from the far-end port */
  80. __be64 rx_pause;
  81. /* Total number of microseconds that far-end port requested to pause
  82. * transmission of packets
  83. */
  84. __be64 rx_pause_duration;
  85. /* Number of received transmission from XOFF state to XON state */
  86. __be64 rx_pause_transition;
  87. /* Total number of PAUSE frames sent from the far-end port */
  88. __be64 tx_pause;
  89. /* Total time in microseconds that transmission of packets has been
  90. * paused
  91. */
  92. __be64 tx_pause_duration;
  93. /* Number of transmitter transitions from XOFF state to XON state */
  94. __be64 tx_pause_transition;
  95. /* Reserverd */
  96. __be64 reserved[2];
  97. };
  98. enum {
  99. MLX4_DUMP_ETH_STATS_FLOW_CONTROL = 1 << 12
  100. };
  101. #define NUM_ALL_STATS (NUM_MAIN_STATS + NUM_PORT_STATS + NUM_PKT_STATS + \
  102. NUM_FLOW_STATS + NUM_PERF_STATS + NUM_PF_STATS + \
  103. NUM_XDP_STATS)
  104. #define MLX4_FIND_NETDEV_STAT(n) (offsetof(struct net_device_stats, n) / \
  105. sizeof(((struct net_device_stats *)0)->n))
  106. #endif