overview.rst revision 6b3e017e
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
115*   Memory management (malloc)
116
117The EAL is fully described in :ref:`Environment Abstraction Layer <Environment_Abstraction_Layer>`.
118
119Core Components
120---------------
121
122The *core components* are a set of libraries that provide all the elements needed
123for high-performance packet processing applications.
124
125.. _figure_architecture-overview:
126
127.. figure:: img/architecture-overview.*
128
129   Core Components Architecture
130
131
132Ring Manager (librte_ring)
133~~~~~~~~~~~~~~~~~~~~~~~~~~
134
135The ring structure provides a lockless multi-producer, multi-consumer FIFO API in a finite size table.
136It has some advantages over lockless queues; easier to implement, adapted to bulk operations and faster.
137A ring is used by the :ref:`Memory Pool Manager (librte_mempool) <Mempool_Library>`
138and may be used as a general communication mechanism between cores
139and/or execution blocks connected together on a logical core.
140
141This ring buffer and its usage are fully described in :ref:`Ring Library <Ring_Library>`.
142
143Memory Pool Manager (librte_mempool)
144~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145
146The Memory Pool Manager is responsible for allocating pools of objects in memory.
147A pool is identified by name and uses a ring to store free objects.
148It provides some other optional services,
149such as a per-core object cache and an alignment helper to ensure that objects are padded to spread them equally on all RAM channels.
150
151This memory pool allocator is described in  :ref:`Mempool Library <Mempool_Library>`.
152
153Network Packet Buffer Management (librte_mbuf)
154~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
155
156The mbuf library provides the facility to create and destroy buffers
157that may be used by the DPDK application to store message buffers.
158The message buffers are created at startup time and stored in a mempool, using the DPDK mempool library.
159
160This library provides an API to allocate/free mbufs, manipulate control message buffers (ctrlmbuf) which are generic message buffers,
161and packet buffers (pktmbuf) which are used to carry network packets.
162
163Network Packet Buffer Management is described in :ref:`Mbuf Library <Mbuf_Library>`.
164
165Timer Manager (librte_timer)
166~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167
168This library provides a timer service to DPDK execution units,
169providing the ability to execute a function asynchronously.
170It can be periodic function calls, or just a one-shot call.
171It uses the timer interface provided by the Environment Abstraction Layer (EAL)
172to get a precise time reference and can be initiated on a per-core basis as required.
173
174The library documentation is available in :ref:`Timer Library <Timer_Library>`.
175
176Ethernet* Poll Mode Driver Architecture
177---------------------------------------
178
179The DPDK includes Poll Mode Drivers (PMDs) for 1 GbE, 10 GbE and 40GbE, and para virtualized virtio
180Ethernet controllers which are designed to work without asynchronous, interrupt-based signaling mechanisms.
181
182See  :ref:`Poll Mode Driver <Poll_Mode_Driver>`.
183
184Packet Forwarding Algorithm Support
185-----------------------------------
186
187The DPDK includes Hash (librte_hash) and Longest Prefix Match (LPM,librte_lpm)
188libraries to support the corresponding packet forwarding algorithms.
189
190See :ref:`Hash Library <Hash_Library>` and  :ref:`LPM Library <LPM_Library>` for more information.
191
192librte_net
193----------
194
195The librte_net library is a collection of IP protocol definitions and convenience macros.
196It is based on code from the FreeBSD* IP stack and contains protocol numbers (for use in IP headers),
197IP-related macros, IPv4/IPv6 header structures and TCP, UDP and SCTP header structures.
198