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 33E3D45B40; Tue, 15 Oct 2024 09:16:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0909740B92; Tue, 15 Oct 2024 09:15:12 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011048.outbound.protection.outlook.com [52.101.70.48]) by mails.dpdk.org (Postfix) with ESMTP id CC7EE40A71 for ; Tue, 15 Oct 2024 09:14:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C8dDV/ksviRlf5VwoCHLn1jQVU5x64HQNOQ2C419uj/M46VGBXD4FCph0WFby2wk/xYMcruwwFU+NT9bX95WY2A4l+eV9cECumG7UaomfG2UdKQBtqhE9ztR8NHIujq1I9HP49AAVPx0gE/YS9lvFTHb2PUDIwEQPzZFERzrPqXApyrQS7YH9hmaG7Lx1BVZo3G2h7ummb77VbTd0cTugr3meQyFCFxmK3aW2MXDYXpOZBrKgUbNHtd+47mZumgC2B8oz4SwFP5dcj0+B/SELssPpgtR+DTVxQjocFHfa/vaKe3dX1VnfP++yhZiRhd22neObh0Y1iJUnnoi9WAUyg== 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=kYUnIptk7ufaLDv7kYw6b0I91NXpvxTDmIE/y5TOiJxtA6KesyKnuDp0WtmlDK+O9nGAFNpuWwhi0CgOiVBDUp96sUWCA5YyGt5Umvddj6sxAXAOwj+5BbU/Bm1IKIpwJ60PR7W4sxLnQXg6mQ918HU/9k0x9u294hyQZM1M632QFCW9aUVZW+aVkHjVux14w5gOGNdCJ0aPi+U/AyAbGRVAHhj6fqaYbh90u+ZYkH657Kl1m/Bj9Hi03A+ppSDkpugXDu0Qvd8lXvx37ijwSt1K2ji+GDJ3hko7uuHoZ16vi/0gSlDbHZ0TaKUqEgsbEWhofm+Yd0uOmzd5t+EAcg== 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=RuKb2wc+iJ4+D7sYqERmn6dk/Kro9ufd5QhULpwvmN7NwONXltao3KGI5mWE9b/5TcvhTLtVO3doXrE2PxEOsXJdTvppeKFQ/gSGpvdXgwTWrKfx6mSjOEZI7NwsTm1bQEmC8w+H2AqgIbwYI4V6L/2AaeMCA7UIrDlWAOOBC85PPQxozCI8pJ5dXeU6TD4zjYOJJDEkDZXiZbkK425d9reiCbHT96EVTgoFA8hp+T+rtQzYBYl05bJIGLGepoYtnP50LWvRBEvjcan76Py9BybcXhYEhVeV0gkNgzvKx7oll1fNLrqP3JtxxUQf3ITYw8lxSiv3Miu25ZQQ0sf48w== 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 AM8PR04MB7218.eurprd04.prod.outlook.com (2603:10a6:20b:1d9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Tue, 15 Oct 2024 07:14:49 +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.8048.020; Tue, 15 Oct 2024 07:14:49 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Subject: [v7 15/15] bus/dpaa: add port bmi stats Date: Tue, 15 Oct 2024 12:44:03 +0530 Message-Id: <20241015071403.1940833-16-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241015071403.1940833-1-g.singh@nxp.com> References: <20241014093639.553467-1-g.singh@nxp.com> <20241015071403.1940833-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0058.apcprd02.prod.outlook.com (2603:1096:4:54::22) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|AM8PR04MB7218:EE_ X-MS-Office365-Filtering-Correlation-Id: 833c42c3-254f-478c-1016-08dcece90e67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?dmCY0v/7LjiQDYMYMP8ruSKvLv5ta4FVn1H9AV6x9KHmdpGHKA//yw9lPUKb?= =?us-ascii?Q?q0fZy0K81WNQhbG5X01UEOh5cWA6Y4/LKGzzBcYjPD1utDW5wJ7FOkIhV8ZZ?= =?us-ascii?Q?HhtbzsH6rVSzuGa3aZudKZe8qDxthK5mh8WbcOarWviqs98prpud+/MkpQtC?= =?us-ascii?Q?8zSBod2ewRUr9MeVSitaQTI76KaYzsNRG49VY7VkTumYkUFKNQR9b4mHdMU0?= =?us-ascii?Q?yayE6Zp2TsmbbjT0LMSlNGj5QkLoWnp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eY8GwpZkg474Ny4eq81Icc1e6YcHvirJVasNqyaF3NklT6jjhuc+NwV50wC1?= =?us-ascii?Q?8PDbeAKwiePXkt1PvUD7z2Inxd+9trCF/uVn/n2+a2Fz3+Dq87ks4dqVtIMy?= =?us-ascii?Q?FKbQwsnBFQvli9HUQGtZWPWJjtymURG7DvxDUVBEe7yNZrkFrcJELYiAjNAh?= =?us-ascii?Q?epbccs/S4++l7Z+y55/TMs0jwXajVzx1bLosLTjgSRMEmQ=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)(1800799024)(52116014)(376014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xttFZ04rudS6B2WtJRD/G44paQLfMxOxyzWeordF+mfZGid3bw6D1RcFLG+m?= =?us-ascii?Q?TdIAXLI80getROuzd5nFJ7h6xkgJYXzIpdwjBE6j04a67rbCuR50NFr7PZaO?= =?us-ascii?Q?u8+oEbo5Ud669/1w0OGvurM9kZDSImySHg7o1FH4MFASosDG+oN1WwYX0N7S?= =?us-ascii?Q?ljcD0Mhp3zJA5az/2AwiF8HK2peU5Q7rEq6YXZIxniN+waXzFIaYhosbRQzX?= =?us-ascii?Q?lacY/Es6O6DGZRB/7O4ElPqDg1VpUwpdzLviBQDPurueqfke8Avmf17w8BW9?= =?us-ascii?Q?baVOnJKcRmYp5cHZTjf4FreLXVZ3Ec4aU1kYYQnXUDCNEs2sS+tHmbThMpmo?= =?us-ascii?Q?urnlLfPb3M5CbtwsvH47jryrSbVqFgh6hUK0jRTnHDjHqehglAb2HYWyHbxC?= =?us-ascii?Q?gBU6hlm+OV8sjcgz1UGJ0wap8GBaFcTMrsG12g3SaZHuP2BOiIH6cJLRdw3t?= =?us-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JA8nSBRpPKb?= =?us-ascii?Q?WYk17Ui5hln05yLcK6T1tHOVt0/Df3nq0s60GCWxO3qvQxQlbwzNpxzLhAGy?= =?us-ascii?Q?DTl4Gq7E4qLrM0GTN9AeQ44KPBQ5/wUqeU6gi15btDFeFo+iSmafZWR7mpTU?= =?us-ascii?Q?py2+/1CxyR6xvZNy17g2+m8k/4iyCQ2CwkKmABmiiCa1a/2phONndzbR/ZHt?= =?us-ascii?Q?73qDONbqzgzd+Zy8nmA=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 833c42c3-254f-478c-1016-08dcece90e67 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 07:14:49.5071 (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: 73ZXJFW87U+GQRlyKqCL5xOEdeyLZs7HHFdCOKtk/SirST6c3o8r0FThKHp9dVTO X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7218 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