From: Rakesh Kudurumalla <rkudurumalla@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, <jerinj@marvell.com>,
Rakesh Kudurumalla <rkudurumalla@marvell.com>
Subject: [PATCH 1/2] common/cnxk: support to dump debug info to file
Date: Tue, 5 Dec 2023 15:15:38 +0530 [thread overview]
Message-ID: <20231205094539.1377142-1-rkudurumalla@marvell.com> (raw)
This patch dumps contents of receviced packet descriptor from CQ
for debug to file
Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
---
drivers/common/cnxk/roc_cpt.h | 2 +-
drivers/common/cnxk/roc_cpt_debug.c | 56 +++++++++++++++++------------
drivers/common/cnxk/roc_nix.h | 2 +-
drivers/common/cnxk/roc_nix_debug.c | 3 +-
4 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h
index 787bccb27d..523a5964a3 100644
--- a/drivers/common/cnxk/roc_cpt.h
+++ b/drivers/common/cnxk/roc_cpt.h
@@ -191,7 +191,7 @@ 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);
+void __roc_api roc_cpt_parse_hdr_dump(FILE *file, const struct cpt_parse_hdr_s *cpth);
int __roc_api roc_cpt_ctx_write(struct roc_cpt_lf *lf, void *sa_dptr,
void *sa_cptr, uint16_t sa_len);
diff --git a/drivers/common/cnxk/roc_cpt_debug.c b/drivers/common/cnxk/roc_cpt_debug.c
index dce3638507..8e69b0a0e5 100644
--- a/drivers/common/cnxk/roc_cpt_debug.c
+++ b/drivers/common/cnxk/roc_cpt_debug.c
@@ -5,38 +5,48 @@
#include "roc_api.h"
#include "roc_priv.h"
+#define cpt_dump(file, fmt, ...) do { \
+ if ((file) == NULL) \
+ plt_dump(fmt, ##__VA_ARGS__); \
+ else \
+ fprintf(file, fmt "\n", ##__VA_ARGS__); \
+} while (0)
+
void
-roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
+roc_cpt_parse_hdr_dump(FILE *file, const struct cpt_parse_hdr_s *cpth)
{
struct cpt_frag_info_s *frag_info;
uint32_t offset;
uint64_t *slot;
- plt_print("CPT_PARSE \t0x%p:", cpth);
+ cpt_dump(file, "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",
+ cpt_dump(file, "W0: cookie \t0x%x\t\tmatch_id \t0x%04x \t",
+ cpth->w0.cookie, cpth->w0.match_id);
+ cpt_dump(file, "W0: err_sum \t%u \t", cpth->w0.err_sum);
+ cpt_dump(file, "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",
+ cpt_dump(file, "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", plt_be_to_cpu_64(cpth->wqe_ptr));
+ cpt_dump(file, "W1: wqe_ptr \t0x%016lx\t",
+ plt_be_to_cpu_64(cpth->wqe_ptr));
/* W2 */
- plt_print("W2: frag_age \t0x%x\t\torig_pf_func \t0x%04x",
+ cpt_dump(file, "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);
+ cpt_dump(file, "W2: il3_off \t0x%x\t\tfi_pad \t0x%x \t",
+ cpth->w2.il3_off, cpth->w2.fi_pad);
+ cpt_dump(file, "W2: fi_offset \t0x%x \t", cpth->w2.fi_offset);
/* W3 */
- plt_print("W3: hw_ccode \t0x%x\t\tuc_ccode \t0x%x\t\tspi \t0x%08x",
+ cpt_dump(file, "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,
+ cpt_dump(file, "W4: esn \t%" PRIx64 " \t OR frag1_wqe_ptr \t0x%" PRIx64,
cpth->esn, plt_be_to_cpu_64(cpth->frag1_wqe_ptr));
/* offset of 0 implies 256B, otherwise it implies offset*8B */
@@ -44,24 +54,24 @@ roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth)
offset = (((offset - 1) & 0x1f) + 1) * 8;
frag_info = PLT_PTR_ADD(cpth, offset);
- plt_print("CPT Fraginfo \t0x%p:", frag_info);
+ cpt_dump(file, "CPT Fraginfo \t0x%p:", frag_info);
/* W0 */
- plt_print("W0: f0.info \t0x%x", frag_info->w0.f0.info);
- plt_print("W0: f1.info \t0x%x", frag_info->w0.f1.info);
- plt_print("W0: f2.info \t0x%x", frag_info->w0.f2.info);
- plt_print("W0: f3.info \t0x%x", frag_info->w0.f3.info);
+ cpt_dump(file, "W0: f0.info \t0x%x", frag_info->w0.f0.info);
+ cpt_dump(file, "W0: f1.info \t0x%x", frag_info->w0.f1.info);
+ cpt_dump(file, "W0: f2.info \t0x%x", frag_info->w0.f2.info);
+ cpt_dump(file, "W0: f3.info \t0x%x", frag_info->w0.f3.info);
/* W1 */
- plt_print("W1: frag_size0 \t0x%x", frag_info->w1.frag_size0);
- plt_print("W1: frag_size1 \t0x%x", frag_info->w1.frag_size1);
- plt_print("W1: frag_size2 \t0x%x", frag_info->w1.frag_size2);
- plt_print("W1: frag_size3 \t0x%x", frag_info->w1.frag_size3);
+ cpt_dump(file, "W1: frag_size0 \t0x%x", frag_info->w1.frag_size0);
+ cpt_dump(file, "W1: frag_size1 \t0x%x", frag_info->w1.frag_size1);
+ cpt_dump(file, "W1: frag_size2 \t0x%x", frag_info->w1.frag_size2);
+ cpt_dump(file, "W1: frag_size3 \t0x%x", frag_info->w1.frag_size3);
slot = (uint64_t *)(frag_info + 1);
- plt_print("Frag Slot2: WQE ptr \t%p",
+ cpt_dump(file, "Frag Slot2: WQE ptr \t%p",
(void *)plt_be_to_cpu_64(slot[0]));
- plt_print("Frag Slot3: WQE ptr \t%p",
+ cpt_dump(file, "Frag Slot3: WQE ptr \t%p",
(void *)plt_be_to_cpu_64(slot[1]));
}
diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h
index acdd1c4cbc..a96cf73757 100644
--- a/drivers/common/cnxk/roc_nix.h
+++ b/drivers/common/cnxk/roc_nix.h
@@ -548,7 +548,7 @@ int __roc_api roc_nix_rx_drop_re_set(struct roc_nix *roc_nix, bool ena);
int __roc_api roc_nix_lf_get_reg_count(struct roc_nix *roc_nix);
int __roc_api roc_nix_lf_reg_dump(struct roc_nix *roc_nix, uint64_t *data);
int __roc_api roc_nix_queues_ctx_dump(struct roc_nix *roc_nix, FILE *file);
-void __roc_api roc_nix_cqe_dump(const struct nix_cqe_hdr_s *cq);
+void __roc_api roc_nix_cqe_dump(FILE *file, const struct nix_cqe_hdr_s *cq);
void __roc_api roc_nix_rq_dump(struct roc_nix_rq *rq, FILE *file);
void __roc_api roc_nix_cq_dump(struct roc_nix_cq *cq, FILE *file);
void __roc_api roc_nix_sq_dump(struct roc_nix_sq *sq, FILE *file);
diff --git a/drivers/common/cnxk/roc_nix_debug.c b/drivers/common/cnxk/roc_nix_debug.c
index 8c7d902f1e..8962a76097 100644
--- a/drivers/common/cnxk/roc_nix_debug.c
+++ b/drivers/common/cnxk/roc_nix_debug.c
@@ -808,9 +808,8 @@ roc_nix_queues_ctx_dump(struct roc_nix *roc_nix, FILE *file)
/* Dumps struct nix_cqe_hdr_s and union nix_rx_parse_u */
void
-roc_nix_cqe_dump(const struct nix_cqe_hdr_s *cq)
+roc_nix_cqe_dump(FILE *file, const struct nix_cqe_hdr_s *cq)
{
- FILE *file = NULL;
const union nix_rx_parse_u *rx =
(const union nix_rx_parse_u *)((const uint64_t *)cq + 1);
const uint64_t *sgs = (const uint64_t *)(rx + 1);
--
2.25.1
next reply other threads:[~2023-12-05 9:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 9:45 Rakesh Kudurumalla [this message]
2023-12-05 9:45 ` [PATCH 2/2] net/cnxk: dump Rx descriptor " Rakesh Kudurumalla
2023-12-07 6:36 ` Jerin Jacob
2023-12-07 13:46 ` [PATCH v2 1/2] common/cnxk: support to dump debug " Rakesh Kudurumalla
2023-12-07 13:46 ` [PATCH v2 2/2] net/cnxk: dump Rx descriptor " Rakesh Kudurumalla
2023-12-11 9:40 ` Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231205094539.1377142-1-rkudurumalla@marvell.com \
--to=rkudurumalla@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).