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>
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] ethdev: missing typecast from void in eth_dev_pci_specific_init
Date: Fri, 12 Apr 2019 14:31:31 -0700 [thread overview]
Message-ID: <20190412143131.211ba764@shemminger-XPS-13-9360> (raw)
In-Reply-To: <6aa39725-2827-6ce0-e406-27ac44a2132b@intel.com>
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
next prev parent reply other threads:[~2019-04-12 21:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-10 20:16 [dpdk-stable] " David Christensen
2019-04-10 20:29 ` Thomas Monjalon
2019-04-10 20:58 ` David Christensen
2019-04-10 21:14 ` Thomas Monjalon
2019-04-12 17:13 ` Ferruh Yigit
2019-04-10 21:00 ` [dpdk-stable] [dpdk-dev] " Bruce Richardson
2019-04-10 23:08 ` Stephen Hemminger
2019-04-12 17:09 ` Ferruh Yigit
2019-04-12 17:15 ` Ananyev, Konstantin
2019-04-12 17:25 ` Ferruh Yigit
2019-04-12 17:29 ` Ferruh Yigit
2019-04-12 21:31 ` Stephen Hemminger [this message]
2019-04-15 16:00 ` Ferruh Yigit
2019-04-10 21:36 ` [dpdk-stable] [PATCH v2] ethdev: missing typecast causes C++ build error David Christensen
2019-04-16 16:31 ` Ferruh Yigit
2019-04-16 16:39 ` Andrew Rybchenko
2019-04-16 16:46 ` [dpdk-stable] [dpdk-dev] " Ananyev, Konstantin
2019-04-16 21:19 ` Stephen Hemminger
2019-04-16 21:50 ` David Christensen
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=20190412143131.211ba764@shemminger-XPS-13-9360 \
--to=stephen@networkplumber.org \
--cc=arybchenko@solarflare.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=drc@linux.vnet.ibm.com \
--cc=ferruh.yigit@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=radhika.chirra@ibm.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).