> -----Original Message-----
> From: Jerin Jacob [mailto:[email protected]]
> Sent: Monday, February 13, 2017 10:10 PM
> To: Eads, Gage <[email protected]>
> Cc: [email protected]; Richardson, Bruce <[email protected]>;
> [email protected]; Van Haaren, Harry <[email protected]>;
> [email protected]
> Subject: Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and
> dequeue functions
>
> 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 <[email protected]>
> > ---
> > 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
Agreed -- if we encounter an error we should set rte_errno, otherwise the
return value will equal nb_events and the user shouldn't check it.
Will fix in v2.
>
> > +#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
> >