From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wes1-so1.wedos.net (wes1-so1.wedos.net [46.28.106.15]) by dpdk.org (Postfix) with ESMTP id A5BB32C31 for ; Wed, 13 Jul 2016 19:34:23 +0200 (CEST) Received: from jvn (dynamic-109-81-211-133.ipv4.broadband.iol.cz [109.81.211.133]) by wes1-so1.wedos.net (Postfix) with ESMTPSA id 3rqQtl0N7rzC2f; Wed, 13 Jul 2016 19:34:23 +0200 (CEST) Date: Wed, 13 Jul 2016 19:34:30 +0200 From: Jan Viktorin To: Shreyansh Jain Cc: , , Message-ID: <20160713193430.65b6df9c@jvn> In-Reply-To: <20160713112043.2fd847ca@jvn> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1468303282-2806-1-git-send-email-shreyansh.jain@nxp.com> <1468303282-2806-6-git-send-email-shreyansh.jain@nxp.com> <20160713112043.2fd847ca@jvn> Organization: RehiveTech X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-unknown-linux-gnu) Importance: high X-Priority: 2 (High) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 05/17] eal: introduce init macros 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, 13 Jul 2016 17:34:23 -0000 On Wed, 13 Jul 2016 11:20:43 +0200 Jan Viktorin wrote: > Hello Shreyansh, > > On Tue, 12 Jul 2016 11:31:10 +0530 > Shreyansh Jain wrote: > > > Introduce a RTE_INIT macro used to mark an init function as a constructor. > > Current eal macros have been converted to use this (no functional impact). > > DRIVER_REGISTER_PCI is added as a helper for pci drivers. > > > > Suggested-by: Jan Viktorin > > Signed-off-by: David Marchand > > Signed-off-by: Shreyansh Jain > > --- > > [...] > > > +#define RTE_INIT(func) \ > > +static void __attribute__((constructor, used)) func(void) > > + > > #ifdef __cplusplus > > } > > #endif > > diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h > > index fa74962..3027adf 100644 > > --- a/lib/librte_eal/common/include/rte_pci.h > > +++ b/lib/librte_eal/common/include/rte_pci.h > > @@ -470,6 +470,14 @@ void rte_eal_pci_dump(FILE *f); > > */ > > void rte_eal_pci_register(struct rte_pci_driver *driver); > > > > +/** Helper for PCI device registeration from driver (eth, crypto) instance */ > > +#define DRIVER_REGISTER_PCI(nm, drv) \ > > +RTE_INIT(pciinitfn_ ##nm); \ > > +static void pciinitfn_ ##nm(void) \ > > +{ \ > > You are missing setting the name here like PMD_REGISTER_DRIVER does > now. Or should I include it in my patch set? > > (drv).name = RTE_STR(nm); Moreover, it should accept the rte_pci_driver *, shouldn't it? Here, it expects a wrapper around it (eth_driver)... I now, my SoC patches were supposing the some... but I think it is wrong. The original David's patch set contains calls like this: RTE_EAL_PCI_REGISTER(bnx2xvf, rte_bnx2xvf_pmd.pci_drv); So, I think, we should go the original way. Jan > > > + rte_eal_pci_register(&drv.pci_drv); \ > > +} > > + > > /** > > * Unregister a PCI driver. > > * > > diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h > > index 4a686e6..71ed3bb 100644 > > --- a/lib/librte_eal/common/include/rte_tailq.h > > +++ b/lib/librte_eal/common/include/rte_tailq.h > > @@ -148,8 +148,8 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name); > > int rte_eal_tailq_register(struct rte_tailq_elem *t); > > > > #define EAL_REGISTER_TAILQ(t) \ > > -void tailqinitfn_ ##t(void); \ > > -void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \ > > +RTE_INIT(tailqinitfn_ ##t); \ > > +static void tailqinitfn_ ##t(void) \ > > { \ > > if (rte_eal_tailq_register(&t) < 0) \ > > rte_panic("Cannot initialize tailq: %s\n", t.name); \ > > > -- Jan Viktorin E-mail: Viktorin@RehiveTech.com System Architect Web: www.RehiveTech.com RehiveTech Brno, Czech Republic