[2/2] eal: DPDK init doesn't fail even if device probe fails.
diff mbox series

Message ID 1566934217-23824-2-git-send-email-nitin.katiyar@ericsson.com
State New
Delegated to: David Marchand
Headers show
Series
  • [1/2] bus/pci: Fail rte_pci_probe if probing all whitelisted devices fail.
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Nitin Katiyar Aug. 27, 2019, 7:30 p.m. UTC
rte_bus_probe() doesn't return error. As a result rte_eal_init()
doesn't catch this error and thus making dpdk initialization
successful despite probe failing for devices.

This patch returns error if probe fails for any of device.

Signed-off-by: Nitin Katiyar <nitin.katiyar@ericsson.com>
---
 lib/librte_eal/common/eal_common_bus.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Aaron Conole Aug. 27, 2019, 1:57 p.m. UTC | #1
Nitin Katiyar <nitin.katiyar@ericsson.com> writes:

> rte_bus_probe() doesn't return error. As a result rte_eal_init()
> doesn't catch this error and thus making dpdk initialization
> successful despite probe failing for devices.
>
> This patch returns error if probe fails for any of device.
>
> Signed-off-by: Nitin Katiyar <nitin.katiyar@ericsson.com>
> ---
>  lib/librte_eal/common/eal_common_bus.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
> index baa5b53..1721179 100644
> --- a/lib/librte_eal/common/eal_common_bus.c
> +++ b/lib/librte_eal/common/eal_common_bus.c
> @@ -70,16 +70,20 @@
>  		}
>  
>  		ret = bus->probe();
> -		if (ret)
> +		if (ret) {
>  			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
>  				bus->name);
> +			return ret;
> +		}

If we return an error here, won't this fail to probe vbus?  In fact,
this will disrupt all subsequent bus probes, yes?

Why should a single bus problem be a 'cannot init' level failure?

>  	}
>  
>  	if (vbus) {
>  		ret = vbus->probe();
> -		if (ret)
> +		if (ret) {
>  			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
>  				vbus->name);
> +			return ret;
> +		}
>  	}
>  
>  	return 0;

Patch
diff mbox series

diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
index baa5b53..1721179 100644
--- a/lib/librte_eal/common/eal_common_bus.c
+++ b/lib/librte_eal/common/eal_common_bus.c
@@ -70,16 +70,20 @@ 
 		}
 
 		ret = bus->probe();
-		if (ret)
+		if (ret) {
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
 				bus->name);
+			return ret;
+		}
 	}
 
 	if (vbus) {
 		ret = vbus->probe();
-		if (ret)
+		if (ret) {
 			RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
 				vbus->name);
+			return ret;
+		}
 	}
 
 	return 0;