From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2AB4245977; Fri, 13 Sep 2024 08:00:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D918C42E49; Fri, 13 Sep 2024 08:00:12 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id E6F6242DE9 for ; Fri, 13 Sep 2024 08:00:05 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id BBE12201CAD; Fri, 13 Sep 2024 08:00:05 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 597A8201CAE; Fri, 13 Sep 2024 08:00:05 +0200 (CEST) Received: from lsv03379.swis.in-blr01.nxp.com (lsv03379.swis.in-blr01.nxp.com [92.120.147.188]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id EF1F7183DC2E; Fri, 13 Sep 2024 14:00:01 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Rohit Raj Subject: [v1 04/43] net/dpaa2: add support to dump dpdmux counters Date: Fri, 13 Sep 2024 11:29:20 +0530 Message-Id: <20240913055959.3246917-5-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240913055959.3246917-1-vanshika.shukla@nxp.com> References: <20240913055959.3246917-1-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP 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: Hemant Agrawal This patch add supports to dump dpdmux counters as they are required to identify the reasons for packet drop in dpdmux. Signed-off-by: Hemant Agrawal Signed-off-by: Rohit Raj --- drivers/net/dpaa2/dpaa2_mux.c | 84 +++++++++++++++++++++++++++++++ drivers/net/dpaa2/rte_pmd_dpaa2.h | 18 +++++++ drivers/net/dpaa2/version.map | 1 + 3 files changed, 103 insertions(+) diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c index 2ff1a98fda..d682a61e52 100644 --- a/drivers/net/dpaa2/dpaa2_mux.c +++ b/drivers/net/dpaa2/dpaa2_mux.c @@ -259,6 +259,90 @@ rte_pmd_dpaa2_mux_rx_frame_len(uint32_t dpdmux_id, uint16_t max_rx_frame_len) return ret; } +/* dump the status of the dpaa2_mux counters on the console */ +void +rte_pmd_dpaa2_mux_dump_counter(FILE *f, uint32_t dpdmux_id, int num_if) +{ + struct dpaa2_dpdmux_dev *dpdmux; + uint64_t counter; + int ret; + int if_id; + + /* Find the DPDMUX from dpdmux_id in our list */ + dpdmux = get_dpdmux_from_id(dpdmux_id); + if (!dpdmux) { + DPAA2_PMD_ERR("Invalid dpdmux_id: %d", dpdmux_id); + return; + } + + for (if_id = 0; if_id < num_if; if_id++) { + fprintf(f, "dpdmux.%d\n", if_id); + + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_FRAME, &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_BYTE, &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_BYTE %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_FLTR_FRAME, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_FLTR_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_FRAME_DISCARD, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_FRAME_DISCARD %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_MCAST_FRAME, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_MCAST_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_MCAST_BYTE, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_MCAST_BYTE %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_BCAST_FRAME, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_BCAST_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_ING_BCAST_BYTES, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_ING_BCAST_BYTES %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_EGR_FRAME, &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_EGR_FRAME %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_EGR_BYTE, &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_EGR_BYTE %" PRIu64 "\n", + counter); + ret = dpdmux_if_get_counter(&dpdmux->dpdmux, CMD_PRI_LOW, + dpdmux->token, if_id, DPDMUX_CNT_EGR_FRAME_DISCARD, + &counter); + if (!ret) + fprintf(f, "DPDMUX_CNT_EGR_FRAME_DISCARD %" PRIu64 "\n", + counter); + } +} + static int dpaa2_create_dpdmux_device(int vdev_fd __rte_unused, struct vfio_device_info *obj_info __rte_unused, diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h index aea9bae905..fd9acd841b 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2.h +++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h @@ -33,6 +33,24 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, struct rte_flow_item *pattern[], struct rte_flow_action *actions[]); +/** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * + * Dump demultiplex ethernet traffic counters + * + * @param f + * output stream + * @param dpdmux_id + * ID of the DPDMUX MC object. + * @param num_if + * number of interface in dpdmux object + * + */ +__rte_experimental +void +rte_pmd_dpaa2_mux_dump_counter(FILE *f, uint32_t dpdmux_id, int num_if); + /** * @warning * @b EXPERIMENTAL: this API may change, or be removed, without prior notice diff --git a/drivers/net/dpaa2/version.map b/drivers/net/dpaa2/version.map index 2d95303e27..7323fc8869 100644 --- a/drivers/net/dpaa2/version.map +++ b/drivers/net/dpaa2/version.map @@ -19,6 +19,7 @@ EXPERIMENTAL { # added in 24.11 rte_pmd_dpaa2_set_one_step_ts; rte_pmd_dpaa2_get_one_step_ts; + rte_pmd_dpaa2_mux_dump_counter; }; INTERNAL { -- 2.25.1