2663fe0e83a9092347d71ae28f405e65d45622d7
[dpdk.git] / doc / guides / prog_guide / overview.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2010-2014 Intel Corporation.
3
4 **Part 1: Architecture Overview**
5
6 Overview
7 ========
8
9 This section gives a global overview of the architecture of Data Plane Development Kit (DPDK).
10
11 The main goal of the DPDK is to provide a simple,
12 complete framework for fast packet processing in data plane applications.
13 Users may use the code to understand some of the techniques employed,
14 to build upon for prototyping or to add their own protocol stacks.
15 Alternative ecosystem options that use the DPDK are available.
16
17 The framework creates a set of libraries for specific environments
18 through the creation of an Environment Abstraction Layer (EAL),
19 which may be specific to a mode of the IntelĀ® architecture (32-bit or 64-bit),
20 Linux* user space compilers or a specific platform.
21 These environments are created through the use of make files and configuration files.
22 Once the EAL library is created, the user may link with the library to create their own applications.
23 Other libraries, outside of EAL, including the Hash,
24 Longest Prefix Match (LPM) and rings libraries are also provided.
25 Sample applications are provided to help show the user how to use various features of the DPDK.
26
27 The DPDK implements a run to completion model for packet processing,
28 where all resources must be allocated prior to calling Data Plane applications,
29 running as execution units on logical processing cores.
30 The model does not support a scheduler and all devices are accessed by polling.
31 The primary reason for not using interrupts is the performance overhead imposed by interrupt processing.
32
33 In addition to the run-to-completion model,
34 a pipeline model may also be used by passing packets or messages between cores via the rings.
35 This allows work to be performed in stages and may allow more efficient use of code on cores.
36
37 Development Environment
38 -----------------------
39
40 The DPDK project installation requires Linux and the associated toolchain,
41 such as one or more compilers, assembler, make utility,
42 editor and various libraries to create the DPDK components and libraries.
43
44 Once these libraries are created for the specific environment and architecture,
45 they may then be used to create the user's data plane application.
46
47 When creating applications for the Linux user space, the glibc library is used.
48 For DPDK applications, two environmental variables (RTE_SDK and RTE_TARGET)
49 must be configured before compiling the applications.
50 The following are examples of how the variables can be set:
51
52 .. code-block:: console
53
54     export RTE_SDK=/home/user/DPDK
55     export RTE_TARGET=x86_64-native-linuxapp-gcc
56
57 See the *DPDK Getting Started Guide* for information on setting up the development environment.
58
59 Environment Abstraction Layer
60 -----------------------------
61
62 The Environment Abstraction Layer (EAL) provides a generic interface
63 that hides the environment specifics from the applications and libraries.
64 The services provided by the EAL are:
65
66 *   DPDK loading and launching
67
68 *   Support for multi-process and multi-thread execution types
69
70 *   Core affinity/assignment procedures
71
72 *   System memory allocation/de-allocation
73
74 *   Atomic/lock operations
75
76 *   Time reference
77
78 *   PCI bus access
79
80 *   Trace and debug functions
81
82 *   CPU feature identification
83
84 *   Interrupt handling
85
86 *   Alarm operations
87
88 *   Memory management (malloc)
89
90 The EAL is fully described in :ref:`Environment Abstraction Layer <Environment_Abstraction_Layer>`.
91
92 Core Components
93 ---------------
94
95 The *core components* are a set of libraries that provide all the elements needed
96 for high-performance packet processing applications.
97
98 .. _figure_architecture-overview:
99
100 .. figure:: img/architecture-overview.*
101
102    Core Components Architecture
103
104
105 Ring Manager (librte_ring)
106 ~~~~~~~~~~~~~~~~~~~~~~~~~~
107
108 The ring structure provides a lockless multi-producer, multi-consumer FIFO API in a finite size table.
109 It has some advantages over lockless queues; easier to implement, adapted to bulk operations and faster.
110 A ring is used by the :ref:`Memory Pool Manager (librte_mempool) <Mempool_Library>`
111 and may be used as a general communication mechanism between cores
112 and/or execution blocks connected together on a logical core.
113
114 This ring buffer and its usage are fully described in :ref:`Ring Library <Ring_Library>`.
115
116 Memory Pool Manager (librte_mempool)
117 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118
119 The Memory Pool Manager is responsible for allocating pools of objects in memory.
120 A pool is identified by name and uses a ring to store free objects.
121 It provides some other optional services,
122 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.
123
124 This memory pool allocator is described in  :ref:`Mempool Library <Mempool_Library>`.
125
126 Network Packet Buffer Management (librte_mbuf)
127 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128
129 The mbuf library provides the facility to create and destroy buffers
130 that may be used by the DPDK application to store message buffers.
131 The message buffers are created at startup time and stored in a mempool, using the DPDK mempool library.
132
133 This library provides an API to allocate/free mbufs, manipulate control message buffers (ctrlmbuf) which are generic message buffers,
134 and packet buffers (pktmbuf) which are used to carry network packets.
135
136 Network Packet Buffer Management is described in :ref:`Mbuf Library <Mbuf_Library>`.
137
138 Timer Manager (librte_timer)
139 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140
141 This library provides a timer service to DPDK execution units,
142 providing the ability to execute a function asynchronously.
143 It can be periodic function calls, or just a one-shot call.
144 It uses the timer interface provided by the Environment Abstraction Layer (EAL)
145 to get a precise time reference and can be initiated on a per-core basis as required.
146
147 The library documentation is available in :ref:`Timer Library <Timer_Library>`.
148
149 Ethernet* Poll Mode Driver Architecture
150 ---------------------------------------
151
152 The DPDK includes Poll Mode Drivers (PMDs) for 1 GbE, 10 GbE and 40GbE, and para virtualized virtio
153 Ethernet controllers which are designed to work without asynchronous, interrupt-based signaling mechanisms.
154
155 See  :ref:`Poll Mode Driver <Poll_Mode_Driver>`.
156
157 Packet Forwarding Algorithm Support
158 -----------------------------------
159
160 The DPDK includes Hash (librte_hash) and Longest Prefix Match (LPM,librte_lpm)
161 libraries to support the corresponding packet forwarding algorithms.
162
163 See :ref:`Hash Library <Hash_Library>` and  :ref:`LPM Library <LPM_Library>` for more information.
164
165 librte_net
166 ----------
167
168 The librte_net library is a collection of IP protocol definitions and convenience macros.
169 It is based on code from the FreeBSD* IP stack and contains protocol numbers (for use in IP headers),
170 IP-related macros, IPv4/IPv6 header structures and TCP, UDP and SCTP header structures.