All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions
@ 2017-02-10 21:02 Gage Eads
  2017-02-13 10:38 ` Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Gage Eads @ 2017-02-10 21:02 UTC (permalink / raw)
  To: dev
  Cc: jerin.jacob, bruce.richardson, hemant.agrawal, harry.van.haaren,
	nipun.gupta

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 <gage.eads@intel.com>
---
 lib/librte_eventdev/rte_eventdev.h | 42 +++++++++++++++++++++++++++++++++++---
 1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index c2f9310..ef21205 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -245,6 +245,7 @@ extern "C" {
 
 #include <rte_common.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
 
@@ -1116,9 +1117,14 @@ 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.
  * @see rte_event_port_enqueue_depth()
  */
 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;
+#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

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions
  2017-02-10 21:02 [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions Gage Eads
@ 2017-02-13 10:38 ` Bruce Richardson
  2017-02-13 11:48   ` Jerin Jacob
  2017-02-14  4:10 ` Jerin Jacob
  2017-02-15 17:09 ` [PATCH v2] " Gage Eads
  2 siblings, 1 reply; 22+ messages in thread
From: Bruce Richardson @ 2017-02-13 10:38 UTC (permalink / raw)
  To: Gage Eads; +Cc: dev, jerin.jacob, hemant.agrawal, harry.van.haaren, nipun.gupta

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 <gage.eads@intel.com>
> ---

Do we have some idea of the performance hit from these? It may be too
soon to know, given we don't have many drivers to test with, but if
there is no perf hit seen with the SW driver, I think we should look to
just always do this, rather than having it compile-time off. If it does
prove to be a performance problem we can look to #ifdef it out later.

/Bruce

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions
  2017-02-13 10:38 ` Bruce Richardson
@ 2017-02-13 11:48   ` Jerin Jacob
  2017-02-13 12:08     ` Bruce Richardson
  0 siblings, 1 reply; 22+ messages in thread
From: Jerin Jacob @ 2017-02-13 11:48 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Gage Eads, dev, hemant.agrawal, harry.van.haaren, nipun.gupta

On Mon, Feb 13, 2017 at 10:38:55AM +0000, Bruce Richardson wrote:
> 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 <gage.eads@intel.com>
> > ---
> 
> Do we have some idea of the performance hit from these? It may be too
> soon to know, given we don't have many drivers to test with, but if
> there is no perf hit seen with the SW driver, I think we should look to
> just always do this, rather than having it compile-time off. If it does

IMO, It is better put to under compile-time like ethdev. It is
difficult predict the performance regression on wide range of cores that DPDK
runs now. I think we need to add following additional checks based on
Gage header file change

1) Per event queue ID is valid or not?
2) Per event's sched type doesn't match the capabilities of the destination queue.


> prove to be a performance problem we can look to #ifdef it out later.
> 
> /Bruce

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions
  2017-02-13 11:48   ` Jerin Jacob
@ 2017-02-13 12:08     ` Bruce Richardson
  2017-02-13 16:05       ` Eads, Gage
  0 siblings, 1 reply; 22+ messages in thread
From: Bruce Richardson @ 2017-02-13 12:08 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Gage Eads, dev, hemant.agrawal, harry.van.haaren, nipun.gupta

On Mon, Feb 13, 2017 at 05:18:11PM +0530, Jerin Jacob wrote:
> On Mon, Feb 13, 2017 at 10:38:55AM +0000, Bruce Richardson wrote:
> > 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 <gage.eads@intel.com>
> > > ---
> > 
> > Do we have some idea of the performance hit from these? It may be too
> > soon to know, given we don't have many drivers to test with, but if
> > there is no perf hit seen with the SW driver, I think we should look to
> > just always do this, rather than having it compile-time off. If it does
> 
> IMO, It is better put to under compile-time like ethdev. It is
> difficult predict the performance regression on wide range of cores that DPDK
> runs now. I think we need to add following additional checks based on
> Gage header file change
> 
> 1) Per event queue ID is valid or not?
> 2) Per event's sched type doesn't match the capabilities of the destination queue.
> 

Ok, if we are expanding the number of checks then I definitely think it
needs to be compile-time selected.

/Bruce
> 
> > prove to be a performance problem we can look to #ifdef it out later.
> > 
> > /Bruce

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions
  2017-02-13 12:08     ` Bruce Richardson
