[v2,2/3] common/cnxk: print counters along with flow dump

Message ID 20220829062442.49728-2-psatheesh@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [v2,1/3] common/cnxk: fix printing disabled MKEX registers |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Satheesh Paul Antonysamy Aug. 29, 2022, 6:24 a.m. UTC
  From: Satheesh Paul <psatheesh@marvell.com>

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

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

Patch

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)