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