mbuf: remove control mbuf
[dpdk.git] / doc / guides / prog_guide / overview.rst
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
33 Overview
34 ========
35
36 This section gives a global overview of the architecture of Data Plane Development Kit (DPDK).
37
38 The main goal of the DPDK is to provide a simple,
39 complete framework for fast packet processing in data plane applications.
40 Users may use the code to understand some of the techniques employed,
41 to build upon for prototyping or to add their own protocol stacks.
42 Alternative ecosystem options that use the DPDK are available.
43
44 The framework creates a set of libraries for specific environments
45 through the creation of an Environment Abstraction Layer (EAL),
46 which may be specific to a mode of the IntelĀ® architecture (32-bit or 64-bit),
47 Linux* user space compilers or a specific platform.
48 These environments are created through the use of make files and configuration files.
49 Once the EAL library is created, the user may link with the library to create their own applications.
50 Other libraries, outside of EAL, including the Hash,
51 Longest Prefix Match (LPM) and rings libraries are also provided.
52 Sample applications are provided to help show the user how to use various features of the DPDK.
53
54 The DPDK implements a run to completion model for packet processing,
55 where all resources must be allocated prior to calling Data Plane applications,
56 running as execution units on logical processing cores.
57 The model does not support a scheduler and all devices are accessed by polling.
58 The primary reason for not using interrupts is the performance overhead imposed by interrupt processing.
59
60 In addition to the run-to-completion model,
61 a pipeline model may also be used by passing packets or messages between cores via the rings.
62 This allows work to be performed in stages and may allow more efficient use of code on cores.
63
64 Development Environment
65 -----------------------
66
67 The DPDK project installation requires Linux and the associated toolchain,
68 such as one or more compilers, assembler, make utility,
69 editor and various libraries to create the DPDK components and libraries.
70
71 Once these libraries are created for the specific environment and architecture,
72 they may then be used to create the user's data plane application.
73
74 When creating applications for the Linux user space, the glibc library is used.
75 For DPDK applications, two environmental variables (RTE_SDK and RTE_TARGET)
76 must be configured before compiling the applications.
77 The 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
84 See the *DPDK Getting Started Guide* for information on setting up the development environment.
85
86 Environment Abstraction Layer
87 -----------------------------
88
89 The Environment Abstraction Layer (EAL) provides a generic interface
90 that hides the environment specifics from the applications and libraries.
91 The 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
117 The EAL is fully described in :ref:`Environment Abstraction Layer <Environment_Abstraction_Layer>`.
118
119 Core Components
120 ---------------
121
122 The *core components* are a set of libraries that provide all the elements needed
123 for high-performance packet processing applications.
124
125 .. _figure_architecture-overview:
126
127 .. figure:: img/architecture-overview.*
128
129    Core Components Architecture
130
131
132 Ring Manager (librte_ring)
133 ~~~~~~~~~~~~~~~~~~~~~~~~~~
134
135 The ring structure provides a lockless multi-producer, multi-consumer FIFO API in a finite size table.
136 It has some advantages over lockless queues; easier to implement, adapted to bulk operations and faster.
137 A ring is used by the :ref:`Memory Pool Manager (librte_mempool) <Mempool_Library>`
138 and may be used as a general communication mechanism between cores
139 and/or execution blocks connected together on a logical core.
140
141 This ring buffer and its usage are fully described in :ref:`Ring Library <Ring_Library>`.
142
143 Memory Pool Manager (librte_mempool)
144 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145
146 The Memory Pool Manager is responsible for allocating pools of objects in memory.
147 A pool is identified by name and uses a ring to store free objects.
148 It provides some other optional services,
149 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.
150
151 This memory pool allocator is described in  :ref:`Mempool Library <Mempool_Library>`.
152
153 Network Packet Buffer Management (librte_mbuf)
154 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
155
156 The mbuf library provides the facility to create and destroy buffers
157 that may be used by the DPDK application to store message buffers.
158 The message buffers are created at startup time and stored in a mempool, using the DPDK mempool library.
159
160 This library provides an API to allocate/free mbufs, manipulate
161 packet buffers which are used to carry network packets.
162
163 Network Packet Buffer Management is described in :ref:`Mbuf Library <Mbuf_Library>`.
164
165 Timer Manager (librte_timer)
166 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167
168 This library provides a timer service to DPDK execution units,
169 providing the ability to execute a function asynchronously.
170 It can be periodic function calls, or just a one-shot call.
171 It uses the timer interface provided by the Environment Abstraction Layer (EAL)
172 to get a precise time reference and can be initiated on a per-core basis as required.
173
174 The library documentation is available in :ref:`Timer Library <Timer_Library>`.
175
176 Ethernet* Poll Mode Driver Architecture
177 ---------------------------------------
178
179 The DPDK includes Poll Mode Drivers (PMDs) for 1 GbE, 10 GbE and 40GbE, and para virtualized virtio
180 Ethernet controllers which are designed to work without asynchronous, interrupt-based signaling mechanisms.
181
182 See  :ref:`Poll Mode Driver <Poll_Mode_Driver>`.
183
184 Packet Forwarding Algorithm Support
185 -----------------------------------
186
187 The DPDK includes Hash (librte_hash) and Longest Prefix Match (LPM,librte_lpm)
188 libraries to support the corresponding packet forwarding algorithms.
189
190 See :ref:`Hash Library <Hash_Library>` and  :ref:`LPM Library <LPM_Library>` for more information.
191
192 librte_net
193 ----------
194
195 The librte_net library is a collection of IP protocol definitions and convenience macros.
196 It is based on code from the FreeBSD* IP stack and contains protocol numbers (for use in IP headers),
197 IP-related macros, IPv4/IPv6 header structures and TCP, UDP and SCTP header structures.