赞
踩
This document describes how to build and install Open vSwitch using a DPDK datapath. Open vSwitch can use the DPDK library to operate entirely in userspace.
Important
The releases FAQ lists support for the required versions of DPDK for each version of Open vSwitch. If building OVS and DPDK outside of the master build tree users should consult this list first.
In addition to the requirements described in Open vSwitch on Linux, FreeBSD and NetBSD, building Open vSwitch with DPDK will require the following:
DPDK 19.11
Only required when physical ports are in use
A suitable kernel
On Linux Distros running kernel version >= 3.0, only IOMMU needs to enabled via the grub cmdline, assuming you are using VFIO. For older kernels, ensure the kernel is built with UIO
, HUGETLBFS
, PROC_PAGE_MONITOR
, HPET
, HPET_MMAP
support. If these are not present, it will be necessary to upgrade your kernel or build a custom kernel with these flags enabled.
Detailed system requirements can be found at DPDK requirements.
Download the DPDK sources, extract the file and set DPDK_DIR
:
$ cd /usr/src/ $ wget https://fast.dpdk.org/rel/dpdk-19.11.tar.xz $ tar xf dpdk-19.11.tar.xz $ export DPDK_DIR=/usr/src/dpdk-19.11 $ cd $DPDK_DIR
(Optional) Configure DPDK as a shared library
DPDK can be built as either a static library or a shared library. By default, it is configured for the former. If you wish to use the latter, set CONFIG_RTE_BUILD_SHARED_LIB=y
in $DPDK_DIR/config/common_base
.
Note
Minor performance loss is expected when using OVS with a shared DPDK library compared to a static DPDK library.
Configure and install DPDK
Build and install the DPDK library:
$ export DPDK_TARGET=x86_64-native-linuxapp-gcc $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET $ make install T=$DPDK_TARGET DESTDIR=install
(Optional) Export the DPDK shared library location
If DPDK was built as a shared library, export the path to this library for use when building OVS:
$ export LD_LIBRARY_PATH=$DPDK_DIR/x86_64-native-linuxapp-gcc/lib
OVS can be installed using different methods. For OVS to use DPDK, it has to be configured to build against the DPDK library (--with-dpdk
).
Note
This section focuses on generic recipe that suits most cases. For distribution specific instructions, refer to one of the more relevant guides.
Ensure the standard OVS requirements, described in Build Requirements, are installed
Bootstrap, if required, as described in Bootstrapping
Configure the package using the --with-dpdk
flag:
$ ./configure --with-dpdk=$DPDK_BUILD
where DPDK_BUILD
is the path to the built DPDK library. This can be skipped if DPDK library is installed in its default location.
If no path is provided to --with-dpdk
, but a pkg-config configuration for libdpdk is available the include paths will be generated via an equivalent pkg-config --cflags libdpdk
.
Note
While --with-dpdk
is required, you can pass any other configuration option described in Configuring.
Build and install OVS, as described in Building
Additional information can be found in Open vSwitch on Linux, FreeBSD and NetBSD.
Note
If you are running using the Fedora or Red Hat package, the Open vSwitch daemon will run as a non-root user. This implies that you must have a working IOMMU. Visit the RHEL README for additional information.
Allocate a number of 2M Huge pages:
For persistent allocation of huge pages, write to hugepages.conf file in /etc/sysctl.d:
$ echo 'vm.nr_hugepages=2048' > /etc/sysctl.d/hugepages.conf
For run-time allocation of huge pages, use the sysctl
utility:
$ sysctl -w vm.nr_hugepages=N # where N = No. of 2M huge pages
To verify hugepage configuration:
$ grep HugePages_ /proc/meminfo
Mount the hugepa
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。