1 .. SPDX-License-Identifier: BSD-3-Clause
2 Copyright(c) 2010-2016 Intel Corporation.
6 Testpmd Runtime Functions
7 =========================
9 Where the testpmd application is started in interactive mode, (``-i|--interactive``),
10 it displays a prompt that can be used to start and stop forwarding,
11 configure the application, display statistics (including the extended NIC
12 statistics aka xstats) , set the Flow Director and other tasks::
16 The testpmd prompt has some, limited, readline support.
17 Common bash command-line functions such as ``Ctrl+a`` and ``Ctrl+e`` to go to the start and end of the prompt line are supported
18 as well as access to the command history via the up-arrow.
20 There is also support for tab completion.
21 If you type a partial command and hit ``<TAB>`` you get a list of the available completions:
23 .. code-block:: console
25 testpmd> show port <TAB>
27 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X
28 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all
29 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X
30 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all
36 Some examples in this document are too long to fit on one line are shown wrapped at `"\\"` for display purposes::
38 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
39 (pause_time) (send_xon) (port_id)
41 In the real ``testpmd>`` prompt these commands should be on a single line.
46 The testpmd has on-line help for the functions that are available at runtime.
47 These are divided into sections and can be accessed using help, help section or help all:
49 .. code-block:: console
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.
62 Command File Functions
63 ----------------------
65 To facilitate loading large number of commands or to avoid cutting and pasting where not
66 practical or possible testpmd supports alternative methods for executing commands.
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.
72 .. code-block:: console
74 ./dpdk-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
89 Flow rule #498 created
90 Flow rule #499 created
91 Read all CLI commands from /home/ubuntu/flow-create-commands.txt
95 * At run-time additional commands can be loaded in bulk by invoking the ``load FILENAME``
98 .. code-block:: console
100 testpmd> load /home/ubuntu/flow-create-commands.txt
105 Flow rule #498 created
106 Flow rule #499 created
107 Read all CLI commands from /home/ubuntu/flow-create-commands.txt
111 In all cases output from any included command will be displayed as standard output.
112 Execution will continue until the end of the file is reached regardless of
113 whether any errors occur. The end user must examine the output to determine if
114 any failures occurred.
123 Start packet forwarding with current configuration::
130 Start packet forwarding with current configuration after sending specified number of bursts of packets::
132 testpmd> start tx_first (""|burst_num)
134 The default burst number is 1 when ``burst_num`` not presented.
139 Stop packet forwarding, and display accumulated statistics::
154 The functions in the following sections are used to display information about the
155 testpmd configuration or the NIC status.
160 Display information for a given port or all ports::
162 testpmd> show port (info|summary|stats|xstats|fdir|stat_qmap|dcb_tc) (port_id|all)
164 The available information categories are:
166 * ``info``: General port information such as MAC address.
168 * ``summary``: Brief port summary such as Device Name, Driver Name etc.
170 * ``stats``: RX/TX statistics.
172 * ``xstats``: RX/TX extended NIC statistics.
174 * ``fdir``: Flow Director information and statistics.
176 * ``stat_qmap``: Queue statistics mapping.
178 * ``dcb_tc``: DCB information such as TC mapping.
182 .. code-block:: console
184 testpmd> show port info 0
186 ********************* Infos for port 0 *********************
188 MAC address: XX:XX:XX:XX:XX:XX
190 memory allocation on the socket: 0
192 Link speed: 40000 Mbps
193 Link duplex: full-duplex
194 Promiscuous mode: enabled
195 Allmulticast mode: disabled
196 Maximum number of MAC addresses: 64
197 Maximum number of MAC addresses of hash filtering: 0
199 strip on, filter on, extend off, qinq strip off
200 Redirection table size: 512
201 Supported flow types:
219 show port (module_eeprom|eeprom)
220 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
222 Display the EEPROM information of a port::
224 testpmd> show port (port_id) (module_eeprom|eeprom)
229 Display the rss redirection table entry indicated by masks on port X::
231 testpmd> show port (port_id) rss reta (size) (mask0, mask1...)
233 size is used to indicate the hardware supported reta size
238 Display the RSS hash functions and RSS hash key of a port::
240 testpmd> show port (port_id) rss-hash [key]
245 Clear the port statistics and forward engine statistics for a given port or for all ports::
247 testpmd> clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)
251 testpmd> clear port stats all
256 Display information for a given port's RX/TX queue::
258 testpmd> show (rxq|txq) info (port_id) (queue_id)
260 show desc status(rxq|txq)
261 ~~~~~~~~~~~~~~~~~~~~~~~~~
263 Display information for a given port's RX/TX descriptor status::
265 testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status
267 show rxq desc used count
268 ~~~~~~~~~~~~~~~~~~~~~~~~
270 Display the number of receive packet descriptors currently filled by hardware
271 and ready to be processed by the driver on a given RX queue::
273 testpmd> show port (port_id) rxq (queue_id) desc used count
278 Displays the configuration of the application.
279 The configuration comes from the command-line, the runtime or the application defaults::
281 testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes)
283 The available information categories are:
285 * ``rxtx``: RX/TX configuration items.
287 * ``cores``: List of forwarding cores.
289 * ``fwd``: Packet forwarding configuration.
291 * ``rxoffs``: Packet offsets for RX split.
293 * ``rxpkts``: Packets to RX split configuration.
295 * ``txpkts``: Packets to TX configuration.
297 * ``txtimes``: Burst time pattern for Tx only mode.
301 .. code-block:: console
303 testpmd> show config rxtx
305 io packet forwarding - CRC stripping disabled - packets/burst=16
306 nb forwarding cores=2 - nb forwarding ports=1
307 RX queues=1 - RX desc=128 - RX free threshold=0
308 RX threshold registers: pthresh=8 hthresh=8 wthresh=4
309 TX queues=1 - TX desc=512 - TX free threshold=0
310 TX threshold registers: pthresh=36 hthresh=0 wthresh=0
311 TX RS bit threshold=0 - TXQ flags=0x0
316 Set the packet forwarding mode::
318 testpmd> set fwd (io|mac|macswap|flowgen| \
319 rxonly|txonly|csum|icmpecho|noisy|5tswap) (""|retry)
321 ``retry`` can be specified for forwarding engines except ``rx_only``.
323 The available information categories are:
325 * ``io``: Forwards packets "as-is" in I/O mode.
326 This is the fastest possible forwarding operation as it does not access packets data.
327 This is the default mode.
329 * ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them.
330 Default application behavior is to set source Ethernet address to that of the transmitting interface, and destination
331 address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or
332 'eth-peers-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address.
334 * ``macswap``: MAC swap forwarding mode.
335 Swaps the source and the destination Ethernet addresses of packets before forwarding them.
337 * ``flowgen``: Multi-flow generation mode.
338 Originates a number of flows (with varying destination IP addresses), and terminate receive traffic.
340 * ``rxonly``: Receives packets but doesn't transmit them.
342 * ``txonly``: Generates and transmits packets without receiving any.
344 * ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet.
346 * ``icmpecho``: Receives a burst of packets, lookup for ICMP echo requests and, if any, send back ICMP echo replies.
348 * ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX.
350 * ``noisy``: Noisy neighbor simulation.
351 Simulate more realistic behavior of a guest machine engaged in receiving
352 and sending packets performing Virtual Network Function (VNF).
354 * ``5tswap``: Swap the source and destination of L2,L3,L4 if they exist.
356 L2 swaps the source address and destination address of Ethernet, as same as ``macswap``.
358 L3 swaps the source address and destination address of IP (v4 and v6).
360 L4 swaps the source port and destination port of transport layer (TCP and UDP).
364 testpmd> set fwd rxonly
366 Set rxonly packet forwarding mode
372 When running, forwarding engines maintain statistics from the time they have been started.
373 Example for the io forwarding engine, with some packet drops on the tx side::
375 testpmd> show fwd stats all
377 ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
378 RX-packets: 274293770 TX-packets: 274293642 TX-dropped: 128
380 ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
381 RX-packets: 274301850 TX-packets: 274301850 TX-dropped: 0
383 ---------------------- Forward statistics for port 0 ----------------------
384 RX-packets: 274293802 RX-dropped: 0 RX-total: 274293802
385 TX-packets: 274301862 TX-dropped: 0 TX-total: 274301862
386 ----------------------------------------------------------------------------
388 ---------------------- Forward statistics for port 1 ----------------------
389 RX-packets: 274301894 RX-dropped: 0 RX-total: 274301894
390 TX-packets: 274293706 TX-dropped: 128 TX-total: 274293834
391 ----------------------------------------------------------------------------
393 +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
394 RX-packets: 548595696 RX-dropped: 0 RX-total: 548595696
395 TX-packets: 548595568 TX-dropped: 128 TX-total: 548595696
396 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
402 Clear the forwarding engines statistics::
404 testpmd> clear fwd stats all
409 Display an RX descriptor for a port RX queue::
411 testpmd> read rxd (port_id) (queue_id) (rxd_id)
415 testpmd> read rxd 0 0 4
416 0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180
421 Display a TX descriptor for a port TX queue::
423 testpmd> read txd (port_id) (queue_id) (txd_id)
427 testpmd> read txd 0 0 4
428 0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
433 Get loaded dynamic device personalization (DDP) package info list::
435 testpmd> ddp get list (port_id)
440 Display information about dynamic device personalization (DDP) profile::
442 testpmd> ddp get info (profile_path)
447 Display VF statistics::
449 testpmd> show vf stats (port_id) (vf_id)
454 Reset VF statistics::
456 testpmd> clear vf stats (port_id) (vf_id)
458 show port pctype mapping
459 ~~~~~~~~~~~~~~~~~~~~~~~~
461 List all items from the pctype mapping table::
463 testpmd> show port (port_id) pctype mapping
465 show rx offloading capabilities
466 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
468 List all per queue and per port Rx offloading capabilities of a port::
470 testpmd> show port (port_id) rx_offload capabilities
472 show rx offloading configuration
473 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
475 List port level and all queue level Rx offloading configuration::
477 testpmd> show port (port_id) rx_offload configuration
479 show tx offloading capabilities
480 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
482 List all per queue and per port Tx offloading capabilities of a port::
484 testpmd> show port (port_id) tx_offload capabilities
486 show tx offloading configuration
487 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
489 List port level and all queue level Tx offloading configuration::
491 testpmd> show port (port_id) tx_offload configuration
493 show tx metadata setting
494 ~~~~~~~~~~~~~~~~~~~~~~~~
496 Show Tx metadata value set for a specific port::
498 testpmd> show port (port_id) tx_metadata
500 show port supported ptypes
501 ~~~~~~~~~~~~~~~~~~~~~~~~~~
503 Show ptypes supported for a specific port::
505 testpmd> show port (port_id) ptypes
507 set port supported ptypes
508 ~~~~~~~~~~~~~~~~~~~~~~~~~
510 set packet types classification for a specific port::
512 testpmd> set port (port_id) ptypes_mask (mask)
514 show port mac addresses info
515 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
517 Show mac addresses added for a specific port::
519 testpmd> show port (port_id) macs
522 show port multicast mac addresses info
523 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
525 Show multicast mac addresses added for a specific port::
527 testpmd> show port (port_id) mcast_macs
532 Show general information about devices probed::
534 testpmd> show device info (<identifier>|all)
538 .. code-block:: console
540 testpmd> show device info net_pcap0
542 ********************* Infos for device net_pcap0 *********************
544 Driver name: net_pcap
545 Devargs: iface=enP2p6s0,phy_mac=1
546 Connect to socket: -1
549 MAC address: 1E:37:93:28:04:B8
550 Device name: net_pcap0
555 Dumps all physical memory segment layouts::
557 testpmd> dump_physmem
562 Dumps the layout of all memory zones::
564 testpmd> dump_memzone
569 Dumps the memory usage of all sockets::
571 testpmd> dump_socket_mem
576 Dumps the size of all memory structures::
578 testpmd> dump_struct_sizes
583 Dumps the status of all or specific element in DPDK rings::
585 testpmd> dump_ring [ring_name]
590 Dumps the statistics of all or specific memory pool::
592 testpmd> dump_mempool [mempool_name]
597 Dumps the user device list::
599 testpmd> dump_devargs
604 Dumps the log level for all the dpdk modules::
606 testpmd> dump_log_types
608 show (raw_encap|raw_decap)
609 ~~~~~~~~~~~~~~~~~~~~~~~~~~
611 Display content of raw_encap/raw_decap buffers in hex::
613 testpmd> show <raw_encap|raw_decap> <index>
614 testpmd> show <raw_encap|raw_decap> all
618 testpmd> show raw_encap 6
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 | ................
626 show fec capabilities
627 ~~~~~~~~~~~~~~~~~~~~~
629 Show fec capabilities of a port::
631 testpmd> show port (port_id) fec capabilities
636 Show fec mode of a port::
638 testpmd> show port (port_id) fec_mode
641 Configuration Functions
642 -----------------------
644 The testpmd application can be configured from the runtime as well as from the command-line.
646 This section details the available configuration functions that are available.
650 Configuration changes only become active when forwarding is started/restarted.
655 Reset forwarding to the default configuration::
662 Set the debug verbosity level::
664 testpmd> set verbose (level)
666 Available levels are as following:
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.
676 Set the log level for a log type::
678 testpmd> set log global|(type) (level)
682 * ``type`` is the log name.
684 * ``level`` is the log level.
686 For example, to change the global log level::
688 testpmd> set log global (level)
690 Regexes can also be used for type. To change log level of user1, user2 and user3::
692 testpmd> set log user[1-3] (level)
697 Set the number of ports used by the application:
701 This is equivalent to the ``--nb-ports`` command-line option.
706 Set the number of cores used by the application::
708 testpmd> set nbcore (num)
710 This is equivalent to the ``--nb-cores`` command-line option.
714 The number of cores used must not be greater than number of ports used multiplied by the number of queues per port.
719 Set the forwarding cores hexadecimal mask::
721 testpmd> set coremask (mask)
723 This is equivalent to the ``--coremask`` command-line option.
727 The main lcore is reserved for command line parsing only and cannot be masked on for packet forwarding.
732 Set the forwarding ports hexadecimal mask::
734 testpmd> set portmask (mask)
736 This is equivalent to the ``--portmask`` command-line option.
738 set record-core-cycles
739 ~~~~~~~~~~~~~~~~~~~~~~
741 Set the recording of CPU cycles::
743 testpmd> set record-core-cycles (on|off)
747 * ``on`` enables measurement of CPU cycles per packet.
749 * ``off`` disables measurement of CPU cycles per packet.
751 This is equivalent to the ``--record-core-cycles command-line`` option.
753 set record-burst-stats
754 ~~~~~~~~~~~~~~~~~~~~~~
756 Set the displaying of RX and TX bursts::
758 testpmd> set record-burst-stats (on|off)
762 * ``on`` enables display of RX and TX bursts.
764 * ``off`` disables display of RX and TX bursts.
766 This is equivalent to the ``--record-burst-stats command-line`` option.
771 Set number of packets per burst::
773 testpmd> set burst (num)
775 This is equivalent to the ``--burst command-line`` option.
777 When retry is enabled, the transmit delay time and number of retries can also be set::
779 testpmd> set burst tx delay (microseconds) retry (num)
784 Set the offsets of segments relating to the data buffer beginning on receiving
785 if split feature is engaged. Affects only the queues configured with split
786 offloads (currently BUFFER_SPLIT is supported only).
788 testpmd> set rxoffs (x[,y]*)
790 Where x[,y]* represents a CSV list of values, without white space. If the list
791 of offsets is shorter than the list of segments the zero offsets will be used
792 for the remaining segments.
797 Set the length of segments to scatter packets on receiving if split
798 feature is engaged. Affects only the queues configured with split offloads
799 (currently BUFFER_SPLIT is supported only). Optionally the multiple memory
800 pools can be specified with --mbuf-size command line parameter and the mbufs
801 to receive will be allocated sequentially from these extra memory pools (the
802 mbuf for the first segment is allocated from the first pool, the second one
803 from the second pool, and so on, if segment number is greater then pool's the
804 mbuf for remaining segments will be allocated from the last valid pool).
806 testpmd> set rxpkts (x[,y]*)
808 Where x[,y]* represents a CSV list of values, without white space. Zero value
809 means to use the corresponding memory pool data buffer size.
814 Set the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode::
816 testpmd> set txpkts (x[,y]*)
818 Where x[,y]* represents a CSV list of values, without white space.
823 Configure the timing burst pattern for Tx only mode. This command enables
824 the packet send scheduling on dynamic timestamp mbuf field and configures
825 timing pattern in Tx only mode. In this mode, if scheduling is enabled
826 application provides timestamps in the packets being sent. It is possible
827 to configure delay (in unspecified device clock units) between bursts
828 and between the packets within the burst::
830 testpmd> set txtimes (inter),(intra)
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).
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.
847 As the result the bursts of packet will be transmitted with specific
848 delays between the packets within the burst and specific delay between
849 the bursts. The rte_eth_read_clock() must be supported by the device(s)
850 and is supposed to be engaged to get the current device clock value
851 and provide the reference for the timestamps. If there is no supported
852 rte_eth_read_clock() there will be no send scheduling provided on the port.
857 Set the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes::
859 testpmd> set txsplit (off|on|rand)
863 * ``off`` disable packet copy & split for CSUM mode.
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
869 * ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments.
874 Set the list of forwarding cores::
876 testpmd> set corelist (x[,y]*)
878 For example, to change the forwarding cores:
880 .. code-block:: console
882 testpmd> set corelist 3,1
883 testpmd> show config fwd
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
893 The cores are used in the same order as specified on the command line.
898 Set the list of forwarding ports::
900 testpmd> set portlist (x[,y]*)
902 For example, to change the port forwarding:
904 .. code-block:: console
906 testpmd> set portlist 0,2,1,3
907 testpmd> show config fwd
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
919 Select how to retrieve new ports created after "port attach" command::
921 testpmd> set port setup on (iterator|event)
923 For each new port, a setup is done.
924 It will find the probed ports via RTE_ETH_FOREACH_MATCHING_DEV loop
925 in iterator mode, or via RTE_ETH_EVENT_NEW in event mode.
930 Enable/disable tx loopback::
932 testpmd> set tx loopback (port_id) (on|off)
937 set drop enable bit for all queues::
939 testpmd> set all queues drop (port_id) (on|off)
941 set split drop enable (for VF)
942 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
944 set split drop enable bit for VF from PF::
946 testpmd> set vf split drop (port_id) (vf_id) (on|off)
948 set mac antispoof (for VF)
949 ~~~~~~~~~~~~~~~~~~~~~~~~~~
951 Set mac antispoof for a VF from the PF::
953 testpmd> set vf mac antispoof (port_id) (vf_id) (on|off)
958 Enable/disable MACsec offload::
960 testpmd> set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)
961 testpmd> set macsec offload (port_id) off
966 Configure MACsec secure connection (SC)::
968 testpmd> set macsec sc (tx|rx) (port_id) (mac) (pi)
972 The pi argument is ignored for tx.
973 Check the NIC Datasheet for hardware limits.
978 Configure MACsec secure association (SA)::
980 testpmd> set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)
984 The IDX value must be 0 or 1.
985 Check the NIC Datasheet for hardware limits.
987 set broadcast mode (for VF)
988 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
990 Set broadcast mode for a VF from the PF::
992 testpmd> set vf broadcast (port_id) (vf_id) (on|off)
997 Set the VLAN strip for a queue on a port::
999 testpmd> vlan set stripq (on|off) (port_id,queue_id)
1001 vlan set stripq (for VF)
1002 ~~~~~~~~~~~~~~~~~~~~~~~~
1004 Set VLAN strip for all queues in a pool for a VF from the PF::
1006 testpmd> set vf vlan stripq (port_id) (vf_id) (on|off)
1008 vlan set insert (for VF)
1009 ~~~~~~~~~~~~~~~~~~~~~~~~
1011 Set VLAN insert for a VF from the PF::
1013 testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
1015 vlan set tag (for VF)
1016 ~~~~~~~~~~~~~~~~~~~~~
1018 Set VLAN tag for a VF from the PF::
1020 testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
1022 vlan set antispoof (for VF)
1023 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1025 Set VLAN antispoof for a VF from the PF::
1027 testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off)
1029 vlan set (strip|filter|qinq_strip|extend)
1030 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1031 Set the VLAN strip/filter/QinQ strip/extend on for a port::
1033 testpmd> vlan set (strip|filter|qinq_strip|extend) (on|off) (port_id)
1038 Set the inner or outer VLAN TPID for packet filtering on a port::
1040 testpmd> vlan set (inner|outer) tpid (value) (port_id)
1044 TPID value must be a 16-bit number (value <= 65536).
1049 Add a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID::
1051 testpmd> rx_vlan add (vlan_id|all) (port_id)
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.
1062 Remove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID::
1064 testpmd> rx_vlan rm (vlan_id|all) (port_id)
1066 rx_vlan add (for VF)
1067 ~~~~~~~~~~~~~~~~~~~~
1069 Add a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID::
1071 testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask)
1076 Remove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID::
1078 testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask)
1083 Add an UDP port for VXLAN packet filter on a port::
1085 testpmd> rx_vxlan_port add (udp_port) (port_id)
1087 rx_vxlan_port remove
1088 ~~~~~~~~~~~~~~~~~~~~
1090 Remove an UDP port for VXLAN packet filter on a port::
1092 testpmd> rx_vxlan_port rm (udp_port) (port_id)
1097 Set hardware insertion of VLAN IDs in packets sent on a port::
1099 testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer]
1101 For example, set a single VLAN ID (5) insertion on port 0::
1105 Or, set double VLAN ID (inner: 2, outer: 3) insertion on port 1::
1113 Set port based hardware insertion of VLAN ID in packets sent on a port::
1115 testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off)
1120 Disable hardware insertion of a VLAN header in packets sent on a port::
1122 testpmd> tx_vlan reset (port_id)
1127 Select hardware or software calculation of the checksum when
1128 transmitting a packet using the ``csum`` forwarding engine::
1130 testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)
1134 * ``ip|udp|tcp|sctp`` always relate to the inner layer.
1136 * ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized
1137 as a tunnel packet by the forwarding engine (geneve, gre, gtp, ipip, vxlan and vxlan-gpe are
1138 supported). See also the ``csum parse-tunnel`` command.
1140 * ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized
1141 as a tunnel packet by the forwarding engine (geneve, gtp, vxlan and vxlan-gpe are
1142 supported). See also the ``csum parse-tunnel`` command.
1146 Check the NIC Datasheet for hardware limits.
1151 Set RSS queue region span on a port::
1153 testpmd> set port (port_id) queue-region region_id (value) \
1154 queue_start_index (value) queue_num (value)
1156 Set flowtype mapping on a RSS queue region on a port::
1158 testpmd> set port (port_id) queue-region region_id (value) flowtype (value)
1162 * For the flowtype(pctype) of packet,the specific index for each type has
1163 been defined in file i40e_type.h as enum i40e_filter_pctype.
1165 Set user priority mapping on a RSS queue region on a port::
1167 testpmd> set port (port_id) queue-region UP (value) region_id (value)
1169 Flush all queue region related configuration on a port::
1171 testpmd> set port (port_id) queue-region flush (on|off)
1175 * ``on``: is just an enable function which server for other configuration,
1176 it is for all configuration about queue region from up layer,
1177 at first will only keep in DPDK software stored in driver,
1178 only after "flush on", it commit all configuration to HW.
1180 * ``"off``: is just clean all configuration about queue region just now,
1181 and restore all to DPDK i40e driver default config when start up.
1183 Show all queue region related configuration info on a port::
1185 testpmd> show port (port_id) queue-region
1189 Queue region only support on PF by now, so these command is
1190 only for configuration of queue region on PF port.
1195 Define how tunneled packets should be handled by the csum forward
1198 testpmd> csum parse-tunnel (on|off) (tx_port_id)
1200 If enabled, the csum forward engine will try to recognize supported
1201 tunnel headers (geneve, gtp, gre, ipip, vxlan, vxlan-gpe).
1203 If disabled, treat tunnel packets as non-tunneled packets (a inner
1204 header is handled as a packet payload).
1208 The port argument is the TX port like in the ``csum set`` command.
1212 Consider a packet in packet like the following::
1214 eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in
1216 * If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1217 command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the
1218 ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ipv4_out`` and ``udp_out``).
1220 * If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1221 command relate to the outer headers, here ``ipv4_out`` and ``udp_out``.
1226 Display tx checksum offload configuration::
1228 testpmd> csum show (port_id)
1233 Enable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine::
1235 testpmd> tso set (segsize) (port_id)
1239 Check the NIC datasheet for hardware limits.
1244 Display the status of TCP Segmentation Offload::
1246 testpmd> tso show (port_id)
1251 Set tso segment size of tunneled packets for a port in csum engine::
1253 testpmd> tunnel_tso set (tso_segsz) (port_id)
1258 Display the status of tunneled TCP Segmentation Offload for a port::
1260 testpmd> tunnel_tso show (port_id)
1265 Enable or disable GRO in ``csum`` forwarding engine::
1267 testpmd> set port <port_id> gro on|off
1269 If enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
1270 packets received from the given port.
1272 If disabled, packets received from the given port won't be performed
1273 GRO. By default, GRO is disabled for all ports.
1277 When enable GRO for a port, TCP/IPv4 packets received from the port
1278 will be performed GRO. After GRO, all merged packets have bad
1279 checksums, since the GRO library doesn't re-calculate checksums for
1280 the merged packets. Therefore, if users want the merged packets to
1281 have correct checksums, please select HW IP checksum calculation and
1282 HW TCP checksum calculation for the port which the merged packets are
1288 Display GRO configuration for a given port::
1290 testpmd> show port <port_id> gro
1295 Set the cycle to flush the GROed packets from reassembly tables::
1297 testpmd> set gro flush <cycles>
1299 When enable GRO, the csum forwarding engine performs GRO on received
1300 packets, and the GROed packets are stored in reassembly tables. Users
1301 can use this command to determine when the GROed packets are flushed
1302 from the reassembly tables.
1304 The ``cycles`` is measured in GRO operation times. The csum forwarding
1305 engine flushes the GROed packets from the tables every ``cycles`` GRO
1308 By default, the value of ``cycles`` is 1, which means flush GROed packets
1309 from the reassembly tables as soon as one GRO operation finishes. The value
1310 of ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
1312 Please note that the large value of ``cycles`` may cause the poor TCP/IP
1313 stack performance. Because the GROed packets are delayed to arrive the
1314 stack, thus causing more duplicated ACKs and TCP retransmissions.
1319 Toggle per-port GSO support in ``csum`` forwarding engine::
1321 testpmd> set port <port_id> gso on|off
1323 If enabled, the csum forwarding engine will perform GSO on supported IPv4
1324 packets, transmitted on the given port.
1326 If disabled, packets transmitted on the given port will not undergo GSO.
1327 By default, GSO is disabled for all ports.
1331 When GSO is enabled on a port, supported IPv4 packets transmitted on that
1332 port undergo GSO. Afterwards, the segmented packets are represented by
1333 multi-segment mbufs; however, the csum forwarding engine doesn't calculation
1334 of checksums for GSO'd segments in SW. As a result, if users want correct
1335 checksums in GSO segments, they should enable HW checksum calculation for
1338 For example, HW checksum calculation for VxLAN GSO'd packets may be enabled
1339 by setting the following options in the csum forwarding engine:
1341 testpmd> csum set outer_ip hw <port_id>
1343 testpmd> csum set ip hw <port_id>
1345 testpmd> csum set tcp hw <port_id>
1347 UDP GSO is the same as IP fragmentation, which treats the UDP header
1348 as the payload and does not modify it during segmentation. That is,
1349 after UDP GSO, only the first output fragment has the original UDP
1350 header. Therefore, users need to enable HW IP checksum calculation
1351 and SW UDP checksum calculation for GSO-enabled ports, if they want
1352 correct checksums for UDP/IPv4 packets.
1357 Set the maximum GSO segment size (measured in bytes), which includes the
1358 packet header and the packet payload for GSO-enabled ports (global)::
1360 testpmd> set gso segsz <length>
1365 Display the status of Generic Segmentation Offload for a given port::
1367 testpmd> show port <port_id> gso
1372 Add an alternative MAC address to a port::
1374 testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)
1379 Remove a MAC address from a port::
1381 testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)
1386 To add the multicast MAC address to/from the set of multicast addresses
1389 testpmd> mcast_addr add (port_id) (mcast_addr)
1394 To remove the multicast MAC address to/from the set of multicast addresses
1397 testpmd> mcast_addr remove (port_id) (mcast_addr)
1399 mac_addr add (for VF)
1400 ~~~~~~~~~~~~~~~~~~~~~
1402 Add an alternative MAC address for a VF to a port::
1404 testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX)
1409 Set the default MAC address for a port::
1411 testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
1413 mac_addr set (for VF)
1414 ~~~~~~~~~~~~~~~~~~~~~
1416 Set the MAC address for a VF from the PF::
1418 testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)
1423 Set the forwarding peer address for certain port::
1425 testpmd> set eth-peer (port_id) (peer_addr)
1427 This is equivalent to the ``--eth-peer`` command-line option.
1432 Set the unicast hash filter(s) on/off for a port::
1434 testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off)
1439 Set the promiscuous mode on for a port or for all ports.
1440 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1442 testpmd> set promisc (port_id|all) (on|off)
1447 Set the allmulti mode for a port or for all ports::
1449 testpmd> set allmulti (port_id|all) (on|off)
1451 Same as the ifconfig (8) option. Controls how multicast packets are handled.
1453 set promisc (for VF)
1454 ~~~~~~~~~~~~~~~~~~~~
1456 Set the unicast promiscuous mode for a VF from PF.
1457 It's supported by Intel i40e NICs now.
1458 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1460 testpmd> set vf promisc (port_id) (vf_id) (on|off)
1462 set allmulticast (for VF)
1463 ~~~~~~~~~~~~~~~~~~~~~~~~~
1465 Set the multicast promiscuous mode for a VF from PF.
1466 It's supported by Intel i40e NICs now.
1467 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1469 testpmd> set vf allmulti (port_id) (vf_id) (on|off)
1471 set tx max bandwidth (for VF)
1472 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1474 Set TX max absolute bandwidth (Mbps) for a VF from PF::
1476 testpmd> set vf tx max-bandwidth (port_id) (vf_id) (max_bandwidth)
1478 set tc tx min bandwidth (for VF)
1479 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1481 Set all TCs' TX min relative bandwidth (%) for a VF from PF::
1483 testpmd> set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)
1485 set tc tx max bandwidth (for VF)
1486 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1488 Set a TC's TX max absolute bandwidth (Mbps) for a VF from PF::
1490 testpmd> set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (max_bandwidth)
1492 set tc strict link priority mode
1493 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1495 Set some TCs' strict link priority mode on a physical port::
1497 testpmd> set tx strict-link-priority (port_id) (tc_bitmap)
1499 set tc tx min bandwidth
1500 ~~~~~~~~~~~~~~~~~~~~~~~
1502 Set all TCs' TX min relative bandwidth (%) globally for all PF and VFs::
1504 testpmd> set tc tx min-bandwidth (port_id) (bw1, bw2, ...)
1509 Set the link flow control parameter on a port::
1511 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1512 (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \
1513 autoneg (on|off) (port_id)
1517 * ``high_water`` (integer): High threshold value to trigger XOFF.
1519 * ``low_water`` (integer): Low threshold value to trigger XON.
1521 * ``pause_time`` (integer): Pause quota in the Pause frame.
1523 * ``send_xon`` (0/1): Send XON frame.
1525 * ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames.
1527 * ``autoneg``: Change the auto-negotiation parameter.
1532 Set the priority flow control parameter on a port::
1534 testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1535 (pause_time) (priority) (port_id)
1539 * ``high_water`` (integer): High threshold value.
1541 * ``low_water`` (integer): Low threshold value.
1543 * ``pause_time`` (integer): Pause quota in the Pause frame.
1545 * ``priority`` (0-7): VLAN User Priority.
1550 Set statistics mapping (qmapping 0..15) for RX/TX queue on port::
1552 testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)
1554 For example, to set rx queue 2 on port 0 to mapping 5::
1556 testpmd>set stat_qmap rx 0 2 5
1558 set xstats-hide-zero
1559 ~~~~~~~~~~~~~~~~~~~~
1561 Set the option to hide zero values for xstats display::
1563 testpmd> set xstats-hide-zero on|off
1567 By default, the zero values are displayed for xstats.
1569 set port - rx/tx (for VF)
1570 ~~~~~~~~~~~~~~~~~~~~~~~~~
1572 Set VF receive/transmit from a port::
1574 testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1576 set port - rx mode(for VF)
1577 ~~~~~~~~~~~~~~~~~~~~~~~~~~
1579 Set the VF receive mode of a port::
1581 testpmd> set port (port_id) vf (vf_id) \
1582 rxmode (AUPE|ROPE|BAM|MPE) (on|off)
1584 The available receive modes are:
1586 * ``AUPE``: Accepts untagged VLAN.
1588 * ``ROPE``: Accepts unicast hash.
1590 * ``BAM``: Accepts broadcast packets.
1592 * ``MPE``: Accepts all multicast packets.
1594 set port - tx_rate (for Queue)
1595 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1597 Set TX rate limitation for a queue on a port::
1599 testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1601 set port - tx_rate (for VF)
1602 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1604 Set TX rate limitation for queues in VF on a port::
1606 testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
1608 set port - mirror rule
1609 ~~~~~~~~~~~~~~~~~~~~~~
1611 Set pool or vlan type mirror rule for a port::
1613 testpmd> set port (port_id) mirror-rule (rule_id) \
1614 (pool-mirror-up|pool-mirror-down|vlan-mirror) \
1615 (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off)
1617 Set link mirror rule for a port::
1619 testpmd> set port (port_id) mirror-rule (rule_id) \
1620 (uplink-mirror|downlink-mirror) dst-pool (pool_id) (on|off)
1622 For example to enable mirror traffic with vlan 0,1 to pool 0::
1624 set port 0 mirror-rule 0 vlan-mirror 0,1 dst-pool 0 on
1626 reset port - mirror rule
1627 ~~~~~~~~~~~~~~~~~~~~~~~~
1629 Reset a mirror rule for a port::
1631 testpmd> reset port (port_id) mirror-rule (rule_id)
1636 Set the flush on RX streams before forwarding.
1637 The default is flush ``on``.
1638 Mainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams::
1640 testpmd> set flush_rx off
1645 Set the bypass mode for the lowest port on bypass enabled NIC::
1647 testpmd> set bypass mode (normal|bypass|isolate) (port_id)
1652 Set the event required to initiate specified bypass mode for the lowest port on a bypass enabled::
1654 testpmd> set bypass event (timeout|os_on|os_off|power_on|power_off) \
1655 mode (normal|bypass|isolate) (port_id)
1659 * ``timeout``: Enable bypass after watchdog timeout.
1661 * ``os_on``: Enable bypass when OS/board is powered on.
1663 * ``os_off``: Enable bypass when OS/board is powered off.
1665 * ``power_on``: Enable bypass when power supply is turned on.
1667 * ``power_off``: Enable bypass when power supply is turned off.
1673 Set the bypass watchdog timeout to ``n`` seconds where 0 = instant::
1675 testpmd> set bypass timeout (0|1.5|2|3|4|8|16|32)
1680 Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC::
1682 testpmd> show bypass config (port_id)
1687 Set link up for a port::
1689 testpmd> set link-up port (port id)
1694 Set link down for a port::
1696 testpmd> set link-down port (port id)
1701 Enable E-tag insertion for a VF on a port::
1703 testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
1705 Disable E-tag insertion for a VF on a port::
1707 testpmd> E-tag set insertion off port (port_id) vf (vf_id)
1709 Enable/disable E-tag stripping on a port::
1711 testpmd> E-tag set stripping (on|off) port (port_id)
1713 Enable/disable E-tag based forwarding on a port::
1715 testpmd> E-tag set forwarding (on|off) port (port_id)
1720 Load a dynamic device personalization (DDP) profile and store backup profile::
1722 testpmd> ddp add (port_id) (profile_path[,backup_profile_path])
1727 Delete a dynamic device personalization profile and restore backup profile::
1729 testpmd> ddp del (port_id) (backup_profile_path)
1734 List all items from the ptype mapping table::
1736 testpmd> ptype mapping get (port_id) (valid_only)
1740 * ``valid_only``: A flag indicates if only list valid items(=1) or all itemss(=0).
1742 Replace a specific or a group of software defined ptype with a new one::
1744 testpmd> ptype mapping replace (port_id) (target) (mask) (pkt_type)
1748 * ``target``: A specific software ptype or a mask to represent a group of software ptypes.
1750 * ``mask``: A flag indicate if "target" is a specific software ptype(=0) or a ptype mask(=1).
1752 * ``pkt_type``: The new software ptype to replace the old ones.
1754 Update hardware defined ptype to software defined packet type mapping table::
1756 testpmd> ptype mapping update (port_id) (hw_ptype) (sw_ptype)
1760 * ``hw_ptype``: hardware ptype as the index of the ptype mapping table.
1762 * ``sw_ptype``: software ptype as the value of the ptype mapping table.
1764 Reset ptype mapping table::
1766 testpmd> ptype mapping reset (port_id)
1768 config per port Rx offloading
1769 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1771 Enable or disable a per port Rx offloading on all Rx queues of a port::
1773 testpmd> port config (port_id) rx_offload (offloading) on|off
1775 * ``offloading``: can be any of these offloading capability:
1776 vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1777 qinq_strip, outer_ipv4_cksum, macsec_strip,
1778 header_split, vlan_filter, vlan_extend, jumbo_frame,
1779 scatter, timestamp, security, keep_crc, rss_hash
1781 This command should be run when the port is stopped, or else it will fail.
1783 config per queue Rx offloading
1784 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1786 Enable or disable a per queue Rx offloading only on a specific Rx queue::
1788 testpmd> port (port_id) rxq (queue_id) rx_offload (offloading) on|off
1790 * ``offloading``: can be any of these offloading capability:
1791 vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1792 qinq_strip, outer_ipv4_cksum, macsec_strip,
1793 header_split, vlan_filter, vlan_extend, jumbo_frame,
1794 scatter, timestamp, security, keep_crc
1796 This command should be run when the port is stopped, or else it will fail.
1798 config per port Tx offloading
1799 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1801 Enable or disable a per port Tx offloading on all Tx queues of a port::
1803 testpmd> port config (port_id) tx_offload (offloading) on|off
1805 * ``offloading``: can be any of these offloading capability:
1806 vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1807 sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1808 qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1809 ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1810 mt_lockfree, multi_segs, mbuf_fast_free, security
1812 This command should be run when the port is stopped, or else it will fail.
1814 config per queue Tx offloading
1815 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1817 Enable or disable a per queue Tx offloading only on a specific Tx queue::
1819 testpmd> port (port_id) txq (queue_id) tx_offload (offloading) on|off
1821 * ``offloading``: can be any of these offloading capability:
1822 vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1823 sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1824 qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1825 ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1826 mt_lockfree, multi_segs, mbuf_fast_free, security
1828 This command should be run when the port is stopped, or else it will fail.
1830 Config VXLAN Encap outer layers
1831 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1833 Configure the outer layer to encapsulate a packet inside a VXLAN tunnel::
1835 set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1836 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) \
1839 set vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1840 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1841 eth-src (eth-src) eth-dst (eth-dst)
1843 set vxlan-tos-ttl ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1844 udp-dst (udp-dst) ip-tos (ip-tos) ip-ttl (ip-ttl) ip-src (ip-src) \
1845 ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1847 These commands will set an internal configuration inside testpmd, any following
1848 flow rule using the action vxlan_encap will use the last configuration set.
1849 To have a different encapsulation header, one of those commands must be called
1850 before the flow rule creation.
1852 Config NVGRE Encap outer layers
1853 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1855 Configure the outer layer to encapsulate a packet inside a NVGRE tunnel::
1857 set nvgre ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) ip-dst (ip-dst) \
1858 eth-src (eth-src) eth-dst (eth-dst)
1859 set nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) \
1860 ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1862 These commands will set an internal configuration inside testpmd, any following
1863 flow rule using the action nvgre_encap will use the last configuration set.
1864 To have a different encapsulation header, one of those commands must be called
1865 before the flow rule creation.
1870 Configure the l2 to be used when encapsulating a packet with L2::
1872 set l2_encap ip-version (ipv4|ipv6) eth-src (eth-src) eth-dst (eth-dst)
1873 set l2_encap-with-vlan ip-version (ipv4|ipv6) vlan-tci (vlan-tci) \
1874 eth-src (eth-src) eth-dst (eth-dst)
1876 Those commands will set an internal configuration inside testpmd, any following
1877 flow rule using the action l2_encap will use the last configuration set.
1878 To have a different encapsulation header, one of those commands must be called
1879 before the flow rule creation.
1884 Configure the l2 to be removed when decapsulating a packet with L2::
1886 set l2_decap ip-version (ipv4|ipv6)
1887 set l2_decap-with-vlan ip-version (ipv4|ipv6)
1889 Those commands will set an internal configuration inside testpmd, any following
1890 flow rule using the action l2_decap will use the last configuration set.
1891 To have a different encapsulation header, one of those commands must be called
1892 before the flow rule creation.
1894 Config MPLSoGRE Encap outer layers
1895 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1897 Configure the outer layer to encapsulate a packet inside a MPLSoGRE tunnel::
1899 set mplsogre_encap ip-version (ipv4|ipv6) label (label) \
1900 ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1901 set mplsogre_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1902 ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1903 eth-src (eth-src) eth-dst (eth-dst)
1905 These commands will set an internal configuration inside testpmd, any following
1906 flow rule using the action mplsogre_encap will use the last configuration set.
1907 To have a different encapsulation header, one of those commands must be called
1908 before the flow rule creation.
1910 Config MPLSoGRE Decap outer layers
1911 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1913 Configure the outer layer to decapsulate MPLSoGRE packet::
1915 set mplsogre_decap ip-version (ipv4|ipv6)
1916 set mplsogre_decap-with-vlan ip-version (ipv4|ipv6)
1918 These commands will set an internal configuration inside testpmd, any following
1919 flow rule using the action mplsogre_decap will use the last configuration set.
1920 To have a different decapsulation header, one of those commands must be called
1921 before the flow rule creation.
1923 Config MPLSoUDP Encap outer layers
1924 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1926 Configure the outer layer to encapsulate a packet inside a MPLSoUDP tunnel::
1928 set mplsoudp_encap ip-version (ipv4|ipv6) label (label) udp-src (udp-src) \
1929 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1930 eth-src (eth-src) eth-dst (eth-dst)
1931 set mplsoudp_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1932 udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1933 vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1935 These commands will set an internal configuration inside testpmd, any following
1936 flow rule using the action mplsoudp_encap will use the last configuration set.
1937 To have a different encapsulation header, one of those commands must be called
1938 before the flow rule creation.
1940 Config MPLSoUDP Decap outer layers
1941 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1943 Configure the outer layer to decapsulate MPLSoUDP packet::
1945 set mplsoudp_decap ip-version (ipv4|ipv6)
1946 set mplsoudp_decap-with-vlan ip-version (ipv4|ipv6)
1948 These commands will set an internal configuration inside testpmd, any following
1949 flow rule using the action mplsoudp_decap will use the last configuration set.
1950 To have a different decapsulation header, one of those commands must be called
1951 before the flow rule creation.
1953 Config Raw Encapsulation
1954 ~~~~~~~~~~~~~~~~~~~~~~~~~
1956 Configure the raw data to be used when encapsulating a packet by
1957 rte_flow_action_raw_encap::
1959 set raw_encap {index} {item} [/ {item} [...]] / end_set
1961 There are multiple global buffers for ``raw_encap``, this command will set one
1962 internal buffer index by ``{index}``.
1963 If there is no ``{index}`` specified::
1965 set raw_encap {item} [/ {item} [...]] / end_set
1967 the default index ``0`` is used.
1968 In order to use different encapsulating header, ``index`` must be specified
1969 during the flow rule creation::
1971 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
1972 raw_encap index 2 / end
1974 Otherwise the default index ``0`` is used.
1976 Config Raw Decapsulation
1977 ~~~~~~~~~~~~~~~~~~~~~~~~
1979 Configure the raw data to be used when decapsulating a packet by
1980 rte_flow_action_raw_decap::
1982 set raw_decap {index} {item} [/ {item} [...]] / end_set
1984 There are multiple global buffers for ``raw_decap``, this command will set
1985 one internal buffer index by ``{index}``.
1986 If there is no ``{index}`` specified::
1988 set raw_decap {item} [/ {item} [...]] / end_set
1990 the default index ``0`` is used.
1991 In order to use different decapsulating header, ``index`` must be specified
1992 during the flow rule creation::
1994 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
1995 raw_encap index 3 / end
1997 Otherwise the default index ``0`` is used.
2002 Set fec mode for a specific port::
2004 testpmd> set port (port_id) fec_mode auto|off|rs|baser
2010 The following sections show functions for configuring ports.
2014 Port configuration changes only become active when forwarding is started/restarted.
2019 Attach a port specified by pci address or virtual device args::
2021 testpmd> port attach (identifier)
2023 To attach a new pci device, the device should be recognized by kernel first.
2024 Then it should be moved under DPDK management.
2025 Finally the port can be attached to testpmd.
2027 For example, to move a pci device using ixgbe under DPDK management:
2029 .. code-block:: console
2031 # Check the status of the available devices.
2032 ./usertools/dpdk-devbind.py --status
2034 Network devices using DPDK-compatible driver
2035 ============================================
2038 Network devices using kernel driver
2039 ===================================
2040 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=
2043 # Bind the device to igb_uio.
2044 sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0
2047 # Recheck the status of the devices.
2048 ./usertools/dpdk-devbind.py --status
2049 Network devices using DPDK-compatible driver
2050 ============================================
2051 0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused=
2053 To attach a port created by virtual device, above steps are not needed.
2055 For example, to attach a port whose pci address is 0000:0a:00.0.
2057 .. code-block:: console
2059 testpmd> port attach 0000:0a:00.0
2060 Attaching a new port...
2061 EAL: PCI device 0000:0a:00.0 on NUMA socket -1
2062 EAL: probe driver: 8086:10fb rte_ixgbe_pmd
2063 EAL: PCI memory mapped at 0x7f83bfa00000
2064 EAL: PCI memory mapped at 0x7f83bfa80000
2065 PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5
2066 PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
2067 Port 0 is attached. Now total ports is 1
2070 For example, to attach a port created by pcap PMD.
2072 .. code-block:: console
2074 testpmd> port attach net_pcap0
2075 Attaching a new port...
2076 PMD: Initializing pmd_pcap for net_pcap0
2077 PMD: Creating pcap-backed ethdev on numa socket 0
2078 Port 0 is attached. Now total ports is 1
2081 In this case, identifier is ``net_pcap0``.
2082 This identifier format is the same as ``--vdev`` format of DPDK applications.
2084 For example, to re-attach a bonded port which has been previously detached,
2085 the mode and slave parameters must be given.
2087 .. code-block:: console
2089 testpmd> port attach net_bond_0,mode=0,slave=1
2090 Attaching a new port...
2091 EAL: Initializing pmd_bond for net_bond_0
2092 EAL: Create bonded device net_bond_0 on port 0 in mode 0 on socket 0.
2093 Port 0 is attached. Now total ports is 1
2100 Detach a specific port::
2102 testpmd> port detach (port_id)
2104 Before detaching a port, the port should be stopped and closed.
2106 For example, to detach a pci device port 0.
2108 .. code-block:: console
2110 testpmd> port stop 0
2113 testpmd> port close 0
2117 testpmd> port detach 0
2119 EAL: PCI device 0000:0a:00.0 on NUMA socket -1
2120 EAL: remove driver: 8086:10fb rte_ixgbe_pmd
2121 EAL: PCI memory unmapped at 0x7f83bfa00000
2122 EAL: PCI memory unmapped at 0x7f83bfa80000
2126 For example, to detach a virtual device port 0.
2128 .. code-block:: console
2130 testpmd> port stop 0
2133 testpmd> port close 0
2137 testpmd> port detach 0
2139 PMD: Closing pcap ethdev on numa socket 0
2140 Port 'net_pcap0' is detached. Now total ports is 0
2143 To remove a pci device completely from the system, first detach the port from testpmd.
2144 Then the device should be moved under kernel management.
2145 Finally the device can be removed using kernel pci hotplug functionality.
2147 For example, to move a pci device under kernel management:
2149 .. code-block:: console
2151 sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0
2153 ./usertools/dpdk-devbind.py --status
2155 Network devices using DPDK-compatible driver
2156 ============================================
2159 Network devices using kernel driver
2160 ===================================
2161 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio
2163 To remove a port created by a virtual device, above steps are not needed.
2168 Start all ports or a specific port::
2170 testpmd> port start (port_id|all)
2175 Stop all ports or a specific port::
2177 testpmd> port stop (port_id|all)
2182 Close all ports or a specific port::
2184 testpmd> port close (port_id|all)
2189 Reset all ports or a specific port::
2191 testpmd> port reset (port_id|all)
2193 User should stop port(s) before resetting and (re-)start after reset.
2195 port config - queue ring size
2196 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2198 Configure a rx/tx queue ring size::
2200 testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
2202 Only take effect after command that (re-)start the port or command that setup specific queue.
2204 port start/stop queue
2205 ~~~~~~~~~~~~~~~~~~~~~
2207 Start/stop a rx/tx queue on a specific port::
2209 testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
2211 port config - queue deferred start
2212 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2214 Switch on/off deferred start of a specific port queue::
2216 testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
2219 ~~~~~~~~~~~~~~~~~~~~~
2221 Setup a rx/tx queue on a specific port::
2223 testpmd> port (port_id) (rxq|txq) (queue_id) setup
2225 Only take effect when port is started.
2230 Set the speed and duplex mode for all ports or a specific port::
2232 testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|200000|auto) \
2233 duplex (half|full|auto)
2235 port config - queues/descriptors
2236 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2238 Set number of queues/descriptors for rxq, txq, rxd and txd::
2240 testpmd> port config all (rxq|txq|rxd|txd) (value)
2242 This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2244 port config - max-pkt-len
2245 ~~~~~~~~~~~~~~~~~~~~~~~~~
2247 Set the maximum packet length::
2249 testpmd> port config all max-pkt-len (value)
2251 This is equivalent to the ``--max-pkt-len`` command-line option.
2253 port config - max-lro-pkt-size
2254 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2256 Set the maximum LRO aggregated packet size::
2258 testpmd> port config all max-lro-pkt-size (value)
2260 This is equivalent to the ``--max-lro-pkt-size`` command-line option.
2262 port config - Drop Packets
2263 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2265 Enable or disable packet drop on all RX queues of all ports when no receive buffers available::
2267 testpmd> port config all drop-en (on|off)
2269 Packet dropping when no receive buffers available is off by default.
2271 The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2276 Set the RSS (Receive Side Scaling) mode on or off::
2278 testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none)
2280 RSS is on by default.
2282 The ``all`` option is equivalent to eth|vlan|ip|tcp|udp|sctp|ether|l2tpv3|esp|ah|pfcp.
2284 The ``default`` option enables all supported RSS types reported by device info.
2286 The ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2288 port config - RSS Reta
2289 ~~~~~~~~~~~~~~~~~~~~~~
2291 Set the RSS (Receive Side Scaling) redirection table::
2293 testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2298 Set the DCB mode for an individual port::
2300 testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2302 The traffic class should be 4 or 8.
2307 Set the number of packets per burst::
2309 testpmd> port config all burst (value)
2311 This is equivalent to the ``--burst`` command-line option.
2313 port config - Threshold
2314 ~~~~~~~~~~~~~~~~~~~~~~~
2316 Set thresholds for TX/RX queues::
2318 testpmd> port config all (threshold) (value)
2320 Where the threshold type can be:
2322 * ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255.
2324 * ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255.
2326 * ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255.
2328 * ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255.
2330 * ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255.
2332 * ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255.
2334 * ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd.
2336 * ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd.
2338 * ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd.
2340 These threshold options are also available from the command-line.
2342 port config pctype mapping
2343 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2345 Reset pctype mapping table::
2347 testpmd> port config (port_id) pctype mapping reset
2349 Update hardware defined pctype to software defined flow type mapping table::
2351 testpmd> port config (port_id) pctype mapping update (pctype_id_0[,pctype_id_1]*) (flow_type_id)
2355 * ``pctype_id_x``: hardware pctype id as index of bit in bitmask value of the pctype mapping table.
2357 * ``flow_type_id``: software flow type id as the index of the pctype mapping table.
2359 port config input set
2360 ~~~~~~~~~~~~~~~~~~~~~
2362 Config RSS/FDIR/FDIR flexible payload input set for some pctype::
2364 testpmd> port config (port_id) pctype (pctype_id) \
2365 (hash_inset|fdir_inset|fdir_flx_inset) \
2366 (get|set|clear) field (field_idx)
2368 Clear RSS/FDIR/FDIR flexible payload input set for some pctype::
2370 testpmd> port config (port_id) pctype (pctype_id) \
2371 (hash_inset|fdir_inset|fdir_flx_inset) clear all
2375 * ``pctype_id``: hardware packet classification types.
2376 * ``field_idx``: hardware field index.
2378 port config udp_tunnel_port
2379 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2381 Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
2383 testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe|ecpri (udp_port)
2385 port config tx_metadata
2386 ~~~~~~~~~~~~~~~~~~~~~~~
2388 Set Tx metadata value per port.
2389 testpmd will add this value to any Tx packet sent from this port::
2391 testpmd> port config (port_id) tx_metadata (value)
2396 Set/clear dynamic flag per port.
2397 testpmd will register this flag in the mbuf (same registration
2398 for both Tx and Rx). Then set/clear this flag for each Tx
2399 packet sent from this port. The set bit only works for Tx packet::
2401 testpmd> port config (port_id) dynf (name) (set|clear)
2406 To configure MTU(Maximum Transmission Unit) on devices using testpmd::
2408 testpmd> port config mtu (port_id) (value)
2410 port config rss hash key
2411 ~~~~~~~~~~~~~~~~~~~~~~~~
2413 To configure the RSS hash key used to compute the RSS
2414 hash of input [IP] packets received on port::
2416 testpmd> port config <port_id> rss-hash-key (ipv4|ipv4-frag|\
2417 ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|\
2418 ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|\
2419 ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|\
2420 ipv6-udp-ex <string of hex digits \
2421 (variable length, NIC dependent)>)
2426 The following sections show functions for device operations.
2431 Detach a device specified by pci address or virtual device args::
2433 testpmd> device detach (identifier)
2435 Before detaching a device associated with ports, the ports should be stopped and closed.
2437 For example, to detach a pci device whose address is 0002:03:00.0.
2439 .. code-block:: console
2441 testpmd> device detach 0002:03:00.0
2442 Removing a device...
2443 Port 1 is now closed
2444 EAL: Releasing pci mapped resource for 0002:03:00.0
2445 EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218a050000
2446 EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218c050000
2447 Device 0002:03:00.0 is detached
2448 Now total ports is 1
2450 For example, to detach a port created by pcap PMD.
2452 .. code-block:: console
2454 testpmd> device detach net_pcap0
2455 Removing a device...
2456 Port 0 is now closed
2457 Device net_pcap0 is detached
2458 Now total ports is 0
2461 In this case, identifier is ``net_pcap0``.
2462 This identifier format is the same as ``--vdev`` format of DPDK applications.
2464 Link Bonding Functions
2465 ----------------------
2467 The Link Bonding functions make it possible to dynamically create and
2468 manage link bonding devices from within testpmd interactive prompt.
2470 create bonded device
2471 ~~~~~~~~~~~~~~~~~~~~
2473 Create a new bonding device::
2475 testpmd> create bonded device (mode) (socket)
2477 For example, to create a bonded device in mode 1 on socket 0::
2479 testpmd> create bonded device 1 0
2480 created new bonded device (port X)
2485 Adds Ethernet device to a Link Bonding device::
2487 testpmd> add bonding slave (slave id) (port id)
2489 For example, to add Ethernet device (port 6) to a Link Bonding device (port 10)::
2491 testpmd> add bonding slave 6 10
2494 remove bonding slave
2495 ~~~~~~~~~~~~~~~~~~~~
2497 Removes an Ethernet slave device from a Link Bonding device::
2499 testpmd> remove bonding slave (slave id) (port id)
2501 For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10)::
2503 testpmd> remove bonding slave 6 10
2508 Set the Link Bonding mode of a Link Bonding device::
2510 testpmd> set bonding mode (value) (port id)
2512 For example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3)::
2514 testpmd> set bonding mode 3 10
2519 Set an Ethernet slave device as the primary device on a Link Bonding device::
2521 testpmd> set bonding primary (slave id) (port id)
2523 For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10)::
2525 testpmd> set bonding primary 6 10
2530 Set the MAC address of a Link Bonding device::
2532 testpmd> set bonding mac (port id) (mac)
2534 For example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01::
2536 testpmd> set bonding mac 10 00:00:00:00:00:01
2538 set bonding balance_xmit_policy
2539 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2541 Set the transmission policy for a Link Bonding device when it is in Balance XOR mode::
2543 testpmd> set bonding balance_xmit_policy (port_id) (l2|l23|l34)
2545 For example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports)::
2547 testpmd> set bonding balance_xmit_policy 10 l34
2550 set bonding mon_period
2551 ~~~~~~~~~~~~~~~~~~~~~~
2553 Set the link status monitoring polling period in milliseconds for a bonding device.
2555 This adds support for PMD slave devices which do not support link status interrupts.
2556 When the mon_period is set to a value greater than 0 then all PMD's which do not support
2557 link status ISR will be queried every polling interval to check if their link status has changed::
2559 testpmd> set bonding mon_period (port_id) (value)
2561 For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms::
2563 testpmd> set bonding mon_period 5 150
2566 set bonding lacp dedicated_queue
2567 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2569 Enable dedicated tx/rx queues on bonding devices slaves to handle LACP control plane traffic
2570 when in mode 4 (link-aggregation-802.3ad)::
2572 testpmd> set bonding lacp dedicated_queues (port_id) (enable|disable)
2575 set bonding agg_mode
2576 ~~~~~~~~~~~~~~~~~~~~
2578 Enable one of the specific aggregators mode when in mode 4 (link-aggregation-802.3ad)::
2580 testpmd> set bonding agg_mode (port_id) (bandwidth|count|stable)
2586 Show the current configuration of a Link Bonding device::
2588 testpmd> show bonding config (port id)
2591 to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4)
2592 in balance mode with a transmission policy of layer 2+3::
2594 testpmd> show bonding config 9
2596 Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23
2598 Active Slaves (3): [1 3 4]
2605 The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
2606 This is mainly useful for debugging purposes.
2607 Reference should be made to the appropriate datasheet for the network card for details on the register addresses
2608 and fields that can be accessed.
2613 Display the value of a port register::
2615 testpmd> read reg (port_id) (address)
2617 For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
2619 testpmd> read reg 0 0xEE00
2620 port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
2625 Display a port register bit field::
2627 testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
2629 For example, reading the lowest two bits from the register in the example above::
2631 testpmd> read regfield 0 0xEE00 0 1
2632 port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
2637 Display a single port register bit::
2639 testpmd> read regbit (port_id) (address) (bit_x)
2641 For example, reading the lowest bit from the register in the example above::
2643 testpmd> read regbit 0 0xEE00 0
2644 port 0 PCI register at offset 0xEE00: bit 0=1
2649 Set the value of a port register::
2651 testpmd> write reg (port_id) (address) (value)
2653 For example, to clear a register::
2655 testpmd> write reg 0 0xEE00 0x0
2656 port 0 PCI register at offset 0xEE00: 0x00000000 (0)
2661 Set bit field of a port register::
2663 testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
2665 For example, writing to the register cleared in the example above::
2667 testpmd> write regfield 0 0xEE00 0 1 2
2668 port 0 PCI register at offset 0xEE00: 0x00000002 (2)
2673 Set single bit value of a port register::
2675 testpmd> write regbit (port_id) (address) (bit_x) (value)
2677 For example, to set the high bit in the register from the example above::
2679 testpmd> write regbit 0 0xEE00 31 1
2680 port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
2682 Traffic Metering and Policing
2683 -----------------------------
2685 The following section shows functions for configuring traffic metering and
2686 policing on the ethernet device through the use of generic ethdev API.
2688 show port traffic management capability
2689 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2691 Show traffic metering and policing capability of the port::
2693 testpmd> show port meter cap (port_id)
2695 add port meter profile (srTCM rfc2967)
2696 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2698 Add meter profile (srTCM rfc2697) to the ethernet device::
2700 testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
2705 * ``profile_id``: ID for the meter profile.
2706 * ``cir``: Committed Information Rate (CIR) (bytes/second).
2707 * ``cbs``: Committed Burst Size (CBS) (bytes).
2708 * ``ebs``: Excess Burst Size (EBS) (bytes).
2710 add port meter profile (trTCM rfc2968)
2711 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2713 Add meter profile (srTCM rfc2698) to the ethernet device::
2715 testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
2716 (cir) (pir) (cbs) (pbs)
2720 * ``profile_id``: ID for the meter profile.
2721 * ``cir``: Committed information rate (bytes/second).
2722 * ``pir``: Peak information rate (bytes/second).
2723 * ``cbs``: Committed burst size (bytes).
2724 * ``pbs``: Peak burst size (bytes).
2726 add port meter profile (trTCM rfc4115)
2727 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2729 Add meter profile (trTCM rfc4115) to the ethernet device::
2731 testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
2732 (cir) (eir) (cbs) (ebs)
2736 * ``profile_id``: ID for the meter profile.
2737 * ``cir``: Committed information rate (bytes/second).
2738 * ``eir``: Excess information rate (bytes/second).
2739 * ``cbs``: Committed burst size (bytes).
2740 * ``ebs``: Excess burst size (bytes).
2742 delete port meter profile
2743 ~~~~~~~~~~~~~~~~~~~~~~~~~
2745 Delete meter profile from the ethernet device::
2747 testpmd> del port meter profile (port_id) (profile_id)
2752 Create new meter object for the ethernet device::
2754 testpmd> create port meter (port_id) (mtr_id) (profile_id) \
2755 (meter_enable) (g_action) (y_action) (r_action) (stats_mask) (shared) \
2756 (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\
2761 * ``mtr_id``: meter object ID.
2762 * ``profile_id``: ID for the meter profile.
2763 * ``meter_enable``: When this parameter has a non-zero value, the meter object
2764 gets enabled at the time of creation, otherwise remains disabled.
2765 * ``g_action``: Policer action for the packet with green color.
2766 * ``y_action``: Policer action for the packet with yellow color.
2767 * ``r_action``: Policer action for the packet with red color.
2768 * ``stats_mask``: Mask of statistics counter types to be enabled for the
2770 * ``shared``: When this parameter has a non-zero value, the meter object is
2771 shared by multiple flows. Otherwise, meter object is used by single flow.
2772 * ``use_pre_meter_color``: When this parameter has a non-zero value, the
2773 input color for the current meter object is determined by the latest meter
2774 object in the same flow. Otherwise, the current meter object uses the
2775 *dscp_table* to determine the input color.
2776 * ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input
2777 color, 0 <= x <= 63.
2782 Enable meter for the ethernet device::
2784 testpmd> enable port meter (port_id) (mtr_id)
2789 Disable meter for the ethernet device::
2791 testpmd> disable port meter (port_id) (mtr_id)
2796 Delete meter for the ethernet device::
2798 testpmd> del port meter (port_id) (mtr_id)
2800 Set port meter profile
2801 ~~~~~~~~~~~~~~~~~~~~~~
2803 Set meter profile for the ethernet device::
2805 testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2807 set port meter dscp table
2808 ~~~~~~~~~~~~~~~~~~~~~~~~~
2810 Set meter dscp table for the ethernet device::
2812 testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0) \
2813 (dscp_tbl_entry1)...(dscp_tbl_entry63)]
2815 set port meter policer action
2816 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2818 Set meter policer action for the ethernet device::
2820 testpmd> set port meter policer action (port_id) (mtr_id) (action_mask) \
2821 (action0) [(action1) (action1)]
2825 * ``action_mask``: Bit mask indicating which policer actions need to be
2826 updated. One or more policer actions can be updated in a single function
2827 invocation. To update the policer action associated with color C, bit
2828 (1 << C) needs to be set in *action_mask* and element at position C
2829 in the *actions* array needs to be valid.
2830 * ``actionx``: Policer action for the color x,
2831 RTE_MTR_GREEN <= x < RTE_MTR_COLORS
2833 set port meter stats mask
2834 ~~~~~~~~~~~~~~~~~~~~~~~~~
2836 Set meter stats mask for the ethernet device::
2838 testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2842 * ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2844 show port meter stats
2845 ~~~~~~~~~~~~~~~~~~~~~
2847 Show meter stats of the ethernet device::
2849 testpmd> show port meter stats (port_id) (mtr_id) (clear)
2853 * ``clear``: Flag that indicates whether the statistics counters should
2854 be cleared (i.e. set to zero) immediately after they have been read or not.
2859 The following section shows functions for configuring traffic management on
2860 the ethernet device through the use of generic TM API.
2862 show port traffic management capability
2863 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2865 Show traffic management capability of the port::
2867 testpmd> show port tm cap (port_id)
2869 show port traffic management capability (hierarchy level)
2870 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2872 Show traffic management hierarchy level capability of the port::
2874 testpmd> show port tm level cap (port_id) (level_id)
2876 show port traffic management capability (hierarchy node level)
2877 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2879 Show the traffic management hierarchy node capability of the port::
2881 testpmd> show port tm node cap (port_id) (node_id)
2883 show port traffic management hierarchy node type
2884 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2886 Show the port traffic management hierarchy node type::
2888 testpmd> show port tm node type (port_id) (node_id)
2890 show port traffic management hierarchy node stats
2891 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2893 Show the port traffic management hierarchy node statistics::
2895 testpmd> show port tm node stats (port_id) (node_id) (clear)
2899 * ``clear``: When this parameter has a non-zero value, the statistics counters
2900 are cleared (i.e. set to zero) immediately after they have been read,
2901 otherwise the statistics counters are left untouched.
2903 Add port traffic management private shaper profile
2904 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2906 Add the port traffic management private shaper profile::
2908 testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
2909 (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
2910 (packet_length_adjust) (packet_mode)
2914 * ``shaper_profile id``: Shaper profile ID for the new profile.
2915 * ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second).
2916 * ``cmit_tb_size``: Committed token bucket size (bytes or packets).
2917 * ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second).
2918 * ``peak_tb_size``: Peak token bucket size (bytes or packets).
2919 * ``packet_length_adjust``: The value (bytes) to be added to the length of
2920 each packet for the purpose of shaping. This parameter value can be used to
2921 correct the packet length with the framing overhead bytes that are consumed
2923 * ``packet_mode``: Shaper configured in packet mode. This parameter value if
2924 zero, configures shaper in byte mode and if non-zero configures it in packet
2927 Delete port traffic management private shaper profile
2928 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2930 Delete the port traffic management private shaper::
2932 testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
2936 * ``shaper_profile id``: Shaper profile ID that needs to be deleted.
2938 Add port traffic management shared shaper
2939 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2941 Create the port traffic management shared shaper::
2943 testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \
2948 * ``shared_shaper_id``: Shared shaper ID to be created.
2949 * ``shaper_profile id``: Shaper profile ID for shared shaper.
2951 Set port traffic management shared shaper
2952 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2954 Update the port traffic management shared shaper::
2956 testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \
2961 * ``shared_shaper_id``: Shared shaper ID to be update.
2962 * ``shaper_profile id``: Shaper profile ID for shared shaper.
2964 Delete port traffic management shared shaper
2965 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2967 Delete the port traffic management shared shaper::
2969 testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
2973 * ``shared_shaper_id``: Shared shaper ID to be deleted.
2975 Set port traffic management hierarchy node private shaper
2976 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2978 set the port traffic management hierarchy node private shaper::
2980 testpmd> set port tm node shaper profile (port_id) (node_id) \
2985 * ``shaper_profile id``: Private shaper profile ID to be enabled on the
2988 Add port traffic management WRED profile
2989 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2991 Create a new WRED profile::
2993 testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
2994 (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
2995 (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
2996 (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
3000 * ``wred_profile id``: Identifier for the newly create WRED profile
3001 * ``color_g``: Packet color (green)
3002 * ``min_th_g``: Minimum queue threshold for packet with green color
3003 * ``max_th_g``: Minimum queue threshold for packet with green color
3004 * ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp)
3005 * ``wq_log2_g``: Negated log2 of queue weight (wq)
3006 * ``color_y``: Packet color (yellow)
3007 * ``min_th_y``: Minimum queue threshold for packet with yellow color
3008 * ``max_th_y``: Minimum queue threshold for packet with yellow color
3009 * ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp)
3010 * ``wq_log2_y``: Negated log2 of queue weight (wq)
3011 * ``color_r``: Packet color (red)
3012 * ``min_th_r``: Minimum queue threshold for packet with yellow color
3013 * ``max_th_r``: Minimum queue threshold for packet with yellow color
3014 * ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp)
3015 * ``wq_log2_r``: Negated log2 of queue weight (wq)
3017 Delete port traffic management WRED profile
3018 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3020 Delete the WRED profile::
3022 testpmd> del port tm node wred profile (port_id) (wred_profile_id)
3024 Add port traffic management hierarchy nonleaf node
3025 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3027 Add nonleaf node to port traffic management hierarchy::
3029 testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \
3030 (priority) (weight) (level_id) (shaper_profile_id) \
3031 (n_sp_priorities) (stats_mask) (n_shared_shapers) \
3032 [(shared_shaper_0) (shared_shaper_1) ...] \
3036 * ``parent_node_id``: Node ID of the parent.
3037 * ``priority``: Node priority (highest node priority is zero). This is used by
3038 the SP algorithm running on the parent node for scheduling this node.
3039 * ``weight``: Node weight (lowest weight is one). The node weight is relative
3040 to the weight sum of all siblings that have the same priority. It is used by
3041 the WFQ algorithm running on the parent node for scheduling this node.
3042 * ``level_id``: Hierarchy level of the node.
3043 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
3045 * ``n_sp_priorities``: Number of strict priorities.
3046 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
3047 * ``n_shared_shapers``: Number of shared shapers.
3048 * ``shared_shaper_id``: Shared shaper id.
3050 Add port traffic management hierarchy nonleaf node with packet mode
3051 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3053 Add nonleaf node with packet mode to port traffic management hierarchy::
3055 testpmd> add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id) \
3056 (priority) (weight) (level_id) (shaper_profile_id) \
3057 (n_sp_priorities) (stats_mask) (n_shared_shapers) \
3058 [(shared_shaper_0) (shared_shaper_1) ...] \
3062 * ``parent_node_id``: Node ID of the parent.
3063 * ``priority``: Node priority (highest node priority is zero). This is used by
3064 the SP algorithm running on the parent node for scheduling this node.
3065 * ``weight``: Node weight (lowest weight is one). The node weight is relative
3066 to the weight sum of all siblings that have the same priority. It is used by
3067 the WFQ algorithm running on the parent node for scheduling this node.
3068 * ``level_id``: Hierarchy level of the node.
3069 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
3071 * ``n_sp_priorities``: Number of strict priorities. Packet mode is enabled on
3073 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
3074 * ``n_shared_shapers``: Number of shared shapers.
3075 * ``shared_shaper_id``: Shared shaper id.
3077 Add port traffic management hierarchy leaf node
3078 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3080 Add leaf node to port traffic management hierarchy::
3082 testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \
3083 (priority) (weight) (level_id) (shaper_profile_id) \
3084 (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \
3085 [(shared_shaper_id) (shared_shaper_id) ...] \
3089 * ``parent_node_id``: Node ID of the parent.
3090 * ``priority``: Node priority (highest node priority is zero). This is used by
3091 the SP algorithm running on the parent node for scheduling this node.
3092 * ``weight``: Node weight (lowest weight is one). The node weight is relative
3093 to the weight sum of all siblings that have the same priority. It is used by
3094 the WFQ algorithm running on the parent node for scheduling this node.
3095 * ``level_id``: Hierarchy level of the node.
3096 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
3098 * ``cman_mode``: Congestion management mode to be enabled for this node.
3099 * ``wred_profile_id``: WRED profile id to be enabled for this node.
3100 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
3101 * ``n_shared_shapers``: Number of shared shapers.
3102 * ``shared_shaper_id``: Shared shaper id.
3104 Delete port traffic management hierarchy node
3105 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3107 Delete node from port traffic management hierarchy::
3109 testpmd> del port tm node (port_id) (node_id)
3111 Update port traffic management hierarchy parent node
3112 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3114 Update port traffic management hierarchy parent node::
3116 testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \
3119 This function can only be called after the hierarchy commit invocation. Its
3120 success depends on the port support for this operation, as advertised through
3121 the port capability set. This function is valid for all nodes of the traffic
3122 management hierarchy except root node.
3124 Suspend port traffic management hierarchy node
3125 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3127 testpmd> suspend port tm node (port_id) (node_id)
3129 Resume port traffic management hierarchy node
3130 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3132 testpmd> resume port tm node (port_id) (node_id)
3134 Commit port traffic management hierarchy
3135 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3137 Commit the traffic management hierarchy on the port::
3139 testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
3143 * ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function
3144 call failure. On the other hand, hierarchy is preserved when this parameter
3147 Set port traffic management mark VLAN dei
3148 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3150 Enables/Disables the traffic management marking on the port for VLAN packets::
3152 testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red>
3156 * ``port_id``: The port which on which VLAN packets marked as ``green`` or
3157 ``yellow`` or ``red`` will have dei bit enabled
3159 * ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green
3161 * ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow
3163 * ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red
3165 Set port traffic management mark IP dscp
3166 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3168 Enables/Disables the traffic management marking on the port for IP dscp packets::
3170 testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red>
3174 * ``port_id``: The port which on which IP packets marked as ``green`` or
3175 ``yellow`` or ``red`` will have IP dscp bits updated
3177 * ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets
3179 * ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets
3181 * ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets
3183 Set port traffic management mark IP ecn
3184 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3186 Enables/Disables the traffic management marking on the port for IP ecn packets::
3188 testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red>
3192 * ``port_id``: The port which on which IP packets marked as ``green`` or
3193 ``yellow`` or ``red`` will have IP ecn bits updated
3195 * ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01 or 2'b10
3196 to ecn of 2'b11 when IP is caring TCP or SCTP
3198 * ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
3199 to ecn of 2'b11 when IP is caring TCP or SCTP
3201 * ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
3202 to ecn of 2'b11 when IP is caring TCP or SCTP
3207 This section details the available filter functions that are available.
3209 Note these functions interface the deprecated legacy filtering framework,
3210 superseded by *rte_flow*. See `Flow rules management`_.
3212 .. _testpmd_flow_director:
3217 Set flow director's input masks::
3219 flow_director_mask (port_id) mode IP vlan (vlan_value) \
3220 src_mask (ipv4_src) (ipv6_src) (src_port) \
3221 dst_mask (ipv4_dst) (ipv6_dst) (dst_port)
3223 flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value)
3225 flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \
3226 mac (mac_value) tunnel-type (tunnel_type_value) \
3227 tunnel-id (tunnel_id_value)
3229 Example, to set flow director mask on port 0::
3231 testpmd> flow_director_mask 0 mode IP vlan 0xefff \
3232 src_mask 255.255.255.255 \
3233 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF \
3234 dst_mask 255.255.255.255 \
3235 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF
3237 flow_director_flex_payload
3238 ~~~~~~~~~~~~~~~~~~~~~~~~~~
3240 Configure flexible payload selection::
3242 flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config)
3244 For example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload::
3246 testpmd> flow_director_flex_payload 0 l4 \
3247 (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
3250 .. _testpmd_rte_flow:
3252 Flow rules management
3253 ---------------------
3255 Control of the generic flow API (*rte_flow*) is fully exposed through the
3256 ``flow`` command (validation, creation, destruction, queries and operation
3259 Considering *rte_flow* overlaps with all `Filter Functions`_, using both
3260 features simultaneously may cause undefined side-effects and is therefore
3266 Because the ``flow`` command uses dynamic tokens to handle the large number
3267 of possible flow rules combinations, its behavior differs slightly from
3268 other commands, in particular:
3270 - Pressing *?* or the *<tab>* key displays contextual help for the current
3271 token, not that of the entire command.
3273 - Optional and repeated parameters are supported (provided they are listed
3274 in the contextual help).
3276 The first parameter stands for the operation mode. Possible operations and
3277 their general syntax are described below. They are covered in detail in the
3280 - Check whether a flow rule can be created::
3282 flow validate {port_id}
3283 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3284 pattern {item} [/ {item} [...]] / end
3285 actions {action} [/ {action} [...]] / end
3287 - Create a flow rule::
3289 flow create {port_id}
3290 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3291 pattern {item} [/ {item} [...]] / end
3292 actions {action} [/ {action} [...]] / end
3294 - Destroy specific flow rules::
3296 flow destroy {port_id} rule {rule_id} [...]
3298 - Destroy all flow rules::
3300 flow flush {port_id}
3302 - Query an existing flow rule::
3304 flow query {port_id} {rule_id} {action}
3306 - List existing flow rules sorted by priority, filtered by group
3309 flow list {port_id} [group {group_id}] [...]
3311 - Restrict ingress traffic to the defined flow rules::
3313 flow isolate {port_id} {boolean}
3315 - Dump internal representation information of all flows in hardware::
3317 flow dump {port_id} {output_file}
3319 - List and destroy aged flow rules::
3321 flow aged {port_id} [destroy]
3323 - Tunnel offload - create a tunnel stub::
3325 flow tunnel create {port_id} type {tunnel_type}
3327 - Tunnel offload - destroy a tunnel stub::
3329 flow tunnel destroy {port_id} id {tunnel_id}
3331 - Tunnel offload - list port tunnel stubs::
3333 flow tunnel list {port_id}
3335 Creating a tunnel stub for offload
3336 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3338 ``flow tunnel create`` setup a tunnel stub for tunnel offload flow rules::
3340 flow tunnel create {port_id} type {tunnel_type}
3342 If successful, it will return a tunnel stub ID usable with other commands::
3344 port [...]: flow tunnel #[...] type [...]
3346 Tunnel stub ID is relative to a port.
3348 Destroying tunnel offload stub
3349 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3351 ``flow tunnel destroy`` destroy port tunnel stub::
3353 flow tunnel destroy {port_id} id {tunnel_id}
3355 Listing tunnel offload stubs
3356 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3358 ``flow tunnel list`` list port tunnel offload stubs::
3360 flow tunnel list {port_id}
3362 Validating flow rules
3363 ~~~~~~~~~~~~~~~~~~~~~
3365 ``flow validate`` reports whether a flow rule would be accepted by the
3366 underlying device in its current state but stops short of creating it. It is
3367 bound to ``rte_flow_validate()``::
3369 flow validate {port_id}
3370 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3371 pattern {item} [/ {item} [...]] / end
3372 actions {action} [/ {action} [...]] / end
3374 If successful, it will show::
3378 Otherwise it will show an error message of the form::
3380 Caught error type [...] ([...]): [...]
3382 This command uses the same parameters as ``flow create``, their format is
3383 described in `Creating flow rules`_.
3385 Check whether redirecting any Ethernet packet received on port 0 to RX queue
3386 index 6 is supported::
3388 testpmd> flow validate 0 ingress pattern eth / end
3389 actions queue index 6 / end
3393 Port 0 does not support TCPv6 rules::
3395 testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end
3397 Caught error type 9 (specific pattern item): Invalid argument
3403 ``flow create`` validates and creates the specified flow rule. It is bound
3404 to ``rte_flow_create()``::
3406 flow create {port_id}
3407 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3408 [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}]
3409 pattern {item} [/ {item} [...]] / end
3410 actions {action} [/ {action} [...]] / end
3412 If successful, it will return a flow rule ID usable with other commands::
3414 Flow rule #[...] created
3416 Otherwise it will show an error message of the form::
3418 Caught error type [...] ([...]): [...]
3420 Parameters describe in the following order:
3422 - Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens).
3423 - Tunnel offload specification (tunnel_set, tunnel_match)
3424 - A matching pattern, starting with the *pattern* token and terminated by an
3426 - Actions, starting with the *actions* token and terminated by an *end*
3429 These translate directly to *rte_flow* objects provided as-is to the
3430 underlying functions.
3432 The shortest valid definition only comprises mandatory tokens::
3434 testpmd> flow create 0 pattern end actions end
3436 Note that PMDs may refuse rules that essentially do nothing such as this
3439 **All unspecified object values are automatically initialized to 0.**
3444 These tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3445 specified before the ``pattern`` token.
3447 - ``group {group id}``: priority group.
3448 - ``priority {level}``: priority level within group.
3449 - ``ingress``: rule applies to ingress traffic.
3450 - ``egress``: rule applies to egress traffic.
3451 - ``transfer``: apply rule directly to endpoints found in pattern.
3453 Each instance of an attribute specified several times overrides the previous
3454 value as shown below (group 4 is used)::
3456 testpmd> flow create 0 group 42 group 24 group 4 [...]
3458 Note that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3460 While not specifying a direction is an error, some rules may allow both
3463 Most rules affect RX therefore contain the ``ingress`` token::
3465 testpmd> flow create 0 ingress pattern [...]
3470 Indicate tunnel offload rule type
3472 - ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type.
3473 - ``tunnel_match {tunnel_id}``: mark rule as tunel offload match type.
3478 A matching pattern starts after the ``pattern`` token. It is made of pattern
3479 items and is terminated by a mandatory ``end`` item.
3481 Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3482 rte_flow_item_type``).
3484 The ``/`` token is used as a separator between pattern items as shown
3487 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3489 Note that protocol items like these must be stacked from lowest to highest
3490 layer to make sense. For instance, the following rule is either invalid or
3491 unlikely to match any packet::
3493 testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3495 More information on these restrictions can be found in the *rte_flow*
3498 Several items support additional specification structures, for example
3499 ``ipv4`` allows specifying source and destination addresses as follows::
3501 testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1
3502 dst is 10.2.0.0 / end [...]
3504 This rule matches all IPv4 traffic with the specified properties.
3506 In this example, ``src`` and ``dst`` are field names of the underlying
3507 ``struct rte_flow_item_ipv4`` object. All item properties can be specified
3508 in a similar fashion.
3510 The ``is`` token means that the subsequent value must be matched exactly,
3511 and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3512 accordingly. Possible assignment tokens are:
3514 - ``is``: match value perfectly (with full bit-mask).
3515 - ``spec``: match value according to configured bit-mask.
3516 - ``last``: specify upper bound to establish a range.
3517 - ``mask``: specify bit-mask with relevant bits set to one.
3518 - ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one.
3520 These yield identical results::
3522 ipv4 src is 10.1.1.1
3526 ipv4 src spec 10.1.1.1 src mask 255.255.255.255
3530 ipv4 src spec 10.1.1.1 src prefix 32
3534 ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value
3538 ipv4 src is 10.1.1.1 src last 0 # 0 disables range
3540 Inclusive ranges can be defined with ``last``::
3542 ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4
3544 Note that ``mask`` affects both ``spec`` and ``last``::
3546 ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0
3547 # matches 10.1.0.0 to 10.2.255.255
3549 Properties can be modified multiple times::
3551 ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4
3555 ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16
3560 This section lists supported pattern items and their attributes, if any.
3562 - ``end``: end list of pattern items.
3564 - ``void``: no-op pattern item.
3566 - ``invert``: perform actions when pattern does not match.
3568 - ``any``: match any protocol for the current layer.
3570 - ``num {unsigned}``: number of layers covered.
3572 - ``pf``: match traffic from/to the physical function.
3574 - ``vf``: match traffic from/to a virtual function ID.
3576 - ``id {unsigned}``: VF ID.
3578 - ``phy_port``: match traffic from/to a specific physical port.
3580 - ``index {unsigned}``: physical port index.
3582 - ``port_id``: match traffic from/to a given DPDK port ID.
3584 - ``id {unsigned}``: DPDK port ID.
3586 - ``mark``: match value set in previously matched flow rule using the mark action.
3588 - ``id {unsigned}``: arbitrary integer value.
3590 - ``raw``: match an arbitrary byte string.
3592 - ``relative {boolean}``: look for pattern after the previous item.
3593 - ``search {boolean}``: search pattern from offset (see also limit).
3594 - ``offset {integer}``: absolute or relative offset for pattern.
3595 - ``limit {unsigned}``: search area limit for start of pattern.
3596 - ``pattern {string}``: byte string to look for.
3598 - ``eth``: match Ethernet header.
3600 - ``dst {MAC-48}``: destination MAC.
3601 - ``src {MAC-48}``: source MAC.
3602 - ``type {unsigned}``: EtherType or TPID.
3604 - ``vlan``: match 802.1Q/ad VLAN tag.
3606 - ``tci {unsigned}``: tag control information.
3607 - ``pcp {unsigned}``: priority code point.
3608 - ``dei {unsigned}``: drop eligible indicator.
3609 - ``vid {unsigned}``: VLAN identifier.
3610 - ``inner_type {unsigned}``: inner EtherType or TPID.
3612 - ``ipv4``: match IPv4 header.
3614 - ``tos {unsigned}``: type of service.
3615 - ``ttl {unsigned}``: time to live.
3616 - ``proto {unsigned}``: next protocol ID.
3617 - ``src {ipv4 address}``: source address.
3618 - ``dst {ipv4 address}``: destination address.
3620 - ``ipv6``: match IPv6 header.
3622 - ``tc {unsigned}``: traffic class.
3623 - ``flow {unsigned}``: flow label.
3624 - ``proto {unsigned}``: protocol (next header).
3625 - ``hop {unsigned}``: hop limit.
3626 - ``src {ipv6 address}``: source address.
3627 - ``dst {ipv6 address}``: destination address.
3629 - ``icmp``: match ICMP header.
3631 - ``type {unsigned}``: ICMP packet type.
3632 - ``code {unsigned}``: ICMP packet code.
3634 - ``udp``: match UDP header.
3636 - ``src {unsigned}``: UDP source port.
3637 - ``dst {unsigned}``: UDP destination port.
3639 - ``tcp``: match TCP header.
3641 - ``src {unsigned}``: TCP source port.
3642 - ``dst {unsigned}``: TCP destination port.
3644 - ``sctp``: match SCTP header.
3646 - ``src {unsigned}``: SCTP source port.
3647 - ``dst {unsigned}``: SCTP destination port.
3648 - ``tag {unsigned}``: validation tag.
3649 - ``cksum {unsigned}``: checksum.
3651 - ``vxlan``: match VXLAN header.
3653 - ``vni {unsigned}``: VXLAN identifier.
3655 - ``e_tag``: match IEEE 802.1BR E-Tag header.
3657 - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
3659 - ``nvgre``: match NVGRE header.
3661 - ``tni {unsigned}``: virtual subnet ID.
3663 - ``mpls``: match MPLS header.
3665 - ``label {unsigned}``: MPLS label.
3667 - ``gre``: match GRE header.
3669 - ``protocol {unsigned}``: protocol type.
3671 - ``gre_key``: match GRE optional key field.
3673 - ``value {unsigned}``: key value.
3675 - ``fuzzy``: fuzzy pattern match, expect faster than default.
3677 - ``thresh {unsigned}``: accuracy threshold.
3679 - ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header.
3681 - ``teid {unsigned}``: tunnel endpoint identifier.
3683 - ``geneve``: match GENEVE header.
3685 - ``vni {unsigned}``: virtual network identifier.
3686 - ``protocol {unsigned}``: protocol type.
3688 - ``geneve-opt``: match GENEVE header option.
3690 - ``class {unsigned}``: GENEVE option class.
3691 - ``type {unsigned}``: GENEVE option type.
3692 - ``length {unsigned}``: GENEVE option length in 32-bit words.
3693 - ``data {hex string}``: GENEVE option data, the length is defined by
3696 - ``vxlan-gpe``: match VXLAN-GPE header.
3698 - ``vni {unsigned}``: VXLAN-GPE identifier.
3700 - ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4.
3702 - ``sha {MAC-48}``: sender hardware address.
3703 - ``spa {ipv4 address}``: sender IPv4 address.
3704 - ``tha {MAC-48}``: target hardware address.
3705 - ``tpa {ipv4 address}``: target IPv4 address.
3707 - ``ipv6_ext``: match presence of any IPv6 extension header.
3709 - ``next_hdr {unsigned}``: next header.
3711 - ``icmp6``: match any ICMPv6 header.
3713 - ``type {unsigned}``: ICMPv6 type.
3714 - ``code {unsigned}``: ICMPv6 code.
3716 - ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
3718 - ``target_addr {ipv6 address}``: target address.
3720 - ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement.
3722 - ``target_addr {ipv6 address}``: target address.
3724 - ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option.
3726 - ``type {unsigned}``: ND option type.
3728 - ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet
3729 link-layer address option.
3731 - ``sla {MAC-48}``: source Ethernet LLA.
3733 - ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet
3734 link-layer address option.
3736 - ``tla {MAC-48}``: target Ethernet LLA.
3738 - ``meta``: match application specific metadata.
3740 - ``data {unsigned}``: metadata value.
3742 - ``gtp_psc``: match GTP PDU extension header with type 0x85.
3744 - ``pdu_type {unsigned}``: PDU type.
3745 - ``qfi {unsigned}``: QoS flow identifier.
3747 - ``pppoes``, ``pppoed``: match PPPoE header.
3749 - ``session_id {unsigned}``: session identifier.
3751 - ``pppoe_proto_id``: match PPPoE session protocol identifier.
3753 - ``proto_id {unsigned}``: PPP protocol identifier.
3755 - ``l2tpv3oip``: match L2TPv3 over IP header.
3757 - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
3759 - ``ah``: match AH header.
3761 - ``spi {unsigned}``: security parameters index.
3763 - ``pfcp``: match PFCP header.
3765 - ``s_field {unsigned}``: S field.
3766 - ``seid {unsigned}``: session endpoint identifier.
3771 A list of actions starts after the ``actions`` token in the same fashion as
3772 `Matching pattern`_; actions are separated by ``/`` tokens and the list is
3773 terminated by a mandatory ``end`` action.
3775 Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
3776 rte_flow_action_type``).
3778 Dropping all incoming UDPv4 packets can be expressed as follows::
3780 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3783 Several actions have configurable properties which must be specified when
3784 there is no valid default value. For example, ``queue`` requires a target
3787 This rule redirects incoming UDPv4 traffic to queue index 6::
3789 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3790 actions queue index 6 / end
3792 While this one could be rejected by PMDs (unspecified queue index)::
3794 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3797 As defined by *rte_flow*, the list is not ordered, all actions of a given
3798 rule are performed simultaneously. These are equivalent::
3800 queue index 6 / void / mark id 42 / end
3804 void / mark id 42 / queue index 6 / end
3806 All actions in a list should have different types, otherwise only the last
3807 action of a given type is taken into account::
3809 queue index 4 / queue index 5 / queue index 6 / end # will use queue 6
3813 drop / drop / drop / end # drop is performed only once
3817 mark id 42 / queue index 3 / mark id 24 / end # mark will be 24
3819 Considering they are performed simultaneously, opposite and overlapping
3820 actions can sometimes be combined when the end result is unambiguous::
3822 drop / queue index 6 / end # drop has no effect
3826 queue index 6 / rss queues 6 7 8 / end # queue has no effect
3830 drop / passthru / end # drop has no effect
3832 Note that PMDs may still refuse such combinations.
3837 This section lists supported actions and their attributes, if any.
3839 - ``end``: end list of actions.
3841 - ``void``: no-op action.
3843 - ``passthru``: let subsequent rule process matched packets.
3845 - ``jump``: redirect traffic to group on device.
3847 - ``group {unsigned}``: group to redirect to.
3849 - ``mark``: attach 32 bit value to packets.
3851 - ``id {unsigned}``: 32 bit value to return with packets.
3853 - ``flag``: flag packets.
3855 - ``queue``: assign packets to a given queue index.
3857 - ``index {unsigned}``: queue index to use.
3859 - ``drop``: drop packets (note: passthru has priority).
3861 - ``count``: enable counters for this rule.
3863 - ``rss``: spread packets among several queues.
3865 - ``func {hash function}``: RSS hash function to apply, allowed tokens are
3866 ``toeplitz``, ``simple_xor``, ``symmetric_toeplitz`` and ``default``.
3868 - ``level {unsigned}``: encapsulation level for ``types``.
3870 - ``types [{RSS hash type} [...]] end``: specific RSS hash types.
3871 Note that an empty list does not disable RSS but instead requests
3872 unspecified "best-effort" settings.
3874 - ``key {string}``: RSS hash key, overrides ``key_len``.
3876 - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in
3877 conjunction with ``key`` to pad or truncate it.
3879 - ``queues [{unsigned} [...]] end``: queue indices to use.
3881 - ``pf``: direct traffic to physical function.
3883 - ``vf``: direct traffic to a virtual function ID.
3885 - ``original {boolean}``: use original VF ID if possible.
3886 - ``id {unsigned}``: VF ID.
3888 - ``phy_port``: direct packets to physical port index.
3890 - ``original {boolean}``: use original port index if possible.
3891 - ``index {unsigned}``: physical port index.
3893 - ``port_id``: direct matching traffic to a given DPDK port ID.
3895 - ``original {boolean}``: use original DPDK port ID if possible.
3896 - ``id {unsigned}``: DPDK port ID.
3898 - ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``.
3900 - ``mpls_ttl``: MPLS TTL.
3902 - ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``.
3904 - ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``.
3906 - ``nw_ttl``: IP TTL.
3908 - ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``.
3910 - ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``.
3912 - ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``.
3914 - ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``.
3916 - ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``.
3918 - ``ethertype``: Ethertype.
3920 - ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``.
3922 - ``vlan_vid``: VLAN id.
3924 - ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``.
3926 - ``vlan_pcp``: VLAN priority.
3928 - ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``.
3930 - ``ethertype``: Ethertype.
3932 - ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``.
3934 - ``ethertype``: Ethertype.
3936 - ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration
3937 is done through `Config VXLAN Encap outer layers`_.
3939 - ``vxlan_decap``: Performs a decapsulation action by stripping all headers of
3940 the VXLAN tunnel network overlay from the matched flow.
3942 - ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration
3943 is done through `Config NVGRE Encap outer layers`_.
3945 - ``nvgre_decap``: Performs a decapsulation action by stripping all headers of
3946 the NVGRE tunnel network overlay from the matched flow.
3948 - ``l2_encap``: Performs a L2 encapsulation, L2 configuration
3949 is done through `Config L2 Encap`_.
3951 - ``l2_decap``: Performs a L2 decapsulation, L2 configuration
3952 is done through `Config L2 Decap`_.
3954 - ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer
3955 configuration is done through `Config MPLSoGRE Encap outer layers`_.
3957 - ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer
3958 configuration is done through `Config MPLSoGRE Decap outer layers`_.
3960 - ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer
3961 configuration is done through `Config MPLSoUDP Encap outer layers`_.
3963 - ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer
3964 configuration is done through `Config MPLSoUDP Decap outer layers`_.
3966 - ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header.
3968 - ``ipv4_addr``: New IPv4 source address.
3970 - ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4
3973 - ``ipv4_addr``: New IPv4 destination address.
3975 - ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header.
3977 - ``ipv6_addr``: New IPv6 source address.
3979 - ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6
3982 - ``ipv6_addr``: New IPv6 destination address.
3984 - ``set_tp_src``: Set a new source port number in the outermost TCP/UDP
3987 - ``port``: New TCP/UDP source port number.
3989 - ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP
3992 - ``port``: New TCP/UDP destination port number.
3994 - ``mac_swap``: Swap the source and destination MAC addresses in the outermost
3997 - ``dec_ttl``: Performs a decrease TTL value action
3999 - ``set_ttl``: Set TTL value with specified value
4000 - ``ttl_value {unsigned}``: The new TTL value to be set
4002 - ``set_mac_src``: set source MAC address
4004 - ``mac_addr {MAC-48}``: new source MAC address
4006 - ``set_mac_dst``: set destination MAC address
4008 - ``mac_addr {MAC-48}``: new destination MAC address
4010 - ``inc_tcp_seq``: Increase sequence number in the outermost TCP header.
4012 - ``value {unsigned}``: Value to increase TCP sequence number by.
4014 - ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header.
4016 - ``value {unsigned}``: Value to decrease TCP sequence number by.
4018 - ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header.
4020 - ``value {unsigned}``: Value to increase TCP acknowledgment number by.
4022 - ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header.
4024 - ``value {unsigned}``: Value to decrease TCP acknowledgment number by.
4026 - ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value
4028 - ``dscp_value {unsigned}``: The new DSCP value to be set
4030 - ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value
4032 - ``dscp_value {unsigned}``: The new DSCP value to be set
4034 - ``shared``: Use shared action created via
4035 ``flow shared_action {port_id} create``
4037 - ``shared_action_id {unsigned}``: Shared action ID to use
4039 Destroying flow rules
4040 ~~~~~~~~~~~~~~~~~~~~~
4042 ``flow destroy`` destroys one or more rules from their rule ID (as returned
4043 by ``flow create``), this command calls ``rte_flow_destroy()`` as many
4044 times as necessary::
4046 flow destroy {port_id} rule {rule_id} [...]
4048 If successful, it will show::
4050 Flow rule #[...] destroyed
4052 It does not report anything for rule IDs that do not exist. The usual error
4053 message is shown when a rule cannot be destroyed::
4055 Caught error type [...] ([...]): [...]
4057 ``flow flush`` destroys all rules on a device and does not take extra
4058 arguments. It is bound to ``rte_flow_flush()``::
4060 flow flush {port_id}
4062 Any errors are reported as above.
4064 Creating several rules and destroying them::
4066 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4067 actions queue index 2 / end
4068 Flow rule #0 created
4069 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4070 actions queue index 3 / end
4071 Flow rule #1 created
4072 testpmd> flow destroy 0 rule 0 rule 1
4073 Flow rule #1 destroyed
4074 Flow rule #0 destroyed
4077 The same result can be achieved using ``flow flush``::
4079 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4080 actions queue index 2 / end
4081 Flow rule #0 created
4082 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4083 actions queue index 3 / end
4084 Flow rule #1 created
4085 testpmd> flow flush 0
4088 Non-existent rule IDs are ignored::
4090 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4091 actions queue index 2 / end
4092 Flow rule #0 created
4093 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4094 actions queue index 3 / end
4095 Flow rule #1 created
4096 testpmd> flow destroy 0 rule 42 rule 10 rule 2
4098 testpmd> flow destroy 0 rule 0
4099 Flow rule #0 destroyed
4105 ``flow query`` queries a specific action of a flow rule having that
4106 ability. Such actions collect information that can be reported using this
4107 command. It is bound to ``rte_flow_query()``::
4109 flow query {port_id} {rule_id} {action}
4111 If successful, it will display either the retrieved data for known actions
4112 or the following message::
4114 Cannot display result for action type [...] ([...])
4116 Otherwise, it will complain either that the rule does not exist or that some
4119 Flow rule #[...] not found
4123 Caught error type [...] ([...]): [...]
4125 Currently only the ``count`` action is supported. This action reports the
4126 number of packets that hit the flow rule and the total number of bytes. Its
4127 output has the following format::
4130 hits_set: [...] # whether "hits" contains a valid value
4131 bytes_set: [...] # whether "bytes" contains a valid value
4132 hits: [...] # number of packets
4133 bytes: [...] # number of bytes
4135 Querying counters for TCPv6 packets redirected to queue 6::
4137 testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end
4138 actions queue index 6 / count / end
4139 Flow rule #4 created
4140 testpmd> flow query 0 4 count
4151 ``flow list`` lists existing flow rules sorted by priority and optionally
4152 filtered by group identifiers::
4154 flow list {port_id} [group {group_id}] [...]
4156 This command only fails with the following message if the device does not
4161 Output consists of a header line followed by a short description of each
4162 flow rule, one per line. There is no output at all when no flow rules are
4163 configured on the device::
4165 ID Group Prio Attr Rule
4166 [...] [...] [...] [...] [...]
4168 ``Attr`` column flags:
4170 - ``i`` for ``ingress``.
4171 - ``e`` for ``egress``.
4173 Creating several flow rules and listing them::
4175 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4176 actions queue index 6 / end
4177 Flow rule #0 created
4178 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4179 actions queue index 2 / end
4180 Flow rule #1 created
4181 testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end
4182 actions rss queues 6 7 8 end / end
4183 Flow rule #2 created
4184 testpmd> flow list 0
4185 ID Group Prio Attr Rule
4186 0 0 0 i- ETH IPV4 => QUEUE
4187 1 0 0 i- ETH IPV6 => QUEUE
4188 2 0 5 i- ETH IPV4 UDP => RSS
4191 Rules are sorted by priority (i.e. group ID first, then priority level)::
4193 testpmd> flow list 1
4194 ID Group Prio Attr Rule
4195 0 0 0 i- ETH => COUNT
4196 6 0 500 i- ETH IPV6 TCP => DROP COUNT
4197 5 0 1000 i- ETH IPV6 ICMP => QUEUE
4198 1 24 0 i- ETH IPV4 UDP => QUEUE
4199 4 24 10 i- ETH IPV4 TCP => DROP
4200 3 24 20 i- ETH IPV4 => DROP
4201 2 24 42 i- ETH IPV4 UDP => QUEUE
4202 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE
4205 Output can be limited to specific groups::
4207 testpmd> flow list 1 group 0 group 63
4208 ID Group Prio Attr Rule
4209 0 0 0 i- ETH => COUNT
4210 6 0 500 i- ETH IPV6 TCP => DROP COUNT
4211 5 0 1000 i- ETH IPV6 ICMP => QUEUE
4212 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE
4215 Toggling isolated mode
4216 ~~~~~~~~~~~~~~~~~~~~~~
4218 ``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4219 must only be injected from the defined flow rules; that no default traffic
4220 is expected outside those rules and the driver is free to assign more
4221 resources to handle them. It is bound to ``rte_flow_isolate()``::
4223 flow isolate {port_id} {boolean}
4225 If successful, enabling or disabling isolated mode shows either::
4227 Ingress traffic on port [...]
4228 is now restricted to the defined flow rules
4232 Ingress traffic on port [...]
4233 is not restricted anymore to the defined flow rules
4235 Otherwise, in case of error::
4237 Caught error type [...] ([...]): [...]
4239 Mainly due to its side effects, PMDs supporting this mode may not have the
4240 ability to toggle it more than once without reinitializing affected ports
4241 first (e.g. by exiting testpmd).
4243 Enabling isolated mode::
4245 testpmd> flow isolate 0 true
4246 Ingress traffic on port 0 is now restricted to the defined flow rules
4249 Disabling isolated mode::
4251 testpmd> flow isolate 0 false
4252 Ingress traffic on port 0 is not restricted anymore to the defined flow rules
4255 Dumping HW internal information
4256 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4258 ``flow dump`` dumps the hardware's internal representation information of
4259 all flows. It is bound to ``rte_flow_dev_dump()``::
4261 flow dump {port_id} {output_file}
4263 If successful, it will show::
4267 Otherwise, it will complain error occurred::
4269 Caught error type [...] ([...]): [...]
4271 Listing and destroying aged flow rules
4272 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4274 ``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``,
4275 and ``destroy`` parameter can be used to destroy those flow rules in PMD.
4277 flow aged {port_id} [destroy]
4279 Listing current aged flow rules::
4281 testpmd> flow aged 0
4282 Port 0 total aged flows: 0
4283 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.14 / end
4284 actions age timeout 5 / queue index 0 / end
4285 Flow rule #0 created
4286 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.15 / end
4287 actions age timeout 4 / queue index 0 / end
4288 Flow rule #1 created
4289 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.16 / end
4290 actions age timeout 2 / queue index 0 / end
4291 Flow rule #2 created
4292 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.17 / end
4293 actions age timeout 3 / queue index 0 / end
4294 Flow rule #3 created
4297 Aged Rules are simply list as command ``flow list {port_id}``, but strip the detail rule
4298 information, all the aged flows are sorted by the longest timeout time. For example, if
4299 those rules be configured in the same time, ID 2 will be the first aged out rule, the next
4300 will be ID 3, ID 1, ID 0::
4302 testpmd> flow aged 0
4303 Port 0 total aged flows: 4
4310 If attach ``destroy`` parameter, the command will destroy all the list aged flow rules.
4312 testpmd> flow aged 0 destroy
4313 Port 0 total aged flows: 4
4320 Flow rule #2 destroyed
4321 Flow rule #3 destroyed
4322 Flow rule #1 destroyed
4323 Flow rule #0 destroyed
4324 4 flows be destroyed
4325 testpmd> flow aged 0
4326 Port 0 total aged flows: 0
4328 Creating shared actions
4329 ~~~~~~~~~~~~~~~~~~~~~~~
4330 ``flow shared_action {port_id} create`` creates shared action with optional
4331 shared action ID. It is bound to ``rte_flow_shared_action_create()``::
4333 flow shared_action {port_id} create [action_id {shared_action_id}]
4334 [ingress] [egress] [transfer] action {action} / end
4336 If successful, it will show::
4338 Shared action #[...] created
4340 Otherwise, it will complain either that shared action already exists or that
4341 some error occurred::
4343 Shared action #[...] is already assigned, delete it first
4347 Caught error type [...] ([...]): [...]
4349 Create shared rss action with id 100 to queues 1 and 2 on port 0::
4351 testpmd> flow shared_action 0 create action_id 100 \
4352 ingress action rss queues 1 2 end / end
4354 Create shared rss action with id assigned by testpmd to queues 1 and 2 on
4357 testpmd> flow shared_action 0 create action_id \
4358 ingress action rss queues 0 1 end / end
4360 Updating shared actions
4361 ~~~~~~~~~~~~~~~~~~~~~~~
4362 ``flow shared_action {port_id} update`` updates configuration of the shared
4363 action from its shared action ID (as returned by
4364 ``flow shared_action {port_id} create``). It is bound to
4365 ``rte_flow_shared_action_update()``::
4367 flow shared_action {port_id} update {shared_action_id}
4368 action {action} / end
4370 If successful, it will show::
4372 Shared action #[...] updated
4374 Otherwise, it will complain either that shared action not found or that some
4377 Failed to find shared action #[...] on port [...]
4381 Caught error type [...] ([...]): [...]
4383 Update shared rss action having id 100 on port 0 with rss to queues 0 and 3
4384 (in create example above rss queues were 1 and 2)::
4386 testpmd> flow shared_action 0 update 100 action rss queues 0 3 end / end
4388 Destroying shared actions
4389 ~~~~~~~~~~~~~~~~~~~~~~~~~
4390 ``flow shared_action {port_id} update`` destroys one or more shared actions
4391 from their shared action IDs (as returned by
4392 ``flow shared_action {port_id} create``). It is bound to
4393 ``rte_flow_shared_action_destroy()``::
4395 flow shared_action {port_id} destroy action_id {shared_action_id} [...]
4397 If successful, it will show::
4399 Shared action #[...] destroyed
4401 It does not report anything for shared action IDs that do not exist.
4402 The usual error message is shown when a shared action cannot be destroyed::
4404 Caught error type [...] ([...]): [...]
4406 Destroy shared actions having id 100 & 101::
4408 testpmd> flow shared_action 0 destroy action_id 100 action_id 101
4410 Query shared actions
4411 ~~~~~~~~~~~~~~~~~~~~
4412 ``flow shared_action {port_id} query`` queries the shared action from its
4413 shared action ID (as returned by ``flow shared_action {port_id} create``).
4414 It is bound to ``rte_flow_shared_action_query()``::
4416 flow shared_action {port_id} query {shared_action_id}
4418 Currently only rss shared action supported. If successful, it will show::
4423 Otherwise, it will complain either that shared action not found or that some
4426 Failed to find shared action #[...] on port [...]
4430 Caught error type [...] ([...]): [...]
4432 Query shared action having id 100::
4434 testpmd> flow shared_action 0 query 100
4436 Sample QinQ flow rules
4437 ~~~~~~~~~~~~~~~~~~~~~~
4439 Before creating QinQ rule(s) the following commands should be issued to enable QinQ::
4441 testpmd> port stop 0
4442 testpmd> vlan set extend on 0
4444 The above command sets the inner and outer TPID's to 0x8100.
4446 To change the TPID's the following commands should be used::
4448 testpmd> vlan set outer tpid 0x88A8 0
4449 testpmd> vlan set inner tpid 0x8100 0
4450 testpmd> port start 0
4452 Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
4456 testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 /
4457 vlan tci is 456 / end actions vf id 1 / queue index 0 / end
4458 Flow rule #0 validated
4460 testpmd> flow create 0 ingress pattern eth / vlan tci is 4 /
4461 vlan tci is 456 / end actions vf id 123 / queue index 0 / end
4462 Flow rule #0 created
4464 testpmd> flow list 0
4465 ID Group Prio Attr Rule
4466 0 0 0 i- ETH VLAN VLAN=>VF QUEUE
4468 Validate and create a QinQ rule on port 0 to steer traffic to a queue on the host.
4472 testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 /
4473 vlan tci is 654 / end actions pf / queue index 0 / end
4474 Flow rule #1 validated
4476 testpmd> flow create 0 ingress pattern eth / vlan tci is 321 /
4477 vlan tci is 654 / end actions pf / queue index 1 / end
4478 Flow rule #1 created
4480 testpmd> flow list 0
4481 ID Group Prio Attr Rule
4482 0 0 0 i- ETH VLAN VLAN=>VF QUEUE
4483 1 0 0 i- ETH VLAN VLAN=>PF QUEUE
4485 Sample VXLAN flow rules
4486 ~~~~~~~~~~~~~~~~~~~~~~~
4488 Before creating VXLAN rule(s), the UDP port should be added for VXLAN packet
4491 testpmd> rx_vxlan_port add 4789 0
4493 Create VXLAN rules on port 0 to steer traffic to PF queues.
4497 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
4498 eth dst is 00:11:22:33:44:55 / end actions pf / queue index 1 / end
4499 Flow rule #0 created
4501 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 3 /
4502 eth dst is 00:11:22:33:44:55 / end actions pf / queue index 2 / end
4503 Flow rule #1 created
4505 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
4506 eth dst is 00:11:22:33:44:55 / vlan tci is 10 / end actions pf /
4508 Flow rule #2 created
4510 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 5 /
4511 eth dst is 00:11:22:33:44:55 / vlan tci is 20 / end actions pf /
4513 Flow rule #3 created
4515 testpmd> flow create 0 ingress pattern eth dst is 00:00:00:00:01:00 / ipv4 /
4516 udp / vxlan vni is 6 / eth dst is 00:11:22:33:44:55 / end actions pf /
4518 Flow rule #4 created
4520 testpmd> flow list 0
4521 ID Group Prio Attr Rule
4522 0 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE
4523 1 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE
4524 2 0 0 i- ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
4525 3 0 0 i- ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
4526 4 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE
4528 Sample VXLAN encapsulation rule
4529 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4531 VXLAN encapsulation outer layer has default value pre-configured in testpmd
4532 source code, those can be changed by using the following commands
4534 IPv4 VXLAN outer header::
4536 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
4537 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4538 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4541 testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src
4542 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4543 eth-dst 22:22:22:22:22:22
4544 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4547 testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-tos 0
4548 ip-ttl 255 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4549 eth-dst 22:22:22:22:22:22
4550 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4553 IPv6 VXLAN outer header::
4555 testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1
4556 ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4557 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4560 testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4561 ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11
4562 eth-dst 22:22:22:22:22:22
4563 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4566 testpmd> set vxlan-tos-ttl ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4567 ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4568 eth-dst 22:22:22:22:22:22
4569 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4572 Sample NVGRE encapsulation rule
4573 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4575 NVGRE encapsulation outer layer has default value pre-configured in testpmd
4576 source code, those can be changed by using the following commands
4578 IPv4 NVGRE outer header::
4580 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
4581 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4582 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4585 testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1
4586 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4587 eth-dst 22:22:22:22:22:22
4588 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4591 IPv6 NVGRE outer header::
4593 testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4594 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4595 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4598 testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4599 vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4600 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4603 Sample L2 encapsulation rule
4604 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4606 L2 encapsulation has default value pre-configured in testpmd
4607 source code, those can be changed by using the following commands
4611 testpmd> set l2_encap ip-version ipv4
4612 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4613 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4614 mplsoudp_decap / l2_encap / end
4616 L2 with VXLAN header::
4618 testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34
4619 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4620 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4621 mplsoudp_decap / l2_encap / end
4623 Sample L2 decapsulation rule
4624 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4626 L2 decapsulation has default value pre-configured in testpmd
4627 source code, those can be changed by using the following commands
4631 testpmd> set l2_decap
4632 testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap /
4635 L2 with VXLAN header::
4637 testpmd> set l2_encap-with-vlan
4638 testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap /
4641 Sample MPLSoGRE encapsulation rule
4642 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4644 MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
4645 source code, those can be changed by using the following commands
4647 IPv4 MPLSoGRE outer header::
4649 testpmd> set mplsogre_encap ip-version ipv4 label 4
4650 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4651 eth-dst 22:22:22:22:22:22
4652 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4653 mplsogre_encap / end
4655 IPv4 MPLSoGRE with VLAN outer header::
4657 testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4
4658 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4659 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4660 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4661 mplsogre_encap / end
4663 IPv6 MPLSoGRE outer header::
4665 testpmd> set mplsogre_encap ip-version ipv6 mask 4
4666 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4667 eth-dst 22:22:22:22:22:22
4668 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4669 mplsogre_encap / end
4671 IPv6 MPLSoGRE with VLAN outer header::
4673 testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4
4674 ip-src ::1 ip-dst ::2222 vlan-tci 34
4675 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4676 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4677 mplsogre_encap / end
4679 Sample MPLSoGRE decapsulation rule
4680 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4682 MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
4683 source code, those can be changed by using the following commands
4685 IPv4 MPLSoGRE outer header::
4687 testpmd> set mplsogre_decap ip-version ipv4
4688 testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions
4689 mplsogre_decap / l2_encap / end
4691 IPv4 MPLSoGRE with VLAN outer header::
4693 testpmd> set mplsogre_decap-with-vlan ip-version ipv4
4694 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end
4695 actions mplsogre_decap / l2_encap / end
4697 IPv6 MPLSoGRE outer header::
4699 testpmd> set mplsogre_decap ip-version ipv6
4700 testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end
4701 actions mplsogre_decap / l2_encap / end
4703 IPv6 MPLSoGRE with VLAN outer header::
4705 testpmd> set mplsogre_decap-with-vlan ip-version ipv6
4706 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end
4707 actions mplsogre_decap / l2_encap / end
4709 Sample MPLSoUDP encapsulation rule
4710 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4712 MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
4713 source code, those can be changed by using the following commands
4715 IPv4 MPLSoUDP outer header::
4717 testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10
4718 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4719 eth-dst 22:22:22:22:22:22
4720 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4721 mplsoudp_encap / end
4723 IPv4 MPLSoUDP with VLAN outer header::
4725 testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5
4726 udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4727 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4728 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4729 mplsoudp_encap / end
4731 IPv6 MPLSoUDP outer header::
4733 testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10
4734 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4735 eth-dst 22:22:22:22:22:22
4736 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4737 mplsoudp_encap / end
4739 IPv6 MPLSoUDP with VLAN outer header::
4741 testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5
4742 udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34
4743 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4744 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4745 mplsoudp_encap / end
4747 Sample MPLSoUDP decapsulation rule
4748 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4750 MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
4751 source code, those can be changed by using the following commands
4753 IPv4 MPLSoUDP outer header::
4755 testpmd> set mplsoudp_decap ip-version ipv4
4756 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4757 mplsoudp_decap / l2_encap / end
4759 IPv4 MPLSoUDP with VLAN outer header::
4761 testpmd> set mplsoudp_decap-with-vlan ip-version ipv4
4762 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end
4763 actions mplsoudp_decap / l2_encap / end
4765 IPv6 MPLSoUDP outer header::
4767 testpmd> set mplsoudp_decap ip-version ipv6
4768 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end
4769 actions mplsoudp_decap / l2_encap / end
4771 IPv6 MPLSoUDP with VLAN outer header::
4773 testpmd> set mplsoudp_decap-with-vlan ip-version ipv6
4774 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end
4775 actions mplsoudp_decap / l2_encap / end
4777 Sample Raw encapsulation rule
4778 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4780 Raw encapsulation configuration can be set by the following commands
4782 Eecapsulating VxLAN::
4784 testpmd> set raw_encap 4 eth src is 10:11:22:33:44:55 / vlan tci is 1
4785 inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni
4787 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
4788 raw_encap index 4 / end
4790 Sample Raw decapsulation rule
4791 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4793 Raw decapsulation configuration can be set by the following commands
4795 Decapsulating VxLAN::
4797 testpmd> set raw_decap eth / ipv4 / udp / vxlan / end_set
4798 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 /
4799 end actions raw_decap / queue index 0 / end
4804 ESP rules can be created by the following commands::
4806 testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions
4808 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end
4809 actions queue index 3 / end
4810 testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions
4812 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
4813 actions queue index 3 / end
4818 AH rules can be created by the following commands::
4820 testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions
4822 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end
4823 actions queue index 3 / end
4824 testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions
4826 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end
4827 actions queue index 3 / end
4832 PFCP rules can be created by the following commands(s_field need to be 1
4835 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
4836 actions queue index 3 / end
4837 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
4838 seid is 1 / end actions queue index 3 / end
4839 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
4840 actions queue index 3 / end
4841 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
4842 seid is 1 / end actions queue index 3 / end
4847 The following sections show functions to load/unload eBPF based filters.
4852 Load an eBPF program as a callback for particular RX/TX queue::
4854 testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename)
4856 The available load-flags are:
4858 * ``J``: use JIT generated native code, otherwise BPF interpreter will be used.
4860 * ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data.
4866 You'll need clang v3.7 or above to build bpf program you'd like to load
4870 .. code-block:: console
4873 clang -O2 -target bpf -c t1.c
4875 Then to load (and JIT compile) t1.o at RX queue 0, port 1:
4877 .. code-block:: console
4879 testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
4881 To load (not JITed) t1.o at TX queue 0, port 0:
4883 .. code-block:: console
4885 testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
4890 Unload previously loaded eBPF program for particular RX/TX queue::
4892 testpmd> bpf-unload rx|tx (portid) (queueid)
4894 For example to unload BPF filter from TX queue 0, port 0:
4896 .. code-block:: console
4898 testpmd> bpf-unload tx 0 0