[dpdk-dev] [PATCH 2/2] eal: DPDK init doesn't fail even if device probe fails.

Aaron Conole aconole at redhat.com
Tue Aug 27 15:57:01 CEST 2019


Nitin Katiyar <nitin.katiyar at 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 at 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;


More information about the dev mailing list