xref: /dpdk/drivers/common/cnxk/roc_nix_debug.c (revision 2df20a1d345a5fc0a1b6dc0317d11fc7b1fda7e7)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4 
5 #include "roc_api.h"
6 #include "roc_priv.h"
7 
8 
9 #define nix_dump(file, fmt, ...) do {                                           \
10 	if ((file) == NULL)							\
11 		plt_dump(fmt, ##__VA_ARGS__);					\
12 	else                                                                    \
13 		fprintf(file, fmt "\n", ##__VA_ARGS__);                         \
14 } while (0)
15 
16 #define NIX_REG_INFO(reg)                                                      \
17 	{                                                                      \
18 		reg, #reg                                                      \
19 	}
20 #define NIX_REG_NAME_SZ 48
21 
22 #define nix_dump_no_nl(file, fmt, ...) do {                                     \
23 	if ((file) == NULL)                                                     \
24 		plt_dump_no_nl(fmt, ##__VA_ARGS__);				\
25 	else                                                                    \
26 		fprintf(file, fmt, ##__VA_ARGS__);                              \
27 } while (0)
28 
29 
30 struct nix_lf_reg_info {
31 	uint32_t offset;
32 	const char *name;
33 };
34 
35 static const struct nix_lf_reg_info nix_lf_reg[] = {
36 	NIX_REG_INFO(NIX_LF_RX_SECRETX(0)),
37 	NIX_REG_INFO(NIX_LF_RX_SECRETX(1)),
38 	NIX_REG_INFO(NIX_LF_RX_SECRETX(2)),
39 	NIX_REG_INFO(NIX_LF_RX_SECRETX(3)),
40 	NIX_REG_INFO(NIX_LF_RX_SECRETX(4)),
41 	NIX_REG_INFO(NIX_LF_RX_SECRETX(5)),
42 	NIX_REG_INFO(NIX_LF_CFG),
43 	NIX_REG_INFO(NIX_LF_GINT),
44 	NIX_REG_INFO(NIX_LF_GINT_W1S),
45 	NIX_REG_INFO(NIX_LF_GINT_ENA_W1C),
46 	NIX_REG_INFO(NIX_LF_GINT_ENA_W1S),
47 	NIX_REG_INFO(NIX_LF_ERR_INT),
48 	NIX_REG_INFO(NIX_LF_ERR_INT_W1S),
49 	NIX_REG_INFO(NIX_LF_ERR_INT_ENA_W1C),
50 	NIX_REG_INFO(NIX_LF_ERR_INT_ENA_W1S),
51 	NIX_REG_INFO(NIX_LF_RAS),
52 	NIX_REG_INFO(NIX_LF_RAS_W1S),
53 	NIX_REG_INFO(NIX_LF_RAS_ENA_W1C),
54 	NIX_REG_INFO(NIX_LF_RAS_ENA_W1S),
55 	NIX_REG_INFO(NIX_LF_SQ_OP_ERR_DBG),
56 	NIX_REG_INFO(NIX_LF_MNQ_ERR_DBG),
57 	NIX_REG_INFO(NIX_LF_SEND_ERR_DBG),
58 };
59 
60 static void
61 nix_bitmap_dump(struct plt_bitmap *bmp, FILE *file)
62 {
63 	uint32_t pos = 0, start_pos;
64 	uint64_t slab = 0;
65 	int i;
66 
67 	plt_bitmap_scan_init(bmp);
68 	if (!plt_bitmap_scan(bmp, &pos, &slab))
69 		return;
70 
71 	start_pos = pos;
72 
73 	nix_dump_no_nl(file, "  \t\t[");
74 	do {
75 		if (!slab)
76 			break;
77 		i = 0;
78 
79 		for (i = 0; i < 64; i++)
80 			if (slab & (1ULL << i))
81 				nix_dump_no_nl(file, "%d, ", i);
82 
83 		if (!plt_bitmap_scan(bmp, &pos, &slab))
84 			break;
85 	} while (start_pos != pos);
86 	nix_dump_no_nl(file, " ]");
87 }
88 
89 int
90 roc_nix_lf_get_reg_count(struct roc_nix *roc_nix)
91 {
92 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
93 	int reg_count;
94 
95 	if (roc_nix == NULL)
96 		return NIX_ERR_PARAM;
97 
98 	reg_count = PLT_DIM(nix_lf_reg);
99 	/* NIX_LF_TX_STATX */
100 	reg_count += nix->lf_tx_stats;
101 	/* NIX_LF_RX_STATX */
102 	reg_count += nix->lf_rx_stats;
103 	/* NIX_LF_QINTX_CNT*/
104 	reg_count += nix->qints;
105 	/* NIX_LF_QINTX_INT */
106 	reg_count += nix->qints;
107 	/* NIX_LF_QINTX_ENA_W1S */
108 	reg_count += nix->qints;
109 	/* NIX_LF_QINTX_ENA_W1C */
110 	reg_count += nix->qints;
111 	/* NIX_LF_CINTX_CNT */
112 	reg_count += nix->cints;
113 	/* NIX_LF_CINTX_WAIT */
114 	reg_count += nix->cints;
115 	/* NIX_LF_CINTX_INT */
116 	reg_count += nix->cints;
117 	/* NIX_LF_CINTX_INT_W1S */
118 	reg_count += nix->cints;
119 	/* NIX_LF_CINTX_ENA_W1S */
120 	reg_count += nix->cints;
121 	/* NIX_LF_CINTX_ENA_W1C */
122 	reg_count += nix->cints;
123 
124 	return reg_count;
125 }
126 
127 int
128 nix_lf_gen_reg_dump(uintptr_t nix_lf_base, uint64_t *data)
129 {
130 	FILE *file = NULL;
131 	bool dump_stdout;
132 	uint64_t reg;
133 	uint32_t i;
134 
135 	dump_stdout = data ? 0 : 1;
136 
137 	for (i = 0; i < PLT_DIM(nix_lf_reg); i++) {
138 		reg = plt_read64(nix_lf_base + nix_lf_reg[i].offset);
139 		if (dump_stdout && reg)
140 			nix_dump(file, "%32s = 0x%" PRIx64, nix_lf_reg[i].name, reg);
141 		if (data)
142 			*data++ = reg;
143 	}
144 
145 	return i;
146 }
147 
148 int
149 nix_lf_stat_reg_dump(uintptr_t nix_lf_base, uint64_t *data, uint8_t lf_tx_stats,
150 		     uint8_t lf_rx_stats)
151 {
152 	uint32_t i, count = 0;
153 	FILE *file = NULL;
154 	bool dump_stdout;
155 	uint64_t reg;
156 
157 	dump_stdout = data ? 0 : 1;
158 
159 	/* NIX_LF_TX_STATX */
160 	for (i = 0; i < lf_tx_stats; i++) {
161 		reg = plt_read64(nix_lf_base + NIX_LF_TX_STATX(i));
162 		if (dump_stdout && reg)
163 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_TX_STATX", i,
164 				 reg);
165 		if (data)
166 			*data++ = reg;
167 	}
168 	count += i;
169 
170 	/* NIX_LF_RX_STATX */
171 	for (i = 0; i < lf_rx_stats; i++) {
172 		reg = plt_read64(nix_lf_base + NIX_LF_RX_STATX(i));
173 		if (dump_stdout && reg)
174 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_RX_STATX", i,
175 				 reg);
176 		if (data)
177 			*data++ = reg;
178 	}
179 
180 	return count + i;
181 }
182 
183 int
184 nix_lf_int_reg_dump(uintptr_t nix_lf_base, uint64_t *data, uint16_t qints,
185 		    uint16_t cints)
186 {
187 	uint32_t i, count = 0;
188 	FILE *file = NULL;
189 	bool dump_stdout;
190 	uint64_t reg;
191 
192 	dump_stdout = data ? 0 : 1;
193 
194 	/* NIX_LF_QINTX_CNT*/
195 	for (i = 0; i < qints; i++) {
196 		reg = plt_read64(nix_lf_base + NIX_LF_QINTX_CNT(i));
197 		if (dump_stdout && reg)
198 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_QINTX_CNT", i,
199 				 reg);
200 		if (data)
201 			*data++ = reg;
202 	}
203 	count += i;
204 
205 	/* NIX_LF_QINTX_INT */
206 	for (i = 0; i < qints; i++) {
207 		reg = plt_read64(nix_lf_base + NIX_LF_QINTX_INT(i));
208 		if (dump_stdout && reg)
209 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_QINTX_INT", i,
210 				 reg);
211 		if (data)
212 			*data++ = reg;
213 	}
214 	count += i;
215 
216 	/* NIX_LF_QINTX_ENA_W1S */
217 	for (i = 0; i < qints; i++) {
218 		reg = plt_read64(nix_lf_base + NIX_LF_QINTX_ENA_W1S(i));
219 		if (dump_stdout && reg)
220 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_QINTX_ENA_W1S",
221 				 i, reg);
222 		if (data)
223 			*data++ = reg;
224 	}
225 	count += i;
226 
227 	/* NIX_LF_QINTX_ENA_W1C */
228 	for (i = 0; i < qints; i++) {
229 		reg = plt_read64(nix_lf_base + NIX_LF_QINTX_ENA_W1C(i));
230 		if (dump_stdout && reg)
231 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_QINTX_ENA_W1C",
232 				 i, reg);
233 		if (data)
234 			*data++ = reg;
235 	}
236 	count += i;
237 
238 	/* NIX_LF_CINTX_CNT */
239 	for (i = 0; i < cints; i++) {
240 		reg = plt_read64(nix_lf_base + NIX_LF_CINTX_CNT(i));
241 		if (dump_stdout && reg)
242 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_CNT", i,
243 				 reg);
244 		if (data)
245 			*data++ = reg;
246 	}
247 	count += i;
248 
249 	/* NIX_LF_CINTX_WAIT */
250 	for (i = 0; i < cints; i++) {
251 		reg = plt_read64(nix_lf_base + NIX_LF_CINTX_WAIT(i));
252 		if (dump_stdout && reg)
253 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_WAIT", i,
254 				 reg);
255 		if (data)
256 			*data++ = reg;
257 	}
258 	count += i;
259 
260 	/* NIX_LF_CINTX_INT */
261 	for (i = 0; i < cints; i++) {
262 		reg = plt_read64(nix_lf_base + NIX_LF_CINTX_INT(i));
263 		if (dump_stdout && reg)
264 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_INT", i,
265 				 reg);
266 		if (data)
267 			*data++ = reg;
268 	}
269 	count += i;
270 
271 	/* NIX_LF_CINTX_INT_W1S */
272 	for (i = 0; i < cints; i++) {
273 		reg = plt_read64(nix_lf_base + NIX_LF_CINTX_INT_W1S(i));
274 		if (dump_stdout && reg)
275 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_INT_W1S",
276 				 i, reg);
277 		if (data)
278 			*data++ = reg;
279 	}
280 	count += i;
281 
282 	/* NIX_LF_CINTX_ENA_W1S */
283 	for (i = 0; i < cints; i++) {
284 		reg = plt_read64(nix_lf_base + NIX_LF_CINTX_ENA_W1S(i));
285 		if (dump_stdout && reg)
286 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_ENA_W1S",
287 				 i, reg);
288 		if (data)
289 			*data++ = reg;
290 	}
291 	count += i;
292 
293 	/* NIX_LF_CINTX_ENA_W1C */
294 	for (i = 0; i < cints; i++) {
295 		reg = plt_read64(nix_lf_base + NIX_LF_CINTX_ENA_W1C(i));
296 		if (dump_stdout && reg)
297 			nix_dump(file, "%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_ENA_W1C",
298 				 i, reg);
299 		if (data)
300 			*data++ = reg;
301 	}
302 
303 	return count + i;
304 }
305 
306 int
307 roc_nix_lf_reg_dump(struct roc_nix *roc_nix, uint64_t *data)
308 {
309 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
310 	bool dump_stdout = data ? 0 : 1;
311 	uintptr_t nix_base;
312 	uint32_t i;
313 
314 	if (roc_nix == NULL)
315 		return NIX_ERR_PARAM;
316 
317 	nix_base = nix->base;
318 	/* General registers */
319 	i = nix_lf_gen_reg_dump(nix_base, data);
320 
321 	/* Rx, Tx stat registers */
322 	i += nix_lf_stat_reg_dump(nix_base, dump_stdout ? NULL : &data[i],
323 				  nix->lf_tx_stats, nix->lf_rx_stats);
324 
325 	/* Intr registers */
326 	i += nix_lf_int_reg_dump(nix_base, dump_stdout ? NULL : &data[i],
327 				 nix->qints, nix->cints);
328 
329 	return 0;
330 }
331 
332 int
333 nix_q_ctx_get(struct dev *dev, uint8_t ctype, uint16_t qid, __io void **ctx_p)
334 {
335 	struct mbox *mbox = mbox_get(dev->mbox);
336 	int rc;
337 
338 	if (roc_model_is_cn9k()) {
339 		struct nix_aq_enq_rsp *rsp;
340 		struct nix_aq_enq_req *aq;
341 
342 		aq = mbox_alloc_msg_nix_aq_enq(mbox);
343 		if (!aq) {
344 			rc = -ENOSPC;
345 			goto exit;
346 		}
347 
348 		aq->qidx = qid;
349 		aq->ctype = ctype;
350 		aq->op = NIX_AQ_INSTOP_READ;
351 
352 		rc = mbox_process_msg(mbox, (void *)&rsp);
353 		if (rc)
354 			goto exit;
355 		if (ctype == NIX_AQ_CTYPE_RQ)
356 			*ctx_p = &rsp->rq;
357 		else if (ctype == NIX_AQ_CTYPE_SQ)
358 			*ctx_p = &rsp->sq;
359 		else
360 			*ctx_p = &rsp->cq;
361 	} else {
362 		struct nix_cn10k_aq_enq_rsp *rsp;
363 		struct nix_cn10k_aq_enq_req *aq;
364 
365 		aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
366 		if (!aq) {
367 			rc = -ENOSPC;
368 			goto exit;
369 		}
370 
371 		aq->qidx = qid;
372 		aq->ctype = ctype;
373 		aq->op = NIX_AQ_INSTOP_READ;
374 
375 		rc = mbox_process_msg(mbox, (void *)&rsp);
376 		if (rc)
377 			goto exit;
378 
379 		if (ctype == NIX_AQ_CTYPE_RQ)
380 			*ctx_p = &rsp->rq;
381 		else if (ctype == NIX_AQ_CTYPE_SQ)
382 			*ctx_p = &rsp->sq;
383 		else
384 			*ctx_p = &rsp->cq;
385 	}
386 	rc = 0;
387 exit:
388 	mbox_put(mbox);
389 	return rc;
390 }
391 
392 static inline void
393 nix_cn9k_lf_sq_dump(__io struct nix_sq_ctx_s *ctx, uint32_t *sqb_aura_p, FILE *file)
394 {
395 	nix_dump(file, "W0: sqe_way_mask \t\t%d\nW0: cq \t\t\t\t%d",
396 		 ctx->sqe_way_mask, ctx->cq);
397 	nix_dump(file, "W0: sdp_mcast \t\t\t%d\nW0: substream \t\t\t0x%03x",
398 		 ctx->sdp_mcast, ctx->substream);
399 	nix_dump(file, "W0: qint_idx \t\t\t%d\nW0: ena \t\t\t%d\n", ctx->qint_idx,
400 		 ctx->ena);
401 
402 	nix_dump(file, "W1: sqb_count \t\t\t%d\nW1: default_chan \t\t%d",
403 		 ctx->sqb_count, ctx->default_chan);
404 	nix_dump(file, "W1: smq_rr_quantum \t\t%d\nW1: sso_ena \t\t\t%d",
405 		 ctx->smq_rr_quantum, ctx->sso_ena);
406 	nix_dump(file, "W1: xoff \t\t\t%d\nW1: cq_ena \t\t\t%d\nW1: smq\t\t\t\t%d\n",
407 		 ctx->xoff, ctx->cq_ena, ctx->smq);
408 
409 	nix_dump(file, "W2: sqe_stype \t\t\t%d\nW2: sq_int_ena \t\t\t%d",
410 		 ctx->sqe_stype, ctx->sq_int_ena);
411 	nix_dump(file, "W2: sq_int  \t\t\t%d\nW2: sqb_aura \t\t\t%d", ctx->sq_int,
412 		 ctx->sqb_aura);
413 	nix_dump(file, "W2: smq_rr_count \t\t%d\n", ctx->smq_rr_count);
414 
415 	nix_dump(file, "W3: smq_next_sq_vld\t\t%d\nW3: smq_pend\t\t\t%d",
416 		 ctx->smq_next_sq_vld, ctx->smq_pend);
417 	nix_dump(file, "W3: smenq_next_sqb_vld  \t%d\nW3: head_offset\t\t\t%d",
418 		 ctx->smenq_next_sqb_vld, ctx->head_offset);
419 	nix_dump(file, "W3: smenq_offset\t\t%d\nW3: tail_offset \t\t%d",
420 		 ctx->smenq_offset, ctx->tail_offset);
421 	nix_dump(file, "W3: smq_lso_segnum \t\t%d\nW3: smq_next_sq \t\t%d",
422 		 ctx->smq_lso_segnum, ctx->smq_next_sq);
423 	nix_dump(file, "W3: mnq_dis \t\t\t%d\nW3: lmt_dis \t\t\t%d", ctx->mnq_dis,
424 		 ctx->lmt_dis);
425 	nix_dump(file, "W3: cq_limit\t\t\t%d\nW3: max_sqe_size\t\t%d\n",
426 		 ctx->cq_limit, ctx->max_sqe_size);
427 
428 	nix_dump(file, "W4: next_sqb \t\t\t0x%" PRIx64 "", ctx->next_sqb);
429 	nix_dump(file, "W5: tail_sqb \t\t\t0x%" PRIx64 "", ctx->tail_sqb);
430 	nix_dump(file, "W6: smenq_sqb \t\t\t0x%" PRIx64 "", ctx->smenq_sqb);
431 	nix_dump(file, "W7: smenq_next_sqb \t\t0x%" PRIx64 "", ctx->smenq_next_sqb);
432 	nix_dump(file, "W8: head_sqb \t\t\t0x%" PRIx64 "", ctx->head_sqb);
433 
434 	nix_dump(file, "W9: vfi_lso_vld \t\t%d\nW9: vfi_lso_vlan1_ins_ena\t%d",
435 		 ctx->vfi_lso_vld, ctx->vfi_lso_vlan1_ins_ena);
436 	nix_dump(file, "W9: vfi_lso_vlan0_ins_ena\t%d\nW9: vfi_lso_mps\t\t\t%d",
437 		 ctx->vfi_lso_vlan0_ins_ena, ctx->vfi_lso_mps);
438 	nix_dump(file, "W9: vfi_lso_sb \t\t\t%d\nW9: vfi_lso_sizem1\t\t%d",
439 		 ctx->vfi_lso_sb, ctx->vfi_lso_sizem1);
440 	nix_dump(file, "W9: vfi_lso_total\t\t%d", ctx->vfi_lso_total);
441 
442 	nix_dump(file, "W10: scm_lso_rem \t\t0x%" PRIx64 "",
443 		 (uint64_t)ctx->scm_lso_rem);
444 	nix_dump(file, "W11: octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->octs);
445 	nix_dump(file, "W12: pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->pkts);
446 	nix_dump(file, "W14: dropped_octs \t\t0x%" PRIx64 "",
447 		 (uint64_t)ctx->drop_octs);
448 	nix_dump(file, "W15: dropped_pkts \t\t0x%" PRIx64 "",
449 		 (uint64_t)ctx->drop_pkts);
450 
451 	*sqb_aura_p = ctx->sqb_aura;
452 }
453 
454 static inline void
455 nix_lf_sq_dump(__io struct nix_cn10k_sq_ctx_s *ctx, uint32_t *sqb_aura_p, FILE *file)
456 {
457 	nix_dump(file, "W0: sqe_way_mask \t\t%d\nW0: cq \t\t\t\t%d",
458 		 ctx->sqe_way_mask, ctx->cq);
459 	nix_dump(file, "W0: sdp_mcast \t\t\t%d\nW0: substream \t\t\t0x%03x",
460 		 ctx->sdp_mcast, ctx->substream);
461 	nix_dump(file, "W0: qint_idx \t\t\t%d\nW0: ena \t\t\t%d\n", ctx->qint_idx,
462 		 ctx->ena);
463 
464 	nix_dump(file, "W1: sqb_count \t\t\t%d\nW1: default_chan \t\t%d",
465 		 ctx->sqb_count, ctx->default_chan);
466 	nix_dump(file, "W1: smq_rr_weight \t\t%d\nW1: sso_ena \t\t\t%d",
467 		 ctx->smq_rr_weight, ctx->sso_ena);
468 	nix_dump(file, "W1: xoff \t\t\t%d\nW1: cq_ena \t\t\t%d\nW1: smq\t\t\t\t%d\n",
469 		 ctx->xoff, ctx->cq_ena, ctx->smq);
470 
471 	nix_dump(file, "W2: sqe_stype \t\t\t%d\nW2: sq_int_ena \t\t\t%d",
472 		 ctx->sqe_stype, ctx->sq_int_ena);
473 	nix_dump(file, "W2: sq_int  \t\t\t%d\nW2: sqb_aura \t\t\t%d", ctx->sq_int,
474 		 ctx->sqb_aura);
475 	nix_dump(file, "W2: smq_rr_count[ub:lb] \t\t%x:%x\n", ctx->smq_rr_count_ub,
476 		 ctx->smq_rr_count_lb);
477 
478 	nix_dump(file, "W3: smq_next_sq_vld\t\t%d\nW3: smq_pend\t\t\t%d",
479 		 ctx->smq_next_sq_vld, ctx->smq_pend);
480 	nix_dump(file, "W3: smenq_next_sqb_vld  \t%d\nW3: head_offset\t\t\t%d",
481 		 ctx->smenq_next_sqb_vld, ctx->head_offset);
482 	nix_dump(file, "W3: smenq_offset\t\t%d\nW3: tail_offset \t\t%d",
483 		 ctx->smenq_offset, ctx->tail_offset);
484 	nix_dump(file, "W3: smq_lso_segnum \t\t%d\nW3: smq_next_sq \t\t%d",
485 		 ctx->smq_lso_segnum, ctx->smq_next_sq);
486 	nix_dump(file, "W3: mnq_dis \t\t\t%d\nW3: lmt_dis \t\t\t%d", ctx->mnq_dis,
487 		 ctx->lmt_dis);
488 	nix_dump(file, "W3: cq_limit\t\t\t%d\nW3: max_sqe_size\t\t%d\n",
489 		 ctx->cq_limit, ctx->max_sqe_size);
490 
491 	nix_dump(file, "W4: next_sqb \t\t\t0x%" PRIx64 "", ctx->next_sqb);
492 	nix_dump(file, "W5: tail_sqb \t\t\t0x%" PRIx64 "", ctx->tail_sqb);
493 	nix_dump(file, "W6: smenq_sqb \t\t\t0x%" PRIx64 "", ctx->smenq_sqb);
494 	nix_dump(file, "W7: smenq_next_sqb \t\t0x%" PRIx64 "", ctx->smenq_next_sqb);
495 	nix_dump(file, "W8: head_sqb \t\t\t0x%" PRIx64 "", ctx->head_sqb);
496 
497 	nix_dump(file, "W9: vfi_lso_vld \t\t%d\nW9: vfi_lso_vlan1_ins_ena\t%d", ctx->vfi_lso_vld,
498 		 ctx->vfi_lso_vlan1_ins_ena);
499 	nix_dump(file, "W9: vfi_lso_vlan0_ins_ena\t%d\nW9: vfi_lso_mps\t\t\t%d",
500 		 ctx->vfi_lso_vlan0_ins_ena, ctx->vfi_lso_mps);
501 	nix_dump(file, "W9: vfi_lso_sb \t\t\t%d\nW9: vfi_lso_sizem1\t\t%d", ctx->vfi_lso_sb,
502 		 ctx->vfi_lso_sizem1);
503 	nix_dump(file, "W9: vfi_lso_total\t\t%d", ctx->vfi_lso_total);
504 
505 	nix_dump(file, "W10: scm_lso_rem \t\t0x%" PRIx64 "", (uint64_t)ctx->scm_lso_rem);
506 	nix_dump(file, "W11: octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->octs);
507 	nix_dump(file, "W12: pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->pkts);
508 	nix_dump(file, "W13: aged_drop_pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->aged_drop_pkts);
509 	nix_dump(file, "W13: aged_drop_octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->aged_drop_octs);
510 	nix_dump(file, "W14: dropped_octs \t\t0x%" PRIx64 "", (uint64_t)ctx->drop_octs);
511 	nix_dump(file, "W15: dropped_pkts \t\t0x%" PRIx64 "", (uint64_t)ctx->drop_pkts);
512 
513 	*sqb_aura_p = ctx->sqb_aura;
514 }
515 
516 static inline void
517 nix_cn9k_lf_rq_dump(__io struct nix_rq_ctx_s *ctx, FILE *file)
518 {
519 	nix_dump(file, "W0: wqe_aura \t\t\t%d\nW0: substream \t\t\t0x%03x",
520 		 ctx->wqe_aura, ctx->substream);
521 	nix_dump(file, "W0: cq \t\t\t\t%d\nW0: ena_wqwd \t\t\t%d", ctx->cq,
522 		 ctx->ena_wqwd);
523 	nix_dump(file, "W0: ipsech_ena \t\t\t%d\nW0: sso_ena \t\t\t%d",
524 		 ctx->ipsech_ena, ctx->sso_ena);
525 	nix_dump(file, "W0: ena \t\t\t%d\n", ctx->ena);
526 
527 	nix_dump(file, "W1: lpb_drop_ena \t\t%d\nW1: spb_drop_ena \t\t%d",
528 		 ctx->lpb_drop_ena, ctx->spb_drop_ena);
529 	nix_dump(file, "W1: xqe_drop_ena \t\t%d\nW1: wqe_caching \t\t%d",
530 		 ctx->xqe_drop_ena, ctx->wqe_caching);
531 	nix_dump(file, "W1: pb_caching \t\t\t%d\nW1: sso_tt \t\t\t%d",
532 		 ctx->pb_caching, ctx->sso_tt);
533 	nix_dump(file, "W1: sso_grp \t\t\t%d\nW1: lpb_aura \t\t\t%d", ctx->sso_grp,
534 		 ctx->lpb_aura);
535 	nix_dump(file, "W1: spb_aura \t\t\t%d\n", ctx->spb_aura);
536 
537 	nix_dump(file, "W2: xqe_hdr_split \t\t%d\nW2: xqe_imm_copy \t\t%d",
538 		 ctx->xqe_hdr_split, ctx->xqe_imm_copy);
539 	nix_dump(file, "W2: xqe_imm_size \t\t%d\nW2: later_skip \t\t\t%d",
540 		 ctx->xqe_imm_size, ctx->later_skip);
541 	nix_dump(file, "W2: first_skip \t\t\t%d\nW2: lpb_sizem1 \t\t\t%d",
542 		 ctx->first_skip, ctx->lpb_sizem1);
543 	nix_dump(file, "W2: spb_ena \t\t\t%d\nW2: wqe_skip \t\t\t%d", ctx->spb_ena,
544 		 ctx->wqe_skip);
545 	nix_dump(file, "W2: spb_sizem1 \t\t\t%d\n", ctx->spb_sizem1);
546 
547 	nix_dump(file, "W3: spb_pool_pass \t\t%d\nW3: spb_pool_drop \t\t%d",
548 		 ctx->spb_pool_pass, ctx->spb_pool_drop);
549 	nix_dump(file, "W3: spb_aura_pass \t\t%d\nW3: spb_aura_drop \t\t%d",
550 		 ctx->spb_aura_pass, ctx->spb_aura_drop);
551 	nix_dump(file, "W3: wqe_pool_pass \t\t%d\nW3: wqe_pool_drop \t\t%d",
552 		 ctx->wqe_pool_pass, ctx->wqe_pool_drop);
553 	nix_dump(file, "W3: xqe_pass \t\t\t%d\nW3: xqe_drop \t\t\t%d\n",
554 		 ctx->xqe_pass, ctx->xqe_drop);
555 
556 	nix_dump(file, "W4: qint_idx \t\t\t%d\nW4: rq_int_ena \t\t\t%d",
557 		 ctx->qint_idx, ctx->rq_int_ena);
558 	nix_dump(file, "W4: rq_int \t\t\t%d\nW4: lpb_pool_pass \t\t%d", ctx->rq_int,
559 		 ctx->lpb_pool_pass);
560 	nix_dump(file, "W4: lpb_pool_drop \t\t%d\nW4: lpb_aura_pass \t\t%d",
561 		 ctx->lpb_pool_drop, ctx->lpb_aura_pass);
562 	nix_dump(file, "W4: lpb_aura_drop \t\t%d\n", ctx->lpb_aura_drop);
563 
564 	nix_dump(file, "W5: flow_tagw \t\t\t%d\nW5: bad_utag \t\t\t%d",
565 		 ctx->flow_tagw, ctx->bad_utag);
566 	nix_dump(file, "W5: good_utag \t\t\t%d\nW5: ltag \t\t\t%d\n", ctx->good_utag,
567 		 ctx->ltag);
568 
569 	nix_dump(file, "W6: octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->octs);
570 	nix_dump(file, "W7: pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->pkts);
571 	nix_dump(file, "W8: drop_octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->drop_octs);
572 	nix_dump(file, "W9: drop_pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->drop_pkts);
573 	nix_dump(file, "W10: re_pkts \t\t\t0x%" PRIx64 "\n", (uint64_t)ctx->re_pkts);
574 }
575 
576 void
577 nix_lf_rq_dump(__io struct nix_cn10k_rq_ctx_s *ctx, FILE *file)
578 {
579 	nix_dump(file, "W0: wqe_aura \t\t\t%d\nW0: len_ol3_dis \t\t\t%d",
580 		 ctx->wqe_aura, ctx->len_ol3_dis);
581 	nix_dump(file, "W0: len_ol4_dis \t\t\t%d\nW0: len_il3_dis \t\t\t%d",
582 		 ctx->len_ol4_dis, ctx->len_il3_dis);
583 	nix_dump(file, "W0: len_il4_dis \t\t\t%d\nW0: csum_ol4_dis \t\t\t%d",
584 		 ctx->len_il4_dis, ctx->csum_ol4_dis);
585 	nix_dump(file, "W0: csum_ol3_dis \t\t\t%d\nW0: lenerr_dis \t\t\t%d",
586 		 ctx->csum_ol4_dis, ctx->lenerr_dis);
587 	nix_dump(file, "W0: cq \t\t\t\t%d\nW0: ena_wqwd \t\t\t%d", ctx->cq,
588 		 ctx->ena_wqwd);
589 	nix_dump(file, "W0: ipsech_ena \t\t\t%d\nW0: sso_ena \t\t\t%d",
590 		 ctx->ipsech_ena, ctx->sso_ena);
591 	nix_dump(file, "W0: ena \t\t\t%d\n", ctx->ena);
592 
593 	nix_dump(file, "W1: chi_ena \t\t%d\nW1: ipsecd_drop_en \t\t%d", ctx->chi_ena,
594 		 ctx->ipsecd_drop_en);
595 	nix_dump(file, "W1: pb_stashing \t\t\t%d", ctx->pb_stashing);
596 	nix_dump(file, "W1: lpb_drop_ena \t\t%d\nW1: spb_drop_ena \t\t%d",
597 		 ctx->lpb_drop_ena, ctx->spb_drop_ena);
598 	nix_dump(file, "W1: xqe_drop_ena \t\t%d\nW1: wqe_caching \t\t%d",
599 		 ctx->xqe_drop_ena, ctx->wqe_caching);
600 	nix_dump(file, "W1: pb_caching \t\t\t%d\nW1: sso_tt \t\t\t%d",
601 		 ctx->pb_caching, ctx->sso_tt);
602 	nix_dump(file, "W1: sso_grp \t\t\t%d\nW1: lpb_aura \t\t\t%d", ctx->sso_grp,
603 		 ctx->lpb_aura);
604 	nix_dump(file, "W1: spb_aura \t\t\t%d\n", ctx->spb_aura);
605 
606 	nix_dump(file, "W2: xqe_hdr_split \t\t%d\nW2: xqe_imm_copy \t\t%d",
607 		 ctx->xqe_hdr_split, ctx->xqe_imm_copy);
608 	nix_dump(file, "W2: xqe_imm_size \t\t%d\nW2: later_skip \t\t\t%d",
609 		 ctx->xqe_imm_size, ctx->later_skip);
610 	nix_dump(file, "W2: first_skip \t\t\t%d\nW2: lpb_sizem1 \t\t\t%d",
611 		 ctx->first_skip, ctx->lpb_sizem1);
612 	nix_dump(file, "W2: spb_ena \t\t\t%d\nW2: wqe_skip \t\t\t%d", ctx->spb_ena,
613 		 ctx->wqe_skip);
614 	nix_dump(file, "W2: spb_sizem1 \t\t\t%d\nW2: policer_ena \t\t\t%d",
615 		 ctx->spb_sizem1, ctx->policer_ena);
616 	nix_dump(file, "W2: band_prof_id \t\t\t%d", ctx->band_prof_id);
617 
618 	nix_dump(file, "W3: spb_pool_pass \t\t%d\nW3: spb_pool_drop \t\t%d",
619 		 ctx->spb_pool_pass, ctx->spb_pool_drop);
620 	nix_dump(file, "W3: spb_aura_pass \t\t%d\nW3: spb_aura_drop \t\t%d",
621 		 ctx->spb_aura_pass, ctx->spb_aura_drop);
622 	nix_dump(file, "W3: wqe_pool_pass \t\t%d\nW3: wqe_pool_drop \t\t%d",
623 		 ctx->wqe_pool_pass, ctx->wqe_pool_drop);
624 	nix_dump(file, "W3: xqe_pass \t\t\t%d\nW3: xqe_drop \t\t\t%d\n",
625 		 ctx->xqe_pass, ctx->xqe_drop);
626 
627 	nix_dump(file, "W4: qint_idx \t\t\t%d\nW4: rq_int_ena \t\t\t%d",
628 		 ctx->qint_idx, ctx->rq_int_ena);
629 	nix_dump(file, "W4: rq_int \t\t\t%d\nW4: lpb_pool_pass \t\t%d", ctx->rq_int,
630 		 ctx->lpb_pool_pass);
631 	nix_dump(file, "W4: lpb_pool_drop \t\t%d\nW4: lpb_aura_pass \t\t%d",
632 		 ctx->lpb_pool_drop, ctx->lpb_aura_pass);
633 	nix_dump(file, "W4: lpb_aura_drop \t\t%d\n", ctx->lpb_aura_drop);
634 
635 	nix_dump(file, "W5: vwqe_skip \t\t\t%d\nW5: max_vsize_exp \t\t\t%d",
636 		 ctx->vwqe_skip, ctx->max_vsize_exp);
637 	nix_dump(file, "W5: vtime_wait \t\t\t%d\nW5: vwqe_ena \t\t\t%d",
638 		 ctx->vtime_wait, ctx->max_vsize_exp);
639 	nix_dump(file, "W5: ipsec_vwqe \t\t\t%d", ctx->ipsec_vwqe);
640 	nix_dump(file, "W5: flow_tagw \t\t\t%d\nW5: bad_utag \t\t\t%d",
641 		 ctx->flow_tagw, ctx->bad_utag);
642 	nix_dump(file, "W5: good_utag \t\t\t%d\nW5: ltag \t\t\t%d\n", ctx->good_utag,
643 		 ctx->ltag);
644 
645 	nix_dump(file, "W6: octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->octs);
646 	nix_dump(file, "W7: pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->pkts);
647 	nix_dump(file, "W8: drop_octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->drop_octs);
648 	nix_dump(file, "W9: drop_pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->drop_pkts);
649 	nix_dump(file, "W10: re_pkts \t\t\t0x%" PRIx64 "\n", (uint64_t)ctx->re_pkts);
650 }
651 
652 static inline void
653 nix_lf_cq_dump(__io struct nix_cq_ctx_s *ctx, FILE *file)
654 {
655 	nix_dump(file, "W0: base \t\t\t0x%" PRIx64 "\n", ctx->base);
656 
657 	nix_dump(file, "W1: wrptr \t\t\t%" PRIx64 "", (uint64_t)ctx->wrptr);
658 	nix_dump(file, "W1: avg_con \t\t\t%d\nW1: cint_idx \t\t\t%d", ctx->avg_con,
659 		 ctx->cint_idx);
660 	nix_dump(file, "W1: cq_err \t\t\t%d\nW1: qint_idx \t\t\t%d", ctx->cq_err,
661 		 ctx->qint_idx);
662 	nix_dump(file, "W1: bpid  \t\t\t%d\nW1: bp_ena \t\t\t%d\n", ctx->bpid,
663 		 ctx->bp_ena);
664 	nix_dump(file,
665 		 "W1: lbpid_high \t\t\t0x%03x\nW1: lbpid_med \t\t\t0x%03x\n"
666 		 "W1: lbpid_low \t\t\t0x%03x\n(W1: lbpid) \t\t\t0x%03x\n",
667 		 ctx->lbpid_high, ctx->lbpid_med, ctx->lbpid_low, (unsigned int)
668 		 (ctx->lbpid_high << 6 | ctx->lbpid_med << 3 | ctx->lbpid_low));
669 	nix_dump(file, "W1: lbp_ena \t\t\t\t%d\n", ctx->lbp_ena);
670 
671 	nix_dump(file, "W2: update_time \t\t%d\nW2: avg_level \t\t\t%d",
672 		 ctx->update_time, ctx->avg_level);
673 	nix_dump(file, "W2: head \t\t\t%d\nW2: tail \t\t\t%d\n", ctx->head,
674 		 ctx->tail);
675 
676 	nix_dump(file, "W3: cq_err_int_ena \t\t%d\nW3: cq_err_int \t\t\t%d",
677 		 ctx->cq_err_int_ena, ctx->cq_err_int);
678 	nix_dump(file, "W3: qsize \t\t\t%d\nW3: caching \t\t\t%d", ctx->qsize,
679 		 ctx->caching);
680 	nix_dump(file, "W3: lbp_frac \t\t\t%d\n", ctx->lbp_frac);
681 	nix_dump(file, "W3: substream \t\t\t0x%03x\nW3: cpt_drop_err_en \t\t\t%d\n",
682 		 ctx->substream, ctx->cpt_drop_err_en);
683 	nix_dump(file, "W3: ena \t\t\t%d\n", ctx->ena);
684 	nix_dump(file, "W3: drop_ena \t\t\t%d\nW3: drop \t\t\t%d", ctx->drop_ena,
685 		 ctx->drop);
686 	nix_dump(file, "W3: bp \t\t\t\t%d\n", ctx->bp);
687 }
688 
689 int
690 roc_nix_queues_ctx_dump(struct roc_nix *roc_nix, FILE *file)
691 {
692 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
693 	int rc = -1, q, rq = nix->nb_rx_queues;
694 	struct npa_aq_enq_rsp *npa_rsp;
695 	struct npa_aq_enq_req *npa_aq;
696 	struct dev *dev = &nix->dev;
697 	int sq = nix->nb_tx_queues;
698 	struct roc_nix_rq *inl_rq;
699 	struct npa_lf *npa_lf;
700 	volatile void *ctx;
701 	uint32_t sqb_aura;
702 
703 	npa_lf = idev_npa_obj_get();
704 	if (npa_lf == NULL)
705 		return NPA_ERR_DEVICE_NOT_BOUNDED;
706 
707 	for (q = 0; q < rq; q++) {
708 		rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_CQ, q, &ctx);
709 		if (rc) {
710 			plt_err("Failed to get cq context");
711 			goto fail;
712 		}
713 		nix_dump(file, "============== port=%d cq=%d ===============",
714 			 roc_nix->port_id, q);
715 		nix_lf_cq_dump(ctx, file);
716 	}
717 
718 	for (q = 0; q < rq; q++) {
719 		rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_RQ, q, &ctx);
720 		if (rc) {
721 			plt_err("Failed to get rq context");
722 			goto fail;
723 		}
724 		nix_dump(file, "============== port=%d rq=%d ===============",
725 			 roc_nix->port_id, q);
726 		if (roc_model_is_cn9k())
727 			nix_cn9k_lf_rq_dump(ctx, file);
728 		else
729 			nix_lf_rq_dump(ctx, file);
730 	}
731 
732 	/* Dump inline dev RQ for this port */
733 	inl_rq = roc_nix_inl_dev_rq(roc_nix);
734 	if (inl_rq) {
735 		struct idev_cfg *idev = idev_get_cfg();
736 		struct nix_inl_dev *inl_dev = NULL;
737 
738 		if (idev && idev->nix_inl_dev)
739 			inl_dev = idev->nix_inl_dev;
740 
741 		if (!inl_dev)
742 			return -EINVAL;
743 
744 		rc = nix_q_ctx_get(&inl_dev->dev, NIX_AQ_CTYPE_RQ, inl_rq->qid, &ctx);
745 		if (rc) {
746 			plt_err("Failed to get rq context");
747 			goto fail;
748 		}
749 		nix_dump(file, "============== port=%d inl_rq=%d ===============", roc_nix->port_id,
750 			 inl_rq->qid);
751 		if (roc_model_is_cn9k())
752 			nix_cn9k_lf_rq_dump(ctx, file);
753 		else
754 			nix_lf_rq_dump(ctx, file);
755 	}
756 
757 	for (q = 0; q < sq; q++) {
758 		rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_SQ, q, &ctx);
759 		if (rc) {
760 			plt_err("Failed to get sq context");
761 			goto fail;
762 		}
763 		nix_dump(file, "============== port=%d sq=%d ===============",
764 			 roc_nix->port_id, q);
765 		if (roc_model_is_cn9k())
766 			nix_cn9k_lf_sq_dump(ctx, &sqb_aura, file);
767 		else
768 			nix_lf_sq_dump(ctx, &sqb_aura, file);
769 
770 		if (!npa_lf) {
771 			plt_err("NPA LF does not exist");
772 			continue;
773 		}
774 
775 		/* Dump SQB Aura minimal info */
776 		npa_aq = mbox_alloc_msg_npa_aq_enq(mbox_get(npa_lf->mbox));
777 		if (npa_aq == NULL) {
778 			rc = -ENOSPC;
779 			mbox_put(npa_lf->mbox);
780 			goto fail;
781 		}
782 		npa_aq->aura_id = sqb_aura;
783 		npa_aq->ctype = NPA_AQ_CTYPE_AURA;
784 		npa_aq->op = NPA_AQ_INSTOP_READ;
785 
786 		rc = mbox_process_msg(npa_lf->mbox, (void *)&npa_rsp);
787 		mbox_put(npa_lf->mbox);
788 		if (rc) {
789 			plt_err("Failed to get sq's sqb_aura context");
790 			continue;
791 		}
792 
793 		nix_dump(file, "\nSQB Aura W0: Pool addr\t\t0x%" PRIx64 "",
794 			 npa_rsp->aura.pool_addr);
795 		nix_dump(file, "SQB Aura W1: ena\t\t\t%d", npa_rsp->aura.ena);
796 		nix_dump(file, "SQB Aura W2: count\t\t%" PRIx64 "",
797 			 (uint64_t)npa_rsp->aura.count);
798 		nix_dump(file, "SQB Aura W3: limit\t\t%" PRIx64 "",
799 			 (uint64_t)npa_rsp->aura.limit);
800 		nix_dump(file, "SQB Aura W3: fc_ena\t\t%d", npa_rsp->aura.fc_ena);
801 		nix_dump(file, "SQB Aura W4: fc_addr\t\t0x%" PRIx64 "\n",
802 			 npa_rsp->aura.fc_addr);
803 	}
804 
805 fail:
806 	return rc;
807 }
808 
809 /* Dumps struct nix_cqe_hdr_s and union nix_rx_parse_u */
810 void
811 roc_nix_cqe_dump(const struct nix_cqe_hdr_s *cq)
812 {
813 	FILE *file = NULL;
814 	const union nix_rx_parse_u *rx =
815 		(const union nix_rx_parse_u *)((const uint64_t *)cq + 1);
816 	const uint64_t *sgs = (const uint64_t *)(rx + 1);
817 	int i;
818 
819 	nix_dump(file, "tag \t\t0x%x\tq \t\t%d\t\tnode \t\t%d\tcqe_type \t%d",
820 		 cq->tag, cq->q, cq->node, cq->cqe_type);
821 
822 	nix_dump(file, "W0: chan \t0x%x\t\tdesc_sizem1 \t%d", rx->chan,
823 		 rx->desc_sizem1);
824 	nix_dump(file, "W0: imm_copy \t%d\t\texpress \t%d", rx->imm_copy,
825 		 rx->express);
826 	nix_dump(file, "W0: wqwd \t%d\t\terrlev \t\t%d\t\terrcode \t%d", rx->wqwd,
827 		 rx->errlev, rx->errcode);
828 	nix_dump(file, "W0: latype \t%d\t\tlbtype \t\t%d\t\tlctype \t\t%d",
829 		 rx->latype, rx->lbtype, rx->lctype);
830 	nix_dump(file, "W0: ldtype \t%d\t\tletype \t\t%d\t\tlftype \t\t%d",
831 		 rx->ldtype, rx->letype, rx->lftype);
832 	nix_dump(file, "W0: lgtype \t%d \t\tlhtype \t\t%d", rx->lgtype, rx->lhtype);
833 
834 	nix_dump(file, "W1: pkt_lenm1 \t%d", rx->pkt_lenm1);
835 	nix_dump(file, "W1: l2m \t%d\t\tl2b \t\t%d\t\tl3m \t\t%d\tl3b \t\t%d",
836 		 rx->l2m, rx->l2b, rx->l3m, rx->l3b);
837 	nix_dump(file, "W1: vtag0_valid %d\t\tvtag0_gone \t%d", rx->vtag0_valid,
838 		 rx->vtag0_gone);
839 	nix_dump(file, "W1: vtag1_valid %d\t\tvtag1_gone \t%d", rx->vtag1_valid,
840 		 rx->vtag1_gone);
841 	nix_dump(file, "W1: pkind \t%d", rx->pkind);
842 	nix_dump(file, "W1: vtag0_tci \t%d\t\tvtag1_tci \t%d", rx->vtag0_tci,
843 		 rx->vtag1_tci);
844 
845 	nix_dump(file, "W2: laflags \t%d\t\tlbflags\t\t%d\t\tlcflags \t%d",
846 		 rx->laflags, rx->lbflags, rx->lcflags);
847 	nix_dump(file, "W2: ldflags \t%d\t\tleflags\t\t%d\t\tlfflags \t%d",
848 		 rx->ldflags, rx->leflags, rx->lfflags);
849 	nix_dump(file, "W2: lgflags \t%d\t\tlhflags \t%d", rx->lgflags, rx->lhflags);
850 
851 	nix_dump(file, "W3: eoh_ptr \t%d\t\twqe_aura \t%d\t\tpb_aura \t%d",
852 		 rx->eoh_ptr, rx->wqe_aura, rx->pb_aura);
853 	nix_dump(file, "W3: match_id \t%d", rx->match_id);
854 
855 	nix_dump(file, "W4: laptr \t%d\t\tlbptr \t\t%d\t\tlcptr \t\t%d", rx->laptr,
856 		 rx->lbptr, rx->lcptr);
857 	nix_dump(file, "W4: ldptr \t%d\t\tleptr \t\t%d\t\tlfptr \t\t%d", rx->ldptr,
858 		 rx->leptr, rx->lfptr);
859 	nix_dump(file, "W4: lgptr \t%d\t\tlhptr \t\t%d", rx->lgptr, rx->lhptr);
860 
861 	nix_dump(file, "W5: vtag0_ptr \t%d\t\tvtag1_ptr \t%d\t\tflow_key_alg \t%d",
862 		 rx->vtag0_ptr, rx->vtag1_ptr, rx->flow_key_alg);
863 
864 	for (i = 0; i < (rx->desc_sizem1 + 1) << 1; i++)
865 		nix_dump(file, "sg[%u] = %p", i, (void *)sgs[i]);
866 }
867 
868 void
869 roc_nix_rq_dump(struct roc_nix_rq *rq, FILE *file)
870 {
871 	nix_dump(file, "nix_rq@%p", rq);
872 	nix_dump(file, "  qid = %d", rq->qid);
873 	nix_dump(file, "  aura_handle = 0x%" PRIx64 "", rq->aura_handle);
874 	nix_dump(file, "  ipsec_ena = %d", rq->ipsech_ena);
875 	nix_dump(file, "  first_skip = %d", rq->first_skip);
876 	nix_dump(file, "  later_skip = %d", rq->later_skip);
877 	nix_dump(file, "  lpb_size = %d", rq->lpb_size);
878 	nix_dump(file, "  sso_ena = %d", rq->sso_ena);
879 	nix_dump(file, "  tag_mask = %d", rq->tag_mask);
880 	nix_dump(file, "  flow_tag_width = %d", rq->flow_tag_width);
881 	nix_dump(file, "  tt = %d", rq->tt);
882 	nix_dump(file, "  hwgrp = %d", rq->hwgrp);
883 	nix_dump(file, "  vwqe_ena = %d", rq->vwqe_ena);
884 	nix_dump(file, "  vwqe_first_skip = %d", rq->vwqe_first_skip);
885 	nix_dump(file, "  vwqe_max_sz_exp = %d", rq->vwqe_max_sz_exp);
886 	nix_dump(file, "  vwqe_wait_tmo = %ld", rq->vwqe_wait_tmo);
887 	nix_dump(file, "  vwqe_aura_handle = %ld", rq->vwqe_aura_handle);
888 	nix_dump(file, "  roc_nix = %p", rq->roc_nix);
889 	nix_dump(file, "  inl_dev_refs = %d", rq->inl_dev_refs);
890 	nix_dump(file, "  tc = %d", rq->tc);
891 }
892 
893 void
894 roc_nix_cq_dump(struct roc_nix_cq *cq, FILE *file)
895 {
896 	nix_dump(file, "nix_cq@%p", cq);
897 	nix_dump(file, "  qid = %d", cq->qid);
898 	nix_dump(file, "  qnb_desc = %d", cq->nb_desc);
899 	nix_dump(file, "  roc_nix = %p", cq->roc_nix);
900 	nix_dump(file, "  door = 0x%" PRIx64 "", cq->door);
901 	nix_dump(file, "  status = %p", cq->status);
902 	nix_dump(file, "  wdata = 0x%" PRIx64 "", cq->wdata);
903 	nix_dump(file, "  desc_base = %p", cq->desc_base);
904 	nix_dump(file, "  qmask = 0x%" PRIx32 "", cq->qmask);
905 }
906 
907 void
908 roc_nix_sq_dump(struct roc_nix_sq *sq, FILE *file)
909 {
910 	nix_dump(file, "nix_sq@%p", sq);
911 	nix_dump(file, "  qid = %d", sq->qid);
912 	nix_dump(file, "  max_sqe_sz = %d", sq->max_sqe_sz);
913 	nix_dump(file, "  nb_desc = %d", sq->nb_desc);
914 	nix_dump(file, "  sqes_per_sqb_log2 = %d", sq->sqes_per_sqb_log2);
915 	nix_dump(file, "  roc_nix= %p", sq->roc_nix);
916 	nix_dump(file, "  aura_handle = 0x%" PRIx64 "", sq->aura_handle);
917 	nix_dump(file, "  nb_sqb_bufs_adj = %d", sq->nb_sqb_bufs_adj);
918 	nix_dump(file, "  nb_sqb_bufs = %d", sq->nb_sqb_bufs);
919 	nix_dump(file, "  io_addr = 0x%" PRIx64 "", sq->io_addr);
920 	nix_dump(file, "  lmt_addr = %p", sq->lmt_addr);
921 	nix_dump(file, "  sqe_mem = %p", sq->sqe_mem);
922 	nix_dump(file, "  fc = %p", sq->fc);
923 	nix_dump(file, "  tc = %d", sq->tc);
924 };
925 
926 static uint8_t
927 nix_tm_reg_dump_prep(uint16_t hw_lvl, uint16_t schq, uint16_t link,
928 		     uint64_t *reg, char regstr[][NIX_REG_NAME_SZ])
929 {
930 	FILE *file = NULL;
931 	uint8_t k = 0;
932 
933 	switch (hw_lvl) {
934 	case NIX_TXSCH_LVL_SMQ:
935 		reg[k] = NIX_AF_SMQX_CFG(schq);
936 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_SMQ[%u]_CFG",
937 			 schq);
938 
939 		reg[k] = NIX_AF_MDQX_PARENT(schq);
940 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_PARENT",
941 			 schq);
942 
943 		reg[k] = NIX_AF_MDQX_SCHEDULE(schq);
944 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
945 			 "NIX_AF_MDQ[%u]_SCHEDULE", schq);
946 
947 		reg[k] = NIX_AF_MDQX_PIR(schq);
948 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_PIR",
949 			 schq);
950 
951 		reg[k] = NIX_AF_MDQX_CIR(schq);
952 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_CIR",
953 			 schq);
954 
955 		reg[k] = NIX_AF_MDQX_SHAPE(schq);
956 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_SHAPE",
957 			 schq);
958 
959 		reg[k] = NIX_AF_MDQX_SW_XOFF(schq);
960 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_SW_XOFF",
961 			 schq);
962 		break;
963 	case NIX_TXSCH_LVL_TL4:
964 		reg[k] = NIX_AF_TL4X_PARENT(schq);
965 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_PARENT",
966 			 schq);
967 
968 		reg[k] = NIX_AF_TL4X_TOPOLOGY(schq);
969 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
970 			 "NIX_AF_TL4[%u]_TOPOLOGY", schq);
971 
972 		reg[k] = NIX_AF_TL4X_SDP_LINK_CFG(schq);
973 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
974 			 "NIX_AF_TL4[%u]_SDP_LINK_CFG", schq);
975 
976 		reg[k] = NIX_AF_TL4X_SCHEDULE(schq);
977 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
978 			 "NIX_AF_TL4[%u]_SCHEDULE", schq);
979 
980 		reg[k] = NIX_AF_TL4X_PIR(schq);
981 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_PIR",
982 			 schq);
983 
984 		reg[k] = NIX_AF_TL4X_CIR(schq);
985 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_CIR",
986 			 schq);
987 
988 		reg[k] = NIX_AF_TL4X_SHAPE(schq);
989 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_SHAPE",
990 			 schq);
991 
992 		reg[k] = NIX_AF_TL4X_SW_XOFF(schq);
993 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_SW_XOFF",
994 			 schq);
995 		break;
996 	case NIX_TXSCH_LVL_TL3:
997 		reg[k] = NIX_AF_TL3X_PARENT(schq);
998 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_PARENT",
999 			 schq);
1000 
1001 		reg[k] = NIX_AF_TL3X_TOPOLOGY(schq);
1002 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1003 			 "NIX_AF_TL3[%u]_TOPOLOGY", schq);
1004 
1005 		reg[k] = NIX_AF_TL3_TL2X_LINKX_CFG(schq, link);
1006 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1007 			 "NIX_AF_TL3_TL2[%u]_LINK[%u]_CFG", schq, link);
1008 
1009 		reg[k] = NIX_AF_TL3X_SCHEDULE(schq);
1010 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1011 			 "NIX_AF_TL3[%u]_SCHEDULE", schq);
1012 
1013 		reg[k] = NIX_AF_TL3X_PIR(schq);
1014 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_PIR",
1015 			 schq);
1016 
1017 		reg[k] = NIX_AF_TL3X_CIR(schq);
1018 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_CIR",
1019 			 schq);
1020 
1021 		reg[k] = NIX_AF_TL3X_SHAPE(schq);
1022 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_SHAPE",
1023 			 schq);
1024 
1025 		reg[k] = NIX_AF_TL3X_SW_XOFF(schq);
1026 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_SW_XOFF",
1027 			 schq);
1028 		break;
1029 	case NIX_TXSCH_LVL_TL2:
1030 		reg[k] = NIX_AF_TL2X_PARENT(schq);
1031 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_PARENT",
1032 			 schq);
1033 
1034 		reg[k] = NIX_AF_TL2X_TOPOLOGY(schq);
1035 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1036 			 "NIX_AF_TL2[%u]_TOPOLOGY", schq);
1037 
1038 		reg[k] = NIX_AF_TL3_TL2X_LINKX_CFG(schq, link);
1039 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1040 			 "NIX_AF_TL3_TL2[%u]_LINK[%u]_CFG", schq, link);
1041 
1042 		reg[k] = NIX_AF_TL2X_SCHEDULE(schq);
1043 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1044 			 "NIX_AF_TL2[%u]_SCHEDULE", schq);
1045 
1046 		reg[k] = NIX_AF_TL2X_PIR(schq);
1047 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_PIR",
1048 			 schq);
1049 
1050 		reg[k] = NIX_AF_TL2X_CIR(schq);
1051 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_CIR",
1052 			 schq);
1053 
1054 		reg[k] = NIX_AF_TL2X_SHAPE(schq);
1055 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_SHAPE",
1056 			 schq);
1057 
1058 		reg[k] = NIX_AF_TL2X_SW_XOFF(schq);
1059 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_SW_XOFF",
1060 			 schq);
1061 		break;
1062 	case NIX_TXSCH_LVL_TL1:
1063 
1064 		reg[k] = NIX_AF_TL1X_TOPOLOGY(schq);
1065 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1066 			 "NIX_AF_TL1[%u]_TOPOLOGY", schq);
1067 
1068 		reg[k] = NIX_AF_TL1X_SCHEDULE(schq);
1069 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1070 			 "NIX_AF_TL1[%u]_SCHEDULE", schq);
1071 
1072 		reg[k] = NIX_AF_TL1X_CIR(schq);
1073 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL1[%u]_CIR",
1074 			 schq);
1075 
1076 		reg[k] = NIX_AF_TL1X_SW_XOFF(schq);
1077 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL1[%u]_SW_XOFF",
1078 			 schq);
1079 
1080 		reg[k] = NIX_AF_TL1X_DROPPED_PACKETS(schq);
1081 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1082 			 "NIX_AF_TL1[%u]_DROPPED_PACKETS", schq);
1083 		break;
1084 	default:
1085 		break;
1086 	}
1087 
1088 	if (k > MAX_REGS_PER_MBOX_MSG) {
1089 		nix_dump(file, "\t!!!NIX TM Registers request overflow!!!");
1090 		return 0;
1091 	}
1092 	return k;
1093 }
1094 
1095 static void
1096 nix_tm_dump_lvl(struct nix *nix, struct nix_tm_node_list *list, uint8_t hw_lvl)
1097 {
1098 	char regstr[MAX_REGS_PER_MBOX_MSG * 2][NIX_REG_NAME_SZ];
1099 	uint64_t reg[MAX_REGS_PER_MBOX_MSG * 2];
1100 	struct mbox *mbox = (&nix->dev)->mbox;
1101 	struct nix_txschq_config *req, *rsp;
1102 	const char *lvlstr, *parent_lvlstr;
1103 	struct nix_tm_node *node, *parent;
1104 	struct nix_tm_node *root = NULL;
1105 	uint32_t schq, parent_schq;
1106 	bool found = false;
1107 	FILE *file = NULL;
1108 	uint8_t j, k, rc;
1109 
1110 	TAILQ_FOREACH(node, list, node) {
1111 		if (node->hw_lvl != hw_lvl)
1112 			continue;
1113 
1114 		found = true;
1115 		parent = node->parent;
1116 		if (hw_lvl == NIX_TXSCH_LVL_CNT) {
1117 			lvlstr = "SQ";
1118 			schq = node->id;
1119 		} else {
1120 			lvlstr = nix_tm_hwlvl2str(node->hw_lvl);
1121 			schq = node->hw_id;
1122 		}
1123 
1124 		if (parent) {
1125 			parent_schq = parent->hw_id;
1126 			parent_lvlstr = nix_tm_hwlvl2str(parent->hw_lvl);
1127 		} else if (node->hw_lvl == NIX_TXSCH_LVL_TL1) {
1128 			parent_schq = nix->tx_link;
1129 			parent_lvlstr = "LINK";
1130 		} else {
1131 			parent_schq = node->parent_hw_id;
1132 			parent_lvlstr = nix_tm_hwlvl2str(node->hw_lvl + 1);
1133 		}
1134 
1135 		nix_dump(file, "\t(%p%s) %s_%d->%s_%d", node,
1136 			 node->child_realloc ? "[CR]" : "", lvlstr, schq,
1137 			 parent_lvlstr, parent_schq);
1138 
1139 		if (!(node->flags & NIX_TM_NODE_HWRES))
1140 			continue;
1141 
1142 		/* Need to dump TL1 when root is TL2 */
1143 		if (node->hw_lvl == nix->tm_root_lvl)
1144 			root = node;
1145 
1146 		/* Dump registers only when HWRES is present */
1147 		k = nix_tm_reg_dump_prep(node->hw_lvl, schq, nix->tx_link, reg,
1148 					 regstr);
1149 		if (!k)
1150 			continue;
1151 
1152 		req = mbox_alloc_msg_nix_txschq_cfg(mbox_get(mbox));
1153 		req->read = 1;
1154 		req->lvl = node->hw_lvl;
1155 		req->num_regs = k;
1156 		mbox_memcpy(req->reg, reg, sizeof(uint64_t) * k);
1157 		rc = mbox_process_msg(mbox, (void **)&rsp);
1158 		if (!rc) {
1159 			for (j = 0; j < k; j++)
1160 				nix_dump(file, "\t\t%s=0x%016" PRIx64, regstr[j],
1161 					 rsp->regval[j]);
1162 		} else {
1163 			nix_dump(file, "\t!!!Failed to dump registers!!!");
1164 		}
1165 		mbox_put(mbox);
1166 	}
1167 
1168 	if (found)
1169 		nix_dump(file, "\n");
1170 
1171 	/* Dump TL1 node data when root level is TL2 */
1172 	if (root && root->hw_lvl == NIX_TXSCH_LVL_TL2) {
1173 		k = nix_tm_reg_dump_prep(NIX_TXSCH_LVL_TL1, root->parent_hw_id,
1174 					 nix->tx_link, reg, regstr);
1175 		if (!k)
1176 			return;
1177 
1178 		req = mbox_alloc_msg_nix_txschq_cfg(mbox_get(mbox));
1179 		req->read = 1;
1180 		req->lvl = NIX_TXSCH_LVL_TL1;
1181 		req->num_regs = k;
1182 		mbox_memcpy(req->reg, reg, sizeof(uint64_t) * k);
1183 		rc = mbox_process_msg(mbox, (void **)&rsp);
1184 		if (!rc) {
1185 			for (j = 0; j < k; j++)
1186 				nix_dump(file, "\t\t%s=0x%016" PRIx64, regstr[j],
1187 					 rsp->regval[j]);
1188 		} else {
1189 			nix_dump(file, "\t!!!Failed to dump registers!!!");
1190 		}
1191 		mbox_put(mbox);
1192 		nix_dump(file, "\n");
1193 	}
1194 }
1195 
1196 void
1197 roc_nix_tm_dump(struct roc_nix *roc_nix, FILE *file)
1198 {
1199 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
1200 	struct dev *dev = &nix->dev;
1201 	uint8_t hw_lvl, i;
1202 
1203 	nix_dump(file, "===TM hierarchy and registers dump of %s (pf:vf) (%d:%d)===",
1204 		 nix->pci_dev->name, dev_get_pf(dev->pf_func),
1205 		 dev_get_vf(dev->pf_func));
1206 
1207 	/* Dump all trees */
1208 	for (i = 0; i < ROC_NIX_TM_TREE_MAX; i++) {
1209 		nix_dump(file, "\tTM %s:", nix_tm_tree2str(i));
1210 		for (hw_lvl = 0; hw_lvl <= NIX_TXSCH_LVL_CNT; hw_lvl++)
1211 			nix_tm_dump_lvl(nix, &nix->trees[i], hw_lvl);
1212 	}
1213 
1214 	/* Dump unused resources */
1215 	nix_dump(file, "\tTM unused resources:");
1216 	hw_lvl = NIX_TXSCH_LVL_SMQ;
1217 	for (; hw_lvl < NIX_TXSCH_LVL_CNT; hw_lvl++) {
1218 		nix_dump(file, "\t\ttxschq        %7s num = %d",
1219 			 nix_tm_hwlvl2str(hw_lvl),
1220 			 nix_tm_resource_avail(nix, hw_lvl, false));
1221 
1222 		nix_bitmap_dump(nix->schq_bmp[hw_lvl], file);
1223 		nix_dump(file, "\n");
1224 
1225 		nix_dump(file, "\t\ttxschq_contig %7s num = %d",
1226 			 nix_tm_hwlvl2str(hw_lvl),
1227 			 nix_tm_resource_avail(nix, hw_lvl, true));
1228 		nix_bitmap_dump(nix->schq_contig_bmp[hw_lvl], file);
1229 		nix_dump(file, "\n");
1230 	}
1231 }
1232 
1233 void
1234 roc_nix_dump(struct roc_nix *roc_nix, FILE *file)
1235 {
1236 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
1237 	struct dev *dev = &nix->dev;
1238 	int i;
1239 
1240 	nix_dump(file, "nix@%p", nix);
1241 	nix_dump(file, "  pf = %d", dev_get_pf(dev->pf_func));
1242 	nix_dump(file, "  vf = %d", dev_get_vf(dev->pf_func));
1243 	nix_dump(file, "  bar2 = 0x%" PRIx64, dev->bar2);
1244 	nix_dump(file, "  bar4 = 0x%" PRIx64, dev->bar4);
1245 	nix_dump(file, "  port_id = %d", roc_nix->port_id);
1246 	nix_dump(file, "  rss_tag_as_xor = %d", roc_nix->rss_tag_as_xor);
1247 	nix_dump(file, "  rss_tag_as_xor = %d", roc_nix->max_sqb_count);
1248 	nix_dump(file, "  outb_nb_desc = %u", roc_nix->outb_nb_desc);
1249 
1250 	nix_dump(file, "  \tpci_dev = %p", nix->pci_dev);
1251 	nix_dump(file, "  \tbase = 0x%" PRIxPTR "", nix->base);
1252 	nix_dump(file, "  \tlmt_base = 0x%" PRIxPTR "", nix->lmt_base);
1253 	nix_dump(file, "  \treta_size = %d", nix->reta_sz);
1254 	nix_dump(file, "  \ttx_chan_base = %d", nix->tx_chan_base);
1255 	nix_dump(file, "  \trx_chan_base = %d", nix->rx_chan_base);
1256 	nix_dump(file, "  \tnb_rx_queues = %d", nix->nb_rx_queues);
1257 	nix_dump(file, "  \tnb_tx_queues = %d", nix->nb_tx_queues);
1258 	nix_dump(file, "  \tlso_tsov6_idx = %d", nix->lso_tsov6_idx);
1259 	nix_dump(file, "  \tlso_tsov4_idx = %d", nix->lso_tsov4_idx);
1260 	nix_dump(file, "  \tlso_udp_tun_v4v4 = %d",
1261 		 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
1262 	nix_dump(file, "  \tlso_udp_tun_v4v6 = %d",
1263 		 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
1264 	nix_dump(file, "  \tlso_udp_tun_v6v4 = %d",
1265 		 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
1266 	nix_dump(file, "  \tlso_udp_tun_v6v6 = %d",
1267 		 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
1268 	nix_dump(file, "  \tlso_tun_v4v4 = %d",
1269 		 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
1270 	nix_dump(file, "  \tlso_tun_v4v6 = %d",
1271 		 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
1272 	nix_dump(file, "  \tlso_tun_v6v4 = %d",
1273 		 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
1274 	nix_dump(file, "  \tlso_tun_v6v6 = %d",
1275 		 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
1276 	nix_dump(file, "  \tlf_rx_stats = %d", nix->lf_rx_stats);
1277 	nix_dump(file, "  \tlf_tx_stats = %d", nix->lf_tx_stats);
1278 	nix_dump(file, "  \trx_chan_cnt = %d", nix->rx_chan_cnt);
1279 	nix_dump(file, "  \ttx_chan_cnt = %d", nix->tx_chan_cnt);
1280 	nix_dump(file, "  \tcgx_links = %d", nix->cgx_links);
1281 	nix_dump(file, "  \tlbk_links = %d", nix->lbk_links);
1282 	nix_dump(file, "  \tsdp_links = %d", nix->sdp_links);
1283 	nix_dump(file, "  \ttx_link = %d", nix->tx_link);
1284 	nix_dump(file, "  \tsqb_size = %d", nix->sqb_size);
1285 	nix_dump(file, "  \tmsixoff = %d", nix->msixoff);
1286 	for (i = 0; i < nix->nb_cpt_lf; i++)
1287 		nix_dump(file, "  \tcpt_msixoff[%d] = %d", i, nix->cpt_msixoff[i]);
1288 	nix_dump(file, "  \tcints = %d", nix->cints);
1289 	nix_dump(file, "  \tqints = %d", nix->qints);
1290 	nix_dump(file, "  \tsdp_link = %d", nix->sdp_link);
1291 	nix_dump(file, "  \tptp_en = %d", nix->ptp_en);
1292 	nix_dump(file, "  \trss_alg_idx = %d", nix->rss_alg_idx);
1293 	nix_dump(file, "  \ttx_pause = %d", nix->tx_pause);
1294 	nix_dump(file, "  \tinl_inb_ena = %d", nix->inl_inb_ena);
1295 	nix_dump(file, "  \tinl_outb_ena = %d", nix->inl_outb_ena);
1296 	nix_dump(file, "  \tinb_sa_base = 0x%p", nix->inb_sa_base);
1297 	nix_dump(file, "  \tinb_sa_sz = %" PRIu64, nix->inb_sa_sz);
1298 	nix_dump(file, "  \toutb_sa_base = 0x%p", nix->outb_sa_base);
1299 	nix_dump(file, "  \toutb_sa_sz = %" PRIu64, nix->outb_sa_sz);
1300 	nix_dump(file, "  \toutb_err_sso_pffunc = 0x%x", nix->outb_err_sso_pffunc);
1301 	nix_dump(file, "  \tcpt_lf_base = 0x%p", nix->cpt_lf_base);
1302 	nix_dump(file, "  \tnb_cpt_lf = %d", nix->nb_cpt_lf);
1303 	nix_dump(file, "  \tinb_inl_dev = %d", nix->inb_inl_dev);
1304 
1305 }
1306 
1307 void
1308 roc_nix_inl_dev_dump(struct roc_nix_inl_dev *roc_inl_dev, FILE *file)
1309 {
1310 	struct idev_cfg *idev = idev_get_cfg();
1311 	struct nix_inl_dev *inl_dev = NULL;
1312 	struct dev *dev = NULL;
1313 	int i;
1314 
1315 	if (roc_inl_dev) {
1316 		inl_dev = (struct nix_inl_dev *)&roc_inl_dev->reserved;
1317 	} else {
1318 		if (idev && idev->nix_inl_dev)
1319 			inl_dev = idev->nix_inl_dev;
1320 		else
1321 			return;
1322 	}
1323 
1324 	dev = &inl_dev->dev;
1325 	nix_dump(file, "nix_inl_dev@%p", inl_dev);
1326 	nix_dump(file, "  pf = %d", dev_get_pf(dev->pf_func));
1327 	nix_dump(file, "  vf = %d", dev_get_vf(dev->pf_func));
1328 	nix_dump(file, "  bar2 = 0x%" PRIx64, dev->bar2);
1329 	nix_dump(file, "  bar4 = 0x%" PRIx64, dev->bar4);
1330 
1331 	nix_dump(file, "  \tpci_dev = %p", inl_dev->pci_dev);
1332 	nix_dump(file, "  \tnix_base = 0x%" PRIxPTR "", inl_dev->nix_base);
1333 	nix_dump(file, "  \tsso_base = 0x%" PRIxPTR "", inl_dev->sso_base);
1334 	nix_dump(file, "  \tssow_base = 0x%" PRIxPTR "", inl_dev->ssow_base);
1335 	nix_dump(file, "  \tnix_msixoff = %d", inl_dev->nix_msixoff);
1336 	nix_dump(file, "  \tsso_msixoff = %d", inl_dev->sso_msixoff);
1337 	nix_dump(file, "  \tssow_msixoff = %d", inl_dev->ssow_msixoff);
1338 	nix_dump(file, "  \tnix_cints = %d", inl_dev->cints);
1339 	nix_dump(file, "  \tnix_qints = %d", inl_dev->qints);
1340 	nix_dump(file, "  \tinb_sa_base = 0x%p", inl_dev->inb_sa_base);
1341 	nix_dump(file, "  \tinb_sa_sz = %d", inl_dev->inb_sa_sz);
1342 	nix_dump(file, "  \txaq_buf_size = %u", inl_dev->xaq_buf_size);
1343 	nix_dump(file, "  \txae_waes = %u", inl_dev->xae_waes);
1344 	nix_dump(file, "  \tiue = %u", inl_dev->iue);
1345 	nix_dump(file, "  \txaq_aura = 0x%" PRIx64, inl_dev->xaq.aura_handle);
1346 	nix_dump(file, "  \txaq_mem = 0x%p", inl_dev->xaq.mem);
1347 
1348 	nix_dump(file, "  \tinl_dev_rq:");
1349 	for (i = 0; i < inl_dev->nb_rqs; i++)
1350 		roc_nix_rq_dump(&inl_dev->rqs[i], file);
1351 }
1352 
1353 void
1354 roc_nix_inl_outb_cpt_lfs_dump(struct roc_nix *roc_nix, FILE *file)
1355 {
1356 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
1357 	struct roc_cpt_lf *lf_base = nix->cpt_lf_base;
1358 	int i;
1359 
1360 	nix_dump(file, "nix@%p", nix);
1361 	for (i = 0; i < nix->nb_cpt_lf; i++) {
1362 		nix_dump(file, "NIX inline dev outbound CPT LFs:");
1363 		cpt_lf_print(&lf_base[i]);
1364 	}
1365 }
1366