[dpdk-dev] [PATCH v8 3/9] pci: split match and probe function

Thomas Monjalon thomas.monjalon at 6wind.com
Wed Jan 18 08:31:01 CET 2017


2017-01-18 06:17, Shreyansh Jain:
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > 2017-01-17 19:07, Shreyansh Jain:
> > > +static int
> > > +rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
> > > +               struct rte_pci_device *dev)
> > > +{
> > > +       int ret;
> > > +       struct rte_pci_addr *loc;
> > > +
> > > +       if ((dr == NULL) || (dev == NULL))
> > > +               return -EINVAL;
> > > +
> > > +       ret = rte_pci_match(dr, dev);
> > 
> > I do not understand this function.
> > The driver should be known by the device at this stage.
> > Why specifying a driver as parameter?
> > 
> > I know it is not new in this series, but
> > pci_detach_all_drivers(struct rte_pci_device *dev) makes no sense to me.
> 
> From what I understand, pci_detach_all_drivers is simply a wrapper over the PCI driver list, calling rte_eal_pci_detach_dev for each driver. Considering that all it does is iterate, it is not functionally required.
> 
> But, let me clarify one more thing: There is a possibility that rte_pci_device->pci_driver be directly used in case of detach rather than searching for a driver. This is assuming that before 'detach', a pci_device would link to a valid pci_driver. Is there some caveat in this assumption?

I would say it it always true.
But seeing this code existing makes me hesitates.
I suggest to go with this assumption for RC1 and remove this loop.


More information about the dev mailing list