[1/2] bus/pci: fix driver detach clear
Checks
Commit Message
When a rte_device is unplugged, the driver should be detached from the
device.
The PCI detach driver operation wrongly didn't clear the driver from the
device structure what remain the device in probe state from the EAL
point of view.
Clear the driver in driver detach successful operation.
Fixes: dbe6b4b61b0e ("pci: probe or close device")
Cc: mukawa@igel.co.jp
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
---
drivers/bus/pci/pci_common.c | 1 +
1 file changed, 1 insertion(+)
Comments
12/11/2019 09:47, Matan Azrad:
> When a rte_device is unplugged, the driver should be detached from the
> device.
Yes
> The PCI detach driver operation wrongly didn't clear the driver from the
> device structure what remain the device in probe state from the EAL
> point of view.
Are you aware of an use case which is broken because of that?
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -247,6 +247,7 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)
The git context above is wrong, it should show the function rte_pci_detach_dev.
> /* clear driver structure */
> dev->driver = NULL;
> + dev->device.driver = NULL;
It looks a good fix.
Acked-by: Thomas Monjalon <thomas@monjalon.net>
I am wondering if there could be a risk for any test application
if applied in 19.11-rc3.
I think we should try to get it and revert if a side effect is discovered.
Hi
From: Thomas Monjalon
> 12/11/2019 09:47, Matan Azrad:
> > When a rte_device is unplugged, the driver should be detached from the
> > device.
>
> Yes
>
> > The PCI detach driver operation wrongly didn't clear the driver from
> > the device structure what remain the device in probe state from the
> > EAL point of view.
>
> Are you aware of an use case which is broken because of that?
Yes, will add a small example.
>
> > --- a/drivers/bus/pci/pci_common.c
> > +++ b/drivers/bus/pci/pci_common.c
> > @@ -247,6 +247,7 @@ static struct rte_devargs
> > *pci_devargs_lookup(struct rte_pci_device *dev)
>
> The git context above is wrong, it should show the function
> rte_pci_detach_dev.
>
> > /* clear driver structure */
> > dev->driver = NULL;
> > + dev->device.driver = NULL;
>
> It looks a good fix.
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
>
> I am wondering if there could be a risk for any test application if applied in
> 19.11-rc3.
> I think we should try to get it and revert if a side effect is discovered.
>
@@ -247,6 +247,7 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)
/* clear driver structure */
dev->driver = NULL;
+ dev->device.driver = NULL;
if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
/* unmap resources for devices that use igb_uio */