Skip to contentSkip to conversation

common/cnxk: enable npa telemetry

PATCH Superseded Gowrishankar Muthukrishnan 10 participants 121 messages Jul 29, 2021 – Nov 4, 2021 Page 2 of 2

Subsystems (3)
lore
Share & tools
lore
Reviewed-by on v9 2/4
#109 lore raw

Re: [dpdk-dev] [EXT] [v9 2/4] common/cnxk: add telemetry endpoints to nix

In reply to Gowrishankar Muthukrishnan
Quoted 17 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Gowrishankar Muthukrishnan
Sent: Wednesday, September 29, 2021 12:25 PM
To: [email protected]
Cc: Jerin Jacob Kollanukkaran <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Sunil Kumar Kori <[email protected]>; Satha Koteswara Rao Kottidi <[email protected]>; Ashwin Sekhar Thalakalath Kottilveetil <[email protected]>; Pavan Nikhilesh Bhagavatula <[email protected]>; Gowrishankar Muthukrishnan <[email protected]>
Subject: [EXT] [dpdk-dev] [v9 2/4] common/cnxk: add telemetry endpoints to nix

Quoted 6 lines

External Email

----------------------------------------------------------------------
Add telemetry endpoints to nix.

Patch looks good to me.

Thanks
Harman

Quoted 985 lines
---
 drivers/common/cnxk/cnxk_telemetry_nix.c | 849
+++++++++++++++++++++++
 drivers/common/cnxk/meson.build          |   3 +-
 drivers/common/cnxk/roc_nix.c            |   3 +
 drivers/common/cnxk/roc_nix_priv.h       |   9 +
 drivers/common/cnxk/roc_nix_queue.c      |  15 +-
 drivers/common/cnxk/roc_platform.h       |   3 +
 6 files changed, 878 insertions(+), 4 deletions(-)  create mode 100644

drivers/common/cnxk/cnxk_telemetry_nix.c

drivers/common/cnxk/cnxk_telemetry_nix.c new file +57 -0
new file mode 100644
index 0000000000..1175f68a51
@@ -0,0 +1,849 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cnxk_telemetry.h"
+#include "roc_api.h"
+#include "roc_priv.h"
+
+struct nix_tel_node {
+	TAILQ_ENTRY(nix_tel_node) node;
+	struct roc_nix *nix;
+	uint16_t n_rq;
+	uint16_t n_cq;
+	uint16_t n_sq;
+	struct roc_nix_rq **rqs;
+	struct roc_nix_cq **cqs;
+	struct roc_nix_sq **sqs;
+};
+
+TAILQ_HEAD(nix_tel_node_list, nix_tel_node); static struct
+nix_tel_node_list nix_list;
+
+static struct nix_tel_node *
+nix_tel_node_get(struct roc_nix *roc_nix) {
+	struct nix_tel_node *node, *roc_node = NULL;
+
+	TAILQ_FOREACH(node, &nix_list, node) {
+		if (node->nix == roc_nix) {
+			roc_node = node;
+			break;
+		}
+	}
+
+	return roc_node;
+}
+
+int
+nix_tel_node_add(struct roc_nix *roc_nix) {
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+	struct nix_tel_node *node;
+
+	node = nix_tel_node_get(roc_nix);
+	if (node) {
+		if (nix->nb_rx_queues == node->n_rq &&
+		    nix->nb_tx_queues == node->n_sq)
+			return 0;
+
+		nix_tel_node_del(roc_nix);
+	}
+
+	node = plt_zmalloc(sizeof(struct nix_tel_node), 0);
+	if (!node)
+		return -1;
+
+	node->nix = roc_nix;
+	node->rqs =
+		plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_rq *),

0);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +2 -0
+	node->cqs =
+		plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_cq *),

0);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +2 -0
+	node->sqs =
+		plt_zmalloc(nix->nb_tx_queues * sizeof(struct roc_nix_sq *),

0);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +104 -0
+	TAILQ_INSERT_TAIL(&nix_list, node, node);
+
+	return 0;
+}
+
+void
+nix_tel_node_del(struct roc_nix *roc_nix) {
+	struct nix_tel_node *node;
+
+	TAILQ_FOREACH(node, &nix_list, node) {
+		if (node->nix == roc_nix) {
+			plt_free(node->rqs);
+			plt_free(node->cqs);
+			plt_free(node->sqs);
+			TAILQ_REMOVE(&nix_list, node, node);
+		}
+	}
+
+	plt_free(node);
+}
+
+static struct nix_tel_node *
+nix_tel_node_get_by_pcidev_name(const char *name) {
+	struct nix_tel_node *node, *roc_node = NULL;
+
+	TAILQ_FOREACH(node, &nix_list, node) {
+		if (!strncmp(node->nix->pci_dev->name, name,
+			     PCI_PRI_STR_SIZE)) {
+			roc_node = node;
+			break;
+		}
+	}
+
+	return roc_node;
+}
+
+int
+nix_tel_node_add_rq(struct roc_nix_rq *rq) {
+	struct nix_tel_node *node;
+
+	node = nix_tel_node_get(rq->roc_nix);
+	if (!node)
+		return -1;
+
+	node->rqs[rq->qid] = rq;
+	node->n_rq++;
+	return 0;
+}
+
+int
+nix_tel_node_add_cq(struct roc_nix_cq *cq) {
+	struct nix_tel_node *node;
+
+	node = nix_tel_node_get(cq->roc_nix);
+	if (!node)
+		return -1;
+
+	node->cqs[cq->qid] = cq;
+	node->n_cq++;
+	return 0;
+}
+
+int
+nix_tel_node_add_sq(struct roc_nix_sq *sq) {
+	struct nix_tel_node *node;
+
+	node = nix_tel_node_get(sq->roc_nix);
+	if (!node)
+		return -1;
+
+	node->sqs[sq->qid] = sq;
+	node->n_sq++;
+	return 0;
+}
+
+static int
+cnxk_tel_nix(struct roc_nix *roc_nix, struct plt_tel_data *d) {
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+
+	struct dev *dev = &nix->dev;
+
+	plt_tel_data_add_dict_ptr(d, "nix", nix);
+	plt_tel_data_add_dict_int(d, "pf_func", dev->pf_func);
+	plt_tel_data_add_dict_int(d, "pf", dev_get_pf(dev->pf_func));
+	plt_tel_data_add_dict_int(d, "vf", dev_get_vf(dev->pf_func));
+
+	CNXK_TEL_DICT_PTR(d, dev, bar2);
+	CNXK_TEL_DICT_PTR(d, dev, bar4);
+	CNXK_TEL_DICT_INT(d, roc_nix, port_id);
+	CNXK_TEL_DICT_INT(d, roc_nix, rss_tag_as_xor);
+	CNXK_TEL_DICT_INT(d, roc_nix, max_sqb_count);
+	CNXK_TEL_DICT_PTR(d, nix, pci_dev);
+	CNXK_TEL_DICT_PTR(d, nix, base);
+	CNXK_TEL_DICT_PTR(d, nix, lmt_base);
+	CNXK_TEL_DICT_INT(d, nix, reta_sz);
+	CNXK_TEL_DICT_INT(d, nix, tx_chan_base);
+	CNXK_TEL_DICT_INT(d, nix, rx_chan_base);
+	CNXK_TEL_DICT_INT(d, nix, nb_tx_queues);
+	CNXK_TEL_DICT_INT(d, nix, nb_rx_queues);
+	CNXK_TEL_DICT_INT(d, nix, lso_tsov6_idx);
+	CNXK_TEL_DICT_INT(d, nix, lso_tsov4_idx);
+
+	plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v4",
+				  nix-
Quoted 1 line

lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V4]);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +2 -0
+	plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v6",
+				  nix-
Quoted 1 line

lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V6]);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +2 -0
+	plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v4",
+				  nix-
Quoted 1 line

lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V4]);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +2 -0
+	plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v6",
+				  nix-
Quoted 1 line

lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V6]);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +2 -0
+	plt_tel_data_add_dict_int(d, "lso_tun_v4v4",
+				  nix-
Quoted 1 line

lso_tun_idx[ROC_NIX_LSO_TUN_V4V4]);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +2 -0
+	plt_tel_data_add_dict_int(d, "lso_tun_v4v6",
+				  nix-
Quoted 1 line

lso_tun_idx[ROC_NIX_LSO_TUN_V4V6]);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +2 -0
+	plt_tel_data_add_dict_int(d, "lso_tun_v6v4",
+				  nix-
Quoted 1 line

lso_tun_idx[ROC_NIX_LSO_TUN_V6V4]);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +2 -0
+	plt_tel_data_add_dict_int(d, "lso_tun_v6v6",
+				  nix-
Quoted 1 line

lso_tun_idx[ROC_NIX_LSO_TUN_V6V6]);

