From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions Date: Tue, 14 Feb 2017 09:40:10 +0530 Message-ID: <20170214041009.GB6091@localhost.localdomain> References: <1486760541-12568-1-git-send-email-gage.eads@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, bruce.richardson@intel.com, hemant.agrawal@nxp.com, harry.van.haaren@intel.com, nipun.gupta@nxp.com To: Gage Eads Return-path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0064.outbound.protection.outlook.com [104.47.38.64]) by dpdk.org (Postfix) with ESMTP id CC23BA2F for ; Tue, 14 Feb 2017 05:10:32 +0100 (CET) Content-Disposition: inline In-Reply-To: <1486760541-12568-1-git-send-email-gage.eads@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Feb 10, 2017 at 03:02:21PM -0600, Gage Eads wrote: > This change 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 > --- > static inline uint16_t > @@ -1127,6 +1133,21 @@ rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id, > { > struct rte_eventdev *dev = &rte_eventdevs[dev_id]; > > + rte_errno = 0; I don't think it is required. If at all required, move this under RTE_LIBRTE_EVENTDEV_DEBUG to save store to rte_errno cycles on fastpath > +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG > + if (rte_eventdevs[dev_id].attached == RTE_EVENTDEV_DETACHED) { > + RTE_EDEV_LOG_DEBUG("Invalid dev_id=%d\n", dev_id); > + rte_errno = -EINVAL; > + return 0; > + } > + > + if (port_id >= dev->data->nb_ports) { > + RTE_EDEV_LOG_DEBUG("Invalid port_id=%d\n", port_id); > + rte_errno = -EINVAL; > + return 0; > + } > +#endif > + > /* > * Allow zero cost non burst mode routine invocation if application > * requests nb_events as const one > @@ -1235,6 +1256,21 @@ 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 > + rte_errno = 0; > + if (rte_eventdevs[dev_id].attached == RTE_EVENTDEV_DETACHED) { > + RTE_EDEV_LOG_DEBUG("Invalid dev_id=%d\n", dev_id); > + rte_errno = -EINVAL; > + return 0; > + } > + > + if (port_id >= dev->data->nb_ports) { > + RTE_EDEV_LOG_DEBUG("Invalid port_id=%d\n", port_id); > + 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 >