summaryrefslogtreecommitdiff
path: root/vswitchd
diff options
context:
space:
mode:
authorAaron Conole <aconole@redhat.com>2016-04-29 13:44:01 -0400
committerDaniele Di Proietto <diproiettod@vmware.com>2016-04-29 15:07:39 -0700
commitbab6940971336510c1f4342cde0bc17da46b99f1 (patch)
tree1978f936db9c59f46497e8c3220ae9ab8bc94a05 /vswitchd
parent563c98d86e77ba0345661e212137906747958db1 (diff)
downloadopenvswitch-bab6940971336510c1f4342cde0bc17da46b99f1.tar.gz
netdev-dpdk: Convert initialization from cmdline to db
Existing DPDK integration is provided by use of command line options which must be split out and passed to librte in a special manner. However, this forces any configuration to be passed by way of a special DPDK flag, and interferes with ovs+dpdk packaging solutions. This commit delays dpdk initialization until after the OVS database connection is established, at which point ovs initializes librte. It pulls all of the config data from the OVS database, and assembles a new argv/argc pair to be passed along. Signed-off-by: Aaron Conole <aconole@redhat.com> Acked-by: Kevin Traynor <kevin.traynor@intel.com> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
Diffstat (limited to 'vswitchd')
-rw-r--r--vswitchd/bridge.c5
-rw-r--r--vswitchd/ovs-vswitchd.8.in6
-rw-r--r--vswitchd/ovs-vswitchd.c27
-rw-r--r--vswitchd/vswitch.xml108
4 files changed, 121 insertions, 25 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 439ca94aa..b4e5ea7ff 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -34,6 +34,7 @@
#include "if-notifier.h"
#include "jsonrpc.h"
#include "lacp.h"
+#include "lib/netdev-dpdk.h"
#include "mac-learning.h"
#include "mcast-snooping.h"
#include "netdev.h"
@@ -2892,6 +2893,10 @@ bridge_run(void)
}
cfg = ovsrec_open_vswitch_first(idl);
+ if (cfg) {
+ dpdk_init(&cfg->other_config);
+ }
+
/* Initialize the ofproto library. This only needs to run once, but
* it must be done after the configuration is set. If the
* initialization has already occurred, bridge_init_ofproto()
diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
index 601b7a112..3dacfc34b 100644
--- a/vswitchd/ovs-vswitchd.8.in
+++ b/vswitchd/ovs-vswitchd.8.in
@@ -84,9 +84,9 @@ only allow privileged users, such as the superuser, to use it.
unavailable or unsuccessful.
.
.SS "DPDK Options"
-.IP "\fB\-\-dpdk\fR"
-Initialize \fBovs\-vswitchd\fR DPDK datapath. Refer to INSTALL.DPDK
-for details.
+For details on initializing the \fBovs\-vswitchd\fR DPDK datapath,
+refer to INSTALL.DPDK.md or \fBovs\-vswitchd.conf.db\fR(5) for
+details.
.SS "Daemon Options"
.ds DD \
\fBovs\-vswitchd\fR detaches only after it has connected to the \
diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c
index e78ecda93..7d467a175 100644
--- a/vswitchd/ovs-vswitchd.c
+++ b/vswitchd/ovs-vswitchd.c
@@ -48,7 +48,6 @@
#include "openvswitch/vconn.h"
#include "openvswitch/vlog.h"
#include "lib/vswitch-idl.h"
-#include "lib/netdev-dpdk.h"
VLOG_DEFINE_THIS_MODULE(vswitchd);
@@ -71,13 +70,6 @@ main(int argc, char *argv[])
int retval;
set_program_name(argv[0]);
- retval = dpdk_init(argc,argv);
- if (retval < 0) {
- return retval;
- }
-
- argc -= retval;
- argv += retval;
ovs_cmdl_proctitle_init(argc, argv);
service_start(&argc, &argv);
@@ -166,7 +158,7 @@ parse_options(int argc, char *argv[], char **unixctl_pathp)
{"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},
{"enable-dummy", optional_argument, NULL, OPT_ENABLE_DUMMY},
{"disable-system", no_argument, NULL, OPT_DISABLE_SYSTEM},
- {"dpdk", required_argument, NULL, OPT_DPDK},
+ {"dpdk", optional_argument, NULL, OPT_DPDK},
{NULL, 0, NULL, 0},
};
char *short_options = ovs_cmdl_long_options_to_short_options(long_options);
@@ -219,7 +211,7 @@ parse_options(int argc, char *argv[], char **unixctl_pathp)
exit(EXIT_FAILURE);
case OPT_DPDK:
- ovs_fatal(0, "--dpdk must be given at beginning of command line.");
+ ovs_fatal(0, "Using --dpdk to configure DPDK is not supported.");
break;
default:
@@ -256,18 +248,9 @@ usage(void)
daemon_usage();
vlog_usage();
printf("\nDPDK options:\n"
- " --dpdk [VHOST] [DPDK] Initialize DPDK datapath.\n"
- " where DPDK are options for initializing DPDK lib and VHOST is\n"
-#ifdef VHOST_CUSE
- " option to override default character device name used for\n"
- " for use with userspace vHost\n"
- " -cuse_dev_name NAME\n"
-#else
- " option to override default directory where vhost-user\n"
- " sockets are created.\n"
- " -vhost_sock_dir DIR\n"
-#endif
- );
+ "Configuration of DPDK via command-line is removed from this\n"
+ "version of Open vSwitch. DPDK is configured through ovsdb.\n"
+ );
printf("\nOther options:\n"
" --unixctl=SOCKET override default control socket name\n"
" -h, --help display this help message\n"
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 90806337a..c36cb5945 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -171,6 +171,49 @@
</p>
</column>
+ <column name="other_config" key="dpdk-init"
+ type='{"type": "boolean"}'>
+ <p>
+ Set this value to <code>true</code> to enable runtime support for
+ DPDK ports. The vswitch must have compile-time support for DPDK as
+ well.
+ </p>
+ <p>
+ The default value is <code>false</code>. Changing this value requires
+ restarting the daemon
+ </p>
+ <p>
+ If this value is <code>false</code> at startup, any dpdk ports which
+ are configured in the bridge will fail due to memory errors.
+ </p>
+ </column>
+
+ <column name="other_config" key="dpdk-lcore-mask"
+ type='{"type": "integer", "minInteger": 1}'>
+ <p>
+ Specifies the CPU cores where dpdk lcore threads should be spawned.
+ The DPDK lcore threads are used for DPDK library tasks, such as
+ library internal message processing, logging, etc. Value should be in
+ the form of a hex string (so '0x123') similar to the 'taskset' mask
+ input.
+ </p>
+ <p>
+ The lowest order bit corresponds to the first CPU core. A set bit
+ means the corresponding core is available and an lcore thread will be
+ created and pinned to it. If the input does not cover all cores,
+ those uncovered cores are considered not set.
+ </p>
+ <p>
+ For performance reasons, it is best to set this to a single core on
+ the system, rather than allow lcore threads to float.
+ </p>
+ <p>
+ If not specified, the value will be determined by choosing the lowest
+ CPU core from initial cpu affinity list. Otherwise, the value will be
+ passed directly to the DPDK library.
+ </p>
+ </column>
+
<column name="other_config" key="pmd-cpu-mask">
<p>
Specifies CPU mask for setting the cpu affinity of PMD (Poll
@@ -190,6 +233,71 @@
</p>
</column>
+ <column name="other_config" key="dpdk-alloc-mem"
+ type='{"type": "integer", "minInteger": 0}'>
+ <p>
+ Specifies the amount of memory to preallocate from the hugepage pool,
+ regardless of socket. It is recommended that dpdk-socket-mem is used
+ instead.
+ </p>
+ <p>
+ If not specified, the value is 0. Changing this value requires
+ restarting the daemon.
+ </p>
+ </column>
+
+ <column name="other_config" key="dpdk-socket-mem"
+ type='{"type": "string"}'>
+ <p>
+ Specifies the amount of memory to preallocate from the hugepage pool,
+ on a per-socket basis.
+ </p>
+ <p>
+ The specifier is a comma-separated string, in ascending order of CPU
+ socket (ex: 1024,2048,4096,8192 would set socket 0 to preallocate
+ 1024MB, socket 1 to preallocate 2048MB, etc.)
+ </p>
+ <p>
+ If not specified, the default value is 1024,0. Changing this value
+ requires restarting the daemon.
+ </p>
+ </column>
+
+ <column name="other_config" key="dpdk-hugepage-dir"
+ type='{"type": "string"}'>
+ <p>
+ Specifies the path to the hugetlbfs mount point.
+ </p>
+ <p>
+ If not specified, this will be guessed by the DPDK library (default
+ is /dev/hugepages). Changing this value requires restarting the
+ daemon.
+ </p>
+ </column>
+
+ <column name="other_config" key="cuse-dev-name"
+ type='{"type": "string"}'>
+ <p>
+ Specifies the name of the vhost-cuse character device to open for
+ vhost-cuse support.
+ </p>
+ <p>
+ The default is vhost-net. Changing this value requires restarting
+ the daemon.
+ </p>
+ </column>
+
+ <column name="other_config" key="vhost-sock-dir"
+ type='{"type": "string"}'>
+ <p>
+ Specifies the path to the vhost-user unix domain socket files.
+ </p>
+ <p>
+ Defaults to the working directory of the application. Changing this
+ value requires restarting the daemon.
+ </p>
+ </column>
+
<column name="other_config" key="n-handler-threads"
type='{"type": "integer", "minInteger": 1}'>
<p>