[dpdk-dev] [PATCH v4 2/4] drivers/bus: move driver assignment to end of probing

Thomas Monjalon thomas at monjalon.net
Fri Oct 12 12:45:33 CEST 2018


12/10/2018 10:32, Jan Remeš:
> Hi Andrew,
> 
> On Fri, Oct 12, 2018 at 9:45 AM Andrew Rybchenko
> <arybchenko at solarflare.com> wrote:
> >
> > Hi, Thomas,
> >
> > On 10/12/18 12:02 AM, Thomas Monjalon wrote:
> > > The PCI mapping requires to know the PCI driver to use,
> > > even before the probing is done. That's why the PCI driver is
> > > referenced early inside the PCI device structure. See
> > > commit 1d20a073fa5e ("bus/pci: reference driver structure before mapping")
> > >
> > > However the rte_driver does not need to be referenced in rte_device
> > > before the device probing is done.
> > > By moving back this assignment at the end of the device probing,
> > > it becomes possible to make clear the status of a rte_device.
> > >
> > > Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
> > > Reviewed-by: Andrew Rybchenko <arybchenko at solarflare.com>
> >
> > Have you seen driver->name usage in drivers/net/szedata2/rte_eth_szedata2.c
> > rte_szedata2_eth_dev_init() which is used from probe?
> >
> 
> for szedata2, this is easily fixed by using the driver name directly
> from the #define above.
> 
> diff --git a/drivers/net/szedata2/rte_eth_szedata2.c
> b/drivers/net/szedata2/rte_eth_szedata2.c
> index 8f92e72..4e5e01c 100644
> --- a/drivers/net/szedata2/rte_eth_szedata2.c
> +++ b/drivers/net/szedata2/rte_eth_szedata2.c
> @@ -1474,7 +1474,7 @@ struct szedata2_tx_queue {
>         PMD_INIT_FUNC_TRACE();
> 
>         PMD_INIT_LOG(INFO, "Initializing eth_dev %s (driver %s)", data->name,
> -                       dev->device->driver->name);
> +                       RTE_STR(RTE_SZEDATA2_DRIVER_NAME));
> 
>         /* Fill internal private structure. */
>         internals->dev = dev;
> @@ -1525,7 +1525,7 @@ struct szedata2_tx_queue {
>         ether_addr_copy(&eth_addr, data->mac_addrs);
> 
>         PMD_INIT_LOG(INFO, "%s device %s successfully initialized",
> -                       dev->device->driver->name, data->name);
> +                       RTE_STR(RTE_SZEDATA2_DRIVER_NAME), data->name);
> 
>         return 0;
>  }
> @@ -1547,7 +1547,7 @@ struct szedata2_tx_queue {
>         rte_free(dev->data->mac_addrs);
> 
>         PMD_DRV_LOG(INFO, "%s device %s successfully uninitialized",
> -                       dev->device->driver->name, dev->data->name);
> +                       RTE_STR(RTE_SZEDATA2_DRIVER_NAME), dev->data->name);
> 
>         return 0;
>  }

OK, I'll include such change in next version.





More information about the dev mailing list