xref: /linux/drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c (revision e1938b10fa26f39240f7400b3d2a77b38e0d2cbc)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Marvell RVU Admin Function driver
3  *
4  * Copyright (C) 2024 Marvell.
5  *
6  */
7 
8 #include <linux/fs.h>
9 #include <linux/debugfs.h>
10 #include <linux/module.h>
11 #include <linux/pci.h>
12 
13 #include "struct.h"
14 #include "rvu.h"
15 #include "debugfs.h"
16 #include "cn20k/reg.h"
17 #include "cn20k/npc.h"
18 
19 static int npc_mcam_layout_show(struct seq_file *s, void *unused)
20 {
21 	int i, j, sbd, idx0, idx1, vidx0, vidx1;
22 	struct npc_priv_t *npc_priv;
23 	char buf0[32], buf1[32];
24 	struct npc_subbank *sb;
25 	unsigned int bw0, bw1;
26 	bool v0, v1;
27 	int pf1, pf2;
28 	bool e0, e1;
29 	void *map;
30 
31 	npc_priv = s->private;
32 
33 	sbd = npc_priv->subbank_depth;
34 
35 	for (i = npc_priv->num_subbanks - 1; i >= 0; i--) {
36 		sb = &npc_priv->sb[i];
37 		mutex_lock(&sb->lock);
38 
39 		if (sb->flags & NPC_SUBBANK_FLAG_FREE)
40 			goto next;
41 
42 		bw0 = bitmap_weight(sb->b0map, npc_priv->subbank_depth);
43 		if (sb->key_type == NPC_MCAM_KEY_X4) {
44 			seq_printf(s, "\n\nsubbank:%u, x4, free=%u, used=%u\n",
45 				   sb->idx, sb->free_cnt, bw0);
46 
47 			for (j = sbd - 1; j >= 0; j--) {
48 				if (!test_bit(j, sb->b0map))
49 					continue;
50 
51 				idx0 = sb->b0b + j;
52 				map = xa_load(&npc_priv->xa_idx2pf_map, idx0);
53 				pf1 = xa_to_value(map);
54 
55 				map = xa_load(&npc_priv->xa_idx2vidx_map, idx0);
56 				if (map) {
57 					vidx0 = xa_to_value(map);
58 					snprintf(buf0, sizeof(buf0),
59 						 "v:%u", vidx0);
60 				}
61 
62 				seq_printf(s, "\t%u(%#x)%c %s\n", idx0, pf1,
63 					   test_bit(idx0, npc_priv->en_map) ? '+' : ' ',
64 					   map ? buf0 : " ");
65 			}
66 			goto next;
67 		}
68 
69 		bw1 = bitmap_weight(sb->b1map, npc_priv->subbank_depth);
70 		seq_printf(s, "\n\nsubbank:%u, x2, free=%u, used=%u\n",
71 			   sb->idx, sb->free_cnt, bw0 + bw1);
72 		seq_printf(s, "bank1(%u)\t\tbank0(%u)\n", bw1, bw0);
73 
74 		for (j = sbd - 1; j >= 0; j--) {
75 			e0 = test_bit(j, sb->b0map);
76 			e1 = test_bit(j, sb->b1map);
77 
78 			if (!e1 && !e0)
79 				continue;
80 
81 			if (e1 && e0) {
82 				idx0 = sb->b0b + j;
83 				map = xa_load(&npc_priv->xa_idx2pf_map, idx0);
84 				pf1 = xa_to_value(map);
85 
86 				map = xa_load(&npc_priv->xa_idx2vidx_map, idx0);
87 				v0 = !!map;
88 				if (v0) {
89 					vidx0 = xa_to_value(map);
90 					snprintf(buf0, sizeof(buf0), "v:%05u",
91 						 vidx0);
92 				}
93 
94 				idx1 = sb->b1b + j;
95 				map = xa_load(&npc_priv->xa_idx2pf_map, idx1);
96 				pf2 = xa_to_value(map);
97 
98 				map = xa_load(&npc_priv->xa_idx2vidx_map, idx1);
99 				v1 = !!map;
100 				if (v1) {
101 					vidx1 = xa_to_value(map);
102 					snprintf(buf1, sizeof(buf1), "v:%05u",
103 						 vidx1);
104 				}
105 
106 				seq_printf(s, "%05u(%#x)%c %s\t\t%05u(%#x)%c %s\n",
107 					   idx1, pf2,
108 					   test_bit(idx1, npc_priv->en_map) ? '+' : ' ',
109 					   v1 ? buf1 : "       ",
110 					   idx0, pf1,
111 					   test_bit(idx0, npc_priv->en_map) ? '+' : ' ',
112 					   v0 ? buf0 : "       ");
113 
114 				continue;
115 			}
116 
117 			if (e0) {
118 				idx0 = sb->b0b + j;
119 				map = xa_load(&npc_priv->xa_idx2pf_map, idx0);
120 				pf1 = xa_to_value(map);
121 
122 				map = xa_load(&npc_priv->xa_idx2vidx_map, idx0);
123 				if (map) {
124 					vidx0 = xa_to_value(map);
125 					snprintf(buf0, sizeof(buf0), "v:%05u",
126 						 vidx0);
127 				}
128 
129 				seq_printf(s, "\t\t   \t\t%05u(%#x)%c %s\n", idx0, pf1,
130 					   test_bit(idx0, npc_priv->en_map) ? '+' : ' ',
131 					   map ? buf0 : " ");
132 				continue;
133 			}
134 
135 			idx1 = sb->b1b + j;
136 			map = xa_load(&npc_priv->xa_idx2pf_map, idx1);
137 			pf1 = xa_to_value(map);
138 			map = xa_load(&npc_priv->xa_idx2vidx_map, idx1);
139 			if (map) {
140 				vidx1 = xa_to_value(map);
141 				snprintf(buf1, sizeof(buf1), "v:%05u", vidx1);
142 			}
143 
144 			seq_printf(s, "%05u(%#x)%c %s\n", idx1, pf1,
145 				   test_bit(idx1, npc_priv->en_map) ? '+' : ' ',
146 				   map ? buf1 : " ");
147 		}
148 next:
149 		mutex_unlock(&sb->lock);
150 	}
151 	return 0;
152 }
153 
154 DEFINE_SHOW_ATTRIBUTE(npc_mcam_layout);
155 
156 #define __OCTEONTX2_DEBUGFS_ATTRIBUTE_FOPS(__name)			\
157 static const struct file_operations __name ## _fops = {			\
158 	.owner = THIS_MODULE,						\
159 	.open = __name ## _open,					\
160 	.read = seq_read,						\
161 	.llseek = seq_lseek,						\
162 	.release = single_release,					\
163 }
164 
165 #define DEFINE_OCTEONTX2_DEBUGFS_ATTRIBUTE_WITH_SIZE(__name, __size)		\
166 static int __name ## _open(struct inode *inode, struct file *file)		\
167 {										\
168 	return single_open_size(file, __name ## _show, inode->i_private,	\
169 				__size);					\
170 }										\
171 __OCTEONTX2_DEBUGFS_ATTRIBUTE_FOPS(__name)
172 
173 static DEFINE_MUTEX(stats_lock);
174 
175 /* MAX_NUM_BANKS, MAX_SUBBANK_DEPTH and MAX_NUM_SUB_BANKS represent
176  * hard limit on all silicon variants, preventing any possibility of
177  * out-of-bounds access.
178  */
179 static u64 (*dstats)[MAX_NUM_BANKS][MAX_SUBBANK_DEPTH * MAX_NUM_SUB_BANKS];
180 
181 static int npc_mcam_dstats_show(struct seq_file *s, void *unused)
182 {
183 	struct npc_priv_t *npc_priv;
184 	int blkaddr, pf, mcam_idx;
185 	u64 stats, delta;
186 	struct rvu *rvu;
187 	char buff[64];
188 	u8 key_type;
189 	void *map;
190 
191 	npc_priv = npc_priv_get();
192 	rvu = s->private;
193 	blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
194 	if (blkaddr < 0)
195 		return 0;
196 
197 	mutex_lock(&stats_lock);
198 	seq_puts(s, "idx\tpfunc\tstats\n");
199 	for (int bank = npc_priv->num_banks - 1; bank >= 0; bank--) {
200 		for (int idx = npc_priv->bank_depth - 1; idx >= 0; idx--) {
201 			mcam_idx = bank * npc_priv->bank_depth + idx;
202 
203 			if (npc_mcam_idx_2_key_type(rvu, mcam_idx, &key_type))
204 				continue;
205 
206 			if (key_type == NPC_MCAM_KEY_X4 && bank != 0)
207 				continue;
208 
209 			if (!test_bit(mcam_idx, npc_priv->en_map))
210 				continue;
211 
212 			stats = rvu_read64(rvu, blkaddr,
213 					   NPC_AF_CN20K_MCAMEX_BANKX_STAT_EXT(idx, bank));
214 			if (!stats)
215 				continue;
216 			if (stats == dstats[0][bank][idx])
217 				continue;
218 
219 			if (stats < dstats[0][bank][idx])
220 				dstats[0][bank][idx] = 0;
221 
222 			pf = 0xFFFF;
223 			map = xa_load(&npc_priv->xa_idx2pf_map, mcam_idx);
224 			if (map)
225 				pf = xa_to_value(map);
226 
227 			delta = stats - dstats[0][bank][idx];
228 
229 			snprintf(buff, sizeof(buff), "%u\t%#04x\t%llu\n",
230 				 mcam_idx, pf, delta);
231 			seq_puts(s, buff);
232 
233 			dstats[0][bank][idx] = stats;
234 		}
235 	}
236 
237 	mutex_unlock(&stats_lock);
238 	return 0;
239 }
240 
241 /*  "%u\t%#04x\t%llu\n" needs less than 64 characters to print */
242 #define TOTAL_SZ (MAX_NUM_BANKS * MAX_NUM_SUB_BANKS * MAX_SUBBANK_DEPTH * 64)
243 DEFINE_OCTEONTX2_DEBUGFS_ATTRIBUTE_WITH_SIZE(npc_mcam_dstats, TOTAL_SZ);
244 
245 static int npc_mcam_mismatch_show(struct seq_file *s, void *unused)
246 {
247 	struct npc_priv_t *npc_priv;
248 	struct npc_subbank *sb;
249 	int mcam_idx, sb_off;
250 	struct rvu *rvu;
251 	char buff[64];
252 	void *map;
253 	int rc;
254 
255 	npc_priv = npc_priv_get();
256 	rvu = s->private;
257 
258 	seq_puts(s, "index\tsb idx\tkw type\n");
259 	for (int bank = npc_priv->num_banks - 1; bank >= 0; bank--) {
260 		for (int idx = npc_priv->bank_depth - 1; idx >= 0; idx--) {
261 			mcam_idx = bank * npc_priv->bank_depth + idx;
262 
263 			if (!test_bit(mcam_idx, npc_priv->en_map))
264 				continue;
265 
266 			map = xa_load(&npc_priv->xa_idx2pf_map, mcam_idx);
267 			if (map)
268 				continue;
269 
270 			rc = npc_mcam_idx_2_subbank_idx(rvu, mcam_idx,
271 							&sb, &sb_off);
272 			if (rc)
273 				continue;
274 
275 			snprintf(buff, sizeof(buff), "%u\t%d\t%u\n",
276 				 mcam_idx, sb->idx, sb->key_type);
277 
278 			seq_puts(s, buff);
279 		}
280 	}
281 	return 0;
282 }
283 
284 /* "%u\t%d\t%u\n" needs less than 64 characters to print. */
285 DEFINE_OCTEONTX2_DEBUGFS_ATTRIBUTE_WITH_SIZE(npc_mcam_mismatch, TOTAL_SZ);
286 
287 static int npc_mcam_default_show(struct seq_file *s, void *unused)
288 {
289 	struct npc_priv_t *npc_priv;
290 	unsigned long index;
291 	u16 ptr[4], pcifunc;
292 	struct rvu *rvu;
293 	int rc, i;
294 	void *map;
295 
296 	npc_priv = npc_priv_get();
297 	rvu = s->private;
298 
299 	seq_puts(s, "\npcifunc\tBcast\tmcast\tpromisc\tucast\n");
300 
301 	xa_for_each(&npc_priv->xa_pf_map, index, map) {
302 		pcifunc = index;
303 
304 		for (i = 0; i < ARRAY_SIZE(ptr); i++)
305 			ptr[i] = USHRT_MAX;
306 
307 		rc = npc_cn20k_dft_rules_idx_get(rvu, pcifunc, &ptr[0],
308 						 &ptr[1], &ptr[2], &ptr[3]);
309 		if (rc)
310 			continue;
311 
312 		seq_printf(s, "%#x\t", pcifunc);
313 		for (i = 0; i < ARRAY_SIZE(ptr); i++) {
314 			if (ptr[i] != USHRT_MAX)
315 				seq_printf(s, "%u\t", ptr[i]);
316 			else
317 				seq_puts(s, "\t");
318 		}
319 		seq_puts(s, "\n");
320 	}
321 
322 	return 0;
323 }
324 DEFINE_SHOW_ATTRIBUTE(npc_mcam_default);
325 
326 static int npc_vidx2idx_map_show(struct seq_file *s, void *unused)
327 {
328 	struct npc_priv_t *npc_priv;
329 	unsigned long index, start;
330 	struct xarray *xa;
331 	void *map;
332 
333 	npc_priv = s->private;
334 	start = npc_priv->bank_depth * 2;
335 	xa = &npc_priv->xa_vidx2idx_map;
336 
337 	seq_puts(s, "\nvidx\tmcam_idx\n");
338 
339 	xa_for_each_start(xa, index, map, start)
340 		seq_printf(s, "%lu\t%lu\n", index, xa_to_value(map));
341 	return 0;
342 }
343 DEFINE_SHOW_ATTRIBUTE(npc_vidx2idx_map);
344 
345 static int npc_idx2vidx_map_show(struct seq_file *s, void *unused)
346 {
347 	struct npc_priv_t *npc_priv;
348 	unsigned long index;
349 	struct xarray *xa;
350 	void *map;
351 
352 	npc_priv = s->private;
353 	xa = &npc_priv->xa_idx2vidx_map;
354 
355 	seq_puts(s, "\nmidx\tvidx\n");
356 
357 	xa_for_each(xa, index, map)
358 		seq_printf(s, "%lu\t%lu\n", index, xa_to_value(map));
359 	return 0;
360 }
361 DEFINE_SHOW_ATTRIBUTE(npc_idx2vidx_map);
362 
363 static int npc_defrag_show(struct seq_file *s, void *unused)
364 {
365 	struct npc_defrag_show_node *node;
366 	struct npc_priv_t *npc_priv;
367 	u16 sbd, bdm;
368 
369 	npc_priv = s->private;
370 	bdm = npc_priv->bank_depth - 1;
371 	sbd = npc_priv->subbank_depth;
372 
373 	seq_puts(s, "\nold(sb)   ->    new(sb)\t\tvidx\n");
374 
375 	mutex_lock(&npc_priv->lock);
376 	list_for_each_entry(node, &npc_priv->defrag_lh, list)
377 		seq_printf(s, "%u(%u)\t%u(%u)\t%u\n", node->old_midx,
378 			   (node->old_midx & bdm) / sbd,
379 			   node->new_midx,
380 			   (node->new_midx & bdm) / sbd,
381 			   node->vidx);
382 	mutex_unlock(&npc_priv->lock);
383 	return 0;
384 }
385 
386 DEFINE_SHOW_ATTRIBUTE(npc_defrag);
387 
388 int npc_cn20k_debugfs_init(struct rvu *rvu)
389 {
390 	struct npc_priv_t *npc_priv = npc_priv_get();
391 
392 	debugfs_create_file("mcam_layout", 0444, rvu->rvu_dbg.npc,
393 			    npc_priv, &npc_mcam_layout_fops);
394 
395 	debugfs_create_file("mcam_default", 0444, rvu->rvu_dbg.npc,
396 			    rvu, &npc_mcam_default_fops);
397 
398 	debugfs_create_file("vidx2idx", 0444, rvu->rvu_dbg.npc,
399 			    npc_priv, &npc_vidx2idx_map_fops);
400 
401 	dstats = devm_kzalloc(rvu->dev, sizeof(*dstats), GFP_KERNEL);
402 	if (!dstats)
403 		return -ENOMEM;
404 
405 	debugfs_create_file("dstats", 0444, rvu->rvu_dbg.npc, rvu,
406 			    &npc_mcam_dstats_fops);
407 
408 	debugfs_create_file("mismatch", 0444, rvu->rvu_dbg.npc, rvu,
409 			    &npc_mcam_mismatch_fops);
410 
411 	debugfs_create_file("idx2vidx", 0444, rvu->rvu_dbg.npc,
412 			    npc_priv, &npc_idx2vidx_map_fops);
413 
414 	debugfs_create_file("defrag", 0444, rvu->rvu_dbg.npc,
415 			    npc_priv, &npc_defrag_fops);
416 
417 	return 0;
418 }
419 
420 void npc_cn20k_debugfs_deinit(struct rvu *rvu)
421 {
422 	debugfs_remove_recursive(rvu->rvu_dbg.npc);
423 }
424 
425 void print_nix_cn20k_sq_ctx(struct seq_file *m,
426 			    struct nix_cn20k_sq_ctx_s *sq_ctx)
427 {
428 	seq_printf(m, "W0: ena \t\t\t%d\nW0: qint_idx \t\t\t%d\n",
429 		   sq_ctx->ena, sq_ctx->qint_idx);
430 	seq_printf(m, "W0: substream \t\t\t0x%03x\nW0: sdp_mcast \t\t\t%d\n",
431 		   sq_ctx->substream, sq_ctx->sdp_mcast);
432 	seq_printf(m, "W0: cq \t\t\t\t%d\nW0: sqe_way_mask \t\t%d\n\n",
433 		   sq_ctx->cq, sq_ctx->sqe_way_mask);
434 
435 	seq_printf(m, "W1: smq \t\t\t%d\nW1: cq_ena \t\t\t%d\nW1: xoff\t\t\t%d\n",
436 		   sq_ctx->smq, sq_ctx->cq_ena, sq_ctx->xoff);
437 	seq_printf(m, "W1: sso_ena \t\t\t%d\nW1: smq_rr_weight\t\t%d\n",
438 		   sq_ctx->sso_ena, sq_ctx->smq_rr_weight);
439 	seq_printf(m, "W1: default_chan\t\t%d\nW1: sqb_count\t\t\t%d\n\n",
440 		   sq_ctx->default_chan, sq_ctx->sqb_count);
441 
442 	seq_printf(m, "W1: smq_rr_count_lb \t\t%d\n", sq_ctx->smq_rr_count_lb);
443 	seq_printf(m, "W2: smq_rr_count_ub \t\t%d\n", sq_ctx->smq_rr_count_ub);
444 	seq_printf(m, "W2: sqb_aura \t\t\t%d\nW2: sq_int \t\t\t%d\n",
445 		   sq_ctx->sqb_aura, sq_ctx->sq_int);
446 	seq_printf(m, "W2: sq_int_ena \t\t\t%d\nW2: sqe_stype \t\t\t%d\n",
447 		   sq_ctx->sq_int_ena, sq_ctx->sqe_stype);
448 
449 	seq_printf(m, "W3: max_sqe_size\t\t%d\nW3: cq_limit\t\t\t%d\n",
450 		   sq_ctx->max_sqe_size, sq_ctx->cq_limit);
451 	seq_printf(m, "W3: lmt_dis \t\t\t%d\nW3: mnq_dis \t\t\t%d\n",
452 		   sq_ctx->lmt_dis, sq_ctx->mnq_dis);
453 	seq_printf(m, "W3: smq_next_sq\t\t\t%d\nW3: smq_lso_segnum\t\t%d\n",
454 		   sq_ctx->smq_next_sq, sq_ctx->smq_lso_segnum);
455 	seq_printf(m, "W3: tail_offset \t\t%d\nW3: smenq_offset\t\t%d\n",
456 		   sq_ctx->tail_offset, sq_ctx->smenq_offset);
457 	seq_printf(m, "W3: head_offset\t\t\t%d\nW3: smenq_next_sqb_vld\t\t%d\n\n",
458 		   sq_ctx->head_offset, sq_ctx->smenq_next_sqb_vld);
459 
460 	seq_printf(m, "W3: smq_next_sq_vld\t\t%d\nW3: smq_pend\t\t\t%d\n",
461 		   sq_ctx->smq_next_sq_vld, sq_ctx->smq_pend);
462 	seq_printf(m, "W4: next_sqb \t\t\t%llx\n\n", sq_ctx->next_sqb);
463 	seq_printf(m, "W5: tail_sqb \t\t\t%llx\n\n", sq_ctx->tail_sqb);
464 	seq_printf(m, "W6: smenq_sqb \t\t\t%llx\n\n", sq_ctx->smenq_sqb);
465 	seq_printf(m, "W7: smenq_next_sqb \t\t%llx\n\n",
466 		   sq_ctx->smenq_next_sqb);
467 
468 	seq_printf(m, "W8: head_sqb\t\t\t%llx\n\n", sq_ctx->head_sqb);
469 
470 	seq_printf(m, "W9: vfi_lso_total\t\t%d\n", sq_ctx->vfi_lso_total);
471 	seq_printf(m, "W9: vfi_lso_sizem1\t\t%d\nW9: vfi_lso_sb\t\t\t%d\n",
472 		   sq_ctx->vfi_lso_sizem1, sq_ctx->vfi_lso_sb);
473 	seq_printf(m, "W9: vfi_lso_mps\t\t\t%d\nW9: vfi_lso_vlan0_ins_ena\t%d\n",
474 		   sq_ctx->vfi_lso_mps, sq_ctx->vfi_lso_vlan0_ins_ena);
475 	seq_printf(m, "W9: vfi_lso_vlan1_ins_ena\t%d\nW9: vfi_lso_vld \t\t%d\n\n",
476 		   sq_ctx->vfi_lso_vld, sq_ctx->vfi_lso_vlan1_ins_ena);
477 
478 	seq_printf(m, "W10: scm_lso_rem \t\t%llu\n\n",
479 		   (u64)sq_ctx->scm_lso_rem);
480 	seq_printf(m, "W11: octs \t\t\t%llu\n\n", (u64)sq_ctx->octs);
481 	seq_printf(m, "W12: pkts \t\t\t%llu\n\n", (u64)sq_ctx->pkts);
482 	seq_printf(m, "W13: aged_drop_octs \t\t\t%llu\n\n",
483 		   (u64)sq_ctx->aged_drop_octs);
484 	seq_printf(m, "W13: aged_drop_pkts \t\t\t%llu\n\n",
485 		   (u64)sq_ctx->aged_drop_pkts);
486 	seq_printf(m, "W14: dropped_octs \t\t%llu\n\n",
487 		   (u64)sq_ctx->dropped_octs);
488 	seq_printf(m, "W15: dropped_pkts \t\t%llu\n\n",
489 		   (u64)sq_ctx->dropped_pkts);
490 }
491 
492 void print_nix_cn20k_cq_ctx(struct seq_file *m,
493 			    struct nix_cn20k_aq_enq_rsp *rsp)
494 {
495 	struct nix_cn20k_cq_ctx_s *cq_ctx = &rsp->cq;
496 
497 	seq_printf(m, "W0: base \t\t\t%llx\n\n", cq_ctx->base);
498 
499 	seq_printf(m, "W1: wrptr \t\t\t%llx\n", (u64)cq_ctx->wrptr);
500 	seq_printf(m, "W1: avg_con \t\t\t%d\nW1: cint_idx \t\t\t%d\n",
501 		   cq_ctx->avg_con, cq_ctx->cint_idx);
502 	seq_printf(m, "W1: cq_err \t\t\t%d\nW1: qint_idx \t\t\t%d\n",
503 		   cq_ctx->cq_err, cq_ctx->qint_idx);
504 	seq_printf(m, "W1: bpid \t\t\t%d\nW1: bp_ena \t\t\t%d\n\n",
505 		   cq_ctx->bpid, cq_ctx->bp_ena);
506 
507 	seq_printf(m, "W1: lbpid_high \t\t\t0x%03x\n", cq_ctx->lbpid_high);
508 	seq_printf(m, "W1: lbpid_med \t\t\t0x%03x\n", cq_ctx->lbpid_med);
509 	seq_printf(m, "W1: lbpid_low \t\t\t0x%03x\n", cq_ctx->lbpid_low);
510 	seq_printf(m, "(W1: lbpid) \t\t\t0x%03x\n",
511 		   cq_ctx->lbpid_high << 6 | cq_ctx->lbpid_med << 3 |
512 		   cq_ctx->lbpid_low);
513 	seq_printf(m, "W1: lbp_ena \t\t\t\t%d\n\n", cq_ctx->lbp_ena);
514 
515 	seq_printf(m, "W2: update_time \t\t%d\nW2:avg_level \t\t\t%d\n",
516 		   cq_ctx->update_time, cq_ctx->avg_level);
517 	seq_printf(m, "W2: head \t\t\t%d\nW2:tail \t\t\t%d\n\n",
518 		   cq_ctx->head, cq_ctx->tail);
519 
520 	seq_printf(m, "W3: cq_err_int_ena \t\t%d\nW3:cq_err_int \t\t\t%d\n",
521 		   cq_ctx->cq_err_int_ena, cq_ctx->cq_err_int);
522 	seq_printf(m, "W3: qsize \t\t\t%d\nW3:stashing \t\t\t%d\n",
523 		   cq_ctx->qsize, cq_ctx->stashing);
524 
525 	seq_printf(m, "W3: caching \t\t\t%d\n", cq_ctx->caching);
526 	seq_printf(m, "W3: lbp_frac \t\t\t%d\n", cq_ctx->lbp_frac);
527 	seq_printf(m, "W3: stash_thresh \t\t\t%d\n",
528 		   cq_ctx->stash_thresh);
529 
530 	seq_printf(m, "W3: msh_valid \t\t\t%d\nW3:msh_dst \t\t\t%d\n",
531 		   cq_ctx->msh_valid, cq_ctx->msh_dst);
532 
533 	seq_printf(m, "W3: cpt_drop_err_en \t\t\t%d\n",
534 		   cq_ctx->cpt_drop_err_en);
535 	seq_printf(m, "W3: ena \t\t\t%d\n",
536 		   cq_ctx->ena);
537 	seq_printf(m, "W3: drop_ena \t\t\t%d\nW3: drop \t\t\t%d\n",
538 		   cq_ctx->drop_ena, cq_ctx->drop);
539 	seq_printf(m, "W3: bp \t\t\t\t%d\n\n", cq_ctx->bp);
540 
541 	seq_printf(m, "W4: lbpid_ext \t\t\t\t%d\n\n", cq_ctx->lbpid_ext);
542 	seq_printf(m, "W4: bpid_ext \t\t\t\t%d\n\n", cq_ctx->bpid_ext);
543 }
544 
545 void print_npa_cn20k_aura_ctx(struct seq_file *m,
546 			      struct npa_cn20k_aq_enq_rsp *rsp)
547 {
548 	struct npa_cn20k_aura_s *aura = &rsp->aura;
549 
550 	seq_printf(m, "W0: Pool addr\t\t%llx\n", aura->pool_addr);
551 
552 	seq_printf(m, "W1: ena\t\t\t%d\nW1: pool caching\t%d\n",
553 		   aura->ena, aura->pool_caching);
554 	seq_printf(m, "W1: avg con\t\t%d\n", aura->avg_con);
555 	seq_printf(m, "W1: pool drop ena\t%d\nW1: aura drop ena\t%d\n",
556 		   aura->pool_drop_ena, aura->aura_drop_ena);
557 	seq_printf(m, "W1: bp_ena\t\t%d\nW1: aura drop\t\t%d\n",
558 		   aura->bp_ena, aura->aura_drop);
559 	seq_printf(m, "W1: aura shift\t\t%d\nW1: avg_level\t\t%d\n",
560 		   aura->shift, aura->avg_level);
561 
562 	seq_printf(m, "W2: count\t\t%llu\nW2: nix_bpid\t\t%d\n",
563 		   (u64)aura->count, aura->bpid);
564 
565 	seq_printf(m, "W3: limit\t\t%llu\nW3: bp\t\t\t%d\nW3: fc_ena\t\t%d\n",
566 		   (u64)aura->limit, aura->bp, aura->fc_ena);
567 
568 	seq_printf(m, "W3: fc_up_crossing\t%d\nW3: fc_stype\t\t%d\n",
569 		   aura->fc_up_crossing, aura->fc_stype);
570 	seq_printf(m, "W3: fc_hyst_bits\t%d\n", aura->fc_hyst_bits);
571 
572 	seq_printf(m, "W4: fc_addr\t\t%llx\n", aura->fc_addr);
573 
574 	seq_printf(m, "W5: pool_drop\t\t%d\nW5: update_time\t\t%d\n",
575 		   aura->pool_drop, aura->update_time);
576 	seq_printf(m, "W5: err_int \t\t%d\nW5: err_int_ena\t\t%d\n",
577 		   aura->err_int, aura->err_int_ena);
578 	seq_printf(m, "W5: thresh_int\t\t%d\nW5: thresh_int_ena \t%d\n",
579 		   aura->thresh_int, aura->thresh_int_ena);
580 	seq_printf(m, "W5: thresh_up\t\t%d\nW5: thresh_qint_idx\t%d\n",
581 		   aura->thresh_up, aura->thresh_qint_idx);
582 	seq_printf(m, "W5: err_qint_idx \t%d\n", aura->err_qint_idx);
583 
584 	seq_printf(m, "W6: thresh\t\t%llu\n", (u64)aura->thresh);
585 	seq_printf(m, "W6: fc_msh_dst\t\t%d\n", aura->fc_msh_dst);
586 }
587 
588 void print_npa_cn20k_pool_ctx(struct seq_file *m,
589 			      struct npa_cn20k_aq_enq_rsp *rsp)
590 {
591 	struct npa_cn20k_pool_s *pool = &rsp->pool;
592 
593 	seq_printf(m, "W0: Stack base\t\t%llx\n", pool->stack_base);
594 
595 	seq_printf(m, "W1: ena \t\t%d\nW1: nat_align \t\t%d\n",
596 		   pool->ena, pool->nat_align);
597 	seq_printf(m, "W1: stack_caching\t%d\n",
598 		   pool->stack_caching);
599 	seq_printf(m, "W1: buf_offset\t\t%d\nW1: buf_size\t\t%d\n",
600 		   pool->buf_offset, pool->buf_size);
601 
602 	seq_printf(m, "W2: stack_max_pages \t%d\nW2: stack_pages\t\t%d\n",
603 		   pool->stack_max_pages, pool->stack_pages);
604 
605 	seq_printf(m, "W4: stack_offset\t%d\nW4: shift\t\t%d\nW4: avg_level\t\t%d\n",
606 		   pool->stack_offset, pool->shift, pool->avg_level);
607 	seq_printf(m, "W4: avg_con \t\t%d\nW4: fc_ena\t\t%d\nW4: fc_stype\t\t%d\n",
608 		   pool->avg_con, pool->fc_ena, pool->fc_stype);
609 	seq_printf(m, "W4: fc_hyst_bits\t%d\nW4: fc_up_crossing\t%d\n",
610 		   pool->fc_hyst_bits, pool->fc_up_crossing);
611 	seq_printf(m, "W4: update_time\t\t%d\n", pool->update_time);
612 
613 	seq_printf(m, "W5: fc_addr\t\t%llx\n", pool->fc_addr);
614 
615 	seq_printf(m, "W6: ptr_start\t\t%llx\n", pool->ptr_start);
616 
617 	seq_printf(m, "W7: ptr_end\t\t%llx\n", pool->ptr_end);
618 
619 	seq_printf(m, "W8: err_int\t\t%d\nW8: err_int_ena\t\t%d\n",
620 		   pool->err_int, pool->err_int_ena);
621 	seq_printf(m, "W8: thresh_int\t\t%d\n", pool->thresh_int);
622 	seq_printf(m, "W8: thresh_int_ena\t%d\nW8: thresh_up\t\t%d\n",
623 		   pool->thresh_int_ena, pool->thresh_up);
624 	seq_printf(m, "W8: thresh_qint_idx\t%d\nW8: err_qint_idx\t%d\n",
625 		   pool->thresh_qint_idx, pool->err_qint_idx);
626 	seq_printf(m, "W8: fc_msh_dst\t\t%d\n", pool->fc_msh_dst);
627 }
628