From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0042.outbound.protection.outlook.com [104.47.41.42]) by dpdk.org (Postfix) with ESMTP id AFD526A6E for ; Fri, 17 Mar 2017 13:22:49 +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=8b1XhovTPdow1j4n/K/e7zSXwTkhBLbEi+X2ofXYYjo=; b=YRmdCbIbf4G9gH4SoH+EZwrhVrQiz7ait1lIackN4J6GNNec07TNwiCvU4MB8mvTl9rJ7lcEu6GLZO6mDexQUBrOA7cE7ulbxgw+7AVRWt79KJ7lh6gtKXvm9IPTgmXhH3K3D71B1xvrhCO+IBWPpsmrywRq6ebxecNAUlEr8J0= 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 (122.167.124.252) by BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.961.17; Fri, 17 Mar 2017 12:22:46 +0000 Date: Fri, 17 Mar 2017 17:52:28 +0530 From: Jerin Jacob To: Harry van Haaren Cc: dev@dpdk.org, Bruce Richardson Message-ID: <20170317122227.uymznz5a2cs4ahit@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1489175012-101439-5-git-send-email-harry.van.haaren@intel.com> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [122.167.124.252] X-ClientProxiedBy: BM1PR01CA0094.INDPRD01.PROD.OUTLOOK.COM (10.174.208.162) To BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) X-MS-Office365-Filtering-Correlation-Id: 41363e3c-8835-4662-a0dc-08d46d3052dc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 3:7ahEvP57tXtprCF/msnrMB3/G1zOIUQAW1WGbxgoWvG3OCGam5vHHJIXaR0DouCwb9eCg0/iWxOrB+gsCZF7JRT0YY5E+scNlrBUhoUmhDnj6cTz2CWJr806Sht4WwqeFh4MIkDOnw2c4AcpmXkvRqcvOEdKKQAyzA/2o6Efgl/6XcEv5hKGnXj88UDhqbLMX3OgrSZ85OQ19wUUS+tnD+h1dZq/xepQ6yTnnXBhoOfFly9ssQWXHP/jWKBMNzaFLfVHpGX8iKFUmyaiK5/3/g==; 25:xEppA9yEPLCfSb2DfXslvEPAZ/E8W8jcf4TtRAJiSRczmE4ZnGA2WhSz8yv5nsj4mLVGvikd2P/dQ/ZlXE4m3XVi9J4v76iJuz9SaXsWIQQHm8t4FNQeB8vMX09yvxtFI3Oad2KpqcLs1y944VBDS/Ds9D3bpVww9OwHWoONYrIkgkXBXbWmG7jEPX9NL7ETubuTJWabXExQGAG621OMiPZhIO7ajXBF8AyoYQASPBwUf7F5sTmbKJP8yUb+6fYa2vvTDEMW5wbUeMJFemtc8DkvwaQinzTjDK0TGVrvLKouVkTa/lyldfB5O8eUoyaZrE8jGD2OtZ1mqUdYDV/v53/kcmWkXVK4pJjvqoxL/5IiiLeRVDVlG4VRi6avUrnyEj7EK60Z5fmvliDKn9sR3h/dHdVMpJ+HMf9Dr5McBYHZ/NGqqd1+EwQN8+p6kOxqlqd99UNi4QNTdalYjUrXQw== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 31:b+dIbsDnbZB5lzNsZGlpqQjrVVq9FZIVA6+J3GRv5GVaWX7AQBzD0RwWepvKvPLJmUssTNYZzjCHpUh+AuVPant3XRuccQwwvu1Vcxh8KG4WixgSmXibt9JLuX0lcPBiPtiRPVlROwKir9boHagfFhkPi35MEvnrIrTahQfX/TiN5Vnie77AyS42ldTK2Y6mNcIDU/4NH5Ghz9nTLvOnoIoZvPRacRxZ9cdmMifJvU2VXC3gTQyTjpmSVougVmY/69ywjB18mb26KWF08OlWsvlmDZ92lozImsOzd+CYuFE=; 20:QsNtDj41e4xUJsff6ZMAtHs+F/25FXH2b7MHtbI9zZao7cvyx53epKzIMVFnPnphqwoqNgsbEoRlScX+5AzMuUmTyIp47/qaztbg15HNTXTT7XoCvCLJwLIqhD3KofsXLN1ATUUUtO5c5CuITteIT6kmOtLMyAG9jU3gFFfD9KpOjwphYnJovhTOK/ECaE5ckwXydusMKHCPbxWecCdbI/H18kII9jYp1eiyH5g5Gr4oTiV+i58oNXXsMc9/WmWKn6l0m3pMcRmGjDDidg8Ybb1dr9qzCcWI5qlQSwAHLzzrXO4n4ApnanMQHDXHtqOwtTG+9Us94XQDFdK/dC/SfCNGBhDkzLtkM+OXizVuYotri/s2PGXbJ4GHhXD9JrEY1FHurE8MIU3dl7pxnk2R1xy90ur1qTHN1xBBAbtClI2uoVcr1lSydL8GFWcjmv+LLZPFK+zmCsHXl6Wfqw8zoSV9BN/KqOBcX8NsB5I2U5jFX3Zd9xuX+Mb+Uxm3YtM+dZT9D+DBvV9unp5u0+Y2Pd9zM/jfdIYCCktk+dXtgNj0QqzLaxjIDdMxiSoNb/tuBw94jzuUbm4/tpBMCuE4iklB8BeuteASAcraSQzHAEY= 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)(10201501046)(3002001)(6041248)(20161123560025)(20161123564025)(20161123562025)(20161123555025)(20161123558025)(6072148); SRVR:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:TaMLbaR+dc1yjxHnAUDQ/qjQSV9u8rPzXbMWRhJ6g9QswOMVQCnRp8SiDuj0Gmf0b9x6YZLIvVpY5e+TAEMCA9xb3s++mpFG2jPkQyK5g8sRXasZddKgDijQjOy9U/2mqka8emUsn2skHcMq64y0KUBaDsEYBHUzu9jovYvnZ7tfq+xTb9uBMYbzmYKmffoQ5rR25ik98FEtTCqCA66RTPSWXTMU8IQ9oofl2bBmc3zXGqIcNOtfwfKNy2oTO+tinjQjpmhkUMD9QP7LK54zTM8XYuH6kS/cu+3ylO1FOAx4Qk1n9ebGCZ/zZENa8/nQdMLvvTnG3skBbTCl9V0YT+XV9kvtJJCoZWwsWpiKZBafJu6fAce8ni4A0eRyA7LVKCAaSBDMzOzj2Q96oBQuUZkBL0Yk88HOr6hVDNS98TG7Zxe+PgtilwGnIwz29947ByyKZdhP7Liy75y00z8Ipp++8akPrY3jGMRChWzK2czSDNHUz8P+OphjfQJ9RMc3TU7rg258Xo7h4bs7y8iXKqS7Npj0xNajoHPD9OGq0y52DpnJrLoVqeK2POYhqTA8d/xnAeD+J3hbcwZhSwAYN+BzuyXW5dcZCKoqsD7YKGY9ntvv/RocVd9B/7cqoNfaNaqSqWFP+MR2ELCq0Wxk8A== X-Forefront-PRVS: 0249EFCB0B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39830400002)(39450400003)(39410400002)(24454002)(4326008)(2906002)(81166006)(47776003)(66066001)(8676002)(33646002)(189998001)(6246003)(50466002)(61506002)(110136004)(83506001)(38730400002)(4001350100001)(53936002)(6666003)(54356999)(50986999)(76176999)(1076002)(5660300001)(55016002)(2950100002)(7736002)(25786008)(6506006)(9686003)(6916009)(42882006)(42186005)(23726003)(305945005)(229853002)(6116002)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1723; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1723; 23:JH19Cn9t56hPIrP5NKWdG/aJDiSKcJihQ5kU/pS?= =?us-ascii?Q?PPKKmyriCzmKdNZUwpMQfKUcf69j8y6dGclM+SO2i+LlEWFfzf6qprfU7IFe?= =?us-ascii?Q?VnijXzp24biuyc2EsBu5LQBb+y6GslnI/9V7MiGFb7VJSomrhvO5S14NoIQz?= =?us-ascii?Q?mrAq/w2ZkK8vIGAoFLMi+V/qbiGOdMzvfm+1KPKJLUq8JXsMfa2tOzVXT4F5?= =?us-ascii?Q?hi/qwp2dNJKKgI6vp+Jrrb9gjaI/PeWTm9giVetG+2JVGAjPxVbnr66DugUQ?= =?us-ascii?Q?E8lHwADi0eNqlmzQKe8+Z4teo5K7OfYaAZzP8nHmETvE+Z8hw6RDQqj1hOEx?= =?us-ascii?Q?yyvquPPbASl2MqJTu0KXQSnYOQJj95bpK0M8grI3DgzTo3rgFi0qlQ//GIS3?= =?us-ascii?Q?+EipiGYKTzddNT4Fm/8QaUEqhOQSTQIHWcaEI7vNF4z0Cand8s2Q7OYuG0Qn?= =?us-ascii?Q?eC/8fYfRhEV0f8I90XjZZ7xTrR0H4KtFKDAObqF8A9Gu9SnWMauz3AwlYfqX?= =?us-ascii?Q?9s3BTsIpxS04gyoQau9lWAJ/UPntvBemjn9CKtUsoHp1cGiEnUJAINM2XM1o?= =?us-ascii?Q?X2MBfPhKG0U/RFO+jT89SYfwsGv39ap4uMIySWwVTv2hB4s68SZv7bIMh1Y2?= =?us-ascii?Q?ylqPmSlUx1ylw/whWofNMg7u9mhgygi67iFq/VZ15NURgPbjjeWzixdqogHR?= =?us-ascii?Q?CWvTyE0lwnIkcNXphZBM8WLg07ypEGd4dfQ6a98HINAFxv/2MeKQY4cdVHe8?= =?us-ascii?Q?vb3k/KcpboH7w5tZ6xjaKgNMSOm2uF1Ag1T0rD6hTICno51Ui+YAFZVZp+8f?= =?us-ascii?Q?UcO9CUG6KUsy3plAwlMD5nUz3p8oCsA00ncPACTIEBHR7Zvhm/LevTG80Iod?= =?us-ascii?Q?prgKPMhdFwwdVJoDSOahXx+nECg7wzm0VjBe6zaZSC7LXSg72EXT5rmn+aF7?= =?us-ascii?Q?0h1pKzdAP5t9kraLODKhFSEPj8U8sk9zs4lVLqB8LEnQM+0zXiq6s4iPKysU?= =?us-ascii?Q?ygrUJSg6JhzKDNmPae+Xv3lxNugJFe6Tk0LWNa40msBGbg1myulwUJuI+vhx?= =?us-ascii?Q?/n90Y4gLuZRhJpBljK/o4T9pfJt1k?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 6:NQvOPDH5R2JcHnTQV8Gs7qjwbJtODlo+b1b9R4SLkBg5udIaqS3nKlV3xjaZxXk+/XS2xFXEtXVi1J7zQhWIpna3H74Z70Mv/03eyyIJDv5ioyxdxokYVWqnQFQX6URzhgxempXIVHu7W9wrXFvXQgDBBJdbV7lkrg6k1ukhPD/5Bz0oCOfzDtx3mTo3nX8KcDv+LO9N0wNLXCrufaZ0NDlU2ROXyVAf54UUtgdqhSnTuyMzw8htYvM0EBgThwhNPKZonudY7zoOXpHpHdourz2xgzeBQivXKCc2AjoOBS8WwnSbskgXZOtOecIWTQZbHUU61Ruuj1Ov7GFqYKxdjG5Rdk37y7r79TctbaliLVDo86BrAB3Bkb08112yL57UniJa1zyuT2ZfItsEwjLtVw==; 5:1oSvxbumC5HxCzLuDEwfbjNSskakMeA8/9RE4v5JKzNpJfGMyQmElYflorQgD8NZfe6f7Iqj8fvQiFSH1XYBXFOM2buhTPqfDGc/xr1votU9ELM+lA5XP4hBFj6eMDqicDRG6YkYo8RUz8yJyeBNRg==; 24:EdGEkasLV7prPaVQAintXS7FyWINM/MWaVv3L3oWe8wT+6thA1UcLihZTht4UuhJRlQRggft/1RUoes163e8iAHg8V1akafAz37xPlQOgbA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 7:W9scIUQ/AiSxcRou6mh0lJZ11wK8t0nVwUn2OWvRT0RZldSyWYPYUKIrYOSRHumrGae4/vjrEft974OGJlhZ2ZL9sxHjbOvaioz0/0eaa/II4VG1s5yFaXW15/BQPyuZdZiA3DV+RlGufhHnAkkItYoTPuktbvg14GauCOptgwPmp95UESg5Nigh1vcmDbbFGZYiB4CJqrsfNMSKVIRApDXesJBDW4enP2u9AXixlRHssihwIvyNg/jIMc+y6VFKa5MCznxHXnSt6r5F6uHq46XW41QvMyC7STnnMXIcmIR46T9pAr8tipWpIxPAohAVVeJRdNeEzrXsFwp614ZUFA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2017 12:22:46.6349 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 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: Fri, 17 Mar 2017 12:22:50 -0000 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 > > --- > > 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 >