xref: /dpdk/doc/guides/testpmd_app_ug/testpmd_funcs.rst (revision 738ef8f7c706c124715699f76b6de1168a64534a)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2010-2016 Intel Corporation.
3
4.. _testpmd_runtime:
5
6Testpmd Runtime Functions
7=========================
8
9Where the testpmd application is started in interactive mode, (``-i|--interactive``),
10it displays a prompt that can be used to start and stop forwarding,
11configure the application, display statistics (including the extended NIC
12statistics aka xstats) , set the Flow Director and other tasks::
13
14   testpmd>
15
16The testpmd prompt has some, limited, readline support.
17Common bash command-line functions such as ``Ctrl+a`` and ``Ctrl+e`` to go to the start and end of the prompt line are supported
18as well as access to the command history via the up-arrow.
19
20There is also support for tab completion.
21If you type a partial command and hit ``<TAB>`` you get a list of the available completions:
22
23.. code-block:: console
24
25   testpmd> show port <TAB>
26
27       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap X
28       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all
29       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap X
30       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all
31       ...
32
33
34.. note::
35
36   Some examples in this document are too long to fit on one line are shown wrapped at `"\\"` for display purposes::
37
38      testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
39               (pause_time) (send_xon) (port_id)
40
41In the real ``testpmd>`` prompt these commands should be on a single line.
42
43Help Functions
44--------------
45
46The testpmd has on-line help for the functions that are available at runtime.
47These are divided into sections and can be accessed using help, help section or help all:
48
49.. code-block:: console
50
51   testpmd> help
52       Help is available for the following sections:
53
54           help control                    : Start and stop forwarding.
55           help display                    : Displaying port, stats and config information.
56           help config                     : Configuration information.
57           help ports                      : Configuring ports.
58           help filters                    : Filters configuration help.
59           help traffic_management         : Traffic Management commands.
60           help devices                    : Device related commands.
61           help drivers                    : Driver specific commands.
62           help all                        : All of the above sections.
63
64Command File Functions
65----------------------
66
67To facilitate loading large number of commands or to avoid cutting and pasting where not
68practical or possible testpmd supports alternative methods for executing commands.
69
70* If started with the ``--cmdline-file=FILENAME`` command line argument testpmd
71  will execute all CLI commands contained within the file immediately before
72  starting packet forwarding or entering interactive mode.
73
74.. code-block:: console
75
76   ./dpdk-testpmd -n4 -r2 ... -- -i --cmdline-file=/home/ubuntu/flow-create-commands.txt
77   Interactive-mode selected
78   CLI commands to be read from /home/ubuntu/flow-create-commands.txt
79   Configuring Port 0 (socket 0)
80   Port 0: 7C:FE:90:CB:74:CE
81   Configuring Port 1 (socket 0)
82   Port 1: 7C:FE:90:CB:74:CA
83   Checking link statuses...
84   Port 0 Link Up - speed 10000 Mbps - full-duplex
85   Port 1 Link Up - speed 10000 Mbps - full-duplex
86   Done
87   Flow rule #0 created
88   Flow rule #1 created
89   ...
90   ...
91   Flow rule #498 created
92   Flow rule #499 created
93   Read all CLI commands from /home/ubuntu/flow-create-commands.txt
94   testpmd>
95
96
97* At run-time additional commands can be loaded in bulk by invoking the ``load FILENAME``
98  command.
99
100.. code-block:: console
101
102   testpmd> load /home/ubuntu/flow-create-commands.txt
103   Flow rule #0 created
104   Flow rule #1 created
105   ...
106   ...
107   Flow rule #498 created
108   Flow rule #499 created
109   Read all CLI commands from /home/ubuntu/flow-create-commands.txt
110   testpmd>
111
112
113In all cases output from any included command will be displayed as standard output.
114Execution will continue until the end of the file is reached regardless of
115whether any errors occur.  The end user must examine the output to determine if
116any failures occurred.
117
118
119Control Functions
120-----------------
121
122start
123~~~~~
124
125Start packet forwarding with current configuration::
126
127   testpmd> start
128
129start tx_first
130~~~~~~~~~~~~~~
131
132Start packet forwarding with current configuration after sending specified number of bursts of packets::
133
134   testpmd> start tx_first (""|burst_num)
135
136The default burst number is 1 when ``burst_num`` not presented.
137
138stop
139~~~~
140
141Stop packet forwarding, and display accumulated statistics::
142
143   testpmd> stop
144
145quit
146~~~~
147
148Quit to prompt::
149
150   testpmd> quit
151
152
153Display Functions
154-----------------
155
156The functions in the following sections are used to display information about the
157testpmd configuration or the NIC status.
158
159show port
160~~~~~~~~~
161
162Display information for a given port or all ports::
163
164   testpmd> show port (info|summary|stats|xstats|fdir|dcb_tc|cap) (port_id|all)
165
166The available information categories are:
167
168* ``info``: General port information such as MAC address.
169
170* ``summary``: Brief port summary such as Device Name, Driver Name etc.
171
172* ``stats``: RX/TX statistics.
173
174* ``xstats``: RX/TX extended NIC statistics.
175
176* ``fdir``: Flow Director information and statistics.
177
178* ``dcb_tc``: DCB information such as TC mapping.
179
180For example:
181
182.. code-block:: console
183
184   testpmd> show port info 0
185
186   ********************* Infos for port 0 *********************
187
188   MAC address: XX:XX:XX:XX:XX:XX
189   Connect to socket: 0
190   memory allocation on the socket: 0
191   Link status: up
192   Link speed: 40000 Mbps
193   Link duplex: full-duplex
194   Promiscuous mode: enabled
195   Allmulticast mode: disabled
196   Maximum number of MAC addresses: 64
197   Maximum number of MAC addresses of hash filtering: 0
198   VLAN offload:
199       strip on, filter on, extend off, qinq strip off
200   Redirection table size: 512
201   Supported flow types:
202     ipv4-frag
203     ipv4-tcp
204     ipv4-udp
205     ipv4-sctp
206     ipv4-other
207     ipv6-frag
208     ipv6-tcp
209     ipv6-udp
210     ipv6-sctp
211     ipv6-other
212     l2_payload
213     port
214     vxlan
215     geneve
216     nvgre
217     vxlan-gpe
218
219show port (module_eeprom|eeprom)
220~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
221
222Display the EEPROM information of a port::
223
224   testpmd> show port (port_id) (module_eeprom|eeprom)
225
226show port rss reta
227~~~~~~~~~~~~~~~~~~
228
229Display the rss redirection table entry indicated by masks on port X::
230
231   testpmd> show port (port_id) rss reta (size) (mask0, mask1...)
232
233size is used to indicate the hardware supported reta size
234
235show port rss-hash
236~~~~~~~~~~~~~~~~~~
237
238Display the RSS hash functions and RSS hash key or RSS hash algorithm of a port::
239
240   testpmd> show port (port_id) rss-hash [key | algorithm]
241
242clear port
243~~~~~~~~~~
244
245Clear the port statistics and forward engine statistics for a given port or for all ports::
246
247   testpmd> clear port (info|stats|xstats|fdir) (port_id|all)
248
249For example::
250
251   testpmd> clear port stats all
252
253show (rxq|txq)
254~~~~~~~~~~~~~~
255
256Display information for a given port's RX/TX queue::
257
258   testpmd> show (rxq|txq) info (port_id) (queue_id)
259
260show desc status(rxq|txq)
261~~~~~~~~~~~~~~~~~~~~~~~~~
262
263Display information for a given port's RX/TX descriptor status::
264
265   testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status
266
267show rxq desc used count
268~~~~~~~~~~~~~~~~~~~~~~~~
269
270Display the number of receive packet descriptors currently filled by hardware
271and ready to be processed by the driver on a given RX queue::
272
273   testpmd> show port (port_id) rxq (queue_id) desc used count
274
275show config
276~~~~~~~~~~~
277
278Displays the configuration of the application.
279The configuration comes from the command-line, the runtime or the application defaults::
280
281   testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|rxhdrs|txpkts|txtimes)
282
283The available information categories are:
284
285* ``rxtx``: RX/TX configuration items.
286
287* ``cores``: List of forwarding cores.
288
289* ``fwd``: Packet forwarding configuration.
290
291* ``rxoffs``: Packet offsets for RX split.
292
293* ``rxpkts``: Packets to RX length-based split configuration.
294
295* ``rxhdrs``: Packets to RX proto-based split configuration.
296
297* ``txpkts``: Packets to TX configuration.
298
299* ``txtimes``: Burst time pattern for Tx only mode.
300
301For example:
302
303.. code-block:: console
304
305   testpmd> show config rxtx
306
307   io packet forwarding - CRC stripping disabled - packets/burst=16
308   nb forwarding cores=2 - nb forwarding ports=1
309   RX queues=1 - RX desc=128 - RX free threshold=0
310   RX threshold registers: pthresh=8 hthresh=8 wthresh=4
311   TX queues=1 - TX desc=512 - TX free threshold=0
312   TX threshold registers: pthresh=36 hthresh=0 wthresh=0
313   TX RS bit threshold=0 - TXQ flags=0x0
314
315set fwd
316~~~~~~~
317
318Set the packet forwarding mode::
319
320   testpmd> set fwd (io|mac|macswap|flowgen| \
321                     rxonly|txonly|csum|icmpecho|noisy|5tswap|shared-rxq|recycle_mbufs) (""|retry)
322
323``retry`` can be specified for forwarding engines except ``rx_only``.
324
325The available information categories are:
326
327* ``io``: Forwards packets "as-is" in I/O mode.
328  This is the fastest possible forwarding operation as it does not access packets data.
329  This is the default mode.
330
331* ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them.
332  Default application behavior is to set source Ethernet address to that of the transmitting interface, and destination
333  address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or
334  'eth-peers-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address.
335
336* ``macswap``: MAC swap forwarding mode.
337  Swaps the source and the destination Ethernet addresses of packets before forwarding them.
338
339* ``flowgen``: Multi-flow generation mode.
340  Originates a number of flows (with varying destination IP addresses), and terminate receive traffic.
341
342* ``rxonly``: Receives packets but doesn't transmit them.
343
344* ``txonly``: Generates and transmits packets without receiving any.
345
346* ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet.
347
348* ``icmpecho``: Receives a burst of packets, lookup for ICMP echo requests and, if any, send back ICMP echo replies.
349
350* ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX.
351
352* ``noisy``: Noisy neighbor simulation.
353  Simulate more realistic behavior of a guest machine engaged in receiving
354  and sending packets performing Virtual Network Function (VNF).
355
356* ``5tswap``: Swap the source and destination of L2,L3,L4 if they exist.
357
358  L2 swaps the source address and destination address of Ethernet, as same as ``macswap``.
359
360  L3 swaps the source address and destination address of IP (v4 and v6).
361
362  L4 swaps the source port and destination port of transport layer (TCP and UDP).
363
364* ``shared-rxq``: Receive only for shared Rx queue.
365  Resolve packet source port from mbuf and update stream statistics accordingly.
366
367* ``recycle_mbufs``:  Recycle Tx queue used mbufs for Rx queue mbuf ring.
368  This mode uses fast path mbuf recycle feature and forwards packets in I/O mode.
369
370Example::
371
372   testpmd> set fwd rxonly
373
374   Set rxonly packet forwarding mode
375
376
377show fwd
378~~~~~~~~
379
380When running, forwarding engines maintain statistics from the time they have been started.
381Example for the io forwarding engine, with some packet drops on the tx side::
382
383   testpmd> show fwd stats all
384
385     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
386     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
387
388     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
389     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
390
391     ---------------------- Forward statistics for port 0  ----------------------
392     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
393     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
394     ----------------------------------------------------------------------------
395
396     ---------------------- Forward statistics for port 1  ----------------------
397     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
398     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
399     ----------------------------------------------------------------------------
400
401     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
402     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
403     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
404     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
405
406
407clear fwd
408~~~~~~~~~
409
410Clear the forwarding engines statistics::
411
412   testpmd> clear fwd stats all
413
414read rxd
415~~~~~~~~
416
417Display an RX descriptor for a port RX queue::
418
419   testpmd> read rxd (port_id) (queue_id) (rxd_id)
420
421For example::
422
423   testpmd> read rxd 0 0 4
424        0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180
425
426read txd
427~~~~~~~~
428
429Display a TX descriptor for a port TX queue::
430
431   testpmd> read txd (port_id) (queue_id) (txd_id)
432
433For example::
434
435   testpmd> read txd 0 0 4
436        0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
437
438show vf stats
439~~~~~~~~~~~~~
440
441Display VF statistics::
442
443   testpmd> show vf stats (port_id) (vf_id)
444
445clear vf stats
446~~~~~~~~~~~~~~
447
448Reset VF statistics::
449
450   testpmd> clear vf stats (port_id) (vf_id)
451
452show rx offloading capabilities
453~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
454
455List all per queue and per port Rx offloading capabilities of a port::
456
457   testpmd> show port (port_id) rx_offload capabilities
458
459show rx offloading configuration
460~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
461
462List port level and all queue level Rx offloading configuration::
463
464   testpmd> show port (port_id) rx_offload configuration
465
466show tx offloading capabilities
467~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
468
469List all per queue and per port Tx offloading capabilities of a port::
470
471   testpmd> show port (port_id) tx_offload capabilities
472
473show tx offloading configuration
474~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
475
476List port level and all queue level Tx offloading configuration::
477
478   testpmd> show port (port_id) tx_offload configuration
479
480show tx metadata setting
481~~~~~~~~~~~~~~~~~~~~~~~~
482
483Show Tx metadata value set for a specific port::
484
485   testpmd> show port (port_id) tx_metadata
486
487show port supported ptypes
488~~~~~~~~~~~~~~~~~~~~~~~~~~
489
490Show ptypes supported for a specific port::
491
492   testpmd> show port (port_id) ptypes
493
494set port supported ptypes
495~~~~~~~~~~~~~~~~~~~~~~~~~
496
497set packet types classification for a specific port::
498
499   testpmd> set port (port_id) ptypes_mask (mask)
500
501show port mac addresses info
502~~~~~~~~~~~~~~~~~~~~~~~~~~~~
503
504Show mac addresses added for a specific port::
505
506   testpmd> show port (port_id) macs
507
508
509show port multicast mac addresses info
510~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
511
512Show multicast mac addresses added for a specific port::
513
514   testpmd> show port (port_id) mcast_macs
515
516show flow transfer proxy port ID for the given port
517~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
518
519Show proxy port ID to use as the 1st argument in commands to
520manage ``transfer`` flows and their indirect components.
521::
522
523   testpmd> show port (port_id) flow transfer proxy
524
525show device info
526~~~~~~~~~~~~~~~~
527
528Show general information about devices probed::
529
530   testpmd> show device info (<identifier>|all)
531
532For example:
533
534.. code-block:: console
535
536    testpmd> show device info net_pcap0
537
538    ********************* Infos for device net_pcap0 *********************
539    Bus name: vdev
540    Driver name: net_pcap
541    Devargs: iface=enP2p6s0,phy_mac=1
542    Connect to socket: -1
543
544            Port id: 2
545            MAC address: 1E:37:93:28:04:B8
546            Device name: net_pcap0
547
548dump physmem
549~~~~~~~~~~~~
550
551Dumps all physical memory segment layouts::
552
553   testpmd> dump_physmem
554
555dump memzone
556~~~~~~~~~~~~
557
558Dumps the layout of all memory zones::
559
560   testpmd> dump_memzone
561
562dump socket memory
563~~~~~~~~~~~~~~~~~~
564
565Dumps the memory usage of all sockets::
566
567   testpmd> dump_socket_mem
568
569dump struct size
570~~~~~~~~~~~~~~~~
571
572Dumps the size of all memory structures::
573
574   testpmd> dump_struct_sizes
575
576dump ring
577~~~~~~~~~
578
579Dumps the status of all or specific element in DPDK rings::
580
581   testpmd> dump_ring [ring_name]
582
583dump mempool
584~~~~~~~~~~~~
585
586Dumps the statistics of all or specific memory pool::
587
588   testpmd> dump_mempool [mempool_name]
589
590dump devargs
591~~~~~~~~~~~~
592
593Dumps the user device list::
594
595   testpmd> dump_devargs
596
597dump lcores
598~~~~~~~~~~~
599
600Dumps the logical cores list::
601
602   testpmd> dump_lcores
603
604dump trace
605~~~~~~~~~~
606
607Dumps the tracing data to the folder according to the current EAL settings::
608
609   testpmd> dump_trace
610
611dump log types
612~~~~~~~~~~~~~~
613
614Dumps the log level for all the dpdk modules::
615
616   testpmd> dump_log_types
617
618show (raw_encap|raw_decap)
619~~~~~~~~~~~~~~~~~~~~~~~~~~
620
621Display content of raw_encap/raw_decap buffers in hex::
622
623  testpmd> show <raw_encap|raw_decap> <index>
624  testpmd> show <raw_encap|raw_decap> all
625
626For example::
627
628  testpmd> show raw_encap 6
629
630  index: 6 at [0x1c565b0], len=50
631  00000000: 00 00 00 00 00 00 16 26 36 46 56 66 08 00 45 00 | .......&6FVf..E.
632  00000010: 00 00 00 00 00 00 00 11 00 00 C0 A8 01 06 C0 A8 | ................
633  00000020: 03 06 00 00 00 FA 00 00 00 00 08 00 00 00 00 00 | ................
634  00000030: 06 00                                           | ..
635
636show fec capabilities
637~~~~~~~~~~~~~~~~~~~~~
638
639Show fec capabilities of a port::
640
641  testpmd> show port (port_id) fec capabilities
642
643show fec mode
644~~~~~~~~~~~~~
645
646Show fec mode of a port::
647
648  testpmd> show port (port_id) fec_mode
649
650
651Configuration Functions
652-----------------------
653
654The testpmd application can be configured from the runtime as well as from the command-line.
655
656This section details the available configuration functions that are available.
657
658.. note::
659
660   Configuration changes only become active when forwarding is started/restarted.
661
662set default
663~~~~~~~~~~~
664
665Reset forwarding to the default configuration::
666
667   testpmd> set default
668
669set verbose
670~~~~~~~~~~~
671
672Set the debug verbosity level::
673
674   testpmd> set verbose (level)
675
676Available levels are as following:
677
678* ``0`` silent except for error.
679* ``1`` fully verbose except for Tx packets.
680* ``2`` fully verbose except for Rx packets.
681* ``> 2`` fully verbose.
682
683set log
684~~~~~~~
685
686Set the log level for a log type::
687
688	testpmd> set log global|(type) (level)
689
690Where:
691
692* ``type`` is the log name.
693
694* ``level`` is the log level.
695
696For example, to change the global log level::
697
698	testpmd> set log global (level)
699
700Regexes can also be used for type. To change log level of user1, user2 and user3::
701
702	testpmd> set log user[1-3] (level)
703
704set nbport
705~~~~~~~~~~
706
707Set the number of ports used by the application:
708
709set nbport (num)
710
711This is equivalent to the ``--nb-ports`` command-line option.
712
713set nbcore
714~~~~~~~~~~
715
716Set the number of cores used by the application::
717
718   testpmd> set nbcore (num)
719
720This is equivalent to the ``--nb-cores`` command-line option.
721
722.. note::
723
724   The number of cores used must not be greater than number of ports used multiplied by the number of queues per port.
725
726set coremask
727~~~~~~~~~~~~
728
729Set the forwarding cores hexadecimal mask::
730
731   testpmd> set coremask (mask)
732
733This is equivalent to the ``--coremask`` command-line option.
734
735.. note::
736
737   The main lcore is reserved for command line parsing only and cannot be masked on for packet forwarding.
738
739set portmask
740~~~~~~~~~~~~
741
742Set the forwarding ports hexadecimal mask::
743
744   testpmd> set portmask (mask)
745
746This is equivalent to the ``--portmask`` command-line option.
747
748set record-core-cycles
749~~~~~~~~~~~~~~~~~~~~~~
750
751Set the recording of CPU cycles::
752
753   testpmd> set record-core-cycles (on|off)
754
755Where:
756
757* ``on`` enables measurement of CPU cycles per packet.
758
759* ``off`` disables measurement of CPU cycles per packet.
760
761This is equivalent to the ``--record-core-cycles command-line`` option.
762
763set record-burst-stats
764~~~~~~~~~~~~~~~~~~~~~~
765
766Set the displaying of RX and TX bursts::
767
768   testpmd> set record-burst-stats (on|off)
769
770Where:
771
772* ``on`` enables display of RX and TX bursts.
773
774* ``off`` disables display of RX and TX bursts.
775
776This is equivalent to the ``--record-burst-stats command-line`` option.
777
778set burst
779~~~~~~~~~
780
781Set number of packets per burst::
782
783   testpmd> set burst (num)
784
785This is equivalent to the ``--burst command-line`` option.
786
787When retry is enabled, the transmit delay time and number of retries can also be set::
788
789   testpmd> set burst tx delay (microseconds) retry (num)
790
791set rxoffs
792~~~~~~~~~~
793
794Set the offsets of segments relating to the data buffer beginning on receiving
795if split feature is engaged. Affects only the queues configured with split
796offloads (currently BUFFER_SPLIT is supported only).
797
798   testpmd> set rxoffs (x[,y]*)
799
800Where x[,y]* represents a CSV list of values, without white space. If the list
801of offsets is shorter than the list of segments the zero offsets will be used
802for the remaining segments.
803
804set rxpkts
805~~~~~~~~~~
806
807Set the length of segments to scatter packets on receiving if split
808feature is engaged. Affects only the queues configured with split offloads
809(currently BUFFER_SPLIT is supported only). Optionally the multiple memory
810pools can be specified with --mbuf-size command line parameter and the mbufs
811to receive will be allocated sequentially from these extra memory pools (the
812mbuf for the first segment is allocated from the first pool, the second one
813from the second pool, and so on, if segment number is greater then pool's the
814mbuf for remaining segments will be allocated from the last valid pool).
815
816   testpmd> set rxpkts (x[,y]*)
817
818Where x[,y]* represents a CSV list of values, without white space. Zero value
819means to use the corresponding memory pool data buffer size.
820
821set rxhdrs
822~~~~~~~~~~
823
824Set the protocol headers of segments to scatter packets on receiving
825if split feature is engaged.
826Affects only the queues configured with split offloads
827(currently BUFFER_SPLIT is supported only).
828
829   testpmd> set rxhdrs (eth[,ipv4]*)
830
831Where eth[,ipv4]* represents a CSV list of values, without white space.
832If the list of offsets is shorter than the list of segments,
833zero offsets will be used for the remaining segments.
834
835set txpkts
836~~~~~~~~~~
837
838Set the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode::
839
840   testpmd> set txpkts (x[,y]*)
841
842Where x[,y]* represents a CSV list of values, without white space.
843
844set txtimes
845~~~~~~~~~~~
846
847Configure the timing burst pattern for Tx only mode. This command enables
848the packet send scheduling on dynamic timestamp mbuf field and configures
849timing pattern in Tx only mode. In this mode, if scheduling is enabled
850application provides timestamps in the packets being sent. It is possible
851to configure delay (in unspecified device clock units) between bursts
852and between the packets within the burst::
853
854   testpmd> set txtimes (inter),(intra)
855
856where:
857
858* ``inter``  is the delay between the bursts in the device clock units.
859  If ``intra`` is zero, this is the time between the beginnings of the
860  first packets in the neighbour bursts, if ``intra`` is not zero,
861  ``inter`` specifies the time between the beginning of the first packet
862  of the current burst and the beginning of the last packet of the
863  previous burst. If ``inter`` parameter is zero the send scheduling
864  on timestamps is disabled (default).
865
866* ``intra`` is the delay between the packets within the burst specified
867  in the device clock units. The number of packets in the burst is defined
868  by regular burst setting. If ``intra`` parameter is zero no timestamps
869  provided in the packets excepting the first one in the burst.
870
871As the result the bursts of packet will be transmitted with specific
872delays between the packets within the burst and specific delay between
873the bursts. The rte_eth_read_clock() must be supported by the device(s)
874and is supposed to be engaged to get the current device clock value
875and provide the reference for the timestamps. If there is no supported
876rte_eth_read_clock() there will be no send scheduling provided on the port.
877
878set txsplit
879~~~~~~~~~~~
880
881Set the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes::
882
883   testpmd> set txsplit (off|on|rand)
884
885Where:
886
887* ``off`` disable packet copy & split for CSUM mode.
888
889* ``on`` split outgoing packet into multiple segments. Size of each segment
890  and number of segments per packet is determined by ``set txpkts`` command
891  (see above).
892
893* ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments.
894
895set corelist
896~~~~~~~~~~~~
897
898Set the list of forwarding cores::
899
900   testpmd> set corelist (x[,y]*)
901
902For example, to change the forwarding cores:
903
904.. code-block:: console
905
906   testpmd> set corelist 3,1
907   testpmd> show config fwd
908
909   io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled
910   Logical Core 3 (socket 0) forwards packets on 1 streams:
911   RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
912   Logical Core 1 (socket 0) forwards packets on 1 streams:
913   RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
914
915.. note::
916
917   The cores are used in the same order as specified on the command line.
918
919set portlist
920~~~~~~~~~~~~
921
922Set the list of forwarding ports::
923
924   testpmd> set portlist (x[,y]*)
925
926For example, to change the port forwarding:
927
928.. code-block:: console
929
930   testpmd> set portlist 0,2,1,3
931   testpmd> show config fwd
932
933   io packet forwarding - ports=4 - cores=1 - streams=4
934   Logical Core 3 (socket 0) forwards packets on 4 streams:
935   RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01
936   RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
937   RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03
938   RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02
939
940set port setup on
941~~~~~~~~~~~~~~~~~
942
943Select how to retrieve new ports created after "port attach" command::
944
945   testpmd> set port setup on (iterator|event)
946
947For each new port, a setup is done.
948It will find the probed ports via RTE_ETH_FOREACH_MATCHING_DEV loop
949in iterator mode, or via RTE_ETH_EVENT_NEW in event mode.
950
951set tx loopback
952~~~~~~~~~~~~~~~
953
954Enable/disable tx loopback::
955
956   testpmd> set tx loopback (port_id) (on|off)
957
958set drop enable
959~~~~~~~~~~~~~~~
960
961set drop enable bit for all queues::
962
963   testpmd> set all queues drop (port_id) (on|off)
964
965set mac antispoof (for VF)
966~~~~~~~~~~~~~~~~~~~~~~~~~~
967
968Set mac antispoof for a VF from the PF::
969
970   testpmd> set vf mac antispoof  (port_id) (vf_id) (on|off)
971
972vlan set stripq
973~~~~~~~~~~~~~~~
974
975Set the VLAN strip for a queue on a port::
976
977   testpmd> vlan set stripq (on|off) (port_id,queue_id)
978
979vlan set stripq (for VF)
980~~~~~~~~~~~~~~~~~~~~~~~~
981
982Set VLAN strip for all queues in a pool for a VF from the PF::
983
984   testpmd> set vf vlan stripq (port_id) (vf_id) (on|off)
985
986vlan set insert (for VF)
987~~~~~~~~~~~~~~~~~~~~~~~~
988
989Set VLAN insert for a VF from the PF::
990
991   testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
992
993vlan set antispoof (for VF)
994~~~~~~~~~~~~~~~~~~~~~~~~~~~
995
996Set VLAN antispoof for a VF from the PF::
997
998   testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off)
999
1000vlan set (strip|filter|qinq_strip|extend)
1001~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1002Set the VLAN strip/filter/QinQ strip/extend on for a port::
1003
1004   testpmd> vlan set (strip|filter|qinq_strip|extend) (on|off) (port_id)
1005
1006vlan set tpid
1007~~~~~~~~~~~~~
1008
1009Set the inner or outer VLAN TPID for packet filtering on a port::
1010
1011   testpmd> vlan set (inner|outer) tpid (value) (port_id)
1012
1013.. note::
1014
1015   TPID value must be a 16-bit number (value <= 65536).
1016
1017rx_vlan add
1018~~~~~~~~~~~
1019
1020Add a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID::
1021
1022   testpmd> rx_vlan add (vlan_id|all) (port_id)
1023
1024.. note::
1025
1026   VLAN filter must be set on that port. VLAN ID < 4096.
1027   Depending on the NIC used, number of vlan_ids may be limited to the maximum entries
1028   in VFTA table. This is important if enabling all vlan_ids.
1029
1030rx_vlan rm
1031~~~~~~~~~~
1032
1033Remove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID::
1034
1035   testpmd> rx_vlan rm (vlan_id|all) (port_id)
1036
1037rx_vlan add (for VF)
1038~~~~~~~~~~~~~~~~~~~~
1039
1040Add a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID::
1041
1042   testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask)
1043
1044rx_vlan rm (for VF)
1045~~~~~~~~~~~~~~~~~~~
1046
1047Remove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID::
1048
1049   testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask)
1050
1051rx_vxlan_port add
1052~~~~~~~~~~~~~~~~~
1053
1054Add an UDP port for VXLAN packet filter on a port::
1055
1056   testpmd> rx_vxlan_port add (udp_port) (port_id)
1057
1058rx_vxlan_port remove
1059~~~~~~~~~~~~~~~~~~~~
1060
1061Remove an UDP port for VXLAN packet filter on a port::
1062
1063   testpmd> rx_vxlan_port rm (udp_port) (port_id)
1064
1065tx_vlan set
1066~~~~~~~~~~~
1067
1068Set hardware insertion of VLAN IDs in packets sent on a port::
1069
1070   testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer]
1071
1072For example, set a single VLAN ID (5) insertion on port 0::
1073
1074   tx_vlan set 0 5
1075
1076Or, set double VLAN ID (inner: 2, outer: 3) insertion on port 1::
1077
1078   tx_vlan set 1 2 3
1079
1080
1081tx_vlan set pvid
1082~~~~~~~~~~~~~~~~
1083
1084Set port based hardware insertion of VLAN ID in packets sent on a port::
1085
1086   testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off)
1087
1088tx_vlan reset
1089~~~~~~~~~~~~~
1090
1091Disable hardware insertion of a VLAN header in packets sent on a port::
1092
1093   testpmd> tx_vlan reset (port_id)
1094
1095csum set
1096~~~~~~~~
1097
1098Select hardware or software calculation of the checksum when
1099transmitting a packet using the ``csum`` forwarding engine::
1100
1101   testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)
1102
1103Where:
1104
1105* ``ip|udp|tcp|sctp`` always relate to  the inner layer.
1106
1107* ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized
1108  as a tunnel packet by the forwarding engine (geneve, gre, gtp, ipip, vxlan and vxlan-gpe are
1109  supported). See also the ``csum parse-tunnel`` command.
1110
1111* ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized
1112  as a tunnel packet by the forwarding engine (geneve, gtp, vxlan and vxlan-gpe are
1113  supported). See also the ``csum parse-tunnel`` command.
1114
1115.. note::
1116
1117   Check the NIC Datasheet for hardware limits.
1118
1119csum parse-tunnel
1120~~~~~~~~~~~~~~~~~
1121
1122Define how tunneled packets should be handled by the csum forward
1123engine::
1124
1125   testpmd> csum parse-tunnel (on|off) (tx_port_id)
1126
1127If enabled, the csum forward engine will try to recognize supported
1128tunnel headers (geneve, gtp, gre, ipip, vxlan, vxlan-gpe).
1129
1130If disabled, treat tunnel packets as non-tunneled packets (a inner
1131header is handled as a packet payload).
1132
1133.. note::
1134
1135   The port argument is the TX port like in the ``csum set`` command.
1136
1137Example:
1138
1139Consider a packet in packet like the following::
1140
1141   eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in
1142
1143* If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1144  command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the
1145  ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ipv4_out`` and ``udp_out``).
1146
1147* If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum  set``
1148   command relate to the outer headers, here ``ipv4_out`` and ``udp_out``.
1149
1150csum show
1151~~~~~~~~~
1152
1153Display tx checksum offload configuration::
1154
1155   testpmd> csum show (port_id)
1156
1157tso set
1158~~~~~~~
1159
1160Enable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine::
1161
1162   testpmd> tso set (segsize) (port_id)
1163
1164.. note::
1165
1166   Check the NIC datasheet for hardware limits.
1167
1168tso show
1169~~~~~~~~
1170
1171Display the status of TCP Segmentation Offload::
1172
1173   testpmd> tso show (port_id)
1174
1175tunnel tso set
1176~~~~~~~~~~~~~~
1177
1178Set tso segment size of tunneled packets for a port in csum engine::
1179
1180   testpmd> tunnel_tso set (tso_segsz) (port_id)
1181
1182tunnel tso show
1183~~~~~~~~~~~~~~~
1184
1185Display the status of tunneled TCP Segmentation Offload for a port::
1186
1187   testpmd> tunnel_tso show (port_id)
1188
1189set port - gro
1190~~~~~~~~~~~~~~
1191
1192Enable or disable GRO in ``csum`` forwarding engine::
1193
1194   testpmd> set port <port_id> gro on|off
1195
1196If enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
1197packets received from the given port.
1198
1199If disabled, packets received from the given port won't be performed
1200GRO. By default, GRO is disabled for all ports.
1201
1202.. note::
1203
1204   When enable GRO for a port, TCP/IPv4 packets received from the port
1205   will be performed GRO. After GRO, all merged packets have bad
1206   checksums, since the GRO library doesn't re-calculate checksums for
1207   the merged packets. Therefore, if users want the merged packets to
1208   have correct checksums, please select HW IP checksum calculation and
1209   HW TCP checksum calculation for the port which the merged packets are
1210   transmitted to.
1211
1212show port - gro
1213~~~~~~~~~~~~~~~
1214
1215Display GRO configuration for a given port::
1216
1217   testpmd> show port <port_id> gro
1218
1219set gro flush
1220~~~~~~~~~~~~~
1221
1222Set the cycle to flush the GROed packets from reassembly tables::
1223
1224   testpmd> set gro flush <cycles>
1225
1226When enable GRO, the csum forwarding engine performs GRO on received
1227packets, and the GROed packets are stored in reassembly tables. Users
1228can use this command to determine when the GROed packets are flushed
1229from the reassembly tables.
1230
1231The ``cycles`` is measured in GRO operation times. The csum forwarding
1232engine flushes the GROed packets from the tables every ``cycles`` GRO
1233operations.
1234
1235By default, the value of ``cycles`` is 1, which means flush GROed packets
1236from the reassembly tables as soon as one GRO operation finishes. The value
1237of ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
1238
1239Please note that the large value of ``cycles`` may cause the poor TCP/IP
1240stack performance. Because the GROed packets are delayed to arrive the
1241stack, thus causing more duplicated ACKs and TCP retransmissions.
1242
1243set port - gso
1244~~~~~~~~~~~~~~
1245
1246Toggle per-port GSO support in ``csum`` forwarding engine::
1247
1248   testpmd> set port <port_id> gso on|off
1249
1250If enabled, the csum forwarding engine will perform GSO on supported IPv4
1251packets, transmitted on the given port.
1252
1253If disabled, packets transmitted on the given port will not undergo GSO.
1254By default, GSO is disabled for all ports.
1255
1256.. note::
1257
1258   When GSO is enabled on a port, supported IPv4 packets transmitted on that
1259   port undergo GSO. Afterwards, the segmented packets are represented by
1260   multi-segment mbufs; however, the csum forwarding engine doesn't calculation
1261   of checksums for GSO'd segments in SW. As a result, if users want correct
1262   checksums in GSO segments, they should enable HW checksum calculation for
1263   GSO-enabled ports.
1264
1265   For example, HW checksum calculation for VxLAN GSO'd packets may be enabled
1266   by setting the following options in the csum forwarding engine:
1267
1268   testpmd> csum set outer_ip hw <port_id>
1269
1270   testpmd> csum set ip hw <port_id>
1271
1272   testpmd> csum set tcp hw <port_id>
1273
1274   UDP GSO is the same as IP fragmentation, which treats the UDP header
1275   as the payload and does not modify it during segmentation. That is,
1276   after UDP GSO, only the first output fragment has the original UDP
1277   header. Therefore, users need to enable HW IP checksum calculation
1278   and SW UDP checksum calculation for GSO-enabled ports, if they want
1279   correct checksums for UDP/IPv4 packets.
1280
1281set gso segsz
1282~~~~~~~~~~~~~
1283
1284Set the maximum GSO segment size (measured in bytes), which includes the
1285packet header and the packet payload for GSO-enabled ports (global)::
1286
1287   testpmd> set gso segsz <length>
1288
1289show port - gso
1290~~~~~~~~~~~~~~~
1291
1292Display the status of Generic Segmentation Offload for a given port::
1293
1294   testpmd> show port <port_id> gso
1295
1296mac_addr add
1297~~~~~~~~~~~~
1298
1299Add an alternative MAC address to a port::
1300
1301   testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)
1302
1303mac_addr remove
1304~~~~~~~~~~~~~~~
1305
1306Remove a MAC address from a port::
1307
1308   testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)
1309
1310mcast_addr add
1311~~~~~~~~~~~~~~
1312
1313To add the multicast MAC address to/from the set of multicast addresses
1314filtered by port::
1315
1316   testpmd> mcast_addr add (port_id) (mcast_addr)
1317
1318mcast_addr remove
1319~~~~~~~~~~~~~~~~~
1320
1321To remove the multicast MAC address to/from the set of multicast addresses
1322filtered by port::
1323
1324   testpmd> mcast_addr remove (port_id) (mcast_addr)
1325
1326mcast_addr flush
1327~~~~~~~~~~~~~~~~
1328
1329Flush all multicast MAC addresses on port_id::
1330
1331   testpmd> mcast_addr flush (port_id)
1332
1333mac_addr add (for VF)
1334~~~~~~~~~~~~~~~~~~~~~
1335
1336Add an alternative MAC address for a VF to a port::
1337
1338   testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX)
1339
1340mac_addr set
1341~~~~~~~~~~~~
1342
1343Set the default MAC address for a port::
1344
1345   testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
1346
1347mac_addr set (for VF)
1348~~~~~~~~~~~~~~~~~~~~~
1349
1350Set the MAC address for a VF from the PF::
1351
1352   testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)
1353
1354set eth-peer
1355~~~~~~~~~~~~
1356
1357Set the forwarding peer address for certain port::
1358
1359   testpmd> set eth-peer (port_id) (peer_addr)
1360
1361This is equivalent to the ``--eth-peer`` command-line option.
1362
1363set port-uta
1364~~~~~~~~~~~~
1365
1366Set the unicast hash filter(s) on/off for a port::
1367
1368   testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off)
1369
1370set promisc
1371~~~~~~~~~~~
1372
1373Set the promiscuous mode on for a port or for all ports.
1374In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1375
1376   testpmd> set promisc (port_id|all) (on|off)
1377
1378set allmulti
1379~~~~~~~~~~~~
1380
1381Set the allmulti mode for a port or for all ports::
1382
1383   testpmd> set allmulti (port_id|all) (on|off)
1384
1385Same as the ifconfig (8) option. Controls how multicast packets are handled.
1386
1387set flow_ctrl rx
1388~~~~~~~~~~~~~~~~
1389
1390Set the link flow control parameter on a port::
1391
1392   testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1393            (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \
1394	    autoneg (on|off) (port_id)
1395
1396Where:
1397
1398* ``high_water`` (integer): High threshold value to trigger XOFF.
1399
1400* ``low_water`` (integer): Low threshold value to trigger XON.
1401
1402* ``pause_time`` (integer): Pause quota in the Pause frame.
1403
1404* ``send_xon`` (0/1): Send XON frame.
1405
1406* ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames.
1407
1408* ``autoneg``: Change the auto-negotiation parameter.
1409
1410show flow control
1411~~~~~~~~~~~~~~~~~
1412
1413show the link flow control parameter on a port::
1414
1415   testpmd> show port <port_id> flow_ctrl
1416
1417set pfc_ctrl rx
1418~~~~~~~~~~~~~~~
1419
1420Set the priority flow control parameter on a port::
1421
1422   testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1423            (pause_time) (priority) (port_id)
1424
1425Where:
1426
1427* ``high_water`` (integer): High threshold value.
1428
1429* ``low_water`` (integer): Low threshold value.
1430
1431* ``pause_time`` (integer): Pause quota in the Pause frame.
1432
1433* ``priority`` (0-7): VLAN User Priority.
1434
1435set pfc_queue_ctrl
1436~~~~~~~~~~~~~~~~~~
1437
1438Set the priority flow control parameter on a given Rx and Tx queue of a port::
1439
1440   testpmd> set pfc_queue_ctrl <port_id> rx (on|off) <tx_qid> <tx_tc> \
1441            tx (on|off) <rx_qid> <rx_tc> <pause_time>
1442
1443Where:
1444
1445* ``tx_qid`` (integer): Tx qid for which ``tx_tc`` will be applied and traffic
1446  will be paused when PFC frame is received with ``tx_tc`` enabled.
1447
1448* ``tx_tc`` (0-15): TC for which traffic is to be paused for xmit.
1449
1450* ``rx_qid`` (integer): Rx qid for which threshold will be applied and PFC
1451  frame will be generated with ``tx_tc`` when exceeds the threshold.
1452
1453* ``rx_tc`` (0-15): TC filled in PFC frame for which remote Tx is to be paused.
1454
1455* ``pause_time`` (integer): Pause quanta filled in the PFC frame for which
1456  interval, remote Tx will be paused. Valid only if Tx pause is on.
1457
1458Set Rx queue available descriptors threshold
1459~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1460
1461Set available descriptors threshold for a specific Rx queue of port::
1462
1463  testpmd> set port (port_id) rxq (queue_id) avail_thresh (0..99)
1464
1465Use 0 value to disable the threshold and corresponding event.
1466
1467set stat_qmap
1468~~~~~~~~~~~~~
1469
1470Set statistics mapping (qmapping 0..15) for RX/TX queue on port::
1471
1472   testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)
1473
1474For example, to set rx queue 2 on port 0 to mapping 5::
1475
1476   testpmd>set stat_qmap rx 0 2 5
1477
1478set xstats-hide-zero
1479~~~~~~~~~~~~~~~~~~~~
1480
1481Set the option to hide zero values for xstats display::
1482
1483	testpmd> set xstats-hide-zero on|off
1484
1485.. note::
1486
1487	By default, the zero values are displayed for xstats.
1488
1489set port - rx/tx (for VF)
1490~~~~~~~~~~~~~~~~~~~~~~~~~
1491
1492Set VF receive/transmit from a port::
1493
1494   testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1495
1496set port - rx mode(for VF)
1497~~~~~~~~~~~~~~~~~~~~~~~~~~
1498
1499Set the VF receive mode of a port::
1500
1501   testpmd> set port (port_id) vf (vf_id) \
1502            rxmode (AUPE|ROPE|BAM|MPE) (on|off)
1503
1504The available receive modes are:
1505
1506* ``AUPE``: Accepts untagged VLAN.
1507
1508* ``ROPE``: Accepts unicast hash.
1509
1510* ``BAM``: Accepts broadcast packets.
1511
1512* ``MPE``: Accepts all multicast packets.
1513
1514set port - tx_rate (for Queue)
1515~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1516
1517Set TX rate limitation for a queue on a port::
1518
1519   testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1520
1521set port - tx_rate (for VF)
1522~~~~~~~~~~~~~~~~~~~~~~~~~~~
1523
1524Set TX rate limitation for queues in VF on a port::
1525
1526   testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
1527
1528set flush_rx
1529~~~~~~~~~~~~
1530
1531Set the flush on RX streams before forwarding.
1532The default is flush ``on``.
1533Mainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams::
1534
1535   testpmd> set flush_rx off
1536
1537set link up
1538~~~~~~~~~~~
1539
1540Set link up for a port::
1541
1542   testpmd> set link-up port (port id)
1543
1544set link down
1545~~~~~~~~~~~~~
1546
1547Set link down for a port::
1548
1549   testpmd> set link-down port (port id)
1550
1551E-tag set
1552~~~~~~~~~
1553
1554Enable E-tag insertion for a VF on a port::
1555
1556   testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
1557
1558Disable E-tag insertion for a VF on a port::
1559
1560   testpmd> E-tag set insertion off port (port_id) vf (vf_id)
1561
1562Enable/disable E-tag stripping on a port::
1563
1564   testpmd> E-tag set stripping (on|off) port (port_id)
1565
1566Enable/disable E-tag based forwarding on a port::
1567
1568   testpmd> E-tag set forwarding (on|off) port (port_id)
1569
1570config per port Rx offloading
1571~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1572
1573Enable or disable port Rx offloading on all Rx queues of a port::
1574
1575   testpmd> port config (port_id|all) rx_offload (offloading) on|off
1576
1577* ``offloading``: can be any of these offloading capability:
1578                  all, vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1579                  qinq_strip, outer_ipv4_cksum, macsec_strip,
1580                  vlan_filter, vlan_extend, scatter, timestamp, security,
1581                  keep_crc, rss_hash
1582
1583This command should be run when the port is stopped, or else it will fail.
1584
1585config per queue Rx offloading
1586~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1587
1588Enable or disable a per queue Rx offloading only on a specific Rx queue::
1589
1590   testpmd> port (port_id) rxq (queue_id) rx_offload (offloading) on|off
1591
1592* ``offloading``: can be any of these offloading capability:
1593                  all, vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1594                  qinq_strip, outer_ipv4_cksum, macsec_strip,
1595                  vlan_filter, vlan_extend, scatter, timestamp, security,
1596                  keep_crc
1597
1598This command should be run when the port is stopped, or else it will fail.
1599
1600config per port Tx offloading
1601~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1602
1603Enable or disable port Tx offloading on all Tx queues of a port::
1604
1605   testpmd> port config (port_id|all) tx_offload (offloading) on|off
1606
1607* ``offloading``: can be any of these offloading capability:
1608                  all, vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1609                  sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1610                  qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1611                  ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1612                  mt_lockfree, multi_segs, mbuf_fast_free, security
1613
1614This command should be run when the port is stopped, or else it will fail.
1615
1616config per queue Tx offloading
1617~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1618
1619Enable or disable a per queue Tx offloading only on a specific Tx queue::
1620
1621   testpmd> port (port_id) txq (queue_id) tx_offload (offloading) on|off
1622
1623* ``offloading``: can be any of these offloading capability:
1624                  all, vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1625                  sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1626                  qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1627                  ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1628                  mt_lockfree, multi_segs, mbuf_fast_free, security
1629
1630This command should be run when the port is stopped, or else it will fail.
1631
1632config per queue Tx affinity mapping
1633~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1634
1635Map a Tx queue with an aggregated port of the DPDK port (specified with port_id)::
1636
1637   testpmd> port (port_id) txq (queue_id) affinity (value)
1638
1639* ``affinity``: the number of the aggregated port.
1640                When multiple ports are aggregated into a single one,
1641                it allows to choose which port to use for Tx via a queue.
1642
1643This command should be run when the port is stopped, otherwise it fails.
1644
1645
1646Config VXLAN Encap outer layers
1647~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1648
1649Configure the outer layer to encapsulate a packet inside a VXLAN tunnel::
1650
1651 set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1652 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) \
1653 eth-dst (eth-dst)
1654
1655 set vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1656 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1657 eth-src (eth-src) eth-dst (eth-dst)
1658
1659 set vxlan-tos-ttl ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1660 udp-dst (udp-dst) ip-tos (ip-tos) ip-ttl (ip-ttl) ip-src (ip-src) \
1661 ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1662
1663These commands will set an internal configuration inside testpmd, any following
1664flow rule using the action vxlan_encap will use the last configuration set.
1665To have a different encapsulation header, one of those commands must be called
1666before the flow rule creation.
1667
1668Config NVGRE Encap outer layers
1669~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1670
1671Configure the outer layer to encapsulate a packet inside a NVGRE tunnel::
1672
1673 set nvgre ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) ip-dst (ip-dst) \
1674        eth-src (eth-src) eth-dst (eth-dst)
1675 set nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) \
1676        ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1677
1678These commands will set an internal configuration inside testpmd, any following
1679flow rule using the action nvgre_encap will use the last configuration set.
1680To have a different encapsulation header, one of those commands must be called
1681before the flow rule creation.
1682
1683Config L2 Encap
1684~~~~~~~~~~~~~~~
1685
1686Configure the l2 to be used when encapsulating a packet with L2::
1687
1688 set l2_encap ip-version (ipv4|ipv6) eth-src (eth-src) eth-dst (eth-dst)
1689 set l2_encap-with-vlan ip-version (ipv4|ipv6) vlan-tci (vlan-tci) \
1690        eth-src (eth-src) eth-dst (eth-dst)
1691
1692Those commands will set an internal configuration inside testpmd, any following
1693flow rule using the action l2_encap will use the last configuration set.
1694To have a different encapsulation header, one of those commands must be called
1695before the flow rule creation.
1696
1697Config L2 Decap
1698~~~~~~~~~~~~~~~
1699
1700Configure the l2 to be removed when decapsulating a packet with L2::
1701
1702 set l2_decap ip-version (ipv4|ipv6)
1703 set l2_decap-with-vlan ip-version (ipv4|ipv6)
1704
1705Those commands will set an internal configuration inside testpmd, any following
1706flow rule using the action l2_decap will use the last configuration set.
1707To have a different encapsulation header, one of those commands must be called
1708before the flow rule creation.
1709
1710Config MPLSoGRE Encap outer layers
1711~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1712
1713Configure the outer layer to encapsulate a packet inside a MPLSoGRE tunnel::
1714
1715 set mplsogre_encap ip-version (ipv4|ipv6) label (label) \
1716        ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1717 set mplsogre_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1718        ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1719        eth-src (eth-src) eth-dst (eth-dst)
1720
1721These commands will set an internal configuration inside testpmd, any following
1722flow rule using the action mplsogre_encap will use the last configuration set.
1723To have a different encapsulation header, one of those commands must be called
1724before the flow rule creation.
1725
1726Config MPLSoGRE Decap outer layers
1727~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1728
1729Configure the outer layer to decapsulate MPLSoGRE packet::
1730
1731 set mplsogre_decap ip-version (ipv4|ipv6)
1732 set mplsogre_decap-with-vlan ip-version (ipv4|ipv6)
1733
1734These commands will set an internal configuration inside testpmd, any following
1735flow rule using the action mplsogre_decap will use the last configuration set.
1736To have a different decapsulation header, one of those commands must be called
1737before the flow rule creation.
1738
1739Config MPLSoUDP Encap outer layers
1740~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1741
1742Configure the outer layer to encapsulate a packet inside a MPLSoUDP tunnel::
1743
1744 set mplsoudp_encap ip-version (ipv4|ipv6) label (label) udp-src (udp-src) \
1745        udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1746        eth-src (eth-src) eth-dst (eth-dst)
1747 set mplsoudp_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1748        udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1749        vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1750
1751These commands will set an internal configuration inside testpmd, any following
1752flow rule using the action mplsoudp_encap will use the last configuration set.
1753To have a different encapsulation header, one of those commands must be called
1754before the flow rule creation.
1755
1756Config MPLSoUDP Decap outer layers
1757~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1758
1759Configure the outer layer to decapsulate MPLSoUDP packet::
1760
1761 set mplsoudp_decap ip-version (ipv4|ipv6)
1762 set mplsoudp_decap-with-vlan ip-version (ipv4|ipv6)
1763
1764These commands will set an internal configuration inside testpmd, any following
1765flow rule using the action mplsoudp_decap will use the last configuration set.
1766To have a different decapsulation header, one of those commands must be called
1767before the flow rule creation.
1768
1769Config Raw Encapsulation
1770~~~~~~~~~~~~~~~~~~~~~~~~~
1771
1772Configure the raw data to be used when encapsulating a packet by
1773rte_flow_action_raw_encap::
1774
1775 set raw_encap {index} {item} [/ {item} [...]] / end_set
1776
1777There are multiple global buffers for ``raw_encap``, this command will set one
1778internal buffer index by ``{index}``.
1779If there is no ``{index}`` specified::
1780
1781 set raw_encap {item} [/ {item} [...]] / end_set
1782
1783the default index ``0`` is used.
1784In order to use different encapsulating header, ``index`` must be specified
1785during the flow rule creation::
1786
1787 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
1788        raw_encap index 2 / end
1789
1790Otherwise the default index ``0`` is used.
1791
1792Config Raw Decapsulation
1793~~~~~~~~~~~~~~~~~~~~~~~~
1794
1795Configure the raw data to be used when decapsulating a packet by
1796rte_flow_action_raw_decap::
1797
1798 set raw_decap {index} {item} [/ {item} [...]] / end_set
1799
1800There are multiple global buffers for ``raw_decap``, this command will set
1801one internal buffer index by ``{index}``.
1802If there is no ``{index}`` specified::
1803
1804 set raw_decap {item} [/ {item} [...]] / end_set
1805
1806the default index ``0`` is used.
1807In order to use different decapsulating header, ``index`` must be specified
1808during the flow rule creation::
1809
1810 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
1811          raw_encap index 3 / end
1812
1813Otherwise the default index ``0`` is used.
1814
1815Set fec mode
1816~~~~~~~~~~~~
1817
1818Set fec mode for a specific port::
1819
1820  testpmd> set port (port_id) fec_mode auto|off|rs|baser|llrs
1821
1822Config Sample actions list
1823~~~~~~~~~~~~~~~~~~~~~~~~~~
1824
1825Configure the sample actions list to be used when sampling a packet by
1826rte_flow_action_sample::
1827
1828 set sample_actions {index} {action} [/ {action} [...]] / end
1829
1830There are multiple global buffers for ``sample_actions``, this command will set
1831one internal buffer index by ``{index}``.
1832
1833In order to use different sample actions list, ``index`` must be specified
1834during the flow rule creation::
1835
1836 testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
1837        sample ratio 2 index 2 / end
1838
1839Otherwise the default index ``0`` is used.
1840
1841Port Functions
1842--------------
1843
1844The following sections show functions for configuring ports.
1845
1846.. note::
1847
1848   Port configuration changes only become active when forwarding is started/restarted.
1849
1850.. _port_attach:
1851
1852port attach
1853~~~~~~~~~~~
1854
1855Attach a port specified by pci address or virtual device args::
1856
1857   testpmd> port attach (identifier)
1858
1859To attach a new pci device, the device should be recognized by kernel first.
1860Then it should be moved under DPDK management.
1861Finally the port can be attached to testpmd.
1862
1863For example, to move a pci device using ixgbe under DPDK management:
1864
1865.. code-block:: console
1866
1867   # Check the status of the available devices.
1868   ./usertools/dpdk-devbind.py --status
1869
1870   Network devices using DPDK-compatible driver
1871   ============================================
1872   <none>
1873
1874   Network devices using kernel driver
1875   ===================================
1876   0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=
1877
1878
1879   # Bind the device to igb_uio.
1880   sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0
1881
1882
1883   # Recheck the status of the devices.
1884   ./usertools/dpdk-devbind.py --status
1885   Network devices using DPDK-compatible driver
1886   ============================================
1887   0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused=
1888
1889To attach a port created by virtual device, above steps are not needed.
1890
1891For example, to attach a port whose pci address is 0000:0a:00.0.
1892
1893.. code-block:: console
1894
1895   testpmd> port attach 0000:0a:00.0
1896   Attaching a new port...
1897   EAL: PCI device 0000:0a:00.0 on NUMA socket -1
1898   EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
1899   EAL:   PCI memory mapped at 0x7f83bfa00000
1900   EAL:   PCI memory mapped at 0x7f83bfa80000
1901   PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5
1902   PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
1903   Port 0 is attached. Now total ports is 1
1904   Done
1905
1906For example, to attach a port created by pcap PMD.
1907
1908.. code-block:: console
1909
1910   testpmd> port attach net_pcap0
1911   Attaching a new port...
1912   PMD: Initializing pmd_pcap for net_pcap0
1913   PMD: Creating pcap-backed ethdev on numa socket 0
1914   Port 0 is attached. Now total ports is 1
1915   Done
1916
1917In this case, identifier is ``net_pcap0``.
1918This identifier format is the same as ``--vdev`` format of DPDK applications.
1919
1920For example, to re-attach a bonding port which has been previously detached,
1921the mode and slave parameters must be given.
1922
1923.. code-block:: console
1924
1925   testpmd> port attach net_bond_0,mode=0,slave=1
1926   Attaching a new port...
1927   EAL: Initializing pmd_bond for net_bond_0
1928   EAL: Create bonding device net_bond_0 on port 0 in mode 0 on socket 0.
1929   Port 0 is attached. Now total ports is 1
1930   Done
1931
1932
1933port detach
1934~~~~~~~~~~~
1935
1936Detach a specific port::
1937
1938   testpmd> port detach (port_id)
1939
1940Before detaching a port, the port should be stopped and closed.
1941
1942For example, to detach a pci device port 0.
1943
1944.. code-block:: console
1945
1946   testpmd> port stop 0
1947   Stopping ports...
1948   Done
1949   testpmd> port close 0
1950   Closing ports...
1951   Done
1952
1953   testpmd> port detach 0
1954   Detaching a port...
1955   EAL: PCI device 0000:0a:00.0 on NUMA socket -1
1956   EAL:   remove driver: 8086:10fb rte_ixgbe_pmd
1957   EAL:   PCI memory unmapped at 0x7f83bfa00000
1958   EAL:   PCI memory unmapped at 0x7f83bfa80000
1959   Done
1960
1961
1962For example, to detach a virtual device port 0.
1963
1964.. code-block:: console
1965
1966   testpmd> port stop 0
1967   Stopping ports...
1968   Done
1969   testpmd> port close 0
1970   Closing ports...
1971   Done
1972
1973   testpmd> port detach 0
1974   Detaching a port...
1975   PMD: Closing pcap ethdev on numa socket 0
1976   Port 'net_pcap0' is detached. Now total ports is 0
1977   Done
1978
1979To remove a pci device completely from the system, first detach the port from testpmd.
1980Then the device should be moved under kernel management.
1981Finally the device can be removed using kernel pci hotplug functionality.
1982
1983For example, to move a pci device under kernel management:
1984
1985.. code-block:: console
1986
1987   sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0
1988
1989   ./usertools/dpdk-devbind.py --status
1990
1991   Network devices using DPDK-compatible driver
1992   ============================================
1993   <none>
1994
1995   Network devices using kernel driver
1996   ===================================
1997   0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio
1998
1999To remove a port created by a virtual device, above steps are not needed.
2000
2001port start
2002~~~~~~~~~~
2003
2004Start all ports or a specific port::
2005
2006   testpmd> port start (port_id|all)
2007
2008port stop
2009~~~~~~~~~
2010
2011Stop all ports or a specific port::
2012
2013   testpmd> port stop (port_id|all)
2014
2015port close
2016~~~~~~~~~~
2017
2018Close all ports or a specific port::
2019
2020   testpmd> port close (port_id|all)
2021
2022port reset
2023~~~~~~~~~~
2024
2025Reset all ports or a specific port::
2026
2027   testpmd> port reset (port_id|all)
2028
2029User should stop port(s) before resetting and (re-)start after reset.
2030
2031port config - queue ring size
2032~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2033
2034Configure a rx/tx queue ring size::
2035
2036   testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
2037
2038Only take effect after command that (re-)start the port or command that setup specific queue.
2039
2040port start/stop queue
2041~~~~~~~~~~~~~~~~~~~~~
2042
2043Start/stop a rx/tx queue on a specific port::
2044
2045   testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
2046
2047port config - queue deferred start
2048~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2049
2050Switch on/off deferred start of a specific port queue::
2051
2052   testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
2053
2054port setup queue
2055~~~~~~~~~~~~~~~~~~~~~
2056
2057Setup a rx/tx queue on a specific port::
2058
2059   testpmd> port (port_id) (rxq|txq) (queue_id) setup
2060
2061Only take effect when port is started.
2062
2063port config - speed
2064~~~~~~~~~~~~~~~~~~~
2065
2066Set the speed and duplex mode for all ports or a specific port::
2067
2068   testpmd> port config (port_id|all) speed (10|100|1000|2500|5000|10000|25000|40000|50000|100000|200000|400000|auto) \
2069            duplex (half|full|auto)
2070
2071port config - queues/descriptors
2072~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2073
2074Set number of queues/descriptors for rxq, txq, rxd and txd::
2075
2076   testpmd> port config all (rxq|txq|rxd|txd) (value)
2077
2078This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2079
2080port config - max-pkt-len
2081~~~~~~~~~~~~~~~~~~~~~~~~~
2082
2083Set the maximum packet length::
2084
2085   testpmd> port config all max-pkt-len (value)
2086
2087This is equivalent to the ``--max-pkt-len`` command-line option.
2088
2089port config - max-lro-pkt-size
2090~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2091
2092Set the maximum LRO aggregated packet size::
2093
2094   testpmd> port config all max-lro-pkt-size (value)
2095
2096This is equivalent to the ``--max-lro-pkt-size`` command-line option.
2097
2098port config - Drop Packets
2099~~~~~~~~~~~~~~~~~~~~~~~~~~
2100
2101Enable or disable packet drop on all RX queues of all ports when no receive buffers available::
2102
2103   testpmd> port config all drop-en (on|off)
2104
2105Packet dropping when no receive buffers available is off by default.
2106
2107The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2108
2109port config - RSS
2110~~~~~~~~~~~~~~~~~
2111
2112Set the RSS (Receive Side Scaling) mode on or off::
2113   testpmd> port config all rss (all|default|level-default|level-outer|level-inner| \
2114                                 ip|tcp|udp|sctp|tunnel|vlan|none| \
2115                                 ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other| \
2116                                 ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
2117                                 ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex| \
2118                                 l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan| \
2119                                 esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum| \
2120                                 l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32| \
2121                                 l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)
2122
2123RSS is on by default.
2124
2125The ``all`` option is equivalent to eth|vlan|ip|tcp|udp|sctp|ether|l2tpv3|esp|ah|pfcp|l2tpv2.
2126
2127The ``default`` option enables all supported RSS types reported by device info.
2128
2129The ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2130
2131port config - RSS Reta
2132~~~~~~~~~~~~~~~~~~~~~~
2133
2134Set the RSS (Receive Side Scaling) redirection table::
2135
2136   testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2137
2138port config - DCB
2139~~~~~~~~~~~~~~~~~
2140
2141Set the DCB mode for an individual port::
2142
2143   testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2144
2145The traffic class should be 4 or 8.
2146
2147port config - Burst
2148~~~~~~~~~~~~~~~~~~~
2149
2150Set the number of packets per burst::
2151
2152   testpmd> port config all burst (value)
2153
2154This is equivalent to the ``--burst`` command-line option.
2155
2156port config - Threshold
2157~~~~~~~~~~~~~~~~~~~~~~~
2158
2159Set thresholds for TX/RX queues::
2160
2161   testpmd> port config all (threshold) (value)
2162
2163Where the threshold type can be:
2164
2165* ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255.
2166
2167* ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255.
2168
2169* ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255.
2170
2171* ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255.
2172
2173* ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255.
2174
2175* ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255.
2176
2177* ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd.
2178
2179* ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd.
2180
2181* ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd.
2182
2183These threshold options are also available from the command-line.
2184
2185port config pctype mapping
2186~~~~~~~~~~~~~~~~~~~~~~~~~~
2187
2188Reset pctype mapping table::
2189
2190   testpmd> port config (port_id) pctype mapping reset
2191
2192Update hardware defined pctype to software defined flow type mapping table::
2193
2194   testpmd> port config (port_id) pctype mapping update (pctype_id_0[,pctype_id_1]*) (flow_type_id)
2195
2196where:
2197
2198* ``pctype_id_x``: hardware pctype id as index of bit in bitmask value of the pctype mapping table.
2199
2200* ``flow_type_id``: software flow type id as the index of the pctype mapping table.
2201
2202port config input set
2203~~~~~~~~~~~~~~~~~~~~~
2204
2205Config RSS/FDIR/FDIR flexible payload input set for some pctype::
2206
2207   testpmd> port config (port_id) pctype (pctype_id) \
2208            (hash_inset|fdir_inset|fdir_flx_inset) \
2209	    (get|set|clear) field (field_idx)
2210
2211Clear RSS/FDIR/FDIR flexible payload input set for some pctype::
2212
2213   testpmd> port config (port_id) pctype (pctype_id) \
2214            (hash_inset|fdir_inset|fdir_flx_inset) clear all
2215
2216where:
2217
2218* ``pctype_id``: hardware packet classification types.
2219* ``field_idx``: hardware field index.
2220
2221port config udp_tunnel_port
2222~~~~~~~~~~~~~~~~~~~~~~~~~~~
2223
2224Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
2225
2226    testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe|ecpri (udp_port)
2227
2228port config tx_metadata
2229~~~~~~~~~~~~~~~~~~~~~~~
2230
2231Set Tx metadata value per port.
2232testpmd will add this value to any Tx packet sent from this port::
2233
2234   testpmd> port config (port_id) tx_metadata (value)
2235
2236port config dynf
2237~~~~~~~~~~~~~~~~
2238
2239Set/clear dynamic flag per port.
2240testpmd will register this flag in the mbuf (same registration
2241for both Tx and Rx). Then set/clear this flag for each Tx
2242packet sent from this port. The set bit only works for Tx packet::
2243
2244   testpmd> port config (port_id) dynf (name) (set|clear)
2245
2246port config mtu
2247~~~~~~~~~~~~~~~
2248
2249To configure MTU(Maximum Transmission Unit) on devices using testpmd::
2250
2251   testpmd> port config mtu (port_id) (value)
2252
2253port config rss hash key
2254~~~~~~~~~~~~~~~~~~~~~~~~
2255
2256To configure the RSS hash key used to compute the RSS
2257hash of input [IP] packets received on port::
2258
2259   testpmd> port config <port_id> rss-hash-key (ipv4|ipv4-frag|\
2260                     ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|\
2261                     ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|\
2262                     ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|\
2263                     ipv6-udp-ex <string of hex digits \
2264                     (variable length, NIC dependent)>)
2265
2266port config rss hash algorithm
2267~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2268
2269To configure the RSS hash algorithm used to compute the RSS
2270hash of input packets received on port::
2271
2272   testpmd> port config <port_id> rss-hash-algo (default|\
2273                     simple_xor|toeplitz|symmetric_toeplitz|\
2274                     symmetric_toeplitz_sort)
2275
2276port cleanup txq mbufs
2277~~~~~~~~~~~~~~~~~~~~~~
2278
2279To cleanup txq mbufs currently cached by driver::
2280
2281   testpmd> port cleanup (port_id) txq (queue_id) (free_cnt)
2282
2283If the value of ``free_cnt`` is 0, driver should free all cached mbufs.
2284
2285Device Functions
2286----------------
2287
2288The following sections show functions for device operations.
2289
2290device detach
2291~~~~~~~~~~~~~
2292
2293Detach a device specified by pci address or virtual device args::
2294
2295   testpmd> device detach (identifier)
2296
2297Before detaching a device associated with ports, the ports should be stopped and closed.
2298
2299For example, to detach a pci device whose address is 0002:03:00.0.
2300
2301.. code-block:: console
2302
2303    testpmd> device detach 0002:03:00.0
2304    Removing a device...
2305    Port 1 is now closed
2306    EAL: Releasing pci mapped resource for 0002:03:00.0
2307    EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218a050000
2308    EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218c050000
2309    Device 0002:03:00.0 is detached
2310    Now total ports is 1
2311
2312For example, to detach a port created by pcap PMD.
2313
2314.. code-block:: console
2315
2316    testpmd> device detach net_pcap0
2317    Removing a device...
2318    Port 0 is now closed
2319    Device net_pcap0 is detached
2320    Now total ports is 0
2321    Done
2322
2323In this case, identifier is ``net_pcap0``.
2324This identifier format is the same as ``--vdev`` format of DPDK applications.
2325
2326Link Bonding Functions
2327----------------------
2328
2329The Link Bonding functions make it possible to dynamically create and
2330manage link bonding devices from within testpmd interactive prompt.
2331
2332See :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information.
2333
2334Traffic Metering and Policing
2335-----------------------------
2336
2337The following section shows functions for configuring traffic metering and
2338policing on the ethernet device through the use of generic ethdev API.
2339
2340show port traffic management capability
2341~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2342
2343Show traffic metering and policing capability of the port::
2344
2345   testpmd> show port meter cap (port_id)
2346
2347add port meter profile (srTCM rfc2967)
2348~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2349
2350Add meter profile (srTCM rfc2697) to the ethernet device::
2351
2352   testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
2353   (cir) (cbs) (ebs) (packet_mode)
2354
2355where:
2356
2357* ``profile_id``: ID for the meter profile.
2358* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
2359* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
2360* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
2361* ``packet_mode``: Packets mode for meter profile.
2362
2363add port meter profile (trTCM rfc2968)
2364~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2365
2366Add meter profile (srTCM rfc2698) to the ethernet device::
2367
2368   testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
2369   (cir) (pir) (cbs) (pbs) (packet_mode)
2370
2371where:
2372
2373* ``profile_id``: ID for the meter profile.
2374* ``cir``: Committed information rate (bytes per second or packets per second).
2375* ``pir``: Peak information rate (bytes per second or packets per second).
2376* ``cbs``: Committed burst size (bytes or packets).
2377* ``pbs``: Peak burst size (bytes or packets).
2378* ``packet_mode``: Packets mode for meter profile.
2379
2380add port meter profile (trTCM rfc4115)
2381~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2382
2383Add meter profile (trTCM rfc4115) to the ethernet device::
2384
2385   testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
2386   (cir) (eir) (cbs) (ebs) (packet_mode)
2387
2388where:
2389
2390* ``profile_id``: ID for the meter profile.
2391* ``cir``: Committed information rate (bytes per second or packets per second).
2392* ``eir``: Excess information rate (bytes per second or packets per second).
2393* ``cbs``: Committed burst size (bytes or packets).
2394* ``ebs``: Excess burst size (bytes or packets).
2395* ``packet_mode``: Packets mode for meter profile.
2396
2397delete port meter profile
2398~~~~~~~~~~~~~~~~~~~~~~~~~
2399
2400Delete meter profile from the ethernet device::
2401
2402   testpmd> del port meter profile (port_id) (profile_id)
2403
2404create port policy
2405~~~~~~~~~~~~~~~~~~
2406
2407Create new policy object for the ethernet device::
2408
2409   testpmd> add port meter policy (port_id) (policy_id) g_actions \
2410   {action} y_actions {action} r_actions {action}
2411
2412where:
2413
2414* ``policy_id``: policy ID.
2415* ``action``: action lists for green/yellow/red colors.
2416
2417delete port policy
2418~~~~~~~~~~~~~~~~~~
2419
2420Delete policy object for the ethernet device::
2421
2422   testpmd> del port meter policy (port_id) (policy_id)
2423
2424where:
2425
2426* ``policy_id``: policy ID.
2427
2428create port meter
2429~~~~~~~~~~~~~~~~~
2430
2431Create new meter object for the ethernet device::
2432
2433   testpmd> create port meter (port_id) (mtr_id) (profile_id) \
2434   (policy_id) (meter_enable) (stats_mask) (shared) (default_input_color) \
2435   (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\
2436   (dscp_tbl_entry63)] [(vlan_tbl_entry0) (vlan_tbl_entry1) ... \
2437   (vlan_tbl_entry15)]
2438
2439where:
2440
2441* ``mtr_id``: meter object ID.
2442* ``profile_id``: ID for the meter profile.
2443* ``policy_id``: ID for the policy.
2444* ``meter_enable``: When this parameter has a non-zero value, the meter object
2445  gets enabled at the time of creation, otherwise remains disabled.
2446* ``stats_mask``: Mask of statistics counter types to be enabled for the
2447  meter object.
2448* ``shared``:  When this parameter has a non-zero value, the meter object is
2449  shared by multiple flows. Otherwise, meter object is used by single flow.
2450* ``default_input_color``:  Default input color for incoming packets.
2451  If incoming packet misses DSCP or VLAN input color table then it will be used
2452  as input color.
2453* ``use_pre_meter_color``: When this parameter has a non-zero value, the
2454  input color for the current meter object is determined by the latest meter
2455  object in the same flow. Otherwise, the current meter object uses the
2456  *dscp_table* to determine the input color.
2457* ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input
2458  color, 0 <= x <= 63.
2459* ``vlan_tbl_entryx``: VLAN table entry x providing meter input color,
2460  0 <= x <= 15.
2461
2462enable port meter
2463~~~~~~~~~~~~~~~~~
2464
2465Enable meter for the ethernet device::
2466
2467   testpmd> enable port meter (port_id) (mtr_id)
2468
2469disable port meter
2470~~~~~~~~~~~~~~~~~~
2471
2472Disable meter for the ethernet device::
2473
2474   testpmd> disable port meter (port_id) (mtr_id)
2475
2476delete port meter
2477~~~~~~~~~~~~~~~~~
2478
2479Delete meter for the ethernet device::
2480
2481   testpmd> del port meter (port_id) (mtr_id)
2482
2483Set port meter profile
2484~~~~~~~~~~~~~~~~~~~~~~
2485
2486Set meter profile for the ethernet device::
2487
2488   testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2489
2490set port meter dscp table
2491~~~~~~~~~~~~~~~~~~~~~~~~~
2492
2493Set meter dscp table for the ethernet device::
2494
2495   testpmd> set port meter dscp table (port_id) (mtr_id) (proto) \
2496   [(dscp_tbl_entry0) (dscp_tbl_entry1)...(dscp_tbl_entry63)]
2497
2498set port meter vlan table
2499~~~~~~~~~~~~~~~~~~~~~~~~~
2500Set meter VLAN table for the Ethernet device::
2501
2502   testpmd> set port meter vlan table (port_id) (mtr_id) (proto) \
2503   [(vlan_tbl_entry0) (vlan_tbl_entry1)...(vlan_tbl_entry15)]
2504
2505set port meter protocol
2506~~~~~~~~~~~~~~~~~~~~~~~
2507Set meter protocol and corresponding priority::
2508
2509   testpmd> set port meter proto (port_id) (mtr_id) (proto) (prio)
2510
2511get port meter protocol
2512~~~~~~~~~~~~~~~~~~~~~~~
2513Get meter protocol::
2514
2515   testpmd> get port meter proto (port_id) (mtr_id)
2516
2517get port meter protocol priority
2518~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2519Get priority associated to meter protocol::
2520
2521   testpmd> get port meter proto_prio (port_id) (mtr_id) (proto)
2522
2523set port meter stats mask
2524~~~~~~~~~~~~~~~~~~~~~~~~~
2525
2526Set meter stats mask for the ethernet device::
2527
2528   testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2529
2530where:
2531
2532* ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2533
2534show port meter stats
2535~~~~~~~~~~~~~~~~~~~~~
2536
2537Show meter stats of the ethernet device::
2538
2539   testpmd> show port meter stats (port_id) (mtr_id) (clear)
2540
2541where:
2542
2543* ``clear``: Flag that indicates whether the statistics counters should
2544  be cleared (i.e. set to zero) immediately after they have been read or not.
2545
2546Traffic Management
2547------------------
2548
2549The following section shows functions for configuring traffic management on
2550the ethernet device through the use of generic TM API.
2551
2552show port traffic management capability
2553~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2554
2555Show traffic management capability of the port::
2556
2557   testpmd> show port tm cap (port_id)
2558
2559show port traffic management capability (hierarchy level)
2560~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2561
2562Show traffic management hierarchy level capability of the port::
2563
2564   testpmd> show port tm level cap (port_id) (level_id)
2565
2566show port traffic management capability (hierarchy node level)
2567~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2568
2569Show the traffic management hierarchy node capability of the port::
2570
2571   testpmd> show port tm node cap (port_id) (node_id)
2572
2573show port traffic management hierarchy node type
2574~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2575
2576Show the port traffic management hierarchy node type::
2577
2578   testpmd> show port tm node type (port_id) (node_id)
2579
2580show port traffic management hierarchy node stats
2581~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2582
2583Show the port traffic management hierarchy node statistics::
2584
2585   testpmd> show port tm node stats (port_id) (node_id) (clear)
2586
2587where:
2588
2589* ``clear``: When this parameter has a non-zero value, the statistics counters
2590  are cleared (i.e. set to zero) immediately after they have been read,
2591  otherwise the statistics counters are left untouched.
2592
2593Add port traffic management private shaper profile
2594~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2595
2596Add the port traffic management private shaper profile::
2597
2598   testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
2599   (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
2600   (packet_length_adjust) (packet_mode)
2601
2602where:
2603
2604* ``shaper_profile id``: Shaper profile ID for the new profile.
2605* ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second).
2606* ``cmit_tb_size``: Committed token bucket size (bytes or packets).
2607* ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second).
2608* ``peak_tb_size``: Peak token bucket size (bytes or packets).
2609* ``packet_length_adjust``: The value (bytes) to be added to the length of
2610  each packet for the purpose of shaping. This parameter value can be used to
2611  correct the packet length with the framing overhead bytes that are consumed
2612  on the wire.
2613* ``packet_mode``: Shaper configured in packet mode. This parameter value if
2614  zero, configures shaper in byte mode and if non-zero configures it in packet
2615  mode.
2616
2617Delete port traffic management private shaper profile
2618~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2619
2620Delete the port traffic management private shaper::
2621
2622   testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
2623
2624where:
2625
2626* ``shaper_profile id``: Shaper profile ID that needs to be deleted.
2627
2628Add port traffic management shared shaper
2629~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2630
2631Create the port traffic management shared shaper::
2632
2633   testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \
2634   (shaper_profile_id)
2635
2636where:
2637
2638* ``shared_shaper_id``: Shared shaper ID to be created.
2639* ``shaper_profile id``: Shaper profile ID for shared shaper.
2640
2641Set port traffic management shared shaper
2642~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2643
2644Update the port traffic management shared shaper::
2645
2646   testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \
2647   (shaper_profile_id)
2648
2649where:
2650
2651* ``shared_shaper_id``: Shared shaper ID to be update.
2652* ``shaper_profile id``: Shaper profile ID for shared shaper.
2653
2654Delete port traffic management shared shaper
2655~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2656
2657Delete the port traffic management shared shaper::
2658
2659   testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
2660
2661where:
2662
2663* ``shared_shaper_id``: Shared shaper ID to be deleted.
2664
2665Set port traffic management hierarchy node private shaper
2666~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2667
2668set the port traffic management hierarchy node private shaper::
2669
2670   testpmd> set port tm node shaper profile (port_id) (node_id) \
2671   (shaper_profile_id)
2672
2673where:
2674
2675* ``shaper_profile id``: Private shaper profile ID to be enabled on the
2676  hierarchy node.
2677
2678Add port traffic management WRED profile
2679~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2680
2681Create a new WRED profile::
2682
2683   testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
2684   (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
2685   (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
2686   (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
2687
2688where:
2689
2690* ``wred_profile id``: Identifier for the newly create WRED profile
2691* ``color_g``: Packet color (green)
2692* ``min_th_g``: Minimum queue threshold for packet with green color
2693* ``max_th_g``: Minimum queue threshold for packet with green color
2694* ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp)
2695* ``wq_log2_g``: Negated log2 of queue weight (wq)
2696* ``color_y``: Packet color (yellow)
2697* ``min_th_y``: Minimum queue threshold for packet with yellow color
2698* ``max_th_y``: Minimum queue threshold for packet with yellow color
2699* ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp)
2700* ``wq_log2_y``: Negated log2 of queue weight (wq)
2701* ``color_r``: Packet color (red)
2702* ``min_th_r``: Minimum queue threshold for packet with yellow color
2703* ``max_th_r``: Minimum queue threshold for packet with yellow color
2704* ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp)
2705* ``wq_log2_r``: Negated log2 of queue weight (wq)
2706
2707Delete port traffic management WRED profile
2708~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2709
2710Delete the WRED profile::
2711
2712   testpmd> del port tm node wred profile (port_id) (wred_profile_id)
2713
2714Add port traffic management hierarchy nonleaf node
2715~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2716
2717Add nonleaf node to port traffic management hierarchy::
2718
2719   testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \
2720   (priority) (weight) (level_id) (shaper_profile_id) \
2721   (n_sp_priorities) (stats_mask) (n_shared_shapers) \
2722   [(shared_shaper_0) (shared_shaper_1) ...] \
2723
2724where:
2725
2726* ``parent_node_id``: Node ID of the parent.
2727* ``priority``: Node priority (highest node priority is zero). This is used by
2728  the SP algorithm running on the parent node for scheduling this node.
2729* ``weight``: Node weight (lowest weight is one). The node weight is relative
2730  to the weight sum of all siblings that have the same priority. It is used by
2731  the WFQ algorithm running on the parent node for scheduling this node.
2732* ``level_id``: Hierarchy level of the node.
2733* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2734  the node.
2735* ``n_sp_priorities``: Number of strict priorities.
2736* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2737* ``n_shared_shapers``: Number of shared shapers.
2738* ``shared_shaper_id``: Shared shaper id.
2739
2740Add port traffic management hierarchy nonleaf node with packet mode
2741~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2742
2743Add nonleaf node with packet mode to port traffic management hierarchy::
2744
2745   testpmd> add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id) \
2746   (priority) (weight) (level_id) (shaper_profile_id) \
2747   (n_sp_priorities) (stats_mask) (n_shared_shapers) \
2748   [(shared_shaper_0) (shared_shaper_1) ...] \
2749
2750where:
2751
2752* ``parent_node_id``: Node ID of the parent.
2753* ``priority``: Node priority (highest node priority is zero). This is used by
2754  the SP algorithm running on the parent node for scheduling this node.
2755* ``weight``: Node weight (lowest weight is one). The node weight is relative
2756  to the weight sum of all siblings that have the same priority. It is used by
2757  the WFQ algorithm running on the parent node for scheduling this node.
2758* ``level_id``: Hierarchy level of the node.
2759* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2760  the node.
2761* ``n_sp_priorities``: Number of strict priorities. Packet mode is enabled on
2762  all of them.
2763* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2764* ``n_shared_shapers``: Number of shared shapers.
2765* ``shared_shaper_id``: Shared shaper id.
2766
2767Add port traffic management hierarchy leaf node
2768~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2769
2770Add leaf node to port traffic management hierarchy::
2771
2772   testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \
2773   (priority) (weight) (level_id) (shaper_profile_id) \
2774   (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \
2775   [(shared_shaper_id) (shared_shaper_id) ...] \
2776
2777where:
2778
2779* ``parent_node_id``: Node ID of the parent.
2780* ``priority``: Node priority (highest node priority is zero). This is used by
2781  the SP algorithm running on the parent node for scheduling this node.
2782* ``weight``: Node weight (lowest weight is one). The node weight is relative
2783  to the weight sum of all siblings that have the same priority. It is used by
2784  the WFQ algorithm running on the parent node for scheduling this node.
2785* ``level_id``: Hierarchy level of the node.
2786* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2787  the node.
2788* ``cman_mode``: Congestion management mode to be enabled for this node.
2789* ``wred_profile_id``: WRED profile id to be enabled for this node.
2790* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2791* ``n_shared_shapers``: Number of shared shapers.
2792* ``shared_shaper_id``: Shared shaper id.
2793
2794Delete port traffic management hierarchy node
2795~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2796
2797Delete node from port traffic management hierarchy::
2798
2799   testpmd> del port tm node (port_id) (node_id)
2800
2801Update port traffic management hierarchy parent node
2802~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2803
2804Update port traffic management hierarchy parent node::
2805
2806   testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \
2807   (priority) (weight)
2808
2809This function can only be called after the hierarchy commit invocation. Its
2810success depends on the port support for this operation, as advertised through
2811the port capability set. This function is valid for all nodes of the traffic
2812management hierarchy except root node.
2813
2814Suspend port traffic management hierarchy node
2815~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2816
2817   testpmd> suspend port tm node (port_id) (node_id)
2818
2819Resume port traffic management hierarchy node
2820~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2821
2822   testpmd> resume port tm node (port_id) (node_id)
2823
2824Commit port traffic management hierarchy
2825~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2826
2827Commit the traffic management hierarchy on the port::
2828
2829   testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
2830
2831where:
2832
2833* ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function
2834  call failure. On the other hand, hierarchy is preserved when this parameter
2835  is equal to zero.
2836
2837Set port traffic management mark VLAN dei
2838~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2839
2840Enables/Disables the traffic management marking on the port for VLAN packets::
2841
2842   testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red>
2843
2844where:
2845
2846* ``port_id``: The port which on which VLAN packets marked as ``green`` or
2847  ``yellow`` or ``red`` will have dei bit enabled
2848
2849* ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green
2850
2851* ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow
2852
2853* ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red
2854
2855Set port traffic management mark IP dscp
2856~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2857
2858Enables/Disables the traffic management marking on the port for IP dscp packets::
2859
2860   testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red>
2861
2862where:
2863
2864* ``port_id``: The port which on which IP packets marked as ``green`` or
2865  ``yellow`` or ``red`` will have IP dscp bits updated
2866
2867* ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets
2868
2869* ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets
2870
2871* ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets
2872
2873Set port traffic management mark IP ecn
2874~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2875
2876Enables/Disables the traffic management marking on the port for IP ecn packets::
2877
2878   testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red>
2879
2880where:
2881
2882* ``port_id``: The port which on which IP packets marked as ``green`` or
2883  ``yellow`` or ``red`` will have IP ecn bits updated
2884
2885* ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01  or 2'b10
2886  to ecn of 2'b11 when IP is caring TCP or SCTP
2887
2888* ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
2889  to ecn of 2'b11 when IP is caring TCP or SCTP
2890
2891* ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
2892  to ecn of 2'b11 when IP is caring TCP or SCTP
2893
2894Congestion Management
2895---------------------
2896
2897Get capabilities
2898~~~~~~~~~~~~~~~~
2899
2900Retrieve congestion management capabilities supported by driver for given port.
2901Below example command retrieves capabilities for port 0::
2902
2903   testpmd> show port cman capa 0
2904
2905Get configuration
2906~~~~~~~~~~~~~~~~~
2907
2908Retrieve congestion management configuration for given port.
2909Below example command retrieves configuration for port 0::
2910
2911   testpmd> show port cman config 0
2912
2913Set configuration
2914~~~~~~~~~~~~~~~~~
2915
2916Configures congestion management settings on given queue
2917or mempool associated with queue.
2918Below example command configures RED as congestion management algorithm
2919for port 0 and queue 0::
2920
2921   testpmd> set port cman config 0 0 obj queue mode red 10 100 1
2922
2923Filter Functions
2924----------------
2925
2926This section details the available filter functions that are available.
2927
2928Note these functions interface the deprecated legacy filtering framework,
2929superseded by *rte_flow*. See `Flow rules management`_.
2930
2931.. _testpmd_rte_flow:
2932
2933Flow rules management
2934---------------------
2935
2936Control of the generic flow API (*rte_flow*) is fully exposed through the
2937``flow`` command (configuration, validation, creation, destruction, queries
2938and operation modes).
2939
2940Considering *rte_flow* overlaps with all `Filter Functions`_, using both
2941features simultaneously may cause undefined side-effects and is therefore
2942not recommended.
2943
2944``flow`` syntax
2945~~~~~~~~~~~~~~~
2946
2947Because the ``flow`` command uses dynamic tokens to handle the large number
2948of possible flow rules combinations, its behavior differs slightly from
2949other commands, in particular:
2950
2951- Pressing *?* or the *<tab>* key displays contextual help for the current
2952  token, not that of the entire command.
2953
2954- Optional and repeated parameters are supported (provided they are listed
2955  in the contextual help).
2956
2957The first parameter stands for the operation mode. Possible operations and
2958their general syntax are described below. They are covered in detail in the
2959following sections.
2960
2961- Get info about flow engine::
2962
2963   flow info {port_id}
2964
2965- Configure flow engine::
2966
2967   flow configure {port_id}
2968       [queues_number {number}] [queues_size {size}]
2969       [counters_number {number}]
2970       [aging_counters_number {number}]
2971       [meters_number {number}] [flags {number}]
2972
2973- Create a pattern template::
2974
2975   flow pattern_template {port_id} create [pattern_template_id {id}]
2976       [relaxed {boolean}] [ingress] [egress] [transfer]
2977       template {item} [/ {item} [...]] / end
2978
2979- Destroy a pattern template::
2980
2981   flow pattern_template {port_id} destroy pattern_template {id} [...]
2982
2983- Create an actions template::
2984
2985   flow actions_template {port_id} create [actions_template_id {id}]
2986       [ingress] [egress] [transfer]
2987       template {action} [/ {action} [...]] / end
2988       mask {action} [/ {action} [...]] / end
2989
2990- Destroy an actions template::
2991
2992   flow actions_template {port_id} destroy actions_template {id} [...]
2993
2994- Create a table::
2995
2996   flow table {port_id} create
2997       [table_id {id}]
2998       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
2999       rules_number {number}
3000       pattern_template {pattern_template_id}
3001       actions_template {actions_template_id}
3002
3003- Destroy a table::
3004
3005   flow table {port_id} destroy table {id} [...]
3006
3007- Check whether a flow rule can be created::
3008
3009   flow validate {port_id}
3010       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3011       pattern {item} [/ {item} [...]] / end
3012       actions {action} [/ {action} [...]] / end
3013
3014- Enqueue creation of a flow rule::
3015
3016   flow queue {port_id} create {queue_id}
3017       [postpone {boolean}] template_table {table_id}
3018       pattern_template {pattern_template_index}
3019       actions_template {actions_template_index}
3020       pattern {item} [/ {item} [...]] / end
3021       actions {action} [/ {action} [...]] / end
3022
3023- Enqueue destruction of specific flow rules::
3024
3025   flow queue {port_id} destroy {queue_id}
3026       [postpone {boolean}] rule {rule_id} [...]
3027
3028- Push enqueued operations::
3029
3030   flow push {port_id} queue {queue_id}
3031
3032- Pull all operations results from a queue::
3033
3034   flow pull {port_id} queue {queue_id}
3035
3036- Create a flow rule::
3037
3038   flow create {port_id}
3039       [group {group_id}] [priority {level}] [ingress] [egress]
3040       [transfer] [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}]
3041       [user_id {user_id}] pattern {item} [/ {item} [...]] / end
3042       actions {action} [/ {action} [...]] / end
3043
3044- Destroy specific flow rules::
3045
3046   flow destroy {port_id} rule {rule_id} [...] [user_id]
3047
3048- Destroy all flow rules::
3049
3050   flow flush {port_id}
3051
3052- Query an existing flow rule::
3053
3054   flow query {port_id} {rule_id} {action} [user_id]
3055
3056- List existing flow rules sorted by priority, filtered by group
3057  identifiers::
3058
3059   flow list {port_id} [group {group_id}] [...]
3060
3061- Restrict ingress traffic to the defined flow rules::
3062
3063   flow isolate {port_id} {boolean}
3064
3065- Dump internal representation information of all flows in hardware::
3066
3067   flow dump {port_id} all {output_file} [user_id]
3068
3069  for one flow::
3070
3071   flow dump {port_id} rule {rule_id} {output_file} [user_id]
3072
3073- List and destroy aged flow rules::
3074
3075   flow aged {port_id} [destroy]
3076
3077- Enqueue list and destroy aged flow rules::
3078
3079   flow queue {port_id} aged {queue_id} [destroy]
3080
3081- Tunnel offload - create a tunnel stub::
3082
3083   flow tunnel create {port_id} type {tunnel_type}
3084
3085- Tunnel offload - destroy a tunnel stub::
3086
3087   flow tunnel destroy {port_id} id {tunnel_id}
3088
3089- Tunnel offload - list port tunnel stubs::
3090
3091   flow tunnel list {port_id}
3092
3093Retrieving info about flow management engine
3094~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3095
3096``flow info`` retrieves info on pre-configurable resources in the underlying
3097device to give a hint of possible values for flow engine configuration.
3098
3099``rte_flow_info_get()``::
3100
3101   flow info {port_id}
3102
3103If successful, it will show::
3104
3105   Flow engine resources on port #[...]:
3106   Number of queues: #[...]
3107   Size of queues: #[...]
3108   Number of counters: #[...]
3109   Number of aging objects: #[...]
3110   Number of meters: #[...]
3111
3112Otherwise it will show an error message of the form::
3113
3114   Caught error type [...] ([...]): [...]
3115
3116Configuring flow management engine
3117~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3118
3119``flow configure`` pre-allocates all the needed resources in the underlying
3120device to be used later at the flow creation. Flow queues are allocated as well
3121for asynchronous flow creation/destruction operations. It is bound to
3122``rte_flow_configure()``::
3123
3124   flow configure {port_id}
3125       [queues_number {number}] [queues_size {size}]
3126       [counters_number {number}]
3127       [aging_counters_number {number}]
3128       [host_port {number}]
3129       [meters_number {number}]
3130       [flags {number}]
3131
3132If successful, it will show::
3133
3134   Configure flows on port #[...]: number of queues #[...] with #[...] elements
3135
3136Otherwise it will show an error message of the form::
3137
3138   Caught error type [...] ([...]): [...]
3139
3140Creating pattern templates
3141~~~~~~~~~~~~~~~~~~~~~~~~~~
3142
3143``flow pattern_template create`` creates the specified pattern template.
3144It is bound to ``rte_flow_pattern_template_create()``::
3145
3146   flow pattern_template {port_id} create [pattern_template_id {id}]
3147       [relaxed {boolean}] [ingress] [egress] [transfer]
3148	   template {item} [/ {item} [...]] / end
3149
3150If successful, it will show::
3151
3152   Pattern template #[...] created
3153
3154Otherwise it will show an error message of the form::
3155
3156   Caught error type [...] ([...]): [...]
3157
3158This command uses the same pattern items as ``flow create``,
3159their format is described in `Creating flow rules`_.
3160
3161Destroying pattern templates
3162~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3163
3164``flow pattern_template destroy`` destroys one or more pattern templates
3165from their template ID (as returned by ``flow pattern_template create``),
3166this command calls ``rte_flow_pattern_template_destroy()`` as many
3167times as necessary::
3168
3169   flow pattern_template {port_id} destroy pattern_template {id} [...]
3170
3171If successful, it will show::
3172
3173   Pattern template #[...] destroyed
3174
3175It does not report anything for pattern template IDs that do not exist.
3176The usual error message is shown when a pattern template cannot be destroyed::
3177
3178   Caught error type [...] ([...]): [...]
3179
3180Creating actions templates
3181~~~~~~~~~~~~~~~~~~~~~~~~~~
3182
3183``flow actions_template create`` creates the specified actions template.
3184It is bound to ``rte_flow_actions_template_create()``::
3185
3186   flow actions_template {port_id} create [actions_template_id {id}]
3187       [ingress] [egress] [transfer]
3188	   template {action} [/ {action} [...]] / end
3189       mask {action} [/ {action} [...]] / end
3190
3191If successful, it will show::
3192
3193   Actions template #[...] created
3194
3195Otherwise it will show an error message of the form::
3196
3197   Caught error type [...] ([...]): [...]
3198
3199This command uses the same actions as ``flow create``,
3200their format is described in `Creating flow rules`_.
3201
3202Destroying actions templates
3203~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3204
3205``flow actions_template destroy`` destroys one or more actions templates
3206from their template ID (as returned by ``flow actions_template create``),
3207this command calls ``rte_flow_actions_template_destroy()`` as many
3208times as necessary::
3209
3210   flow actions_template {port_id} destroy actions_template {id} [...]
3211
3212If successful, it will show::
3213
3214   Actions template #[...] destroyed
3215
3216It does not report anything for actions template IDs that do not exist.
3217The usual error message is shown when an actions template cannot be destroyed::
3218
3219   Caught error type [...] ([...]): [...]
3220
3221Creating template table
3222~~~~~~~~~~~~~~~~~~~~~~~
3223
3224``flow template_table create`` creates the specified template table.
3225It is bound to ``rte_flow_template_table_create()``::
3226
3227   flow template_table {port_id} create
3228       [table_id {id}] [group {group_id}]
3229       [priority {level}] [ingress] [egress]
3230       [transfer [vport_orig] [wire_orig]]
3231       rules_number {number}
3232       pattern_template {pattern_template_id}
3233       actions_template {actions_template_id}
3234
3235If successful, it will show::
3236
3237   Template table #[...] created
3238
3239Otherwise it will show an error message of the form::
3240
3241   Caught error type [...] ([...]): [...]
3242
3243Destroying flow table
3244~~~~~~~~~~~~~~~~~~~~~
3245
3246``flow template_table destroy`` destroys one or more template tables
3247from their table ID (as returned by ``flow template_table create``),
3248this command calls ``rte_flow_template_table_destroy()`` as many
3249times as necessary::
3250
3251   flow template_table {port_id} destroy table {id} [...]
3252
3253If successful, it will show::
3254
3255   Template table #[...] destroyed
3256
3257It does not report anything for table IDs that do not exist.
3258The usual error message is shown when a table cannot be destroyed::
3259
3260   Caught error type [...] ([...]): [...]
3261
3262Pushing enqueued operations
3263~~~~~~~~~~~~~~~~~~~~~~~~~~~
3264
3265``flow push`` pushes all the outstanding enqueued operations
3266to the underlying device immediately.
3267It is bound to ``rte_flow_push()``::
3268
3269   flow push {port_id} queue {queue_id}
3270
3271If successful, it will show::
3272
3273   Queue #[...] operations pushed
3274
3275The usual error message is shown when operations cannot be pushed::
3276
3277   Caught error type [...] ([...]): [...]
3278
3279Pulling flow operations results
3280~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3281
3282``flow pull`` asks the underlying device about flow queue operations
3283results and return all the processed (successfully or not) operations.
3284It is bound to ``rte_flow_pull()``::
3285
3286   flow pull {port_id} queue {queue_id}
3287
3288If successful, it will show::
3289
3290   Queue #[...] pulled #[...] operations (#[...] failed, #[...] succeeded)
3291
3292The usual error message is shown when operations results cannot be pulled::
3293
3294   Caught error type [...] ([...]): [...]
3295
3296Calculating hash
3297~~~~~~~~~~~~~~~~
3298
3299``flow hash`` calculates the hash for a given pattern.
3300It is bound to ``rte_flow_calc_table_hash()``::
3301
3302   flow hash {port_id} template_table {table_id}
3303       pattern_template {pattern_template_index}
3304       actions_template {actions_template_index}
3305       pattern {item} [/ {item} [...]] / end
3306
3307If successful, it will show the calculated hash result as seen below::
3308
3309   Hash results 0x[...]
3310
3311Otherwise, it will show an error message of the form::
3312
3313   Caught error type [...] ([...]): [...]
3314
3315This command uses the same pattern items as ``flow create``,
3316their format is described in `Creating flow rules`_.
3317
3318Creating a tunnel stub for offload
3319~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3320
3321``flow tunnel create`` setup a tunnel stub for tunnel offload flow rules::
3322
3323   flow tunnel create {port_id} type {tunnel_type}
3324
3325If successful, it will return a tunnel stub ID usable with other commands::
3326
3327   port [...]: flow tunnel #[...] type [...]
3328
3329Tunnel stub ID is relative to a port.
3330
3331Destroying tunnel offload stub
3332~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3333
3334``flow tunnel destroy`` destroy port tunnel stub::
3335
3336   flow tunnel destroy {port_id} id {tunnel_id}
3337
3338Listing tunnel offload stubs
3339~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3340
3341``flow tunnel list`` list port tunnel offload stubs::
3342
3343   flow tunnel list {port_id}
3344
3345Validating flow rules
3346~~~~~~~~~~~~~~~~~~~~~
3347
3348``flow validate`` reports whether a flow rule would be accepted by the
3349underlying device in its current state but stops short of creating it. It is
3350bound to ``rte_flow_validate()``::
3351
3352   flow validate {port_id}
3353      [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3354      pattern {item} [/ {item} [...]] / end
3355      actions {action} [/ {action} [...]] / end
3356
3357If successful, it will show::
3358
3359   Flow rule validated
3360
3361Otherwise it will show an error message of the form::
3362
3363   Caught error type [...] ([...]): [...]
3364
3365This command uses the same parameters as ``flow create``, their format is
3366described in `Creating flow rules`_.
3367
3368Check whether redirecting any Ethernet packet received on port 0 to RX queue
3369index 6 is supported::
3370
3371   testpmd> flow validate 0 ingress pattern eth / end
3372      actions queue index 6 / end
3373   Flow rule validated
3374   testpmd>
3375
3376Port 0 does not support TCPv6 rules::
3377
3378   testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end
3379      actions drop / end
3380   Caught error type 9 (specific pattern item): Invalid argument
3381   testpmd>
3382
3383Creating flow rules
3384~~~~~~~~~~~~~~~~~~~
3385
3386``flow create`` validates and creates the specified flow rule. It is bound
3387to ``rte_flow_create()``::
3388
3389   flow create {port_id}
3390      [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3391      [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}]
3392      [user_id {user_id}] pattern {item} [/ {item} [...]] / end
3393      actions {action} [/ {action} [...]] / end
3394
3395If successful, it will return a flow rule ID usable with other commands::
3396
3397   Flow rule #[...] created
3398
3399Or if ``user_id`` is provided::
3400
3401   Flow rule #[...] created, user-id [...]
3402
3403Otherwise it will show an error message of the form::
3404
3405   Caught error type [...] ([...]): [...]
3406
3407Parameters describe in the following order:
3408
3409- Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens).
3410- Tunnel offload specification (tunnel_set, tunnel_match)
3411- User identifier for the flow.
3412- A matching pattern, starting with the *pattern* token and terminated by an
3413  *end* pattern item.
3414- Actions, starting with the *actions* token and terminated by an *end*
3415  action.
3416
3417These translate directly to *rte_flow* objects provided as-is to the
3418underlying functions.
3419
3420The shortest valid definition only comprises mandatory tokens::
3421
3422   testpmd> flow create 0 pattern end actions end
3423
3424Note that PMDs may refuse rules that essentially do nothing such as this
3425one.
3426
3427**All unspecified object values are automatically initialized to 0.**
3428
3429Enqueueing creation of flow rules
3430~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3431
3432``flow queue create`` adds creation operation of a flow rule to a queue.
3433It is bound to ``rte_flow_async_create()``::
3434
3435   flow queue {port_id} create {queue_id}
3436       [postpone {boolean}] template_table {table_id}
3437       pattern_template {pattern_template_index}
3438       actions_template {actions_template_index}
3439       pattern {item} [/ {item} [...]] / end
3440       actions {action} [/ {action} [...]] / end
3441
3442If successful, it will return a flow rule ID usable with other commands::
3443
3444   Flow rule #[...] creaion enqueued
3445
3446Otherwise it will show an error message of the form::
3447
3448   Caught error type [...] ([...]): [...]
3449
3450This command uses the same pattern items and actions as ``flow create``,
3451their format is described in `Creating flow rules`_.
3452
3453``flow queue pull`` must be called to retrieve the operation status.
3454
3455Attributes
3456^^^^^^^^^^
3457
3458These tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3459specified before the ``pattern`` token.
3460
3461- ``group {group id}``: priority group.
3462- ``priority {level}``: priority level within group.
3463- ``ingress``: rule applies to ingress traffic.
3464- ``egress``: rule applies to egress traffic.
3465- ``transfer``: apply rule directly to endpoints found in pattern.
3466
3467Please note that use of ``transfer`` attribute requires that the flow and
3468its indirect components be managed via so-called ``transfer`` proxy port.
3469See `show flow transfer proxy port ID for the given port`_ for details.
3470
3471Each instance of an attribute specified several times overrides the previous
3472value as shown below (group 4 is used)::
3473
3474   testpmd> flow create 0 group 42 group 24 group 4 [...]
3475
3476Note that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3477
3478While not specifying a direction is an error, some rules may allow both
3479simultaneously.
3480
3481Most rules affect RX therefore contain the ``ingress`` token::
3482
3483   testpmd> flow create 0 ingress pattern [...]
3484
3485Tunnel offload
3486^^^^^^^^^^^^^^
3487
3488Indicate tunnel offload rule type
3489
3490- ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type.
3491- ``tunnel_match {tunnel_id}``:  mark rule as tunnel offload match type.
3492
3493Matching pattern
3494^^^^^^^^^^^^^^^^
3495
3496A matching pattern starts after the ``pattern`` token. It is made of pattern
3497items and is terminated by a mandatory ``end`` item.
3498
3499Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3500rte_flow_item_type``).
3501
3502The ``/`` token is used as a separator between pattern items as shown
3503below::
3504
3505   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3506
3507Note that protocol items like these must be stacked from lowest to highest
3508layer to make sense. For instance, the following rule is either invalid or
3509unlikely to match any packet::
3510
3511   testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3512
3513More information on these restrictions can be found in the *rte_flow*
3514documentation.
3515
3516Several items support additional specification structures, for example
3517``ipv4`` allows specifying source and destination addresses as follows::
3518
3519   testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1
3520      dst is 10.2.0.0 / end [...]
3521
3522This rule matches all IPv4 traffic with the specified properties.
3523
3524In this example, ``src`` and ``dst`` are field names of the underlying
3525``struct rte_flow_item_ipv4`` object. All item properties can be specified
3526in a similar fashion.
3527
3528The ``is`` token means that the subsequent value must be matched exactly,
3529and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3530accordingly. Possible assignment tokens are:
3531
3532- ``is``: match value perfectly (with full bit-mask).
3533- ``spec``: match value according to configured bit-mask.
3534- ``last``: specify upper bound to establish a range.
3535- ``mask``: specify bit-mask with relevant bits set to one.
3536- ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one.
3537
3538These yield identical results::
3539
3540   ipv4 src is 10.1.1.1
3541
3542::
3543
3544   ipv4 src spec 10.1.1.1 src mask 255.255.255.255
3545
3546::
3547
3548   ipv4 src spec 10.1.1.1 src prefix 32
3549
3550::
3551
3552   ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value
3553
3554::
3555
3556   ipv4 src is 10.1.1.1 src last 0 # 0 disables range
3557
3558Inclusive ranges can be defined with ``last``::
3559
3560   ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4
3561
3562Note that ``mask`` affects both ``spec`` and ``last``::
3563
3564   ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0
3565      # matches 10.1.0.0 to 10.2.255.255
3566
3567Properties can be modified multiple times::
3568
3569   ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4
3570
3571::
3572
3573   ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16
3574
3575Pattern items
3576^^^^^^^^^^^^^
3577
3578This section lists supported pattern items and their attributes, if any.
3579
3580- ``end``: end list of pattern items.
3581
3582- ``void``: no-op pattern item.
3583
3584- ``invert``: perform actions when pattern does not match.
3585
3586- ``any``: match any protocol for the current layer.
3587
3588  - ``num {unsigned}``: number of layers covered.
3589
3590- ``port_id``: match traffic from/to a given DPDK port ID.
3591
3592  - ``id {unsigned}``: DPDK port ID.
3593
3594- ``mark``: match value set in previously matched flow rule using the mark action.
3595
3596  - ``id {unsigned}``: arbitrary integer value.
3597
3598- ``raw``: match an arbitrary byte string.
3599
3600  - ``relative {boolean}``: look for pattern after the previous item.
3601  - ``search {boolean}``: search pattern from offset (see also limit).
3602  - ``offset {integer}``: absolute or relative offset for pattern.
3603  - ``limit {unsigned}``: search area limit for start of pattern.
3604  - ``pattern {string}``: byte string to look for.
3605  - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for.
3606
3607- ``eth``: match Ethernet header.
3608
3609  - ``dst {MAC-48}``: destination MAC.
3610  - ``src {MAC-48}``: source MAC.
3611  - ``type {unsigned}``: EtherType or TPID.
3612
3613- ``vlan``: match 802.1Q/ad VLAN tag.
3614
3615  - ``tci {unsigned}``: tag control information.
3616  - ``pcp {unsigned}``: priority code point.
3617  - ``dei {unsigned}``: drop eligible indicator.
3618  - ``vid {unsigned}``: VLAN identifier.
3619  - ``inner_type {unsigned}``: inner EtherType or TPID.
3620
3621- ``ipv4``: match IPv4 header.
3622
3623  - ``version_ihl {unsigned}``: IPv4 version and IP header length.
3624  - ``tos {unsigned}``: type of service.
3625  - ``ttl {unsigned}``: time to live.
3626  - ``proto {unsigned}``: next protocol ID.
3627  - ``src {ipv4 address}``: source address.
3628  - ``dst {ipv4 address}``: destination address.
3629
3630- ``ipv6``: match IPv6 header.
3631
3632  - ``tc {unsigned}``: traffic class.
3633  - ``flow {unsigned}``: flow label.
3634  - ``proto {unsigned}``: protocol (next header).
3635  - ``hop {unsigned}``: hop limit.
3636  - ``src {ipv6 address}``: source address.
3637  - ``dst {ipv6 address}``: destination address.
3638
3639- ``icmp``: match ICMP header.
3640
3641  - ``type {unsigned}``: ICMP packet type.
3642  - ``code {unsigned}``: ICMP packet code.
3643
3644- ``udp``: match UDP header.
3645
3646  - ``src {unsigned}``: UDP source port.
3647  - ``dst {unsigned}``: UDP destination port.
3648
3649- ``tcp``: match TCP header.
3650
3651  - ``src {unsigned}``: TCP source port.
3652  - ``dst {unsigned}``: TCP destination port.
3653
3654- ``sctp``: match SCTP header.
3655
3656  - ``src {unsigned}``: SCTP source port.
3657  - ``dst {unsigned}``: SCTP destination port.
3658  - ``tag {unsigned}``: validation tag.
3659  - ``cksum {unsigned}``: checksum.
3660
3661- ``vxlan``: match VXLAN header.
3662
3663  - ``vni {unsigned}``: VXLAN identifier.
3664  - ``last_rsvd {unsigned}``: VXLAN last reserved 8-bits.
3665
3666- ``e_tag``: match IEEE 802.1BR E-Tag header.
3667
3668  - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
3669
3670- ``nvgre``: match NVGRE header.
3671
3672  - ``tni {unsigned}``: virtual subnet ID.
3673
3674- ``mpls``: match MPLS header.
3675
3676  - ``label {unsigned}``: MPLS label.
3677
3678- ``gre``: match GRE header.
3679
3680  - ``protocol {unsigned}``: protocol type.
3681
3682- ``gre_key``: match GRE optional key field.
3683
3684  - ``value {unsigned}``: key value.
3685
3686- ``gre_option``: match GRE optional fields(checksum/key/sequence).
3687
3688  - ``checksum {unsigned}``: checksum value.
3689  - ``key {unsigned}``: key value.
3690  - ``sequence {unsigned}``: sequence number value.
3691
3692- ``fuzzy``: fuzzy pattern match, expect faster than default.
3693
3694  - ``thresh {unsigned}``: accuracy threshold.
3695
3696- ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header.
3697
3698  - ``teid {unsigned}``: tunnel endpoint identifier.
3699
3700- ``geneve``: match GENEVE header.
3701
3702  - ``vni {unsigned}``: virtual network identifier.
3703  - ``protocol {unsigned}``: protocol type.
3704
3705- ``geneve-opt``: match GENEVE header option.
3706
3707  - ``class {unsigned}``: GENEVE option class.
3708  - ``type {unsigned}``: GENEVE option type.
3709  - ``length {unsigned}``: GENEVE option length in 32-bit words.
3710  - ``data {hex string}``: GENEVE option data, the length is defined by
3711    ``length`` field.
3712
3713- ``vxlan-gpe``: match VXLAN-GPE header.
3714
3715  - ``vni {unsigned}``: VXLAN-GPE identifier.
3716
3717- ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4.
3718
3719  - ``sha {MAC-48}``: sender hardware address.
3720  - ``spa {ipv4 address}``: sender IPv4 address.
3721  - ``tha {MAC-48}``: target hardware address.
3722  - ``tpa {ipv4 address}``: target IPv4 address.
3723
3724- ``ipv6_ext``: match presence of any IPv6 extension header.
3725
3726  - ``next_hdr {unsigned}``: next header.
3727
3728- ``icmp6``: match any ICMPv6 header.
3729
3730  - ``type {unsigned}``: ICMPv6 type.
3731  - ``code {unsigned}``: ICMPv6 code.
3732
3733- ``icmp6_echo_request``: match ICMPv6 echo request.
3734
3735  - ``ident {unsigned}``: ICMPv6 echo request identifier.
3736  - ``seq {unsigned}``: ICMPv6 echo request sequence number.
3737
3738- ``icmp6_echo_reply``: match ICMPv6 echo reply.
3739
3740  - ``ident {unsigned}``: ICMPv6 echo reply identifier.
3741  - ``seq {unsigned}``: ICMPv6 echo reply sequence number.
3742
3743- ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
3744
3745  - ``target_addr {ipv6 address}``: target address.
3746
3747- ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement.
3748
3749  - ``target_addr {ipv6 address}``: target address.
3750
3751- ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option.
3752
3753  - ``type {unsigned}``: ND option type.
3754
3755- ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet
3756  link-layer address option.
3757
3758  - ``sla {MAC-48}``: source Ethernet LLA.
3759
3760- ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet
3761  link-layer address option.
3762
3763  - ``tla {MAC-48}``: target Ethernet LLA.
3764
3765- ``meta``: match application specific metadata.
3766
3767  - ``data {unsigned}``: metadata value.
3768
3769- ``random``: match application specific random value.
3770
3771  - ``value {unsigned}``: random value.
3772
3773- ``gtp_psc``: match GTP PDU extension header with type 0x85.
3774
3775  - ``pdu_type {unsigned}``: PDU type.
3776
3777  - ``qfi {unsigned}``: QoS flow identifier.
3778
3779- ``pppoes``, ``pppoed``: match PPPoE header.
3780
3781  - ``session_id {unsigned}``: session identifier.
3782
3783- ``pppoe_proto_id``: match PPPoE session protocol identifier.
3784
3785  - ``proto_id {unsigned}``: PPP protocol identifier.
3786
3787- ``l2tpv3oip``: match L2TPv3 over IP header.
3788
3789  - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
3790
3791- ``ah``: match AH header.
3792
3793  - ``spi {unsigned}``: security parameters index.
3794
3795- ``pfcp``: match PFCP header.
3796
3797  - ``s_field {unsigned}``: S field.
3798  - ``seid {unsigned}``: session endpoint identifier.
3799
3800- ``integrity``: match packet integrity.
3801
3802   - ``level {unsigned}``: Packet encapsulation level the item should
3803     apply to. See rte_flow_action_rss for details.
3804   - ``value {unsigned}``: A bitmask that specify what packet elements
3805     must be matched for integrity.
3806
3807- ``conntrack``: match conntrack state.
3808
3809- ``port_representor``: match traffic entering the embedded switch from the given ethdev
3810
3811  - ``port_id {unsigned}``: ethdev port ID
3812
3813- ``represented_port``: match traffic entering the embedded switch from
3814  the entity represented by the given ethdev
3815
3816  - ``ethdev_port_id {unsigned}``: ethdev port ID
3817
3818- ``l2tpv2``: match L2TPv2 header.
3819
3820  - ``length {unsigned}``: L2TPv2 option length.
3821  - ``tunnel_id {unsigned}``: L2TPv2 tunnel identifier.
3822  - ``session_id {unsigned}``: L2TPv2 session identifier.
3823  - ``ns {unsigned}``: L2TPv2 option ns.
3824  - ``nr {unsigned}``: L2TPv2 option nr.
3825  - ``offset_size {unsigned}``: L2TPv2 option offset.
3826
3827- ``ppp``: match PPP header.
3828
3829  - ``addr {unsigned}``: PPP address.
3830  - ``ctrl {unsigned}``: PPP control.
3831  - ``proto_id {unsigned}``: PPP protocol identifier.
3832
3833- ``ib_bth``: match InfiniBand BTH(base transport header).
3834
3835  - ``opcode {unsigned}``: Opcode.
3836  - ``pkey {unsigned}``: Partition key.
3837  - ``dst_qp {unsigned}``: Destination Queue Pair.
3838  - ``psn {unsigned}``: Packet Sequence Number.
3839
3840- ``meter``: match meter color.
3841
3842  - ``color {value}``: meter color value (green/yellow/red).
3843
3844- ``aggr_affinity``: match aggregated port.
3845
3846  - ``affinity {value}``: aggregated port (starts from 1).
3847
3848- ``tx_queue``: match Tx queue of sent packet.
3849
3850  - ``tx_queue {value}``: send queue value (starts from 0).
3851
3852- ``send_to_kernel``: send packets to kernel.
3853
3854- ``ptype``: match the packet type (L2/L3/L4 and tunnel information).
3855
3856        - ``packet_type {unsigned}``: packet type.
3857
3858
3859Actions list
3860^^^^^^^^^^^^
3861
3862A list of actions starts after the ``actions`` token in the same fashion as
3863`Matching pattern`_; actions are separated by ``/`` tokens and the list is
3864terminated by a mandatory ``end`` action.
3865
3866Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
3867rte_flow_action_type``).
3868
3869Dropping all incoming UDPv4 packets can be expressed as follows::
3870
3871   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3872      actions drop / end
3873
3874Several actions have configurable properties which must be specified when
3875there is no valid default value. For example, ``queue`` requires a target
3876queue index.
3877
3878This rule redirects incoming UDPv4 traffic to queue index 6::
3879
3880   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3881      actions queue index 6 / end
3882
3883While this one could be rejected by PMDs (unspecified queue index)::
3884
3885   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3886      actions queue / end
3887
3888As defined by *rte_flow*, the list is not ordered, all actions of a given
3889rule are performed simultaneously. These are equivalent::
3890
3891   queue index 6 / void / mark id 42 / end
3892
3893::
3894
3895   void / mark id 42 / queue index 6 / end
3896
3897All actions in a list should have different types, otherwise only the last
3898action of a given type is taken into account::
3899
3900   queue index 4 / queue index 5 / queue index 6 / end # will use queue 6
3901
3902::
3903
3904   drop / drop / drop / end # drop is performed only once
3905
3906::
3907
3908   mark id 42 / queue index 3 / mark id 24 / end # mark will be 24
3909
3910Considering they are performed simultaneously, opposite and overlapping
3911actions can sometimes be combined when the end result is unambiguous::
3912
3913   drop / queue index 6 / end # drop has no effect
3914
3915::
3916
3917   queue index 6 / rss queues 6 7 8 / end # queue has no effect
3918
3919::
3920
3921   drop / passthru / end # drop has no effect
3922
3923Note that PMDs may still refuse such combinations.
3924
3925Actions
3926^^^^^^^
3927
3928This section lists supported actions and their attributes, if any.
3929
3930- ``end``: end list of actions.
3931
3932- ``void``: no-op action.
3933
3934- ``passthru``: let subsequent rule process matched packets.
3935
3936- ``jump``: redirect traffic to group on device.
3937
3938  - ``group {unsigned}``: group to redirect to.
3939
3940- ``mark``: attach 32 bit value to packets.
3941
3942  - ``id {unsigned}``: 32 bit value to return with packets.
3943
3944- ``flag``: flag packets.
3945
3946- ``queue``: assign packets to a given queue index.
3947
3948  - ``index {unsigned}``: queue index to use.
3949
3950- ``drop``: drop packets (note: passthru has priority).
3951
3952- ``count``: enable counters for this rule.
3953
3954- ``rss``: spread packets among several queues.
3955
3956  - ``func {hash function}``: RSS hash function to apply, allowed tokens are
3957    ``toeplitz``, ``simple_xor``, ``symmetric_toeplitz`` and ``default``.
3958
3959  - ``level {unsigned}``: encapsulation level for ``types``.
3960
3961  - ``types [{RSS hash type} [...]] end``: specific RSS hash types.
3962    Note that an empty list does not disable RSS but instead requests
3963    unspecified "best-effort" settings.
3964
3965  - ``key {string}``: RSS hash key, overrides ``key_len``.
3966
3967  - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in
3968    conjunction with ``key`` to pad or truncate it.
3969
3970  - ``queues [{unsigned} [...]] end``: queue indices to use.
3971
3972- ``pf``: direct traffic to physical function.
3973
3974- ``vf``: direct traffic to a virtual function ID.
3975
3976  - ``original {boolean}``: use original VF ID if possible.
3977  - ``id {unsigned}``: VF ID.
3978
3979- ``port_id``: direct matching traffic to a given DPDK port ID.
3980
3981  - ``original {boolean}``: use original DPDK port ID if possible.
3982  - ``id {unsigned}``: DPDK port ID.
3983
3984- ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``.
3985
3986  - ``mpls_ttl``: MPLS TTL.
3987
3988- ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``.
3989
3990- ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``.
3991
3992  - ``nw_ttl``: IP TTL.
3993
3994- ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``.
3995
3996- ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``.
3997
3998- ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``.
3999
4000- ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``.
4001
4002- ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``.
4003
4004  - ``ethertype``: Ethertype.
4005
4006- ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``.
4007
4008  - ``vlan_vid``: VLAN id.
4009
4010- ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``.
4011
4012  - ``vlan_pcp``: VLAN priority.
4013
4014- ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``.
4015
4016  - ``ethertype``: Ethertype.
4017
4018- ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``.
4019
4020  - ``ethertype``: Ethertype.
4021
4022- ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration
4023  is done through `Config VXLAN Encap outer layers`_.
4024
4025- ``vxlan_decap``: Performs a decapsulation action by stripping all headers of
4026  the VXLAN tunnel network overlay from the matched flow.
4027
4028- ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration
4029  is done through `Config NVGRE Encap outer layers`_.
4030
4031- ``nvgre_decap``: Performs a decapsulation action by stripping all headers of
4032  the NVGRE tunnel network overlay from the matched flow.
4033
4034- ``l2_encap``: Performs a L2 encapsulation, L2 configuration
4035  is done through `Config L2 Encap`_.
4036
4037- ``l2_decap``: Performs a L2 decapsulation, L2 configuration
4038  is done through `Config L2 Decap`_.
4039
4040- ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer
4041  configuration is done through `Config MPLSoGRE Encap outer layers`_.
4042
4043- ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer
4044  configuration is done through `Config MPLSoGRE Decap outer layers`_.
4045
4046- ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer
4047  configuration is done through `Config MPLSoUDP Encap outer layers`_.
4048
4049- ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer
4050  configuration is done through `Config MPLSoUDP Decap outer layers`_.
4051
4052- ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header.
4053
4054  - ``ipv4_addr``: New IPv4 source address.
4055
4056- ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4
4057  header.
4058
4059  - ``ipv4_addr``: New IPv4 destination address.
4060
4061- ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header.
4062
4063  - ``ipv6_addr``: New IPv6 source address.
4064
4065- ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6
4066  header.
4067
4068  - ``ipv6_addr``: New IPv6 destination address.
4069
4070- ``set_tp_src``: Set a new source port number in the outermost TCP/UDP
4071  header.
4072
4073  - ``port``: New TCP/UDP source port number.
4074
4075- ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP
4076  header.
4077
4078  - ``port``: New TCP/UDP destination port number.
4079
4080- ``mac_swap``: Swap the source and destination MAC addresses in the outermost
4081  Ethernet header.
4082
4083- ``dec_ttl``: Performs a decrease TTL value action
4084
4085- ``set_ttl``: Set TTL value with specified value
4086  - ``ttl_value {unsigned}``: The new TTL value to be set
4087
4088- ``set_mac_src``: set source MAC address
4089
4090  - ``mac_addr {MAC-48}``: new source MAC address
4091
4092- ``set_mac_dst``: set destination MAC address
4093
4094  - ``mac_addr {MAC-48}``: new destination MAC address
4095
4096- ``inc_tcp_seq``: Increase sequence number in the outermost TCP header.
4097
4098  - ``value {unsigned}``: Value to increase TCP sequence number by.
4099
4100- ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header.
4101
4102  - ``value {unsigned}``: Value to decrease TCP sequence number by.
4103
4104- ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header.
4105
4106  - ``value {unsigned}``: Value to increase TCP acknowledgment number by.
4107
4108- ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header.
4109
4110  - ``value {unsigned}``: Value to decrease TCP acknowledgment number by.
4111
4112- ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value
4113
4114  - ``dscp_value {unsigned}``: The new DSCP value to be set
4115
4116- ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value
4117
4118  - ``dscp_value {unsigned}``: The new DSCP value to be set
4119
4120- ``indirect``: Use indirect action created via
4121  ``flow indirect_action {port_id} create``
4122
4123  - ``indirect_action_id {unsigned}``: Indirect action ID to use
4124
4125- ``color``: Color the packet to reflect the meter color result
4126
4127  - ``type {value}``: Set color type with specified value(green/yellow/red)
4128
4129- ``port_representor``: at embedded switch level, send matching traffic to
4130  the given ethdev
4131
4132  - ``port_id {unsigned}``: ethdev port ID
4133
4134- ``represented_port``: at embedded switch level, send matching traffic to
4135  the entity represented by the given ethdev
4136
4137  - ``ethdev_port_id {unsigned}``: ethdev port ID
4138
4139- ``meter_mark``:  meter the directed packets using profile and policy
4140
4141  - ``mtr_profile {unsigned}``: meter profile ID to use
4142  - ``mtr_policy {unsigned}``: meter policy ID to use
4143  - ``mtr_color_mode {unsigned}``: meter color-awareness mode (blind/aware)
4144  - ``mtr_init_color {value}``: initial color value (green/yellow/red)
4145  - ``mtr_state {unsigned}``: meter state (disabled/enabled)
4146
4147- ``modify_field``:  Modify packet field
4148
4149  - ``op``: modify operation (set/add/sub)
4150  - ``dst_type``: the destination field to be modified, the supported fields as
4151    ``enum rte_flow_field_id`` listed.
4152  - ``dst_level``: destination field level.
4153  - ``dst_tag_index``: destination field tag array.
4154  - ``dst_type_id``: destination field type ID.
4155  - ``dst_class``: destination field class ID.
4156  - ``dst_offset``: destination field bit offset.
4157  - ``src_type``: the modify source field, the supported fields as
4158    ``enum rte_flow_field_id`` listed.
4159  - ``src_level``: source field level.
4160  - ``src_tag_index``: source field tag array.
4161  - ``src_type_id``: source field type ID.
4162  - ``src_class``: source field class ID.
4163  - ``src_offset``: source field bit offset.
4164  - ``src_value``: source immediate value.
4165  - ``src_ptr``: pointer to source immediate value.
4166  - ``width``: number of bits to copy.
4167
4168Destroying flow rules
4169~~~~~~~~~~~~~~~~~~~~~
4170
4171``flow destroy`` destroys one or more rules from their rule ID (as returned
4172by ``flow create``), this command calls ``rte_flow_destroy()`` as many
4173times as necessary::
4174
4175   flow destroy {port_id} rule {rule_id} [...] [user_id]
4176
4177If successful, it will show::
4178
4179   Flow rule #[...] destroyed
4180
4181Or if ``user_id`` flag is provided::
4182
4183   Flow rule #[...] destroyed, user-id [...]
4184
4185Optional ``user_id`` is a flag that signifies the rule ID
4186is the one provided by the user at creation.
4187It does not report anything for rule IDs that do not exist. The usual error
4188message is shown when a rule cannot be destroyed::
4189
4190   Caught error type [...] ([...]): [...]
4191
4192``flow flush`` destroys all rules on a device and does not take extra
4193arguments. It is bound to ``rte_flow_flush()``::
4194
4195   flow flush {port_id}
4196
4197Any errors are reported as above.
4198
4199Creating several rules and destroying them::
4200
4201   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4202      actions queue index 2 / end
4203   Flow rule #0 created
4204   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4205      actions queue index 3 / end
4206   Flow rule #1 created
4207   testpmd> flow destroy 0 rule 0 rule 1
4208   Flow rule #1 destroyed
4209   Flow rule #0 destroyed
4210   testpmd>
4211
4212The same result can be achieved using ``flow flush``::
4213
4214   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4215      actions queue index 2 / end
4216   Flow rule #0 created
4217   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4218      actions queue index 3 / end
4219   Flow rule #1 created
4220   testpmd> flow flush 0
4221   testpmd>
4222
4223Non-existent rule IDs are ignored::
4224
4225   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4226      actions queue index 2 / end
4227   Flow rule #0 created
4228   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4229      actions queue index 3 / end
4230   Flow rule #1 created
4231   testpmd> flow destroy 0 rule 42 rule 10 rule 2
4232   testpmd>
4233   testpmd> flow destroy 0 rule 0
4234   Flow rule #0 destroyed
4235   testpmd>
4236
4237Enqueueing destruction of flow rules
4238~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4239
4240``flow queue destroy`` adds destruction operations to destroy one or more rules
4241from their rule ID (as returned by ``flow queue create``) to a queue,
4242this command calls ``rte_flow_async_destroy()`` as many times as necessary::
4243
4244   flow queue {port_id} destroy {queue_id}
4245        [postpone {boolean}] rule {rule_id} [...]
4246
4247If successful, it will show::
4248
4249   Flow rule #[...] destruction enqueued
4250
4251It does not report anything for rule IDs that do not exist. The usual error
4252message is shown when a rule cannot be destroyed::
4253
4254   Caught error type [...] ([...]): [...]
4255
4256``flow queue pull`` must be called to retrieve the operation status.
4257
4258Querying flow rules
4259~~~~~~~~~~~~~~~~~~~
4260
4261``flow query`` queries a specific action of a flow rule having that
4262ability. Such actions collect information that can be reported using this
4263command. It is bound to ``rte_flow_query()``::
4264
4265   flow query {port_id} {rule_id} {action} [user_id]
4266
4267Optional ``user_id`` is a flag that signifies the rule ID
4268is the one provided by the user at creation.
4269If successful, it will display either the retrieved data for known actions
4270or the following message::
4271
4272   Cannot display result for action type [...] ([...])
4273
4274Otherwise, it will complain either that the rule does not exist or that some
4275error occurred::
4276
4277   Flow rule #[...] not found
4278
4279::
4280
4281   Caught error type [...] ([...]): [...]
4282
4283Currently only the ``count`` action is supported. This action reports the
4284number of packets that hit the flow rule and the total number of bytes. Its
4285output has the following format::
4286
4287   count:
4288    hits_set: [...] # whether "hits" contains a valid value
4289    bytes_set: [...] # whether "bytes" contains a valid value
4290    hits: [...] # number of packets
4291    bytes: [...] # number of bytes
4292
4293Querying counters for TCPv6 packets redirected to queue 6::
4294
4295   testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end
4296      actions queue index 6 / count / end
4297   Flow rule #4 created
4298   testpmd> flow query 0 4 count
4299   count:
4300    hits_set: 1
4301    bytes_set: 0
4302    hits: 386446
4303    bytes: 0
4304   testpmd>
4305
4306Listing flow rules
4307~~~~~~~~~~~~~~~~~~
4308
4309``flow list`` lists existing flow rules sorted by priority and optionally
4310filtered by group identifiers::
4311
4312   flow list {port_id} [group {group_id}] [...]
4313
4314This command only fails with the following message if the device does not
4315exist::
4316
4317   Invalid port [...]
4318
4319Output consists of a header line followed by a short description of each
4320flow rule, one per line. There is no output at all when no flow rules are
4321configured on the device::
4322
4323   ID      Group   Prio    Attr    Rule
4324   [...]   [...]   [...]   [...]   [...]
4325
4326``Attr`` column flags:
4327
4328- ``i`` for ``ingress``.
4329- ``e`` for ``egress``.
4330
4331Creating several flow rules and listing them::
4332
4333   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4334      actions queue index 6 / end
4335   Flow rule #0 created
4336   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4337      actions queue index 2 / end
4338   Flow rule #1 created
4339   testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end
4340      actions rss queues 6 7 8 end / end
4341   Flow rule #2 created
4342   testpmd> flow list 0
4343   ID      Group   Prio    Attr    Rule
4344   0       0       0       i-      ETH IPV4 => QUEUE
4345   1       0       0       i-      ETH IPV6 => QUEUE
4346   2       0       5       i-      ETH IPV4 UDP => RSS
4347   testpmd>
4348
4349Rules are sorted by priority (i.e. group ID first, then priority level)::
4350
4351   testpmd> flow list 1
4352   ID      Group   Prio    Attr    Rule
4353   0       0       0       i-      ETH => COUNT
4354   6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4355   5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4356   1       24      0       i-      ETH IPV4 UDP => QUEUE
4357   4       24      10      i-      ETH IPV4 TCP => DROP
4358   3       24      20      i-      ETH IPV4 => DROP
4359   2       24      42      i-      ETH IPV4 UDP => QUEUE
4360   7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4361   testpmd>
4362
4363Output can be limited to specific groups::
4364
4365   testpmd> flow list 1 group 0 group 63
4366   ID      Group   Prio    Attr    Rule
4367   0       0       0       i-      ETH => COUNT
4368   6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4369   5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4370   7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4371   testpmd>
4372
4373Toggling isolated mode
4374~~~~~~~~~~~~~~~~~~~~~~
4375
4376``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4377must only be injected from the defined flow rules; that no default traffic
4378is expected outside those rules and the driver is free to assign more
4379resources to handle them. It is bound to ``rte_flow_isolate()``::
4380
4381 flow isolate {port_id} {boolean}
4382
4383If successful, enabling or disabling isolated mode shows either::
4384
4385 Ingress traffic on port [...]
4386    is now restricted to the defined flow rules
4387
4388Or::
4389
4390 Ingress traffic on port [...]
4391    is not restricted anymore to the defined flow rules
4392
4393Otherwise, in case of error::
4394
4395   Caught error type [...] ([...]): [...]
4396
4397Mainly due to its side effects, PMDs supporting this mode may not have the
4398ability to toggle it more than once without reinitializing affected ports
4399first (e.g. by exiting testpmd).
4400
4401Enabling isolated mode::
4402
4403 testpmd> flow isolate 0 true
4404 Ingress traffic on port 0 is now restricted to the defined flow rules
4405 testpmd>
4406
4407Disabling isolated mode::
4408
4409 testpmd> flow isolate 0 false
4410 Ingress traffic on port 0 is not restricted anymore to the defined flow rules
4411 testpmd>
4412
4413Dumping HW internal information
4414~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4415
4416``flow dump`` dumps the hardware's internal representation information of
4417all flows. It is bound to ``rte_flow_dev_dump()``::
4418
4419   flow dump {port_id} {output_file} [user_id]
4420
4421If successful, it will show::
4422
4423   Flow dump finished
4424
4425Otherwise, it will complain error occurred::
4426
4427   Caught error type [...] ([...]): [...]
4428
4429Optional ``user_id`` is a flag that signifies the rule ID
4430is the one provided by the user at creation.
4431
4432Listing and destroying aged flow rules
4433~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4434
4435``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``,
4436and ``destroy`` parameter can be used to destroy those flow rules in PMD::
4437
4438   flow aged {port_id} [destroy]
4439
4440Listing current aged flow rules::
4441
4442   testpmd> flow aged 0
4443   Port 0 total aged flows: 0
4444   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.14 / end
4445      actions age timeout 5 / queue index 0 /  end
4446   Flow rule #0 created
4447   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.15 / end
4448      actions age timeout 4 / queue index 0 /  end
4449   Flow rule #1 created
4450   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.16 / end
4451      actions age timeout 2 / queue index 0 /  end
4452   Flow rule #2 created
4453   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.17 / end
4454      actions age timeout 3 / queue index 0 /  end
4455   Flow rule #3 created
4456
4457
4458Aged Rules are simply list as command ``flow list {port_id}``, but strip the detail rule
4459information, all the aged flows are sorted by the longest timeout time. For example, if
4460those rules be configured in the same time, ID 2 will be the first aged out rule, the next
4461will be ID 3, ID 1, ID 0::
4462
4463   testpmd> flow aged 0
4464   Port 0 total aged flows: 4
4465   ID      Group   Prio    Attr
4466   2       0       0       i--
4467   3       0       0       i--
4468   1       0       0       i--
4469   0       0       0       i--
4470
4471If attach ``destroy`` parameter, the command will destroy all the list aged flow rules::
4472
4473   testpmd> flow aged 0 destroy
4474   Port 0 total aged flows: 4
4475   ID      Group   Prio    Attr
4476   2       0       0       i--
4477   3       0       0       i--
4478   1       0       0       i--
4479   0       0       0       i--
4480
4481   Flow rule #2 destroyed
4482   Flow rule #3 destroyed
4483   Flow rule #1 destroyed
4484   Flow rule #0 destroyed
4485   4 flows be destroyed
4486   testpmd> flow aged 0
4487   Port 0 total aged flows: 0
4488
4489
4490Enqueueing listing and destroying aged flow rules
4491~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4492
4493``flow queue aged`` simply lists aged flow rules be get from
4494``rte_flow_get_q_aged_flows`` API, and ``destroy`` parameter can be used to
4495destroy those flow rules in PMD::
4496
4497   flow queue {port_id} aged {queue_id} [destroy]
4498
4499Listing current aged flow rules::
4500
4501   testpmd> flow queue 0 aged 0
4502   Port 0 queue 0 total aged flows: 0
4503   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4504      pattern eth / ipv4 src is 2.2.2.14 / end
4505      actions age timeout 5 / queue index 0 /  end
4506   Flow rule #0 creation enqueued
4507   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4508      pattern eth / ipv4 src is 2.2.2.15 / end
4509      actions age timeout 4 / queue index 0 /  end
4510   Flow rule #1 creation enqueued
4511   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4512      pattern eth / ipv4 src is 2.2.2.16 / end
4513      actions age timeout 4 / queue index 0 /  end
4514   Flow rule #2 creation enqueued
4515   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4516      pattern eth / ipv4 src is 2.2.2.17 / end
4517      actions age timeout 4 / queue index 0 /  end
4518   Flow rule #3 creation enqueued
4519   testpmd> flow pull 0 queue 0
4520   Queue #0 pulled 4 operations (0 failed, 4 succeeded)
4521
4522Aged Rules are simply list as command ``flow queue {port_id} list {queue_id}``,
4523but strip the detail rule information, all the aged flows are sorted by the
4524longest timeout time. For example, if those rules is configured in the same time,
4525ID 2 will be the first aged out rule, the next will be ID 3, ID 1, ID 0::
4526
4527   testpmd> flow queue 0 aged 0
4528   Port 0 queue 0 total aged flows: 4
4529   ID      Group   Prio    Attr
4530   2       0       0       ---
4531   3       0       0       ---
4532   1       0       0       ---
4533   0       0       0       ---
4534
4535   0 flows destroyed
4536
4537If attach ``destroy`` parameter, the command will destroy all the list aged flow rules::
4538
4539   testpmd> flow queue 0 aged 0 destroy
4540   Port 0 queue 0 total aged flows: 4
4541   ID      Group   Prio    Attr
4542   2       0       0       ---
4543   3       0       0       ---
4544   1       0       0       ---
4545   0       0       0       ---
4546   Flow rule #2 destruction enqueued
4547   Flow rule #3 destruction enqueued
4548   Flow rule #1 destruction enqueued
4549   Flow rule #0 destruction enqueued
4550
4551   4 flows destroyed
4552   testpmd> flow queue 0 aged 0
4553   Port 0 total aged flows: 0
4554
4555.. note::
4556
4557   The queue must be empty before attaching ``destroy`` parameter.
4558
4559
4560Creating indirect actions
4561~~~~~~~~~~~~~~~~~~~~~~~~~
4562
4563``flow indirect_action {port_id} create`` creates indirect action with optional
4564indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
4565
4566   flow indirect_action {port_id} create [action_id {indirect_action_id}]
4567      [ingress] [egress] [transfer] action {action} / end
4568
4569If successful, it will show::
4570
4571   Indirect action #[...] created
4572
4573Otherwise, it will complain either that indirect action already exists or that
4574some error occurred::
4575
4576   Indirect action #[...] is already assigned, delete it first
4577
4578::
4579
4580   Caught error type [...] ([...]): [...]
4581
4582Create indirect rss action with id 100 to queues 1 and 2 on port 0::
4583
4584   testpmd> flow indirect_action 0 create action_id 100 \
4585      ingress action rss queues 1 2 end / end
4586
4587Create indirect rss action with id assigned by testpmd to queues 1 and 2 on
4588port 0::
4589
4590	testpmd> flow indirect_action 0 create action_id \
4591		ingress action rss queues 0 1 end / end
4592
4593Enqueueing creation of indirect actions
4594~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4595
4596``flow queue indirect_action create`` adds creation operation of an indirect
4597action to a queue. It is bound to ``rte_flow_async_action_handle_create()``::
4598
4599   flow queue {port_id} create {queue_id} [postpone {boolean}]
4600       table {table_id} item_template {item_template_id}
4601       action_template {action_template_id}
4602       pattern {item} [/ {item} [...]] / end
4603       actions {action} [/ {action} [...]] / end
4604
4605If successful, it will show::
4606
4607   Indirect action #[...] creation queued
4608
4609Otherwise it will show an error message of the form::
4610
4611   Caught error type [...] ([...]): [...]
4612
4613This command uses the same parameters as  ``flow indirect_action create``,
4614described in `Creating indirect actions`_.
4615
4616``flow queue pull`` must be called to retrieve the operation status.
4617
4618Updating indirect actions
4619~~~~~~~~~~~~~~~~~~~~~~~~~
4620
4621``flow indirect_action {port_id} update`` updates configuration of the indirect
4622action from its indirect action ID (as returned by
4623``flow indirect_action {port_id} create``). It is bound to
4624``rte_flow_action_handle_update()``::
4625
4626   flow indirect_action {port_id} update {indirect_action_id}
4627      action {action} / end
4628
4629If successful, it will show::
4630
4631   Indirect action #[...] updated
4632
4633Otherwise, it will complain either that indirect action not found or that some
4634error occurred::
4635
4636   Failed to find indirect action #[...] on port [...]
4637
4638::
4639
4640   Caught error type [...] ([...]): [...]
4641
4642Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3
4643(in create example above rss queues were 1 and 2)::
4644
4645   testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
4646
4647Enqueueing update of indirect actions
4648~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4649
4650``flow queue indirect_action update`` adds update operation for an indirect
4651action to a queue. It is bound to ``rte_flow_async_action_handle_update()``::
4652
4653   flow queue {port_id} indirect_action {queue_id} update
4654      {indirect_action_id} [postpone {boolean}] action {action} / end
4655
4656If successful, it will show::
4657
4658   Indirect action #[...] update queued
4659
4660Otherwise it will show an error message of the form::
4661
4662   Caught error type [...] ([...]): [...]
4663
4664``flow queue pull`` must be called to retrieve the operation status.
4665
4666Destroying indirect actions
4667~~~~~~~~~~~~~~~~~~~~~~~~~~~
4668
4669``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
4670from their indirect action IDs (as returned by
4671``flow indirect_action {port_id} create``). It is bound to
4672``rte_flow_action_handle_destroy()``::
4673
4674   flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
4675
4676If successful, it will show::
4677
4678   Indirect action #[...] destroyed
4679
4680It does not report anything for indirect action IDs that do not exist.
4681The usual error message is shown when a indirect action cannot be destroyed::
4682
4683   Caught error type [...] ([...]): [...]
4684
4685Destroy indirect actions having id 100 & 101::
4686
4687   testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
4688
4689Enqueueing destruction of indirect actions
4690~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4691
4692``flow queue indirect_action destroy`` adds destruction operation to destroy
4693one or more indirect actions from their indirect action IDs (as returned by
4694``flow queue {port_id} indirect_action {queue_id} create``) to a queue.
4695It is bound to ``rte_flow_async_action_handle_destroy()``::
4696
4697   flow queue {port_id} indirect_action {queue_id} destroy
4698      [postpone {boolean}] action_id {indirect_action_id} [...]
4699
4700If successful, it will show::
4701
4702   Indirect action #[...] destruction queued
4703
4704Otherwise it will show an error message of the form::
4705
4706   Caught error type [...] ([...]): [...]
4707
4708``flow queue pull`` must be called to retrieve the operation status.
4709
4710Query indirect actions
4711~~~~~~~~~~~~~~~~~~~~~~
4712
4713``flow indirect_action {port_id} query`` queries the indirect action from its
4714indirect action ID (as returned by ``flow indirect_action {port_id} create``).
4715It is bound to ``rte_flow_action_handle_query()``::
4716
4717  flow indirect_action {port_id} query {indirect_action_id}
4718
4719Currently only rss indirect action supported. If successful, it will show::
4720
4721   Indirect RSS action:
4722      refs:[...]
4723
4724Otherwise, it will complain either that indirect action not found or that some
4725error occurred::
4726
4727   Failed to find indirect action #[...] on port [...]
4728
4729::
4730
4731   Caught error type [...] ([...]): [...]
4732
4733Query indirect action having id 100::
4734
4735   testpmd> flow indirect_action 0 query 100
4736
4737Enqueueing query of indirect actions
4738~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4739
4740``flow queue indirect_action query`` adds query operation for an indirect
4741action to a queue. It is bound to ``rte_flow_async_action_handle_query()``::
4742
4743   flow queue {port_id} indirect_action {queue_id} query
4744      {indirect_action_id} [postpone {boolean}]
4745
4746If successful, it will show::
4747
4748   Indirect action #[...] query queued
4749
4750Otherwise it will show an error message of the form::
4751
4752   Caught error type [...] ([...]): [...]
4753
4754``flow queue pull`` must be called to retrieve the operation status.
4755
4756Sample QinQ flow rules
4757~~~~~~~~~~~~~~~~~~~~~~
4758
4759Before creating QinQ rule(s) the following commands should be issued to enable QinQ::
4760
4761   testpmd> port stop 0
4762   testpmd> vlan set extend on 0
4763
4764The above command sets the inner and outer TPID's to 0x8100.
4765
4766To change the TPID's the following commands should be used::
4767
4768   testpmd> vlan set outer tpid 0x88A8 0
4769   testpmd> vlan set inner tpid 0x8100 0
4770   testpmd> port start 0
4771
4772Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
4773
4774::
4775
4776   testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 /
4777       vlan tci is 456 / end actions vf id 1 / queue index 0 / end
4778   Flow rule #0 validated
4779
4780   testpmd> flow create 0 ingress pattern eth / vlan tci is 4 /
4781       vlan tci is 456 / end actions vf id 123 / queue index 0 / end
4782   Flow rule #0 created
4783
4784   testpmd> flow list 0
4785   ID      Group   Prio    Attr    Rule
4786   0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
4787
4788Validate and create a QinQ rule on port 0 to steer traffic to a queue on the host.
4789
4790::
4791
4792   testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 /
4793        vlan tci is 654 / end actions pf / queue index 0 / end
4794   Flow rule #1 validated
4795
4796   testpmd> flow create 0 ingress pattern eth / vlan tci is 321 /
4797        vlan tci is 654 / end actions pf / queue index 1 / end
4798   Flow rule #1 created
4799
4800   testpmd> flow list 0
4801   ID      Group   Prio    Attr    Rule
4802   0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
4803   1       0       0       i-      ETH VLAN VLAN=>PF QUEUE
4804
4805Sample VXLAN flow rules
4806~~~~~~~~~~~~~~~~~~~~~~~
4807
4808Before creating VXLAN rule(s), the UDP port should be added for VXLAN packet
4809filter on a port::
4810
4811  testpmd> rx_vxlan_port add 4789 0
4812
4813Create VXLAN rules on port 0 to steer traffic to PF queues.
4814
4815::
4816
4817  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
4818         eth dst is 00:11:22:33:44:55 / end actions pf / queue index 1 / end
4819  Flow rule #0 created
4820
4821  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 3 /
4822         eth dst is 00:11:22:33:44:55 / end actions pf / queue index 2 / end
4823  Flow rule #1 created
4824
4825  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
4826         eth dst is 00:11:22:33:44:55 / vlan tci is 10 / end actions pf /
4827         queue index 3 / end
4828  Flow rule #2 created
4829
4830  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 5 /
4831         eth dst is 00:11:22:33:44:55 / vlan tci is 20 / end actions pf /
4832         queue index 4 / end
4833  Flow rule #3 created
4834
4835  testpmd> flow create 0 ingress pattern eth dst is 00:00:00:00:01:00 / ipv4 /
4836         udp / vxlan vni is 6 /  eth dst is 00:11:22:33:44:55 / end actions pf /
4837         queue index 5 / end
4838  Flow rule #4 created
4839
4840  testpmd> flow list 0
4841  ID      Group   Prio    Attr    Rule
4842  0       0       0       i-      ETH IPV4 UDP VXLAN ETH => QUEUE
4843  1       0       0       i-      ETH IPV4 UDP VXLAN ETH => QUEUE
4844  2       0       0       i-      ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
4845  3       0       0       i-      ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
4846  4       0       0       i-      ETH IPV4 UDP VXLAN ETH => QUEUE
4847
4848Sample VXLAN encapsulation rule
4849~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4850
4851VXLAN encapsulation outer layer has default value pre-configured in testpmd
4852source code, those can be changed by using the following commands
4853
4854IPv4 VXLAN outer header::
4855
4856 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
4857        ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4858 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4859        queue index 0 / end
4860
4861 testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src
4862         127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4863         eth-dst 22:22:22:22:22:22
4864 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4865         queue index 0 / end
4866
4867 testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-tos 0
4868         ip-ttl 255 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4869         eth-dst 22:22:22:22:22:22
4870 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4871         queue index 0 / end
4872
4873IPv6 VXLAN outer header::
4874
4875 testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1
4876        ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4877 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4878         queue index 0 / end
4879
4880 testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4881         ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11
4882         eth-dst 22:22:22:22:22:22
4883 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4884         queue index 0 / end
4885
4886 testpmd> set vxlan-tos-ttl ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4887         ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4888         eth-dst 22:22:22:22:22:22
4889 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4890         queue index 0 / end
4891
4892Sample NVGRE encapsulation rule
4893~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4894
4895NVGRE encapsulation outer layer has default value pre-configured in testpmd
4896source code, those can be changed by using the following commands
4897
4898IPv4 NVGRE outer header::
4899
4900 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
4901        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4902 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4903        queue index 0 / end
4904
4905 testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1
4906         ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4907         eth-dst 22:22:22:22:22:22
4908 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4909         queue index 0 / end
4910
4911IPv6 NVGRE outer header::
4912
4913 testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4914        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4915 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4916        queue index 0 / end
4917
4918 testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4919        vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4920 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4921        queue index 0 / end
4922
4923Sample L2 encapsulation rule
4924~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4925
4926L2 encapsulation has default value pre-configured in testpmd
4927source code, those can be changed by using the following commands
4928
4929L2 header::
4930
4931 testpmd> set l2_encap ip-version ipv4
4932        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4933 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4934        mplsoudp_decap / l2_encap / end
4935
4936L2 with VXLAN header::
4937
4938 testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34
4939         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4940 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4941        mplsoudp_decap / l2_encap / end
4942
4943Sample L2 decapsulation rule
4944~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4945
4946L2 decapsulation has default value pre-configured in testpmd
4947source code, those can be changed by using the following commands
4948
4949L2 header::
4950
4951 testpmd> set l2_decap
4952 testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap /
4953        queue index 0 / end
4954
4955L2 with VXLAN header::
4956
4957 testpmd> set l2_encap-with-vlan
4958 testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap /
4959         queue index 0 / end
4960
4961Sample MPLSoGRE encapsulation rule
4962~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4963
4964MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
4965source code, those can be changed by using the following commands
4966
4967IPv4 MPLSoGRE outer header::
4968
4969 testpmd> set mplsogre_encap ip-version ipv4 label 4
4970        ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4971        eth-dst 22:22:22:22:22:22
4972 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4973        mplsogre_encap / end
4974
4975IPv4 MPLSoGRE with VLAN outer header::
4976
4977 testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4
4978        ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4979        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4980 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4981        mplsogre_encap / end
4982
4983IPv6 MPLSoGRE outer header::
4984
4985 testpmd> set mplsogre_encap ip-version ipv6 mask 4
4986        ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4987        eth-dst 22:22:22:22:22:22
4988 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4989        mplsogre_encap / end
4990
4991IPv6 MPLSoGRE with VLAN outer header::
4992
4993 testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4
4994        ip-src ::1 ip-dst ::2222 vlan-tci 34
4995        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4996 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4997        mplsogre_encap / end
4998
4999Sample MPLSoGRE decapsulation rule
5000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5001
5002MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
5003source code, those can be changed by using the following commands
5004
5005IPv4 MPLSoGRE outer header::
5006
5007 testpmd> set mplsogre_decap ip-version ipv4
5008 testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions
5009        mplsogre_decap / l2_encap / end
5010
5011IPv4 MPLSoGRE with VLAN outer header::
5012
5013 testpmd> set mplsogre_decap-with-vlan ip-version ipv4
5014 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end
5015        actions mplsogre_decap / l2_encap / end
5016
5017IPv6 MPLSoGRE outer header::
5018
5019 testpmd> set mplsogre_decap ip-version ipv6
5020 testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end
5021        actions mplsogre_decap / l2_encap / end
5022
5023IPv6 MPLSoGRE with VLAN outer header::
5024
5025 testpmd> set mplsogre_decap-with-vlan ip-version ipv6
5026 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end
5027        actions mplsogre_decap / l2_encap / end
5028
5029Sample MPLSoUDP encapsulation rule
5030~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5031
5032MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
5033source code, those can be changed by using the following commands
5034
5035IPv4 MPLSoUDP outer header::
5036
5037 testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10
5038        ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
5039        eth-dst 22:22:22:22:22:22
5040 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5041        mplsoudp_encap / end
5042
5043IPv4 MPLSoUDP with VLAN outer header::
5044
5045 testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5
5046        udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
5047        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5048 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5049        mplsoudp_encap / end
5050
5051IPv6 MPLSoUDP outer header::
5052
5053 testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10
5054        ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
5055        eth-dst 22:22:22:22:22:22
5056 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5057        mplsoudp_encap / end
5058
5059IPv6 MPLSoUDP with VLAN outer header::
5060
5061 testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5
5062        udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34
5063        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5064 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5065        mplsoudp_encap / end
5066
5067Sample MPLSoUDP decapsulation rule
5068~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5069
5070MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
5071source code, those can be changed by using the following commands
5072
5073IPv4 MPLSoUDP outer header::
5074
5075 testpmd> set mplsoudp_decap ip-version ipv4
5076 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
5077        mplsoudp_decap / l2_encap / end
5078
5079IPv4 MPLSoUDP with VLAN outer header::
5080
5081 testpmd> set mplsoudp_decap-with-vlan ip-version ipv4
5082 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end
5083        actions mplsoudp_decap / l2_encap / end
5084
5085IPv6 MPLSoUDP outer header::
5086
5087 testpmd> set mplsoudp_decap ip-version ipv6
5088 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end
5089        actions mplsoudp_decap / l2_encap / end
5090
5091IPv6 MPLSoUDP with VLAN outer header::
5092
5093 testpmd> set mplsoudp_decap-with-vlan ip-version ipv6
5094 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end
5095        actions mplsoudp_decap / l2_encap / end
5096
5097Sample Raw encapsulation rule
5098~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5099
5100Raw encapsulation configuration can be set by the following commands
5101
5102Encapsulating VxLAN::
5103
5104 testpmd> set raw_encap 4 eth src is 10:11:22:33:44:55 / vlan tci is 1
5105        inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni
5106        is 2 / end_set
5107 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
5108        raw_encap index 4 / end
5109
5110Sample Raw decapsulation rule
5111~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5112
5113Raw decapsulation configuration can be set by the following commands
5114
5115Decapsulating VxLAN::
5116
5117 testpmd> set raw_decap eth / ipv4 / udp / vxlan / end_set
5118 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 /
5119        end actions raw_decap / queue index 0 / end
5120
5121Sample ESP rules
5122~~~~~~~~~~~~~~~~
5123
5124ESP rules can be created by the following commands::
5125
5126 testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions
5127        queue index 3 / end
5128 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end
5129        actions queue index 3 / end
5130 testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions
5131        queue index 3 / end
5132 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
5133        actions queue index 3 / end
5134
5135Sample AH rules
5136~~~~~~~~~~~~~~~~
5137
5138AH rules can be created by the following commands::
5139
5140 testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions
5141        queue index 3 / end
5142 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end
5143        actions queue index 3 / end
5144 testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions
5145        queue index 3 / end
5146 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end
5147        actions queue index 3 / end
5148
5149Sample PFCP rules
5150~~~~~~~~~~~~~~~~~
5151
5152PFCP rules can be created by the following commands(s_field need to be 1
5153if seid is set)::
5154
5155 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
5156        actions queue index 3 / end
5157 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
5158        seid is 1 / end actions queue index 3 / end
5159 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
5160        actions queue index 3 / end
5161 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
5162        seid is 1 / end actions queue index 3 / end
5163
5164Sample Sampling/Mirroring rules
5165~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5166
5167Sample/Mirroring rules can be set by the following commands
5168
5169NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1,
5170and 50% packets are duplicated and marked with 0x1234 and sent to queue 0.
5171
5172::
5173
5174 testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
5175 testpmd> flow create 0 ingress group 1 pattern eth / end actions
5176        sample ratio 2 index 0 / queue index 1 / end
5177
5178Match packets coming from a VM which is referred to by means of
5179its representor ethdev (port 1), mirror 50% of them to the
5180said representor (for bookkeeping) as well as encapsulate
5181all the packets and steer them to the physical port:
5182
5183::
5184
5185   testpmd> set sample_actions 0 port_representor ethdev_port_id 1 / end
5186
5187   testpmd> set vxlan ip-version ipv4 vni 4 udp-src 32 udp-dst 4789 ip-src 127.0.0.1
5188      ip-dst 127.0.0.2 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5189
5190   testpmd> flow create 0 transfer pattern represented_port ethdev_port_id is 1 / end
5191      actions sample ratio 2 index 0 / vxlan_encap /
5192      represented_port ethdev_port_id 0 / end
5193
5194The rule is inserted via port 0 (assumed to have "transfer" privilege).
5195
5196Sample integrity rules
5197~~~~~~~~~~~~~~~~~~~~~~
5198
5199Integrity rules can be created by the following commands:
5200
5201Integrity rule that forwards valid TCP packets to group 1.
5202TCP packet integrity is matched with the ``l4_ok`` bit 3.
5203
5204::
5205
5206 testpmd> flow create 0 ingress
5207            pattern eth / ipv4 / tcp / integrity value mask 8 value spec 8 / end
5208            actions jump group 1 / end
5209
5210Integrity rule that forwards invalid packets to application.
5211General packet integrity is matched with the ``packet_ok`` bit 0.
5212
5213::
5214
5215 testpmd> flow create 0 ingress pattern integrity value mask 1 value spec 0 / end actions queue index 0 / end
5216
5217Sample conntrack rules
5218~~~~~~~~~~~~~~~~~~~~~~
5219
5220Conntrack rules can be set by the following commands
5221
5222Need to construct the connection context with provided information.
5223In the first table, create a flow rule by using conntrack action and jump to
5224the next table. In the next table, create a rule to check the state.
5225
5226::
5227
5228 testpmd> set conntrack com peer 1 is_orig 1 enable 1 live 1 sack 1 cack 0
5229        last_dir 0 liberal 0 state 1 max_ack_win 7 r_lim 5 last_win 510
5230        last_seq 2632987379 last_ack 2532480967 last_end 2632987379
5231        last_index 0x8
5232 testpmd> set conntrack orig scale 7 fin 0 acked 1 unack_data 0
5233        sent_end 2632987379 reply_end 2633016339 max_win 28960
5234        max_ack 2632987379
5235 testpmd> set conntrack rply scale 7 fin 0 acked 1 unack_data 0
5236        sent_end 2532480967 reply_end 2532546247 max_win 65280
5237        max_ack 2532480967
5238 testpmd> flow indirect_action 0 create ingress action conntrack / end
5239 testpmd> flow create 0 group 3 ingress pattern eth / ipv4 / tcp / end actions indirect 0 / jump group 5 / end
5240 testpmd> flow create 0 group 5 ingress pattern eth / ipv4 / tcp / conntrack is 1 / end actions queue index 5 / end
5241
5242Construct the conntrack again with only "is_orig" set to 0 (other fields are
5243ignored), then use "update" interface to update the direction. Create flow
5244rules like above for the peer port.
5245
5246::
5247
5248 testpmd> flow indirect_action 0 update 0 action conntrack_update dir / end
5249
5250Sample meter with policy rules
5251~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5252
5253Meter with policy rules can be created by the following commands:
5254
5255Need to create policy first and actions are set for green/yellow/red colors.
5256Create meter with policy id. Create flow with meter id.
5257
5258Example for policy with meter color action. The purpose is to color the packet
5259to reflect the meter color result.
5260The meter policy action list: ``green -> green, yellow -> yellow, red -> red``.
5261
5262::
5263
5264   testpmd> add port meter profile srtcm_rfc2697 0 13 21504 2688 0 0
5265   testpmd> add port meter policy 0 1 g_actions color type green / end y_actions color type yellow / end
5266            r_actions color type red / end
5267   testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
5268   testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end
5269
5270Sample L2TPv2 RSS rules
5271~~~~~~~~~~~~~~~~~~~~~~~
5272
5273L2TPv2 RSS rules can be created by the following commands::
5274
5275   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
5276            / end actions rss types l2tpv2 end queues end / end
5277   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / end
5278            actions rss types eth l2-src-only end queues end / end
5279   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / end
5280            actions rss types l2tpv2 end queues end / end
5281   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5282            / end actions rss types ipv4 end queues end / end
5283   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv6
5284            / udp / end actions rss types ipv6-udp end queues end / end
5285   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv4
5286            / tcp / end actions rss types ipv4-tcp end queues end / end
5287   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
5288            / end actions rss types ipv6 end queues end / end
5289
5290Sample L2TPv2 FDIR rules
5291~~~~~~~~~~~~~~~~~~~~~~~~
5292
5293L2TPv2 FDIR rules can be created by the following commands::
5294
5295   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
5296            session_id is 0x1111 / end actions queue index 3 / end
5297   testpmd> flow create 0 ingress pattern eth src is 00:00:00:00:00:01 / ipv4
5298            / udp / l2tpv2 type data / end actions queue index 3 / end
5299   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type data
5300            session_id is 0x1111 / ppp / end actions queue index 3 / end
5301   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5302            src is 10.0.0.1 / end actions queue index 3 / end
5303   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
5304            dst is ABAB:910B:6666:3457:8295:3333:1800:2929 / end actions queue index 3 / end
5305   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5306            / udp src is 22 / end actions queue index 3 / end
5307   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5308            / tcp dst is 23 / end actions queue index 3 / end
5309
5310Sample RAW rule
5311~~~~~~~~~~~~~~~
5312
5313A RAW rule can be created as following using ``pattern_hex`` key and mask.
5314
5315::
5316
5317    testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset
5318             is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a
5319             pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions
5320             queue index 4 / end
5321
5322BPF Functions
5323--------------
5324
5325The following sections show functions to load/unload eBPF based filters.
5326
5327bpf-load
5328~~~~~~~~
5329
5330Load an eBPF program as a callback for particular RX/TX queue::
5331
5332   testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename)
5333
5334The available load-flags are:
5335
5336* ``J``: use JIT generated native code, otherwise BPF interpreter will be used.
5337
5338* ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data.
5339
5340* ``-``: none.
5341
5342.. note::
5343
5344   You'll need clang v3.7 or above to build bpf program you'd like to load
5345
5346For example:
5347
5348.. code-block:: console
5349
5350   cd examples/bpf
5351   clang -O2 -target bpf -c t1.c
5352
5353Then to load (and JIT compile) t1.o at RX queue 0, port 1:
5354
5355.. code-block:: console
5356
5357   testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
5358
5359To load (not JITed) t1.o at TX queue 0, port 0:
5360
5361.. code-block:: console
5362
5363   testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
5364
5365bpf-unload
5366~~~~~~~~~~
5367
5368Unload previously loaded eBPF program for particular RX/TX queue::
5369
5370   testpmd> bpf-unload rx|tx (portid) (queueid)
5371
5372For example to unload BPF filter from TX queue 0, port 0:
5373
5374.. code-block:: console
5375
5376   testpmd> bpf-unload tx 0 0
5377
5378Flex Item Functions
5379-------------------
5380
5381The following sections show functions that configure and create flex item object,
5382create flex pattern and use it in a flow rule.
5383The commands will use 20 bytes IPv4 header for examples:
5384
5385::
5386
5387   0                   1                   2                   3
5388   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
5389   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5390   |  ver  |  IHL  |     TOS       |        length                 | +0
5391   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5392   |       identification          | flg |    frag. offset         | +4
5393   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5394   |       TTL     |  protocol     |        checksum               | +8
5395   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5396   |               source IP address                               | +12
5397   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5398   |              destination IP address                           | +16
5399   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5400
5401
5402Create flex item
5403~~~~~~~~~~~~~~~~
5404
5405Flex item object is created by PMD according to a new header configuration. The
5406header configuration is compiled by the testpmd and stored in
5407``rte_flow_item_flex_conf`` type variable.
5408
5409::
5410
5411   # flow flex_item create <port> <flex id> <configuration file>
5412   testpmd> flow flex_item init 0 3 ipv4_flex_config.json
5413   port-0: created flex item #3
5414
5415Flex item configuration is kept in external JSON file.
5416It describes the following header elements:
5417
5418**New header length.**
5419
5420Specify whether the new header has fixed or variable length and the basic/minimal
5421header length value.
5422
5423If header length is not fixed, header location with a value that completes header
5424length calculation and scale/offset function must be added.
5425
5426Scale function depends on port hardware.
5427
5428**Next protocol.**
5429
5430Describes location in the new header that specify following network header type.
5431
5432**Flow match samples.**
5433
5434Describes locations in the new header that will be used in flow rules.
5435
5436Number of flow samples and sample maximal length depend of port hardware.
5437
5438**Input trigger.**
5439
5440Describes preceding network header configuration.
5441
5442**Output trigger.**
5443
5444Describes conditions that trigger transfer to following network header
5445
5446.. code-block:: json
5447
5448   {
5449      "next_header": { "field_mode": "FIELD_MODE_FIXED", "field_size": 20},
5450      "next_protocol": {"field_size": 8, "field_base": 72},
5451      "sample_data": [
5452         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 0},
5453         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 32},
5454         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 64},
5455         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 96}
5456      ],
5457      "input_link": [
5458         {"item": "eth type is 0x0800"},
5459         {"item": "vlan inner_type is 0x0800"}
5460      ],
5461      "output_link": [
5462         {"item": "udp", "next": 17},
5463         {"item": "tcp", "next": 6},
5464         {"item": "icmp", "next": 1}
5465      ]
5466   }
5467
5468
5469Flex pattern and flow rules
5470~~~~~~~~~~~~~~~~~~~~~~~~~~~
5471
5472Flex pattern describe parts of network header that will trigger flex flow item hit in a flow rule.
5473Flex pattern directly related to flex item samples configuration.
5474Flex pattern can be shared between ports.
5475
5476**Flex pattern and flow rule to match IPv4 version and 20 bytes length**
5477
5478::
5479
5480   # set flex_pattern <pattern_id> is <hex bytes sequence>
5481   testpmd> flow flex_item pattern 5 is 45FF
5482   created pattern #5
5483
5484   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / flex item is 3 pattern is 5 / end actions mark id 1 / queue index 0 / end
5485   Flow rule #0 created
5486
5487**Flex pattern and flow rule to match packets with source address 1.2.3.4**
5488
5489::
5490
5491   testpmd> flow flex_item pattern 2 spec 45000000000000000000000001020304 mask FF0000000000000000000000FFFFFFFF
5492   created pattern #2
5493
5494   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / flex item is 3 pattern is 2 / end actions mark id 1 / queue index 0 / end
5495   Flow rule #0 created
5496
5497Driver specific commands
5498------------------------
5499
5500Some drivers provide specific features.
5501See:
5502
5503- :ref:`net/bonding testpmd driver specific commands <bonding_testpmd_commands>`
5504- :ref:`net/i40e testpmd driver specific commands <net_i40e_testpmd_commands>`
5505- :ref:`net/ixgbe testpmd driver specific commands <net_ixgbe_testpmd_commands>`
5506