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