[dpdk-dev] [PATCH 3/9] drivers: no more pdev drivers

Jan Viktorin viktorin at rehivetech.com
Wed Feb 10 13:29:18 CET 2016


On Wed, 10 Feb 2016 12:38:20 +0100
David Marchand <david.marchand at 6wind.com> wrote:

> On Wed, Feb 10, 2016 at 11:20 AM, Jan Viktorin <viktorin at rehivetech.com> wrote:
> > On Wed, 10 Feb 2016 10:27:14 +0100
> > David Marchand <david.marchand at 6wind.com> 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


More information about the dev mailing list