From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0076.outbound.protection.outlook.com [104.47.34.76]) by dpdk.org (Postfix) with ESMTP id A2D65106A for ; Sat, 21 Jan 2017 20:00:16 +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=vMbtRoNtSVsiuOtKYlWpt87fcsSuwDoJy5H6469iyaE=; b=WY+SYmbpBdacpSzpNMyDFfBwu/PYDUTMX22/yP1jQxCYMjnlOF9+DR1NDdCmqg8TJSbqqohuEc6rL++b/CD2mEfmtnEpdAzAxtpGS82NojD5j6uDa9L28XPFZTJOXYJyMRc5iTe5ybxL3Gn+c3QOKHa97oyDIlgR/KR0Nv5w6Kw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain (122.171.62.83) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Sat, 21 Jan 2017 19:00:11 +0000 Date: Sun, 22 Jan 2017 00:29:53 +0530 From: Jerin Jacob To: Harry van Haaren CC: , Bruce Richardson Message-ID: <20170121185951.GB13156@localhost.localdomain> References: <1484581255-148720-1-git-send-email-harry.van.haaren@intel.com> <1484581255-148720-3-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: <1484581255-148720-3-git-send-email-harry.van.haaren@intel.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Originating-IP: [122.171.62.83] X-ClientProxiedBy: PN1PR01CA0094.INDPRD01.PROD.OUTLOOK.COM (10.174.144.162) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: 14ccf66f-9d23-4698-47a5-08d4422fbb2e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:kBs27s+jnHOEzRYmKWx5nTOyT3dBLx4TPayqs0PvDdW0TU+qvNtL5x7wHn4/YpMTV/sV6p/04nxsFKK+ME0jzHVHC7jgs3aoEbQZFu/HBAM26BckmwuMtEF1iB4Rfi77ZeTmA0GfGR24UGzepme1NxHz3u8g9pH7ztr1NRJvyqLxyfyfqOpSaTFlbiheGAhLy1T5fsxY0d5J+ven+pTcg1Nta6IZQsF9h3WH1HnNS6eNV8qoYmHlMXMbKJyAd53e1sEkxjMiBkNGMJfB4HM2aA==; 25:wQl/pynQeeishKJsaK4TboZoXUcFuWQAsfXt90r5V+6ri5dIpo8eRl0sgbOq2dF9dJ3Q0KUyZZaS0gRMyVU6PJHX2QmDJeC4NIq3IRRvnFFh63ZlnZHYe5mR+/gdKsUWLbPKsnxmKLIErOCjYjS89ZkDJhv8by4Eh1jGZymZAfNKR8O5VUbo3i2Mag5k0oRh9mN3lZ8c9k8fatf6/4DgUjTfSUoxfwqLgAUnszNkdlVxvTjHCqhCNxTxzDzfCvGWN+QFy7JoMVOWHLfIQbp9e52rrfa/qXpicss2ZS9fO9BmugAf/83ILaLENhGtxfT6lY3ob6bh8qjwdK2Ch8b2SRGfJ/oQj45D+VxtoVvf0YsQH+X8J5wBYaeoPt5n1/wcFghrW6OugEdwqzJUAZL5GZID6yTvvOjImVR19HIog2jleuscdv364dmCUK6u8RTgeguhNMjRlXZ6T8et72BqKA== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:qFrdFsWyTk0wCI5C4+q9s6aEQ+niSQ37Hu51i/8QQTgx6mLkpSfFQ4Jvd9K6mm8k86f+E2qBT595eqJBFMFh2c/04vS4l0CCrdg+wyS1UUucnx5Meq7XCy+6IUUjDQNaZF6VjNRMj/qhkkm4FyvzGxRXzyxzSzIPUMVSQBsWshFNwF/KMA7/fOVsm/WNPK8BaTkmKn/Xp382tZZ6vuLu2t/fz+KePb2sCHBfjH2Pj4S01tMfYas0jFENtp+u8sz9bZ5TaAs5SFVMSwGkYe+CFl/4M22JbmINEmCQgePaf1w=; 20:DZhslxUygwoZgj7beVMJuPPMf9RqZiIsT4n4LmA7C+f2X6Rr54uctvV4ArJVqU7B9VrEy4oL0Wnab9bg15tyO5yHv97z6sg3GFdyCV2kKWxxgf8sr+MetiY6Z6JZ8+zNwkRV46sGeQcGbY1LY7TI8AAMUgFYEBUy78Scclq4/VwA7sOSC8waDvhJI6JqsgAPVn0hH26QOGyLUhxkI7F46SY0yVxHJe2+kNfE66Hd/Ht+nPlpYlTZGCcv8qjkSC0b1k81BrtokGyLDVt/WbtcKQwZeOnTEwSlGr207wbEKITW7qGTi7L4ZuQ3j/uJtOWENGm5gsr7H3yS7ArJ94HJVSkCvZZlM7CeEKDvahmzLomt8r37lboMcrJTgqU/JuI6SNmUBcqmA61oRZ5tPxd0R7uk3wleATSDlgaNg0D+ESYnW8FVQPT6/z9S6Th5iDPqSZ0lxII3W2B5ueT+3OcYHKUTPh6RAFp+Hkl1Una2+nyBgpce+BoCSuL19M5JbNgrqvmOKBi1gUEPQ968dyiJt5pdx4s1Sd/Znt1ACJYf4LRGC5NW2jfXp23AW74CFXbCFiAnyeF6vtYJZkCuT5HJxQDHBQwqS/z3TgQJzOd0pl8= 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)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(6072148); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:yTXpFMVnrwuZ4FOgItNfTr9mV429k4HE/IUfKr8Jk7E+F1VK0MxtmSUz/EpmD+l01iOWidP4k9QdaZBuD2nJaXGtLBiq82QnfDdX/FV1Il4ilQuWUvxztZSLOo9AT3p5ZfKsZr88rG4swerawT5+DTcOkk+0PD3Ds6T9ArHsmlKLEdPkj8/p6jDIwwzE50G1i2Vbo+g2GXV82FlcgzBe9UmwDOQxRFQhNhg9ECpKucuctfu5F/pCCQGR9uMY48gKev00NCWUHwSulu3NQzGwcCZlZtqPXOY/4+jSH7kYsEW9I3jTxqMBXKqGgh0JUcNSWBntDGpg0c3h9OU54Ap3KsIyl/ytSe9Pn8pTJ805/VOAYcMoLwrNnthSENPXiExq0UBJKRPfDVeeRcRmVYpjMLXcq3PCgjR6f/P8Q/7jWWS1nDndb2HBCWQZ3zKiSrCWlll1rOyYUWblX7yrnDfhmbCA4PPwvXHaH7aaLA+epwIJa07+RAalsgmUC+rVmg8i0DJpVFg3yxooNFAd6HGB+bbbtnFeckDDEpE/uH/YSmm+YrqO7S93xEyPONzi1exg71jV07d147uFAHh5LS3MVvUGUBtkPmOSns5huax/CAvEc8kbXIHdIDQjEzj+MXfo X-Forefront-PRVS: 01949FE337 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(189002)(24454002)(199003)(229853002)(6916009)(110136003)(6666003)(68736007)(92566002)(47776003)(2906002)(4326007)(5660300001)(8676002)(23726003)(305945005)(42882006)(2950100002)(7736002)(53936002)(6116002)(81156014)(1076002)(3846002)(81166006)(42186005)(46406003)(25786008)(9686003)(55016002)(54906002)(105586002)(76176999)(54356999)(50986999)(106356001)(50466002)(6506006)(189998001)(101416001)(66066001)(38730400001)(61506002)(4001350100001)(97736004)(33656002)(83506001)(97756001)(18370500001)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 23:jZjmKYmgKhzrBe5Iu9dKmdE09OSPSujqT8hrIoc?= =?us-ascii?Q?i669cD9GRRif+XWVtX0MoYkDYB6mp944KWI8TkO4tRKlYNN8/OCcEZvTuoUm?= =?us-ascii?Q?+mhpeBTGtUvWwgydwfFZPbiAadkZaCMoOUq46oGN7pS13SFfTGLM6g/lL1Z1?= =?us-ascii?Q?Bw8L4T+OUAHyi9SdDtRIvq2wNt0+ptPzQNi6qmrkqCsLucqwKDSYX6ca3YBi?= =?us-ascii?Q?BCl5fcgui81/4Ne4zWvDK9qUfqgR+cE2G5RFDrKyrf3UAWXBD4gllTPCRPx8?= =?us-ascii?Q?LbrAcRZ2gdo2X7wrgyld3YgOydf6u3ddx36TbJsM7SLKF6LJWLTaur6pxnB2?= =?us-ascii?Q?KkBQPxaPLrvIU7WZQbV1sdeEQh378fhtp7F/oQQGO4Sg/bhDwWJDF9sXEpKN?= =?us-ascii?Q?LrhzJWF/W6Wlmdlb1MDhgJUSAw8yqZ/3tjN9HES8Jzfz/7vU7dN4IpfJ2uRH?= =?us-ascii?Q?RYhayi8/ykdaDCGFmWwuePEidLWDAtNEe41q8p9hGaw5ROL/U6Ts+6Zqmoyu?= =?us-ascii?Q?agAm7ldDDdDfuAudcgVP6zYy0mVJGXMPmj+nU2c1huMEuX2iCQSo3mzpeHiZ?= =?us-ascii?Q?vAHBC3ZC41K0vKGfOmVa4qrjiB0mCn6CmFAE0FXMh3GMFUd+4do0CErM2F7B?= =?us-ascii?Q?ouHO4Zi3tJh71QF8qahzeWkCPRMviS83n69Dwt2n8/Y06oxBDsDPnSOuUutl?= =?us-ascii?Q?si6JCK/VL4yuBU17xBJSuU1GMiEy0woqmwdRRouBDVBLsCSFbOYGktg/PRRf?= =?us-ascii?Q?106JhxplldoSfk9Sr9DnxG6O+t0x2SRHlmPC62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/+gl2rsx/vAM90MMNwCkqqCdpcy5+/baPOHj5ljvH6tFdw=; 5:c9+rD2Pud1Je9X/CaliDcuotJdD2NEWNRhpZMZB/qTYYSVa6jrCbkJWduz8W+tNDrq+gPJk4cwtCPUYO87QwANDXatDZ0i0BdqsiWNyFoVYhRmtS2qIl6+6wxeFCAiqcpyMbOZfCGES5h/3WQb8crw==; 24:dtfaLTGwQIpzUY1/kA9B3xel6tBSaL9MoIi9ruLV421H/t5RLaXWkEKI0mbbX3e9eYviz2qe9+GQK2FVfCLwLRbFlj36cCE0yME1fqpyVDA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:fJrkImb+32C7yuwR+lBRze129JLvxHpV+byxva3+rTXqqL6TqJ9OnkmVOiBLZssPOKfO8qvThlCBn6blu9Zkksx1b7HlolTMPXZqlcRE10fGPrHP6ILAX/cvtwpQIw/PoYGL4bYaivcVAqZOrT5LRxvAzNXcLnsYBQvZ0ctcfgsWwUITP1vcMMaMsUkJGvZaVuuxDlEAKJT0HnAeMZb+ksnqihhR36ocIZvCIWRXewDYX543p3/EXRKq+INrSQB6PNdPpaWWMpcaKmEaqrbZ6n7WUHaUWfKTPIeUkYiI7jmAqAXwTS1xCaj4ODzmsfqZ4oz/UC34osi1cyFQJ89t73g+hzungX+tmO01uELi6/Nu9PsMlEjfpGWgcQz9FbYaw6Zu7Jz7OUpsOlpfua5bP+Mp8DGa35tP2TbQ6e4UxnZgngUdO/J7Z6Sm4vOUDomA3dvnU/bpXtsiDj/Y6/cPdw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2017 19:00:11.9925 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: Re: [dpdk-dev] [PATCH 02/15] 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: Sat, 21 Jan 2017 19:00:17 -0000 On Mon, Jan 16, 2017 at 03:40:42PM +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. Overall the xstat API looks good. I think, we need to extend the API to support event port and event queue specific xstats too. > > Signed-off-by: Bruce Richardson > Signed-off-by: Harry van Haaren > --- > lib/librte_eventdev/rte_eventdev.c | 64 ++++++++++++++++++++++++ > lib/librte_eventdev/rte_eventdev.h | 75 ++++++++++++++++++++++++++++ > lib/librte_eventdev/rte_eventdev_pmd.h | 58 +++++++++++++++++++++ > lib/librte_eventdev/rte_eventdev_version.map | 3 ++ > 4 files changed, 200 insertions(+) > > + > +uint64_t > +rte_event_dev_get_xstat_by_name(uint8_t dev_id, const char *name, > + unsigned int *id) > +{ > + 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 */ > + > + RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, 0); > + > + /* implemented by driver */ > + if (dev->dev_ops->get_xstat_by_name != NULL) > + return (*dev->dev_ops->get_xstat_by_name)(dev, name, id); > + return 0; Shouldn't we return -1 as per API specification? > +} > + > 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 c2f9310..681cbfa 100644 > --- a/lib/librte_eventdev/rte_eventdev.h > +++ b/lib/librte_eventdev/rte_eventdev.h > @@ -1401,6 +1401,81 @@ 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_XSTAT_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_event_dev_xstat_name { > + char name[RTE_EVENT_DEV_XSTAT_NAME_SIZE]; > +}; > + > +/** > + * Retrieve names of extended statistics of an event device. > + * > + * @param dev_id > + * The identifier of the event device. > + * @param xstat_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 xstat_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 (invalid port id) How about updating the rte_errno also in the failure case? It may useful for application developer to have single check for error condition > + */ > +int > +rte_event_dev_get_xstat_names(uint8_t dev_id, > + struct rte_event_dev_xstat_name *xstat_names, > + unsigned int size); > + > +/** > + * Retrieve extended statistics of an event 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_event_dev_get_xstat_names(), or > + * by using rte_eventdev_get_xstat_by_name() > + * @param values Please add [out] to indicate it is a output parameter example: @param[out] values > + * The values for each stats request by ID. > + * @param n > + * The number of stats requested > + * @return > + * Number of stat entries filled into the values array > + */ > +int > +rte_event_dev_get_xstats(uint8_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 id Please add [out] to indicate it is output parameter > + * 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 The function prototype is rte_event_dev_get_xstats. Change the rte_eventdev_xstats_get to rte_event_dev_get_xstats in the above description The rest of the file is following rte_eventdev_xxx_xxx_get syntax for get functions. How about changing rte_eventdev_xxx_xxx_get syntax to maintain the consistency? > + * 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 > + * The stat value, or -1 if not found. > + */ > +uint64_t > +rte_event_dev_get_xstat_by_name(uint8_t dev_id, const char *name, unsigned int *id);