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 meson 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, meson 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. 48 49See the *DPDK Getting Started Guide* for information on setting up the development environment. 50 51Environment Abstraction Layer 52----------------------------- 53 54The Environment Abstraction Layer (EAL) provides a generic interface 55that hides the environment specifics from the applications and libraries. 56The services provided by the EAL are: 57 58* DPDK loading and launching 59 60* Support for multi-process and multi-thread execution types 61 62* Core affinity/assignment procedures 63 64* System memory allocation/de-allocation 65 66* Atomic/lock operations 67 68* Time reference 69 70* PCI bus access 71 72* Trace and debug functions 73 74* CPU feature identification 75 76* Interrupt handling 77 78* Alarm operations 79 80* Memory management (malloc) 81 82The EAL is fully described in :ref:`Environment Abstraction Layer <Environment_Abstraction_Layer>`. 83 84Core Components 85--------------- 86 87The *core components* are a set of libraries that provide all the elements needed 88for high-performance packet processing applications. 89 90.. _figure_architecture-overview: 91 92.. figure:: img/architecture-overview.* 93 94 Core Components Architecture 95 96 97Ring Manager (librte_ring) 98~~~~~~~~~~~~~~~~~~~~~~~~~~ 99 100The ring structure provides a lockless multi-producer, multi-consumer FIFO API in a finite size table. 101It has some advantages over lockless queues; easier to implement, adapted to bulk operations and faster. 102A ring is used by the :ref:`Memory Pool Manager (librte_mempool) <Mempool_Library>` 103and may be used as a general communication mechanism between cores 104and/or execution blocks connected together on a logical core. 105 106This ring buffer and its usage are fully described in :ref:`Ring Library <Ring_Library>`. 107 108Memory Pool Manager (librte_mempool) 109~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 111The Memory Pool Manager is responsible for allocating pools of objects in memory. 112A pool is identified by name and uses a ring to store free objects. 113It provides some other optional services, 114such as a per-core object cache and an alignment helper to ensure that objects are padded to spread them equally on all RAM channels. 115 116This memory pool allocator is described in :ref:`Mempool Library <Mempool_Library>`. 117 118Network Packet Buffer Management (librte_mbuf) 119~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 120 121The mbuf library provides the facility to create and destroy buffers 122that may be used by the DPDK application to store message buffers. 123The message buffers are created at startup time and stored in a mempool, using the DPDK mempool library. 124 125This library provides an API to allocate/free mbufs, manipulate 126packet buffers which are used to carry network packets. 127 128Network Packet Buffer Management is described in :ref:`Mbuf Library <Mbuf_Library>`. 129 130Timer Manager (librte_timer) 131~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 132 133This library provides a timer service to DPDK execution units, 134providing the ability to execute a function asynchronously. 135It can be periodic function calls, or just a one-shot call. 136It uses the timer interface provided by the Environment Abstraction Layer (EAL) 137to get a precise time reference and can be initiated on a per-core basis as required. 138 139The library documentation is available in :ref:`Timer Library <Timer_Library>`. 140 141Ethernet* Poll Mode Driver Architecture 142--------------------------------------- 143 144The DPDK includes Poll Mode Drivers (PMDs) for 1 GbE, 10 GbE and 40GbE, and para virtualized virtio 145Ethernet controllers which are designed to work without asynchronous, interrupt-based signaling mechanisms. 146 147See :ref:`Poll Mode Driver <Poll_Mode_Driver>`. 148 149Packet Forwarding Algorithm Support 150----------------------------------- 151 152The DPDK includes Hash (librte_hash) and Longest Prefix Match (LPM,librte_lpm) 153libraries to support the corresponding packet forwarding algorithms. 154 155See :ref:`Hash Library <Hash_Library>` and :ref:`LPM Library <LPM_Library>` for more information. 156 157librte_net 158---------- 159 160The librte_net library is a collection of IP protocol definitions and convenience macros. 161It is based on code from the FreeBSD* IP stack and contains protocol numbers (for use in IP headers), 162IP-related macros, IPv4/IPv6 header structures and TCP, UDP and SCTP header structures. 163