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