drivers/common/cnxk/cnxk_telemetry_nix.c new file +529 -0
+
+	CNXK_TEL_DICT_INT(d, nix, lf_tx_stats);
+	CNXK_TEL_DICT_INT(d, nix, lf_rx_stats);
+	CNXK_TEL_DICT_INT(d, nix, cgx_links);
+	CNXK_TEL_DICT_INT(d, nix, lbk_links);
+	CNXK_TEL_DICT_INT(d, nix, sdp_links);
+	CNXK_TEL_DICT_INT(d, nix, tx_link);
+	CNXK_TEL_DICT_INT(d, nix, sqb_size);
+	CNXK_TEL_DICT_INT(d, nix, msixoff);
+	CNXK_TEL_DICT_INT(d, nix, cints);
+	CNXK_TEL_DICT_INT(d, nix, qints);
+	CNXK_TEL_DICT_INT(d, nix, sdp_link);
+	CNXK_TEL_DICT_INT(d, nix, ptp_en);
+	CNXK_TEL_DICT_INT(d, nix, rss_alg_idx);
+	CNXK_TEL_DICT_INT(d, nix, tx_pause);
+
+	return 0;
+}
+
+static int
+cnxk_tel_nix_rq(struct roc_nix_rq *rq, struct plt_tel_data *d) {
+	plt_tel_data_add_dict_ptr(d, "nix_rq", rq);
+	CNXK_TEL_DICT_INT(d, rq, qid);
+	CNXK_TEL_DICT_PTR(d, rq, aura_handle);
+	CNXK_TEL_DICT_INT(d, rq, ipsech_ena);
+	CNXK_TEL_DICT_INT(d, rq, first_skip);
+	CNXK_TEL_DICT_INT(d, rq, later_skip);
+	CNXK_TEL_DICT_INT(d, rq, lpb_size);
+	CNXK_TEL_DICT_INT(d, rq, sso_ena);
+	CNXK_TEL_DICT_INT(d, rq, tag_mask);
+	CNXK_TEL_DICT_INT(d, rq, flow_tag_width);
+	CNXK_TEL_DICT_INT(d, rq, tt);
+	CNXK_TEL_DICT_INT(d, rq, hwgrp);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_ena);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_first_skip);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_max_sz_exp);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_wait_tmo);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_aura_handle);
+	CNXK_TEL_DICT_PTR(d, rq, roc_nix);
+
+	return 0;
+}
+
+static int
+cnxk_tel_nix_cq(struct roc_nix_cq *cq, struct plt_tel_data *d) {
+	plt_tel_data_add_dict_ptr(d, "nix_cq", cq);
+	CNXK_TEL_DICT_INT(d, cq, qid);
+	CNXK_TEL_DICT_INT(d, cq, nb_desc);
+	CNXK_TEL_DICT_PTR(d, cq, roc_nix);
+	CNXK_TEL_DICT_PTR(d, cq, door);
+	CNXK_TEL_DICT_PTR(d, cq, status);
+	CNXK_TEL_DICT_PTR(d, cq, wdata);
+	CNXK_TEL_DICT_PTR(d, cq, desc_base);
+	CNXK_TEL_DICT_INT(d, cq, qmask);
+
+	return 0;
+}
+
+static int
+cnxk_tel_nix_sq(struct roc_nix_sq *sq, struct plt_tel_data *d) {
+	plt_tel_data_add_dict_ptr(d, "nix_sq", sq);
+	CNXK_TEL_DICT_INT(d, sq, qid);
+	CNXK_TEL_DICT_INT(d, sq, max_sqe_sz);
+	CNXK_TEL_DICT_INT(d, sq, nb_desc);
+	CNXK_TEL_DICT_INT(d, sq, sqes_per_sqb_log2);
+	CNXK_TEL_DICT_PTR(d, sq, roc_nix);
+	CNXK_TEL_DICT_PTR(d, sq, aura_handle);
+	CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs_adj);
+	CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs);
+	CNXK_TEL_DICT_PTR(d, sq, io_addr);
+	CNXK_TEL_DICT_PTR(d, sq, lmt_addr);
+	CNXK_TEL_DICT_PTR(d, sq, sqe_mem);
+	CNXK_TEL_DICT_PTR(d, sq, fc);
+
+	return 0;
+}
+
+static void
+nix_rq_ctx_cn9k(void *qctx, struct plt_tel_data *d) {
+	struct nix_rq_ctx_s *ctx = (struct nix_rq_ctx_s *)qctx;
+
+	/* W0 */
+	CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
+	CNXK_TEL_DICT_BF_PTR(d, ctx, substream, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
+
+	/* W1 */
+	CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
+
+	/* W4 */
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
+
+	/* W5 */
+	CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
+
+	/* W6 */
+	CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
+
+	/* W7 */
+	CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
+
+	/* W8 */
+	CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
+
+	/* W9 */
+	CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
+
+	/* W10 */
+	CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_); }
+
+static void
+nix_rq_ctx(void *qctx, struct plt_tel_data *d) {
+	struct nix_cn10k_rq_ctx_s *ctx = (struct nix_cn10k_rq_ctx_s *)qctx;
+
+	/* W0 */
+	CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, len_ol3_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, len_ol4_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, len_il3_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, len_il4_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, csum_ol4_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, lenerr_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0);
+	CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0);
+	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w0);
+
+	/* W1 */
+	CNXK_TEL_DICT_INT(d, ctx, chi_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, ipsecd_drop_en, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, pb_stashing, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, policer_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, band_prof_id, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
+
+	/* W4 */
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
+
+	/* W5 */
+	CNXK_TEL_DICT_INT(d, ctx, vwqe_skip, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, max_vsize_exp, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, vtime_wait, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, vwqe_ena, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, ipsec_vwqe, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
+
+	/* W6 */
+	CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
+
+	/* W7 */
+	CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
+
+	/* W8 */
+	CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
+
+	/* W9 */
+	CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
+
+	/* W10 */
+	CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_); }
+
+static int
+cnxk_tel_nix_rq_ctx(struct roc_nix *roc_nix, uint8_t n, struct
+plt_tel_data *d) {
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+	struct dev *dev = &nix->dev;
+	struct npa_lf *npa_lf;
+	volatile void *qctx;
+	int rc = -1;
+
+	npa_lf = idev_npa_obj_get();
+	if (npa_lf == NULL)
+		return NPA_ERR_DEVICE_NOT_BOUNDED;
+
+	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_RQ, n, &qctx);
+	if (rc) {
+		plt_err("Failed to get rq context");
+		return rc;
+	}
+
+	if (roc_model_is_cn9k())
+		nix_rq_ctx_cn9k(&qctx, d);
+	else
+		nix_rq_ctx(&qctx, d);
+
+	return 0;
+}
+
+static int
+cnxk_tel_nix_cq_ctx(struct roc_nix *roc_nix, uint8_t n, struct
+plt_tel_data *d) {
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+	struct dev *dev = &nix->dev;
+	struct npa_lf *npa_lf;
+	volatile struct nix_cq_ctx_s *ctx;
+	int rc = -1;
+
+	npa_lf = idev_npa_obj_get();
+	if (npa_lf == NULL)
+		return NPA_ERR_DEVICE_NOT_BOUNDED;
+
+	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_CQ, n, (void *)&ctx);
+	if (rc) {
+		plt_err("Failed to get cq context");
+		return rc;
+	}
+
+	/* W0 */
+	CNXK_TEL_DICT_PTR(d, ctx, base, w0_);
+
+	/* W1 */
+	CNXK_TEL_DICT_U64(d, ctx, wrptr, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, avg_con, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, cint_idx, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_err, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, bpid, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, bp_ena, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, update_time, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, avg_level, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, head, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, tail, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, cq_err_int_ena, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_err_int, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, qsize, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, caching, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, substream, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, drop_ena, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, bp, w3_);
+
+	return 0;
+}
+
+static void
+nix_sq_ctx_cn9k(void *qctx, struct plt_tel_data *d) {
+	struct nix_sq_ctx_s *ctx = (struct nix_sq_ctx_s *)qctx;
+
+	/* W0 */
+	CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
+
+	/* W1 */
+	CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_quantum, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
+
+	/* W4 */
+	CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
+
+	/* W5 */
+	CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
+
+	/* W6 */
+	CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
+
+	/* W7 */
+	CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
+
+	/* W8 */
+	CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
+
+	/* W9 */
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
+
+	/* W10 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
+
+	/* W11 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
+
+	/* W12 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
+
+	/* W14 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
+
+	/* W15 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_); }
+
+static void
+nix_sq_ctx(void *qctx, struct plt_tel_data *d) {
+	struct nix_cn10k_sq_ctx_s *ctx = (struct nix_cn10k_sq_ctx_s *)qctx;
+
+	/* W0 */
+	CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
+
+	/* W1 */
+	CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_weight, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_ub, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_lb, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
+
+	/* W4 */
+	CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
+
+	/* W5 */
+	CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
+
+	/* W6 */
+	CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
+
+	/* W7 */
+	CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
+
+	/* W8 */
+	CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
+
+	/* W9 */
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
+
+	/* W10 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
+
+	/* W11 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
+
+	/* W12 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
+
+	/* W14 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
+
+	/* W15 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_); }
+
+static int
+cnxk_tel_nix_sq_ctx(struct roc_nix *roc_nix, uint8_t n, struct
+plt_tel_data *d) {
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+	struct dev *dev = &nix->dev;
+	struct npa_lf *npa_lf;
+	volatile void *qctx;
+	int rc = -1;
+
+	npa_lf = idev_npa_obj_get();
+	if (npa_lf == NULL)
+		return NPA_ERR_DEVICE_NOT_BOUNDED;
+
+	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_SQ, n, &qctx);
+	if (rc) {
+		plt_err("Failed to get rq context");
+		return rc;
+	}
+
+	if (roc_model_is_cn9k())
+		nix_sq_ctx_cn9k(&qctx, d);
+	else
+		nix_sq_ctx(&qctx, d);
+
+	return 0;
+}
+
+static int
+cnxk_nix_tel_handle_list(const char *cmd __plt_unused,
+			 const char *params __plt_unused,
+			 struct plt_tel_data *d)
+{
+	struct nix_tel_node *node;
+	struct roc_nix *roc_nix;
+
+	plt_tel_data_start_array(d, PLT_TEL_STRING_VAL);
+
+	TAILQ_FOREACH(node, &nix_list, node) {
+		roc_nix = node->nix;
+		plt_tel_data_add_array_string(d, roc_nix->pci_dev->name);
+	}
+
+	return 0;
+}
+
+static int
+cnxk_nix_tel_handle_info(const char *cmd __plt_unused, const char

*params,

drivers/common/cnxk/cnxk_telemetry_nix.c new file +121 -0
+			 struct plt_tel_data *d)
+{
+	char name[PCI_PRI_STR_SIZE];
+	struct nix_tel_node *node;
+
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		return -1;
+
+	plt_strlcpy(name, params, PCI_PRI_STR_SIZE);
+
+	node = nix_tel_node_get_by_pcidev_name(name);
+	if (!node)
+		return -1;
+
+	plt_tel_data_start_dict(d);
+	return cnxk_tel_nix(node->nix, d);
+}
+
+static int
+cnxk_nix_tel_handle_info_x(const char *cmd, const char *params,
+			   struct plt_tel_data *d)
+{
+	struct nix_tel_node *node;
+	char *name, *param;
+	char buf[1024];
+	int rc = -1;
+
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		goto exit;
+
+	plt_strlcpy(buf, params, PCI_PRI_STR_SIZE + 1);
+	name = strtok(buf, ",");
+	param = strtok(NULL, "\0");
+
+	node = nix_tel_node_get_by_pcidev_name(name);
+	if (!node)
+		goto exit;
+
+	plt_tel_data_start_dict(d);
+
+	if (strstr(cmd, "rq")) {
+		char *tok = strtok(param, ",");
+		int rq;
+
+		if (!tok)
+			goto exit;
+
+		rq = strtol(tok, NULL, 10);
+		if ((node->n_rq <= rq) || (rq < 0))
+			goto exit;
+
+		if (strstr(cmd, "ctx"))
+			rc = cnxk_tel_nix_rq_ctx(node->nix, rq, d);
+		else
+			rc = cnxk_tel_nix_rq(node->rqs[rq], d);
+
+	} else if (strstr(cmd, "cq")) {
+		char *tok = strtok(param, ",");
+		int cq;
+
+		if (!tok)
+			goto exit;
+
+		cq = strtol(tok, NULL, 10);
+		if ((node->n_cq <= cq) || (cq < 0))
+			goto exit;
+
+		if (strstr(cmd, "ctx"))
+			rc = cnxk_tel_nix_cq_ctx(node->nix, cq, d);
+		else
+			rc = cnxk_tel_nix_cq(node->cqs[cq], d);
+
+	} else if (strstr(cmd, "sq")) {
+		char *tok = strtok(param, ",");
+		int sq;
+
+		if (!tok)
+			goto exit;
+
+		sq = strtol(tok, NULL, 10);
+		if ((node->n_sq <= sq) || (sq < 0))
+			goto exit;
+
+		if (strstr(cmd, "ctx"))
+			rc = cnxk_tel_nix_sq_ctx(node->nix, sq, d);
+		else
+			rc = cnxk_tel_nix_sq(node->sqs[sq], d);
+	}
+
+exit:
+	return rc;
+}
+
+PLT_INIT(cnxk_telemetry_nix_init)
+{
+	TAILQ_INIT(&nix_list);
+
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/list", cnxk_nix_tel_handle_list,
+		"Returns list of available NIX devices. Takes no parameters");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/info", cnxk_nix_tel_handle_info,
+		"Returns nix information. Parameters: pci id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/rq/info", cnxk_nix_tel_handle_info_x,
+		"Returns nix rq information. Parameters: pci id, rq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/rq/ctx", cnxk_nix_tel_handle_info_x,
+		"Returns nix rq context. Parameters: pci id, rq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/cq/info", cnxk_nix_tel_handle_info_x,
+		"Returns nix cq information. Parameters: pci id, cq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/cq/ctx", cnxk_nix_tel_handle_info_x,
+		"Returns nix cq context. Parameters: pci id, cq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/sq/info", cnxk_nix_tel_handle_info_x,
+		"Returns nix sq information. Parameters: pci id, sq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/sq/ctx", cnxk_nix_tel_handle_info_x,
+		"Returns nix sq context. Parameters: pci id, sq id"); }
(quoted diff) +0 -0

b/drivers/common/cnxk/meson.build index f0a1c9f115..fe7a95b526 100644

drivers/common/cnxk/meson.build +2 -1
@@ -65,6 +65,7 @@ sources = files(
 sources += files('cnxk_security.c')
 
 # Telemetry common code
-sources += files('cnxk_telemetry_npa.c')
+sources += files('cnxk_telemetry_npa.c',
+                 'cnxk_telemetry_nix.c')
 
 deps += ['bus_pci', 'net', 'telemetry'] diff --git

a/drivers/common/cnxk/roc_nix.c b/drivers/common/cnxk/roc_nix.c index 3ab954e94d..17beb1a736 100644

drivers/common/cnxk/roc_nix.c +2 -0
@@ -178,6 +178,8 @@ roc_nix_lf_alloc(struct roc_nix *roc_nix, uint32_t
 nb_rxq, uint32_t nb_txq,
 	nix->sqs = plt_zmalloc(sizeof(struct roc_nix_sq *) * nb_txq, 0);
 	if (!nix->sqs)
 		return -ENOMEM;
+
+	nix_tel_node_add(roc_nix);
 fail:
 	return rc;

}

drivers/common/cnxk/roc_nix.c +1 -0
@@ -413,6 +415,7 @@ roc_nix_dev_init(struct roc_nix *roc_nix)
 dev_fini:
 	rc |= dev_fini(dev, pci_dev);
 fail:
+	nix_tel_node_del(roc_nix);
 	return rc;
 }
 
drivers/common/cnxk/roc_nix_priv.h +0 -0
index 2cd5a72347..ba639791ce 100644
@@ -424,4 +424,13 @@ int nix_lf_int_reg_dump(uintptr_t nix_lf_base,

uint64_t *data, uint16_t qints, int nix_q_ctx_get(struct dev *dev, uint8_t ctype, uint16_t qid,

drivers/common/cnxk/roc_nix_priv.h +9 -0
 		  __io void **ctx_p);
 
+/*
+ * Telemetry
+ */
+int nix_tel_node_add(struct roc_nix *roc_nix); void
+nix_tel_node_del(struct roc_nix *roc_nix); int
+nix_tel_node_add_rq(struct roc_nix_rq *rq); int
+nix_tel_node_add_cq(struct roc_nix_cq *cq); int
+nix_tel_node_add_sq(struct roc_nix_sq *sq);
+
 #endif /* _ROC_NIX_PRIV_H_ */
drivers/common/cnxk/roc_nix_queue.c +5 -1
index 8fbb13ecbd..f546fc83c5 100644
@@ -387,7 +387,11 @@ roc_nix_rq_init(struct roc_nix *roc_nix, struct
 roc_nix_rq *rq, bool ena)
 	if (rc)
 		return rc;
 
-	return mbox_process(mbox);
+	rc = mbox_process(mbox);
+	if (rc)
+		return rc;
+
+	return nix_tel_node_add_rq(rq);
 }
 

