From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eads, Gage" Subject: Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions Date: Wed, 15 Feb 2017 00:14:00 +0000 Message-ID: <9184057F7FC11744A2107296B6B8EB1E01E66C0C@FMSMSX108.amr.corp.intel.com> References: <1486760541-12568-1-git-send-email-gage.eads@intel.com> <20170214041009.GB6091@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "Richardson, Bruce" , "hemant.agrawal@nxp.com" , "Van Haaren, Harry" , "nipun.gupta@nxp.com" To: Jerin Jacob Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 99DC6A2F for ; Wed, 15 Feb 2017 01:14:03 +0100 (CET) In-Reply-To: <20170214041009.GB6091@localhost.localdomain> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Monday, February 13, 2017 10:10 PM > To: Eads, Gage > Cc: dev@dpdk.org; Richardson, Bruce ; > hemant.agrawal@nxp.com; Van Haaren, Harry ; > nipun.gupta@nxp.com > Subject: Re: [PATCH] eventdev: Add rte_errno return values to the enqueu= e and > dequeue functions > =20 > 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 =3D &rte_eventdevs[dev_id]; > > > > + rte_errno =3D 0; > =20 > 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 Agreed -- if we encounter an error we should set rte_errno, otherwise the r= eturn value will equal nb_events and the user shouldn't check it. Will fix in v2. > =20 > > +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG > > + if (rte_eventdevs[dev_id].attached =3D=3D RTE_EVENTDEV_DETACHED) { > > + RTE_EDEV_LOG_DEBUG("Invalid dev_id=3D%d\n", dev_id); > > + rte_errno =3D -EINVAL; > > + return 0; > > + } > > + > > + if (port_id >=3D dev->data->nb_ports) { > > + RTE_EDEV_LOG_DEBUG("Invalid port_id=3D%d\n", port_id); > > + rte_errno =3D -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 =3D &rte_eventdevs[dev_id]; > > > > +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG > > + rte_errno =3D 0; > > + if (rte_eventdevs[dev_id].attached =3D=3D RTE_EVENTDEV_DETACHED) { > > + RTE_EDEV_LOG_DEBUG("Invalid dev_id=3D%d\n", dev_id); > > + rte_errno =3D -EINVAL; > > + return 0; > > + } > > + > > + if (port_id >=3D dev->data->nb_ports) { > > + RTE_EDEV_LOG_DEBUG("Invalid port_id=3D%d\n", port_id); > > + rte_errno =3D -EINVAL; > > + return 0; > > + } > > +#endif > > + > > /* > > * Allow zero cost non burst mode routine invocation if application > > * requests nb_events as const one > > -- > > 2.7.4 > >