Download PDF 957KB
This article describes the Data Plane Development Kit (DPDK) Packet Framework, which allows rapid prototyping of real-world packet processing workloads on multicore Intel® CPUs with great flexibility and performance. This framework is based on three DPDK libraries: librte_port, librte_table, and librte_pipeline.
The DPDK Packet Framework library was first introduced in DPDK v2.1 along with a reference application known as ip_pipeline. In subsequent releases, various features were added to the ip_pipeline application to transform it into a toolbox for developing complex packet processing workloads such as edge routers. The information here applies to DPDK versions 16.04 and above.
The DPDK Packet Framework employs a suite of DPDK libraries (
librte_port, librte_table, and
librte_pipeline) to define a standard methodology for building complex packet processing applications. It provides reusable and extensible templates for building various functional application blocks as pipeline modules.
Each pipeline module is constructed of three primitive entities: input ports, output ports, and tables. An example is shown in Figure 1.
Figure 1. The DPDK Packet Framework.
Input ports can only be connected to one table; however, that one table can be connected to other tables and also to output ports.
Various actions can be performed on packets as they traverse the pipeline blocks. For example, packet header integrity and verification can be performed at an input port. In addition, table actions can be applied, based on the result of a look-up operation, to forward packets to another table, to send packets to an output port, or to simply drop the packets.
The IP Pipeline application is designed to demonstrate the use of the DPDK Packet Framework tool suite. This sample application, in the DPDK codebase, provides the following data plane functions implemented using the above pipeline model.
Theses pipelines can be seen as prefabricated blocks that can be instantiated and interconnected by means of a configuration file to create complete applications.
The application configuration file defines the application structure that includes pipeline instances, device queues, and software queues. Different applications are created by using different configuration files; therefore, the ip_pipeline sample application can be seen as an application generator. The configuration of each pipeline can be updated at run time through the application's command-line interface (CLI).
The following steps are required to run the DPDK Packet Framework-based ip_pipeline sample application.
$ cd /home/dpdk/examples/ip_pipeline/
$ export RTE_SDK = /home/dpdk $ export RTE_TARGET = x86_64-native-linuxapp-gcc
ip_pipeline [-f CONFIG_FILE] [-s SCRIPT_FILE] -p PORT_MASK [-l LOG_LEVEL]
The application command-line arguments are:
-f CONFIG_FILE: (optional, default: ./config/ip_pipeline.cfg). This is the path to the configuration file to be loaded by the application.
-s SCRIPT_FILE: (optional). This is the path to the CLI script file to be run by the master pipeline at application startup. No CLI script file will be run at startup if this argument is not present.
-p PORT_MASK: (required). The hexadecimal mask of the NIC port IDs to be used by the application.
-l LOG_LEVEL: (optional). The log level to determine which application messages are to be printed to standard output. Available log levels are: 0 (None), 1 (High priority), and 2 (Low priority).
Example: L3 Forwarding
The usage of the pipeline blocks is demonstrated by means of several sample applications and configuration files that are provided with the ip_pipeline application.
Figure 2 shows one such configuration file for a Layer 3 (L3) forwarding application.
Figure 2: L3 Forwarding Application Configuration file (l3fwd.cfg).
In the file, the [PIPELINE] section defines various parameters of the pipeline. In this particular case it sets up simple routing.
The "core" entries thread id (tuple of socket ID, physical CPU ID, and hyper-thread ID) determines the CPU core to run the pipeline.
The "pktq_in" and "pktq_out" parameters define the packet transfer interface; in this case, to receive and send packets.
The "encap" parameter can be set to "ethernet", "qinq", or "mpls" to encapsulate all outgoing packets with the appropriate header.
The last parameter, "
ip_hdr_offset", is used to set the offset bytes needed to offset to the start of the ip-header in the DPDK packet structure (mbuf).
Figure 3 shows the ip_pipeline script file with routing rules added to the LPM table of the routing pipeline. Entries in this file are related to the case where the "encap" field is set to "ethernet" and the fast path ARP is disabled.
Figure 3: L3 Forwarding Application Rules file (l3fwd.sh).
The rules in the script file have the following format:
p <pipeline_id> route add <ip_addr> <depth> port <port_id> ether <next hop mac_addr>
Use the following command to run the L3 forwarding application:
$./build/ip_pipeline -f l3fwd.cfg -p 0xf -s l3fwd.sh
Sometimes applications can have complex topologies in terms of interconnections between different functional blocks. In these cases it can becomes difficult to understand the application packet processing flow by simply looking at its configuration file. In order to help with this a Python* program called diagram‑generator.py has been provided to create visual diagrams of the application topology from the configuration file.
Once the application configuration file is ready, run the command shown below to generate the diagram.
$./diagram-generator.py -f <configuration file>
Figure 4 shows a section of a generated topology for a complex ip_pipeline application.
Figure 4: Section of a generated topology for a complex ip_pipeline application.
This article describes the DPDK packet framework library, which enables rapid prototyping of real-world packet processing applications on multicore CPU systems, and presents the architecture of the standard pipeline model built using this library.
The various network functions (pipelines) constructed using this standard pipeline model are available as part of the DPDK ip_pipeline sample application. Although some of these are simple examples, a straightforward configuration file can build realistic applications. This article presents the commands to visualize and run the applications.
Check out the DPDK Programmer's Guide for a full description of the DPDK Packet Framework design.
Two sample applications are provided for Packet Framework: app/test-pipeline and examples/ip_pipeline. Refer to the DPDK Sample Apps Guide for a detailed description of how these sample applications work.
Jasvinder Singh is a network software engineer with Intel. His work is primarily focused on development of data plane functions and libraries for DPDK. His contributions include packet framework enhancements and the ip_pipeline sample application.
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.
Notice revision #20110804