int

drivers/common/cnxk/roc_nix_queue.c +5 -1
@@ -415,7 +419,11 @@ roc_nix_rq_modify(struct roc_nix *roc_nix, struct
 roc_nix_rq *rq, bool ena)
 	if (rc)
 		return rc;
 
-	return mbox_process(mbox);
+	rc = mbox_process(mbox);
+	if (rc)
+		return rc;
+
+	return nix_tel_node_add_rq(rq);
 }
 

int

drivers/common/cnxk/roc_nix_queue.c +1 -1
@@ -504,7 +512,7 @@ roc_nix_cq_init(struct roc_nix *roc_nix, struct
 roc_nix_cq *cq)
 	if (rc)
 		goto free_mem;
 
-	return 0;
+	return nix_tel_node_add_cq(cq);
 
 free_mem:
drivers/common/cnxk/roc_nix_queue.c +1 -0
 	plt_free(cq->desc_base);
@@ -884,6 +892,7 @@ roc_nix_sq_init(struct roc_nix *roc_nix, struct
 roc_nix_sq *sq)
 					((qid & RVU_CN9K_LMT_SLOT_MASK)
 << 12));
 	}
 
+	rc = nix_tel_node_add_sq(sq);
 	return rc;

nomem:

drivers/common/cnxk/roc_nix_queue.c +0 -0
 	plt_free(sq->fc);
drivers/common/cnxk/roc_platform.h +3 -1
index 57073d62aa..b95af115f7 100644
@@ -145,7 +145,10 @@
 
 #define plt_strlcpy rte_strlcpy
 
+#define PLT_TEL_STRING_VAL RTE_TEL_STRING_VAL
 #define plt_tel_data		     rte_tel_data
+#define plt_tel_data_start_array     rte_tel_data_start_array
+#define plt_tel_data_add_array_string rte_tel_data_add_array_string
 #define plt_tel_data_start_dict      rte_tel_data_start_dict
 #define plt_tel_data_add_dict_int    rte_tel_data_add_dict_int
 #define plt_tel_data_add_dict_ptr(d, n, v)			\
--

2.25.1

#110 lore raw

PATCH v9 3/4 mempool/cnxk: add telemetry endpoints mempool

In reply to Gowrishankar Muthukrishnan

Adding telemetry endpoints to cnxk mempool driver.

---
 drivers/mempool/cnxk/cnxk_mempool_telemetry.c | 57 +++++++++++++++++++
 drivers/mempool/cnxk/meson.build              |  1 +
 2 files changed, 58 insertions(+)
 create mode 100644 drivers/mempool/cnxk/cnxk_mempool_telemetry.c
drivers/mempool/cnxk/cnxk_mempool_telemetry.c new file +57 -0
new file mode 100644
index 0000000000..c71798d7fd
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include <rte_mempool.h>
+#include <rte_memzone.h>
+#include <rte_telemetry.h>
+
+#include <roc_api.h>
+
+#include "cnxk_mempool.h"
+#include "cnxk_telemetry.h"
+
+struct mempool_info_cb_arg {
+	char *pool_name;
+	struct rte_tel_data *d;
+};
+
+static void
+mempool_info_cb(struct rte_mempool *mp, void *arg)
+{
+	struct mempool_info_cb_arg *info = (struct mempool_info_cb_arg *)arg;
+	int aura_id;
+
+	if (strncmp(mp->name, info->pool_name, RTE_MEMZONE_NAMESIZE))
+		return;
+
+	aura_id = roc_npa_aura_handle_to_aura(mp->pool_id);
+	rte_tel_data_add_dict_int(info->d, "aura_id", aura_id);
+}
+
+static int
+mempool_tel_handle_info(const char *cmd __rte_unused, const char *params,
+			struct rte_tel_data *d)
+{
+	struct mempool_info_cb_arg mp_arg;
+	char name[RTE_MEMZONE_NAMESIZE];
+
+	if (params == NULL || strlen(params) == 0)
+		return -EINVAL;
+
+	rte_strlcpy(name, params, RTE_MEMZONE_NAMESIZE);
+
+	rte_tel_data_start_dict(d);
+	mp_arg.pool_name = name;
+	mp_arg.d = d;
+	rte_mempool_walk(mempool_info_cb, &mp_arg);
+
+	return 0;
+}
+
+RTE_INIT(cnxk_mempool_init_telemetry)
+{
+	rte_telemetry_register_cmd(
+		"/cnxk/mempool/info", mempool_tel_handle_info,
+		"Returns mempool info. Parameters: pool_name");
+}
drivers/mempool/cnxk/meson.build +1 -0
index e28a9e044d..d5d1978569 100644
@@ -11,6 +11,7 @@ endif
 sources = files(
         'cnxk_mempool.c',
         'cnxk_mempool_ops.c',
+        'cnxk_mempool_telemetry.c',
         'cn9k_mempool_ops.c',
         'cn10k_mempool_ops.c',
 )
Signature · 1 line
2.25.1
Reviewed-by on v9 3/4
#111 lore raw

Re: [dpdk-dev] [EXT] [v9 3/4] mempool/cnxk: add telemetry endpoints mempool

Quoted 17 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Gowrishankar Muthukrishnan
Sent: Wednesday, September 29, 2021 12:25 PM
To: [email protected]
Cc: Jerin Jacob Kollanukkaran <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Sunil Kumar Kori <[email protected]>; Satha Koteswara Rao Kottidi <[email protected]>; Ashwin Sekhar Thalakalath Kottilveetil <[email protected]>; Pavan Nikhilesh Bhagavatula <[email protected]>; Gowrishankar Muthukrishnan <[email protected]>
Subject: [EXT] [dpdk-dev] [v9 3/4] mempool/cnxk: add telemetry endpoints mempool

Quoted 6 lines

External Email

----------------------------------------------------------------------
Adding telemetry endpoints to cnxk mempool driver.

LGTM

Thanks
Harman

Quoted 86 lines
---
 drivers/mempool/cnxk/cnxk_mempool_telemetry.c | 57
+++++++++++++++++++
 drivers/mempool/cnxk/meson.build              |  1 +
 2 files changed, 58 insertions(+)
 create mode 100644 drivers/mempool/cnxk/cnxk_mempool_telemetry.c
drivers/mempool/cnxk/cnxk_mempool_telemetry.c new file +21 -0
new file mode 100644
index 0000000000..c71798d7fd
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include <rte_mempool.h>
+#include <rte_memzone.h>
+#include <rte_telemetry.h>
+
+#include <roc_api.h>
+
+#include "cnxk_mempool.h"
+#include "cnxk_telemetry.h"
+
+struct mempool_info_cb_arg {
+	char *pool_name;
+	struct rte_tel_data *d;
+};
+
+static void
+mempool_info_cb(struct rte_mempool *mp, void *arg) {
+	struct mempool_info_cb_arg *info = (struct mempool_info_cb_arg

*)arg;

drivers/mempool/cnxk/cnxk_mempool_telemetry.c new file +3 -0
+	int aura_id;
+
+	if (strncmp(mp->name, info->pool_name,

RTE_MEMZONE_NAMESIZE))

drivers/mempool/cnxk/cnxk_mempool_telemetry.c new file +7 -0
+		return;
+
+	aura_id = roc_npa_aura_handle_to_aura(mp->pool_id);
+	rte_tel_data_add_dict_int(info->d, "aura_id", aura_id); }
+
+static int
+mempool_tel_handle_info(const char *cmd __rte_unused, const char

*params,

drivers/mempool/cnxk/cnxk_mempool_telemetry.c new file +23 -0
+			struct rte_tel_data *d)
+{
+	struct mempool_info_cb_arg mp_arg;
+	char name[RTE_MEMZONE_NAMESIZE];
+
+	if (params == NULL || strlen(params) == 0)
+		return -EINVAL;
+
+	rte_strlcpy(name, params, RTE_MEMZONE_NAMESIZE);
+
+	rte_tel_data_start_dict(d);
+	mp_arg.pool_name = name;
+	mp_arg.d = d;
+	rte_mempool_walk(mempool_info_cb, &mp_arg);
+
+	return 0;
+}
+
+RTE_INIT(cnxk_mempool_init_telemetry)
+{
+	rte_telemetry_register_cmd(
+		"/cnxk/mempool/info", mempool_tel_handle_info,
+		"Returns mempool info. Parameters: pool_name"); }
drivers/mempool/cnxk/meson.build +1 -1
index e28a9e044d..d5d1978569 100644
@@ -11,6 +11,7 @@ endif
 sources = files(
         'cnxk_mempool.c',
         'cnxk_mempool_ops.c',
+        'cnxk_mempool_telemetry.c',
         'cn9k_mempool_ops.c',
         'cn10k_mempool_ops.c',
 )
