From patchwork Tue Apr 26 19:42:48 2016
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Aaron Conole
X-Patchwork-Id: 615141
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Received: from archives.nicira.com (archives.nicira.com [96.126.127.54])
by ozlabs.org (Postfix) with ESMTP id 3qvYRz40t8z9t5g
for ;
Wed, 27 Apr 2016 05:43:43 +1000 (AEST)
Received: from archives.nicira.com (localhost [127.0.0.1])
by archives.nicira.com (Postfix) with ESMTP id 6C450106BF;
Tue, 26 Apr 2016 12:43:03 -0700 (PDT)
X-Original-To: dev@openvswitch.org
Delivered-To: dev@openvswitch.org
Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67])
by archives.nicira.com (Postfix) with ESMTPS id CC676106AA
for ; Tue, 26 Apr 2016 12:42:59 -0700 (PDT)
Received: from bar5.cudamail.com (unknown [192.168.21.12])
by mx1e4.cudamail.com (Postfix) with ESMTPS id 5731E1E0057
for ; Tue, 26 Apr 2016 13:42:59 -0600 (MDT)
X-ASG-Debug-ID: 1461699778-09eadd6dea16f7d0001-byXFYA
Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com
with
ESMTP id vjG57uDEk9uQKbpS (version=TLSv1 cipher=DHE-RSA-AES256-SHA
bits=256 verify=NO) for ;
Tue, 26 Apr 2016 13:42:59 -0600 (MDT)
X-Barracuda-Envelope-From: aconole@redhat.com
X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2
Received: from unknown (HELO mx1.redhat.com) (209.132.183.28)
by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted);
26 Apr 2016 19:42:58 -0000
Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at _spf1.redhat.com
designates 209.132.183.28 as permitted sender)
X-Barracuda-Apparent-Source-IP: 209.132.183.28
X-Barracuda-RBL-IP: 209.132.183.28
Received: from int-mx11.intmail.prod.int.phx2.redhat.com
(int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 61BB36265A;
Tue, 26 Apr 2016 19:42:57 +0000 (UTC)
Received: from aconole-fed23.bos.redhat.com (dhcp-25-211.bos.redhat.com
[10.18.25.211])
by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with
ESMTP id u3QJgntd022156; Tue, 26 Apr 2016 15:42:56 -0400
X-CudaMail-Envelope-Sender: aconole@redhat.com
From: Aaron Conole
To: dev@openvswitch.org, Flavio Leitner ,
Kevin Traynor ,
Panu Matilainen ,
RobertX Wojciechowicz ,
Sean K Mooney , Andy Zhou ,
Daniele Di Proietto ,
Zoltan Kiss ,
Christian Ehrhardt ,
Ben Pfaff
X-CudaMail-Whitelist-To: dev@openvswitch.org
X-CudaMail-MID: CM-E2-425076612
X-CudaMail-DTE: 042616
X-CudaMail-Originating-IP: 209.132.183.28
Date: Tue, 26 Apr 2016 15:42:48 -0400
X-ASG-Orig-Subj: [##CM-E2-425076612##][PATCH v12 5/6] netdev-dpdk: Allow
arbitrary eal arguments
Message-Id: <1461699769-8496-6-git-send-email-aconole@redhat.com>
In-Reply-To: <1461699769-8496-1-git-send-email-aconole@redhat.com>
References: <1461699769-8496-1-git-send-email-aconole@redhat.com>
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
(mx1.redhat.com [10.5.110.39]); Tue, 26 Apr 2016 19:42:57 +0000 (UTC)
X-Barracuda-Connect: UNKNOWN[192.168.24.2]
X-Barracuda-Start-Time: 1461699779
X-Barracuda-Encrypted: DHE-RSA-AES256-SHA
X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi
X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?=
X-Virus-Scanned: by bsmtpd at cudamail.com
X-Barracuda-BRTS-Status: 1
Subject: [ovs-dev] [PATCH v12 5/6] netdev-dpdk: Allow arbitrary eal arguments
X-BeenThere: dev@openvswitch.org
X-Mailman-Version: 2.1.16
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Errors-To: dev-bounces@openvswitch.org
Sender: "dev"
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
Tested-by: Sean K Mooney
Tested-by: RobertX Wojciechowicz
Tested-by: Kevin Traynor
Acked-by: Panu Matilainen
Acked-by: Kevin Traynor
Acked-by: Flavio Leitner
---
Previous: http://openvswitch.org/pipermail/dev/2016-April/069031.html
v12:
* Squashed NEWS related change into this patch
* Dropped a useless assignment hunk
INSTALL.DPDK.md | 5 +++++
NEWS | 3 ++-
lib/netdev-dpdk.c | 37 +++++++++++++++++++++++++++++++++++++
utilities/ovs-dev.py | 7 +++++--
vswitchd/vswitch.xml | 11 +++++++++++
5 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md
index 3cc283a..9f907f8 100644
--- a/INSTALL.DPDK.md
+++ b/INSTALL.DPDK.md
@@ -173,6 +173,11 @@ Using the DPDK with ovs-vswitchd:
* dpdk-hugepage-dir
Directory where hugetlbfs is mounted
+ * dpdk-extra
+ Extra arguments to provide to DPDK EAL, as previously specified on the
+ command line. Do not pass '--no-huge' to the system in this way. Support
+ for running the system without hugepages is nonexistent.
+
* cuse-dev-name
Option to set the vhost_cuse character device name.
diff --git a/NEWS b/NEWS
index f349819..e819438 100644
--- a/NEWS
+++ b/NEWS
@@ -30,7 +30,8 @@ Post-v2.5.0
* Sensible defaults have been introduced for many of the required
configuration options
* DB entries have been added for many of the DPDK EAL command line
- arguments
+ arguments. Additional arguments can be passed via the dpdk-extra
+ entry.
- ovs-benchmark: This utility has been removed due to lack of use and
bitrot.
- ovs-appctl:
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index e7951df..d676a3e 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -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"
@@ -2774,6 +2775,23 @@ dpdk_option_extend(char ***argv, int argc, const char *option,
}
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 ovsrec_open_vswitch *ovs_cfg,
char ***argv, const int initial_size)
{
@@ -2871,8 +2889,14 @@ static int
get_dpdk_args(const struct ovsrec_open_vswitch *ovs_cfg, char ***argv,
int argc)
{
+ const char *extra_configuration;
int i = construct_dpdk_options(ovs_cfg, argv, argc);
i = construct_dpdk_mutex_options(ovs_cfg, argv, i);
+
+ extra_configuration = smap_get(&ovs_cfg->other_config, "dpdk-extra");
+ if (extra_configuration) {
+ i = extra_dpdk_args(extra_configuration, argv, i);
+ }
return i;
}
@@ -2979,6 +3003,19 @@ dpdk_init__(const struct ovsrec_open_vswitch *ovs_cfg)
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) {
diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py
index a74b528..524f574 100755
--- a/utilities/ovs-dev.py
+++ b/utilities/ovs-dev.py
@@ -267,6 +267,8 @@ def run():
if options.dpdk:
_sh("ovs-vsctl --no-wait set Open_vSwitch %s " \
"other_config:dpdk-init=true" % root_uuid)
+ _sh("ovs-vsctl --no-wait set Open_vSwitch %s other_config:" \
+ "dpdk-extra=\"%s\"" % (root_uuid, ' '.join(options.dpdk)))
else:
_sh("ovs-vsctl --no-wait set Open_vSwitch %s " \
"other_config:dpdk-init=false" % root_uuid)
@@ -423,8 +425,9 @@ def main():
help="run ovs-vswitchd under gdb")
group.add_option("--valgrind", dest="valgrind", action="store_true",
help="run ovs-vswitchd under valgrind")
- group.add_option("--dpdk", dest="dpdk", action="store_true",
- help="run ovs-vswitchd with dpdk")
+ group.add_option("--dpdk", dest="dpdk", action="callback",
+ callback=parse_subargs,
+ help="run ovs-vswitchd with dpdk subopts (ended by --)")
group.add_option("--clang", dest="clang", action="store_true",
help="Use binaries built by clang")
group.add_option("--user", dest="user", action="store", default="",
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index e6d7359..2212aef 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -287,6 +287,17 @@
+
+
+ Specifies additional eal command line arguments for DPDK.
+
+
+ The default is empty. Changing this value requires restarting the
+ daemon
+
+
+