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|cap X
28 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
29 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
30 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
36 Some examples in this document are too long to fit on one line are 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 ./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|cap) (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.
180 * ``cap``: Supported offload capabilities.
184 .. code-block:: console
186 testpmd> show port info 0
188 ********************* Infos for port 0 *********************
190 MAC address: XX:XX:XX:XX:XX:XX
192 memory allocation on the socket: 0
194 Link speed: 40000 Mbps
195 Link duplex: full-duplex
196 Promiscuous mode: enabled
197 Allmulticast mode: disabled
198 Maximum number of MAC addresses: 64
199 Maximum number of MAC addresses of hash filtering: 0
204 Redirection table size: 512
205 Supported flow types:
225 Display the rss redirection table entry indicated by masks on port X::
227 testpmd> show port (port_id) rss reta (size) (mask0, mask1...)
229 size is used to indicate the hardware supported reta size
234 Display the RSS hash functions and RSS hash key of a port::
236 testpmd> show port (port_id) rss-hash [key]
241 Clear the port statistics for a given port or for all ports::
243 testpmd> clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)
247 testpmd> clear port stats all
252 Display information for a given port's RX/TX queue::
254 testpmd> show (rxq|txq) info (port_id) (queue_id)
259 Displays the configuration of the application.
260 The configuration comes from the command-line, the runtime or the application defaults::
262 testpmd> show config (rxtx|cores|fwd|txpkts)
264 The available information categories are:
266 * ``rxtx``: RX/TX configuration items.
268 * ``cores``: List of forwarding cores.
270 * ``fwd``: Packet forwarding configuration.
272 * ``txpkts``: Packets to TX configuration.
276 .. code-block:: console
278 testpmd> show config rxtx
280 io packet forwarding - CRC stripping disabled - packets/burst=16
281 nb forwarding cores=2 - nb forwarding ports=1
282 RX queues=1 - RX desc=128 - RX free threshold=0
283 RX threshold registers: pthresh=8 hthresh=8 wthresh=4
284 TX queues=1 - TX desc=512 - TX free threshold=0
285 TX threshold registers: pthresh=36 hthresh=0 wthresh=0
286 TX RS bit threshold=0 - TXQ flags=0x0
291 Set the packet forwarding mode::
293 testpmd> set fwd (io|mac|macswap|flowgen| \
294 rxonly|txonly|csum|icmpecho|noisy) (""|retry)
296 ``retry`` can be specified for forwarding engines except ``rx_only``.
298 The available information categories are:
300 * ``io``: Forwards packets "as-is" in I/O mode.
301 This is the fastest possible forwarding operation as it does not access packets data.
302 This is the default mode.
304 * ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them.
305 Default application behavior is to set source Ethernet address to that of the transmitting interface, and destination
306 address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or
307 'eth-peers-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address.
309 * ``macswap``: MAC swap forwarding mode.
310 Swaps the source and the destination Ethernet addresses of packets before forwarding them.
312 * ``flowgen``: Multi-flow generation mode.
313 Originates a number of flows (with varying destination IP addresses), and terminate receive traffic.
315 * ``rxonly``: Receives packets but doesn't transmit them.
317 * ``txonly``: Generates and transmits packets without receiving any.
319 * ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet.
321 * ``icmpecho``: Receives a burst of packets, lookup for ICMP echo requests and, if any, send back ICMP echo replies.
323 * ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX. Requires ``CONFIG_RTE_LIBRTE_IEEE1588=y``.
325 * ``softnic``: Demonstrates the softnic forwarding operation. In this mode, packet forwarding is
326 similar to I/O mode except for the fact that packets are loopback to the softnic ports only. Therefore, portmask parameter should be set to softnic port only. The various software based custom NIC pipelines specified through the softnic firmware (DPDK packet framework script) can be tested in this mode. Furthermore, it allows to build 5-level hierarchical QoS scheduler as a default option that can be enabled through CLI once testpmd application is initialised. The user can modify the default scheduler hierarchy or can specify the new QoS Scheduler hierarchy through CLI. Requires ``CONFIG_RTE_LIBRTE_PMD_SOFTNIC=y``.
328 * ``noisy``: Noisy neighbor simulation.
329 Simulate more realistic behavior of a guest machine engaged in receiving
330 and sending packets performing Virtual Network Function (VNF).
334 testpmd> set fwd rxonly
336 Set rxonly packet forwarding mode
342 Display an RX descriptor for a port RX queue::
344 testpmd> read rxd (port_id) (queue_id) (rxd_id)
348 testpmd> read rxd 0 0 4
349 0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180
354 Display a TX descriptor for a port TX queue::
356 testpmd> read txd (port_id) (queue_id) (txd_id)
360 testpmd> read txd 0 0 4
361 0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
366 Get loaded dynamic device personalization (DDP) package info list::
368 testpmd> ddp get list (port_id)
373 Display information about dynamic device personalization (DDP) profile::
375 testpmd> ddp get info (profile_path)
380 Display VF statistics::
382 testpmd> show vf stats (port_id) (vf_id)
387 Reset VF statistics::
389 testpmd> clear vf stats (port_id) (vf_id)
391 show port pctype mapping
392 ~~~~~~~~~~~~~~~~~~~~~~~~
394 List all items from the pctype mapping table::
396 testpmd> show port (port_id) pctype mapping
398 show rx offloading capabilities
399 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
401 List all per queue and per port Rx offloading capabilities of a port::
403 testpmd> show port (port_id) rx_offload capabilities
405 show rx offloading configuration
406 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
408 List port level and all queue level Rx offloading configuration::
410 testpmd> show port (port_id) rx_offload configuration
412 show tx offloading capabilities
413 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
415 List all per queue and per port Tx offloading capabilities of a port::
417 testpmd> show port (port_id) tx_offload capabilities
419 show tx offloading configuration
420 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
422 List port level and all queue level Tx offloading configuration::
424 testpmd> show port (port_id) tx_offload configuration
426 show tx metadata setting
427 ~~~~~~~~~~~~~~~~~~~~~~~~
429 Show Tx metadata value set for a specific port::
431 testpmd> show port (port_id) tx_metadata
436 Dumps all physical memory segment layouts::
438 testpmd> dump_physmem
443 Dumps the layout of all memory zones::
445 testpmd> dump_memzone
451 Dumps the size of all memory structures::
453 testpmd> dump_struct_sizes
458 Dumps the status of all or specific element in DPDK rings::
460 testpmd> dump_ring [ring_name]
465 Dumps the statistics of all or specific memory pool::
467 testpmd> dump_mempool [mempool_name]
472 Dumps the user device list::
474 testpmd> dump_devargs
479 Dumps the log level for all the dpdk modules::
481 testpmd> dump_log_types
483 Configuration Functions
484 -----------------------
486 The testpmd application can be configured from the runtime as well as from the command-line.
488 This section details the available configuration functions that are available.
492 Configuration changes only become active when forwarding is started/restarted.
497 Reset forwarding to the default configuration::
504 Set the debug verbosity level::
506 testpmd> set verbose (level)
508 Available levels are as following:
510 * ``0`` silent except for error.
511 * ``1`` fully verbose except for Tx packets.
512 * ``2`` fully verbose except for Rx packets.
513 * ``> 2`` fully verbose.
518 Set the log level for a log type::
520 testpmd> set log global|(type) (level)
524 * ``type`` is the log name.
526 * ``level`` is the log level.
528 For example, to change the global log level::
530 testpmd> set log global (level)
532 Regexes can also be used for type. To change log level of user1, user2 and user3::
534 testpmd> set log user[1-3] (level)
539 Set the number of ports used by the application:
543 This is equivalent to the ``--nb-ports`` command-line option.
548 Set the number of cores used by the application::
550 testpmd> set nbcore (num)
552 This is equivalent to the ``--nb-cores`` command-line option.
556 The number of cores used must not be greater than number of ports used multiplied by the number of queues per port.
561 Set the forwarding cores hexadecimal mask::
563 testpmd> set coremask (mask)
565 This is equivalent to the ``--coremask`` command-line option.
569 The master lcore is reserved for command line parsing only and cannot be masked on for packet forwarding.
574 Set the forwarding ports hexadecimal mask::
576 testpmd> set portmask (mask)
578 This is equivalent to the ``--portmask`` command-line option.
583 Set number of packets per burst::
585 testpmd> set burst (num)
587 This is equivalent to the ``--burst command-line`` option.
589 When retry is enabled, the transmit delay time and number of retries can also be set::
591 testpmd> set burst tx delay (microseconds) retry (num)
596 Set the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode::
598 testpmd> set txpkts (x[,y]*)
600 Where x[,y]* represents a CSV list of values, without white space.
605 Set the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes::
607 testpmd> set txsplit (off|on|rand)
611 * ``off`` disable packet copy & split for CSUM mode.
613 * ``on`` split outgoing packet into multiple segments. Size of each segment
614 and number of segments per packet is determined by ``set txpkts`` command
617 * ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments.
622 Set the list of forwarding cores::
624 testpmd> set corelist (x[,y]*)
626 For example, to change the forwarding cores:
628 .. code-block:: console
630 testpmd> set corelist 3,1
631 testpmd> show config fwd
633 io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled
634 Logical Core 3 (socket 0) forwards packets on 1 streams:
635 RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
636 Logical Core 1 (socket 0) forwards packets on 1 streams:
637 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
641 The cores are used in the same order as specified on the command line.
646 Set the list of forwarding ports::
648 testpmd> set portlist (x[,y]*)
650 For example, to change the port forwarding:
652 .. code-block:: console
654 testpmd> set portlist 0,2,1,3
655 testpmd> show config fwd
657 io packet forwarding - ports=4 - cores=1 - streams=4
658 Logical Core 3 (socket 0) forwards packets on 4 streams:
659 RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01
660 RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
661 RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03
662 RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02
667 Select how to retrieve new ports created after "port attach" command::
669 testpmd> set port setup on (iterator|event)
671 For each new port, a setup is done.
672 It will find the probed ports via RTE_ETH_FOREACH_MATCHING_DEV loop
673 in iterator mode, or via RTE_ETH_EVENT_NEW in event mode.
678 Enable/disable tx loopback::
680 testpmd> set tx loopback (port_id) (on|off)
685 set drop enable bit for all queues::
687 testpmd> set all queues drop (port_id) (on|off)
689 set split drop enable (for VF)
690 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
692 set split drop enable bit for VF from PF::
694 testpmd> set vf split drop (port_id) (vf_id) (on|off)
696 set mac antispoof (for VF)
697 ~~~~~~~~~~~~~~~~~~~~~~~~~~
699 Set mac antispoof for a VF from the PF::
701 testpmd> set vf mac antispoof (port_id) (vf_id) (on|off)
706 Enable/disable MACsec offload::
708 testpmd> set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)
709 testpmd> set macsec offload (port_id) off
714 Configure MACsec secure connection (SC)::
716 testpmd> set macsec sc (tx|rx) (port_id) (mac) (pi)
720 The pi argument is ignored for tx.
721 Check the NIC Datasheet for hardware limits.
726 Configure MACsec secure association (SA)::
728 testpmd> set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)
732 The IDX value must be 0 or 1.
733 Check the NIC Datasheet for hardware limits.
735 set broadcast mode (for VF)
736 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
738 Set broadcast mode for a VF from the PF::
740 testpmd> set vf broadcast (port_id) (vf_id) (on|off)
745 Set the VLAN strip on a port::
747 testpmd> vlan set strip (on|off) (port_id)
752 Set the VLAN strip for a queue on a port::
754 testpmd> vlan set stripq (on|off) (port_id,queue_id)
756 vlan set stripq (for VF)
757 ~~~~~~~~~~~~~~~~~~~~~~~~
759 Set VLAN strip for all queues in a pool for a VF from the PF::
761 testpmd> set vf vlan stripq (port_id) (vf_id) (on|off)
763 vlan set insert (for VF)
764 ~~~~~~~~~~~~~~~~~~~~~~~~
766 Set VLAN insert for a VF from the PF::
768 testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
770 vlan set tag (for VF)
771 ~~~~~~~~~~~~~~~~~~~~~
773 Set VLAN tag for a VF from the PF::
775 testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
777 vlan set antispoof (for VF)
778 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
780 Set VLAN antispoof for a VF from the PF::
782 testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off)
787 Set the VLAN filter on a port::
789 testpmd> vlan set filter (on|off) (port_id)
794 Set the VLAN QinQ (extended queue in queue) on for a port::
796 testpmd> vlan set qinq (on|off) (port_id)
801 Set the inner or outer VLAN TPID for packet filtering on a port::
803 testpmd> vlan set (inner|outer) tpid (value) (port_id)
807 TPID value must be a 16-bit number (value <= 65536).
812 Add a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID::
814 testpmd> rx_vlan add (vlan_id|all) (port_id)
818 VLAN filter must be set on that port. VLAN ID < 4096.
819 Depending on the NIC used, number of vlan_ids may be limited to the maximum entries
820 in VFTA table. This is important if enabling all vlan_ids.
825 Remove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID::
827 testpmd> rx_vlan rm (vlan_id|all) (port_id)
832 Add a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID::
834 testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask)
839 Remove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID::
841 testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask)
846 Add a tunnel filter on a port::
848 testpmd> tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) \
849 (inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\
850 imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)
852 The available information categories are:
854 * ``vxlan``: Set tunnel type as VXLAN.
856 * ``nvgre``: Set tunnel type as NVGRE.
858 * ``ipingre``: Set tunnel type as IP-in-GRE.
860 * ``imac-ivlan``: Set filter type as Inner MAC and VLAN.
862 * ``imac-ivlan-tenid``: Set filter type as Inner MAC, VLAN and tenant ID.
864 * ``imac-tenid``: Set filter type as Inner MAC and tenant ID.
866 * ``imac``: Set filter type as Inner MAC.
868 * ``omac-imac-tenid``: Set filter type as Outer MAC, Inner MAC and tenant ID.
870 * ``oip``: Set filter type as Outer IP.
872 * ``iip``: Set filter type as Inner IP.
876 testpmd> tunnel_filter add 0 68:05:CA:28:09:82 00:00:00:00:00:00 \
877 192.168.2.2 0 ipingre oip 1 1
879 Set an IP-in-GRE tunnel on port 0, and the filter type is Outer IP.
884 Remove a tunnel filter on a port::
886 testpmd> tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) \
887 (inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\
888 imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)
893 Add an UDP port for VXLAN packet filter on a port::
895 testpmd> rx_vxlan_port add (udp_port) (port_id)
900 Remove an UDP port for VXLAN packet filter on a port::
902 testpmd> rx_vxlan_port rm (udp_port) (port_id)
907 Set hardware insertion of VLAN IDs in packets sent on a port::
909 testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer]
911 For example, set a single VLAN ID (5) insertion on port 0::
915 Or, set double VLAN ID (inner: 2, outer: 3) insertion on port 1::
923 Set port based hardware insertion of VLAN ID in packets sent on a port::
925 testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off)
930 Disable hardware insertion of a VLAN header in packets sent on a port::
932 testpmd> tx_vlan reset (port_id)
937 Select hardware or software calculation of the checksum when
938 transmitting a packet using the ``csum`` forwarding engine::
940 testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)
944 * ``ip|udp|tcp|sctp`` always relate to the inner layer.
946 * ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized
947 as a tunnel packet by the forwarding engine (vxlan, gre and ipip are
948 supported). See also the ``csum parse-tunnel`` command.
950 * ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized
951 as a tunnel packet by the forwarding engine (vxlan, vxlan-gpe are
952 supported). See also the ``csum parse-tunnel`` command.
956 Check the NIC Datasheet for hardware limits.
961 Set RSS queue region span on a port::
963 testpmd> set port (port_id) queue-region region_id (value) \
964 queue_start_index (value) queue_num (value)
966 Set flowtype mapping on a RSS queue region on a port::
968 testpmd> set port (port_id) queue-region region_id (value) flowtype (value)
972 * For the flowtype(pctype) of packet,the specific index for each type has
973 been defined in file i40e_type.h as enum i40e_filter_pctype.
975 Set user priority mapping on a RSS queue region on a port::
977 testpmd> set port (port_id) queue-region UP (value) region_id (value)
979 Flush all queue region related configuration on a port::
981 testpmd> set port (port_id) queue-region flush (on|off)
985 * ``on``: is just an enable function which server for other configuration,
986 it is for all configuration about queue region from up layer,
987 at first will only keep in DPDK software stored in driver,
988 only after "flush on", it commit all configuration to HW.
990 * ``off``: is just clean all configuration about queue region just now,
991 and restore all to DPDK i40e driver default config when start up.
993 Show all queue region related configuration info on a port::
995 testpmd> show port (port_id) queue-region
999 Queue region only support on PF by now, so these command is
1000 only for configuration of queue region on PF port.
1005 Define how tunneled packets should be handled by the csum forward
1008 testpmd> csum parse-tunnel (on|off) (tx_port_id)
1010 If enabled, the csum forward engine will try to recognize supported
1011 tunnel headers (vxlan, gre, ipip).
1013 If disabled, treat tunnel packets as non-tunneled packets (a inner
1014 header is handled as a packet payload).
1018 The port argument is the TX port like in the ``csum set`` command.
1022 Consider a packet in packet like the following::
1024 eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in
1026 * If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1027 command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the
1028 ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ipv4_out`` and ``udp_out``).
1030 * If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1031 command relate to the outer headers, here ``ipv4_out`` and ``udp_out``.
1036 Display tx checksum offload configuration::
1038 testpmd> csum show (port_id)
1043 Enable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine::
1045 testpmd> tso set (segsize) (port_id)
1049 Check the NIC datasheet for hardware limits.
1054 Display the status of TCP Segmentation Offload::
1056 testpmd> tso show (port_id)
1061 Set tso segment size of tunneled packets for a port in csum engine::
1063 testpmd> tunnel_tso set (tso_segsz) (port_id)
1068 Display the status of tunneled TCP Segmentation Offload for a port::
1070 testpmd> tunnel_tso show (port_id)
1075 Enable or disable GRO in ``csum`` forwarding engine::
1077 testpmd> set port <port_id> gro on|off
1079 If enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
1080 packets received from the given port.
1082 If disabled, packets received from the given port won't be performed
1083 GRO. By default, GRO is disabled for all ports.
1087 When enable GRO for a port, TCP/IPv4 packets received from the port
1088 will be performed GRO. After GRO, all merged packets have bad
1089 checksums, since the GRO library doesn't re-calculate checksums for
1090 the merged packets. Therefore, if users want the merged packets to
1091 have correct checksums, please select HW IP checksum calculation and
1092 HW TCP checksum calculation for the port which the merged packets are
1098 Display GRO configuration for a given port::
1100 testpmd> show port <port_id> gro
1105 Set the cycle to flush the GROed packets from reassembly tables::
1107 testpmd> set gro flush <cycles>
1109 When enable GRO, the csum forwarding engine performs GRO on received
1110 packets, and the GROed packets are stored in reassembly tables. Users
1111 can use this command to determine when the GROed packets are flushed
1112 from the reassembly tables.
1114 The ``cycles`` is measured in GRO operation times. The csum forwarding
1115 engine flushes the GROed packets from the tables every ``cycles`` GRO
1118 By default, the value of ``cycles`` is 1, which means flush GROed packets
1119 from the reassembly tables as soon as one GRO operation finishes. The value
1120 of ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
1122 Please note that the large value of ``cycles`` may cause the poor TCP/IP
1123 stack performance. Because the GROed packets are delayed to arrive the
1124 stack, thus causing more duplicated ACKs and TCP retransmissions.
1129 Toggle per-port GSO support in ``csum`` forwarding engine::
1131 testpmd> set port <port_id> gso on|off
1133 If enabled, the csum forwarding engine will perform GSO on supported IPv4
1134 packets, transmitted on the given port.
1136 If disabled, packets transmitted on the given port will not undergo GSO.
1137 By default, GSO is disabled for all ports.
1141 When GSO is enabled on a port, supported IPv4 packets transmitted on that
1142 port undergo GSO. Afterwards, the segmented packets are represented by
1143 multi-segment mbufs; however, the csum forwarding engine doesn't calculation
1144 of checksums for GSO'd segments in SW. As a result, if users want correct
1145 checksums in GSO segments, they should enable HW checksum calculation for
1148 For example, HW checksum calculation for VxLAN GSO'd packets may be enabled
1149 by setting the following options in the csum forwarding engine:
1151 testpmd> csum set outer_ip hw <port_id>
1153 testpmd> csum set ip hw <port_id>
1155 testpmd> csum set tcp hw <port_id>
1157 UDP GSO is the same as IP fragmentation, which treats the UDP header
1158 as the payload and does not modify it during segmentation. That is,
1159 after UDP GSO, only the first output fragment has the original UDP
1160 header. Therefore, users need to enable HW IP checksum calculation
1161 and SW UDP checksum calculation for GSO-enabled ports, if they want
1162 correct checksums for UDP/IPv4 packets.
1167 Set the maximum GSO segment size (measured in bytes), which includes the
1168 packet header and the packet payload for GSO-enabled ports (global)::
1170 testpmd> set gso segsz <length>
1175 Display the status of Generic Segmentation Offload for a given port::
1177 testpmd> show port <port_id> gso
1182 Add an alternative MAC address to a port::
1184 testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)
1189 Remove a MAC address from a port::
1191 testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)
1196 To add the multicast MAC address to/from the set of multicast addresses
1199 testpmd> mcast_addr add (port_id) (mcast_addr)
1204 To remove the multicast MAC address to/from the set of multicast addresses
1207 testpmd> mcast_addr remove (port_id) (mcast_addr)
1209 mac_addr add (for VF)
1210 ~~~~~~~~~~~~~~~~~~~~~
1212 Add an alternative MAC address for a VF to a port::
1214 testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX)
1219 Set the default MAC address for a port::
1221 testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
1223 mac_addr set (for VF)
1224 ~~~~~~~~~~~~~~~~~~~~~
1226 Set the MAC address for a VF from the PF::
1228 testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)
1233 Set the forwarding peer address for certain port::
1235 testpmd> set eth-peer (port_id) (peer_addr)
1237 This is equivalent to the ``--eth-peer`` command-line option.
1242 Set the unicast hash filter(s) on/off for a port::
1244 testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off)
1249 Set the promiscuous mode on for a port or for all ports.
1250 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1252 testpmd> set promisc (port_id|all) (on|off)
1257 Set the allmulti mode for a port or for all ports::
1259 testpmd> set allmulti (port_id|all) (on|off)
1261 Same as the ifconfig (8) option. Controls how multicast packets are handled.
1263 set promisc (for VF)
1264 ~~~~~~~~~~~~~~~~~~~~
1266 Set the unicast promiscuous mode for a VF from PF.
1267 It's supported by Intel i40e NICs now.
1268 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1270 testpmd> set vf promisc (port_id) (vf_id) (on|off)
1272 set allmulticast (for VF)
1273 ~~~~~~~~~~~~~~~~~~~~~~~~~
1275 Set the multicast promiscuous mode for a VF from PF.
1276 It's supported by Intel i40e NICs now.
1277 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1279 testpmd> set vf allmulti (port_id) (vf_id) (on|off)
1281 set tx max bandwidth (for VF)
1282 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1284 Set TX max absolute bandwidth (Mbps) for a VF from PF::
1286 testpmd> set vf tx max-bandwidth (port_id) (vf_id) (max_bandwidth)
1288 set tc tx min bandwidth (for VF)
1289 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1291 Set all TCs' TX min relative bandwidth (%) for a VF from PF::
1293 testpmd> set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)
1295 set tc tx max bandwidth (for VF)
1296 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1298 Set a TC's TX max absolute bandwidth (Mbps) for a VF from PF::
1300 testpmd> set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (max_bandwidth)
1302 set tc strict link priority mode
1303 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1305 Set some TCs' strict link priority mode on a physical port::
1307 testpmd> set tx strict-link-priority (port_id) (tc_bitmap)
1309 set tc tx min bandwidth
1310 ~~~~~~~~~~~~~~~~~~~~~~~
1312 Set all TCs' TX min relative bandwidth (%) globally for all PF and VFs::
1314 testpmd> set tc tx min-bandwidth (port_id) (bw1, bw2, ...)
1319 Set the link flow control parameter on a port::
1321 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1322 (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \
1323 autoneg (on|off) (port_id)
1327 * ``high_water`` (integer): High threshold value to trigger XOFF.
1329 * ``low_water`` (integer): Low threshold value to trigger XON.
1331 * ``pause_time`` (integer): Pause quota in the Pause frame.
1333 * ``send_xon`` (0/1): Send XON frame.
1335 * ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames.
1337 * ``autoneg``: Change the auto-negotiation parameter.
1342 Set the priority flow control parameter on a port::
1344 testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1345 (pause_time) (priority) (port_id)
1349 * ``high_water`` (integer): High threshold value.
1351 * ``low_water`` (integer): Low threshold value.
1353 * ``pause_time`` (integer): Pause quota in the Pause frame.
1355 * ``priority`` (0-7): VLAN User Priority.
1360 Set statistics mapping (qmapping 0..15) for RX/TX queue on port::
1362 testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)
1364 For example, to set rx queue 2 on port 0 to mapping 5::
1366 testpmd>set stat_qmap rx 0 2 5
1368 set xstats-hide-zero
1369 ~~~~~~~~~~~~~~~~~~~~
1371 Set the option to hide zero values for xstats display::
1373 testpmd> set xstats-hide-zero on|off
1377 By default, the zero values are displayed for xstats.
1379 set port - rx/tx (for VF)
1380 ~~~~~~~~~~~~~~~~~~~~~~~~~
1382 Set VF receive/transmit from a port::
1384 testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1386 set port - mac address filter (for VF)
1387 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1389 Add/Remove unicast or multicast MAC addr filter for a VF::
1391 testpmd> set port (port_id) vf (vf_id) (mac_addr) \
1392 (exact-mac|exact-mac-vlan|hashmac|hashmac-vlan) (on|off)
1394 set port - rx mode(for VF)
1395 ~~~~~~~~~~~~~~~~~~~~~~~~~~
1397 Set the VF receive mode of a port::
1399 testpmd> set port (port_id) vf (vf_id) \
1400 rxmode (AUPE|ROPE|BAM|MPE) (on|off)
1402 The available receive modes are:
1404 * ``AUPE``: Accepts untagged VLAN.
1406 * ``ROPE``: Accepts unicast hash.
1408 * ``BAM``: Accepts broadcast packets.
1410 * ``MPE``: Accepts all multicast packets.
1412 set port - tx_rate (for Queue)
1413 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1415 Set TX rate limitation for a queue on a port::
1417 testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1419 set port - tx_rate (for VF)
1420 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1422 Set TX rate limitation for queues in VF on a port::
1424 testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
1426 set port - mirror rule
1427 ~~~~~~~~~~~~~~~~~~~~~~
1429 Set pool or vlan type mirror rule for a port::
1431 testpmd> set port (port_id) mirror-rule (rule_id) \
1432 (pool-mirror-up|pool-mirror-down|vlan-mirror) \
1433 (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off)
1435 Set link mirror rule for a port::
1437 testpmd> set port (port_id) mirror-rule (rule_id) \
1438 (uplink-mirror|downlink-mirror) dst-pool (pool_id) (on|off)
1440 For example to enable mirror traffic with vlan 0,1 to pool 0::
1442 set port 0 mirror-rule 0 vlan-mirror 0,1 dst-pool 0 on
1444 reset port - mirror rule
1445 ~~~~~~~~~~~~~~~~~~~~~~~~
1447 Reset a mirror rule for a port::
1449 testpmd> reset port (port_id) mirror-rule (rule_id)
1454 Set the flush on RX streams before forwarding.
1455 The default is flush ``on``.
1456 Mainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams::
1458 testpmd> set flush_rx off
1463 Set the bypass mode for the lowest port on bypass enabled NIC::
1465 testpmd> set bypass mode (normal|bypass|isolate) (port_id)
1470 Set the event required to initiate specified bypass mode for the lowest port on a bypass enabled::
1472 testpmd> set bypass event (timeout|os_on|os_off|power_on|power_off) \
1473 mode (normal|bypass|isolate) (port_id)
1477 * ``timeout``: Enable bypass after watchdog timeout.
1479 * ``os_on``: Enable bypass when OS/board is powered on.
1481 * ``os_off``: Enable bypass when OS/board is powered off.
1483 * ``power_on``: Enable bypass when power supply is turned on.
1485 * ``power_off``: Enable bypass when power supply is turned off.
1491 Set the bypass watchdog timeout to ``n`` seconds where 0 = instant::
1493 testpmd> set bypass timeout (0|1.5|2|3|4|8|16|32)
1498 Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC::
1500 testpmd> show bypass config (port_id)
1505 Set link up for a port::
1507 testpmd> set link-up port (port id)
1512 Set link down for a port::
1514 testpmd> set link-down port (port id)
1519 Enable E-tag insertion for a VF on a port::
1521 testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
1523 Disable E-tag insertion for a VF on a port::
1525 testpmd> E-tag set insertion off port (port_id) vf (vf_id)
1527 Enable/disable E-tag stripping on a port::
1529 testpmd> E-tag set stripping (on|off) port (port_id)
1531 Enable/disable E-tag based forwarding on a port::
1533 testpmd> E-tag set forwarding (on|off) port (port_id)
1535 Add an E-tag forwarding filter on a port::
1537 testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id) port (port_id)
1539 Delete an E-tag forwarding filter on a port::
1540 testpmd> E-tag set filter del e-tag-id (value) port (port_id)
1545 Load a dynamic device personalization (DDP) profile and store backup profile::
1547 testpmd> ddp add (port_id) (profile_path[,backup_profile_path])
1552 Delete a dynamic device personalization profile and restore backup profile::
1554 testpmd> ddp del (port_id) (backup_profile_path)
1559 List all items from the ptype mapping table::
1561 testpmd> ptype mapping get (port_id) (valid_only)
1565 * ``valid_only``: A flag indicates if only list valid items(=1) or all itemss(=0).
1567 Replace a specific or a group of software defined ptype with a new one::
1569 testpmd> ptype mapping replace (port_id) (target) (mask) (pkt_type)
1573 * ``target``: A specific software ptype or a mask to represent a group of software ptypes.
1575 * ``mask``: A flag indicate if "target" is a specific software ptype(=0) or a ptype mask(=1).
1577 * ``pkt_type``: The new software ptype to replace the old ones.
1579 Update hardware defined ptype to software defined packet type mapping table::
1581 testpmd> ptype mapping update (port_id) (hw_ptype) (sw_ptype)
1585 * ``hw_ptype``: hardware ptype as the index of the ptype mapping table.
1587 * ``sw_ptype``: software ptype as the value of the ptype mapping table.
1589 Reset ptype mapping table::
1591 testpmd> ptype mapping reset (port_id)
1593 config per port Rx offloading
1594 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1596 Enable or disable a per port Rx offloading on all Rx queues of a port::
1598 testpmd> port config (port_id) rx_offload (offloading) on|off
1600 * ``offloading``: can be any of these offloading capability:
1601 vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1602 qinq_strip, outer_ipv4_cksum, macsec_strip,
1603 header_split, vlan_filter, vlan_extend, jumbo_frame,
1604 crc_strip, scatter, timestamp, security, keep_crc
1606 This command should be run when the port is stopped, or else it will fail.
1608 config per queue Rx offloading
1609 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1611 Enable or disable a per queue Rx offloading only on a specific Rx queue::
1613 testpmd> port (port_id) rxq (queue_id) rx_offload (offloading) on|off
1615 * ``offloading``: can be any of these offloading capability:
1616 vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1617 qinq_strip, outer_ipv4_cksum, macsec_strip,
1618 header_split, vlan_filter, vlan_extend, jumbo_frame,
1619 crc_strip, scatter, timestamp, security, keep_crc
1621 This command should be run when the port is stopped, or else it will fail.
1623 config per port Tx offloading
1624 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1626 Enable or disable a per port Tx offloading on all Tx queues of a port::
1628 testpmd> port config (port_id) tx_offload (offloading) on|off
1630 * ``offloading``: can be any of these offloading capability:
1631 vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1632 sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1633 qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1634 ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1635 mt_lockfree, multi_segs, mbuf_fast_free, security,
1638 This command should be run when the port is stopped, or else it will fail.
1640 config per queue Tx offloading
1641 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1643 Enable or disable a per queue Tx offloading only on a specific Tx queue::
1645 testpmd> port (port_id) txq (queue_id) tx_offload (offloading) on|off
1647 * ``offloading``: can be any of these offloading capability:
1648 vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1649 sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1650 qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1651 ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1652 mt_lockfree, multi_segs, mbuf_fast_free, security
1654 This command should be run when the port is stopped, or else it will fail.
1656 Config VXLAN Encap outer layers
1657 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1659 Configure the outer layer to encapsulate a packet inside a VXLAN tunnel::
1661 set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1662 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) \
1665 set vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1666 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1667 eth-src (eth-src) eth-dst (eth-dst)
1669 These commands will set an internal configuration inside testpmd, any following
1670 flow rule using the action vxlan_encap will use the last configuration set.
1671 To have a different encapsulation header, one of those commands must be called
1672 before the flow rule creation.
1674 Config NVGRE Encap outer layers
1675 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1677 Configure the outer layer to encapsulate a packet inside a NVGRE tunnel::
1679 set nvgre ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) ip-dst (ip-dst) \
1680 eth-src (eth-src) eth-dst (eth-dst)
1681 set nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) \
1682 ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1684 These commands will set an internal configuration inside testpmd, any following
1685 flow rule using the action nvgre_encap will use the last configuration set.
1686 To have a different encapsulation header, one of those commands must be called
1687 before the flow rule creation.
1692 Configure the l2 to be used when encapsulating a packet with L2::
1694 set l2_encap ip-version (ipv4|ipv6) eth-src (eth-src) eth-dst (eth-dst)
1695 set l2_encap-with-vlan ip-version (ipv4|ipv6) vlan-tci (vlan-tci) \
1696 eth-src (eth-src) eth-dst (eth-dst)
1698 Those commands will set an internal configuration inside testpmd, any following
1699 flow rule using the action l2_encap will use the last configuration set.
1700 To have a different encapsulation header, one of those commands must be called
1701 before the flow rule creation.
1706 Configure the l2 to be removed when decapsulating a packet with L2::
1708 set l2_decap ip-version (ipv4|ipv6)
1709 set l2_decap-with-vlan ip-version (ipv4|ipv6)
1711 Those commands will set an internal configuration inside testpmd, any following
1712 flow rule using the action l2_decap will use the last configuration set.
1713 To have a different encapsulation header, one of those commands must be called
1714 before the flow rule creation.
1716 Config MPLSoGRE Encap outer layers
1717 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1719 Configure the outer layer to encapsulate a packet inside a MPLSoGRE tunnel::
1721 set mplsogre_encap ip-version (ipv4|ipv6) label (label) \
1722 ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1723 set mplsogre_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1724 ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1725 eth-src (eth-src) eth-dst (eth-dst)
1727 These commands will set an internal configuration inside testpmd, any following
1728 flow rule using the action mplsogre_encap will use the last configuration set.
1729 To have a different encapsulation header, one of those commands must be called
1730 before the flow rule creation.
1732 Config MPLSoGRE Decap outer layers
1733 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1735 Configure the outer layer to decapsulate MPLSoGRE packet::
1737 set mplsogre_decap ip-version (ipv4|ipv6)
1738 set mplsogre_decap-with-vlan ip-version (ipv4|ipv6)
1740 These commands will set an internal configuration inside testpmd, any following
1741 flow rule using the action mplsogre_decap will use the last configuration set.
1742 To have a different decapsulation header, one of those commands must be called
1743 before the flow rule creation.
1745 Config MPLSoUDP Encap outer layers
1746 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1748 Configure the outer layer to encapsulate a packet inside a MPLSoUDP tunnel::
1750 set mplsoudp_encap ip-version (ipv4|ipv6) label (label) udp-src (udp-src) \
1751 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1752 eth-src (eth-src) eth-dst (eth-dst)
1753 set mplsoudp_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1754 udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1755 vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1757 These commands will set an internal configuration inside testpmd, any following
1758 flow rule using the action mplsoudp_encap will use the last configuration set.
1759 To have a different encapsulation header, one of those commands must be called
1760 before the flow rule creation.
1762 Config MPLSoUDP Decap outer layers
1763 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1765 Configure the outer layer to decapsulate MPLSoUDP packet::
1767 set mplsoudp_decap ip-version (ipv4|ipv6)
1768 set mplsoudp_decap-with-vlan ip-version (ipv4|ipv6)
1770 These commands will set an internal configuration inside testpmd, any following
1771 flow rule using the action mplsoudp_decap will use the last configuration set.
1772 To have a different decapsulation header, one of those commands must be called
1773 before the flow rule creation.
1778 The following sections show functions for configuring ports.
1782 Port configuration changes only become active when forwarding is started/restarted.
1787 Attach a port specified by pci address or virtual device args::
1789 testpmd> port attach (identifier)
1791 To attach a new pci device, the device should be recognized by kernel first.
1792 Then it should be moved under DPDK management.
1793 Finally the port can be attached to testpmd.
1795 For example, to move a pci device using ixgbe under DPDK management:
1797 .. code-block:: console
1799 # Check the status of the available devices.
1800 ./usertools/dpdk-devbind.py --status
1802 Network devices using DPDK-compatible driver
1803 ============================================
1806 Network devices using kernel driver
1807 ===================================
1808 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=
1811 # Bind the device to igb_uio.
1812 sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0
1815 # Recheck the status of the devices.
1816 ./usertools/dpdk-devbind.py --status
1817 Network devices using DPDK-compatible driver
1818 ============================================
1819 0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused=
1821 To attach a port created by virtual device, above steps are not needed.
1823 For example, to attach a port whose pci address is 0000:0a:00.0.
1825 .. code-block:: console
1827 testpmd> port attach 0000:0a:00.0
1828 Attaching a new port...
1829 EAL: PCI device 0000:0a:00.0 on NUMA socket -1
1830 EAL: probe driver: 8086:10fb rte_ixgbe_pmd
1831 EAL: PCI memory mapped at 0x7f83bfa00000
1832 EAL: PCI memory mapped at 0x7f83bfa80000
1833 PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5
1834 PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
1835 Port 0 is attached. Now total ports is 1
1838 For example, to attach a port created by pcap PMD.
1840 .. code-block:: console
1842 testpmd> port attach net_pcap0
1843 Attaching a new port...
1844 PMD: Initializing pmd_pcap for net_pcap0
1845 PMD: Creating pcap-backed ethdev on numa socket 0
1846 Port 0 is attached. Now total ports is 1
1849 In this case, identifier is ``net_pcap0``.
1850 This identifier format is the same as ``--vdev`` format of DPDK applications.
1852 For example, to re-attach a bonded port which has been previously detached,
1853 the mode and slave parameters must be given.
1855 .. code-block:: console
1857 testpmd> port attach net_bond_0,mode=0,slave=1
1858 Attaching a new port...
1859 EAL: Initializing pmd_bond for net_bond_0
1860 EAL: Create bonded device net_bond_0 on port 0 in mode 0 on socket 0.
1861 Port 0 is attached. Now total ports is 1
1868 Detach a specific port::
1870 testpmd> port detach (port_id)
1872 Before detaching a port, the port should be stopped and closed.
1874 For example, to detach a pci device port 0.
1876 .. code-block:: console
1878 testpmd> port stop 0
1881 testpmd> port close 0
1885 testpmd> port detach 0
1887 EAL: PCI device 0000:0a:00.0 on NUMA socket -1
1888 EAL: remove driver: 8086:10fb rte_ixgbe_pmd
1889 EAL: PCI memory unmapped at 0x7f83bfa00000
1890 EAL: PCI memory unmapped at 0x7f83bfa80000
1894 For example, to detach a virtual device port 0.
1896 .. code-block:: console
1898 testpmd> port stop 0
1901 testpmd> port close 0
1905 testpmd> port detach 0
1907 PMD: Closing pcap ethdev on numa socket 0
1908 Port 'net_pcap0' is detached. Now total ports is 0
1911 To remove a pci device completely from the system, first detach the port from testpmd.
1912 Then the device should be moved under kernel management.
1913 Finally the device can be removed using kernel pci hotplug functionality.
1915 For example, to move a pci device under kernel management:
1917 .. code-block:: console
1919 sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0
1921 ./usertools/dpdk-devbind.py --status
1923 Network devices using DPDK-compatible driver
1924 ============================================
1927 Network devices using kernel driver
1928 ===================================
1929 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio
1931 To remove a port created by a virtual device, above steps are not needed.
1936 Start all ports or a specific port::
1938 testpmd> port start (port_id|all)
1943 Stop all ports or a specific port::
1945 testpmd> port stop (port_id|all)
1950 Close all ports or a specific port::
1952 testpmd> port close (port_id|all)
1954 port config - queue ring size
1955 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1957 Configure a rx/tx queue ring size::
1959 testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
1961 Only take effect after command that (re-)start the port or command that setup specific queue.
1963 port start/stop queue
1964 ~~~~~~~~~~~~~~~~~~~~~
1966 Start/stop a rx/tx queue on a specific port::
1968 testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
1970 port config - queue deferred start
1971 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1973 Switch on/off deferred start of a specific port queue::
1975 testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
1978 ~~~~~~~~~~~~~~~~~~~~~
1980 Setup a rx/tx queue on a specific port::
1982 testpmd> port (port_id) (rxq|txq) (queue_id) setup
1984 Only take effect when port is started.
1989 Set the speed and duplex mode for all ports or a specific port::
1991 testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|auto) \
1992 duplex (half|full|auto)
1994 port config - queues/descriptors
1995 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1997 Set number of queues/descriptors for rxq, txq, rxd and txd::
1999 testpmd> port config all (rxq|txq|rxd|txd) (value)
2001 This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2003 port config - max-pkt-len
2004 ~~~~~~~~~~~~~~~~~~~~~~~~~
2006 Set the maximum packet length::
2008 testpmd> port config all max-pkt-len (value)
2010 This is equivalent to the ``--max-pkt-len`` command-line option.
2012 port config - CRC Strip
2013 ~~~~~~~~~~~~~~~~~~~~~~~
2015 Set hardware CRC stripping on or off for all ports::
2017 testpmd> port config all crc-strip (on|off)
2019 CRC stripping is on by default.
2021 The ``off`` option is equivalent to the ``--disable-crc-strip`` command-line option.
2023 port config - scatter
2024 ~~~~~~~~~~~~~~~~~~~~~~~
2026 Set RX scatter mode on or off for all ports::
2028 testpmd> port config all scatter (on|off)
2030 RX scatter mode is off by default.
2032 The ``on`` option is equivalent to the ``--enable-scatter`` command-line option.
2034 port config - RX Checksum
2035 ~~~~~~~~~~~~~~~~~~~~~~~~~
2037 Set hardware RX checksum offload to on or off for all ports::
2039 testpmd> port config all rx-cksum (on|off)
2041 Checksum offload is off by default.
2043 The ``on`` option is equivalent to the ``--enable-rx-cksum`` command-line option.
2048 Set hardware VLAN on or off for all ports::
2050 testpmd> port config all hw-vlan (on|off)
2052 Hardware VLAN is off by default.
2054 The ``on`` option is equivalent to the ``--enable-hw-vlan`` command-line option.
2056 port config - VLAN filter
2057 ~~~~~~~~~~~~~~~~~~~~~~~~~
2059 Set hardware VLAN filter on or off for all ports::
2061 testpmd> port config all hw-vlan-filter (on|off)
2063 Hardware VLAN filter is off by default.
2065 The ``on`` option is equivalent to the ``--enable-hw-vlan-filter`` command-line option.
2067 port config - VLAN strip
2068 ~~~~~~~~~~~~~~~~~~~~~~~~
2070 Set hardware VLAN strip on or off for all ports::
2072 testpmd> port config all hw-vlan-strip (on|off)
2074 Hardware VLAN strip is off by default.
2076 The ``on`` option is equivalent to the ``--enable-hw-vlan-strip`` command-line option.
2078 port config - VLAN extend
2079 ~~~~~~~~~~~~~~~~~~~~~~~~~
2081 Set hardware VLAN extend on or off for all ports::
2083 testpmd> port config all hw-vlan-extend (on|off)
2085 Hardware VLAN extend is off by default.
2087 The ``on`` option is equivalent to the ``--enable-hw-vlan-extend`` command-line option.
2089 port config - Drop Packets
2090 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2092 Set packet drop for packets with no descriptors on or off for all ports::
2094 testpmd> port config all drop-en (on|off)
2096 Packet dropping for packets with no descriptors is off by default.
2098 The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2103 Set the RSS (Receive Side Scaling) mode on or off::
2105 testpmd> port config all rss (all|default|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none)
2107 RSS is on by default.
2109 The ``all`` option is equivalent to ip|tcp|udp|sctp|ether.
2110 The ``default`` option enables all supported RSS types reported by device info.
2111 The ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2113 port config - RSS Reta
2114 ~~~~~~~~~~~~~~~~~~~~~~
2116 Set the RSS (Receive Side Scaling) redirection table::
2118 testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2123 Set the DCB mode for an individual port::
2125 testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2127 The traffic class should be 4 or 8.
2132 Set the number of packets per burst::
2134 testpmd> port config all burst (value)
2136 This is equivalent to the ``--burst`` command-line option.
2138 port config - Threshold
2139 ~~~~~~~~~~~~~~~~~~~~~~~
2141 Set thresholds for TX/RX queues::
2143 testpmd> port config all (threshold) (value)
2145 Where the threshold type can be:
2147 * ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255.
2149 * ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255.
2151 * ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255.
2153 * ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255.
2155 * ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255.
2157 * ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255.
2159 * ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd.
2161 * ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd.
2163 * ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd.
2165 These threshold options are also available from the command-line.
2170 Set the value of ether-type for E-tag::
2172 testpmd> port config (port_id|all) l2-tunnel E-tag ether-type (value)
2174 Enable/disable the E-tag support::
2176 testpmd> port config (port_id|all) l2-tunnel E-tag (enable|disable)
2178 port config pctype mapping
2179 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2181 Reset pctype mapping table::
2183 testpmd> port config (port_id) pctype mapping reset
2185 Update hardware defined pctype to software defined flow type mapping table::
2187 testpmd> port config (port_id) pctype mapping update (pctype_id_0[,pctype_id_1]*) (flow_type_id)
2191 * ``pctype_id_x``: hardware pctype id as index of bit in bitmask value of the pctype mapping table.
2193 * ``flow_type_id``: software flow type id as the index of the pctype mapping table.
2195 port config input set
2196 ~~~~~~~~~~~~~~~~~~~~~
2198 Config RSS/FDIR/FDIR flexible payload input set for some pctype::
2200 testpmd> port config (port_id) pctype (pctype_id) \
2201 (hash_inset|fdir_inset|fdir_flx_inset) \
2202 (get|set|clear) field (field_idx)
2204 Clear RSS/FDIR/FDIR flexible payload input set for some pctype::
2206 testpmd> port config (port_id) pctype (pctype_id) \
2207 (hash_inset|fdir_inset|fdir_flx_inset) clear all
2211 * ``pctype_id``: hardware packet classification types.
2212 * ``field_idx``: hardware field index.
2214 port config udp_tunnel_port
2215 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2217 Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
2219 testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve (udp_port)
2221 port config tx_metadata
2222 ~~~~~~~~~~~~~~~~~~~~~~~
2224 Set Tx metadata value per port.
2225 testpmd will add this value to any Tx packet sent from this port::
2227 testpmd> port config (port_id) tx_metadata (value)
2232 To configure MTU(Maximum Transmission Unit) on devices using testpmd::
2234 testpmd> port config mtu (port_id) (value)
2236 port config rss hash key
2237 ~~~~~~~~~~~~~~~~~~~~~~~~
2239 To configure the RSS hash key used to compute the RSS
2240 hash of input [IP] packets received on port::
2242 testpmd> port config <port_id> rss-hash-key (ipv4|ipv4-frag|\
2243 ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|\
2244 ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|\
2245 ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|\
2246 ipv6-udp-ex <string of hex digits \
2247 (variable length, NIC dependent)>)
2249 Link Bonding Functions
2250 ----------------------
2252 The Link Bonding functions make it possible to dynamically create and
2253 manage link bonding devices from within testpmd interactive prompt.
2255 create bonded device
2256 ~~~~~~~~~~~~~~~~~~~~
2258 Create a new bonding device::
2260 testpmd> create bonded device (mode) (socket)
2262 For example, to create a bonded device in mode 1 on socket 0::
2264 testpmd> create bonded device 1 0
2265 created new bonded device (port X)
2270 Adds Ethernet device to a Link Bonding device::
2272 testpmd> add bonding slave (slave id) (port id)
2274 For example, to add Ethernet device (port 6) to a Link Bonding device (port 10)::
2276 testpmd> add bonding slave 6 10
2279 remove bonding slave
2280 ~~~~~~~~~~~~~~~~~~~~
2282 Removes an Ethernet slave device from a Link Bonding device::
2284 testpmd> remove bonding slave (slave id) (port id)
2286 For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10)::
2288 testpmd> remove bonding slave 6 10
2293 Set the Link Bonding mode of a Link Bonding device::
2295 testpmd> set bonding mode (value) (port id)
2297 For example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3)::
2299 testpmd> set bonding mode 3 10
2304 Set an Ethernet slave device as the primary device on a Link Bonding device::
2306 testpmd> set bonding primary (slave id) (port id)
2308 For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10)::
2310 testpmd> set bonding primary 6 10
2315 Set the MAC address of a Link Bonding device::
2317 testpmd> set bonding mac (port id) (mac)
2319 For example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01::
2321 testpmd> set bonding mac 10 00:00:00:00:00:01
2323 set bonding xmit_balance_policy
2324 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2326 Set the transmission policy for a Link Bonding device when it is in Balance XOR mode::
2328 testpmd> set bonding xmit_balance_policy (port_id) (l2|l23|l34)
2330 For example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports)::
2332 testpmd> set bonding xmit_balance_policy 10 l34
2335 set bonding mon_period
2336 ~~~~~~~~~~~~~~~~~~~~~~
2338 Set the link status monitoring polling period in milliseconds for a bonding device.
2340 This adds support for PMD slave devices which do not support link status interrupts.
2341 When the mon_period is set to a value greater than 0 then all PMD's which do not support
2342 link status ISR will be queried every polling interval to check if their link status has changed::
2344 testpmd> set bonding mon_period (port_id) (value)
2346 For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms::
2348 testpmd> set bonding mon_period 5 150
2351 set bonding lacp dedicated_queue
2352 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2354 Enable dedicated tx/rx queues on bonding devices slaves to handle LACP control plane traffic
2355 when in mode 4 (link-aggregation-802.3ad)::
2357 testpmd> set bonding lacp dedicated_queues (port_id) (enable|disable)
2360 set bonding agg_mode
2361 ~~~~~~~~~~~~~~~~~~~~
2363 Enable one of the specific aggregators mode when in mode 4 (link-aggregation-802.3ad)::
2365 testpmd> set bonding agg_mode (port_id) (bandwidth|count|stable)
2371 Show the current configuration of a Link Bonding device::
2373 testpmd> show bonding config (port id)
2376 to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4)
2377 in balance mode with a transmission policy of layer 2+3::
2379 testpmd> show bonding config 9
2381 Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23
2383 Active Slaves (3): [1 3 4]
2390 The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
2391 This is mainly useful for debugging purposes.
2392 Reference should be made to the appropriate datasheet for the network card for details on the register addresses
2393 and fields that can be accessed.
2398 Display the value of a port register::
2400 testpmd> read reg (port_id) (address)
2402 For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
2404 testpmd> read reg 0 0xEE00
2405 port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
2410 Display a port register bit field::
2412 testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
2414 For example, reading the lowest two bits from the register in the example above::
2416 testpmd> read regfield 0 0xEE00 0 1
2417 port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
2422 Display a single port register bit::
2424 testpmd> read regbit (port_id) (address) (bit_x)
2426 For example, reading the lowest bit from the register in the example above::
2428 testpmd> read regbit 0 0xEE00 0
2429 port 0 PCI register at offset 0xEE00: bit 0=1
2434 Set the value of a port register::
2436 testpmd> write reg (port_id) (address) (value)
2438 For example, to clear a register::
2440 testpmd> write reg 0 0xEE00 0x0
2441 port 0 PCI register at offset 0xEE00: 0x00000000 (0)
2446 Set bit field of a port register::
2448 testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
2450 For example, writing to the register cleared in the example above::
2452 testpmd> write regfield 0 0xEE00 0 1 2
2453 port 0 PCI register at offset 0xEE00: 0x00000002 (2)
2458 Set single bit value of a port register::
2460 testpmd> write regbit (port_id) (address) (bit_x) (value)
2462 For example, to set the high bit in the register from the example above::
2464 testpmd> write regbit 0 0xEE00 31 1
2465 port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
2467 Traffic Metering and Policing
2468 -----------------------------
2470 The following section shows functions for configuring traffic metering and
2471 policing on the ethernet device through the use of generic ethdev API.
2473 show port traffic management capability
2474 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2476 Show traffic metering and policing capability of the port::
2478 testpmd> show port meter cap (port_id)
2480 add port meter profile (srTCM rfc2967)
2481 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2483 Add meter profile (srTCM rfc2697) to the ethernet device::
2485 testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
2490 * ``profile_id``: ID for the meter profile.
2491 * ``cir``: Committed Information Rate (CIR) (bytes/second).
2492 * ``cbs``: Committed Burst Size (CBS) (bytes).
2493 * ``ebs``: Excess Burst Size (EBS) (bytes).
2495 add port meter profile (trTCM rfc2968)
2496 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2498 Add meter profile (srTCM rfc2698) to the ethernet device::
2500 testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
2501 (cir) (pir) (cbs) (pbs)
2505 * ``profile_id``: ID for the meter profile.
2506 * ``cir``: Committed information rate (bytes/second).
2507 * ``pir``: Peak information rate (bytes/second).
2508 * ``cbs``: Committed burst size (bytes).
2509 * ``pbs``: Peak burst size (bytes).
2511 add port meter profile (trTCM rfc4115)
2512 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2514 Add meter profile (trTCM rfc4115) to the ethernet device::
2516 testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
2517 (cir) (eir) (cbs) (ebs)
2521 * ``profile_id``: ID for the meter profile.
2522 * ``cir``: Committed information rate (bytes/second).
2523 * ``eir``: Excess information rate (bytes/second).
2524 * ``cbs``: Committed burst size (bytes).
2525 * ``ebs``: Excess burst size (bytes).
2527 delete port meter profile
2528 ~~~~~~~~~~~~~~~~~~~~~~~~~
2530 Delete meter profile from the ethernet device::
2532 testpmd> del port meter profile (port_id) (profile_id)
2537 Create new meter object for the ethernet device::
2539 testpmd> create port meter (port_id) (mtr_id) (profile_id) \
2540 (meter_enable) (g_action) (y_action) (r_action) (stats_mask) (shared) \
2541 (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\
2546 * ``mtr_id``: meter object ID.
2547 * ``profile_id``: ID for the meter profile.
2548 * ``meter_enable``: When this parameter has a non-zero value, the meter object
2549 gets enabled at the time of creation, otherwise remains disabled.
2550 * ``g_action``: Policer action for the packet with green color.
2551 * ``y_action``: Policer action for the packet with yellow color.
2552 * ``r_action``: Policer action for the packet with red color.
2553 * ``stats_mask``: Mask of statistics counter types to be enabled for the
2555 * ``shared``: When this parameter has a non-zero value, the meter object is
2556 shared by multiple flows. Otherwise, meter object is used by single flow.
2557 * ``use_pre_meter_color``: When this parameter has a non-zero value, the
2558 input color for the current meter object is determined by the latest meter
2559 object in the same flow. Otherwise, the current meter object uses the
2560 *dscp_table* to determine the input color.
2561 * ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input
2562 color, 0 <= x <= 63.
2567 Enable meter for the ethernet device::
2569 testpmd> enable port meter (port_id) (mtr_id)
2574 Disable meter for the ethernet device::
2576 testpmd> disable port meter (port_id) (mtr_id)
2581 Delete meter for the ethernet device::
2583 testpmd> del port meter (port_id) (mtr_id)
2585 Set port meter profile
2586 ~~~~~~~~~~~~~~~~~~~~~~
2588 Set meter profile for the ethernet device::
2590 testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2592 set port meter dscp table
2593 ~~~~~~~~~~~~~~~~~~~~~~~~~
2595 Set meter dscp table for the ethernet device::
2597 testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0) \
2598 (dscp_tbl_entry1)...(dscp_tbl_entry63)]
2600 set port meter policer action
2601 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2603 Set meter policer action for the ethernet device::
2605 testpmd> set port meter policer action (port_id) (mtr_id) (action_mask) \
2606 (action0) [(action1) (action1)]
2610 * ``action_mask``: Bit mask indicating which policer actions need to be
2611 updated. One or more policer actions can be updated in a single function
2612 invocation. To update the policer action associated with color C, bit
2613 (1 << C) needs to be set in *action_mask* and element at position C
2614 in the *actions* array needs to be valid.
2615 * ``actionx``: Policer action for the color x,
2616 RTE_MTR_GREEN <= x < RTE_MTR_COLORS
2618 set port meter stats mask
2619 ~~~~~~~~~~~~~~~~~~~~~~~~~
2621 Set meter stats mask for the ethernet device::
2623 testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2627 * ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2629 show port meter stats
2630 ~~~~~~~~~~~~~~~~~~~~~
2632 Show meter stats of the ethernet device::
2634 testpmd> show port meter stats (port_id) (mtr_id) (clear)
2638 * ``clear``: Flag that indicates whether the statistics counters should
2639 be cleared (i.e. set to zero) immediately after they have been read or not.
2644 The following section shows functions for configuring traffic management on
2645 on the ethernet device through the use of generic TM API.
2647 show port traffic management capability
2648 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2650 Show traffic management capability of the port::
2652 testpmd> show port tm cap (port_id)
2654 show port traffic management capability (hierarchy level)
2655 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2657 Show traffic management hierarchy level capability of the port::
2659 testpmd> show port tm level cap (port_id) (level_id)
2661 show port traffic management capability (hierarchy node level)
2662 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2664 Show the traffic management hierarchy node capability of the port::
2666 testpmd> show port tm node cap (port_id) (node_id)
2668 show port traffic management hierarchy node type
2669 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2671 Show the port traffic management hierarchy node type::
2673 testpmd> show port tm node type (port_id) (node_id)
2675 show port traffic management hierarchy node stats
2676 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2678 Show the port traffic management hierarchy node statistics::
2680 testpmd> show port tm node stats (port_id) (node_id) (clear)
2684 * ``clear``: When this parameter has a non-zero value, the statistics counters
2685 are cleared (i.e. set to zero) immediately after they have been read,
2686 otherwise the statistics counters are left untouched.
2688 Add port traffic management private shaper profile
2689 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2691 Add the port traffic management private shaper profile::
2693 testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
2694 (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
2695 (packet_length_adjust)
2699 * ``shaper_profile id``: Shaper profile ID for the new profile.
2700 * ``cmit_tb_rate``: Committed token bucket rate (bytes per second).
2701 * ``cmit_tb_size``: Committed token bucket size (bytes).
2702 * ``peak_tb_rate``: Peak token bucket rate (bytes per second).
2703 * ``peak_tb_size``: Peak token bucket size (bytes).
2704 * ``packet_length_adjust``: The value (bytes) to be added to the length of
2705 each packet for the purpose of shaping. This parameter value can be used to
2706 correct the packet length with the framing overhead bytes that are consumed
2709 Delete port traffic management private shaper profile
2710 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2712 Delete the port traffic management private shaper::
2714 testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
2718 * ``shaper_profile id``: Shaper profile ID that needs to be deleted.
2720 Add port traffic management shared shaper
2721 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2723 Create the port traffic management shared shaper::
2725 testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \
2730 * ``shared_shaper_id``: Shared shaper ID to be created.
2731 * ``shaper_profile id``: Shaper profile ID for shared shaper.
2733 Set port traffic management shared shaper
2734 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2736 Update the port traffic management shared shaper::
2738 testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \
2743 * ``shared_shaper_id``: Shared shaper ID to be update.
2744 * ``shaper_profile id``: Shaper profile ID for shared shaper.
2746 Delete port traffic management shared shaper
2747 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2749 Delete the port traffic management shared shaper::
2751 testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
2755 * ``shared_shaper_id``: Shared shaper ID to be deleted.
2757 Set port traffic management hierarchy node private shaper
2758 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2760 set the port traffic management hierarchy node private shaper::
2762 testpmd> set port tm node shaper profile (port_id) (node_id) \
2767 * ``shaper_profile id``: Private shaper profile ID to be enabled on the
2770 Add port traffic management WRED profile
2771 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2773 Create a new WRED profile::
2775 testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
2776 (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
2777 (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
2778 (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
2782 * ``wred_profile id``: Identifier for the newly create WRED profile
2783 * ``color_g``: Packet color (green)
2784 * ``min_th_g``: Minimum queue threshold for packet with green color
2785 * ``max_th_g``: Minimum queue threshold for packet with green color
2786 * ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp)
2787 * ``wq_log2_g``: Negated log2 of queue weight (wq)
2788 * ``color_y``: Packet color (yellow)
2789 * ``min_th_y``: Minimum queue threshold for packet with yellow color
2790 * ``max_th_y``: Minimum queue threshold for packet with yellow color
2791 * ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp)
2792 * ``wq_log2_y``: Negated log2 of queue weight (wq)
2793 * ``color_r``: Packet color (red)
2794 * ``min_th_r``: Minimum queue threshold for packet with yellow color
2795 * ``max_th_r``: Minimum queue threshold for packet with yellow color
2796 * ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp)
2797 * ``wq_log2_r``: Negated log2 of queue weight (wq)
2799 Delete port traffic management WRED profile
2800 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2802 Delete the WRED profile::
2804 testpmd> del port tm node wred profile (port_id) (wred_profile_id)
2806 Add port traffic management hierarchy nonleaf node
2807 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2809 Add nonleaf node to port traffic management hierarchy::
2811 testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \
2812 (priority) (weight) (level_id) (shaper_profile_id) \
2813 (n_sp_priorities) (stats_mask) (n_shared_shapers) \
2814 [(shared_shaper_0) (shared_shaper_1) ...] \
2818 * ``parent_node_id``: Node ID of the parent.
2819 * ``priority``: Node priority (highest node priority is zero). This is used by
2820 the SP algorithm running on the parent node for scheduling this node.
2821 * ``weight``: Node weight (lowest weight is one). The node weight is relative
2822 to the weight sum of all siblings that have the same priority. It is used by
2823 the WFQ algorithm running on the parent node for scheduling this node.
2824 * ``level_id``: Hierarchy level of the node.
2825 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2827 * ``n_sp_priorities``: Number of strict priorities.
2828 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2829 * ``n_shared_shapers``: Number of shared shapers.
2830 * ``shared_shaper_id``: Shared shaper id.
2832 Add port traffic management hierarchy leaf node
2833 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2835 Add leaf node to port traffic management hierarchy::
2837 testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \
2838 (priority) (weight) (level_id) (shaper_profile_id) \
2839 (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \
2840 [(shared_shaper_id) (shared_shaper_id) ...] \
2844 * ``parent_node_id``: Node ID of the parent.
2845 * ``priority``: Node priority (highest node priority is zero). This is used by
2846 the SP algorithm running on the parent node for scheduling this node.
2847 * ``weight``: Node weight (lowest weight is one). The node weight is relative
2848 to the weight sum of all siblings that have the same priority. It is used by
2849 the WFQ algorithm running on the parent node for scheduling this node.
2850 * ``level_id``: Hierarchy level of the node.
2851 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2853 * ``cman_mode``: Congestion management mode to be enabled for this node.
2854 * ``wred_profile_id``: WRED profile id to be enabled for this node.
2855 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2856 * ``n_shared_shapers``: Number of shared shapers.
2857 * ``shared_shaper_id``: Shared shaper id.
2859 Delete port traffic management hierarchy node
2860 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2862 Delete node from port traffic management hierarchy::
2864 testpmd> del port tm node (port_id) (node_id)
2866 Update port traffic management hierarchy parent node
2867 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2869 Update port traffic management hierarchy parent node::
2871 testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \
2874 This function can only be called after the hierarchy commit invocation. Its
2875 success depends on the port support for this operation, as advertised through
2876 the port capability set. This function is valid for all nodes of the traffic
2877 management hierarchy except root node.
2879 Suspend port traffic management hierarchy node
2880 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2882 testpmd> suspend port tm node (port_id) (node_id)
2884 Resume port traffic management hierarchy node
2885 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2887 testpmd> resume port tm node (port_id) (node_id)
2889 Commit port traffic management hierarchy
2890 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2892 Commit the traffic management hierarchy on the port::
2894 testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
2898 * ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function
2899 call failure. On the other hand, hierarchy is preserved when this parameter
2902 Set port traffic management mark VLAN dei
2903 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2905 Enables/Disables the traffic management marking on the port for VLAN packets::
2907 testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red>
2911 * ``port_id``: The port which on which VLAN packets marked as ``green`` or
2912 ``yellow`` or ``red`` will have dei bit enabled
2914 * ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green
2916 * ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow
2918 * ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red
2920 Set port traffic management mark IP dscp
2921 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2923 Enables/Disables the traffic management marking on the port for IP dscp packets::
2925 testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red>
2929 * ``port_id``: The port which on which IP packets marked as ``green`` or
2930 ``yellow`` or ``red`` will have IP dscp bits updated
2932 * ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets
2934 * ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets
2936 * ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets
2938 Set port traffic management mark IP ecn
2939 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2941 Enables/Disables the traffic management marking on the port for IP ecn packets::
2943 testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red>
2947 * ``port_id``: The port which on which IP packets marked as ``green`` or
2948 ``yellow`` or ``red`` will have IP ecn bits updated
2950 * ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01 or 2'b10
2951 to ecn of 2'b11 when IP is caring TCP or SCTP
2953 * ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
2954 to ecn of 2'b11 when IP is caring TCP or SCTP
2956 * ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
2957 to ecn of 2'b11 when IP is caring TCP or SCTP
2959 Set port traffic management default hierarchy (softnic forwarding mode)
2960 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2962 set the traffic management default hierarchy on the port::
2964 testpmd> set port tm hierarchy default (port_id)
2969 This section details the available filter functions that are available.
2971 Note these functions interface the deprecated legacy filtering framework,
2972 superseded by *rte_flow*. See `Flow rules management`_.
2975 ~~~~~~~~~~~~~~~~~~~~
2977 Add or delete a L2 Ethertype filter, which identify packets by their L2 Ethertype mainly assign them to a receive queue::
2979 ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr) (mac_address) \
2980 ethertype (ether_type) (drop|fwd) queue (queue_id)
2982 The available information parameters are:
2984 * ``port_id``: The port which the Ethertype filter assigned on.
2986 * ``mac_addr``: Compare destination mac address.
2988 * ``mac_ignr``: Ignore destination mac address match.
2990 * ``mac_address``: Destination mac address to match.
2992 * ``ether_type``: The EtherType value want to match,
2993 for example 0x0806 for ARP packet. 0x0800 (IPv4) and 0x86DD (IPv6) are invalid.
2995 * ``queue_id``: The receive queue associated with this EtherType filter.
2996 It is meaningless when deleting or dropping.
2998 Example, to add/remove an ethertype filter rule::
3000 testpmd> ethertype_filter 0 add mac_ignr 00:11:22:33:44:55 \
3001 ethertype 0x0806 fwd queue 3
3003 testpmd> ethertype_filter 0 del mac_ignr 00:11:22:33:44:55 \
3004 ethertype 0x0806 fwd queue 3
3009 Add or delete a 2-tuple filter,
3010 which identifies packets by specific protocol and destination TCP/UDP port
3011 and forwards packets into one of the receive queues::
3013 2tuple_filter (port_id) (add|del) dst_port (dst_port_value) \
3014 protocol (protocol_value) mask (mask_value) \
3015 tcp_flags (tcp_flags_value) priority (prio_value) \
3018 The available information parameters are:
3020 * ``port_id``: The port which the 2-tuple filter assigned on.
3022 * ``dst_port_value``: Destination port in L4.
3024 * ``protocol_value``: IP L4 protocol.
3026 * ``mask_value``: Participates in the match or not by bit for field above, 1b means participate.
3028 * ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the pro_value is not set to 0x06 (TCP).
3030 * ``prio_value``: Priority of this filter.
3032 * ``queue_id``: The receive queue associated with this 2-tuple filter.
3034 Example, to add/remove an 2tuple filter rule::
3036 testpmd> 2tuple_filter 0 add dst_port 32 protocol 0x06 mask 0x03 \
3037 tcp_flags 0x02 priority 3 queue 3
3039 testpmd> 2tuple_filter 0 del dst_port 32 protocol 0x06 mask 0x03 \
3040 tcp_flags 0x02 priority 3 queue 3
3045 Add or delete a 5-tuple filter,
3046 which consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port)
3047 and routes packets into one of the receive queues::
3049 5tuple_filter (port_id) (add|del) dst_ip (dst_address) src_ip \
3050 (src_address) dst_port (dst_port_value) \
3051 src_port (src_port_value) protocol (protocol_value) \
3052 mask (mask_value) tcp_flags (tcp_flags_value) \
3053 priority (prio_value) queue (queue_id)
3055 The available information parameters are:
3057 * ``port_id``: The port which the 5-tuple filter assigned on.
3059 * ``dst_address``: Destination IP address.
3061 * ``src_address``: Source IP address.
3063 * ``dst_port_value``: TCP/UDP destination port.
3065 * ``src_port_value``: TCP/UDP source port.
3067 * ``protocol_value``: L4 protocol.
3069 * ``mask_value``: Participates in the match or not by bit for field above, 1b means participate
3071 * ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the protocol_value is not set to 0x06 (TCP).
3073 * ``prio_value``: The priority of this filter.
3075 * ``queue_id``: The receive queue associated with this 5-tuple filter.
3077 Example, to add/remove an 5tuple filter rule::
3079 testpmd> 5tuple_filter 0 add dst_ip 2.2.2.5 src_ip 2.2.2.4 \
3080 dst_port 64 src_port 32 protocol 0x06 mask 0x1F \
3081 flags 0x0 priority 3 queue 3
3083 testpmd> 5tuple_filter 0 del dst_ip 2.2.2.5 src_ip 2.2.2.4 \
3084 dst_port 64 src_port 32 protocol 0x06 mask 0x1F \
3085 flags 0x0 priority 3 queue 3
3090 Using the SYN filter, TCP packets whose *SYN* flag is set can be forwarded to a separate queue::
3092 syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)
3094 The available information parameters are:
3096 * ``port_id``: The port which the SYN filter assigned on.
3098 * ``high``: This SYN filter has higher priority than other filters.
3100 * ``low``: This SYN filter has lower priority than other filters.
3102 * ``queue_id``: The receive queue associated with this SYN filter
3106 testpmd> syn_filter 0 add priority high queue 3
3111 With flex filter, packets can be recognized by any arbitrary pattern within the first 128 bytes of the packet
3112 and routed into one of the receive queues::
3114 flex_filter (port_id) (add|del) len (len_value) bytes (bytes_value) \
3115 mask (mask_value) priority (prio_value) queue (queue_id)
3117 The available information parameters are:
3119 * ``port_id``: The port which the Flex filter is assigned on.
3121 * ``len_value``: Filter length in bytes, no greater than 128.
3123 * ``bytes_value``: A string in hexadecimal, means the value the flex filter needs to match.
3125 * ``mask_value``: A string in hexadecimal, bit 1 means corresponding byte participates in the match.
3127 * ``prio_value``: The priority of this filter.
3129 * ``queue_id``: The receive queue associated with this Flex filter.
3133 testpmd> flex_filter 0 add len 16 bytes 0x00000000000000000000000008060000 \
3134 mask 000C priority 3 queue 3
3136 testpmd> flex_filter 0 del len 16 bytes 0x00000000000000000000000008060000 \
3137 mask 000C priority 3 queue 3
3140 .. _testpmd_flow_director:
3142 flow_director_filter
3143 ~~~~~~~~~~~~~~~~~~~~
3145 The Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues.
3147 Four types of filtering are supported which are referred to as Perfect Match, Signature, Perfect-mac-vlan and
3148 Perfect-tunnel filters, the match mode is set by the ``--pkt-filter-mode`` command-line parameter:
3150 * Perfect match filters.
3151 The hardware checks a match between the masked fields of the received packets and the programmed filters.
3152 The masked fields are for IP flow.
3154 * Signature filters.
3155 The hardware checks a match between a hash-based signature of the masked fields of the received packet.
3157 * Perfect-mac-vlan match filters.
3158 The hardware checks a match between the masked fields of the received packets and the programmed filters.
3159 The masked fields are for MAC VLAN flow.
3161 * Perfect-tunnel match filters.
3162 The hardware checks a match between the masked fields of the received packets and the programmed filters.
3163 The masked fields are for tunnel flow.
3165 * Perfect-raw-flow-type match filters.
3166 The hardware checks a match between the masked fields of the received packets and pre-loaded raw (template) packet.
3167 The masked fields are specified by input sets.
3169 The Flow Director filters can match the different fields for different type of packet: flow type, specific input set
3170 per flow type and the flexible payload.
3172 The Flow Director can also mask out parts of all of these fields so that filters
3173 are only applied to certain fields or parts of the fields.
3175 Note that for raw flow type mode the source and destination fields in the
3176 raw packet buffer need to be presented in a reversed order with respect
3177 to the expected received packets.
3178 For example: IP source and destination addresses or TCP/UDP/SCTP
3179 source and destination ports
3181 Different NICs may have different capabilities, command show port fdir (port_id) can be used to acquire the information.
3183 # Commands to add flow director filters of different flow types::
3185 flow_director_filter (port_id) mode IP (add|del|update) \
3186 flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag) \
3187 src (src_ip_address) dst (dst_ip_address) \
3188 tos (tos_value) proto (proto_value) ttl (ttl_value) \
3189 vlan (vlan_value) flexbytes (flexbytes_value) \
3190 (drop|fwd) pf|vf(vf_id) queue (queue_id) \
3193 flow_director_filter (port_id) mode IP (add|del|update) \
3194 flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp) \
3195 src (src_ip_address) (src_port) \
3196 dst (dst_ip_address) (dst_port) \
3197 tos (tos_value) ttl (ttl_value) \
3198 vlan (vlan_value) flexbytes (flexbytes_value) \
3199 (drop|fwd) queue pf|vf(vf_id) (queue_id) \
3202 flow_director_filter (port_id) mode IP (add|del|update) \
3203 flow (ipv4-sctp|ipv6-sctp) \
3204 src (src_ip_address) (src_port) \
3205 dst (dst_ip_address) (dst_port) \
3206 tos (tos_value) ttl (ttl_value) \
3207 tag (verification_tag) vlan (vlan_value) \
3208 flexbytes (flexbytes_value) (drop|fwd) \
3209 pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
3211 flow_director_filter (port_id) mode IP (add|del|update) flow l2_payload \
3212 ether (ethertype) flexbytes (flexbytes_value) \
3213 (drop|fwd) pf|vf(vf_id) queue (queue_id)
3216 flow_director_filter (port_id) mode MAC-VLAN (add|del|update) \
3217 mac (mac_address) vlan (vlan_value) \
3218 flexbytes (flexbytes_value) (drop|fwd) \
3219 queue (queue_id) fd_id (fd_id_value)
3221 flow_director_filter (port_id) mode Tunnel (add|del|update) \
3222 mac (mac_address) vlan (vlan_value) \
3223 tunnel (NVGRE|VxLAN) tunnel-id (tunnel_id_value) \
3224 flexbytes (flexbytes_value) (drop|fwd) \
3225 queue (queue_id) fd_id (fd_id_value)
3227 flow_director_filter (port_id) mode raw (add|del|update) flow (flow_id) \
3228 (drop|fwd) queue (queue_id) fd_id (fd_id_value) \
3229 packet (packet file name)
3231 For example, to add an ipv4-udp flow type filter::
3233 testpmd> flow_director_filter 0 mode IP add flow ipv4-udp src 2.2.2.3 32 \
3234 dst 2.2.2.5 33 tos 2 ttl 40 vlan 0x1 flexbytes (0x88,0x48) \
3235 fwd pf queue 1 fd_id 1
3237 For example, add an ipv4-other flow type filter::
3239 testpmd> flow_director_filter 0 mode IP add flow ipv4-other src 2.2.2.3 \
3240 dst 2.2.2.5 tos 2 proto 20 ttl 40 vlan 0x1 \
3241 flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
3246 Flush all flow director filters on a device::
3248 testpmd> flush_flow_director (port_id)
3250 Example, to flush all flow director filter on port 0::
3252 testpmd> flush_flow_director 0
3257 Set flow director's input masks::
3259 flow_director_mask (port_id) mode IP vlan (vlan_value) \
3260 src_mask (ipv4_src) (ipv6_src) (src_port) \
3261 dst_mask (ipv4_dst) (ipv6_dst) (dst_port)
3263 flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value)
3265 flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \
3266 mac (mac_value) tunnel-type (tunnel_type_value) \
3267 tunnel-id (tunnel_id_value)
3269 Example, to set flow director mask on port 0::
3271 testpmd> flow_director_mask 0 mode IP vlan 0xefff \
3272 src_mask 255.255.255.255 \
3273 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF \
3274 dst_mask 255.255.255.255 \
3275 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF
3277 flow_director_flex_mask
3278 ~~~~~~~~~~~~~~~~~~~~~~~
3280 set masks of flow director's flexible payload based on certain flow type::
3282 testpmd> flow_director_flex_mask (port_id) \
3283 flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3284 ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
3285 l2_payload|all) (mask)
3287 Example, to set flow director's flex mask for all flow type on port 0::
3289 testpmd> flow_director_flex_mask 0 flow all \
3290 (0xff,0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
3293 flow_director_flex_payload
3294 ~~~~~~~~~~~~~~~~~~~~~~~~~~
3296 Configure flexible payload selection::
3298 flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config)
3300 For example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload::
3302 testpmd> flow_director_flex_payload 0 l4 \
3303 (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
3305 get_sym_hash_ena_per_port
3306 ~~~~~~~~~~~~~~~~~~~~~~~~~
3308 Get symmetric hash enable configuration per port::
3310 get_sym_hash_ena_per_port (port_id)
3312 For example, to get symmetric hash enable configuration of port 1::
3314 testpmd> get_sym_hash_ena_per_port 1
3316 set_sym_hash_ena_per_port
3317 ~~~~~~~~~~~~~~~~~~~~~~~~~
3319 Set symmetric hash enable configuration per port to enable or disable::
3321 set_sym_hash_ena_per_port (port_id) (enable|disable)
3323 For example, to set symmetric hash enable configuration of port 1 to enable::
3325 testpmd> set_sym_hash_ena_per_port 1 enable
3327 get_hash_global_config
3328 ~~~~~~~~~~~~~~~~~~~~~~
3330 Get the global configurations of hash filters::
3332 get_hash_global_config (port_id)
3334 For example, to get the global configurations of hash filters of port 1::
3336 testpmd> get_hash_global_config 1
3338 set_hash_global_config
3339 ~~~~~~~~~~~~~~~~~~~~~~
3341 Set the global configurations of hash filters::
3343 set_hash_global_config (port_id) (toeplitz|simple_xor|default) \
3344 (ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|ipv6-frag| \
3345 ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload|<flow_id>) \
3348 For example, to enable simple_xor for flow type of ipv6 on port 2::
3350 testpmd> set_hash_global_config 2 simple_xor ipv6 enable
3355 Set the input set for hash::
3357 set_hash_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3358 ipv4-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \
3359 l2_payload|<flow_id>) (ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6| \
3360 ipv4-tos|ipv4-proto|ipv6-tc|ipv6-next-header|udp-src-port|udp-dst-port| \
3361 tcp-src-port|tcp-dst-port|sctp-src-port|sctp-dst-port|sctp-veri-tag| \
3362 udp-key|gre-key|fld-1st|fld-2nd|fld-3rd|fld-4th|fld-5th|fld-6th|fld-7th| \
3363 fld-8th|none) (select|add)
3365 For example, to add source IP to hash input set for flow type of ipv4-udp on port 0::
3367 testpmd> set_hash_input_set 0 ipv4-udp src-ipv4 add
3372 The Flow Director filters can match the different fields for different type of packet, i.e. specific input set
3373 on per flow type and the flexible payload. This command can be used to change input set for each flow type.
3375 Set the input set for flow director::
3377 set_fdir_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3378 ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \
3379 l2_payload|<flow_id>) (ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6| \
3380 ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|ipv6-hop-limits| \
3381 tudp-src-port|udp-dst-port|cp-src-port|tcp-dst-port|sctp-src-port| \
3382 sctp-dst-port|sctp-veri-tag|none) (select|add)
3384 For example to add source IP to FD input set for flow type of ipv4-udp on port 0::
3386 testpmd> set_fdir_input_set 0 ipv4-udp src-ipv4 add
3391 Set different GRE key length for input set::
3393 global_config (port_id) gre-key-len (number in bytes)
3395 For example to set GRE key length for input set to 4 bytes on port 0::
3397 testpmd> global_config 0 gre-key-len 4
3400 .. _testpmd_rte_flow:
3402 Flow rules management
3403 ---------------------
3405 Control of the generic flow API (*rte_flow*) is fully exposed through the
3406 ``flow`` command (validation, creation, destruction, queries and operation
3409 Considering *rte_flow* overlaps with all `Filter Functions`_, using both
3410 features simultaneously may cause undefined side-effects and is therefore
3416 Because the ``flow`` command uses dynamic tokens to handle the large number
3417 of possible flow rules combinations, its behavior differs slightly from
3418 other commands, in particular:
3420 - Pressing *?* or the *<tab>* key displays contextual help for the current
3421 token, not that of the entire command.
3423 - Optional and repeated parameters are supported (provided they are listed
3424 in the contextual help).
3426 The first parameter stands for the operation mode. Possible operations and
3427 their general syntax are described below. They are covered in detail in the
3430 - Check whether a flow rule can be created::
3432 flow validate {port_id}
3433 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3434 pattern {item} [/ {item} [...]] / end
3435 actions {action} [/ {action} [...]] / end
3437 - Create a flow rule::
3439 flow create {port_id}
3440 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3441 pattern {item} [/ {item} [...]] / end
3442 actions {action} [/ {action} [...]] / end
3444 - Destroy specific flow rules::
3446 flow destroy {port_id} rule {rule_id} [...]
3448 - Destroy all flow rules::
3450 flow flush {port_id}
3452 - Query an existing flow rule::
3454 flow query {port_id} {rule_id} {action}
3456 - List existing flow rules sorted by priority, filtered by group
3459 flow list {port_id} [group {group_id}] [...]
3461 - Restrict ingress traffic to the defined flow rules::
3463 flow isolate {port_id} {boolean}
3465 Validating flow rules
3466 ~~~~~~~~~~~~~~~~~~~~~
3468 ``flow validate`` reports whether a flow rule would be accepted by the
3469 underlying device in its current state but stops short of creating it. It is
3470 bound to ``rte_flow_validate()``::
3472 flow validate {port_id}
3473 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3474 pattern {item} [/ {item} [...]] / end
3475 actions {action} [/ {action} [...]] / end
3477 If successful, it will show::
3481 Otherwise it will show an error message of the form::
3483 Caught error type [...] ([...]): [...]
3485 This command uses the same parameters as ``flow create``, their format is
3486 described in `Creating flow rules`_.
3488 Check whether redirecting any Ethernet packet received on port 0 to RX queue
3489 index 6 is supported::
3491 testpmd> flow validate 0 ingress pattern eth / end
3492 actions queue index 6 / end
3496 Port 0 does not support TCPv6 rules::
3498 testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end
3500 Caught error type 9 (specific pattern item): Invalid argument
3506 ``flow create`` validates and creates the specified flow rule. It is bound
3507 to ``rte_flow_create()``::
3509 flow create {port_id}
3510 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3511 pattern {item} [/ {item} [...]] / end
3512 actions {action} [/ {action} [...]] / end
3514 If successful, it will return a flow rule ID usable with other commands::
3516 Flow rule #[...] created
3518 Otherwise it will show an error message of the form::
3520 Caught error type [...] ([...]): [...]
3522 Parameters describe in the following order:
3524 - Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens).
3525 - A matching pattern, starting with the *pattern* token and terminated by an
3527 - Actions, starting with the *actions* token and terminated by an *end*
3530 These translate directly to *rte_flow* objects provided as-is to the
3531 underlying functions.
3533 The shortest valid definition only comprises mandatory tokens::
3535 testpmd> flow create 0 pattern end actions end
3537 Note that PMDs may refuse rules that essentially do nothing such as this
3540 **All unspecified object values are automatically initialized to 0.**
3545 These tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3546 specified before the ``pattern`` token.
3548 - ``group {group id}``: priority group.
3549 - ``priority {level}``: priority level within group.
3550 - ``ingress``: rule applies to ingress traffic.
3551 - ``egress``: rule applies to egress traffic.
3552 - ``transfer``: apply rule directly to endpoints found in pattern.
3554 Each instance of an attribute specified several times overrides the previous
3555 value as shown below (group 4 is used)::
3557 testpmd> flow create 0 group 42 group 24 group 4 [...]
3559 Note that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3561 While not specifying a direction is an error, some rules may allow both
3564 Most rules affect RX therefore contain the ``ingress`` token::
3566 testpmd> flow create 0 ingress pattern [...]
3571 A matching pattern starts after the ``pattern`` token. It is made of pattern
3572 items and is terminated by a mandatory ``end`` item.
3574 Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3575 rte_flow_item_type``).
3577 The ``/`` token is used as a separator between pattern items as shown
3580 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3582 Note that protocol items like these must be stacked from lowest to highest
3583 layer to make sense. For instance, the following rule is either invalid or
3584 unlikely to match any packet::
3586 testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3588 More information on these restrictions can be found in the *rte_flow*
3591 Several items support additional specification structures, for example
3592 ``ipv4`` allows specifying source and destination addresses as follows::
3594 testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1
3595 dst is 10.2.0.0 / end [...]
3597 This rule matches all IPv4 traffic with the specified properties.
3599 In this example, ``src`` and ``dst`` are field names of the underlying
3600 ``struct rte_flow_item_ipv4`` object. All item properties can be specified
3601 in a similar fashion.
3603 The ``is`` token means that the subsequent value must be matched exactly,
3604 and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3605 accordingly. Possible assignment tokens are:
3607 - ``is``: match value perfectly (with full bit-mask).
3608 - ``spec``: match value according to configured bit-mask.
3609 - ``last``: specify upper bound to establish a range.
3610 - ``mask``: specify bit-mask with relevant bits set to one.
3611 - ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one.
3613 These yield identical results::
3615 ipv4 src is 10.1.1.1
3619 ipv4 src spec 10.1.1.1 src mask 255.255.255.255
3623 ipv4 src spec 10.1.1.1 src prefix 32
3627 ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value
3631 ipv4 src is 10.1.1.1 src last 0 # 0 disables range
3633 Inclusive ranges can be defined with ``last``::
3635 ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4
3637 Note that ``mask`` affects both ``spec`` and ``last``::
3639 ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0
3640 # matches 10.1.0.0 to 10.2.255.255
3642 Properties can be modified multiple times::
3644 ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4
3648 ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16
3653 This section lists supported pattern items and their attributes, if any.
3655 - ``end``: end list of pattern items.
3657 - ``void``: no-op pattern item.
3659 - ``invert``: perform actions when pattern does not match.
3661 - ``any``: match any protocol for the current layer.
3663 - ``num {unsigned}``: number of layers covered.
3665 - ``pf``: match traffic from/to the physical function.
3667 - ``vf``: match traffic from/to a virtual function ID.
3669 - ``id {unsigned}``: VF ID.
3671 - ``phy_port``: match traffic from/to a specific physical port.
3673 - ``index {unsigned}``: physical port index.
3675 - ``port_id``: match traffic from/to a given DPDK port ID.
3677 - ``id {unsigned}``: DPDK port ID.
3679 - ``mark``: match value set in previously matched flow rule using the mark action.
3681 - ``id {unsigned}``: arbitrary integer value.
3683 - ``raw``: match an arbitrary byte string.
3685 - ``relative {boolean}``: look for pattern after the previous item.
3686 - ``search {boolean}``: search pattern from offset (see also limit).
3687 - ``offset {integer}``: absolute or relative offset for pattern.
3688 - ``limit {unsigned}``: search area limit for start of pattern.
3689 - ``pattern {string}``: byte string to look for.
3691 - ``eth``: match Ethernet header.
3693 - ``dst {MAC-48}``: destination MAC.
3694 - ``src {MAC-48}``: source MAC.
3695 - ``type {unsigned}``: EtherType or TPID.
3697 - ``vlan``: match 802.1Q/ad VLAN tag.
3699 - ``tci {unsigned}``: tag control information.
3700 - ``pcp {unsigned}``: priority code point.
3701 - ``dei {unsigned}``: drop eligible indicator.
3702 - ``vid {unsigned}``: VLAN identifier.
3703 - ``inner_type {unsigned}``: inner EtherType or TPID.
3705 - ``ipv4``: match IPv4 header.
3707 - ``tos {unsigned}``: type of service.
3708 - ``ttl {unsigned}``: time to live.
3709 - ``proto {unsigned}``: next protocol ID.
3710 - ``src {ipv4 address}``: source address.
3711 - ``dst {ipv4 address}``: destination address.
3713 - ``ipv6``: match IPv6 header.
3715 - ``tc {unsigned}``: traffic class.
3716 - ``flow {unsigned}``: flow label.
3717 - ``proto {unsigned}``: protocol (next header).
3718 - ``hop {unsigned}``: hop limit.
3719 - ``src {ipv6 address}``: source address.
3720 - ``dst {ipv6 address}``: destination address.
3722 - ``icmp``: match ICMP header.
3724 - ``type {unsigned}``: ICMP packet type.
3725 - ``code {unsigned}``: ICMP packet code.
3727 - ``udp``: match UDP header.
3729 - ``src {unsigned}``: UDP source port.
3730 - ``dst {unsigned}``: UDP destination port.
3732 - ``tcp``: match TCP header.
3734 - ``src {unsigned}``: TCP source port.
3735 - ``dst {unsigned}``: TCP destination port.
3737 - ``sctp``: match SCTP header.
3739 - ``src {unsigned}``: SCTP source port.
3740 - ``dst {unsigned}``: SCTP destination port.
3741 - ``tag {unsigned}``: validation tag.
3742 - ``cksum {unsigned}``: checksum.
3744 - ``vxlan``: match VXLAN header.
3746 - ``vni {unsigned}``: VXLAN identifier.
3748 - ``e_tag``: match IEEE 802.1BR E-Tag header.
3750 - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
3752 - ``nvgre``: match NVGRE header.
3754 - ``tni {unsigned}``: virtual subnet ID.
3756 - ``mpls``: match MPLS header.
3758 - ``label {unsigned}``: MPLS label.
3760 - ``gre``: match GRE header.
3762 - ``protocol {unsigned}``: protocol type.
3764 - ``fuzzy``: fuzzy pattern match, expect faster than default.
3766 - ``thresh {unsigned}``: accuracy threshold.
3768 - ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header.
3770 - ``teid {unsigned}``: tunnel endpoint identifier.
3772 - ``geneve``: match GENEVE header.
3774 - ``vni {unsigned}``: virtual network identifier.
3775 - ``protocol {unsigned}``: protocol type.
3777 - ``vxlan-gpe``: match VXLAN-GPE header.
3779 - ``vni {unsigned}``: VXLAN-GPE identifier.
3781 - ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4.
3783 - ``sha {MAC-48}``: sender hardware address.
3784 - ``spa {ipv4 address}``: sender IPv4 address.
3785 - ``tha {MAC-48}``: target hardware address.
3786 - ``tpa {ipv4 address}``: target IPv4 address.
3788 - ``ipv6_ext``: match presence of any IPv6 extension header.
3790 - ``next_hdr {unsigned}``: next header.
3792 - ``icmp6``: match any ICMPv6 header.
3794 - ``type {unsigned}``: ICMPv6 type.
3795 - ``code {unsigned}``: ICMPv6 code.
3797 - ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
3799 - ``target_addr {ipv6 address}``: target address.
3801 - ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement.
3803 - ``target_addr {ipv6 address}``: target address.
3805 - ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option.
3807 - ``type {unsigned}``: ND option type.
3809 - ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet
3810 link-layer address option.
3812 - ``sla {MAC-48}``: source Ethernet LLA.
3814 - ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet
3815 link-layer address option.
3817 - ``tla {MAC-48}``: target Ethernet LLA.
3819 - ``meta``: match application specific metadata.
3821 - ``data {unsigned}``: metadata value.
3826 A list of actions starts after the ``actions`` token in the same fashion as
3827 `Matching pattern`_; actions are separated by ``/`` tokens and the list is
3828 terminated by a mandatory ``end`` action.
3830 Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
3831 rte_flow_action_type``).
3833 Dropping all incoming UDPv4 packets can be expressed as follows::
3835 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3838 Several actions have configurable properties which must be specified when
3839 there is no valid default value. For example, ``queue`` requires a target
3842 This rule redirects incoming UDPv4 traffic to queue index 6::
3844 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3845 actions queue index 6 / end
3847 While this one could be rejected by PMDs (unspecified queue index)::
3849 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3852 As defined by *rte_flow*, the list is not ordered, all actions of a given
3853 rule are performed simultaneously. These are equivalent::
3855 queue index 6 / void / mark id 42 / end
3859 void / mark id 42 / queue index 6 / end
3861 All actions in a list should have different types, otherwise only the last
3862 action of a given type is taken into account::
3864 queue index 4 / queue index 5 / queue index 6 / end # will use queue 6
3868 drop / drop / drop / end # drop is performed only once
3872 mark id 42 / queue index 3 / mark id 24 / end # mark will be 24
3874 Considering they are performed simultaneously, opposite and overlapping
3875 actions can sometimes be combined when the end result is unambiguous::
3877 drop / queue index 6 / end # drop has no effect
3881 queue index 6 / rss queues 6 7 8 / end # queue has no effect
3885 drop / passthru / end # drop has no effect
3887 Note that PMDs may still refuse such combinations.
3892 This section lists supported actions and their attributes, if any.
3894 - ``end``: end list of actions.
3896 - ``void``: no-op action.
3898 - ``passthru``: let subsequent rule process matched packets.
3900 - ``jump``: redirect traffic to group on device.
3902 - ``group {unsigned}``: group to redirect to.
3904 - ``mark``: attach 32 bit value to packets.
3906 - ``id {unsigned}``: 32 bit value to return with packets.
3908 - ``flag``: flag packets.
3910 - ``queue``: assign packets to a given queue index.
3912 - ``index {unsigned}``: queue index to use.
3914 - ``drop``: drop packets (note: passthru has priority).
3916 - ``count``: enable counters for this rule.
3918 - ``rss``: spread packets among several queues.
3920 - ``func {hash function}``: RSS hash function to apply, allowed tokens are
3921 the same as `set_hash_global_config`_.
3923 - ``level {unsigned}``: encapsulation level for ``types``.
3925 - ``types [{RSS hash type} [...]] end``: specific RSS hash types, allowed
3926 tokens are the same as `set_hash_input_set`_, except that an empty list
3927 does not disable RSS but instead requests unspecified "best-effort"
3930 - ``key {string}``: RSS hash key, overrides ``key_len``.
3932 - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in
3933 conjunction with ``key`` to pad or truncate it.
3935 - ``queues [{unsigned} [...]] end``: queue indices to use.
3937 - ``pf``: direct traffic to physical function.
3939 - ``vf``: direct traffic to a virtual function ID.
3941 - ``original {boolean}``: use original VF ID if possible.
3942 - ``id {unsigned}``: VF ID.
3944 - ``phy_port``: direct packets to physical port index.
3946 - ``original {boolean}``: use original port index if possible.
3947 - ``index {unsigned}``: physical port index.
3949 - ``port_id``: direct matching traffic to a given DPDK port ID.
3951 - ``original {boolean}``: use original DPDK port ID if possible.
3952 - ``id {unsigned}``: DPDK port ID.
3954 - ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``.
3956 - ``mpls_ttl``: MPLS TTL.
3958 - ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``.
3960 - ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``.
3962 - ``nw_ttl``: IP TTL.
3964 - ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``.
3966 - ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``.
3968 - ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``.
3970 - ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``.
3972 - ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``.
3974 - ``ethertype``: Ethertype.
3976 - ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``.
3978 - ``vlan_vid``: VLAN id.
3980 - ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``.
3982 - ``vlan_pcp``: VLAN priority.
3984 - ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``.
3986 - ``ethertype``: Ethertype.
3988 - ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``.
3990 - ``ethertype``: Ethertype.
3992 - ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration
3993 is done through `Config VXLAN Encap outer layers`_.
3995 - ``vxlan_decap``: Performs a decapsulation action by stripping all headers of
3996 the VXLAN tunnel network overlay from the matched flow.
3998 - ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration
3999 is done through `Config NVGRE Encap outer layers`_.
4001 - ``nvgre_decap``: Performs a decapsulation action by stripping all headers of
4002 the NVGRE tunnel network overlay from the matched flow.
4004 - ``l2_encap``: Performs a L2 encapsulation, L2 configuration
4005 is done through `Config L2 Encap`_.
4007 - ``l2_decap``: Performs a L2 decapsulation, L2 configuration
4008 is done through `Config L2 Decap`_.
4010 - ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer
4011 configuration is done through `Config MPLSoGRE Encap outer layers`_.
4013 - ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer
4014 configuration is done through `Config MPLSoGRE Decap outer layers`_.
4016 - ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer
4017 configuration is done through `Config MPLSoUDP Encap outer layers`_.
4019 - ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer
4020 configuration is done through `Config MPLSoUDP Decap outer layers`_.
4022 - ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header.
4024 - ``ipv4_addr``: New IPv4 source address.
4026 - ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4
4029 - ``ipv4_addr``: New IPv4 destination address.
4031 - ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header.
4033 - ``ipv6_addr``: New IPv6 source address.
4035 - ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6
4038 - ``ipv6_addr``: New IPv6 destination address.
4040 - ``set_tp_src``: Set a new source port number in the outermost TCP/UDP
4043 - ``port``: New TCP/UDP source port number.
4045 - ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP
4048 - ``port``: New TCP/UDP destination port number.
4050 - ``mac_swap``: Swap the source and destination MAC addresses in the outermost
4053 - ``dec_ttl``: Performs a decrease TTL value action
4055 - ``set_ttl``: Set TTL value with specified value
4056 - ``ttl_value {unsigned}``: The new TTL value to be set
4058 - ``set_mac_src``: set source MAC address
4060 - ``mac_addr {MAC-48}``: new source MAC address
4062 - ``set_mac_dst``: set destination MAC address
4064 - ``mac_addr {MAC-48}``: new destination MAC address
4066 Destroying flow rules
4067 ~~~~~~~~~~~~~~~~~~~~~
4069 ``flow destroy`` destroys one or more rules from their rule ID (as returned
4070 by ``flow create``), this command calls ``rte_flow_destroy()`` as many
4071 times as necessary::
4073 flow destroy {port_id} rule {rule_id} [...]
4075 If successful, it will show::
4077 Flow rule #[...] destroyed
4079 It does not report anything for rule IDs that do not exist. The usual error
4080 message is shown when a rule cannot be destroyed::
4082 Caught error type [...] ([...]): [...]
4084 ``flow flush`` destroys all rules on a device and does not take extra
4085 arguments. It is bound to ``rte_flow_flush()``::
4087 flow flush {port_id}
4089 Any errors are reported as above.
4091 Creating several rules and destroying them::
4093 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4094 actions queue index 2 / end
4095 Flow rule #0 created
4096 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4097 actions queue index 3 / end
4098 Flow rule #1 created
4099 testpmd> flow destroy 0 rule 0 rule 1
4100 Flow rule #1 destroyed
4101 Flow rule #0 destroyed
4104 The same result can be achieved using ``flow flush``::
4106 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4107 actions queue index 2 / end
4108 Flow rule #0 created
4109 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4110 actions queue index 3 / end
4111 Flow rule #1 created
4112 testpmd> flow flush 0
4115 Non-existent rule IDs are ignored::
4117 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4118 actions queue index 2 / end
4119 Flow rule #0 created
4120 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4121 actions queue index 3 / end
4122 Flow rule #1 created
4123 testpmd> flow destroy 0 rule 42 rule 10 rule 2
4125 testpmd> flow destroy 0 rule 0
4126 Flow rule #0 destroyed
4132 ``flow query`` queries a specific action of a flow rule having that
4133 ability. Such actions collect information that can be reported using this
4134 command. It is bound to ``rte_flow_query()``::
4136 flow query {port_id} {rule_id} {action}
4138 If successful, it will display either the retrieved data for known actions
4139 or the following message::
4141 Cannot display result for action type [...] ([...])
4143 Otherwise, it will complain either that the rule does not exist or that some
4146 Flow rule #[...] not found
4150 Caught error type [...] ([...]): [...]
4152 Currently only the ``count`` action is supported. This action reports the
4153 number of packets that hit the flow rule and the total number of bytes. Its
4154 output has the following format::
4157 hits_set: [...] # whether "hits" contains a valid value
4158 bytes_set: [...] # whether "bytes" contains a valid value
4159 hits: [...] # number of packets
4160 bytes: [...] # number of bytes
4162 Querying counters for TCPv6 packets redirected to queue 6::
4164 testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end
4165 actions queue index 6 / count / end
4166 Flow rule #4 created
4167 testpmd> flow query 0 4 count
4178 ``flow list`` lists existing flow rules sorted by priority and optionally
4179 filtered by group identifiers::
4181 flow list {port_id} [group {group_id}] [...]
4183 This command only fails with the following message if the device does not
4188 Output consists of a header line followed by a short description of each
4189 flow rule, one per line. There is no output at all when no flow rules are
4190 configured on the device::
4192 ID Group Prio Attr Rule
4193 [...] [...] [...] [...] [...]
4195 ``Attr`` column flags:
4197 - ``i`` for ``ingress``.
4198 - ``e`` for ``egress``.
4200 Creating several flow rules and listing them::
4202 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4203 actions queue index 6 / end
4204 Flow rule #0 created
4205 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4206 actions queue index 2 / end
4207 Flow rule #1 created
4208 testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end
4209 actions rss queues 6 7 8 end / end
4210 Flow rule #2 created
4211 testpmd> flow list 0
4212 ID Group Prio Attr Rule
4213 0 0 0 i- ETH IPV4 => QUEUE
4214 1 0 0 i- ETH IPV6 => QUEUE
4215 2 0 5 i- ETH IPV4 UDP => RSS
4218 Rules are sorted by priority (i.e. group ID first, then priority level)::
4220 testpmd> flow list 1
4221 ID Group Prio Attr Rule
4222 0 0 0 i- ETH => COUNT
4223 6 0 500 i- ETH IPV6 TCP => DROP COUNT
4224 5 0 1000 i- ETH IPV6 ICMP => QUEUE
4225 1 24 0 i- ETH IPV4 UDP => QUEUE
4226 4 24 10 i- ETH IPV4 TCP => DROP
4227 3 24 20 i- ETH IPV4 => DROP
4228 2 24 42 i- ETH IPV4 UDP => QUEUE
4229 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE
4232 Output can be limited to specific groups::
4234 testpmd> flow list 1 group 0 group 63
4235 ID Group Prio Attr Rule
4236 0 0 0 i- ETH => COUNT
4237 6 0 500 i- ETH IPV6 TCP => DROP COUNT
4238 5 0 1000 i- ETH IPV6 ICMP => QUEUE
4239 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE
4242 Toggling isolated mode
4243 ~~~~~~~~~~~~~~~~~~~~~~
4245 ``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4246 must only be injected from the defined flow rules; that no default traffic
4247 is expected outside those rules and the driver is free to assign more
4248 resources to handle them. It is bound to ``rte_flow_isolate()``::
4250 flow isolate {port_id} {boolean}
4252 If successful, enabling or disabling isolated mode shows either::
4254 Ingress traffic on port [...]
4255 is now restricted to the defined flow rules
4259 Ingress traffic on port [...]
4260 is not restricted anymore to the defined flow rules
4262 Otherwise, in case of error::
4264 Caught error type [...] ([...]): [...]
4266 Mainly due to its side effects, PMDs supporting this mode may not have the
4267 ability to toggle it more than once without reinitializing affected ports
4268 first (e.g. by exiting testpmd).
4270 Enabling isolated mode::
4272 testpmd> flow isolate 0 true
4273 Ingress traffic on port 0 is now restricted to the defined flow rules
4276 Disabling isolated mode::
4278 testpmd> flow isolate 0 false
4279 Ingress traffic on port 0 is not restricted anymore to the defined flow rules
4282 Sample QinQ flow rules
4283 ~~~~~~~~~~~~~~~~~~~~~~
4285 Before creating QinQ rule(s) the following commands should be issued to enable QinQ::
4287 testpmd> port stop 0
4288 testpmd> vlan set qinq on 0
4290 The above command sets the inner and outer TPID's to 0x8100.
4292 To change the TPID's the following commands should be used::
4294 testpmd> vlan set outer tpid 0xa100 0
4295 testpmd> vlan set inner tpid 0x9100 0
4296 testpmd> port start 0
4298 Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
4302 testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 /
4303 vlan tci is 456 / end actions vf id 1 / queue index 0 / end
4304 Flow rule #0 validated
4306 testpmd> flow create 0 ingress pattern eth / vlan tci is 4 /
4307 vlan tci is 456 / end actions vf id 123 / queue index 0 / end
4308 Flow rule #0 created
4310 testpmd> flow list 0
4311 ID Group Prio Attr Rule
4312 0 0 0 i- ETH VLAN VLAN=>VF QUEUE
4314 Validate and create a QinQ rule on port 0 to steer traffic to a queue on the host.
4318 testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 /
4319 vlan tci is 654 / end actions pf / queue index 0 / end
4320 Flow rule #1 validated
4322 testpmd> flow create 0 ingress pattern eth / vlan tci is 321 /
4323 vlan tci is 654 / end actions pf / queue index 1 / end
4324 Flow rule #1 created
4326 testpmd> flow list 0
4327 ID Group Prio Attr Rule
4328 0 0 0 i- ETH VLAN VLAN=>VF QUEUE
4329 1 0 0 i- ETH VLAN VLAN=>PF QUEUE
4331 Sample VXLAN encapsulation rule
4332 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4334 VXLAN encapsulation outer layer has default value pre-configured in testpmd
4335 source code, those can be changed by using the following commands
4337 IPv4 VXLAN outer header::
4339 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
4340 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4341 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4344 testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src
4345 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4346 eth-dst 22:22:22:22:22:22
4347 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4350 IPv6 VXLAN outer header::
4352 testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1
4353 ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4354 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4357 testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4358 ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11
4359 eth-dst 22:22:22:22:22:22
4360 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4363 Sample NVGRE encapsulation rule
4364 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4366 NVGRE encapsulation outer layer has default value pre-configured in testpmd
4367 source code, those can be changed by using the following commands
4369 IPv4 NVGRE outer header::
4371 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
4372 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4373 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4376 testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1
4377 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4378 eth-dst 22:22:22:22:22:22
4379 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4382 IPv6 NVGRE outer header::
4384 testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4385 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4386 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4389 testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4390 vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4391 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4394 Sample L2 encapsulation rule
4395 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4397 L2 encapsulation has default value pre-configured in testpmd
4398 source code, those can be changed by using the following commands
4402 testpmd> set l2_encap ip-version ipv4
4403 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4404 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4405 mplsoudp_decap / l2_encap / end
4407 L2 with VXLAN header::
4409 testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34
4410 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4411 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4412 mplsoudp_decap / l2_encap / end
4414 Sample L2 decapsulation rule
4415 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4417 L2 decapsulation has default value pre-configured in testpmd
4418 source code, those can be changed by using the following commands
4422 testpmd> set l2_decap
4423 testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap /
4426 L2 with VXLAN header::
4428 testpmd> set l2_encap-with-vlan
4429 testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap /
4432 Sample MPLSoGRE encapsulation rule
4433 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4435 MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
4436 source code, those can be changed by using the following commands
4438 IPv4 MPLSoGRE outer header::
4440 testpmd> set mplsogre_encap ip-version ipv4 label 4
4441 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4442 eth-dst 22:22:22:22:22:22
4443 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4444 mplsogre_encap / end
4446 IPv4 MPLSoGRE with VLAN outer header::
4448 testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4
4449 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4450 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4451 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4452 mplsogre_encap / end
4454 IPv6 MPLSoGRE outer header::
4456 testpmd> set mplsogre_encap ip-version ipv6 mask 4
4457 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4458 eth-dst 22:22:22:22:22:22
4459 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4460 mplsogre_encap / end
4462 IPv6 MPLSoGRE with VLAN outer header::
4464 testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4
4465 ip-src ::1 ip-dst ::2222 vlan-tci 34
4466 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4467 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4468 mplsogre_encap / end
4470 Sample MPLSoGRE decapsulation rule
4471 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4473 MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
4474 source code, those can be changed by using the following commands
4476 IPv4 MPLSoGRE outer header::
4478 testpmd> set mplsogre_decap ip-version ipv4
4479 testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions
4480 mplsogre_decap / l2_encap / end
4482 IPv4 MPLSoGRE with VLAN outer header::
4484 testpmd> set mplsogre_decap-with-vlan ip-version ipv4
4485 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end
4486 actions mplsogre_decap / l2_encap / end
4488 IPv6 MPLSoGRE outer header::
4490 testpmd> set mplsogre_decap ip-version ipv6
4491 testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end
4492 actions mplsogre_decap / l2_encap / end
4494 IPv6 MPLSoGRE with VLAN outer header::
4496 testpmd> set mplsogre_decap-with-vlan ip-version ipv6
4497 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end
4498 actions mplsogre_decap / l2_encap / end
4500 Sample MPLSoUDP encapsulation rule
4501 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4503 MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
4504 source code, those can be changed by using the following commands
4506 IPv4 MPLSoUDP outer header::
4508 testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10
4509 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4510 eth-dst 22:22:22:22:22:22
4511 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4512 mplsoudp_encap / end
4514 IPv4 MPLSoUDP with VLAN outer header::
4516 testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5
4517 udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4518 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4519 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4520 mplsoudp_encap / end
4522 IPv6 MPLSoUDP outer header::
4524 testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10
4525 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4526 eth-dst 22:22:22:22:22:22
4527 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4528 mplsoudp_encap / end
4530 IPv6 MPLSoUDP with VLAN outer header::
4532 testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5
4533 udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34
4534 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4535 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4536 mplsoudp_encap / end
4538 Sample MPLSoUDP decapsulation rule
4539 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4541 MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
4542 source code, those can be changed by using the following commands
4544 IPv4 MPLSoUDP outer header::
4546 testpmd> set mplsoudp_decap ip-version ipv4
4547 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4548 mplsoudp_decap / l2_encap / end
4550 IPv4 MPLSoUDP with VLAN outer header::
4552 testpmd> set mplsoudp_decap-with-vlan ip-version ipv4
4553 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end
4554 actions mplsoudp_decap / l2_encap / end
4556 IPv6 MPLSoUDP outer header::
4558 testpmd> set mplsoudp_decap ip-version ipv6
4559 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end
4560 actions mplsoudp_decap / l2_encap / end
4562 IPv6 MPLSoUDP with VLAN outer header::
4564 testpmd> set mplsoudp_decap-with-vlan ip-version ipv6
4565 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end
4566 actions mplsoudp_decap / l2_encap / end
4571 The following sections show functions to load/unload eBPF based filters.
4576 Load an eBPF program as a callback for particular RX/TX queue::
4578 testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename)
4580 The available load-flags are:
4582 * ``J``: use JIT generated native code, otherwise BPF interpreter will be used.
4584 * ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data.
4590 You'll need clang v3.7 or above to build bpf program you'd like to load
4594 .. code-block:: console
4597 clang -O2 -target bpf -c t1.c
4599 Then to load (and JIT compile) t1.o at RX queue 0, port 1:
4601 .. code-block:: console
4603 testpmd> bpf-load rx 1 0 J ./dpdk.org/test/bpf/t1.o
4605 To load (not JITed) t1.o at TX queue 0, port 0:
4607 .. code-block:: console
4609 testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o
4614 Unload previously loaded eBPF program for particular RX/TX queue::
4616 testpmd> bpf-unload rx|tx (portid) (queueid)
4618 For example to unload BPF filter from TX queue 0, port 0:
4620 .. code-block:: console
4622 testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o