--

2.25.1

#112 lore raw

PATCH v9 4/4 net/cnxk: add telemetry endpoints to ethdev

In reply to Gowrishankar Muthukrishnan

Add telemetry endpoints to ethdev.

---
 drivers/net/cnxk/cnxk_ethdev_telemetry.c | 93 ++++++++++++++++++++++++
 drivers/net/cnxk/meson.build             |  1 +
 2 files changed, 94 insertions(+)
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_telemetry.c
drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +93 -0
new file mode 100644
index 0000000000..83bc65848c
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell International Ltd.
+ */
+
+#include <rte_telemetry.h>
+
+#include "cnxk_ethdev.h"
+
+/* Macro to count no of words in eth_info_s size */
+#define ETH_INFO_SZ                                                            \
+	(RTE_ALIGN_CEIL(sizeof(struct eth_info_s), sizeof(uint64_t)) /         \
+	 sizeof(uint64_t))
+#define MACADDR_LEN 18
+
+static int
+ethdev_tel_handle_info(const char *cmd __rte_unused,
+		       const char *params __rte_unused, struct rte_tel_data *d)
+{
+	struct rte_eth_dev *eth_dev;
+	struct rte_tel_data *i_data;
+	struct cnxk_eth_dev *dev;
+	union eth_info_u {
+		struct eth_info_s {
+			/** PF/VF information */
+			uint16_t pf_func;
+			uint8_t max_mac_entries;
+			bool dmac_filter_ena;
+			uint8_t dmac_filter_count;
+			uint8_t ptype_disable;
+			bool scalar_ena;
+			bool ptp_ena;
+			/* Platform specific offload flags */
+			uint16_t rx_offload_flags;
+			uint16_t tx_offload_flags;
+		} info;
+		uint64_t val[ETH_INFO_SZ];
+	} eth_info;
+	struct eth_info_s *info;
+	unsigned int i, j = 0;
+	int n_ports;
+
+	n_ports = rte_eth_dev_count_avail();
+	if (!n_ports) {
+		plt_err("No active ethernet ports found.");
+		return -1;
+	}
+
+	rte_tel_data_start_dict(d);
+	rte_tel_data_add_dict_int(d, "n_ports", n_ports);
+
+	i_data = rte_tel_data_alloc();
+	rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL);
+
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
+
+		eth_dev = &rte_eth_devices[i];
+		if (eth_dev) {
+			memset(&eth_info, 0, sizeof(eth_info));
+			info = &eth_info.info;
+			dev = cnxk_eth_pmd_priv(eth_dev);
+			if (dev) {
+				info->pf_func = roc_nix_get_pf_func(&dev->nix);
+				info->max_mac_entries = dev->max_mac_entries;
+				info->dmac_filter_ena = dev->dmac_filter_enable;
+				info->dmac_filter_count =
+					dev->dmac_filter_count;
+				info->ptype_disable = dev->ptype_disable;
+				info->scalar_ena = dev->scalar_ena;
+				info->ptp_ena = dev->ptp_en;
+				info->rx_offload_flags = dev->rx_offload_flags;
+				info->tx_offload_flags = dev->tx_offload_flags;
+			}
+
+			for (j = 0; j < ETH_INFO_SZ; j++)
+				rte_tel_data_add_array_u64(i_data,
+							   eth_info.val[j]);
+
+			j++;
+		}
+	}
+
+	rte_tel_data_add_dict_container(d, "info", i_data, 0);
+	return 0;
+}
+
+RTE_INIT(cnxk_ethdev_init_telemetry)
+{
+	rte_telemetry_register_cmd("/cnxk/ethdev/info", ethdev_tel_handle_info,
+				   "Returns ethdev device information");
+}
drivers/net/cnxk/meson.build +1 -0
index d1d4b4e15e..5b3b8422fb 100644
@@ -13,6 +13,7 @@ sources = files(
         'cnxk_ethdev_devargs.c',
         'cnxk_ethdev_ops.c',
         'cnxk_ethdev_sec.c',
+        'cnxk_ethdev_telemetry.c',
         'cnxk_link.c',
         'cnxk_lookup.c',
         'cnxk_ptp.c',
Signature · 1 line
2.25.1
Reviewed-by on v9 4/4
#113 lore raw

Re: [dpdk-dev] [EXT] [v9 4/4] net/cnxk: add telemetry endpoints to ethdev

Quoted 17 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Gowrishankar Muthukrishnan
Sent: Wednesday, September 29, 2021 12:25 PM
To: [email protected]
Cc: Jerin Jacob Kollanukkaran <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Sunil Kumar Kori <[email protected]>; Satha Koteswara Rao Kottidi <[email protected]>; Ashwin Sekhar Thalakalath Kottilveetil <[email protected]>; Pavan Nikhilesh Bhagavatula <[email protected]>; Gowrishankar Muthukrishnan <[email protected]>
Subject: [EXT] [dpdk-dev] [v9 4/4] net/cnxk: add telemetry endpoints to ethdev

Quoted 6 lines

External Email

----------------------------------------------------------------------
Add telemetry endpoints to ethdev.

LGTM

Thanks
Harman

Quoted 126 lines
---
 drivers/net/cnxk/cnxk_ethdev_telemetry.c | 93
++++++++++++++++++++++++
 drivers/net/cnxk/meson.build             |  1 +
 2 files changed, 94 insertions(+)
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_telemetry.c
drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +17 -0
new file mode 100644
index 0000000000..83bc65848c
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell International Ltd.
+ */
+
+#include <rte_telemetry.h>
+
+#include "cnxk_ethdev.h"
+
+/* Macro to count no of words in eth_info_s size */
+#define ETH_INFO_SZ                                                            \
+	(RTE_ALIGN_CEIL(sizeof(struct eth_info_s), sizeof(uint64_t)) /         \
+	 sizeof(uint64_t))
+#define MACADDR_LEN 18
+
+static int
+ethdev_tel_handle_info(const char *cmd __rte_unused,
+		       const char *params __rte_unused, struct rte_tel_data *d)

{

drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +47 -0
+	struct rte_eth_dev *eth_dev;
+	struct rte_tel_data *i_data;
+	struct cnxk_eth_dev *dev;
+	union eth_info_u {
+		struct eth_info_s {
+			/** PF/VF information */
+			uint16_t pf_func;
+			uint8_t max_mac_entries;
+			bool dmac_filter_ena;
+			uint8_t dmac_filter_count;
+			uint8_t ptype_disable;
+			bool scalar_ena;
+			bool ptp_ena;
+			/* Platform specific offload flags */
+			uint16_t rx_offload_flags;
+			uint16_t tx_offload_flags;
+		} info;
+		uint64_t val[ETH_INFO_SZ];
+	} eth_info;
+	struct eth_info_s *info;
+	unsigned int i, j = 0;
+	int n_ports;
+
+	n_ports = rte_eth_dev_count_avail();
+	if (!n_ports) {
+		plt_err("No active ethernet ports found.");
+		return -1;
+	}
+
+	rte_tel_data_start_dict(d);
+	rte_tel_data_add_dict_int(d, "n_ports", n_ports);
+
+	i_data = rte_tel_data_alloc();
+	rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL);
+
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
+
+		eth_dev = &rte_eth_devices[i];
+		if (eth_dev) {
+			memset(&eth_info, 0, sizeof(eth_info));
+			info = &eth_info.info;
+			dev = cnxk_eth_pmd_priv(eth_dev);
+			if (dev) {
+				info->pf_func = roc_nix_get_pf_func(&dev-
Quoted 1 line

nix);

drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +1 -0
+				info->max_mac_entries = dev-
Quoted 1 line

max_mac_entries;

drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +1 -0
+				info->dmac_filter_ena = dev-
Quoted 1 line

dmac_filter_enable;

drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +6 -0
+				info->dmac_filter_count =
+					dev->dmac_filter_count;
+				info->ptype_disable = dev->ptype_disable;
+				info->scalar_ena = dev->scalar_ena;
+				info->ptp_ena = dev->ptp_en;
+				info->rx_offload_flags = dev-
Quoted 1 line

rx_offload_flags;

drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +1 -0
+				info->tx_offload_flags = dev-
Quoted 1 line

tx_offload_flags;

drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +17 -0
+			}
+
+			for (j = 0; j < ETH_INFO_SZ; j++)
+				rte_tel_data_add_array_u64(i_data,
+							   eth_info.val[j]);
+
+			j++;
+		}
+	}
+
+	rte_tel_data_add_dict_container(d, "info", i_data, 0);
+	return 0;
+}
+
+RTE_INIT(cnxk_ethdev_init_telemetry)
+{
+	rte_telemetry_register_cmd("/cnxk/ethdev/info",

ethdev_tel_handle_info,

drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +1 -0
+				   "Returns ethdev device information"); }
drivers/net/cnxk/meson.build +1 -1
index d1d4b4e15e..5b3b8422fb 100644
@@ -13,6 +13,7 @@ sources = files(
         'cnxk_ethdev_devargs.c',
         'cnxk_ethdev_ops.c',
         'cnxk_ethdev_sec.c',
+        'cnxk_ethdev_telemetry.c',
         'cnxk_link.c',
         'cnxk_lookup.c',
         'cnxk_ptp.c',
--

2.25.1

#114 lore raw

v10 cover cnxk: enable telemetry endpoints

In reply to Gowrishankar Muthukrishnan

This patch series enables telemetry in cnxk for the following:
- NPA LF
- NIX LF
- Mempool driver
- Ethdev driver

Depends-on: series-18612 ("net/cnxk: support for inline ipsec")
Depends-on: patch-19248 ("ethdev: add telemetry endpoint for device info")
Depends-on: patch-19251 ("mempool: add telemetry endpoint for mempool info")

v10:
- added list endpoints for pool and aura (npa)

Gowrishankar Muthukrishnan (4):
common/cnxk: add telemetry endpoints to npa
common/cnxk: add telemetry endpoints to nix
mempool/cnxk: add telemetry endpoints mempool
net/cnxk: add telemetry endpoints to ethdev

 drivers/common/cnxk/cnxk_telemetry.h          |  26 +
 drivers/common/cnxk/cnxk_telemetry_nix.c      | 849 ++++++++++++++++++
 drivers/common/cnxk/cnxk_telemetry_npa.c      | 260 ++++++
 drivers/common/cnxk/meson.build               |   6 +
 drivers/common/cnxk/roc_nix.c                 |   3 +
 drivers/common/cnxk/roc_nix_priv.h            |   9 +
 drivers/common/cnxk/roc_nix_queue.c           |  15 +-
 drivers/common/cnxk/roc_platform.h            |  17 +
 drivers/mempool/cnxk/cnxk_mempool_telemetry.c |  57 ++
 drivers/mempool/cnxk/meson.build              |   1 +
 drivers/net/cnxk/cnxk_ethdev_telemetry.c      |  93 ++
 drivers/net/cnxk/meson.build                  |   1 +
 12 files changed, 1334 insertions(+), 3 deletions(-)
 create mode 100644 drivers/common/cnxk/cnxk_telemetry.h
 create mode 100644 drivers/common/cnxk/cnxk_telemetry_nix.c
 create mode 100644 drivers/common/cnxk/cnxk_telemetry_npa.c
 create mode 100644 drivers/mempool/cnxk/cnxk_mempool_telemetry.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_telemetry.c
Signature · 1 line
2.25.1
#115 lore raw

PATCH v10 1/4 common/cnxk: add telemetry endpoints to npa

Add telemetry endpoints to npa.

---
 drivers/common/cnxk/cnxk_telemetry.h     |  26 +++
 drivers/common/cnxk/cnxk_telemetry_npa.c | 260 +++++++++++++++++++++++
 drivers/common/cnxk/meson.build          |   5 +
 drivers/common/cnxk/roc_platform.h       |  15 ++
 4 files changed, 306 insertions(+)
 create mode 100644 drivers/common/cnxk/cnxk_telemetry.h
 create mode 100644 drivers/common/cnxk/cnxk_telemetry_npa.c
drivers/common/cnxk/cnxk_telemetry.h new file +26 -0
new file mode 100644
index 0000000000..1461fd893f
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Marvell.
+ */
+
+#ifndef __CNXK_TELEMETRY_H_
+#define __CNXK_TELEMETRY_H_
+
+#define CNXK_TEL_STR(s)		  #s
+#define CNXK_TEL_STR_PREFIX(s, p) CNXK_TEL_STR(p##s)
+#define CNXK_TEL_DICT_INT(d, p, s, ...)                                        \
+	plt_tel_data_add_dict_int(d, CNXK_TEL_STR_PREFIX(s, __VA_ARGS__),      \
+				  (p)->s)
+#define CNXK_TEL_DICT_PTR(d, p, s, ...)                                        \
+	plt_tel_data_add_dict_ptr(d, CNXK_TEL_STR_PREFIX(s, __VA_ARGS__),      \
+				  (void *)(p)->s)
+#define CNXK_TEL_DICT_BF_PTR(d, p, s, ...)                                     \
+	plt_tel_data_add_dict_ptr(d, CNXK_TEL_STR_PREFIX(s, __VA_ARGS__),      \
+				  (void *)(uint64_t)(p)->s)
+#define CNXK_TEL_DICT_U64(d, p, s, ...)                                        \
+	plt_tel_data_add_dict_u64(d, CNXK_TEL_STR_PREFIX(s, __VA_ARGS__),      \
+				  (p)->s)
+#define CNXK_TEL_DICT_STR(d, p, s, ...)                                        \
+	plt_tel_data_add_dict_string(d, CNXK_TEL_STR_PREFIX(s, __VA_ARGS__),   \
+				     (p)->s)
+
+#endif /* __CNXK_TELEMETRY_H_ */
drivers/common/cnxk/cnxk_telemetry_npa.c new file +260 -0

260 lines not on this page · raw message

drivers/common/cnxk/meson.build +5 -0
index 97db5f087b..d88cfbc7fa 100644
@@ -71,3 +71,8 @@ includes += include_directories('../../bus/pci')
 includes += include_directories('../../../lib/net')
 includes += include_directories('../../../lib/ethdev')
 includes += include_directories('../../../lib/meter')
+
+# Telemetry common code
+sources += files('cnxk_telemetry_npa.c')
+
+deps += ['bus_pci', 'net', 'telemetry']
drivers/common/cnxk/roc_platform.h +15 -0
index 241655b334..59af6f4975 100644
@@ -19,6 +19,7 @@
 #include <rte_pci.h>
 #include <rte_spinlock.h>
 #include <rte_string_fns.h>
+#include <rte_telemetry.h>
 
 #include "roc_bits.h"
 
@@ -51,6 +52,7 @@
 #define PLT_CACHE_LINE_SIZE      RTE_CACHE_LINE_SIZE
 #define BITMASK_ULL		 GENMASK_ULL
 #define PLT_ALIGN_CEIL		 RTE_ALIGN_CEIL
+#define PLT_INIT		 RTE_INIT
 
 /** Divide ceil */
 #define PLT_DIV_CEIL(x, y)			\
@@ -63,6 +65,7 @@
 #define __plt_cache_aligned __rte_cache_aligned
 #define __plt_always_inline __rte_always_inline
 #define __plt_packed	    __rte_packed
+#define __plt_unused	    __rte_unused
 #define __roc_api	    __rte_internal
 #define plt_iova_t	    rte_iova_t
 
@@ -142,6 +145,18 @@
 
 #define plt_strlcpy rte_strlcpy
 
+#define PLT_TEL_INT_VAL              RTE_TEL_INT_VAL
+#define plt_tel_data                 rte_tel_data
+#define plt_tel_data_start_array     rte_tel_data_start_array
+#define plt_tel_data_add_array_int   rte_tel_data_add_array_int
+#define plt_tel_data_start_dict      rte_tel_data_start_dict
+#define plt_tel_data_add_dict_int    rte_tel_data_add_dict_int
+#define plt_tel_data_add_dict_ptr(d, n, v)			\
+	rte_tel_data_add_dict_u64(d, n, (uint64_t)v)
+#define plt_tel_data_add_dict_string rte_tel_data_add_dict_string
+#define plt_tel_data_add_dict_u64    rte_tel_data_add_dict_u64
+#define plt_telemetry_register_cmd   rte_telemetry_register_cmd
+
 /* Log */
 extern int cnxk_logtype_base;
 extern int cnxk_logtype_mbox;
Signature · 1 line
2.25.1
#116 lore raw

PATCH v10 2/4 common/cnxk: add telemetry endpoints to nix

In reply to Gowrishankar Muthukrishnan

Add telemetry endpoints to nix.

---
 drivers/common/cnxk/cnxk_telemetry_nix.c | 849 +++++++++++++++++++++++
 drivers/common/cnxk/meson.build          |   3 +-
 drivers/common/cnxk/roc_nix.c            |   3 +
 drivers/common/cnxk/roc_nix_priv.h       |   9 +
 drivers/common/cnxk/roc_nix_queue.c      |  15 +-
 drivers/common/cnxk/roc_platform.h       |   2 +
 6 files changed, 877 insertions(+), 4 deletions(-)
 create mode 100644 drivers/common/cnxk/cnxk_telemetry_nix.c
drivers/common/cnxk/cnxk_telemetry_nix.c new file +849 -0
new file mode 100644
index 0000000000..1175f68a51
@@ -0,0 +1,849 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cnxk_telemetry.h"
+#include "roc_api.h"
+#include "roc_priv.h"
+
+struct nix_tel_node {
+	TAILQ_ENTRY(nix_tel_node) node;
+	struct roc_nix *nix;
+	uint16_t n_rq;
+	uint16_t n_cq;
+	uint16_t n_sq;
+	struct roc_nix_rq **rqs;
+	struct roc_nix_cq **cqs;
+	struct roc_nix_sq **sqs;
+};
+
+TAILQ_HEAD(nix_tel_node_list, nix_tel_node);
+static struct nix_tel_node_list nix_list;
+
+static struct nix_tel_node *
+nix_tel_node_get(struct roc_nix *roc_nix)
+{
+	struct nix_tel_node *node, *roc_node = NULL;
+
+	TAILQ_FOREACH(node, &nix_list, node) {
+		if (node->nix == roc_nix) {
+			roc_node = node;
+			break;
+		}
+	}
+
+	return roc_node;
+}
+
+int
+nix_tel_node_add(struct roc_nix *roc_nix)
+{
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+	struct nix_tel_node *node;
+
+	node = nix_tel_node_get(roc_nix);
+	if (node) {
+		if (nix->nb_rx_queues == node->n_rq &&
+		    nix->nb_tx_queues == node->n_sq)
+			return 0;
+
+		nix_tel_node_del(roc_nix);
+	}
+
+	node = plt_zmalloc(sizeof(struct nix_tel_node), 0);
+	if (!node)
+		return -1;
+
+	node->nix = roc_nix;
+	node->rqs =
+		plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_rq *), 0);
+	node->cqs =
+		plt_zmalloc(nix->nb_rx_queues * sizeof(struct roc_nix_cq *), 0);
+	node->sqs =
+		plt_zmalloc(nix->nb_tx_queues * sizeof(struct roc_nix_sq *), 0);
+	TAILQ_INSERT_TAIL(&nix_list, node, node);
+
+	return 0;
+}
+
+void
+nix_tel_node_del(struct roc_nix *roc_nix)
+{
+	struct nix_tel_node *node;
+
+	TAILQ_FOREACH(node, &nix_list, node) {
+		if (node->nix == roc_nix) {
+			plt_free(node->rqs);
+			plt_free(node->cqs);
+			plt_free(node->sqs);
+			TAILQ_REMOVE(&nix_list, node, node);
+		}
+	}
+
+	plt_free(node);
+}
+
+static struct nix_tel_node *
+nix_tel_node_get_by_pcidev_name(const char *name)
+{
+	struct nix_tel_node *node, *roc_node = NULL;
+
+	TAILQ_FOREACH(node, &nix_list, node) {
+		if (!strncmp(node->nix->pci_dev->name, name,
+			     PCI_PRI_STR_SIZE)) {
+			roc_node = node;
+			break;
+		}
+	}
+
+	return roc_node;
+}
+
+int
+nix_tel_node_add_rq(struct roc_nix_rq *rq)
+{
+	struct nix_tel_node *node;
+
+	node = nix_tel_node_get(rq->roc_nix);
+	if (!node)
+		return -1;
+
+	node->rqs[rq->qid] = rq;
+	node->n_rq++;
+	return 0;
+}
+
+int
+nix_tel_node_add_cq(struct roc_nix_cq *cq)
+{
+	struct nix_tel_node *node;
+
+	node = nix_tel_node_get(cq->roc_nix);
+	if (!node)
+		return -1;
+
+	node->cqs[cq->qid] = cq;
+	node->n_cq++;
+	return 0;
+}
+
+int
+nix_tel_node_add_sq(struct roc_nix_sq *sq)
+{
+	struct nix_tel_node *node;
+
+	node = nix_tel_node_get(sq->roc_nix);
+	if (!node)
+		return -1;
+
+	node->sqs[sq->qid] = sq;
+	node->n_sq++;
+	return 0;
+}
+
+static int
+cnxk_tel_nix(struct roc_nix *roc_nix, struct plt_tel_data *d)
+{
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+
+	struct dev *dev = &nix->dev;
+
+	plt_tel_data_add_dict_ptr(d, "nix", nix);
+	plt_tel_data_add_dict_int(d, "pf_func", dev->pf_func);
+	plt_tel_data_add_dict_int(d, "pf", dev_get_pf(dev->pf_func));
+	plt_tel_data_add_dict_int(d, "vf", dev_get_vf(dev->pf_func));
+
+	CNXK_TEL_DICT_PTR(d, dev, bar2);
+	CNXK_TEL_DICT_PTR(d, dev, bar4);
+	CNXK_TEL_DICT_INT(d, roc_nix, port_id);
+	CNXK_TEL_DICT_INT(d, roc_nix, rss_tag_as_xor);
+	CNXK_TEL_DICT_INT(d, roc_nix, max_sqb_count);
+	CNXK_TEL_DICT_PTR(d, nix, pci_dev);
+	CNXK_TEL_DICT_PTR(d, nix, base);
+	CNXK_TEL_DICT_PTR(d, nix, lmt_base);
+	CNXK_TEL_DICT_INT(d, nix, reta_sz);
+	CNXK_TEL_DICT_INT(d, nix, tx_chan_base);
+	CNXK_TEL_DICT_INT(d, nix, rx_chan_base);
+	CNXK_TEL_DICT_INT(d, nix, nb_tx_queues);
+	CNXK_TEL_DICT_INT(d, nix, nb_rx_queues);
+	CNXK_TEL_DICT_INT(d, nix, lso_tsov6_idx);
+	CNXK_TEL_DICT_INT(d, nix, lso_tsov4_idx);
+
+	plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v4",
+				  nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
+	plt_tel_data_add_dict_int(d, "lso_udp_tun_v4v6",
+				  nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
+	plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v4",
+				  nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
+	plt_tel_data_add_dict_int(d, "lso_udp_tun_v6v6",
+				  nix->lso_udp_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
+	plt_tel_data_add_dict_int(d, "lso_tun_v4v4",
+				  nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V4]);
+	plt_tel_data_add_dict_int(d, "lso_tun_v4v6",
+				  nix->lso_tun_idx[ROC_NIX_LSO_TUN_V4V6]);
+	plt_tel_data_add_dict_int(d, "lso_tun_v6v4",
+				  nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V4]);
+	plt_tel_data_add_dict_int(d, "lso_tun_v6v6",
+				  nix->lso_tun_idx[ROC_NIX_LSO_TUN_V6V6]);
+
+	CNXK_TEL_DICT_INT(d, nix, lf_tx_stats);
+	CNXK_TEL_DICT_INT(d, nix, lf_rx_stats);
+	CNXK_TEL_DICT_INT(d, nix, cgx_links);
+	CNXK_TEL_DICT_INT(d, nix, lbk_links);
+	CNXK_TEL_DICT_INT(d, nix, sdp_links);
+	CNXK_TEL_DICT_INT(d, nix, tx_link);
+	CNXK_TEL_DICT_INT(d, nix, sqb_size);
+	CNXK_TEL_DICT_INT(d, nix, msixoff);
+	CNXK_TEL_DICT_INT(d, nix, cints);
+	CNXK_TEL_DICT_INT(d, nix, qints);
+	CNXK_TEL_DICT_INT(d, nix, sdp_link);
+	CNXK_TEL_DICT_INT(d, nix, ptp_en);
+	CNXK_TEL_DICT_INT(d, nix, rss_alg_idx);
+	CNXK_TEL_DICT_INT(d, nix, tx_pause);
+
+	return 0;
+}
+
+static int
+cnxk_tel_nix_rq(struct roc_nix_rq *rq, struct plt_tel_data *d)
+{
+	plt_tel_data_add_dict_ptr(d, "nix_rq", rq);
+	CNXK_TEL_DICT_INT(d, rq, qid);
+	CNXK_TEL_DICT_PTR(d, rq, aura_handle);
+	CNXK_TEL_DICT_INT(d, rq, ipsech_ena);
+	CNXK_TEL_DICT_INT(d, rq, first_skip);
+	CNXK_TEL_DICT_INT(d, rq, later_skip);
+	CNXK_TEL_DICT_INT(d, rq, lpb_size);
+	CNXK_TEL_DICT_INT(d, rq, sso_ena);
+	CNXK_TEL_DICT_INT(d, rq, tag_mask);
+	CNXK_TEL_DICT_INT(d, rq, flow_tag_width);
+	CNXK_TEL_DICT_INT(d, rq, tt);
+	CNXK_TEL_DICT_INT(d, rq, hwgrp);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_ena);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_first_skip);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_max_sz_exp);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_wait_tmo);
+	CNXK_TEL_DICT_INT(d, rq, vwqe_aura_handle);
+	CNXK_TEL_DICT_PTR(d, rq, roc_nix);
+
+	return 0;
+}
+
+static int
+cnxk_tel_nix_cq(struct roc_nix_cq *cq, struct plt_tel_data *d)
+{
+	plt_tel_data_add_dict_ptr(d, "nix_cq", cq);
+	CNXK_TEL_DICT_INT(d, cq, qid);
+	CNXK_TEL_DICT_INT(d, cq, nb_desc);
+	CNXK_TEL_DICT_PTR(d, cq, roc_nix);
+	CNXK_TEL_DICT_PTR(d, cq, door);
+	CNXK_TEL_DICT_PTR(d, cq, status);
+	CNXK_TEL_DICT_PTR(d, cq, wdata);
+	CNXK_TEL_DICT_PTR(d, cq, desc_base);
+	CNXK_TEL_DICT_INT(d, cq, qmask);
+
+	return 0;
+}
+
+static int
+cnxk_tel_nix_sq(struct roc_nix_sq *sq, struct plt_tel_data *d)
+{
+	plt_tel_data_add_dict_ptr(d, "nix_sq", sq);
+	CNXK_TEL_DICT_INT(d, sq, qid);
+	CNXK_TEL_DICT_INT(d, sq, max_sqe_sz);
+	CNXK_TEL_DICT_INT(d, sq, nb_desc);
+	CNXK_TEL_DICT_INT(d, sq, sqes_per_sqb_log2);
+	CNXK_TEL_DICT_PTR(d, sq, roc_nix);
+	CNXK_TEL_DICT_PTR(d, sq, aura_handle);
+	CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs_adj);
+	CNXK_TEL_DICT_INT(d, sq, nb_sqb_bufs);
+	CNXK_TEL_DICT_PTR(d, sq, io_addr);
+	CNXK_TEL_DICT_PTR(d, sq, lmt_addr);
+	CNXK_TEL_DICT_PTR(d, sq, sqe_mem);
+	CNXK_TEL_DICT_PTR(d, sq, fc);
+
+	return 0;
+}
+
+static void
+nix_rq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
+{
+	struct nix_rq_ctx_s *ctx = (struct nix_rq_ctx_s *)qctx;
+
+	/* W0 */
+	CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
+	CNXK_TEL_DICT_BF_PTR(d, ctx, substream, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
+
+	/* W1 */
+	CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
+
+	/* W4 */
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
+
+	/* W5 */
+	CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
+
+	/* W6 */
+	CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
+
+	/* W7 */
+	CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
+
+	/* W8 */
+	CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
+
+	/* W9 */
+	CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
+
+	/* W10 */
+	CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_);
+}
+
+static void
+nix_rq_ctx(void *qctx, struct plt_tel_data *d)
+{
+	struct nix_cn10k_rq_ctx_s *ctx = (struct nix_cn10k_rq_ctx_s *)qctx;
+
+	/* W0 */
+	CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, len_ol3_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, len_ol4_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, len_il3_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, len_il4_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, csum_ol4_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, lenerr_dis, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena_wqwd, w0);
+	CNXK_TEL_DICT_INT(d, ctx, ipsech_ena, w0);
+	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w0);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w0);
+
+	/* W1 */
+	CNXK_TEL_DICT_INT(d, ctx, chi_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, ipsecd_drop_en, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, pb_stashing, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_drop_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_caching, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, pb_caching, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_tt, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_grp, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, xqe_hdr_split, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_copy, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_imm_size, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, later_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, first_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_sizem1, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_skip, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_sizem1, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, policer_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, band_prof_id, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, spb_pool_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_pool_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, spb_aura_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, wqe_pool_drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_pass, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, xqe_drop, w3_);
+
+	/* W4 */
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, rq_int_ena, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, rq_int, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_pass, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_pool_drop, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_pass, w4_);
+	CNXK_TEL_DICT_INT(d, ctx, lpb_aura_drop, w4_);
+
+	/* W5 */
+	CNXK_TEL_DICT_INT(d, ctx, vwqe_skip, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, max_vsize_exp, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, vtime_wait, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, vwqe_ena, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, ipsec_vwqe, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, flow_tagw, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, bad_utag, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, good_utag, w5_);
+	CNXK_TEL_DICT_INT(d, ctx, ltag, w5_);
+
+	/* W6 */
+	CNXK_TEL_DICT_U64(d, ctx, octs, w6_);
+
+	/* W7 */
+	CNXK_TEL_DICT_U64(d, ctx, pkts, w7_);
+
+	/* W8 */
+	CNXK_TEL_DICT_U64(d, ctx, drop_octs, w8_);
+
+	/* W9 */
+	CNXK_TEL_DICT_U64(d, ctx, drop_pkts, w9_);
+
+	/* W10 */
+	CNXK_TEL_DICT_U64(d, ctx, re_pkts, w10_);
+}
+
+static int
+cnxk_tel_nix_rq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
+{
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+	struct dev *dev = &nix->dev;
+	struct npa_lf *npa_lf;
+	volatile void *qctx;
+	int rc = -1;
+
+	npa_lf = idev_npa_obj_get();
+	if (npa_lf == NULL)
+		return NPA_ERR_DEVICE_NOT_BOUNDED;
+
+	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_RQ, n, &qctx);
+	if (rc) {
+		plt_err("Failed to get rq context");
+		return rc;
+	}
+
+	if (roc_model_is_cn9k())
+		nix_rq_ctx_cn9k(&qctx, d);
+	else
+		nix_rq_ctx(&qctx, d);
+
+	return 0;
+}
+
+static int
+cnxk_tel_nix_cq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
+{
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+	struct dev *dev = &nix->dev;
+	struct npa_lf *npa_lf;
+	volatile struct nix_cq_ctx_s *ctx;
+	int rc = -1;
+
+	npa_lf = idev_npa_obj_get();
+	if (npa_lf == NULL)
+		return NPA_ERR_DEVICE_NOT_BOUNDED;
+
+	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_CQ, n, (void *)&ctx);
+	if (rc) {
+		plt_err("Failed to get cq context");
+		return rc;
+	}
+
+	/* W0 */
+	CNXK_TEL_DICT_PTR(d, ctx, base, w0_);
+
+	/* W1 */
+	CNXK_TEL_DICT_U64(d, ctx, wrptr, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, avg_con, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, cint_idx, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_err, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, bpid, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, bp_ena, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, update_time, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, avg_level, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, head, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, tail, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, cq_err_int_ena, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_err_int, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, qsize, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, caching, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, substream, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, drop_ena, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, drop, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, bp, w3_);
+
+	return 0;
+}
+
+static void
+nix_sq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
+{
+	struct nix_sq_ctx_s *ctx = (struct nix_sq_ctx_s *)qctx;
+
+	/* W0 */
+	CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
+
+	/* W1 */
+	CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_quantum, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
+
+	/* W4 */
+	CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
+
+	/* W5 */
+	CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
+
+	/* W6 */
+	CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
+
+	/* W7 */
+	CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
+
+	/* W8 */
+	CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
+
+	/* W9 */
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
+
+	/* W10 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
+
+	/* W11 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
+
+	/* W12 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
+
+	/* W14 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
+
+	/* W15 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_);
+}
+
+static void
+nix_sq_ctx(void *qctx, struct plt_tel_data *d)
+{
+	struct nix_cn10k_sq_ctx_s *ctx = (struct nix_cn10k_sq_ctx_s *)qctx;
+
+	/* W0 */
+	CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, cq, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, sdp_mcast, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, substream, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, qint_idx, w0_);
+	CNXK_TEL_DICT_INT(d, ctx, ena, w0_);
+
+	/* W1 */
+	CNXK_TEL_DICT_INT(d, ctx, sqb_count, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, default_chan, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_weight, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, sso_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, xoff, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_ena, w1_);
+	CNXK_TEL_DICT_INT(d, ctx, smq, w1_);
+
+	/* W2 */
+	CNXK_TEL_DICT_INT(d, ctx, sqe_stype, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sq_int_ena, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sq_int, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, sqb_aura, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_ub, w2_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_rr_count_lb, w2_);
+
+	/* W3 */
+	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq_vld, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_pend, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smenq_next_sqb_vld, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, head_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smenq_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, tail_offset, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_lso_segnum, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, smq_next_sq, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, mnq_dis, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, lmt_dis, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, cq_limit, w3_);
+	CNXK_TEL_DICT_INT(d, ctx, max_sqe_size, w3_);
+
+	/* W4 */
+	CNXK_TEL_DICT_PTR(d, ctx, next_sqb, w4_);
+
+	/* W5 */
+	CNXK_TEL_DICT_PTR(d, ctx, tail_sqb, w5_);
+
+	/* W6 */
+	CNXK_TEL_DICT_PTR(d, ctx, smenq_sqb, w6_);
+
+	/* W7 */
+	CNXK_TEL_DICT_PTR(d, ctx, smenq_next_sqb, w7_);
+
+	/* W8 */
+	CNXK_TEL_DICT_PTR(d, ctx, head_sqb, w8_);
+
+	/* W9 */
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vld, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan1_ins_ena, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_vlan0_ins_ena, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_mps, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sb, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_sizem1, w9_);
+	CNXK_TEL_DICT_INT(d, ctx, vfi_lso_total, w9_);
+
+	/* W10 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, scm_lso_rem, w10_);
+
+	/* W11 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, octs, w11_);
+
+	/* W12 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_);
+
+	/* W14 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_);
+
+	/* W15 */
+	CNXK_TEL_DICT_BF_PTR(d, ctx, drop_pkts, w15_);
+}
+
+static int
+cnxk_tel_nix_sq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
+{
+	struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+	struct dev *dev = &nix->dev;
+	struct npa_lf *npa_lf;
+	volatile void *qctx;
+	int rc = -1;
+
+	npa_lf = idev_npa_obj_get();
+	if (npa_lf == NULL)
+		return NPA_ERR_DEVICE_NOT_BOUNDED;
+
+	rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_SQ, n, &qctx);
+	if (rc) {
+		plt_err("Failed to get rq context");
+		return rc;
+	}
+
+	if (roc_model_is_cn9k())
+		nix_sq_ctx_cn9k(&qctx, d);
+	else
+		nix_sq_ctx(&qctx, d);
+
+	return 0;
+}
+
+static int
+cnxk_nix_tel_handle_list(const char *cmd __plt_unused,
+			 const char *params __plt_unused,
+			 struct plt_tel_data *d)
+{
+	struct nix_tel_node *node;
+	struct roc_nix *roc_nix;
+
+	plt_tel_data_start_array(d, PLT_TEL_STRING_VAL);
+
+	TAILQ_FOREACH(node, &nix_list, node) {
+		roc_nix = node->nix;
+		plt_tel_data_add_array_string(d, roc_nix->pci_dev->name);
+	}
+
+	return 0;
+}
+
+static int
+cnxk_nix_tel_handle_info(const char *cmd __plt_unused, const char *params,
+			 struct plt_tel_data *d)
+{
+	char name[PCI_PRI_STR_SIZE];
+	struct nix_tel_node *node;
+
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		return -1;
+
+	plt_strlcpy(name, params, PCI_PRI_STR_SIZE);
+
+	node = nix_tel_node_get_by_pcidev_name(name);
+	if (!node)
+		return -1;
+
+	plt_tel_data_start_dict(d);
+	return cnxk_tel_nix(node->nix, d);
+}
+
+static int
+cnxk_nix_tel_handle_info_x(const char *cmd, const char *params,
+			   struct plt_tel_data *d)
+{
+	struct nix_tel_node *node;
+	char *name, *param;
+	char buf[1024];
+	int rc = -1;
+
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		goto exit;
+
+	plt_strlcpy(buf, params, PCI_PRI_STR_SIZE + 1);
+	name = strtok(buf, ",");
+	param = strtok(NULL, "\0");
+
+	node = nix_tel_node_get_by_pcidev_name(name);
+	if (!node)
+		goto exit;
+
+	plt_tel_data_start_dict(d);
+
+	if (strstr(cmd, "rq")) {
+		char *tok = strtok(param, ",");
+		int rq;
+
+		if (!tok)
+			goto exit;
+
+		rq = strtol(tok, NULL, 10);
+		if ((node->n_rq <= rq) || (rq < 0))
+			goto exit;
+
+		if (strstr(cmd, "ctx"))
+			rc = cnxk_tel_nix_rq_ctx(node->nix, rq, d);
+		else
+			rc = cnxk_tel_nix_rq(node->rqs[rq], d);
+
+	} else if (strstr(cmd, "cq")) {
+		char *tok = strtok(param, ",");
+		int cq;
+
+		if (!tok)
+			goto exit;
+
+		cq = strtol(tok, NULL, 10);
+		if ((node->n_cq <= cq) || (cq < 0))
+			goto exit;
+
+		if (strstr(cmd, "ctx"))
+			rc = cnxk_tel_nix_cq_ctx(node->nix, cq, d);
+		else
+			rc = cnxk_tel_nix_cq(node->cqs[cq], d);
+
+	} else if (strstr(cmd, "sq")) {
+		char *tok = strtok(param, ",");
+		int sq;
+
+		if (!tok)
+			goto exit;
+
+		sq = strtol(tok, NULL, 10);
+		if ((node->n_sq <= sq) || (sq < 0))
+			goto exit;
+
+		if (strstr(cmd, "ctx"))
+			rc = cnxk_tel_nix_sq_ctx(node->nix, sq, d);
+		else
+			rc = cnxk_tel_nix_sq(node->sqs[sq], d);
+	}
+
+exit:
+	return rc;
+}
+
+PLT_INIT(cnxk_telemetry_nix_init)
+{
+	TAILQ_INIT(&nix_list);
+
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/list", cnxk_nix_tel_handle_list,
+		"Returns list of available NIX devices. Takes no parameters");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/info", cnxk_nix_tel_handle_info,
+		"Returns nix information. Parameters: pci id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/rq/info", cnxk_nix_tel_handle_info_x,
+		"Returns nix rq information. Parameters: pci id, rq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/rq/ctx", cnxk_nix_tel_handle_info_x,
+		"Returns nix rq context. Parameters: pci id, rq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/cq/info", cnxk_nix_tel_handle_info_x,
+		"Returns nix cq information. Parameters: pci id, cq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/cq/ctx", cnxk_nix_tel_handle_info_x,
+		"Returns nix cq context. Parameters: pci id, cq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/sq/info", cnxk_nix_tel_handle_info_x,
+		"Returns nix sq information. Parameters: pci id, sq id");
+	plt_telemetry_register_cmd(
+		"/cnxk/nix/sq/ctx", cnxk_nix_tel_handle_info_x,
+		"Returns nix sq context. Parameters: pci id, sq id");
+}
drivers/common/cnxk/meson.build +2 -1
index d88cfbc7fa..7b8a4c6633 100644
@@ -73,6 +73,7 @@ includes += include_directories('../../../lib/ethdev')
 includes += include_directories('../../../lib/meter')
 
 # Telemetry common code
