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