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

Reply via email to