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