mlx4_stats.h 3.3 KB

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