From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wes1-so2.wedos.net (wes1-so2.wedos.net [46.28.106.16]) by dpdk.org (Postfix) with ESMTP id 42D242A5B for ; Wed, 10 Feb 2016 13:27:56 +0100 (CET) Received: from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz [147.229.13.147]) by wes1-so2.wedos.net (Postfix) with ESMTPSA id 3q0gND0C72z1rl; Wed, 10 Feb 2016 13:27:56 +0100 (CET) Date: Wed, 10 Feb 2016 13:29:18 +0100 From: Jan Viktorin To: David Marchand Message-ID: <20160210132918.281ef29f@pcviktorin.fit.vutbr.cz> In-Reply-To: References: <1454076516-21591-1-git-send-email-david.marchand@6wind.com> <1454076516-21591-4-git-send-email-david.marchand@6wind.com> <20160209180555.3ad379cf@pcviktorin.fit.vutbr.cz> <20160210112028.7d1004a0@pcviktorin.fit.vutbr.cz> Organization: RehiveTech MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2016 12:27:56 -0000 On Wed, 10 Feb 2016 12:38:20 +0100 David Marchand wrote: > On Wed, Feb 10, 2016 at 11:20 AM, Jan Viktorin wrote: > > On Wed, 10 Feb 2016 10:27:14 +0100 > > David Marchand wrote: > >> #define RTE_EAL_PCI_REGISTER(name, d)\ > >> void pciinitfn_ ##name(void);\ > >> void __attribute__((constructor, used)) pciinitfn_ ##name(void)\ > >> {\ > >> rte_eal_pci_register(d);\ > > > > I meant > > rte_eal_pci_register(&(d)->pci_drv);\ > > > > Perhaps, my assumption that a PCI driver is always referred as pci_drv is wrong... > > Well, I suppose we will always have a pci driver embedded in some > other internal pmd structure. > So we can always expect it to be called pci_drv ... > > Btw, for drivers like mlx or virtio that need to do some more stuff in > their constructor (the iopl stuff for virtio is the most interesting > case, since the pci register happens only if iopl succeeded), we might > need some RTE_MODULE_INIT for those. > > But in such a case, I think having RTE_MODULE_INIT in all pmds would > make more sense, and RTE_EAL_PCI_REGISTER looks unneeded ? > The Linux Kernel solves this by allowing both ways. You can do it by hand and for most cases you can use just a simple oneliner. So, we can have the RTE_(EAL_)MODULE_INIT for the general case. And then eg. RTE_EAL_PCI_MODULE_INIT that makes the most common glue code to register a single driver and who finally calls the RTE_EAL_MODULE_INIT. Regards Jan