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 8D35345ADF; Tue, 8 Oct 2024 09:28:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9EB9E40DF6; Tue, 8 Oct 2024 09:23:58 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2058.outbound.protection.outlook.com [40.107.20.58]) by mails.dpdk.org (Postfix) with ESMTP id 7425540E32 for ; Tue, 8 Oct 2024 09:23:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mi7ttVQN9eXS5wlSadq4xplfEfB7ZSkoKXgxzWgAC0FUvlUyrOlwMMsf6mNw/yV9aPl51eYxgZuymjKj+YsCW73vE7M9u5GwK+COOoXZWcldr8W8YXQRYi6rz/JWKTG8GRWaQGBJHSUFvgkR5dfgYZES7qGuWlQWOv8tL/39ff6H6OsfaTo+gGacgwVXDJkEI17ooc/4Oh5TpGwTJbR3zXUGDjz11uz5FHRfHlyr97Kfr8loRwNWwzeHYsm2qh4UOqEhfRtNTM8lVny0LWwhir73/3DaEgWTTxRfbUyXmnUeQky7d8HQ+wLNIEpfLV2vCpiCqnOD4PdX6DtyOdYPoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EjAecn5/DUPxjY7gQRbvaMOoHIML6552Tk+YY3Nljdg=; b=DifkslgndkkAVUw681SKpPg6+16V5aSt2Uj4zU6o42Qn876bLhJ9hiIUYEjDj25H7DIE0qLr98RQYDB+9DZe18ZYDM92Yy7+hEeQ6Rfns2cPDza+MbMx8iKhUnAGywFZ6YR1FC8BTpilYXF8cVZML2zW/g5jXGNObYUabCR6ZC5hkbVZ/JLGFNCaf7C5qf7yw8JWJjZwUofIQ1e5X6NchQNQmnzTn1nOBpchcaQPBfXEtvUGOdE4vbep+h3CRVhD1TbC0ltV+/FCu7uegBlhmoqU+yaMroyUQZNTb4jCuOnB1OdZhoGe6uPR7vRqVA2k6jVIx0cKo5K17gUgD/q3QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EjAecn5/DUPxjY7gQRbvaMOoHIML6552Tk+YY3Nljdg=; b=U7rxUV6kUnOe/1fZyAa3OOQVYHUdODmHO/l1mHrSAtTnbevuXLpFs2OhDQ2HlbxV5hTM6uAXvvCJwwYFP5YgZv5E50lxfrcZU5P9jC03SIew9QNu7Y0JUZMiJ3JvhoxmUs9Kaosn690/z1xBtW3esMY2q6GvfmQ8RsqBpPfH6tnv2zJuiDhNTptJt9zrucpCVpRWb9n05S0ZkwI7J+8Xqhc//UjqSWCXKx+3WDg0GAboQ8o1avvtShKlkUfrMQBBrAG7HO4/FhoyGY9qY5b1pLuGVHM9ItbWl2FAcI6rx0epH1BN6gUnezmKoNqUO3wyvmuz0Gfx7gvT42Xl5RPQGw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by VI0PR04MB10829.eurprd04.prod.outlook.com (2603:10a6:800:26b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Tue, 8 Oct 2024 07:23:55 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195%4]) with mapi id 15.20.8026.020; Tue, 8 Oct 2024 07:23:55 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Subject: [v4 15/15] bus/dpaa: add port bmi stats Date: Tue, 8 Oct 2024 12:53:06 +0530 Message-Id: <20241008072306.1256445-16-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241008072306.1256445-1-g.singh@nxp.com> References: <20240722163930.2171568-2-g.singh@nxp.com> <20241008072306.1256445-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0221.apcprd06.prod.outlook.com (2603:1096:4:68::29) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|VI0PR04MB10829:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e6ead56-b929-4b28-1d46-08dce76a2ab1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mVizS3zFdWf80y9Su72Eve/1vMvU6tQ74l/PiWKO9HpaA+AJRWNLyWO6zs+m?= =?us-ascii?Q?9Awf7x4hn8HQ3BW9VRQt5DPoF06Q2FtA47DNpFlC9/kAkGjuL/1WGTu58Faj?= =?us-ascii?Q?xOvQ7nfihpHW+hpZKiAB/kloR//DIY8ByCfD53+WdDjwGdkfX+RCV+RAZl9a?= =?us-ascii?Q?VWFBXasTw1EohdXo/SXcHCakYAcolr/S7tazXmY/7+R8ANkXMM1cFPTlOKy8?= =?us-ascii?Q?hToiN9FiXs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= =?us-ascii?Q?Ws687oFzsgcoxhNT0NgT2araUN2vM7LDpfIR0mvt7w5z3pXuWN315nj54e3N?= =?us-ascii?Q?iunm7RruUrNteON+EwAfYCMPSgSOhd9q8GsSByUr26Pewvgqok6MSAiJjzU3?= =?us-ascii?Q?1k1255zlxH+Vr3dh7MgZWrXMEwlyEIdw7H9NbHHaUynMyM2ghOr7YoVcxOW0?= =?us-ascii?Q?EcIjyRFzTdw7BCA2JkQ96WXYkC+UkCSXy8vCeUbIVhcIrA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CbHcsmV2AHfSr9WQsicqv0e6pemK7U4Redz1q5Kf3FCmWG+3YNabWT06WgA/?= =?us-ascii?Q?FAywZNLXzWCJFMixO2TGhpD3V6xIyQef++gaLrkZGPCb/kM0S9wZRxuNBzax?= =?us-ascii?Q?7oJvObo8AflSqovH5ni4f1MYKam+ZKSHJF1Jw1VZRKGMYSuynJGz6oy/eFfF?= =?us-ascii?Q?LBOXUubpHL9zh+uuQR5q7XlAwU/aApD27Op7es1Xnebti72qHlibWpwU1OcG?= =?us-ascii?Q?xDYGRDdlDbMHv3SmaSCCeO8CT30S7BMy3f9g0ybBmBKBi+hXY1Y7Qa096Z5U?= =?us-ascii?Q?E0gCPTYkuGVnvi3H2yPFeF+EHfMojgTR7kYCSaYeRKRm+2NIaIY/1rwGoIng?= =?us-ascii?Q?LY4eStBdj65OT4XvvNFXeNXNyrfbNDyLcI3UMAMZyrF8PNzj8GoNmDX0LqDK?= =?us-ascii?Q?vQC/UdYXHhPQbeLfm4ojWjuvwL3X/Ypjt24ErbXrDM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TYDfPW6JtUVLn/2/XQrStWVP+fRWnMseFmkpNt2E/c?= =?us-ascii?Q?ru3vNgJ4bdoWONeFnqi1R/9hX6WhMLd+35ZWWZbuiYwQvKfx/OgEanAzHOV8?= =?us-ascii?Q?SP4rGF2+GHsFrFHub+iDOSxGTtSPbKOqGCc0tGgxKiTpsIiOsm9uFrU34mU2?= =?us-ascii?Q?AclHi3u/3Nbco9XstjqTErxQF1q/qmcJ4Ta02mFffsWohxeVWOaYM3EZ6PkR?= =?us-ascii?Q?xoYAAFH0vrU/1N3+9ck=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e6ead56-b929-4b28-1d46-08dce76a2ab1 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 07:23:55.0306 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: d2+9dPL8qfRaGuatRycQj4X0pgaUdjcAiHMWffVq8SOHqQeAhuznA6xvGd/NL3ke X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10829 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 Add BMI statistics and fixing the existing extended statistics Signed-off-by: Hemant Agrawal Signed-off-by: Gagandeep Singh --- drivers/bus/dpaa/base/fman/fman_hw.c | 65 +++++++++++++++++++++++++++- drivers/bus/dpaa/include/fman.h | 4 +- drivers/bus/dpaa/include/fsl_fman.h | 12 +++++ drivers/bus/dpaa/version.map | 4 ++ drivers/net/dpaa/dpaa_ethdev.c | 46 +++++++++++++++++--- drivers/net/dpaa/dpaa_ethdev.h | 12 +++++ 6 files changed, 134 insertions(+), 9 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index 24a99f7235..27b39a4975 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -244,8 +244,8 @@ fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n) uint64_t base_offset = offsetof(struct memac_regs, reoct_l); for (i = 0; i < n; i++) - value[i] = (((u64)in_be32((char *)regs + base_offset + 8 * i) | - (u64)in_be32((char *)regs + base_offset + + value[i] = ((u64)in_be32((char *)regs + base_offset + 8 * i) | + ((u64)in_be32((char *)regs + base_offset + 8 * i + 4)) << 32); } @@ -266,6 +266,67 @@ fman_if_stats_reset(struct fman_if *p) ; } +void +fman_if_bmi_stats_enable(struct fman_if *p) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + uint32_t tmp; + + tmp = in_be32(®s->fmbm_rstc); + + tmp |= FMAN_BMI_COUNTERS_EN; + + out_be32(®s->fmbm_rstc, tmp); +} + +void +fman_if_bmi_stats_disable(struct fman_if *p) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + uint32_t tmp; + + tmp = in_be32(®s->fmbm_rstc); + + tmp &= ~FMAN_BMI_COUNTERS_EN; + + out_be32(®s->fmbm_rstc, tmp); +} + +void +fman_if_bmi_stats_get_all(struct fman_if *p, uint64_t *value) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + int i = 0; + + value[i++] = (u32)in_be32(®s->fmbm_rfrc); + value[i++] = (u32)in_be32(®s->fmbm_rfbc); + value[i++] = (u32)in_be32(®s->fmbm_rlfc); + value[i++] = (u32)in_be32(®s->fmbm_rffc); + value[i++] = (u32)in_be32(®s->fmbm_rfdc); + value[i++] = (u32)in_be32(®s->fmbm_rfldec); + value[i++] = (u32)in_be32(®s->fmbm_rodc); + value[i++] = (u32)in_be32(®s->fmbm_rbdc); +} + +void +fman_if_bmi_stats_reset(struct fman_if *p) +{ + struct __fman_if *m = container_of(p, struct __fman_if, __if); + struct rx_bmi_regs *regs = (struct rx_bmi_regs *)m->bmi_map; + + out_be32(®s->fmbm_rfrc, 0); + out_be32(®s->fmbm_rfbc, 0); + out_be32(®s->fmbm_rlfc, 0); + out_be32(®s->fmbm_rffc, 0); + out_be32(®s->fmbm_rfdc, 0); + out_be32(®s->fmbm_rfldec, 0); + out_be32(®s->fmbm_rodc, 0); + out_be32(®s->fmbm_rbdc, 0); +} + void fman_if_promiscuous_enable(struct fman_if *p) { diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index f918836ec2..1f120b7614 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -56,6 +56,8 @@ #define FMAN_PORT_BMI_FIFO_UNITS 0x100 #define FMAN_PORT_IC_OFFSET_UNITS 0x10 +#define FMAN_BMI_COUNTERS_EN 0x80000000 + #define FMAN_ENABLE_BPOOL_DEPLETION 0xF00000F0 #define HASH_CTRL_MCAST_EN 0x00000100 @@ -260,7 +262,7 @@ struct rx_bmi_regs { /**< Buffer Manager pool Information-*/ uint32_t fmbm_acnt[FMAN_PORT_MAX_EXT_POOLS_NUM]; /**< Allocate Counter-*/ - uint32_t reserved0130[8]; + uint32_t reserved0120[16]; /**< 0x130/0x140 - 0x15F reserved -*/ uint32_t fmbm_rcgm[FMAN_PORT_CG_MAP_NUM]; /**< Congestion Group Map*/ diff --git a/drivers/bus/dpaa/include/fsl_fman.h b/drivers/bus/dpaa/include/fsl_fman.h index 20690f8329..5a9750ad0c 100644 --- a/drivers/bus/dpaa/include/fsl_fman.h +++ b/drivers/bus/dpaa/include/fsl_fman.h @@ -60,6 +60,18 @@ void fman_if_stats_reset(struct fman_if *p); __rte_internal void fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n); +__rte_internal +void fman_if_bmi_stats_enable(struct fman_if *p); + +__rte_internal +void fman_if_bmi_stats_disable(struct fman_if *p); + +__rte_internal +void fman_if_bmi_stats_get_all(struct fman_if *p, uint64_t *value); + +__rte_internal +void fman_if_bmi_stats_reset(struct fman_if *p); + /* Set ignore pause option for a specific interface */ void fman_if_set_rx_ignore_pause_frames(struct fman_if *p, bool enable); diff --git a/drivers/bus/dpaa/version.map b/drivers/bus/dpaa/version.map index 3f547f75cf..a17d57632e 100644 --- a/drivers/bus/dpaa/version.map +++ b/drivers/bus/dpaa/version.map @@ -24,6 +24,10 @@ INTERNAL { fman_dealloc_bufs_mask_hi; fman_dealloc_bufs_mask_lo; fman_if_add_mac_addr; + fman_if_bmi_stats_enable; + fman_if_bmi_stats_disable; + fman_if_bmi_stats_get_all; + fman_if_bmi_stats_reset; fman_if_clear_mac_addr; fman_if_disable_rx; fman_if_discard_rx_errors; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 51f5422e0c..da4a64d99a 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -131,6 +131,22 @@ static const struct rte_dpaa_xstats_name_off dpaa_xstats_strings[] = { offsetof(struct dpaa_if_stats, tvlan)}, {"rx_undersized", offsetof(struct dpaa_if_stats, tund)}, + {"rx_frame_counter", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfrc)}, + {"rx_bad_frames_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfbc)}, + {"rx_large_frames_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rlfc)}, + {"rx_filter_frames_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rffc)}, + {"rx_frame_discrad_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfdc)}, + {"rx_frame_list_dma_err_count", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rfldec)}, + {"rx_out_of_buffer_discard ", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rodc)}, + {"rx_buf_diallocate", + offsetof(struct dpaa_if_rx_bmi_stats, fmbm_rbdc)}, }; static struct rte_dpaa_driver rte_dpaa_pmd; @@ -430,6 +446,7 @@ static void dpaa_interrupt_handler(void *param) static int dpaa_eth_dev_start(struct rte_eth_dev *dev) { struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct fman_if *fif = dev->process_private; uint16_t i; PMD_INIT_FUNC_TRACE(); @@ -443,7 +460,9 @@ static int dpaa_eth_dev_start(struct rte_eth_dev *dev) else dev->tx_pkt_burst = dpaa_eth_queue_tx; - fman_if_enable_rx(dev->process_private); + fman_if_bmi_stats_enable(fif); + fman_if_bmi_stats_reset(fif); + fman_if_enable_rx(fif); for (i = 0; i < dev->data->nb_rx_queues; i++) dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; @@ -461,8 +480,10 @@ static int dpaa_eth_dev_stop(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); dev->data->dev_started = 0; - if (!fif->is_shared_mac) + if (!fif->is_shared_mac) { + fman_if_bmi_stats_disable(fif); fman_if_disable_rx(fif); + } dev->tx_pkt_burst = dpaa_eth_tx_drop_all; for (i = 0; i < dev->data->nb_rx_queues; i++) @@ -769,6 +790,7 @@ static int dpaa_eth_stats_reset(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); fman_if_stats_reset(dev->process_private); + fman_if_bmi_stats_reset(dev->process_private); return 0; } @@ -777,8 +799,9 @@ static int dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, unsigned int n) { - unsigned int i = 0, num = RTE_DIM(dpaa_xstats_strings); + unsigned int i = 0, j, num = RTE_DIM(dpaa_xstats_strings); uint64_t values[sizeof(struct dpaa_if_stats) / 8]; + unsigned int bmi_count = sizeof(struct dpaa_if_rx_bmi_stats) / 4; if (n < num) return num; @@ -789,10 +812,16 @@ dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, fman_if_stats_get_all(dev->process_private, values, sizeof(struct dpaa_if_stats) / 8); - for (i = 0; i < num; i++) { + for (i = 0; i < num - (bmi_count - 1); i++) { xstats[i].id = i; xstats[i].value = values[dpaa_xstats_strings[i].offset / 8]; } + fman_if_bmi_stats_get_all(dev->process_private, values); + for (j = 0; i < num; i++, j++) { + xstats[i].id = i; + xstats[i].value = values[j]; + } + return i; } @@ -819,8 +848,9 @@ static int dpaa_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, uint64_t *values, unsigned int n) { - unsigned int i, stat_cnt = RTE_DIM(dpaa_xstats_strings); + unsigned int i, j, stat_cnt = RTE_DIM(dpaa_xstats_strings); uint64_t values_copy[sizeof(struct dpaa_if_stats) / 8]; + unsigned int bmi_count = sizeof(struct dpaa_if_rx_bmi_stats) / 4; if (!ids) { if (n < stat_cnt) @@ -832,10 +862,14 @@ dpaa_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, fman_if_stats_get_all(dev->process_private, values_copy, sizeof(struct dpaa_if_stats) / 8); - for (i = 0; i < stat_cnt; i++) + for (i = 0; i < stat_cnt - (bmi_count - 1); i++) values[i] = values_copy[dpaa_xstats_strings[i].offset / 8]; + fman_if_bmi_stats_get_all(dev->process_private, values); + for (j = 0; i < stat_cnt; i++, j++) + values[i] = values_copy[j]; + return stat_cnt; } diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index 0006bd33d4..1278623e7b 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -212,6 +212,18 @@ dpaa_rx_cb_atomic(void *event, const struct qm_dqrr_entry *dqrr, void **bufs); +struct dpaa_if_rx_bmi_stats { + uint32_t fmbm_rstc; /**< Rx Statistics Counters*/ + uint32_t fmbm_rfrc; /**< Rx Frame Counter*/ + uint32_t fmbm_rfbc; /**< Rx Bad Frames Counter*/ + uint32_t fmbm_rlfc; /**< Rx Large Frames Counter*/ + uint32_t fmbm_rffc; /**< Rx Filter Frames Counter*/ + uint32_t fmbm_rfdc; /**< Rx Frame Discard Counter*/ + uint32_t fmbm_rfldec; /**< Rx Frames List DMA Error Counter*/ + uint32_t fmbm_rodc; /**< Rx Out of Buffers Discard nntr*/ + uint32_t fmbm_rbdc; /**< Rx Buffers Deallocate Counter*/ +}; + /* PMD related logs */ extern int dpaa_logtype_pmd; #define RTE_LOGTYPE_DPAA_PMD dpaa_logtype_pmd -- 2.25.1