@ 2017-02-13 16:05       ` Eads, Gage
  0 siblings, 0 replies; 22+ messages in thread
From: Eads, Gage @ 2017-02-13 16:05 UTC (permalink / raw)
  To: Richardson, Bruce, Jerin Jacob
  Cc: dev, hemant.agrawal, Van Haaren, Harry, nipun.gupta



>  -----Original Message-----
>  From: Richardson, Bruce
>  Sent: Monday, February 13, 2017 6:08 AM
>  To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>  Cc: Eads, Gage <gage.eads@intel.com>; dev@dpdk.org;
>  hemant.agrawal@nxp.com; Van Haaren, Harry <harry.van.haaren@intel.com>;
>  nipun.gupta@nxp.com
>  Subject: Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and
>  dequeue functions
>  
>  On Mon, Feb 13, 2017 at 05:18:11PM +0530, Jerin Jacob wrote:
>  > On Mon, Feb 13, 2017 at 10:38:55AM +0000, Bruce Richardson wrote:
>  > > 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 <gage.eads@intel.com>
>  > > > ---
>  > >
>  > > Do we have some idea of the performance hit from these? It may be
>  > > too soon to know, given we don't have many drivers to test with, but
>  > > if there is no perf hit seen with the SW driver, I think we should
>  > > look to just always do this, rather than having it compile-time off.
>  > > If it does
>  >
>  > IMO, It is better put to under compile-time like ethdev. It is
>  > difficult predict the performance regression on wide range of cores
>  > that DPDK runs now. I think we need to add following additional checks
>  > based on Gage header file change
>  >
>  > 1) Per event queue ID is valid or not?
>  > 2) Per event's sched type doesn't match the capabilities of the destination
>  queue.
>  >
>  
>  Ok, if we are expanding the number of checks then I definitely think it needs to
>  be compile-time selected.

My thinking is that, unlike checking the dev ID or port ID, per-event checks should be in the PMD itself since (presumably) it will loop over the events anyway. I also think it makes sense for the per-event error checking not to be compile-time selectable because a PMD needs to handle the invalid queue ID or sched_type case anyway.

>  
>  /Bruce
>  >
>  > > prove to be a performance problem we can look to #ifdef it out later.
>  > >
>  > > /Bruce

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions
  2017-02-10 21:02 [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions Gage Eads
  2017-02-13 10:38 ` Bruce Richardson
@ 2017-02-14  4:10 ` Jerin Jacob
  2017-02-15  0:14   ` Eads, Gage
  2017-02-15 17:09 ` [PATCH v2] " Gage Eads
  2 siblings, 1 reply; 22+ messages in thread
From: Jerin Jacob @ 2017-02-14  4:10 UTC (permalink / raw)
  To: Gage Eads
  Cc: dev, bruce.richardson, hemant.agrawal, harry.van.haaren, nipun.gupta

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 <gage.eads@intel.com>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions
  2017-02-14  4:10 ` Jerin Jacob
@ 2017-02-15  0:14   ` Eads, Gage
  0 siblings, 0 replies; 22+ messages in thread
From: Eads, Gage @ 2017-02-15  0:14 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: dev, Richardson, Bruce, hemant.agrawal, Van Haaren, Harry, nipun.gupta



>  -----Original Message-----
>  From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
>  Sent: Monday, February 13, 2017 10:10 PM
>  To: Eads, Gage <gage.eads@intel.com>
>  Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>;
>  hemant.agrawal@nxp.com; Van Haaren, Harry <harry.van.haaren@intel.com>;
>  nipun.gupta@nxp.com
>  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 <gage.eads@intel.com>
>  > ---
>  >  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
>  >

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v2] eventdev: Add rte_errno return values to the enqueue and dequeue functions
  2017-02-10 21:02 [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions Gage Eads
  2017-02-13 10:38 ` Bruce Richardson
  2017-02-14  4:10 ` Jerin Jacob
@ 2017-02-15 17:09 ` Gage Eads
  2017-03-16 10:28   ` Jerin Jacob
  2017-03-16 20:12   ` [PATCH v3] eventdev: add errno-style return values Gage Eads
  2 siblings, 2 replies; 22+ messages in thread
