1.. SPDX-License-Identifier: BSD-3-Clause 2 Copyright(c) 2010-2014 Intel Corporation. 3 4**Part 1: Architecture Overview** 5 6Overview 7======== 8 9This section gives a global overview of the architecture of Data Plane Development Kit (DPDK). 10 11The main goal of the DPDK is to provide a simple, 12complete framework for fast packet processing in data plane applications. 13Users may use the code to understand some of the techniques employed, 14to build upon for prototyping or to add their own protocol stacks. 15Alternative ecosystem options that use the DPDK are available. 16 17The framework creates a set of libraries for specific environments 18through the creation of an Environment Abstraction Layer (EAL), 19which may be specific to a mode of the Intel® architecture (32-bit or 64-bit), 20Linux* user space compilers or a specific platform. 21These environments are created through the use of make files and configuration files. 22Once the EAL library is created, the user may link with the library to create their own applications. 23Other libraries, outside of EAL, including the Hash, 24Longest Prefix Match (LPM) and rings libraries are also provided. 25Sample applications are provided to help show the user how to use various features of the DPDK. 26 27The DPDK implements a run to completion model for packet processing, 28where all resources must be allocated prior to calling Data Plane applications, 29running as execution units on logical processing cores. 30The model does not support a scheduler and all devices are accessed by polling. 31The primary reason for not using interrupts is the performance overhead imposed by interrupt processing. 32 33In addition to the run-to-completion model, 34a pipeline model may also be used by passing packets or messages between cores via the rings. 35This allows work to be performed in stages and may allow more efficient use of code on cores. 36 37Development Environment 38----------------------- 39 40The DPDK project installation requires Linux and the associated toolchain, 41such as one or more compilers, assembler, make utility, 42editor and various libraries to create the DPDK components and libraries. 43 44Once these libraries are created for the specific environment and architecture, 45they may then be used to create the user's data plane application. 46 47When creating applications for the Linux user space, the glibc library is used. 48For DPDK applications, two environmental variables (RTE_SDK and RTE_TARGET) 49must be configured before compiling the applications. 50The following are examples of how the variables can be set: 51 52.. code-block:: console 53 54 export RTE_SDK=/home/user/DPDK 55 export RTE_TARGET=x86_64-native-linux-gcc 56 57See the *DPDK Getting Started Guide* for information on setting up the development environment. 58 59Environment Abstraction Layer 60----------------------------- 61 62The Environment Abstraction Layer (EAL) provides a generic interface 63that hides the environment specifics from the applications and libraries. 64The services provided by the EAL are: 65 66* DPDK loading and launching 67 68* Support for multi-process and multi-thread execution types 69 70* Core affinity/assignment procedures 71 72* System memory allocation/de-allocation 73 74* Atomic/lock operations 75 76* Time reference 77 78* PCI bus access 79 80* Trace and debug functions 81 82* CPU feature identification 83 84* Interrupt handling 85 86* Alarm operations 87 88* Memory management (malloc) 89 90The EAL is fully described in :ref:`Environment Abstraction Layer <Environment_Abstraction_Layer>`. 91 92Core Components 93--------------- 94 95The *core components* are a set of libraries that provide all the elements needed 96for high-performance packet processing applications. 97 98.. _figure_architecture-overview: 99 100.. figure:: img/architecture-overview.* 101 102 Core Components Architecture 103 104 105Ring Manager (librte_ring) 106~~~~~~~~~~~~~~~~~~~~~~~~~~ 107 108The ring structure provides a lockless multi-producer, multi-consumer FIFO API in a finite size table. 109It has some advantages over lockless queues; easier to implement, adapted to bulk operations and faster. 110A ring is used by the :ref:`Memory Pool Manager (librte_mempool) <Mempool_Library>` 111and may be used as a general communication mechanism between cores 112and/or execution blocks connected together on a logical core. 113 114This ring buffer and its usage are fully described in :ref:`Ring Library <Ring_Library>`. 115 116Memory Pool Manager (librte_mempool) 117~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 119The Memory Pool Manager is responsible for allocating pools of objects in memory. 120A pool is identified by name and uses a ring to store free objects. 121It provides some other optional services, 122such as a per-core object cache and an alignment helper to ensure that objects are padded to spread them equally on all RAM channels. 123 124This memory pool allocator is described in :ref:`Mempool Library <Mempool_Library>`. 125 126Network Packet Buffer Management (librte_mbuf) 127~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 128 129The mbuf library provides the facility to create and destroy buffers 130that may be used by the DPDK application to store message buffers. 131The message buffers are created at startup time and stored in a mempool, using the DPDK mempool library. 132 133This library provides an API to allocate/free mbufs, manipulate 134packet buffers which are used to carry network packets. 135 136Network Packet Buffer Management is described in :ref:`Mbuf Library <Mbuf_Library>`. 137 138Timer Manager (librte_timer) 139~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 140 141This library provides a timer service to DPDK execution units, 142providing the ability to execute a function asynchronously. 143It can be periodic function calls, or just a one-shot call. 144It uses the timer interface provided by the Environment Abstraction Layer (EAL) 145to get a precise time reference and can be initiated on a per-core basis as required. 146 147The library documentation is available in :ref:`Timer Library <Timer_Library>`. 148 149Ethernet* Poll Mode Driver Architecture 150--------------------------------------- 151 152The DPDK includes Poll Mode Drivers (PMDs) for 1 GbE, 10 GbE and 40GbE, and para virtualized virtio 153Ethernet controllers which are designed to work without asynchronous, interrupt-based signaling mechanisms. 154 155See :ref:`Poll Mode Driver <Poll_Mode_Driver>`. 156 157Packet Forwarding Algorithm Support 158----------------------------------- 159 160The DPDK includes Hash (librte_hash) and Longest Prefix Match (LPM,librte_lpm) 161libraries to support the corresponding packet forwarding algorithms. 162 163See :ref:`Hash Library <Hash_Library>` and :ref:`LPM Library <LPM_Library>` for more information. 164 165librte_net 166---------- 167 168The librte_net library is a collection of IP protocol definitions and convenience macros. 169It is based on code from the FreeBSD* IP stack and contains protocol numbers (for use in IP headers), 170IP-related macros, IPv4/IPv6 header structures and TCP, UDP and SCTP header structures. 171