xref: /dpdk/drivers/common/cnxk/roc_nix_debug.c (revision 0899a87ce7c71576d445cd956036f6f7e555f01c)
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 = 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 		int rc;
342 
343 		aq = mbox_alloc_msg_nix_aq_enq(mbox);
344 		if (!aq)
345 			return -ENOSPC;
346 
347 		aq->qidx = qid;
348 		aq->ctype = ctype;
349 		aq->op = NIX_AQ_INSTOP_READ;
350 
351 		rc = mbox_process_msg(mbox, (void *)&rsp);
352 		if (rc)
353 			return rc;
354 		if (ctype == NIX_AQ_CTYPE_RQ)
355 			*ctx_p = &rsp->rq;
356 		else if (ctype == NIX_AQ_CTYPE_SQ)
357 			*ctx_p = &rsp->sq;
358 		else
359 			*ctx_p = &rsp->cq;
360 	} else {
361 		struct nix_cn10k_aq_enq_rsp *rsp;
362 		struct nix_cn10k_aq_enq_req *aq;
363 
364 		aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
365 		if (!aq)
366 			return -ENOSPC;
367 
368 		aq->qidx = qid;
369 		aq->ctype = ctype;
370 		aq->op = NIX_AQ_INSTOP_READ;
371 
372 		rc = mbox_process_msg(mbox, (void *)&rsp);
373 		if (rc)
374 			return rc;
375 
376 		if (ctype == NIX_AQ_CTYPE_RQ)
377 			*ctx_p = &rsp->rq;
378 		else if (ctype == NIX_AQ_CTYPE_SQ)
379 			*ctx_p = &rsp->sq;
380 		else
381 			*ctx_p = &rsp->cq;
382 	}
383 	return 0;
384 }
385 
386 static inline void
387 nix_cn9k_lf_sq_dump(__io struct nix_sq_ctx_s *ctx, uint32_t *sqb_aura_p, FILE *file)
388 {
389 	nix_dump(file, "W0: sqe_way_mask \t\t%d\nW0: cq \t\t\t\t%d",
390 		 ctx->sqe_way_mask, ctx->cq);
391 	nix_dump(file, "W0: sdp_mcast \t\t\t%d\nW0: substream \t\t\t0x%03x",
392 		 ctx->sdp_mcast, ctx->substream);
393 	nix_dump(file, "W0: qint_idx \t\t\t%d\nW0: ena \t\t\t%d\n", ctx->qint_idx,
394 		 ctx->ena);
395 
396 	nix_dump(file, "W1: sqb_count \t\t\t%d\nW1: default_chan \t\t%d",
397 		 ctx->sqb_count, ctx->default_chan);
398 	nix_dump(file, "W1: smq_rr_quantum \t\t%d\nW1: sso_ena \t\t\t%d",
399 		 ctx->smq_rr_quantum, ctx->sso_ena);
400 	nix_dump(file, "W1: xoff \t\t\t%d\nW1: cq_ena \t\t\t%d\nW1: smq\t\t\t\t%d\n",
401 		 ctx->xoff, ctx->cq_ena, ctx->smq);
402 
403 	nix_dump(file, "W2: sqe_stype \t\t\t%d\nW2: sq_int_ena \t\t\t%d",
404 		 ctx->sqe_stype, ctx->sq_int_ena);
405 	nix_dump(file, "W2: sq_int  \t\t\t%d\nW2: sqb_aura \t\t\t%d", ctx->sq_int,
406 		 ctx->sqb_aura);
407 	nix_dump(file, "W2: smq_rr_count \t\t%d\n", ctx->smq_rr_count);
408 
409 	nix_dump(file, "W3: smq_next_sq_vld\t\t%d\nW3: smq_pend\t\t\t%d",
410 		 ctx->smq_next_sq_vld, ctx->smq_pend);
411 	nix_dump(file, "W3: smenq_next_sqb_vld  \t%d\nW3: head_offset\t\t\t%d",
412 		 ctx->smenq_next_sqb_vld, ctx->head_offset);
413 	nix_dump(file, "W3: smenq_offset\t\t%d\nW3: tail_offset \t\t%d",
414 		 ctx->smenq_offset, ctx->tail_offset);
415 	nix_dump(file, "W3: smq_lso_segnum \t\t%d\nW3: smq_next_sq \t\t%d",
416 		 ctx->smq_lso_segnum, ctx->smq_next_sq);
417 	nix_dump(file, "W3: mnq_dis \t\t\t%d\nW3: lmt_dis \t\t\t%d", ctx->mnq_dis,
418 		 ctx->lmt_dis);
419 	nix_dump(file, "W3: cq_limit\t\t\t%d\nW3: max_sqe_size\t\t%d\n",
420 		 ctx->cq_limit, ctx->max_sqe_size);
421 
422 	nix_dump(file, "W4: next_sqb \t\t\t0x%" PRIx64 "", ctx->next_sqb);
423 	nix_dump(file, "W5: tail_sqb \t\t\t0x%" PRIx64 "", ctx->tail_sqb);
424 	nix_dump(file, "W6: smenq_sqb \t\t\t0x%" PRIx64 "", ctx->smenq_sqb);
425 	nix_dump(file, "W7: smenq_next_sqb \t\t0x%" PRIx64 "", ctx->smenq_next_sqb);
426 	nix_dump(file, "W8: head_sqb \t\t\t0x%" PRIx64 "", ctx->head_sqb);
427 
428 	nix_dump(file, "W9: vfi_lso_vld \t\t%d\nW9: vfi_lso_vlan1_ins_ena\t%d",
429 		 ctx->vfi_lso_vld, ctx->vfi_lso_vlan1_ins_ena);
430 	nix_dump(file, "W9: vfi_lso_vlan0_ins_ena\t%d\nW9: vfi_lso_mps\t\t\t%d",
431 		 ctx->vfi_lso_vlan0_ins_ena, ctx->vfi_lso_mps);
432 	nix_dump(file, "W9: vfi_lso_sb \t\t\t%d\nW9: vfi_lso_sizem1\t\t%d",
433 		 ctx->vfi_lso_sb, ctx->vfi_lso_sizem1);
434 	nix_dump(file, "W9: vfi_lso_total\t\t%d", ctx->vfi_lso_total);
435 
436 	nix_dump(file, "W10: scm_lso_rem \t\t0x%" PRIx64 "",
437 		 (uint64_t)ctx->scm_lso_rem);
438 	nix_dump(file, "W11: octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->octs);
439 	nix_dump(file, "W12: pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->pkts);
440 	nix_dump(file, "W14: dropped_octs \t\t0x%" PRIx64 "",
441 		 (uint64_t)ctx->drop_octs);
442 	nix_dump(file, "W15: dropped_pkts \t\t0x%" PRIx64 "",
443 		 (uint64_t)ctx->drop_pkts);
444 
445 	*sqb_aura_p = ctx->sqb_aura;
446 }
447 
448 static inline void
449 nix_lf_sq_dump(__io struct nix_cn10k_sq_ctx_s *ctx, uint32_t *sqb_aura_p, FILE *file)
450 {
451 	nix_dump(file, "W0: sqe_way_mask \t\t%d\nW0: cq \t\t\t\t%d",
452 		 ctx->sqe_way_mask, ctx->cq);
453 	nix_dump(file, "W0: sdp_mcast \t\t\t%d\nW0: substream \t\t\t0x%03x",
454 		 ctx->sdp_mcast, ctx->substream);
455 	nix_dump(file, "W0: qint_idx \t\t\t%d\nW0: ena \t\t\t%d\n", ctx->qint_idx,
456 		 ctx->ena);
457 
458 	nix_dump(file, "W1: sqb_count \t\t\t%d\nW1: default_chan \t\t%d",
459 		 ctx->sqb_count, ctx->default_chan);
460 	nix_dump(file, "W1: smq_rr_weight \t\t%d\nW1: sso_ena \t\t\t%d",
461 		 ctx->smq_rr_weight, ctx->sso_ena);
462 	nix_dump(file, "W1: xoff \t\t\t%d\nW1: cq_ena \t\t\t%d\nW1: smq\t\t\t\t%d\n",
463 		 ctx->xoff, ctx->cq_ena, ctx->smq);
464 
465 	nix_dump(file, "W2: sqe_stype \t\t\t%d\nW2: sq_int_ena \t\t\t%d",
466 		 ctx->sqe_stype, ctx->sq_int_ena);
467 	nix_dump(file, "W2: sq_int  \t\t\t%d\nW2: sqb_aura \t\t\t%d", ctx->sq_int,
468 		 ctx->sqb_aura);
469 	nix_dump(file, "W2: smq_rr_count[ub:lb] \t\t%x:%x\n", ctx->smq_rr_count_ub,
470 		 ctx->smq_rr_count_lb);
471 
472 	nix_dump(file, "W3: smq_next_sq_vld\t\t%d\nW3: smq_pend\t\t\t%d",
473 		 ctx->smq_next_sq_vld, ctx->smq_pend);
474 	nix_dump(file, "W3: smenq_next_sqb_vld  \t%d\nW3: head_offset\t\t\t%d",
475 		 ctx->smenq_next_sqb_vld, ctx->head_offset);
476 	nix_dump(file, "W3: smenq_offset\t\t%d\nW3: tail_offset \t\t%d",
477 		 ctx->smenq_offset, ctx->tail_offset);
478 	nix_dump(file, "W3: smq_lso_segnum \t\t%d\nW3: smq_next_sq \t\t%d",
479 		 ctx->smq_lso_segnum, ctx->smq_next_sq);
480 	nix_dump(file, "W3: mnq_dis \t\t\t%d\nW3: lmt_dis \t\t\t%d", ctx->mnq_dis,
481 		 ctx->lmt_dis);
482 	nix_dump(file, "W3: cq_limit\t\t\t%d\nW3: max_sqe_size\t\t%d\n",
483 		 ctx->cq_limit, ctx->max_sqe_size);
484 
485 	nix_dump(file, "W4: next_sqb \t\t\t0x%" PRIx64 "", ctx->next_sqb);
486 	nix_dump(file, "W5: tail_sqb \t\t\t0x%" PRIx64 "", ctx->tail_sqb);
487 	nix_dump(file, "W6: smenq_sqb \t\t\t0x%" PRIx64 "", ctx->smenq_sqb);
488 	nix_dump(file, "W7: smenq_next_sqb \t\t0x%" PRIx64 "", ctx->smenq_next_sqb);
489 	nix_dump(file, "W8: head_sqb \t\t\t0x%" PRIx64 "", ctx->head_sqb);
490 
491 	nix_dump(file, "W9: vfi_lso_vld \t\t%d\nW9: vfi_lso_vlan1_ins_ena\t%d", ctx->vfi_lso_vld,
492 		 ctx->vfi_lso_vlan1_ins_ena);
493 	nix_dump(file, "W9: vfi_lso_vlan0_ins_ena\t%d\nW9: vfi_lso_mps\t\t\t%d",
494 		 ctx->vfi_lso_vlan0_ins_ena, ctx->vfi_lso_mps);
495 	nix_dump(file, "W9: vfi_lso_sb \t\t\t%d\nW9: vfi_lso_sizem1\t\t%d", ctx->vfi_lso_sb,
496 		 ctx->vfi_lso_sizem1);
497 	nix_dump(file, "W9: vfi_lso_total\t\t%d", ctx->vfi_lso_total);
498 
499 	nix_dump(file, "W10: scm_lso_rem \t\t0x%" PRIx64 "", (uint64_t)ctx->scm_lso_rem);
500 	nix_dump(file, "W11: octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->octs);
501 	nix_dump(file, "W12: pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->pkts);
502 	nix_dump(file, "W13: aged_drop_pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->aged_drop_pkts);
503 	nix_dump(file, "W13: aged_drop_octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->aged_drop_octs);
504 	nix_dump(file, "W14: dropped_octs \t\t0x%" PRIx64 "", (uint64_t)ctx->drop_octs);
505 	nix_dump(file, "W15: dropped_pkts \t\t0x%" PRIx64 "", (uint64_t)ctx->drop_pkts);
506 
507 	*sqb_aura_p = ctx->sqb_aura;
508 }
509 
510 static inline void
511 nix_cn9k_lf_rq_dump(__io struct nix_rq_ctx_s *ctx, FILE *file)
512 {
513 	nix_dump(file, "W0: wqe_aura \t\t\t%d\nW0: substream \t\t\t0x%03x",
514 		 ctx->wqe_aura, ctx->substream);
515 	nix_dump(file, "W0: cq \t\t\t\t%d\nW0: ena_wqwd \t\t\t%d", ctx->cq,
516 		 ctx->ena_wqwd);
517 	nix_dump(file, "W0: ipsech_ena \t\t\t%d\nW0: sso_ena \t\t\t%d",
518 		 ctx->ipsech_ena, ctx->sso_ena);
519 	nix_dump(file, "W0: ena \t\t\t%d\n", ctx->ena);
520 
521 	nix_dump(file, "W1: lpb_drop_ena \t\t%d\nW1: spb_drop_ena \t\t%d",
522 		 ctx->lpb_drop_ena, ctx->spb_drop_ena);
523 	nix_dump(file, "W1: xqe_drop_ena \t\t%d\nW1: wqe_caching \t\t%d",
524 		 ctx->xqe_drop_ena, ctx->wqe_caching);
525 	nix_dump(file, "W1: pb_caching \t\t\t%d\nW1: sso_tt \t\t\t%d",
526 		 ctx->pb_caching, ctx->sso_tt);
527 	nix_dump(file, "W1: sso_grp \t\t\t%d\nW1: lpb_aura \t\t\t%d", ctx->sso_grp,
528 		 ctx->lpb_aura);
529 	nix_dump(file, "W1: spb_aura \t\t\t%d\n", ctx->spb_aura);
530 
531 	nix_dump(file, "W2: xqe_hdr_split \t\t%d\nW2: xqe_imm_copy \t\t%d",
532 		 ctx->xqe_hdr_split, ctx->xqe_imm_copy);
533 	nix_dump(file, "W2: xqe_imm_size \t\t%d\nW2: later_skip \t\t\t%d",
534 		 ctx->xqe_imm_size, ctx->later_skip);
535 	nix_dump(file, "W2: first_skip \t\t\t%d\nW2: lpb_sizem1 \t\t\t%d",
536 		 ctx->first_skip, ctx->lpb_sizem1);
537 	nix_dump(file, "W2: spb_ena \t\t\t%d\nW2: wqe_skip \t\t\t%d", ctx->spb_ena,
538 		 ctx->wqe_skip);
539 	nix_dump(file, "W2: spb_sizem1 \t\t\t%d\n", ctx->spb_sizem1);
540 
541 	nix_dump(file, "W3: spb_pool_pass \t\t%d\nW3: spb_pool_drop \t\t%d",
542 		 ctx->spb_pool_pass, ctx->spb_pool_drop);
543 	nix_dump(file, "W3: spb_aura_pass \t\t%d\nW3: spb_aura_drop \t\t%d",
544 		 ctx->spb_aura_pass, ctx->spb_aura_drop);
545 	nix_dump(file, "W3: wqe_pool_pass \t\t%d\nW3: wqe_pool_drop \t\t%d",
546 		 ctx->wqe_pool_pass, ctx->wqe_pool_drop);
547 	nix_dump(file, "W3: xqe_pass \t\t\t%d\nW3: xqe_drop \t\t\t%d\n",
548 		 ctx->xqe_pass, ctx->xqe_drop);
549 
550 	nix_dump(file, "W4: qint_idx \t\t\t%d\nW4: rq_int_ena \t\t\t%d",
551 		 ctx->qint_idx, ctx->rq_int_ena);
552 	nix_dump(file, "W4: rq_int \t\t\t%d\nW4: lpb_pool_pass \t\t%d", ctx->rq_int,
553 		 ctx->lpb_pool_pass);
554 	nix_dump(file, "W4: lpb_pool_drop \t\t%d\nW4: lpb_aura_pass \t\t%d",
555 		 ctx->lpb_pool_drop, ctx->lpb_aura_pass);
556 	nix_dump(file, "W4: lpb_aura_drop \t\t%d\n", ctx->lpb_aura_drop);
557 
558 	nix_dump(file, "W5: flow_tagw \t\t\t%d\nW5: bad_utag \t\t\t%d",
559 		 ctx->flow_tagw, ctx->bad_utag);
560 	nix_dump(file, "W5: good_utag \t\t\t%d\nW5: ltag \t\t\t%d\n", ctx->good_utag,
561 		 ctx->ltag);
562 
563 	nix_dump(file, "W6: octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->octs);
564 	nix_dump(file, "W7: pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->pkts);
565 	nix_dump(file, "W8: drop_octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->drop_octs);
566 	nix_dump(file, "W9: drop_pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->drop_pkts);
567 	nix_dump(file, "W10: re_pkts \t\t\t0x%" PRIx64 "\n", (uint64_t)ctx->re_pkts);
568 }
569 
570 void
571 nix_lf_rq_dump(__io struct nix_cn10k_rq_ctx_s *ctx, FILE *file)
572 {
573 	nix_dump(file, "W0: wqe_aura \t\t\t%d\nW0: len_ol3_dis \t\t\t%d",
574 		 ctx->wqe_aura, ctx->len_ol3_dis);
575 	nix_dump(file, "W0: len_ol4_dis \t\t\t%d\nW0: len_il3_dis \t\t\t%d",
576 		 ctx->len_ol4_dis, ctx->len_il3_dis);
577 	nix_dump(file, "W0: len_il4_dis \t\t\t%d\nW0: csum_ol4_dis \t\t\t%d",
578 		 ctx->len_il4_dis, ctx->csum_ol4_dis);
579 	nix_dump(file, "W0: csum_ol3_dis \t\t\t%d\nW0: lenerr_dis \t\t\t%d",
580 		 ctx->csum_ol4_dis, ctx->lenerr_dis);
581 	nix_dump(file, "W0: cq \t\t\t\t%d\nW0: ena_wqwd \t\t\t%d", ctx->cq,
582 		 ctx->ena_wqwd);
583 	nix_dump(file, "W0: ipsech_ena \t\t\t%d\nW0: sso_ena \t\t\t%d",
584 		 ctx->ipsech_ena, ctx->sso_ena);
585 	nix_dump(file, "W0: ena \t\t\t%d\n", ctx->ena);
586 
587 	nix_dump(file, "W1: chi_ena \t\t%d\nW1: ipsecd_drop_en \t\t%d", ctx->chi_ena,
588 		 ctx->ipsecd_drop_en);
589 	nix_dump(file, "W1: pb_stashing \t\t\t%d", ctx->pb_stashing);
590 	nix_dump(file, "W1: lpb_drop_ena \t\t%d\nW1: spb_drop_ena \t\t%d",
591 		 ctx->lpb_drop_ena, ctx->spb_drop_ena);
592 	nix_dump(file, "W1: xqe_drop_ena \t\t%d\nW1: wqe_caching \t\t%d",
593 		 ctx->xqe_drop_ena, ctx->wqe_caching);
594 	nix_dump(file, "W1: pb_caching \t\t\t%d\nW1: sso_tt \t\t\t%d",
595 		 ctx->pb_caching, ctx->sso_tt);
596 	nix_dump(file, "W1: sso_grp \t\t\t%d\nW1: lpb_aura \t\t\t%d", ctx->sso_grp,
597 		 ctx->lpb_aura);
598 	nix_dump(file, "W1: spb_aura \t\t\t%d\n", ctx->spb_aura);
599 
600 	nix_dump(file, "W2: xqe_hdr_split \t\t%d\nW2: xqe_imm_copy \t\t%d",
601 		 ctx->xqe_hdr_split, ctx->xqe_imm_copy);
602 	nix_dump(file, "W2: xqe_imm_size \t\t%d\nW2: later_skip \t\t\t%d",
603 		 ctx->xqe_imm_size, ctx->later_skip);
604 	nix_dump(file, "W2: first_skip \t\t\t%d\nW2: lpb_sizem1 \t\t\t%d",
605 		 ctx->first_skip, ctx->lpb_sizem1);
606 	nix_dump(file, "W2: spb_ena \t\t\t%d\nW2: wqe_skip \t\t\t%d", ctx->spb_ena,
607 		 ctx->wqe_skip);
608 	nix_dump(file, "W2: spb_sizem1 \t\t\t%d\nW2: policer_ena \t\t\t%d",
609 		 ctx->spb_sizem1, ctx->policer_ena);
610 	nix_dump(file, "W2: band_prof_id \t\t\t%d", ctx->band_prof_id);
611 
612 	nix_dump(file, "W3: spb_pool_pass \t\t%d\nW3: spb_pool_drop \t\t%d",
613 		 ctx->spb_pool_pass, ctx->spb_pool_drop);
614 	nix_dump(file, "W3: spb_aura_pass \t\t%d\nW3: spb_aura_drop \t\t%d",
615 		 ctx->spb_aura_pass, ctx->spb_aura_drop);
616 	nix_dump(file, "W3: wqe_pool_pass \t\t%d\nW3: wqe_pool_drop \t\t%d",
617 		 ctx->wqe_pool_pass, ctx->wqe_pool_drop);
618 	nix_dump(file, "W3: xqe_pass \t\t\t%d\nW3: xqe_drop \t\t\t%d\n",
619 		 ctx->xqe_pass, ctx->xqe_drop);
620 
621 	nix_dump(file, "W4: qint_idx \t\t\t%d\nW4: rq_int_ena \t\t\t%d",
622 		 ctx->qint_idx, ctx->rq_int_ena);
623 	nix_dump(file, "W4: rq_int \t\t\t%d\nW4: lpb_pool_pass \t\t%d", ctx->rq_int,
624 		 ctx->lpb_pool_pass);
625 	nix_dump(file, "W4: lpb_pool_drop \t\t%d\nW4: lpb_aura_pass \t\t%d",
626 		 ctx->lpb_pool_drop, ctx->lpb_aura_pass);
627 	nix_dump(file, "W4: lpb_aura_drop \t\t%d\n", ctx->lpb_aura_drop);
628 
629 	nix_dump(file, "W5: vwqe_skip \t\t\t%d\nW5: max_vsize_exp \t\t\t%d",
630 		 ctx->vwqe_skip, ctx->max_vsize_exp);
631 	nix_dump(file, "W5: vtime_wait \t\t\t%d\nW5: vwqe_ena \t\t\t%d",
632 		 ctx->vtime_wait, ctx->max_vsize_exp);
633 	nix_dump(file, "W5: ipsec_vwqe \t\t\t%d", ctx->ipsec_vwqe);
634 	nix_dump(file, "W5: flow_tagw \t\t\t%d\nW5: bad_utag \t\t\t%d",
635 		 ctx->flow_tagw, ctx->bad_utag);
636 	nix_dump(file, "W5: good_utag \t\t\t%d\nW5: ltag \t\t\t%d\n", ctx->good_utag,
637 		 ctx->ltag);
638 
639 	nix_dump(file, "W6: octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->octs);
640 	nix_dump(file, "W7: pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->pkts);
641 	nix_dump(file, "W8: drop_octs \t\t\t0x%" PRIx64 "", (uint64_t)ctx->drop_octs);
642 	nix_dump(file, "W9: drop_pkts \t\t\t0x%" PRIx64 "", (uint64_t)ctx->drop_pkts);
643 	nix_dump(file, "W10: re_pkts \t\t\t0x%" PRIx64 "\n", (uint64_t)ctx->re_pkts);
644 }
645 
646 static inline void
647 nix_lf_cq_dump(__io struct nix_cq_ctx_s *ctx, FILE *file)
648 {
649 	nix_dump(file, "W0: base \t\t\t0x%" PRIx64 "\n", ctx->base);
650 
651 	nix_dump(file, "W1: wrptr \t\t\t%" PRIx64 "", (uint64_t)ctx->wrptr);
652 	nix_dump(file, "W1: avg_con \t\t\t%d\nW1: cint_idx \t\t\t%d", ctx->avg_con,
653 		 ctx->cint_idx);
654 	nix_dump(file, "W1: cq_err \t\t\t%d\nW1: qint_idx \t\t\t%d", ctx->cq_err,
655 		 ctx->qint_idx);
656 	nix_dump(file, "W1: bpid  \t\t\t%d\nW1: bp_ena \t\t\t%d\n", ctx->bpid,
657 		 ctx->bp_ena);
658 
659 	nix_dump(file, "W2: update_time \t\t%d\nW2: avg_level \t\t\t%d",
660 		 ctx->update_time, ctx->avg_level);
661 	nix_dump(file, "W2: head \t\t\t%d\nW2: tail \t\t\t%d\n", ctx->head,
662 		 ctx->tail);
663 
664 	nix_dump(file, "W3: cq_err_int_ena \t\t%d\nW3: cq_err_int \t\t\t%d",
665 		 ctx->cq_err_int_ena, ctx->cq_err_int);
666 	nix_dump(file, "W3: qsize \t\t\t%d\nW3: caching \t\t\t%d", ctx->qsize,
667 		 ctx->caching);
668 	nix_dump(file, "W3: substream \t\t\t0x%03x\nW3: ena \t\t\t%d", ctx->substream,
669 		 ctx->ena);
670 	nix_dump(file, "W3: drop_ena \t\t\t%d\nW3: drop \t\t\t%d", ctx->drop_ena,
671 		 ctx->drop);
672 	nix_dump(file, "W3: bp \t\t\t\t%d\n", ctx->bp);
673 }
674 
675 int
676 roc_nix_queues_ctx_dump(struct roc_nix *roc_nix, FILE *file)
677 {
678 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
679 	int rc = -1, q, rq = nix->nb_rx_queues;
680 	struct npa_aq_enq_rsp *npa_rsp;
681 	struct npa_aq_enq_req *npa_aq;
682 	struct dev *dev = &nix->dev;
683 	int sq = nix->nb_tx_queues;
684 	struct npa_lf *npa_lf;
685 	volatile void *ctx;
686 	uint32_t sqb_aura;
687 
688 	npa_lf = idev_npa_obj_get();
689 	if (npa_lf == NULL)
690 		return NPA_ERR_DEVICE_NOT_BOUNDED;
691 
692 	for (q = 0; q < rq; q++) {
693 		rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_CQ, q, &ctx);
694 		if (rc) {
695 			plt_err("Failed to get cq context");
696 			goto fail;
697 		}
698 		nix_dump(file, "============== port=%d cq=%d ===============",
699 			 roc_nix->port_id, q);
700 		nix_lf_cq_dump(ctx, file);
701 	}
702 
703 	for (q = 0; q < rq; q++) {
704 		rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_RQ, q, &ctx);
705 		if (rc) {
706 			plt_err("Failed to get rq context");
707 			goto fail;
708 		}
709 		nix_dump(file, "============== port=%d rq=%d ===============",
710 			 roc_nix->port_id, q);
711 		if (roc_model_is_cn9k())
712 			nix_cn9k_lf_rq_dump(ctx, file);
713 		else
714 			nix_lf_rq_dump(ctx, file);
715 	}
716 
717 	for (q = 0; q < sq; q++) {
718 		rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_SQ, q, &ctx);
719 		if (rc) {
720 			plt_err("Failed to get sq context");
721 			goto fail;
722 		}
723 		nix_dump(file, "============== port=%d sq=%d ===============",
724 			 roc_nix->port_id, q);
725 		if (roc_model_is_cn9k())
726 			nix_cn9k_lf_sq_dump(ctx, &sqb_aura, file);
727 		else
728 			nix_lf_sq_dump(ctx, &sqb_aura, file);
729 
730 		if (!npa_lf) {
731 			plt_err("NPA LF does not exist");
732 			continue;
733 		}
734 
735 		/* Dump SQB Aura minimal info */
736 		npa_aq = mbox_alloc_msg_npa_aq_enq(npa_lf->mbox);
737 		if (npa_aq == NULL)
738 			return -ENOSPC;
739 		npa_aq->aura_id = sqb_aura;
740 		npa_aq->ctype = NPA_AQ_CTYPE_AURA;
741 		npa_aq->op = NPA_AQ_INSTOP_READ;
742 
743 		rc = mbox_process_msg(npa_lf->mbox, (void *)&npa_rsp);
744 		if (rc) {
745 			plt_err("Failed to get sq's sqb_aura context");
746 			continue;
747 		}
748 
749 		nix_dump(file, "\nSQB Aura W0: Pool addr\t\t0x%" PRIx64 "",
750 			 npa_rsp->aura.pool_addr);
751 		nix_dump(file, "SQB Aura W1: ena\t\t\t%d", npa_rsp->aura.ena);
752 		nix_dump(file, "SQB Aura W2: count\t\t%" PRIx64 "",
753 			 (uint64_t)npa_rsp->aura.count);
754 		nix_dump(file, "SQB Aura W3: limit\t\t%" PRIx64 "",
755 			 (uint64_t)npa_rsp->aura.limit);
756 		nix_dump(file, "SQB Aura W3: fc_ena\t\t%d", npa_rsp->aura.fc_ena);
757 		nix_dump(file, "SQB Aura W4: fc_addr\t\t0x%" PRIx64 "\n",
758 			 npa_rsp->aura.fc_addr);
759 	}
760 
761 fail:
762 	return rc;
763 }
764 
765 /* Dumps struct nix_cqe_hdr_s and union nix_rx_parse_u */
766 void
767 roc_nix_cqe_dump(const struct nix_cqe_hdr_s *cq)
768 {
769 	FILE *file = NULL;
770 	const union nix_rx_parse_u *rx =
771 		(const union nix_rx_parse_u *)((const uint64_t *)cq + 1);
772 	const uint64_t *sgs = (const uint64_t *)(rx + 1);
773 	int i;
774 
775 	nix_dump(file, "tag \t\t0x%x\tq \t\t%d\t\tnode \t\t%d\tcqe_type \t%d",
776 		 cq->tag, cq->q, cq->node, cq->cqe_type);
777 
778 	nix_dump(file, "W0: chan \t0x%x\t\tdesc_sizem1 \t%d", rx->chan,
779 		 rx->desc_sizem1);
780 	nix_dump(file, "W0: imm_copy \t%d\t\texpress \t%d", rx->imm_copy,
781 		 rx->express);
782 	nix_dump(file, "W0: wqwd \t%d\t\terrlev \t\t%d\t\terrcode \t%d", rx->wqwd,
783 		 rx->errlev, rx->errcode);
784 	nix_dump(file, "W0: latype \t%d\t\tlbtype \t\t%d\t\tlctype \t\t%d",
785 		 rx->latype, rx->lbtype, rx->lctype);
786 	nix_dump(file, "W0: ldtype \t%d\t\tletype \t\t%d\t\tlftype \t\t%d",
787 		 rx->ldtype, rx->letype, rx->lftype);
788 	nix_dump(file, "W0: lgtype \t%d \t\tlhtype \t\t%d", rx->lgtype, rx->lhtype);
789 
790 	nix_dump(file, "W1: pkt_lenm1 \t%d", rx->pkt_lenm1);
791 	nix_dump(file, "W1: l2m \t%d\t\tl2b \t\t%d\t\tl3m \t\t%d\tl3b \t\t%d",
792 		 rx->l2m, rx->l2b, rx->l3m, rx->l3b);
793 	nix_dump(file, "W1: vtag0_valid %d\t\tvtag0_gone \t%d", rx->vtag0_valid,
794 		 rx->vtag0_gone);
795 	nix_dump(file, "W1: vtag1_valid %d\t\tvtag1_gone \t%d", rx->vtag1_valid,
796 		 rx->vtag1_gone);
797 	nix_dump(file, "W1: pkind \t%d", rx->pkind);
798 	nix_dump(file, "W1: vtag0_tci \t%d\t\tvtag1_tci \t%d", rx->vtag0_tci,
799 		 rx->vtag1_tci);
800 
801 	nix_dump(file, "W2: laflags \t%d\t\tlbflags\t\t%d\t\tlcflags \t%d",
802 		 rx->laflags, rx->lbflags, rx->lcflags);
803 	nix_dump(file, "W2: ldflags \t%d\t\tleflags\t\t%d\t\tlfflags \t%d",
804 		 rx->ldflags, rx->leflags, rx->lfflags);
805 	nix_dump(file, "W2: lgflags \t%d\t\tlhflags \t%d", rx->lgflags, rx->lhflags);
806 
807 	nix_dump(file, "W3: eoh_ptr \t%d\t\twqe_aura \t%d\t\tpb_aura \t%d",
808 		 rx->eoh_ptr, rx->wqe_aura, rx->pb_aura);
809 	nix_dump(file, "W3: match_id \t%d", rx->match_id);
810 
811 	nix_dump(file, "W4: laptr \t%d\t\tlbptr \t\t%d\t\tlcptr \t\t%d", rx->laptr,
812 		 rx->lbptr, rx->lcptr);
813 	nix_dump(file, "W4: ldptr \t%d\t\tleptr \t\t%d\t\tlfptr \t\t%d", rx->ldptr,
814 		 rx->leptr, rx->lfptr);
815 	nix_dump(file, "W4: lgptr \t%d\t\tlhptr \t\t%d", rx->lgptr, rx->lhptr);
816 
817 	nix_dump(file, "W5: vtag0_ptr \t%d\t\tvtag1_ptr \t%d\t\tflow_key_alg \t%d",
818 		 rx->vtag0_ptr, rx->vtag1_ptr, rx->flow_key_alg);
819 
820 	for (i = 0; i < (rx->desc_sizem1 + 1) << 1; i++)
821 		nix_dump(file, "sg[%u] = %p", i, (void *)sgs[i]);
822 }
823 
824 void
825 roc_nix_rq_dump(struct roc_nix_rq *rq, FILE *file)
826 {
827 	nix_dump(file, "nix_rq@%p", rq);
828 	nix_dump(file, "  qid = %d", rq->qid);
829 	nix_dump(file, "  aura_handle = 0x%" PRIx64 "", rq->aura_handle);
830 	nix_dump(file, "  ipsec_ena = %d", rq->ipsech_ena);
831 	nix_dump(file, "  first_skip = %d", rq->first_skip);
832 	nix_dump(file, "  later_skip = %d", rq->later_skip);
833 	nix_dump(file, "  lpb_size = %d", rq->lpb_size);
834 	nix_dump(file, "  sso_ena = %d", rq->sso_ena);
835 	nix_dump(file, "  tag_mask = %d", rq->tag_mask);
836 	nix_dump(file, "  flow_tag_width = %d", rq->flow_tag_width);
837 	nix_dump(file, "  tt = %d", rq->tt);
838 	nix_dump(file, "  hwgrp = %d", rq->hwgrp);
839 	nix_dump(file, "  vwqe_ena = %d", rq->vwqe_ena);
840 	nix_dump(file, "  vwqe_first_skip = %d", rq->vwqe_first_skip);
841 	nix_dump(file, "  vwqe_max_sz_exp = %d", rq->vwqe_max_sz_exp);
842 	nix_dump(file, "  vwqe_wait_tmo = %ld", rq->vwqe_wait_tmo);
843 	nix_dump(file, "  vwqe_aura_handle = %ld", rq->vwqe_aura_handle);
844 	nix_dump(file, "  roc_nix = %p", rq->roc_nix);
845 	nix_dump(file, "  inl_dev_refs = %d", rq->inl_dev_refs);
846 }
847 
848 void
849 roc_nix_cq_dump(struct roc_nix_cq *cq, FILE *file)
850 {
851 	nix_dump(file, "nix_cq@%p", cq);
852 	nix_dump(file, "  qid = %d", cq->qid);
853 	nix_dump(file, "  qnb_desc = %d", cq->nb_desc);
854 	nix_dump(file, "  roc_nix = %p", cq->roc_nix);
855 	nix_dump(file, "  door = 0x%" PRIx64 "", cq->door);
856 	nix_dump(file, "  status = %p", cq->status);
857 	nix_dump(file, "  wdata = 0x%" PRIx64 "", cq->wdata);
858 	nix_dump(file, "  desc_base = %p", cq->desc_base);
859 	nix_dump(file, "  qmask = 0x%" PRIx32 "", cq->qmask);
860 }
861 
862 void
863 roc_nix_sq_dump(struct roc_nix_sq *sq, FILE *file)
864 {
865 	nix_dump(file, "nix_sq@%p", sq);
866 	nix_dump(file, "  qid = %d", sq->qid);
867 	nix_dump(file, "  max_sqe_sz = %d", sq->max_sqe_sz);
868 	nix_dump(file, "  nb_desc = %d", sq->nb_desc);
869 	nix_dump(file, "  sqes_per_sqb_log2 = %d", sq->sqes_per_sqb_log2);
870 	nix_dump(file, "  roc_nix= %p", sq->roc_nix);
871 	nix_dump(file, "  aura_handle = 0x%" PRIx64 "", sq->aura_handle);
872 	nix_dump(file, "  nb_sqb_bufs_adj = %d", sq->nb_sqb_bufs_adj);
873 	nix_dump(file, "  nb_sqb_bufs = %d", sq->nb_sqb_bufs);
874 	nix_dump(file, "  io_addr = 0x%" PRIx64 "", sq->io_addr);
875 	nix_dump(file, "  lmt_addr = %p", sq->lmt_addr);
876 	nix_dump(file, "  sqe_mem = %p", sq->sqe_mem);
877 	nix_dump(file, "  fc = %p", sq->fc);
878 };
879 
880 static uint8_t
881 nix_tm_reg_dump_prep(uint16_t hw_lvl, uint16_t schq, uint16_t link,
882 		     uint64_t *reg, char regstr[][NIX_REG_NAME_SZ])
883 {
884 	FILE *file = NULL;
885 	uint8_t k = 0;
886 
887 	switch (hw_lvl) {
888 	case NIX_TXSCH_LVL_SMQ:
889 		reg[k] = NIX_AF_SMQX_CFG(schq);
890 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_SMQ[%u]_CFG",
891 			 schq);
892 
893 		reg[k] = NIX_AF_MDQX_PARENT(schq);
894 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_PARENT",
895 			 schq);
896 
897 		reg[k] = NIX_AF_MDQX_SCHEDULE(schq);
898 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
899 			 "NIX_AF_MDQ[%u]_SCHEDULE", schq);
900 
901 		reg[k] = NIX_AF_MDQX_PIR(schq);
902 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_PIR",
903 			 schq);
904 
905 		reg[k] = NIX_AF_MDQX_CIR(schq);
906 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_CIR",
907 			 schq);
908 
909 		reg[k] = NIX_AF_MDQX_SHAPE(schq);
910 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_SHAPE",
911 			 schq);
912 
913 		reg[k] = NIX_AF_MDQX_SW_XOFF(schq);
914 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_MDQ[%u]_SW_XOFF",
915 			 schq);
916 		break;
917 	case NIX_TXSCH_LVL_TL4:
918 		reg[k] = NIX_AF_TL4X_PARENT(schq);
919 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_PARENT",
920 			 schq);
921 
922 		reg[k] = NIX_AF_TL4X_TOPOLOGY(schq);
923 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
924 			 "NIX_AF_TL4[%u]_TOPOLOGY", schq);
925 
926 		reg[k] = NIX_AF_TL4X_SDP_LINK_CFG(schq);
927 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
928 			 "NIX_AF_TL4[%u]_SDP_LINK_CFG", schq);
929 
930 		reg[k] = NIX_AF_TL4X_SCHEDULE(schq);
931 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
932 			 "NIX_AF_TL4[%u]_SCHEDULE", schq);
933 
934 		reg[k] = NIX_AF_TL4X_PIR(schq);
935 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_PIR",
936 			 schq);
937 
938 		reg[k] = NIX_AF_TL4X_CIR(schq);
939 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_CIR",
940 			 schq);
941 
942 		reg[k] = NIX_AF_TL4X_SHAPE(schq);
943 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_SHAPE",
944 			 schq);
945 
946 		reg[k] = NIX_AF_TL4X_SW_XOFF(schq);
947 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL4[%u]_SW_XOFF",
948 			 schq);
949 		break;
950 	case NIX_TXSCH_LVL_TL3:
951 		reg[k] = NIX_AF_TL3X_PARENT(schq);
952 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_PARENT",
953 			 schq);
954 
955 		reg[k] = NIX_AF_TL3X_TOPOLOGY(schq);
956 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
957 			 "NIX_AF_TL3[%u]_TOPOLOGY", schq);
958 
959 		reg[k] = NIX_AF_TL3_TL2X_LINKX_CFG(schq, link);
960 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
961 			 "NIX_AF_TL3_TL2[%u]_LINK[%u]_CFG", schq, link);
962 
963 		reg[k] = NIX_AF_TL3X_SCHEDULE(schq);
964 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
965 			 "NIX_AF_TL3[%u]_SCHEDULE", schq);
966 
967 		reg[k] = NIX_AF_TL3X_PIR(schq);
968 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_PIR",
969 			 schq);
970 
971 		reg[k] = NIX_AF_TL3X_CIR(schq);
972 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_CIR",
973 			 schq);
974 
975 		reg[k] = NIX_AF_TL3X_SHAPE(schq);
976 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_SHAPE",
977 			 schq);
978 
979 		reg[k] = NIX_AF_TL3X_SW_XOFF(schq);
980 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL3[%u]_SW_XOFF",
981 			 schq);
982 		break;
983 	case NIX_TXSCH_LVL_TL2:
984 		reg[k] = NIX_AF_TL2X_PARENT(schq);
985 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_PARENT",
986 			 schq);
987 
988 		reg[k] = NIX_AF_TL2X_TOPOLOGY(schq);
989 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
990 			 "NIX_AF_TL2[%u]_TOPOLOGY", schq);
991 
992 		reg[k] = NIX_AF_TL3_TL2X_LINKX_CFG(schq, link);
993 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
994 			 "NIX_AF_TL3_TL2[%u]_LINK[%u]_CFG", schq, link);
995 
996 		reg[k] = NIX_AF_TL2X_SCHEDULE(schq);
997 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
998 			 "NIX_AF_TL2[%u]_SCHEDULE", schq);
999 
1000 		reg[k] = NIX_AF_TL2X_PIR(schq);
1001 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_PIR",
1002 			 schq);
1003 
1004 		reg[k] = NIX_AF_TL2X_CIR(schq);
1005 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_CIR",
1006 			 schq);
1007 
1008 		reg[k] = NIX_AF_TL2X_SHAPE(schq);
1009 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_SHAPE",
1010 			 schq);
1011 
1012 		reg[k] = NIX_AF_TL2X_SW_XOFF(schq);
1013 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL2[%u]_SW_XOFF",
1014 			 schq);
1015 		break;
1016 	case NIX_TXSCH_LVL_TL1:
1017 
1018 		reg[k] = NIX_AF_TL1X_TOPOLOGY(schq);
1019 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1020 			 "NIX_AF_TL1[%u]_TOPOLOGY", schq);
1021 
1022 		reg[k] = NIX_AF_TL1X_SCHEDULE(schq);
1023 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1024 			 "NIX_AF_TL1[%u]_SCHEDULE", schq);
1025 
1026 		reg[k] = NIX_AF_TL1X_CIR(schq);
1027 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL1[%u]_CIR",
1028 			 schq);
1029 
1030 		reg[k] = NIX_AF_TL1X_SW_XOFF(schq);
1031 		snprintf(regstr[k++], NIX_REG_NAME_SZ, "NIX_AF_TL1[%u]_SW_XOFF",
1032 			 schq);
1033 
1034 		reg[k] = NIX_AF_TL1X_DROPPED_PACKETS(schq);
1035 		snprintf(regstr[k++], NIX_REG_NAME_SZ,
1036 			 "NIX_AF_TL1[%u]_DROPPED_PACKETS", schq);
1037 		break;
1038 	default:
1039 		break;
1040 	}
1041 
1042 	if (k > MAX_REGS_PER_MBOX_MSG) {
1043 		nix_dump(file, "\t!!!NIX TM Registers request overflow!!!");
1044 		return 0;
1045 	}
1046 	return k;
1047 }
1048 
1049 static void
1050 nix_tm_dump_lvl(struct nix *nix, struct nix_tm_node_list *list, uint8_t hw_lvl)
1051 {
1052 	char regstr[MAX_REGS_PER_MBOX_MSG * 2][NIX_REG_NAME_SZ];
1053 	uint64_t reg[MAX_REGS_PER_MBOX_MSG * 2];
1054 	struct mbox *mbox = (&nix->dev)->mbox;
1055 	struct nix_txschq_config *req, *rsp;
1056 	const char *lvlstr, *parent_lvlstr;
1057 	struct nix_tm_node *node, *parent;
1058 	struct nix_tm_node *root = NULL;
1059 	uint32_t schq, parent_schq;
1060 	bool found = false;
1061 	FILE *file = NULL;
1062 	uint8_t j, k, rc;
1063 
1064 	TAILQ_FOREACH(node, list, node) {
1065 		if (node->hw_lvl != hw_lvl)
1066 			continue;
1067 
1068 		found = true;
1069 		parent = node->parent;
1070 		if (hw_lvl == NIX_TXSCH_LVL_CNT) {
1071 			lvlstr = "SQ";
1072 			schq = node->id;
1073 		} else {
1074 			lvlstr = nix_tm_hwlvl2str(node->hw_lvl);
1075 			schq = node->hw_id;
1076 		}
1077 
1078 		if (parent) {
1079 			parent_schq = parent->hw_id;
1080 			parent_lvlstr = nix_tm_hwlvl2str(parent->hw_lvl);
1081 		} else if (node->hw_lvl == NIX_TXSCH_LVL_TL1) {
1082 			parent_schq = nix->tx_link;
1083 			parent_lvlstr = "LINK";
1084 		} else {
1085 			parent_schq = node->parent_hw_id;
1086 			parent_lvlstr = nix_tm_hwlvl2str(node->hw_lvl + 1);
1087 		}
1088 
1089 		nix_dump(file, "\t(%p%s) %s_%d->%s_%d", node,
1090 			 node->child_realloc ? "[CR]" : "", lvlstr, schq,
1091 			 parent_lvlstr, parent_schq);
1092 
1093 		if (!(node->flags & NIX_TM_NODE_HWRES))
1094 			continue;
1095 
1096 		/* Need to dump TL1 when root is TL2 */
1097 		if (node->hw_lvl == nix->tm_root_lvl)
1098 			root = node;
1099 
1100 		/* Dump registers only when HWRES is present */
1101 		k = nix_tm_reg_dump_prep(node->hw_lvl, schq, nix->tx_link, reg,
1102 					 regstr);
1103 		if (!k)
1104 			continue;
1105 
1106 		req = mbox_alloc_msg_nix_txschq_cfg(mbox);
1107 		req->read = 1;
1108 		req->lvl = node->hw_lvl;
1109 		req->num_regs = k;
1110 		mbox_memcpy(req->reg, reg, sizeof(uint64_t) * k);
1111 		rc = mbox_process_msg(mbox, (void **)&rsp);
1112 		if (!rc) {
1113 			for (j = 0; j < k; j++)
1114 				nix_dump(file, "\t\t%s=0x%016" PRIx64, regstr[j],
1115 					 rsp->regval[j]);
1116 		} else {
1117 			nix_dump(file, "\t!!!Failed to dump registers!!!");
1118 		}
1119 	}
1120 
1121 	if (found)
1122 		nix_dump(file, "\n");
1123 
1124 	/* Dump TL1 node data when root level is TL2 */
1125 	if (root && root->hw_lvl == NIX_TXSCH_LVL_TL2) {
1126 		k = nix_tm_reg_dump_prep(NIX_TXSCH_LVL_TL1, root->parent_hw_id,
1127 					 nix->tx_link, reg, regstr);
1128 		if (!k)
1129 			return;
1130 
1131 		req = mbox_alloc_msg_nix_txschq_cfg(mbox);
1132 		req->read = 1;
1133 		req->lvl = NIX_TXSCH_LVL_TL1;
1134 		req->num_regs = k;
1135 		mbox_memcpy(req->reg, reg, sizeof(uint64_t) * k);
1136 		rc = mbox_process_msg(mbox, (void **)&rsp);
1137 		if (!rc) {
1138 			for (j = 0; j < k; j++)
1139 				nix_dump(file, "\t\t%s=0x%016" PRIx64, regstr[j],
1140 					 rsp->regval[j]);
1141 		} else {
1142 			nix_dump(file, "\t!!!Failed to dump registers!!!");
1143 		}
1144 		nix_dump(file, "\n");
1145 	}
1146 }
1147 
1148 void
1149 roc_nix_tm_dump(struct roc_nix *roc_nix, FILE *file)
1150 {
1151 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
1152 	struct dev *dev = &nix->dev;
1153 	uint8_t hw_lvl, i;
1154 
1155 	nix_dump(file, "===TM hierarchy and registers dump of %s (pf:vf) (%d:%d)===",
1156 		 nix->pci_dev->name, dev_get_pf(dev->pf_func),
1157 		 dev_get_vf(dev->pf_func));
1158 
1159 	/* Dump all trees */
1160 	for (i = 0; i < ROC_NIX_TM_TREE_MAX; i++) {
1161 		nix_dump(file, "\tTM %s:", nix_tm_tree2str(i));
1162 		for (hw_lvl = 0; hw_lvl <= NIX_TXSCH_LVL_CNT; hw_lvl++)
1163 			nix_tm_dump_lvl(nix, &nix->trees[i], hw_lvl);
1164 	}
1165 
1166 	/* Dump unused resources */
1167 	nix_dump(file, "\tTM unused resources:");
1168 	hw_lvl = NIX_TXSCH_LVL_SMQ;
1169 	for (; hw_lvl < NIX_TXSCH_LVL_CNT; hw_lvl++) {
1170 		nix_dump(file, "\t\ttxschq        %7s num = %d",
1171 			 nix_tm_hwlvl2str(hw_lvl),
1172 			 nix_tm_resource_avail(nix, hw_lvl, false));
1173 
1174 		nix_bitmap_dump(nix->schq_bmp[hw_lvl], file);
1175 		nix_dump(file, "\n");
1176 
1177 		nix_dump(file, "\t\ttxschq_contig %7s num = %d",
1178 			 nix_tm_hwlvl2str(hw_lvl),
1179 			 nix_tm_resource_avail(nix, hw_lvl, true));
1180 		nix_bitmap_dump(nix->schq_contig_bmp[hw_lvl], file);
1181 		nix_dump(file, "\n");
1182 	}
1183 }
1184 
1185 void
1186 roc_nix_dump(struct roc_nix *roc_nix, FILE *file)
1187 {
1188 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
1189 	struct dev *dev = &nix->dev;
1190 	int i;
1191 
1192 	nix_dump(file, "nix@%p", nix);
1193 	nix_dump(file, "  pf = %d", dev_get_pf(dev->pf_func));
1194 	nix_dump(file, "  vf = %d", dev_get_vf(dev->pf_func));
1195 	nix_dump(file, "  bar2 = 0x%" PRIx64, dev->bar2);
1196 	nix_dump(file, "  bar4 = 0x%" PRIx64, dev->bar4);
1197 	nix_dump(file, "  port_id = %d", roc_nix->port_id);
1198 	nix_dump(file, "  rss_tag_as_xor = %d", roc_nix->rss_tag_as_xor);
1199 	nix_dump(file, "  rss_tag_as_xor = %d", roc_nix->max_sqb_count);
1200 	nix_dump(file, "  outb_nb_desc = %u", roc_nix->outb_nb_desc);
1201 
1202 	nix_dump(file, "  \tpci_dev = %p", nix->pci_dev);
1203 	nix_dump(file, "  \tbase = 0x%" PRIxPTR "", nix->base);
1204 	nix_dump(file, "  \tlmt_base = 0x%" PRIxPTR "", nix->lmt_base);
1205 	nix_dump(file, "  \treta_size = %d", nix->reta_sz);
1206 	nix_dump(file, "  \ttx_chan_base = %d", nix->tx_chan_base);
1207 	nix_dump(file, "  \trx_chan_base = %d", nix->rx_chan_base);
1208 	nix_dump(file, "  \tnb_rx_queues = %d", nix->nb_rx_queues);
1209 	nix_dump(file, "  \tnb_tx_queues = %d", nix->nb_tx_queues);
1210 	nix_dump(file, "  \tlso_tsov6_idx = %d", nix->lso_tsov6_idx);
1211 	nix_dump(file, "  \tlso_tsov4_idx = %d", nix->lso_tsov4_idx);
1212 	nix_dump(file, "  \tlso_udp_tun_v4v4 = %d",
1213 		 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
1214 	nix_dump(file, "  \tlso_udp_tun_v4v6 = %d",
1215 		 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
1216 	nix_dump(file, "  \tlso_udp_tun_v6v4 = %d",
1217 		 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
1218 	nix_dump(file, "  \tlso_udp_tun_v6v6 = %d",
1219 		 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
1220 	nix_dump(file, "  \tlso_tun_v4v4 = %d",
1221 		 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
1222 	nix_dump(file, "  \tlso_tun_v4v6 = %d",
1223 		 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
1224 	nix_dump(file, "  \tlso_tun_v6v4 = %d",
1225 		 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
1226 	nix_dump(file, "  \tlso_tun_v6v6 = %d",
1227 		 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
1228 	nix_dump(file, "  \tlf_rx_stats = %d", nix->lf_rx_stats);
1229 	nix_dump(file, "  \tlf_tx_stats = %d", nix->lf_tx_stats);
1230 	nix_dump(file, "  \trx_chan_cnt = %d", nix->rx_chan_cnt);
1231 	nix_dump(file, "  \ttx_chan_cnt = %d", nix->tx_chan_cnt);
1232 	nix_dump(file, "  \tcgx_links = %d", nix->cgx_links);
1233 	nix_dump(file, "  \tlbk_links = %d", nix->lbk_links);
1234 	nix_dump(file, "  \tsdp_links = %d", nix->sdp_links);
1235 	nix_dump(file, "  \ttx_link = %d", nix->tx_link);
1236 	nix_dump(file, "  \tsqb_size = %d", nix->sqb_size);
1237 	nix_dump(file, "  \tmsixoff = %d", nix->msixoff);
1238 	for (i = 0; i < nix->nb_cpt_lf; i++)
1239 		nix_dump(file, "  \tcpt_msixoff[%d] = %d", i, nix->cpt_msixoff[i]);
1240 	nix_dump(file, "  \tcints = %d", nix->cints);
1241 	nix_dump(file, "  \tqints = %d", nix->qints);
1242 	nix_dump(file, "  \tsdp_link = %d", nix->sdp_link);
1243 	nix_dump(file, "  \tptp_en = %d", nix->ptp_en);
1244 	nix_dump(file, "  \trss_alg_idx = %d", nix->rss_alg_idx);
1245 	nix_dump(file, "  \ttx_pause = %d", nix->tx_pause);
1246 	nix_dump(file, "  \tinl_inb_ena = %d", nix->inl_inb_ena);
1247 	nix_dump(file, "  \tinl_outb_ena = %d", nix->inl_outb_ena);
1248 	nix_dump(file, "  \tinb_sa_base = 0x%p", nix->inb_sa_base);
1249 	nix_dump(file, "  \tinb_sa_sz = %" PRIu64, nix->inb_sa_sz);
1250 	nix_dump(file, "  \toutb_sa_base = 0x%p", nix->outb_sa_base);
1251 	nix_dump(file, "  \toutb_sa_sz = %" PRIu64, nix->outb_sa_sz);
1252 	nix_dump(file, "  \toutb_err_sso_pffunc = 0x%x", nix->outb_err_sso_pffunc);
1253 	nix_dump(file, "  \tcpt_lf_base = 0x%p", nix->cpt_lf_base);
1254 	nix_dump(file, "  \tnb_cpt_lf = %d", nix->nb_cpt_lf);
1255 	nix_dump(file, "  \tinb_inl_dev = %d", nix->inb_inl_dev);
1256 
1257 }
1258 
1259 void
1260 roc_nix_inl_dev_dump(struct roc_nix_inl_dev *roc_inl_dev, FILE *file)
1261 {
1262 	struct idev_cfg *idev = idev_get_cfg();
1263 	struct nix_inl_dev *inl_dev = NULL;
1264 	struct dev *dev = NULL;
1265 	int i;
1266 
1267 	if (roc_inl_dev) {
1268 		inl_dev = (struct nix_inl_dev *)&roc_inl_dev->reserved;
1269 	} else {
1270 		if (idev && idev->nix_inl_dev)
1271 			inl_dev = idev->nix_inl_dev;
1272 		else
1273 			return;
1274 	}
1275 
1276 	dev = &inl_dev->dev;
1277 	nix_dump(file, "nix_inl_dev@%p", inl_dev);
1278 	nix_dump(file, "  pf = %d", dev_get_pf(dev->pf_func));
1279 	nix_dump(file, "  vf = %d", dev_get_vf(dev->pf_func));
1280 	nix_dump(file, "  bar2 = 0x%" PRIx64, dev->bar2);
1281 	nix_dump(file, "  bar4 = 0x%" PRIx64, dev->bar4);
1282 
1283 	nix_dump(file, "  \tpci_dev = %p", inl_dev->pci_dev);
1284 	nix_dump(file, "  \tnix_base = 0x%" PRIxPTR "", inl_dev->nix_base);
1285 	nix_dump(file, "  \tsso_base = 0x%" PRIxPTR "", inl_dev->sso_base);
1286 	nix_dump(file, "  \tssow_base = 0x%" PRIxPTR "", inl_dev->ssow_base);
1287 	nix_dump(file, "  \tnix_msixoff = %d", inl_dev->nix_msixoff);
1288 	nix_dump(file, "  \tsso_msixoff = %d", inl_dev->sso_msixoff);
1289 	nix_dump(file, "  \tssow_msixoff = %d", inl_dev->ssow_msixoff);
1290 	nix_dump(file, "  \tnix_cints = %d", inl_dev->cints);
1291 	nix_dump(file, "  \tnix_qints = %d", inl_dev->qints);
1292 	nix_dump(file, "  \tinb_sa_base = 0x%p", inl_dev->inb_sa_base);
1293 	nix_dump(file, "  \tinb_sa_sz = %d", inl_dev->inb_sa_sz);
1294 	nix_dump(file, "  \txaq_buf_size = %u", inl_dev->xaq_buf_size);
1295 	nix_dump(file, "  \txae_waes = %u", inl_dev->xae_waes);
1296 	nix_dump(file, "  \tiue = %u", inl_dev->iue);
1297 	nix_dump(file, "  \txaq_aura = 0x%" PRIx64, inl_dev->xaq.aura_handle);
1298 	nix_dump(file, "  \txaq_mem = 0x%p", inl_dev->xaq.mem);
1299 
1300 	nix_dump(file, "  \tinl_dev_rq:");
1301 	for (i = 0; i < inl_dev->nb_rqs; i++)
1302 		roc_nix_rq_dump(&inl_dev->rqs[i], file);
1303 }
1304 
1305 void
1306 roc_nix_inl_outb_cpt_lfs_dump(struct roc_nix *roc_nix, FILE *file)
1307 {
1308 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
1309 	struct roc_cpt_lf *lf_base = nix->cpt_lf_base;
1310 	int i;
1311 
1312 	nix_dump(file, "nix@%p", nix);
1313 	for (i = 0; i < nix->nb_cpt_lf; i++) {
1314 		nix_dump(file, "NIX inline dev outbound CPT LFs:");
1315 		cpt_lf_print(&lf_base[i]);
1316 	}
1317 }
1318