From patchwork Tue Dec 5 09:45:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Kudurumalla X-Patchwork-Id: 134867 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E09D643676; Tue, 5 Dec 2023 10:45:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D85B042DFB; Tue, 5 Dec 2023 10:45:48 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 1996A42D45 for ; Tue, 5 Dec 2023 10:45:46 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B4NxYZb022361 for ; Tue, 5 Dec 2023 01:45:46 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=HE2KXAlKxjD2+80AICK7ImmpkWPX8lEauX93g4fzpSE=; b=UXfiaAnU4wsuiXQyNoWuuUkt2Re4y1w7p75Np1egfE2AMMpZKecEbtvOTO+MkRo1FcAE JjUjLM8EQNtDRHvJ8fYehyf2tJZy/iK4e5YCcUifVMsNkKR56hZWd+gdYiG+PF9tvmJ+ znu4fV7CPZO2EJBFV81rJSxJzqsQxqvSnC+LxXlz79fROJb+1rm8AxbdYY9Xx3LR+/WO HVHDSfKmxQEslkEBKF9sy2TTSkv5OfGmv84j8Y2pcXUxwoExfcoyBpVrUZrFi8BiSN8u 3hvOW9UrF+I1whT+THOoYKq2Wx6jPWb7gIRmzdz51FF0KY3yD+1xboac85MLihSKMUxk ZQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3usrx3hhgd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 05 Dec 2023 01:45:45 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 5 Dec 2023 01:45:44 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 5 Dec 2023 01:45:44 -0800 Received: from localhost.localdomain (unknown [10.28.36.154]) by maili.marvell.com (Postfix) with ESMTP id F02BD3F70A7; Tue, 5 Dec 2023 01:45:41 -0800 (PST) From: Rakesh Kudurumalla To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rakesh Kudurumalla Subject: [PATCH 1/2] common/cnxk: support to dump debug info to file Date: Tue, 5 Dec 2023 15:15:38 +0530 Message-ID: <20231205094539.1377142-1-rkudurumalla@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: U44gZ3_sb7znoyrRtEUfucmYrF9koh0B X-Proofpoint-ORIG-GUID: U44gZ3_sb7znoyrRtEUfucmYrF9koh0B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-05_04,2023-12-04_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch dumps contents of receviced packet descriptor from CQ for debug to file Signed-off-by: Rakesh Kudurumalla --- 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);