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