15630257fSFerruh Yigit.. SPDX-License-Identifier: BSD-3-Clause 25630257fSFerruh Yigit Copyright(c) 2010-2014 Intel Corporation. 3fc1f2750SBernard Iremonger 4fc1f2750SBernard IremongerOverview 5fc1f2750SBernard Iremonger======== 6fc1f2750SBernard Iremonger 748624fd9SSiobhan ButlerThis section gives a global overview of the architecture of Data Plane Development Kit (DPDK). 8fc1f2750SBernard Iremonger 948624fd9SSiobhan ButlerThe main goal of the DPDK is to provide a simple, 10fc1f2750SBernard Iremongercomplete framework for fast packet processing in data plane applications. 11fc1f2750SBernard IremongerUsers may use the code to understand some of the techniques employed, 12fc1f2750SBernard Iremongerto build upon for prototyping or to add their own protocol stacks. 1348624fd9SSiobhan ButlerAlternative ecosystem options that use the DPDK are available. 14fc1f2750SBernard Iremonger 15fc1f2750SBernard IremongerThe framework creates a set of libraries for specific environments 16fc1f2750SBernard Iremongerthrough the creation of an Environment Abstraction Layer (EAL), 17fc1f2750SBernard Iremongerwhich may be specific to a mode of the Intel® architecture (32-bit or 64-bit), 18fc1f2750SBernard IremongerLinux* user space compilers or a specific platform. 193cc6ecfdSCiara PowerThese environments are created through the use of meson files and configuration files. 20fc1f2750SBernard IremongerOnce the EAL library is created, the user may link with the library to create their own applications. 21fc1f2750SBernard IremongerOther libraries, outside of EAL, including the Hash, 22fc1f2750SBernard IremongerLongest Prefix Match (LPM) and rings libraries are also provided. 2348624fd9SSiobhan ButlerSample applications are provided to help show the user how to use various features of the DPDK. 24fc1f2750SBernard Iremonger 2548624fd9SSiobhan ButlerThe DPDK implements a run to completion model for packet processing, 26fc1f2750SBernard Iremongerwhere all resources must be allocated prior to calling Data Plane applications, 27fc1f2750SBernard Iremongerrunning as execution units on logical processing cores. 28fc1f2750SBernard IremongerThe model does not support a scheduler and all devices are accessed by polling. 29fc1f2750SBernard IremongerThe primary reason for not using interrupts is the performance overhead imposed by interrupt processing. 30fc1f2750SBernard Iremonger 31fc1f2750SBernard IremongerIn addition to the run-to-completion model, 32fc1f2750SBernard Iremongera pipeline model may also be used by passing packets or messages between cores via the rings. 33fc1f2750SBernard IremongerThis allows work to be performed in stages and may allow more efficient use of code on cores. 34fc1f2750SBernard Iremonger 35fc1f2750SBernard IremongerDevelopment Environment 36fc1f2750SBernard Iremonger----------------------- 37fc1f2750SBernard Iremonger 3848624fd9SSiobhan ButlerThe DPDK project installation requires Linux and the associated toolchain, 393cc6ecfdSCiara Powersuch as one or more compilers, assembler, meson utility, 4048624fd9SSiobhan Butlereditor and various libraries to create the DPDK components and libraries. 41fc1f2750SBernard Iremonger 42fc1f2750SBernard IremongerOnce these libraries are created for the specific environment and architecture, 43fc1f2750SBernard Iremongerthey may then be used to create the user's data plane application. 44fc1f2750SBernard Iremonger 45fc1f2750SBernard IremongerWhen creating applications for the Linux user space, the glibc library is used. 46fc1f2750SBernard Iremonger 4748624fd9SSiobhan ButlerSee the *DPDK Getting Started Guide* for information on setting up the development environment. 48fc1f2750SBernard Iremonger 49fc1f2750SBernard IremongerEnvironment Abstraction Layer 50fc1f2750SBernard Iremonger----------------------------- 51fc1f2750SBernard Iremonger 52fc1f2750SBernard IremongerThe Environment Abstraction Layer (EAL) provides a generic interface 53fc1f2750SBernard Iremongerthat hides the environment specifics from the applications and libraries. 54fc1f2750SBernard IremongerThe services provided by the EAL are: 55fc1f2750SBernard Iremonger 5648624fd9SSiobhan Butler* DPDK loading and launching 57fc1f2750SBernard Iremonger 58fc1f2750SBernard Iremonger* Support for multi-process and multi-thread execution types 59fc1f2750SBernard Iremonger 60fc1f2750SBernard Iremonger* Core affinity/assignment procedures 61fc1f2750SBernard Iremonger 62fc1f2750SBernard Iremonger* System memory allocation/de-allocation 63fc1f2750SBernard Iremonger 64fc1f2750SBernard Iremonger* Atomic/lock operations 65fc1f2750SBernard Iremonger 66fc1f2750SBernard Iremonger* Time reference 67fc1f2750SBernard Iremonger 68fc1f2750SBernard Iremonger* PCI bus access 69fc1f2750SBernard Iremonger 70fc1f2750SBernard Iremonger* Trace and debug functions 71fc1f2750SBernard Iremonger 72fc1f2750SBernard Iremonger* CPU feature identification 73fc1f2750SBernard Iremonger 74fc1f2750SBernard Iremonger* Interrupt handling 75fc1f2750SBernard Iremonger 76fc1f2750SBernard Iremonger* Alarm operations 77fc1f2750SBernard Iremonger 782fe68f32SJohn McNamara* Memory management (malloc) 7956297061SSergio Gonzalez Monroy 80*41dd9a6bSDavid YoungThe EAL is fully described in :doc:`env_abstraction_layer`. 81fc1f2750SBernard Iremonger 82fc1f2750SBernard IremongerCore Components 83fc1f2750SBernard Iremonger--------------- 84fc1f2750SBernard Iremonger 85fc1f2750SBernard IremongerThe *core components* are a set of libraries that provide all the elements needed 86fc1f2750SBernard Iremongerfor high-performance packet processing applications. 87fc1f2750SBernard Iremonger 884a22e6eeSJohn McNamara.. _figure_architecture-overview: 89fc1f2750SBernard Iremonger 904a22e6eeSJohn McNamara.. figure:: img/architecture-overview.* 91fc1f2750SBernard Iremonger 924a22e6eeSJohn McNamara Core Components Architecture 93fc1f2750SBernard Iremonger 94fc1f2750SBernard Iremonger 95fc1f2750SBernard IremongerRing Manager (librte_ring) 96fc1f2750SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~ 97fc1f2750SBernard Iremonger 98fc1f2750SBernard IremongerThe ring structure provides a lockless multi-producer, multi-consumer FIFO API in a finite size table. 99fc1f2750SBernard IremongerIt has some advantages over lockless queues; easier to implement, adapted to bulk operations and faster. 100*41dd9a6bSDavid YoungA ring is used by the :doc:`mempool_lib` 101fc1f2750SBernard Iremongerand may be used as a general communication mechanism between cores 102fc1f2750SBernard Iremongerand/or execution blocks connected together on a logical core. 103fc1f2750SBernard Iremonger 104*41dd9a6bSDavid YoungThis ring buffer and its usage are fully described in :doc:`ring_lib`. 105fc1f2750SBernard Iremonger 106fc1f2750SBernard IremongerMemory Pool Manager (librte_mempool) 107fc1f2750SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 108fc1f2750SBernard Iremonger 109fc1f2750SBernard IremongerThe Memory Pool Manager is responsible for allocating pools of objects in memory. 110fc1f2750SBernard IremongerA pool is identified by name and uses a ring to store free objects. 111fc1f2750SBernard IremongerIt provides some other optional services, 112fc1f2750SBernard Iremongersuch as a per-core object cache and an alignment helper to ensure that objects are padded to spread them equally on all RAM channels. 113fc1f2750SBernard Iremonger 114*41dd9a6bSDavid YoungThis memory pool allocator is described in :doc:`mempool_lib`. 115fc1f2750SBernard Iremonger 116fc1f2750SBernard IremongerNetwork Packet Buffer Management (librte_mbuf) 117fc1f2750SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118fc1f2750SBernard Iremonger 119fc1f2750SBernard IremongerThe mbuf library provides the facility to create and destroy buffers 12048624fd9SSiobhan Butlerthat may be used by the DPDK application to store message buffers. 12148624fd9SSiobhan ButlerThe message buffers are created at startup time and stored in a mempool, using the DPDK mempool library. 122fc1f2750SBernard Iremonger 123d27a6261SOlivier MatzThis library provides an API to allocate/free mbufs, manipulate 124d27a6261SOlivier Matzpacket buffers which are used to carry network packets. 125fc1f2750SBernard Iremonger 126*41dd9a6bSDavid YoungNetwork Packet Buffer Management is described in :doc:`mbuf_lib`. 127fc1f2750SBernard Iremonger 128fc1f2750SBernard IremongerTimer Manager (librte_timer) 129fc1f2750SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130fc1f2750SBernard Iremonger 13148624fd9SSiobhan ButlerThis library provides a timer service to DPDK execution units, 132fc1f2750SBernard Iremongerproviding the ability to execute a function asynchronously. 133fc1f2750SBernard IremongerIt can be periodic function calls, or just a one-shot call. 134fc1f2750SBernard IremongerIt uses the timer interface provided by the Environment Abstraction Layer (EAL) 135fc1f2750SBernard Iremongerto get a precise time reference and can be initiated on a per-core basis as required. 136fc1f2750SBernard Iremonger 137*41dd9a6bSDavid YoungThe library documentation is available in :doc:`timer_lib`. 138fc1f2750SBernard Iremonger 139fc1f2750SBernard IremongerEthernet* Poll Mode Driver Architecture 140fc1f2750SBernard Iremonger--------------------------------------- 141fc1f2750SBernard Iremonger 14248624fd9SSiobhan ButlerThe DPDK includes Poll Mode Drivers (PMDs) for 1 GbE, 10 GbE and 40GbE, and para virtualized virtio 143fc1f2750SBernard IremongerEthernet controllers which are designed to work without asynchronous, interrupt-based signaling mechanisms. 144fc1f2750SBernard Iremonger 145fc1f2750SBernard IremongerPacket Forwarding Algorithm Support 146fc1f2750SBernard Iremonger----------------------------------- 147fc1f2750SBernard Iremonger 14848624fd9SSiobhan ButlerThe DPDK includes Hash (librte_hash) and Longest Prefix Match (LPM,librte_lpm) 149fc1f2750SBernard Iremongerlibraries to support the corresponding packet forwarding algorithms. 150fc1f2750SBernard Iremonger 151*41dd9a6bSDavid YoungSee :doc:`hash_lib` and :doc:`lpm_lib` for more information. 152fc1f2750SBernard Iremonger 153fc1f2750SBernard Iremongerlibrte_net 154fc1f2750SBernard Iremonger---------- 155fc1f2750SBernard Iremonger 156fc1f2750SBernard IremongerThe librte_net library is a collection of IP protocol definitions and convenience macros. 157fc1f2750SBernard IremongerIt is based on code from the FreeBSD* IP stack and contains protocol numbers (for use in IP headers), 158fc1f2750SBernard IremongerIP-related macros, IPv4/IPv6 header structures and TCP, UDP and SCTP header structures. 159