Skip to content

Commit

Permalink
dpif-netdev: Add DPDK netdev.
Browse files Browse the repository at this point in the history
Following patch adds DPDK netdev-class to userspace datapath. Now
OVS can use DPDK port for IO by just configuring DPDK port and then
adding dpdk type port to userspace datapath.

Refer to INSTALL.DPDK doc for further info.

This is based a patch from Gerald Rogers.

Signed-off-by: Gerald Rogers <[email protected]>
Signed-off-by: Pravin B Shelar <[email protected]>
Acked-by: Thomas Graf <[email protected]>
  • Loading branch information
Pravin committed Mar 21, 2014
1 parent 275eebb commit 8a9562d
Show file tree
Hide file tree
Showing 13 changed files with 1,383 additions and 5 deletions.
1 change: 1 addition & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on a specific platform, please see one of these files:
- INSTALL.RHEL
- INSTALL.XenServer
- INSTALL.NetBSD
- INSTALL.DPDK

Build Requirements
------------------
Expand Down
93 changes: 93 additions & 0 deletions INSTALL.DPDK
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Using Open vSwitch with DPDK
============================

Open vSwitch can use Intel(R) DPDK lib to operate entirely in
userspace. This file explains how to install and use Open vSwitch in
such a mode.

The DPDK support of Open vSwitch is considered experimental.
It has not been thoroughly tested.

This version of Open vSwitch should be built manually with "configure"
and "make".

Building and Installing:
------------------------

Recommended to use DPDK 1.6.

DPDK:
cd DPDK
update config/defconfig_x86_64-default-linuxapp-gcc so that dpdk generate single lib file.
CONFIG_RTE_BUILD_COMBINE_LIBS=y

make install T=x86_64-default-linuxapp-gcc
For details refer to http://dpdk.org/

Linux kernel:
Refer to intel-dpdk-getting-started-guide.pdf for understanding
DPDK kernel requirement.

OVS:
cd $(OVS_DIR)/openvswitch
./boot.sh
./configure --with-dpdk=$(DPDK_BUILD)
make

Refer to INSTALL.userspace for general requirements of building
userspace OVS.

Using the DPDK with ovs-vswitchd:
---------------------------------

First setup DPDK devices:
- insert uio.ko
- insert igb_uio.ko
e.g. insmod DPDK/x86_64-default-linuxapp-gcc/kmod/igb_uio.ko
- mount hugetlbfs
e.g. mount -t hugetlbfs -o pagesize=1G none /mnt/huge/
- Bind network device to ibg_uio.
e.g. DPDK/tools/pci_unbind.py --bind=igb_uio eth1

Ref to http://www.dpdk.org/doc/quick-start for verifying DPDK setup.

Start vswitchd:
DPDK configuration arguments can be passed to vswitchd via `--dpdk`
argument. dpdk arg -c is ignored by ovs-dpdk, but it is required parameter
for dpdk initialization.

e.g.
./vswitchd/ovs-vswitchd --dpdk -c 0x1 -n 4 -- unix:$DB_SOCK --pidfile --detach

To use ovs-vswitchd with DPDK, create a bridge with datapath_type
"netdev" in the configuration database. For example:

ovs-vsctl add-br br0
ovs-vsctl set bridge br0 datapath_type=netdev

Now you can add dpdk devices. OVS expect DPDK device name start with dpdk
and end with portid. vswitchd should print number of dpdk devices found.

ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk

Once first DPDK port is added vswitchd, it creates Polling thread and
polls dpdk device in continuous loop. Therefore CPU utilization
for that thread is always 100%.

Restrictions:
-------------

- This Support is for Physical NIC. I have tested with Intel NIC only.
- vswitchd userspace datapath does affine polling thread but it is
assumed that devices are on numa node 0. Therefore if device is
attached to non zero numa node switching performance would be
suboptimal.
- There are fixed number of polling thread and fixed number of per
device queues configured.
- Work with 1500 MTU, needs few changes in DPDK lib to fix this issue.
- Currently DPDK port does not make use any offload functionality.

Bug Reporting:
--------------

Please report problems to [email protected].
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ EXTRA_DIST = \
FAQ \
INSTALL \
INSTALL.Debian \
INSTALL.DPDK \
INSTALL.Fedora \
INSTALL.KVM \
INSTALL.Libvirt \
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Post-v2.1.0
instead.
- Support for Linux kernels up to 3.12. On Kernel 3.12 OVS uses tunnel
API for GRE and VXLAN.
- Added DPDK support.


v2.1.0 - xx xxx xxxx
Expand Down
26 changes: 26 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,32 @@ AC_DEFUN([OVS_CHECK_LINUX], [
AM_CONDITIONAL(LINUX_ENABLED, test -n "$KBUILD")
])

dnl OVS_CHECK_DPDK
dnl
dnl Configure DPDK source tree
AC_DEFUN([OVS_CHECK_DPDK], [
AC_ARG_WITH([dpdk],
[AC_HELP_STRING([--with-dpdk=/path/to/dpdk],
[Specify the DPDP build directory])])
if test X"$with_dpdk" != X; then
RTE_SDK=$with_dpdk
DPDK_INCLUDE=$RTE_SDK/include
DPDK_LIB_DIR=$RTE_SDK/lib
DPDK_LIBS="$DPDK_LIB_DIR/libintel_dpdk.a"
LIBS="$DPDK_LIBS $LIBS"
CPPFLAGS="-I$DPDK_INCLUDE $CPPFLAGS"
AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.])
else
RTE_SDK=
fi
AM_CONDITIONAL([DPDK_NETDEV], test -n "$RTE_SDK")
])

dnl OVS_GREP_IFELSE(FILE, REGEX, [IF-MATCH], [IF-NO-MATCH])
dnl
dnl Greps FILE for REGEX. If it matches, runs IF-MATCH, otherwise IF-NO-MATCH.
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ OVS_ENABLE_SPARSE
AC_ARG_VAR(KARCH, [Kernel Architecture String])
AC_SUBST(KARCH)
OVS_CHECK_LINUX
OVS_CHECK_DPDK

AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(datapath/Makefile)
Expand Down
6 changes: 6 additions & 0 deletions lib/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,12 @@ lib_libopenvswitch_la_SOURCES += \
lib/route-table.h
endif

if DPDK_NETDEV
lib_libopenvswitch_la_SOURCES += \
lib/netdev-dpdk.c \
lib/netdev-dpdk.h
endif

if HAVE_POSIX_AIO
lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
else
Expand Down
Loading

0 comments on commit 8a9562d

Please sign in to comment.