-sources += files('cnxk_telemetry_npa.c')
+sources += files('cnxk_telemetry_npa.c',
+                 'cnxk_telemetry_nix.c')
 
 deps += ['bus_pci', 'net', 'telemetry']
drivers/common/cnxk/roc_nix.c +3 -0
index b7ef843b4b..64156ceb19 100644
@@ -184,6 +184,8 @@ roc_nix_lf_alloc(struct roc_nix *roc_nix, uint32_t nb_rxq, uint32_t nb_txq,
 	nix->sqs = plt_zmalloc(sizeof(struct roc_nix_sq *) * nb_txq, 0);
 	if (!nix->sqs)
 		return -ENOMEM;
+
+	nix_tel_node_add(roc_nix);
 fail:
 	return rc;
 }
@@ -419,6 +421,7 @@ roc_nix_dev_init(struct roc_nix *roc_nix)
 dev_fini:
 	rc |= dev_fini(dev, pci_dev);
 fail:
+	nix_tel_node_del(roc_nix);
 	return rc;
 }
 
drivers/common/cnxk/roc_nix_priv.h +9 -0
index 8beb5454b7..2f5eefd6ec 100644
@@ -427,4 +427,13 @@ int nix_lf_int_reg_dump(uintptr_t nix_lf_base, uint64_t *data, uint16_t qints,
 int nix_q_ctx_get(struct dev *dev, uint8_t ctype, uint16_t qid,
 		  __io void **ctx_p);
 
+/*
+ * Telemetry
+ */
+int nix_tel_node_add(struct roc_nix *roc_nix);
+void nix_tel_node_del(struct roc_nix *roc_nix);
+int nix_tel_node_add_rq(struct roc_nix_rq *rq);
+int nix_tel_node_add_cq(struct roc_nix_cq *cq);
+int nix_tel_node_add_sq(struct roc_nix_sq *sq);
+
 #endif /* _ROC_NIX_PRIV_H_ */
drivers/common/cnxk/roc_nix_queue.c +12 -3
index 422eef124c..0510f9692e 100644
@@ -387,7 +387,11 @@ roc_nix_rq_init(struct roc_nix *roc_nix, struct roc_nix_rq *rq, bool ena)
 	if (rc)
 		return rc;
 
-	return mbox_process(mbox);
+	rc = mbox_process(mbox);
+	if (rc)
+		return rc;
+
+	return nix_tel_node_add_rq(rq);
 }
 
 int
