From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0045.outbound.protection.outlook.com [104.47.38.45]) by dpdk.org (Postfix) with ESMTP id 594C5A495 for ; Tue, 23 Jan 2018 15:24:54 +0100 (CET) Received: from DM5PR03CA0045.namprd03.prod.outlook.com (10.174.189.162) by CY1PR03MB1421.namprd03.prod.outlook.com (10.163.17.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Tue, 23 Jan 2018 14:24:52 +0000 Received: from BN1AFFO11FD042.protection.gbl (2a01:111:f400:7c10::117) by DM5PR03CA0045.outlook.office365.com (2603:10b6:4:3b::34) 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, 23 Jan 2018 14:24:51 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=fail action=none header.from=nxp.com; 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 BN1AFFO11FD042.mail.protection.outlook.com (10.58.52.253) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.428.12 via Frontend Transport; Tue, 23 Jan 2018 14:24:49 +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 w0NDj5Rf022838; Tue, 23 Jan 2018 06:45:21 -0700 From: Shreyansh Jain To: , CC: , , , Shreyansh Jain Date: Tue, 23 Jan 2018 19:29:04 +0530 Message-ID: <20180123135910.10755-5-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180123135910.10755-1-shreyansh.jain@nxp.com> References: <20180102125749.2379-1-shreyansh.jain@nxp.com> <20180123135910.10755-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131611910916189905; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(376002)(39380400002)(396003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(305945005)(356003)(77096007)(81156014)(81166006)(8676002)(5660300001)(68736007)(59450400001)(76176011)(53936002)(51416003)(48376002)(50466002)(26005)(4326008)(2906002)(85426001)(50226002)(8936002)(316002)(2950100002)(6666003)(110136005)(54906003)(16586007)(1076002)(86362001)(105606002)(104016004)(498600001)(106466001)(97736004)(47776003)(336011)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB1421; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD042; 1:hlUFfKwiwBttVvgSnaLRsIWa8liQ4KDY4rE4b+AbJitDE8o7kIYSgQTdikfWj9xm2ErJnZ4Cy8E5wc2L3UHibnfWVWDsPezxIgyBwXoFacJpqAMv3tJ5gI4bdndDlFaM MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21c262d3-cdd0-46a6-aed1-08d5626d10d5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:CY1PR03MB1421; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB1421; 3:oCPFWjyZCqvfQuwKAf4x8+K+z1du2s02SQaiXgid9KTTZu4M5q7H3n2pxpW8xgClrPm0DIL2ceXFmt7RMxJJxRls/kDcz+1so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mthlqqvwE7725d5VNdKYDUMkef7NQerhmBuoyxDFalbEKxd9pGRqh6wRfkDzjkV6Kx7L5DPWkc4NF0pr24423jVVF2TVcqY5dc/CWErhRAAF+x3i9vt48ltCOcA6oPR0Jmyo4Kc1XrDATYaK9Zcp137FYzykgPjchDmz9F95Vd+1ilX 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)(3002001)(10201501046)(93006095)(93001095)(3231023)(2400081)(944501161)(6055026)(6096035)(20161123565025)(20161123561025)(20161123563025)(201703131430075)(201703131433075)(201703131448075)(201703151042153)(20161123559100)(20161123556025)(201708071742011); SRVR:CY1PR03MB1421; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY1PR03MB1421; X-Forefront-PRVS: 05610E64EE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB1421; 23:YmvLTK+u+Y4sQiBYi+g9zuHPUKeaIM2zHnQpAMKA4?= =?us-ascii?Q?SsQoj7eg67la/hA/mUNJYd4UkslI62E/7Lz+TJyC4Azj1CtmnJwJc9pcq09S?= =?us-ascii?Q?XtEvrOCh6/J9J5s909sI7+w/uZPB/qt3/LjDaD+sbUR3scK+krlLe/2wRrzf?= =?us-ascii?Q?aaHK6avwO17WH2D+h3nY2Kn+qXV477YJwDnKMnd56qubbmbY9xMyFkQA7qeh?= =?us-ascii?Q?tPyK2ny73mGxGvPZqA5Xa3SnCYQ1tgmJMWfNZ8qIGQAc5eiZ+LSwAAmHtzRI?= =?us-ascii?Q?wotSsR7CfVPM5kYHbgj240bYTkH/cjwJUvaCklh+KApuxn+ehTn01d9cDa97?= =?us-ascii?Q?u2CbYvj+fb55gUeC8/eSlFeoJwqgMDa6lR5oZb2T9LmSFMU5bvK7RUzXDMKc?= =?us-ascii?Q?v7l1kJgYEoH9oq6XnB074eZ94reiSRKfSd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qAGehxnB9JoCt8EpoC7Iux6Sbe8HxiNVrr4NDcEiJUGO/ca7BM6/G4VtktmopjrQUtA4lx8kYlhwimPs9lXUm9D6WZEEDiir2uFkFqGNzrq9tx+Ju7RE08os5Hg40hVrKNdZFJtDJozFgx5nBbIkSnxa0=; 5:QG+GRsiRu4fX1J3geavnTi8+pDOs5H425dEPcpRpHKC+sDmKUI513G0Z4VfRGkvGpb0w1wkmqCaNri2dIrzEXL7zjkWdgneu+GwUY3kcbeMo/u2lG9IPYtnbX0n7nD1pLKtxCgFhLYQURCtagrm1BtD0qQj08+QVc9sUr+NJSF0=; 24:EcQBJqKtfE7oWFohIR+AeO+DHLTDQIslCBC8kavgBq0VFyTxXJ/pblTnnMe6htJNSC0wE5BGY0RmUfUzsyM6UBZSw76+hgPYIFYD+VQOYZU=; 7:JozEQgteizad7zMGaiOpZXjlNWcVi4pPvfOvpoFoyA1SX+nZT0cdLoQVADqoQW9VJZpNoQ2tMZozsN9054+5tGt2zwWnx+0XZ4QyFBhgQ77JoGzZxxMps0zcH4pray3qDxPdur42MN4kGHgPwrtvjRpALCqPnqStNomSlLzn8MdcXqGmiucmq6SK2WoW9rjikbBl+G6HBz5MoL+ciwZDklP4E061EefIpWEnMKe3EgIeoUWuQUp/tce8qZSce6nj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2018 14:24:49.7937 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21c262d3-cdd0-46a6-aed1-08d5626d10d5 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: CY1PR03MB1421 Subject: [dpdk-dev] [PATCH v2 04/10] 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, 23 Jan 2018 14:24:54 -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 0c5204f51..3a7800a45 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_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_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_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_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_rawdev_start(uint16_t dev_id) { diff --git a/lib/librte_rawdev/rte_rawdev.h b/lib/librte_rawdev/rte_rawdev.h index 22f055a40..221f85856 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_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_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_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_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 300693f41..fd94b39c3 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