xref: /dpdk/drivers/common/cnxk/cnxk_telemetry_nix.c (revision db5744d3cd23c485c506bc2a35e91132b1eb9ed0)
1af75aac7SGowrishankar Muthukrishnan /* SPDX-License-Identifier: BSD-3-Clause
2af75aac7SGowrishankar Muthukrishnan  * Copyright(C) 2021 Marvell.
3af75aac7SGowrishankar Muthukrishnan  */
4af75aac7SGowrishankar Muthukrishnan 
572b452c5SDmitry Kozlyuk #include <ctype.h>
6af75aac7SGowrishankar Muthukrishnan #include "cnxk_telemetry.h"
7af75aac7SGowrishankar Muthukrishnan #include "roc_api.h"
8af75aac7SGowrishankar Muthukrishnan #include "roc_priv.h"
9af75aac7SGowrishankar Muthukrishnan 
10af75aac7SGowrishankar Muthukrishnan struct nix_tel_node {
11af75aac7SGowrishankar Muthukrishnan 	TAILQ_ENTRY(nix_tel_node) node;
12af75aac7SGowrishankar Muthukrishnan 	struct roc_nix *nix;
13af75aac7SGowrishankar Muthukrishnan 	uint16_t n_rq;
14af75aac7SGowrishankar Muthukrishnan 	uint16_t n_cq;
15af75aac7SGowrishankar Muthukrishnan 	uint16_t n_sq;
16af75aac7SGowrishankar Muthukrishnan 	struct roc_nix_rq **rqs;
17af75aac7SGowrishankar Muthukrishnan 	struct roc_nix_cq **cqs;
18af75aac7SGowrishankar Muthukrishnan 	struct roc_nix_sq **sqs;
19af75aac7SGowrishankar Muthukrishnan };
20af75aac7SGowrishankar Muthukrishnan 
21af75aac7SGowrishankar Muthukrishnan TAILQ_HEAD(nix_tel_node_list, nix_tel_node);
22af75aac7SGowrishankar Muthukrishnan static struct nix_tel_node_list nix_list;
23af75aac7SGowrishankar Muthukrishnan 
24af75aac7SGowrishankar Muthukrishnan static struct nix_tel_node *
25af75aac7SGowrishankar Muthukrishnan nix_tel_node_get(struct roc_nix *roc_nix)
26af75aac7SGowrishankar Muthukrishnan {
27af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node, *roc_node = NULL;
28af75aac7SGowrishankar Muthukrishnan 
29af75aac7SGowrishankar Muthukrishnan 	TAILQ_FOREACH(node, &nix_list, node) {
30af75aac7SGowrishankar Muthukrishnan 		if (node->nix == roc_nix) {
31af75aac7SGowrishankar Muthukrishnan 			roc_node = node;
32af75aac7SGowrishankar Muthukrishnan 			break;
33af75aac7SGowrishankar Muthukrishnan 		}
34af75aac7SGowrishankar Muthukrishnan 	}
35af75aac7SGowrishankar Muthukrishnan 
36af75aac7SGowrishankar Muthukrishnan 	return roc_node;
37af75aac7SGowrishankar Muthukrishnan }
38af75aac7SGowrishankar Muthukrishnan 
39af75aac7SGowrishankar Muthukrishnan int
40af75aac7SGowrishankar Muthukrishnan nix_tel_node_add(struct roc_nix *roc_nix)
41af75aac7SGowrishankar Muthukrishnan {
42af75aac7SGowrishankar Muthukrishnan 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
43af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node;
44af75aac7SGowrishankar Muthukrishnan 
45af75aac7SGowrishankar Muthukrishnan 	node = nix_tel_node_get(roc_nix);
46af75aac7SGowrishankar Muthukrishnan 	if (node) {
47af75aac7SGowrishankar Muthukrishnan 		if (nix->nb_rx_queues == node->n_rq &&
48af75aac7SGowrishankar Muthukrishnan 		    nix->nb_tx_queues == node->n_sq)
49af75aac7SGowrishankar Muthukrishnan 			return 0;
50af75aac7SGowrishankar Muthukrishnan 
51af75aac7SGowrishankar Muthukrishnan 		nix_tel_node_del(roc_nix);
52af75aac7SGowrishankar Muthukrishnan 	}
53af75aac7SGowrishankar Muthukrishnan 
54af75aac7SGowrishankar Muthukrishnan 	node = plt_zmalloc(sizeof(struct nix_tel_node), 0);
55af75aac7SGowrishankar Muthukrishnan 	if (!node)
56af75aac7SGowrishankar Muthukrishnan 		return -1;
57af75aac7SGowrishankar Muthukrishnan 
58af75aac7SGowrishankar Muthukrishnan 	node->nix = roc_nix;
59af75aac7SGowrishankar Muthukrishnan 	node->rqs =
60af75aac7SGowrishankar Muthukrishnan 		plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_rq *), 0);
61af75aac7SGowrishankar Muthukrishnan 	node->cqs =
62af75aac7SGowrishankar Muthukrishnan 		plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_cq *), 0);
63af75aac7SGowrishankar Muthukrishnan 	node->sqs =
64af75aac7SGowrishankar Muthukrishnan 		plt_zmalloc(nix->nb_tx_queues * sizeof(struct roc_nix_sq *), 0);
65af75aac7SGowrishankar Muthukrishnan 	TAILQ_INSERT_TAIL(&nix_list, node, node);
66af75aac7SGowrishankar Muthukrishnan 
67af75aac7SGowrishankar Muthukrishnan 	return 0;
68af75aac7SGowrishankar Muthukrishnan }
69af75aac7SGowrishankar Muthukrishnan 
70af75aac7SGowrishankar Muthukrishnan void
71af75aac7SGowrishankar Muthukrishnan nix_tel_node_del(struct roc_nix *roc_nix)
72af75aac7SGowrishankar Muthukrishnan {
73af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node;
74af75aac7SGowrishankar Muthukrishnan 
75af75aac7SGowrishankar Muthukrishnan 	TAILQ_FOREACH(node, &nix_list, node) {
76af75aac7SGowrishankar Muthukrishnan 		if (node->nix == roc_nix) {
77af75aac7SGowrishankar Muthukrishnan 			plt_free(node->rqs);
78af75aac7SGowrishankar Muthukrishnan 			plt_free(node->cqs);
79af75aac7SGowrishankar Muthukrishnan 			plt_free(node->sqs);
80af75aac7SGowrishankar Muthukrishnan 			TAILQ_REMOVE(&nix_list, node, node);
81af75aac7SGowrishankar Muthukrishnan 		}
82af75aac7SGowrishankar Muthukrishnan 	}
83af75aac7SGowrishankar Muthukrishnan 
84af75aac7SGowrishankar Muthukrishnan 	plt_free(node);
85af75aac7SGowrishankar Muthukrishnan }
86af75aac7SGowrishankar Muthukrishnan 
87af75aac7SGowrishankar Muthukrishnan static struct nix_tel_node *
88af75aac7SGowrishankar Muthukrishnan nix_tel_node_get_by_pcidev_name(const char *name)
89af75aac7SGowrishankar Muthukrishnan {
90af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node, *roc_node = NULL;
91af75aac7SGowrishankar Muthukrishnan 
92af75aac7SGowrishankar Muthukrishnan 	TAILQ_FOREACH(node, &nix_list, node) {
93af75aac7SGowrishankar Muthukrishnan 		if (!strncmp(node->nix->pci_dev->name, name,
94af75aac7SGowrishankar Muthukrishnan 			     PCI_PRI_STR_SIZE)) {
95af75aac7SGowrishankar Muthukrishnan 			roc_node = node;
96af75aac7SGowrishankar Muthukrishnan 			break;
97af75aac7SGowrishankar Muthukrishnan 		}
98af75aac7SGowrishankar Muthukrishnan 	}
99af75aac7SGowrishankar Muthukrishnan 
100af75aac7SGowrishankar Muthukrishnan 	return roc_node;
101af75aac7SGowrishankar Muthukrishnan }
102af75aac7SGowrishankar Muthukrishnan 
103af75aac7SGowrishankar Muthukrishnan int
104af75aac7SGowrishankar Muthukrishnan nix_tel_node_add_rq(struct roc_nix_rq *rq)
105af75aac7SGowrishankar Muthukrishnan {
106af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node;
107af75aac7SGowrishankar Muthukrishnan 
108af75aac7SGowrishankar Muthukrishnan 	node = nix_tel_node_get(rq->roc_nix);
109af75aac7SGowrishankar Muthukrishnan 	if (!node)
110af75aac7SGowrishankar Muthukrishnan 		return -1;
111af75aac7SGowrishankar Muthukrishnan 
112af75aac7SGowrishankar Muthukrishnan 	node->rqs[rq->qid] = rq;
113af75aac7SGowrishankar Muthukrishnan 	node->n_rq++;
114af75aac7SGowrishankar Muthukrishnan 	return 0;
115af75aac7SGowrishankar Muthukrishnan }
116af75aac7SGowrishankar Muthukrishnan 
117af75aac7SGowrishankar Muthukrishnan int
118af75aac7SGowrishankar Muthukrishnan nix_tel_node_add_cq(struct roc_nix_cq *cq)
119af75aac7SGowrishankar Muthukrishnan {
120af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node;
121af75aac7SGowrishankar Muthukrishnan 
122af75aac7SGowrishankar Muthukrishnan 	node = nix_tel_node_get(cq->roc_nix);
123af75aac7SGowrishankar Muthukrishnan 	if (!node)
124af75aac7SGowrishankar Muthukrishnan 		return -1;
125af75aac7SGowrishankar Muthukrishnan 
126af75aac7SGowrishankar Muthukrishnan 	node->cqs[cq->qid] = cq;
127af75aac7SGowrishankar Muthukrishnan 	node->n_cq++;
128af75aac7SGowrishankar Muthukrishnan 	return 0;
129af75aac7SGowrishankar Muthukrishnan }
130af75aac7SGowrishankar Muthukrishnan 
131af75aac7SGowrishankar Muthukrishnan int
132af75aac7SGowrishankar Muthukrishnan nix_tel_node_add_sq(struct roc_nix_sq *sq)
133af75aac7SGowrishankar Muthukrishnan {
134af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node;
135af75aac7SGowrishankar Muthukrishnan 
136af75aac7SGowrishankar Muthukrishnan 	node = nix_tel_node_get(sq->roc_nix);
137af75aac7SGowrishankar Muthukrishnan 	if (!node)
138af75aac7SGowrishankar Muthukrishnan 		return -1;
139af75aac7SGowrishankar Muthukrishnan 
140af75aac7SGowrishankar Muthukrishnan 	node->sqs[sq->qid] = sq;
141af75aac7SGowrishankar Muthukrishnan 	node->n_sq++;
142af75aac7SGowrishankar Muthukrishnan 	return 0;
143af75aac7SGowrishankar Muthukrishnan }
144af75aac7SGowrishankar Muthukrishnan 
145af75aac7SGowrishankar Muthukrishnan static int
146af75aac7SGowrishankar Muthukrishnan cnxk_tel_nix(struct roc_nix *roc_nix, struct plt_tel_data *d)
147af75aac7SGowrishankar Muthukrishnan {
148af75aac7SGowrishankar Muthukrishnan 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
149af75aac7SGowrishankar Muthukrishnan 
150af75aac7SGowrishankar Muthukrishnan 	struct dev *dev = &nix->dev;
151af75aac7SGowrishankar Muthukrishnan 
152af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_ptr(d, "nix", nix);
153af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "pf_func", dev->pf_func);
154af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "pf", dev_get_pf(dev->pf_func));
155af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "vf", dev_get_vf(dev->pf_func));
156af75aac7SGowrishankar Muthukrishnan 
157af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, dev, bar2);
158af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, dev, bar4);
159af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, roc_nix, port_id);
160af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, roc_nix, rss_tag_as_xor);
161af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, roc_nix, max_sqb_count);
162af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, nix, pci_dev);
163af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, nix, base);
164af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, nix, lmt_base);
165af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, reta_sz);
166af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, tx_chan_base);
167af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, rx_chan_base);
168af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, nb_tx_queues);
169af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, nb_rx_queues);
170af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, lso_tsov6_idx);
171af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, lso_tsov4_idx);
172af75aac7SGowrishankar Muthukrishnan 
173af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v4",
174af75aac7SGowrishankar Muthukrishnan 				  nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
175af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v6",
176af75aac7SGowrishankar Muthukrishnan 				  nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
177af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v4",
178af75aac7SGowrishankar Muthukrishnan 				  nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
179af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v6",
180af75aac7SGowrishankar Muthukrishnan 				  nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
181af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "lso_tun_v4v4",
182af75aac7SGowrishankar Muthukrishnan 				  nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
183af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "lso_tun_v4v6",
184af75aac7SGowrishankar Muthukrishnan 				  nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
185af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "lso_tun_v6v4",
186af75aac7SGowrishankar Muthukrishnan 				  nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
187af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_int(d, "lso_tun_v6v6",
188af75aac7SGowrishankar Muthukrishnan 				  nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
189af75aac7SGowrishankar Muthukrishnan 
190af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, lf_tx_stats);
191af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, lf_rx_stats);
192af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, cgx_links);
193af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, lbk_links);
194af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, sdp_links);
195af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, tx_link);
196af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, sqb_size);
197af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, msixoff);
198af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, cints);
199af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, qints);
200af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, sdp_link);
201af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, ptp_en);
202af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, rss_alg_idx);
203af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, nix, tx_pause);
204af75aac7SGowrishankar Muthukrishnan 
205af75aac7SGowrishankar Muthukrishnan 	return 0;
206af75aac7SGowrishankar Muthukrishnan }
207af75aac7SGowrishankar Muthukrishnan 
208af75aac7SGowrishankar Muthukrishnan static int
209af75aac7SGowrishankar Muthukrishnan cnxk_tel_nix_rq(struct roc_nix_rq *rq, struct plt_tel_data *d)
210af75aac7SGowrishankar Muthukrishnan {
211af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_ptr(d, "nix_rq", rq);
212af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, qid);
213af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, rq, aura_handle);
214af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, ipsech_ena);
215af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, first_skip);
216af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, later_skip);
217af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, lpb_size);
218af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, sso_ena);
219af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, tag_mask);
220af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, flow_tag_width);
221af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, tt);
222af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, hwgrp);
223af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, vwqe_ena);
224af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, vwqe_first_skip);
225af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, vwqe_max_sz_exp);
226af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, vwqe_wait_tmo);
227af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, rq, vwqe_aura_handle);
228af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, rq, roc_nix);
229af75aac7SGowrishankar Muthukrishnan 
230af75aac7SGowrishankar Muthukrishnan 	return 0;
231af75aac7SGowrishankar Muthukrishnan }
232af75aac7SGowrishankar Muthukrishnan 
233af75aac7SGowrishankar Muthukrishnan static int
234af75aac7SGowrishankar Muthukrishnan cnxk_tel_nix_cq(struct roc_nix_cq *cq, struct plt_tel_data *d)
235af75aac7SGowrishankar Muthukrishnan {
236af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_ptr(d, "nix_cq", cq);
237af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, cq, qid);
238af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, cq, nb_desc);
239af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, cq, roc_nix);
240af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, cq, door);
241af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, cq, status);
242af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, cq, wdata);
243af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, cq, desc_base);
244af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, cq, qmask);
245af75aac7SGowrishankar Muthukrishnan 
246af75aac7SGowrishankar Muthukrishnan 	return 0;
247af75aac7SGowrishankar Muthukrishnan }
248af75aac7SGowrishankar Muthukrishnan 
249af75aac7SGowrishankar Muthukrishnan static int
250af75aac7SGowrishankar Muthukrishnan cnxk_tel_nix_sq(struct roc_nix_sq *sq, struct plt_tel_data *d)
251af75aac7SGowrishankar Muthukrishnan {
252af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_add_dict_ptr(d, "nix_sq", sq);
253af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, sq, qid);
254af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, sq, max_sqe_sz);
255af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, sq, nb_desc);
256af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, sq, sqes_per_sqb_log2);
257af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, sq, roc_nix);
258af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, sq, aura_handle);
259af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs_adj);
260af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs);
261af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, sq, io_addr);
262af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, sq, lmt_addr);
263af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, sq, sqe_mem);
264af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, sq, fc);
265af75aac7SGowrishankar Muthukrishnan 
266af75aac7SGowrishankar Muthukrishnan 	return 0;
267af75aac7SGowrishankar Muthukrishnan }
268af75aac7SGowrishankar Muthukrishnan 
269af75aac7SGowrishankar Muthukrishnan static void
2705050f441SAnkur Dwivedi nix_rq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
271af75aac7SGowrishankar Muthukrishnan {
2725050f441SAnkur Dwivedi 	volatile struct nix_rq_ctx_s *ctx;
2735050f441SAnkur Dwivedi 
2745050f441SAnkur Dwivedi 	ctx = (volatile struct nix_rq_ctx_s *)qctx;
275af75aac7SGowrishankar Muthukrishnan 
276af75aac7SGowrishankar Muthukrishnan 	/* W0 */
277af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
278af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, substream, w0_);
279af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
280af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0_);
281af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0_);
282af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0_);
283af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
284af75aac7SGowrishankar Muthukrishnan 
285af75aac7SGowrishankar Muthukrishnan 	/* W1 */
286af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
287af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
288af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
289af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
290af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
291af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
292af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
293af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
294af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
295af75aac7SGowrishankar Muthukrishnan 
296af75aac7SGowrishankar Muthukrishnan 	/* W2 */
297af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
298af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
299af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
300af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
301af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
302af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
303af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
304af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
305af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
306af75aac7SGowrishankar Muthukrishnan 
307af75aac7SGowrishankar Muthukrishnan 	/* W3 */
308af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
309af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
310af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
311af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
312af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
313af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
314af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
315af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
316af75aac7SGowrishankar Muthukrishnan 
317af75aac7SGowrishankar Muthukrishnan 	/* W4 */
318af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
319af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
320af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
321af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
322af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
323af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
324af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
325af75aac7SGowrishankar Muthukrishnan 
326af75aac7SGowrishankar Muthukrishnan 	/* W5 */
327af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
328af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
329af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
330af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
331af75aac7SGowrishankar Muthukrishnan 
332af75aac7SGowrishankar Muthukrishnan 	/* W6 */
333af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
334af75aac7SGowrishankar Muthukrishnan 
335af75aac7SGowrishankar Muthukrishnan 	/* W7 */
336af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
337af75aac7SGowrishankar Muthukrishnan 
338af75aac7SGowrishankar Muthukrishnan 	/* W8 */
339af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
340af75aac7SGowrishankar Muthukrishnan 
341af75aac7SGowrishankar Muthukrishnan 	/* W9 */
342af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
343af75aac7SGowrishankar Muthukrishnan 
344af75aac7SGowrishankar Muthukrishnan 	/* W10 */
345af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_);
346af75aac7SGowrishankar Muthukrishnan }
347af75aac7SGowrishankar Muthukrishnan 
348af75aac7SGowrishankar Muthukrishnan static void
349*db5744d3SSatha Rao nix_rq_ctx_cn10k(volatile void *qctx, struct plt_tel_data *d)
350af75aac7SGowrishankar Muthukrishnan {
3515050f441SAnkur Dwivedi 	volatile struct nix_cn10k_rq_ctx_s *ctx;
3525050f441SAnkur Dwivedi 
3535050f441SAnkur Dwivedi 	ctx = (volatile struct nix_cn10k_rq_ctx_s *)qctx;
354af75aac7SGowrishankar Muthukrishnan 
355af75aac7SGowrishankar Muthukrishnan 	/* W0 */
356af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
357af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, len_ol3_dis, w0_);
358af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, len_ol4_dis, w0_);
359af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, len_il3_dis, w0_);
360af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, len_il4_dis, w0_);
361af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, csum_ol4_dis, w0_);
362af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lenerr_dis, w0_);
363af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0);
364af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0);
365af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0);
366af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ena, w0);
367af75aac7SGowrishankar Muthukrishnan 
368af75aac7SGowrishankar Muthukrishnan 	/* W1 */
369af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, chi_ena, w1_);
370af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ipsecd_drop_en, w1_);
371af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, pb_stashing, w1_);
372af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
373af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
374af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
375af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
376af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
377af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
378af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
379af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
380af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
381af75aac7SGowrishankar Muthukrishnan 
382af75aac7SGowrishankar Muthukrishnan 	/* W2 */
383af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
384af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
385af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
386af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
387af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
388af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
389af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
390af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
391af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
392af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, policer_ena, w2_);
393af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, band_prof_id, w2_);
394af75aac7SGowrishankar Muthukrishnan 
395af75aac7SGowrishankar Muthukrishnan 	/* W3 */
396af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
397af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
398af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
399af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
400af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
401af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
402af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
403af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
404af75aac7SGowrishankar Muthukrishnan 
405af75aac7SGowrishankar Muthukrishnan 	/* W4 */
406af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
407af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
408af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
409af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
410af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
411af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
412af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
413af75aac7SGowrishankar Muthukrishnan 
414af75aac7SGowrishankar Muthukrishnan 	/* W5 */
415af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vwqe_skip, w5_);
416af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, max_vsize_exp, w5_);
417af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vtime_wait, w5_);
418af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vwqe_ena, w5_);
419af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ipsec_vwqe, w5_);
420af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
421af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
422af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
423af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
424af75aac7SGowrishankar Muthukrishnan 
425af75aac7SGowrishankar Muthukrishnan 	/* W6 */
426af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
427af75aac7SGowrishankar Muthukrishnan 
428af75aac7SGowrishankar Muthukrishnan 	/* W7 */
429af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
430af75aac7SGowrishankar Muthukrishnan 
431af75aac7SGowrishankar Muthukrishnan 	/* W8 */
432af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
433af75aac7SGowrishankar Muthukrishnan 
434af75aac7SGowrishankar Muthukrishnan 	/* W9 */
435af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
436af75aac7SGowrishankar Muthukrishnan 
437af75aac7SGowrishankar Muthukrishnan 	/* W10 */
438af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_);
439af75aac7SGowrishankar Muthukrishnan }
440af75aac7SGowrishankar Muthukrishnan 
441*db5744d3SSatha Rao static void
442*db5744d3SSatha Rao nix_rq_ctx(volatile void *qctx, struct plt_tel_data *d)
443*db5744d3SSatha Rao {
444*db5744d3SSatha Rao 	volatile struct nix_cn20k_rq_ctx_s *ctx;
445*db5744d3SSatha Rao 
446*db5744d3SSatha Rao 	ctx = (volatile struct nix_cn20k_rq_ctx_s *)qctx;
447*db5744d3SSatha Rao 
448*db5744d3SSatha Rao 	/* W0 */
449*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
450*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, len_ol3_dis, w0_);
451*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, len_ol4_dis, w0_);
452*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, len_il3_dis, w0_);
453*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, len_il4_dis, w0_);
454*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, csum_ol4_dis, w0_);
455*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, csum_il4_dis, w0_);
456*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lenerr_dis, w0_);
457*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, port_ol4_dis, w0_);
458*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, port_il4_dis, w0_);
459*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0);
460*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0);
461*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0);
462*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, ena, w0);
463*db5744d3SSatha Rao 
464*db5744d3SSatha Rao 	/* W1 */
465*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, chi_ena, w1_);
466*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, ipsecd_drop_en, w1_);
467*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, pb_stashing, w1_);
468*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
469*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
470*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
471*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
472*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
473*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
474*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
475*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
476*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
477*db5744d3SSatha Rao 
478*db5744d3SSatha Rao 	/* W2 */
479*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
480*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
481*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, band_prof_id_h, w2_);
482*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
483*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
484*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sso_bp_ena, w2_);
485*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
486*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
487*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
488*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, spb_high_sizem1, w2_);
489*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
490*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
491*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, policer_ena, w2_);
492*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, band_prof_id_l, w2_);
493*db5744d3SSatha Rao 
494*db5744d3SSatha Rao 	/* W3 */
495*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
496*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
497*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
498*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
499*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
500*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
501*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
502*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
503*db5744d3SSatha Rao 
504*db5744d3SSatha Rao 	/* W4 */
505*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
506*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
507*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
508*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
509*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
510*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
511*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
512*db5744d3SSatha Rao 
513*db5744d3SSatha Rao 	/* W5 */
514*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
515*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
516*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
517*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
518*db5744d3SSatha Rao 
519*db5744d3SSatha Rao 	/* W6 */
520*db5744d3SSatha Rao 	CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
521*db5744d3SSatha Rao 
522*db5744d3SSatha Rao 	/* W7 */
523*db5744d3SSatha Rao 	CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
524*db5744d3SSatha Rao 
525*db5744d3SSatha Rao 	/* W8 */
526*db5744d3SSatha Rao 	CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
527*db5744d3SSatha Rao 
528*db5744d3SSatha Rao 	/* W9 */
529*db5744d3SSatha Rao 	CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
530*db5744d3SSatha Rao 
531*db5744d3SSatha Rao 	/* W10 */
532*db5744d3SSatha Rao 	CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_);
533*db5744d3SSatha Rao }
534*db5744d3SSatha Rao 
535af75aac7SGowrishankar Muthukrishnan static int
536af75aac7SGowrishankar Muthukrishnan cnxk_tel_nix_rq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
537af75aac7SGowrishankar Muthukrishnan {
538af75aac7SGowrishankar Muthukrishnan 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
539af75aac7SGowrishankar Muthukrishnan 	struct dev *dev = &nix->dev;
540af75aac7SGowrishankar Muthukrishnan 	struct npa_lf *npa_lf;
541af75aac7SGowrishankar Muthukrishnan 	volatile void *qctx;
542af75aac7SGowrishankar Muthukrishnan 	int rc = -1;
543af75aac7SGowrishankar Muthukrishnan 
544af75aac7SGowrishankar Muthukrishnan 	npa_lf = idev_npa_obj_get();
545af75aac7SGowrishankar Muthukrishnan 	if (npa_lf == NULL)
546af75aac7SGowrishankar Muthukrishnan 		return NPA_ERR_DEVICE_NOT_BOUNDED;
547af75aac7SGowrishankar Muthukrishnan 
548af75aac7SGowrishankar Muthukrishnan 	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_RQ, n, &qctx);
549af75aac7SGowrishankar Muthukrishnan 	if (rc) {
550af75aac7SGowrishankar Muthukrishnan 		plt_err("Failed to get rq context");
551af75aac7SGowrishankar Muthukrishnan 		return rc;
552af75aac7SGowrishankar Muthukrishnan 	}
553af75aac7SGowrishankar Muthukrishnan 
554af75aac7SGowrishankar Muthukrishnan 	if (roc_model_is_cn9k())
5555050f441SAnkur Dwivedi 		nix_rq_ctx_cn9k(qctx, d);
556*db5744d3SSatha Rao 	else if (roc_model_is_cn10k())
557*db5744d3SSatha Rao 		nix_rq_ctx_cn10k(qctx, d);
558af75aac7SGowrishankar Muthukrishnan 	else
5595050f441SAnkur Dwivedi 		nix_rq_ctx(qctx, d);
560af75aac7SGowrishankar Muthukrishnan 
561af75aac7SGowrishankar Muthukrishnan 	return 0;
562af75aac7SGowrishankar Muthukrishnan }
563af75aac7SGowrishankar Muthukrishnan 
564af75aac7SGowrishankar Muthukrishnan static int
565*db5744d3SSatha Rao cnxk_tel_nix_cq_ctx_cn20k(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
566*db5744d3SSatha Rao {
567*db5744d3SSatha Rao 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
568*db5744d3SSatha Rao 	struct dev *dev = &nix->dev;
569*db5744d3SSatha Rao 	struct npa_lf *npa_lf;
570*db5744d3SSatha Rao 	volatile struct nix_cn20k_cq_ctx_s *ctx;
571*db5744d3SSatha Rao 	int rc = -1;
572*db5744d3SSatha Rao 
573*db5744d3SSatha Rao 	npa_lf = idev_npa_obj_get();
574*db5744d3SSatha Rao 	if (npa_lf == NULL)
575*db5744d3SSatha Rao 		return NPA_ERR_DEVICE_NOT_BOUNDED;
576*db5744d3SSatha Rao 
577*db5744d3SSatha Rao 	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_CQ, n, (void *)&ctx);
578*db5744d3SSatha Rao 	if (rc) {
579*db5744d3SSatha Rao 		plt_err("Failed to get cq context");
580*db5744d3SSatha Rao 		return rc;
581*db5744d3SSatha Rao 	}
582*db5744d3SSatha Rao 
583*db5744d3SSatha Rao 	/* W0 */
584*db5744d3SSatha Rao 	CNXK_TEL_DICT_PTR(d, ctx, base, w0_);
585*db5744d3SSatha Rao 
586*db5744d3SSatha Rao 	/* W1 */
587*db5744d3SSatha Rao 	CNXK_TEL_DICT_U64(d, ctx, wrptr, w1_);
588*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, avg_con, w1_);
589*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, cint_idx, w1_);
590*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, cq_err, w1_);
591*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w1_);
592*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lbpid_high, w1_);
593*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, bpid, w1_);
594*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lbpid_med, w1_);
595*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, bp_ena, w1_);
596*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lbpid_low, w1_);
597*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lbp_ena, w1_);
598*db5744d3SSatha Rao 
599*db5744d3SSatha Rao 	/* W2 */
600*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, update_time, w2_);
601*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, avg_level, w2_);
602*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, head, w2_);
603*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, tail, w2_);
604*db5744d3SSatha Rao 
605*db5744d3SSatha Rao 	/* W3 */
606*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, cq_err_int_ena, w3_);
607*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, cq_err_int, w3_);
608*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, qsize, w3_);
609*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, stashing, w3_);
610*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, caching, w3_);
611*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lbp_frac, w3_);
612*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, stash_thresh, w3_);
613*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, msh_valid, w3_);
614*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, msh_dst, w3_);
615*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, cpt_drop_err_en, w3_);
616*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, ena, w3_);
617*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, drop_ena, w3_);
618*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, drop, w3_);
619*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, bp, w3_);
620*db5744d3SSatha Rao 
621*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lbpid_ext, w4_);
622*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, bpid_ext, w4_);
623*db5744d3SSatha Rao 
624*db5744d3SSatha Rao 	return 0;
625*db5744d3SSatha Rao }
626*db5744d3SSatha Rao 
627*db5744d3SSatha Rao static int
628af75aac7SGowrishankar Muthukrishnan cnxk_tel_nix_cq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
629af75aac7SGowrishankar Muthukrishnan {
630af75aac7SGowrishankar Muthukrishnan 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
631af75aac7SGowrishankar Muthukrishnan 	struct dev *dev = &nix->dev;
632af75aac7SGowrishankar Muthukrishnan 	struct npa_lf *npa_lf;
633af75aac7SGowrishankar Muthukrishnan 	volatile struct nix_cq_ctx_s *ctx;
634af75aac7SGowrishankar Muthukrishnan 	int rc = -1;
635af75aac7SGowrishankar Muthukrishnan 
636*db5744d3SSatha Rao 	if (roc_model_is_cn20k())
637*db5744d3SSatha Rao 		return cnxk_tel_nix_cq_ctx_cn20k(roc_nix, n, d);
638*db5744d3SSatha Rao 
639af75aac7SGowrishankar Muthukrishnan 	npa_lf = idev_npa_obj_get();
640af75aac7SGowrishankar Muthukrishnan 	if (npa_lf == NULL)
641af75aac7SGowrishankar Muthukrishnan 		return NPA_ERR_DEVICE_NOT_BOUNDED;
642af75aac7SGowrishankar Muthukrishnan 
643af75aac7SGowrishankar Muthukrishnan 	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_CQ, n, (void *)&ctx);
644af75aac7SGowrishankar Muthukrishnan 	if (rc) {
645af75aac7SGowrishankar Muthukrishnan 		plt_err("Failed to get cq context");
646af75aac7SGowrishankar Muthukrishnan 		return rc;
647af75aac7SGowrishankar Muthukrishnan 	}
648af75aac7SGowrishankar Muthukrishnan 
649af75aac7SGowrishankar Muthukrishnan 	/* W0 */
650af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, base, w0_);
651af75aac7SGowrishankar Muthukrishnan 
652af75aac7SGowrishankar Muthukrishnan 	/* W1 */
653af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_U64(d, ctx, wrptr, w1_);
654af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, avg_con, w1_);
655af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cint_idx, w1_);
656af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq_err, w1_);
657af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w1_);
658af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, bpid, w1_);
659af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, bp_ena, w1_);
660af75aac7SGowrishankar Muthukrishnan 
661af75aac7SGowrishankar Muthukrishnan 	/* W2 */
662af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, update_time, w2_);
663af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, avg_level, w2_);
664af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, head, w2_);
665af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, tail, w2_);
666af75aac7SGowrishankar Muthukrishnan 
667af75aac7SGowrishankar Muthukrishnan 	/* W3 */
668af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq_err_int_ena, w3_);
669af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq_err_int, w3_);
670af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, qsize, w3_);
671af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, caching, w3_);
672af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, substream, w3_);
673af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ena, w3_);
674af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, drop_ena, w3_);
675af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, drop, w3_);
676af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, bp, w3_);
677af75aac7SGowrishankar Muthukrishnan 
678af75aac7SGowrishankar Muthukrishnan 	return 0;
679af75aac7SGowrishankar Muthukrishnan }
680af75aac7SGowrishankar Muthukrishnan 
681af75aac7SGowrishankar Muthukrishnan static void
6825050f441SAnkur Dwivedi nix_sq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
683af75aac7SGowrishankar Muthukrishnan {
6845050f441SAnkur Dwivedi 	volatile struct nix_sq_ctx_s *ctx;
6855050f441SAnkur Dwivedi 
6865050f441SAnkur Dwivedi 	ctx = (volatile struct nix_sq_ctx_s *)qctx;
687af75aac7SGowrishankar Muthukrishnan 
688af75aac7SGowrishankar Muthukrishnan 	/* W0 */
689af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
690af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
691af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
692af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
693af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
694af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
695af75aac7SGowrishankar Muthukrishnan 
696af75aac7SGowrishankar Muthukrishnan 	/* W1 */
697af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
698af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
699af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_rr_quantum, w1_);
700af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
701af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
702af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
703af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
704af75aac7SGowrishankar Muthukrishnan 
705af75aac7SGowrishankar Muthukrishnan 	/* W2 */
706af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
707af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
708af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
709af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
710af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count, w2_);
711af75aac7SGowrishankar Muthukrishnan 
712af75aac7SGowrishankar Muthukrishnan 	/* W3 */
713af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
714af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
715af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
716af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
717af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
718af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
719af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
720af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
721af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
722af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
723af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
724af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
725af75aac7SGowrishankar Muthukrishnan 
726af75aac7SGowrishankar Muthukrishnan 	/* W4 */
727af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
728af75aac7SGowrishankar Muthukrishnan 
729af75aac7SGowrishankar Muthukrishnan 	/* W5 */
730af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
731af75aac7SGowrishankar Muthukrishnan 
732af75aac7SGowrishankar Muthukrishnan 	/* W6 */
733af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
734af75aac7SGowrishankar Muthukrishnan 
735af75aac7SGowrishankar Muthukrishnan 	/* W7 */
736af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
737af75aac7SGowrishankar Muthukrishnan 
738af75aac7SGowrishankar Muthukrishnan 	/* W8 */
739af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
740af75aac7SGowrishankar Muthukrishnan 
741af75aac7SGowrishankar Muthukrishnan 	/* W9 */
742af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
743af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
744af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
745af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
746af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
747af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
748af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
749af75aac7SGowrishankar Muthukrishnan 
750af75aac7SGowrishankar Muthukrishnan 	/* W10 */
751af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
752af75aac7SGowrishankar Muthukrishnan 
753af75aac7SGowrishankar Muthukrishnan 	/* W11 */
754af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
755af75aac7SGowrishankar Muthukrishnan 
756af75aac7SGowrishankar Muthukrishnan 	/* W12 */
757af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
758af75aac7SGowrishankar Muthukrishnan 
759af75aac7SGowrishankar Muthukrishnan 	/* W14 */
760af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
761af75aac7SGowrishankar Muthukrishnan 
762af75aac7SGowrishankar Muthukrishnan 	/* W15 */
763af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_);
764af75aac7SGowrishankar Muthukrishnan }
765af75aac7SGowrishankar Muthukrishnan 
766af75aac7SGowrishankar Muthukrishnan static void
767*db5744d3SSatha Rao nix_sq_ctx_cn10k(volatile void *qctx, struct plt_tel_data *d)
768af75aac7SGowrishankar Muthukrishnan {
7695050f441SAnkur Dwivedi 	volatile struct nix_cn10k_sq_ctx_s *ctx;
7705050f441SAnkur Dwivedi 
7715050f441SAnkur Dwivedi 	ctx = (volatile struct nix_cn10k_sq_ctx_s *)qctx;
772af75aac7SGowrishankar Muthukrishnan 
773af75aac7SGowrishankar Muthukrishnan 	/* W0 */
774af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
775af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
776af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
777af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
778af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
779af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
780af75aac7SGowrishankar Muthukrishnan 
781af75aac7SGowrishankar Muthukrishnan 	/* W1 */
782*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_lb, w1_);
783af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
784af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
785af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_rr_weight, w1_);
786af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
787af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
788af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
789af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
790af75aac7SGowrishankar Muthukrishnan 
791af75aac7SGowrishankar Muthukrishnan 	/* W2 */
792af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
793af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
794af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
795af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
796af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_ub, w2_);
797*db5744d3SSatha Rao 
798*db5744d3SSatha Rao 	/* W3 */
799*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
800*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
801*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
802*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
803*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
804*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
805*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
806*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
807*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
808*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
809*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
810*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
811*db5744d3SSatha Rao 
812*db5744d3SSatha Rao 	/* W4 */
813*db5744d3SSatha Rao 	CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
814*db5744d3SSatha Rao 
815*db5744d3SSatha Rao 	/* W5 */
816*db5744d3SSatha Rao 	CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
817*db5744d3SSatha Rao 
818*db5744d3SSatha Rao 	/* W6 */
819*db5744d3SSatha Rao 	CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
820*db5744d3SSatha Rao 
821*db5744d3SSatha Rao 	/* W7 */
822*db5744d3SSatha Rao 	CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
823*db5744d3SSatha Rao 
824*db5744d3SSatha Rao 	/* W8 */
825*db5744d3SSatha Rao 	CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
826*db5744d3SSatha Rao 
827*db5744d3SSatha Rao 	/* W9 */
828*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
829*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
830*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
831*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
832*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
833*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
834*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
835*db5744d3SSatha Rao 
836*db5744d3SSatha Rao 	/* W10 */
837*db5744d3SSatha Rao 	CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
838*db5744d3SSatha Rao 
839*db5744d3SSatha Rao 	/* W11 */
840*db5744d3SSatha Rao 	CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
841*db5744d3SSatha Rao 
842*db5744d3SSatha Rao 	/* W12 */
843*db5744d3SSatha Rao 	CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
844*db5744d3SSatha Rao 
845*db5744d3SSatha Rao 	/* W13 */
846*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, aged_drop_octs, w13_);
847*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, aged_drop_pkts, w13_);
848*db5744d3SSatha Rao 
849*db5744d3SSatha Rao 	/* W14 */
850*db5744d3SSatha Rao 	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
851*db5744d3SSatha Rao 
852*db5744d3SSatha Rao 	/* W15 */
853*db5744d3SSatha Rao 	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_);
854*db5744d3SSatha Rao }
855*db5744d3SSatha Rao 
856*db5744d3SSatha Rao static void
857*db5744d3SSatha Rao nix_sq_ctx(volatile void *qctx, struct plt_tel_data *d)
858*db5744d3SSatha Rao {
859*db5744d3SSatha Rao 	volatile struct nix_cn20k_sq_ctx_s *ctx;
860*db5744d3SSatha Rao 
861*db5744d3SSatha Rao 	ctx = (volatile struct nix_cn20k_sq_ctx_s *)qctx;
862*db5744d3SSatha Rao 
863*db5744d3SSatha Rao 	/* W0 */
864*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
865*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
866*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
867*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
868*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
869*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
870*db5744d3SSatha Rao 
871*db5744d3SSatha Rao 	/* W1 */
872*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_lb, w1_);
873*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
874*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
875*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smq_rr_weight, w1_);
876*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
877*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
878*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
879*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
880*db5744d3SSatha Rao 
881*db5744d3SSatha Rao 	/* W2 */
882*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
883*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
884*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
885*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
886*db5744d3SSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_ub, w2_);
887af75aac7SGowrishankar Muthukrishnan 
888af75aac7SGowrishankar Muthukrishnan 	/* W3 */
889af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
890af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
891af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
892af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
893af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
894af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
895af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
896af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
897af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
898af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
899af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
900af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
901af75aac7SGowrishankar Muthukrishnan 
902af75aac7SGowrishankar Muthukrishnan 	/* W4 */
903af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
904af75aac7SGowrishankar Muthukrishnan 
905af75aac7SGowrishankar Muthukrishnan 	/* W5 */
906af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
907af75aac7SGowrishankar Muthukrishnan 
908af75aac7SGowrishankar Muthukrishnan 	/* W6 */
909af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
910af75aac7SGowrishankar Muthukrishnan 
911af75aac7SGowrishankar Muthukrishnan 	/* W7 */
912af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
913af75aac7SGowrishankar Muthukrishnan 
914af75aac7SGowrishankar Muthukrishnan 	/* W8 */
915af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
916af75aac7SGowrishankar Muthukrishnan 
917af75aac7SGowrishankar Muthukrishnan 	/* W9 */
918af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
919af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
920af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
921af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
922af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
923af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
924af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
925af75aac7SGowrishankar Muthukrishnan 
926af75aac7SGowrishankar Muthukrishnan 	/* W10 */
927af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
928af75aac7SGowrishankar Muthukrishnan 
929af75aac7SGowrishankar Muthukrishnan 	/* W11 */
930af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
931af75aac7SGowrishankar Muthukrishnan 
932af75aac7SGowrishankar Muthukrishnan 	/* W12 */
933af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
934af75aac7SGowrishankar Muthukrishnan 
9353ae7a30eSSatha Rao 	/* W13 */
9363ae7a30eSSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, aged_drop_octs, w13_);
9373ae7a30eSSatha Rao 	CNXK_TEL_DICT_INT(d, ctx, aged_drop_pkts, w13_);
9383ae7a30eSSatha Rao 
939af75aac7SGowrishankar Muthukrishnan 	/* W14 */
940af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
941af75aac7SGowrishankar Muthukrishnan 
942af75aac7SGowrishankar Muthukrishnan 	/* W15 */
943af75aac7SGowrishankar Muthukrishnan 	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_);
944af75aac7SGowrishankar Muthukrishnan }
945af75aac7SGowrishankar Muthukrishnan 
946af75aac7SGowrishankar Muthukrishnan static int
947af75aac7SGowrishankar Muthukrishnan cnxk_tel_nix_sq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
948af75aac7SGowrishankar Muthukrishnan {
949af75aac7SGowrishankar Muthukrishnan 	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
950af75aac7SGowrishankar Muthukrishnan 	struct dev *dev = &nix->dev;
951af75aac7SGowrishankar Muthukrishnan 	struct npa_lf *npa_lf;
952af75aac7SGowrishankar Muthukrishnan 	volatile void *qctx;
953af75aac7SGowrishankar Muthukrishnan 	int rc = -1;
954af75aac7SGowrishankar Muthukrishnan 
955af75aac7SGowrishankar Muthukrishnan 	npa_lf = idev_npa_obj_get();
956af75aac7SGowrishankar Muthukrishnan 	if (npa_lf == NULL)
957af75aac7SGowrishankar Muthukrishnan 		return NPA_ERR_DEVICE_NOT_BOUNDED;
958af75aac7SGowrishankar Muthukrishnan 
959af75aac7SGowrishankar Muthukrishnan 	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_SQ, n, &qctx);
960af75aac7SGowrishankar Muthukrishnan 	if (rc) {
961af75aac7SGowrishankar Muthukrishnan 		plt_err("Failed to get rq context");
962af75aac7SGowrishankar Muthukrishnan 		return rc;
963af75aac7SGowrishankar Muthukrishnan 	}
964af75aac7SGowrishankar Muthukrishnan 
965af75aac7SGowrishankar Muthukrishnan 	if (roc_model_is_cn9k())
9665050f441SAnkur Dwivedi 		nix_sq_ctx_cn9k(qctx, d);
967*db5744d3SSatha Rao 	else if (roc_model_is_cn10k())
968*db5744d3SSatha Rao 		nix_sq_ctx_cn10k(qctx, d);
969af75aac7SGowrishankar Muthukrishnan 	else
9705050f441SAnkur Dwivedi 		nix_sq_ctx(qctx, d);
971af75aac7SGowrishankar Muthukrishnan 
972af75aac7SGowrishankar Muthukrishnan 	return 0;
973af75aac7SGowrishankar Muthukrishnan }
974af75aac7SGowrishankar Muthukrishnan 
975af75aac7SGowrishankar Muthukrishnan static int
976af75aac7SGowrishankar Muthukrishnan cnxk_nix_tel_handle_list(const char *cmd __plt_unused,
977af75aac7SGowrishankar Muthukrishnan 			 const char *params __plt_unused,
978af75aac7SGowrishankar Muthukrishnan 			 struct plt_tel_data *d)
979af75aac7SGowrishankar Muthukrishnan {
980af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node;
981af75aac7SGowrishankar Muthukrishnan 	struct roc_nix *roc_nix;
982af75aac7SGowrishankar Muthukrishnan 
983af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_start_array(d, PLT_TEL_STRING_VAL);
984af75aac7SGowrishankar Muthukrishnan 
985af75aac7SGowrishankar Muthukrishnan 	TAILQ_FOREACH(node, &nix_list, node) {
986af75aac7SGowrishankar Muthukrishnan 		roc_nix = node->nix;
987af75aac7SGowrishankar Muthukrishnan 		plt_tel_data_add_array_string(d, roc_nix->pci_dev->name);
988af75aac7SGowrishankar Muthukrishnan 	}
989af75aac7SGowrishankar Muthukrishnan 
990af75aac7SGowrishankar Muthukrishnan 	return 0;
991af75aac7SGowrishankar Muthukrishnan }
992af75aac7SGowrishankar Muthukrishnan 
993af75aac7SGowrishankar Muthukrishnan static int
994af75aac7SGowrishankar Muthukrishnan cnxk_nix_tel_handle_info(const char *cmd __plt_unused, const char *params,
995af75aac7SGowrishankar Muthukrishnan 			 struct plt_tel_data *d)
996af75aac7SGowrishankar Muthukrishnan {
997af75aac7SGowrishankar Muthukrishnan 	char name[PCI_PRI_STR_SIZE];
998af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node;
999af75aac7SGowrishankar Muthukrishnan 
1000af75aac7SGowrishankar Muthukrishnan 	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
1001af75aac7SGowrishankar Muthukrishnan 		return -1;
1002af75aac7SGowrishankar Muthukrishnan 
1003af75aac7SGowrishankar Muthukrishnan 	plt_strlcpy(name, params, PCI_PRI_STR_SIZE);
1004af75aac7SGowrishankar Muthukrishnan 
1005af75aac7SGowrishankar Muthukrishnan 	node = nix_tel_node_get_by_pcidev_name(name);
1006af75aac7SGowrishankar Muthukrishnan 	if (!node)
1007af75aac7SGowrishankar Muthukrishnan 		return -1;
1008af75aac7SGowrishankar Muthukrishnan 
1009af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_start_dict(d);
1010af75aac7SGowrishankar Muthukrishnan 	return cnxk_tel_nix(node->nix, d);
1011af75aac7SGowrishankar Muthukrishnan }
1012af75aac7SGowrishankar Muthukrishnan 
1013af75aac7SGowrishankar Muthukrishnan static int
1014af75aac7SGowrishankar Muthukrishnan cnxk_nix_tel_handle_info_x(const char *cmd, const char *params,
1015af75aac7SGowrishankar Muthukrishnan 			   struct plt_tel_data *d)
1016af75aac7SGowrishankar Muthukrishnan {
1017af75aac7SGowrishankar Muthukrishnan 	struct nix_tel_node *node;
1018af75aac7SGowrishankar Muthukrishnan 	char *name, *param;
1019af75aac7SGowrishankar Muthukrishnan 	char buf[1024];
1020af75aac7SGowrishankar Muthukrishnan 	int rc = -1;
1021af75aac7SGowrishankar Muthukrishnan 
1022af75aac7SGowrishankar Muthukrishnan 	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
1023af75aac7SGowrishankar Muthukrishnan 		goto exit;
1024af75aac7SGowrishankar Muthukrishnan 
1025af75aac7SGowrishankar Muthukrishnan 	plt_strlcpy(buf, params, PCI_PRI_STR_SIZE + 1);
1026af75aac7SGowrishankar Muthukrishnan 	name = strtok(buf, ",");
102714f7e5d4SGowrishankar Muthukrishnan 	if (name == NULL)
102814f7e5d4SGowrishankar Muthukrishnan 		goto exit;
102914f7e5d4SGowrishankar Muthukrishnan 
1030af75aac7SGowrishankar Muthukrishnan 	param = strtok(NULL, "\0");
1031af75aac7SGowrishankar Muthukrishnan 
1032af75aac7SGowrishankar Muthukrishnan 	node = nix_tel_node_get_by_pcidev_name(name);
1033af75aac7SGowrishankar Muthukrishnan 	if (!node)
1034af75aac7SGowrishankar Muthukrishnan 		goto exit;
1035af75aac7SGowrishankar Muthukrishnan 
1036af75aac7SGowrishankar Muthukrishnan 	plt_tel_data_start_dict(d);
1037af75aac7SGowrishankar Muthukrishnan 
1038af75aac7SGowrishankar Muthukrishnan 	if (strstr(cmd, "rq")) {
1039af75aac7SGowrishankar Muthukrishnan 		char *tok = strtok(param, ",");
1040af75aac7SGowrishankar Muthukrishnan 		int rq;
1041af75aac7SGowrishankar Muthukrishnan 
1042af75aac7SGowrishankar Muthukrishnan 		if (!tok)
1043af75aac7SGowrishankar Muthukrishnan 			goto exit;
1044af75aac7SGowrishankar Muthukrishnan 
1045af75aac7SGowrishankar Muthukrishnan 		rq = strtol(tok, NULL, 10);
1046af75aac7SGowrishankar Muthukrishnan 		if ((node->n_rq <= rq) || (rq < 0))
1047af75aac7SGowrishankar Muthukrishnan 			goto exit;
1048af75aac7SGowrishankar Muthukrishnan 
1049af75aac7SGowrishankar Muthukrishnan 		if (strstr(cmd, "ctx"))
1050af75aac7SGowrishankar Muthukrishnan 			rc = cnxk_tel_nix_rq_ctx(node->nix, rq, d);
1051af75aac7SGowrishankar Muthukrishnan 		else
1052af75aac7SGowrishankar Muthukrishnan 			rc = cnxk_tel_nix_rq(node->rqs[rq], d);
1053af75aac7SGowrishankar Muthukrishnan 
1054af75aac7SGowrishankar Muthukrishnan 	} else if (strstr(cmd, "cq")) {
1055af75aac7SGowrishankar Muthukrishnan 		char *tok = strtok(param, ",");
1056af75aac7SGowrishankar Muthukrishnan 		int cq;
1057af75aac7SGowrishankar Muthukrishnan 
1058af75aac7SGowrishankar Muthukrishnan 		if (!tok)
1059af75aac7SGowrishankar Muthukrishnan 			goto exit;
1060af75aac7SGowrishankar Muthukrishnan 
1061af75aac7SGowrishankar Muthukrishnan 		cq = strtol(tok, NULL, 10);
1062af75aac7SGowrishankar Muthukrishnan 		if ((node->n_cq <= cq) || (cq < 0))
1063af75aac7SGowrishankar Muthukrishnan 			goto exit;
1064af75aac7SGowrishankar Muthukrishnan 
1065af75aac7SGowrishankar Muthukrishnan 		if (strstr(cmd, "ctx"))
1066af75aac7SGowrishankar Muthukrishnan 			rc = cnxk_tel_nix_cq_ctx(node->nix, cq, d);
1067af75aac7SGowrishankar Muthukrishnan 		else
1068af75aac7SGowrishankar Muthukrishnan 			rc = cnxk_tel_nix_cq(node->cqs[cq], d);
1069af75aac7SGowrishankar Muthukrishnan 
1070af75aac7SGowrishankar Muthukrishnan 	} else if (strstr(cmd, "sq")) {
1071af75aac7SGowrishankar Muthukrishnan 		char *tok = strtok(param, ",");
1072af75aac7SGowrishankar Muthukrishnan 		int sq;
1073af75aac7SGowrishankar Muthukrishnan 
1074af75aac7SGowrishankar Muthukrishnan 		if (!tok)
1075af75aac7SGowrishankar Muthukrishnan 			goto exit;
1076af75aac7SGowrishankar Muthukrishnan 
1077af75aac7SGowrishankar Muthukrishnan 		sq = strtol(tok, NULL, 10);
1078af75aac7SGowrishankar Muthukrishnan 		if ((node->n_sq <= sq) || (sq < 0))
1079af75aac7SGowrishankar Muthukrishnan 			goto exit;
1080af75aac7SGowrishankar Muthukrishnan 
1081af75aac7SGowrishankar Muthukrishnan 		if (strstr(cmd, "ctx"))
1082af75aac7SGowrishankar Muthukrishnan 			rc = cnxk_tel_nix_sq_ctx(node->nix, sq, d);
1083af75aac7SGowrishankar Muthukrishnan 		else
1084af75aac7SGowrishankar Muthukrishnan 			rc = cnxk_tel_nix_sq(node->sqs[sq], d);
1085af75aac7SGowrishankar Muthukrishnan 	}
1086af75aac7SGowrishankar Muthukrishnan 
1087af75aac7SGowrishankar Muthukrishnan exit:
1088af75aac7SGowrishankar Muthukrishnan 	return rc;
1089af75aac7SGowrishankar Muthukrishnan }
1090af75aac7SGowrishankar Muthukrishnan 
1091af75aac7SGowrishankar Muthukrishnan PLT_INIT(cnxk_telemetry_nix_init)
1092af75aac7SGowrishankar Muthukrishnan {
1093af75aac7SGowrishankar Muthukrishnan 	TAILQ_INIT(&nix_list);
1094af75aac7SGowrishankar Muthukrishnan 
1095af75aac7SGowrishankar Muthukrishnan 	plt_telemetry_register_cmd(
1096af75aac7SGowrishankar Muthukrishnan 		"/cnxk/nix/list", cnxk_nix_tel_handle_list,
1097af75aac7SGowrishankar Muthukrishnan 		"Returns list of available NIX devices. Takes no parameters");
1098af75aac7SGowrishankar Muthukrishnan 	plt_telemetry_register_cmd(
1099af75aac7SGowrishankar Muthukrishnan 		"/cnxk/nix/info", cnxk_nix_tel_handle_info,
1100af75aac7SGowrishankar Muthukrishnan 		"Returns nix information. Parameters: pci id");
1101af75aac7SGowrishankar Muthukrishnan 	plt_telemetry_register_cmd(
1102af75aac7SGowrishankar Muthukrishnan 		"/cnxk/nix/rq/info", cnxk_nix_tel_handle_info_x,
1103af75aac7SGowrishankar Muthukrishnan 		"Returns nix rq information. Parameters: pci id, rq id");
1104af75aac7SGowrishankar Muthukrishnan 	plt_telemetry_register_cmd(
1105af75aac7SGowrishankar Muthukrishnan 		"/cnxk/nix/rq/ctx", cnxk_nix_tel_handle_info_x,
1106af75aac7SGowrishankar Muthukrishnan 		"Returns nix rq context. Parameters: pci id, rq id");
1107af75aac7SGowrishankar Muthukrishnan 	plt_telemetry_register_cmd(
1108af75aac7SGowrishankar Muthukrishnan 		"/cnxk/nix/cq/info", cnxk_nix_tel_handle_info_x,
1109af75aac7SGowrishankar Muthukrishnan 		"Returns nix cq information. Parameters: pci id, cq id");
1110af75aac7SGowrishankar Muthukrishnan 	plt_telemetry_register_cmd(
1111af75aac7SGowrishankar Muthukrishnan 		"/cnxk/nix/cq/ctx", cnxk_nix_tel_handle_info_x,
1112af75aac7SGowrishankar Muthukrishnan 		"Returns nix cq context. Parameters: pci id, cq id");
1113af75aac7SGowrishankar Muthukrishnan 	plt_telemetry_register_cmd(
1114af75aac7SGowrishankar Muthukrishnan 		"/cnxk/nix/sq/info", cnxk_nix_tel_handle_info_x,
1115af75aac7SGowrishankar Muthukrishnan 		"Returns nix sq information. Parameters: pci id, sq id");
1116af75aac7SGowrishankar Muthukrishnan 	plt_telemetry_register_cmd(
1117af75aac7SGowrishankar Muthukrishnan 		"/cnxk/nix/sq/ctx", cnxk_nix_tel_handle_info_x,
1118af75aac7SGowrishankar Muthukrishnan 		"Returns nix sq context. Parameters: pci id, sq id");
1119af75aac7SGowrishankar Muthukrishnan }
1120