@@ -415,7 +419,11 @@ roc_nix_rq_modify(struct roc_nix *roc_nix, struct roc_nix_rq *rq, bool ena)
 	if (rc)
 		return rc;
 
-	return mbox_process(mbox);
+	rc = mbox_process(mbox);
+	if (rc)
+		return rc;
+
+	return nix_tel_node_add_rq(rq);
 }
 
 int
@@ -504,7 +512,7 @@ roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq)
 	if (rc)
 		goto free_mem;
 
-	return 0;
+	return nix_tel_node_add_cq(cq);
 
 free_mem:
 	plt_free(cq->desc_base);
@@ -888,6 +896,7 @@ roc_nix_sq_init(struct roc_nix *roc_nix, struct roc_nix_sq *sq)
 					((qid & RVU_CN9K_LMT_SLOT_MASK) << 12));
 	}
 
+	rc = nix_tel_node_add_sq(sq);
 	return rc;
 nomem:
 	plt_free(sq->fc);
drivers/common/cnxk/roc_platform.h +2 -0
index 59af6f4975..731c5bc3b3 100644
@@ -146,9 +146,11 @@
 #define plt_strlcpy rte_strlcpy
 
 #define PLT_TEL_INT_VAL              RTE_TEL_INT_VAL
+#define PLT_TEL_STRING_VAL           RTE_TEL_STRING_VAL
 #define plt_tel_data                 rte_tel_data
 #define plt_tel_data_start_array     rte_tel_data_start_array
 #define plt_tel_data_add_array_int   rte_tel_data_add_array_int
