From patchwork Thu Feb 8 08:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 136519 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 15D8B43ACC; Thu, 8 Feb 2024 10:00:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C4A742E29; Thu, 8 Feb 2024 10:00:17 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 822BE42E04 for ; Thu, 8 Feb 2024 10:00:13 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4187djlx005897 for ; Thu, 8 Feb 2024 01:00:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=2Q5NmobC76Lhdm08GKZgqiaEnQufah54I0G+/MaIo1I=; b=WgM QwxcX7WVCKXLh8HrszhAFCyRkbkV6eYuaD0mowwPzujuYGim5/69Myaf2jsx8Xfu lGfnCsRaGjY7kKBCCg21pqQAzjiT0OdtQdG1R7Sbnz6Y5aEzYtDKhRVnBWmaNNBI 8II+x5WBAEARCdh/pRBZquIsluguNjg10UhZCmcc8jfOmU/0JytBU7Dn8UdaytEa koN9v7h1LL5HCWOquCvk5LfnPtaJtnOVFKMxqiBCO8tHtO/elUwTFoDSKABjtSam 0LSXquaCaUY/hX5cv1FzQkszPBovkFCuXK0aImWM3G7r+Wqxfu8HABNmhi9mcP5D UN/z/3KHcgKGz3bM/PQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3w4trp877s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 08 Feb 2024 01:00:12 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 8 Feb 2024 01:00:10 -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; Thu, 8 Feb 2024 01:00:10 -0800 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id D6DC23F70A4; Thu, 8 Feb 2024 01:00:08 -0800 (PST) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: Subject: [PATCH 04/13] common/cnxk: dump selected SQ entries Date: Thu, 8 Feb 2024 14:29:47 +0530 Message-ID: <20240208085956.1741174-4-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240208085956.1741174-1-ndabilpuram@marvell.com> References: <20240208085956.1741174-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: soBywKBTRD1BvAvlfjOpoSOOrUub8Q9n X-Proofpoint-ORIG-GUID: soBywKBTRD1BvAvlfjOpoSOOrUub8Q9n X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-08_01,2024-02-07_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 From: Satha Rao New API to dump detailed SQ entries. Signed-off-by: Satha Rao --- drivers/common/cnxk/roc_nix.h | 2 + drivers/common/cnxk/roc_nix_debug.c | 172 ++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 175 insertions(+) diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 84e6fc3df5..9d57ca0be7 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -553,6 +553,8 @@ 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); +int __roc_api roc_nix_sq_desc_dump(struct roc_nix *roc_nix, uint16_t q, uint16_t offset, + uint16_t num, FILE *file); void __roc_api roc_nix_tm_dump(struct roc_nix *roc_nix, FILE *file); void __roc_api roc_nix_dump(struct roc_nix *roc_nix, FILE *file); diff --git a/drivers/common/cnxk/roc_nix_debug.c b/drivers/common/cnxk/roc_nix_debug.c index 8962a76097..26546f9297 100644 --- a/drivers/common/cnxk/roc_nix_debug.c +++ b/drivers/common/cnxk/roc_nix_debug.c @@ -1362,3 +1362,175 @@ roc_nix_inl_outb_cpt_lfs_dump(struct roc_nix *roc_nix, FILE *file) cpt_lf_print(&lf_base[i]); } } + +static void +nix_tm_sqe_dump(uint64_t *sqe, int head_off, int end_off, int instr_sz, FILE *file, int full, + uint16_t *num) +{ + int i, j, inc = (8 * (0x2 >> instr_sz)), segs; + uint64_t *ptr; + + if (!sqe || !(*num)) + return; + + ptr = sqe + (head_off * inc); + for (i = head_off; i < end_off; i++) { + if (!(*num)) + return; + ptr = sqe + (i * inc); + nix_dump(file, "Entry : %d >>>>>\n", i); + nix_dump(file, "\t\tSEND_HDR[0]: 0x%016lx SEND_HDR[1]: 0x%016lx\n", *ptr, + *(ptr + 1)); + *num = *num - 1; + if (!full) + continue; + ptr += 2; + if (((*ptr >> 60) & 0xF) == NIX_SUBDC_EXT) { + nix_dump(file, "\t\tSUBDC_EXT[0]: 0x%016lx DUBDC_EXT[1]: 0x%016lx\n", *ptr, + *(ptr + 1)); + ptr += 2; + } + if (((*ptr >> 60) & 0xF) == NIX_SUBDC_AGE_AND_STATS) { + nix_dump(file, + "\t\tSUBDC_AGE_STATS[0]: 0x%016lx SUBDC_AGE_STATS[1]: 0x%016lx\n", + *ptr, *(ptr + 1)); + ptr += 2; + } + if (((*ptr >> 60) & 0xF) == NIX_SUBDC_JUMP) { + nix_dump(file, "\t\tSUBDC_JUMP: 0x%016lx\n", *ptr); + ptr += 1; + ptr = (uint64_t *)*ptr; + } + if (((*ptr >> 60) & 0xF) == NIX_SUBDC_CRC) { + nix_dump(file, "\t\tSUBDC_CRC[0]: 0x%016lx SUBDC_CRC[1]: 0x%016lx\n", *ptr, + *(ptr + 1)); + ptr += 2; + } + /* We are not parsing immediate send descriptor */ + if (((*ptr >> 60) & 0xF) == NIX_SUBDC_IMM) { + nix_dump(file, "\t\tSUBDC_IMM: 0x%016lx ", *ptr); + continue; + } + while (1) { + if (((*ptr >> 60) & 0xF) == NIX_SUBDC_SG) { + nix_dump(file, "\t\tSUBDC_SG: 0x%016lx ", *ptr); + segs = (*ptr >> 48) & 0x3; + ptr += 1; + for (j = 0; j < segs; j++) { + nix_dump(file, "\t\t\t 0x%016lx ", *ptr); + ptr += 1; + } + if (segs == 2) + ptr += 1; + } else if (((*ptr >> 60) & 0xF) == NIX_SUBDC_SG2) { + nix_dump(file, "\t\tSUBDC_SG2: 0x%016lx ", *ptr); + ptr += 1; + nix_dump(file, "\t\t\t 0x%016lx ", *ptr); + ptr += 1; + } else + break; + } + } +} + +int +roc_nix_sq_desc_dump(struct roc_nix *roc_nix, uint16_t q, uint16_t offset, uint16_t num, FILE *file) +{ + int head_off, count, rc = 0, tail_off, full = 0; + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct roc_nix_sq *sq = nix->sqs[q]; + void *sqb_buf, *dat, *tail_sqb; + struct ndc_sync_op *ndc_req; + struct dev *dev = &nix->dev; + uint16_t sqes_per_sqb; + struct mbox *mbox; + + mbox = dev->mbox; + /* Sync NDC-NIX-TX for LF */ + ndc_req = mbox_alloc_msg_ndc_sync_op(mbox_get(mbox)); + if (ndc_req == NULL) { + mbox_put(mbox); + return -EFAULT; + } + + ndc_req->nix_lf_tx_sync = 1; + if (mbox_process(mbox)) + rc |= NIX_ERR_NDC_SYNC; + mbox_put(mbox); + + if (rc) + plt_err("NDC_SYNC failed rc %d", rc); + + rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_SQ, q, (void *)&dat); + if (rc) + return rc; + if (roc_model_is_cn9k()) { + volatile struct nix_sq_ctx_s *ctx = (struct nix_sq_ctx_s *)dat; + + if (ctx->mnq_dis || ctx->lmt_dis) + full = 1; + + count = ctx->sqb_count; + sqb_buf = (void *)ctx->head_sqb; + tail_sqb = (void *)ctx->tail_sqb; + head_off = ctx->head_offset; + tail_off = ctx->tail_offset; + } else { + volatile struct nix_cn10k_sq_ctx_s *ctx = (struct nix_cn10k_sq_ctx_s *)dat; + + if (ctx->mnq_dis || ctx->lmt_dis) + full = 1; + + count = ctx->sqb_count; + sqb_buf = (void *)ctx->head_sqb; + tail_sqb = (void *)ctx->tail_sqb; + head_off = ctx->head_offset; + tail_off = ctx->tail_offset; + } + sqes_per_sqb = 1 << sq->sqes_per_sqb_log2; + while (count) { + void *next_sqb; + + if (sqb_buf == tail_sqb) { + if ((head_off + offset) >= tail_off) /* Nothing to be dump */ + return 0; + head_off += tail_off; + break; + } else if ((head_off + offset) >= sqes_per_sqb) { + next_sqb = *(void **)((uint64_t *)sqb_buf + + (uint32_t)((sqes_per_sqb - 1) * + (0x2 >> sq->max_sqe_sz) * 8)); + /* While traffic running HW may freed/reused this SQE */ + if (!next_sqb) + return 0; + sqb_buf = next_sqb; + head_off = 0; + count--; + } else { + head_off += offset; + break; + } + } + while (count) { + void *next_sqb; + + if (sqb_buf == tail_sqb) + nix_tm_sqe_dump(sqb_buf, head_off, tail_off, sq->max_sqe_sz, file, full, + &num); + else + nix_tm_sqe_dump(sqb_buf, head_off, (sqes_per_sqb - 1), sq->max_sqe_sz, file, + full, &num); + if (!num) + break; + next_sqb = *(void **)((uint64_t *)sqb_buf + + (uint32_t)((sqes_per_sqb - 1) * (0x2 >> sq->max_sqe_sz) * 8)); + /* While traffic running HW may freed/reused this SQE */ + if (!next_sqb) + return 0; + sqb_buf = next_sqb; + head_off = 0; + count--; + } + + return 0; +} diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 2123ebf701..45b5148522 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -336,6 +336,7 @@ INTERNAL { roc_nix_rx_drop_re_set; roc_nix_rx_queue_intr_disable; roc_nix_rx_queue_intr_enable; + roc_nix_sq_desc_dump; roc_nix_sq_dump; roc_nix_sq_ena_dis; roc_nix_sq_fini;