
For fast processing of packets, it is required to detect bit patterns and quickly (with the speed of the channel) make decisions about the necessary actions based on the available bit patterns. These bit patterns can belong to one of several headers present in the packet, which, in turn, can be on one of several layers, such as Ethernet, VLAN, IP, MPLS, or TCP / UDP. Actions defined by bit patterns can vary from simple forwarding of packets to another port to complex rewriting operations that require matching the packet header from one protocol set to another. To this should be added traffic management functions and traffic policies, firewalls, virtual private networks, etc., as a result of which the complexity of the operations that need to be performed with each packet increases many times over.
To achieve work at the expected level of performance at a channel speed of 10 Gb / s and a packet size of 84 bytes, the processor must process 14.88 million packets per second. General purpose equipment was not powerful enough to process packets at such a speed. Therefore, in most working network systems, the processing of packets in data channels is handled by ASIC controllers and NPU network processors. The obvious disadvantages of this approach are: lack of flexibility, high cost, long development cycles, dependence on a particular supplier. However, due to the availability of faster and cheaper CPUs and software accelerators, such as the Data Plane Development Kit (DPDK), you can shift this burden to general-purpose hardware.
What is the Data Plane Development Kit?
DPDK is a set of libraries and drivers for fast packet processing. You can turn a general-purpose processor into your own packet forwarding server without purchasing expensive switches and routers.
DPDK usually runs on Linux *, although there is a version of some DPDK components for FreeBSD *. DPDK is an
open source project distributed under the BSD license . The latest corrections and additions provided by the community are available
in the main branch .
')
DPDK is not a set of network protocols and does not implement such functions as Layer 3 Redirection, IPsec, Firewall, etc. At the same time, various
examples of applications are included in the tree to help develop such components.
Support and services are provided by
several companies , including Intel.
DPDK allows you to:
- receive and send packets using the least number of CPU cycles (usually no more than 80 cycles);
- develop fast packet writing algorithms (like tcpdump);
- run third-party fast stacks.
The performance of some packet processing functions is millions of frames per second when using 64-byte packets with PCIe * network cards.
Using the Data Plane Development Kit
To get started with DPDK, follow these steps:
1. If you do not have Linux, boot into the virtual box and
install a Linux machine .
2. Download the latest version of DPDK using one of the commands depending on the Linux kernel used.
wget www.dpdk.org/browse/dpdk/snapshot/dpdk-2.1.0.tar.gz
or
sudo apt-get www.dpdk.org/browse/dpdk/snapshot/dpdk-2.1.0.tar.gz
or
yum install www.dpdk.org/browse/dpdk/snapshot/dpdk-2.1.0.tar.gz
3. Unzip the DPDK zip file.
tar zxvf dpdk-2.1.0.tar.gz
4. Examine the source code.
cd dpdk-2.1.0
For a directory look, watch the video. Chapter 1: DPDK Directory Structure, Scenarios, and DPDK Setup at Network Builder University Introduction to DPDK.
5. Check the CPU configuration.
cd tools ./cpu_layout.py
Sample output

