patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Thomas Monjalon <thomas@monjalon.net>,
	dev@dpdk.org, stable@dpdk.org, declan.doherty@intel.com,
	Boris Pismenny <borisp@mellanox.com>,
	Aviad Yehezkel <aviadye@mellanox.com>,
	Radu Nicolau <radu.nicolau@intel.com>
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2 6/6] ethdev: return named opaque type instead of void pointer
Date: Tue, 9 Jan 2018 10:55:49 -0800	[thread overview]
Message-ID: <20180109105549.6c853ade@xeon-e3> (raw)
In-Reply-To: <20180109162317.18183-6-ferruh.yigit@intel.com>

On Tue,  9 Jan 2018 16:23:17 +0000
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> "struct rte_eth_rxtx_callback" is defined as internal data structure and
> used as named opaque type.
> 
> So the functions that are adding callbacks can return objects in this
> type instead of void pointer.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> v2:
> * keep using struct * in parameters, instead add callback functions
> return struct rte_eth_rxtx_callback pointer.
> ---
>  lib/librte_ether/rte_ethdev.c | 6 +++---
>  lib/librte_ether/rte_ethdev.h | 9 ++++++---
>  2 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index b3918b77a..184245880 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -3115,7 +3115,7 @@ rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type,
>  	return (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op, arg);
>  }
>  
> -void *
> +struct rte_eth_rxtx_callback *
>  rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
>  		rte_rx_callback_fn fn, void *user_param)
>  {
> @@ -3157,7 +3157,7 @@ rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
>  	return cb;
>  }
>  
> -void *
> +struct rte_eth_rxtx_callback *
>  rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
>  		rte_rx_callback_fn fn, void *user_param)
>  {
> @@ -3192,7 +3192,7 @@ rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
>  	return cb;
>  }
>  
> -void *
> +struct rte_eth_rxtx_callback *
>  rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
>  		rte_tx_callback_fn fn, void *user_param)
>  {
> diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
> index a61a97c6a..2877a455c 100644
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> @@ -2846,7 +2846,8 @@ int rte_eth_dev_get_dcb_info(uint16_t port_id,
>   *   NULL on error.
>   *   On success, a pointer value which can later be used to remove the callback.
>   */
> -void *rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
> +struct rte_eth_rxtx_callback *
> +rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
>  		rte_rx_callback_fn fn, void *user_param);
>  
>  /**
> @@ -2874,7 +2875,8 @@ void *rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
>   *   NULL on error.
>   *   On success, a pointer value which can later be used to remove the callback.
>   */
> -void *rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
> +struct rte_eth_rxtx_callback *
> +rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
>  		rte_rx_callback_fn fn, void *user_param);
>  
>  /**
> @@ -2901,7 +2903,8 @@ void *rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
>   *   NULL on error.
>   *   On success, a pointer value which can later be used to remove the callback.
>   */
> -void *rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
> +struct rte_eth_rxtx_callback *
> +rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
>  		rte_tx_callback_fn fn, void *user_param);
>  
>  /**

I would prefer that the public API keep a typed (but opaque pointer).
Use of void * is problematic and likely to cause bugs.

  reply	other threads:[~2018-01-09 18:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171201022957.64329-1-ferruh.yigit@intel.com>
2017-12-01  2:29 ` [dpdk-stable] [PATCH 2/7] ethdev: fix port id storage Ferruh Yigit
2017-12-01  9:01   ` Hemant Agrawal
2017-12-01 23:52   ` Ferruh Yigit
2018-01-09 16:23 ` [dpdk-stable] [PATCH v2 1/6] " Ferruh Yigit
2018-01-09 16:23   ` [dpdk-stable] [PATCH v2 2/6] ethdev: separate driver APIs Ferruh Yigit
2018-01-09 19:19     ` Andrew Rybchenko
2018-01-09 16:23   ` [dpdk-stable] [PATCH v2 3/6] ethdev: separate internal structures into own header Ferruh Yigit
2018-01-09 16:23   ` [dpdk-stable] [PATCH v2 4/6] ethdev: reorder inline functions Ferruh Yigit
2018-01-09 16:23   ` [dpdk-stable] [PATCH v2 5/6] ethdev: rename function parameter for consistency Ferruh Yigit
2018-01-09 16:23   ` [dpdk-stable] [PATCH v2 6/6] ethdev: return named opaque type instead of void pointer Ferruh Yigit
2018-01-09 18:55     ` Stephen Hemminger [this message]
2018-01-09 18:58     ` [dpdk-stable] [dpdk-dev] " Stephen Hemminger
2018-01-17 21:57   ` [dpdk-stable] [PATCH v3 1/6] ethdev: fix port id storage Ferruh Yigit
2018-01-17 21:57     ` [dpdk-stable] [PATCH v3 2/6] ethdev: return named opaque type instead of void pointer Ferruh Yigit
2018-01-17 22:11       ` Thomas Monjalon
2018-01-18 10:09         ` Ferruh Yigit
2018-01-17 21:57     ` [dpdk-stable] [PATCH v3 3/6] ethdev: separate driver APIs Ferruh Yigit
2018-01-17 21:58     ` [dpdk-stable] [PATCH v3 4/6] ethdev: separate internal structures into own header Ferruh Yigit
2018-01-17 21:58     ` [dpdk-stable] [PATCH v3 5/6] ethdev: reorder inline functions Ferruh Yigit
2018-01-17 21:58     ` [dpdk-stable] [PATCH v3 6/6] ethdev: rename function parameter for consistency Ferruh Yigit
2018-01-17 22:09     ` [dpdk-stable] [PATCH v3 1/6] ethdev: fix port id storage Thomas Monjalon
2018-01-17 22:19       ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2018-01-18 10:15         ` Ferruh Yigit
2018-01-18 11:29           ` Thomas Monjalon
2018-03-09 11:27     ` [dpdk-stable] [PATCH v4] " Ferruh Yigit
2018-03-09 12:58       ` Thomas Monjalon
2018-03-26 20:25         ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit

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=20180109105549.6c853ade@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=aviadye@mellanox.com \
    --cc=borisp@mellanox.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=radu.nicolau@intel.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).