Skip to content

Commit

Permalink
netdev-dpdk: Convert initialization from cmdline to db
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
apconole authored and ddiproietto committed Apr 29, 2016
1 parent 563c98d commit bab6940
Show file tree
Hide file tree
Showing 14 changed files with 454 additions and 157 deletions.
6 changes: 3 additions & 3 deletions FAQ.md
Expand Up @@ -445,9 +445,9 @@ A: Yes. How you configure it depends on what you mean by "promiscuous

A: Firstly, you must have a DPDK-enabled version of Open vSwitch.

If your version is DPDK-enabled it will support the --dpdk
argument on the command line and will display lines with
"EAL:..." during startup when --dpdk is supplied.
If your version is DPDK-enabled it will support the other-config:dpdk-init
configuration in the database and will display lines with "EAL:..."
during startup when other_config:dpdk-init is set to 'true'.

Secondly, when adding a DPDK port, unlike a system port, the
type for the interface must be specified. For example;
Expand Down
78 changes: 59 additions & 19 deletions INSTALL.DPDK.md
Expand Up @@ -138,22 +138,62 @@ Using the DPDK with ovs-vswitchd:

5. Start vswitchd:

DPDK configuration arguments can be passed to vswitchd via `--dpdk`
argument. This needs to be first argument passed to vswitchd process.
dpdk arg -c is ignored by ovs-dpdk, but it is a required parameter
for dpdk initialization.
DPDK configuration arguments can be passed to vswitchd via Open_vSwitch
other_config column. The recognized configuration options are listed.
Defaults will be provided for all values not explicitly set.

* dpdk-init
Specifies whether OVS should initialize and support DPDK ports. This is
a boolean, and defaults to false.

* dpdk-lcore-mask
Specifies the CPU cores on which 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.
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.
For performance reasons, it is best to set this to a single core on
the system, rather than allow lcore threads to float.

* dpdk-alloc-mem
This sets the total memory to preallocate from hugepages regardless of
processor socket. It is recommended to use dpdk-socket-mem instead.

* dpdk-socket-mem
Comma separated list of memory to pre-allocate from hugepages on specific
sockets.

* dpdk-hugepage-dir
Directory where hugetlbfs is mounted

* cuse-dev-name
Option to set the vhost_cuse character device name.

* vhost-sock-dir
Option to set the path to the vhost_user unix socket files.

NOTE: Changing any of these options requires restarting the ovs-vswitchd
application.

Open vSwitch can be started as normal. DPDK will be initialized as long
as the dpdk-init option has been set to 'true'.


```
export DB_SOCK=/usr/local/var/run/openvswitch/db.sock
ovs-vswitchd --dpdk -c 0x1 -n 4 -- unix:$DB_SOCK --pidfile --detach
ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true
ovs-vswitchd unix:$DB_SOCK --pidfile --detach
```

If allocated more than one GB hugepage (as for IVSHMEM), set amount and
use NUMA node 0 memory:

```
ovs-vswitchd --dpdk -c 0x1 -n 4 --socket-mem 1024,0 \
-- unix:$DB_SOCK --pidfile --detach
ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem="1024,0"
ovs-vswitchd unix:$DB_SOCK --pidfile --detach
```

6. Add bridge & ports
Expand Down Expand Up @@ -540,11 +580,12 @@ in the names.
`/usr/local/var/run/openvswitch/vhost-user-1`, which you must provide
to your VM on the QEMU command line. More instructions on this can be
found in the next section "DPDK vhost-user VM configuration"
Note: If you wish for the vhost-user sockets to be created in a
directory other than `/usr/local/var/run/openvswitch`, you may specify
another location on the ovs-vswitchd command line like so:
- If you wish for the vhost-user sockets to be created in a directory other
than `/usr/local/var/run/openvswitch`, you may specify another location
in the ovsdb like so:

`./vswitchd/ovs-vswitchd --dpdk -vhost_sock_dir /my-dir -c 0x1 ...`
`./utilities/ovs-vsctl --no-wait \
set Open_vSwitch . other_config:vhost-sock-dir=path`

DPDK vhost-user VM configuration:
---------------------------------
Expand Down Expand Up @@ -692,14 +733,13 @@ DPDK vhost-cuse VM configuration:

1. This step is only needed if using an alternative character device.

The new character device filename must be specified on the vswitchd
commandline:
The new character device filename must be specified in the ovsdb:

`./vswitchd/ovs-vswitchd --dpdk --cuse_dev_name my-vhost-net -c 0x1 ...`
`./utilities/ovs-vsctl --no-wait set Open_vSwitch . \
other_config:cuse-dev-name=my-vhost-net`

Note that the `--cuse_dev_name` argument and associated string must be the first
arguments after `--dpdk` and come before the EAL arguments. In the example
above, the character device to be used will be `/dev/my-vhost-net`.
In the example above, the character device to be used will be
`/dev/my-vhost-net`.

2. This step is only needed if reusing the standard character device. It will
conflict with the kernel vhost character device so the user must first
Expand Down Expand Up @@ -811,8 +851,8 @@ steps.
```

<my-vhost-device> refers to "vhost-net" if using the `/dev/vhost-net`
device. If you have specificed a different name on the ovs-vswitchd
commandline using the "--cuse_dev_name" parameter, please specify that
device. If you have specificed a different name in the database
using the "other_config:cuse-dev-name" parameter, please specify that
filename instead.

2. Disable SELinux or set to permissive mode
Expand Down
5 changes: 5 additions & 0 deletions NEWS
Expand Up @@ -26,6 +26,11 @@ Post-v2.5.0
assignment.
* Type of log messages from PMD threads changed from INFO to DBG.
* QoS functionality with sample egress-policer implementation.
* The mechanism for configuring DPDK has changed to use database
* 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
- ovs-benchmark: This utility has been removed due to lack of use and
bitrot.
- ovs-appctl:
Expand Down
4 changes: 4 additions & 0 deletions lib/automake.mk
Expand Up @@ -354,6 +354,10 @@ if DPDK_NETDEV
lib_libopenvswitch_la_SOURCES += \
lib/netdev-dpdk.c \
lib/netdev-dpdk.h
else
lib_libopenvswitch_la_SOURCES += \
lib/netdev-nodpdk.c \
lib/netdev-dpdk.h
endif

if WIN32
Expand Down

0 comments on commit bab6940

Please sign in to comment.