DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] common/cnxk: adds cn10k specific xstats
@ 2022-02-23 12:51 Rahul Bhansali
  2022-02-24  4:18 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Rahul Bhansali @ 2022-02-23 12:51 UTC (permalink / raw)
  To: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: jerinj, Rahul Bhansali

This adds cn10k specific rx xstats of bpf, cpt and
ipsecd counters.

Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
---
 drivers/common/cnxk/hw/nix.h         |  1 +
 drivers/common/cnxk/roc_nix_stats.c  | 14 ++++++++++++++
 drivers/common/cnxk/roc_nix_xstats.h | 20 +++++++++++++++++++-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/hw/nix.h b/drivers/common/cnxk/hw/nix.h
index 6931f1d1d2..1cc0c8dfb8 100644
--- a/drivers/common/cnxk/hw/nix.h
+++ b/drivers/common/cnxk/hw/nix.h
@@ -419,6 +419,7 @@
 #define NIX_STAT_LF_RX_RX_RC_OCTS_DROP	 (0x16ull) /* [CN10K, .) */
 #define NIX_STAT_LF_RX_RX_RC_PKTS_DROP	 (0x17ull) /* [CN10K, .) */
 #define NIX_STAT_LF_RX_RX_CPT_DROP_PKTS	 (0x18ull) /* [CN10K, .) */
+#define NIX_STAT_LF_RX_RX_IPSECD_DROP_PKTS (0x19ull) /* [CN10K, .) */
 
 #define CGX_RX_PKT_CNT		 (0x0ull) /* [CN9K, CN10K) */
 #define CGX_RX_OCT_CNT		 (0x1ull) /* [CN9K, CN10K) */
diff --git a/drivers/common/cnxk/roc_nix_stats.c b/drivers/common/cnxk/roc_nix_stats.c
index 756111fb1c..946cda114d 100644
--- a/drivers/common/cnxk/roc_nix_stats.c
+++ b/drivers/common/cnxk/roc_nix_stats.c
@@ -353,6 +353,13 @@ roc_nix_xstats_get(struct roc_nix *roc_nix, struct roc_nix_xstat *xstats,
 			xstats[count].id = count;
 			count++;
 		}
+
+		for (i = 0; i < CNXK_NIX_NUM_CN10K_RX_XSTATS; i++) {
+			xstats[count].value =
+				NIX_RX_STATS(nix_cn10k_rx_xstats[i].offset);
+			xstats[count].id = count;
+			count++;
+		}
 	}
 
 	return count;
@@ -422,6 +429,13 @@ roc_nix_xstats_names_get(struct roc_nix *roc_nix,
 					 nix_tx_xstats_rpm[i].name);
 				count++;
 			}
+
+			for (i = 0; i < CNXK_NIX_NUM_CN10K_RX_XSTATS; i++) {
+				snprintf(xstats_names[count].name,
+					 sizeof(xstats_names[count].name), "%s",
+					 nix_cn10k_rx_xstats[i].name);
+				count++;
+			}
 		}
 	}
 
diff --git a/drivers/common/cnxk/roc_nix_xstats.h b/drivers/common/cnxk/roc_nix_xstats.h
index b0eaab78e7..c0a6f693f2 100644
--- a/drivers/common/cnxk/roc_nix_xstats.h
+++ b/drivers/common/cnxk/roc_nix_xstats.h
@@ -34,6 +34,23 @@ static const struct cnxk_nix_xstats_name nix_rx_xstats[] = {
 	{"rx_drp_l3mcast", NIX_STAT_LF_RX_RX_DRP_L3MCAST},
 };
 
+static const struct cnxk_nix_xstats_name nix_cn10k_rx_xstats[] = {
+	{"rx_gc_octs_pass", NIX_STAT_LF_RX_RX_GC_OCTS_PASSED},
+	{"rx_gc_pkts_pass", NIX_STAT_LF_RX_RX_GC_PKTS_PASSED},
+	{"rx_yc_octs_pass", NIX_STAT_LF_RX_RX_YC_OCTS_PASSED},
+	{"rx_yc_pkts_pass", NIX_STAT_LF_RX_RX_YC_PKTS_PASSED},
+	{"rx_rc_octs_pass", NIX_STAT_LF_RX_RX_RC_OCTS_PASSED},
+	{"rx_rc_pkts_pass", NIX_STAT_LF_RX_RX_RC_PKTS_PASSED},
+	{"rx_gc_octs_drop", NIX_STAT_LF_RX_RX_GC_OCTS_DROP},
+	{"rx_gc_pkts_drop", NIX_STAT_LF_RX_RX_GC_PKTS_DROP},
+	{"rx_yc_octs_drop", NIX_STAT_LF_RX_RX_YC_OCTS_DROP},
+	{"rx_yc_pkts_drop", NIX_STAT_LF_RX_RX_YC_PKTS_DROP},
+	{"rx_rc_octs_drop", NIX_STAT_LF_RX_RX_RC_OCTS_DROP},
+	{"rx_rc_pkts_drop", NIX_STAT_LF_RX_RX_RC_PKTS_DROP},
+	{"rx_cpt_pkts_drop", NIX_STAT_LF_RX_RX_CPT_DROP_PKTS},
+	{"rx_ipsecd_pkts_drop", NIX_STAT_LF_RX_RX_IPSECD_DROP_PKTS},
+};
+
 static const struct cnxk_nix_xstats_name nix_q_xstats[] = {
 	{"rq_op_re_pkts", NIX_LF_RQ_OP_RE_PKTS},
 };
@@ -173,6 +190,7 @@ static const struct cnxk_nix_xstats_name nix_tx_xstats_cgx[] = {
 #define CNXK_NIX_NUM_TX_XSTATS_CGX PLT_DIM(nix_tx_xstats_cgx)
 #define CNXK_NIX_NUM_RX_XSTATS_RPM PLT_DIM(nix_rx_xstats_rpm)
 #define CNXK_NIX_NUM_TX_XSTATS_RPM PLT_DIM(nix_tx_xstats_rpm)
+#define CNXK_NIX_NUM_CN10K_RX_XSTATS PLT_DIM(nix_cn10k_rx_xstats)
 
 #define CNXK_NIX_NUM_XSTATS_REG                                                \
 	(CNXK_NIX_NUM_RX_XSTATS + CNXK_NIX_NUM_TX_XSTATS +                     \
@@ -182,7 +200,7 @@ static const struct cnxk_nix_xstats_name nix_tx_xstats_cgx[] = {
 	 CNXK_NIX_NUM_TX_XSTATS_CGX)
 #define CNXK_NIX_NUM_XSTATS_RPM                                                \
 	(CNXK_NIX_NUM_XSTATS_REG + CNXK_NIX_NUM_RX_XSTATS_RPM +                \
-	 CNXK_NIX_NUM_TX_XSTATS_RPM)
+	 CNXK_NIX_NUM_TX_XSTATS_RPM + CNXK_NIX_NUM_CN10K_RX_XSTATS)
 
 static inline uint64_t
 roc_nix_num_rx_xstats(void)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-24  4:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 12:51 [PATCH] common/cnxk: adds cn10k specific xstats Rahul Bhansali
2022-02-24  4:18 ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).