2 * Copyright (c) 2017, Mellanox Technologies, Ltd. All rights reserved.
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:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
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.
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
35 #include "en_accel/tls.h"
36 #include "en_accel/en_accel.h"
38 static unsigned int stats_grps_num(struct mlx5e_priv *priv)
40 return !priv->profile->stats_grps_num ? 0 :
41 priv->profile->stats_grps_num(priv);
44 unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv)
46 mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
47 const unsigned int num_stats_grps = stats_grps_num(priv);
48 unsigned int total = 0;
51 for (i = 0; i < num_stats_grps; i++)
52 total += stats_grps[i]->get_num_stats(priv);
57 void mlx5e_stats_update(struct mlx5e_priv *priv)
59 mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
60 const unsigned int num_stats_grps = stats_grps_num(priv);
63 for (i = num_stats_grps - 1; i >= 0; i--)
64 if (stats_grps[i]->update_stats)
65 stats_grps[i]->update_stats(priv);
68 void mlx5e_stats_fill(struct mlx5e_priv *priv, u64 *data, int idx)
70 mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
71 const unsigned int num_stats_grps = stats_grps_num(priv);
74 for (i = 0; i < num_stats_grps; i++)
75 idx = stats_grps[i]->fill_stats(priv, data, idx);
78 void mlx5e_stats_fill_strings(struct mlx5e_priv *priv, u8 *data)
80 mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
81 const unsigned int num_stats_grps = stats_grps_num(priv);
84 for (i = 0; i < num_stats_grps; i++)
85 idx = stats_grps[i]->fill_strings(priv, data, idx);
88 /* Concrete NIC Stats */
90 static const struct counter_desc sw_stats_desc[] = {
91 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_packets) },
92 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_bytes) },
93 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_packets) },
94 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_bytes) },
95 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_packets) },
96 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_bytes) },
97 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_packets) },
98 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tso_inner_bytes) },
99 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_added_vlan_packets) },
100 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_nop) },
102 #ifdef CONFIG_MLX5_EN_TLS
103 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_encrypted_packets) },
104 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_encrypted_bytes) },
105 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_ctx) },
106 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_ooo) },
107 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_dump_packets) },
108 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_dump_bytes) },
109 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_resync_bytes) },
110 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_skip_no_sync_data) },
111 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_no_sync_data) },
112 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_tls_drop_bypass_req) },
115 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_packets) },
116 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_lro_bytes) },
117 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_ecn_mark) },
118 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_removed_vlan_packets) },
119 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary) },
120 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_none) },
121 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete) },
122 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete_tail) },
123 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_complete_tail_slow) },
124 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_csum_unnecessary_inner) },
125 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_drop) },
126 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_redirect) },
127 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_xmit) },
128 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_mpwqe) },
129 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_inlnw) },
130 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_nops) },
131 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_full) },
132 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_err) },
133 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xdp_tx_cqe) },
134 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_none) },
135 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial) },
136 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_csum_partial_inner) },
137 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_stopped) },
138 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_dropped) },
139 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xmit_more) },
140 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_recover) },
141 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_cqes) },
142 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_queue_wake) },
143 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_cqe_err) },
144 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xdp_xmit) },
145 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xdp_mpwqe) },
146 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xdp_inlnw) },
147 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xdp_nops) },
148 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xdp_full) },
149 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xdp_err) },
150 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xdp_cqes) },
151 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_wqe_err) },
152 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler_cqes) },
153 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_mpwqe_filler_strides) },
154 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_oversize_pkts_sw_drop) },
155 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_buff_alloc_err) },
156 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_blks) },
157 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cqe_compress_pkts) },
158 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_reuse) },
159 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_full) },
160 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_empty) },
161 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_busy) },
162 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_cache_waive) },
163 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_congst_umr) },
164 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_arfs_err) },
165 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_recover) },
166 #ifdef CONFIG_MLX5_EN_TLS
167 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_decrypted_packets) },
168 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_decrypted_bytes) },
169 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_ctx) },
170 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_del) },
171 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_resync_req_pkt) },
172 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_resync_req_start) },
173 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_resync_req_end) },
174 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_resync_req_skip) },
175 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_resync_res_ok) },
176 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_resync_res_skip) },
177 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_tls_err) },
179 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_events) },
180 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_poll) },
181 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_arm) },
182 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_aff_change) },
183 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_force_irq) },
184 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, ch_eq_rearm) },
185 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_packets) },
186 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_bytes) },
187 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_csum_complete) },
188 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_csum_unnecessary) },
189 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_csum_unnecessary_inner) },
190 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_csum_none) },
191 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_ecn_mark) },
192 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_removed_vlan_packets) },
193 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_xdp_drop) },
194 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_xdp_redirect) },
195 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_wqe_err) },
196 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_mpwqe_filler_cqes) },
197 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_mpwqe_filler_strides) },
198 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_oversize_pkts_sw_drop) },
199 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_buff_alloc_err) },
200 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_cqe_compress_blks) },
201 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_cqe_compress_pkts) },
202 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_congst_umr) },
203 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, rx_xsk_arfs_err) },
204 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xsk_xmit) },
205 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xsk_mpwqe) },
206 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xsk_inlnw) },
207 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xsk_full) },
208 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xsk_err) },
209 { MLX5E_DECLARE_STAT(struct mlx5e_sw_stats, tx_xsk_cqes) },
212 #define NUM_SW_COUNTERS ARRAY_SIZE(sw_stats_desc)
214 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(sw)
216 return NUM_SW_COUNTERS;
219 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(sw)
223 for (i = 0; i < NUM_SW_COUNTERS; i++)
224 strcpy(data + (idx++) * ETH_GSTRING_LEN, sw_stats_desc[i].format);
228 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(sw)
232 for (i = 0; i < NUM_SW_COUNTERS; i++)
233 data[idx++] = MLX5E_READ_CTR64_CPU(&priv->stats.sw, sw_stats_desc, i);
237 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(sw)
239 struct mlx5e_sw_stats *s = &priv->stats.sw;
242 memset(s, 0, sizeof(*s));
244 for (i = 0; i < priv->max_nch; i++) {
245 struct mlx5e_channel_stats *channel_stats =
246 &priv->channel_stats[i];
247 struct mlx5e_xdpsq_stats *xdpsq_red_stats = &channel_stats->xdpsq;
248 struct mlx5e_xdpsq_stats *xdpsq_stats = &channel_stats->rq_xdpsq;
249 struct mlx5e_xdpsq_stats *xsksq_stats = &channel_stats->xsksq;
250 struct mlx5e_rq_stats *xskrq_stats = &channel_stats->xskrq;
251 struct mlx5e_rq_stats *rq_stats = &channel_stats->rq;
252 struct mlx5e_ch_stats *ch_stats = &channel_stats->ch;
255 s->rx_packets += rq_stats->packets;
256 s->rx_bytes += rq_stats->bytes;
257 s->rx_lro_packets += rq_stats->lro_packets;
258 s->rx_lro_bytes += rq_stats->lro_bytes;
259 s->rx_ecn_mark += rq_stats->ecn_mark;
260 s->rx_removed_vlan_packets += rq_stats->removed_vlan_packets;
261 s->rx_csum_none += rq_stats->csum_none;
262 s->rx_csum_complete += rq_stats->csum_complete;
263 s->rx_csum_complete_tail += rq_stats->csum_complete_tail;
264 s->rx_csum_complete_tail_slow += rq_stats->csum_complete_tail_slow;
265 s->rx_csum_unnecessary += rq_stats->csum_unnecessary;
266 s->rx_csum_unnecessary_inner += rq_stats->csum_unnecessary_inner;
267 s->rx_xdp_drop += rq_stats->xdp_drop;
268 s->rx_xdp_redirect += rq_stats->xdp_redirect;
269 s->rx_xdp_tx_xmit += xdpsq_stats->xmit;
270 s->rx_xdp_tx_mpwqe += xdpsq_stats->mpwqe;
271 s->rx_xdp_tx_inlnw += xdpsq_stats->inlnw;
272 s->rx_xdp_tx_nops += xdpsq_stats->nops;
273 s->rx_xdp_tx_full += xdpsq_stats->full;
274 s->rx_xdp_tx_err += xdpsq_stats->err;
275 s->rx_xdp_tx_cqe += xdpsq_stats->cqes;
276 s->rx_wqe_err += rq_stats->wqe_err;
277 s->rx_mpwqe_filler_cqes += rq_stats->mpwqe_filler_cqes;
278 s->rx_mpwqe_filler_strides += rq_stats->mpwqe_filler_strides;
279 s->rx_oversize_pkts_sw_drop += rq_stats->oversize_pkts_sw_drop;
280 s->rx_buff_alloc_err += rq_stats->buff_alloc_err;
281 s->rx_cqe_compress_blks += rq_stats->cqe_compress_blks;
282 s->rx_cqe_compress_pkts += rq_stats->cqe_compress_pkts;
283 s->rx_cache_reuse += rq_stats->cache_reuse;
284 s->rx_cache_full += rq_stats->cache_full;
285 s->rx_cache_empty += rq_stats->cache_empty;
286 s->rx_cache_busy += rq_stats->cache_busy;
287 s->rx_cache_waive += rq_stats->cache_waive;
288 s->rx_congst_umr += rq_stats->congst_umr;
289 s->rx_arfs_err += rq_stats->arfs_err;
290 s->rx_recover += rq_stats->recover;
291 #ifdef CONFIG_MLX5_EN_TLS
292 s->rx_tls_decrypted_packets += rq_stats->tls_decrypted_packets;
293 s->rx_tls_decrypted_bytes += rq_stats->tls_decrypted_bytes;
294 s->rx_tls_ctx += rq_stats->tls_ctx;
295 s->rx_tls_del += rq_stats->tls_del;
296 s->rx_tls_resync_req_pkt += rq_stats->tls_resync_req_pkt;
297 s->rx_tls_resync_req_start += rq_stats->tls_resync_req_start;
298 s->rx_tls_resync_req_end += rq_stats->tls_resync_req_end;
299 s->rx_tls_resync_req_skip += rq_stats->tls_resync_req_skip;
300 s->rx_tls_resync_res_ok += rq_stats->tls_resync_res_ok;
301 s->rx_tls_resync_res_skip += rq_stats->tls_resync_res_skip;
302 s->rx_tls_err += rq_stats->tls_err;
304 s->ch_events += ch_stats->events;
305 s->ch_poll += ch_stats->poll;
306 s->ch_arm += ch_stats->arm;
307 s->ch_aff_change += ch_stats->aff_change;
308 s->ch_force_irq += ch_stats->force_irq;
309 s->ch_eq_rearm += ch_stats->eq_rearm;
311 s->tx_xdp_xmit += xdpsq_red_stats->xmit;
312 s->tx_xdp_mpwqe += xdpsq_red_stats->mpwqe;
313 s->tx_xdp_inlnw += xdpsq_red_stats->inlnw;
314 s->tx_xdp_nops += xdpsq_red_stats->nops;
315 s->tx_xdp_full += xdpsq_red_stats->full;
316 s->tx_xdp_err += xdpsq_red_stats->err;
317 s->tx_xdp_cqes += xdpsq_red_stats->cqes;
318 /* AF_XDP zero-copy */
319 s->rx_xsk_packets += xskrq_stats->packets;
320 s->rx_xsk_bytes += xskrq_stats->bytes;
321 s->rx_xsk_csum_complete += xskrq_stats->csum_complete;
322 s->rx_xsk_csum_unnecessary += xskrq_stats->csum_unnecessary;
323 s->rx_xsk_csum_unnecessary_inner += xskrq_stats->csum_unnecessary_inner;
324 s->rx_xsk_csum_none += xskrq_stats->csum_none;
325 s->rx_xsk_ecn_mark += xskrq_stats->ecn_mark;
326 s->rx_xsk_removed_vlan_packets += xskrq_stats->removed_vlan_packets;
327 s->rx_xsk_xdp_drop += xskrq_stats->xdp_drop;
328 s->rx_xsk_xdp_redirect += xskrq_stats->xdp_redirect;
329 s->rx_xsk_wqe_err += xskrq_stats->wqe_err;
330 s->rx_xsk_mpwqe_filler_cqes += xskrq_stats->mpwqe_filler_cqes;
331 s->rx_xsk_mpwqe_filler_strides += xskrq_stats->mpwqe_filler_strides;
332 s->rx_xsk_oversize_pkts_sw_drop += xskrq_stats->oversize_pkts_sw_drop;
333 s->rx_xsk_buff_alloc_err += xskrq_stats->buff_alloc_err;
334 s->rx_xsk_cqe_compress_blks += xskrq_stats->cqe_compress_blks;
335 s->rx_xsk_cqe_compress_pkts += xskrq_stats->cqe_compress_pkts;
336 s->rx_xsk_congst_umr += xskrq_stats->congst_umr;
337 s->rx_xsk_arfs_err += xskrq_stats->arfs_err;
338 s->tx_xsk_xmit += xsksq_stats->xmit;
339 s->tx_xsk_mpwqe += xsksq_stats->mpwqe;
340 s->tx_xsk_inlnw += xsksq_stats->inlnw;
341 s->tx_xsk_full += xsksq_stats->full;
342 s->tx_xsk_err += xsksq_stats->err;
343 s->tx_xsk_cqes += xsksq_stats->cqes;
345 for (j = 0; j < priv->max_opened_tc; j++) {
346 struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j];
348 s->tx_packets += sq_stats->packets;
349 s->tx_bytes += sq_stats->bytes;
350 s->tx_tso_packets += sq_stats->tso_packets;
351 s->tx_tso_bytes += sq_stats->tso_bytes;
352 s->tx_tso_inner_packets += sq_stats->tso_inner_packets;
353 s->tx_tso_inner_bytes += sq_stats->tso_inner_bytes;
354 s->tx_added_vlan_packets += sq_stats->added_vlan_packets;
355 s->tx_nop += sq_stats->nop;
356 s->tx_queue_stopped += sq_stats->stopped;
357 s->tx_queue_wake += sq_stats->wake;
358 s->tx_queue_dropped += sq_stats->dropped;
359 s->tx_cqe_err += sq_stats->cqe_err;
360 s->tx_recover += sq_stats->recover;
361 s->tx_xmit_more += sq_stats->xmit_more;
362 s->tx_csum_partial_inner += sq_stats->csum_partial_inner;
363 s->tx_csum_none += sq_stats->csum_none;
364 s->tx_csum_partial += sq_stats->csum_partial;
365 #ifdef CONFIG_MLX5_EN_TLS
366 s->tx_tls_encrypted_packets += sq_stats->tls_encrypted_packets;
367 s->tx_tls_encrypted_bytes += sq_stats->tls_encrypted_bytes;
368 s->tx_tls_ctx += sq_stats->tls_ctx;
369 s->tx_tls_ooo += sq_stats->tls_ooo;
370 s->tx_tls_dump_bytes += sq_stats->tls_dump_bytes;
371 s->tx_tls_dump_packets += sq_stats->tls_dump_packets;
372 s->tx_tls_resync_bytes += sq_stats->tls_resync_bytes;
373 s->tx_tls_skip_no_sync_data += sq_stats->tls_skip_no_sync_data;
374 s->tx_tls_drop_no_sync_data += sq_stats->tls_drop_no_sync_data;
375 s->tx_tls_drop_bypass_req += sq_stats->tls_drop_bypass_req;
377 s->tx_cqes += sq_stats->cqes;
379 /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657 */
385 static const struct counter_desc q_stats_desc[] = {
386 { MLX5E_DECLARE_STAT(struct mlx5e_qcounter_stats, rx_out_of_buffer) },
389 static const struct counter_desc drop_rq_stats_desc[] = {
390 { MLX5E_DECLARE_STAT(struct mlx5e_qcounter_stats, rx_if_down_packets) },
393 #define NUM_Q_COUNTERS ARRAY_SIZE(q_stats_desc)
394 #define NUM_DROP_RQ_COUNTERS ARRAY_SIZE(drop_rq_stats_desc)
396 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(qcnt)
401 num_stats += NUM_Q_COUNTERS;
403 if (priv->drop_rq_q_counter)
404 num_stats += NUM_DROP_RQ_COUNTERS;
409 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(qcnt)
413 for (i = 0; i < NUM_Q_COUNTERS && priv->q_counter; i++)
414 strcpy(data + (idx++) * ETH_GSTRING_LEN,
415 q_stats_desc[i].format);
417 for (i = 0; i < NUM_DROP_RQ_COUNTERS && priv->drop_rq_q_counter; i++)
418 strcpy(data + (idx++) * ETH_GSTRING_LEN,
419 drop_rq_stats_desc[i].format);
424 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(qcnt)
428 for (i = 0; i < NUM_Q_COUNTERS && priv->q_counter; i++)
429 data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt,
431 for (i = 0; i < NUM_DROP_RQ_COUNTERS && priv->drop_rq_q_counter; i++)
432 data[idx++] = MLX5E_READ_CTR32_CPU(&priv->stats.qcnt,
433 drop_rq_stats_desc, i);
437 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(qcnt)
439 struct mlx5e_qcounter_stats *qcnt = &priv->stats.qcnt;
440 u32 out[MLX5_ST_SZ_DW(query_q_counter_out)] = {};
441 u32 in[MLX5_ST_SZ_DW(query_q_counter_in)] = {};
444 MLX5_SET(query_q_counter_in, in, opcode, MLX5_CMD_OP_QUERY_Q_COUNTER);
446 if (priv->q_counter) {
447 MLX5_SET(query_q_counter_in, in, counter_set_id,
449 ret = mlx5_cmd_exec_inout(priv->mdev, query_q_counter, in, out);
451 qcnt->rx_out_of_buffer = MLX5_GET(query_q_counter_out,
455 if (priv->drop_rq_q_counter) {
456 MLX5_SET(query_q_counter_in, in, counter_set_id,
457 priv->drop_rq_q_counter);
458 ret = mlx5_cmd_exec_inout(priv->mdev, query_q_counter, in, out);
460 qcnt->rx_if_down_packets = MLX5_GET(query_q_counter_out,
465 #define VNIC_ENV_OFF(c) MLX5_BYTE_OFF(query_vnic_env_out, c)
466 static const struct counter_desc vnic_env_stats_steer_desc[] = {
467 { "rx_steer_missed_packets",
468 VNIC_ENV_OFF(vport_env.nic_receive_steering_discard) },
471 static const struct counter_desc vnic_env_stats_dev_oob_desc[] = {
472 { "dev_internal_queue_oob",
473 VNIC_ENV_OFF(vport_env.internal_rq_out_of_buffer) },
476 #define NUM_VNIC_ENV_STEER_COUNTERS(dev) \
477 (MLX5_CAP_GEN(dev, nic_receive_steering_discard) ? \
478 ARRAY_SIZE(vnic_env_stats_steer_desc) : 0)
479 #define NUM_VNIC_ENV_DEV_OOB_COUNTERS(dev) \
480 (MLX5_CAP_GEN(dev, vnic_env_int_rq_oob) ? \
481 ARRAY_SIZE(vnic_env_stats_dev_oob_desc) : 0)
483 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(vnic_env)
485 return NUM_VNIC_ENV_STEER_COUNTERS(priv->mdev) +
486 NUM_VNIC_ENV_DEV_OOB_COUNTERS(priv->mdev);
489 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(vnic_env)
493 for (i = 0; i < NUM_VNIC_ENV_STEER_COUNTERS(priv->mdev); i++)
494 strcpy(data + (idx++) * ETH_GSTRING_LEN,
495 vnic_env_stats_steer_desc[i].format);
497 for (i = 0; i < NUM_VNIC_ENV_DEV_OOB_COUNTERS(priv->mdev); i++)
498 strcpy(data + (idx++) * ETH_GSTRING_LEN,
499 vnic_env_stats_dev_oob_desc[i].format);
503 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(vnic_env)
507 for (i = 0; i < NUM_VNIC_ENV_STEER_COUNTERS(priv->mdev); i++)
508 data[idx++] = MLX5E_READ_CTR64_BE(priv->stats.vnic.query_vnic_env_out,
509 vnic_env_stats_steer_desc, i);
511 for (i = 0; i < NUM_VNIC_ENV_DEV_OOB_COUNTERS(priv->mdev); i++)
512 data[idx++] = MLX5E_READ_CTR32_BE(priv->stats.vnic.query_vnic_env_out,
513 vnic_env_stats_dev_oob_desc, i);
517 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vnic_env)
519 u32 *out = (u32 *)priv->stats.vnic.query_vnic_env_out;
520 u32 in[MLX5_ST_SZ_DW(query_vnic_env_in)] = {};
521 struct mlx5_core_dev *mdev = priv->mdev;
523 if (!MLX5_CAP_GEN(priv->mdev, nic_receive_steering_discard))
526 MLX5_SET(query_vnic_env_in, in, opcode, MLX5_CMD_OP_QUERY_VNIC_ENV);
527 mlx5_cmd_exec_inout(mdev, query_vnic_env, in, out);
530 #define VPORT_COUNTER_OFF(c) MLX5_BYTE_OFF(query_vport_counter_out, c)
531 static const struct counter_desc vport_stats_desc[] = {
532 { "rx_vport_unicast_packets",
533 VPORT_COUNTER_OFF(received_eth_unicast.packets) },
534 { "rx_vport_unicast_bytes",
535 VPORT_COUNTER_OFF(received_eth_unicast.octets) },
536 { "tx_vport_unicast_packets",
537 VPORT_COUNTER_OFF(transmitted_eth_unicast.packets) },
538 { "tx_vport_unicast_bytes",
539 VPORT_COUNTER_OFF(transmitted_eth_unicast.octets) },
540 { "rx_vport_multicast_packets",
541 VPORT_COUNTER_OFF(received_eth_multicast.packets) },
542 { "rx_vport_multicast_bytes",
543 VPORT_COUNTER_OFF(received_eth_multicast.octets) },
544 { "tx_vport_multicast_packets",
545 VPORT_COUNTER_OFF(transmitted_eth_multicast.packets) },
546 { "tx_vport_multicast_bytes",
547 VPORT_COUNTER_OFF(transmitted_eth_multicast.octets) },
548 { "rx_vport_broadcast_packets",
549 VPORT_COUNTER_OFF(received_eth_broadcast.packets) },
550 { "rx_vport_broadcast_bytes",
551 VPORT_COUNTER_OFF(received_eth_broadcast.octets) },
552 { "tx_vport_broadcast_packets",
553 VPORT_COUNTER_OFF(transmitted_eth_broadcast.packets) },
554 { "tx_vport_broadcast_bytes",
555 VPORT_COUNTER_OFF(transmitted_eth_broadcast.octets) },
556 { "rx_vport_rdma_unicast_packets",
557 VPORT_COUNTER_OFF(received_ib_unicast.packets) },
558 { "rx_vport_rdma_unicast_bytes",
559 VPORT_COUNTER_OFF(received_ib_unicast.octets) },
560 { "tx_vport_rdma_unicast_packets",
561 VPORT_COUNTER_OFF(transmitted_ib_unicast.packets) },
562 { "tx_vport_rdma_unicast_bytes",
563 VPORT_COUNTER_OFF(transmitted_ib_unicast.octets) },
564 { "rx_vport_rdma_multicast_packets",
565 VPORT_COUNTER_OFF(received_ib_multicast.packets) },
566 { "rx_vport_rdma_multicast_bytes",
567 VPORT_COUNTER_OFF(received_ib_multicast.octets) },
568 { "tx_vport_rdma_multicast_packets",
569 VPORT_COUNTER_OFF(transmitted_ib_multicast.packets) },
570 { "tx_vport_rdma_multicast_bytes",
571 VPORT_COUNTER_OFF(transmitted_ib_multicast.octets) },
574 #define NUM_VPORT_COUNTERS ARRAY_SIZE(vport_stats_desc)
576 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(vport)
578 return NUM_VPORT_COUNTERS;
581 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(vport)
585 for (i = 0; i < NUM_VPORT_COUNTERS; i++)
586 strcpy(data + (idx++) * ETH_GSTRING_LEN, vport_stats_desc[i].format);
590 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(vport)
594 for (i = 0; i < NUM_VPORT_COUNTERS; i++)
595 data[idx++] = MLX5E_READ_CTR64_BE(priv->stats.vport.query_vport_out,
596 vport_stats_desc, i);
600 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport)
602 u32 *out = (u32 *)priv->stats.vport.query_vport_out;
603 u32 in[MLX5_ST_SZ_DW(query_vport_counter_in)] = {};
604 struct mlx5_core_dev *mdev = priv->mdev;
606 MLX5_SET(query_vport_counter_in, in, opcode, MLX5_CMD_OP_QUERY_VPORT_COUNTER);
607 mlx5_cmd_exec_inout(mdev, query_vport_counter, in, out);
610 #define PPORT_802_3_OFF(c) \
611 MLX5_BYTE_OFF(ppcnt_reg, \
612 counter_set.eth_802_3_cntrs_grp_data_layout.c##_high)
613 static const struct counter_desc pport_802_3_stats_desc[] = {
614 { "tx_packets_phy", PPORT_802_3_OFF(a_frames_transmitted_ok) },
615 { "rx_packets_phy", PPORT_802_3_OFF(a_frames_received_ok) },
616 { "rx_crc_errors_phy", PPORT_802_3_OFF(a_frame_check_sequence_errors) },
617 { "tx_bytes_phy", PPORT_802_3_OFF(a_octets_transmitted_ok) },
618 { "rx_bytes_phy", PPORT_802_3_OFF(a_octets_received_ok) },
619 { "tx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_xmitted_ok) },
620 { "tx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_xmitted_ok) },
621 { "rx_multicast_phy", PPORT_802_3_OFF(a_multicast_frames_received_ok) },
622 { "rx_broadcast_phy", PPORT_802_3_OFF(a_broadcast_frames_received_ok) },
623 { "rx_in_range_len_errors_phy", PPORT_802_3_OFF(a_in_range_length_errors) },
624 { "rx_out_of_range_len_phy", PPORT_802_3_OFF(a_out_of_range_length_field) },
625 { "rx_oversize_pkts_phy", PPORT_802_3_OFF(a_frame_too_long_errors) },
626 { "rx_symbol_err_phy", PPORT_802_3_OFF(a_symbol_error_during_carrier) },
627 { "tx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_transmitted) },
628 { "rx_mac_control_phy", PPORT_802_3_OFF(a_mac_control_frames_received) },
629 { "rx_unsupported_op_phy", PPORT_802_3_OFF(a_unsupported_opcodes_received) },
630 { "rx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_received) },
631 { "tx_pause_ctrl_phy", PPORT_802_3_OFF(a_pause_mac_ctrl_frames_transmitted) },
634 #define NUM_PPORT_802_3_COUNTERS ARRAY_SIZE(pport_802_3_stats_desc)
636 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(802_3)
638 return NUM_PPORT_802_3_COUNTERS;
641 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(802_3)
645 for (i = 0; i < NUM_PPORT_802_3_COUNTERS; i++)
646 strcpy(data + (idx++) * ETH_GSTRING_LEN, pport_802_3_stats_desc[i].format);
650 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(802_3)
654 for (i = 0; i < NUM_PPORT_802_3_COUNTERS; i++)
655 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.IEEE_802_3_counters,
656 pport_802_3_stats_desc, i);
660 #define MLX5_BASIC_PPCNT_SUPPORTED(mdev) \
661 (MLX5_CAP_GEN(mdev, pcam_reg) ? MLX5_CAP_PCAM_REG(mdev, ppcnt) : 1)
663 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(802_3)
665 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
666 struct mlx5_core_dev *mdev = priv->mdev;
667 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {0};
668 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
671 if (!MLX5_BASIC_PPCNT_SUPPORTED(mdev))
674 MLX5_SET(ppcnt_reg, in, local_port, 1);
675 out = pstats->IEEE_802_3_counters;
676 MLX5_SET(ppcnt_reg, in, grp, MLX5_IEEE_802_3_COUNTERS_GROUP);
677 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
680 #define MLX5E_READ_CTR64_BE_F(ptr, c) \
681 be64_to_cpu(*(__be64 *)((char *)ptr + \
682 MLX5_BYTE_OFF(ppcnt_reg, \
683 counter_set.eth_802_3_cntrs_grp_data_layout.c##_high)))
685 void mlx5e_stats_pause_get(struct mlx5e_priv *priv,
686 struct ethtool_pause_stats *pause_stats)
688 u32 ppcnt_ieee_802_3[MLX5_ST_SZ_DW(ppcnt_reg)];
689 struct mlx5_core_dev *mdev = priv->mdev;
690 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {};
691 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
693 if (!MLX5_BASIC_PPCNT_SUPPORTED(mdev))
696 MLX5_SET(ppcnt_reg, in, local_port, 1);
697 MLX5_SET(ppcnt_reg, in, grp, MLX5_IEEE_802_3_COUNTERS_GROUP);
698 mlx5_core_access_reg(mdev, in, sz, ppcnt_ieee_802_3,
699 sz, MLX5_REG_PPCNT, 0, 0);
701 pause_stats->tx_pause_frames =
702 MLX5E_READ_CTR64_BE_F(ppcnt_ieee_802_3,
703 a_pause_mac_ctrl_frames_transmitted);
704 pause_stats->rx_pause_frames =
705 MLX5E_READ_CTR64_BE_F(ppcnt_ieee_802_3,
706 a_pause_mac_ctrl_frames_received);
709 #define PPORT_2863_OFF(c) \
710 MLX5_BYTE_OFF(ppcnt_reg, \
711 counter_set.eth_2863_cntrs_grp_data_layout.c##_high)
712 static const struct counter_desc pport_2863_stats_desc[] = {
713 { "rx_discards_phy", PPORT_2863_OFF(if_in_discards) },
714 { "tx_discards_phy", PPORT_2863_OFF(if_out_discards) },
715 { "tx_errors_phy", PPORT_2863_OFF(if_out_errors) },
718 #define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc)
720 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(2863)
722 return NUM_PPORT_2863_COUNTERS;
725 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(2863)
729 for (i = 0; i < NUM_PPORT_2863_COUNTERS; i++)
730 strcpy(data + (idx++) * ETH_GSTRING_LEN, pport_2863_stats_desc[i].format);
734 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(2863)
738 for (i = 0; i < NUM_PPORT_2863_COUNTERS; i++)
739 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2863_counters,
740 pport_2863_stats_desc, i);
744 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(2863)
746 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
747 struct mlx5_core_dev *mdev = priv->mdev;
748 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {0};
749 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
752 MLX5_SET(ppcnt_reg, in, local_port, 1);
753 out = pstats->RFC_2863_counters;
754 MLX5_SET(ppcnt_reg, in, grp, MLX5_RFC_2863_COUNTERS_GROUP);
755 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
758 #define PPORT_2819_OFF(c) \
759 MLX5_BYTE_OFF(ppcnt_reg, \
760 counter_set.eth_2819_cntrs_grp_data_layout.c##_high)
761 static const struct counter_desc pport_2819_stats_desc[] = {
762 { "rx_undersize_pkts_phy", PPORT_2819_OFF(ether_stats_undersize_pkts) },
763 { "rx_fragments_phy", PPORT_2819_OFF(ether_stats_fragments) },
764 { "rx_jabbers_phy", PPORT_2819_OFF(ether_stats_jabbers) },
765 { "rx_64_bytes_phy", PPORT_2819_OFF(ether_stats_pkts64octets) },
766 { "rx_65_to_127_bytes_phy", PPORT_2819_OFF(ether_stats_pkts65to127octets) },
767 { "rx_128_to_255_bytes_phy", PPORT_2819_OFF(ether_stats_pkts128to255octets) },
768 { "rx_256_to_511_bytes_phy", PPORT_2819_OFF(ether_stats_pkts256to511octets) },
769 { "rx_512_to_1023_bytes_phy", PPORT_2819_OFF(ether_stats_pkts512to1023octets) },
770 { "rx_1024_to_1518_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1024to1518octets) },
771 { "rx_1519_to_2047_bytes_phy", PPORT_2819_OFF(ether_stats_pkts1519to2047octets) },
772 { "rx_2048_to_4095_bytes_phy", PPORT_2819_OFF(ether_stats_pkts2048to4095octets) },
773 { "rx_4096_to_8191_bytes_phy", PPORT_2819_OFF(ether_stats_pkts4096to8191octets) },
774 { "rx_8192_to_10239_bytes_phy", PPORT_2819_OFF(ether_stats_pkts8192to10239octets) },
777 #define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc)
779 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(2819)
781 return NUM_PPORT_2819_COUNTERS;
784 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(2819)
788 for (i = 0; i < NUM_PPORT_2819_COUNTERS; i++)
789 strcpy(data + (idx++) * ETH_GSTRING_LEN, pport_2819_stats_desc[i].format);
793 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(2819)
797 for (i = 0; i < NUM_PPORT_2819_COUNTERS; i++)
798 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters,
799 pport_2819_stats_desc, i);
803 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(2819)
805 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
806 struct mlx5_core_dev *mdev = priv->mdev;
807 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {0};
808 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
811 if (!MLX5_BASIC_PPCNT_SUPPORTED(mdev))
814 MLX5_SET(ppcnt_reg, in, local_port, 1);
815 out = pstats->RFC_2819_counters;
816 MLX5_SET(ppcnt_reg, in, grp, MLX5_RFC_2819_COUNTERS_GROUP);
817 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
820 #define PPORT_PHY_STATISTICAL_OFF(c) \
821 MLX5_BYTE_OFF(ppcnt_reg, \
822 counter_set.phys_layer_statistical_cntrs.c##_high)
823 static const struct counter_desc pport_phy_statistical_stats_desc[] = {
824 { "rx_pcs_symbol_err_phy", PPORT_PHY_STATISTICAL_OFF(phy_symbol_errors) },
825 { "rx_corrected_bits_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits) },
828 static const struct counter_desc
829 pport_phy_statistical_err_lanes_stats_desc[] = {
830 { "rx_err_lane_0_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits_lane0) },
831 { "rx_err_lane_1_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits_lane1) },
832 { "rx_err_lane_2_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits_lane2) },
833 { "rx_err_lane_3_phy", PPORT_PHY_STATISTICAL_OFF(phy_corrected_bits_lane3) },
836 #define NUM_PPORT_PHY_STATISTICAL_COUNTERS \
837 ARRAY_SIZE(pport_phy_statistical_stats_desc)
838 #define NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS \
839 ARRAY_SIZE(pport_phy_statistical_err_lanes_stats_desc)
841 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(phy)
843 struct mlx5_core_dev *mdev = priv->mdev;
846 /* "1" for link_down_events special counter */
849 num_stats += MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group) ?
850 NUM_PPORT_PHY_STATISTICAL_COUNTERS : 0;
852 num_stats += MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters) ?
853 NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS : 0;
858 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(phy)
860 struct mlx5_core_dev *mdev = priv->mdev;
863 strcpy(data + (idx++) * ETH_GSTRING_LEN, "link_down_events_phy");
865 if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
868 for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
869 strcpy(data + (idx++) * ETH_GSTRING_LEN,
870 pport_phy_statistical_stats_desc[i].format);
872 if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters))
873 for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++)
874 strcpy(data + (idx++) * ETH_GSTRING_LEN,
875 pport_phy_statistical_err_lanes_stats_desc[i].format);
880 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(phy)
882 struct mlx5_core_dev *mdev = priv->mdev;
885 /* link_down_events_phy has special handling since it is not stored in __be64 format */
886 data[idx++] = MLX5_GET(ppcnt_reg, priv->stats.pport.phy_counters,
887 counter_set.phys_layer_cntrs.link_down_events);
889 if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
892 for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_COUNTERS; i++)
894 MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
895 pport_phy_statistical_stats_desc, i);
897 if (MLX5_CAP_PCAM_FEATURE(mdev, per_lane_error_counters))
898 for (i = 0; i < NUM_PPORT_PHY_STATISTICAL_PER_LANE_COUNTERS; i++)
900 MLX5E_READ_CTR64_BE(&priv->stats.pport.phy_statistical_counters,
901 pport_phy_statistical_err_lanes_stats_desc,
906 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(phy)
908 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
909 struct mlx5_core_dev *mdev = priv->mdev;
910 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {0};
911 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
914 MLX5_SET(ppcnt_reg, in, local_port, 1);
915 out = pstats->phy_counters;
916 MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_COUNTERS_GROUP);
917 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
919 if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
922 out = pstats->phy_statistical_counters;
923 MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_STATISTICAL_GROUP);
924 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
927 #define PPORT_ETH_EXT_OFF(c) \
928 MLX5_BYTE_OFF(ppcnt_reg, \
929 counter_set.eth_extended_cntrs_grp_data_layout.c##_high)
930 static const struct counter_desc pport_eth_ext_stats_desc[] = {
931 { "rx_buffer_passed_thres_phy", PPORT_ETH_EXT_OFF(rx_buffer_almost_full) },
934 #define NUM_PPORT_ETH_EXT_COUNTERS ARRAY_SIZE(pport_eth_ext_stats_desc)
936 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(eth_ext)
938 if (MLX5_CAP_PCAM_FEATURE((priv)->mdev, rx_buffer_fullness_counters))
939 return NUM_PPORT_ETH_EXT_COUNTERS;
944 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(eth_ext)
948 if (MLX5_CAP_PCAM_FEATURE((priv)->mdev, rx_buffer_fullness_counters))
949 for (i = 0; i < NUM_PPORT_ETH_EXT_COUNTERS; i++)
950 strcpy(data + (idx++) * ETH_GSTRING_LEN,
951 pport_eth_ext_stats_desc[i].format);
955 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(eth_ext)
959 if (MLX5_CAP_PCAM_FEATURE((priv)->mdev, rx_buffer_fullness_counters))
960 for (i = 0; i < NUM_PPORT_ETH_EXT_COUNTERS; i++)
962 MLX5E_READ_CTR64_BE(&priv->stats.pport.eth_ext_counters,
963 pport_eth_ext_stats_desc, i);
967 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(eth_ext)
969 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
970 struct mlx5_core_dev *mdev = priv->mdev;
971 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {0};
972 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
975 if (!MLX5_CAP_PCAM_FEATURE(mdev, rx_buffer_fullness_counters))
978 MLX5_SET(ppcnt_reg, in, local_port, 1);
979 out = pstats->eth_ext_counters;
980 MLX5_SET(ppcnt_reg, in, grp, MLX5_ETHERNET_EXTENDED_COUNTERS_GROUP);
981 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
984 #define PCIE_PERF_OFF(c) \
985 MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c)
986 static const struct counter_desc pcie_perf_stats_desc[] = {
987 { "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) },
988 { "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
991 #define PCIE_PERF_OFF64(c) \
992 MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c##_high)
993 static const struct counter_desc pcie_perf_stats_desc64[] = {
994 { "outbound_pci_buffer_overflow", PCIE_PERF_OFF64(tx_overflow_buffer_pkt) },
997 static const struct counter_desc pcie_perf_stall_stats_desc[] = {
998 { "outbound_pci_stalled_rd", PCIE_PERF_OFF(outbound_stalled_reads) },
999 { "outbound_pci_stalled_wr", PCIE_PERF_OFF(outbound_stalled_writes) },
1000 { "outbound_pci_stalled_rd_events", PCIE_PERF_OFF(outbound_stalled_reads_events) },
1001 { "outbound_pci_stalled_wr_events", PCIE_PERF_OFF(outbound_stalled_writes_events) },
1004 #define NUM_PCIE_PERF_COUNTERS ARRAY_SIZE(pcie_perf_stats_desc)
1005 #define NUM_PCIE_PERF_COUNTERS64 ARRAY_SIZE(pcie_perf_stats_desc64)
1006 #define NUM_PCIE_PERF_STALL_COUNTERS ARRAY_SIZE(pcie_perf_stall_stats_desc)
1008 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(pcie)
1012 if (MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_performance_group))
1013 num_stats += NUM_PCIE_PERF_COUNTERS;
1015 if (MLX5_CAP_MCAM_FEATURE((priv)->mdev, tx_overflow_buffer_pkt))
1016 num_stats += NUM_PCIE_PERF_COUNTERS64;
1018 if (MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_outbound_stalled))
1019 num_stats += NUM_PCIE_PERF_STALL_COUNTERS;
1024 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(pcie)
1028 if (MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_performance_group))
1029 for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
1030 strcpy(data + (idx++) * ETH_GSTRING_LEN,
1031 pcie_perf_stats_desc[i].format);
1033 if (MLX5_CAP_MCAM_FEATURE((priv)->mdev, tx_overflow_buffer_pkt))
1034 for (i = 0; i < NUM_PCIE_PERF_COUNTERS64; i++)
1035 strcpy(data + (idx++) * ETH_GSTRING_LEN,
1036 pcie_perf_stats_desc64[i].format);
1038 if (MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_outbound_stalled))
1039 for (i = 0; i < NUM_PCIE_PERF_STALL_COUNTERS; i++)
1040 strcpy(data + (idx++) * ETH_GSTRING_LEN,
1041 pcie_perf_stall_stats_desc[i].format);
1045 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(pcie)
1049 if (MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_performance_group))
1050 for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
1052 MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
1053 pcie_perf_stats_desc, i);
1055 if (MLX5_CAP_MCAM_FEATURE((priv)->mdev, tx_overflow_buffer_pkt))
1056 for (i = 0; i < NUM_PCIE_PERF_COUNTERS64; i++)
1058 MLX5E_READ_CTR64_BE(&priv->stats.pcie.pcie_perf_counters,
1059 pcie_perf_stats_desc64, i);
1061 if (MLX5_CAP_MCAM_FEATURE((priv)->mdev, pcie_outbound_stalled))
1062 for (i = 0; i < NUM_PCIE_PERF_STALL_COUNTERS; i++)
1064 MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
1065 pcie_perf_stall_stats_desc, i);
1069 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(pcie)
1071 struct mlx5e_pcie_stats *pcie_stats = &priv->stats.pcie;
1072 struct mlx5_core_dev *mdev = priv->mdev;
1073 u32 in[MLX5_ST_SZ_DW(mpcnt_reg)] = {0};
1074 int sz = MLX5_ST_SZ_BYTES(mpcnt_reg);
1077 if (!MLX5_CAP_MCAM_FEATURE(mdev, pcie_performance_group))
1080 out = pcie_stats->pcie_perf_counters;
1081 MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP);
1082 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
1085 #define PPORT_PER_TC_PRIO_OFF(c) \
1086 MLX5_BYTE_OFF(ppcnt_reg, \
1087 counter_set.eth_per_tc_prio_grp_data_layout.c##_high)
1089 static const struct counter_desc pport_per_tc_prio_stats_desc[] = {
1090 { "rx_prio%d_buf_discard", PPORT_PER_TC_PRIO_OFF(no_buffer_discard_uc) },
1093 #define NUM_PPORT_PER_TC_PRIO_COUNTERS ARRAY_SIZE(pport_per_tc_prio_stats_desc)
1095 #define PPORT_PER_TC_CONGEST_PRIO_OFF(c) \
1096 MLX5_BYTE_OFF(ppcnt_reg, \
1097 counter_set.eth_per_tc_congest_prio_grp_data_layout.c##_high)
1099 static const struct counter_desc pport_per_tc_congest_prio_stats_desc[] = {
1100 { "rx_prio%d_cong_discard", PPORT_PER_TC_CONGEST_PRIO_OFF(wred_discard) },
1101 { "rx_prio%d_marked", PPORT_PER_TC_CONGEST_PRIO_OFF(ecn_marked_tc) },
1104 #define NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS \
1105 ARRAY_SIZE(pport_per_tc_congest_prio_stats_desc)
1107 static int mlx5e_grp_per_tc_prio_get_num_stats(struct mlx5e_priv *priv)
1109 struct mlx5_core_dev *mdev = priv->mdev;
1111 if (!MLX5_CAP_GEN(mdev, sbcam_reg))
1114 return NUM_PPORT_PER_TC_PRIO_COUNTERS * NUM_PPORT_PRIO;
1117 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(per_port_buff_congest)
1119 struct mlx5_core_dev *mdev = priv->mdev;
1122 if (!MLX5_CAP_GEN(mdev, sbcam_reg))
1125 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
1126 for (i = 0; i < NUM_PPORT_PER_TC_PRIO_COUNTERS; i++)
1127 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1128 pport_per_tc_prio_stats_desc[i].format, prio);
1129 for (i = 0; i < NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS; i++)
1130 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1131 pport_per_tc_congest_prio_stats_desc[i].format, prio);
1137 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(per_port_buff_congest)
1139 struct mlx5e_pport_stats *pport = &priv->stats.pport;
1140 struct mlx5_core_dev *mdev = priv->mdev;
1143 if (!MLX5_CAP_GEN(mdev, sbcam_reg))
1146 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
1147 for (i = 0; i < NUM_PPORT_PER_TC_PRIO_COUNTERS; i++)
1149 MLX5E_READ_CTR64_BE(&pport->per_tc_prio_counters[prio],
1150 pport_per_tc_prio_stats_desc, i);
1151 for (i = 0; i < NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS ; i++)
1153 MLX5E_READ_CTR64_BE(&pport->per_tc_congest_prio_counters[prio],
1154 pport_per_tc_congest_prio_stats_desc, i);
1160 static void mlx5e_grp_per_tc_prio_update_stats(struct mlx5e_priv *priv)
1162 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
1163 struct mlx5_core_dev *mdev = priv->mdev;
1164 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {};
1165 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
1169 if (!MLX5_CAP_GEN(mdev, sbcam_reg))
1172 MLX5_SET(ppcnt_reg, in, pnat, 2);
1173 MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_TRAFFIC_CLASS_COUNTERS_GROUP);
1174 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
1175 out = pstats->per_tc_prio_counters[prio];
1176 MLX5_SET(ppcnt_reg, in, prio_tc, prio);
1177 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
1181 static int mlx5e_grp_per_tc_congest_prio_get_num_stats(struct mlx5e_priv *priv)
1183 struct mlx5_core_dev *mdev = priv->mdev;
1185 if (!MLX5_CAP_GEN(mdev, sbcam_reg))
1188 return NUM_PPORT_PER_TC_CONGEST_PRIO_COUNTERS * NUM_PPORT_PRIO;
1191 static void mlx5e_grp_per_tc_congest_prio_update_stats(struct mlx5e_priv *priv)
1193 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
1194 struct mlx5_core_dev *mdev = priv->mdev;
1195 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {};
1196 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
1200 if (!MLX5_CAP_GEN(mdev, sbcam_reg))
1203 MLX5_SET(ppcnt_reg, in, pnat, 2);
1204 MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_TRAFFIC_CLASS_CONGESTION_GROUP);
1205 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
1206 out = pstats->per_tc_congest_prio_counters[prio];
1207 MLX5_SET(ppcnt_reg, in, prio_tc, prio);
1208 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_PPCNT, 0, 0);
1212 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(per_port_buff_congest)
1214 return mlx5e_grp_per_tc_prio_get_num_stats(priv) +
1215 mlx5e_grp_per_tc_congest_prio_get_num_stats(priv);
1218 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(per_port_buff_congest)
1220 mlx5e_grp_per_tc_prio_update_stats(priv);
1221 mlx5e_grp_per_tc_congest_prio_update_stats(priv);
1224 #define PPORT_PER_PRIO_OFF(c) \
1225 MLX5_BYTE_OFF(ppcnt_reg, \
1226 counter_set.eth_per_prio_grp_data_layout.c##_high)
1227 static const struct counter_desc pport_per_prio_traffic_stats_desc[] = {
1228 { "rx_prio%d_bytes", PPORT_PER_PRIO_OFF(rx_octets) },
1229 { "rx_prio%d_packets", PPORT_PER_PRIO_OFF(rx_frames) },
1230 { "rx_prio%d_discards", PPORT_PER_PRIO_OFF(rx_discards) },
1231 { "tx_prio%d_bytes", PPORT_PER_PRIO_OFF(tx_octets) },
1232 { "tx_prio%d_packets", PPORT_PER_PRIO_OFF(tx_frames) },
1235 #define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
1237 static int mlx5e_grp_per_prio_traffic_get_num_stats(void)
1239 return NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * NUM_PPORT_PRIO;
1242 static int mlx5e_grp_per_prio_traffic_fill_strings(struct mlx5e_priv *priv,
1248 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
1249 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
1250 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1251 pport_per_prio_traffic_stats_desc[i].format, prio);
1257 static int mlx5e_grp_per_prio_traffic_fill_stats(struct mlx5e_priv *priv,
1263 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
1264 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
1266 MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
1267 pport_per_prio_traffic_stats_desc, i);
1273 static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
1274 /* %s is "global" or "prio{i}" */
1275 { "rx_%s_pause", PPORT_PER_PRIO_OFF(rx_pause) },
1276 { "rx_%s_pause_duration", PPORT_PER_PRIO_OFF(rx_pause_duration) },
1277 { "tx_%s_pause", PPORT_PER_PRIO_OFF(tx_pause) },
1278 { "tx_%s_pause_duration", PPORT_PER_PRIO_OFF(tx_pause_duration) },
1279 { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
1282 static const struct counter_desc pport_pfc_stall_stats_desc[] = {
1283 { "tx_pause_storm_warning_events", PPORT_PER_PRIO_OFF(device_stall_minor_watermark_cnt) },
1284 { "tx_pause_storm_error_events", PPORT_PER_PRIO_OFF(device_stall_critical_watermark_cnt) },
1287 #define NUM_PPORT_PER_PRIO_PFC_COUNTERS ARRAY_SIZE(pport_per_prio_pfc_stats_desc)
1288 #define NUM_PPORT_PFC_STALL_COUNTERS(priv) (ARRAY_SIZE(pport_pfc_stall_stats_desc) * \
1289 MLX5_CAP_PCAM_FEATURE((priv)->mdev, pfcc_mask) * \
1290 MLX5_CAP_DEBUG((priv)->mdev, stall_detect))
1292 static unsigned long mlx5e_query_pfc_combined(struct mlx5e_priv *priv)
1294 struct mlx5_core_dev *mdev = priv->mdev;
1299 if (MLX5_CAP_GEN(mdev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
1302 err = mlx5_query_port_pfc(mdev, &pfc_en_tx, &pfc_en_rx);
1304 return err ? 0 : pfc_en_tx | pfc_en_rx;
1307 static bool mlx5e_query_global_pause_combined(struct mlx5e_priv *priv)
1309 struct mlx5_core_dev *mdev = priv->mdev;
1314 if (MLX5_CAP_GEN(mdev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
1317 err = mlx5_query_port_pause(mdev, &rx_pause, &tx_pause);
1319 return err ? false : rx_pause | tx_pause;
1322 static int mlx5e_grp_per_prio_pfc_get_num_stats(struct mlx5e_priv *priv)
1324 return (mlx5e_query_global_pause_combined(priv) +
1325 hweight8(mlx5e_query_pfc_combined(priv))) *
1326 NUM_PPORT_PER_PRIO_PFC_COUNTERS +
1327 NUM_PPORT_PFC_STALL_COUNTERS(priv);
1330 static int mlx5e_grp_per_prio_pfc_fill_strings(struct mlx5e_priv *priv,
1334 unsigned long pfc_combined;
1337 pfc_combined = mlx5e_query_pfc_combined(priv);
1338 for_each_set_bit(prio, &pfc_combined, NUM_PPORT_PRIO) {
1339 for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) {
1340 char pfc_string[ETH_GSTRING_LEN];
1342 snprintf(pfc_string, sizeof(pfc_string), "prio%d", prio);
1343 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1344 pport_per_prio_pfc_stats_desc[i].format, pfc_string);
1348 if (mlx5e_query_global_pause_combined(priv)) {
1349 for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) {
1350 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1351 pport_per_prio_pfc_stats_desc[i].format, "global");
1355 for (i = 0; i < NUM_PPORT_PFC_STALL_COUNTERS(priv); i++)
1356 strcpy(data + (idx++) * ETH_GSTRING_LEN,
1357 pport_pfc_stall_stats_desc[i].format);
1362 static int mlx5e_grp_per_prio_pfc_fill_stats(struct mlx5e_priv *priv,
1366 unsigned long pfc_combined;
1369 pfc_combined = mlx5e_query_pfc_combined(priv);
1370 for_each_set_bit(prio, &pfc_combined, NUM_PPORT_PRIO) {
1371 for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) {
1373 MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
1374 pport_per_prio_pfc_stats_desc, i);
1378 if (mlx5e_query_global_pause_combined(priv)) {
1379 for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) {
1381 MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0],
1382 pport_per_prio_pfc_stats_desc, i);
1386 for (i = 0; i < NUM_PPORT_PFC_STALL_COUNTERS(priv); i++)
1387 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0],
1388 pport_pfc_stall_stats_desc, i);
1393 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(per_prio)
1395 return mlx5e_grp_per_prio_traffic_get_num_stats() +
1396 mlx5e_grp_per_prio_pfc_get_num_stats(priv);
1399 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(per_prio)
1401 idx = mlx5e_grp_per_prio_traffic_fill_strings(priv, data, idx);
1402 idx = mlx5e_grp_per_prio_pfc_fill_strings(priv, data, idx);
1406 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(per_prio)
1408 idx = mlx5e_grp_per_prio_traffic_fill_stats(priv, data, idx);
1409 idx = mlx5e_grp_per_prio_pfc_fill_stats(priv, data, idx);
1413 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(per_prio)
1415 struct mlx5e_pport_stats *pstats = &priv->stats.pport;
1416 struct mlx5_core_dev *mdev = priv->mdev;
1417 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {0};
1418 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
1422 if (!MLX5_BASIC_PPCNT_SUPPORTED(mdev))
1425 MLX5_SET(ppcnt_reg, in, local_port, 1);
1426 MLX5_SET(ppcnt_reg, in, grp, MLX5_PER_PRIORITY_COUNTERS_GROUP);
1427 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
1428 out = pstats->per_prio_counters[prio];
1429 MLX5_SET(ppcnt_reg, in, prio_tc, prio);
1430 mlx5_core_access_reg(mdev, in, sz, out, sz,
1431 MLX5_REG_PPCNT, 0, 0);
1435 static const struct counter_desc mlx5e_pme_status_desc[] = {
1436 { "module_unplug", sizeof(u64) * MLX5_MODULE_STATUS_UNPLUGGED },
1439 static const struct counter_desc mlx5e_pme_error_desc[] = {
1440 { "module_bus_stuck", sizeof(u64) * MLX5_MODULE_EVENT_ERROR_BUS_STUCK },
1441 { "module_high_temp", sizeof(u64) * MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE },
1442 { "module_bad_shorted", sizeof(u64) * MLX5_MODULE_EVENT_ERROR_BAD_CABLE },
1445 #define NUM_PME_STATUS_STATS ARRAY_SIZE(mlx5e_pme_status_desc)
1446 #define NUM_PME_ERR_STATS ARRAY_SIZE(mlx5e_pme_error_desc)
1448 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(pme)
1450 return NUM_PME_STATUS_STATS + NUM_PME_ERR_STATS;
1453 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(pme)
1457 for (i = 0; i < NUM_PME_STATUS_STATS; i++)
1458 strcpy(data + (idx++) * ETH_GSTRING_LEN, mlx5e_pme_status_desc[i].format);
1460 for (i = 0; i < NUM_PME_ERR_STATS; i++)
1461 strcpy(data + (idx++) * ETH_GSTRING_LEN, mlx5e_pme_error_desc[i].format);
1466 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(pme)
1468 struct mlx5_pme_stats pme_stats;
1471 mlx5_get_pme_stats(priv->mdev, &pme_stats);
1473 for (i = 0; i < NUM_PME_STATUS_STATS; i++)
1474 data[idx++] = MLX5E_READ_CTR64_CPU(pme_stats.status_counters,
1475 mlx5e_pme_status_desc, i);
1477 for (i = 0; i < NUM_PME_ERR_STATS; i++)
1478 data[idx++] = MLX5E_READ_CTR64_CPU(pme_stats.error_counters,
1479 mlx5e_pme_error_desc, i);
1484 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(pme) { return; }
1486 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(tls)
1488 return mlx5e_tls_get_count(priv);
1491 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(tls)
1493 return idx + mlx5e_tls_get_strings(priv, data + idx * ETH_GSTRING_LEN);
1496 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(tls)
1498 return idx + mlx5e_tls_get_stats(priv, data + idx);
1501 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(tls) { return; }
1503 static const struct counter_desc rq_stats_desc[] = {
1504 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, packets) },
1505 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, bytes) },
1506 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete) },
1507 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete_tail) },
1508 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_complete_tail_slow) },
1509 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary) },
1510 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) },
1511 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, csum_none) },
1512 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_drop) },
1513 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, xdp_redirect) },
1514 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_packets) },
1515 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, lro_bytes) },
1516 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, ecn_mark) },
1517 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, removed_vlan_packets) },
1518 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, wqe_err) },
1519 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler_cqes) },
1520 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, mpwqe_filler_strides) },
1521 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, oversize_pkts_sw_drop) },
1522 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, buff_alloc_err) },
1523 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_blks) },
1524 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) },
1525 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_reuse) },
1526 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_full) },
1527 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_empty) },
1528 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_busy) },
1529 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, cache_waive) },
1530 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, congst_umr) },
1531 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, arfs_err) },
1532 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, recover) },
1533 #ifdef CONFIG_MLX5_EN_TLS
1534 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_decrypted_packets) },
1535 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_decrypted_bytes) },
1536 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_ctx) },
1537 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_del) },
1538 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_resync_req_pkt) },
1539 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_resync_req_start) },
1540 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_resync_req_end) },
1541 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_resync_req_skip) },
1542 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_resync_res_ok) },
1543 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_resync_res_skip) },
1544 { MLX5E_DECLARE_RX_STAT(struct mlx5e_rq_stats, tls_err) },
1548 static const struct counter_desc sq_stats_desc[] = {
1549 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, packets) },
1550 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, bytes) },
1551 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_packets) },
1552 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_bytes) },
1553 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_packets) },
1554 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tso_inner_bytes) },
1555 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial) },
1556 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_partial_inner) },
1557 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, added_vlan_packets) },
1558 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, nop) },
1559 #ifdef CONFIG_MLX5_EN_TLS
1560 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_encrypted_packets) },
1561 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_encrypted_bytes) },
1562 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_ctx) },
1563 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_ooo) },
1564 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_dump_packets) },
1565 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_dump_bytes) },
1566 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_resync_bytes) },
1567 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_skip_no_sync_data) },
1568 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_no_sync_data) },
1569 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, tls_drop_bypass_req) },
1571 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, csum_none) },
1572 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, stopped) },
1573 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, dropped) },
1574 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, xmit_more) },
1575 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, recover) },
1576 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, cqes) },
1577 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, wake) },
1578 { MLX5E_DECLARE_TX_STAT(struct mlx5e_sq_stats, cqe_err) },
1581 static const struct counter_desc rq_xdpsq_stats_desc[] = {
1582 { MLX5E_DECLARE_RQ_XDPSQ_STAT(struct mlx5e_xdpsq_stats, xmit) },
1583 { MLX5E_DECLARE_RQ_XDPSQ_STAT(struct mlx5e_xdpsq_stats, mpwqe) },
1584 { MLX5E_DECLARE_RQ_XDPSQ_STAT(struct mlx5e_xdpsq_stats, inlnw) },
1585 { MLX5E_DECLARE_RQ_XDPSQ_STAT(struct mlx5e_xdpsq_stats, nops) },
1586 { MLX5E_DECLARE_RQ_XDPSQ_STAT(struct mlx5e_xdpsq_stats, full) },
1587 { MLX5E_DECLARE_RQ_XDPSQ_STAT(struct mlx5e_xdpsq_stats, err) },
1588 { MLX5E_DECLARE_RQ_XDPSQ_STAT(struct mlx5e_xdpsq_stats, cqes) },
1591 static const struct counter_desc xdpsq_stats_desc[] = {
1592 { MLX5E_DECLARE_XDPSQ_STAT(struct mlx5e_xdpsq_stats, xmit) },
1593 { MLX5E_DECLARE_XDPSQ_STAT(struct mlx5e_xdpsq_stats, mpwqe) },
1594 { MLX5E_DECLARE_XDPSQ_STAT(struct mlx5e_xdpsq_stats, inlnw) },
1595 { MLX5E_DECLARE_XDPSQ_STAT(struct mlx5e_xdpsq_stats, nops) },
1596 { MLX5E_DECLARE_XDPSQ_STAT(struct mlx5e_xdpsq_stats, full) },
1597 { MLX5E_DECLARE_XDPSQ_STAT(struct mlx5e_xdpsq_stats, err) },
1598 { MLX5E_DECLARE_XDPSQ_STAT(struct mlx5e_xdpsq_stats, cqes) },
1601 static const struct counter_desc xskrq_stats_desc[] = {
1602 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, packets) },
1603 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, bytes) },
1604 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, csum_complete) },
1605 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, csum_unnecessary) },
1606 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, csum_unnecessary_inner) },
1607 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, csum_none) },
1608 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, ecn_mark) },
1609 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, removed_vlan_packets) },
1610 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, xdp_drop) },
1611 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, xdp_redirect) },
1612 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, wqe_err) },
1613 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, mpwqe_filler_cqes) },
1614 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, mpwqe_filler_strides) },
1615 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, oversize_pkts_sw_drop) },
1616 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, buff_alloc_err) },
1617 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, cqe_compress_blks) },
1618 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, cqe_compress_pkts) },
1619 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, congst_umr) },
1620 { MLX5E_DECLARE_XSKRQ_STAT(struct mlx5e_rq_stats, arfs_err) },
1623 static const struct counter_desc xsksq_stats_desc[] = {
1624 { MLX5E_DECLARE_XSKSQ_STAT(struct mlx5e_xdpsq_stats, xmit) },
1625 { MLX5E_DECLARE_XSKSQ_STAT(struct mlx5e_xdpsq_stats, mpwqe) },
1626 { MLX5E_DECLARE_XSKSQ_STAT(struct mlx5e_xdpsq_stats, inlnw) },
1627 { MLX5E_DECLARE_XSKSQ_STAT(struct mlx5e_xdpsq_stats, full) },
1628 { MLX5E_DECLARE_XSKSQ_STAT(struct mlx5e_xdpsq_stats, err) },
1629 { MLX5E_DECLARE_XSKSQ_STAT(struct mlx5e_xdpsq_stats, cqes) },
1632 static const struct counter_desc ch_stats_desc[] = {
1633 { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, events) },
1634 { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, poll) },
1635 { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, arm) },
1636 { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, aff_change) },
1637 { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, force_irq) },
1638 { MLX5E_DECLARE_CH_STAT(struct mlx5e_ch_stats, eq_rearm) },
1641 #define NUM_RQ_STATS ARRAY_SIZE(rq_stats_desc)
1642 #define NUM_SQ_STATS ARRAY_SIZE(sq_stats_desc)
1643 #define NUM_XDPSQ_STATS ARRAY_SIZE(xdpsq_stats_desc)
1644 #define NUM_RQ_XDPSQ_STATS ARRAY_SIZE(rq_xdpsq_stats_desc)
1645 #define NUM_XSKRQ_STATS ARRAY_SIZE(xskrq_stats_desc)
1646 #define NUM_XSKSQ_STATS ARRAY_SIZE(xsksq_stats_desc)
1647 #define NUM_CH_STATS ARRAY_SIZE(ch_stats_desc)
1649 static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS(channels)
1651 int max_nch = priv->max_nch;
1653 return (NUM_RQ_STATS * max_nch) +
1654 (NUM_CH_STATS * max_nch) +
1655 (NUM_SQ_STATS * max_nch * priv->max_opened_tc) +
1656 (NUM_RQ_XDPSQ_STATS * max_nch) +
1657 (NUM_XDPSQ_STATS * max_nch) +
1658 (NUM_XSKRQ_STATS * max_nch * priv->xsk.ever_used) +
1659 (NUM_XSKSQ_STATS * max_nch * priv->xsk.ever_used);
1662 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(channels)
1664 bool is_xsk = priv->xsk.ever_used;
1665 int max_nch = priv->max_nch;
1668 for (i = 0; i < max_nch; i++)
1669 for (j = 0; j < NUM_CH_STATS; j++)
1670 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1671 ch_stats_desc[j].format, i);
1673 for (i = 0; i < max_nch; i++) {
1674 for (j = 0; j < NUM_RQ_STATS; j++)
1675 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1676 rq_stats_desc[j].format, i);
1677 for (j = 0; j < NUM_XSKRQ_STATS * is_xsk; j++)
1678 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1679 xskrq_stats_desc[j].format, i);
1680 for (j = 0; j < NUM_RQ_XDPSQ_STATS; j++)
1681 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1682 rq_xdpsq_stats_desc[j].format, i);
1685 for (tc = 0; tc < priv->max_opened_tc; tc++)
1686 for (i = 0; i < max_nch; i++)
1687 for (j = 0; j < NUM_SQ_STATS; j++)
1688 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1689 sq_stats_desc[j].format,
1692 for (i = 0; i < max_nch; i++) {
1693 for (j = 0; j < NUM_XSKSQ_STATS * is_xsk; j++)
1694 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1695 xsksq_stats_desc[j].format, i);
1696 for (j = 0; j < NUM_XDPSQ_STATS; j++)
1697 sprintf(data + (idx++) * ETH_GSTRING_LEN,
1698 xdpsq_stats_desc[j].format, i);
1704 static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(channels)
1706 bool is_xsk = priv->xsk.ever_used;
1707 int max_nch = priv->max_nch;
1710 for (i = 0; i < max_nch; i++)
1711 for (j = 0; j < NUM_CH_STATS; j++)
1713 MLX5E_READ_CTR64_CPU(&priv->channel_stats[i].ch,
1716 for (i = 0; i < max_nch; i++) {
1717 for (j = 0; j < NUM_RQ_STATS; j++)
1719 MLX5E_READ_CTR64_CPU(&priv->channel_stats[i].rq,
1721 for (j = 0; j < NUM_XSKRQ_STATS * is_xsk; j++)
1723 MLX5E_READ_CTR64_CPU(&priv->channel_stats[i].xskrq,
1724 xskrq_stats_desc, j);
1725 for (j = 0; j < NUM_RQ_XDPSQ_STATS; j++)
1727 MLX5E_READ_CTR64_CPU(&priv->channel_stats[i].rq_xdpsq,
1728 rq_xdpsq_stats_desc, j);
1731 for (tc = 0; tc < priv->max_opened_tc; tc++)
1732 for (i = 0; i < max_nch; i++)
1733 for (j = 0; j < NUM_SQ_STATS; j++)
1735 MLX5E_READ_CTR64_CPU(&priv->channel_stats[i].sq[tc],
1738 for (i = 0; i < max_nch; i++) {
1739 for (j = 0; j < NUM_XSKSQ_STATS * is_xsk; j++)
1741 MLX5E_READ_CTR64_CPU(&priv->channel_stats[i].xsksq,
1742 xsksq_stats_desc, j);
1743 for (j = 0; j < NUM_XDPSQ_STATS; j++)
1745 MLX5E_READ_CTR64_CPU(&priv->channel_stats[i].xdpsq,
1746 xdpsq_stats_desc, j);
1752 static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(channels) { return; }
1754 MLX5E_DEFINE_STATS_GRP(sw, 0);
1755 MLX5E_DEFINE_STATS_GRP(qcnt, MLX5E_NDO_UPDATE_STATS);
1756 MLX5E_DEFINE_STATS_GRP(vnic_env, 0);
1757 MLX5E_DEFINE_STATS_GRP(vport, MLX5E_NDO_UPDATE_STATS);
1758 MLX5E_DEFINE_STATS_GRP(802_3, MLX5E_NDO_UPDATE_STATS);
1759 MLX5E_DEFINE_STATS_GRP(2863, 0);
1760 MLX5E_DEFINE_STATS_GRP(2819, 0);
1761 MLX5E_DEFINE_STATS_GRP(phy, 0);
1762 MLX5E_DEFINE_STATS_GRP(pcie, 0);
1763 MLX5E_DEFINE_STATS_GRP(per_prio, 0);
1764 MLX5E_DEFINE_STATS_GRP(pme, 0);
1765 MLX5E_DEFINE_STATS_GRP(channels, 0);
1766 MLX5E_DEFINE_STATS_GRP(per_port_buff_congest, 0);
1767 MLX5E_DEFINE_STATS_GRP(eth_ext, 0);
1768 static MLX5E_DEFINE_STATS_GRP(tls, 0);
1770 /* The stats groups order is opposite to the update_stats() order calls */
1771 mlx5e_stats_grp_t mlx5e_nic_stats_grps[] = {
1772 &MLX5E_STATS_GRP(sw),
1773 &MLX5E_STATS_GRP(qcnt),
1774 &MLX5E_STATS_GRP(vnic_env),
1775 &MLX5E_STATS_GRP(vport),
1776 &MLX5E_STATS_GRP(802_3),
1777 &MLX5E_STATS_GRP(2863),
1778 &MLX5E_STATS_GRP(2819),
1779 &MLX5E_STATS_GRP(phy),
1780 &MLX5E_STATS_GRP(eth_ext),
1781 &MLX5E_STATS_GRP(pcie),
1782 &MLX5E_STATS_GRP(per_prio),
1783 &MLX5E_STATS_GRP(pme),
1784 #ifdef CONFIG_MLX5_EN_IPSEC
1785 &MLX5E_STATS_GRP(ipsec_sw),
1786 &MLX5E_STATS_GRP(ipsec_hw),
1788 &MLX5E_STATS_GRP(tls),
1789 &MLX5E_STATS_GRP(channels),
1790 &MLX5E_STATS_GRP(per_port_buff_congest),
1793 unsigned int mlx5e_nic_stats_grps_num(struct mlx5e_priv *priv)
1795 return ARRAY_SIZE(mlx5e_nic_stats_grps);