[dpdk-dev] [PATCH] pci: Don't call probe callback if driver already loaded.
David Marchand
david.marchand at 6wind.com
Thu Oct 27 15:28:03 CEST 2016
Hello Benjamin,
On Tue, Oct 25, 2016 at 11:50 PM, Ben Walker <benjamin.walker at intel.com> wrote:
> If the user asks to probe multiple times, the probe
> callback should only be called on devices that don't have
> a driver already loaded.
>
> This is useful if a driver is registered after the
> execution of a program has started and the list of devices
> needs to be re-scanned.
Why not use the hotplug api, attaching explicitely one pci device ?
> Signed-off-by: Ben Walker <benjamin.walker at intel.com>
> ---
> lib/librte_eal/common/eal_common_pci.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
> index 638cd86..971ad20 100644
> --- a/lib/librte_eal/common/eal_common_pci.c
> +++ b/lib/librte_eal/common/eal_common_pci.c
> @@ -289,6 +289,10 @@ pci_probe_all_drivers(struct rte_pci_device *dev)
> if (dev == NULL)
> return -1;
>
> + /* Check if a driver is already loaded */
> + if (dev->driver != NULL)
> + return 0;
> +
This can do the trick, yes.
To be safe, I think we are missing a check in
rte_eal_pci_probe_one_driver() so that dev->driver is only set when
the probe function from the driver did succeed.
--
David Marchand
More information about the dev
mailing list