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 A165B4564F; Fri, 19 Jul 2024 12:05:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DB0642FAF; Fri, 19 Jul 2024 12:02:50 +0200 (CEST) Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010063.outbound.protection.outlook.com [52.101.69.63]) by mails.dpdk.org (Postfix) with ESMTP id 7F33942F7F for ; Fri, 19 Jul 2024 12:02:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hX1+dUnd2hsXvIDQJ4OHRvjYL9ziez7w2lvWUV71KxBpmyMup10F+ULXVRzVMTs9UXxVboVp2d32KDzTyIes2dlmi//r/FxTOH3ghx8uvL6+Yofd0Oe5xtWAH8Lv155xm9Hg9ebEFBWldCQ0r4/7H/nEPXiMK/fEp1HVmS8Ez0fGYX9TbLGFmvebV5RQrV64JlO/J/g+/LDsuiSm59SiWhaXvk77W2UmUl42whYDsCKGMttwivzFDY2L0Ei7BUQjgr1J1R7k7+Ha06fzu5gGL8QYkdIAPjS0YFlH6sDUQFfh0YG+mWUxipkjWGDPsmqHlIq8Op2VlZTm78jeodZE8A== 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=WYxQJs87L1zPHcz+2yihUOYA9X0eKLUNm7IAyyCozk4=; b=idHU+6ltPpKHn+33sQ6Jb9jfqa2FnvB+iWJ0D1Jq7Emd8PC55H0EHkNapCUIQWgRn2HESV1yPBbRgsJ1oUl3ffNXdvyQ8+PDwHDuiqLOLaj1cs9AXyqqPnGuekpWWPETxbEwsgfEXW2x2GT3rq5jJLGVJ3ardu59hspHpqF5g30dYyfry7cb7q0BU4mvLlRLOGeAJefZsYsokSuFDuIuZ4MQD8WbnR1WcaYjB0+/DCxdScquOUVY57j+QF5nFZmynOqvdC3yJ8HXI7DXVrpDNmtIB3QMc9xzWRr4qOC5bCmyCTSOoAXncGjuGJ6Ax9zHsvFkyQAdIKPw8MQYZZvmvg== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WYxQJs87L1zPHcz+2yihUOYA9X0eKLUNm7IAyyCozk4=; b=o6Q3PJGDzN7GnyOeXkQPNEIHll1UcRhDJUcarE2yreltW7RLFa+qwMQro2GtNK5ZrH+9Xc65v27ieq02gGVuvloKgW+fUaEnWsQq2ZlyKrcdQl+Emlssw/Yjvt/9GqCo41u8cKqE8Vz04xSILaoJEf5mu62OzuJS9o38B5bFh/w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) by AM0PR04MB7108.eurprd04.prod.outlook.com (2603:10a6:208:19e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Fri, 19 Jul 2024 10:02:34 +0000 Received: from PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f]) by PAXPR04MB8205.eurprd04.prod.outlook.com ([fe80::7633:884d:5973:174f%6]) with mapi id 15.20.7784.016; Fri, 19 Jul 2024 10:02:34 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Subject: [PATCH 30/30] bus/dpaa: add port bmi stats Date: Fri, 19 Jul 2024 15:31:26 +0530 Message-Id: <20240719100126.1150373-30-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240719100126.1150373-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0184.apcprd01.prod.exchangelabs.com (2603:1096:4:189::9) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8205:EE_|AM0PR04MB7108:EE_ X-MS-Office365-Filtering-Correlation-Id: aa6fb4df-6be2-43a3-3e20-08dca7d9e8da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?lBNV8uiIbMO2YVVJDmWbJF6BYyIcEfmAo/d8KzMBfe0ibIEVDfDcmfjouftZ?= =?us-ascii?Q?48SaXMLdM88waS3n9HqhhTK/Xf2yijSzg+KbPB1dKHBoeeIGtyiab33sVohL?= =?us-ascii?Q?GpT4PV2iZUHh6ilaElyIvwzbZs2ojBjODVHZbcdNyCdpIt0JGviQDZrHRepm?= =?us-ascii?Q?3116zk55nikIxIt4vNRvDAiNbA7xLQkxdf2lETMJpVTL1mDE9HPKFPzdSovS?= =?us-ascii?Q?nJB20Vae2aAqSh0WSqmyXVWYgwzHbfziJzPi99yALB/ZZa2hQdULaRRAKVDa?= =?us-ascii?Q?WFowbkqq543xLOwkus4OK2KRnvvfg73q4JvG6aj10YjjlWeAMWrXjgpbIMQ0?= =?us-ascii?Q?dQ11i1IzOYbRs9SbP8CJhxaSPbRvy3dJcDKGvtycpqCKYu7jx9oKgHAgILuS?= =?us-ascii?Q?0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nyCYcqYGYsCHLAFiZ?= =?us-ascii?Q?OVo/fUX0YVMq9ocEGuMRP7UOixgniLrVKhAy6AO33hT9ili0D8lP3+bz2auJ?= =?us-ascii?Q?izS3ogakw1fwIAm5v5tQGNDiT1gEkYnR+uxPHrb+CVKZ6QJxiQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8205.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?L7p8p2Q7wXHznGUfBQGEQkEd2n63TDetzb5Zq5wn9HDMh5PKaKcuEfBEmz3q?= =?us-ascii?Q?Sdp4rDqOjp6+Kh+7SkkWyPrt287oT/LRBnnGp4n3RipDFxsoNOVYkqZvr8jd?= =?us-ascii?Q?jQb33ZYE8AGb0erycofQ0gvwUG4UzLnphJQ6LnELUU3vGDdCuaoDJfsRcz4T?= =?us-ascii?Q?2v+H5mfb7TAcn5EVWbLCa8WdWQ7fWkZVvqB8Ryx5OLQCepC+yeHUYfAtP56s?= =?us-ascii?Q?k7LN48zdtCMQQ/jKM4CywJRrGtpnEXFkbJiPlFdUhLoKGs5I/dQ/OIPY83wW?= =?us-ascii?Q?wOAuZAmDk4tHGv1ZnFy5ci8nBOpKD0avwwfmqbnoZnwASTC5eS2mVHaXw8IR?= =?us-ascii?Q?oXktGW5+AJdIpsAVQLZNHaPeRRC+hWb6K51K6uY6cRKox/yA4tGrCqay9o+f?= =?us-ascii?Q?ZjJJiLKLd/qgIs/rKsVCpe+iJdXOW7FU3M7ge7ST9bfqlzVy5mvMv6WbRU70?= =?us-ascii?Q?cjIWfxxwy1/9FUzGoVjGl1gPdQzk5wIvIIA4JKokQ9AHH2hJec5EKls9HZmJ?= =?us-ascii?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fkoFyDyDg6/3SIqDS2?= =?us-ascii?Q?nG43hjww//gEUv1/Swcj4X740lOVe+MLxSjRTbTaGNX04bmHLj/r3nJ0qgOC?= =?us-ascii?Q?hb0UAxwvvH31zKziIGx0rmmEF6qmrQmJjylY/rkTqCj1aOp4qc3ov+pJP3+B?= =?us-ascii?Q?SglTWAXywzNg7QMCzGVSM4mgKhvOh6jQzVrj+4vz?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa6fb4df-6be2-43a3-3e20-08dca7d9e8da X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2024 10:02:34.2176 (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: AN9oWoEIB11qtgyh5yLetP0K4Knc5ObuQaDIVKxIimKLgjz65+GfaYtkjgjZIo3e X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7108 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 extented 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 3a6dd555a7..60681068ea 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 060b8c678f..4d9a4c7e6d 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 b6c61b8b6b..261a5a3ca7 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