From: "Roger B. Melton" <rmelton@cisco.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 4/4] ethdev: check support for rx_queue_count and descriptor_done fns
Date: Fri, 12 Jun 2015 13:32:56 -0400 [thread overview]
Message-ID: <557B17C8.3090300@cisco.com> (raw)
In-Reply-To: <1434108496-1993-5-git-send-email-bruce.richardson@intel.com>
Hi Bruce, Comment in-line. Regards, Roger
On 6/12/15 7:28 AM, Bruce Richardson wrote:
> The functions rte_eth_rx_queue_count and rte_eth_descriptor_done are
> supported by very few PMDs. Therefore, it is best to check for support
> for the functions in the ethdev library, so as to avoid crashes
> at run-time if the application goes to use those APIs. The performance
> impact of this change should be very small as this is a predictable
> branch in the function.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> lib/librte_ether/rte_ethdev.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index 827ca3e..9ad1b6a 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -2496,6 +2496,8 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
> * The queue id on the specific port.
> * @return
> * The number of used descriptors in the specific queue.
> + * NOTE: if function is not supported by device this call
> + * returns (uint32_t)-ENOTSUP
> */
> static inline uint32_t
Why not change the return type to int32_t?
In this way, the caller isn't required to make the assumption that a
large queue count indicates an error. < 0 means error, other wise it's
a valid queue count.
This approach would be consistent with other APIs.
> rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
> @@ -2507,8 +2509,9 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
> RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> return 0;
> }
> - RTE_ETH_FPTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
> #endif
> + RTE_ETH_FPTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, (uint32_t)-ENOTSUP);
> +
> return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
> }
>
> @@ -2525,6 +2528,7 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
> * - (1) if the specific DD bit is set.
> * - (0) if the specific DD bit is not set.
> * - (-ENODEV) if *port_id* invalid.
> + * - (-ENOTSUP) if the device does not support this function
> */
> static inline int
> rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
> @@ -2536,8 +2540,8 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
> RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
> return -ENODEV;
> }
> - RTE_ETH_FPTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
> #endif
> + RTE_ETH_FPTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
>
> return (*dev->dev_ops->rx_descriptor_done)( \
> dev->data->rx_queues[queue_id], offset);
--
____________________________________________________________________
|Roger B. Melton | | Cisco Systems |
|CPP Software :|: :|: 7100 Kit Creek Rd |
|+1.919.476.2332 phone :|||: :|||: RTP, NC 27709-4987 |
|+1.919.392.1094 fax .:|||||||:..:|||||||:. rmelton@cisco.com |
| |
| This email may contain confidential and privileged material for the|
| sole use of the intended recipient. Any review, use, distribution |
| or disclosure by others is strictly prohibited. If you are not the |
| intended recipient (or authorized to receive for the recipient), |
| please contact the sender by reply email and delete all copies of |
| this message. |
| |
| For corporate legal information go to: |
| http://www.cisco.com/web/about/doing_business/legal/cri/index.html |
|__________________________ http://www.cisco.com ____________________|
next prev parent reply other threads:[~2015-06-12 17:32 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 11:28 [dpdk-dev] [PATCH 0/4] ethdev: Add checks for function support in driver Bruce Richardson
2015-06-12 11:28 ` [dpdk-dev] [PATCH 1/4] ethdev: rename macros to have RTE_ETH prefix Bruce Richardson
2015-06-12 11:28 ` [dpdk-dev] [PATCH 2/4] ethdev: move RTE_ETH_FPTR_OR_ERR macros to header Bruce Richardson
2015-06-12 11:28 ` [dpdk-dev] [PATCH 3/4] ethdev: remove duplicated debug functions Bruce Richardson
2015-06-12 11:28 ` [dpdk-dev] [PATCH 4/4] ethdev: check support for rx_queue_count and descriptor_done fns Bruce Richardson
2015-06-12 17:32 ` Roger B. Melton [this message]
2015-06-15 10:14 ` Bruce Richardson
2015-07-06 15:11 ` Thomas Monjalon
2015-07-26 20:44 ` Thomas Monjalon
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 0/4] ethdev: minor cleanup Bruce Richardson
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 1/4] ethdev: rename macros to have RTE_ETH prefix Bruce Richardson
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 2/4] ethdev: move error checking macros to header Bruce Richardson
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 3/4] ethdev: remove duplicated debug functions Bruce Richardson
2015-09-09 15:09 ` [dpdk-dev] [PATCH v2 4/4] ethdev: check driver support for functions Bruce Richardson
2015-09-28 10:23 ` [dpdk-dev] [PATCH v2 0/4] ethdev: minor cleanup Bruce Richardson
2015-11-03 1:11 ` Thomas Monjalon
2015-11-03 10:06 ` Bruce Richardson
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 " Bruce Richardson
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 1/4] ethdev: rename macros to have RTE_ETH prefix Bruce Richardson
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 2/4] ethdev: move error checking macros to header Bruce Richardson
2015-11-04 1:19 ` Thomas Monjalon
2015-11-04 10:24 ` Adrien Mazarguil
2015-11-04 14:10 ` Bruce Richardson
2015-11-04 15:25 ` Adrien Mazarguil
2015-11-04 18:39 ` Stephen Hemminger
2015-11-05 15:09 ` Adrien Mazarguil
2015-11-05 15:17 ` Bruce Richardson
2015-11-06 11:49 ` Bruce Richardson
2015-11-06 17:10 ` Bruce Richardson
2015-11-06 17:22 ` Bruce Richardson
2015-11-09 13:39 ` Adrien Mazarguil
2015-11-09 13:50 ` Adrien Mazarguil
2015-11-09 14:02 ` Richardson, Bruce
2015-11-10 10:31 ` Declan Doherty
2015-11-10 16:08 ` Adrien Mazarguil
2015-11-10 16:21 ` Richardson, Bruce
2015-11-10 17:12 ` Adrien Mazarguil
2015-11-11 10:51 ` Bruce Richardson
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 3/4] ethdev: remove duplicated debug functions Bruce Richardson
2015-11-03 12:00 ` [dpdk-dev] [PATCH v3 4/4] ethdev: check driver support for functions Bruce Richardson
2015-11-03 22:00 ` Stephen Hemminger
2015-11-04 14:15 ` Bruce Richardson
2015-11-17 12:21 ` [dpdk-dev] [PATCH v4 0/2] ethdev: debug code cleanup Bruce Richardson
2015-11-17 12:21 ` [dpdk-dev] [PATCH v4 1/2] ethdev: remove duplicated debug functions Bruce Richardson
2015-11-17 12:21 ` [dpdk-dev] [PATCH v4 2/2] ethdev: add sanity checks to functions Bruce Richardson
2015-11-17 15:53 ` Stephen Hemminger
2015-11-24 14:56 ` Bruce Richardson
2015-11-24 15:29 ` Thomas Monjalon
2015-11-24 15:45 ` Bruce Richardson
2015-11-24 15:48 ` Thomas Monjalon
2015-11-24 17:37 ` [dpdk-dev] [PATCH v5 0/2] ethdev: debug code cleanup Bruce Richardson
2015-11-24 17:37 ` [dpdk-dev] [PATCH v5 1/2] ethdev: remove duplicated debug functions Bruce Richardson
2015-11-25 18:14 ` Thomas Monjalon
2015-11-24 17:37 ` [dpdk-dev] [PATCH v5 2/2] ethdev: add sanity checks to functions Bruce Richardson
2015-11-25 18:21 ` [dpdk-dev] [PATCH v5 0/2] ethdev: debug code cleanup Thomas Monjalon
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=557B17C8.3090300@cisco.com \
--to=rmelton@cisco.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/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).