Data Plane Development Kit (DPDK) in network applications, i.e. Linux on steroids

May 30, 2022

Linux-like systems dominate the world, and today no one doubts this anymore. Each producer tries to get a piece of the cake, advertising their device as intelligent or self-sufficient. Countless amounts of smartphones (android runs on the Linux kernel), television sets, network devices (servers, firewalls, routers) are powered by Linux TUX. What started as a hobbyist experiment of a Finnish student (Linus Torvalds), has now become one of the leading business systems – Linux. The kernel’s versatility and scalability guarantee that it will work equally well on a supercomputer (each within the TOP500) and a small home router. The GNU license under which the kernel is distributed makes all features available to both global giants and at home hobbyists, at the same time.
And while it seems that the GNU/Linux project is a tailor-made outfit for everyone, there are certain limitations of the Linux kernel that make it too… slow. Undoubtedly, one such area is telecommunication. Telecommunication equipment is the foundation of the network. Its task is to process a huge number of packets in the shortest possible time.

In a standard configuration, the operating system acts as an intermediary between the hardware and the software. In this case, the operating system does two things: it communicates with other programs using ‘virtual devices’ visible in /dev/* of the main file system (/dev/* is a special type of a file) and it talks to the device through one of the specialized communication buses.

 

 

This conversation forces something called space switching (user/kernel space), the process costs time and as mentioned earlier, there is not much of it. The remedy for this was the use of specialized equipment, which, as you can guess, was neither cheap nor universal, and certainly not generally available. So they wondered if there was a way to bypass the bottleneck that the Linux kernel itself  turned out to be. Since space switching ‘costs’, they started to look for a way for the software to talk to the hardware (in this story: the network card) directly, without going through the kernel itself.

The solution turned out to be a project called Data Plane Development Kit (DPDK), invented by Intel engineer – Venky Venkates, which currently developed by the Linux Foundation. DPDK is a set of user space libraries and drivers that work by polling the network interface controller (network adapter) in order to offload the kernel from the task of processing network packets to user space processes. Thanks to the work of the Linux Foundation, the solution can be found for virtually any architecture: x86, ARM, amd, PowerPC (https://en.wikipedia.org/wiki/Data_Plane_Development_Kit). Freamwork enables the elimination of space switching when copying data, and thanks to the mechanism of hardware polling, it eliminates the need to handle the interrupts – which also normally involves the need to switch space.

 

 

Excluding hardware from kernel ‘supervision’ also has some consequences: for example, the interface assigned to DPDK is not visible from standard management tools, such as ip or ifconfig. The project is already at such a stage of development that it is being used in production environments and is systematically improved. It is used, among others, by:

  • Open vSwitch – a virtual switch compatible with Linux bridges,
  • Trex – a traffic generator created by CISCO,
  • Butterfly – virtual machine traffic management,

and many others (https://www.dpdk.org/ecosystem).

And now it turns out that you don’t need a lot of money to build a telecommunication device on a slightly smaller scale. Embedded devices, i.e., ‘a special-purpose computer systems that become an integral part of the hardware they support’ (Wikipedia) are available for relatively little money. With the right configuration, the very popular Raseprbery Pi 4 can become:

  • a gate,
  • a router,
  • a dam,
  • a vPN server,
  • or a traffic generator.

Open sources, the community and passionate enthusiasts make it possible for everyone to gain knowledge and expand their skills.

The open P4Pi project (https://github.com/p4lang/p4pi), which aims to provide a hardware and software platform for learning network technologies, is worth recommending. But we’ll come back to the revolution that P4 brings some time in the future…

Published by: Dominika Rybińska

Related articles