2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-dpdk: Allow arbitrary eal arguments

A previous change moved some commonly used arguments from commandline to
the database, and with it the ability to pass arbitrary arguments to
EAL. This change allows arbitrary eal arguments to be provided
via a new db entry 'other_config:dpdk-extra' which will tokenize the
string and add it to the argument list. The only argument which will not
be supported with this change is '--no-huge', which appears to break the
system in other ways.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Tested-by: Sean K Mooney <sean.k.mooney@intel.com>
Tested-by: RobertX Wojciechowicz <robertx.wojciechowicz@intel.com>
Tested-by: Kevin Traynor <kevin.traynor@intel.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Kevin Traynor <kevin.traynor@intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
This commit is contained in:
Aaron Conole
2016-04-29 13:44:04 -04:00
committed by Daniele Di Proietto
parent 88964e6428
commit eac84432a4
5 changed files with 60 additions and 3 deletions

View File

@@ -39,6 +39,7 @@
#include "netdev-provider.h"
#include "netdev-vport.h"
#include "odp-util.h"
#include "openvswitch/dynamic-string.h"
#include "openvswitch/list.h"
#include "openvswitch/ofp-print.h"
#include "openvswitch/vlog.h"
@@ -2772,6 +2773,23 @@ dpdk_option_extend(char ***argv, int argc, const char *option,
newargv[argc+1] = xstrdup(value);
}
static int
extra_dpdk_args(const char *ovs_extra_config, char ***argv, int argc)
{
int ret = argc;
char *release_tok = xstrdup(ovs_extra_config);
char *tok = release_tok, *endptr = NULL;
for (tok = strtok_r(release_tok, " ", &endptr); tok != NULL;
tok = strtok_r(NULL, " ", &endptr)) {
char **newarg = grow_argv(argv, ret, 1);
*argv = newarg;
newarg[ret++] = xstrdup(tok);
}
free(release_tok);
return ret;
}
static int
construct_dpdk_options(const struct smap *ovs_other_config,
char ***argv, const int initial_size)
@@ -2869,8 +2887,14 @@ static int
get_dpdk_args(const struct smap *ovs_other_config, char ***argv,
int argc)
{
const char *extra_configuration;
int i = construct_dpdk_options(ovs_other_config, argv, argc);
i = construct_dpdk_mutex_options(ovs_other_config, argv, i);
extra_configuration = smap_get(ovs_other_config, "dpdk-extra");
if (extra_configuration) {
i = extra_dpdk_args(extra_configuration, argv, i);
}
return i;
}
@@ -2981,6 +3005,19 @@ dpdk_init__(const struct smap *ovs_other_config)
optind = 1;
if (VLOG_IS_INFO_ENABLED()) {
struct ds eal_args;
int opt;
ds_init(&eal_args);
ds_put_cstr(&eal_args, "EAL ARGS:");
for (opt = 0; opt < argc; ++opt) {
ds_put_cstr(&eal_args, " ");
ds_put_cstr(&eal_args, argv[opt]);
}
VLOG_INFO("%s", ds_cstr_ro(&eal_args));
ds_destroy(&eal_args);
}
/* Make sure things are initialized ... */
result = rte_eal_init(argc, argv);
if (result < 0) {