1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
5 #include "cnxk_telemetry.h"
10 TAILQ_ENTRY(nix_tel_node) node;
15 struct roc_nix_rq **rqs;
16 struct roc_nix_cq **cqs;
17 struct roc_nix_sq **sqs;
20 TAILQ_HEAD(nix_tel_node_list, nix_tel_node);
21 static struct nix_tel_node_list nix_list;
23 static struct nix_tel_node *
24 nix_tel_node_get(struct roc_nix *roc_nix)
26 struct nix_tel_node *node, *roc_node = NULL;
28 TAILQ_FOREACH(node, &nix_list, node) {
29 if (node->nix == roc_nix) {
39 nix_tel_node_add(struct roc_nix *roc_nix)
41 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
42 struct nix_tel_node *node;
44 node = nix_tel_node_get(roc_nix);
46 if (nix->nb_rx_queues == node->n_rq &&
47 nix->nb_tx_queues == node->n_sq)
50 nix_tel_node_del(roc_nix);
53 node = plt_zmalloc(sizeof(struct nix_tel_node), 0);
59 plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_rq *), 0);
61 plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_cq *), 0);
63 plt_zmalloc(nix->nb_tx_queues * sizeof(struct roc_nix_sq *), 0);
64 TAILQ_INSERT_TAIL(&nix_list, node, node);
70 nix_tel_node_del(struct roc_nix *roc_nix)
72 struct nix_tel_node *node;
74 TAILQ_FOREACH(node, &nix_list, node) {
75 if (node->nix == roc_nix) {
79 TAILQ_REMOVE(&nix_list, node, node);
86 static struct nix_tel_node *
87 nix_tel_node_get_by_pcidev_name(const char *name)
89 struct nix_tel_node *node, *roc_node = NULL;
91 TAILQ_FOREACH(node, &nix_list, node) {
92 if (!strncmp(node->nix->pci_dev->name, name,
103 nix_tel_node_add_rq(struct roc_nix_rq *rq)
105 struct nix_tel_node *node;
107 node = nix_tel_node_get(rq->roc_nix);
111 node->rqs[rq->qid] = rq;
117 nix_tel_node_add_cq(struct roc_nix_cq *cq)
119 struct nix_tel_node *node;
121 node = nix_tel_node_get(cq->roc_nix);
125 node->cqs[cq->qid] = cq;
131 nix_tel_node_add_sq(struct roc_nix_sq *sq)
133 struct nix_tel_node *node;
135 node = nix_tel_node_get(sq->roc_nix);
139 node->sqs[sq->qid] = sq;
145 cnxk_tel_nix(struct roc_nix *roc_nix, struct plt_tel_data *d)
147 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
149 struct dev *dev = &nix->dev;
151 plt_tel_data_add_dict_ptr(d, "nix", nix);
152 plt_tel_data_add_dict_int(d, "pf_func", dev->pf_func);
153 plt_tel_data_add_dict_int(d, "pf", dev_get_pf(dev->pf_func));
154 plt_tel_data_add_dict_int(d, "vf", dev_get_vf(dev->pf_func));
156 CNXK_TEL_DICT_PTR(d, dev, bar2);
157 CNXK_TEL_DICT_PTR(d, dev, bar4);
158 CNXK_TEL_DICT_INT(d, roc_nix, port_id);
159 CNXK_TEL_DICT_INT(d, roc_nix, rss_tag_as_xor);
160 CNXK_TEL_DICT_INT(d, roc_nix, max_sqb_count);
161 CNXK_TEL_DICT_PTR(d, nix, pci_dev);
162 CNXK_TEL_DICT_PTR(d, nix, base);
163 CNXK_TEL_DICT_PTR(d, nix, lmt_base);
164 CNXK_TEL_DICT_INT(d, nix, reta_sz);
165 CNXK_TEL_DICT_INT(d, nix, tx_chan_base);
166 CNXK_TEL_DICT_INT(d, nix, rx_chan_base);
167 CNXK_TEL_DICT_INT(d, nix, nb_tx_queues);
168 CNXK_TEL_DICT_INT(d, nix, nb_rx_queues);
169 CNXK_TEL_DICT_INT(d, nix, lso_tsov6_idx);
170 CNXK_TEL_DICT_INT(d, nix, lso_tsov4_idx);
172 plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v4",
173 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
174 plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v6",
175 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
176 plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v4",
177 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
178 plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v6",
179 nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
180 plt_tel_data_add_dict_int(d, "lso_tun_v4v4",
181 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
182 plt_tel_data_add_dict_int(d, "lso_tun_v4v6",
183 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
184 plt_tel_data_add_dict_int(d, "lso_tun_v6v4",
185 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
186 plt_tel_data_add_dict_int(d, "lso_tun_v6v6",
187 nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
189 CNXK_TEL_DICT_INT(d, nix, lf_tx_stats);
190 CNXK_TEL_DICT_INT(d, nix, lf_rx_stats);
191 CNXK_TEL_DICT_INT(d, nix, cgx_links);
192 CNXK_TEL_DICT_INT(d, nix, lbk_links);
193 CNXK_TEL_DICT_INT(d, nix, sdp_links);
194 CNXK_TEL_DICT_INT(d, nix, tx_link);
195 CNXK_TEL_DICT_INT(d, nix, sqb_size);
196 CNXK_TEL_DICT_INT(d, nix, msixoff);
197 CNXK_TEL_DICT_INT(d, nix, cints);
198 CNXK_TEL_DICT_INT(d, nix, qints);
199 CNXK_TEL_DICT_INT(d, nix, sdp_link);
200 CNXK_TEL_DICT_INT(d, nix, ptp_en);
201 CNXK_TEL_DICT_INT(d, nix, rss_alg_idx);
202 CNXK_TEL_DICT_INT(d, nix, tx_pause);
208 cnxk_tel_nix_rq(struct roc_nix_rq *rq, struct plt_tel_data *d)
210 plt_tel_data_add_dict_ptr(d, "nix_rq", rq);
211 CNXK_TEL_DICT_INT(d, rq, qid);
212 CNXK_TEL_DICT_PTR(d, rq, aura_handle);
213 CNXK_TEL_DICT_INT(d, rq, ipsech_ena);
214 CNXK_TEL_DICT_INT(d, rq, first_skip);
215 CNXK_TEL_DICT_INT(d, rq, later_skip);
216 CNXK_TEL_DICT_INT(d, rq, lpb_size);
217 CNXK_TEL_DICT_INT(d, rq, sso_ena);
218 CNXK_TEL_DICT_INT(d, rq, tag_mask);
219 CNXK_TEL_DICT_INT(d, rq, flow_tag_width);
220 CNXK_TEL_DICT_INT(d, rq, tt);
221 CNXK_TEL_DICT_INT(d, rq, hwgrp);
222 CNXK_TEL_DICT_INT(d, rq, vwqe_ena);
223 CNXK_TEL_DICT_INT(d, rq, vwqe_first_skip);
224 CNXK_TEL_DICT_INT(d, rq, vwqe_max_sz_exp);
225 CNXK_TEL_DICT_INT(d, rq, vwqe_wait_tmo);
226 CNXK_TEL_DICT_INT(d, rq, vwqe_aura_handle);
227 CNXK_TEL_DICT_PTR(d, rq, roc_nix);
233 cnxk_tel_nix_cq(struct roc_nix_cq *cq, struct plt_tel_data *d)
235 plt_tel_data_add_dict_ptr(d, "nix_cq", cq);
236 CNXK_TEL_DICT_INT(d, cq, qid);
237 CNXK_TEL_DICT_INT(d, cq, nb_desc);
238 CNXK_TEL_DICT_PTR(d, cq, roc_nix);
239 CNXK_TEL_DICT_PTR(d, cq, door);
240 CNXK_TEL_DICT_PTR(d, cq, status);
241 CNXK_TEL_DICT_PTR(d, cq, wdata);
242 CNXK_TEL_DICT_PTR(d, cq, desc_base);
243 CNXK_TEL_DICT_INT(d, cq, qmask);
249 cnxk_tel_nix_sq(struct roc_nix_sq *sq, struct plt_tel_data *d)
251 plt_tel_data_add_dict_ptr(d, "nix_sq", sq);
252 CNXK_TEL_DICT_INT(d, sq, qid);
253 CNXK_TEL_DICT_INT(d, sq, max_sqe_sz);
254 CNXK_TEL_DICT_INT(d, sq, nb_desc);
255 CNXK_TEL_DICT_INT(d, sq, sqes_per_sqb_log2);
256 CNXK_TEL_DICT_PTR(d, sq, roc_nix);
257 CNXK_TEL_DICT_PTR(d, sq, aura_handle);
258 CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs_adj);
259 CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs);
260 CNXK_TEL_DICT_PTR(d, sq, io_addr);
261 CNXK_TEL_DICT_PTR(d, sq, lmt_addr);
262 CNXK_TEL_DICT_PTR(d, sq, sqe_mem);
263 CNXK_TEL_DICT_PTR(d, sq, fc);
269 nix_rq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
271 volatile struct nix_rq_ctx_s *ctx;
273 ctx = (volatile struct nix_rq_ctx_s *)qctx;
276 CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
277 CNXK_TEL_DICT_BF_PTR(d, ctx, substream, w0_);
278 CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
279 CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0_);
280 CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0_);
281 CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0_);
282 CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
285 CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
286 CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
287 CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
288 CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
289 CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
290 CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
291 CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
292 CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
293 CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
296 CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
297 CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
298 CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
299 CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
300 CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
301 CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
302 CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
303 CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
304 CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
307 CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
308 CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
309 CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
310 CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
311 CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
312 CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
313 CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
314 CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
317 CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
318 CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
319 CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
320 CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
321 CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
322 CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
323 CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
326 CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
327 CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
328 CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
329 CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
332 CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
335 CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
338 CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
341 CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
344 CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_);
348 nix_rq_ctx(volatile void *qctx, struct plt_tel_data *d)
350 volatile struct nix_cn10k_rq_ctx_s *ctx;
352 ctx = (volatile struct nix_cn10k_rq_ctx_s *)qctx;
355 CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
356 CNXK_TEL_DICT_INT(d, ctx, len_ol3_dis, w0_);
357 CNXK_TEL_DICT_INT(d, ctx, len_ol4_dis, w0_);
358 CNXK_TEL_DICT_INT(d, ctx, len_il3_dis, w0_);
359 CNXK_TEL_DICT_INT(d, ctx, len_il4_dis, w0_);
360 CNXK_TEL_DICT_INT(d, ctx, csum_ol4_dis, w0_);
361 CNXK_TEL_DICT_INT(d, ctx, lenerr_dis, w0_);
362 CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0);
363 CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0);
364 CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0);
365 CNXK_TEL_DICT_INT(d, ctx, ena, w0);
368 CNXK_TEL_DICT_INT(d, ctx, chi_ena, w1_);
369 CNXK_TEL_DICT_INT(d, ctx, ipsecd_drop_en, w1_);
370 CNXK_TEL_DICT_INT(d, ctx, pb_stashing, w1_);
371 CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
372 CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
373 CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
374 CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
375 CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
376 CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
377 CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
378 CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
379 CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
382 CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
383 CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
384 CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
385 CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
386 CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
387 CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
388 CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
389 CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
390 CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
391 CNXK_TEL_DICT_INT(d, ctx, policer_ena, w2_);
392 CNXK_TEL_DICT_INT(d, ctx, band_prof_id, w2_);
395 CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
396 CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
397 CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
398 CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
399 CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
400 CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
401 CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
402 CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
405 CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
406 CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
407 CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
408 CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
409 CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
410 CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
411 CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
414 CNXK_TEL_DICT_INT(d, ctx, vwqe_skip, w5_);
415 CNXK_TEL_DICT_INT(d, ctx, max_vsize_exp, w5_);
416 CNXK_TEL_DICT_INT(d, ctx, vtime_wait, w5_);
417 CNXK_TEL_DICT_INT(d, ctx, vwqe_ena, w5_);
418 CNXK_TEL_DICT_INT(d, ctx, ipsec_vwqe, w5_);
419 CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
420 CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
421 CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
422 CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
425 CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
428 CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
431 CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
434 CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
437 CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_);
441 cnxk_tel_nix_rq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
443 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
444 struct dev *dev = &nix->dev;
445 struct npa_lf *npa_lf;
449 npa_lf = idev_npa_obj_get();
451 return NPA_ERR_DEVICE_NOT_BOUNDED;
453 rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_RQ, n, &qctx);
455 plt_err("Failed to get rq context");
459 if (roc_model_is_cn9k())
460 nix_rq_ctx_cn9k(qctx, d);
468 cnxk_tel_nix_cq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
470 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
471 struct dev *dev = &nix->dev;
472 struct npa_lf *npa_lf;
473 volatile struct nix_cq_ctx_s *ctx;
476 npa_lf = idev_npa_obj_get();
478 return NPA_ERR_DEVICE_NOT_BOUNDED;
480 rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_CQ, n, (void *)&ctx);
482 plt_err("Failed to get cq context");
487 CNXK_TEL_DICT_PTR(d, ctx, base, w0_);
490 CNXK_TEL_DICT_U64(d, ctx, wrptr, w1_);
491 CNXK_TEL_DICT_INT(d, ctx, avg_con, w1_);
492 CNXK_TEL_DICT_INT(d, ctx, cint_idx, w1_);
493 CNXK_TEL_DICT_INT(d, ctx, cq_err, w1_);
494 CNXK_TEL_DICT_INT(d, ctx, qint_idx, w1_);
495 CNXK_TEL_DICT_INT(d, ctx, bpid, w1_);
496 CNXK_TEL_DICT_INT(d, ctx, bp_ena, w1_);
499 CNXK_TEL_DICT_INT(d, ctx, update_time, w2_);
500 CNXK_TEL_DICT_INT(d, ctx, avg_level, w2_);
501 CNXK_TEL_DICT_INT(d, ctx, head, w2_);
502 CNXK_TEL_DICT_INT(d, ctx, tail, w2_);
505 CNXK_TEL_DICT_INT(d, ctx, cq_err_int_ena, w3_);
506 CNXK_TEL_DICT_INT(d, ctx, cq_err_int, w3_);
507 CNXK_TEL_DICT_INT(d, ctx, qsize, w3_);
508 CNXK_TEL_DICT_INT(d, ctx, caching, w3_);
509 CNXK_TEL_DICT_INT(d, ctx, substream, w3_);
510 CNXK_TEL_DICT_INT(d, ctx, ena, w3_);
511 CNXK_TEL_DICT_INT(d, ctx, drop_ena, w3_);
512 CNXK_TEL_DICT_INT(d, ctx, drop, w3_);
513 CNXK_TEL_DICT_INT(d, ctx, bp, w3_);
519 nix_sq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
521 volatile struct nix_sq_ctx_s *ctx;
523 ctx = (volatile struct nix_sq_ctx_s *)qctx;
526 CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
527 CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
528 CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
529 CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
530 CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
531 CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
534 CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
535 CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
536 CNXK_TEL_DICT_INT(d, ctx, smq_rr_quantum, w1_);
537 CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
538 CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
539 CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
540 CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
543 CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
544 CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
545 CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
546 CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
547 CNXK_TEL_DICT_INT(d, ctx, smq_rr_count, w2_);
550 CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
551 CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
552 CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
553 CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
554 CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
555 CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
556 CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
557 CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
558 CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
559 CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
560 CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
561 CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
564 CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
567 CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
570 CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
573 CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
576 CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
579 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
580 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
581 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
582 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
583 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
584 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
585 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
588 CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
591 CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
594 CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
597 CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
600 CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_);
604 nix_sq_ctx(volatile void *qctx, struct plt_tel_data *d)
606 volatile struct nix_cn10k_sq_ctx_s *ctx;
608 ctx = (volatile struct nix_cn10k_sq_ctx_s *)qctx;
611 CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
612 CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
613 CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
614 CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
615 CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
616 CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
619 CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
620 CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
621 CNXK_TEL_DICT_INT(d, ctx, smq_rr_weight, w1_);
622 CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
623 CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
624 CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
625 CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
628 CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
629 CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
630 CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
631 CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
632 CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_ub, w2_);
633 CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_lb, w2_);
636 CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
637 CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
638 CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
639 CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
640 CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
641 CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
642 CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
643 CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
644 CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
645 CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
646 CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
647 CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
650 CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
653 CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
656 CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
659 CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
662 CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
665 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
666 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
667 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
668 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
669 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
670 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
671 CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
674 CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
677 CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
680 CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
683 CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
686 CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_);
690 cnxk_tel_nix_sq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
692 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
693 struct dev *dev = &nix->dev;
694 struct npa_lf *npa_lf;
698 npa_lf = idev_npa_obj_get();
700 return NPA_ERR_DEVICE_NOT_BOUNDED;
702 rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_SQ, n, &qctx);
704 plt_err("Failed to get rq context");
708 if (roc_model_is_cn9k())
709 nix_sq_ctx_cn9k(qctx, d);
717 cnxk_nix_tel_handle_list(const char *cmd __plt_unused,
718 const char *params __plt_unused,
719 struct plt_tel_data *d)
721 struct nix_tel_node *node;
722 struct roc_nix *roc_nix;
724 plt_tel_data_start_array(d, PLT_TEL_STRING_VAL);
726 TAILQ_FOREACH(node, &nix_list, node) {
728 plt_tel_data_add_array_string(d, roc_nix->pci_dev->name);
735 cnxk_nix_tel_handle_info(const char *cmd __plt_unused, const char *params,
736 struct plt_tel_data *d)
738 char name[PCI_PRI_STR_SIZE];
739 struct nix_tel_node *node;
741 if (params == NULL || strlen(params) == 0 || !isdigit(*params))
744 plt_strlcpy(name, params, PCI_PRI_STR_SIZE);
746 node = nix_tel_node_get_by_pcidev_name(name);
750 plt_tel_data_start_dict(d);
751 return cnxk_tel_nix(node->nix, d);
755 cnxk_nix_tel_handle_info_x(const char *cmd, const char *params,
756 struct plt_tel_data *d)
758 struct nix_tel_node *node;
763 if (params == NULL || strlen(params) == 0 || !isdigit(*params))
766 plt_strlcpy(buf, params, PCI_PRI_STR_SIZE + 1);
767 name = strtok(buf, ",");
771 param = strtok(NULL, "\0");
773 node = nix_tel_node_get_by_pcidev_name(name);
777 plt_tel_data_start_dict(d);
779 if (strstr(cmd, "rq")) {
780 char *tok = strtok(param, ",");
786 rq = strtol(tok, NULL, 10);
787 if ((node->n_rq <= rq) || (rq < 0))
790 if (strstr(cmd, "ctx"))
791 rc = cnxk_tel_nix_rq_ctx(node->nix, rq, d);
793 rc = cnxk_tel_nix_rq(node->rqs[rq], d);
795 } else if (strstr(cmd, "cq")) {
796 char *tok = strtok(param, ",");
802 cq = strtol(tok, NULL, 10);
803 if ((node->n_cq <= cq) || (cq < 0))
806 if (strstr(cmd, "ctx"))
807 rc = cnxk_tel_nix_cq_ctx(node->nix, cq, d);
809 rc = cnxk_tel_nix_cq(node->cqs[cq], d);
811 } else if (strstr(cmd, "sq")) {
812 char *tok = strtok(param, ",");
818 sq = strtol(tok, NULL, 10);
819 if ((node->n_sq <= sq) || (sq < 0))
822 if (strstr(cmd, "ctx"))
823 rc = cnxk_tel_nix_sq_ctx(node->nix, sq, d);
825 rc = cnxk_tel_nix_sq(node->sqs[sq], d);
832 PLT_INIT(cnxk_telemetry_nix_init)
834 TAILQ_INIT(&nix_list);
836 plt_telemetry_register_cmd(
837 "/cnxk/nix/list", cnxk_nix_tel_handle_list,
838 "Returns list of available NIX devices. Takes no parameters");
839 plt_telemetry_register_cmd(
840 "/cnxk/nix/info", cnxk_nix_tel_handle_info,
841 "Returns nix information. Parameters: pci id");
842 plt_telemetry_register_cmd(
843 "/cnxk/nix/rq/info", cnxk_nix_tel_handle_info_x,
844 "Returns nix rq information. Parameters: pci id, rq id");
845 plt_telemetry_register_cmd(
846 "/cnxk/nix/rq/ctx", cnxk_nix_tel_handle_info_x,
847 "Returns nix rq context. Parameters: pci id, rq id");
848 plt_telemetry_register_cmd(
849 "/cnxk/nix/cq/info", cnxk_nix_tel_handle_info_x,
850 "Returns nix cq information. Parameters: pci id, cq id");
851 plt_telemetry_register_cmd(
852 "/cnxk/nix/cq/ctx", cnxk_nix_tel_handle_info_x,
853 "Returns nix cq context. Parameters: pci id, cq id");
854 plt_telemetry_register_cmd(
855 "/cnxk/nix/sq/info", cnxk_nix_tel_handle_info_x,
856 "Returns nix sq information. Parameters: pci id, sq id");
857 plt_telemetry_register_cmd(
858 "/cnxk/nix/sq/ctx", cnxk_nix_tel_handle_info_x,
859 "Returns nix sq context. Parameters: pci id, sq id");