xref: /dpdk/doc/guides/testpmd_app_ug/run_app.rst (revision daa02b5cddbb8e11b31d41e2bf7bb1ae64dcae2f)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2010-2014 Intel Corporation.
3
4Running the Application
5=======================
6
7EAL Command-line Options
8------------------------
9
10Please refer to :doc:`EAL parameters (Linux) <../linux_gsg/linux_eal_parameters>`
11or :doc:`EAL parameters (FreeBSD) <../freebsd_gsg/freebsd_eal_parameters>` for
12a list of available EAL command-line options.
13
14
15Testpmd Command-line Options
16----------------------------
17
18The following are the command-line options for the testpmd applications.
19They must be separated from the EAL options, shown in the previous section, with a ``--`` separator:
20
21.. code-block:: console
22
23    sudo ./dpdk-testpmd -l 0-3 -n 4 -- -i --portmask=0x1 --nb-cores=2
24
25The command line options are:
26
27*   ``-i, --interactive``
28
29    Run testpmd in interactive mode.
30    In this mode, the testpmd starts with a prompt that can be used to start and stop forwarding,
31    configure the application and display stats on the current packet processing session.
32    See :ref:`testpmd_runtime` for more details.
33
34    In non-interactive mode,
35    the application starts with the configuration specified on the command-line and
36    immediately enters forwarding mode.
37
38*   ``-h, --help``
39
40    Display a help message and quit.
41
42*   ``-a, --auto-start``
43
44    Start forwarding on initialization.
45
46*   ``--tx-first``
47
48    Start forwarding, after sending a burst of packets first.
49
50.. Note::
51
52   This flag should be only used in non-interactive mode.
53
54*   ``--stats-period PERIOD``
55
56    Display statistics every PERIOD seconds, if interactive mode is disabled.
57    The default value is 0, which means that the statistics will not be displayed.
58
59*   ``--display-xstats xstat_name1[,...]``
60
61    Display comma-separated list of extended statistics every PERIOD seconds
62    as specified in ``--stats-period`` or when used with interactive commands
63    that show Rx/Tx statistics (i.e. 'show port stats').
64
65*   ``--nb-cores=N``
66
67    Set the number of forwarding cores,
68    where 1 <= N <= "number of cores" or ``RTE_MAX_LCORE`` from the configuration file.
69    The default value is 1.
70
71*   ``--nb-ports=N``
72
73    Set the number of forwarding ports,
74    where 1 <= N <= "number of ports" on the board or ``RTE_MAX_ETHPORTS`` from the configuration file.
75    The default value is the number of ports on the board.
76
77*   ``--coremask=0xXX``
78
79    Set the hexadecimal bitmask of the cores running the packet forwarding test.
80    The main lcore is reserved for command line parsing only and cannot be masked on for packet forwarding.
81
82*   ``--portmask=0xXX``
83
84    Set the hexadecimal bitmask of the ports used by the packet forwarding test.
85
86*   ``--portlist=X``
87
88      Set the forwarding ports based on the user input used by the packet forwarding test.
89      '-' denotes a range of ports to set including the two specified port IDs
90      ',' separates multiple port values.
91      Possible examples like --portlist=0,1 or --portlist=0-2 or --portlist=0,1-2 etc
92
93*   ``--numa``
94
95    Enable NUMA-aware allocation of RX/TX rings and of RX memory buffers
96    (mbufs). [Default setting]
97
98*   ``--no-numa``
99
100    Disable NUMA-aware allocation of RX/TX rings and of RX memory buffers (mbufs).
101
102*   ``--port-numa-config=(port,socket)[,(port,socket)]``
103
104    Specify the socket on which the memory pool to be used by the port will be allocated.
105
106*   ``--ring-numa-config=(port,flag,socket)[,(port,flag,socket)]``
107
108    Specify the socket on which the TX/RX rings for the port will be allocated.
109    Where flag is 1 for RX, 2 for TX, and 3 for RX and TX.
110
111*   ``--socket-num=N``
112
113    Set the socket from which all memory is allocated in NUMA mode,
114    where 0 <= N < number of sockets on the board.
115
116*   ``--mbuf-size=N[,N1[,...Nn]``
117
118    Set the data size of the mbufs used to N bytes, where N < 65536.
119    The default value is 2048. If multiple mbuf-size values are specified the
120    extra memory pools will be created for allocating mbufs to receive packets
121    with buffer splitting features.
122
123*   ``--total-num-mbufs=N``
124
125    Set the number of mbufs to be allocated in the mbuf pools, where N > 1024.
126
127*   ``--max-pkt-len=N``
128
129    Set the maximum packet size to N bytes, where N >= 64. The default value is 1518.
130
131*   ``--max-lro-pkt-size=N``
132
133    Set the maximum LRO aggregated packet size to N bytes, where N >= 64.
134
135*   ``--eth-peers-configfile=name``
136
137    Use a configuration file containing the Ethernet addresses of the peer ports.
138    The configuration file should contain the Ethernet addresses on separate lines::
139
140       XX:XX:XX:XX:XX:01
141       XX:XX:XX:XX:XX:02
142       ...
143
144*   ``--eth-peer=N,XX:XX:XX:XX:XX:XX``
145
146    Set the MAC address ``XX:XX:XX:XX:XX:XX`` of the peer port N,
147    where 0 <= N < ``RTE_MAX_ETHPORTS``.
148
149*   ``--tx-ip=SRC,DST``
150
151    Set the source and destination IP address used when doing transmit only test.
152    The defaults address values are source 198.18.0.1 and
153    destination 198.18.0.2. These are special purpose addresses
154    reserved for benchmarking (RFC 5735).
155
156*   ``--tx-udp=SRC[,DST]``
157
158    Set the source and destination UDP port number for transmit test only test.
159    The default port is the port 9 which is defined for the discard protocol
160    (RFC 863).
161
162*   ``--pkt-filter-mode=mode``
163
164    Set Flow Director mode where mode is either ``none`` (the default), ``signature`` or ``perfect``.
165    See :ref:`testpmd_flow_director` for more details.
166
167*   ``--pkt-filter-report-hash=mode``
168
169    Set Flow Director hash match reporting mode where mode is ``none``, ``match`` (the default) or ``always``.
170
171*   ``--pkt-filter-size=N``
172
173    Set Flow Director allocated memory size, where N is 64K, 128K or 256K.
174    Sizes are in kilobytes. The default is 64.
175
176*   ``--pkt-filter-flexbytes-offset=N``
177
178    Set the flexbytes offset.
179    The offset is defined in words (not bytes) counted from the first byte of the destination Ethernet MAC address,
180    where N is 0 <= N <= 32.
181    The default value is 0x6.
182
183*   ``--pkt-filter-drop-queue=N``
184
185    Set the drop-queue.
186    In perfect filter mode, when a rule is added with queue = -1, the packet will be enqueued into the RX drop-queue.
187    If the drop-queue does not exist, the packet is dropped. The default value is N=127.
188
189*   ``--disable-crc-strip``
190
191    Disable hardware CRC stripping.
192
193*   ``--enable-lro``
194
195    Enable large receive offload.
196
197*   ``--enable-rx-cksum``
198
199    Enable hardware RX checksum offload.
200
201*   ``--enable-scatter``
202
203    Enable scatter (multi-segment) RX.
204
205*   ``--enable-hw-vlan``
206
207    Enable hardware VLAN.
208
209*   ``--enable-hw-vlan-filter``
210
211    Enable hardware VLAN filter.
212
213*   ``--enable-hw-vlan-strip``
214
215    Enable hardware VLAN strip.
216
217*   ``--enable-hw-vlan-extend``
218
219    Enable hardware VLAN extend.
220
221*   ``--enable-hw-qinq-strip``
222
223    Enable hardware QINQ strip.
224
225*   ``--enable-drop-en``
226
227    Enable per-queue packet drop for packets with no descriptors.
228
229*   ``--disable-rss``
230
231    Disable RSS (Receive Side Scaling).
232
233*   ``--port-topology=mode``
234
235    Set port topology, where mode is ``paired`` (the default), ``chained`` or ``loop``.
236
237    In ``paired`` mode, the forwarding is between pairs of ports, for example: (0,1), (2,3), (4,5).
238
239    In ``chained`` mode, the forwarding is to the next available port in the port mask, for example: (0,1), (1,2), (2,0).
240
241    The ordering of the ports can be changed using the portlist testpmd runtime function.
242
243    In ``loop`` mode, ingress traffic is simply transmitted back on the same interface.
244
245*   ``--forward-mode=mode``
246
247    Set the forwarding mode where ``mode`` is one of the following::
248
249       io (the default)
250       mac
251       macswap
252       flowgen
253       rxonly
254       txonly
255       csum
256       icmpecho
257       ieee1588
258       tm
259       noisy
260       5tswap
261       shared-rxq
262
263*   ``--rss-ip``
264
265    Set RSS functions for IPv4/IPv6 only.
266
267*   ``--rss-udp``
268
269    Set RSS functions for IPv4/IPv6 and UDP.
270
271*   ``--rxq=N``
272
273    Set the number of RX queues per port to N, where 1 <= N <= 65535.
274    The default value is 1.
275
276*   ``--rxd=N``
277
278    Set the number of descriptors in the RX rings to N, where N > 0.
279    The default value is 128.
280
281*   ``--txq=N``
282
283    Set the number of TX queues per port to N, where 1 <= N <= 65535.
284    The default value is 1.
285
286*   ``--txd=N``
287
288    Set the number of descriptors in the TX rings to N, where N > 0.
289    The default value is 512.
290
291*   ``--hairpinq=N``
292
293    Set the number of hairpin queues per port to N, where 1 <= N <= 65535.
294    The default value is 0. The number of hairpin queues are added to the
295    number of TX queues and to the number of RX queues. then the first
296    RX hairpin is binded to the first TX hairpin, the second RX hairpin is
297    binded to the second TX hairpin and so on. The index of the first
298    RX hairpin queue is the number of RX queues as configured using --rxq.
299    The index of the first TX hairpin queue is the number of TX queues
300    as configured using --txq.
301
302*   ``--burst=N``
303
304    Set the number of packets per burst to N, where 1 <= N <= 512.
305    The default value is 32.
306    If set to 0, driver default is used if defined. Else, if driver
307    default is not defined, default of 32 is used.
308
309*   ``--flowgen-clones=N``
310
311    Set the number of each packet clones to be sent in `flowgen` mode.
312    Sending clones reduces host CPU load on creating packets and may help
313    in testing extreme speeds or maxing out Tx packet performance.
314    N should be not zero, but less than 'burst' parameter.
315
316*   ``--flowgen-flows=N``
317
318    Set the number of flows to be generated in `flowgen` mode, where
319    1 <= N <= INT32_MAX.
320
321*   ``--mbcache=N``
322
323    Set the cache of mbuf memory pools to N, where 0 <= N <= 512.
324    The default value is 16.
325
326*   ``--rxpt=N``
327
328    Set the prefetch threshold register of RX rings to N, where N >= 0.
329    The default value is 8.
330
331*   ``--rxht=N``
332
333    Set the host threshold register of RX rings to N, where N >= 0.
334    The default value is 8.
335
336*   ``--rxfreet=N``
337
338    Set the free threshold of RX descriptors to N, where 0 <= N < value of --rxd.
339    The default value is 0.
340
341*   ``--rxwt=N``
342
343    Set the write-back threshold register of RX rings to N, where N >= 0.
344    The default value is 4.
345
346*   ``--txpt=N``
347
348    Set the prefetch threshold register of TX rings to N, where N >= 0.
349    The default value is 36.
350
351*   ``--txht=N``
352
353    Set the host threshold register of TX rings to N, where N >= 0.
354    The default value is 0.
355
356*   ``--txwt=N``
357
358    Set the write-back threshold register of TX rings to N, where N >= 0.
359    The default value is 0.
360
361*   ``--txfreet=N``
362
363    Set the transmit free threshold of TX rings to N, where 0 <= N <= value of ``--txd``.
364    The default value is 0.
365
366*   ``--txrst=N``
367
368    Set the transmit RS bit threshold of TX rings to N, where 0 <= N <= value of ``--txd``.
369    The default value is 0.
370
371*   ``--no-flush-rx``
372
373    Don't flush the RX streams before starting forwarding. Used mainly with the PCAP PMD.
374
375*   ``--rxoffs=X[,Y]``
376
377    Set the offsets of packet segments on receiving if split
378    feature is engaged. Affects only the queues configured
379    with split offloads (currently BUFFER_SPLIT is supported only).
380
381*   ``--rxpkts=X[,Y]``
382
383    Set the length of segments to scatter packets on receiving if split
384    feature is engaged. Affects only the queues configured
385    with split offloads (currently BUFFER_SPLIT is supported only).
386    Optionally the multiple memory pools can be specified with --mbuf-size
387    command line parameter and the mbufs to receive will be allocated
388    sequentially from these extra memory pools.
389
390*   ``--txpkts=X[,Y]``
391
392    Set TX segment sizes or total packet length. Valid for ``tx-only``
393    and ``flowgen`` forwarding modes.
394
395*   ``--txonly-multi-flow``
396
397    Generate multiple flows in txonly mode.
398
399*   ``--rxq-share=[X]``
400
401    Create queues in shared Rx queue mode if device supports.
402    Shared Rx queues are grouped per X ports. X defaults to UINT32_MAX,
403    implies all ports join share group 1. Forwarding engine "shared-rxq"
404    should be used for shared Rx queues. This engine does Rx only and
405    update stream statistics accordingly.
406
407*   ``--eth-link-speed``
408
409    Set a forced link speed to the ethernet port::
410
411       10 - 10Mbps (not supported)
412       100 - 100Mbps (not supported)
413       1000 - 1Gbps
414       10000 - 10Gbps
415       25000 - 25Gbps
416       40000 - 40Gbps
417       50000 - 50Gbps
418       100000 - 100Gbps
419       200000 - 200Gbps
420       ...
421
422*   ``--disable-link-check``
423
424    Disable check on link status when starting/stopping ports.
425
426*   ``--disable-device-start``
427
428    Do not automatically start all ports. This allows testing
429    configuration of rx and tx queues before device is started
430    for the first time.
431
432*   ``--no-lsc-interrupt``
433
434    Disable LSC interrupts for all ports, even those supporting it.
435
436*   ``--no-rmv-interrupt``
437
438    Disable RMV interrupts for all ports, even those supporting it.
439
440*   ``--bitrate-stats=N``
441
442    Set the logical core N to perform bitrate calculation.
443
444*   ``--print-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|dev_probed|dev_released|flow_aged|all>``
445
446    Enable printing the occurrence of the designated event. Using all will
447    enable all of them.
448
449*   ``--mask-event <unknown|intr_lsc|queue_state|intr_reset|vf_mbox|macsec|intr_rmv|dev_probed|dev_released|flow_aged|all>``
450
451    Disable printing the occurrence of the designated event. Using all will
452    disable all of them.
453
454*   ``--flow-isolate-all``
455
456    Providing this parameter requests flow API isolated mode on all ports at
457    initialization time. It ensures all traffic is received through the
458    configured flow rules only (see flow command).
459
460    Ports that do not support this mode are automatically discarded.
461
462*   ``--tx-offloads=0xXXXXXXXX``
463
464    Set the hexadecimal bitmask of TX queue offloads.
465    The default value is 0.
466
467*   ``--rx-offloads=0xXXXXXXXX``
468
469    Set the hexadecimal bitmask of RX queue offloads.
470    The default value is 0.
471
472*   ``--hot-plug``
473
474    Enable device event monitor mechanism for hotplug.
475
476*   ``--vxlan-gpe-port=N``
477
478    Set the UDP port number of tunnel VXLAN-GPE to N.
479    The default value is 4790.
480
481*   ``--geneve-parsed-port=N``
482
483    Set the UDP port number that is used for parsing the GENEVE protocol to N.
484    HW may be configured with another tunnel Geneve port.
485    The default value is 6081.
486
487*   ``--mlockall``
488
489    Enable locking all memory.
490
491*   ``--no-mlockall``
492
493    Disable locking all memory.
494
495*   ``--mp-alloc <native|anon|xmem|xmemhuge>``
496
497    Select mempool allocation mode:
498
499    * native: create and populate mempool using native DPDK memory
500    * anon: create mempool using native DPDK memory, but populate using
501      anonymous memory
502    * xmem: create and populate mempool using externally and anonymously
503      allocated area
504    * xmemhuge: create and populate mempool using externally and anonymously
505      allocated hugepage area
506
507*   ``--noisy-tx-sw-buffer-size``
508
509    Set the number of maximum elements  of the FIFO queue to be created
510    for buffering packets. Only available with the noisy forwarding mode.
511    The default value is 0.
512
513*   ``--noisy-tx-sw-buffer-flushtime=N``
514
515    Set the time before packets in the FIFO queue is flushed.
516    Only available with the noisy forwarding mode. The default value is 0.
517
518*   ``--noisy-lkup-memory=N``
519
520    Set the size of the noisy neighbor simulation memory buffer in MB to N.
521    Only available with the noisy forwarding mode. The default value is 0.
522
523
524*   ``--noisy-lkup-num-reads=N``
525
526    Set the number of reads to be done in noisy neighbor simulation memory buffer to N.
527    Only available with the noisy forwarding mode. The default value is 0.
528
529*   ``--noisy-lkup-num-writes=N``
530
531    Set the number of writes to be done in noisy neighbor simulation memory buffer to N.
532    Only available with the noisy forwarding mode. The default value is 0.
533
534*   ``--noisy-lkup-num-reads-writes=N``
535
536    Set the number of r/w accesses to be done in noisy neighbor simulation memory buffer to N.
537    Only available with the noisy forwarding mode. The default value is 0.
538
539*   ``--no-iova-contig``
540
541    Enable to create mempool which is not IOVA contiguous. Valid only with --mp-alloc=anon.
542    The default value is 0.
543
544*   ``--rx-mq-mode``
545
546    Set the hexadecimal bitmask of RX multi queue mode which can be enabled.
547    The default value is 0x7::
548
549       RTE_ETH_MQ_RX_RSS_FLAG | RTE_ETH_MQ_RX_DCB_FLAG | RTE_ETH_MQ_RX_VMDQ_FLAG
550
551*   ``--record-core-cycles``
552
553    Enable measurement of CPU cycles per packet.
554
555*   ``--record-burst-stats``
556
557    Enable display of RX and TX burst stats.
558
559*   ``--hairpin-mode=0xXX``
560
561    Set the hairpin port mode with bitmask, only valid when hairpin queues number is set::
562
563	bit 4 - explicit Tx flow rule
564	bit 1 - two hairpin ports paired
565	bit 0 - two hairpin ports loop
566
567    The default value is 0. Hairpin will use single port mode and implicit Tx flow mode.
568
569
570Testpmd Multi-Process Command-line Options
571~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
572
573The following are the command-line options for testpmd multi-process support:
574
575*   primary process:
576
577.. code-block:: console
578
579    sudo ./dpdk-testpmd -a xxx --proc-type=auto -l 0-1 -- -i --rxq=4 --txq=4 \
580        --num-procs=2 --proc-id=0
581
582*   secondary process:
583
584.. code-block:: console
585
586    sudo ./dpdk-testpmd -a xxx --proc-type=auto -l 2-3 -- -i --rxq=4 --txq=4 \
587        --num-procs=2 --proc-id=1
588
589The command line options are:
590
591*   ``--num-procs=N``
592
593    The number of processes which will be used.
594
595*   ``--proc-id=ID``
596
597    The ID of the current process (ID < num-procs). ID should be different in
598    primary process and secondary process, which starts from '0'.
599
600Calculation rule for queue:
601All queues are allocated to different processes based on ``proc_num`` and
602``proc_id``.
603Calculation rule for the testpmd to allocate queues to each process:
604*   start(queue start id) = proc_id * nb_q / num_procs;
605
606*   end(queue end id) = start + nb_q / num_procs;
607
608For example, if testpmd is configured to have 4 Tx and Rx queues,
609queues 0 and 1 will be used by the primary process and
610queues 2 and 3 will be used by the secondary process.
611
612The number of queues should be a multiple of the number of processes. If not,
613redundant queues will exist after queues are allocated to processes. If RSS
614is enabled, packet loss occurs when traffic is sent to all processes at the same
615time. Some traffic goes to redundant queues and cannot be forwarded.
616
617All the dev ops is supported in primary process. While secondary process is
618not permitted to allocate or release shared memory, so some ops are not supported
619as follows:
620
621- ``dev_configure``
622- ``dev_start``
623- ``dev_stop``
624- ``rx_queue_setup``
625- ``tx_queue_setup``
626- ``rx_queue_release``
627- ``tx_queue_release``
628
629So, any command from testpmd which calls those APIs will not be supported in
630secondary process, like:
631
632.. code-block:: console
633
634    port config all rxq|txq|rxd|txd <value>
635    port config <port_id> rx_offload xxx on/off
636    port config <port_id> tx_offload xxx on/off
637
638etc.
639
640When secondary is running, port in primary is not permitted to be stopped.
641Reconfigure operation is only valid in primary.
642
643Stats is supported, stats will not change when one quits and starts, as they
644share the same buffer to store the stats. Flow rules are maintained in process
645level: primary and secondary has its own flow list (but one flow list in HW).
646The two can see all the queues, so setting the flow rules for the other is OK.
647But in the testpmd primary process receiving or transmitting packets from the
648queue allocated for secondary process is not permitted, and same for secondary
649process.
650
651Flow API and RSS are supported.
652