app/testpmd: fix statistics after reset
[dpdk.git] / doc / guides / sample_app_ug / test_pipeline.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2010-2014 Intel Corporation.
3
4 Test Pipeline Application
5 =========================
6
7 The Test Pipeline application illustrates the use of the DPDK Packet Framework tool suite.
8 Its purpose is to demonstrate the performance of single-table DPDK pipelines.
9
10 Overview
11 --------
12
13 The application uses three CPU cores:
14
15 *   Core A ("RX core") receives traffic from the NIC ports and feeds core B with traffic through SW queues.
16
17 *   Core B ("Pipeline core") implements a single-table DPDK pipeline
18     whose type is selectable through specific command line parameter.
19     Core B receives traffic from core A through software queues,
20     processes it according to the actions configured in the table entries that
21     are hit by the input packets and feeds it to core C through another set of software queues.
22
23 *   Core C ("TX core") receives traffic from core B through software queues and sends it to the NIC ports for transmission.
24
25 .. _figure_test_pipeline_app:
26
27 .. figure:: img/test_pipeline_app.*
28
29    Test Pipeline Application
30
31 Compiling the Application
32 -------------------------
33 To compile the sample application see :doc:`compiling`
34
35 The application is located in the ``$RTE_SDK/app/test-pipeline`` directory.
36
37
38 Running the Application
39 -----------------------
40
41 Application Command Line
42 ~~~~~~~~~~~~~~~~~~~~~~~~
43
44 The application execution command line is:
45
46 .. code-block:: console
47
48     ./test-pipeline [EAL options] -- -p PORTMASK --TABLE_TYPE
49
50 The -c or -l EAL CPU coremask/corelist option has to contain exactly 3 CPU cores.
51 The first CPU core in the core mask is assigned for core A, the second for core B and the third for core C.
52
53 The PORTMASK parameter must contain 2 or 4 ports.
54
55 Table Types and Behavior
56 ~~~~~~~~~~~~~~~~~~~~~~~~
57
58 :numref:`table_test_pipeline_1` describes the table types used and how they are populated.
59
60 The hash tables are pre-populated with 16 million keys.
61 For hash tables, the following parameters can be selected:
62
63 *   **Configurable key size implementation or fixed (specialized) key size implementation (e.g. hash-8-ext or hash-spec-8-ext).**
64     The key size specialized implementations are expected to provide better performance for 8-byte and 16-byte key sizes,
65     while the key-size-non-specialized implementation is expected to provide better performance for larger key sizes;
66
67 *   **Key size (e.g. hash-spec-8-ext or hash-spec-16-ext).**
68     The available options are 8, 16 and 32 bytes;
69
70 *   **Table type (e.g. hash-spec-16-ext or hash-spec-16-lru).**
71     The available options are ext (extendable bucket) or lru (least recently used).
72
73 .. _table_test_pipeline_1:
74
75 .. table:: Table Types
76
77    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
78    | **#** | **TABLE_TYPE**         | **Description of Core B Table**                          | **Pre-added Table Entries**                           |
79    |       |                        |                                                          |                                                       |
80    +=======+========================+==========================================================+=======================================================+
81    | 1     | none                   | Core B is not implementing a DPDK pipeline.              | N/A                                                   |
82    |       |                        | Core B is implementing a pass-through from its input set |                                                       |
83    |       |                        | of software queues to its output set of software queues. |                                                       |
84    |       |                        |                                                          |                                                       |
85    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
86    | 2     | stub                   | Stub table. Core B is implementing the same pass-through | N/A                                                   |
87    |       |                        | functionality as described for the "none" option by      |                                                       |
88    |       |                        | using the DPDK Packet Framework by using one             |                                                       |
89    |       |                        | stub table for each input NIC port.                      |                                                       |
90    |       |                        |                                                          |                                                       |
91    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
92    | 3     | hash-[spec]-8-lru      | LRU hash table with 8-byte key size and 16 million       | 16 million entries are successfully added to the      |
93    |       |                        | entries.                                                 | hash table with the following key format:             |
94    |       |                        |                                                          |                                                       |
95    |       |                        |                                                          | [4-byte index, 4 bytes of 0]                          |
96    |       |                        |                                                          |                                                       |
97    |       |                        |                                                          | The action configured for all table entries is        |
98    |       |                        |                                                          | "Sendto output port", with the output port index      |
99    |       |                        |                                                          | uniformly distributed for the range of output ports.  |
100    |       |                        |                                                          |                                                       |
101    |       |                        |                                                          | The default table rule (used in the case of a lookup  |
102    |       |                        |                                                          | miss) is to drop the packet.                          |
103    |       |                        |                                                          |                                                       |
104    |       |                        |                                                          | At run time, core A is creating the following lookup  |
105    |       |                        |                                                          | key and storing it into the packet meta data for      |
106    |       |                        |                                                          | core B to use for table lookup:                       |
107    |       |                        |                                                          |                                                       |
108    |       |                        |                                                          | [destination IPv4 address, 4 bytes of 0]              |
109    |       |                        |                                                          |                                                       |
110    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
111    | 4     | hash-[spec]-8-ext      | Extendable bucket hash table with 8-byte key size        | Same as hash-[spec]-8-lru table entries, above.       |
112    |       |                        | and 16 million entries.                                  |                                                       |
113    |       |                        |                                                          |                                                       |
114    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
115    | 5     | hash-[spec]-16-lru     | LRU hash table with 16-byte key size and 16 million      | 16 million entries are successfully added to the hash |
116    |       |                        | entries.                                                 | table with the following key format:                  |
117    |       |                        |                                                          |                                                       |
118    |       |                        |                                                          | [4-byte index, 12 bytes of 0]                         |
119    |       |                        |                                                          |                                                       |
120    |       |                        |                                                          | The action configured for all table entries is        |
121    |       |                        |                                                          | "Send to output port", with the output port index     |
122    |       |                        |                                                          | uniformly distributed for the range of output ports.  |
123    |       |                        |                                                          |                                                       |
124    |       |                        |                                                          | The default table rule (used in the case of a lookup  |
125    |       |                        |                                                          | miss) is to drop the packet.                          |
126    |       |                        |                                                          |                                                       |
127    |       |                        |                                                          | At run time, core A is creating the following lookup  |
128    |       |                        |                                                          | key and storing it into the packet meta data for core |
129    |       |                        |                                                          | B to use for table lookup:                            |
130    |       |                        |                                                          |                                                       |
131    |       |                        |                                                          | [destination IPv4 address, 12 bytes of 0]             |
132    |       |                        |                                                          |                                                       |
133    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
134    | 6     | hash-[spec]-16-ext     | Extendable bucket hash table with 16-byte key size       | Same as hash-[spec]-16-lru table entries, above.      |
135    |       |                        | and 16 million entries.                                  |                                                       |
136    |       |                        |                                                          |                                                       |
137    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
138    | 7     | hash-[spec]-32-lru     | LRU hash table with 32-byte key size and 16 million      | 16 million entries are successfully added to the hash |
139    |       |                        | entries.                                                 | table with the following key format:                  |
140    |       |                        |                                                          |                                                       |
141    |       |                        |                                                          | [4-byte index, 28 bytes of 0].                        |
142    |       |                        |                                                          |                                                       |
143    |       |                        |                                                          | The action configured for all table entries is        |
144    |       |                        |                                                          | "Send to output port", with the output port index     |
145    |       |                        |                                                          | uniformly distributed for the range of output ports.  |
146    |       |                        |                                                          |                                                       |
147    |       |                        |                                                          | The default table rule (used in the case of a lookup  |
148    |       |                        |                                                          | miss) is to drop the packet.                          |
149    |       |                        |                                                          |                                                       |
150    |       |                        |                                                          | At run time, core A is creating the following lookup  |
151    |       |                        |                                                          | key and storing it into the packet meta data for      |
152    |       |                        |                                                          | Lpmcore B to use for table lookup:                    |
153    |       |                        |                                                          |                                                       |
154    |       |                        |                                                          | [destination IPv4 address, 28 bytes of 0]             |
155    |       |                        |                                                          |                                                       |
156    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
157    | 8     | hash-[spec]-32-ext     | Extendable bucket hash table with 32-byte key size       | Same as hash-[spec]-32-lru table entries, above.      |
158    |       |                        | and 16 million entries.                                  |                                                       |
159    |       |                        |                                                          |                                                       |
160    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
161    | 9     | lpm                    | Longest Prefix Match (LPM) IPv4 table.                   | In the case of two ports, two routes                  |
162    |       |                        |                                                          | are added to the table:                               |
163    |       |                        |                                                          |                                                       |
164    |       |                        |                                                          | [0.0.0.0/9 => send to output port 0]                  |
165    |       |                        |                                                          |                                                       |
166    |       |                        |                                                          | [0.128.0.0/9 => send to output port 1]                |
167    |       |                        |                                                          |                                                       |
168    |       |                        |                                                          | In case of four ports, four entries are added to the  |
169    |       |                        |                                                          | table:                                                |
170    |       |                        |                                                          |                                                       |
171    |       |                        |                                                          | [0.0.0.0/10 => send to output port 0]                 |
172    |       |                        |                                                          |                                                       |
173    |       |                        |                                                          | [0.64.0.0/10 => send to output port 1]                |
174    |       |                        |                                                          |                                                       |
175    |       |                        |                                                          | [0.128.0.0/10 => send to output port 2]               |
176    |       |                        |                                                          |                                                       |
177    |       |                        |                                                          | [0.192.0.0/10 => send to output port 3]               |
178    |       |                        |                                                          |                                                       |
179    |       |                        |                                                          | The default table rule (used in the case of a lookup  |
180    |       |                        |                                                          | miss) is to drop the packet.                          |
181    |       |                        |                                                          |                                                       |
182    |       |                        |                                                          | At run time, core A is storing the IPv4 destination   |
183    |       |                        |                                                          | within the packet meta data to be later used by core  |
184    |       |                        |                                                          | B as the lookup key.                                  |
185    |       |                        |                                                          |                                                       |
186    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
187    | 10    | acl                    | Access Control List (ACL) table                          | In the case of two ports, two ACL rules are added to  |
188    |       |                        |                                                          | the table:                                            |
189    |       |                        |                                                          |                                                       |
190    |       |                        |                                                          | [priority = 0 (highest),                              |
191    |       |                        |                                                          |                                                       |
192    |       |                        |                                                          | IPv4 source = ANY,                                    |
193    |       |                        |                                                          |                                                       |
194    |       |                        |                                                          | IPv4 destination = 0.0.0.0/9,                         |
195    |       |                        |                                                          |                                                       |
196    |       |                        |                                                          | L4 protocol = ANY,                                    |
197    |       |                        |                                                          |                                                       |
198    |       |                        |                                                          | TCP source port = ANY,                                |
199    |       |                        |                                                          |                                                       |
200    |       |                        |                                                          | TCP destination port = ANY                            |
201    |       |                        |                                                          |                                                       |
202    |       |                        |                                                          | => send to output port 0]                             |
203    |       |                        |                                                          |                                                       |
204    |       |                        |                                                          |                                                       |
205    |       |                        |                                                          | [priority = 0 (highest),                              |
206    |       |                        |                                                          |                                                       |
207    |       |                        |                                                          | IPv4 source = ANY,                                    |
208    |       |                        |                                                          |                                                       |
209    |       |                        |                                                          | IPv4 destination = 0.128.0.0/9,                       |
210    |       |                        |                                                          |                                                       |
211    |       |                        |                                                          | L4 protocol = ANY,                                    |
212    |       |                        |                                                          |                                                       |
213    |       |                        |                                                          | TCP source port = ANY,                                |
214    |       |                        |                                                          |                                                       |
215    |       |                        |                                                          | TCP destination port = ANY                            |
216    |       |                        |                                                          |                                                       |
217    |       |                        |                                                          | => send to output port 0].                            |
218    |       |                        |                                                          |                                                       |
219    |       |                        |                                                          |                                                       |
220    |       |                        |                                                          | The default table rule (used in the case of a lookup  |
221    |       |                        |                                                          | miss) is to drop the packet.                          |
222    |       |                        |                                                          |                                                       |
223    +-------+------------------------+----------------------------------------------------------+-------------------------------------------------------+
224
225 Input Traffic
226 ~~~~~~~~~~~~~
227
228 Regardless of the table type used for the core B pipeline,
229 the same input traffic can be used to hit all table entries with uniform distribution,
230 which results in uniform distribution of packets sent out on the set of output NIC ports.
231 The profile for input traffic is TCP/IPv4 packets with:
232
233 *   destination IP address as A.B.C.D with A fixed to 0 and B, C,D random
234
235 *   source IP address fixed to 0.0.0.0
236
237 *   destination TCP port fixed to 0
238
239 *   source TCP port fixed to 0