From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0084.outbound.protection.outlook.com [104.47.40.84]) by dpdk.org (Postfix) with ESMTP id 33DEE69C6 for ; Thu, 23 Mar 2017 11:20:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Hm+tZkzm0auxQ3kJVhGW+NkAcNa2h8w6mpfK7t2chOo=; b=YO6j8JxBgSoCOHy+OeicgVIxGWMXzUJp8nRu8pa2vfCiKrhFkfj0RdaeXVAJ1QBaStgYZflaUngBUJCKlbNpgiW2TVgLaXzG3QzBr/M1MSj9D3szcwsEKxqtSjzFGlLh2ApYaI8JQQzfFzvmUjhtgqUUSlrbnt+EIeFb45AZ/fA= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (171.76.89.237) by BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Thu, 23 Mar 2017 10:20:27 +0000 Date: Thu, 23 Mar 2017 15:50:10 +0530 From: Jerin Jacob To: Harry van Haaren Cc: dev@dpdk.org, Bruce Richardson Message-ID: <20170323102009.ld525nyacfbuspsk@localhost.localdomain> References: <1487343252-16092-1-git-send-email-harry.van.haaren@intel.com> <1489175012-101439-1-git-send-email-harry.van.haaren@intel.com> <1489175012-101439-5-git-send-email-harry.van.haaren@intel.com> <20170317122227.uymznz5a2cs4ahit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170317122227.uymznz5a2cs4ahit@localhost.localdomain> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [171.76.89.237] X-ClientProxiedBy: PN1PR01CA0110.INDPRD01.PROD.OUTLOOK.COM (10.174.144.26) To BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) X-MS-Office365-Filtering-Correlation-Id: ec4f3c29-2abe-477a-5cc6-08d471d63b24 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 3:8uigQhGWDJfg1yfH+C5qRsYGhnTlsH4GgruZ0wUAtQLeTSUM1YEVnEhmxmDASPklXATB2J0Xqtb12ZX+TAfIGnCA8pdeBmufrlS/fzBQG7La3nCdSqw9wBpWXxr+j5TbuMUz4izTIo0JQDbiSGnttqSw3BtNMvLDMwIQFs76HQlbY9gSUCrgzXOAPOULt9K3vBrPXI/IvOHkmhhJdBRdBqlbCIkuILvt06IUOtWYs1wtvyxticOf0u1W4KSxg+1/lVvNBRuaDbHJaCbeOTgPPA==; 25:6nM8skFG4y1X0r/995OMYNCtJ32lJRTTmOfj/vWbQtzYUTuV8xmtFLEwsGKh2fVQhYOSQ9+/iDobK2kGiMf/n9YSckatZUphV+o4mEcL0fEQ0hRpi6B1qINglkhP3AgX2wfIYzXV2jziPHlFR5hCUIbplcNteKW/AixUnhb4ZebT9OLHg5xpXJW4hEfbS/hLPr7Uil2niRnwg7OexBI4vLdvrovE+2PIjpuykYaIbiMtKj/jgKxcjm6YFAEp7P0F5y82em8DDC75DXVB2zwPr602j9sePCDIl9YiY3jv3gzXSwP9fpRuKieXgAruxrFmH+KYWZgh5kp0wYCNA70trmRwYGLU/+E9cWjMvuynIy5l9fNeFi8luRt+4riwK/bla7zD78cR4AIimHhLWad9/92Op8VAa9oNFh39CqmwUAheHxRaeQHM99mfJqPF1tiy83KT62yAEAQCxMd5KgAoug== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 31:vCNqZF6BQ6z8f2l5Uge7Ow0eoq6TCTRXlGv5DNrof/VCmsR6+AqtYDxz0Y0Z1QqN/amC3mdotMVZLXeYjkhK4mIHIXnJ2KnVIlAstue9EYgKb3uxh3iNc6g+gfSH7fAKdH4Y1W5UYg2mKDmDgQVmiKijDU/7WAEtPaouyQ1up6GQ0Fdioy1JFxiIsYokB2AHFpamI0LRKDyzJwqsN88SUod0uDLVFBWs6oZKyo88W9gC3/1imdCOCR9dNNJOs5FHey7Th4ayCRwfP8bEQ0VTOA==; 20:h9dcPe3MNDnfEyX1+tWBIOpuqZ66Evgcoyy2A7AN+BoeU/vLNR5m9muo+r6gvFDSq4QN+BOVjaHTCEwQgGSUcHMF4Us58wnrfaUHz7VqNRXUAMzv8ihFfpl3gk/dVyHItst1+LsQmEjTXLUm/jm6xoIdOjuLJVVtwoAzhBUr5o83eQaGBCEMAgt2ZC4t3RsQyN2GYlCjCHaEdd9vZF0BMrAh7B3TZBISk+BQWP+YR+VKiiiSFfwVAgYI++RQK2NpoqhnHXWi3tTMjPwELZfBfc2kcQtMPIYUtabVWNiGCDH233Jc7Ql7DY6QLBTEbFROrKW1PPRx/IpD2WFuaiIGSOQdcqz/tbKR2aVwbzmd3TdBbW7XLJPP3dYJ5A5SjNXyPi8ukAwlb2aYo+PdgLbUB2NPRWB3Ph42SwiJr3slS7YOJKq8Wwp8Rq/29HTzRhs/iL22nvL+oKVoXKvlNSZvVoW5k0HfxB/lv5YRbkvRe+zy2ifvrNGQDGGCfMSpd3DNY6Ql5tYEmUO3LXB/Ed7xZ7Wg5/LzeujvZwRx8Pi7/9e5EriSm7y4+rQiy3okMsqthw5e8f2rn1EZvhUob4kjcENmEWm2+r9IAl95+9fQ5Ms= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123558025)(20161123560025)(6072148); SRVR:BLUPR0701MB1713; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 4:+tbA6ZerVyuTKZfJU/cuTOuir+ejNVtRT93vhF+L+B4vzyZzUJzE9DFT7lAyreZPYInpmLi/m14PRLJdy5Y5C0GL/yWqJV6FHkEgBqpDcOZHhN5VLYxmYjLzPR8Ydvfz8jHxIpA+ali9N0Yn16jFDGf+nqEtV0JiUUBdzdAJIJQDtxCiGDQLoYFk1sXUiWQ84nP3Ok16Ujd1kAlZfVjZlnK8aL24UAT3Da7Z4vFAV10FWzFDvBqKgqhIXIALhvGWXCSeSjKNYpBzWhKpTBsabJ2nCBGiBd1GZGywdInc1akvHtVyxa07X5VpgHfAjxgpniiqe+r0ievttFg8qW3ONhxW+wCrpuDC9lkOc91WDTbqoKx7rDkImMMsyMnapNd+B9rs7wQP2BIbqHlNzOaLdtfJEm2KX4QRpZmQmMYACy3tGiOod23ZckIonruz48IJ8y5lcoWRt+2ejyWr+y4ll+eXjfsBS8Lo9ma53FCYboQGM4tTHFmk5s4zNithHFS7NOEE1hy0L9jnBHUcgoNOKIEg2fOphcsQ8SMzXDb6ntjIXpSNpIwZJFXu1ed/3R4jCGcQ4CCVO+yZ1s/KNzIQmSMrlahTIXjqJxVjluDUMCn6JBVfJtZPBe49qPRCD0NM1pKl3wk1Cx42jjvo1tE8Xg== X-Forefront-PRVS: 0255DF69B9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(39830400002)(39410400002)(39450400003)(24454002)(54356999)(23726003)(6116002)(3846002)(76176999)(50986999)(33646002)(9686003)(81166006)(1076002)(4001350100001)(55016002)(93886004)(50466002)(25786009)(66066001)(53936002)(6916009)(2906002)(8676002)(2950100002)(6666003)(229853002)(47776003)(42186005)(42882006)(7736002)(189998001)(305945005)(5660300001)(4326008)(38730400002)(110136004)(6506006)(6246003)(61506002)(83506001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1713; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1713; 23:9o+xQdPZvJpp6sPPlbiPC2lBj7qy3IQlPEB/W9T?= =?us-ascii?Q?WFUZqO7jqZwg6PFGT54F43F3MWak1a/36rMXmbgOle+gXPuqNJ+G1FWpvWzr?= =?us-ascii?Q?dNRf8q2CkcusABAR5kPd4RWyE9bjNjMAVOvYBIy5dC9WMp9LL+BBgc7PXOwr?= =?us-ascii?Q?HUfSVQyTNrqZiQwB9Vd+rbf8Rrj2YTO1IrpcnYBKmV2WoaXRgyNUGayNittk?= =?us-ascii?Q?qpnPHYb2O0zEjknHO42QzaCXDUHqraJV84vVZis4aA6w/1MdlTUTUD3EXdg3?= =?us-ascii?Q?8sa6Jw68mQj6trzpraI2q1XZFJCM9rCVWEaLb+vyyQ4x3oXM0UKUCI8Pdl6U?= =?us-ascii?Q?GOo1kUZJBPRQ6hWDGFbfkOrSy00QHrSMR0MjkMNtEk0wbyX24R4iL/osdrWv?= =?us-ascii?Q?f0KQjbciKO/xcH4fBpPViayKOTCV+XeKqk/yXD/udFO785sdKrmqD8ub1DUY?= =?us-ascii?Q?WzS9wY5cN5M0raoZe+cCNfej+7P1CyLaXbkaipUmF9oj6NWh4Sx2FZJKxJ2p?= =?us-ascii?Q?Ih7KHs8RWtl17V51LwVJa9x7HLZtO1OIlttU4TReELkrXZY3sJ8GFSb7LlJB?= =?us-ascii?Q?/CiM7an3WrvPs0VgAWADVREfa4MpgHQox1hovVt4F9V6YZ6FDmSWGE/8N3Lc?= =?us-ascii?Q?LFkOGSVh9fB5aaLrBT4NJSLybOJyf2Z8iwQhqtAU7KoKlx2QobtRK72wPjQQ?= =?us-ascii?Q?55CuadtyMLcHBbC3ajOvzqSJlUOTESPvGEajVjtLTWODdDcMAbD3u/jC2xia?= =?us-ascii?Q?pDeHuohEWY4k+NzYPXAfjQTpo6RZQU/HFkAgj+D8Rgjhcv5wJY7b5BcoveSK?= =?us-ascii?Q?M5CXsgNf3VpdWU+SxHe5ETl1mNhRv7qQtE5+wqjcLtvm83+FAicZpWlQ54lL?= =?us-ascii?Q?enbZ2jvu5e06Ylz5YTqtXaerWDtd2kPogQdIXXklt04o3sSDB9w5LcoYq2wa?= =?us-ascii?Q?3o9FKxHoUnpiJCYKLcGQMW/ctL/FVM/bKak0Sy+SCqguhyQscGAsnh6iKd6N?= =?us-ascii?Q?5Kbr5YoLRYJ1wFx3uMrIbtt7Ck2cyQtdafEa/TcONcxaojunRiSOmvPL05te?= =?us-ascii?Q?jZXRLnUR2KgO0BBalCS1mBzLe2TZ3qu7eVlaEPMuYL4KABZWK1w=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 6:zaUHFxcll+FMdc9J5PWUHUOe1Ty4nJ89Wgf+tKLVvxbAgLGiF31w6FRTctjPCM/IYaHx2DdwbAdxjiZxBHb5nbzNHDNvyDiMJ6VBlUU40J3+RsrGmtWCZNRPZEb7PstEQTvjLjVkuClTwJA7HWs9g3z+sGfp4yJlOFA0LkE9iIcT5sQg0/aj+HZUNaYWyL0/JYUVdKNQkS82kDy/wmwqxYETtDvYa3ld/ouGmQJH0s1R/VQB/5f/tT2bNxfYc5wsh2jqR8ryewFqhwU7NjmnK8Rk7OutPu6kZ8CK38uL1WY3v71pOn0HmlZq42NQA2NDbUeXMKTIDDGRxrVcVfBqZPK5FHpJyagk008Hyq+p1/6ui9lL9n68MyBtI5GeEpJKc36AvK7/vRVnhNvLepC6EA==; 5:mai7jApnh4sRKowU9SWEGTRHY4U0Di3kYOuHowfoM4p+HgCUv/AEopPfIOo4h4lI+0ZdNtGxk9SAfNUTafvD+UgZvQeDYe/R4RJBZFXOjyUUR7vrrBxLlnpQfzH2IRzsqUMkDxkD2y/YWHXcKC0K3g==; 24:SCA58owjPK/h8H6D1RKU+LKXZypFThsFi7EUxixrl4DK1c4OmkfdLV+o/vO2udNhYfoh+VH5lytCwwIOtf95MZ0LbyyhL0qCoIZvee6FB0E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 7:3f4GNDPvvKN2oQ8JNK8ZHgIEhfNaJOQ5thSNz+BynYwKRS31kT8vU5JyfAd9W8M71t19mcbCb5JTFU35U5AwNa4uwB4jgSbDmDv83t7zU8MXv3229ljyPYnXkjsGgW8QeFKeF6JFiTbHbnTIaceYE49k9nD6di1xNj9wvwCzogfLWyDPgLw25Q2ixoE0iW6IDQKOCPU/qme04qMb4uYHkpoFw2BDtCiTfy7ykNL1yj+0iWBzx9gFmb0QZmlIIAqxF8ReveiFpwXYSF6im7SpHFFDz2s4XdgxWHQ5TJST8hau/4BK2bt4AaXi11+7yOGm/FVjFDuyNuckUfUF+LPi4g== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2017 10:20:27.8996 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1713 Subject: Re: [dpdk-dev] [PATCH v4 04/17] eventdev: add APIs 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: Thu, 23 Mar 2017 10:20:36 -0000 On Fri, Mar 17, 2017 at 05:52:28PM +0530, Jerin Jacob wrote: > On Fri, Mar 10, 2017 at 07:43:19PM +0000, Harry van Haaren wrote: > > From: Bruce Richardson > > > > Add in APIs for extended stats so that eventdev implementations can report > > out information on their internal state. The APIs are based on, but not > > identical to, the equivalent ethdev functions. > > > > Signed-off-by: Bruce Richardson > > Signed-off-by: Harry van Haaren > > Acked-by: Jerin Jacob Applied to dpdk-next-eventdev/master. Thanks. > > > > > --- > > > > v3 -> v4: > > - xstats API reset allows selection of device/port/queue to reset > > --- > > lib/librte_eventdev/rte_eventdev.c | 83 ++++++++++++++++ > > lib/librte_eventdev/rte_eventdev.h | 142 +++++++++++++++++++++++++++ > > lib/librte_eventdev/rte_eventdev_pmd.h | 74 ++++++++++++++ > > lib/librte_eventdev/rte_eventdev_version.map | 4 + > > 4 files changed, 303 insertions(+) > > > > diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c > > index 68bfc3b..0280ef0 100644 > > --- a/lib/librte_eventdev/rte_eventdev.c > > +++ b/lib/librte_eventdev/rte_eventdev.c > > @@ -920,6 +920,89 @@ rte_event_dev_dump(uint8_t dev_id, FILE *f) > > > > } > > > > +static int > > +xstats_get_count(uint8_t dev_id, enum rte_event_dev_xstats_mode mode, > > + uint8_t queue_port_id) > > +{ > > + struct rte_eventdev *dev = &rte_eventdevs[dev_id]; > > + if (dev->dev_ops->xstats_get_names != NULL) > > + return (*dev->dev_ops->xstats_get_names)(dev, mode, > > + queue_port_id, > > + NULL, NULL, 0); > > + return 0; > > +} > > + > > +int > > +rte_event_dev_xstats_names_get(uint8_t dev_id, > > + enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id, > > + struct rte_event_dev_xstats_name *xstats_names, > > + unsigned int *ids, unsigned int size) > > +{ > > + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV); > > + const int cnt_expected_entries = xstats_get_count(dev_id, mode, > > + queue_port_id); > > + if (xstats_names == NULL || cnt_expected_entries < 0 || > > + (int)size < cnt_expected_entries) > > + return cnt_expected_entries; > > + > > + /* dev_id checked above */ > > + const struct rte_eventdev *dev = &rte_eventdevs[dev_id]; > > + > > + if (dev->dev_ops->xstats_get_names != NULL) > > + return (*dev->dev_ops->xstats_get_names)(dev, mode, > > + queue_port_id, xstats_names, ids, size); > > + > > + return -ENOTSUP; > > +} > > + > > +/* retrieve eventdev extended statistics */ > > +int > > +rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode mode, > > + uint8_t queue_port_id, const unsigned int ids[], > > + uint64_t values[], unsigned int n) > > +{ > > + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV); > > + const struct rte_eventdev *dev = &rte_eventdevs[dev_id]; > > + > > + /* implemented by the driver */ > > + if (dev->dev_ops->xstats_get != NULL) > > + return (*dev->dev_ops->xstats_get)(dev, mode, queue_port_id, > > + ids, values, n); > > + return -ENOTSUP; > > +} > > + > > +uint64_t > > +rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name, > > + unsigned int *id) > > +{ > > + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, 0); > > + const struct rte_eventdev *dev = &rte_eventdevs[dev_id]; > > + unsigned int temp = -1; > > + > > + if (id != NULL) > > + *id = (unsigned int)-1; > > + else > > + id = &temp; /* ensure driver never gets a NULL value */ > > + > > + /* implemented by driver */ > > + if (dev->dev_ops->xstats_get_by_name != NULL) > > + return (*dev->dev_ops->xstats_get_by_name)(dev, name, id); > > + return -ENOTSUP; > > +} > > + > > +int rte_event_dev_xstats_reset(uint8_t dev_id, > > + enum rte_event_dev_xstats_mode mode, int16_t queue_port_id, > > + const uint32_t ids[], uint32_t nb_ids) > > +{ > > + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); > > + struct rte_eventdev *dev = &rte_eventdevs[dev_id]; > > + > > + if (dev->dev_ops->xstats_reset != NULL) > > + return (*dev->dev_ops->xstats_reset)(dev, mode, queue_port_id, > > + ids, nb_ids); > > + return -ENOTSUP; > > +} > > + > > int > > rte_event_dev_start(uint8_t dev_id) > > { > > diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h > > index 4876353..d462047 100644 > > --- a/lib/librte_eventdev/rte_eventdev.h > > +++ b/lib/librte_eventdev/rte_eventdev.h > > @@ -1405,6 +1405,148 @@ rte_event_port_links_get(uint8_t dev_id, uint8_t port_id, > > int > > rte_event_dev_dump(uint8_t dev_id, FILE *f); > > > > +/** Maximum name length for extended statistics counters */ > > +#define RTE_EVENT_DEV_XSTATS_NAME_SIZE 64 > > + > > +/** > > + * Selects the component of the eventdev to retrieve statistics from. > > + */ > > +enum rte_event_dev_xstats_mode { > > + RTE_EVENT_DEV_XSTATS_DEVICE, > > + RTE_EVENT_DEV_XSTATS_PORT, > > + RTE_EVENT_DEV_XSTATS_QUEUE, > > +}; > > + > > +/** > > + * 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_event_dev_xstats_name { > > + char name[RTE_EVENT_DEV_XSTATS_NAME_SIZE]; > > +}; > > + > > +/** > > + * Retrieve names of extended statistics of an event device. > > + * > > + * @param dev_id > > + * The identifier of the event device. > > + * @param mode > > + * The mode of statistics to retrieve. Choices include the device statistics, > > + * port statistics or queue statistics. > > + * @param queue_port_id > > + * Used to specify the port or queue number in queue or port mode, and is > > + * ignored in device mode. > > + * @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[out] ids > > + * Block of memory to insert ids into. Must be at least size in capacity. > > + * If set to NULL, function returns required capacity. The id values returned > > + * can be passed to *rte_event_dev_xstats_get* to select statistics. > > + * @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* > > + * -EINVAL for invalid mode, queue port or id parameters > > + * -ENOTSUP if the device doesn't support this function. > > + */ > > +int > > +rte_event_dev_xstats_names_get(uint8_t dev_id, > > + enum rte_event_dev_xstats_mode mode, > > + uint8_t queue_port_id, > > + struct rte_event_dev_xstats_name *xstats_names, > > + unsigned int *ids, > > + unsigned int size); > > + > > +/** > > + * Retrieve extended statistics of an event device. > > + * > > + * @param dev_id > > + * The identifier of the device. > > + * @param mode > > + * The mode of statistics to retrieve. Choices include the device statistics, > > + * port statistics or queue statistics. > > + * @param queue_port_id > > + * Used to specify the port or queue number in queue or port mode, and is > > + * ignored in device mode. > > + * @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_event_dev_get_xstats_names(), or > > + * by using rte_eventdev_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* > > + * -EINVAL for invalid mode, queue port or id parameters > > + * -ENOTSUP if the device doesn't support this function. > > + */ > > +int > > +rte_event_dev_xstats_get(uint8_t dev_id, > > + enum rte_event_dev_xstats_mode mode, > > + uint8_t queue_port_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_eventdev_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_event_dev_xstats_by_name_get(uint8_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 mode > > + * The mode of the statistics to reset. Choose from device, queue or port. > > + * @param queue_port_id > > + * The queue or port to reset. 0 and positive values select ports and queues, > > + * while -1 indicates all ports or queues. > > + * @param ids > > + * Selects specific statistics to be reset. When NULL, all statistics selected > > + * by *mode* 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_event_dev_xstats_reset(uint8_t dev_id, > > + enum rte_event_dev_xstats_mode mode, > > + int16_t queue_port_id, > > + const uint32_t ids[], > > + uint32_t nb_ids); > > + > > #ifdef __cplusplus > > } > > #endif > > diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h > > index 828dfce..86e0076 100644 > > --- a/lib/librte_eventdev/rte_eventdev_pmd.h > > +++ b/lib/librte_eventdev/rte_eventdev_pmd.h > > @@ -421,6 +421,71 @@ typedef void (*eventdev_dequeue_timeout_ticks_t)(struct rte_eventdev *dev, > > */ > > typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, FILE *f); > > > > +/** > > + * Retrieve a set of statistics from device > > + * > > + * @param dev > > + * Event 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 (*eventdev_xstats_get_t)(const struct rte_eventdev *dev, > > + enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id, > > + const unsigned int ids[], uint64_t values[], unsigned int n); > > + > > +/** > > + * Resets the statistic values in xstats for the device, based on mode. > > + */ > > +typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev, > > + enum rte_event_dev_xstats_mode mode, > > + int16_t queue_port_id, > > + const uint32_t ids[], > > + uint32_t nb_ids); > > + > > +/** > > + * Get names of extended stats of an event device > > + * > > + * @param dev > > + * Event 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 (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev, > > + enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id, > > + struct rte_event_dev_xstats_name *xstats_names, > > + unsigned int *ids, unsigned int size); > > + > > +/** > > + * Get value of one stats and optionally return its id > > + * > > + * @param dev > > + * Event device pointer > > + * @param name > > + * The name of the stat to retrieve > > + * @param id > > + * Pointer to an unsigned int where we store the stat-id for future reference. > > + * 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 (*eventdev_xstats_get_by_name)(const struct rte_eventdev *dev, > > + const char *name, unsigned int *id); > > + > > /** Event device operations function pointer table */ > > struct rte_eventdev_ops { > > eventdev_info_get_t dev_infos_get; /**< Get device info. */ > > @@ -451,6 +516,15 @@ struct rte_eventdev_ops { > > /**< Converts ns to *timeout_ticks* value for rte_event_dequeue() */ > > eventdev_dump_t dump; > > /* Dump internal information */ > > + > > + eventdev_xstats_get_t xstats_get; > > + /**< Get extended device statistics. */ > > + eventdev_xstats_get_names_t xstats_get_names; > > + /**< Get names of extended stats. */ > > + eventdev_xstats_get_by_name xstats_get_by_name; > > + /**< Get one value by name. */ > > + eventdev_xstats_reset_t xstats_reset; > > + /**< Reset the statistics values in xstats. */ > > }; > > > > /** > > diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map > > index 7a6921c..1fa6b33 100644 > > --- a/lib/librte_eventdev/rte_eventdev_version.map > > +++ b/lib/librte_eventdev/rte_eventdev_version.map > > @@ -12,6 +12,10 @@ DPDK_17.05 { > > rte_event_dev_stop; > > rte_event_dev_close; > > rte_event_dev_dump; > > + rte_event_dev_xstats_by_name_get; > > + rte_event_dev_xstats_get; > > + rte_event_dev_xstats_names_get; > > + rte_event_dev_xstats_reset; > > > > rte_event_port_default_conf_get; > > rte_event_port_setup; > > -- > > 2.7.4 > >