+#define plt_tel_data_add_array_string rte_tel_data_add_array_string
 #define plt_tel_data_start_dict      rte_tel_data_start_dict
 #define plt_tel_data_add_dict_int    rte_tel_data_add_dict_int
 #define plt_tel_data_add_dict_ptr(d, n, v)			\
Signature · 1 line
2.25.1
#117 lore raw

PATCH v10 3/4 mempool/cnxk: add telemetry endpoints mempool

In reply to Gowrishankar Muthukrishnan

Adding telemetry endpoints to cnxk mempool driver.

---
 drivers/mempool/cnxk/cnxk_mempool_telemetry.c | 57 +++++++++++++++++++
 drivers/mempool/cnxk/meson.build              |  1 +
 2 files changed, 58 insertions(+)
 create mode 100644 drivers/mempool/cnxk/cnxk_mempool_telemetry.c
drivers/mempool/cnxk/cnxk_mempool_telemetry.c new file +57 -0
new file mode 100644
index 0000000000..c71798d7fd
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include <rte_mempool.h>
+#include <rte_memzone.h>
+#include <rte_telemetry.h>
+
+#include <roc_api.h>
+
+#include "cnxk_mempool.h"
+#include "cnxk_telemetry.h"
+
+struct mempool_info_cb_arg {
+	char *pool_name;
+	struct rte_tel_data *d;
+};
+
+static void
+mempool_info_cb(struct rte_mempool *mp, void *arg)
+{
+	struct mempool_info_cb_arg *info = (struct mempool_info_cb_arg *)arg;
+	int aura_id;
+
+	if (strncmp(mp->name, info->pool_name, RTE_MEMZONE_NAMESIZE))
+		return;
+
+	aura_id = roc_npa_aura_handle_to_aura(mp->pool_id);
+	rte_tel_data_add_dict_int(info->d, "aura_id", aura_id);
+}
+
+static int
+mempool_tel_handle_info(const char *cmd __rte_unused, const char *params,
+			struct rte_tel_data *d)
+{
+	struct mempool_info_cb_arg mp_arg;
+	char name[RTE_MEMZONE_NAMESIZE];
+
+	if (params == NULL || strlen(params) == 0)
+		return -EINVAL;
+
+	rte_strlcpy(name, params, RTE_MEMZONE_NAMESIZE);
+
+	rte_tel_data_start_dict(d);
+	mp_arg.pool_name = name;
+	mp_arg.d = d;
+	rte_mempool_walk(mempool_info_cb, &mp_arg);
+
+	return 0;
+}
+
+RTE_INIT(cnxk_mempool_init_telemetry)
+{
+	rte_telemetry_register_cmd(
+		"/cnxk/mempool/info", mempool_tel_handle_info,
+		"Returns mempool info. Parameters: pool_name");
+}
drivers/mempool/cnxk/meson.build +1 -0
index e28a9e044d..d5d1978569 100644
@@ -11,6 +11,7 @@ endif
 sources = files(
         'cnxk_mempool.c',
         'cnxk_mempool_ops.c',
+        'cnxk_mempool_telemetry.c',
         'cn9k_mempool_ops.c',
         'cn10k_mempool_ops.c',
 )
