xref: /dpdk/doc/guides/testpmd_app_ug/testpmd_funcs.rst (revision 0f2096d7ab3698c33600ddd67d3b9421691e11d5)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2010-2016 Intel Corporation.
3
4.. _testpmd_runtime:
5
6Testpmd Runtime Functions
7=========================
8
9Where the testpmd application is started in interactive mode, (``-i|--interactive``),
10it displays a prompt that can be used to start and stop forwarding,
11configure the application, display statistics (including the extended NIC
12statistics aka xstats) , set the Flow Director and other tasks::
13
14   testpmd>
15
16The testpmd prompt has some, limited, readline support.
17Common bash command-line functions such as ``Ctrl+a`` and ``Ctrl+e`` to go to the start and end of the prompt line are supported
18as well as access to the command history via the up-arrow.
19
20There is also support for tab completion.
21If you type a partial command and hit ``<TAB>`` you get a list of the available completions:
22
23.. code-block:: console
24
25   testpmd> show port <TAB>
26
27       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|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
41In the real ``testpmd>`` prompt these commands should be on a single line.
42
43Help Functions
44--------------
45
46The testpmd has on-line help for the functions that are available at runtime.
47These are divided into sections and can be accessed using help, help section or help all:
48
49.. code-block:: console
50
51   testpmd> help
52
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
62Command File Functions
63----------------------
64
65To facilitate loading large number of commands or to avoid cutting and pasting where not
66practical 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
111In all cases output from any included command will be displayed as standard output.
112Execution will continue until the end of the file is reached regardless of
113whether any errors occur.  The end user must examine the output to determine if
114any failures occurred.
115
116
117Control Functions
118-----------------
119
120start
121~~~~~
122
123Start packet forwarding with current configuration::
124
125   testpmd> start
126
127start tx_first
128~~~~~~~~~~~~~~
129
130Start packet forwarding with current configuration after sending specified number of bursts of packets::
131
132   testpmd> start tx_first (""|burst_num)
133
134The default burst number is 1 when ``burst_num`` not presented.
135
136stop
137~~~~
138
139Stop packet forwarding, and display accumulated statistics::
140
141   testpmd> stop
142
143quit
144~~~~
145
146Quit to prompt::
147
148   testpmd> quit
149
150
151Display Functions
152-----------------
153
154The functions in the following sections are used to display information about the
155testpmd configuration or the NIC status.
156
157show port
158~~~~~~~~~
159
160Display 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
164The 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
182For 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
221show port (module_eeprom|eeprom)
222~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223
224Display the EEPROM information of a port::
225
226   testpmd> show port (port_id) (module_eeprom|eeprom)
227
228show port rss reta
229~~~~~~~~~~~~~~~~~~
230
231Display the rss redirection table entry indicated by masks on port X::
232
233   testpmd> show port (port_id) rss reta (size) (mask0, mask1...)
234
235size is used to indicate the hardware supported reta size
236
237show port rss-hash
238~~~~~~~~~~~~~~~~~~
239
240Display the RSS hash functions and RSS hash key of a port::
241
242   testpmd> show port (port_id) rss-hash [key]
243
244clear port
245~~~~~~~~~~
246
247Clear 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
251For example::
252
253   testpmd> clear port stats all
254
255show (rxq|txq)
256~~~~~~~~~~~~~~
257
258Display information for a given port's RX/TX queue::
259
260   testpmd> show (rxq|txq) info (port_id) (queue_id)
261
262show desc status(rxq|txq)
263~~~~~~~~~~~~~~~~~~~~~~~~~
264
265Display 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
270show config
271~~~~~~~~~~~
272
273Displays the configuration of the application.
274The configuration comes from the command-line, the runtime or the application defaults::
275
276   testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes)
277
278The 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
292For 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
306set fwd
307~~~~~~~
308
309Set 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
316The 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
355Example::
356
357   testpmd> set fwd rxonly
358
359   Set rxonly packet forwarding mode
360
361
362show fwd
363~~~~~~~~
364
365When running, forwarding engines maintain statistics from the time they have been started.
366Example 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
397clear fwd
398~~~~~~~~~
399
400Clear the forwarding engines statistics::
401
402   testpmd> clear fwd stats all
403
404read rxd
405~~~~~~~~
406
407Display an RX descriptor for a port RX queue::
408
409   testpmd> read rxd (port_id) (queue_id) (rxd_id)
410
411For example::
412
413   testpmd> read rxd 0 0 4
414        0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180
415
416read txd
417~~~~~~~~
418
419Display a TX descriptor for a port TX queue::
420
421   testpmd> read txd (port_id) (queue_id) (txd_id)
422
423For example::
424
425   testpmd> read txd 0 0 4
426        0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
427
428ddp get list
429~~~~~~~~~~~~
430
431Get loaded dynamic device personalization (DDP) package info list::
432
433   testpmd> ddp get list (port_id)
434
435ddp get info
436~~~~~~~~~~~~
437
438Display information about dynamic device personalization (DDP) profile::
439
440   testpmd> ddp get info (profile_path)
441
442show vf stats
443~~~~~~~~~~~~~
444
445Display VF statistics::
446
447   testpmd> show vf stats (port_id) (vf_id)
448
449clear vf stats
450~~~~~~~~~~~~~~
451
452Reset VF statistics::
453
454   testpmd> clear vf stats (port_id) (vf_id)
455
456show port pctype mapping
457~~~~~~~~~~~~~~~~~~~~~~~~
458
459List all items from the pctype mapping table::
460
461   testpmd> show port (port_id) pctype mapping
462
463show rx offloading capabilities
464~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
465
466List all per queue and per port Rx offloading capabilities of a port::
467
468   testpmd> show port (port_id) rx_offload capabilities
469
470show rx offloading configuration
471~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
472
473List port level and all queue level Rx offloading configuration::
474
475   testpmd> show port (port_id) rx_offload configuration
476
477show tx offloading capabilities
478~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
479
480List all per queue and per port Tx offloading capabilities of a port::
481
482   testpmd> show port (port_id) tx_offload capabilities
483
484show tx offloading configuration
485~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
486
487List port level and all queue level Tx offloading configuration::
488
489   testpmd> show port (port_id) tx_offload configuration
490
491show tx metadata setting
492~~~~~~~~~~~~~~~~~~~~~~~~
493
494Show Tx metadata value set for a specific port::
495
496   testpmd> show port (port_id) tx_metadata
497
498show port supported ptypes
499~~~~~~~~~~~~~~~~~~~~~~~~~~
500
501Show ptypes supported for a specific port::
502
503   testpmd> show port (port_id) ptypes
504
505set port supported ptypes
506~~~~~~~~~~~~~~~~~~~~~~~~~
507
508set packet types classification for a specific port::
509
510   testpmd> set port (port_id) ptypes_mask (mask)
511
512show port mac addresses info
513~~~~~~~~~~~~~~~~~~~~~~~~~~~~
514
515Show mac addresses added for a specific port::
516
517   testpmd> show port (port_id) macs
518
519
520show port multicast mac addresses info
521~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
522
523Show multicast mac addresses added for a specific port::
524
525   testpmd> show port (port_id) mcast_macs
526
527show device info
528~~~~~~~~~~~~~~~~
529
530Show general information about devices probed::
531
532   testpmd> show device info (<identifier>|all)
533
534For 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
550dump physmem
551~~~~~~~~~~~~
552
553Dumps all physical memory segment layouts::
554
555   testpmd> dump_physmem
556
557dump memzone
558~~~~~~~~~~~~
559
560Dumps the layout of all memory zones::
561
562   testpmd> dump_memzone
563
564dump socket memory
565~~~~~~~~~~~~~~~~~~
566
567Dumps the memory usage of all sockets::
568
569   testpmd> dump_socket_mem
570
571dump struct size
572~~~~~~~~~~~~~~~~
573
574Dumps the size of all memory structures::
575
576   testpmd> dump_struct_sizes
577
578dump ring
579~~~~~~~~~
580
581Dumps the status of all or specific element in DPDK rings::
582
583   testpmd> dump_ring [ring_name]
584
585dump mempool
586~~~~~~~~~~~~
587
588Dumps the statistics of all or specific memory pool::
589
590   testpmd> dump_mempool [mempool_name]
591
592dump devargs
593~~~~~~~~~~~~
594
595Dumps the user device list::
596
597   testpmd> dump_devargs
598
599dump log types
600~~~~~~~~~~~~~~
601
602Dumps the log level for all the dpdk modules::
603
604   testpmd> dump_log_types
605
606show (raw_encap|raw_decap)
607~~~~~~~~~~~~~~~~~~~~~~~~~~
608
609Display 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
614For 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
624show fec capabilities
625~~~~~~~~~~~~~~~~~~~~~
626
627Show fec capabilities of a port::
628
629  testpmd> show port (port_id) fec capabilities
630
631show fec mode
632~~~~~~~~~~~~~
633
634Show fec mode of a port::
635
636  testpmd> show port (port_id) fec_mode
637
638
639Configuration Functions
640-----------------------
641
642The testpmd application can be configured from the runtime as well as from the command-line.
643
644This 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
650set default
651~~~~~~~~~~~
652
653Reset forwarding to the default configuration::
654
655   testpmd> set default
656
657set verbose
658~~~~~~~~~~~
659
660Set the debug verbosity level::
661
662   testpmd> set verbose (level)
663
664Available 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
671set log
672~~~~~~~
673
674Set the log level for a log type::
675
676	testpmd> set log global|(type) (level)
677
678Where:
679
680* ``type`` is the log name.
681
682* ``level`` is the log level.
683
684For example, to change the global log level::
685
686	testpmd> set log global (level)
687
688Regexes 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
692set nbport
693~~~~~~~~~~
694
695Set the number of ports used by the application:
696
697set nbport (num)
698
699This is equivalent to the ``--nb-ports`` command-line option.
700
701set nbcore
702~~~~~~~~~~
703
704Set the number of cores used by the application::
705
706   testpmd> set nbcore (num)
707
708This 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
714set coremask
715~~~~~~~~~~~~
716
717Set the forwarding cores hexadecimal mask::
718
719   testpmd> set coremask (mask)
720
721This 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
727set portmask
728~~~~~~~~~~~~
729
730Set the forwarding ports hexadecimal mask::
731
732   testpmd> set portmask (mask)
733
734This is equivalent to the ``--portmask`` command-line option.
735
736set record-core-cycles
737~~~~~~~~~~~~~~~~~~~~~~
738
739Set the recording of CPU cycles::
740
741   testpmd> set record-core-cycles (on|off)
742
743Where:
744
745* ``on`` enables measurement of CPU cycles per packet.
746
747* ``off`` disables measurement of CPU cycles per packet.
748
749This is equivalent to the ``--record-core-cycles command-line`` option.
750
751set record-burst-stats
752~~~~~~~~~~~~~~~~~~~~~~
753
754Set the displaying of RX and TX bursts::
755
756   testpmd> set record-burst-stats (on|off)
757
758Where:
759
760* ``on`` enables display of RX and TX bursts.
761
762* ``off`` disables display of RX and TX bursts.
763
764This is equivalent to the ``--record-burst-stats command-line`` option.
765
766set burst
767~~~~~~~~~
768
769Set number of packets per burst::
770
771   testpmd> set burst (num)
772
773This is equivalent to the ``--burst command-line`` option.
774
775When 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
779set rxpkts
780~~~~~~~~~~
781
782Set the length of segments to scatter packets on receiving if split
783feature is engaged. Affects only the queues configured with split offloads
784(currently BUFFER_SPLIT is supported only). Optionally the multiple memory
785pools can be specified with --mbuf-size command line parameter and the mbufs
786to receive will be allocated sequentially from these extra memory pools (the
787mbuf for the first segment is allocated from the first pool, the second one
788from the second pool, and so on, if segment number is greater then pool's the
789mbuf for remaining segments will be allocated from the last valid pool).
790
791   testpmd> set rxpkts (x[,y]*)
792
793Where x[,y]* represents a CSV list of values, without white space. Zero value
794means to use the corresponding memory pool data buffer size.
795
796set txpkts
797~~~~~~~~~~
798
799Set 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
803Where x[,y]* represents a CSV list of values, without white space.
804
805set txtimes
806~~~~~~~~~~~
807
808Configure the timing burst pattern for Tx only mode. This command enables
809the packet send scheduling on dynamic timestamp mbuf field and configures
810timing pattern in Tx only mode. In this mode, if scheduling is enabled
811application provides timestamps in the packets being sent. It is possible
812to configure delay (in unspecified device clock units) between bursts
813and between the packets within the burst::
814
815   testpmd> set txtimes (inter),(intra)
816
817where:
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
832As the result the bursts of packet will be transmitted with specific
833delays between the packets within the burst and specific delay between
834the bursts. The rte_eth_read_clock() must be supported by the device(s)
835and is supposed to be engaged to get the current device clock value
836and provide the reference for the timestamps. If there is no supported
837rte_eth_read_clock() there will be no send scheduling provided on the port.
838
839set txsplit
840~~~~~~~~~~~
841
842Set the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes::
843
844   testpmd> set txsplit (off|on|rand)
845
846Where:
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
856set corelist
857~~~~~~~~~~~~
858
859Set the list of forwarding cores::
860
861   testpmd> set corelist (x[,y]*)
862
863For 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
880set portlist
881~~~~~~~~~~~~
882
883Set the list of forwarding ports::
884
885   testpmd> set portlist (x[,y]*)
886
887For 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
901set port setup on
902~~~~~~~~~~~~~~~~~
903
904Select how to retrieve new ports created after "port attach" command::
905
906   testpmd> set port setup on (iterator|event)
907
908For each new port, a setup is done.
909It will find the probed ports via RTE_ETH_FOREACH_MATCHING_DEV loop
910in iterator mode, or via RTE_ETH_EVENT_NEW in event mode.
911
912set tx loopback
913~~~~~~~~~~~~~~~
914
915Enable/disable tx loopback::
916
917   testpmd> set tx loopback (port_id) (on|off)
918
919set drop enable
920~~~~~~~~~~~~~~~
921
922set drop enable bit for all queues::
923
924   testpmd> set all queues drop (port_id) (on|off)
925
926set split drop enable (for VF)
927~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
928
929set split drop enable bit for VF from PF::
930
931   testpmd> set vf split drop (port_id) (vf_id) (on|off)
932
933set mac antispoof (for VF)
934~~~~~~~~~~~~~~~~~~~~~~~~~~
935
936Set mac antispoof for a VF from the PF::
937
938   testpmd> set vf mac antispoof  (port_id) (vf_id) (on|off)
939
940set macsec offload
941~~~~~~~~~~~~~~~~~~
942
943Enable/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
948set macsec sc
949~~~~~~~~~~~~~
950
951Configure 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
960set macsec sa
961~~~~~~~~~~~~~
962
963Configure 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
972set broadcast mode (for VF)
973~~~~~~~~~~~~~~~~~~~~~~~~~~~
974
975Set broadcast mode for a VF from the PF::
976
977   testpmd> set vf broadcast (port_id) (vf_id) (on|off)
978
979vlan set stripq
980~~~~~~~~~~~~~~~
981
982Set the VLAN strip for a queue on a port::
983
984   testpmd> vlan set stripq (on|off) (port_id,queue_id)
985
986vlan set stripq (for VF)
987~~~~~~~~~~~~~~~~~~~~~~~~
988
989Set 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
993vlan set insert (for VF)
994~~~~~~~~~~~~~~~~~~~~~~~~
995
996Set VLAN insert for a VF from the PF::
997
998   testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
999
1000vlan set tag (for VF)
1001~~~~~~~~~~~~~~~~~~~~~
1002
1003Set VLAN tag for a VF from the PF::
1004
1005   testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
1006
1007vlan set antispoof (for VF)
1008~~~~~~~~~~~~~~~~~~~~~~~~~~~
1009
1010Set VLAN antispoof for a VF from the PF::
1011
1012   testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off)
1013
1014vlan set (strip|filter|qinq_strip|extend)
1015~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1016Set 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
1020vlan set tpid
1021~~~~~~~~~~~~~
1022
1023Set 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
1031rx_vlan add
1032~~~~~~~~~~~
1033
1034Add 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
1044rx_vlan rm
1045~~~~~~~~~~
1046
1047Remove 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
1051rx_vlan add (for VF)
1052~~~~~~~~~~~~~~~~~~~~
1053
1054Add 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
1058rx_vlan rm (for VF)
1059~~~~~~~~~~~~~~~~~~~
1060
1061Remove 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
1065tunnel_filter add
1066~~~~~~~~~~~~~~~~~
1067
1068Add 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
1074The 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
1098Example::
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
1105tunnel_filter remove
1106~~~~~~~~~~~~~~~~~~~~
1107
1108Remove 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
1114rx_vxlan_port add
1115~~~~~~~~~~~~~~~~~
1116
1117Add an UDP port for VXLAN packet filter on a port::
1118
1119   testpmd> rx_vxlan_port add (udp_port) (port_id)
1120
1121rx_vxlan_port remove
1122~~~~~~~~~~~~~~~~~~~~
1123
1124Remove an UDP port for VXLAN packet filter on a port::
1125
1126   testpmd> rx_vxlan_port rm (udp_port) (port_id)
1127
1128tx_vlan set
1129~~~~~~~~~~~
1130
1131Set 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
1135For example, set a single VLAN ID (5) insertion on port 0::
1136
1137   tx_vlan set 0 5
1138
1139Or, set double VLAN ID (inner: 2, outer: 3) insertion on port 1::
1140
1141   tx_vlan set 1 2 3
1142
1143
1144tx_vlan set pvid
1145~~~~~~~~~~~~~~~~
1146
1147Set 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
1151tx_vlan reset
1152~~~~~~~~~~~~~
1153
1154Disable hardware insertion of a VLAN header in packets sent on a port::
1155
1156   testpmd> tx_vlan reset (port_id)
1157
1158csum set
1159~~~~~~~~
1160
1161Select hardware or software calculation of the checksum when
1162transmitting 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
1166Where:
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
1182RSS queue region
1183~~~~~~~~~~~~~~~~
1184
1185Set 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
1190Set 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
1194where:
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
1199Set 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
1203Flush all queue region related configuration on a port::
1204
1205   testpmd> set port (port_id) queue-region flush (on|off)
1206
1207where:
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
1217Show 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
1226csum parse-tunnel
1227~~~~~~~~~~~~~~~~~
1228
1229Define how tunneled packets should be handled by the csum forward
1230engine::
1231
1232   testpmd> csum parse-tunnel (on|off) (tx_port_id)
1233
1234If enabled, the csum forward engine will try to recognize supported
1235tunnel headers (geneve, gtp, gre, ipip, vxlan, vxlan-gpe).
1236
1237If disabled, treat tunnel packets as non-tunneled packets (a inner
1238header 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
1244Example:
1245
1246Consider 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
1257csum show
1258~~~~~~~~~
1259
1260Display tx checksum offload configuration::
1261
1262   testpmd> csum show (port_id)
1263
1264tso set
1265~~~~~~~
1266
1267Enable 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
1275tso show
1276~~~~~~~~
1277
1278Display the status of TCP Segmentation Offload::
1279
1280   testpmd> tso show (port_id)
1281
1282tunnel tso set
1283~~~~~~~~~~~~~~
1284
1285Set tso segment size of tunneled packets for a port in csum engine::
1286
1287   testpmd> tunnel_tso set (tso_segsz) (port_id)
1288
1289tunnel tso show
1290~~~~~~~~~~~~~~~
1291
1292Display the status of tunneled TCP Segmentation Offload for a port::
1293
1294   testpmd> tunnel_tso show (port_id)
1295
1296set port - gro
1297~~~~~~~~~~~~~~
1298
1299Enable or disable GRO in ``csum`` forwarding engine::
1300
1301   testpmd> set port <port_id> gro on|off
1302
1303If enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
1304packets received from the given port.
1305
1306If disabled, packets received from the given port won't be performed
1307GRO. 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
1319show port - gro
1320~~~~~~~~~~~~~~~
1321
1322Display GRO configuration for a given port::
1323
1324   testpmd> show port <port_id> gro
1325
1326set gro flush
1327~~~~~~~~~~~~~
1328
1329Set the cycle to flush the GROed packets from reassembly tables::
1330
1331   testpmd> set gro flush <cycles>
1332
1333When enable GRO, the csum forwarding engine performs GRO on received
1334packets, and the GROed packets are stored in reassembly tables. Users
1335can use this command to determine when the GROed packets are flushed
1336from the reassembly tables.
1337
1338The ``cycles`` is measured in GRO operation times. The csum forwarding
1339engine flushes the GROed packets from the tables every ``cycles`` GRO
1340operations.
1341
1342By default, the value of ``cycles`` is 1, which means flush GROed packets
1343from the reassembly tables as soon as one GRO operation finishes. The value
1344of ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
1345
1346Please note that the large value of ``cycles`` may cause the poor TCP/IP
1347stack performance. Because the GROed packets are delayed to arrive the
1348stack, thus causing more duplicated ACKs and TCP retransmissions.
1349
1350set port - gso
1351~~~~~~~~~~~~~~
1352
1353Toggle per-port GSO support in ``csum`` forwarding engine::
1354
1355   testpmd> set port <port_id> gso on|off
1356
1357If enabled, the csum forwarding engine will perform GSO on supported IPv4
1358packets, transmitted on the given port.
1359
1360If disabled, packets transmitted on the given port will not undergo GSO.
1361By 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
1388set gso segsz
1389~~~~~~~~~~~~~
1390
1391Set the maximum GSO segment size (measured in bytes), which includes the
1392packet header and the packet payload for GSO-enabled ports (global)::
1393
1394   testpmd> set gso segsz <length>
1395
1396show port - gso
1397~~~~~~~~~~~~~~~
1398
1399Display the status of Generic Segmentation Offload for a given port::
1400
1401   testpmd> show port <port_id> gso
1402
1403mac_addr add
1404~~~~~~~~~~~~
1405
1406Add an alternative MAC address to a port::
1407
1408   testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)
1409
1410mac_addr remove
1411~~~~~~~~~~~~~~~
1412
1413Remove a MAC address from a port::
1414
1415   testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)
1416
1417mcast_addr add
1418~~~~~~~~~~~~~~
1419
1420To add the multicast MAC address to/from the set of multicast addresses
1421filtered by port::
1422
1423   testpmd> mcast_addr add (port_id) (mcast_addr)
1424
1425mcast_addr remove
1426~~~~~~~~~~~~~~~~~
1427
1428To remove the multicast MAC address to/from the set of multicast addresses
1429filtered by port::
1430
1431   testpmd> mcast_addr remove (port_id) (mcast_addr)
1432
1433mac_addr add (for VF)
1434~~~~~~~~~~~~~~~~~~~~~
1435
1436Add 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
1440mac_addr set
1441~~~~~~~~~~~~
1442
1443Set the default MAC address for a port::
1444
1445   testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
1446
1447mac_addr set (for VF)
1448~~~~~~~~~~~~~~~~~~~~~
1449
1450Set 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
1454set eth-peer
1455~~~~~~~~~~~~
1456
1457Set the forwarding peer address for certain port::
1458
1459   testpmd> set eth-peer (port_id) (peer_addr)
1460
1461This is equivalent to the ``--eth-peer`` command-line option.
1462
1463set port-uta
1464~~~~~~~~~~~~
1465
1466Set 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
1470set promisc
1471~~~~~~~~~~~
1472
1473Set the promiscuous mode on for a port or for all ports.
1474In 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
1478set allmulti
1479~~~~~~~~~~~~
1480
1481Set the allmulti mode for a port or for all ports::
1482
1483   testpmd> set allmulti (port_id|all) (on|off)
1484
1485Same as the ifconfig (8) option. Controls how multicast packets are handled.
1486
1487set promisc (for VF)
1488~~~~~~~~~~~~~~~~~~~~
1489
1490Set the unicast promiscuous mode for a VF from PF.
1491It's supported by Intel i40e NICs now.
1492In 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
1496set allmulticast (for VF)
1497~~~~~~~~~~~~~~~~~~~~~~~~~
1498
1499Set the multicast promiscuous mode for a VF from PF.
1500It's supported by Intel i40e NICs now.
1501In 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
1505set tx max bandwidth (for VF)
1506~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1507
1508Set 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
1512set tc tx min bandwidth (for VF)
1513~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1514
1515Set 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
1519set tc tx max bandwidth (for VF)
1520~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1521
1522Set 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
1526set tc strict link priority mode
1527~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1528
1529Set some TCs' strict link priority mode on a physical port::
1530
1531   testpmd> set tx strict-link-priority (port_id) (tc_bitmap)
1532
1533set tc tx min bandwidth
1534~~~~~~~~~~~~~~~~~~~~~~~
1535
1536Set 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
1540set flow_ctrl rx
1541~~~~~~~~~~~~~~~~
1542
1543Set 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
1549Where:
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
1563set pfc_ctrl rx
1564~~~~~~~~~~~~~~~
1565
1566Set 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
1571Where:
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
1581set stat_qmap
1582~~~~~~~~~~~~~
1583
1584Set 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
1588For example, to set rx queue 2 on port 0 to mapping 5::
1589
1590   testpmd>set stat_qmap rx 0 2 5
1591
1592set xstats-hide-zero
1593~~~~~~~~~~~~~~~~~~~~
1594
1595Set 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
1603set port - rx/tx (for VF)
1604~~~~~~~~~~~~~~~~~~~~~~~~~
1605
1606Set VF receive/transmit from a port::
1607
1608   testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1609
1610set port - mac address filter (for VF)
1611~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1612
1613Add/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
1618set port - rx mode(for VF)
1619~~~~~~~~~~~~~~~~~~~~~~~~~~
1620
1621Set 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
1626The 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
1636set port - tx_rate (for Queue)
1637~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1638
1639Set TX rate limitation for a queue on a port::
1640
1641   testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1642
1643set port - tx_rate (for VF)
1644~~~~~~~~~~~~~~~~~~~~~~~~~~~
1645
1646Set 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
1650set port - mirror rule
1651~~~~~~~~~~~~~~~~~~~~~~
1652
1653Set 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
1659Set 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
1664For 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
1668reset port - mirror rule
1669~~~~~~~~~~~~~~~~~~~~~~~~
1670
1671Reset a mirror rule for a port::
1672
1673   testpmd> reset port (port_id) mirror-rule (rule_id)
1674
1675set flush_rx
1676~~~~~~~~~~~~
1677
1678Set the flush on RX streams before forwarding.
1679The default is flush ``on``.
1680Mainly 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
1684set bypass mode
1685~~~~~~~~~~~~~~~
1686
1687Set the bypass mode for the lowest port on bypass enabled NIC::
1688
1689   testpmd> set bypass mode (normal|bypass|isolate) (port_id)
1690
1691set bypass event
1692~~~~~~~~~~~~~~~~
1693
1694Set 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
1699Where:
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
1712set bypass timeout
1713~~~~~~~~~~~~~~~~~~
1714
1715Set 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
1719show bypass config
1720~~~~~~~~~~~~~~~~~~
1721
1722Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC::
1723
1724   testpmd> show bypass config (port_id)
1725
1726set link up
1727~~~~~~~~~~~
1728
1729Set link up for a port::
1730
1731   testpmd> set link-up port (port id)
1732
1733set link down
1734~~~~~~~~~~~~~
1735
1736Set link down for a port::
1737
1738   testpmd> set link-down port (port id)
1739
1740E-tag set
1741~~~~~~~~~
1742
1743Enable 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
1747Disable E-tag insertion for a VF on a port::
1748
1749   testpmd> E-tag set insertion off port (port_id) vf (vf_id)
1750
1751Enable/disable E-tag stripping on a port::
1752
1753   testpmd> E-tag set stripping (on|off) port (port_id)
1754
1755Enable/disable E-tag based forwarding on a port::
1756
1757   testpmd> E-tag set forwarding (on|off) port (port_id)
1758
1759Add 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
1763Delete an E-tag forwarding filter on a port::
1764   testpmd> E-tag set filter del e-tag-id (value) port (port_id)
1765
1766ddp add
1767~~~~~~~
1768
1769Load a dynamic device personalization (DDP) profile and store backup profile::
1770
1771   testpmd> ddp add (port_id) (profile_path[,backup_profile_path])
1772
1773ddp del
1774~~~~~~~
1775
1776Delete a dynamic device personalization profile and restore backup profile::
1777
1778   testpmd> ddp del (port_id) (backup_profile_path)
1779
1780ptype mapping
1781~~~~~~~~~~~~~
1782
1783List all items from the ptype mapping table::
1784
1785   testpmd> ptype mapping get (port_id) (valid_only)
1786
1787Where:
1788
1789* ``valid_only``: A flag indicates if only list valid items(=1) or all itemss(=0).
1790
1791Replace 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
1795where:
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
1803Update hardware defined ptype to software defined packet type mapping table::
1804
1805   testpmd> ptype mapping update (port_id) (hw_ptype) (sw_ptype)
1806
1807where:
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
1813Reset ptype mapping table::
1814
1815   testpmd> ptype mapping reset (port_id)
1816
1817config per port Rx offloading
1818~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1819
1820Enable 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
1830This command should be run when the port is stopped, or else it will fail.
1831
1832config per queue Rx offloading
1833~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1834
1835Enable 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
1845This command should be run when the port is stopped, or else it will fail.
1846
1847config per port Tx offloading
1848~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1849
1850Enable 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
1861This command should be run when the port is stopped, or else it will fail.
1862
1863config per queue Tx offloading
1864~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1865
1866Enable 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
1877This command should be run when the port is stopped, or else it will fail.
1878
1879Config VXLAN Encap outer layers
1880~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1881
1882Configure 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
1896These commands will set an internal configuration inside testpmd, any following
1897flow rule using the action vxlan_encap will use the last configuration set.
1898To have a different encapsulation header, one of those commands must be called
1899before the flow rule creation.
1900
1901Config NVGRE Encap outer layers
1902~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1903
1904Configure 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
1911These commands will set an internal configuration inside testpmd, any following
1912flow rule using the action nvgre_encap will use the last configuration set.
1913To have a different encapsulation header, one of those commands must be called
1914before the flow rule creation.
1915
1916Config L2 Encap
1917~~~~~~~~~~~~~~~
1918
1919Configure 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
1925Those commands will set an internal configuration inside testpmd, any following
1926flow rule using the action l2_encap will use the last configuration set.
1927To have a different encapsulation header, one of those commands must be called
1928before the flow rule creation.
1929
1930Config L2 Decap
1931~~~~~~~~~~~~~~~
1932
1933Configure 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
1938Those commands will set an internal configuration inside testpmd, any following
1939flow rule using the action l2_decap will use the last configuration set.
1940To have a different encapsulation header, one of those commands must be called
1941before the flow rule creation.
1942
1943Config MPLSoGRE Encap outer layers
1944~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1945
1946Configure 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
1954These commands will set an internal configuration inside testpmd, any following
1955flow rule using the action mplsogre_encap will use the last configuration set.
1956To have a different encapsulation header, one of those commands must be called
1957before the flow rule creation.
1958
1959Config MPLSoGRE Decap outer layers
1960~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1961
1962Configure 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
1967These commands will set an internal configuration inside testpmd, any following
1968flow rule using the action mplsogre_decap will use the last configuration set.
1969To have a different decapsulation header, one of those commands must be called
1970before the flow rule creation.
1971
1972Config MPLSoUDP Encap outer layers
1973~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1974
1975Configure 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
1984These commands will set an internal configuration inside testpmd, any following
1985flow rule using the action mplsoudp_encap will use the last configuration set.
1986To have a different encapsulation header, one of those commands must be called
1987before the flow rule creation.
1988
1989Config MPLSoUDP Decap outer layers
1990~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1991
1992Configure 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
1997These commands will set an internal configuration inside testpmd, any following
1998flow rule using the action mplsoudp_decap will use the last configuration set.
1999To have a different decapsulation header, one of those commands must be called
2000before the flow rule creation.
2001
2002Config Raw Encapsulation
2003~~~~~~~~~~~~~~~~~~~~~~~~~
2004
2005Configure the raw data to be used when encapsulating a packet by
2006rte_flow_action_raw_encap::
2007
2008 set raw_encap {index} {item} [/ {item} [...]] / end_set
2009
2010There are multiple global buffers for ``raw_encap``, this command will set one
2011internal buffer index by ``{index}``.
2012If there is no ``{index}`` specified::
2013
2014 set raw_encap {item} [/ {item} [...]] / end_set
2015
2016the default index ``0`` is used.
2017In order to use different encapsulating header, ``index`` must be specified
2018during the flow rule creation::
2019
2020 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
2021        raw_encap index 2 / end
2022
2023Otherwise the default index ``0`` is used.
2024
2025Config Raw Decapsulation
2026~~~~~~~~~~~~~~~~~~~~~~~~
2027
2028Configure the raw data to be used when decapsulating a packet by
2029rte_flow_action_raw_decap::
2030
2031 set raw_decap {index} {item} [/ {item} [...]] / end_set
2032
2033There are multiple global buffers for ``raw_decap``, this command will set
2034one internal buffer index by ``{index}``.
2035If there is no ``{index}`` specified::
2036
2037 set raw_decap {item} [/ {item} [...]] / end_set
2038
2039the default index ``0`` is used.
2040In order to use different decapsulating header, ``index`` must be specified
2041during the flow rule creation::
2042
2043 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
2044          raw_encap index 3 / end
2045
2046Otherwise the default index ``0`` is used.
2047
2048Set fec mode
2049~~~~~~~~~~~~
2050
2051Set fec mode for a specific port::
2052
2053  testpmd> set port (port_id) fec_mode auto|off|rs|baser
2054
2055
2056Port Functions
2057--------------
2058
2059The following sections show functions for configuring ports.
2060
2061.. note::
2062
2063   Port configuration changes only become active when forwarding is started/restarted.
2064
2065port attach
2066~~~~~~~~~~~
2067
2068Attach a port specified by pci address or virtual device args::
2069
2070   testpmd> port attach (identifier)
2071
2072To attach a new pci device, the device should be recognized by kernel first.
2073Then it should be moved under DPDK management.
2074Finally the port can be attached to testpmd.
2075
2076For 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
2102To attach a port created by virtual device, above steps are not needed.
2103
2104For 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
2119For 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
2130In this case, identifier is ``net_pcap0``.
2131This identifier format is the same as ``--vdev`` format of DPDK applications.
2132
2133For example, to re-attach a bonded port which has been previously detached,
2134the 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
2146port detach
2147~~~~~~~~~~~
2148
2149Detach a specific port::
2150
2151   testpmd> port detach (port_id)
2152
2153Before detaching a port, the port should be stopped and closed.
2154
2155For 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
2175For 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
2192To remove a pci device completely from the system, first detach the port from testpmd.
2193Then the device should be moved under kernel management.
2194Finally the device can be removed using kernel pci hotplug functionality.
2195
2196For 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
2212To remove a port created by a virtual device, above steps are not needed.
2213
2214port start
2215~~~~~~~~~~
2216
2217Start all ports or a specific port::
2218
2219   testpmd> port start (port_id|all)
2220
2221port stop
2222~~~~~~~~~
2223
2224Stop all ports or a specific port::
2225
2226   testpmd> port stop (port_id|all)
2227
2228port close
2229~~~~~~~~~~
2230
2231Close all ports or a specific port::
2232
2233   testpmd> port close (port_id|all)
2234
2235port reset
2236~~~~~~~~~~
2237
2238Reset all ports or a specific port::
2239
2240   testpmd> port reset (port_id|all)
2241
2242User should stop port(s) before resetting and (re-)start after reset.
2243
2244port config - queue ring size
2245~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2246
2247Configure a rx/tx queue ring size::
2248
2249   testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
2250
2251Only take effect after command that (re-)start the port or command that setup specific queue.
2252
2253port start/stop queue
2254~~~~~~~~~~~~~~~~~~~~~
2255
2256Start/stop a rx/tx queue on a specific port::
2257
2258   testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
2259
2260port config - queue deferred start
2261~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2262
2263Switch on/off deferred start of a specific port queue::
2264
2265   testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
2266
2267port setup queue
2268~~~~~~~~~~~~~~~~~~~~~
2269
2270Setup a rx/tx queue on a specific port::
2271
2272   testpmd> port (port_id) (rxq|txq) (queue_id) setup
2273
2274Only take effect when port is started.
2275
2276port config - speed
2277~~~~~~~~~~~~~~~~~~~
2278
2279Set 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
2284port config - queues/descriptors
2285~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2286
2287Set number of queues/descriptors for rxq, txq, rxd and txd::
2288
2289   testpmd> port config all (rxq|txq|rxd|txd) (value)
2290
2291This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2292
2293port config - max-pkt-len
2294~~~~~~~~~~~~~~~~~~~~~~~~~
2295
2296Set the maximum packet length::
2297
2298   testpmd> port config all max-pkt-len (value)
2299
2300This is equivalent to the ``--max-pkt-len`` command-line option.
2301
2302port config - max-lro-pkt-size
2303~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2304
2305Set the maximum LRO aggregated packet size::
2306
2307   testpmd> port config all max-lro-pkt-size (value)
2308
2309This is equivalent to the ``--max-lro-pkt-size`` command-line option.
2310
2311port config - Drop Packets
2312~~~~~~~~~~~~~~~~~~~~~~~~~~
2313
2314Enable 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
2318Packet dropping when no receive buffers available is off by default.
2319
2320The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2321
2322port config - RSS
2323~~~~~~~~~~~~~~~~~
2324
2325Set 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
2329RSS is on by default.
2330
2331The ``all`` option is equivalent to eth|vlan|ip|tcp|udp|sctp|ether|l2tpv3|esp|ah|pfcp.
2332
2333The ``default`` option enables all supported RSS types reported by device info.
2334
2335The ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2336
2337port config - RSS Reta
2338~~~~~~~~~~~~~~~~~~~~~~
2339
2340Set the RSS (Receive Side Scaling) redirection table::
2341
2342   testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2343
2344port config - DCB
2345~~~~~~~~~~~~~~~~~
2346
2347Set the DCB mode for an individual port::
2348
2349   testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2350
2351The traffic class should be 4 or 8.
2352
2353port config - Burst
2354~~~~~~~~~~~~~~~~~~~
2355
2356Set the number of packets per burst::
2357
2358   testpmd> port config all burst (value)
2359
2360This is equivalent to the ``--burst`` command-line option.
2361
2362port config - Threshold
2363~~~~~~~~~~~~~~~~~~~~~~~
2364
2365Set thresholds for TX/RX queues::
2366
2367   testpmd> port config all (threshold) (value)
2368
2369Where 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
2389These threshold options are also available from the command-line.
2390
2391port config - E-tag
2392~~~~~~~~~~~~~~~~~~~
2393
2394Set the value of ether-type for E-tag::
2395
2396   testpmd> port config (port_id|all) l2-tunnel E-tag ether-type (value)
2397
2398Enable/disable the E-tag support::
2399
2400   testpmd> port config (port_id|all) l2-tunnel E-tag (enable|disable)
2401
2402port config pctype mapping
2403~~~~~~~~~~~~~~~~~~~~~~~~~~
2404
2405Reset pctype mapping table::
2406
2407   testpmd> port config (port_id) pctype mapping reset
2408
2409Update 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
2413where:
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
2419port config input set
2420~~~~~~~~~~~~~~~~~~~~~
2421
2422Config 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
2428Clear 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
2433where:
2434
2435* ``pctype_id``: hardware packet classification types.
2436* ``field_idx``: hardware field index.
2437
2438port config udp_tunnel_port
2439~~~~~~~~~~~~~~~~~~~~~~~~~~~
2440
2441Add/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
2445port config tx_metadata
2446~~~~~~~~~~~~~~~~~~~~~~~
2447
2448Set Tx metadata value per port.
2449testpmd will add this value to any Tx packet sent from this port::
2450
2451   testpmd> port config (port_id) tx_metadata (value)
2452
2453port config dynf
2454~~~~~~~~~~~~~~~~
2455
2456Set/clear dynamic flag per port.
2457testpmd will register this flag in the mbuf (same registration
2458for both Tx and Rx). Then set/clear this flag for each Tx
2459packet sent from this port. The set bit only works for Tx packet::
2460
2461   testpmd> port config (port_id) dynf (name) (set|clear)
2462
2463port config mtu
2464~~~~~~~~~~~~~~~
2465
2466To configure MTU(Maximum Transmission Unit) on devices using testpmd::
2467
2468   testpmd> port config mtu (port_id) (value)
2469
2470port config rss hash key
2471~~~~~~~~~~~~~~~~~~~~~~~~
2472
2473To configure the RSS hash key used to compute the RSS
2474hash 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
2483Device Functions
2484----------------
2485
2486The following sections show functions for device operations.
2487
2488device detach
2489~~~~~~~~~~~~~
2490
2491Detach a device specified by pci address or virtual device args::
2492
2493   testpmd> device detach (identifier)
2494
2495Before detaching a device associated with ports, the ports should be stopped and closed.
2496
2497For 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
2510For 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
2521In this case, identifier is ``net_pcap0``.
2522This identifier format is the same as ``--vdev`` format of DPDK applications.
2523
2524Link Bonding Functions
2525----------------------
2526
2527The Link Bonding functions make it possible to dynamically create and
2528manage link bonding devices from within testpmd interactive prompt.
2529
2530create bonded device
2531~~~~~~~~~~~~~~~~~~~~
2532
2533Create a new bonding device::
2534
2535   testpmd> create bonded device (mode) (socket)
2536
2537For 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
2542add bonding slave
2543~~~~~~~~~~~~~~~~~
2544
2545Adds Ethernet device to a Link Bonding device::
2546
2547   testpmd> add bonding slave (slave id) (port id)
2548
2549For example, to add Ethernet device (port 6) to a Link Bonding device (port 10)::
2550
2551   testpmd> add bonding slave 6 10
2552
2553
2554remove bonding slave
2555~~~~~~~~~~~~~~~~~~~~
2556
2557Removes an Ethernet slave device from a Link Bonding device::
2558
2559   testpmd> remove bonding slave (slave id) (port id)
2560
2561For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10)::
2562
2563   testpmd> remove bonding slave 6 10
2564
2565set bonding mode
2566~~~~~~~~~~~~~~~~
2567
2568Set the Link Bonding mode of a Link Bonding device::
2569
2570   testpmd> set bonding mode (value) (port id)
2571
2572For 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
2576set bonding primary
2577~~~~~~~~~~~~~~~~~~~
2578
2579Set an Ethernet slave device as the primary device on a Link Bonding device::
2580
2581   testpmd> set bonding primary (slave id) (port id)
2582
2583For 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
2587set bonding mac
2588~~~~~~~~~~~~~~~
2589
2590Set the MAC address of a Link Bonding device::
2591
2592   testpmd> set bonding mac (port id) (mac)
2593
2594For 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
2598set bonding xmit_balance_policy
2599~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2600
2601Set 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
2605For 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
2610set bonding mon_period
2611~~~~~~~~~~~~~~~~~~~~~~
2612
2613Set the link status monitoring polling period in milliseconds for a bonding device.
2614
2615This adds support for PMD slave devices which do not support link status interrupts.
2616When the mon_period is set to a value greater than 0 then all PMD's which do not support
2617link 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
2621For 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
2626set bonding lacp dedicated_queue
2627~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2628
2629Enable dedicated tx/rx queues on bonding devices slaves to handle LACP control plane traffic
2630when in mode 4 (link-aggregation-802.3ad)::
2631
2632   testpmd> set bonding lacp dedicated_queues (port_id) (enable|disable)
2633
2634
2635set bonding agg_mode
2636~~~~~~~~~~~~~~~~~~~~
2637
2638Enable 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
2643show bonding config
2644~~~~~~~~~~~~~~~~~~~
2645
2646Show the current configuration of a Link Bonding device::
2647
2648   testpmd> show bonding config (port id)
2649
2650For example,
2651to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4)
2652in 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
2662Register Functions
2663------------------
2664
2665The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
2666This is mainly useful for debugging purposes.
2667Reference should be made to the appropriate datasheet for the network card for details on the register addresses
2668and fields that can be accessed.
2669
2670read reg
2671~~~~~~~~
2672
2673Display the value of a port register::
2674
2675   testpmd> read reg (port_id) (address)
2676
2677For 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
2682read regfield
2683~~~~~~~~~~~~~
2684
2685Display a port register bit field::
2686
2687   testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
2688
2689For 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
2694read regbit
2695~~~~~~~~~~~
2696
2697Display a single port register bit::
2698
2699   testpmd> read regbit (port_id) (address) (bit_x)
2700
2701For 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
2706write reg
2707~~~~~~~~~
2708
2709Set the value of a port register::
2710
2711   testpmd> write reg (port_id) (address) (value)
2712
2713For example, to clear a register::
2714
2715   testpmd> write reg 0 0xEE00 0x0
2716   port 0 PCI register at offset 0xEE00: 0x00000000 (0)
2717
2718write regfield
2719~~~~~~~~~~~~~~
2720
2721Set bit field of a port register::
2722
2723   testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
2724
2725For 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
2730write regbit
2731~~~~~~~~~~~~
2732
2733Set single bit value of a port register::
2734
2735   testpmd> write regbit (port_id) (address) (bit_x) (value)
2736
2737For 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
2742Traffic Metering and Policing
2743-----------------------------
2744
2745The following section shows functions for configuring traffic metering and
2746policing on the ethernet device through the use of generic ethdev API.
2747
2748show port traffic management capability
2749~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2750
2751Show traffic metering and policing capability of the port::
2752
2753   testpmd> show port meter cap (port_id)
2754
2755add port meter profile (srTCM rfc2967)
2756~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2757
2758Add 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
2763where:
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
2770add port meter profile (trTCM rfc2968)
2771~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2772
2773Add 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
2778where:
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
2786add port meter profile (trTCM rfc4115)
2787~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2788
2789Add 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
2794where:
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
2802delete port meter profile
2803~~~~~~~~~~~~~~~~~~~~~~~~~
2804
2805Delete meter profile from the ethernet device::
2806
2807   testpmd> del port meter profile (port_id) (profile_id)
2808
2809create port meter
2810~~~~~~~~~~~~~~~~~
2811
2812Create 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
2819where:
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
2839enable port meter
2840~~~~~~~~~~~~~~~~~
2841
2842Enable meter for the ethernet device::
2843
2844   testpmd> enable port meter (port_id) (mtr_id)
2845
2846disable port meter
2847~~~~~~~~~~~~~~~~~~
2848
2849Disable meter for the ethernet device::
2850
2851   testpmd> disable port meter (port_id) (mtr_id)
2852
2853delete port meter
2854~~~~~~~~~~~~~~~~~
2855
2856Delete meter for the ethernet device::
2857
2858   testpmd> del port meter (port_id) (mtr_id)
2859
2860Set port meter profile
2861~~~~~~~~~~~~~~~~~~~~~~
2862
2863Set meter profile for the ethernet device::
2864
2865   testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2866
2867set port meter dscp table
2868~~~~~~~~~~~~~~~~~~~~~~~~~
2869
2870Set 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
2875set port meter policer action
2876~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2877
2878Set 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
2883where:
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
2893set port meter stats mask
2894~~~~~~~~~~~~~~~~~~~~~~~~~
2895
2896Set meter stats mask for the ethernet device::
2897
2898   testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2899
2900where:
2901
2902* ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2903
2904show port meter stats
2905~~~~~~~~~~~~~~~~~~~~~
2906
2907Show meter stats of the ethernet device::
2908
2909   testpmd> show port meter stats (port_id) (mtr_id) (clear)
2910
2911where:
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
2916Traffic Management
2917------------------
2918
2919The following section shows functions for configuring traffic management on
2920the ethernet device through the use of generic TM API.
2921
2922show port traffic management capability
2923~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2924
2925Show traffic management capability of the port::
2926
2927   testpmd> show port tm cap (port_id)
2928
2929show port traffic management capability (hierarchy level)
2930~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2931
2932Show traffic management hierarchy level capability of the port::
2933
2934   testpmd> show port tm level cap (port_id) (level_id)
2935
2936show port traffic management capability (hierarchy node level)
2937~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2938
2939Show the traffic management hierarchy node capability of the port::
2940
2941   testpmd> show port tm node cap (port_id) (node_id)
2942
2943show port traffic management hierarchy node type
2944~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2945
2946Show the port traffic management hierarchy node type::
2947
2948   testpmd> show port tm node type (port_id) (node_id)
2949
2950show port traffic management hierarchy node stats
2951~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2952
2953Show the port traffic management hierarchy node statistics::
2954
2955   testpmd> show port tm node stats (port_id) (node_id) (clear)
2956
2957where:
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
2963Add port traffic management private shaper profile
2964~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2965
2966Add 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
2972where:
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
2987Delete port traffic management private shaper profile
2988~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2989
2990Delete the port traffic management private shaper::
2991
2992   testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
2993
2994where:
2995
2996* ``shaper_profile id``: Shaper profile ID that needs to be deleted.
2997
2998Add port traffic management shared shaper
2999~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3000
3001Create 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
3006where:
3007
3008* ``shared_shaper_id``: Shared shaper ID to be created.
3009* ``shaper_profile id``: Shaper profile ID for shared shaper.
3010
3011Set port traffic management shared shaper
3012~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3013
3014Update 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
3019where:
3020
3021* ``shared_shaper_id``: Shared shaper ID to be update.
3022* ``shaper_profile id``: Shaper profile ID for shared shaper.
3023
3024Delete port traffic management shared shaper
3025~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3026
3027Delete the port traffic management shared shaper::
3028
3029   testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
3030
3031where:
3032
3033* ``shared_shaper_id``: Shared shaper ID to be deleted.
3034
3035Set port traffic management hierarchy node private shaper
3036~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3037
3038set 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
3043where:
3044
3045* ``shaper_profile id``: Private shaper profile ID to be enabled on the
3046  hierarchy node.
3047
3048Add port traffic management WRED profile
3049~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3050
3051Create 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
3058where:
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
3077Delete port traffic management WRED profile
3078~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3079
3080Delete the WRED profile::
3081
3082   testpmd> del port tm node wred profile (port_id) (wred_profile_id)
3083
3084Add port traffic management hierarchy nonleaf node
3085~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3086
3087Add 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
3094where:
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
3110Add port traffic management hierarchy nonleaf node with packet mode
3111~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3112
3113Add 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
3120where:
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
3137Add port traffic management hierarchy leaf node
3138~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3139
3140Add 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
3147where:
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
3164Delete port traffic management hierarchy node
3165~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3166
3167Delete node from port traffic management hierarchy::
3168
3169   testpmd> del port tm node (port_id) (node_id)
3170
3171Update port traffic management hierarchy parent node
3172~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3173
3174Update 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
3179This function can only be called after the hierarchy commit invocation. Its
3180success depends on the port support for this operation, as advertised through
3181the port capability set. This function is valid for all nodes of the traffic
3182management hierarchy except root node.
3183
3184Suspend port traffic management hierarchy node
3185~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3186
3187   testpmd> suspend port tm node (port_id) (node_id)
3188
3189Resume port traffic management hierarchy node
3190~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3191
3192   testpmd> resume port tm node (port_id) (node_id)
3193
3194Commit port traffic management hierarchy
3195~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3196
3197Commit the traffic management hierarchy on the port::
3198
3199   testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
3200
3201where:
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
3207Set port traffic management mark VLAN dei
3208~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3209
3210Enables/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
3214where:
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
3225Set port traffic management mark IP dscp
3226~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3227
3228Enables/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
3232where:
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
3243Set port traffic management mark IP ecn
3244~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3245
3246Enables/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
3250where:
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
3264Filter Functions
3265----------------
3266
3267This section details the available filter functions that are available.
3268
3269Note these functions interface the deprecated legacy filtering framework,
3270superseded by *rte_flow*. See `Flow rules management`_.
3271
3272ethertype_filter
3273~~~~~~~~~~~~~~~~~~~~
3274
3275Add 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
3280The 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
3296Example, 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
33042tuple_filter
3305~~~~~~~~~~~~~~~~~
3306
3307Add or delete a 2-tuple filter,
3308which identifies packets by specific protocol and destination TCP/UDP port
3309and 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
3316The 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
3332Example, 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
33405tuple_filter
3341~~~~~~~~~~~~~~~~~
3342
3343Add or delete a 5-tuple filter,
3344which consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port)
3345and 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
3353The 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
3375Example, 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
3385syn_filter
3386~~~~~~~~~~
3387
3388Using 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
3392The 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
3402Example::
3403
3404   testpmd> syn_filter 0 add priority high queue 3
3405
3406flex_filter
3407~~~~~~~~~~~
3408
3409With flex filter, packets can be recognized by any arbitrary pattern within the first 128 bytes of the packet
3410and 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
3415The 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
3429Example::
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
3440flow_director_filter
3441~~~~~~~~~~~~~~~~~~~~
3442
3443The Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues.
3444
3445Four types of filtering are supported which are referred to as Perfect Match, Signature, Perfect-mac-vlan and
3446Perfect-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
3467The Flow Director filters can match the different fields for different type of packet: flow type, specific input set
3468per flow type and the flexible payload.
3469
3470The Flow Director can also mask out parts of all of these fields so that filters
3471are only applied to certain fields or parts of the fields.
3472
3473Note that for raw flow type mode the source and destination fields in the
3474raw packet buffer need to be presented in a reversed order with respect
3475to the expected received packets.
3476For example: IP source and destination addresses or TCP/UDP/SCTP
3477source and destination ports
3478
3479Different 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
3529For 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
3535For 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
3541flush_flow_director
3542~~~~~~~~~~~~~~~~~~~
3543
3544Flush all flow director filters on a device::
3545
3546   testpmd> flush_flow_director (port_id)
3547
3548Example, to flush all flow director filter on port 0::
3549
3550   testpmd> flush_flow_director 0
3551
3552flow_director_mask
3553~~~~~~~~~~~~~~~~~~
3554
3555Set 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
3567Example, 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
3575flow_director_flex_mask
3576~~~~~~~~~~~~~~~~~~~~~~~
3577
3578set 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
3585Example, 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
3591flow_director_flex_payload
3592~~~~~~~~~~~~~~~~~~~~~~~~~~
3593
3594Configure flexible payload selection::
3595
3596   flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config)
3597
3598For 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
3603get_sym_hash_ena_per_port
3604~~~~~~~~~~~~~~~~~~~~~~~~~
3605
3606Get symmetric hash enable configuration per port::
3607
3608   get_sym_hash_ena_per_port (port_id)
3609
3610For example, to get symmetric hash enable configuration of port 1::
3611
3612   testpmd> get_sym_hash_ena_per_port 1
3613
3614set_sym_hash_ena_per_port
3615~~~~~~~~~~~~~~~~~~~~~~~~~
3616
3617Set symmetric hash enable configuration per port to enable or disable::
3618
3619   set_sym_hash_ena_per_port (port_id) (enable|disable)
3620
3621For example, to set symmetric hash enable configuration of port 1 to enable::
3622
3623   testpmd> set_sym_hash_ena_per_port 1 enable
3624
3625get_hash_global_config
3626~~~~~~~~~~~~~~~~~~~~~~
3627
3628Get the global configurations of hash filters::
3629
3630   get_hash_global_config (port_id)
3631
3632For example, to get the global configurations of hash filters of port 1::
3633
3634   testpmd> get_hash_global_config 1
3635
3636set_hash_global_config
3637~~~~~~~~~~~~~~~~~~~~~~
3638
3639Set 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
3646For 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
3650set_hash_input_set
3651~~~~~~~~~~~~~~~~~~
3652
3653Set 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
3663For 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
3667set_fdir_input_set
3668~~~~~~~~~~~~~~~~~~
3669
3670The Flow Director filters can match the different fields for different type of packet, i.e. specific input set
3671on per flow type and the flexible payload. This command can be used to change input set for each flow type.
3672
3673Set 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
3682For 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
3686global_config
3687~~~~~~~~~~~~~
3688
3689Set different GRE key length for input set::
3690
3691   global_config (port_id) gre-key-len (number in bytes)
3692
3693For 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
3700Flow rules management
3701---------------------
3702
3703Control of the generic flow API (*rte_flow*) is fully exposed through the
3704``flow`` command (validation, creation, destruction, queries and operation
3705modes).
3706
3707Considering *rte_flow* overlaps with all `Filter Functions`_, using both
3708features simultaneously may cause undefined side-effects and is therefore
3709not recommended.
3710
3711``flow`` syntax
3712~~~~~~~~~~~~~~~
3713
3714Because the ``flow`` command uses dynamic tokens to handle the large number
3715of possible flow rules combinations, its behavior differs slightly from
3716other 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
3724The first parameter stands for the operation mode. Possible operations and
3725their general syntax are described below. They are covered in detail in the
3726following 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
3783Creating 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
3790If successful, it will return a tunnel stub ID usable with other commands::
3791
3792   port [...]: flow tunnel #[...] type [...]
3793
3794Tunnel stub ID is relative to a port.
3795
3796Destroying tunnel offload stub
3797~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3798
3799``flow tunnel destroy`` destroy port tunnel stub::
3800
3801   flow tunnel destroy {port_id} id {tunnel_id}
3802
3803Listing tunnel offload stubs
3804~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3805
3806``flow tunnel list`` list port tunnel offload stubs::
3807
3808   flow tunnel list {port_id}
3809
3810Validating flow rules
3811~~~~~~~~~~~~~~~~~~~~~
3812
3813``flow validate`` reports whether a flow rule would be accepted by the
3814underlying device in its current state but stops short of creating it. It is
3815bound 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
3822If successful, it will show::
3823
3824   Flow rule validated
3825
3826Otherwise it will show an error message of the form::
3827
3828   Caught error type [...] ([...]): [...]
3829
3830This command uses the same parameters as ``flow create``, their format is
3831described in `Creating flow rules`_.
3832
3833Check whether redirecting any Ethernet packet received on port 0 to RX queue
3834index 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
3841Port 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
3848Creating flow rules
3849~~~~~~~~~~~~~~~~~~~
3850
3851``flow create`` validates and creates the specified flow rule. It is bound
3852to ``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
3860If successful, it will return a flow rule ID usable with other commands::
3861
3862   Flow rule #[...] created
3863
3864Otherwise it will show an error message of the form::
3865
3866   Caught error type [...] ([...]): [...]
3867
3868Parameters 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
3877These translate directly to *rte_flow* objects provided as-is to the
3878underlying functions.
3879
3880The shortest valid definition only comprises mandatory tokens::
3881
3882   testpmd> flow create 0 pattern end actions end
3883
3884Note that PMDs may refuse rules that essentially do nothing such as this
3885one.
3886
3887**All unspecified object values are automatically initialized to 0.**
3888
3889Attributes
3890^^^^^^^^^^
3891
3892These tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3893specified 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
3901Each instance of an attribute specified several times overrides the previous
3902value as shown below (group 4 is used)::
3903
3904   testpmd> flow create 0 group 42 group 24 group 4 [...]
3905
3906Note that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3907
3908While not specifying a direction is an error, some rules may allow both
3909simultaneously.
3910
3911Most rules affect RX therefore contain the ``ingress`` token::
3912
3913   testpmd> flow create 0 ingress pattern [...]
3914
3915Tunnel offload
3916^^^^^^^^^^^^^^
3917
3918Indicate 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
3923Matching pattern
3924^^^^^^^^^^^^^^^^
3925
3926A matching pattern starts after the ``pattern`` token. It is made of pattern
3927items and is terminated by a mandatory ``end`` item.
3928
3929Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3930rte_flow_item_type``).
3931
3932The ``/`` token is used as a separator between pattern items as shown
3933below::
3934
3935   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3936
3937Note that protocol items like these must be stacked from lowest to highest
3938layer to make sense. For instance, the following rule is either invalid or
3939unlikely to match any packet::
3940
3941   testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3942
3943More information on these restrictions can be found in the *rte_flow*
3944documentation.
3945
3946Several 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
3952This rule matches all IPv4 traffic with the specified properties.
3953
3954In this example, ``src`` and ``dst`` are field names of the underlying
3955``struct rte_flow_item_ipv4`` object. All item properties can be specified
3956in a similar fashion.
3957
3958The ``is`` token means that the subsequent value must be matched exactly,
3959and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3960accordingly. 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
3968These 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
3988Inclusive 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
3992Note 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
3997Properties 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
4005Pattern items
4006^^^^^^^^^^^^^
4007
4008This 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
4208Actions list
4209^^^^^^^^^^^^
4210
4211A 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
4213terminated by a mandatory ``end`` action.
4214
4215Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
4216rte_flow_action_type``).
4217
4218Dropping 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
4223Several actions have configurable properties which must be specified when
4224there is no valid default value. For example, ``queue`` requires a target
4225queue index.
4226
4227This 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
4232While 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
4237As defined by *rte_flow*, the list is not ordered, all actions of a given
4238rule 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
4246All actions in a list should have different types, otherwise only the last
4247action 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
4259Considering they are performed simultaneously, opposite and overlapping
4260actions 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
4272Note that PMDs may still refuse such combinations.
4273
4274Actions
4275^^^^^^^
4276
4277This 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
4480Destroying flow rules
4481~~~~~~~~~~~~~~~~~~~~~
4482
4483``flow destroy`` destroys one or more rules from their rule ID (as returned
4484by ``flow create``), this command calls ``rte_flow_destroy()`` as many
4485times as necessary::
4486
4487   flow destroy {port_id} rule {rule_id} [...]
4488
4489If successful, it will show::
4490
4491   Flow rule #[...] destroyed
4492
4493It does not report anything for rule IDs that do not exist. The usual error
4494message 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
4499arguments. It is bound to ``rte_flow_flush()``::
4500
4501   flow flush {port_id}
4502
4503Any errors are reported as above.
4504
4505Creating 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
4518The 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
4529Non-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
4543Querying flow rules
4544~~~~~~~~~~~~~~~~~~~
4545
4546``flow query`` queries a specific action of a flow rule having that
4547ability. Such actions collect information that can be reported using this
4548command. It is bound to ``rte_flow_query()``::
4549
4550   flow query {port_id} {rule_id} {action}
4551
4552If successful, it will display either the retrieved data for known actions
4553or the following message::
4554
4555   Cannot display result for action type [...] ([...])
4556
4557Otherwise, it will complain either that the rule does not exist or that some
4558error occurred::
4559
4560   Flow rule #[...] not found
4561
4562::
4563
4564   Caught error type [...] ([...]): [...]
4565
4566Currently only the ``count`` action is supported. This action reports the
4567number of packets that hit the flow rule and the total number of bytes. Its
4568output 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
4576Querying 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
4589Listing flow rules
4590~~~~~~~~~~~~~~~~~~
4591
4592``flow list`` lists existing flow rules sorted by priority and optionally
4593filtered by group identifiers::
4594
4595   flow list {port_id} [group {group_id}] [...]
4596
4597This command only fails with the following message if the device does not
4598exist::
4599
4600   Invalid port [...]
4601
4602Output consists of a header line followed by a short description of each
4603flow rule, one per line. There is no output at all when no flow rules are
4604configured 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
4614Creating 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
4632Rules 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
4646Output 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
4656Toggling isolated mode
4657~~~~~~~~~~~~~~~~~~~~~~
4658
4659``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4660must only be injected from the defined flow rules; that no default traffic
4661is expected outside those rules and the driver is free to assign more
4662resources to handle them. It is bound to ``rte_flow_isolate()``::
4663
4664 flow isolate {port_id} {boolean}
4665
4666If successful, enabling or disabling isolated mode shows either::
4667
4668 Ingress traffic on port [...]
4669    is now restricted to the defined flow rules
4670
4671Or::
4672
4673 Ingress traffic on port [...]
4674    is not restricted anymore to the defined flow rules
4675
4676Otherwise, in case of error::
4677
4678   Caught error type [...] ([...]): [...]
4679
4680Mainly due to its side effects, PMDs supporting this mode may not have the
4681ability to toggle it more than once without reinitializing affected ports
4682first (e.g. by exiting testpmd).
4683
4684Enabling 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
4690Disabling 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
4696Dumping HW internal information
4697~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4698
4699``flow dump`` dumps the hardware's internal representation information of
4700all flows. It is bound to ``rte_flow_dev_dump()``::
4701
4702   flow dump {port_id} {output_file}
4703
4704If successful, it will show::
4705
4706   Flow dump finished
4707
4708Otherwise, it will complain error occurred::
4709
4710   Caught error type [...] ([...]): [...]
4711
4712Listing and destroying aged flow rules
4713~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4714
4715``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``,
4716and ``destroy`` parameter can be used to destroy those flow rules in PMD.
4717
4718   flow aged {port_id} [destroy]
4719
4720Listing 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
4738Aged Rules are simply list as command ``flow list {port_id}``, but strip the detail rule
4739information, all the aged flows are sorted by the longest timeout time. For example, if
4740those rules be configured in the same time, ID 2 will be the first aged out rule, the next
4741will 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
4751If 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
4769Creating shared actions
4770~~~~~~~~~~~~~~~~~~~~~~~
4771``flow shared_action {port_id} create`` creates shared action with optional
4772shared 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
4777If successful, it will show::
4778
4779   Shared action #[...] created
4780
4781Otherwise, it will complain either that shared action already exists or that
4782some error occurred::
4783
4784   Shared action #[...] is already assigned, delete it first
4785
4786::
4787
4788   Caught error type [...] ([...]): [...]
4789
4790Create 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
4795Create shared rss action with id assigned by testpmd to queues 1 and 2 on
4796port 0::
4797
4798	testpmd> flow shared_action 0 create action_id \
4799		ingress action rss queues 0 1 end / end
4800
4801Updating shared actions
4802~~~~~~~~~~~~~~~~~~~~~~~
4803``flow shared_action {port_id} update`` updates configuration of the shared
4804action 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
4811If successful, it will show::
4812
4813   Shared action #[...] updated
4814
4815Otherwise, it will complain either that shared action not found or that some
4816error occurred::
4817
4818   Failed to find shared action #[...] on port [...]
4819
4820::
4821
4822   Caught error type [...] ([...]): [...]
4823
4824Update 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
4829Destroying shared actions
4830~~~~~~~~~~~~~~~~~~~~~~~~~
4831``flow shared_action {port_id} update`` destroys one or more shared actions
4832from 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
4838If successful, it will show::
4839
4840   Shared action #[...] destroyed
4841
4842It does not report anything for shared action IDs that do not exist.
4843The usual error message is shown when a shared action cannot be destroyed::
4844
4845   Caught error type [...] ([...]): [...]
4846
4847Destroy shared actions having id 100 & 101::
4848
4849   testpmd> flow shared_action 0 destroy action_id 100 action_id 101
4850
4851Query shared actions
4852~~~~~~~~~~~~~~~~~~~~
4853``flow shared_action {port_id} query`` queries the shared action from its
4854shared action ID (as returned by ``flow shared_action {port_id} create``).
4855It is bound to ``rte_flow_shared_action_query()``::
4856
4857  flow shared_action {port_id} query {shared_action_id}
4858
4859Currently only rss shared action supported. If successful, it will show::
4860
4861   Shared RSS action:
4862      refs:[...]
4863
4864Otherwise, it will complain either that shared action not found or that some
4865error occurred::
4866
4867   Failed to find shared action #[...] on port [...]
4868
4869::
4870
4871   Caught error type [...] ([...]): [...]
4872
4873Query shared action having id 100::
4874
4875   testpmd> flow shared_action 0 query 100
4876
4877Sample QinQ flow rules
4878~~~~~~~~~~~~~~~~~~~~~~
4879
4880Before 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
4885The above command sets the inner and outer TPID's to 0x8100.
4886
4887To 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
4893Validate 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
4909Validate 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
4926Sample VXLAN encapsulation rule
4927~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4928
4929VXLAN encapsulation outer layer has default value pre-configured in testpmd
4930source code, those can be changed by using the following commands
4931
4932IPv4 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
4951IPv6 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
4970Sample NVGRE encapsulation rule
4971~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4972
4973NVGRE encapsulation outer layer has default value pre-configured in testpmd
4974source code, those can be changed by using the following commands
4975
4976IPv4 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
4989IPv6 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
5001Sample L2 encapsulation rule
5002~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5003
5004L2 encapsulation has default value pre-configured in testpmd
5005source code, those can be changed by using the following commands
5006
5007L2 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
5014L2 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
5021Sample L2 decapsulation rule
5022~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5023
5024L2 decapsulation has default value pre-configured in testpmd
5025source code, those can be changed by using the following commands
5026
5027L2 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
5033L2 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
5039Sample MPLSoGRE encapsulation rule
5040~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5041
5042MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
5043source code, those can be changed by using the following commands
5044
5045IPv4 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
5053IPv4 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
5061IPv6 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
5069IPv6 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
5077Sample MPLSoGRE decapsulation rule
5078~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5079
5080MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
5081source code, those can be changed by using the following commands
5082
5083IPv4 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
5089IPv4 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
5095IPv6 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
5101IPv6 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
5107Sample MPLSoUDP encapsulation rule
5108~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5109
5110MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
5111source code, those can be changed by using the following commands
5112
5113IPv4 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
5121IPv4 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
5129IPv6 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
5137IPv6 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
5145Sample MPLSoUDP decapsulation rule
5146~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5147
5148MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
5149source code, those can be changed by using the following commands
5150
5151IPv4 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
5157IPv4 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
5163IPv6 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
5169IPv6 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
5175Sample Raw encapsulation rule
5176~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5177
5178Raw encapsulation configuration can be set by the following commands
5179
5180Eecapsulating 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
5188Sample Raw decapsulation rule
5189~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5190
5191Raw decapsulation configuration can be set by the following commands
5192
5193Decapsulating 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
5199Sample ESP rules
5200~~~~~~~~~~~~~~~~
5201
5202ESP 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
5213Sample AH rules
5214~~~~~~~~~~~~~~~~
5215
5216AH 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
5227Sample PFCP rules
5228~~~~~~~~~~~~~~~~~
5229
5230PFCP rules can be created by the following commands(s_field need to be 1
5231if 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
5242BPF Functions
5243--------------
5244
5245The following sections show functions to load/unload eBPF based filters.
5246
5247bpf-load
5248~~~~~~~~
5249
5250Load 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
5254The 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
5266For example:
5267
5268.. code-block:: console
5269
5270   cd examples/bpf
5271   clang -O2 -target bpf -c t1.c
5272
5273Then 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
5279To 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
5285bpf-unload
5286~~~~~~~~~~
5287
5288Unload previously loaded eBPF program for particular RX/TX queue::
5289
5290   testpmd> bpf-unload rx|tx (portid) (queueid)
5291
5292For example to unload BPF filter from TX queue 0, port 0:
5293
5294.. code-block:: console
5295
5296   testpmd> bpf-unload tx 0 0
5297