xref: /dpdk/doc/guides/prog_guide/overview.rst (revision bd89cca3ca34d255e48fa4246998c89bb38301d4)
1..  BSD LICENSE
2    Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
3    All rights reserved.
4
5    Redistribution and use in source and binary forms, with or without
6    modification, are permitted provided that the following conditions
7    are met:
8
9    * Redistributions of source code must retain the above copyright
10    notice, this list of conditions and the following disclaimer.
11    * Redistributions in binary form must reproduce the above copyright
12    notice, this list of conditions and the following disclaimer in
13    the documentation and/or other materials provided with the
14    distribution.
15    * Neither the name of Intel Corporation nor the names of its
16    contributors may be used to endorse or promote products derived
17    from this software without specific prior written permission.
18
19    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31**Part 1: Architecture Overview**
32
33Overview
34========
35
36This section gives a global overview of the architecture of Data Plane Development Kit (DPDK).
37
38The main goal of the DPDK is to provide a simple,
39complete framework for fast packet processing in data plane applications.
40Users may use the code to understand some of the techniques employed,
41to build upon for prototyping or to add their own protocol stacks.
42Alternative ecosystem options that use the DPDK are available.
43
44The framework creates a set of libraries for specific environments
45through the creation of an Environment Abstraction Layer (EAL),
46which may be specific to a mode of the Intel® architecture (32-bit or 64-bit),
47Linux* user space compilers or a specific platform.
48These environments are created through the use of make files and configuration files.
49Once the EAL library is created, the user may link with the library to create their own applications.
50Other libraries, outside of EAL, including the Hash,
51Longest Prefix Match (LPM) and rings libraries are also provided.
52Sample applications are provided to help show the user how to use various features of the DPDK.
53
54The DPDK implements a run to completion model for packet processing,
55where all resources must be allocated prior to calling Data Plane applications,
56running as execution units on logical processing cores.
57The model does not support a scheduler and all devices are accessed by polling.
58The primary reason for not using interrupts is the performance overhead imposed by interrupt processing.
59
60In addition to the run-to-completion model,
61a pipeline model may also be used by passing packets or messages between cores via the rings.
62This allows work to be performed in stages and may allow more efficient use of code on cores.
63
64Development Environment
65-----------------------
66
67The DPDK project installation requires Linux and the associated toolchain,
68such as one or more compilers, assembler, make utility,
69editor and various libraries to create the DPDK components and libraries.
70
71Once these libraries are created for the specific environment and architecture,
72they may then be used to create the user's data plane application.
73
74When creating applications for the Linux user space, the glibc library is used.
75For DPDK applications, two environmental variables (RTE_SDK and RTE_TARGET)
76must be configured before compiling the applications.
77The following are examples of how the variables can be set:
78
79.. code-block:: console
80
81    export RTE_SDK=/home/user/DPDK
82    export RTE_TARGET=x86_64-native-linuxapp-gcc
83
84See the *DPDK Getting Started Guide* for information on setting up the development environment.
85
86Environment Abstraction Layer
87-----------------------------
88
89The Environment Abstraction Layer (EAL) provides a generic interface
90that hides the environment specifics from the applications and libraries.
91The services provided by the EAL are:
92
93*   DPDK loading and launching
94
95*   Support for multi-process and multi-thread execution types
96
97*   Core affinity/assignment procedures
98
99*   System memory allocation/de-allocation
100
101*   Atomic/lock operations
102
103*   Time reference
104
105*   PCI bus access
106
107*   Trace and debug functions
108
109*   CPU feature identification
110
111*   Interrupt handling
112
113*   Alarm operations
114
115The EAL is fully described in :ref:`Environment Abstraction Layer <Environment_Abstraction_Layer>`.
116
117Core Components
118---------------
119
120The *core components* are a set of libraries that provide all the elements needed
121for high-performance packet processing applications.
122
123.. _pg_figure_1:
124
125**Figure 1. Core Components Architecture**
126
127.. image2_png has been replaced
128
129|architecture-overview|
130
131Memory Manager (librte_malloc)
132~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133
134The librte_malloc library provides an API to allocate memory from the memzones created from the hugepages instead of the heap.
135This helps when allocating large numbers of items that may become susceptible to TLB misses
136when using typical 4k heap pages in the Linux user space environment.
137
138This memory allocator is fully described in :ref:`Malloc Library <Malloc_Library>`.
139
140Ring Manager (librte_ring)
141~~~~~~~~~~~~~~~~~~~~~~~~~~
142
143The ring structure provides a lockless multi-producer, multi-consumer FIFO API in a finite size table.
144It has some advantages over lockless queues; easier to implement, adapted to bulk operations and faster.
145A ring is used by the :ref:`Memory Pool Manager (librte_mempool) <Mempool_Library>`
146and may be used as a general communication mechanism between cores
147and/or execution blocks connected together on a logical core.
148
149This ring buffer and its usage are fully described in :ref:`Ring Library <Ring_Library>`.
150
151Memory Pool Manager (librte_mempool)
152~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153
154The Memory Pool Manager is responsible for allocating pools of objects in memory.
155A pool is identified by name and uses a ring to store free objects.
156It provides some other optional services,
157such as a per-core object cache and an alignment helper to ensure that objects are padded to spread them equally on all RAM channels.
158
159This memory pool allocator is described in  :ref:`Mempool Library <Mempool_Library>`.
160
161Network Packet Buffer Management (librte_mbuf)
162~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163
164The mbuf library provides the facility to create and destroy buffers
165that may be used by the DPDK application to store message buffers.
166The message buffers are created at startup time and stored in a mempool, using the DPDK mempool library.
167
168This library provide an API to allocate/free mbufs, manipulate control message buffers (ctrlmbuf) which are generic message buffers,
169and packet buffers (pktmbuf) which are used to carry network packets.
170
171Network Packet Buffer Management is described in :ref:`Mbuf Library <Mbuf_Library>`.
172
173Timer Manager (librte_timer)
174~~~~~~~~~~~~~~~~~~~~~~~~~~~~
175
176This library provides a timer service to DPDK execution units,
177providing the ability to execute a function asynchronously.
178It can be periodic function calls, or just a one-shot call.
179It uses the timer interface provided by the Environment Abstraction Layer (EAL)
180to get a precise time reference and can be initiated on a per-core basis as required.
181
182The library documentation is available in :ref:`Timer Library <Timer_Library>`.
183
184Ethernet* Poll Mode Driver Architecture
185---------------------------------------
186
187The DPDK includes Poll Mode Drivers (PMDs) for 1 GbE, 10 GbE and 40GbE, and para virtualized virtio
188Ethernet controllers which are designed to work without asynchronous, interrupt-based signaling mechanisms.
189
190See  :ref:`Poll Mode Driver <Poll_Mode_Driver>`.
191
192Packet Forwarding Algorithm Support
193-----------------------------------
194
195The DPDK includes Hash (librte_hash) and Longest Prefix Match (LPM,librte_lpm)
196libraries to support the corresponding packet forwarding algorithms.
197
198See :ref:`Hash Library <Hash_Library>` and  :ref:`LPM Library <LPM_Library>` for more information.
199
200librte_net
201----------
202
203The librte_net library is a collection of IP protocol definitions and convenience macros.
204It is based on code from the FreeBSD* IP stack and contains protocol numbers (for use in IP headers),
205IP-related macros, IPv4/IPv6 header structures and TCP, UDP and SCTP header structures.
206
207.. |architecture-overview| image:: img/architecture-overview.svg
208