[dpdk-dev] [PATCH v2 2/3] common/cnxk: print counters along with flow dump

psatheesh at marvell.com psatheesh at marvell.com
Mon Aug 29 08:24:41 CEST 2022


From: Satheesh Paul <psatheesh at marvell.com>

When dumping hardware flow data, print any counter
configured on the flow as well.

Signed-off-by: Satheesh Paul <psatheesh at marvell.com>
Reviewed-by: Kiran Kumar K <kirankumark at marvell.com>
---
 drivers/common/cnxk/roc_npc_mcam_dump.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/common/cnxk/roc_npc_mcam_dump.c b/drivers/common/cnxk/roc_npc_mcam_dump.c
index 16997bd38a..fe57811a84 100644
--- a/drivers/common/cnxk/roc_npc_mcam_dump.c
+++ b/drivers/common/cnxk/roc_npc_mcam_dump.c
@@ -590,12 +590,19 @@ roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
 	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
 	struct npc_mcam_read_entry_req *mcam_read_req;
 	struct npc_mcam_read_entry_rsp *mcam_read_rsp;
+	uint64_t count = 0;
 	bool is_rx = 0;
 	int i, rc = 0;
 
 	fprintf(file, "MCAM Index:%d\n", flow->mcam_id);
-	fprintf(file, "Interface :%s (%d)\n", intf_str[flow->nix_intf],
-		flow->nix_intf);
+	if (flow->ctr_id != NPC_COUNTER_NONE && flow->use_ctr) {
+		rc = roc_npc_mcam_read_counter(roc_npc, flow->ctr_id, &count);
+		if (rc)
+			return;
+		fprintf(file, "Hit count: %" PRIu64 "\n", count);
+	}
+
+	fprintf(file, "Interface :%s (%d)\n", intf_str[flow->nix_intf], flow->nix_intf);
 	fprintf(file, "Priority  :%d\n", flow->priority);
 
 	if (flow->nix_intf == NIX_INTF_RX)
-- 
2.35.3



More information about the dev mailing list