DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Gage Eads <gage.eads@intel.com>
Cc: dev@dpdk.org, bruce.richardson@intel.com, hemant.agrawal@nxp.com,
	harry.van.haaren@intel.com, nipun.gupta@nxp.com
Subject: Re: [dpdk-dev] [PATCH v5] eventdev: add errno-style return values
Date: Wed, 22 Mar 2017 22:47:46 +0530	[thread overview]
Message-ID: <20170322171744.qefio7e6463vjbim@localhost.localdomain> (raw)
In-Reply-To: <1490194680-25484-1-git-send-email-gage.eads@intel.com>

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
> 

  reply	other threads:[~2017-03-22 17:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10 21:02 [dpdk-dev] [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 ` [dpdk-dev] [PATCH v2] " Gage Eads
2017-03-16 10:28   ` Jerin Jacob
2017-03-16 20:12   ` [dpdk-dev] [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     ` [dpdk-dev] [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       ` [dpdk-dev] [PATCH v5] " Gage Eads
2017-03-22 17:17         ` Jerin Jacob [this message]
2017-03-23 22:32           ` Eads, Gage
2017-03-23 22:30         ` [dpdk-dev] [PATCH v6] " Gage Eads
2017-03-24  2:38           ` Jerin Jacob
2017-03-25  5:11             ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170322171744.qefio7e6463vjbim@localhost.localdomain \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=nipun.gupta@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).