app/eventdev: add event timer adapter as a producer
[dpdk.git] / doc / guides / tools / testeventdev.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2017 Cavium, Inc
3
4 dpdk-test-eventdev Application
5 ==============================
6
7 The ``dpdk-test-eventdev`` tool is a Data Plane Development Kit (DPDK)
8 application that allows exercising various eventdev use cases.
9 This application has a generic framework to add new eventdev based test cases to
10 verify functionality and measure the performance parameters of DPDK eventdev
11 devices.
12
13 Compiling the Application
14 -------------------------
15
16 **Build the application**
17
18 Execute the ``dpdk-setup.sh`` script to build the DPDK library together with the
19 ``dpdk-test-eventdev`` application.
20
21 Initially, the user must select a DPDK target to choose the correct target type
22 and compiler options to use when building the libraries.
23 The user must have all libraries, modules, updates and compilers installed
24 in the system prior to this,
25 as described in the earlier chapters in this Getting Started Guide.
26
27 Running the Application
28 -----------------------
29
30 The application has a number of command line options:
31
32 .. code-block:: console
33
34    dpdk-test-eventdev [EAL Options] -- [application options]
35
36 EAL Options
37 ~~~~~~~~~~~
38
39 The following are the EAL command-line options that can be used in conjunction
40 with the ``dpdk-test-eventdev`` application.
41 See the DPDK Getting Started Guides for more information on these options.
42
43 *   ``-c <COREMASK>`` or ``-l <CORELIST>``
44
45         Set the hexadecimal bitmask of the cores to run on. The corelist is a
46         list of cores to use.
47
48 *   ``--vdev <driver><id>``
49
50         Add a virtual eventdev device.
51
52 Application Options
53 ~~~~~~~~~~~~~~~~~~~
54
55 The following are the application command-line options:
56
57 * ``--verbose``
58
59         Set verbose level. Default is 1. Value > 1 displays more details.
60
61 * ``--dev <n>``
62
63         Set the device id of the event device.
64
65 * ``--test <name>``
66
67         Set test name, where ``name`` is one of the following::
68
69          order_queue
70          order_atq
71          perf_queue
72          perf_atq
73
74 * ``--socket_id <n>``
75
76         Set the socket id of the application resources.
77
78 * ``--pool-sz <n>``
79
80         Set the number of mbufs to be allocated from the mempool.
81
82 * ``--plcores <CORELIST>``
83
84         Set the list of cores to be used as producers.
85
86 * ``--wlcores <CORELIST>``
87
88         Set the list of cores to be used as workers.
89
90 * ``--stlist <type_list>``
91
92         Set the scheduled type of each stage where ``type_list`` size
93         determines the number of stages used in the test application.
94         Each type_list member can be one of the following::
95
96             P or p : Parallel schedule type
97             O or o : Ordered schedule type
98             A or a : Atomic schedule type
99
100         Application expects the ``type_list`` in comma separated form (i.e. ``--stlist o,a,a,a``)
101
102 * ``--nb_flows <n>``
103
104         Set the number of flows to produce.
105
106 * ``--nb_pkts <n>``
107
108         Set the number of packets to produce. 0 implies no limit.
109
110 * ``--worker_deq_depth <n>``
111
112         Set the dequeue depth of the worker.
113
114 * ``--fwd_latency``
115
116         Perform forward latency measurement.
117
118 * ``--queue_priority``
119
120         Enable queue priority.
121
122 * ``--prod_type_ethdev``
123
124         Use ethernet device as producer.
125
126 * ``--prod_type_timerdev``
127
128         Use event timer adapter as producer.
129
130 Eventdev Tests
131 --------------
132
133 ORDER_QUEUE Test
134 ~~~~~~~~~~~~~~~~
135
136 This is a functional test case that aims at testing the following:
137
138 #. Verify the ingress order maintenance.
139 #. Verify the exclusive(atomic) access to given atomic flow per eventdev port.
140
141 .. _table_eventdev_order_queue_test:
142
143 .. table:: Order queue test eventdev configuration.
144
145    +---+--------------+----------------+------------------------+
146    | # | Items        | Value          | Comments               |
147    |   |              |                |                        |
148    +===+==============+================+========================+
149    | 1 | nb_queues    | 2              | q0(ordered), q1(atomic)|
150    |   |              |                |                        |
151    +---+--------------+----------------+------------------------+
152    | 2 | nb_producers | 1              |                        |
153    |   |              |                |                        |
154    +---+--------------+----------------+------------------------+
155    | 3 | nb_workers   | >= 1           |                        |
156    |   |              |                |                        |
157    +---+--------------+----------------+------------------------+
158    | 4 | nb_ports     | nb_workers +   | Workers use port 0 to  |
159    |   |              | 1              | port n-1. Producer uses|
160    |   |              |                | port n                 |
161    +---+--------------+----------------+------------------------+
162
163 .. _figure_eventdev_order_queue_test:
164
165 .. figure:: img/eventdev_order_queue_test.*
166
167    order queue test operation.
168
169 The order queue test configures the eventdev with two queues and an event
170 producer to inject the events to q0(ordered) queue. Both q0(ordered) and
171 q1(atomic) are linked to all the workers.
172
173 The event producer maintains a sequence number per flow and injects the events
174 to the ordered queue. The worker receives the events from ordered queue and
175 forwards to atomic queue. Since the events from an ordered queue can be
176 processed in parallel on the different workers, the ingress order of events
177 might have changed on the downstream atomic queue enqueue. On enqueue to the
178 atomic queue, the eventdev PMD driver reorders the event to the original
179 ingress order(i.e producer ingress order).
180
181 When the event is dequeued from the atomic queue by the worker, this test
182 verifies the expected sequence number of associated event per flow by comparing
183 the free running expected sequence number per flow.
184
185 Application options
186 ^^^^^^^^^^^^^^^^^^^
187
188 Supported application command line options are following::
189
190    --verbose
191    --dev
192    --test
193    --socket_id
194    --pool_sz
195    --plcores
196    --wlcores
197    --nb_flows
198    --nb_pkts
199    --worker_deq_depth
200
201 Example
202 ^^^^^^^
203
204 Example command to run order queue test:
205
206 .. code-block:: console
207
208    sudo build/app/dpdk-test-eventdev --vdev=event_sw0 -- \
209                 --test=order_queue --plcores 1 --wlcores 2,3
210
211
212 ORDER_ATQ Test
213 ~~~~~~~~~~~~~~
214
215 This test verifies the same aspects of ``order_queue`` test, the difference is
216 the number of queues used, this test operates on a single ``all types queue(atq)``
217 instead of two different queues for ordered and atomic.
218
219 .. _table_eventdev_order_atq_test:
220
221 .. table:: Order all types queue test eventdev configuration.
222
223    +---+--------------+----------------+------------------------+
224    | # | Items        | Value          | Comments               |
225    |   |              |                |                        |
226    +===+==============+================+========================+
227    | 1 | nb_queues    | 1              | q0(all types queue)    |
228    |   |              |                |                        |
229    +---+--------------+----------------+------------------------+
230    | 2 | nb_producers | 1              |                        |
231    |   |              |                |                        |
232    +---+--------------+----------------+------------------------+
233    | 3 | nb_workers   | >= 1           |                        |
234    |   |              |                |                        |
235    +---+--------------+----------------+------------------------+
236    | 4 | nb_ports     | nb_workers +   | Workers use port 0 to  |
237    |   |              | 1              | port n-1.Producer uses |
238    |   |              |                | port n.                |
239    +---+--------------+----------------+------------------------+
240
241 .. _figure_eventdev_order_atq_test:
242
243 .. figure:: img/eventdev_order_atq_test.*
244
245    order all types queue test operation.
246
247 Application options
248 ^^^^^^^^^^^^^^^^^^^
249
250 Supported application command line options are following::
251
252    --verbose
253    --dev
254    --test
255    --socket_id
256    --pool_sz
257    --plcores
258    --wlcores
259    --nb_flows
260    --nb_pkts
261    --worker_deq_depth
262
263 Example
264 ^^^^^^^
265
266 Example command to run order ``all types queue`` test:
267
268 .. code-block:: console
269
270    sudo build/app/dpdk-test-eventdev --vdev=event_octeontx -- \
271                         --test=order_atq --plcores 1 --wlcores 2,3
272
273
274 PERF_QUEUE Test
275 ~~~~~~~~~~~~~~~
276
277 This is a performance test case that aims at testing the following:
278
279 #. Measure the number of events can be processed in a second.
280 #. Measure the latency to forward an event.
281
282 .. _table_eventdev_perf_queue_test:
283
284 .. table:: Perf queue test eventdev configuration.
285
286    +---+--------------+----------------+-----------------------------------------+
287    | # | Items        | Value          | Comments                                |
288    |   |              |                |                                         |
289    +===+==============+================+=========================================+
290    | 1 | nb_queues    | nb_producers * | Queues will be configured based on the  |
291    |   |              | nb_stages      | user requested sched type list(--stlist)|
292    +---+--------------+----------------+-----------------------------------------+
293    | 2 | nb_producers | >= 1           | Selected through --plcores command line |
294    |   |              |                | argument.                               |
295    +---+--------------+----------------+-----------------------------------------+
296    | 3 | nb_workers   | >= 1           | Selected through --wlcores command line |
297    |   |              |                | argument                                |
298    +---+--------------+----------------+-----------------------------------------+
299    | 4 | nb_ports     | nb_workers +   | Workers use port 0 to port n-1.         |
300    |   |              | nb_producers   | Producers use port n to port p          |
301    +---+--------------+----------------+-----------------------------------------+
302
303 .. _figure_eventdev_perf_queue_test:
304
305 .. figure:: img/eventdev_perf_queue_test.*
306
307    perf queue test operation.
308
309 The perf queue test configures the eventdev with Q queues and P ports, where
310 Q and P is a function of the number of workers, the number of producers and
311 number of stages as mentioned in :numref:`table_eventdev_perf_queue_test`.
312
313 The user can choose the number of workers, the number of producers and number of
314 stages through the ``--wlcores``, ``--plcores`` and the ``--stlist`` application
315 command line arguments respectively.
316
317 The producer(s) injects the events to eventdev based the first stage sched type
318 list requested by the user through ``--stlist`` the command line argument.
319
320 Based on the number of stages to process(selected through ``--stlist``),
321 The application forwards the event to next upstream queue and terminates when it
322 reaches the last stage in the pipeline. On event termination, application
323 increments the number events processed and print periodically in one second
324 to get the number of events processed in one second.
325
326 When ``--fwd_latency`` command line option selected, the application inserts
327 the timestamp in the event on the first stage and then on termination, it
328 updates the number of cycles to forward a packet. The application uses this
329 value to compute the average latency to a forward packet.
330
331 When ``--prod_type_ethdev`` command line option is selected, the application
332 uses the probed ethernet devices as producers by configuring them as Rx
333 adapters instead of using synthetic producers.
334
335 Application options
336 ^^^^^^^^^^^^^^^^^^^
337
338 Supported application command line options are following::
339
340         --verbose
341         --dev
342         --test
343         --socket_id
344         --pool_sz
345         --plcores
346         --wlcores
347         --stlist
348         --nb_flows
349         --nb_pkts
350         --worker_deq_depth
351         --fwd_latency
352         --queue_priority
353         --prod_type_ethdev
354         --prod_type_timerdev
355
356 Example
357 ^^^^^^^
358
359 Example command to run perf queue test:
360
361 .. code-block:: console
362
363    sudo build/app/dpdk-test-eventdev -c 0xf -s 0x1 --vdev=event_sw0 -- \
364         --test=perf_queue --plcores=2 --wlcore=3 --stlist=p --nb_pkts=0
365
366 Example command to run perf queue test with ethernet ports:
367
368 .. code-block:: console
369
370    sudo build/app/dpdk-test-eventdev --vdev=event_sw0 -- \
371         --test=perf_queue --plcores=2 --wlcore=3 --stlist=p --prod_type_ethdev
372
373 Example command to run perf queue test with event timer adapter:
374
375 .. code-block:: console
376
377    sudo  build/app/dpdk-test-eventdev --vdev="event_octeontx" -- \
378                 --wlcores 4 --plcores 12 --test perf_queue --stlist=a \
379                 --prod_type_timerdev --fwd_latency
380
381 PERF_ATQ Test
382 ~~~~~~~~~~~~~~~
383
384 This is a performance test case that aims at testing the following with
385 ``all types queue`` eventdev scheme.
386
387 #. Measure the number of events can be processed in a second.
388 #. Measure the latency to forward an event.
389
390 .. _table_eventdev_perf_atq_test:
391
392 .. table:: Perf all types queue test eventdev configuration.
393
394    +---+--------------+----------------+-----------------------------------------+
395    | # | Items        | Value          | Comments                                |
396    |   |              |                |                                         |
397    +===+==============+================+=========================================+
398    | 1 | nb_queues    | nb_producers   | Queues will be configured based on the  |
399    |   |              |                | user requested sched type list(--stlist)|
400    +---+--------------+----------------+-----------------------------------------+
401    | 2 | nb_producers | >= 1           | Selected through --plcores command line |
402    |   |              |                | argument.                               |
403    +---+--------------+----------------+-----------------------------------------+
404    | 3 | nb_workers   | >= 1           | Selected through --wlcores command line |
405    |   |              |                | argument                                |
406    +---+--------------+----------------+-----------------------------------------+
407    | 4 | nb_ports     | nb_workers +   | Workers use port 0 to port n-1.         |
408    |   |              | nb_producers   | Producers use port n to port p          |
409    +---+--------------+----------------+-----------------------------------------+
410
411 .. _figure_eventdev_perf_atq_test:
412
413 .. figure:: img/eventdev_perf_atq_test.*
414
415    perf all types queue test operation.
416
417
418 The ``all types queues(atq)`` perf test configures the eventdev with Q queues
419 and P ports, where Q and P is a function of the number of workers and number of
420 producers as mentioned in :numref:`table_eventdev_perf_atq_test`.
421
422
423 The atq queue test functions as same as ``perf_queue`` test. The difference
424 is, It uses, ``all type queue scheme`` instead of separate queues for each
425 stage and thus reduces the number of queues required to realize the use case
426 and enables flow pinning as the event does not move to the next queue.
427
428
429 Application options
430 ^^^^^^^^^^^^^^^^^^^
431
432 Supported application command line options are following::
433
434         --verbose
435         --dev
436         --test
437         --socket_id
438         --pool_sz
439         --plcores
440         --wlcores
441         --stlist
442         --nb_flows
443         --nb_pkts
444         --worker_deq_depth
445         --fwd_latency
446         --prod_type_ethdev
447         --prod_type_timerdev
448
449 Example
450 ^^^^^^^
451
452 Example command to run perf ``all types queue`` test:
453
454 .. code-block:: console
455
456    sudo build/app/dpdk-test-eventdev --vdev=event_octeontx -- \
457                 --test=perf_atq --plcores=2 --wlcore=3 --stlist=p --nb_pkts=0
458
459 Example command to run perf ``all types queue`` test with event timer adapter:
460
461 .. code-block:: console
462
463    sudo  build/app/dpdk-test-eventdev --vdev="event_octeontx" -- \
464                 --wlcores 4 --plcores 12 --test perf_atq --verbose 20 \
465                 --stlist=a --prod_type_timerdev --fwd_latency
466
467
468 PIPELINE_QUEUE Test
469 ~~~~~~~~~~~~~~~~~~~
470
471 This is a pipeline test case that aims at testing the following:
472
473 #. Measure the end-to-end performance of an event dev with a ethernet dev.
474 #. Maintain packet ordering from Rx to Tx.
475
476 .. _table_eventdev_pipeline_queue_test:
477
478 .. table:: Pipeline queue test eventdev configuration.
479
480    +---+--------------+----------------+-----------------------------------------+
481    | # | Items        | Value          | Comments                                |
482    |   |              |                |                                         |
483    +===+==============+================+=========================================+
484    | 1 | nb_queues    | (nb_producers  | Queues will be configured based on the  |
485    |   |              | * nb_stages) + | user requested sched type list(--stlist)|
486    |   |              | x              | Here value of x is 1 in generic pipeline|
487    |   |              |                | and nb_producers in lockfree pipeline   |
488    +---+--------------+----------------+-----------------------------------------+
489    | 2 | nb_producers | >= 1           | Producers will be configured based on   |
490    |   |              |                | the number of detected ethernet devices.|
491    |   |              |                | Each ethdev will be configured as an Rx |
492    |   |              |                | adapter.                                |
493    +---+--------------+----------------+-----------------------------------------+
494    | 3 | nb_workers   | >= 1           | Selected through --wlcores command line |
495    |   |              |                | argument                                |
496    +---+--------------+----------------+-----------------------------------------+
497    | 4 | nb_ports     | nb_workers +   | Workers use port 0 to port n.           |
498    |   |              | nb_producers   | Producers use port n+1 to port n+m,     |
499    |   |              |                | depending on the Rx adapter capability. |
500    +---+--------------+----------------+-----------------------------------------+
501
502 .. _figure_eventdev_pipeline_queue_test_generic:
503
504 .. figure:: img/eventdev_pipeline_queue_test_generic.*
505
506 .. _figure_eventdev_pipeline_queue_test_lockfree:
507
508 .. figure:: img/eventdev_pipeline_queue_test_lockfree.*
509
510    pipeline queue test operation.
511
512 The pipeline queue test configures the eventdev with Q queues and P ports,
513 where Q and P is a function of the number of workers, the number of producers
514 and number of stages as mentioned in :numref:`table_eventdev_pipeline_queue_test`.
515
516 The user can choose the number of workers and number of stages through the
517 ``--wlcores`` and the ``--stlist`` application command line arguments
518 respectively.
519
520 The number of producers depends on the number of ethernet devices detected and
521 each ethernet device is configured as a event_eth_rx_adapter that acts as a
522 producer.
523
524 The producer(s) injects the events to eventdev based the first stage sched type
525 list requested by the user through ``--stlist`` the command line argument.
526
527 Based on the number of stages to process(selected through ``--stlist``),
528 The application forwards the event to next upstream queue and when it reaches
529 the last stage in the pipeline if the event type is ``atomic`` it is enqueued
530 onto ethdev Tx queue else to maintain ordering the event type is set to
531 ``atomic`` and enqueued onto the last stage queue.
532
533 If the ethernet has ``DEV_TX_OFFLOAD_MT_LOCKFREE`` capability then the worker
534 cores transmit the packets directly. Else the worker cores enqueue the packet
535 onto the ``SINGLE_LINK_QUEUE`` that is managed by a Tx service. The Tx service
536 dequeues the packet and transmits it.
537
538 On packet Tx, application increments the number events processed and print
539 periodically in one second to get the number of events processed in one
540 second.
541
542
543 Application options
544 ^^^^^^^^^^^^^^^^^^^
545
546 Supported application command line options are following::
547
548         --verbose
549         --dev
550         --test
551         --socket_id
552         --pool_sz
553         --wlcores
554         --stlist
555         --worker_deq_depth
556         --prod_type_ethdev
557
558
559 .. Note::
560
561     * The ``--prod_type_ethdev`` is mandatory for running this test.
562
563 Example
564 ^^^^^^^
565
566 Example command to run pipeline queue test:
567
568 .. code-block:: console
569
570     sudo build/app/dpdk-test-eventdev -c 0xf -s 0x8 --vdev=event_sw0 -- \
571         --test=pipeline_queue --wlcore=1 --prod_type_ethdev --stlist=a
572
573
574 PIPELINE_ATQ Test
575 ~~~~~~~~~~~~~~~~~~~
576
577 This is a pipeline test case that aims at testing the following with
578 ``all types queue`` eventdev scheme.
579
580 #. Measure the end-to-end performance of an event dev with a ethernet dev.
581 #. Maintain packet ordering from Rx to Tx.
582
583 .. _table_eventdev_pipeline_atq_test:
584
585 .. table:: Pipeline atq test eventdev configuration.
586
587    +---+--------------+----------------+-----------------------------------------+
588    | # | Items        | Value          | Comments                                |
589    |   |              |                |                                         |
590    +===+==============+================+=========================================+
591    | 1 | nb_queues    | nb_producers + | Queues will be configured based on the  |
592    |   |              | x              | user requested sched type list(--stlist)|
593    |   |              |                | where x = 1 in generic pipeline and 0   |
594    |   |              |                | in lockfree pipeline                    |
595    +---+--------------+----------------+-----------------------------------------+
596    | 2 | nb_producers | >= 1           | Producers will be configured based on   |
597    |   |              |                | the number of detected ethernet devices.|
598    |   |              |                | Each ethdev will be configured as an Rx |
599    |   |              |                | adapter.                                |
600    +---+--------------+----------------+-----------------------------------------+
601    | 3 | nb_workers   | >= 1           | Selected through --wlcores command line |
602    |   |              |                | argument                                |
603    +---+--------------+----------------+-----------------------------------------+
604    | 4 | nb_ports     | nb_workers +   | Workers use port 0 to port n.           |
605    |   |              | nb_producers   | Producers use port n+1 to port n+m,     |
606    |   |              |                | depending on the Rx adapter capability. |
607    +---+--------------+----------------+-----------------------------------------+
608
609 .. _figure_eventdev_pipeline_atq_test_generic:
610
611 .. figure:: img/eventdev_pipeline_atq_test_generic.*
612
613 .. _figure_eventdev_pipeline_atq_test_lockfree:
614
615 .. figure:: img/eventdev_pipeline_atq_test_lockfree.*
616
617    pipeline atq test operation.
618
619 The pipeline atq test configures the eventdev with Q queues and P ports,
620 where Q and P is a function of the number of workers, the number of producers
621 and number of stages as mentioned in :numref:`table_eventdev_pipeline_atq_test`.
622
623 The atq queue test functions as same as ``pipeline_queue`` test. The difference
624 is, It uses, ``all type queue scheme`` instead of separate queues for each
625 stage and thus reduces the number of queues required to realize the use case.
626
627
628 Application options
629 ^^^^^^^^^^^^^^^^^^^
630
631 Supported application command line options are following::
632
633         --verbose
634         --dev
635         --test
636         --socket_id
637         --pool_sz
638         --wlcores
639         --stlist
640         --worker_deq_depth
641         --prod_type_ethdev
642
643
644 .. Note::
645
646     * The ``--prod_type_ethdev`` is mandatory for running this test.
647
648 Example
649 ^^^^^^^
650
651 Example command to run pipeline queue test:
652
653 .. code-block:: console
654
655     sudo build/app/dpdk-test-eventdev -c 0xf -s 0x8 --vdev=event_sw0 -- \
656         --test=pipeline_atq --wlcore=1 --prod_type_ethdev --stlist=a