From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id DF32EA0096
	for <public@inbox.dpdk.org>; Fri, 12 Apr 2019 23:31:40 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 005E41B3AA;
	Fri, 12 Apr 2019 23:31:37 +0200 (CEST)
Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com
 [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 1D7D31B3A0
 for <dev@dpdk.org>; Fri, 12 Apr 2019 23:31:35 +0200 (CEST)
Received: by mail-pl1-f194.google.com with SMTP id d1so5715220plj.8
 for <dev@dpdk.org>; Fri, 12 Apr 2019 14:31:35 -0700 (PDT)
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=pssenuc+Inm74HRWVaXS0udzBRE8N/9rW4FSJsoyxPg=;
 b=f2DxolHC2N6Uow9mDKTSLlknMXRtbYxbboxnl77L3lIRYYdgHQxFhcsAkPs6nMLyUz
 YseFYrIAtegBvtMp9wzDKD+eItJsRzaA0FOW7ABP34BHbutF75VT8u3yW9yHx1Kp1ibO
 Ipsc/gBBjXy83I83nOlip5HsGACFUXQUO+IW7qtJuaqZGlf1KylPq6Ip4pk+DhS+Nxmu
 x0dkpCkg2KrH88MaSDNzIOfa3QSIX8e9ZGfVLJhhO2g1MOKLX7i9BOVqx1Zlz5mPxvb7
 RyZxAgnM53vj+2O4gaDgbfBEUFG3KxP+e770vin/o9METfpkA6h9cx/DmWapmeoXOdn5
 MnLg==
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=pssenuc+Inm74HRWVaXS0udzBRE8N/9rW4FSJsoyxPg=;
 b=riK/aH1khoKLFk5rjibMd9ZfiClukMjak1LNXokIBS7CV1H1r9QlgW9GW0ocS9AvJ3
 j1eOwD4kM7eZK5OMwV2Iav7sZd+RMydkUXv3XW+XDvvMBQnYQgkouSvecXc99gnWEWfc
 0U48W/5OnH7Y6lRwFi0mEwzsyXa75e2Lr3QgO0+maXpYwGJjHp++/yQSuHGxLoINrZW/
 GpMdAn+FMpAD4uMBV6lDoqppqSQg00r20MC3fHEtGHgJItNYuWvTsnEcFT33+TbqCrQs
 8/xQwq3Eq09URxzNRFxr4H5xAZ8xXCBDKgdnyuqxG7yovzlm640xqjbYhM3SYOszizq3
 TD5w==
X-Gm-Message-State: APjAAAX9nAqVDNqGarFqKAsaN30fMuH2RwSgRkFuceTiC6XN9whJ1qfl
 wkm8Ac6kLHaG+0L8PvU5D1P5kw==
X-Google-Smtp-Source: APXvYqxxohEgZyP4rbQcsHOnT/Uj8kI48ljVxqHca36KVny0UBGYsIzeiuCKaXzUsvMLhPZCZPLhXA==
X-Received: by 2002:a17:902:b484:: with SMTP id
 y4mr59389471plr.88.1555104694975; 
 Fri, 12 Apr 2019 14:31:34 -0700 (PDT)
Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com.
 [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id q77sm49007215pfi.45.2019.04.12.14.31.34
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 12 Apr 2019 14:31:34 -0700 (PDT)
Date: Fri, 12 Apr 2019 14:31:31 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>, "Richardson,
 Bruce" <bruce.richardson@intel.com>, David Christensen
 <drc@linux.vnet.ibm.com>, "thomas@monjalon.net" <thomas@monjalon.net>,
 "arybchenko@solarflare.com" <arybchenko@solarflare.com>, "dev@dpdk.org"
 <dev@dpdk.org>, "radhika.chirra@ibm.com" <radhika.chirra@ibm.com>,
 "stable@dpdk.org" <stable@dpdk.org>
Message-ID: <20190412143131.211ba764@shemminger-XPS-13-9360>
In-Reply-To: <6aa39725-2827-6ce0-e406-27ac44a2132b@intel.com>
References: <1554927376-93022-1-git-send-email-drc@linux.vnet.ibm.com>
 <20190410210017.GA742@bricha3-MOBL.ger.corp.intel.com>
 <20190410160818.78855564@shemminger-XPS-13-9360>
 <88e75c95-b2d3-ca28-b4f3-d27d0c7d6e99@intel.com>
 <2601191342CEEE43887BDE71AB9772580148A96EA6@irsmsx105.ger.corp.intel.com>
 <0c9b3ee9-4bc4-4ab0-7678-4827538dda3a@intel.com>
 <6aa39725-2827-6ce0-e406-27ac44a2132b@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH] ethdev: missing typecast from void in
 eth_dev_pci_specific_init
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://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190412213131.FqSnWohxz-sicUjqgrLpKoWt2hq4zYTJwzkJd9vE3Fs@z>

On Fri, 12 Apr 2019 18:29:46 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 4/12/2019 6:25 PM, Ferruh Yigit wrote:
> > On 4/12/2019 6:15 PM, Ananyev, Konstantin wrote:  
> >>
> >>  
> >>> -----Original Message-----
> >>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> >>> Sent: Friday, April 12, 2019 6:09 PM
> >>> To: Stephen Hemminger <stephen@networkplumber.org>; Richardson, Bruce <bruce.richardson@intel.com>
> >>> Cc: David Christensen <drc@linux.vnet.ibm.com>; thomas@monjalon.net; arybchenko@solarflare.com; dev@dpdk.org;
> >>> radhika.chirra@ibm.com; stable@dpdk.org
> >>> Subject: Re: [dpdk-dev] [PATCH] ethdev: missing typecast from void in eth_dev_pci_specific_init
> >>>
> >>> On 4/11/2019 12:08 AM, Stephen Hemminger wrote:  
> >>>> On Wed, 10 Apr 2019 22:00:18 +0100
> >>>> Bruce Richardson <bruce.richardson@intel.com> wrote:
> >>>>  
> >>>>> On Wed, Apr 10, 2019 at 03:16:16PM -0500, David Christensen wrote:  
> >>>>>> The function eth_dev_pci_specific_init is missing a typecast to
> >>>>>> (struct rte_pci_device *) for the input argument bus_device.
> >>>>>>
> >>>>>> Cc: stable@dpdk.org
> >>>>>>
> >>>>>> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> >>>>>> Tested-by: Radhika Chirra <radhika.chirra@ibm.com>
> >>>>>> ---
> >>>>>>  lib/librte_ethdev/rte_ethdev_pci.h | 2 +-
> >>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>
> >>>>>> diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h
> >>>>>> index 23257e9..a325311 100644
> >>>>>> --- a/lib/librte_ethdev/rte_ethdev_pci.h
> >>>>>> +++ b/lib/librte_ethdev/rte_ethdev_pci.h
> >>>>>> @@ -72,7 +72,7 @@
> >>>>>>
> >>>>>>  static inline int
> >>>>>>  eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) {
> >>>>>> -	struct rte_pci_device *pci_dev = bus_device;
> >>>>>> +	struct rte_pci_device *pci_dev = (struct rte_pci_device *)bus_device;
> >>>>>>  
> >>>>>
> >>>>> Is this needed for building some C++ apps that are including the header
> >>>>> file (directly, or indirectly), because for pure C, "void *" types should
> >>>>> be assignable to any other pointer type without casting?
> >>>>>
> >>>>> /Bruce  
> >>>>
> >>>> Another example of Why the Hell is this inline?
> >>>>  
> >>>
> >>> It has been done inline intentionally at the time as far as remember, this
> >>> header is for drivers not for applications, it has helper functions.
> >>>
> >>> The common code from drivers related to the bus put into header files, so the
> >>> code itself belongs to drivers not ethdev and reduces duplicates in them.  
> >>
> >> Ok that's the common code used by the drivers...
> >> But why it still can't be in .c file?  
> > 
> > When it is in .c file, it will be either in ethdev library, single location in
> > .c file and binary file, but location is not exactly right, because code belongs
> > to drivers.
> > Or code should be in .c files of each drivers, this will be code duplication.
> > 
> > Having in .h file makes code in single place, but when compiled code will be in
> > each driver object file/ library.
> > 
> > Of course it works when put into a .c file in ehtdev, but bus (pci and vdev)
> > related code are not belongs to ethdev library and I believe shouldn't be part
> > of ethdev binary. And those bus helper headers are only for drivers to include,
> > so having inline shouldn't be a problem at all because there is not stability
> > concern in that interface.
> >   
> 
> btw, if you put those into .c file in ethdev, you will be creating a dependency
> from ethdev to bus code, to all available buses which will make impossible to
> disable any bus type if you use ethdev.

The problem I see is rte_ethdev_pci.h, it should be headers only and then put
code rte_ethdev_pci.c