From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0065.outbound.protection.outlook.com [104.47.34.65]) by dpdk.org (Postfix) with ESMTP id D2B411396 for ; Wed, 22 Mar 2017 18:18:08 +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=WByl+l1hl34K8evbf25xvyxx2KQmPjbyfuoKY0UAlmM=; b=ReqetBTl+I3/pWmmcc2pffF54YEueURPkktC8ipd0joDj1cnjyOvS1fo565cMJpaMlCKSdnqu75tAslTMEwZlD5k/WdJmRaLrM/OneAxELcEgTjM4CpbAG48aYTW+dsY+0uzqFzPo3smAlyvIRSWaQA/3vSnxZ0L93tMpB+HWhU= 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.189) 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.977.11; Wed, 22 Mar 2017 17:18:03 +0000 Date: Wed, 22 Mar 2017 22:47:46 +0530 From: Jerin Jacob To: Gage Eads Cc: dev@dpdk.org, bruce.richardson@intel.com, hemant.agrawal@nxp.com, harry.van.haaren@intel.com, nipun.gupta@nxp.com Message-ID: <20170322171744.qefio7e6463vjbim@localhost.localdomain> References: <1489762288-4710-1-git-send-email-gage.eads@intel.com> <1490194680-25484-1-git-send-email-gage.eads@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490194680-25484-1-git-send-email-gage.eads@intel.com> User-Agent: NeoMutt/20170306 (1.8.0) X-Originating-IP: [122.167.124.189] X-ClientProxiedBy: MAXPR01CA0063.INDPRD01.PROD.OUTLOOK.COM (10.164.146.163) To BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) X-MS-Office365-Filtering-Correlation-Id: ef474ea5-b696-4128-f597-08d47147680b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 3:KVBuMr1tr3Lmwa4dudXHq9ABQ+pqCKzXgPWBNpso2xpYYoZVixzFsNiouGeHv8JLyCJCeVvj6zTzGqE0FC2D+MvhTEEHk4TagJPLrXiR4iEJ7624YeeO80HD1KX5YTXCbcXf5xfPGhwwK8zVtjI0kCbbG6237rLE38pWNTrzq34bAWvKKQvg/hlJw8c6QRuPHOa6EqidPvtT/jcrXsO2KqlvPwHhn+R9QNyO5yxyDpiYO5owKAb+x/1q7UIhZmmwU9jHBCFz8HSZMik4JZikRw==; 25:uE9hRiP5t9Bn16OwwN3/wbi+0TNzenKWIOTtDGynGxQfJ60m7NzNNO5o4ygAVpBlUDcGP+YFfcsQ/mh5HUWP4E/rbWxeDvQ7o25Hdl8picaAFGVODj+zRRXN/lm2T+Sa4nI0t+sUPdiyFxAjAJI2KgK8MVTO7z2WNyidvMHpVLhafm3V20tX88Blp2zlhPA/9w337ApLkjRZekeMIx5ycxzGt0yoNUfBesTGKg1s5ct47s7qn+vlxd0e4Z4lOqzQYtfeEaaIrLhu3/NRGbSTG8sIr0k/SU6cGqXV7BfrsSqzJIjZwf3J7ztnKrp3ylEmQLjng77PTNlOVkfV1roz/qLM2r2qTKPYcRQAAJ1+d+p4fuLLXbmTKyD1RPCB0xuDmA85oPLBH8knGnyHmzkehUaTrHTH/WFTc5qJJmf7YO7ir0pWC0A6O3cI17fE7mvrBvxyPFAMr7QcRFPsMiuYGw== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 31:0pqBlvM67lIreV2lBk4k5NpvavQXH6EzLjpZRqQMiS7J5UP+xjCnZq8Y8oTLbu3kNLAl/WaL99i2Pc02bxVUT92Vih7wp+9Hu0iRyPag38aNwOeqzPrXYff3jIiuE+WE4Zgyeoh+oN4AP3+reeUoJvJ0scX1LllTLM78ghMbKYkx/uHHpB1JFqASGN/aJwbWDBnuEzT7NMRJyq3zeuJ++CMfpKvbetB/FiGqoFKL9+Oky7J0z8214B5NP92v2fPKP5fYyEPdXWi2gCaUz2yAx4djpjCoqe9i+oAaEvlk1Xo=; 20:z3rJAVL8GczrP+5xda3hY7qpyt7pHTlugxO5FY1FkTx7cZF6bLUQSzs9mBm3KcoG07KRBXtn52gifPSRZ9o74tjjXtYirW0DOJdTu6zhynQlkA+7dlOIS3OeDavBa83B5SGlugJ7eZHIDIt22iyFGe45rXCq4vI9gVlxNIXeiDd+gPWFV7Z+BceXdZTYlarnmNWnqHTy5RYiAHjP5ScP7xJCiTjBhUHIwnP4G0/E8CTueJatT0G6+Tr6+62HA5le0JiYF5xZ4Th5qNG3LDj4v/Q/ku4vNvApNG2Jq7MIdYwskiAll9aG+lc0I8SWxirCjR/ffjjpQh3QVu37wz1tOB/Lc1eC4TavgmOlOXnvQB+GXKYTAMX7B1I+BgmoDiyt21pEDrmjIaIHzKwGlWqTnVrmVv60EV2B9NCowaZD1AXrv8SU+NsIYm7hJ+erYzNUoEZ0h8wzr+1J+/qiVRhAq73o9CGUOxutEPvzQ9vIGc5qhRIXT97MXCgH8ilAnSlX/DESevK7N4oV25xwxAouqTIMzCrmkpRizGE/WXFbNZFN97pxrSMD4DsacIkC3hkkkto/yvdLMnhDAI01CgGx1KdI2geNXKM9rNn+ZMcoZ+U= 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)(20161123558025)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(6072148); SRVR:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:l6a9TP2En/8Dxr59sSCWwZTDHcDXxiZALczbRFzoEtqiUPID/aDjSfDmvm/LlS2dx8OJWlyXT0BFuN7moZoHvVeH/RvtnNeZJztldxySmSwEqrWaki8GGWptpNx2YI1SpM0dXSbrSa/BbR6M2uf302vxHfSTv5mtXAV6ulZog40SRPBXFrCg4TIgY4Ic6iG2KVgHB6e0cG4W/hO4CPJ2rsEBmnR5UAeCPJUVv7Cv9DzJZbHdSwoAU1Oowxm7RCqBONhnGZxV1QmY6H8LCDBVynqZKqhuhs1CA3adTJhfa4LW9SiZ/hpEtEjNcX62TsgIK03+FH9kPDwDTLAnGnH4nBRPo3tf1UCA6au4jbGf1nUN4F4eW5sTOwLBakXK8ZHqFCeWpnoldfUM1qiJJm2WhyXwf+cWLcN/7buSKJsxIoVQdZLSytQgC5EEpbZXDxVtoyhcx4nuqbWxBc0a0kmh9OXgJTIuNuxOVqKHC6KOEcw8w1wdH5eo/eX7TA/VOAha74en+fkWx21CUJqqYEMKD26LZzTxbrLFjfZHP+G8/vAqeqiSdvtGO2hX2rxrPq+3JSzMTZ4T5QQfv7kYhuzeNChNWcnzaoUYNar3fOOtgeQ9K3o7fC86334bOqTd5plNfEPNTylfG61ksUncRd/NHg== X-Forefront-PRVS: 02543CD7CD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39410400002)(39450400003)(39830400002)(24454002)(43544003)(2950100002)(6666003)(189998001)(9686003)(8656002)(53936002)(6116002)(6916009)(55016002)(42882006)(50466002)(5890100001)(81166006)(8676002)(6506006)(23726003)(3846002)(76176999)(1076002)(61506002)(4326008)(42186005)(47776003)(66066001)(4001350100001)(7736002)(38730400002)(5660300001)(110136004)(6246003)(2906002)(33646002)(25786009)(50986999)(54356999)(305945005)(229853002); 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:0CEz2z8Orwt3rtvm1S0jEKcdHMB1M/Xa0mevXIi?= =?us-ascii?Q?cmoK4Sm30hiO7Ls6Az9gLUIWm+JGdBUKh0l+75tF0nbzNlMWewf2IOLTErgZ?= =?us-ascii?Q?tAMcJkAiT1dMKZgPtJmBh1kjzLR3gjqn8BNjSO7C7GnlEA2ZBJacGj5FUhae?= =?us-ascii?Q?PVQBDZq6edY52MCNKbql9peYsnvNZiKctG/YVecVfjhyVK7onGv/znh4Yfog?= =?us-ascii?Q?Ecree2WiF67aTeUiN5Pk2gqI6AYF/u8TjvqBS3q9RWRY1/n4MyLro8H+y1GC?= =?us-ascii?Q?/iIUh++Oej7y0OE9nEUrBxQnrNx1pPi2UvK7zNeJIWuH1eFlxaJaapjnXOo/?= =?us-ascii?Q?PEVMbse+TUdybOtIfSyv3L/riseqKbR1iEGF1eZpYdKvagwK/QRvW6CtFxl3?= =?us-ascii?Q?44Ct4Y6dJp5Fq1KKkPg/vQCMPPnlBnJLUKMMdyCXzH8H3C3jqHRmFGgBS3+p?= =?us-ascii?Q?hXUK6q0PDz5hq/WJ6KVOLejR2lkW22rFgy+hWZatuGZfCVvacvRE59YMGMFk?= =?us-ascii?Q?VlSU5FOMfQo5hZyKeXEib+gsIODXz8wWSbpbPZLuM15hZrXlfvawmmOIRgTz?= =?us-ascii?Q?pYiFJsxJGQAB9g9obYCOLkz6kyACr3WaZ8RKaErQTiGl6FCnHeAFCDoXtUF9?= =?us-ascii?Q?H3wWtd7Cr6o3Moed0dtTxdymZZ8Ihs9ogcGdjvGfk123Rggt/d0jmtLy35r2?= =?us-ascii?Q?OV1XxwPK/9iHTWEqR1aRVprRSKqN5omOfXMDxNlNaclAc/15MOE8yjLEbBUs?= =?us-ascii?Q?jh/QqZgvcak1grCzaYvnBIUaW31ifL/3dbP6zX735xL9XLqnceA8P/WPZZfC?= =?us-ascii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P+mhEskMcdY0f5eVX7czJxfv5W+kvLyYYAMLtY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 7:blDAiKB942Sv4oOEtv+TWlLicrugHYBYzGw9sabpJ5RPqAGvbZTj4UmBeF34gxqofwijsiWUYL9EvG4HBF5DmRrKgTb3R53MmKSprwrgt5unKJqrG+KcvSC/nxQ1Lar8Zh8g9bePT3n97dNhXU2vdOy/hKEkfZYcNN6dxOkGdNrMt7ADLy/Ek6pA/7taNnMhQPZmvt/OxccUDNymT0Jy8KcXbYK28gEBr96FzkqexxJFRuPwncnCTgxITlsH2IkGTaL2HqkmkOUMEpPtomPRjR6gHvS4qpG3eEPFc5TnvK2wF2qoFbxGagT1T3bNoMpVJw1s5AHsyFhz7j7Zi0sO7A== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2017 17:18:03.9687 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 Subject: Re: [dpdk-dev] [PATCH v5] eventdev: add errno-style return values 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: Wed, 22 Mar 2017 17:18:10 -0000 On Wed, Mar 22, 2017 at 09:58:00AM -0500, Gage Eads wrote: > From: "Eads, Gage" > > This commit adds rte_errno return values to rte_event_enqueue_burst() and > rte_event_dequeue_burst(). > > These return values allows user software to differentiate between an > invalid argument (such as an invalid queue_id or sched_type in an enqueued > event) and backpressure from the event device. > > The port and device ID checks are placed in RTE_LIBRTE_EVENTDEV_DEBUG > header guards to avoid the performance hit in non-debug execution. > > Signed-off-by: Gage Eads > --- > Changes for v2: > - Remove rte_errno initialization > Changes for v3: > - Fix checkpatch and check-git-log.sh errors > Changes for v4: > - v3 was incorrectly based on v1, v4 is instead based on v2's changes > Changes for v5: > - Clarify -ENOSPC description and fix compilation errors > > lib/librte_eventdev/rte_eventdev.h | 37 ++++++++++++++++++++++++++++++++++--- > 1 file changed, 34 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h > index 2b30a35..b450622 100644 > --- a/lib/librte_eventdev/rte_eventdev.h > +++ b/lib/librte_eventdev/rte_eventdev.h > @@ -245,6 +245,7 @@ extern "C" { > > #include > #include > +#include > > struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */ > > @@ -1118,9 +1119,15 @@ rte_event_schedule(uint8_t dev_id) > * The number of event objects actually enqueued on the event device. The > * return value can be less than the value of the *nb_events* parameter when > * the event devices queue is full or if invalid parameters are specified in a > - * *rte_event*. If return value is less than *nb_events*, the remaining events > - * at the end of ev[] are not consumed,and the caller has to take care of them > - * > + * *rte_event*. If the return value is less than *nb_events*, the remaining > + * events at the end of ev[] are not consumed and the caller has to take care > + * of them, and rte_errno is set accordingly. Possible errno values include: > + * -(-EINVAL) The port ID is invalid, device ID is invalid, an event's queue > + * ID is invalid, or an event's sched type doesn't match the > + * capabilities of the destination queue. > + * -(-ENOSPC) The event port was backpressured and unable to enqueue > + * one or more events. This error code is only applicable to > + * closed systems. EINVAL and ENOSPC section is not rendering correctly in HTML doc. Please find below the fix. You can use "make doc-api-html" command to verify the HTML rendering. - * -(-EINVAL) The port ID is invalid, device ID is invalid, an event's queue + * - -EINVAL The port ID is invalid, device ID is invalid, an event's queue - * -(-ENOSPC) The event port was backpressured and unable to enqueue + * - -ENOSPC The event port was backpressured and unable to enqueue > * @see rte_event_port_enqueue_depth() > */ > static inline uint16_t > @@ -1129,6 +1136,18 @@ rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id, > { > struct rte_eventdev *dev = &rte_eventdevs[dev_id]; > > +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG > + if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) { Just to make .attached in sync with implementation, may we can we move RTE_EVENTDEV_DETACHED and RTE_EVENTDEV_ATTACHED to rte_eventdev.h. No strong opinion on this. diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h index b450622..a6ba89b 100644 --- a/lib/librte_eventdev/rte_eventdev.h +++ b/lib/librte_eventdev/rte_eventdev.h @@ -1066,6 +1066,8 @@ struct rte_eventdev { /**< Driver for this device */ RTE_STD_C11 +#define RTE_EVENTDEV_DETACHED (0) +#define RTE_EVENTDEV_ATTACHED (1) uint8_t attached : 1; With proposed documentation changes, Acked-by: Jerin Jacob > + return 0; > + } > + > + if (port_id >= dev->data->nb_ports) { > + rte_errno = -EINVAL; > + return 0; > + } > +#endif > + > /* > * Allow zero cost non burst mode routine invocation if application > * requests nb_events as const one > @@ -1239,6 +1258,18 @@ rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[], > { > struct rte_eventdev *dev = &rte_eventdevs[dev_id]; > > +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG > + if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) { > + rte_errno = -EINVAL; > + return 0; > + } > + > + if (port_id >= dev->data->nb_ports) { > + rte_errno = -EINVAL; > + return 0; > + } > +#endif > + > /* > * Allow zero cost non burst mode routine invocation if application > * requests nb_events as const one > -- > 2.7.4 >