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