From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 23DACA0096 for ; Fri, 12 Apr 2019 23:31:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BE3C21B1F9; 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 1AEF81B1F9 for ; Fri, 12 Apr 2019 23:31:35 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id cv12so5726348plb.9 for ; 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=BdNee0L44Ffn8YJeFmJ5gx/R52/darjV1j8/m9/uJOJwTWpVEQFP2lFRfEfqdtoVxG 6/D5Mu/cAbH3elyOJCeDp9DQOYXom9Y6k5S/slErmTLVLzrW+xafChZE3j7m/lBUIVYp wZpmTjd5JHDSydWZyq08+K2Bd6e+ZuaWd+iZAq/RAje19EVwPU9bZM4D2c08TAywuJ+6 eEiZWmEpG2Bw7RbTh99YPalxQvKZCBnGRfAChZf/5lnpehimWRt9XheDf8WLREwrIQic zwj7TqF+/6Xe9s1Sttbsalvx90jU/pSGZgDFwuzczc8wWnHIAdNFefM24y4wFHOmS3JJ 3pgQ== X-Gm-Message-State: APjAAAWOoVBlkvSeED8SonMWKy3baL6oGS7fK9Qjof+KjU9cQuqhEj+T gfc+n2Z3tJbKwqWGk/uDS2lkLQ== 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 To: Ferruh Yigit Cc: "Ananyev, Konstantin" , "Richardson, Bruce" , David Christensen , "thomas@monjalon.net" , "arybchenko@solarflare.com" , "dev@dpdk.org" , "radhika.chirra@ibm.com" , "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=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] ethdev: missing typecast from void in eth_dev_pci_specific_init X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Fri, 12 Apr 2019 18:29:46 +0100 Ferruh Yigit 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 ; Richardson, Bruce > >>> Cc: David Christensen ; 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 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 > >>>>>> Tested-by: Radhika Chirra > >>>>>> --- > >>>>>> 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