[02/27] common/cnxk: add helper API to dump cpt parse header

Message ID 20210902021505.17607-3-ndabilpuram@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series net/cnxk: support for inline ipsec |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Nithin Dabilpuram Sept. 2, 2021, 2:14 a.m. UTC
  Add helper API to dump cpt parse header.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/common/cnxk/roc_cpt.h       |  2 ++
 drivers/common/cnxk/roc_cpt_debug.c | 31 +++++++++++++++++++++++++++++++
 drivers/common/cnxk/version.map     |  1 +
 3 files changed, 34 insertions(+)
  

Patch

diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h
index f0f505a..9b55303 100644
--- a/drivers/common/cnxk/roc_cpt.h
+++ b/drivers/common/cnxk/roc_cpt.h
@@ -154,4 +154,6 @@  void __roc_api roc_cpt_iq_enable(struct roc_cpt_lf *lf);
 int __roc_api roc_cpt_lmtline_init(struct roc_cpt *roc_cpt,
 				   struct roc_cpt_lmtline *lmtline, int lf_id);
 
+void __roc_api roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth);
+
 #endif /* _ROC_CPT_H_ */
diff --git a/drivers/common/cnxk/roc_cpt_debug.c b/drivers/common/cnxk/roc_cpt_debug.c
index 9a9dcba..a6c9004 100644
--- a/drivers/common/cnxk/roc_cpt_debug.c
+++ b/drivers/common/cnxk/roc_cpt_debug.c
@@ -5,6 +5,37 @@ 
 #include "roc_api.h"
 #include "roc_priv.h"
 
+void
+roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
+{
+	plt_print("CPT_PARSE \t0x%p:", cpth);
+
+	/* W0 */
+	plt_print("W0: cookie \t0x%x\t\tmatch_id \t0x%04x\t\terr_sum \t%u \t",
+		  cpth->w0.cookie, cpth->w0.match_id, cpth->w0.err_sum);
+	plt_print("W0: reas_sts \t0x%x\t\tet_owr \t%u\t\tpkt_fmt \t%u \t",
+		  cpth->w0.reas_sts, cpth->w0.et_owr, cpth->w0.pkt_fmt);
+	plt_print("W0: pad_len \t%u\t\tnum_frags \t%u\t\tpkt_out \t%u \t",
+		  cpth->w0.pad_len, cpth->w0.num_frags, cpth->w0.pkt_out);
+
+	/* W1 */
+	plt_print("W1: wqe_ptr \t0x%016lx\t", cpth->wqe_ptr);
+
+	/* W2 */
+	plt_print("W2: frag_age \t0x%x\t\torig_pf_func \t0x%04x",
+		  cpth->w2.frag_age, cpth->w2.orig_pf_func);
+	plt_print("W2: il3_off \t0x%x\t\tfi_pad \t0x%x\t\tfi_offset \t0x%x \t",
+		  cpth->w2.il3_off, cpth->w2.fi_pad, cpth->w2.fi_offset);
+
+	/* W3 */
+	plt_print("W3: hw_ccode \t0x%x\t\tuc_ccode \t0x%x\t\tspi \t0x%08x",
+		  cpth->w3.hw_ccode, cpth->w3.uc_ccode, cpth->w3.spi);
+
+	/* W4 */
+	plt_print("W4: esn \t%" PRIx64 " \t OR frag1_wqe_ptr \t0x%" PRIx64,
+		  cpth->esn, cpth->frag1_wqe_ptr);
+}
+
 static int
 cpt_af_reg_read(struct roc_cpt *roc_cpt, uint64_t reg, uint64_t *val)
 {
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 7814b60..5dbb21c 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -66,6 +66,7 @@  INTERNAL {
 	roc_cpt_lf_fini;
 	roc_cpt_lfs_print;
 	roc_cpt_lmtline_init;
+	roc_cpt_parse_hdr_dump;
 	roc_cpt_rxc_time_cfg;
 	roc_error_msg_get;
 	roc_hash_sha1_gen;