[dpdk-dev,v2,1/7] pci: If a driver's probe function fails, unmap resources.

Message ID 1479931644-78960-1-git-send-email-benjamin.walker@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
checkpatch/checkpatch success coding style OK

Commit Message

Walker, Benjamin Nov. 23, 2016, 8:07 p.m. UTC
  If resources were mapped prior to probe, unmap them
if probe fails.

This does not handle the case where the kernel driver was
forcibly unbound prior to probe.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
---
 lib/librte_eal/common/eal_common_pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Shreyansh Jain Nov. 25, 2016, 9:21 a.m. UTC | #1
On Thursday 24 November 2016 01:37 AM, Ben Walker wrote:
> If resources were mapped prior to probe, unmap them
> if probe fails.
>
> This does not handle the case where the kernel driver was
> forcibly unbound prior to probe.
>
> Signed-off-by: Ben Walker <benjamin.walker@intel.com>
> ---
>  lib/librte_eal/common/eal_common_pci.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
> index 6bff675..4f8c3a0 100644
> --- a/lib/librte_eal/common/eal_common_pci.c
> +++ b/lib/librte_eal/common/eal_common_pci.c
> @@ -215,8 +215,11 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
>
>  		/* call the driver probe() function */
>  		ret = dr->probe(dr, dev);
> -		if (ret)
> +		if (ret) {
>  			dev->driver = NULL;
> +			if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
> +				rte_eal_pci_unmap_device(dev);
> +		}
>
>  		return ret;
>  	}
>

Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
  
Thomas Monjalon Dec. 21, 2016, 4:19 p.m. UTC | #2
2016-11-25 14:51, Shreyansh Jain:
> On Thursday 24 November 2016 01:37 AM, Ben Walker wrote:
> > If resources were mapped prior to probe, unmap them
> > if probe fails.
> >
> > This does not handle the case where the kernel driver was
> > forcibly unbound prior to probe.
> >
> > Signed-off-by: Ben Walker <benjamin.walker@intel.com>
> 
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>

The 3 first patches of this series seems good and easy to agree,
except some minor nits.

Please Ben or Shreyansh, could you respin only them to help make
progress before applying a PCI/bus rework from Shreyansh?
As soon as one of you shoot a partial v3, I'll apply them.
Thanks
  
Thomas Monjalon Jan. 4, 2017, 5:39 p.m. UTC | #3
2016-12-21 17:19, Thomas Monjalon:
> 2016-11-25 14:51, Shreyansh Jain:
> > On Thursday 24 November 2016 01:37 AM, Ben Walker wrote:
> > > If resources were mapped prior to probe, unmap them
> > > if probe fails.
> > >
> > > This does not handle the case where the kernel driver was
> > > forcibly unbound prior to probe.
> > >
> > > Signed-off-by: Ben Walker <benjamin.walker@intel.com>
> > 
> > Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> 
> The 3 first patches of this series seems good and easy to agree,
> except some minor nits.
> 
> Please Ben or Shreyansh, could you respin only them to help make
> progress before applying a PCI/bus rework from Shreyansh?
> As soon as one of you shoot a partial v3, I'll apply them.
> Thanks

Please Ben, do you want to make a partial v3?
  
Thomas Monjalon Jan. 9, 2017, 5:12 p.m. UTC | #4
2017-01-04 18:39, Thomas Monjalon:
> 2016-12-21 17:19, Thomas Monjalon:
> > 2016-11-25 14:51, Shreyansh Jain:
> > > On Thursday 24 November 2016 01:37 AM, Ben Walker wrote:
> > > > If resources were mapped prior to probe, unmap them
> > > > if probe fails.
> > > >
> > > > This does not handle the case where the kernel driver was
> > > > forcibly unbound prior to probe.
> > > >
> > > > Signed-off-by: Ben Walker <benjamin.walker@intel.com>
> > > 
> > > Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> > 
> > The 3 first patches of this series seems good and easy to agree,
> > except some minor nits.
> > 
> > Please Ben or Shreyansh, could you respin only them to help make
> > progress before applying a PCI/bus rework from Shreyansh?
> > As soon as one of you shoot a partial v3, I'll apply them.
> > Thanks
> 
> Please Ben, do you want to make a partial v3?

Please, would you mind to re-send the first 3 patches as v3?
  

Patch

diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 6bff675..4f8c3a0 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -215,8 +215,11 @@  rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 
 		/* call the driver probe() function */
 		ret = dr->probe(dr, dev);
-		if (ret)
+		if (ret) {
 			dev->driver = NULL;
+			if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING)
+				rte_eal_pci_unmap_device(dev);
+		}
 
 		return ret;
 	}