app/flow-perf: support dynamic values for meter profile
[dpdk.git] / doc / guides / tools / flow-perf.rst
1 .. SPDX-License-Identifier: BSD-3-Clause
2    Copyright 2020 Mellanox Technologies, Ltd
3
4 Flow Performance Tool
5 =====================
6
7 Application for rte_flow performance testing.
8 The application provides the ability to test insertion rate of specific
9 rte_flow rule, by stressing it to the NIC, and calculates the insertion
10 and deletion rates.
11
12 The application allows to configure which rule to apply through several
13 options of the command line.
14
15 After that the application will start producing rules with same pattern
16 but increasing the outer IP source address by 1 each time, thus it will
17 give different flow each time, and all other items will have open masks.
18
19 To assess the rule insertion rate, the flow performance tool breaks
20 down the entire number of flow rule operations into windows of fixed size
21 (defaults to 100000 flow rule operations per window, but can be configured).
22 Then, the flow performance tool measures the total time per window and
23 computes an average time across all windows.
24
25 The application also provides the ability to measure rte flow deletion rate,
26 in addition to memory consumption before and after the flow rules' creation.
27
28 The app supports single and multiple core performance measurements, and
29 support multiple cores insertion/deletion as well.
30
31
32 Compiling the Application
33 -------------------------
34
35 The ``test-flow-perf`` application is compiled as part of the main compilation
36 of the DPDK libraries and tools.
37
38 Refer to the DPDK Getting Started Guides for details.
39
40
41 Running the Application
42 -----------------------
43
44 EAL Command-line Options
45 ~~~~~~~~~~~~~~~~~~~~~~~~
46
47 Please refer to :doc:`EAL parameters (Linux) <../linux_gsg/linux_eal_parameters>`
48 or :doc:`EAL parameters (FreeBSD) <../freebsd_gsg/freebsd_eal_parameters>` for
49 a list of available EAL command-line options.
50
51
52 Flow Performance Options
53 ~~~~~~~~~~~~~~~~~~~~~~~~
54
55 The following are the command-line options for the flow performance application.
56 They must be separated from the EAL options, shown in the previous section,
57 with a ``--`` separator:
58
59 .. code-block:: console
60
61         sudo ./dpdk-test-flow_perf -n 4 -a 08:00.0 -- --ingress --ether --ipv4 --queue --rules-count=1000000
62
63 The command line options are:
64
65 *       ``--help``
66         Display a help message and quit.
67
68 *       ``--rules-count=N``
69         Set the total number of flow rules to insert,
70         where 1 <= N <= "number of flow rules".
71         The default value is 4,000,000.
72
73 *       ``--rules-batch=N``
74         Set the number of flow rules to insert per iteration window,
75         where 1 <= N <= "number of flow rules per iteration window".
76         The default value is 100,000 flow rules per iteration window.
77         For a total of --rules-count=1000000 flow rules to be inserted
78         and an iteration window size of --rules-batch=100000 flow rules,
79         the application will measure the insertion rate 10 times
80         (i.e., once every 100000 flow rules) and then report an average
81         insertion rate across the 10 measurements.
82
83 *       ``--dump-iterations``
84         Print rates for each iteration window.
85         Default iteration window equals to the rules-batch size (i.e., 100,000).
86
87 *       ``--deletion-rate``
88         Enable deletion rate calculations.
89
90 *       ``--dump-socket-mem``
91         Dump the memory stats for each socket before the insertion and after.
92
93 *       ``--enable-fwd``
94         Enable packets forwarding after insertion/deletion operations.
95
96 *       ``--portmask=N``
97         hexadecimal bitmask of ports to be used.
98
99 *       ``--cores=N``
100         Set the number of needed cores to insert/delete rte_flow rules.
101         Default cores count is 1.
102
103 *       ``--random-priority=N,S``
104         Create flows with the priority attribute set randomly between 0 to N - 1
105         and use S as seed for the pseudo-random number generator.
106
107 *       ``--meter-profile-alg``
108         Set the traffic metering algorithm.
109         Example: meter-profile-alg=srtcmp, default algorithm is srtcm_rfc2697
110
111 *       ``--unique-data``
112         Flag to set using unique data for all actions that support data,
113         Such as header modify and encap actions. Default is using fixed
114         data for any action that support data for all flows.
115
116 *       ``--rxq=N``
117         Set the count of receive queues, default is 1.
118
119 *       ``--txq=N``
120         Set the count of send queues, default is 1.
121
122 *       ``--rxd=N``
123         Set the count of rxd, default is 256.
124
125 *       ``--txd=N``
126         Set the count of txd, default is 256.
127
128 *       ``--mbuf-size=N``
129         Set the size of mbuf, default size is 2048.
130
131 *       ``--mbuf-cache-size=N``
132         Set the size of mbuf cache, default size is 512.
133
134 *       ``--total-mbuf-count=N``
135         Set the count of total mbuf number, default count is 32000.
136
137 *       ``--meter-profile=N1,N2,N3``
138         Set the CIR, CBS and EBS parameters, default values are 1250000, 156250 and 0.
139
140 Attributes:
141
142 *       ``--ingress``
143         Set Ingress attribute to all flows attributes.
144
145 *       ``--egress``
146         Set Egress attribute to all flows attributes.
147
148 *       ``--transfer``
149         Set Transfer attribute to all flows attributes.
150
151 *       ``--group=N``
152         Set group for all flows, where N >= 0.
153         Default group is 0.
154
155 Items:
156
157 *       ``--ether``
158         Add Ether item to all flows items, This item have open mask.
159
160 *       ``--vlan``
161         Add VLAN item to all flows items,
162         This item have VLAN value defined in user_parameters.h
163         under ``VNI_VALUE`` with full mask, default value = 1.
164         Other fields are open mask.
165
166 *       ``--ipv4``
167         Add IPv4 item to all flows items,
168         This item have incremental source IP, with full mask.
169         Other fields are open mask.
170
171 *       ``--ipv6``
172         Add IPv6 item to all flows item,
173         This item have incremental source IP, with full mask.
174         Other fields are open mask.
175
176 *       ``--tcp``
177         Add TCP item to all flows items, This item have open mask.
178
179 *       ``--udp``
180         Add UDP item to all flows items, This item have open mask.
181
182 *       ``--vxlan``
183         Add VXLAN item to all flows items,
184         This item have VNI value defined in user_parameters.h
185         under ``VNI_VALUE`` with full mask, default value = 1.
186         Other fields are open mask.
187
188 *       ``--vxlan-gpe``
189         Add VXLAN-GPE item to all flows items,
190         This item have VNI value defined in user_parameters.h
191         under ``VNI_VALUE`` with full mask, default value = 1.
192         Other fields are open mask.
193
194 *       ``--gre``
195         Add GRE item to all flows items,
196         This item have protocol value defined in user_parameters.h
197         under ``GRE_PROTO`` with full mask, default protocol = 0x6558 "Ether"
198         Other fields are open mask.
199
200 *       ``--geneve``
201         Add GENEVE item to all flows items,
202         This item have VNI value defined in user_parameters.h
203         under ``VNI_VALUE`` with full mask, default value = 1.
204         Other fields are open mask.
205
206 *       ``--gtp``
207         Add GTP item to all flows items,
208         This item have TEID value defined in user_parameters.h
209         under ``TEID_VALUE`` with full mask, default value = 1.
210         Other fields are open mask.
211
212 *       ``--meta``
213         Add Meta item to all flows items,
214         This item have data value defined in user_parameters.h
215         under ``META_DATA`` with full mask, default value = 1.
216         Other fields are open mask.
217
218 *       ``--tag``
219         Add Tag item to all flows items,
220         This item have data value defined in user_parameters.h
221         under ``META_DATA`` with full mask, default value = 1.
222
223         Also it have tag value defined in user_parameters.h
224         under ``TAG_INDEX`` with full mask, default value = 0.
225         Other fields are open mask.
226
227 *       ``--icmpv4``
228         Add icmpv4 item to all flows items, This item have open mask.
229
230 *       ``--icmpv6``
231         Add icmpv6 item to all flows items, This item have open mask.
232
233
234 Actions:
235
236 *       ``--port-id``
237         Add port redirection action to all flows actions.
238         Port redirection destination is defined in user_parameters.h
239         under PORT_ID_DST, default value = 1.
240
241        It can also has optional parameter like --port-id=N[,M] to
242        specify the destination port, the number of values should be
243        the same with number of set bits in portmask.
244
245 *       ``--rss``
246         Add RSS action to all flows actions,
247         The queues in RSS action will be all queues configured
248         in the app.
249
250 *       ``--queue``
251         Add queue action to all flows items,
252         The queue will change in round robin state for each flow.
253
254         For example:
255                 The app running with 4 RX queues
256                 Flow #0: queue index 0
257                 Flow #1: queue index 1
258                 Flow #2: queue index 2
259                 Flow #3: queue index 3
260                 Flow #4: queue index 0
261                 ...
262
263 *       ``--jump``
264         Add jump action to all flows actions.
265         Jump action destination is defined in user_parameters.h
266         under ``JUMP_ACTION_TABLE``, default value = 2.
267
268 *       ``--mark``
269         Add mark action to all flows actions.
270         Mark action id is defined in user_parameters.h
271         under ``MARK_ID``, default value = 1.
272
273 *       ``--count``
274         Add count action to all flows actions.
275
276 *       ``--set-meta``
277         Add set-meta action to all flows actions.
278         Meta data is defined in user_parameters.h under ``META_DATA``
279         with full mask, default value = 1.
280
281 *       ``--set-tag``
282         Add set-tag action to all flows actions.
283         Meta data is defined in user_parameters.h under ``META_DATA``
284         with full mask, default value = 1.
285
286         Tag index is defined in user_parameters.h under ``TAG_INDEX``
287         with full mask, default value = 0.
288
289 *       ``--drop``
290         Add drop action to all flows actions.
291
292 *       ``--hairpin-queue=N``
293         Add hairpin queue action to all flows actions.
294         The queue will change in round robin state for each flow.
295
296         For example:
297                 The app running with 4 RX hairpin queues and 4 normal RX queues
298                 Flow #0: queue index 4
299                 Flow #1: queue index 5
300                 Flow #2: queue index 6
301                 Flow #3: queue index 7
302                 Flow #4: queue index 4
303                 ...
304
305 *       ``--hairpin-rss=N``
306         Add hairpin RSS action to all flows actions.
307         The queues in RSS action will be all hairpin queues configured
308         in the app.
309
310 *       ``--set-src-mac``
311         Add set source mac action to all flows actions.
312         The mac to be set is random each flow.
313
314 *       ``--set-dst-mac``
315         Add set destination mac action to all flows actions.
316         The mac to be set is random each flow.
317
318 *       ``-set-src-ipv4``
319         Add set source ipv4 action to all flows actions.
320         The ipv4 header to be set is random each flow.
321
322 *       ``--set-dst-ipv4``
323         Add set destination ipv4 action to all flows actions.
324         The ipv4 header to be set is random each flow.
325
326 *       ``--set-src-ipv6``
327         Add set source ipv6 action to all flows actions.
328         The ipv6 header to be set is random each flow.
329
330 *       ``--set-dst-ipv6``
331         Add set destination ipv6 action to all flows actions.
332         The ipv6 header to be set is random each flow.
333
334 *       ``--set-src-tp``
335         Add set source tp action to all flows actions.
336         The tp sport header to be set is random each flow.
337
338 *       ``--set-dst-tp``
339         Add set destination tp action to all flows actions.
340         The tp dport header to be set is random each flow.
341
342 *       ``--inc-tcp-ack``
343         Add increment TCP acknowledgment by one to all flows actions.
344
345 *       ``--dec-tcp-ack``
346         Add decrement TCP acknowledgment by one to all flows actions.
347
348 *       ``--inc-tcp-seq``
349         Add increment TCP sequence by one to all flows actions.
350
351 *       ``--dec-tcp-seq``
352         Add decrement TCP sequence by one to all flows actions.
353
354 *       ``--set-ttl``
355         Add set IP ttl action to all flows actions.
356         The ttl value to be set is random each flow.
357
358 *       ``--dec-ttl``
359         Add decrement IP ttl by one to all flows actions.
360
361 *       ``--set-ipv4-dscp``
362         Add set IPv4 dscp action to all flows actions.
363         The dscp value to be is random each flow.
364
365 *       ``--set-ipv6-dscp``
366         Add set IPv6 dscp action to all flows actions.
367         The dscp value to be is random each flow.
368
369 *       ``--flag``
370         Add flag action to all flows actions.
371
372 *       ``--raw-encap=<DATA>``
373         Add raw encap action to all flows actions.
374         Data is the data needed to be encaped, with fixed values.
375         Example: raw-encap=ether,ipv4,udp,vxlan
376
377 *       ``--raw-decap=<DATA>``
378         Add raw decap action to all flows actions.
379         Data is the data needed to be decaped, with fixed values.
380         Example: raw-decap=ether,ipv4,gre
381
382 *       ``--vxlan-encap``
383         Add vxlan encap action to all flows actions.
384         Data to encap is fixed with pattern: ether,ipv4,udp,vxlan,
385         all encapped items have fixed values.
386
387 *       ``--vxlan-decap``
388         Add vxlan decap action to all flows actions.
389
390 *       ``--policy-mtr=<str>``
391         Add policy-mtr to create meter with policy and specify policy actions.
392         Example: policy-mtr=rss,mark::drop
393
394 *       ``--meter``
395         Add meter action to all flows actions.
396         Currently, 1 meter profile -> N meter rules -> N rte flows.