[v2] eal: fix errno on service cores init failure
diff mbox series

Message ID 20210113082805.5945-1-olivier.matz@6wind.com
State Accepted
Delegated to: David Marchand
Headers show
Series
  • [v2] eal: fix errno on service cores init failure
Related show

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Olivier Matz Jan. 13, 2021, 8:28 a.m. UTC
Currently, when rte_service_init() fails at initialization, we
see the following message:

  Cannot init EAL: Exec format error

This error code does describe the real issue. Instead, use the error
code returned by the function.

Fixes: e39824500825 ("service: initialize with EAL")
Cc: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
---

v2
* rebase on top of main branch
* add same change for windows

 lib/librte_eal/freebsd/eal.c | 4 ++--
 lib/librte_eal/linux/eal.c   | 4 ++--
 lib/librte_eal/windows/eal.c | 6 ++++--
 3 files changed, 8 insertions(+), 6 deletions(-)

Comments

David Marchand Jan. 14, 2021, 3:52 p.m. UTC | #1
On Wed, Jan 13, 2021 at 9:29 AM Olivier Matz <olivier.matz@6wind.com> wrote:
>
> Currently, when rte_service_init() fails at initialization, we
> see the following message:
>
>   Cannot init EAL: Exec format error
>
> This error code does describe the real issue. Instead, use the error
> code returned by the function.
>
> Fixes: e39824500825 ("service: initialize with EAL")
> Cc: stable@dpdk.org
>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>

Applied, thanks.

Patch
diff mbox series

diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c
index d6ea023750..51478358c7 100644
--- a/lib/librte_eal/freebsd/eal.c
+++ b/lib/librte_eal/freebsd/eal.c
@@ -906,7 +906,7 @@  rte_eal_init(int argc, char **argv)
 	ret = rte_service_init();
 	if (ret) {
 		rte_eal_init_alert("rte_service_init() failed");
-		rte_errno = ENOEXEC;
+		rte_errno = -ret;
 		return -1;
 	}
 
@@ -922,7 +922,7 @@  rte_eal_init(int argc, char **argv)
 	 */
 	ret = rte_service_start_with_defaults();
 	if (ret < 0 && ret != -ENOTSUP) {
-		rte_errno = ENOEXEC;
+		rte_errno = -ret;
 		return -1;
 	}
 
diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index a4161be630..32b48c3de9 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -1273,7 +1273,7 @@  rte_eal_init(int argc, char **argv)
 	ret = rte_service_init();
 	if (ret) {
 		rte_eal_init_alert("rte_service_init() failed");
-		rte_errno = ENOEXEC;
+		rte_errno = -ret;
 		return -1;
 	}
 
@@ -1295,7 +1295,7 @@  rte_eal_init(int argc, char **argv)
 	 */
 	ret = rte_service_start_with_defaults();
 	if (ret < 0 && ret != -ENOTSUP) {
-		rte_errno = ENOEXEC;
+		rte_errno = -ret;
 		return -1;
 	}
 
diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c
index 105549de1b..1e5f6576f0 100644
--- a/lib/librte_eal/windows/eal.c
+++ b/lib/librte_eal/windows/eal.c
@@ -264,6 +264,7 @@  rte_eal_init(int argc, char **argv)
 	const struct rte_config *config = rte_eal_get_configuration();
 	struct internal_config *internal_conf =
 		eal_get_internal_configuration();
+	int ret;
 
 	rte_eal_log_init(NULL, 0);
 
@@ -387,9 +388,10 @@  rte_eal_init(int argc, char **argv)
 	}
 
 	/* Initialize services so drivers can register services during probe. */
-	if (rte_service_init()) {
+	ret = rte_service_init();
+	if (ret) {
 		rte_eal_init_alert("rte_service_init() failed");
-		rte_errno = ENOEXEC;
+		rte_errno = -ret;
 		return -1;
 	}