aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Kiss <zoltan.kiss@linaro.org>2015-06-12 19:28:54 +0100
committerZoltan Kiss <zoltan.kiss@linaro.org>2015-06-23 18:49:18 +0100
commitaf15aa91a3d96a9ea0dd572c6d59b5eba26c51ae (patch)
treedd5d1684402ecd4d30768516b3bea2b51b0ec19c
parentb0ea4716a00ce31ce0d6c391456c6d61172613d8 (diff)
init: reset optind before calling DPDK initv1.1.0.0_DPDK_1.7.1
The calling app might have changed it. Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
-rw-r--r--platform/linux-dpdk/odp_init.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-dpdk/odp_init.c
index da16ab1e6..a9083dcb7 100644
--- a/platform/linux-dpdk/odp_init.c
+++ b/platform/linux-dpdk/odp_init.c
@@ -11,6 +11,7 @@
#include <odp_packet_dpdk.h>
#include <odp_debug_internal.h>
#include <odp/system_info.h>
+#include <unistd.h>
#define PMD_EXT(drv) extern void devinitfn_##drv(void);
PMD_EXT(bond_drv)
@@ -103,13 +104,18 @@ static void parse_dpdk_args(const char *args, int *dst_argc, char ***dst_argv)
static void print_dpdk_env_help(void)
{
char **dpdk_argv;
- int dpdk_argc;
+ int dpdk_argc, save_optind;
parse_dpdk_args("--help", &dpdk_argc, &dpdk_argv);
ODP_ERR("Missing: export ODP_PLATFORM_PARAMS=\"EAL options\"\n");
ODP_ERR("Example: export ODP_PLATFORM_PARAMS=\"-n 4 --no-huge\"\n");
ODP_ERR("Note: -c argument substitutes automatically from odp coremask\n");
+ save_optind = optind;
+ optind = 1;
rte_eal_init(dpdk_argc, dpdk_argv);
+ optind = save_optind;
+ free(dpdk_argv[0]);
+ free(dpdk_argv);
}
@@ -119,7 +125,7 @@ int odp_init_dpdk(void)
int dpdk_argc;
char *env;
char *new_env;
- int core_mask, i;
+ int core_mask, i, save_optind;
env = getenv("ODP_PLATFORM_PARAMS");
if (env == NULL) {
@@ -143,7 +149,11 @@ int odp_init_dpdk(void)
fflush(stdout);
free(new_env);
+ /* reset optind, the caller application might have used it */
+ save_optind = optind;
+ optind = 1;
i = rte_eal_init(dpdk_argc, dpdk_argv);
+ optind = save_optind;
free(dpdk_argv[0]);
free(dpdk_argv);
if (i < 0) {