diff options
author | Matias Elo <matias.elo@nokia.com> | 2016-03-23 15:14:39 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-03-29 11:32:53 +0300 |
commit | e3092b96f69b44abe22e8e65468c03245b7a9fd9 (patch) | |
tree | 46f51c2d30115154cc360cd238b17b76fe694784 | |
parent | 815cc95b6b4930a7026afe628519435f93ad1821 (diff) |
linux-generic: dpdk: pass ODP_PKTIO_DPDK_PARAMS environment variable to dpdk init
Pass ODP_PKTIO_DPDK_PARAMS environment variable to
rte_eal_init(). This can be used to pass DPDK only
configuration options from command line. E.g. configuring
vdev interfaces.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r-- | DEPENDENCIES | 5 | ||||
-rw-r--r-- | platform/linux-generic/pktio/dpdk.c | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/DEPENDENCIES b/DEPENDENCIES index 9fee177b6..0091f24ce 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -209,6 +209,11 @@ Prerequisites for building the OpenDataPlane (ODP) API $ cd <odp_dir> $ sudo ./test/performance/odp_l2fwd -i 0,1 -c 2 -m 0 + Additionally, DPDK command line options can be passed to the application + using ODP_PKTIO_DPDK_PARAMS environment variable. For example, allocate + 1024MB of memory: + $ sudo ODP_PKTIO_DPDK_PARAMS="-m 1024" ./test/performance/odp_l2fwd -i 0 -c 1 + 4.0 Packages needed to build API tests Cunit test framework version 2.1-3 is required diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 848425ddf..57625dce7 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -326,6 +326,7 @@ static int dpdk_pktio_init(void) int i; odp_cpumask_t mask; char mask_str[ODP_CPUMASK_STR_SIZE]; + const char *cmdline; int32_t masklen; int mem_str_len; int cmd_len; @@ -365,15 +366,19 @@ static int dpdk_pktio_init(void) mem_str_len = snprintf(NULL, 0, "%d", DPDK_MEMORY_MB); + cmdline = getenv("ODP_PKTIO_DPDK_PARAMS"); + if (cmdline == NULL) + cmdline = ""; + /* masklen includes the terminating null as well */ cmd_len = strlen("odpdpdk -c -m ") + masklen + mem_str_len + - strlen(" "); + strlen(cmdline) + strlen(" "); char full_cmd[cmd_len]; /* first argument is facility log, simply bind it to odpdpdk for now.*/ - cmd_len = snprintf(full_cmd, cmd_len, "odpdpdk -c %s -m %d", - mask_str, DPDK_MEMORY_MB); + cmd_len = snprintf(full_cmd, cmd_len, "odpdpdk -c %s -m %d %s", + mask_str, DPDK_MEMORY_MB, cmdline); for (i = 0, dpdk_argc = 1; i < cmd_len; ++i) { if (isspace(full_cmd[i])) |