VPP Sandbox/turbotap
Abstract
The objective of this project is to continue to build out better integration with host operating system and for providing a basis to enable completely or partially unmodified applications to take advantage of a fast datapath.
Introduction
Tap interfaces are virtual network devices in Linux Kernel. Legacy tap interfaces provide mechanism to write down user space application to send/receive packets to/from tap interfaces. VPP implements tap interfaces driver tapcli and provides tap interfaces at host side to communicate with host kernel stack or with applications running on host or for containerized applications. VPP uses tap interfaces to connect with legacy applications that use host APIs or system calls. Tapcli driver implements one system call per packet which results in huge performance issue due to context switching.
Turbotap driver is an experimental work and a replacement for tapcli driver in VPP. It uses tap interfaces using socket API system calls sendmmsg or recvmmsg that allows to send/receive multiple packets using one single system call. Hence save the time for context switching between userspace and kernel space.
The linux kernel doesn't support socket API for tap interfaces. Therefore, a separate turbotap 'LINUX KERNEL MODULE' has been implemented to support send and receive socket system calls.
Currently the turbotap driver plugin uses socket API system calls. Most of the code is borrowed from tapcli driver in VPP. One can extend it to multi-queue driver.
Build and Install
The turbotap driver is implemented as a plugin to send/receive packets from kernel tap interfaces. Before using it, you must BUILD and INSTALL turbotap kernel module. You have to clone the source code or download the tar ball from the turbotap repository. Here you will find the details. Then you must build plugin and put it in VPPs runtime plugin directory. The plugin depends on vpp. This wiki assumes familiarity with the build environment for both projects.
NOTE: In turbotap directory, configure.ac file explicitly enables the dpdk by setting it to 1. If you are not using dpdk (in case of vpp_lite), you should change the flag from 1 to 0 before building the sources.
Build vpp and turbotap both at once by creating symbolic links in the top level vpp directory to the turbotap directory as well as symbolic links to the respective .mk files in 'build-data/packages'.
$ cd /git/vpp $ ln -sf /git/vppsb/turbotap $ ln -sf ../../turbotap/turbotap.mk build-data/packages/
Now build everything and create a link to the plugin in vpp's plugin path.
$ cd build-root $ ./bootstrap.sh $ make V=0 PLATFORM=vpp TAG=vpp_debug turbotap-install $ ln -sf /git/vpp/build-root/install-vpp_debug-native/turbotap/lib64/turbotap.so.0.0.0 \ /usr/lib/vpp_plugins/
Once VPP is running and the plugin is loaded, turbotap interfaces can be created or deleted.
$ vppctl turbotap connect turbotap0
The host operating system should see a turbotap named 'turbotap0'.
$ vppctl turbotap delete turbotap0
To delete the turbotap interfaces.
References
- TUN/TAP: https://www.kernel.org/doc/Documentation/networking/tuntap.txt
- sendmmsg system call: http://linux.die.net/man/2/sendmmsg
- recvmmsg system call: http://linux.die.net/man/2/recvmmsg
- Vector Packet Processing (VPP): https://wiki.fd.io/view/VPP
- Turbotap kernel module: https://github.com/vpp-dev/turbotap