From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stephen@networkplumber.org>
Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com
 [209.85.192.196]) by dpdk.org (Postfix) with ESMTP id DC7461B1BD
 for <stable@dpdk.org>; Tue,  9 Jan 2018 19:55:51 +0100 (CET)
Received: by mail-pf0-f196.google.com with SMTP id e76so4422462pfk.1
 for <stable@dpdk.org>; Tue, 09 Jan 2018 10:55:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=S0oldHfIWyf/U3bOv//W8W9UDprbsfL/IPVsfXmmJpo=;
 b=blJctG39xS2INFPX7L9CK4PqzrMXqP1FG8H5poTr+ZoZBRELO7YYcthe9UXSQngF4+
 7L7sKnW5e60NMo94wVh8QTua+HEwn+HygAvcu10OLmI1z4aqHkgixLngvaDGVk4wlQut
 MjeBF8Olq6hj1BTfYwJlhBWjiAhBO64Iv7rmfhdskC4MSb0U83RVY3UN7GizS3w2BkPh
 J15j8TLi2TcSCmlp+B127FwqKcevqMFOSLlmvkzdSemwWYtDB0oyCccfUBJCWHTur4Cn
 L+PfbJ4U6BXm3kQirZij2spCNt05Cvh3U1Zz13jViNm6RAYhhiU5tLAIXERgvYYy38Uj
 I2Ug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=S0oldHfIWyf/U3bOv//W8W9UDprbsfL/IPVsfXmmJpo=;
 b=b5qfgF1jtZgpIr0Bp+AegK7b3BaOIp+64yVHSfcUbRjU5Vo7SqoJyHG2ggvSLCxc/n
 c/aKx2ATw6WwZv9LwFy8JJHUDobswpNF6gK5P8Wg0FfRZd/YL/vWAxHZvFhJxg2WElEk
 gvbawSiw3uiQs2JbS4ODOqwEqM7fI0/3JbMFKDFBeqMxXJ3CKQan94/9ySqNZEEz9B3M
 f3ngV2Kz4KTwL9omB6PpOmIc+CCeS72ikIRQcUhKA/lUPKiMCLsPrdbROduMu0DGrzJ4
 R+cLP9TDqlsY2iA+BpIsM83qyup4NeFPYaVrykkvnTMrnM0RxUUf4Ei79pOInq5RJg2C
 dwZQ==
X-Gm-Message-State: AKGB3mJju6n+baDKA5pZKvupVnNDFaWO3/14+k1Ki6q8NzMZ+YjchD2x
 J1p0n8k63rNTuhCP7VvJcmRTiQ==
X-Google-Smtp-Source: ACJfBosReepBxsXcmV6EoUpKqS4ki/VRVXmNa74cMZDB6mNhu/KPO4gp/G+eXGVvHNXAz8Yrt8B+nQ==
X-Received: by 10.101.81.7 with SMTP id f7mr12989237pgq.435.1515524150954;
 Tue, 09 Jan 2018 10:55:50 -0800 (PST)
Received: from xeon-e3 (204-195-18-133.wavecable.com. [204.195.18.133])
 by smtp.gmail.com with ESMTPSA id h192sm33511672pfc.139.2018.01.09.10.55.50
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 09 Jan 2018 10:55:50 -0800 (PST)
Date: Tue, 9 Jan 2018 10:55:49 -0800
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>
Message-ID: <20180109105549.6c853ade@xeon-e3>
In-Reply-To: <20180109162317.18183-6-ferruh.yigit@intel.com>
References: <20171201022957.64329-1-ferruh.yigit@intel.com>
 <20180109162317.18183-1-ferruh.yigit@intel.com>
 <20180109162317.18183-6-ferruh.yigit@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2 6/6] ethdev: return named
 opaque type instead of void pointer
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Jan 2018 18:55:52 -0000

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.