Signature · 1 line
2.25.1
#118 lore raw

PATCH v10 4/4 net/cnxk: add telemetry endpoints to ethdev

In reply to Gowrishankar Muthukrishnan

Add telemetry endpoints to ethdev.

---
 drivers/net/cnxk/cnxk_ethdev_telemetry.c | 93 ++++++++++++++++++++++++
 drivers/net/cnxk/meson.build             |  1 +
 2 files changed, 94 insertions(+)
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_telemetry.c
drivers/net/cnxk/cnxk_ethdev_telemetry.c new file +93 -0
new file mode 100644
index 0000000000..83bc65848c
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell International Ltd.
+ */
+
+#include <rte_telemetry.h>
+
+#include "cnxk_ethdev.h"
+
+/* Macro to count no of words in eth_info_s size */
+#define ETH_INFO_SZ                                                            \
+	(RTE_ALIGN_CEIL(sizeof(struct eth_info_s), sizeof(uint64_t)) /         \
+	 sizeof(uint64_t))
+#define MACADDR_LEN 18
+
+static int
+ethdev_tel_handle_info(const char *cmd __rte_unused,
+		       const char *params __rte_unused, struct rte_tel_data *d)
+{
+	struct rte_eth_dev *eth_dev;
+	struct rte_tel_data *i_data;
+	struct cnxk_eth_dev *dev;
+	union eth_info_u {
+		struct eth_info_s {
+			/** PF/VF information */
+			uint16_t pf_func;
+			uint8_t max_mac_entries;
+			bool dmac_filter_ena;
+			uint8_t dmac_filter_count;
+			uint8_t ptype_disable;
+			bool scalar_ena;
+			bool ptp_ena;
+			/* Platform specific offload flags */
+			uint16_t rx_offload_flags;
+			uint16_t tx_offload_flags;
+		} info;
+		uint64_t val[ETH_INFO_SZ];
+	} eth_info;
+	struct eth_info_s *info;
+	unsigned int i, j = 0;
+	int n_ports;
+
+	n_ports = rte_eth_dev_count_avail();
+	if (!n_ports) {
+		plt_err("No active ethernet ports found.");
+		return -1;
+	}
+
+	rte_tel_data_start_dict(d);
+	rte_tel_data_add_dict_int(d, "n_ports", n_ports);
+
+	i_data = rte_tel_data_alloc();
+	rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL);
+
+	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
+		/* Skip if port is unused */
+		if (!rte_eth_dev_is_valid_port(i))
+			continue;
+
+		eth_dev = &rte_eth_devices[i];
+		if (eth_dev) {
+			memset(&eth_info, 0, sizeof(eth_info));
+			info = &eth_info.info;
+			dev = cnxk_eth_pmd_priv(eth_dev);
+			if (dev) {
+				info->pf_func = roc_nix_get_pf_func(&dev->nix);
+				info->max_mac_entries = dev->max_mac_entries;
+				info->dmac_filter_ena = dev->dmac_filter_enable;
+				info->dmac_filter_count =
+					dev->dmac_filter_count;
+				info->ptype_disable = dev->ptype_disable;
+				info->scalar_ena = dev->scalar_ena;
+				info->ptp_ena = dev->ptp_en;
+				info->rx_offload_flags = dev->rx_offload_flags;
+				info->tx_offload_flags = dev->tx_offload_flags;
+			}
+
+			for (j = 0; j < ETH_INFO_SZ; j++)
+				rte_tel_data_add_array_u64(i_data,
+							   eth_info.val[j]);
+
+			j++;
+		}
+	}
+
+	rte_tel_data_add_dict_container(d, "info", i_data, 0);
+	return 0;
+}
+
+RTE_INIT(cnxk_ethdev_init_telemetry)
+{
+	rte_telemetry_register_cmd("/cnxk/ethdev/info", ethdev_tel_handle_info,
+				   "Returns ethdev device information");
+}
drivers/net/cnxk/meson.build +1 -0
index d86188fed7..341ac99771 100644
@@ -13,6 +13,7 @@ sources = files(
         'cnxk_ethdev_devargs.c',
         'cnxk_ethdev_ops.c',
         'cnxk_ethdev_sec.c',
+        'cnxk_ethdev_telemetry.c',
         'cnxk_link.c',
         'cnxk_lookup.c',
         'cnxk_ptp.c',
Signature · 1 line
2.25.1
#119 lore raw

Re: [dpdk-dev] [v9 0/4] cnxk: enable telemetry endpoints

In reply to Gowrishankar Muthukrishnan
Quoted 7 lines · Gowrishankar Muthukrishnan

This patch series enables telemetry in cnxk for the following:
- NPA LF
- NIX LF
- cnxk Mempool driver
- cnxk Ethdev driver

Series Acked-by: Jerin Jacob <[email protected]> Series applied to dpdk-next-net-mrvl/for-dpdk-main. Thanks.

Quoted 32 lines

v9:
- moved common info from drivers to lib endpoints.

Gowrishankar Muthukrishnan (4):
common/cnxk: add telemetry endpoints to npa
common/cnxk: add telemetry endpoints to nix
mempool/cnxk: add telemetry endpoints mempool
net/cnxk: add telemetry endpoints to ethdev

 drivers/common/cnxk/cnxk_telemetry.h          |  26 +
 drivers/common/cnxk/cnxk_telemetry_nix.c      | 849 ++++++++++++++++++
 drivers/common/cnxk/cnxk_telemetry_npa.c      | 224 +++++
 drivers/common/cnxk/meson.build               |   7 +-
 drivers/common/cnxk/roc_nix.c                 |   3 +
 drivers/common/cnxk/roc_nix_priv.h            |   9 +
 drivers/common/cnxk/roc_nix_queue.c           |  15 +-
 drivers/common/cnxk/roc_platform.h            |  15 +
 drivers/mempool/cnxk/cnxk_mempool_telemetry.c |  57 ++
 drivers/mempool/cnxk/meson.build              |   1 +
 drivers/net/cnxk/cnxk_ethdev_telemetry.c      |  93 ++
 drivers/net/cnxk/meson.build                  |   1 +
 12 files changed, 1295 insertions(+), 5 deletions(-)
 create mode 100644 drivers/common/cnxk/cnxk_telemetry.h
 create mode 100644 drivers/common/cnxk/cnxk_telemetry_nix.c
 create mode 100644 drivers/common/cnxk/cnxk_telemetry_npa.c
 create mode 100644 drivers/mempool/cnxk/cnxk_mempool_telemetry.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_telemetry.c

--
2.25.1

#120 lore raw

Re: [dpdk-dev] [v9 0/4] cnxk: enable telemetry endpoints

Quoted 11 lines · Jerin Jacob
Quoted 7 lines · Gowrishankar Muthukrishnan

This patch series enables telemetry in cnxk for the following:
- NPA LF
- NIX LF
- cnxk Mempool driver
- cnxk Ethdev driver

Quoted 3 lines

Series Acked-by: Jerin Jacob <[email protected]> Series applied to dpdk-next-net-mrvl/for-dpdk-main. Thanks.

For record, v10 of this set seems merged according patchwork:
https://patches.dpdk.org/project/dpdk/list/?series=19788&state=*

Quoted 32 lines
Quoted 32 lines

v9:
- moved common info from drivers to lib endpoints.

Gowrishankar Muthukrishnan (4):
common/cnxk: add telemetry endpoints to npa
common/cnxk: add telemetry endpoints to nix
mempool/cnxk: add telemetry endpoints mempool
net/cnxk: add telemetry endpoints to ethdev

  drivers/common/cnxk/cnxk_telemetry.h          |  26 +
  drivers/common/cnxk/cnxk_telemetry_nix.c      | 849 ++++++++++++++++++
  drivers/common/cnxk/cnxk_telemetry_npa.c      | 224 +++++
  drivers/common/cnxk/meson.build               |   7 +-
  drivers/common/cnxk/roc_nix.c                 |   3 +
  drivers/common/cnxk/roc_nix_priv.h            |   9 +
  drivers/common/cnxk/roc_nix_queue.c           |  15 +-
  drivers/common/cnxk/roc_platform.h            |  15 +
  drivers/mempool/cnxk/cnxk_mempool_telemetry.c |  57 ++
  drivers/mempool/cnxk/meson.build              |   1 +
  drivers/net/cnxk/cnxk_ethdev_telemetry.c      |  93 ++
  drivers/net/cnxk/meson.build                  |   1 +
  12 files changed, 1295 insertions(+), 5 deletions(-)

create mode 100644 drivers/common/cnxk/cnxk_telemetry.h create mode 100644 drivers/common/cnxk/cnxk_telemetry_nix.c create mode 100644 drivers/common/cnxk/cnxk_telemetry_npa.c create mode 100644 drivers/mempool/cnxk/cnxk_mempool_telemetry.c create mode 100644 drivers/net/cnxk/cnxk_ethdev_telemetry.c

--
2.25.1