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 D090745681; Mon, 22 Jul 2024 14:02:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB8DC40A4B; Mon, 22 Jul 2024 14:00:07 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013071.outbound.protection.outlook.com [52.101.67.71]) by mails.dpdk.org (Postfix) with ESMTP id 2A710402D9 for ; Mon, 22 Jul 2024 14:00:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OXgkfCE1gOavDRNfFjS5A+CZmJ6Pe72BKZuQLZinz7qT4xkQ9WnpvEa0mQ45BJ/H0ShTZLSTMm/7UEsyht9yhdl0l/PA5hVbHuKZQda1M5G/IcDJXbfLZcdTUkJAfQKEB8T3Jo4aeCHKxvCvPtibL2rxqI1SOZ2Qh2dKMHS9oB+71bOOZ7budGtZozITbGC7mqEpeHDy2A26IGwXF+LygVNgLadvOCbM343mzueSmxyPvXMnYkGnbOg3FUajMiy64CmoJUhShEgUEaHfonIU/M6EtpK9+h2AcFK+a/zpEb0UmAQcBiJcGAs0RYCwmXUNte0S4b4KJ8t6s8Vu5wHWbg== 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=QdGNxX/ruKA41O16rVCFtuII3G3z7JWCmG/SzfQMcdo=; b=rRd/gI+hmQ2+PuK45LqbOT+XKyJMn+U+kphAAtxYYRzl6WCFCAtaHiLTG0mG3gmJMU7O1K0jWZDcqCCqdj3jaSebm0XwB2DeNJmjTpeMEmnnRxfE3bmwyq1aTFM8gcB8OSxiAQloMN0juAcWlz9NIY4Zznw9UFBt364lIOX/9qXGCRQXqRI9FAg08IPVM0WyaPVtnf+o6YZUzdgZZ1NFa2UFRkvLlPj3EsHBmWvtoadp0cNVX16+PI2jdNLbfmHxdLgY7sYh4KZfMLe/GyiZGF/s2mdoN+OFjo7eYYTA28oDQFkHZoDa+mD6lcUESlH03e0w9MfZ7nEMwmail2S3+Q== 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=QdGNxX/ruKA41O16rVCFtuII3G3z7JWCmG/SzfQMcdo=; b=clvpQ//E9Rw5cjxxfiwvn3nlrqEtzJftPeVXP61KBwWVlBZ4iOQW6C7FIGUKOkG91TYUQX4SdFdYugCuEyBdoZcIjUNbR+72BtEIU2apH7L1xeANAJZc7anMmChargJlHeJlwLOcC5o3x+k05LwQHwCQBSzyEjxWVxJN/JrwlRk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) by DUZPR04MB9917.eurprd04.prod.outlook.com (2603:10a6:10:4d8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.20; Mon, 22 Jul 2024 11:59:58 +0000 Received: from AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325]) by AS8SPR01MB0024.eurprd04.prod.outlook.com ([fe80::c634:479e:8f8a:a325%7]) with mapi id 15.20.7784.017; Mon, 22 Jul 2024 11:59:58 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Subject: [v2 30/30] bus/dpaa: add port bmi stats Date: Mon, 22 Jul 2024 17:28:43 +0530 Message-Id: <20240722115843.1830105-31-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240722115843.1830105-1-g.singh@nxp.com> References: <20240719100126.1150373-1-g.singh@nxp.com> <20240722115843.1830105-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:195::21) To AS8SPR01MB0024.eurprd04.prod.outlook.com (2603:10a6:20b:3d0::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8SPR01MB0024:EE_|DUZPR04MB9917:EE_ X-MS-Office365-Filtering-Correlation-Id: fc44bc5c-7e18-499b-efbe-08dcaa45ce38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?CpC9IeNe5kUUj2U2UYqZBd8MYnLqcP81UTUmNikT1h19PeY10Qcsn08ZrYpq?= =?us-ascii?Q?uGAd2+CKxb24XthWCVzMAjsD8crFIoFXOnNR73pTQPM0MFCjTzObWe1XJpMg?= =?us-ascii?Q?7Sg6Bdfn6AkNdZcY3BS1GL80TnRpgEwI64Dwm7G045dGB626a1mJK2uWD4Eu?= =?us-ascii?Q?A8U1uCX1FQ64jLpX0ka3oPmkTxgMzazij2tsFUe934duv1W/OGgmqIxpb/gA?= =?us-ascii?Q?wS4Y0vmtnKxCYroxqFgOMmy1U5cuCAMhatKTLj9mu1xN8hRt1wOCslBk+y8j?= =?us-ascii?Q?GvwKCWKCM3B9iMua2Mp81YNGs1YPOH6JRfja5J8HXxbETPZZprqcy8C4eTgJ?= =?us-ascii?Q?fQRQSRVeB3PMrhgbht00tADqyGm8jVAXR0tRSaSzXBXhwAMqcPXA9gmnut+A?= =?us-ascii?Q?Y2NUuxeAxCF79LfbxRdieVZQ9OF1vza8W/+4yMHoWgcHroP/YvnnWWYo7/cu?= =?us-ascii?Q?41awdb/XnZDCr0RtWIR7+wXkBtLHyA5cUpOpVFrX6LB6MiLFBnnM5hvn1bTj?= =?us-ascii?Q?WFbHyWxFvhxEgp796I90mk2z7RIV1+LZMtzM6FSyZEmzx0bzN61/CDZvvKuv?= =?us-ascii?Q?0L7m7PfUSuLOGL2+L9HEMRhoECk4WG8A3PJNES3VZDySVtY3EkSDgBRCkRxz?= =?us-ascii?Q?20VKfYnXInBegt7YvG2JKh8oNnLd0RA1glMhbTvS1o1z+DMuekum2PxAGf/S?= =?us-ascii?Q?2br37CvVDfVSraBgmWFUS/hpgxdjMDozGFg8IulM9grzAylaFuyU2KiByED3?= =?us-ascii?Q?QBcnh1cV6psyPatDMvdyaxTC00iZ7YLNEJikeWjkBTb25+ClSwcqyGsQvImB?= =?us-ascii?Q?N12FtnJunup3486x/GKoaxkDo0sn75obPfcU1r2pz0ykvE+3wVb7qmP8I2o7?= =?us-ascii?Q?7ypqTtuFpstpKqrEYvxGD8uwJw1wv6c34yRjhTNjiq841mTJP/hyw2htWlk0?= =?us-ascii?Q?12z1AWMpILZGfCq8AA2ge+F1pidzjd+I2jIW/I7udVhT6hULR24IrZFEYEkI?= =?us-ascii?Q?rbzDtb876VN2Tj2HzOqFvw/MfR/1MEutHiYEO7RtmRsk6GegXosBC6uiH3cM?= =?us-ascii?Q?1tzaQX8Y/mF8kLVAlyl9pr+Puv0qxULUnZ8wi1lwDup+UhgBhTQEDhZf1H0t?= =?us-ascii?Q?s1ce0J2XdwHzEG04dQwJgEWFaarrYkJuutq+oMujwjmAIT0gK5GWx9ksUY68?= =?us-ascii?Q?gMBc6FwE1RVEzD2n/lceV6dUv3tG2WqMfNdGFXC8B0LHC7k0fPJCyb2C62rI?= =?us-ascii?Q?3hMTstacL1Q8nfbzGZk3PE9pQaxEyr5nLJ+vMY6pMv5MISI+DYo7vnVbIFp/?= =?us-ascii?Q?csAqcwDkSac4ZtEzFmi1XDM6vO5zDnrADspPdM8U4fZrZwtf1WfdQx8Uaj9g?= =?us-ascii?Q?zZzwMTKmAIEqSgTUb1V42izPvi5P1Nw7mFl0p9ej5SbuIn5HVg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8SPR01MB0024.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?eFWyq6Y2Xzj00NV3+M7d/4u4YPOZzef6sMT2OKMoeY3tGst2CqXT/ZTxAQmn?= =?us-ascii?Q?4twfu5QmUj8ZRNRfitvAZQUVHTk3sY1S+BuHW/Dq0ssZFTEPuOlueNZ+NDGI?= =?us-ascii?Q?luTOLcoCn/1W7E2Ep0tMLEk26COtV1Y/aeRIsvgXnROgecdJ6d50ERBI3V7s?= =?us-ascii?Q?6dbvlo0+0whb05GaUBSRfGGKUZBNH2OFFuQMCyzVSbQEIRoldAgIajIXpW9y?= =?us-ascii?Q?OlRA0lBP7Z1+De0sG4Vfugvp65qMrsemzNhs0Ha3UvL9HEUIqVqP8LeZhu2Y?= =?us-ascii?Q?rw9IvUw718WTlfogVyiAFr5HOHjb/jNs8F9w5sPLpeBChFt+t9TG8QNs8aU5?= =?us-ascii?Q?LaAGDf7wwBosQdKZxGK2bTAdGvDfLJn/E/fnJWVmqtATiDdupN994008Ekl0?= =?us-ascii?Q?ZH6BTcSOfd/qGOvIjI+QdVjIxET2zU/9kN8tWdrYk81SHVwrxsy3oC7MB5FM?= =?us-ascii?Q?BchztN9inWTY4fhOJceIFDDx8VE2vLyyWBZ8uN4xFiPb5XkL8L0fbTlArlEn?= =?us-ascii?Q?qlQjbFpWefcjS6gi72zAsiuFxoYzd8z7zcVJ/97qIcuTGWlKPJglstXy4cl8?= =?us-ascii?Q?ZSoV6xd4g+F1V5WEmnlHTv4vpFO9v4/ArOX3VRuRPpZDzsw1UZeL/UselIJX?= =?us-ascii?Q?aywUwLIwbtZFyVAVOXKtmVOGbHaOCRYW3bP8S7oiExBquxPQO75SARdzFKwJ?= =?us-ascii?Q?ix1QdLihw/oiVjmaBbGGDSkbw4QczMIrt4K8ziaeuyh+E9c542tfthzhqgGE?= =?us-ascii?Q?MLxpLWl4zZmz55GQvq9zCxKA3ffxgE01Ct/sqqXr5yZdhSWvh5ZjpA7KCTUp?= =?us-ascii?Q?blXNC7iI16lQ6DSSwo92dgLtZTBV9qWhZ9s2y6MHIC2GtOlZju5yV6eHA4JP?= =?us-ascii?Q?ThDiylH5kIBfyitI8Nv6GiOov8Q1RhvG+yR1fDX8jFgeNCmHuM1bcJOq1aQn?= =?us-ascii?Q?gG6k06C3Efx14Te3Z50bnvN41b7he5PZo+tsS1UxYyLHKXIpzpnga8fjbeNR?= =?us-ascii?Q?yPYnKud0PJztdkch0ZfgRvg3QJZQJopippf6c5yMtYGXRZ4PiQd6vMAyTVQM?= =?us-ascii?Q?Xeq60+XXYBptOi/MDcacdVmmzFTwvS3ODI7RXTDcQEbebt/sWs/qNbK+IKeo?= =?us-ascii?Q?XhSvVbNnheafecUqDW2+9Bl7LWRBrxFGRX+/sZ6Evj2fQnB//JR0KzByHrKj?= =?us-ascii?Q?V27r/RMEaGGeCS7ySTg8q6AeufVOxSYb/iVGR3wQv7clRLNhP1cb+Donp/EG?= =?us-ascii?Q?iLjDVr8hQ5kDf5CIoWOmUvk5dRM9ZNCYRxJkxiiCohB7R/DsG5SbdmRHznyA?= =?us-ascii?Q?qoTwm8wKfF7YabA0QWLhDBmZDr1yUBNdsojTfME8pOGYpceRL241LC8mYk9Y?= =?us-ascii?Q?+aVuxe6gMJkH2QSw2lQzsVBylC9pQRtIi7GdKiZdEB/FX38c+SKukJWAhh9x?= =?us-ascii?Q?1ldCl6noLnZtpKGNL6ANNebSjERCwQwWdLZRDPKsutnNpHFP4pQ9Zq2FLPLt?= =?us-ascii?Q?awB7BEaxkeAcb7Y/biTfd06cfOfquUfBwbF4D73OzdC5A9DqM3KHy87ND6jt?= =?us-ascii?Q?4WPJdLRVJesFiC+GvH0CoASgK3IQSz9zSF6WxrLz?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc44bc5c-7e18-499b-efbe-08dcaa45ce38 X-MS-Exchange-CrossTenant-AuthSource: AS8SPR01MB0024.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2024 11:59:57.4477 (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: M/p5EAVqsqLQTQRIFneTiEl0tEx7vDFJIT0vKmEcyUl7KtsyRwUbYwVydi1h2qPr X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9917 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 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