6. Check the configuration of the network adapters.
stack@nde01 tools]$ ./dpdk_nic_bind.py --status Network devices using DPDK-compatible driver ============================================ 0000:03:00.0 'Ethernet Connection X552/X557-AT 10GBASE-T' drv=igb_uio unused= 0000:03:00.1 'Ethernet Connection X552/X557-AT 10GBASE-T' drv=igb_uio unused= Network devices using kernel driver =================================== 0000:05:00.0 'Ethernet Controller XL710 for 40GbE QSFP+' if=ens2f0 drv=i40e unused=igb_uio 0000:05:00.1 'Ethernet Controller XL710 for 40GbE QSFP+' if=ens2f1 drv=i40e unused=igb_uio 0000:07:00.0 'I350 Gigabit Network Connection' if=eno1 drv=igb unused=igb_uio *Active* 0000:07:00.1 'I350 Gigabit Network Connection' if=eno2 drv=igb unused=igb_uio Other network devices ===================== <none>
7. Configure the DPDK:
setup.sh is a useful program that helps compile DPDK and configure the system. To run this program, you need root privileges. In the tools directory, enter:
./setup.sh
As a result, you will get something like this:
[stack@nde01 tools]$ ./setup.sh ------------------------------------------------------------------------------ RTE_SDK exported as /admin/software_installfiles/dpdk-2.1.0 ------------------------------------------------------------------------------ ---------------------------------------------------------- Step 1: Select the DPDK environment to build ---------------------------------------------------------- [1] i686-native-linuxapp-gcc [2] i686-native-linuxapp-icc [3] ppc_64-power8-linuxapp-gcc [4] tile-tilegx-linuxapp-gcc [5] x86_64-ivshmem-linuxapp-gcc [6] x86_64-ivshmem-linuxapp-icc [7] x86_64-native-bsdapp-clang [8] x86_64-native-bsdapp-gcc [9] x86_64-native-linuxapp-clang [10] x86_64-native-linuxapp-gcc [11] x86_64-native-linuxapp-icc [12] x86_x32-native-linuxapp-gcc ---------------------------------------------------------- Step 2: Setup linuxapp environment ---------------------------------------------------------- [13] Insert IGB UIO module [14] Insert VFIO module [15] Insert KNI module [16] Setup hugepage mappings for non-NUMA systems [17] Setup hugepage mappings for NUMA systems [18] Display current Ethernet device settings [19] Bind Ethernet device to IGB UIO module [20] Bind Ethernet device to VFIO module [21] Setup VFIO permissions ---------------------------------------------------------- Step 3: Run test application for linuxapp environment ---------------------------------------------------------- [22] Run test application ($RTE_TARGET/app/test) [23] Run testpmd application in interactive mode ($RTE_TARGET/app/testpmd) ---------------------------------------------------------- Step 4: Other tools ---------------------------------------------------------- [24] List hugepage info from /proc/meminfo ---------------------------------------------------------- Step 5: Uninstall and system cleanup ---------------------------------------------------------- [25] Uninstall all targets [26] Unbind NICs from IGB UIO or VFIO driver [27] Remove IGB UIO module [28] Remove VFIO module [29] Remove KNI module [30] Remove hugepage mappings [31] Exit Script Option:
You need to select an option and configure.
1. In step 1, you need to select the DPDK build. You can select
x86_64-native-linuxapp-gcc ; This is option 10.
2. In step 2, you need to set up a Linux application environment. Parameter 13 - download the latest version of the IGB UIO module and compile the latest version of the IGB UIO driver. The IGB UIO is a DPDK kernel module that works with the PCI enumeration and handles user-mode reference status interrupts (instead of the kernel). Support is also required for allocating extra large pages, for example, 2 MB pages for NUMA, parameter 17. Parameter 18 — Displays the current Ethernet settings, as in step 6 above. Using parameter 19, remove the binding of the desired network adapter from the Linux kernel driver and link it to the installed IGB UIO module using parameter 13.
Attention! Do not bind to the DPDK network adapter used for external connections, as in this case the connection to the device will be lost.
For installation information, see the video.
Chapter 2: Setting up a DPDK as part of the Network Builder University course Introduction to DPDK .
8. Compile the l2fwd sample application. This is a Layer 2 redirect application, it forwards packets based on MAC addresses, not IP addresses.
cd examples cd l2fwd export RTE_SDK=< dpdk> make
9. Run the sample application.
Syntax:
./build/l2fwd -c COREMASK | -l CORELIST -n CHANNELS [options] ./build/l2fwd –c 0x3 –n 4 -- -p 0x3
-c (hexadecimal kernel bitmask, you need to run one), for example –c Ox3 means launch on both cores, because binary 11 = 0x3
-n (number of memory channels), for example –n 4, means starting on all four channels available on the Intel Xeon processor
-p (port mask)
-p 0x3 means running on both ports bound to dpdk, since binary 11 = 0x3
In our testing, this sample application redirects all packets arriving on port 0 to port 1 and vice versa. After startup, it switches to the polling cycle, where it polls both ports and updates statistics, such as the number of packets received and sent, every 10 seconds (see the last screenshot below). The first screen capture shows the EAL level (medium abstraction level) passing through all logical cores that are associated with physical cores. The second screenshot shows PCI devices / network cards associated with the DPDK (IGB UIO driver, see steps 7 -> 2 above) and using for this reason the
rte_ixgbe_pmd driver (this is the DPDK polled mode driver), as well as network cards that are not running the DPDK. Screenshot 3 shows one logical core dedicated to each physical port.



For details on execution options, see
Chapter 3: Compile and Run the Sample Application, in the Network Builder University course Introduction to DPDK .
The sample application shows basic level 2 redirection functionality. If you need to measure DPDK performance, familiarize yourself with the course at Intel Network Builder University
Using DPPD PROX , in which Luc Provost, the technical head of Network Platforms Group at Intel, measures virtual network performance using DPPD Plane Performance Demonstrator) Prox to help software developers understand and use these tools.
Conclusion
DPDK is a software accelerator that works in user space bypassing the Linux kernel and provides access to network adapters, CPU, and memory for packet-processing applications. This article provides step-by-step instructions for downloading DPDK 2.1.0 on a Linux platform with compiling, configuring, and running a sample application.
For a better understanding of the terms used in the above videos, and to explore the capabilities and programs of DPDK, check out the following resources:
- DPDK 101 . In this course, Intel Network Builders University Andrew Dignan, Platform Application Engineer at Intel, talks about DPDK (based on version 2.1), including licensing, packet processing principles, DPDK component libraries, memory problems with Intel and about configuring DPDK in terms of working with memory.
- DPDK 201 . In this course, Intel Network Builders University MJay, a leading platform engineer at Intel, talks about DPDK and describes the concept of a DPDK device (based on version 2.1), the main components and the reasons for their creation, and then talks about how sample applications were developed.
- DPDK Programmers Guide for DPDK.org.
Have a question? Post it on the
SDN / NFV forum .