Merge remote-tracking branches 'asoc/fix/nau8825', 'asoc/fix/rt5645', 'asoc/fix/tlv32...
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_stats.h
1 /*
2  * Copyright (c) 2015-2016, Mellanox Technologies. All rights reserved.
3  *
4  * This software is available to you under a choice of one of two
5  * licenses.  You may choose to be licensed under the terms of the GNU
6  * General Public License (GPL) Version 2, available from the file
7  * COPYING in the main directory of this source tree, or the
8  * OpenIB.org BSD license below:
9  *
10  *     Redistribution and use in source and binary forms, with or
11  *     without modification, are permitted provided that the following
12  *     conditions are met:
13  *
14  *      - Redistributions of source code must retain the above
15  *        copyright notice, this list of conditions and the following
16  *        disclaimer.
17  *
18  *      - Redistributions in binary form must reproduce the above
19  *        copyright notice, this list of conditions and the following
20  *        disclaimer in the documentation and/or other materials
21  *        provided with the distribution.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30  * SOFTWARE.
31  */
32 #ifndef __MLX5_EN_STATS_H__
33 #define __MLX5_EN_STATS_H__
34
35 #define MLX5E_READ_CTR64_CPU(ptr, dsc, i) \
36         (*(u64 *)((char *)ptr + dsc[i].offset))
37 #define MLX5E_READ_CTR64_BE(ptr, dsc, i) \
38         be64_to_cpu(*(__be64 *)((char *)ptr + dsc[i].offset))
39 #define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \
40         (*(u32 *)((char *)ptr + dsc[i].offset))
41 #define MLX5E_READ_CTR32_BE(ptr, dsc, i) \
42         be64_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset))
43
44 #define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld)
45 #define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld)
46 #define MLX5E_DECLARE_TX_STAT(type, fld) "tx%d_"#fld, offsetof(type, fld)
47
48 struct counter_desc {
49         char            format[ETH_GSTRING_LEN];
50         int             offset; /* Byte offset */
51 };
52
53 struct mlx5e_sw_stats {
54         u64 rx_packets;
55         u64 rx_bytes;
56         u64 tx_packets;
57         u64 tx_bytes;
58         u64 tx_tso_packets;
59         u64 tx_tso_bytes;
60         u64 tx_tso_inner_packets;
61         u64 tx_tso_inner_bytes;
62         u64 rx_lro_packets;
63         u64 rx_lro_bytes;
64         u64 rx_csum_unnecessary;
65         u64 rx_csum_none;
66         u64 rx_csum_complete;
67         u64 rx_csum_unnecessary_inner;
68         u64 rx_xdp_drop;
69         u64 rx_xdp_tx;
70         u64 rx_xdp_tx_full;
71         u64 tx_csum_partial;
72         u64 tx_csum_partial_inner;
73         u64 tx_queue_stopped;
74         u64 tx_queue_wake;
75         u64 tx_queue_dropped;
76         u64 tx_xmit_more;
77         u64 rx_wqe_err;
78         u64 rx_mpwqe_filler;
79         u64 rx_buff_alloc_err;
80         u64 rx_cqe_compress_blks;
81         u64 rx_cqe_compress_pkts;
82         u64 rx_cache_reuse;
83         u64 rx_cache_full;
84         u64 rx_cache_empty;
85         u64 rx_cache_busy;
86
87         /* Special handling counters */
88         u64 link_down_events_phy;
89 };
90
91 static const struct counter_desc sw_stats_desc[] = {
92         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_packets) },
93         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_bytes) },
94         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_packets) },
95         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_bytes) },
96         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_packets) },
97         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_bytes) },
98         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_packets) },
99         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_bytes) },
100         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) },
101         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_bytes) },
102         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) },
103         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) },
104         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) },
105         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) },
106         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) },
107         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx) },
108         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_full) },
109         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial) },
110         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial_inner) },
111         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) },
112         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) },
113         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) },
114         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xmit_more) },
115         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_wqe_err) },
116         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler) },
117         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) },
118         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) },
119         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) },
120         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_reuse) },
121         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_full) },
122         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_empty) },
123         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_busy) },
124         { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, link_down_events_phy) },
125 };
126
127 struct mlx5e_qcounter_stats {
128         u32 rx_out_of_buffer;
129 };
130
131 static const struct counter_desc q_stats_desc[] = {
132         { MLX5E_DECLARE_STAT(struct mlx5e_qcounter_stats, rx_out_of_buffer) },
133 };
134
135 #define VPORT_COUNTER_OFF(c) MLX5_BYTE_OFF(query_vport_counter_out, c)
136 #define VPORT_COUNTER_GET(vstats, c) MLX5_GET64(query_vport_counter_out, \
137                                                 vstats->query_vport_out, c)
138
139 struct mlx5e_vport_stats {
140         __be64 query_vport_out[MLX5_ST_SZ_QW(query_vport_counter_out)];
141 };
142
143 static const struct counter_desc vport_stats_desc[] = {
144         { "rx_vport_unicast_packets",
145                 VPORT_COUNTER_OFF(received_eth_unicast.packets) },
146         { "rx_vport_unicast_bytes",
147                 VPORT_COUNTER_OFF(received_eth_unicast.octets) },
148         { "tx_vport_unicast_packets",
149                 VPORT_COUNTER_OFF(transmitted_eth_unicast.packets) },
150         { "tx_vport_unicast_bytes",
151                 VPORT_COUNTER_OFF(transmitted_eth_unicast.octets) },
152         { "rx_vport_multicast_packets",
153                 VPORT_COUNTER_OFF(received_eth_multicast.packets) },
154         { "rx_vport_multicast_bytes",
155                 VPORT_COUNTER_OFF(received_eth_multicast.octets) },
156         { "tx_vport_multicast_packets",
157                 VPORT_COUNTER_OFF(transmitted_eth_multicast.packets) },
158         { "tx_vport_multicast_bytes",
159                 VPORT_COUNTER_OFF(transmitted_eth_multicast.octets) },
160         { "rx_vport_broadcast_packets",
161                 VPORT_COUNTER_OFF(received_eth_broadcast.packets) },
162         { "rx_vport_broadcast_bytes",
163                 VPORT_COUNTER_OFF(received_eth_broadcast.octets) },
164         { "tx_vport_broadcast_packets",
165                 VPORT_COUNTER_OFF(transmitted_eth_broadcast.packets) },
166         { "tx_vport_broadcast_bytes",
167                 VPORT_COUNTER_OFF(transmitted_eth_broadcast.octets) },
168         { "rx_vport_rdma_unicast_packets",
169                 VPORT_COUNTER_OFF(received_ib_unicast.packets) },
170         { "rx_vport_rdma_unicast_bytes",
171                 VPORT_COUNTER_OFF(received_ib_unicast.octets) },
172         { "tx_vport_rdma_unicast_packets",
173                 VPORT_COUNTER_OFF(transmitted_ib_unicast.packets) },
174         { "tx_vport_rdma_unicast_bytes",
175                 VPORT_COUNTER_OFF(transmitted_ib_unicast.octets) },
176         { "rx_vport_rdma_multicast_packets",
177                 VPORT_COUNTER_OFF(received_ib_multicast.packets) },
178         { "rx_vport_rdma_multicast_bytes",
179                 VPORT_COUNTER_OFF(received_ib_multicast.octets) },
180         { "tx_vport_rdma_multicast_packets",
181                 VPORT_COUNTER_OFF(transmitted_ib_multicast.packets) },
182         { "tx_vport_rdma_multicast_bytes",
183                 VPORT_COUNTER_OFF(transmitted_ib_multicast.octets) },
184 };
185
186 #define PPORT_802_3_OFF(c) \
187         MLX5_BYTE_OFF(ppcnt_reg, \
188                       counter_set.eth_802_3_cntrs_grp_data_layout.c##_high)
189 #define PPORT_802_3_GET(pstats, c) \
190         MLX5_GET64(ppcnt_reg, pstats->IEEE_802_3_counters, \
191                    counter_set.eth_802_3_cntrs_grp_data_layout.c##_high)
192 #define PPORT_2863_OFF(c) \
193         MLX5_BYTE_OFF(ppcnt_reg, \
194                       counter_set.eth_2863_cntrs_grp_data_layout.c##_high)
195 #define PPORT_2863_GET(pstats, c) \
196         MLX5_GET64(ppcnt_reg, pstats->RFC_2863_counters, \
197                    counter_set.eth_2863_cntrs_grp_data_layout.c##_high)
198 #define PPORT_2819_OFF(c) \
199         MLX5_BYTE_OFF(ppcnt_reg, \
200                       counter_set.eth_2819_cntrs_grp_data_layout.c##_high)
201 #define PPORT_2819_GET(pstats, c) \
202         MLX5_GET64(ppcnt_reg, pstats->RFC_2819_counters, \
203                    counter_set.eth_2819_cntrs_grp_data_layout.c##_high)
204 #define PPORT_PER_PRIO_OFF(c) \
205         MLX5_BYTE_OFF(ppcnt_reg, \
206                       counter_set.eth_per_prio_grp_data_layout.c##_high)
207 #define PPORT_PER_PRIO_GET(pstats, prio, c) \
208         MLX5_GET64(ppcnt_reg, pstats->per_prio_counters[prio], \
209                    counter_set.eth_per_prio_grp_data_layout.c##_high)
210 #define NUM_PPORT_PRIO                          8
211
212 struct mlx5e_pport_stats {
213         __be64 IEEE_802_3_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
214         __be64 RFC_2863_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
215         __be64 RFC_2819_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
216         __be64 per_prio_counters[NUM_PPORT_PRIO][MLX5_ST_SZ_QW(ppcnt_reg)];
217         __be64 phy_counters[MLX5_ST_SZ_QW(ppcnt_reg)];
218 };
219
220 static const struct counter_desc pport_802_3_stats_desc[] = {
221         { "tx_packets_phy", PPORT_802_3_OFF(a_frames_transmitted_ok) },
222         { "rx_packets_phy", PPORT_802_3_OFF(a_frames_received_ok) },
223         { "rx_crc_errors_phy", PPORT_802_3_OFF(a_frame_check_sequence_errors) },
224         { "tx_bytes_phy", PPORT_802_3_OFF(a_octets_transmitted_ok) },
225         { "rx_bytes_phy", PPORT_802_3_OFF(a_octets_received_ok) },
226         { "tx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_xmitted_ok) },
227         { "tx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_xmitted_ok) },
228         { "rx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_received_ok) },
229         { "rx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_received_ok) },
230         { "rx_in_range_len_errors_phy", PPORT_802_3_OFF(a_in_range_length_errors) },
231         { "rx_out_of_range_len_phy", PPORT_802_3_OFF(a_out_of_range_length_field) },
232         { "rx_oversize_pkts_phy", PPORT_802_3_OFF(a_frame_too_long_errors) },
233         { "rx_symbol_err_phy", PPORT_802_3_OFF(a_symbol_error_during_carrier) },
234         { "tx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_transmitted) },
235         { "rx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_received) },
236         { "rx_unsupported_op_phy", PPORT_802_3_OFF(a_unsupported_opcodes_received) },
237         { "rx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_received) },
238         { "tx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_transmitted) },
239 };
240
241 static const struct counter_desc pport_2863_stats_desc[] = {
242         { "rx_discards_phy", PPORT_2863_OFF(if_in_discards) },
243         { "tx_discards_phy", PPORT_2863_OFF(if_out_discards) },
244         { "tx_errors_phy", PPORT_2863_OFF(if_out_errors) },
245 };
246
247 static const struct counter_desc pport_2819_stats_desc[] = {
248         { "rx_undersize_pkts_phy", PPORT_2819_OFF(ether_stats_undersize_pkts) },
249         { "rx_fragments_phy", PPORT_2819_OFF(ether_stats_fragments) },
250         { "rx_jabbers_phy", PPORT_2819_OFF(ether_stats_jabbers) },
251         { "rx_64_bytes_phy", PPORT_2819_OFF(ether_stats_pkts64octets) },
252         { "rx_65_to_127_bytes_phy", PPORT_2819_OFF(ether_stats_pkts65to127octets) },
253         { "rx_128_to_255_bytes_phy", PPORT_2819_OFF(ether_stats_pkts128to255octets) },
254         { "rx_256_to_511_bytes_phy", PPORT_2819_OFF(ether_stats_pkts256to511octets) },
255         { "rx_512_to_1023_bytes_phy", PPORT_2819_OFF(ether_stats_pkts512to1023octets) },
256         { "rx_1024_to_1518_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1024to1518octets) },
257         { "rx_1519_to_2047_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1519to2047octets) },
258         { "rx_2048_to_4095_bytes_phy", PPORT_2819_OFF(ether_stats_pkts2048to4095octets) },
259         { "rx_4096_to_8191_bytes_phy", PPORT_2819_OFF(ether_stats_pkts4096to8191octets) },
260         { "rx_8192_to_10239_bytes_phy", PPORT_2819_OFF(ether_stats_pkts8192to10239octets) },
261 };
262
263 static const struct counter_desc pport_per_prio_traffic_stats_desc[] = {
264         { "rx_prio%d_bytes", PPORT_PER_PRIO_OFF(rx_octets) },
265         { "rx_prio%d_packets", PPORT_PER_PRIO_OFF(rx_frames) },
266         { "tx_prio%d_bytes", PPORT_PER_PRIO_OFF(tx_octets) },
267         { "tx_prio%d_packets", PPORT_PER_PRIO_OFF(tx_frames) },
268 };
269
270 static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
271         /* %s is "global" or "prio{i}" */
272         { "rx_%s_pause", PPORT_PER_PRIO_OFF(rx_pause) },
273         { "rx_%s_pause_duration", PPORT_PER_PRIO_OFF(rx_pause_duration) },
274         { "tx_%s_pause", PPORT_PER_PRIO_OFF(tx_pause) },
275         { "tx_%s_pause_duration", PPORT_PER_PRIO_OFF(tx_pause_duration) },
276         { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
277 };
278
279 struct mlx5e_rq_stats {
280         u64 packets;
281         u64 bytes;
282         u64 csum_complete;
283         u64 csum_unnecessary_inner;
284         u64 csum_none;
285         u64 lro_packets;
286         u64 lro_bytes;
287         u64 xdp_drop;
288         u64 xdp_tx;
289         u64 xdp_tx_full;
290         u64 wqe_err;
291         u64 mpwqe_filler;
292         u64 buff_alloc_err;
293         u64 cqe_compress_blks;
294         u64 cqe_compress_pkts;
295         u64 cache_reuse;
296         u64 cache_full;
297         u64 cache_empty;
298         u64 cache_busy;
299 };
300
301 static const struct counter_desc rq_stats_desc[] = {
302         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) },
303         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) },
304         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) },
305         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) },
306         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) },
307         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_drop) },
308         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_tx) },
309         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_tx_full) },
310         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_packets) },
311         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_bytes) },
312         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) },
313         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler) },
314         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, buff_alloc_err) },
315         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_blks) },
316         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) },
317         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_reuse) },
318         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_full) },
319         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_empty) },
320         { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_busy) },
321 };
322
323 struct mlx5e_sq_stats {
324         /* commonly accessed in data path */
325         u64 packets;
326         u64 bytes;
327         u64 xmit_more;
328         u64 tso_packets;
329         u64 tso_bytes;
330         u64 tso_inner_packets;
331         u64 tso_inner_bytes;
332         u64 csum_partial_inner;
333         u64 nop;
334         /* less likely accessed in data path */
335         u64 csum_none;
336         u64 stopped;
337         u64 wake;
338         u64 dropped;
339 };
340
341 static const struct counter_desc sq_stats_desc[] = {
342         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, packets) },
343         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, bytes) },
344         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_packets) },
345         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_bytes) },
346         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_packets) },
347         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_bytes) },
348         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
349         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },
350         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },
351         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) },
352         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, wake) },
353         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, dropped) },
354         { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, xmit_more) },
355 };
356
357 #define NUM_SW_COUNTERS                 ARRAY_SIZE(sw_stats_desc)
358 #define NUM_Q_COUNTERS                  ARRAY_SIZE(q_stats_desc)
359 #define NUM_VPORT_COUNTERS              ARRAY_SIZE(vport_stats_desc)
360 #define NUM_PPORT_802_3_COUNTERS        ARRAY_SIZE(pport_802_3_stats_desc)
361 #define NUM_PPORT_2863_COUNTERS         ARRAY_SIZE(pport_2863_stats_desc)
362 #define NUM_PPORT_2819_COUNTERS         ARRAY_SIZE(pport_2819_stats_desc)
363 #define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \
364         ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
365 #define NUM_PPORT_PER_PRIO_PFC_COUNTERS \
366         ARRAY_SIZE(pport_per_prio_pfc_stats_desc)
367 #define NUM_PPORT_COUNTERS              (NUM_PPORT_802_3_COUNTERS + \
368                                          NUM_PPORT_2863_COUNTERS  + \
369                                          NUM_PPORT_2819_COUNTERS  + \
370                                          NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
371                                          NUM_PPORT_PRIO)
372 #define NUM_RQ_STATS                    ARRAY_SIZE(rq_stats_desc)
373 #define NUM_SQ_STATS                    ARRAY_SIZE(sq_stats_desc)
374
375 struct mlx5e_stats {
376         struct mlx5e_sw_stats sw;
377         struct mlx5e_qcounter_stats qcnt;
378         struct mlx5e_vport_stats vport;
379         struct mlx5e_pport_stats pport;
380         struct rtnl_link_stats64 vf_vport;
381 };
382
383 static const struct counter_desc mlx5e_pme_status_desc[] = {
384         { "module_plug", 0 },
385         { "module_unplug", 8 },
386 };
387
388 static const struct counter_desc mlx5e_pme_error_desc[] = {
389         { "module_pwr_budget_exd", 0 },  /* power budget exceed */
390         { "module_long_range", 8 },      /* long range for non MLNX cable */
391         { "module_bus_stuck", 16 },      /* bus stuck (I2C or data shorted) */
392         { "module_no_eeprom", 24 },      /* no eeprom/retry time out */
393         { "module_enforce_part", 32 },   /* enforce part number list */
394         { "module_unknown_id", 40 },     /* unknown identifier */
395         { "module_high_temp", 48 },      /* high temperature */
396         { "module_bad_shorted", 56 },    /* bad or shorted cable/module */
397         { "module_unknown_status", 64 },
398 };
399
400 #endif /* __MLX5_EN_STATS_H__ */