Skip to content

Commit

Permalink
service: propagate init error in EAL
Browse files Browse the repository at this point in the history
[ upstream commit de6aede ]

Currently, when rte_service_init() fails at initialization, the
application always gets a ENOEXEC error code. For example, with testpmd,
this is displayed as:

  Cannot init EAL: Exec format error

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

Fixes: e398245 ("service: initialize with EAL")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
  • Loading branch information
olivier-matz-6wind authored and bluca committed Feb 4, 2021
1 parent 508b619 commit 4344784
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/librte_eal/freebsd/eal.c
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/librte_eal/linux/eal.c
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down
6 changes: 4 additions & 2 deletions lib/librte_eal/windows/eal.c
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 4344784

Please sign in to comment.