From: Gage Eads @ 2017-02-15 17:09 UTC (permalink / raw)
  To: dev
  Cc: jerin.jacob, bruce.richardson, hemant.agrawal, harry.van.haaren,
	nipun.gupta

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 <gage.eads@intel.com>
---
Changes for v2:
  - Remove rte_errno initialization

 lib/librte_eventdev/rte_eventdev.h | 40 +++++++++++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index c2f9310..31d1e31 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -245,6 +245,7 @@ extern "C" {
 
 #include <rte_common.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
 
@@ -1116,9 +1117,14 @@ 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.
  * @see rte_event_port_enqueue_depth()
  */
 static inline uint16_t
@@ -1127,6 +1133,20 @@ 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 (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 +1255,20 @@ 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 (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

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v2] eventdev: Add rte_errno return values to the enqueue and dequeue functions
  2017-02-15 17:09 ` [PATCH v2] " Gage Eads
@ 2017-03-16 10:28   ` Jerin Jacob
  2017-03-16 20:12   ` [PATCH v3] eventdev: add errno-style return values Gage Eads
  1 sibling, 0 replies; 22+ messages in thread
From: Jerin Jacob @ 2017-03-16 10:28 UTC (permalink / raw)
  To: Gage Eads
  Cc: dev, bruce.richardson, hemant.agrawal, harry.van.haaren, nipun.gupta

On Wed, Feb 15, 2017 at 11:09:54AM -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.

Please fix the checkpatch error.
http://dpdk.org/ml/archives/test-report/2017-February/010896.html

> 
> Signed-off-by: Gage Eads <gage.eads@intel.com>
> ---
> Changes for v2:
>   - Remove rte_errno initialization
> 
>  lib/librte_eventdev/rte_eventdev.h | 40 +++++++++++++++++++++++++++++++++++---
>  1 file changed, 37 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
> index c2f9310..31d1e31 100644
> --- a/lib/librte_eventdev/rte_eventdev.h
> +++ b/lib/librte_eventdev/rte_eventdev.h
> @@ -245,6 +245,7 @@ extern "C" {
>  
>  #include <rte_common.h>
>  #include <rte_memory.h>
> +#include <rte_errno.h>
>  
>  struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
>  
> @@ -1116,9 +1117,14 @@ 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.

If I understand it correctly, -ENOSPC comes only for closed systems not
for open systems. IMO, It is worth to mention that -ENOSPC is valid only of closed
systems.

>   * @see rte_event_port_enqueue_depth()
>   */
>  static inline uint16_t
> @@ -1127,6 +1133,20 @@ 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

Please check with enabling RTE_LIBRTE_EVENTDEV_DEBUG. It has compilation errors.

In file included from
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.c:61:0:
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h: In
function ‘rte_event_enqueue_burst’:
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1139:40:
error: ‘RTE_EVENTDEV_DETACHED’ undeclared (first use in this function)
  if (rte_eventdevs[dev_id].attached == RTE_EVENTDEV_DETACHED) {
                                        ^
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1139:40:
note: each undeclared identifier is reported only once for each function
it appears in
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1140:3:
error: implicit declaration of function ‘RTE_EDEV_LOG_DEBUG’
[-Werror=implicit-function-declaration]
   RTE_EDEV_LOG_DEBUG("Invalid dev_id=%d\n", dev_id);
   ^
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1140:3:
error: nested extern declaration of ‘RTE_EDEV_LOG_DEBUG’
[-Werror=nested-externs]
In file included from
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.c:61:0:
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h: In
function ‘rte_event_dequeue_burst’:
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1263:40:
error: ‘RTE_EVENTDEV_DETACHED’ undeclared (first use in this function)
  if (rte_eventdevs[dev_id].attached == RTE_EVENTDEV_DETACHED) {


> +	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 +1255,20 @@ 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 (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
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v3] eventdev: add errno-style return values
  2017-02-15 17:09 ` [PATCH v2] " Gage Eads
  2017-03-16 10:28   ` Jerin Jacob
@ 2017-03-16 20:12   ` Gage Eads
  2017-03-17  3:10     ` Jerin Jacob
  2017-03-17 14:51     ` [PATCH v4] " Gage Eads
  1 sibling, 2 replies; 22+ messages in thread
From: Gage Eads @ 2017-03-16 20:12 UTC (permalink / raw)
  To: dev
  Cc: jerin.jacob, bruce.richardson, hemant.agrawal, harry.van.haaren,
	nipun.gupta

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 <gage.eads@intel.com>
---
Changes for v2:
  - Remove rte_errno initialization
Changes for v3:
  - Fix checkpatch and check-git-log.sh errors

 lib/librte_eventdev/rte_eventdev.h | 42 +++++++++++++++++++++++++++++++++++---
 1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 2b30a35..3e54b27 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -245,6 +245,7 @@ extern "C" {
 
 #include <rte_common.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
 
@@ -1118,9 +1119,14 @@ 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.
  * @see rte_event_port_enqueue_depth()
  */
 static inline uint16_t
@@ -1129,6 +1135,21 @@ rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
 {
 	struct rte_eventdev *dev = &rte_eventdevs[dev_id];
 
+	rte_errno = 0;
+#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
@@ -1239,6 +1260,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

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v3] eventdev: add errno-style return values
  2017-03-16 20:12   ` [PATCH v3] eventdev: add errno-style return values Gage Eads
@ 2017-03-17  3:10     ` Jerin Jacob
  2017-03-17 14:34       ` Eads, Gage
  2017-03-17 14:51     ` [PATCH v4] " Gage Eads
  1 sibling, 1 reply; 22+ messages in thread
From: Jerin Jacob @ 2017-03-17  3:10 UTC (permalink / raw)
  To: Gage Eads
  Cc: dev, bruce.richardson, hemant.agrawal, harry.van.haaren, nipun.gupta

On Thu, Mar 16, 2017 at 03:12:19PM -0500, Gage Eads wrote:
> 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 <gage.eads@intel.com>
> ---
> Changes for v2:
>   - Remove rte_errno initialization
> Changes for v3:
>   - Fix checkpatch and check-git-log.sh errors
> 
>  lib/librte_eventdev/rte_eventdev.h | 42 +++++++++++++++++++++++++++++++++++---
>  1 file changed, 39 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
> index 2b30a35..3e54b27 100644
> --- a/lib/librte_eventdev/rte_eventdev.h
> +++ b/lib/librte_eventdev/rte_eventdev.h
> @@ -245,6 +245,7 @@ extern "C" {
>  
>  #include <rte_common.h>
>  #include <rte_memory.h>
> +#include <rte_errno.h>
>  
>  struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
>  
> @@ -1118,9 +1119,14 @@ 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.

Please check the review comments of v2
http://dpdk.org/ml/archives/dev/2017-March/060352.html

>   * @see rte_event_port_enqueue_depth()
>   */
>  static inline uint16_t
> @@ -1129,6 +1135,21 @@ rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
>  {
>  	struct rte_eventdev *dev = &rte_eventdevs[dev_id];
>  
> +	rte_errno = 0;

Why rte_errno = 0 is not in RTE_LIBRTE_EVENTDEV_DEBUG now in v3?

> +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG

Please check the review comments of v2
http://dpdk.org/ml/archives/dev/2017-March/060352.html

It still fails.

n file included from
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.c:61:0:
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h: In
function ‘rte_event_enqueue_burst’:
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1140:40:
error: ‘RTE_EVENTDEV_DETACHED’ undeclared (first use in this function)
  if (rte_eventdevs[dev_id].attached == RTE_EVENTDEV_DETACHED) {
                                        ^
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1140:40:
note: each undeclared identifier is reported only once for each function
it appears in
/export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1141:3:
error: implicit declaration of function ‘RTE_EDEV_LOG_DEBUG’
[-Werror=implicit-function-declaration]
   RTE_EDEV_LOG_DEBUG("Invalid dev_id=%d\n", dev_id);
   ^

> +	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
> @@ -1239,6 +1260,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
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v3] eventdev: add errno-style return values
  2017-03-17  3:10     ` Jerin Jacob
@ 2017-03-17 14:34       ` Eads, Gage
  0 siblings, 0 replies; 22+ messages in thread
From: Eads, Gage @ 2017-03-17 14:34 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: dev, Richardson, Bruce, hemant.agrawal, Van Haaren, Harry, nipun.gupta

Ah, sorry about that! I revised the v1 patch, not the v2 patch. I'll fix and resubmit.

>  -----Original Message-----
>  From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
>  Sent: Thursday, March 16, 2017 10:11 PM
>  To: Eads, Gage <gage.eads@intel.com>
>  Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>;
>  hemant.agrawal@nxp.com; Van Haaren, Harry <harry.van.haaren@intel.com>;
>  nipun.gupta@nxp.com
>  Subject: Re: [PATCH v3] eventdev: add errno-style return values
>  
>  On Thu, Mar 16, 2017 at 03:12:19PM -0500, Gage Eads wrote:
>  > 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 <gage.eads@intel.com>
>  > ---
>  > Changes for v2:
>  >   - Remove rte_errno initialization
>  > Changes for v3:
>  >   - Fix checkpatch and check-git-log.sh errors
>  >
>  >  lib/librte_eventdev/rte_eventdev.h | 42
>  > +++++++++++++++++++++++++++++++++++---
>  >  1 file changed, 39 insertions(+), 3 deletions(-)
>  >
>  > diff --git a/lib/librte_eventdev/rte_eventdev.h
>  > b/lib/librte_eventdev/rte_eventdev.h
>  > index 2b30a35..3e54b27 100644
>  > --- a/lib/librte_eventdev/rte_eventdev.h
>  > +++ b/lib/librte_eventdev/rte_eventdev.h
>  > @@ -245,6 +245,7 @@ extern "C" {
>  >
>  >  #include <rte_common.h>
>  >  #include <rte_memory.h>
>  > +#include <rte_errno.h>
>  >
>  >  struct rte_mbuf; /* we just use mbuf pointers; no need to include
>  > rte_mbuf.h */
>  >
>  > @@ -1118,9 +1119,14 @@ 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.
>  
>  Please check the review comments of v2
>  http://dpdk.org/ml/archives/dev/2017-March/060352.html
>  
>  >   * @see rte_event_port_enqueue_depth()
>  >   */
>  >  static inline uint16_t
>  > @@ -1129,6 +1135,21 @@ rte_event_enqueue_burst(uint8_t dev_id, uint8_t
>  > port_id,  {
>  >  	struct rte_eventdev *dev = &rte_eventdevs[dev_id];
>  >
>  > +	rte_errno = 0;
>  
>  Why rte_errno = 0 is not in RTE_LIBRTE_EVENTDEV_DEBUG now in v3?
>  
>  > +#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
>  
>  Please check the review comments of v2
>  http://dpdk.org/ml/archives/dev/2017-March/060352.html
>  
>  It still fails.
>  
>  n file included from
>  /export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.c:61:0:
>  /export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h: In function
>  ‘rte_event_enqueue_burst’:
>  /export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1140:40:
>  error: ‘RTE_EVENTDEV_DETACHED’ undeclared (first use in this function)
>    if (rte_eventdevs[dev_id].attached == RTE_EVENTDEV_DETACHED) {
>                                          ^
>  /export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1140:40:
>  note: each undeclared identifier is reported only once for each function it
>  appears in
>  /export/dpdk-next-eventdev/lib/librte_eventdev/rte_eventdev.h:1141:3:
>  error: implicit declaration of function ‘RTE_EDEV_LOG_DEBUG’
>  [-Werror=implicit-function-declaration]
>     RTE_EDEV_LOG_DEBUG("Invalid dev_id=%d\n", dev_id);
>     ^
>  
>  > +	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
>  > @@ -1239,6 +1260,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
>  >

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v4] eventdev: add errno-style return values
  2017-03-16 20:12   ` [PATCH v3] eventdev: add errno-style return values Gage Eads
  2017-03-17  3:10     ` Jerin Jacob
@ 2017-03-17 14:51     ` Gage Eads
  2017-03-21 11:06       ` Jerin Jacob
  2017-03-22 14:58       ` [PATCH v5] " Gage Eads
  1 sibling, 2 replies; 22+ messages in thread
From: Gage Eads @ 2017-03-17 14:51 UTC (permalink / raw)
  To: dev
  Cc: jerin.jacob, bruce.richardson, hemant.agrawal, harry.van.haaren,
	nipun.gupta, Eads, Gage

From: "Eads, Gage" <gage.eads@intel.com>

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 <gage.eads@intel.com>
---
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

 lib/librte_eventdev/rte_eventdev.h | 40 +++++++++++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 2b30a35..a45c81a 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -245,6 +245,7 @@ extern "C" {
 
 #include <rte_common.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
 
@@ -1118,9 +1119,14 @@ 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.
  * @see rte_event_port_enqueue_depth()
  */
 static inline uint16_t
@@ -1129,6 +1135,20 @@ 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 (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
@@ -1239,6 +1259,20 @@ 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 (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

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v4] eventdev: add errno-style return values
  2017-03-17 14:51     ` [PATCH v4] " Gage Eads
@ 2017-03-21 11:06       ` Jerin Jacob
  2017-03-21 20:38         ` Eads, Gage
  2017-03-22 14:58       ` [PATCH v5] " Gage Eads
  1 sibling, 1 reply; 22+ messages in thread
From: Jerin Jacob @ 2017-03-21 11:06 UTC (permalink / raw)
  To: Gage Eads
  Cc: dev, bruce.richardson, hemant.agrawal, harry.van.haaren, nipun.gupta

On Fri, Mar 17, 2017 at 09:51:28AM -0500, Gage Eads wrote:
> From: "Eads, Gage" <gage.eads@intel.com>
> 
> 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 <gage.eads@intel.com>
> ---
> 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
> 
>  lib/librte_eventdev/rte_eventdev.h | 40 +++++++++++++++++++++++++++++++++++---
>  1 file changed, 37 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
> index 2b30a35..a45c81a 100644
> --- a/lib/librte_eventdev/rte_eventdev.h
> +++ b/lib/librte_eventdev/rte_eventdev.h
> @@ -245,6 +245,7 @@ extern "C" {
>  
>  #include <rte_common.h>
>  #include <rte_memory.h>
> +#include <rte_errno.h>
>  
>  struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
>  
> @@ -1118,9 +1119,14 @@ 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.

Some reason you haven't addressed the comments in v2.i.e add a note that
-ENOSPC applicable only for *closed system*

http://dpdk.org/ml/archives/dev/2017-March/060352.html


>   * @see rte_event_port_enqueue_depth()
>   */
>  static inline uint16_t
> @@ -1129,6 +1135,20 @@ 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

Some reason you haven't addressed the comments in v2.i.e Not fixed the
build issue.
http://dpdk.org/ml/archives/dev/2017-March/060352.html

You can reproduce it by setting CONFIG_RTE_LIBRTE_EVENTDEV_DEBUG=y in
common config.

We have two approaches to fix it
1/ Pollute lib/librte_eventdev/rte_eventdev.h header with implementation
specific header files

Or

2/ Have neat pmd debug common function in rte_eventdev_pmd.h.Let all PMD
driver call it by including rte_eventdev_pmd.h


> +	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
> @@ -1239,6 +1259,20 @@ 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 (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
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v4] eventdev: add errno-style return values
  2017-03-21 11:06       ` Jerin Jacob
@ 2017-03-21 20:38         ` Eads, Gage
  2017-03-22  6:53           ` Jerin Jacob
  0 siblings, 1 reply; 22+ messages in thread
From: Eads, Gage @ 2017-03-21 20:38 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: dev, Richardson, Bruce, hemant.agrawal, Van Haaren, Harry, nipun.gupta



>  -----Original Message-----
>  From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
>  Sent: Tuesday, March 21, 2017 6:06 AM
>  To: Eads, Gage <gage.eads@intel.com>
>  Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>;
>  hemant.agrawal@nxp.com; Van Haaren, Harry <harry.van.haaren@intel.com>;
>  nipun.gupta@nxp.com
>  Subject: Re: [PATCH v4] eventdev: add errno-style return values
>  
>  On Fri, Mar 17, 2017 at 09:51:28AM -0500, Gage Eads wrote:
>  > From: "Eads, Gage" <gage.eads@intel.com>
>  >
>  > 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 <gage.eads@intel.com>
>  > ---
>  > 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
>  >
>  >  lib/librte_eventdev/rte_eventdev.h | 40
>  > +++++++++++++++++++++++++++++++++++---
>  >  1 file changed, 37 insertions(+), 3 deletions(-)
>  >
>  > diff --git a/lib/librte_eventdev/rte_eventdev.h
>  > b/lib/librte_eventdev/rte_eventdev.h
>  > index 2b30a35..a45c81a 100644
>  > --- a/lib/librte_eventdev/rte_eventdev.h
>  > +++ b/lib/librte_eventdev/rte_eventdev.h
>  > @@ -245,6 +245,7 @@ extern "C" {
>  >
>  >  #include <rte_common.h>
>  >  #include <rte_memory.h>
>  > +#include <rte_errno.h>
>  >
>  >  struct rte_mbuf; /* we just use mbuf pointers; no need to include
>  > rte_mbuf.h */
>  >
>  > @@ -1118,9 +1119,14 @@ 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.
>  
>  Some reason you haven't addressed the comments in v2.i.e add a note that -
>  ENOSPC applicable only for *closed system*
>  
>  http://dpdk.org/ml/archives/dev/2017-March/060352.html
>  

Will fix.

>  
>  >   * @see rte_event_port_enqueue_depth()
>  >   */
>  >  static inline uint16_t
>  > @@ -1129,6 +1135,20 @@ 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
>  
>  Some reason you haven't addressed the comments in v2.i.e Not fixed the build
>  issue.
>  http://dpdk.org/ml/archives/dev/2017-March/060352.html
>  
>  You can reproduce it by setting CONFIG_RTE_LIBRTE_EVENTDEV_DEBUG=y in
>  common config.
>  
>  We have two approaches to fix it
>  1/ Pollute lib/librte_eventdev/rte_eventdev.h header with implementation
>  specific header files
>  
>  Or
>  
>  2/ Have neat pmd debug common function in rte_eventdev_pmd.h.Let all PMD
>  driver call it by including rte_eventdev_pmd.h
>  

I'd prefer to avoid the issue by dropping the debug message and RTE_EVENTDEV_DETACHED, like so:

#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

What do you think?

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v4] eventdev: add errno-style return values
  2017-03-21 20:38         ` Eads, Gage
@ 2017-03-22  6:53           ` Jerin Jacob
  0 siblings, 0 replies; 22+ messages in thread
From: Jerin Jacob @ 2017-03-22  6:53 UTC (permalink / raw)
  To: Eads, Gage
  Cc: dev, Richardson, Bruce, hemant.agrawal, Van Haaren, Harry, nipun.gupta

On Tue, Mar 21, 2017 at 08:38:25PM +0000, Eads, Gage wrote:
> 
> 
> >  -----Original Message-----
> >  From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> >  Sent: Tuesday, March 21, 2017 6:06 AM
> >  To: Eads, Gage <gage.eads@intel.com>
> >  Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>;
> >  hemant.agrawal@nxp.com; Van Haaren, Harry <harry.van.haaren@intel.com>;
> >  nipun.gupta@nxp.com
> >  Subject: Re: [PATCH v4] eventdev: add errno-style return values
> >  
> >  On Fri, Mar 17, 2017 at 09:51:28AM -0500, Gage Eads wrote:
> >  > From: "Eads, Gage" <gage.eads@intel.com>
> >  >
> >  > 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 <gage.eads@intel.com>
> >  > ---
> >  > 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
> >  >
> >  >  lib/librte_eventdev/rte_eventdev.h | 40
> >  > +++++++++++++++++++++++++++++++++++---
> >  >  1 file changed, 37 insertions(+), 3 deletions(-)
> >  >
> >  > diff --git a/lib/librte_eventdev/rte_eventdev.h
> >  > b/lib/librte_eventdev/rte_eventdev.h
> >  > index 2b30a35..a45c81a 100644
> >  > --- a/lib/librte_eventdev/rte_eventdev.h
> >  > +++ b/lib/librte_eventdev/rte_eventdev.h
> >  > @@ -245,6 +245,7 @@ extern "C" {
> >  >
> >  >  #include <rte_common.h>
> >  >  #include <rte_memory.h>
> >  > +#include <rte_errno.h>
> >  >
> >  >  struct rte_mbuf; /* we just use mbuf pointers; no need to include
> >  > rte_mbuf.h */
> >  >
> >  > @@ -1118,9 +1119,14 @@ 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.
> >  
> >  Some reason you haven't addressed the comments in v2.i.e add a note that -
> >  ENOSPC applicable only for *closed system*
> >  
> >  http://dpdk.org/ml/archives/dev/2017-March/060352.html
> >  
> 
> Will fix.
> 
> >  
> >  >   * @see rte_event_port_enqueue_depth()
> >  >   */
> >  >  static inline uint16_t
> >  > @@ -1129,6 +1135,20 @@ 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
> >  
> >  Some reason you haven't addressed the comments in v2.i.e Not fixed the build
> >  issue.
> >  http://dpdk.org/ml/archives/dev/2017-March/060352.html
> >  
> >  You can reproduce it by setting CONFIG_RTE_LIBRTE_EVENTDEV_DEBUG=y in
> >  common config.
> >  
> >  We have two approaches to fix it
> >  1/ Pollute lib/librte_eventdev/rte_eventdev.h header with implementation
> >  specific header files
> >  
> >  Or
> >  
> >  2/ Have neat pmd debug common function in rte_eventdev_pmd.h.Let all PMD
> >  driver call it by including rte_eventdev_pmd.h
> >  
> 
> I'd prefer to avoid the issue by dropping the debug message and RTE_EVENTDEV_DETACHED, like so:
> 
> #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
> 
> What do you think?

Looks good to me.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v5] eventdev: add errno-style return values
  2017-03-17 14:51     ` [PATCH v4] " Gage Eads
  2017-03-21 11:06       ` Jerin Jacob
@ 2017-03-22 14:58       ` Gage Eads
  2017-03-22 17:17         ` Jerin Jacob
  2017-03-23 22:30         ` [PATCH v6] " Gage Eads
  1 sibling, 2 replies; 22+ messages in thread
From: Gage Eads @ 2017-03-22 14:58 UTC (permalink / raw)
  To: dev
  Cc: jerin.jacob, bruce.richardson, hemant.agrawal, harry.van.haaren,
	nipun.gupta, Eads, Gage

From: "Eads, Gage" <gage.eads@intel.com>

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 <gage.eads@intel.com>
---
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 <rte_common.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 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.
  * @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) {
+		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
@@ -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

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v5] eventdev: add errno-style return values
  2017-03-22 14:58       ` [PATCH v5] " Gage Eads
@ 2017-03-22 17:17         ` Jerin Jacob
  2017-03-23 22:32           ` Eads, Gage
  2017-03-23 22:30         ` [PATCH v6] " Gage Eads
  1 sibling, 1 reply; 22+ messages in thread
From: Jerin Jacob @ 2017-03-22 17:17 UTC (permalink / raw)
  To: Gage Eads
  Cc: dev, bruce.richardson, hemant.agrawal, harry.van.haaren, nipun.gupta

On Wed, Mar 22, 2017 at 09:58:00AM -0500, Gage Eads wrote:
> From: "Eads, Gage" <gage.eads@intel.com>
> 
> 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 <gage.eads@intel.com>
> ---
> 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 <rte_common.h>
>  #include <rte_memory.h>
> +#include <rte_errno.h>
>  
>  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 <jerin.jacob@caviumnetworks.com>

> +		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
> 

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v6] eventdev: add errno-style return values
  2017-03-22 14:58       ` [PATCH v5] " Gage Eads
  2017-03-22 17:17         ` Jerin Jacob
@ 2017-03-23 22:30         ` Gage Eads
  2017-03-24  2:38           ` Jerin Jacob
  1 sibling, 1 reply; 22+ messages in thread
From: Gage Eads @ 2017-03-23 22:30 UTC (permalink / raw)
  To: dev
  Cc: jerin.jacob, bruce.richardson, hemant.agrawal, harry.van.haaren,
	nipun.gupta, Eads, Gage

From: "Eads, Gage" <gage.eads@intel.com>

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 <gage.eads@intel.com>
---
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
Changes for v6:
  - Fixed html doc rendering of bullet points for errno values

 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 5ce2f33..9971937 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -245,6 +245,7 @@ extern "C" {
 
 #include <rte_common.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
 
@@ -1119,9 +1120,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.
  * @see rte_event_port_enqueue_depth()
  */
 static inline uint16_t
@@ -1130,6 +1137,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) {
+		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
@@ -1240,6 +1259,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

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v5] eventdev: add errno-style return values
  2017-03-22 17:17         ` Jerin Jacob
@ 2017-03-23 22:32           ` Eads, Gage
  0 siblings, 0 replies; 22+ messages in thread
From: Eads, Gage @ 2017-03-23 22:32 UTC (permalink / raw)
  To: Jerin Jacob
  Cc: dev, Richardson, Bruce, hemant.agrawal, Van Haaren, Harry, nipun.gupta

Thanks! Good catch on the html guide. I submitted v6, leaving the "attached" code as is.

Thanks,
Gage

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6] eventdev: add errno-style return values
  2017-03-23 22:30         ` [PATCH v6] " Gage Eads
@ 2017-03-24  2:38           ` Jerin Jacob
  2017-03-25  5:11             ` Jerin Jacob
  0 siblings, 1 reply; 22+ messages in thread
From: Jerin Jacob @ 2017-03-24  2:38 UTC (permalink / raw)
  To: Gage Eads
  Cc: dev, bruce.richardson, hemant.agrawal, harry.van.haaren, nipun.gupta

On Thu, Mar 23, 2017 at 05:30:20PM -0500, Gage Eads wrote:
> From: "Eads, Gage" <gage.eads@intel.com>
> 
> 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 <gage.eads@intel.com>

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

> ---
> 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
> Changes for v6:
>   - Fixed html doc rendering of bullet points for errno values
> 
>  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 5ce2f33..9971937 100644
> --- a/lib/librte_eventdev/rte_eventdev.h
> +++ b/lib/librte_eventdev/rte_eventdev.h
> @@ -245,6 +245,7 @@ extern "C" {
>  
>  #include <rte_common.h>
>  #include <rte_memory.h>
> +#include <rte_errno.h>
>  
>  struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
>  
> @@ -1119,9 +1120,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.
>   * @see rte_event_port_enqueue_depth()
>   */
>  static inline uint16_t
> @@ -1130,6 +1137,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) {
> +		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
> @@ -1240,6 +1259,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
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v6] eventdev: add errno-style return values
  2017-03-24  2:38           ` Jerin Jacob
@ 2017-03-25  5:11             ` Jerin Jacob
  0 siblings, 0 replies; 22+ messages in thread
From: Jerin Jacob @ 2017-03-25  5:11 UTC (permalink / raw)
  To: Gage Eads
  Cc: dev, bruce.richardson, hemant.agrawal, harry.van.haaren, nipun.gupta

On Fri, Mar 24, 2017 at 08:08:06AM +0530, Jerin Jacob wrote:
> On Thu, Mar 23, 2017 at 05:30:20PM -0500, Gage Eads wrote:
> > From: "Eads, Gage" <gage.eads@intel.com>
> > 
> > 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 <gage.eads@intel.com>
> 
> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>


Applied to dpdk-next-eventdev/master. Thanks.

> 
> > ---
> > 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
> > Changes for v6:
> >   - Fixed html doc rendering of bullet points for errno values
> > 
> >  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 5ce2f33..9971937 100644
> > --- a/lib/librte_eventdev/rte_eventdev.h
> > +++ b/lib/librte_eventdev/rte_eventdev.h
> > @@ -245,6 +245,7 @@ extern "C" {
> >  
> >  #include <rte_common.h>
> >  #include <rte_memory.h>
> > +#include <rte_errno.h>
> >  
> >  struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
> >  
> > @@ -1119,9 +1120,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.
> >   * @see rte_event_port_enqueue_depth()
> >   */
> >  static inline uint16_t
> > @@ -1130,6 +1137,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) {
> > +		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
> > @@ -1240,6 +1259,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
> > 

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-03-25  5:11 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-10 21:02 [PATCH] eventdev: Add rte_errno return values to the enqueue and dequeue functions Gage Eads
2017-02-13 10:38 ` Bruce Richardson
2017-02-13 11:48   ` Jerin Jacob
2017-02-13 12:08     ` Bruce Richardson
2017-02-13 16:05       ` Eads, Gage
2017-02-14  4:10 ` Jerin Jacob
2017-02-15  0:14   ` Eads, Gage
2017-02-15 17:09 ` [PATCH v2] " Gage Eads
2017-03-16 10:28   ` Jerin Jacob
2017-03-16 20:12   ` [PATCH v3] eventdev: add errno-style return values Gage Eads
2017-03-17  3:10     ` Jerin Jacob
2017-03-17 14:34       ` Eads, Gage
2017-03-17 14:51     ` [PATCH v4] " Gage Eads
2017-03-21 11:06       ` Jerin Jacob
2017-03-21 20:38         ` Eads, Gage
2017-03-22  6:53           ` Jerin Jacob
2017-03-22 14:58       ` [PATCH v5] " Gage Eads
2017-03-22 17:17         ` Jerin Jacob
2017-03-23 22:32           ` Eads, Gage
2017-03-23 22:30         ` [PATCH v6] " Gage Eads
2017-03-24  2:38           ` Jerin Jacob
2017-03-25  5:11             ` Jerin Jacob

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.