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