From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0070.outbound.protection.outlook.com [104.47.34.70]) by dpdk.org (Postfix) with ESMTP id D3CA21B62E for ; Tue, 30 Jan 2018 16:24:49 +0100 (CET) Received: from CY1PR03CA0031.namprd03.prod.outlook.com (10.174.128.41) by BLUPR03MB1411.namprd03.prod.outlook.com (10.163.81.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Tue, 30 Jan 2018 15:24:48 +0000 Received: from BN1AFFO11FD006.protection.gbl (2a01:111:f400:7c10::139) by CY1PR03CA0031.outlook.office365.com (2603:10b6:600::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.14 via Frontend Transport; Tue, 30 Jan 2018 15:24:48 +0000 Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD006.mail.protection.outlook.com (10.58.52.66) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.444.13 via Frontend Transport; Tue, 30 Jan 2018 15:24:46 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0UEh7sh023996; Tue, 30 Jan 2018 07:43:23 -0700 From: Shreyansh Jain To: CC: , , , , Shreyansh Jain Date: Tue, 30 Jan 2018 20:27:03 +0530 Message-ID: <20180130145710.24757-5-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180130145710.24757-1-shreyansh.jain@nxp.com> References: <20180123135910.10755-1-shreyansh.jain@nxp.com> <20180130145710.24757-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131617994879607697; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39380400002)(396003)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(6346003)(76176011)(68736007)(81156014)(97736004)(81166006)(8936002)(77096007)(59450400001)(86362001)(26005)(51416003)(106466001)(336011)(8676002)(48376002)(50466002)(105606002)(2906002)(316002)(305945005)(54906003)(53936002)(1076002)(47776003)(50226002)(2351001)(6862004)(4326008)(356003)(16586007)(498600001)(36756003)(104016004)(6666003)(2950100002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB1411; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD006; 1:g0+cXODyx7nBkwoEWVtuMFOwVclmHhKM9Xm8XX43R6XYvTZOJw8Sc9NP9gz0Ze9bbSddSS/h7ARFkaYzE48lR/aoP9kKwfnPVAx1fcwAPRmH40lhOb+amAC1O2MV14EO MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 497d14a7-429b-4804-2391-08d567f59950 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BLUPR03MB1411; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1411; 3:+pjWQQhhNbppL0efxK3y0iMqnJcp42e7xZa9RvRkCGXIkEcYVTRYkjWqD/M905p/6jlevtfRUsRFHboer3mlGXfT69cchRIpmQ4iIDQCG8Orr4KjehtmOvtfnEjrLY8Dczs2kT/JuDbMQHJ5+w235jWc+LAPQ7jwF2BElRQbzIydthvSFJbwRQKsA0Fv4C2N+Q2Svh5dJ5Tza7ANWx++aUAi2UBOKK4LCCKveuoL2tGsgcUIexXrNeQWKHFlp7c0C7+S3GrMgweharxj4jgJ9MwcGcUF6H7a9DS/OuCBKFp4kWZO4bKSPxW/Z6JOXCxHHuuBuOV+YaEl04j/sD50E6qI8odPA2DWFo1lYuKzprU=; 25:yWH8xaAYIstvH53VPRX+0EliDevrRxKFBk0oBy02x4U2ow38qmSmV/0nNJo1RzdtpSYGFQUqZguVbQmksouLOYI0tWkdPKzulcPxh8H5H3x6K55a1aaVsVO9jLYntglGaLnigEbc/clVo9A0ghhWIbBlcckOgRxxHoq8Rg84BGlTw1p90BGiR53V4ZVIWFa7pw2maG4NgIvpYsbDtrDRb+ZmYQ47lCF2VBY9xMXePDLuLePgnvltvILZMuhhsUf3ryJFHb4+jnSkKedApyGFu+lSLWEF7WR1gpN6luLx1xZX76+f7GAfRKgOCIvMyBg0V79jiNc6lnG34bjVGGX+eg== X-MS-TrafficTypeDiagnostic: BLUPR03MB1411: X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1411; 31:Vq9cm5hDrsh7btn3FUTEBgF6ZvSiHzhjtku/N+f76SIFk+KCsT3xC7Rcy1jzzYpuuLrOVVevKq1N3CV2NKdQ7ogrJJ1j0ylkrfSXV4gaimhTyy3qmpVSHuZShJOiqRnczq7CtjCMUrvzZ7Iduz1Tvy7tmoIkPK6jadAbHUO4yhUJ+VlrMTyjR8VIOR5K/afEeR9Fbcm8JUiSo8s7I79vH2pYNMDVVV4j+DYsD3x4014=; 4:hWmPNQl6crj6MEQ36BrYpOeD1V1A1VpTYgtz8Er/Px1E1s7eL9Y/F4RuXAcZGMzWHDMMGMIrJRpPbBehz2gWmNDhgORZ2pLoyRGdSC/GmGxz32NuBC6zP31QnYDPXVfM8GZ41ZCJpzQFJ6qLh5CFjuElhJohNvCJ791ks9ohNY66DxJqECeOANHTXz+Fc2bD1d78Bvi5r8mtO/OXVVZEmZoIdUInKnyFfrtZCkIy2xWASx14QzTmRm0ER18DIyUnljjHRGp2q/MjIgoLt8dGSae62+cD8ReRKHO5C8R1owTZ/LS3BUcjJaTHwqeD3HRT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231101)(944501161)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123563025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(20161123561025)(20161123556025)(201708071742011); SRVR:BLUPR03MB1411; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR03MB1411; X-Forefront-PRVS: 0568F32D91 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB1411; 23:UK+zv8ZC5XinYSbhNKcWk7XbyY25uj+QvN2+vAFsE?= =?us-ascii?Q?XVS6G7ckq8C3MRQiLFj3KUjDmUNlI3j2kILVYNER6ja4qH1PoxdalU7QHxKo?= =?us-ascii?Q?DKpGR9H95YBFHRDtK+LQO9athNFcwwAEFBUZmCtwobS6lOVHBA80d34Sdohv?= =?us-ascii?Q?27wp7ZwtnjycTMDW72re5FZS8rxGNdZcUOUrKHSRZ/pNO9sdVv6sng98Tw+H?= =?us-ascii?Q?hBTvaOzu5L0nJmmf3Ww8eZJS6mEqghcB1rRX0VKO2nl+oBl0njuuHC1lNZD9?= =?us-ascii?Q?I+3ozmBOiutAkOWtVRA7dGSIYBTBit/EEfrSITMlvaKcHbwbCPTTDrD8X7KX?= =?us-ascii?Q?b7ZoRSJniL/kzO02rAiTBuLmP0hELfTLhsaoKcGYFJvv2gS22ZrAHZCjt7cD?= =?us-ascii?Q?ZFVYENJ6CZMT70+VCdBQwDqN6efkxRptNJdz1kVk9vCCozCbDeah4dPJ2BHZ?= =?us-ascii?Q?pD6y6k2hKhogWQNb57NyWepNDUM7tnL7RksE5sE8Fo+kSvwq9d3bTt5eucMt?= =?us-ascii?Q?D1CCr4NBDgIwU1z2rnj9lFngzkMCppp1iSQtFI+Evy4UCCambNMOoVbVHKfo?= =?us-ascii?Q?P4CQVjHVxA+En8aK176WwqXrUc1zaBLUhM4604xvzEyALbDuqIbVo0RicWNa?= =?us-ascii?Q?NjmwPIKC55Il7Kj734o7kjoyYMcNRjJYIxZfhZt1CJgbrTVECialESZbToA/?= =?us-ascii?Q?ShyO8ZFflHNKxdpeSmS2xpxZdtpS0IkJZzWMeNUEJAxierQB8GsoY1lF9qSK?= =?us-ascii?Q?+UeaOTBCr3PoHw5aoA3zpasBrB9Aq5OiAr6ttYln1vKJfpk3drnUksPbF2Ww?= =?us-ascii?Q?MSdAhbSwNm051vEldz9yGYDv1s0Abfks4KEiLS6VaSesYzd1lADnwpDWINBQ?= =?us-ascii?Q?i1DE7i18ayWSoMBLeVyEsS0uqt+aDm/4gDdoYl230r/fmjwl+QwTgi6D8KMi?= =?us-ascii?Q?Mt5t89yPQJAJjgWdaZ67GEbyS5HB01u85yVE9llR433ldhoH/DM9E+MN1wQB?= =?us-ascii?Q?1fY1Ou8LdPDQZYL5c8XH88ymkw6Bg8NG2lhg0xc7yifH9OONlCWLS0S4l+78?= =?us-ascii?Q?HS1E2J4pRTaavjm2I8PRJD745VCUKLdzirp5qN8EzhxPs9pdSuOmrFR5Ziqh?= =?us-ascii?Q?uUek1oFf+w=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1411; 6:gXtH5L4/SXTNUrjlz3ojJPf6OtGBTljcuPTuAAh+cqR0rzyQRlHthCfRxBsJoY+J5LHKU9/bfPKpkiBJ+azUdNTEc4cTiom/Z934UBcyvuj0R7wfktVEv873uw2YCG0+7MReJxmXNsmk6oUIMj/XGrxiriFY3DynFTLOnJkNViFAxwKRmxNNS543GW+K1X6odWbkG4sfNL8zgXCBxQGQh1iMr7F9VnMcf4BFGJG3fo6aRSfTfM5ssOSlmV40uT1IVT/foPDlfh80bPXjO9vcaPFFX4sBf/j+99EE9qIU8/P2HB9hEHDNTtfPpOAUR3MepdDxRtpkPNj8SoQ+78cAKgHi0e0Q/n5KmvjvWJTQPIw=; 5:tXz1HXYZd+HR0yeWQKCcyevFOfUPjhPkvHxPLpq/3s174mPdPAxB4WPSUTFQvuEf/C9Qj/4CCiNvLXRjhW58aSsb2tefoJSGdAaaQ0I1hCZsK95Yzuhb+GB0lbhxlfbgAMqY/2F19FdObjtYFozizCc9qwxehjz4jrYeDTteljw=; 24:tKgrZISJpVfTjGoejlsk4vzAOAYPXzqdDJSnOQLCjMfKk+9QIjZxKK3vU89/YxreQ3mkxza3y+N8r8x6dS2or4osljSgR+I0SM8aI5CK0Kc=; 7:72ZFb0ZVLd6jHexaBi0PFT9fOCl9Jgp8DhoUMjYtnVs20BWcVJXfoSBC1Km9p3tZ24nWXwAj2qUKdRpVO5Q0xIIEVXWkZ7upmS0ZGlJC+9HwPY8Zu8Zg7rxzWconff58x55JVrl7IYubakqENCp88LlPlyIRbhQt2Z7u02h571YmOuGNYMrva6vMK8wSr7rAwXQWefn5uxqF6DXVO6upEf66nclqe6/sAAWFAdnkO6OzUmvjq7nlfeO7i4nJAZY6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2018 15:24:46.8063 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 497d14a7-429b-4804-2391-08d567f59950 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1411 Subject: [dpdk-dev] [PATCH v3 04/11] rawdev: support for extended stats X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jan 2018 15:24:51 -0000 Generic rawdev library cannot define a pre-defined set of stats for devices which are yet to be defined. This patch introduces the xstats support for rawdev so that any implementation can create its own statistics. Signed-off-by: Shreyansh Jain --- lib/librte_rawdev/rte_rawdev.c | 75 ++++++++++++++++++++++ lib/librte_rawdev/rte_rawdev.h | 105 +++++++++++++++++++++++++++++++ lib/librte_rawdev/rte_rawdev_pmd.h | 72 +++++++++++++++++++++ lib/librte_rawdev/rte_rawdev_version.map | 4 ++ 4 files changed, 256 insertions(+) diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c index a6d937c34..d6c284554 100644 --- a/lib/librte_rawdev/rte_rawdev.c +++ b/lib/librte_rawdev/rte_rawdev.c @@ -245,6 +245,81 @@ rte_rawdev_dump(uint16_t dev_id, FILE *f) return (*dev->dev_ops->dump)(dev, f); } +static int +xstats_get_count(uint16_t dev_id) +{ + struct rte_rawdev *dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP); + return (*dev->dev_ops->xstats_get_names)(dev, NULL, 0); +} + +int __rte_experimental +rte_rawdev_xstats_names_get(uint16_t dev_id, + struct rte_rawdev_xstats_name *xstats_names, + unsigned int size) +{ + const struct rte_rawdev *dev; + int cnt_expected_entries; + + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV); + + cnt_expected_entries = xstats_get_count(dev_id); + + if (xstats_names == NULL || cnt_expected_entries < 0 || + (int)size < cnt_expected_entries || size <= 0) + return cnt_expected_entries; + + dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_names, -ENOTSUP); + return (*dev->dev_ops->xstats_get_names)(dev, xstats_names, size); +} + +/* retrieve rawdev extended statistics */ +int __rte_experimental +rte_rawdev_xstats_get(uint16_t dev_id, + const unsigned int ids[], + uint64_t values[], + unsigned int n) +{ + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV); + const struct rte_rawdev *dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get, -ENOTSUP); + return (*dev->dev_ops->xstats_get)(dev, ids, values, n); +} + +uint64_t __rte_experimental +rte_rawdev_xstats_by_name_get(uint16_t dev_id, + const char *name, + unsigned int *id) +{ + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, 0); + const struct rte_rawdev *dev = &rte_rawdevs[dev_id]; + unsigned int temp = -1; + + if (id != NULL) + *id = (unsigned int)-1; + else + id = &temp; /* driver never gets a NULL value */ + + /* implemented by driver */ + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_get_by_name, -ENOTSUP); + return (*dev->dev_ops->xstats_get_by_name)(dev, name, id); +} + +int __rte_experimental +rte_rawdev_xstats_reset(uint16_t dev_id, + const uint32_t ids[], uint32_t nb_ids) +{ + RTE_RAWDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + struct rte_rawdev *dev = &rte_rawdevs[dev_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->xstats_reset, -ENOTSUP); + return (*dev->dev_ops->xstats_reset)(dev, ids, nb_ids); +} + int __rte_experimental rte_rawdev_start(uint16_t dev_id) { diff --git a/lib/librte_rawdev/rte_rawdev.h b/lib/librte_rawdev/rte_rawdev.h index b4f9aee37..8e3d72273 100644 --- a/lib/librte_rawdev/rte_rawdev.h +++ b/lib/librte_rawdev/rte_rawdev.h @@ -408,6 +408,111 @@ rte_rawdev_dequeue_buffers(uint16_t dev_id, unsigned int count, rte_rawdev_obj_t context); +/** Maximum name length for extended statistics counters */ +#define RTE_RAW_DEV_XSTATS_NAME_SIZE 64 + +/** + * A name-key lookup element for extended statistics. + * + * This structure is used to map between names and ID numbers + * for extended ethdev statistics. + */ +struct rte_rawdev_xstats_name { + char name[RTE_RAW_DEV_XSTATS_NAME_SIZE]; +}; + +/** + * Retrieve names of extended statistics of a raw device. + * + * @param dev_id + * The identifier of the raw device. + * @param[out] xstats_names + * Block of memory to insert names into. Must be at least size in capacity. + * If set to NULL, function returns required capacity. + * @param size + * Capacity of xstats_names (number of names). + * @return + * - positive value lower or equal to size: success. The return value + * is the number of entries filled in the stats table. + * - positive value higher than size: error, the given statistics table + * is too small. The return value corresponds to the size that should + * be given to succeed. The entries in the table are not valid and + * shall not be used by the caller. + * - negative value on error: + * -ENODEV for invalid *dev_id* + * -ENOTSUP if the device doesn't support this function. + */ +int __rte_experimental +rte_rawdev_xstats_names_get(uint16_t dev_id, + struct rte_rawdev_xstats_name *xstats_names, + unsigned int size); + +/** + * Retrieve extended statistics of a raw device. + * + * @param dev_id + * The identifier of the device. + * @param ids + * The id numbers of the stats to get. The ids can be got from the stat + * position in the stat list from rte_rawdev_get_xstats_names(), or + * by using rte_rawdev_get_xstats_by_name() + * @param[out] values + * The values for each stats request by ID. + * @param n + * The number of stats requested + * @return + * - positive value: number of stat entries filled into the values array + * - negative value on error: + * -ENODEV for invalid *dev_id* + * -ENOTSUP if the device doesn't support this function. + */ +int __rte_experimental +rte_rawdev_xstats_get(uint16_t dev_id, + const unsigned int ids[], + uint64_t values[], + unsigned int n); + +/** + * Retrieve the value of a single stat by requesting it by name. + * + * @param dev_id + * The identifier of the device + * @param name + * The stat name to retrieve + * @param[out] id + * If non-NULL, the numerical id of the stat will be returned, so that further + * requests for the stat can be got using rte_rawdev_xstats_get, which will + * be faster as it doesn't need to scan a list of names for the stat. + * If the stat cannot be found, the id returned will be (unsigned)-1. + * @return + * - positive value or zero: the stat value + * - negative value: -EINVAL if stat not found, -ENOTSUP if not supported. + */ +uint64_t __rte_experimental +rte_rawdev_xstats_by_name_get(uint16_t dev_id, + const char *name, + unsigned int *id); + +/** + * Reset the values of the xstats of the selected component in the device. + * + * @param dev_id + * The identifier of the device + * @param ids + * Selects specific statistics to be reset. When NULL, all statistics + * will be reset. If non-NULL, must point to array of at least + * *nb_ids* size. + * @param nb_ids + * The number of ids available from the *ids* array. Ignored when ids is NULL. + * @return + * - zero: successfully reset the statistics to zero + * - negative value: -EINVAL invalid parameters, -ENOTSUP if not supported. + */ +int __rte_experimental +rte_rawdev_xstats_reset(uint16_t dev_id, + const uint32_t ids[], + uint32_t nb_ids); + #ifdef __cplusplus } #endif diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h index da891dc4d..2ef380988 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -351,6 +351,69 @@ typedef int (*rawdev_set_attr_t)(struct rte_rawdev *dev, const char *attr_name, const uint64_t attr_value); +/** + * Retrieve a set of statistics from device. + * Note: Being a raw device, the stats are specific to the device being + * implemented thus represented as xstats. + * + * @param dev + * Raw device pointer + * @param ids + * The stat ids to retrieve + * @param values + * The returned stat values + * @param n + * The number of id values and entries in the values array + * @return + * The number of stat values successfully filled into the values array + */ +typedef int (*rawdev_xstats_get_t)(const struct rte_rawdev *dev, + const unsigned int ids[], uint64_t values[], unsigned int n); + +/** + * Resets the statistic values in xstats for the device. + */ +typedef int (*rawdev_xstats_reset_t)(struct rte_rawdev *dev, + const uint32_t ids[], + uint32_t nb_ids); + +/** + * Get names of extended stats of an raw device + * + * @param dev + * Raw device pointer + * @param xstats_names + * Array of name values to be filled in + * @param size + * Number of values in the xstats_names array + * @return + * When size >= the number of stats, return the number of stat values filled + * into the array. + * When size < the number of available stats, return the number of stats + * values, and do not fill in any data into xstats_names. + */ +typedef int (*rawdev_xstats_get_names_t)(const struct rte_rawdev *dev, + struct rte_rawdev_xstats_name *xstats_names, + unsigned int size); + +/** + * Get value of one stats and optionally return its id + * + * @param dev + * Raw device pointer + * @param name + * The name of the stat to retrieve + * @param id + * Pointer to an unsigned int where we store the stat-id. + * This pointer may be null if the id is not required. + * @return + * The value of the stat, or (uint64_t)-1 if the stat is not found. + * If the stat is not found, the id value will be returned as (unsigned)-1, + * if id pointer is non-NULL + */ +typedef uint64_t (*rawdev_xstats_get_by_name_t)(const struct rte_rawdev *dev, + const char *name, + unsigned int *id); /** Rawdevice operations function pointer table */ struct rte_rawdev_ops { /**< Get device info. */ @@ -386,6 +449,15 @@ struct rte_rawdev_ops { rawdev_get_attr_t attr_get; /**< Set an attribute managed by the implementation */ rawdev_set_attr_t attr_set; + + /**< Get extended device statistics. */ + rawdev_xstats_get_t xstats_get; + /**< Get names of extended stats. */ + rawdev_xstats_get_names_t xstats_get_names; + /**< Get one value by name. */ + rawdev_xstats_get_by_name_t xstats_get_by_name; + /**< Reset the statistics values in xstats. */ + rawdev_xstats_reset_t xstats_reset; }; /** diff --git a/lib/librte_rawdev/rte_rawdev_version.map b/lib/librte_rawdev/rte_rawdev_version.map index bafe2c5de..469b78d81 100644 --- a/lib/librte_rawdev/rte_rawdev_version.map +++ b/lib/librte_rawdev/rte_rawdev_version.map @@ -19,6 +19,10 @@ EXPERIMENTAL { rte_rawdev_socket_id; rte_rawdev_start; rte_rawdev_stop; + rte_rawdev_xstats_by_name_get; + rte_rawdev_xstats_get; + rte_rawdev_xstats_names_get; + rte_rawdev_xstats_reset; rte_rawdevs; local: *; -- 2.14.1