xref: /dpdk/doc/guides/testpmd_app_ug/testpmd_funcs.rst (revision ef8bd7d0b25abdcc425d4a7e399c66957b15b935)
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
1326mcast_addr flush
1327~~~~~~~~~~~~~~~~
1328
1329Flush all multicast MAC addresses on port_id::
1330
1331   testpmd> mcast_addr flush (port_id)
1332
1333mac_addr add (for VF)
1334~~~~~~~~~~~~~~~~~~~~~
1335
1336Add an alternative MAC address for a VF to a port::
1337
1338   testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX)
1339
1340mac_addr set
1341~~~~~~~~~~~~
1342
1343Set the default MAC address for a port::
1344
1345   testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
1346
1347mac_addr set (for VF)
1348~~~~~~~~~~~~~~~~~~~~~
1349
1350Set the MAC address for a VF from the PF::
1351
1352   testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)
1353
1354set eth-peer
1355~~~~~~~~~~~~
1356
1357Set the forwarding peer address for certain port::
1358
1359   testpmd> set eth-peer (port_id) (peer_addr)
1360
1361This is equivalent to the ``--eth-peer`` command-line option.
1362
1363set port-uta
1364~~~~~~~~~~~~
1365
1366Set the unicast hash filter(s) on/off for a port::
1367
1368   testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off)
1369
1370set promisc
1371~~~~~~~~~~~
1372
1373Set the promiscuous mode on for a port or for all ports.
1374In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1375
1376   testpmd> set promisc (port_id|all) (on|off)
1377
1378set allmulti
1379~~~~~~~~~~~~
1380
1381Set the allmulti mode for a port or for all ports::
1382
1383   testpmd> set allmulti (port_id|all) (on|off)
1384
1385Same as the ifconfig (8) option. Controls how multicast packets are handled.
1386
1387set flow_ctrl rx
1388~~~~~~~~~~~~~~~~
1389
1390Set the link flow control parameter on a port::
1391
1392   testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1393            (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \
1394	    autoneg (on|off) (port_id)
1395
1396Where:
1397
1398* ``high_water`` (integer): High threshold value to trigger XOFF.
1399
1400* ``low_water`` (integer): Low threshold value to trigger XON.
1401
1402* ``pause_time`` (integer): Pause quota in the Pause frame.
1403
1404* ``send_xon`` (0/1): Send XON frame.
1405
1406* ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames.
1407
1408* ``autoneg``: Change the auto-negotiation parameter.
1409
1410show flow control
1411~~~~~~~~~~~~~~~~~
1412
1413show the link flow control parameter on a port::
1414
1415   testpmd> show port <port_id> flow_ctrl
1416
1417set pfc_ctrl rx
1418~~~~~~~~~~~~~~~
1419
1420Set the priority flow control parameter on a port::
1421
1422   testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1423            (pause_time) (priority) (port_id)
1424
1425Where:
1426
1427* ``high_water`` (integer): High threshold value.
1428
1429* ``low_water`` (integer): Low threshold value.
1430
1431* ``pause_time`` (integer): Pause quota in the Pause frame.
1432
1433* ``priority`` (0-7): VLAN User Priority.
1434
1435set pfc_queue_ctrl
1436~~~~~~~~~~~~~~~~~~
1437
1438Set the priority flow control parameter on a given Rx and Tx queue of a port::
1439
1440   testpmd> set pfc_queue_ctrl <port_id> rx (on|off) <tx_qid> <tx_tc> \
1441            tx (on|off) <rx_qid> <rx_tc> <pause_time>
1442
1443Where:
1444
1445* ``tx_qid`` (integer): Tx qid for which ``tx_tc`` will be applied and traffic
1446  will be paused when PFC frame is received with ``tx_tc`` enabled.
1447
1448* ``tx_tc`` (0-15): TC for which traffic is to be paused for xmit.
1449
1450* ``rx_qid`` (integer): Rx qid for which threshold will be applied and PFC
1451  frame will be generated with ``tx_tc`` when exceeds the threshold.
1452
1453* ``rx_tc`` (0-15): TC filled in PFC frame for which remote Tx is to be paused.
1454
1455* ``pause_time`` (integer): Pause quanta filled in the PFC frame for which
1456  interval, remote Tx will be paused. Valid only if Tx pause is on.
1457
1458Set Rx queue available descriptors threshold
1459~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1460
1461Set available descriptors threshold for a specific Rx queue of port::
1462
1463  testpmd> set port (port_id) rxq (queue_id) avail_thresh (0..99)
1464
1465Use 0 value to disable the threshold and corresponding event.
1466
1467set stat_qmap
1468~~~~~~~~~~~~~
1469
1470Set statistics mapping (qmapping 0..15) for RX/TX queue on port::
1471
1472   testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)
1473
1474For example, to set rx queue 2 on port 0 to mapping 5::
1475
1476   testpmd>set stat_qmap rx 0 2 5
1477
1478set xstats-hide-zero
1479~~~~~~~~~~~~~~~~~~~~
1480
1481Set the option to hide zero values for xstats display::
1482
1483	testpmd> set xstats-hide-zero on|off
1484
1485.. note::
1486
1487	By default, the zero values are displayed for xstats.
1488
1489set port - rx/tx (for VF)
1490~~~~~~~~~~~~~~~~~~~~~~~~~
1491
1492Set VF receive/transmit from a port::
1493
1494   testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1495
1496set port - rx mode(for VF)
1497~~~~~~~~~~~~~~~~~~~~~~~~~~
1498
1499Set the VF receive mode of a port::
1500
1501   testpmd> set port (port_id) vf (vf_id) \
1502            rxmode (AUPE|ROPE|BAM|MPE) (on|off)
1503
1504The available receive modes are:
1505
1506* ``AUPE``: Accepts untagged VLAN.
1507
1508* ``ROPE``: Accepts unicast hash.
1509
1510* ``BAM``: Accepts broadcast packets.
1511
1512* ``MPE``: Accepts all multicast packets.
1513
1514set port - tx_rate (for Queue)
1515~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1516
1517Set TX rate limitation for a queue on a port::
1518
1519   testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1520
1521set port - tx_rate (for VF)
1522~~~~~~~~~~~~~~~~~~~~~~~~~~~
1523
1524Set TX rate limitation for queues in VF on a port::
1525
1526   testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
1527
1528set flush_rx
1529~~~~~~~~~~~~
1530
1531Set the flush on RX streams before forwarding.
1532The default is flush ``on``.
1533Mainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams::
1534
1535   testpmd> set flush_rx off
1536
1537set link up
1538~~~~~~~~~~~
1539
1540Set link up for a port::
1541
1542   testpmd> set link-up port (port id)
1543
1544set link down
1545~~~~~~~~~~~~~
1546
1547Set link down for a port::
1548
1549   testpmd> set link-down port (port id)
1550
1551E-tag set
1552~~~~~~~~~
1553
1554Enable E-tag insertion for a VF on a port::
1555
1556   testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
1557
1558Disable E-tag insertion for a VF on a port::
1559
1560   testpmd> E-tag set insertion off port (port_id) vf (vf_id)
1561
1562Enable/disable E-tag stripping on a port::
1563
1564   testpmd> E-tag set stripping (on|off) port (port_id)
1565
1566Enable/disable E-tag based forwarding on a port::
1567
1568   testpmd> E-tag set forwarding (on|off) port (port_id)
1569
1570config per port Rx offloading
1571~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1572
1573Enable or disable a per port Rx offloading on all Rx queues of a port::
1574
1575   testpmd> port config (port_id) rx_offload (offloading) on|off
1576
1577* ``offloading``: can be any of these offloading capability:
1578                  vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1579                  qinq_strip, outer_ipv4_cksum, macsec_strip,
1580                  vlan_filter, vlan_extend, scatter, timestamp, security,
1581                  keep_crc, rss_hash
1582
1583This command should be run when the port is stopped, or else it will fail.
1584
1585config per queue Rx offloading
1586~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1587
1588Enable or disable a per queue Rx offloading only on a specific Rx queue::
1589
1590   testpmd> port (port_id) rxq (queue_id) rx_offload (offloading) on|off
1591
1592* ``offloading``: can be any of these offloading capability:
1593                  vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1594                  qinq_strip, outer_ipv4_cksum, macsec_strip,
1595                  vlan_filter, vlan_extend, scatter, timestamp, security,
1596                  keep_crc
1597
1598This command should be run when the port is stopped, or else it will fail.
1599
1600config per port Tx offloading
1601~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1602
1603Enable or disable a per port Tx offloading on all Tx queues of a port::
1604
1605   testpmd> port config (port_id) tx_offload (offloading) on|off
1606
1607* ``offloading``: can be any of these offloading capability:
1608                  vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1609                  sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1610                  qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1611                  ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1612                  mt_lockfree, multi_segs, mbuf_fast_free, security
1613
1614This command should be run when the port is stopped, or else it will fail.
1615
1616config per queue Tx offloading
1617~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1618
1619Enable or disable a per queue Tx offloading only on a specific Tx queue::
1620
1621   testpmd> port (port_id) txq (queue_id) tx_offload (offloading) on|off
1622
1623* ``offloading``: can be any of these offloading capability:
1624                  vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1625                  sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1626                  qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1627                  ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1628                  mt_lockfree, multi_segs, mbuf_fast_free, security
1629
1630This command should be run when the port is stopped, or else it will fail.
1631
1632config per queue Tx affinity mapping
1633~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1634
1635Map a Tx queue with an aggregated port of the DPDK port (specified with port_id)::
1636
1637   testpmd> port (port_id) txq (queue_id) affinity (value)
1638
1639* ``affinity``: the number of the aggregated port.
1640                When multiple ports are aggregated into a single one,
1641                it allows to choose which port to use for Tx via a queue.
1642
1643This command should be run when the port is stopped, otherwise it fails.
1644
1645
1646Config VXLAN Encap outer layers
1647~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1648
1649Configure the outer layer to encapsulate a packet inside a VXLAN tunnel::
1650
1651 set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1652 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) \
1653 eth-dst (eth-dst)
1654
1655 set vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1656 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1657 eth-src (eth-src) eth-dst (eth-dst)
1658
1659 set vxlan-tos-ttl ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1660 udp-dst (udp-dst) ip-tos (ip-tos) ip-ttl (ip-ttl) ip-src (ip-src) \
1661 ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1662
1663These commands will set an internal configuration inside testpmd, any following
1664flow rule using the action vxlan_encap will use the last configuration set.
1665To have a different encapsulation header, one of those commands must be called
1666before the flow rule creation.
1667
1668Config NVGRE Encap outer layers
1669~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1670
1671Configure the outer layer to encapsulate a packet inside a NVGRE tunnel::
1672
1673 set nvgre ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) ip-dst (ip-dst) \
1674        eth-src (eth-src) eth-dst (eth-dst)
1675 set nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) \
1676        ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1677
1678These commands will set an internal configuration inside testpmd, any following
1679flow rule using the action nvgre_encap will use the last configuration set.
1680To have a different encapsulation header, one of those commands must be called
1681before the flow rule creation.
1682
1683Config L2 Encap
1684~~~~~~~~~~~~~~~
1685
1686Configure the l2 to be used when encapsulating a packet with L2::
1687
1688 set l2_encap ip-version (ipv4|ipv6) eth-src (eth-src) eth-dst (eth-dst)
1689 set l2_encap-with-vlan ip-version (ipv4|ipv6) vlan-tci (vlan-tci) \
1690        eth-src (eth-src) eth-dst (eth-dst)
1691
1692Those commands will set an internal configuration inside testpmd, any following
1693flow rule using the action l2_encap will use the last configuration set.
1694To have a different encapsulation header, one of those commands must be called
1695before the flow rule creation.
1696
1697Config L2 Decap
1698~~~~~~~~~~~~~~~
1699
1700Configure the l2 to be removed when decapsulating a packet with L2::
1701
1702 set l2_decap ip-version (ipv4|ipv6)
1703 set l2_decap-with-vlan ip-version (ipv4|ipv6)
1704
1705Those commands will set an internal configuration inside testpmd, any following
1706flow rule using the action l2_decap will use the last configuration set.
1707To have a different encapsulation header, one of those commands must be called
1708before the flow rule creation.
1709
1710Config MPLSoGRE Encap outer layers
1711~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1712
1713Configure the outer layer to encapsulate a packet inside a MPLSoGRE tunnel::
1714
1715 set mplsogre_encap ip-version (ipv4|ipv6) label (label) \
1716        ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1717 set mplsogre_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1718        ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1719        eth-src (eth-src) eth-dst (eth-dst)
1720
1721These commands will set an internal configuration inside testpmd, any following
1722flow rule using the action mplsogre_encap will use the last configuration set.
1723To have a different encapsulation header, one of those commands must be called
1724before the flow rule creation.
1725
1726Config MPLSoGRE Decap outer layers
1727~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1728
1729Configure the outer layer to decapsulate MPLSoGRE packet::
1730
1731 set mplsogre_decap ip-version (ipv4|ipv6)
1732 set mplsogre_decap-with-vlan ip-version (ipv4|ipv6)
1733
1734These commands will set an internal configuration inside testpmd, any following
1735flow rule using the action mplsogre_decap will use the last configuration set.
1736To have a different decapsulation header, one of those commands must be called
1737before the flow rule creation.
1738
1739Config MPLSoUDP Encap outer layers
1740~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1741
1742Configure the outer layer to encapsulate a packet inside a MPLSoUDP tunnel::
1743
1744 set mplsoudp_encap ip-version (ipv4|ipv6) label (label) udp-src (udp-src) \
1745        udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1746        eth-src (eth-src) eth-dst (eth-dst)
1747 set mplsoudp_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1748        udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1749        vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1750
1751These commands will set an internal configuration inside testpmd, any following
1752flow rule using the action mplsoudp_encap will use the last configuration set.
1753To have a different encapsulation header, one of those commands must be called
1754before the flow rule creation.
1755
1756Config MPLSoUDP Decap outer layers
1757~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1758
1759Configure the outer layer to decapsulate MPLSoUDP packet::
1760
1761 set mplsoudp_decap ip-version (ipv4|ipv6)
1762 set mplsoudp_decap-with-vlan ip-version (ipv4|ipv6)
1763
1764These commands will set an internal configuration inside testpmd, any following
1765flow rule using the action mplsoudp_decap will use the last configuration set.
1766To have a different decapsulation header, one of those commands must be called
1767before the flow rule creation.
1768
1769Config Raw Encapsulation
1770~~~~~~~~~~~~~~~~~~~~~~~~~
1771
1772Configure the raw data to be used when encapsulating a packet by
1773rte_flow_action_raw_encap::
1774
1775 set raw_encap {index} {item} [/ {item} [...]] / end_set
1776
1777There are multiple global buffers for ``raw_encap``, this command will set one
1778internal buffer index by ``{index}``.
1779If there is no ``{index}`` specified::
1780
1781 set raw_encap {item} [/ {item} [...]] / end_set
1782
1783the default index ``0`` is used.
1784In order to use different encapsulating header, ``index`` must be specified
1785during the flow rule creation::
1786
1787 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
1788        raw_encap index 2 / end
1789
1790Otherwise the default index ``0`` is used.
1791
1792Config Raw Decapsulation
1793~~~~~~~~~~~~~~~~~~~~~~~~
1794
1795Configure the raw data to be used when decapsulating a packet by
1796rte_flow_action_raw_decap::
1797
1798 set raw_decap {index} {item} [/ {item} [...]] / end_set
1799
1800There are multiple global buffers for ``raw_decap``, this command will set
1801one internal buffer index by ``{index}``.
1802If there is no ``{index}`` specified::
1803
1804 set raw_decap {item} [/ {item} [...]] / end_set
1805
1806the default index ``0`` is used.
1807In order to use different decapsulating header, ``index`` must be specified
1808during the flow rule creation::
1809
1810 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
1811          raw_encap index 3 / end
1812
1813Otherwise the default index ``0`` is used.
1814
1815Set fec mode
1816~~~~~~~~~~~~
1817
1818Set fec mode for a specific port::
1819
1820  testpmd> set port (port_id) fec_mode auto|off|rs|baser|llrs
1821
1822Config Sample actions list
1823~~~~~~~~~~~~~~~~~~~~~~~~~~
1824
1825Configure the sample actions list to be used when sampling a packet by
1826rte_flow_action_sample::
1827
1828 set sample_actions {index} {action} [/ {action} [...]] / end
1829
1830There are multiple global buffers for ``sample_actions``, this command will set
1831one internal buffer index by ``{index}``.
1832
1833In order to use different sample actions list, ``index`` must be specified
1834during the flow rule creation::
1835
1836 testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
1837        sample ratio 2 index 2 / end
1838
1839Otherwise the default index ``0`` is used.
1840
1841Port Functions
1842--------------
1843
1844The following sections show functions for configuring ports.
1845
1846.. note::
1847
1848   Port configuration changes only become active when forwarding is started/restarted.
1849
1850.. _port_attach:
1851
1852port attach
1853~~~~~~~~~~~
1854
1855Attach a port specified by pci address or virtual device args::
1856
1857   testpmd> port attach (identifier)
1858
1859To attach a new pci device, the device should be recognized by kernel first.
1860Then it should be moved under DPDK management.
1861Finally the port can be attached to testpmd.
1862
1863For example, to move a pci device using ixgbe under DPDK management:
1864
1865.. code-block:: console
1866
1867   # Check the status of the available devices.
1868   ./usertools/dpdk-devbind.py --status
1869
1870   Network devices using DPDK-compatible driver
1871   ============================================
1872   <none>
1873
1874   Network devices using kernel driver
1875   ===================================
1876   0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=
1877
1878
1879   # Bind the device to igb_uio.
1880   sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0
1881
1882
1883   # Recheck the status of the devices.
1884   ./usertools/dpdk-devbind.py --status
1885   Network devices using DPDK-compatible driver
1886   ============================================
1887   0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused=
1888
1889To attach a port created by virtual device, above steps are not needed.
1890
1891For example, to attach a port whose pci address is 0000:0a:00.0.
1892
1893.. code-block:: console
1894
1895   testpmd> port attach 0000:0a:00.0
1896   Attaching a new port...
1897   EAL: PCI device 0000:0a:00.0 on NUMA socket -1
1898   EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
1899   EAL:   PCI memory mapped at 0x7f83bfa00000
1900   EAL:   PCI memory mapped at 0x7f83bfa80000
1901   PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5
1902   PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
1903   Port 0 is attached. Now total ports is 1
1904   Done
1905
1906For example, to attach a port created by pcap PMD.
1907
1908.. code-block:: console
1909
1910   testpmd> port attach net_pcap0
1911   Attaching a new port...
1912   PMD: Initializing pmd_pcap for net_pcap0
1913   PMD: Creating pcap-backed ethdev on numa socket 0
1914   Port 0 is attached. Now total ports is 1
1915   Done
1916
1917In this case, identifier is ``net_pcap0``.
1918This identifier format is the same as ``--vdev`` format of DPDK applications.
1919
1920For example, to re-attach a bonding port which has been previously detached,
1921the mode and slave parameters must be given.
1922
1923.. code-block:: console
1924
1925   testpmd> port attach net_bond_0,mode=0,slave=1
1926   Attaching a new port...
1927   EAL: Initializing pmd_bond for net_bond_0
1928   EAL: Create bonding device net_bond_0 on port 0 in mode 0 on socket 0.
1929   Port 0 is attached. Now total ports is 1
1930   Done
1931
1932
1933port detach
1934~~~~~~~~~~~
1935
1936Detach a specific port::
1937
1938   testpmd> port detach (port_id)
1939
1940Before detaching a port, the port should be stopped and closed.
1941
1942For example, to detach a pci device port 0.
1943
1944.. code-block:: console
1945
1946   testpmd> port stop 0
1947   Stopping ports...
1948   Done
1949   testpmd> port close 0
1950   Closing ports...
1951   Done
1952
1953   testpmd> port detach 0
1954   Detaching a port...
1955   EAL: PCI device 0000:0a:00.0 on NUMA socket -1
1956   EAL:   remove driver: 8086:10fb rte_ixgbe_pmd
1957   EAL:   PCI memory unmapped at 0x7f83bfa00000
1958   EAL:   PCI memory unmapped at 0x7f83bfa80000
1959   Done
1960
1961
1962For example, to detach a virtual device port 0.
1963
1964.. code-block:: console
1965
1966   testpmd> port stop 0
1967   Stopping ports...
1968   Done
1969   testpmd> port close 0
1970   Closing ports...
1971   Done
1972
1973   testpmd> port detach 0
1974   Detaching a port...
1975   PMD: Closing pcap ethdev on numa socket 0
1976   Port 'net_pcap0' is detached. Now total ports is 0
1977   Done
1978
1979To remove a pci device completely from the system, first detach the port from testpmd.
1980Then the device should be moved under kernel management.
1981Finally the device can be removed using kernel pci hotplug functionality.
1982
1983For example, to move a pci device under kernel management:
1984
1985.. code-block:: console
1986
1987   sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0
1988
1989   ./usertools/dpdk-devbind.py --status
1990
1991   Network devices using DPDK-compatible driver
1992   ============================================
1993   <none>
1994
1995   Network devices using kernel driver
1996   ===================================
1997   0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio
1998
1999To remove a port created by a virtual device, above steps are not needed.
2000
2001port start
2002~~~~~~~~~~
2003
2004Start all ports or a specific port::
2005
2006   testpmd> port start (port_id|all)
2007
2008port stop
2009~~~~~~~~~
2010
2011Stop all ports or a specific port::
2012
2013   testpmd> port stop (port_id|all)
2014
2015port close
2016~~~~~~~~~~
2017
2018Close all ports or a specific port::
2019
2020   testpmd> port close (port_id|all)
2021
2022port reset
2023~~~~~~~~~~
2024
2025Reset all ports or a specific port::
2026
2027   testpmd> port reset (port_id|all)
2028
2029User should stop port(s) before resetting and (re-)start after reset.
2030
2031port config - queue ring size
2032~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2033
2034Configure a rx/tx queue ring size::
2035
2036   testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
2037
2038Only take effect after command that (re-)start the port or command that setup specific queue.
2039
2040port start/stop queue
2041~~~~~~~~~~~~~~~~~~~~~
2042
2043Start/stop a rx/tx queue on a specific port::
2044
2045   testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
2046
2047port config - queue deferred start
2048~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2049
2050Switch on/off deferred start of a specific port queue::
2051
2052   testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
2053
2054port setup queue
2055~~~~~~~~~~~~~~~~~~~~~
2056
2057Setup a rx/tx queue on a specific port::
2058
2059   testpmd> port (port_id) (rxq|txq) (queue_id) setup
2060
2061Only take effect when port is started.
2062
2063port config - speed
2064~~~~~~~~~~~~~~~~~~~
2065
2066Set the speed and duplex mode for all ports or a specific port::
2067
2068   testpmd> port config (port_id|all) speed (10|100|1000|2500|5000|10000|25000|40000|50000|100000|200000|400000|auto) \
2069            duplex (half|full|auto)
2070
2071port config - queues/descriptors
2072~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2073
2074Set number of queues/descriptors for rxq, txq, rxd and txd::
2075
2076   testpmd> port config all (rxq|txq|rxd|txd) (value)
2077
2078This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2079
2080port config - max-pkt-len
2081~~~~~~~~~~~~~~~~~~~~~~~~~
2082
2083Set the maximum packet length::
2084
2085   testpmd> port config all max-pkt-len (value)
2086
2087This is equivalent to the ``--max-pkt-len`` command-line option.
2088
2089port config - max-lro-pkt-size
2090~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2091
2092Set the maximum LRO aggregated packet size::
2093
2094   testpmd> port config all max-lro-pkt-size (value)
2095
2096This is equivalent to the ``--max-lro-pkt-size`` command-line option.
2097
2098port config - Drop Packets
2099~~~~~~~~~~~~~~~~~~~~~~~~~~
2100
2101Enable or disable packet drop on all RX queues of all ports when no receive buffers available::
2102
2103   testpmd> port config all drop-en (on|off)
2104
2105Packet dropping when no receive buffers available is off by default.
2106
2107The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2108
2109port config - RSS
2110~~~~~~~~~~~~~~~~~
2111
2112Set the RSS (Receive Side Scaling) mode on or off::
2113   testpmd> port config all rss (all|default|level-default|level-outer|level-inner| \
2114                                 ip|tcp|udp|sctp|tunnel|vlan|none| \
2115                                 ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other| \
2116                                 ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
2117                                 ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex| \
2118                                 l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan| \
2119                                 esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum| \
2120                                 l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32| \
2121                                 l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)
2122
2123RSS is on by default.
2124
2125The ``all`` option is equivalent to eth|vlan|ip|tcp|udp|sctp|ether|l2tpv3|esp|ah|pfcp|l2tpv2.
2126
2127The ``default`` option enables all supported RSS types reported by device info.
2128
2129The ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2130
2131port config - RSS Reta
2132~~~~~~~~~~~~~~~~~~~~~~
2133
2134Set the RSS (Receive Side Scaling) redirection table::
2135
2136   testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2137
2138port config - DCB
2139~~~~~~~~~~~~~~~~~
2140
2141Set the DCB mode for an individual port::
2142
2143   testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2144
2145The traffic class should be 4 or 8.
2146
2147port config - Burst
2148~~~~~~~~~~~~~~~~~~~
2149
2150Set the number of packets per burst::
2151
2152   testpmd> port config all burst (value)
2153
2154This is equivalent to the ``--burst`` command-line option.
2155
2156port config - Threshold
2157~~~~~~~~~~~~~~~~~~~~~~~
2158
2159Set thresholds for TX/RX queues::
2160
2161   testpmd> port config all (threshold) (value)
2162
2163Where the threshold type can be:
2164
2165* ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255.
2166
2167* ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255.
2168
2169* ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255.
2170
2171* ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255.
2172
2173* ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255.
2174
2175* ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255.
2176
2177* ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd.
2178
2179* ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd.
2180
2181* ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd.
2182
2183These threshold options are also available from the command-line.
2184
2185port config pctype mapping
2186~~~~~~~~~~~~~~~~~~~~~~~~~~
2187
2188Reset pctype mapping table::
2189
2190   testpmd> port config (port_id) pctype mapping reset
2191
2192Update hardware defined pctype to software defined flow type mapping table::
2193
2194   testpmd> port config (port_id) pctype mapping update (pctype_id_0[,pctype_id_1]*) (flow_type_id)
2195
2196where:
2197
2198* ``pctype_id_x``: hardware pctype id as index of bit in bitmask value of the pctype mapping table.
2199
2200* ``flow_type_id``: software flow type id as the index of the pctype mapping table.
2201
2202port config input set
2203~~~~~~~~~~~~~~~~~~~~~
2204
2205Config RSS/FDIR/FDIR flexible payload input set for some pctype::
2206
2207   testpmd> port config (port_id) pctype (pctype_id) \
2208            (hash_inset|fdir_inset|fdir_flx_inset) \
2209	    (get|set|clear) field (field_idx)
2210
2211Clear RSS/FDIR/FDIR flexible payload input set for some pctype::
2212
2213   testpmd> port config (port_id) pctype (pctype_id) \
2214            (hash_inset|fdir_inset|fdir_flx_inset) clear all
2215
2216where:
2217
2218* ``pctype_id``: hardware packet classification types.
2219* ``field_idx``: hardware field index.
2220
2221port config udp_tunnel_port
2222~~~~~~~~~~~~~~~~~~~~~~~~~~~
2223
2224Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
2225
2226    testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe|ecpri (udp_port)
2227
2228port config tx_metadata
2229~~~~~~~~~~~~~~~~~~~~~~~
2230
2231Set Tx metadata value per port.
2232testpmd will add this value to any Tx packet sent from this port::
2233
2234   testpmd> port config (port_id) tx_metadata (value)
2235
2236port config dynf
2237~~~~~~~~~~~~~~~~
2238
2239Set/clear dynamic flag per port.
2240testpmd will register this flag in the mbuf (same registration
2241for both Tx and Rx). Then set/clear this flag for each Tx
2242packet sent from this port. The set bit only works for Tx packet::
2243
2244   testpmd> port config (port_id) dynf (name) (set|clear)
2245
2246port config mtu
2247~~~~~~~~~~~~~~~
2248
2249To configure MTU(Maximum Transmission Unit) on devices using testpmd::
2250
2251   testpmd> port config mtu (port_id) (value)
2252
2253port config rss hash key
2254~~~~~~~~~~~~~~~~~~~~~~~~
2255
2256To configure the RSS hash key used to compute the RSS
2257hash of input [IP] packets received on port::
2258
2259   testpmd> port config <port_id> rss-hash-key (ipv4|ipv4-frag|\
2260                     ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|\
2261                     ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|\
2262                     ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|\
2263                     ipv6-udp-ex <string of hex digits \
2264                     (variable length, NIC dependent)>)
2265
2266port cleanup txq mbufs
2267~~~~~~~~~~~~~~~~~~~~~~
2268
2269To cleanup txq mbufs currently cached by driver::
2270
2271   testpmd> port cleanup (port_id) txq (queue_id) (free_cnt)
2272
2273If the value of ``free_cnt`` is 0, driver should free all cached mbufs.
2274
2275Device Functions
2276----------------
2277
2278The following sections show functions for device operations.
2279
2280device detach
2281~~~~~~~~~~~~~
2282
2283Detach a device specified by pci address or virtual device args::
2284
2285   testpmd> device detach (identifier)
2286
2287Before detaching a device associated with ports, the ports should be stopped and closed.
2288
2289For example, to detach a pci device whose address is 0002:03:00.0.
2290
2291.. code-block:: console
2292
2293    testpmd> device detach 0002:03:00.0
2294    Removing a device...
2295    Port 1 is now closed
2296    EAL: Releasing pci mapped resource for 0002:03:00.0
2297    EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218a050000
2298    EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218c050000
2299    Device 0002:03:00.0 is detached
2300    Now total ports is 1
2301
2302For example, to detach a port created by pcap PMD.
2303
2304.. code-block:: console
2305
2306    testpmd> device detach net_pcap0
2307    Removing a device...
2308    Port 0 is now closed
2309    Device net_pcap0 is detached
2310    Now total ports is 0
2311    Done
2312
2313In this case, identifier is ``net_pcap0``.
2314This identifier format is the same as ``--vdev`` format of DPDK applications.
2315
2316Link Bonding Functions
2317----------------------
2318
2319The Link Bonding functions make it possible to dynamically create and
2320manage link bonding devices from within testpmd interactive prompt.
2321
2322See :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information.
2323
2324Traffic Metering and Policing
2325-----------------------------
2326
2327The following section shows functions for configuring traffic metering and
2328policing on the ethernet device through the use of generic ethdev API.
2329
2330show port traffic management capability
2331~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2332
2333Show traffic metering and policing capability of the port::
2334
2335   testpmd> show port meter cap (port_id)
2336
2337add port meter profile (srTCM rfc2967)
2338~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2339
2340Add meter profile (srTCM rfc2697) to the ethernet device::
2341
2342   testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
2343   (cir) (cbs) (ebs) (packet_mode)
2344
2345where:
2346
2347* ``profile_id``: ID for the meter profile.
2348* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
2349* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
2350* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
2351* ``packet_mode``: Packets mode for meter profile.
2352
2353add port meter profile (trTCM rfc2968)
2354~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2355
2356Add meter profile (srTCM rfc2698) to the ethernet device::
2357
2358   testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
2359   (cir) (pir) (cbs) (pbs) (packet_mode)
2360
2361where:
2362
2363* ``profile_id``: ID for the meter profile.
2364* ``cir``: Committed information rate (bytes per second or packets per second).
2365* ``pir``: Peak information rate (bytes per second or packets per second).
2366* ``cbs``: Committed burst size (bytes or packets).
2367* ``pbs``: Peak burst size (bytes or packets).
2368* ``packet_mode``: Packets mode for meter profile.
2369
2370add port meter profile (trTCM rfc4115)
2371~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2372
2373Add meter profile (trTCM rfc4115) to the ethernet device::
2374
2375   testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
2376   (cir) (eir) (cbs) (ebs) (packet_mode)
2377
2378where:
2379
2380* ``profile_id``: ID for the meter profile.
2381* ``cir``: Committed information rate (bytes per second or packets per second).
2382* ``eir``: Excess information rate (bytes per second or packets per second).
2383* ``cbs``: Committed burst size (bytes or packets).
2384* ``ebs``: Excess burst size (bytes or packets).
2385* ``packet_mode``: Packets mode for meter profile.
2386
2387delete port meter profile
2388~~~~~~~~~~~~~~~~~~~~~~~~~
2389
2390Delete meter profile from the ethernet device::
2391
2392   testpmd> del port meter profile (port_id) (profile_id)
2393
2394create port policy
2395~~~~~~~~~~~~~~~~~~
2396
2397Create new policy object for the ethernet device::
2398
2399   testpmd> add port meter policy (port_id) (policy_id) g_actions \
2400   {action} y_actions {action} r_actions {action}
2401
2402where:
2403
2404* ``policy_id``: policy ID.
2405* ``action``: action lists for green/yellow/red colors.
2406
2407delete port policy
2408~~~~~~~~~~~~~~~~~~
2409
2410Delete policy object for the ethernet device::
2411
2412   testpmd> del port meter policy (port_id) (policy_id)
2413
2414where:
2415
2416* ``policy_id``: policy ID.
2417
2418create port meter
2419~~~~~~~~~~~~~~~~~
2420
2421Create new meter object for the ethernet device::
2422
2423   testpmd> create port meter (port_id) (mtr_id) (profile_id) \
2424   (policy_id) (meter_enable) (stats_mask) (shared) (default_input_color) \
2425   (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\
2426   (dscp_tbl_entry63)] [(vlan_tbl_entry0) (vlan_tbl_entry1) ... \
2427   (vlan_tbl_entry15)]
2428
2429where:
2430
2431* ``mtr_id``: meter object ID.
2432* ``profile_id``: ID for the meter profile.
2433* ``policy_id``: ID for the policy.
2434* ``meter_enable``: When this parameter has a non-zero value, the meter object
2435  gets enabled at the time of creation, otherwise remains disabled.
2436* ``stats_mask``: Mask of statistics counter types to be enabled for the
2437  meter object.
2438* ``shared``:  When this parameter has a non-zero value, the meter object is
2439  shared by multiple flows. Otherwise, meter object is used by single flow.
2440* ``default_input_color``:  Default input color for incoming packets.
2441  If incoming packet misses DSCP or VLAN input color table then it will be used
2442  as input color.
2443* ``use_pre_meter_color``: When this parameter has a non-zero value, the
2444  input color for the current meter object is determined by the latest meter
2445  object in the same flow. Otherwise, the current meter object uses the
2446  *dscp_table* to determine the input color.
2447* ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input
2448  color, 0 <= x <= 63.
2449* ``vlan_tbl_entryx``: VLAN table entry x providing meter input color,
2450  0 <= x <= 15.
2451
2452enable port meter
2453~~~~~~~~~~~~~~~~~
2454
2455Enable meter for the ethernet device::
2456
2457   testpmd> enable port meter (port_id) (mtr_id)
2458
2459disable port meter
2460~~~~~~~~~~~~~~~~~~
2461
2462Disable meter for the ethernet device::
2463
2464   testpmd> disable port meter (port_id) (mtr_id)
2465
2466delete port meter
2467~~~~~~~~~~~~~~~~~
2468
2469Delete meter for the ethernet device::
2470
2471   testpmd> del port meter (port_id) (mtr_id)
2472
2473Set port meter profile
2474~~~~~~~~~~~~~~~~~~~~~~
2475
2476Set meter profile for the ethernet device::
2477
2478   testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2479
2480set port meter dscp table
2481~~~~~~~~~~~~~~~~~~~~~~~~~
2482
2483Set meter dscp table for the ethernet device::
2484
2485   testpmd> set port meter dscp table (port_id) (mtr_id) (proto) \
2486   [(dscp_tbl_entry0) (dscp_tbl_entry1)...(dscp_tbl_entry63)]
2487
2488set port meter vlan table
2489~~~~~~~~~~~~~~~~~~~~~~~~~
2490Set meter VLAN table for the Ethernet device::
2491
2492   testpmd> set port meter vlan table (port_id) (mtr_id) (proto) \
2493   [(vlan_tbl_entry0) (vlan_tbl_entry1)...(vlan_tbl_entry15)]
2494
2495set port meter protocol
2496~~~~~~~~~~~~~~~~~~~~~~~
2497Set meter protocol and corresponding priority::
2498
2499   testpmd> set port meter proto (port_id) (mtr_id) (proto) (prio)
2500
2501get port meter protocol
2502~~~~~~~~~~~~~~~~~~~~~~~
2503Get meter protocol::
2504
2505   testpmd> get port meter proto (port_id) (mtr_id)
2506
2507get port meter protocol priority
2508~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2509Get priority associated to meter protocol::
2510
2511   testpmd> get port meter proto_prio (port_id) (mtr_id) (proto)
2512
2513set port meter stats mask
2514~~~~~~~~~~~~~~~~~~~~~~~~~
2515
2516Set meter stats mask for the ethernet device::
2517
2518   testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2519
2520where:
2521
2522* ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2523
2524show port meter stats
2525~~~~~~~~~~~~~~~~~~~~~
2526
2527Show meter stats of the ethernet device::
2528
2529   testpmd> show port meter stats (port_id) (mtr_id) (clear)
2530
2531where:
2532
2533* ``clear``: Flag that indicates whether the statistics counters should
2534  be cleared (i.e. set to zero) immediately after they have been read or not.
2535
2536Traffic Management
2537------------------
2538
2539The following section shows functions for configuring traffic management on
2540the ethernet device through the use of generic TM API.
2541
2542show port traffic management capability
2543~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2544
2545Show traffic management capability of the port::
2546
2547   testpmd> show port tm cap (port_id)
2548
2549show port traffic management capability (hierarchy level)
2550~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2551
2552Show traffic management hierarchy level capability of the port::
2553
2554   testpmd> show port tm level cap (port_id) (level_id)
2555
2556show port traffic management capability (hierarchy node level)
2557~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2558
2559Show the traffic management hierarchy node capability of the port::
2560
2561   testpmd> show port tm node cap (port_id) (node_id)
2562
2563show port traffic management hierarchy node type
2564~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2565
2566Show the port traffic management hierarchy node type::
2567
2568   testpmd> show port tm node type (port_id) (node_id)
2569
2570show port traffic management hierarchy node stats
2571~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2572
2573Show the port traffic management hierarchy node statistics::
2574
2575   testpmd> show port tm node stats (port_id) (node_id) (clear)
2576
2577where:
2578
2579* ``clear``: When this parameter has a non-zero value, the statistics counters
2580  are cleared (i.e. set to zero) immediately after they have been read,
2581  otherwise the statistics counters are left untouched.
2582
2583Add port traffic management private shaper profile
2584~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2585
2586Add the port traffic management private shaper profile::
2587
2588   testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
2589   (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
2590   (packet_length_adjust) (packet_mode)
2591
2592where:
2593
2594* ``shaper_profile id``: Shaper profile ID for the new profile.
2595* ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second).
2596* ``cmit_tb_size``: Committed token bucket size (bytes or packets).
2597* ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second).
2598* ``peak_tb_size``: Peak token bucket size (bytes or packets).
2599* ``packet_length_adjust``: The value (bytes) to be added to the length of
2600  each packet for the purpose of shaping. This parameter value can be used to
2601  correct the packet length with the framing overhead bytes that are consumed
2602  on the wire.
2603* ``packet_mode``: Shaper configured in packet mode. This parameter value if
2604  zero, configures shaper in byte mode and if non-zero configures it in packet
2605  mode.
2606
2607Delete port traffic management private shaper profile
2608~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2609
2610Delete the port traffic management private shaper::
2611
2612   testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
2613
2614where:
2615
2616* ``shaper_profile id``: Shaper profile ID that needs to be deleted.
2617
2618Add port traffic management shared shaper
2619~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2620
2621Create the port traffic management shared shaper::
2622
2623   testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \
2624   (shaper_profile_id)
2625
2626where:
2627
2628* ``shared_shaper_id``: Shared shaper ID to be created.
2629* ``shaper_profile id``: Shaper profile ID for shared shaper.
2630
2631Set port traffic management shared shaper
2632~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2633
2634Update the port traffic management shared shaper::
2635
2636   testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \
2637   (shaper_profile_id)
2638
2639where:
2640
2641* ``shared_shaper_id``: Shared shaper ID to be update.
2642* ``shaper_profile id``: Shaper profile ID for shared shaper.
2643
2644Delete port traffic management shared shaper
2645~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2646
2647Delete the port traffic management shared shaper::
2648
2649   testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
2650
2651where:
2652
2653* ``shared_shaper_id``: Shared shaper ID to be deleted.
2654
2655Set port traffic management hierarchy node private shaper
2656~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2657
2658set the port traffic management hierarchy node private shaper::
2659
2660   testpmd> set port tm node shaper profile (port_id) (node_id) \
2661   (shaper_profile_id)
2662
2663where:
2664
2665* ``shaper_profile id``: Private shaper profile ID to be enabled on the
2666  hierarchy node.
2667
2668Add port traffic management WRED profile
2669~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2670
2671Create a new WRED profile::
2672
2673   testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
2674   (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
2675   (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
2676   (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
2677
2678where:
2679
2680* ``wred_profile id``: Identifier for the newly create WRED profile
2681* ``color_g``: Packet color (green)
2682* ``min_th_g``: Minimum queue threshold for packet with green color
2683* ``max_th_g``: Minimum queue threshold for packet with green color
2684* ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp)
2685* ``wq_log2_g``: Negated log2 of queue weight (wq)
2686* ``color_y``: Packet color (yellow)
2687* ``min_th_y``: Minimum queue threshold for packet with yellow color
2688* ``max_th_y``: Minimum queue threshold for packet with yellow color
2689* ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp)
2690* ``wq_log2_y``: Negated log2 of queue weight (wq)
2691* ``color_r``: Packet color (red)
2692* ``min_th_r``: Minimum queue threshold for packet with yellow color
2693* ``max_th_r``: Minimum queue threshold for packet with yellow color
2694* ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp)
2695* ``wq_log2_r``: Negated log2 of queue weight (wq)
2696
2697Delete port traffic management WRED profile
2698~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2699
2700Delete the WRED profile::
2701
2702   testpmd> del port tm node wred profile (port_id) (wred_profile_id)
2703
2704Add port traffic management hierarchy nonleaf node
2705~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2706
2707Add nonleaf node to port traffic management hierarchy::
2708
2709   testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \
2710   (priority) (weight) (level_id) (shaper_profile_id) \
2711   (n_sp_priorities) (stats_mask) (n_shared_shapers) \
2712   [(shared_shaper_0) (shared_shaper_1) ...] \
2713
2714where:
2715
2716* ``parent_node_id``: Node ID of the parent.
2717* ``priority``: Node priority (highest node priority is zero). This is used by
2718  the SP algorithm running on the parent node for scheduling this node.
2719* ``weight``: Node weight (lowest weight is one). The node weight is relative
2720  to the weight sum of all siblings that have the same priority. It is used by
2721  the WFQ algorithm running on the parent node for scheduling this node.
2722* ``level_id``: Hierarchy level of the node.
2723* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2724  the node.
2725* ``n_sp_priorities``: Number of strict priorities.
2726* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2727* ``n_shared_shapers``: Number of shared shapers.
2728* ``shared_shaper_id``: Shared shaper id.
2729
2730Add port traffic management hierarchy nonleaf node with packet mode
2731~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2732
2733Add nonleaf node with packet mode to port traffic management hierarchy::
2734
2735   testpmd> add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id) \
2736   (priority) (weight) (level_id) (shaper_profile_id) \
2737   (n_sp_priorities) (stats_mask) (n_shared_shapers) \
2738   [(shared_shaper_0) (shared_shaper_1) ...] \
2739
2740where:
2741
2742* ``parent_node_id``: Node ID of the parent.
2743* ``priority``: Node priority (highest node priority is zero). This is used by
2744  the SP algorithm running on the parent node for scheduling this node.
2745* ``weight``: Node weight (lowest weight is one). The node weight is relative
2746  to the weight sum of all siblings that have the same priority. It is used by
2747  the WFQ algorithm running on the parent node for scheduling this node.
2748* ``level_id``: Hierarchy level of the node.
2749* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2750  the node.
2751* ``n_sp_priorities``: Number of strict priorities. Packet mode is enabled on
2752  all of them.
2753* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2754* ``n_shared_shapers``: Number of shared shapers.
2755* ``shared_shaper_id``: Shared shaper id.
2756
2757Add port traffic management hierarchy leaf node
2758~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2759
2760Add leaf node to port traffic management hierarchy::
2761
2762   testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \
2763   (priority) (weight) (level_id) (shaper_profile_id) \
2764   (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \
2765   [(shared_shaper_id) (shared_shaper_id) ...] \
2766
2767where:
2768
2769* ``parent_node_id``: Node ID of the parent.
2770* ``priority``: Node priority (highest node priority is zero). This is used by
2771  the SP algorithm running on the parent node for scheduling this node.
2772* ``weight``: Node weight (lowest weight is one). The node weight is relative
2773  to the weight sum of all siblings that have the same priority. It is used by
2774  the WFQ algorithm running on the parent node for scheduling this node.
2775* ``level_id``: Hierarchy level of the node.
2776* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2777  the node.
2778* ``cman_mode``: Congestion management mode to be enabled for this node.
2779* ``wred_profile_id``: WRED profile id to be enabled for this node.
2780* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2781* ``n_shared_shapers``: Number of shared shapers.
2782* ``shared_shaper_id``: Shared shaper id.
2783
2784Delete port traffic management hierarchy node
2785~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2786
2787Delete node from port traffic management hierarchy::
2788
2789   testpmd> del port tm node (port_id) (node_id)
2790
2791Update port traffic management hierarchy parent node
2792~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2793
2794Update port traffic management hierarchy parent node::
2795
2796   testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \
2797   (priority) (weight)
2798
2799This function can only be called after the hierarchy commit invocation. Its
2800success depends on the port support for this operation, as advertised through
2801the port capability set. This function is valid for all nodes of the traffic
2802management hierarchy except root node.
2803
2804Suspend port traffic management hierarchy node
2805~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2806
2807   testpmd> suspend port tm node (port_id) (node_id)
2808
2809Resume port traffic management hierarchy node
2810~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2811
2812   testpmd> resume port tm node (port_id) (node_id)
2813
2814Commit port traffic management hierarchy
2815~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2816
2817Commit the traffic management hierarchy on the port::
2818
2819   testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
2820
2821where:
2822
2823* ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function
2824  call failure. On the other hand, hierarchy is preserved when this parameter
2825  is equal to zero.
2826
2827Set port traffic management mark VLAN dei
2828~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2829
2830Enables/Disables the traffic management marking on the port for VLAN packets::
2831
2832   testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red>
2833
2834where:
2835
2836* ``port_id``: The port which on which VLAN packets marked as ``green`` or
2837  ``yellow`` or ``red`` will have dei bit enabled
2838
2839* ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green
2840
2841* ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow
2842
2843* ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red
2844
2845Set port traffic management mark IP dscp
2846~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2847
2848Enables/Disables the traffic management marking on the port for IP dscp packets::
2849
2850   testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red>
2851
2852where:
2853
2854* ``port_id``: The port which on which IP packets marked as ``green`` or
2855  ``yellow`` or ``red`` will have IP dscp bits updated
2856
2857* ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets
2858
2859* ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets
2860
2861* ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets
2862
2863Set port traffic management mark IP ecn
2864~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2865
2866Enables/Disables the traffic management marking on the port for IP ecn packets::
2867
2868   testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red>
2869
2870where:
2871
2872* ``port_id``: The port which on which IP packets marked as ``green`` or
2873  ``yellow`` or ``red`` will have IP ecn bits updated
2874
2875* ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01  or 2'b10
2876  to ecn of 2'b11 when IP is caring TCP or SCTP
2877
2878* ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
2879  to ecn of 2'b11 when IP is caring TCP or SCTP
2880
2881* ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
2882  to ecn of 2'b11 when IP is caring TCP or SCTP
2883
2884Congestion Management
2885---------------------
2886
2887Get capabilities
2888~~~~~~~~~~~~~~~~
2889
2890Retrieve congestion management capabilities supported by driver for given port.
2891Below example command retrieves capabilities for port 0::
2892
2893   testpmd> show port cman capa 0
2894
2895Get configuration
2896~~~~~~~~~~~~~~~~~
2897
2898Retrieve congestion management configuration for given port.
2899Below example command retrieves configuration for port 0::
2900
2901   testpmd> show port cman config 0
2902
2903Set configuration
2904~~~~~~~~~~~~~~~~~
2905
2906Configures congestion management settings on given queue
2907or mempool associated with queue.
2908Below example command configures RED as congestion management algorithm
2909for port 0 and queue 0::
2910
2911   testpmd> set port cman config 0 0 obj queue mode red 10 100 1
2912
2913Filter Functions
2914----------------
2915
2916This section details the available filter functions that are available.
2917
2918Note these functions interface the deprecated legacy filtering framework,
2919superseded by *rte_flow*. See `Flow rules management`_.
2920
2921.. _testpmd_rte_flow:
2922
2923Flow rules management
2924---------------------
2925
2926Control of the generic flow API (*rte_flow*) is fully exposed through the
2927``flow`` command (configuration, validation, creation, destruction, queries
2928and operation modes).
2929
2930Considering *rte_flow* overlaps with all `Filter Functions`_, using both
2931features simultaneously may cause undefined side-effects and is therefore
2932not recommended.
2933
2934``flow`` syntax
2935~~~~~~~~~~~~~~~
2936
2937Because the ``flow`` command uses dynamic tokens to handle the large number
2938of possible flow rules combinations, its behavior differs slightly from
2939other commands, in particular:
2940
2941- Pressing *?* or the *<tab>* key displays contextual help for the current
2942  token, not that of the entire command.
2943
2944- Optional and repeated parameters are supported (provided they are listed
2945  in the contextual help).
2946
2947The first parameter stands for the operation mode. Possible operations and
2948their general syntax are described below. They are covered in detail in the
2949following sections.
2950
2951- Get info about flow engine::
2952
2953   flow info {port_id}
2954
2955- Configure flow engine::
2956
2957   flow configure {port_id}
2958       [queues_number {number}] [queues_size {size}]
2959       [counters_number {number}]
2960       [aging_counters_number {number}]
2961       [meters_number {number}] [flags {number}]
2962
2963- Create a pattern template::
2964
2965   flow pattern_template {port_id} create [pattern_template_id {id}]
2966       [relaxed {boolean}] [ingress] [egress] [transfer]
2967       template {item} [/ {item} [...]] / end
2968
2969- Destroy a pattern template::
2970
2971   flow pattern_template {port_id} destroy pattern_template {id} [...]
2972
2973- Create an actions template::
2974
2975   flow actions_template {port_id} create [actions_template_id {id}]
2976       [ingress] [egress] [transfer]
2977       template {action} [/ {action} [...]] / end
2978       mask {action} [/ {action} [...]] / end
2979
2980- Destroy an actions template::
2981
2982   flow actions_template {port_id} destroy actions_template {id} [...]
2983
2984- Create a table::
2985
2986   flow table {port_id} create
2987       [table_id {id}]
2988       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
2989       rules_number {number}
2990       pattern_template {pattern_template_id}
2991       actions_template {actions_template_id}
2992
2993- Destroy a table::
2994
2995   flow table {port_id} destroy table {id} [...]
2996
2997- Check whether a flow rule can be created::
2998
2999   flow validate {port_id}
3000       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3001       pattern {item} [/ {item} [...]] / end
3002       actions {action} [/ {action} [...]] / end
3003
3004- Enqueue creation of a flow rule::
3005
3006   flow queue {port_id} create {queue_id}
3007       [postpone {boolean}] template_table {table_id}
3008       pattern_template {pattern_template_index}
3009       actions_template {actions_template_index}
3010       pattern {item} [/ {item} [...]] / end
3011       actions {action} [/ {action} [...]] / end
3012
3013- Enqueue destruction of specific flow rules::
3014
3015   flow queue {port_id} destroy {queue_id}
3016       [postpone {boolean}] rule {rule_id} [...]
3017
3018- Push enqueued operations::
3019
3020   flow push {port_id} queue {queue_id}
3021
3022- Pull all operations results from a queue::
3023
3024   flow pull {port_id} queue {queue_id}
3025
3026- Create a flow rule::
3027
3028   flow create {port_id}
3029       [group {group_id}] [priority {level}] [ingress] [egress]
3030       [transfer] [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}]
3031       [user_id {user_id}] pattern {item} [/ {item} [...]] / end
3032       actions {action} [/ {action} [...]] / end
3033
3034- Destroy specific flow rules::
3035
3036   flow destroy {port_id} rule {rule_id} [...] [user_id]
3037
3038- Destroy all flow rules::
3039
3040   flow flush {port_id}
3041
3042- Query an existing flow rule::
3043
3044   flow query {port_id} {rule_id} {action} [user_id]
3045
3046- List existing flow rules sorted by priority, filtered by group
3047  identifiers::
3048
3049   flow list {port_id} [group {group_id}] [...]
3050
3051- Restrict ingress traffic to the defined flow rules::
3052
3053   flow isolate {port_id} {boolean}
3054
3055- Dump internal representation information of all flows in hardware::
3056
3057   flow dump {port_id} all {output_file} [user_id]
3058
3059  for one flow::
3060
3061   flow dump {port_id} rule {rule_id} {output_file} [user_id]
3062
3063- List and destroy aged flow rules::
3064
3065   flow aged {port_id} [destroy]
3066
3067- Enqueue list and destroy aged flow rules::
3068
3069   flow queue {port_id} aged {queue_id} [destroy]
3070
3071- Tunnel offload - create a tunnel stub::
3072
3073   flow tunnel create {port_id} type {tunnel_type}
3074
3075- Tunnel offload - destroy a tunnel stub::
3076
3077   flow tunnel destroy {port_id} id {tunnel_id}
3078
3079- Tunnel offload - list port tunnel stubs::
3080
3081   flow tunnel list {port_id}
3082
3083Retrieving info about flow management engine
3084~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3085
3086``flow info`` retrieves info on pre-configurable resources in the underlying
3087device to give a hint of possible values for flow engine configuration.
3088
3089``rte_flow_info_get()``::
3090
3091   flow info {port_id}
3092
3093If successful, it will show::
3094
3095   Flow engine resources on port #[...]:
3096   Number of queues: #[...]
3097   Size of queues: #[...]
3098   Number of counters: #[...]
3099   Number of aging objects: #[...]
3100   Number of meters: #[...]
3101
3102Otherwise it will show an error message of the form::
3103
3104   Caught error type [...] ([...]): [...]
3105
3106Configuring flow management engine
3107~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3108
3109``flow configure`` pre-allocates all the needed resources in the underlying
3110device to be used later at the flow creation. Flow queues are allocated as well
3111for asynchronous flow creation/destruction operations. It is bound to
3112``rte_flow_configure()``::
3113
3114   flow configure {port_id}
3115       [queues_number {number}] [queues_size {size}]
3116       [counters_number {number}]
3117       [aging_counters_number {number}]
3118       [host_port {number}]
3119       [meters_number {number}]
3120       [flags {number}]
3121
3122If successful, it will show::
3123
3124   Configure flows on port #[...]: number of queues #[...] with #[...] elements
3125
3126Otherwise it will show an error message of the form::
3127
3128   Caught error type [...] ([...]): [...]
3129
3130Creating pattern templates
3131~~~~~~~~~~~~~~~~~~~~~~~~~~
3132
3133``flow pattern_template create`` creates the specified pattern template.
3134It is bound to ``rte_flow_pattern_template_create()``::
3135
3136   flow pattern_template {port_id} create [pattern_template_id {id}]
3137       [relaxed {boolean}] [ingress] [egress] [transfer]
3138	   template {item} [/ {item} [...]] / end
3139
3140If successful, it will show::
3141
3142   Pattern template #[...] created
3143
3144Otherwise it will show an error message of the form::
3145
3146   Caught error type [...] ([...]): [...]
3147
3148This command uses the same pattern items as ``flow create``,
3149their format is described in `Creating flow rules`_.
3150
3151Destroying pattern templates
3152~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3153
3154``flow pattern_template destroy`` destroys one or more pattern templates
3155from their template ID (as returned by ``flow pattern_template create``),
3156this command calls ``rte_flow_pattern_template_destroy()`` as many
3157times as necessary::
3158
3159   flow pattern_template {port_id} destroy pattern_template {id} [...]
3160
3161If successful, it will show::
3162
3163   Pattern template #[...] destroyed
3164
3165It does not report anything for pattern template IDs that do not exist.
3166The usual error message is shown when a pattern template cannot be destroyed::
3167
3168   Caught error type [...] ([...]): [...]
3169
3170Creating actions templates
3171~~~~~~~~~~~~~~~~~~~~~~~~~~
3172
3173``flow actions_template create`` creates the specified actions template.
3174It is bound to ``rte_flow_actions_template_create()``::
3175
3176   flow actions_template {port_id} create [actions_template_id {id}]
3177       [ingress] [egress] [transfer]
3178	   template {action} [/ {action} [...]] / end
3179       mask {action} [/ {action} [...]] / end
3180
3181If successful, it will show::
3182
3183   Actions template #[...] created
3184
3185Otherwise it will show an error message of the form::
3186
3187   Caught error type [...] ([...]): [...]
3188
3189This command uses the same actions as ``flow create``,
3190their format is described in `Creating flow rules`_.
3191
3192Destroying actions templates
3193~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3194
3195``flow actions_template destroy`` destroys one or more actions templates
3196from their template ID (as returned by ``flow actions_template create``),
3197this command calls ``rte_flow_actions_template_destroy()`` as many
3198times as necessary::
3199
3200   flow actions_template {port_id} destroy actions_template {id} [...]
3201
3202If successful, it will show::
3203
3204   Actions template #[...] destroyed
3205
3206It does not report anything for actions template IDs that do not exist.
3207The usual error message is shown when an actions template cannot be destroyed::
3208
3209   Caught error type [...] ([...]): [...]
3210
3211Creating template table
3212~~~~~~~~~~~~~~~~~~~~~~~
3213
3214``flow template_table create`` creates the specified template table.
3215It is bound to ``rte_flow_template_table_create()``::
3216
3217   flow template_table {port_id} create
3218       [table_id {id}] [group {group_id}]
3219       [priority {level}] [ingress] [egress]
3220       [transfer [vport_orig] [wire_orig]]
3221       rules_number {number}
3222       pattern_template {pattern_template_id}
3223       actions_template {actions_template_id}
3224
3225If successful, it will show::
3226
3227   Template table #[...] created
3228
3229Otherwise it will show an error message of the form::
3230
3231   Caught error type [...] ([...]): [...]
3232
3233Destroying flow table
3234~~~~~~~~~~~~~~~~~~~~~
3235
3236``flow template_table destroy`` destroys one or more template tables
3237from their table ID (as returned by ``flow template_table create``),
3238this command calls ``rte_flow_template_table_destroy()`` as many
3239times as necessary::
3240
3241   flow template_table {port_id} destroy table {id} [...]
3242
3243If successful, it will show::
3244
3245   Template table #[...] destroyed
3246
3247It does not report anything for table IDs that do not exist.
3248The usual error message is shown when a table cannot be destroyed::
3249
3250   Caught error type [...] ([...]): [...]
3251
3252Pushing enqueued operations
3253~~~~~~~~~~~~~~~~~~~~~~~~~~~
3254
3255``flow push`` pushes all the outstanding enqueued operations
3256to the underlying device immediately.
3257It is bound to ``rte_flow_push()``::
3258
3259   flow push {port_id} queue {queue_id}
3260
3261If successful, it will show::
3262
3263   Queue #[...] operations pushed
3264
3265The usual error message is shown when operations cannot be pushed::
3266
3267   Caught error type [...] ([...]): [...]
3268
3269Pulling flow operations results
3270~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3271
3272``flow pull`` asks the underlying device about flow queue operations
3273results and return all the processed (successfully or not) operations.
3274It is bound to ``rte_flow_pull()``::
3275
3276   flow pull {port_id} queue {queue_id}
3277
3278If successful, it will show::
3279
3280   Queue #[...] pulled #[...] operations (#[...] failed, #[...] succeeded)
3281
3282The usual error message is shown when operations results cannot be pulled::
3283
3284   Caught error type [...] ([...]): [...]
3285
3286Creating a tunnel stub for offload
3287~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3288
3289``flow tunnel create`` setup a tunnel stub for tunnel offload flow rules::
3290
3291   flow tunnel create {port_id} type {tunnel_type}
3292
3293If successful, it will return a tunnel stub ID usable with other commands::
3294
3295   port [...]: flow tunnel #[...] type [...]
3296
3297Tunnel stub ID is relative to a port.
3298
3299Destroying tunnel offload stub
3300~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3301
3302``flow tunnel destroy`` destroy port tunnel stub::
3303
3304   flow tunnel destroy {port_id} id {tunnel_id}
3305
3306Listing tunnel offload stubs
3307~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3308
3309``flow tunnel list`` list port tunnel offload stubs::
3310
3311   flow tunnel list {port_id}
3312
3313Validating flow rules
3314~~~~~~~~~~~~~~~~~~~~~
3315
3316``flow validate`` reports whether a flow rule would be accepted by the
3317underlying device in its current state but stops short of creating it. It is
3318bound to ``rte_flow_validate()``::
3319
3320   flow validate {port_id}
3321      [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3322      pattern {item} [/ {item} [...]] / end
3323      actions {action} [/ {action} [...]] / end
3324
3325If successful, it will show::
3326
3327   Flow rule validated
3328
3329Otherwise it will show an error message of the form::
3330
3331   Caught error type [...] ([...]): [...]
3332
3333This command uses the same parameters as ``flow create``, their format is
3334described in `Creating flow rules`_.
3335
3336Check whether redirecting any Ethernet packet received on port 0 to RX queue
3337index 6 is supported::
3338
3339   testpmd> flow validate 0 ingress pattern eth / end
3340      actions queue index 6 / end
3341   Flow rule validated
3342   testpmd>
3343
3344Port 0 does not support TCPv6 rules::
3345
3346   testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end
3347      actions drop / end
3348   Caught error type 9 (specific pattern item): Invalid argument
3349   testpmd>
3350
3351Creating flow rules
3352~~~~~~~~~~~~~~~~~~~
3353
3354``flow create`` validates and creates the specified flow rule. It is bound
3355to ``rte_flow_create()``::
3356
3357   flow create {port_id}
3358      [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3359      [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}]
3360      [user_id {user_id}] pattern {item} [/ {item} [...]] / end
3361      actions {action} [/ {action} [...]] / end
3362
3363If successful, it will return a flow rule ID usable with other commands::
3364
3365   Flow rule #[...] created
3366
3367Or if ``user_id`` is provided::
3368
3369   Flow rule #[...] created, user-id [...]
3370
3371Otherwise it will show an error message of the form::
3372
3373   Caught error type [...] ([...]): [...]
3374
3375Parameters describe in the following order:
3376
3377- Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens).
3378- Tunnel offload specification (tunnel_set, tunnel_match)
3379- User identifier for the flow.
3380- A matching pattern, starting with the *pattern* token and terminated by an
3381  *end* pattern item.
3382- Actions, starting with the *actions* token and terminated by an *end*
3383  action.
3384
3385These translate directly to *rte_flow* objects provided as-is to the
3386underlying functions.
3387
3388The shortest valid definition only comprises mandatory tokens::
3389
3390   testpmd> flow create 0 pattern end actions end
3391
3392Note that PMDs may refuse rules that essentially do nothing such as this
3393one.
3394
3395**All unspecified object values are automatically initialized to 0.**
3396
3397Enqueueing creation of flow rules
3398~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3399
3400``flow queue create`` adds creation operation of a flow rule to a queue.
3401It is bound to ``rte_flow_async_create()``::
3402
3403   flow queue {port_id} create {queue_id}
3404       [postpone {boolean}] template_table {table_id}
3405       pattern_template {pattern_template_index}
3406       actions_template {actions_template_index}
3407       pattern {item} [/ {item} [...]] / end
3408       actions {action} [/ {action} [...]] / end
3409
3410If successful, it will return a flow rule ID usable with other commands::
3411
3412   Flow rule #[...] creaion enqueued
3413
3414Otherwise it will show an error message of the form::
3415
3416   Caught error type [...] ([...]): [...]
3417
3418This command uses the same pattern items and actions as ``flow create``,
3419their format is described in `Creating flow rules`_.
3420
3421``flow queue pull`` must be called to retrieve the operation status.
3422
3423Attributes
3424^^^^^^^^^^
3425
3426These tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3427specified before the ``pattern`` token.
3428
3429- ``group {group id}``: priority group.
3430- ``priority {level}``: priority level within group.
3431- ``ingress``: rule applies to ingress traffic.
3432- ``egress``: rule applies to egress traffic.
3433- ``transfer``: apply rule directly to endpoints found in pattern.
3434
3435Please note that use of ``transfer`` attribute requires that the flow and
3436its indirect components be managed via so-called ``transfer`` proxy port.
3437See `show flow transfer proxy port ID for the given port`_ for details.
3438
3439Each instance of an attribute specified several times overrides the previous
3440value as shown below (group 4 is used)::
3441
3442   testpmd> flow create 0 group 42 group 24 group 4 [...]
3443
3444Note that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3445
3446While not specifying a direction is an error, some rules may allow both
3447simultaneously.
3448
3449Most rules affect RX therefore contain the ``ingress`` token::
3450
3451   testpmd> flow create 0 ingress pattern [...]
3452
3453Tunnel offload
3454^^^^^^^^^^^^^^
3455
3456Indicate tunnel offload rule type
3457
3458- ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type.
3459- ``tunnel_match {tunnel_id}``:  mark rule as tunnel offload match type.
3460
3461Matching pattern
3462^^^^^^^^^^^^^^^^
3463
3464A matching pattern starts after the ``pattern`` token. It is made of pattern
3465items and is terminated by a mandatory ``end`` item.
3466
3467Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3468rte_flow_item_type``).
3469
3470The ``/`` token is used as a separator between pattern items as shown
3471below::
3472
3473   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3474
3475Note that protocol items like these must be stacked from lowest to highest
3476layer to make sense. For instance, the following rule is either invalid or
3477unlikely to match any packet::
3478
3479   testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3480
3481More information on these restrictions can be found in the *rte_flow*
3482documentation.
3483
3484Several items support additional specification structures, for example
3485``ipv4`` allows specifying source and destination addresses as follows::
3486
3487   testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1
3488      dst is 10.2.0.0 / end [...]
3489
3490This rule matches all IPv4 traffic with the specified properties.
3491
3492In this example, ``src`` and ``dst`` are field names of the underlying
3493``struct rte_flow_item_ipv4`` object. All item properties can be specified
3494in a similar fashion.
3495
3496The ``is`` token means that the subsequent value must be matched exactly,
3497and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3498accordingly. Possible assignment tokens are:
3499
3500- ``is``: match value perfectly (with full bit-mask).
3501- ``spec``: match value according to configured bit-mask.
3502- ``last``: specify upper bound to establish a range.
3503- ``mask``: specify bit-mask with relevant bits set to one.
3504- ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one.
3505
3506These yield identical results::
3507
3508   ipv4 src is 10.1.1.1
3509
3510::
3511
3512   ipv4 src spec 10.1.1.1 src mask 255.255.255.255
3513
3514::
3515
3516   ipv4 src spec 10.1.1.1 src prefix 32
3517
3518::
3519
3520   ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value
3521
3522::
3523
3524   ipv4 src is 10.1.1.1 src last 0 # 0 disables range
3525
3526Inclusive ranges can be defined with ``last``::
3527
3528   ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4
3529
3530Note that ``mask`` affects both ``spec`` and ``last``::
3531
3532   ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0
3533      # matches 10.1.0.0 to 10.2.255.255
3534
3535Properties can be modified multiple times::
3536
3537   ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4
3538
3539::
3540
3541   ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16
3542
3543Pattern items
3544^^^^^^^^^^^^^
3545
3546This section lists supported pattern items and their attributes, if any.
3547
3548- ``end``: end list of pattern items.
3549
3550- ``void``: no-op pattern item.
3551
3552- ``invert``: perform actions when pattern does not match.
3553
3554- ``any``: match any protocol for the current layer.
3555
3556  - ``num {unsigned}``: number of layers covered.
3557
3558- ``port_id``: match traffic from/to a given DPDK port ID.
3559
3560  - ``id {unsigned}``: DPDK port ID.
3561
3562- ``mark``: match value set in previously matched flow rule using the mark action.
3563
3564  - ``id {unsigned}``: arbitrary integer value.
3565
3566- ``raw``: match an arbitrary byte string.
3567
3568  - ``relative {boolean}``: look for pattern after the previous item.
3569  - ``search {boolean}``: search pattern from offset (see also limit).
3570  - ``offset {integer}``: absolute or relative offset for pattern.
3571  - ``limit {unsigned}``: search area limit for start of pattern.
3572  - ``pattern {string}``: byte string to look for.
3573  - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for.
3574
3575- ``eth``: match Ethernet header.
3576
3577  - ``dst {MAC-48}``: destination MAC.
3578  - ``src {MAC-48}``: source MAC.
3579  - ``type {unsigned}``: EtherType or TPID.
3580
3581- ``vlan``: match 802.1Q/ad VLAN tag.
3582
3583  - ``tci {unsigned}``: tag control information.
3584  - ``pcp {unsigned}``: priority code point.
3585  - ``dei {unsigned}``: drop eligible indicator.
3586  - ``vid {unsigned}``: VLAN identifier.
3587  - ``inner_type {unsigned}``: inner EtherType or TPID.
3588
3589- ``ipv4``: match IPv4 header.
3590
3591  - ``version_ihl {unsigned}``: IPv4 version and IP header length.
3592  - ``tos {unsigned}``: type of service.
3593  - ``ttl {unsigned}``: time to live.
3594  - ``proto {unsigned}``: next protocol ID.
3595  - ``src {ipv4 address}``: source address.
3596  - ``dst {ipv4 address}``: destination address.
3597
3598- ``ipv6``: match IPv6 header.
3599
3600  - ``tc {unsigned}``: traffic class.
3601  - ``flow {unsigned}``: flow label.
3602  - ``proto {unsigned}``: protocol (next header).
3603  - ``hop {unsigned}``: hop limit.
3604  - ``src {ipv6 address}``: source address.
3605  - ``dst {ipv6 address}``: destination address.
3606
3607- ``icmp``: match ICMP header.
3608
3609  - ``type {unsigned}``: ICMP packet type.
3610  - ``code {unsigned}``: ICMP packet code.
3611
3612- ``udp``: match UDP header.
3613
3614  - ``src {unsigned}``: UDP source port.
3615  - ``dst {unsigned}``: UDP destination port.
3616
3617- ``tcp``: match TCP header.
3618
3619  - ``src {unsigned}``: TCP source port.
3620  - ``dst {unsigned}``: TCP destination port.
3621
3622- ``sctp``: match SCTP header.
3623
3624  - ``src {unsigned}``: SCTP source port.
3625  - ``dst {unsigned}``: SCTP destination port.
3626  - ``tag {unsigned}``: validation tag.
3627  - ``cksum {unsigned}``: checksum.
3628
3629- ``vxlan``: match VXLAN header.
3630
3631  - ``vni {unsigned}``: VXLAN identifier.
3632  - ``last_rsvd {unsigned}``: VXLAN last reserved 8-bits.
3633
3634- ``e_tag``: match IEEE 802.1BR E-Tag header.
3635
3636  - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
3637
3638- ``nvgre``: match NVGRE header.
3639
3640  - ``tni {unsigned}``: virtual subnet ID.
3641
3642- ``mpls``: match MPLS header.
3643
3644  - ``label {unsigned}``: MPLS label.
3645
3646- ``gre``: match GRE header.
3647
3648  - ``protocol {unsigned}``: protocol type.
3649
3650- ``gre_key``: match GRE optional key field.
3651
3652  - ``value {unsigned}``: key value.
3653
3654- ``gre_option``: match GRE optional fields(checksum/key/sequence).
3655
3656  - ``checksum {unsigned}``: checksum value.
3657  - ``key {unsigned}``: key value.
3658  - ``sequence {unsigned}``: sequence number value.
3659
3660- ``fuzzy``: fuzzy pattern match, expect faster than default.
3661
3662  - ``thresh {unsigned}``: accuracy threshold.
3663
3664- ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header.
3665
3666  - ``teid {unsigned}``: tunnel endpoint identifier.
3667
3668- ``geneve``: match GENEVE header.
3669
3670  - ``vni {unsigned}``: virtual network identifier.
3671  - ``protocol {unsigned}``: protocol type.
3672
3673- ``geneve-opt``: match GENEVE header option.
3674
3675  - ``class {unsigned}``: GENEVE option class.
3676  - ``type {unsigned}``: GENEVE option type.
3677  - ``length {unsigned}``: GENEVE option length in 32-bit words.
3678  - ``data {hex string}``: GENEVE option data, the length is defined by
3679    ``length`` field.
3680
3681- ``vxlan-gpe``: match VXLAN-GPE header.
3682
3683  - ``vni {unsigned}``: VXLAN-GPE identifier.
3684
3685- ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4.
3686
3687  - ``sha {MAC-48}``: sender hardware address.
3688  - ``spa {ipv4 address}``: sender IPv4 address.
3689  - ``tha {MAC-48}``: target hardware address.
3690  - ``tpa {ipv4 address}``: target IPv4 address.
3691
3692- ``ipv6_ext``: match presence of any IPv6 extension header.
3693
3694  - ``next_hdr {unsigned}``: next header.
3695
3696- ``icmp6``: match any ICMPv6 header.
3697
3698  - ``type {unsigned}``: ICMPv6 type.
3699  - ``code {unsigned}``: ICMPv6 code.
3700
3701- ``icmp6_echo_request``: match ICMPv6 echo request.
3702
3703  - ``ident {unsigned}``: ICMPv6 echo request identifier.
3704  - ``seq {unsigned}``: ICMPv6 echo request sequence number.
3705
3706- ``icmp6_echo_reply``: match ICMPv6 echo reply.
3707
3708  - ``ident {unsigned}``: ICMPv6 echo reply identifier.
3709  - ``seq {unsigned}``: ICMPv6 echo reply sequence number.
3710
3711- ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
3712
3713  - ``target_addr {ipv6 address}``: target address.
3714
3715- ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement.
3716
3717  - ``target_addr {ipv6 address}``: target address.
3718
3719- ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option.
3720
3721  - ``type {unsigned}``: ND option type.
3722
3723- ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet
3724  link-layer address option.
3725
3726  - ``sla {MAC-48}``: source Ethernet LLA.
3727
3728- ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet
3729  link-layer address option.
3730
3731  - ``tla {MAC-48}``: target Ethernet LLA.
3732
3733- ``meta``: match application specific metadata.
3734
3735  - ``data {unsigned}``: metadata value.
3736
3737- ``gtp_psc``: match GTP PDU extension header with type 0x85.
3738
3739  - ``pdu_type {unsigned}``: PDU type.
3740
3741  - ``qfi {unsigned}``: QoS flow identifier.
3742
3743- ``pppoes``, ``pppoed``: match PPPoE header.
3744
3745  - ``session_id {unsigned}``: session identifier.
3746
3747- ``pppoe_proto_id``: match PPPoE session protocol identifier.
3748
3749  - ``proto_id {unsigned}``: PPP protocol identifier.
3750
3751- ``l2tpv3oip``: match L2TPv3 over IP header.
3752
3753  - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
3754
3755- ``ah``: match AH header.
3756
3757  - ``spi {unsigned}``: security parameters index.
3758
3759- ``pfcp``: match PFCP header.
3760
3761  - ``s_field {unsigned}``: S field.
3762  - ``seid {unsigned}``: session endpoint identifier.
3763
3764- ``integrity``: match packet integrity.
3765
3766   - ``level {unsigned}``: Packet encapsulation level the item should
3767     apply to. See rte_flow_action_rss for details.
3768   - ``value {unsigned}``: A bitmask that specify what packet elements
3769     must be matched for integrity.
3770
3771- ``conntrack``: match conntrack state.
3772
3773- ``port_representor``: match traffic entering the embedded switch from the given ethdev
3774
3775  - ``port_id {unsigned}``: ethdev port ID
3776
3777- ``represented_port``: match traffic entering the embedded switch from
3778  the entity represented by the given ethdev
3779
3780  - ``ethdev_port_id {unsigned}``: ethdev port ID
3781
3782- ``l2tpv2``: match L2TPv2 header.
3783
3784  - ``length {unsigned}``: L2TPv2 option length.
3785  - ``tunnel_id {unsigned}``: L2TPv2 tunnel identifier.
3786  - ``session_id {unsigned}``: L2TPv2 session identifier.
3787  - ``ns {unsigned}``: L2TPv2 option ns.
3788  - ``nr {unsigned}``: L2TPv2 option nr.
3789  - ``offset_size {unsigned}``: L2TPv2 option offset.
3790
3791- ``ppp``: match PPP header.
3792
3793  - ``addr {unsigned}``: PPP address.
3794  - ``ctrl {unsigned}``: PPP control.
3795  - ``proto_id {unsigned}``: PPP protocol identifier.
3796
3797- ``ib_bth``: match InfiniBand BTH(base transport header).
3798
3799  - ``opcode {unsigned}``: Opcode.
3800  - ``pkey {unsigned}``: Partition key.
3801  - ``dst_qp {unsigned}``: Destination Queue Pair.
3802  - ``psn {unsigned}``: Packet Sequence Number.
3803
3804- ``meter``: match meter color.
3805
3806  - ``color {value}``: meter color value (green/yellow/red).
3807
3808- ``aggr_affinity``: match aggregated port.
3809
3810  - ``affinity {value}``: aggregated port (starts from 1).
3811
3812- ``tx_queue``: match Tx queue of sent packet.
3813
3814  - ``tx_queue {value}``: send queue value (starts from 0).
3815
3816- ``send_to_kernel``: send packets to kernel.
3817
3818
3819Actions list
3820^^^^^^^^^^^^
3821
3822A list of actions starts after the ``actions`` token in the same fashion as
3823`Matching pattern`_; actions are separated by ``/`` tokens and the list is
3824terminated by a mandatory ``end`` action.
3825
3826Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
3827rte_flow_action_type``).
3828
3829Dropping all incoming UDPv4 packets can be expressed as follows::
3830
3831   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3832      actions drop / end
3833
3834Several actions have configurable properties which must be specified when
3835there is no valid default value. For example, ``queue`` requires a target
3836queue index.
3837
3838This rule redirects incoming UDPv4 traffic to queue index 6::
3839
3840   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3841      actions queue index 6 / end
3842
3843While this one could be rejected by PMDs (unspecified queue index)::
3844
3845   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3846      actions queue / end
3847
3848As defined by *rte_flow*, the list is not ordered, all actions of a given
3849rule are performed simultaneously. These are equivalent::
3850
3851   queue index 6 / void / mark id 42 / end
3852
3853::
3854
3855   void / mark id 42 / queue index 6 / end
3856
3857All actions in a list should have different types, otherwise only the last
3858action of a given type is taken into account::
3859
3860   queue index 4 / queue index 5 / queue index 6 / end # will use queue 6
3861
3862::
3863
3864   drop / drop / drop / end # drop is performed only once
3865
3866::
3867
3868   mark id 42 / queue index 3 / mark id 24 / end # mark will be 24
3869
3870Considering they are performed simultaneously, opposite and overlapping
3871actions can sometimes be combined when the end result is unambiguous::
3872
3873   drop / queue index 6 / end # drop has no effect
3874
3875::
3876
3877   queue index 6 / rss queues 6 7 8 / end # queue has no effect
3878
3879::
3880
3881   drop / passthru / end # drop has no effect
3882
3883Note that PMDs may still refuse such combinations.
3884
3885Actions
3886^^^^^^^
3887
3888This section lists supported actions and their attributes, if any.
3889
3890- ``end``: end list of actions.
3891
3892- ``void``: no-op action.
3893
3894- ``passthru``: let subsequent rule process matched packets.
3895
3896- ``jump``: redirect traffic to group on device.
3897
3898  - ``group {unsigned}``: group to redirect to.
3899
3900- ``mark``: attach 32 bit value to packets.
3901
3902  - ``id {unsigned}``: 32 bit value to return with packets.
3903
3904- ``flag``: flag packets.
3905
3906- ``queue``: assign packets to a given queue index.
3907
3908  - ``index {unsigned}``: queue index to use.
3909
3910- ``drop``: drop packets (note: passthru has priority).
3911
3912- ``count``: enable counters for this rule.
3913
3914- ``rss``: spread packets among several queues.
3915
3916  - ``func {hash function}``: RSS hash function to apply, allowed tokens are
3917    ``toeplitz``, ``simple_xor``, ``symmetric_toeplitz`` and ``default``.
3918
3919  - ``level {unsigned}``: encapsulation level for ``types``.
3920
3921  - ``types [{RSS hash type} [...]] end``: specific RSS hash types.
3922    Note that an empty list does not disable RSS but instead requests
3923    unspecified "best-effort" settings.
3924
3925  - ``key {string}``: RSS hash key, overrides ``key_len``.
3926
3927  - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in
3928    conjunction with ``key`` to pad or truncate it.
3929
3930  - ``queues [{unsigned} [...]] end``: queue indices to use.
3931
3932- ``pf``: direct traffic to physical function.
3933
3934- ``vf``: direct traffic to a virtual function ID.
3935
3936  - ``original {boolean}``: use original VF ID if possible.
3937  - ``id {unsigned}``: VF ID.
3938
3939- ``port_id``: direct matching traffic to a given DPDK port ID.
3940
3941  - ``original {boolean}``: use original DPDK port ID if possible.
3942  - ``id {unsigned}``: DPDK port ID.
3943
3944- ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``.
3945
3946  - ``mpls_ttl``: MPLS TTL.
3947
3948- ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``.
3949
3950- ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``.
3951
3952  - ``nw_ttl``: IP TTL.
3953
3954- ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``.
3955
3956- ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``.
3957
3958- ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``.
3959
3960- ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``.
3961
3962- ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``.
3963
3964  - ``ethertype``: Ethertype.
3965
3966- ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``.
3967
3968  - ``vlan_vid``: VLAN id.
3969
3970- ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``.
3971
3972  - ``vlan_pcp``: VLAN priority.
3973
3974- ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``.
3975
3976  - ``ethertype``: Ethertype.
3977
3978- ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``.
3979
3980  - ``ethertype``: Ethertype.
3981
3982- ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration
3983  is done through `Config VXLAN Encap outer layers`_.
3984
3985- ``vxlan_decap``: Performs a decapsulation action by stripping all headers of
3986  the VXLAN tunnel network overlay from the matched flow.
3987
3988- ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration
3989  is done through `Config NVGRE Encap outer layers`_.
3990
3991- ``nvgre_decap``: Performs a decapsulation action by stripping all headers of
3992  the NVGRE tunnel network overlay from the matched flow.
3993
3994- ``l2_encap``: Performs a L2 encapsulation, L2 configuration
3995  is done through `Config L2 Encap`_.
3996
3997- ``l2_decap``: Performs a L2 decapsulation, L2 configuration
3998  is done through `Config L2 Decap`_.
3999
4000- ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer
4001  configuration is done through `Config MPLSoGRE Encap outer layers`_.
4002
4003- ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer
4004  configuration is done through `Config MPLSoGRE Decap outer layers`_.
4005
4006- ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer
4007  configuration is done through `Config MPLSoUDP Encap outer layers`_.
4008
4009- ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer
4010  configuration is done through `Config MPLSoUDP Decap outer layers`_.
4011
4012- ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header.
4013
4014  - ``ipv4_addr``: New IPv4 source address.
4015
4016- ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4
4017  header.
4018
4019  - ``ipv4_addr``: New IPv4 destination address.
4020
4021- ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header.
4022
4023  - ``ipv6_addr``: New IPv6 source address.
4024
4025- ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6
4026  header.
4027
4028  - ``ipv6_addr``: New IPv6 destination address.
4029
4030- ``set_tp_src``: Set a new source port number in the outermost TCP/UDP
4031  header.
4032
4033  - ``port``: New TCP/UDP source port number.
4034
4035- ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP
4036  header.
4037
4038  - ``port``: New TCP/UDP destination port number.
4039
4040- ``mac_swap``: Swap the source and destination MAC addresses in the outermost
4041  Ethernet header.
4042
4043- ``dec_ttl``: Performs a decrease TTL value action
4044
4045- ``set_ttl``: Set TTL value with specified value
4046  - ``ttl_value {unsigned}``: The new TTL value to be set
4047
4048- ``set_mac_src``: set source MAC address
4049
4050  - ``mac_addr {MAC-48}``: new source MAC address
4051
4052- ``set_mac_dst``: set destination MAC address
4053
4054  - ``mac_addr {MAC-48}``: new destination MAC address
4055
4056- ``inc_tcp_seq``: Increase sequence number in the outermost TCP header.
4057
4058  - ``value {unsigned}``: Value to increase TCP sequence number by.
4059
4060- ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header.
4061
4062  - ``value {unsigned}``: Value to decrease TCP sequence number by.
4063
4064- ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header.
4065
4066  - ``value {unsigned}``: Value to increase TCP acknowledgment number by.
4067
4068- ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header.
4069
4070  - ``value {unsigned}``: Value to decrease TCP acknowledgment number by.
4071
4072- ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value
4073
4074  - ``dscp_value {unsigned}``: The new DSCP value to be set
4075
4076- ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value
4077
4078  - ``dscp_value {unsigned}``: The new DSCP value to be set
4079
4080- ``indirect``: Use indirect action created via
4081  ``flow indirect_action {port_id} create``
4082
4083  - ``indirect_action_id {unsigned}``: Indirect action ID to use
4084
4085- ``color``: Color the packet to reflect the meter color result
4086
4087  - ``type {value}``: Set color type with specified value(green/yellow/red)
4088
4089- ``port_representor``: at embedded switch level, send matching traffic to
4090  the given ethdev
4091
4092  - ``port_id {unsigned}``: ethdev port ID
4093
4094- ``represented_port``: at embedded switch level, send matching traffic to
4095  the entity represented by the given ethdev
4096
4097  - ``ethdev_port_id {unsigned}``: ethdev port ID
4098
4099- ``meter_mark``:  meter the directed packets using profile and policy
4100
4101  - ``mtr_profile {unsigned}``: meter profile ID to use
4102  - ``mtr_policy {unsigned}``: meter policy ID to use
4103  - ``mtr_color_mode {unsigned}``: meter color-awareness mode (blind/aware)
4104  - ``mtr_init_color {value}``: initial color value (green/yellow/red)
4105  - ``mtr_state {unsigned}``: meter state (disabled/enabled)
4106
4107Destroying flow rules
4108~~~~~~~~~~~~~~~~~~~~~
4109
4110``flow destroy`` destroys one or more rules from their rule ID (as returned
4111by ``flow create``), this command calls ``rte_flow_destroy()`` as many
4112times as necessary::
4113
4114   flow destroy {port_id} rule {rule_id} [...] [user_id]
4115
4116If successful, it will show::
4117
4118   Flow rule #[...] destroyed
4119
4120Or if ``user_id`` flag is provided::
4121
4122   Flow rule #[...] destroyed, user-id [...]
4123
4124Optional ``user_id`` is a flag that signifies the rule ID
4125is the one provided by the user at creation.
4126It does not report anything for rule IDs that do not exist. The usual error
4127message is shown when a rule cannot be destroyed::
4128
4129   Caught error type [...] ([...]): [...]
4130
4131``flow flush`` destroys all rules on a device and does not take extra
4132arguments. It is bound to ``rte_flow_flush()``::
4133
4134   flow flush {port_id}
4135
4136Any errors are reported as above.
4137
4138Creating several rules and destroying them::
4139
4140   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4141      actions queue index 2 / end
4142   Flow rule #0 created
4143   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4144      actions queue index 3 / end
4145   Flow rule #1 created
4146   testpmd> flow destroy 0 rule 0 rule 1
4147   Flow rule #1 destroyed
4148   Flow rule #0 destroyed
4149   testpmd>
4150
4151The same result can be achieved using ``flow flush``::
4152
4153   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4154      actions queue index 2 / end
4155   Flow rule #0 created
4156   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4157      actions queue index 3 / end
4158   Flow rule #1 created
4159   testpmd> flow flush 0
4160   testpmd>
4161
4162Non-existent rule IDs are ignored::
4163
4164   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4165      actions queue index 2 / end
4166   Flow rule #0 created
4167   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4168      actions queue index 3 / end
4169   Flow rule #1 created
4170   testpmd> flow destroy 0 rule 42 rule 10 rule 2
4171   testpmd>
4172   testpmd> flow destroy 0 rule 0
4173   Flow rule #0 destroyed
4174   testpmd>
4175
4176Enqueueing destruction of flow rules
4177~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4178
4179``flow queue destroy`` adds destruction operations to destroy one or more rules
4180from their rule ID (as returned by ``flow queue create``) to a queue,
4181this command calls ``rte_flow_async_destroy()`` as many times as necessary::
4182
4183   flow queue {port_id} destroy {queue_id}
4184        [postpone {boolean}] rule {rule_id} [...]
4185
4186If successful, it will show::
4187
4188   Flow rule #[...] destruction enqueued
4189
4190It does not report anything for rule IDs that do not exist. The usual error
4191message is shown when a rule cannot be destroyed::
4192
4193   Caught error type [...] ([...]): [...]
4194
4195``flow queue pull`` must be called to retrieve the operation status.
4196
4197Querying flow rules
4198~~~~~~~~~~~~~~~~~~~
4199
4200``flow query`` queries a specific action of a flow rule having that
4201ability. Such actions collect information that can be reported using this
4202command. It is bound to ``rte_flow_query()``::
4203
4204   flow query {port_id} {rule_id} {action} [user_id]
4205
4206Optional ``user_id`` is a flag that signifies the rule ID
4207is the one provided by the user at creation.
4208If successful, it will display either the retrieved data for known actions
4209or the following message::
4210
4211   Cannot display result for action type [...] ([...])
4212
4213Otherwise, it will complain either that the rule does not exist or that some
4214error occurred::
4215
4216   Flow rule #[...] not found
4217
4218::
4219
4220   Caught error type [...] ([...]): [...]
4221
4222Currently only the ``count`` action is supported. This action reports the
4223number of packets that hit the flow rule and the total number of bytes. Its
4224output has the following format::
4225
4226   count:
4227    hits_set: [...] # whether "hits" contains a valid value
4228    bytes_set: [...] # whether "bytes" contains a valid value
4229    hits: [...] # number of packets
4230    bytes: [...] # number of bytes
4231
4232Querying counters for TCPv6 packets redirected to queue 6::
4233
4234   testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end
4235      actions queue index 6 / count / end
4236   Flow rule #4 created
4237   testpmd> flow query 0 4 count
4238   count:
4239    hits_set: 1
4240    bytes_set: 0
4241    hits: 386446
4242    bytes: 0
4243   testpmd>
4244
4245Listing flow rules
4246~~~~~~~~~~~~~~~~~~
4247
4248``flow list`` lists existing flow rules sorted by priority and optionally
4249filtered by group identifiers::
4250
4251   flow list {port_id} [group {group_id}] [...]
4252
4253This command only fails with the following message if the device does not
4254exist::
4255
4256   Invalid port [...]
4257
4258Output consists of a header line followed by a short description of each
4259flow rule, one per line. There is no output at all when no flow rules are
4260configured on the device::
4261
4262   ID      Group   Prio    Attr    Rule
4263   [...]   [...]   [...]   [...]   [...]
4264
4265``Attr`` column flags:
4266
4267- ``i`` for ``ingress``.
4268- ``e`` for ``egress``.
4269
4270Creating several flow rules and listing them::
4271
4272   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4273      actions queue index 6 / end
4274   Flow rule #0 created
4275   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4276      actions queue index 2 / end
4277   Flow rule #1 created
4278   testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end
4279      actions rss queues 6 7 8 end / end
4280   Flow rule #2 created
4281   testpmd> flow list 0
4282   ID      Group   Prio    Attr    Rule
4283   0       0       0       i-      ETH IPV4 => QUEUE
4284   1       0       0       i-      ETH IPV6 => QUEUE
4285   2       0       5       i-      ETH IPV4 UDP => RSS
4286   testpmd>
4287
4288Rules are sorted by priority (i.e. group ID first, then priority level)::
4289
4290   testpmd> flow list 1
4291   ID      Group   Prio    Attr    Rule
4292   0       0       0       i-      ETH => COUNT
4293   6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4294   5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4295   1       24      0       i-      ETH IPV4 UDP => QUEUE
4296   4       24      10      i-      ETH IPV4 TCP => DROP
4297   3       24      20      i-      ETH IPV4 => DROP
4298   2       24      42      i-      ETH IPV4 UDP => QUEUE
4299   7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4300   testpmd>
4301
4302Output can be limited to specific groups::
4303
4304   testpmd> flow list 1 group 0 group 63
4305   ID      Group   Prio    Attr    Rule
4306   0       0       0       i-      ETH => COUNT
4307   6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4308   5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4309   7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4310   testpmd>
4311
4312Toggling isolated mode
4313~~~~~~~~~~~~~~~~~~~~~~
4314
4315``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4316must only be injected from the defined flow rules; that no default traffic
4317is expected outside those rules and the driver is free to assign more
4318resources to handle them. It is bound to ``rte_flow_isolate()``::
4319
4320 flow isolate {port_id} {boolean}
4321
4322If successful, enabling or disabling isolated mode shows either::
4323
4324 Ingress traffic on port [...]
4325    is now restricted to the defined flow rules
4326
4327Or::
4328
4329 Ingress traffic on port [...]
4330    is not restricted anymore to the defined flow rules
4331
4332Otherwise, in case of error::
4333
4334   Caught error type [...] ([...]): [...]
4335
4336Mainly due to its side effects, PMDs supporting this mode may not have the
4337ability to toggle it more than once without reinitializing affected ports
4338first (e.g. by exiting testpmd).
4339
4340Enabling isolated mode::
4341
4342 testpmd> flow isolate 0 true
4343 Ingress traffic on port 0 is now restricted to the defined flow rules
4344 testpmd>
4345
4346Disabling isolated mode::
4347
4348 testpmd> flow isolate 0 false
4349 Ingress traffic on port 0 is not restricted anymore to the defined flow rules
4350 testpmd>
4351
4352Dumping HW internal information
4353~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4354
4355``flow dump`` dumps the hardware's internal representation information of
4356all flows. It is bound to ``rte_flow_dev_dump()``::
4357
4358   flow dump {port_id} {output_file} [user_id]
4359
4360If successful, it will show::
4361
4362   Flow dump finished
4363
4364Otherwise, it will complain error occurred::
4365
4366   Caught error type [...] ([...]): [...]
4367
4368Optional ``user_id`` is a flag that signifies the rule ID
4369is the one provided by the user at creation.
4370
4371Listing and destroying aged flow rules
4372~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4373
4374``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``,
4375and ``destroy`` parameter can be used to destroy those flow rules in PMD::
4376
4377   flow aged {port_id} [destroy]
4378
4379Listing current aged flow rules::
4380
4381   testpmd> flow aged 0
4382   Port 0 total aged flows: 0
4383   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.14 / end
4384      actions age timeout 5 / queue index 0 /  end
4385   Flow rule #0 created
4386   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.15 / end
4387      actions age timeout 4 / queue index 0 /  end
4388   Flow rule #1 created
4389   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.16 / end
4390      actions age timeout 2 / queue index 0 /  end
4391   Flow rule #2 created
4392   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.17 / end
4393      actions age timeout 3 / queue index 0 /  end
4394   Flow rule #3 created
4395
4396
4397Aged Rules are simply list as command ``flow list {port_id}``, but strip the detail rule
4398information, all the aged flows are sorted by the longest timeout time. For example, if
4399those rules be configured in the same time, ID 2 will be the first aged out rule, the next
4400will be ID 3, ID 1, ID 0::
4401
4402   testpmd> flow aged 0
4403   Port 0 total aged flows: 4
4404   ID      Group   Prio    Attr
4405   2       0       0       i--
4406   3       0       0       i--
4407   1       0       0       i--
4408   0       0       0       i--
4409
4410If attach ``destroy`` parameter, the command will destroy all the list aged flow rules::
4411
4412   testpmd> flow aged 0 destroy
4413   Port 0 total aged flows: 4
4414   ID      Group   Prio    Attr
4415   2       0       0       i--
4416   3       0       0       i--
4417   1       0       0       i--
4418   0       0       0       i--
4419
4420   Flow rule #2 destroyed
4421   Flow rule #3 destroyed
4422   Flow rule #1 destroyed
4423   Flow rule #0 destroyed
4424   4 flows be destroyed
4425   testpmd> flow aged 0
4426   Port 0 total aged flows: 0
4427
4428
4429Enqueueing listing and destroying aged flow rules
4430~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4431
4432``flow queue aged`` simply lists aged flow rules be get from
4433``rte_flow_get_q_aged_flows`` API, and ``destroy`` parameter can be used to
4434destroy those flow rules in PMD::
4435
4436   flow queue {port_id} aged {queue_id} [destroy]
4437
4438Listing current aged flow rules::
4439
4440   testpmd> flow queue 0 aged 0
4441   Port 0 queue 0 total aged flows: 0
4442   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4443      pattern eth / ipv4 src is 2.2.2.14 / end
4444      actions age timeout 5 / queue index 0 /  end
4445   Flow rule #0 creation enqueued
4446   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4447      pattern eth / ipv4 src is 2.2.2.15 / end
4448      actions age timeout 4 / queue index 0 /  end
4449   Flow rule #1 creation enqueued
4450   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4451      pattern eth / ipv4 src is 2.2.2.16 / end
4452      actions age timeout 4 / queue index 0 /  end
4453   Flow rule #2 creation enqueued
4454   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4455      pattern eth / ipv4 src is 2.2.2.17 / end
4456      actions age timeout 4 / queue index 0 /  end
4457   Flow rule #3 creation enqueued
4458   testpmd> flow pull 0 queue 0
4459   Queue #0 pulled 4 operations (0 failed, 4 succeeded)
4460
4461Aged Rules are simply list as command ``flow queue {port_id} list {queue_id}``,
4462but strip the detail rule information, all the aged flows are sorted by the
4463longest timeout time. For example, if those rules is configured in the same time,
4464ID 2 will be the first aged out rule, the next will be ID 3, ID 1, ID 0::
4465
4466   testpmd> flow queue 0 aged 0
4467   Port 0 queue 0 total aged flows: 4
4468   ID      Group   Prio    Attr
4469   2       0       0       ---
4470   3       0       0       ---
4471   1       0       0       ---
4472   0       0       0       ---
4473
4474   0 flows destroyed
4475
4476If attach ``destroy`` parameter, the command will destroy all the list aged flow rules::
4477
4478   testpmd> flow queue 0 aged 0 destroy
4479   Port 0 queue 0 total aged flows: 4
4480   ID      Group   Prio    Attr
4481   2       0       0       ---
4482   3       0       0       ---
4483   1       0       0       ---
4484   0       0       0       ---
4485   Flow rule #2 destruction enqueued
4486   Flow rule #3 destruction enqueued
4487   Flow rule #1 destruction enqueued
4488   Flow rule #0 destruction enqueued
4489
4490   4 flows destroyed
4491   testpmd> flow queue 0 aged 0
4492   Port 0 total aged flows: 0
4493
4494.. note::
4495
4496   The queue must be empty before attaching ``destroy`` parameter.
4497
4498
4499Creating indirect actions
4500~~~~~~~~~~~~~~~~~~~~~~~~~
4501
4502``flow indirect_action {port_id} create`` creates indirect action with optional
4503indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
4504
4505   flow indirect_action {port_id} create [action_id {indirect_action_id}]
4506      [ingress] [egress] [transfer] action {action} / end
4507
4508If successful, it will show::
4509
4510   Indirect action #[...] created
4511
4512Otherwise, it will complain either that indirect action already exists or that
4513some error occurred::
4514
4515   Indirect action #[...] is already assigned, delete it first
4516
4517::
4518
4519   Caught error type [...] ([...]): [...]
4520
4521Create indirect rss action with id 100 to queues 1 and 2 on port 0::
4522
4523   testpmd> flow indirect_action 0 create action_id 100 \
4524      ingress action rss queues 1 2 end / end
4525
4526Create indirect rss action with id assigned by testpmd to queues 1 and 2 on
4527port 0::
4528
4529	testpmd> flow indirect_action 0 create action_id \
4530		ingress action rss queues 0 1 end / end
4531
4532Enqueueing creation of indirect actions
4533~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4534
4535``flow queue indirect_action create`` adds creation operation of an indirect
4536action to a queue. It is bound to ``rte_flow_async_action_handle_create()``::
4537
4538   flow queue {port_id} create {queue_id} [postpone {boolean}]
4539       table {table_id} item_template {item_template_id}
4540       action_template {action_template_id}
4541       pattern {item} [/ {item} [...]] / end
4542       actions {action} [/ {action} [...]] / end
4543
4544If successful, it will show::
4545
4546   Indirect action #[...] creation queued
4547
4548Otherwise it will show an error message of the form::
4549
4550   Caught error type [...] ([...]): [...]
4551
4552This command uses the same parameters as  ``flow indirect_action create``,
4553described in `Creating indirect actions`_.
4554
4555``flow queue pull`` must be called to retrieve the operation status.
4556
4557Updating indirect actions
4558~~~~~~~~~~~~~~~~~~~~~~~~~
4559
4560``flow indirect_action {port_id} update`` updates configuration of the indirect
4561action from its indirect action ID (as returned by
4562``flow indirect_action {port_id} create``). It is bound to
4563``rte_flow_action_handle_update()``::
4564
4565   flow indirect_action {port_id} update {indirect_action_id}
4566      action {action} / end
4567
4568If successful, it will show::
4569
4570   Indirect action #[...] updated
4571
4572Otherwise, it will complain either that indirect action not found or that some
4573error occurred::
4574
4575   Failed to find indirect action #[...] on port [...]
4576
4577::
4578
4579   Caught error type [...] ([...]): [...]
4580
4581Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3
4582(in create example above rss queues were 1 and 2)::
4583
4584   testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
4585
4586Enqueueing update of indirect actions
4587~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4588
4589``flow queue indirect_action update`` adds update operation for an indirect
4590action to a queue. It is bound to ``rte_flow_async_action_handle_update()``::
4591
4592   flow queue {port_id} indirect_action {queue_id} update
4593      {indirect_action_id} [postpone {boolean}] action {action} / end
4594
4595If successful, it will show::
4596
4597   Indirect action #[...] update queued
4598
4599Otherwise it will show an error message of the form::
4600
4601   Caught error type [...] ([...]): [...]
4602
4603``flow queue pull`` must be called to retrieve the operation status.
4604
4605Destroying indirect actions
4606~~~~~~~~~~~~~~~~~~~~~~~~~~~
4607
4608``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
4609from their indirect action IDs (as returned by
4610``flow indirect_action {port_id} create``). It is bound to
4611``rte_flow_action_handle_destroy()``::
4612
4613   flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
4614
4615If successful, it will show::
4616
4617   Indirect action #[...] destroyed
4618
4619It does not report anything for indirect action IDs that do not exist.
4620The usual error message is shown when a indirect action cannot be destroyed::
4621
4622   Caught error type [...] ([...]): [...]
4623
4624Destroy indirect actions having id 100 & 101::
4625
4626   testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
4627
4628Enqueueing destruction of indirect actions
4629~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4630
4631``flow queue indirect_action destroy`` adds destruction operation to destroy
4632one or more indirect actions from their indirect action IDs (as returned by
4633``flow queue {port_id} indirect_action {queue_id} create``) to a queue.
4634It is bound to ``rte_flow_async_action_handle_destroy()``::
4635
4636   flow queue {port_id} indirect_action {queue_id} destroy
4637      [postpone {boolean}] action_id {indirect_action_id} [...]
4638
4639If successful, it will show::
4640
4641   Indirect action #[...] destruction queued
4642
4643Otherwise it will show an error message of the form::
4644
4645   Caught error type [...] ([...]): [...]
4646
4647``flow queue pull`` must be called to retrieve the operation status.
4648
4649Query indirect actions
4650~~~~~~~~~~~~~~~~~~~~~~
4651
4652``flow indirect_action {port_id} query`` queries the indirect action from its
4653indirect action ID (as returned by ``flow indirect_action {port_id} create``).
4654It is bound to ``rte_flow_action_handle_query()``::
4655
4656  flow indirect_action {port_id} query {indirect_action_id}
4657
4658Currently only rss indirect action supported. If successful, it will show::
4659
4660   Indirect RSS action:
4661      refs:[...]
4662
4663Otherwise, it will complain either that indirect action not found or that some
4664error occurred::
4665
4666   Failed to find indirect action #[...] on port [...]
4667
4668::
4669
4670   Caught error type [...] ([...]): [...]
4671
4672Query indirect action having id 100::
4673
4674   testpmd> flow indirect_action 0 query 100
4675
4676Enqueueing query of indirect actions
4677~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4678
4679``flow queue indirect_action query`` adds query operation for an indirect
4680action to a queue. It is bound to ``rte_flow_async_action_handle_query()``::
4681
4682   flow queue {port_id} indirect_action {queue_id} query
4683      {indirect_action_id} [postpone {boolean}]
4684
4685If successful, it will show::
4686
4687   Indirect action #[...] query queued
4688
4689Otherwise it will show an error message of the form::
4690
4691   Caught error type [...] ([...]): [...]
4692
4693``flow queue pull`` must be called to retrieve the operation status.
4694
4695Sample QinQ flow rules
4696~~~~~~~~~~~~~~~~~~~~~~
4697
4698Before creating QinQ rule(s) the following commands should be issued to enable QinQ::
4699
4700   testpmd> port stop 0
4701   testpmd> vlan set extend on 0
4702
4703The above command sets the inner and outer TPID's to 0x8100.
4704
4705To change the TPID's the following commands should be used::
4706
4707   testpmd> vlan set outer tpid 0x88A8 0
4708   testpmd> vlan set inner tpid 0x8100 0
4709   testpmd> port start 0
4710
4711Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
4712
4713::
4714
4715   testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 /
4716       vlan tci is 456 / end actions vf id 1 / queue index 0 / end
4717   Flow rule #0 validated
4718
4719   testpmd> flow create 0 ingress pattern eth / vlan tci is 4 /
4720       vlan tci is 456 / end actions vf id 123 / queue index 0 / end
4721   Flow rule #0 created
4722
4723   testpmd> flow list 0
4724   ID      Group   Prio    Attr    Rule
4725   0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
4726
4727Validate and create a QinQ rule on port 0 to steer traffic to a queue on the host.
4728
4729::
4730
4731   testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 /
4732        vlan tci is 654 / end actions pf / queue index 0 / end
4733   Flow rule #1 validated
4734
4735   testpmd> flow create 0 ingress pattern eth / vlan tci is 321 /
4736        vlan tci is 654 / end actions pf / queue index 1 / end
4737   Flow rule #1 created
4738
4739   testpmd> flow list 0
4740   ID      Group   Prio    Attr    Rule
4741   0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
4742   1       0       0       i-      ETH VLAN VLAN=>PF QUEUE
4743
4744Sample VXLAN flow rules
4745~~~~~~~~~~~~~~~~~~~~~~~
4746
4747Before creating VXLAN rule(s), the UDP port should be added for VXLAN packet
4748filter on a port::
4749
4750  testpmd> rx_vxlan_port add 4789 0
4751
4752Create VXLAN rules on port 0 to steer traffic to PF queues.
4753
4754::
4755
4756  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
4757         eth dst is 00:11:22:33:44:55 / end actions pf / queue index 1 / end
4758  Flow rule #0 created
4759
4760  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 3 /
4761         eth dst is 00:11:22:33:44:55 / end actions pf / queue index 2 / end
4762  Flow rule #1 created
4763
4764  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
4765         eth dst is 00:11:22:33:44:55 / vlan tci is 10 / end actions pf /
4766         queue index 3 / end
4767  Flow rule #2 created
4768
4769  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 5 /
4770         eth dst is 00:11:22:33:44:55 / vlan tci is 20 / end actions pf /
4771         queue index 4 / end
4772  Flow rule #3 created
4773
4774  testpmd> flow create 0 ingress pattern eth dst is 00:00:00:00:01:00 / ipv4 /
4775         udp / vxlan vni is 6 /  eth dst is 00:11:22:33:44:55 / end actions pf /
4776         queue index 5 / end
4777  Flow rule #4 created
4778
4779  testpmd> flow list 0
4780  ID      Group   Prio    Attr    Rule
4781  0       0       0       i-      ETH IPV4 UDP VXLAN ETH => QUEUE
4782  1       0       0       i-      ETH IPV4 UDP VXLAN ETH => QUEUE
4783  2       0       0       i-      ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
4784  3       0       0       i-      ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
4785  4       0       0       i-      ETH IPV4 UDP VXLAN ETH => QUEUE
4786
4787Sample VXLAN encapsulation rule
4788~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4789
4790VXLAN encapsulation outer layer has default value pre-configured in testpmd
4791source code, those can be changed by using the following commands
4792
4793IPv4 VXLAN outer header::
4794
4795 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
4796        ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4797 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4798        queue index 0 / end
4799
4800 testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src
4801         127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4802         eth-dst 22:22:22:22:22:22
4803 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4804         queue index 0 / end
4805
4806 testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-tos 0
4807         ip-ttl 255 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4808         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
4812IPv6 VXLAN outer header::
4813
4814 testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1
4815        ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4816 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4817         queue index 0 / end
4818
4819 testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4820         ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11
4821         eth-dst 22:22:22:22:22:22
4822 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4823         queue index 0 / end
4824
4825 testpmd> set vxlan-tos-ttl ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4826         ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4827         eth-dst 22:22:22:22:22:22
4828 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4829         queue index 0 / end
4830
4831Sample NVGRE encapsulation rule
4832~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4833
4834NVGRE encapsulation outer layer has default value pre-configured in testpmd
4835source code, those can be changed by using the following commands
4836
4837IPv4 NVGRE outer header::
4838
4839 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
4840        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4841 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4842        queue index 0 / end
4843
4844 testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1
4845         ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4846         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
4850IPv6 NVGRE outer header::
4851
4852 testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4853        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4854 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4855        queue index 0 / end
4856
4857 testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4858        vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4859 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4860        queue index 0 / end
4861
4862Sample L2 encapsulation rule
4863~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4864
4865L2 encapsulation has default value pre-configured in testpmd
4866source code, those can be changed by using the following commands
4867
4868L2 header::
4869
4870 testpmd> set l2_encap ip-version ipv4
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
4875L2 with VXLAN header::
4876
4877 testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34
4878         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4879 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4880        mplsoudp_decap / l2_encap / end
4881
4882Sample L2 decapsulation rule
4883~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4884
4885L2 decapsulation has default value pre-configured in testpmd
4886source code, those can be changed by using the following commands
4887
4888L2 header::
4889
4890 testpmd> set l2_decap
4891 testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap /
4892        queue index 0 / end
4893
4894L2 with VXLAN header::
4895
4896 testpmd> set l2_encap-with-vlan
4897 testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap /
4898         queue index 0 / end
4899
4900Sample MPLSoGRE encapsulation rule
4901~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4902
4903MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
4904source code, those can be changed by using the following commands
4905
4906IPv4 MPLSoGRE outer header::
4907
4908 testpmd> set mplsogre_encap ip-version ipv4 label 4
4909        ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4910        eth-dst 22:22:22:22:22:22
4911 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4912        mplsogre_encap / end
4913
4914IPv4 MPLSoGRE with VLAN outer header::
4915
4916 testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4
4917        ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4918        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4919 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4920        mplsogre_encap / end
4921
4922IPv6 MPLSoGRE outer header::
4923
4924 testpmd> set mplsogre_encap ip-version ipv6 mask 4
4925        ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4926        eth-dst 22:22:22:22:22:22
4927 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4928        mplsogre_encap / end
4929
4930IPv6 MPLSoGRE with VLAN outer header::
4931
4932 testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4
4933        ip-src ::1 ip-dst ::2222 vlan-tci 34
4934        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4935 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4936        mplsogre_encap / end
4937
4938Sample MPLSoGRE decapsulation rule
4939~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4940
4941MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
4942source code, those can be changed by using the following commands
4943
4944IPv4 MPLSoGRE outer header::
4945
4946 testpmd> set mplsogre_decap ip-version ipv4
4947 testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions
4948        mplsogre_decap / l2_encap / end
4949
4950IPv4 MPLSoGRE with VLAN outer header::
4951
4952 testpmd> set mplsogre_decap-with-vlan ip-version ipv4
4953 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end
4954        actions mplsogre_decap / l2_encap / end
4955
4956IPv6 MPLSoGRE outer header::
4957
4958 testpmd> set mplsogre_decap ip-version ipv6
4959 testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end
4960        actions mplsogre_decap / l2_encap / end
4961
4962IPv6 MPLSoGRE with VLAN outer header::
4963
4964 testpmd> set mplsogre_decap-with-vlan ip-version ipv6
4965 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end
4966        actions mplsogre_decap / l2_encap / end
4967
4968Sample MPLSoUDP encapsulation rule
4969~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4970
4971MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
4972source code, those can be changed by using the following commands
4973
4974IPv4 MPLSoUDP outer header::
4975
4976 testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10
4977        ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4978        eth-dst 22:22:22:22:22:22
4979 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4980        mplsoudp_encap / end
4981
4982IPv4 MPLSoUDP with VLAN outer header::
4983
4984 testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5
4985        udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4986        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4987 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4988        mplsoudp_encap / end
4989
4990IPv6 MPLSoUDP outer header::
4991
4992 testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10
4993        ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4994        eth-dst 22:22:22:22:22:22
4995 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4996        mplsoudp_encap / end
4997
4998IPv6 MPLSoUDP with VLAN outer header::
4999
5000 testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5
5001        udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34
5002        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5003 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5004        mplsoudp_encap / end
5005
5006Sample MPLSoUDP decapsulation rule
5007~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5008
5009MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
5010source code, those can be changed by using the following commands
5011
5012IPv4 MPLSoUDP outer header::
5013
5014 testpmd> set mplsoudp_decap ip-version ipv4
5015 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
5016        mplsoudp_decap / l2_encap / end
5017
5018IPv4 MPLSoUDP with VLAN outer header::
5019
5020 testpmd> set mplsoudp_decap-with-vlan ip-version ipv4
5021 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end
5022        actions mplsoudp_decap / l2_encap / end
5023
5024IPv6 MPLSoUDP outer header::
5025
5026 testpmd> set mplsoudp_decap ip-version ipv6
5027 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end
5028        actions mplsoudp_decap / l2_encap / end
5029
5030IPv6 MPLSoUDP with VLAN outer header::
5031
5032 testpmd> set mplsoudp_decap-with-vlan ip-version ipv6
5033 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end
5034        actions mplsoudp_decap / l2_encap / end
5035
5036Sample Raw encapsulation rule
5037~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5038
5039Raw encapsulation configuration can be set by the following commands
5040
5041Encapsulating VxLAN::
5042
5043 testpmd> set raw_encap 4 eth src is 10:11:22:33:44:55 / vlan tci is 1
5044        inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni
5045        is 2 / end_set
5046 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
5047        raw_encap index 4 / end
5048
5049Sample Raw decapsulation rule
5050~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5051
5052Raw decapsulation configuration can be set by the following commands
5053
5054Decapsulating VxLAN::
5055
5056 testpmd> set raw_decap eth / ipv4 / udp / vxlan / end_set
5057 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 /
5058        end actions raw_decap / queue index 0 / end
5059
5060Sample ESP rules
5061~~~~~~~~~~~~~~~~
5062
5063ESP rules can be created by the following commands::
5064
5065 testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions
5066        queue index 3 / end
5067 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end
5068        actions queue index 3 / end
5069 testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions
5070        queue index 3 / end
5071 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
5072        actions queue index 3 / end
5073
5074Sample AH rules
5075~~~~~~~~~~~~~~~~
5076
5077AH rules can be created by the following commands::
5078
5079 testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions
5080        queue index 3 / end
5081 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end
5082        actions queue index 3 / end
5083 testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions
5084        queue index 3 / end
5085 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end
5086        actions queue index 3 / end
5087
5088Sample PFCP rules
5089~~~~~~~~~~~~~~~~~
5090
5091PFCP rules can be created by the following commands(s_field need to be 1
5092if seid is set)::
5093
5094 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
5095        actions queue index 3 / end
5096 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
5097        seid is 1 / end actions queue index 3 / end
5098 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
5099        actions queue index 3 / end
5100 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
5101        seid is 1 / end actions queue index 3 / end
5102
5103Sample Sampling/Mirroring rules
5104~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5105
5106Sample/Mirroring rules can be set by the following commands
5107
5108NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1,
5109and 50% packets are duplicated and marked with 0x1234 and sent to queue 0.
5110
5111::
5112
5113 testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
5114 testpmd> flow create 0 ingress group 1 pattern eth / end actions
5115        sample ratio 2 index 0 / queue index 1 / end
5116
5117Match packets coming from a VM which is referred to by means of
5118its representor ethdev (port 1), mirror 50% of them to the
5119said representor (for bookkeeping) as well as encapsulate
5120all the packets and steer them to the physical port:
5121
5122::
5123
5124   testpmd> set sample_actions 0 port_representor ethdev_port_id 1 / end
5125
5126   testpmd> set vxlan ip-version ipv4 vni 4 udp-src 32 udp-dst 4789 ip-src 127.0.0.1
5127      ip-dst 127.0.0.2 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5128
5129   testpmd> flow create 0 transfer pattern represented_port ethdev_port_id is 1 / end
5130      actions sample ratio 2 index 0 / vxlan_encap /
5131      represented_port ethdev_port_id 0 / end
5132
5133The rule is inserted via port 0 (assumed to have "transfer" privilege).
5134
5135Sample integrity rules
5136~~~~~~~~~~~~~~~~~~~~~~
5137
5138Integrity rules can be created by the following commands:
5139
5140Integrity rule that forwards valid TCP packets to group 1.
5141TCP packet integrity is matched with the ``l4_ok`` bit 3.
5142
5143::
5144
5145 testpmd> flow create 0 ingress
5146            pattern eth / ipv4 / tcp / integrity value mask 8 value spec 8 / end
5147            actions jump group 1 / end
5148
5149Integrity rule that forwards invalid packets to application.
5150General packet integrity is matched with the ``packet_ok`` bit 0.
5151
5152::
5153
5154 testpmd> flow create 0 ingress pattern integrity value mask 1 value spec 0 / end actions queue index 0 / end
5155
5156Sample conntrack rules
5157~~~~~~~~~~~~~~~~~~~~~~
5158
5159Conntrack rules can be set by the following commands
5160
5161Need to construct the connection context with provided information.
5162In the first table, create a flow rule by using conntrack action and jump to
5163the next table. In the next table, create a rule to check the state.
5164
5165::
5166
5167 testpmd> set conntrack com peer 1 is_orig 1 enable 1 live 1 sack 1 cack 0
5168        last_dir 0 liberal 0 state 1 max_ack_win 7 r_lim 5 last_win 510
5169        last_seq 2632987379 last_ack 2532480967 last_end 2632987379
5170        last_index 0x8
5171 testpmd> set conntrack orig scale 7 fin 0 acked 1 unack_data 0
5172        sent_end 2632987379 reply_end 2633016339 max_win 28960
5173        max_ack 2632987379
5174 testpmd> set conntrack rply scale 7 fin 0 acked 1 unack_data 0
5175        sent_end 2532480967 reply_end 2532546247 max_win 65280
5176        max_ack 2532480967
5177 testpmd> flow indirect_action 0 create ingress action conntrack / end
5178 testpmd> flow create 0 group 3 ingress pattern eth / ipv4 / tcp / end actions indirect 0 / jump group 5 / end
5179 testpmd> flow create 0 group 5 ingress pattern eth / ipv4 / tcp / conntrack is 1 / end actions queue index 5 / end
5180
5181Construct the conntrack again with only "is_orig" set to 0 (other fields are
5182ignored), then use "update" interface to update the direction. Create flow
5183rules like above for the peer port.
5184
5185::
5186
5187 testpmd> flow indirect_action 0 update 0 action conntrack_update dir / end
5188
5189Sample meter with policy rules
5190~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5191
5192Meter with policy rules can be created by the following commands:
5193
5194Need to create policy first and actions are set for green/yellow/red colors.
5195Create meter with policy id. Create flow with meter id.
5196
5197Example for policy with meter color action. The purpose is to color the packet
5198to reflect the meter color result.
5199The meter policy action list: ``green -> green, yellow -> yellow, red -> red``.
5200
5201::
5202
5203   testpmd> add port meter profile srtcm_rfc2697 0 13 21504 2688 0 0
5204   testpmd> add port meter policy 0 1 g_actions color type green / end y_actions color type yellow / end
5205            r_actions color type red / end
5206   testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
5207   testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end
5208
5209Sample L2TPv2 RSS rules
5210~~~~~~~~~~~~~~~~~~~~~~~
5211
5212L2TPv2 RSS rules can be created by the following commands::
5213
5214   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
5215            / end actions rss types l2tpv2 end queues end / end
5216   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / end
5217            actions rss types eth l2-src-only end queues end / end
5218   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / end
5219            actions rss types l2tpv2 end queues end / end
5220   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5221            / end actions rss types ipv4 end queues end / end
5222   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv6
5223            / udp / end actions rss types ipv6-udp end queues end / end
5224   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv4
5225            / tcp / end actions rss types ipv4-tcp end queues end / end
5226   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
5227            / end actions rss types ipv6 end queues end / end
5228
5229Sample L2TPv2 FDIR rules
5230~~~~~~~~~~~~~~~~~~~~~~~~
5231
5232L2TPv2 FDIR rules can be created by the following commands::
5233
5234   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
5235            session_id is 0x1111 / end actions queue index 3 / end
5236   testpmd> flow create 0 ingress pattern eth src is 00:00:00:00:00:01 / ipv4
5237            / udp / l2tpv2 type data / end actions queue index 3 / end
5238   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type data
5239            session_id is 0x1111 / ppp / end actions queue index 3 / end
5240   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5241            src is 10.0.0.1 / end actions queue index 3 / end
5242   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
5243            dst is ABAB:910B:6666:3457:8295:3333:1800:2929 / end actions queue index 3 / end
5244   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5245            / udp src is 22 / end actions queue index 3 / end
5246   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5247            / tcp dst is 23 / end actions queue index 3 / end
5248
5249Sample RAW rule
5250~~~~~~~~~~~~~~~
5251
5252A RAW rule can be created as following using ``pattern_hex`` key and mask.
5253
5254::
5255
5256    testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset
5257             is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a
5258             pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions
5259             queue index 4 / end
5260
5261BPF Functions
5262--------------
5263
5264The following sections show functions to load/unload eBPF based filters.
5265
5266bpf-load
5267~~~~~~~~
5268
5269Load an eBPF program as a callback for particular RX/TX queue::
5270
5271   testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename)
5272
5273The available load-flags are:
5274
5275* ``J``: use JIT generated native code, otherwise BPF interpreter will be used.
5276
5277* ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data.
5278
5279* ``-``: none.
5280
5281.. note::
5282
5283   You'll need clang v3.7 or above to build bpf program you'd like to load
5284
5285For example:
5286
5287.. code-block:: console
5288
5289   cd examples/bpf
5290   clang -O2 -target bpf -c t1.c
5291
5292Then to load (and JIT compile) t1.o at RX queue 0, port 1:
5293
5294.. code-block:: console
5295
5296   testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
5297
5298To load (not JITed) t1.o at TX queue 0, port 0:
5299
5300.. code-block:: console
5301
5302   testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
5303
5304bpf-unload
5305~~~~~~~~~~
5306
5307Unload previously loaded eBPF program for particular RX/TX queue::
5308
5309   testpmd> bpf-unload rx|tx (portid) (queueid)
5310
5311For example to unload BPF filter from TX queue 0, port 0:
5312
5313.. code-block:: console
5314
5315   testpmd> bpf-unload tx 0 0
5316
5317Flex Item Functions
5318-------------------
5319
5320The following sections show functions that configure and create flex item object,
5321create flex pattern and use it in a flow rule.
5322The commands will use 20 bytes IPv4 header for examples:
5323
5324::
5325
5326   0                   1                   2                   3
5327   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
5328   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5329   |  ver  |  IHL  |     TOS       |        length                 | +0
5330   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5331   |       identification          | flg |    frag. offset         | +4
5332   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5333   |       TTL     |  protocol     |        checksum               | +8
5334   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5335   |               source IP address                               | +12
5336   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5337   |              destination IP address                           | +16
5338   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5339
5340
5341Create flex item
5342~~~~~~~~~~~~~~~~
5343
5344Flex item object is created by PMD according to a new header configuration. The
5345header configuration is compiled by the testpmd and stored in
5346``rte_flow_item_flex_conf`` type variable.
5347
5348::
5349
5350   # flow flex_item create <port> <flex id> <configuration file>
5351   testpmd> flow flex_item init 0 3 ipv4_flex_config.json
5352   port-0: created flex item #3
5353
5354Flex item configuration is kept in external JSON file.
5355It describes the following header elements:
5356
5357**New header length.**
5358
5359Specify whether the new header has fixed or variable length and the basic/minimal
5360header length value.
5361
5362If header length is not fixed, header location with a value that completes header
5363length calculation and scale/offset function must be added.
5364
5365Scale function depends on port hardware.
5366
5367**Next protocol.**
5368
5369Describes location in the new header that specify following network header type.
5370
5371**Flow match samples.**
5372
5373Describes locations in the new header that will be used in flow rules.
5374
5375Number of flow samples and sample maximal length depend of port hardware.
5376
5377**Input trigger.**
5378
5379Describes preceding network header configuration.
5380
5381**Output trigger.**
5382
5383Describes conditions that trigger transfer to following network header
5384
5385.. code-block:: json
5386
5387   {
5388      "next_header": { "field_mode": "FIELD_MODE_FIXED", "field_size": 20},
5389      "next_protocol": {"field_size": 8, "field_base": 72},
5390      "sample_data": [
5391         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 0},
5392         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 32},
5393         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 64},
5394         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 96}
5395      ],
5396      "input_link": [
5397         {"item": "eth type is 0x0800"},
5398         {"item": "vlan inner_type is 0x0800"}
5399      ],
5400      "output_link": [
5401         {"item": "udp", "next": 17},
5402         {"item": "tcp", "next": 6},
5403         {"item": "icmp", "next": 1}
5404      ]
5405   }
5406
5407
5408Flex pattern and flow rules
5409~~~~~~~~~~~~~~~~~~~~~~~~~~~
5410
5411Flex pattern describe parts of network header that will trigger flex flow item hit in a flow rule.
5412Flex pattern directly related to flex item samples configuration.
5413Flex pattern can be shared between ports.
5414
5415**Flex pattern and flow rule to match IPv4 version and 20 bytes length**
5416
5417::
5418
5419   # set flex_pattern <pattern_id> is <hex bytes sequence>
5420   testpmd> flow flex_item pattern 5 is 45FF
5421   created pattern #5
5422
5423   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
5424   Flow rule #0 created
5425
5426**Flex pattern and flow rule to match packets with source address 1.2.3.4**
5427
5428::
5429
5430   testpmd> flow flex_item pattern 2 spec 45000000000000000000000001020304 mask FF0000000000000000000000FFFFFFFF
5431   created pattern #2
5432
5433   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
5434   Flow rule #0 created
5435
5436Driver specific commands
5437------------------------
5438
5439Some drivers provide specific features.
5440See:
5441
5442- :ref:`net/bonding testpmd driver specific commands <bonding_testpmd_commands>`
5443- :ref:`net/i40e testpmd driver specific commands <net_i40e_testpmd_commands>`
5444- :ref:`net/ixgbe testpmd driver specific commands <net_ixgbe_testpmd_commands>`
5445