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.e...@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
> 

Reply via email to