From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ferruh.yigit@intel.com>
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by dpdk.org (Postfix) with ESMTP id 784435F13
 for <dev@dpdk.org>; Fri,  9 Mar 2018 14:00:38 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 09 Mar 2018 05:00:37 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.47,445,1515484800"; d="scan'208";a="181311674"
Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.62])
 ([10.237.221.62])
 by orsmga004.jf.intel.com with ESMTP; 09 Mar 2018 05:00:35 -0800
To: Neil Horman <nhorman@tuxdriver.com>
Cc: John McNamara <john.mcnamara@intel.com>,
 Marko Kovacevic <marko.kovacevic@intel.com>,
 Thomas Monjalon <thomas@monjalon.net>, dev@dpdk.org
References: <20180117215802.90809-2-ferruh.yigit@intel.com>
 <20180309112531.292163-1-ferruh.yigit@intel.com>
 <20180309123651.GB19004@hmswarspite.think-freely.org>
From: Ferruh Yigit <ferruh.yigit@intel.com>
Message-ID: <b12988d0-cb4a-2dcb-c20a-37cfbdf73eda@intel.com>
Date: Fri, 9 Mar 2018 13:00:35 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.6.0
MIME-Version: 1.0
In-Reply-To: <20180309123651.GB19004@hmswarspite.think-freely.org>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Subject: Re: [dpdk-dev] [PATCH v4] ethdev: return named opaque type instead
 of void pointer
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 09 Mar 2018 13:00:38 -0000

On 3/9/2018 12:36 PM, Neil Horman wrote:
> On Fri, Mar 09, 2018 at 11:25:31AM +0000, Ferruh Yigit 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>
>> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
>> ---
>> v2:
>> * keep using struct * in parameters, instead add callback functions
>> return struct rte_eth_rxtx_callback pointer.
>>
>> v4:
>> * Remove deprecation notice. LIBABIVER already increased in this release
>> ---
>>  doc/guides/rel_notes/deprecation.rst |  7 -------
>>  lib/librte_ether/rte_ethdev.c        |  6 +++---
>>  lib/librte_ether/rte_ethdev.h        | 13 ++++++++-----
>>  3 files changed, 11 insertions(+), 15 deletions(-)
>>
> This doesn't quite make sense to me.  If rte_eth_rxtx_callback is defined as an
> internal data structure, then it shouldn't be used as part of the prototype for
> an exported function, as the structure will then no longer be a internal data
> structure, but rather part of the public ABI.

"struct rte_eth_rxtx_callback" is internal data structure. And application
should not access elements of this structure.

"struct rte_eth_rxtx_callback;" is defined in the public header, so applications
can use it as opaque type.

It is possible that both "add" and "remove" APIs use "void *" and API itself can
cast it. But the inconsistency was "add" related APIs return "void *" and
"remove" related APIs require a parameter in "struct rte_eth_rxtx_callback *" type.

While unifying the usage, "struct rte_eth_rxtx_callback *" preferred against
"void *", because named opaque type documents intention/usage better.

Thanks,
ferruh

> 
> Neil
>