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 7117F45B37; Mon, 14 Oct 2024 14:01:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 283EB40669; Mon, 14 Oct 2024 14:01:35 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 6C41640613 for ; Mon, 14 Oct 2024 14:01:30 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 49F401A089B; Mon, 14 Oct 2024 14:01:30 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0E37A1A019D; Mon, 14 Oct 2024 14:01:30 +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 1D9F0183DC02; Mon, 14 Oct 2024 20:01:29 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Rohit Raj Subject: [v3 04/43] net/dpaa2: add support to dump dpdmux counters Date: Mon, 14 Oct 2024 17:30:47 +0530 Message-Id: <20241014120126.170790-5-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241014120126.170790-1-vanshika.shukla@nxp.com> References: <20240918075056.1838654-2-vanshika.shukla@nxp.com> <20241014120126.170790-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 7dd5a60966..b2ec5337b1 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