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|dcb_tc|cap X
28 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all
29 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap X
30 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all
36 Some examples in this document are too long to fit on one line are shown wrapped at `"\\"` for display purposes::
38 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
39 (pause_time) (send_xon) (port_id)
41 In the real ``testpmd>`` prompt these commands should be on a single line.
46 The testpmd has on-line help for the functions that are available at runtime.
47 These are divided into sections and can be accessed using help, help section or help all:
49 .. code-block:: console
52 Help is available for the following sections:
54 help control : Start and stop forwarding.
55 help display : Displaying port, stats and config information.
56 help config : Configuration information.
57 help ports : Configuring ports.
58 help registers : Reading and setting port registers.
59 help filters : Filters configuration help.
60 help traffic_management : Traffic Management commands.
61 help devices : Device related commands.
62 help drivers : Driver specific commands.
63 help all : All of the above sections.
65 Command File Functions
66 ----------------------
68 To facilitate loading large number of commands or to avoid cutting and pasting where not
69 practical or possible testpmd supports alternative methods for executing commands.
71 * If started with the ``--cmdline-file=FILENAME`` command line argument testpmd
72 will execute all CLI commands contained within the file immediately before
73 starting packet forwarding or entering interactive mode.
75 .. code-block:: console
77 ./dpdk-testpmd -n4 -r2 ... -- -i --cmdline-file=/home/ubuntu/flow-create-commands.txt
78 Interactive-mode selected
79 CLI commands to be read from /home/ubuntu/flow-create-commands.txt
80 Configuring Port 0 (socket 0)
81 Port 0: 7C:FE:90:CB:74:CE
82 Configuring Port 1 (socket 0)
83 Port 1: 7C:FE:90:CB:74:CA
84 Checking link statuses...
85 Port 0 Link Up - speed 10000 Mbps - full-duplex
86 Port 1 Link Up - speed 10000 Mbps - full-duplex
92 Flow rule #498 created
93 Flow rule #499 created
94 Read all CLI commands from /home/ubuntu/flow-create-commands.txt
98 * At run-time additional commands can be loaded in bulk by invoking the ``load FILENAME``
101 .. code-block:: console
103 testpmd> load /home/ubuntu/flow-create-commands.txt
108 Flow rule #498 created
109 Flow rule #499 created
110 Read all CLI commands from /home/ubuntu/flow-create-commands.txt
114 In all cases output from any included command will be displayed as standard output.
115 Execution will continue until the end of the file is reached regardless of
116 whether any errors occur. The end user must examine the output to determine if
117 any failures occurred.
126 Start packet forwarding with current configuration::
133 Start packet forwarding with current configuration after sending specified number of bursts of packets::
135 testpmd> start tx_first (""|burst_num)
137 The default burst number is 1 when ``burst_num`` not presented.
142 Stop packet forwarding, and display accumulated statistics::
157 The functions in the following sections are used to display information about the
158 testpmd configuration or the NIC status.
163 Display information for a given port or all ports::
165 testpmd> show port (info|summary|stats|xstats|fdir|dcb_tc|cap) (port_id|all)
167 The available information categories are:
169 * ``info``: General port information such as MAC address.
171 * ``summary``: Brief port summary such as Device Name, Driver Name etc.
173 * ``stats``: RX/TX statistics.
175 * ``xstats``: RX/TX extended NIC statistics.
177 * ``fdir``: Flow Director information and statistics.
179 * ``dcb_tc``: DCB information such as TC mapping.
183 .. code-block:: console
185 testpmd> show port info 0
187 ********************* Infos for port 0 *********************
189 MAC address: XX:XX:XX:XX:XX:XX
191 memory allocation on the socket: 0
193 Link speed: 40000 Mbps
194 Link duplex: full-duplex
195 Promiscuous mode: enabled
196 Allmulticast mode: disabled
197 Maximum number of MAC addresses: 64
198 Maximum number of MAC addresses of hash filtering: 0
200 strip on, filter on, extend off, qinq strip off
201 Redirection table size: 512
202 Supported flow types:
220 show port (module_eeprom|eeprom)
221 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223 Display the EEPROM information of a port::
225 testpmd> show port (port_id) (module_eeprom|eeprom)
230 Display the rss redirection table entry indicated by masks on port X::
232 testpmd> show port (port_id) rss reta (size) (mask0, mask1...)
234 size is used to indicate the hardware supported reta size
239 Display the RSS hash functions and RSS hash key of a port::
241 testpmd> show port (port_id) rss-hash [key]
246 Clear the port statistics and forward engine statistics for a given port or for all ports::
248 testpmd> clear port (info|stats|xstats|fdir) (port_id|all)
252 testpmd> clear port stats all
257 Display information for a given port's RX/TX queue::
259 testpmd> show (rxq|txq) info (port_id) (queue_id)
261 show desc status(rxq|txq)
262 ~~~~~~~~~~~~~~~~~~~~~~~~~
264 Display information for a given port's RX/TX descriptor status::
266 testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status
268 show rxq desc used count
269 ~~~~~~~~~~~~~~~~~~~~~~~~
271 Display the number of receive packet descriptors currently filled by hardware
272 and ready to be processed by the driver on a given RX queue::
274 testpmd> show port (port_id) rxq (queue_id) desc used count
279 Displays the configuration of the application.
280 The configuration comes from the command-line, the runtime or the application defaults::
282 testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|txpkts|txtimes)
284 The available information categories are:
286 * ``rxtx``: RX/TX configuration items.
288 * ``cores``: List of forwarding cores.
290 * ``fwd``: Packet forwarding configuration.
292 * ``rxoffs``: Packet offsets for RX split.
294 * ``rxpkts``: Packets to RX split configuration.
296 * ``txpkts``: Packets to TX configuration.
298 * ``txtimes``: Burst time pattern for Tx only mode.
302 .. code-block:: console
304 testpmd> show config rxtx
306 io packet forwarding - CRC stripping disabled - packets/burst=16
307 nb forwarding cores=2 - nb forwarding ports=1
308 RX queues=1 - RX desc=128 - RX free threshold=0
309 RX threshold registers: pthresh=8 hthresh=8 wthresh=4
310 TX queues=1 - TX desc=512 - TX free threshold=0
311 TX threshold registers: pthresh=36 hthresh=0 wthresh=0
312 TX RS bit threshold=0 - TXQ flags=0x0
317 Set the packet forwarding mode::
319 testpmd> set fwd (io|mac|macswap|flowgen| \
320 rxonly|txonly|csum|icmpecho|noisy|5tswap|shared-rxq) (""|retry)
322 ``retry`` can be specified for forwarding engines except ``rx_only``.
324 The available information categories are:
326 * ``io``: Forwards packets "as-is" in I/O mode.
327 This is the fastest possible forwarding operation as it does not access packets data.
328 This is the default mode.
330 * ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them.
331 Default application behavior is to set source Ethernet address to that of the transmitting interface, and destination
332 address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or
333 'eth-peers-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address.
335 * ``macswap``: MAC swap forwarding mode.
336 Swaps the source and the destination Ethernet addresses of packets before forwarding them.
338 * ``flowgen``: Multi-flow generation mode.
339 Originates a number of flows (with varying destination IP addresses), and terminate receive traffic.
341 * ``rxonly``: Receives packets but doesn't transmit them.
343 * ``txonly``: Generates and transmits packets without receiving any.
345 * ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet.
347 * ``icmpecho``: Receives a burst of packets, lookup for ICMP echo requests and, if any, send back ICMP echo replies.
349 * ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX.
351 * ``noisy``: Noisy neighbor simulation.
352 Simulate more realistic behavior of a guest machine engaged in receiving
353 and sending packets performing Virtual Network Function (VNF).
355 * ``5tswap``: Swap the source and destination of L2,L3,L4 if they exist.
357 L2 swaps the source address and destination address of Ethernet, as same as ``macswap``.
359 L3 swaps the source address and destination address of IP (v4 and v6).
361 L4 swaps the source port and destination port of transport layer (TCP and UDP).
363 * ``shared-rxq``: Receive only for shared Rx queue.
364 Resolve packet source port from mbuf and update stream statistics accordingly.
368 testpmd> set fwd rxonly
370 Set rxonly packet forwarding mode
376 When running, forwarding engines maintain statistics from the time they have been started.
377 Example for the io forwarding engine, with some packet drops on the tx side::
379 testpmd> show fwd stats all
381 ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
382 RX-packets: 274293770 TX-packets: 274293642 TX-dropped: 128
384 ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
385 RX-packets: 274301850 TX-packets: 274301850 TX-dropped: 0
387 ---------------------- Forward statistics for port 0 ----------------------
388 RX-packets: 274293802 RX-dropped: 0 RX-total: 274293802
389 TX-packets: 274301862 TX-dropped: 0 TX-total: 274301862
390 ----------------------------------------------------------------------------
392 ---------------------- Forward statistics for port 1 ----------------------
393 RX-packets: 274301894 RX-dropped: 0 RX-total: 274301894
394 TX-packets: 274293706 TX-dropped: 128 TX-total: 274293834
395 ----------------------------------------------------------------------------
397 +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
398 RX-packets: 548595696 RX-dropped: 0 RX-total: 548595696
399 TX-packets: 548595568 TX-dropped: 128 TX-total: 548595696
400 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
406 Clear the forwarding engines statistics::
408 testpmd> clear fwd stats all
413 Display an RX descriptor for a port RX queue::
415 testpmd> read rxd (port_id) (queue_id) (rxd_id)
419 testpmd> read rxd 0 0 4
420 0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180
425 Display a TX descriptor for a port TX queue::
427 testpmd> read txd (port_id) (queue_id) (txd_id)
431 testpmd> read txd 0 0 4
432 0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
437 Get loaded dynamic device personalization (DDP) package info list::
439 testpmd> ddp get list (port_id)
444 Display information about dynamic device personalization (DDP) profile::
446 testpmd> ddp get info (profile_path)
451 Display VF statistics::
453 testpmd> show vf stats (port_id) (vf_id)
458 Reset VF statistics::
460 testpmd> clear vf stats (port_id) (vf_id)
462 show port pctype mapping
463 ~~~~~~~~~~~~~~~~~~~~~~~~
465 List all items from the pctype mapping table::
467 testpmd> show port (port_id) pctype mapping
469 show rx offloading capabilities
470 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
472 List all per queue and per port Rx offloading capabilities of a port::
474 testpmd> show port (port_id) rx_offload capabilities
476 show rx offloading configuration
477 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
479 List port level and all queue level Rx offloading configuration::
481 testpmd> show port (port_id) rx_offload configuration
483 show tx offloading capabilities
484 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
486 List all per queue and per port Tx offloading capabilities of a port::
488 testpmd> show port (port_id) tx_offload capabilities
490 show tx offloading configuration
491 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
493 List port level and all queue level Tx offloading configuration::
495 testpmd> show port (port_id) tx_offload configuration
497 show tx metadata setting
498 ~~~~~~~~~~~~~~~~~~~~~~~~
500 Show Tx metadata value set for a specific port::
502 testpmd> show port (port_id) tx_metadata
504 show port supported ptypes
505 ~~~~~~~~~~~~~~~~~~~~~~~~~~
507 Show ptypes supported for a specific port::
509 testpmd> show port (port_id) ptypes
511 set port supported ptypes
512 ~~~~~~~~~~~~~~~~~~~~~~~~~
514 set packet types classification for a specific port::
516 testpmd> set port (port_id) ptypes_mask (mask)
518 show port mac addresses info
519 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
521 Show mac addresses added for a specific port::
523 testpmd> show port (port_id) macs
526 show port multicast mac addresses info
527 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
529 Show multicast mac addresses added for a specific port::
531 testpmd> show port (port_id) mcast_macs
533 show flow transfer proxy port ID for the given port
534 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
536 Show proxy port ID to use as the 1st argument in commands to
537 manage ``transfer`` flows and their indirect components.
540 testpmd> show port (port_id) flow transfer proxy
545 Show general information about devices probed::
547 testpmd> show device info (<identifier>|all)
551 .. code-block:: console
553 testpmd> show device info net_pcap0
555 ********************* Infos for device net_pcap0 *********************
557 Driver name: net_pcap
558 Devargs: iface=enP2p6s0,phy_mac=1
559 Connect to socket: -1
562 MAC address: 1E:37:93:28:04:B8
563 Device name: net_pcap0
568 Dumps all physical memory segment layouts::
570 testpmd> dump_physmem
575 Dumps the layout of all memory zones::
577 testpmd> dump_memzone
582 Dumps the memory usage of all sockets::
584 testpmd> dump_socket_mem
589 Dumps the size of all memory structures::
591 testpmd> dump_struct_sizes
596 Dumps the status of all or specific element in DPDK rings::
598 testpmd> dump_ring [ring_name]
603 Dumps the statistics of all or specific memory pool::
605 testpmd> dump_mempool [mempool_name]
610 Dumps the user device list::
612 testpmd> dump_devargs
617 Dumps the log level for all the dpdk modules::
619 testpmd> dump_log_types
621 show (raw_encap|raw_decap)
622 ~~~~~~~~~~~~~~~~~~~~~~~~~~
624 Display content of raw_encap/raw_decap buffers in hex::
626 testpmd> show <raw_encap|raw_decap> <index>
627 testpmd> show <raw_encap|raw_decap> all
631 testpmd> show raw_encap 6
633 index: 6 at [0x1c565b0], len=50
634 00000000: 00 00 00 00 00 00 16 26 36 46 56 66 08 00 45 00 | .......&6FVf..E.
635 00000010: 00 00 00 00 00 00 00 11 00 00 C0 A8 01 06 C0 A8 | ................
636 00000020: 03 06 00 00 00 FA 00 00 00 00 08 00 00 00 00 00 | ................
639 show fec capabilities
640 ~~~~~~~~~~~~~~~~~~~~~
642 Show fec capabilities of a port::
644 testpmd> show port (port_id) fec capabilities
649 Show fec mode of a port::
651 testpmd> show port (port_id) fec_mode
654 Configuration Functions
655 -----------------------
657 The testpmd application can be configured from the runtime as well as from the command-line.
659 This section details the available configuration functions that are available.
663 Configuration changes only become active when forwarding is started/restarted.
668 Reset forwarding to the default configuration::
675 Set the debug verbosity level::
677 testpmd> set verbose (level)
679 Available levels are as following:
681 * ``0`` silent except for error.
682 * ``1`` fully verbose except for Tx packets.
683 * ``2`` fully verbose except for Rx packets.
684 * ``> 2`` fully verbose.
689 Set the log level for a log type::
691 testpmd> set log global|(type) (level)
695 * ``type`` is the log name.
697 * ``level`` is the log level.
699 For example, to change the global log level::
701 testpmd> set log global (level)
703 Regexes can also be used for type. To change log level of user1, user2 and user3::
705 testpmd> set log user[1-3] (level)
710 Set the number of ports used by the application:
714 This is equivalent to the ``--nb-ports`` command-line option.
719 Set the number of cores used by the application::
721 testpmd> set nbcore (num)
723 This is equivalent to the ``--nb-cores`` command-line option.
727 The number of cores used must not be greater than number of ports used multiplied by the number of queues per port.
732 Set the forwarding cores hexadecimal mask::
734 testpmd> set coremask (mask)
736 This is equivalent to the ``--coremask`` command-line option.
740 The main lcore is reserved for command line parsing only and cannot be masked on for packet forwarding.
745 Set the forwarding ports hexadecimal mask::
747 testpmd> set portmask (mask)
749 This is equivalent to the ``--portmask`` command-line option.
751 set record-core-cycles
752 ~~~~~~~~~~~~~~~~~~~~~~
754 Set the recording of CPU cycles::
756 testpmd> set record-core-cycles (on|off)
760 * ``on`` enables measurement of CPU cycles per packet.
762 * ``off`` disables measurement of CPU cycles per packet.
764 This is equivalent to the ``--record-core-cycles command-line`` option.
766 set record-burst-stats
767 ~~~~~~~~~~~~~~~~~~~~~~
769 Set the displaying of RX and TX bursts::
771 testpmd> set record-burst-stats (on|off)
775 * ``on`` enables display of RX and TX bursts.
777 * ``off`` disables display of RX and TX bursts.
779 This is equivalent to the ``--record-burst-stats command-line`` option.
784 Set number of packets per burst::
786 testpmd> set burst (num)
788 This is equivalent to the ``--burst command-line`` option.
790 When retry is enabled, the transmit delay time and number of retries can also be set::
792 testpmd> set burst tx delay (microseconds) retry (num)
797 Set the offsets of segments relating to the data buffer beginning on receiving
798 if split feature is engaged. Affects only the queues configured with split
799 offloads (currently BUFFER_SPLIT is supported only).
801 testpmd> set rxoffs (x[,y]*)
803 Where x[,y]* represents a CSV list of values, without white space. If the list
804 of offsets is shorter than the list of segments the zero offsets will be used
805 for the remaining segments.
810 Set the length of segments to scatter packets on receiving if split
811 feature is engaged. Affects only the queues configured with split offloads
812 (currently BUFFER_SPLIT is supported only). Optionally the multiple memory
813 pools can be specified with --mbuf-size command line parameter and the mbufs
814 to receive will be allocated sequentially from these extra memory pools (the
815 mbuf for the first segment is allocated from the first pool, the second one
816 from the second pool, and so on, if segment number is greater then pool's the
817 mbuf for remaining segments will be allocated from the last valid pool).
819 testpmd> set rxpkts (x[,y]*)
821 Where x[,y]* represents a CSV list of values, without white space. Zero value
822 means to use the corresponding memory pool data buffer size.
827 Set the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode::
829 testpmd> set txpkts (x[,y]*)
831 Where x[,y]* represents a CSV list of values, without white space.
836 Configure the timing burst pattern for Tx only mode. This command enables
837 the packet send scheduling on dynamic timestamp mbuf field and configures
838 timing pattern in Tx only mode. In this mode, if scheduling is enabled
839 application provides timestamps in the packets being sent. It is possible
840 to configure delay (in unspecified device clock units) between bursts
841 and between the packets within the burst::
843 testpmd> set txtimes (inter),(intra)
847 * ``inter`` is the delay between the bursts in the device clock units.
848 If ``intra`` is zero, this is the time between the beginnings of the
849 first packets in the neighbour bursts, if ``intra`` is not zero,
850 ``inter`` specifies the time between the beginning of the first packet
851 of the current burst and the beginning of the last packet of the
852 previous burst. If ``inter`` parameter is zero the send scheduling
853 on timestamps is disabled (default).
855 * ``intra`` is the delay between the packets within the burst specified
856 in the device clock units. The number of packets in the burst is defined
857 by regular burst setting. If ``intra`` parameter is zero no timestamps
858 provided in the packets excepting the first one in the burst.
860 As the result the bursts of packet will be transmitted with specific
861 delays between the packets within the burst and specific delay between
862 the bursts. The rte_eth_read_clock() must be supported by the device(s)
863 and is supposed to be engaged to get the current device clock value
864 and provide the reference for the timestamps. If there is no supported
865 rte_eth_read_clock() there will be no send scheduling provided on the port.
870 Set the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes::
872 testpmd> set txsplit (off|on|rand)
876 * ``off`` disable packet copy & split for CSUM mode.
878 * ``on`` split outgoing packet into multiple segments. Size of each segment
879 and number of segments per packet is determined by ``set txpkts`` command
882 * ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments.
887 Set the list of forwarding cores::
889 testpmd> set corelist (x[,y]*)
891 For example, to change the forwarding cores:
893 .. code-block:: console
895 testpmd> set corelist 3,1
896 testpmd> show config fwd
898 io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled
899 Logical Core 3 (socket 0) forwards packets on 1 streams:
900 RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
901 Logical Core 1 (socket 0) forwards packets on 1 streams:
902 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
906 The cores are used in the same order as specified on the command line.
911 Set the list of forwarding ports::
913 testpmd> set portlist (x[,y]*)
915 For example, to change the port forwarding:
917 .. code-block:: console
919 testpmd> set portlist 0,2,1,3
920 testpmd> show config fwd
922 io packet forwarding - ports=4 - cores=1 - streams=4
923 Logical Core 3 (socket 0) forwards packets on 4 streams:
924 RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01
925 RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
926 RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03
927 RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02
932 Select how to retrieve new ports created after "port attach" command::
934 testpmd> set port setup on (iterator|event)
936 For each new port, a setup is done.
937 It will find the probed ports via RTE_ETH_FOREACH_MATCHING_DEV loop
938 in iterator mode, or via RTE_ETH_EVENT_NEW in event mode.
943 Enable/disable tx loopback::
945 testpmd> set tx loopback (port_id) (on|off)
950 set drop enable bit for all queues::
952 testpmd> set all queues drop (port_id) (on|off)
954 set split drop enable (for VF)
955 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
957 set split drop enable bit for VF from PF::
959 testpmd> set vf split drop (port_id) (vf_id) (on|off)
961 set mac antispoof (for VF)
962 ~~~~~~~~~~~~~~~~~~~~~~~~~~
964 Set mac antispoof for a VF from the PF::
966 testpmd> set vf mac antispoof (port_id) (vf_id) (on|off)
971 Enable/disable MACsec offload::
973 testpmd> set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)
974 testpmd> set macsec offload (port_id) off
979 Configure MACsec secure connection (SC)::
981 testpmd> set macsec sc (tx|rx) (port_id) (mac) (pi)
985 The pi argument is ignored for tx.
986 Check the NIC Datasheet for hardware limits.
991 Configure MACsec secure association (SA)::
993 testpmd> set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)
997 The IDX value must be 0 or 1.
998 Check the NIC Datasheet for hardware limits.
1000 set broadcast mode (for VF)
1001 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1003 Set broadcast mode for a VF from the PF::
1005 testpmd> set vf broadcast (port_id) (vf_id) (on|off)
1010 Set the VLAN strip for a queue on a port::
1012 testpmd> vlan set stripq (on|off) (port_id,queue_id)
1014 vlan set stripq (for VF)
1015 ~~~~~~~~~~~~~~~~~~~~~~~~
1017 Set VLAN strip for all queues in a pool for a VF from the PF::
1019 testpmd> set vf vlan stripq (port_id) (vf_id) (on|off)
1021 vlan set insert (for VF)
1022 ~~~~~~~~~~~~~~~~~~~~~~~~
1024 Set VLAN insert for a VF from the PF::
1026 testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
1028 vlan set tag (for VF)
1029 ~~~~~~~~~~~~~~~~~~~~~
1031 Set VLAN tag for a VF from the PF::
1033 testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
1035 vlan set antispoof (for VF)
1036 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1038 Set VLAN antispoof for a VF from the PF::
1040 testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off)
1042 vlan set (strip|filter|qinq_strip|extend)
1043 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1044 Set the VLAN strip/filter/QinQ strip/extend on for a port::
1046 testpmd> vlan set (strip|filter|qinq_strip|extend) (on|off) (port_id)
1051 Set the inner or outer VLAN TPID for packet filtering on a port::
1053 testpmd> vlan set (inner|outer) tpid (value) (port_id)
1057 TPID value must be a 16-bit number (value <= 65536).
1062 Add a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID::
1064 testpmd> rx_vlan add (vlan_id|all) (port_id)
1068 VLAN filter must be set on that port. VLAN ID < 4096.
1069 Depending on the NIC used, number of vlan_ids may be limited to the maximum entries
1070 in VFTA table. This is important if enabling all vlan_ids.
1075 Remove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID::
1077 testpmd> rx_vlan rm (vlan_id|all) (port_id)
1079 rx_vlan add (for VF)
1080 ~~~~~~~~~~~~~~~~~~~~
1082 Add a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID::
1084 testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask)
1089 Remove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID::
1091 testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask)
1096 Add an UDP port for VXLAN packet filter on a port::
1098 testpmd> rx_vxlan_port add (udp_port) (port_id)
1100 rx_vxlan_port remove
1101 ~~~~~~~~~~~~~~~~~~~~
1103 Remove an UDP port for VXLAN packet filter on a port::
1105 testpmd> rx_vxlan_port rm (udp_port) (port_id)
1110 Set hardware insertion of VLAN IDs in packets sent on a port::
1112 testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer]
1114 For example, set a single VLAN ID (5) insertion on port 0::
1118 Or, set double VLAN ID (inner: 2, outer: 3) insertion on port 1::
1126 Set port based hardware insertion of VLAN ID in packets sent on a port::
1128 testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off)
1133 Disable hardware insertion of a VLAN header in packets sent on a port::
1135 testpmd> tx_vlan reset (port_id)
1140 Select hardware or software calculation of the checksum when
1141 transmitting a packet using the ``csum`` forwarding engine::
1143 testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)
1147 * ``ip|udp|tcp|sctp`` always relate to the inner layer.
1149 * ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized
1150 as a tunnel packet by the forwarding engine (geneve, gre, gtp, ipip, vxlan and vxlan-gpe are
1151 supported). See also the ``csum parse-tunnel`` command.
1153 * ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized
1154 as a tunnel packet by the forwarding engine (geneve, gtp, vxlan and vxlan-gpe are
1155 supported). See also the ``csum parse-tunnel`` command.
1159 Check the NIC Datasheet for hardware limits.
1164 Set RSS queue region span on a port::
1166 testpmd> set port (port_id) queue-region region_id (value) \
1167 queue_start_index (value) queue_num (value)
1169 Set flowtype mapping on a RSS queue region on a port::
1171 testpmd> set port (port_id) queue-region region_id (value) flowtype (value)
1175 * For the flowtype(pctype) of packet,the specific index for each type has
1176 been defined in file i40e_type.h as enum i40e_filter_pctype.
1178 Set user priority mapping on a RSS queue region on a port::
1180 testpmd> set port (port_id) queue-region UP (value) region_id (value)
1182 Flush all queue region related configuration on a port::
1184 testpmd> set port (port_id) queue-region flush (on|off)
1188 * ``on``: is just an enable function which server for other configuration,
1189 it is for all configuration about queue region from up layer,
1190 at first will only keep in DPDK software stored in driver,
1191 only after "flush on", it commit all configuration to HW.
1193 * ``"off``: is just clean all configuration about queue region just now,
1194 and restore all to DPDK i40e driver default config when start up.
1196 Show all queue region related configuration info on a port::
1198 testpmd> show port (port_id) queue-region
1202 Queue region only support on PF by now, so these command is
1203 only for configuration of queue region on PF port.
1208 Define how tunneled packets should be handled by the csum forward
1211 testpmd> csum parse-tunnel (on|off) (tx_port_id)
1213 If enabled, the csum forward engine will try to recognize supported
1214 tunnel headers (geneve, gtp, gre, ipip, vxlan, vxlan-gpe).
1216 If disabled, treat tunnel packets as non-tunneled packets (a inner
1217 header is handled as a packet payload).
1221 The port argument is the TX port like in the ``csum set`` command.
1225 Consider a packet in packet like the following::
1227 eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in
1229 * If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1230 command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the
1231 ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ipv4_out`` and ``udp_out``).
1233 * If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1234 command relate to the outer headers, here ``ipv4_out`` and ``udp_out``.
1239 Display tx checksum offload configuration::
1241 testpmd> csum show (port_id)
1246 Enable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine::
1248 testpmd> tso set (segsize) (port_id)
1252 Check the NIC datasheet for hardware limits.
1257 Display the status of TCP Segmentation Offload::
1259 testpmd> tso show (port_id)
1264 Set tso segment size of tunneled packets for a port in csum engine::
1266 testpmd> tunnel_tso set (tso_segsz) (port_id)
1271 Display the status of tunneled TCP Segmentation Offload for a port::
1273 testpmd> tunnel_tso show (port_id)
1278 Enable or disable GRO in ``csum`` forwarding engine::
1280 testpmd> set port <port_id> gro on|off
1282 If enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
1283 packets received from the given port.
1285 If disabled, packets received from the given port won't be performed
1286 GRO. By default, GRO is disabled for all ports.
1290 When enable GRO for a port, TCP/IPv4 packets received from the port
1291 will be performed GRO. After GRO, all merged packets have bad
1292 checksums, since the GRO library doesn't re-calculate checksums for
1293 the merged packets. Therefore, if users want the merged packets to
1294 have correct checksums, please select HW IP checksum calculation and
1295 HW TCP checksum calculation for the port which the merged packets are
1301 Display GRO configuration for a given port::
1303 testpmd> show port <port_id> gro
1308 Set the cycle to flush the GROed packets from reassembly tables::
1310 testpmd> set gro flush <cycles>
1312 When enable GRO, the csum forwarding engine performs GRO on received
1313 packets, and the GROed packets are stored in reassembly tables. Users
1314 can use this command to determine when the GROed packets are flushed
1315 from the reassembly tables.
1317 The ``cycles`` is measured in GRO operation times. The csum forwarding
1318 engine flushes the GROed packets from the tables every ``cycles`` GRO
1321 By default, the value of ``cycles`` is 1, which means flush GROed packets
1322 from the reassembly tables as soon as one GRO operation finishes. The value
1323 of ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
1325 Please note that the large value of ``cycles`` may cause the poor TCP/IP
1326 stack performance. Because the GROed packets are delayed to arrive the
1327 stack, thus causing more duplicated ACKs and TCP retransmissions.
1332 Toggle per-port GSO support in ``csum`` forwarding engine::
1334 testpmd> set port <port_id> gso on|off
1336 If enabled, the csum forwarding engine will perform GSO on supported IPv4
1337 packets, transmitted on the given port.
1339 If disabled, packets transmitted on the given port will not undergo GSO.
1340 By default, GSO is disabled for all ports.
1344 When GSO is enabled on a port, supported IPv4 packets transmitted on that
1345 port undergo GSO. Afterwards, the segmented packets are represented by
1346 multi-segment mbufs; however, the csum forwarding engine doesn't calculation
1347 of checksums for GSO'd segments in SW. As a result, if users want correct
1348 checksums in GSO segments, they should enable HW checksum calculation for
1351 For example, HW checksum calculation for VxLAN GSO'd packets may be enabled
1352 by setting the following options in the csum forwarding engine:
1354 testpmd> csum set outer_ip hw <port_id>
1356 testpmd> csum set ip hw <port_id>
1358 testpmd> csum set tcp hw <port_id>
1360 UDP GSO is the same as IP fragmentation, which treats the UDP header
1361 as the payload and does not modify it during segmentation. That is,
1362 after UDP GSO, only the first output fragment has the original UDP
1363 header. Therefore, users need to enable HW IP checksum calculation
1364 and SW UDP checksum calculation for GSO-enabled ports, if they want
1365 correct checksums for UDP/IPv4 packets.
1370 Set the maximum GSO segment size (measured in bytes), which includes the
1371 packet header and the packet payload for GSO-enabled ports (global)::
1373 testpmd> set gso segsz <length>
1378 Display the status of Generic Segmentation Offload for a given port::
1380 testpmd> show port <port_id> gso
1385 Add an alternative MAC address to a port::
1387 testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)
1392 Remove a MAC address from a port::
1394 testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)
1399 To add the multicast MAC address to/from the set of multicast addresses
1402 testpmd> mcast_addr add (port_id) (mcast_addr)
1407 To remove the multicast MAC address to/from the set of multicast addresses
1410 testpmd> mcast_addr remove (port_id) (mcast_addr)
1412 mac_addr add (for VF)
1413 ~~~~~~~~~~~~~~~~~~~~~
1415 Add an alternative MAC address for a VF to a port::
1417 testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX)
1422 Set the default MAC address for a port::
1424 testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
1426 mac_addr set (for VF)
1427 ~~~~~~~~~~~~~~~~~~~~~
1429 Set the MAC address for a VF from the PF::
1431 testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)
1436 Set the forwarding peer address for certain port::
1438 testpmd> set eth-peer (port_id) (peer_addr)
1440 This is equivalent to the ``--eth-peer`` command-line option.
1445 Set the unicast hash filter(s) on/off for a port::
1447 testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off)
1452 Set the promiscuous mode on for a port or for all ports.
1453 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1455 testpmd> set promisc (port_id|all) (on|off)
1460 Set the allmulti mode for a port or for all ports::
1462 testpmd> set allmulti (port_id|all) (on|off)
1464 Same as the ifconfig (8) option. Controls how multicast packets are handled.
1466 set promisc (for VF)
1467 ~~~~~~~~~~~~~~~~~~~~
1469 Set the unicast promiscuous mode for a VF from PF.
1470 It's supported by Intel i40e NICs now.
1471 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1473 testpmd> set vf promisc (port_id) (vf_id) (on|off)
1475 set allmulticast (for VF)
1476 ~~~~~~~~~~~~~~~~~~~~~~~~~
1478 Set the multicast promiscuous mode for a VF from PF.
1479 It's supported by Intel i40e NICs now.
1480 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1482 testpmd> set vf allmulti (port_id) (vf_id) (on|off)
1484 set tx max bandwidth (for VF)
1485 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1487 Set TX max absolute bandwidth (Mbps) for a VF from PF::
1489 testpmd> set vf tx max-bandwidth (port_id) (vf_id) (max_bandwidth)
1491 set tc tx min bandwidth (for VF)
1492 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1494 Set all TCs' TX min relative bandwidth (%) for a VF from PF::
1496 testpmd> set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)
1498 set tc tx max bandwidth (for VF)
1499 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1501 Set a TC's TX max absolute bandwidth (Mbps) for a VF from PF::
1503 testpmd> set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (max_bandwidth)
1505 set tc strict link priority mode
1506 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1508 Set some TCs' strict link priority mode on a physical port::
1510 testpmd> set tx strict-link-priority (port_id) (tc_bitmap)
1512 set tc tx min bandwidth
1513 ~~~~~~~~~~~~~~~~~~~~~~~
1515 Set all TCs' TX min relative bandwidth (%) globally for all PF and VFs::
1517 testpmd> set tc tx min-bandwidth (port_id) (bw1, bw2, ...)
1522 Set the link flow control parameter on a port::
1524 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1525 (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \
1526 autoneg (on|off) (port_id)
1530 * ``high_water`` (integer): High threshold value to trigger XOFF.
1532 * ``low_water`` (integer): Low threshold value to trigger XON.
1534 * ``pause_time`` (integer): Pause quota in the Pause frame.
1536 * ``send_xon`` (0/1): Send XON frame.
1538 * ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames.
1540 * ``autoneg``: Change the auto-negotiation parameter.
1545 show the link flow control parameter on a port::
1547 testpmd> show port <port_id> flow_ctrl
1552 Set the priority flow control parameter on a port::
1554 testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1555 (pause_time) (priority) (port_id)
1559 * ``high_water`` (integer): High threshold value.
1561 * ``low_water`` (integer): Low threshold value.
1563 * ``pause_time`` (integer): Pause quota in the Pause frame.
1565 * ``priority`` (0-7): VLAN User Priority.
1570 Set the priority flow control parameter on a given Rx and Tx queue of a port::
1572 testpmd> set pfc_queue_ctrl <port_id> rx (on|off) <tx_qid> <tx_tc> \
1573 tx (on|off) <rx_qid> <rx_tc> <pause_time>
1577 * ``tx_qid`` (integer): Tx qid for which ``tx_tc`` will be applied and traffic
1578 will be paused when PFC frame is received with ``tx_tc`` enabled.
1580 * ``tx_tc`` (0-15): TC for which traffic is to be paused for xmit.
1582 * ``rx_qid`` (integer): Rx qid for which threshold will be applied and PFC
1583 frame will be generated with ``tx_tc`` when exceeds the threshold.
1585 * ``rx_tc`` (0-15): TC filled in PFC frame for which remote Tx is to be paused.
1587 * ``pause_time`` (integer): Pause quanta filled in the PFC frame for which
1588 interval, remote Tx will be paused. Valid only if Tx pause is on.
1593 Set statistics mapping (qmapping 0..15) for RX/TX queue on port::
1595 testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)
1597 For example, to set rx queue 2 on port 0 to mapping 5::
1599 testpmd>set stat_qmap rx 0 2 5
1601 set xstats-hide-zero
1602 ~~~~~~~~~~~~~~~~~~~~
1604 Set the option to hide zero values for xstats display::
1606 testpmd> set xstats-hide-zero on|off
1610 By default, the zero values are displayed for xstats.
1612 set port - rx/tx (for VF)
1613 ~~~~~~~~~~~~~~~~~~~~~~~~~
1615 Set VF receive/transmit from a port::
1617 testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1619 set port - rx mode(for VF)
1620 ~~~~~~~~~~~~~~~~~~~~~~~~~~
1622 Set the VF receive mode of a port::
1624 testpmd> set port (port_id) vf (vf_id) \
1625 rxmode (AUPE|ROPE|BAM|MPE) (on|off)
1627 The available receive modes are:
1629 * ``AUPE``: Accepts untagged VLAN.
1631 * ``ROPE``: Accepts unicast hash.
1633 * ``BAM``: Accepts broadcast packets.
1635 * ``MPE``: Accepts all multicast packets.
1637 set port - tx_rate (for Queue)
1638 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1640 Set TX rate limitation for a queue on a port::
1642 testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1644 set port - tx_rate (for VF)
1645 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1647 Set TX rate limitation for queues in VF on a port::
1649 testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
1654 Set the flush on RX streams before forwarding.
1655 The default is flush ``on``.
1656 Mainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams::
1658 testpmd> set flush_rx off
1663 Set the bypass mode for the lowest port on bypass enabled NIC::
1665 testpmd> set bypass mode (normal|bypass|isolate) (port_id)
1670 Set the event required to initiate specified bypass mode for the lowest port on a bypass enabled::
1672 testpmd> set bypass event (timeout|os_on|os_off|power_on|power_off) \
1673 mode (normal|bypass|isolate) (port_id)
1677 * ``timeout``: Enable bypass after watchdog timeout.
1679 * ``os_on``: Enable bypass when OS/board is powered on.
1681 * ``os_off``: Enable bypass when OS/board is powered off.
1683 * ``power_on``: Enable bypass when power supply is turned on.
1685 * ``power_off``: Enable bypass when power supply is turned off.
1691 Set the bypass watchdog timeout to ``n`` seconds where 0 = instant::
1693 testpmd> set bypass timeout (0|1.5|2|3|4|8|16|32)
1698 Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC::
1700 testpmd> show bypass config (port_id)
1705 Set link up for a port::
1707 testpmd> set link-up port (port id)
1712 Set link down for a port::
1714 testpmd> set link-down port (port id)
1719 Enable E-tag insertion for a VF on a port::
1721 testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
1723 Disable E-tag insertion for a VF on a port::
1725 testpmd> E-tag set insertion off port (port_id) vf (vf_id)
1727 Enable/disable E-tag stripping on a port::
1729 testpmd> E-tag set stripping (on|off) port (port_id)
1731 Enable/disable E-tag based forwarding on a port::
1733 testpmd> E-tag set forwarding (on|off) port (port_id)
1738 Load a dynamic device personalization (DDP) profile and store backup profile::
1740 testpmd> ddp add (port_id) (profile_path[,backup_profile_path])
1745 Delete a dynamic device personalization profile and restore backup profile::
1747 testpmd> ddp del (port_id) (backup_profile_path)
1752 List all items from the ptype mapping table::
1754 testpmd> ptype mapping get (port_id) (valid_only)
1758 * ``valid_only``: A flag indicates if only list valid items(=1) or all items(=0).
1760 Replace a specific or a group of software defined ptype with a new one::
1762 testpmd> ptype mapping replace (port_id) (target) (mask) (pkt_type)
1766 * ``target``: A specific software ptype or a mask to represent a group of software ptypes.
1768 * ``mask``: A flag indicate if "target" is a specific software ptype(=0) or a ptype mask(=1).
1770 * ``pkt_type``: The new software ptype to replace the old ones.
1772 Update hardware defined ptype to software defined packet type mapping table::
1774 testpmd> ptype mapping update (port_id) (hw_ptype) (sw_ptype)
1778 * ``hw_ptype``: hardware ptype as the index of the ptype mapping table.
1780 * ``sw_ptype``: software ptype as the value of the ptype mapping table.
1782 Reset ptype mapping table::
1784 testpmd> ptype mapping reset (port_id)
1786 config per port Rx offloading
1787 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1789 Enable or disable a per port Rx offloading on all Rx queues of a port::
1791 testpmd> port config (port_id) rx_offload (offloading) on|off
1793 * ``offloading``: can be any of these offloading capability:
1794 vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1795 qinq_strip, outer_ipv4_cksum, macsec_strip,
1796 header_split, vlan_filter, vlan_extend, jumbo_frame,
1797 scatter, timestamp, security, keep_crc, rss_hash
1799 This command should be run when the port is stopped, or else it will fail.
1801 config per queue Rx offloading
1802 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1804 Enable or disable a per queue Rx offloading only on a specific Rx queue::
1806 testpmd> port (port_id) rxq (queue_id) rx_offload (offloading) on|off
1808 * ``offloading``: can be any of these offloading capability:
1809 vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1810 qinq_strip, outer_ipv4_cksum, macsec_strip,
1811 header_split, vlan_filter, vlan_extend, jumbo_frame,
1812 scatter, timestamp, security, keep_crc
1814 This command should be run when the port is stopped, or else it will fail.
1816 config per port Tx offloading
1817 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1819 Enable or disable a per port Tx offloading on all Tx queues of a port::
1821 testpmd> port config (port_id) tx_offload (offloading) on|off
1823 * ``offloading``: can be any of these offloading capability:
1824 vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1825 sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1826 qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1827 ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1828 mt_lockfree, multi_segs, mbuf_fast_free, security
1830 This command should be run when the port is stopped, or else it will fail.
1832 config per queue Tx offloading
1833 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1835 Enable or disable a per queue Tx offloading only on a specific Tx queue::
1837 testpmd> port (port_id) txq (queue_id) tx_offload (offloading) on|off
1839 * ``offloading``: can be any of these offloading capability:
1840 vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1841 sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1842 qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1843 ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1844 mt_lockfree, multi_segs, mbuf_fast_free, security
1846 This command should be run when the port is stopped, or else it will fail.
1848 Config VXLAN Encap outer layers
1849 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1851 Configure the outer layer to encapsulate a packet inside a VXLAN tunnel::
1853 set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1854 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) \
1857 set vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1858 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1859 eth-src (eth-src) eth-dst (eth-dst)
1861 set vxlan-tos-ttl ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1862 udp-dst (udp-dst) ip-tos (ip-tos) ip-ttl (ip-ttl) ip-src (ip-src) \
1863 ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1865 These commands will set an internal configuration inside testpmd, any following
1866 flow rule using the action vxlan_encap will use the last configuration set.
1867 To have a different encapsulation header, one of those commands must be called
1868 before the flow rule creation.
1870 Config NVGRE Encap outer layers
1871 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1873 Configure the outer layer to encapsulate a packet inside a NVGRE tunnel::
1875 set nvgre ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) ip-dst (ip-dst) \
1876 eth-src (eth-src) eth-dst (eth-dst)
1877 set nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) \
1878 ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1880 These commands will set an internal configuration inside testpmd, any following
1881 flow rule using the action nvgre_encap will use the last configuration set.
1882 To have a different encapsulation header, one of those commands must be called
1883 before the flow rule creation.
1888 Configure the l2 to be used when encapsulating a packet with L2::
1890 set l2_encap ip-version (ipv4|ipv6) eth-src (eth-src) eth-dst (eth-dst)
1891 set l2_encap-with-vlan ip-version (ipv4|ipv6) vlan-tci (vlan-tci) \
1892 eth-src (eth-src) eth-dst (eth-dst)
1894 Those commands will set an internal configuration inside testpmd, any following
1895 flow rule using the action l2_encap will use the last configuration set.
1896 To have a different encapsulation header, one of those commands must be called
1897 before the flow rule creation.
1902 Configure the l2 to be removed when decapsulating a packet with L2::
1904 set l2_decap ip-version (ipv4|ipv6)
1905 set l2_decap-with-vlan ip-version (ipv4|ipv6)
1907 Those commands will set an internal configuration inside testpmd, any following
1908 flow rule using the action l2_decap will use the last configuration set.
1909 To have a different encapsulation header, one of those commands must be called
1910 before the flow rule creation.
1912 Config MPLSoGRE Encap outer layers
1913 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1915 Configure the outer layer to encapsulate a packet inside a MPLSoGRE tunnel::
1917 set mplsogre_encap ip-version (ipv4|ipv6) label (label) \
1918 ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1919 set mplsogre_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1920 ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1921 eth-src (eth-src) eth-dst (eth-dst)
1923 These commands will set an internal configuration inside testpmd, any following
1924 flow rule using the action mplsogre_encap will use the last configuration set.
1925 To have a different encapsulation header, one of those commands must be called
1926 before the flow rule creation.
1928 Config MPLSoGRE Decap outer layers
1929 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1931 Configure the outer layer to decapsulate MPLSoGRE packet::
1933 set mplsogre_decap ip-version (ipv4|ipv6)
1934 set mplsogre_decap-with-vlan ip-version (ipv4|ipv6)
1936 These commands will set an internal configuration inside testpmd, any following
1937 flow rule using the action mplsogre_decap will use the last configuration set.
1938 To have a different decapsulation header, one of those commands must be called
1939 before the flow rule creation.
1941 Config MPLSoUDP Encap outer layers
1942 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1944 Configure the outer layer to encapsulate a packet inside a MPLSoUDP tunnel::
1946 set mplsoudp_encap ip-version (ipv4|ipv6) label (label) udp-src (udp-src) \
1947 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1948 eth-src (eth-src) eth-dst (eth-dst)
1949 set mplsoudp_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1950 udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1951 vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1953 These commands will set an internal configuration inside testpmd, any following
1954 flow rule using the action mplsoudp_encap will use the last configuration set.
1955 To have a different encapsulation header, one of those commands must be called
1956 before the flow rule creation.
1958 Config MPLSoUDP Decap outer layers
1959 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1961 Configure the outer layer to decapsulate MPLSoUDP packet::
1963 set mplsoudp_decap ip-version (ipv4|ipv6)
1964 set mplsoudp_decap-with-vlan ip-version (ipv4|ipv6)
1966 These commands will set an internal configuration inside testpmd, any following
1967 flow rule using the action mplsoudp_decap will use the last configuration set.
1968 To have a different decapsulation header, one of those commands must be called
1969 before the flow rule creation.
1971 Config Raw Encapsulation
1972 ~~~~~~~~~~~~~~~~~~~~~~~~~
1974 Configure the raw data to be used when encapsulating a packet by
1975 rte_flow_action_raw_encap::
1977 set raw_encap {index} {item} [/ {item} [...]] / end_set
1979 There are multiple global buffers for ``raw_encap``, this command will set one
1980 internal buffer index by ``{index}``.
1981 If there is no ``{index}`` specified::
1983 set raw_encap {item} [/ {item} [...]] / end_set
1985 the default index ``0`` is used.
1986 In order to use different encapsulating header, ``index`` must be specified
1987 during the flow rule creation::
1989 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
1990 raw_encap index 2 / end
1992 Otherwise the default index ``0`` is used.
1994 Config Raw Decapsulation
1995 ~~~~~~~~~~~~~~~~~~~~~~~~
1997 Configure the raw data to be used when decapsulating a packet by
1998 rte_flow_action_raw_decap::
2000 set raw_decap {index} {item} [/ {item} [...]] / end_set
2002 There are multiple global buffers for ``raw_decap``, this command will set
2003 one internal buffer index by ``{index}``.
2004 If there is no ``{index}`` specified::
2006 set raw_decap {item} [/ {item} [...]] / end_set
2008 the default index ``0`` is used.
2009 In order to use different decapsulating header, ``index`` must be specified
2010 during the flow rule creation::
2012 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
2013 raw_encap index 3 / end
2015 Otherwise the default index ``0`` is used.
2020 Set fec mode for a specific port::
2022 testpmd> set port (port_id) fec_mode auto|off|rs|baser
2024 Config Sample actions list
2025 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2027 Configure the sample actions list to be used when sampling a packet by
2028 rte_flow_action_sample::
2030 set sample_actions {index} {action} [/ {action} [...]] / end
2032 There are multiple global buffers for ``sample_actions``, this command will set
2033 one internal buffer index by ``{index}``.
2035 In order to use different sample actions list, ``index`` must be specified
2036 during the flow rule creation::
2038 testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
2039 sample ratio 2 index 2 / end
2041 Otherwise the default index ``0`` is used.
2046 The following sections show functions for configuring ports.
2050 Port configuration changes only become active when forwarding is started/restarted.
2055 Attach a port specified by pci address or virtual device args::
2057 testpmd> port attach (identifier)
2059 To attach a new pci device, the device should be recognized by kernel first.
2060 Then it should be moved under DPDK management.
2061 Finally the port can be attached to testpmd.
2063 For example, to move a pci device using ixgbe under DPDK management:
2065 .. code-block:: console
2067 # Check the status of the available devices.
2068 ./usertools/dpdk-devbind.py --status
2070 Network devices using DPDK-compatible driver
2071 ============================================
2074 Network devices using kernel driver
2075 ===================================
2076 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=
2079 # Bind the device to igb_uio.
2080 sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0
2083 # Recheck the status of the devices.
2084 ./usertools/dpdk-devbind.py --status
2085 Network devices using DPDK-compatible driver
2086 ============================================
2087 0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused=
2089 To attach a port created by virtual device, above steps are not needed.
2091 For example, to attach a port whose pci address is 0000:0a:00.0.
2093 .. code-block:: console
2095 testpmd> port attach 0000:0a:00.0
2096 Attaching a new port...
2097 EAL: PCI device 0000:0a:00.0 on NUMA socket -1
2098 EAL: probe driver: 8086:10fb rte_ixgbe_pmd
2099 EAL: PCI memory mapped at 0x7f83bfa00000
2100 EAL: PCI memory mapped at 0x7f83bfa80000
2101 PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5
2102 PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
2103 Port 0 is attached. Now total ports is 1
2106 For example, to attach a port created by pcap PMD.
2108 .. code-block:: console
2110 testpmd> port attach net_pcap0
2111 Attaching a new port...
2112 PMD: Initializing pmd_pcap for net_pcap0
2113 PMD: Creating pcap-backed ethdev on numa socket 0
2114 Port 0 is attached. Now total ports is 1
2117 In this case, identifier is ``net_pcap0``.
2118 This identifier format is the same as ``--vdev`` format of DPDK applications.
2120 For example, to re-attach a bonded port which has been previously detached,
2121 the mode and slave parameters must be given.
2123 .. code-block:: console
2125 testpmd> port attach net_bond_0,mode=0,slave=1
2126 Attaching a new port...
2127 EAL: Initializing pmd_bond for net_bond_0
2128 EAL: Create bonded device net_bond_0 on port 0 in mode 0 on socket 0.
2129 Port 0 is attached. Now total ports is 1
2136 Detach a specific port::
2138 testpmd> port detach (port_id)
2140 Before detaching a port, the port should be stopped and closed.
2142 For example, to detach a pci device port 0.
2144 .. code-block:: console
2146 testpmd> port stop 0
2149 testpmd> port close 0
2153 testpmd> port detach 0
2155 EAL: PCI device 0000:0a:00.0 on NUMA socket -1
2156 EAL: remove driver: 8086:10fb rte_ixgbe_pmd
2157 EAL: PCI memory unmapped at 0x7f83bfa00000
2158 EAL: PCI memory unmapped at 0x7f83bfa80000
2162 For example, to detach a virtual device port 0.
2164 .. code-block:: console
2166 testpmd> port stop 0
2169 testpmd> port close 0
2173 testpmd> port detach 0
2175 PMD: Closing pcap ethdev on numa socket 0
2176 Port 'net_pcap0' is detached. Now total ports is 0
2179 To remove a pci device completely from the system, first detach the port from testpmd.
2180 Then the device should be moved under kernel management.
2181 Finally the device can be removed using kernel pci hotplug functionality.
2183 For example, to move a pci device under kernel management:
2185 .. code-block:: console
2187 sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0
2189 ./usertools/dpdk-devbind.py --status
2191 Network devices using DPDK-compatible driver
2192 ============================================
2195 Network devices using kernel driver
2196 ===================================
2197 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio
2199 To remove a port created by a virtual device, above steps are not needed.
2204 Start all ports or a specific port::
2206 testpmd> port start (port_id|all)
2211 Stop all ports or a specific port::
2213 testpmd> port stop (port_id|all)
2218 Close all ports or a specific port::
2220 testpmd> port close (port_id|all)
2225 Reset all ports or a specific port::
2227 testpmd> port reset (port_id|all)
2229 User should stop port(s) before resetting and (re-)start after reset.
2231 port config - queue ring size
2232 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2234 Configure a rx/tx queue ring size::
2236 testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
2238 Only take effect after command that (re-)start the port or command that setup specific queue.
2240 port start/stop queue
2241 ~~~~~~~~~~~~~~~~~~~~~
2243 Start/stop a rx/tx queue on a specific port::
2245 testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
2247 port config - queue deferred start
2248 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2250 Switch on/off deferred start of a specific port queue::
2252 testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
2255 ~~~~~~~~~~~~~~~~~~~~~
2257 Setup a rx/tx queue on a specific port::
2259 testpmd> port (port_id) (rxq|txq) (queue_id) setup
2261 Only take effect when port is started.
2266 Set the speed and duplex mode for all ports or a specific port::
2268 testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|200000|auto) \
2269 duplex (half|full|auto)
2271 port config - queues/descriptors
2272 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2274 Set number of queues/descriptors for rxq, txq, rxd and txd::
2276 testpmd> port config all (rxq|txq|rxd|txd) (value)
2278 This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2280 port config - max-pkt-len
2281 ~~~~~~~~~~~~~~~~~~~~~~~~~
2283 Set the maximum packet length::
2285 testpmd> port config all max-pkt-len (value)
2287 This is equivalent to the ``--max-pkt-len`` command-line option.
2289 port config - max-lro-pkt-size
2290 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2292 Set the maximum LRO aggregated packet size::
2294 testpmd> port config all max-lro-pkt-size (value)
2296 This is equivalent to the ``--max-lro-pkt-size`` command-line option.
2298 port config - Drop Packets
2299 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2301 Enable or disable packet drop on all RX queues of all ports when no receive buffers available::
2303 testpmd> port config all drop-en (on|off)
2305 Packet dropping when no receive buffers available is off by default.
2307 The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2312 Set the RSS (Receive Side Scaling) mode on or off::
2314 testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|l2tpv2|none)
2316 RSS is on by default.
2318 The ``all`` option is equivalent to eth|vlan|ip|tcp|udp|sctp|ether|l2tpv3|esp|ah|pfcp|l2tpv2.
2320 The ``default`` option enables all supported RSS types reported by device info.
2322 The ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2324 port config - RSS Reta
2325 ~~~~~~~~~~~~~~~~~~~~~~
2327 Set the RSS (Receive Side Scaling) redirection table::
2329 testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2334 Set the DCB mode for an individual port::
2336 testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2338 The traffic class should be 4 or 8.
2343 Set the number of packets per burst::
2345 testpmd> port config all burst (value)
2347 This is equivalent to the ``--burst`` command-line option.
2349 port config - Threshold
2350 ~~~~~~~~~~~~~~~~~~~~~~~
2352 Set thresholds for TX/RX queues::
2354 testpmd> port config all (threshold) (value)
2356 Where the threshold type can be:
2358 * ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255.
2360 * ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255.
2362 * ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255.
2364 * ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255.
2366 * ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255.
2368 * ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255.
2370 * ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd.
2372 * ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd.
2374 * ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd.
2376 These threshold options are also available from the command-line.
2378 port config pctype mapping
2379 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2381 Reset pctype mapping table::
2383 testpmd> port config (port_id) pctype mapping reset
2385 Update hardware defined pctype to software defined flow type mapping table::
2387 testpmd> port config (port_id) pctype mapping update (pctype_id_0[,pctype_id_1]*) (flow_type_id)
2391 * ``pctype_id_x``: hardware pctype id as index of bit in bitmask value of the pctype mapping table.
2393 * ``flow_type_id``: software flow type id as the index of the pctype mapping table.
2395 port config input set
2396 ~~~~~~~~~~~~~~~~~~~~~
2398 Config RSS/FDIR/FDIR flexible payload input set for some pctype::
2400 testpmd> port config (port_id) pctype (pctype_id) \
2401 (hash_inset|fdir_inset|fdir_flx_inset) \
2402 (get|set|clear) field (field_idx)
2404 Clear RSS/FDIR/FDIR flexible payload input set for some pctype::
2406 testpmd> port config (port_id) pctype (pctype_id) \
2407 (hash_inset|fdir_inset|fdir_flx_inset) clear all
2411 * ``pctype_id``: hardware packet classification types.
2412 * ``field_idx``: hardware field index.
2414 port config udp_tunnel_port
2415 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2417 Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
2419 testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe|ecpri (udp_port)
2421 port config tx_metadata
2422 ~~~~~~~~~~~~~~~~~~~~~~~
2424 Set Tx metadata value per port.
2425 testpmd will add this value to any Tx packet sent from this port::
2427 testpmd> port config (port_id) tx_metadata (value)
2432 Set/clear dynamic flag per port.
2433 testpmd will register this flag in the mbuf (same registration
2434 for both Tx and Rx). Then set/clear this flag for each Tx
2435 packet sent from this port. The set bit only works for Tx packet::
2437 testpmd> port config (port_id) dynf (name) (set|clear)
2442 To configure MTU(Maximum Transmission Unit) on devices using testpmd::
2444 testpmd> port config mtu (port_id) (value)
2446 port config rss hash key
2447 ~~~~~~~~~~~~~~~~~~~~~~~~
2449 To configure the RSS hash key used to compute the RSS
2450 hash of input [IP] packets received on port::
2452 testpmd> port config <port_id> rss-hash-key (ipv4|ipv4-frag|\
2453 ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|\
2454 ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|\
2455 ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|\
2456 ipv6-udp-ex <string of hex digits \
2457 (variable length, NIC dependent)>)
2459 port cleanup txq mbufs
2460 ~~~~~~~~~~~~~~~~~~~~~~
2462 To cleanup txq mbufs currently cached by driver::
2464 testpmd> port cleanup (port_id) txq (queue_id) (free_cnt)
2466 If the value of ``free_cnt`` is 0, driver should free all cached mbufs.
2471 The following sections show functions for device operations.
2476 Detach a device specified by pci address or virtual device args::
2478 testpmd> device detach (identifier)
2480 Before detaching a device associated with ports, the ports should be stopped and closed.
2482 For example, to detach a pci device whose address is 0002:03:00.0.
2484 .. code-block:: console
2486 testpmd> device detach 0002:03:00.0
2487 Removing a device...
2488 Port 1 is now closed
2489 EAL: Releasing pci mapped resource for 0002:03:00.0
2490 EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218a050000
2491 EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218c050000
2492 Device 0002:03:00.0 is detached
2493 Now total ports is 1
2495 For example, to detach a port created by pcap PMD.
2497 .. code-block:: console
2499 testpmd> device detach net_pcap0
2500 Removing a device...
2501 Port 0 is now closed
2502 Device net_pcap0 is detached
2503 Now total ports is 0
2506 In this case, identifier is ``net_pcap0``.
2507 This identifier format is the same as ``--vdev`` format of DPDK applications.
2509 Link Bonding Functions
2510 ----------------------
2512 The Link Bonding functions make it possible to dynamically create and
2513 manage link bonding devices from within testpmd interactive prompt.
2515 create bonded device
2516 ~~~~~~~~~~~~~~~~~~~~
2518 Create a new bonding device::
2520 testpmd> create bonded device (mode) (socket)
2522 For example, to create a bonded device in mode 1 on socket 0::
2524 testpmd> create bonded device 1 0
2525 created new bonded device (port X)
2530 Adds Ethernet device to a Link Bonding device::
2532 testpmd> add bonding slave (slave id) (port id)
2534 For example, to add Ethernet device (port 6) to a Link Bonding device (port 10)::
2536 testpmd> add bonding slave 6 10
2539 remove bonding slave
2540 ~~~~~~~~~~~~~~~~~~~~
2542 Removes an Ethernet slave device from a Link Bonding device::
2544 testpmd> remove bonding slave (slave id) (port id)
2546 For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10)::
2548 testpmd> remove bonding slave 6 10
2553 Set the Link Bonding mode of a Link Bonding device::
2555 testpmd> set bonding mode (value) (port id)
2557 For example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3)::
2559 testpmd> set bonding mode 3 10
2564 Set an Ethernet slave device as the primary device on a Link Bonding device::
2566 testpmd> set bonding primary (slave id) (port id)
2568 For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10)::
2570 testpmd> set bonding primary 6 10
2575 Set the MAC address of a Link Bonding device::
2577 testpmd> set bonding mac (port id) (mac)
2579 For example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01::
2581 testpmd> set bonding mac 10 00:00:00:00:00:01
2583 set bonding balance_xmit_policy
2584 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2586 Set the transmission policy for a Link Bonding device when it is in Balance XOR mode::
2588 testpmd> set bonding balance_xmit_policy (port_id) (l2|l23|l34)
2590 For example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports)::
2592 testpmd> set bonding balance_xmit_policy 10 l34
2595 set bonding mon_period
2596 ~~~~~~~~~~~~~~~~~~~~~~
2598 Set the link status monitoring polling period in milliseconds for a bonding device.
2600 This adds support for PMD slave devices which do not support link status interrupts.
2601 When the mon_period is set to a value greater than 0 then all PMD's which do not support
2602 link status ISR will be queried every polling interval to check if their link status has changed::
2604 testpmd> set bonding mon_period (port_id) (value)
2606 For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms::
2608 testpmd> set bonding mon_period 5 150
2611 set bonding lacp dedicated_queue
2612 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2614 Enable dedicated tx/rx queues on bonding devices slaves to handle LACP control plane traffic
2615 when in mode 4 (link-aggregation-802.3ad)::
2617 testpmd> set bonding lacp dedicated_queues (port_id) (enable|disable)
2620 set bonding agg_mode
2621 ~~~~~~~~~~~~~~~~~~~~
2623 Enable one of the specific aggregators mode when in mode 4 (link-aggregation-802.3ad)::
2625 testpmd> set bonding agg_mode (port_id) (bandwidth|count|stable)
2631 Show the current configuration of a Link Bonding device::
2633 testpmd> show bonding config (port id)
2636 to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4)
2637 in balance mode with a transmission policy of layer 2+3::
2639 testpmd> show bonding config 9
2641 Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23
2643 Active Slaves (3): [1 3 4]
2646 show bonding lacp info
2647 ~~~~~~~~~~~~~~~~~~~~~~
2649 Show information about the Link Bonding device in mode 4 (link-aggregation-802.3ad)::
2651 testpmd> show bonding lacp info (port_id)
2656 The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
2657 This is mainly useful for debugging purposes.
2658 Reference should be made to the appropriate datasheet for the network card for details on the register addresses
2659 and fields that can be accessed.
2664 Display the value of a port register::
2666 testpmd> read reg (port_id) (address)
2668 For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
2670 testpmd> read reg 0 0xEE00
2671 port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
2676 Display a port register bit field::
2678 testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
2680 For example, reading the lowest two bits from the register in the example above::
2682 testpmd> read regfield 0 0xEE00 0 1
2683 port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
2688 Display a single port register bit::
2690 testpmd> read regbit (port_id) (address) (bit_x)
2692 For example, reading the lowest bit from the register in the example above::
2694 testpmd> read regbit 0 0xEE00 0
2695 port 0 PCI register at offset 0xEE00: bit 0=1
2700 Set the value of a port register::
2702 testpmd> write reg (port_id) (address) (value)
2704 For example, to clear a register::
2706 testpmd> write reg 0 0xEE00 0x0
2707 port 0 PCI register at offset 0xEE00: 0x00000000 (0)
2712 Set bit field of a port register::
2714 testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
2716 For example, writing to the register cleared in the example above::
2718 testpmd> write regfield 0 0xEE00 0 1 2
2719 port 0 PCI register at offset 0xEE00: 0x00000002 (2)
2724 Set single bit value of a port register::
2726 testpmd> write regbit (port_id) (address) (bit_x) (value)
2728 For example, to set the high bit in the register from the example above::
2730 testpmd> write regbit 0 0xEE00 31 1
2731 port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
2733 Traffic Metering and Policing
2734 -----------------------------
2736 The following section shows functions for configuring traffic metering and
2737 policing on the ethernet device through the use of generic ethdev API.
2739 show port traffic management capability
2740 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2742 Show traffic metering and policing capability of the port::
2744 testpmd> show port meter cap (port_id)
2746 add port meter profile (srTCM rfc2967)
2747 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2749 Add meter profile (srTCM rfc2697) to the ethernet device::
2751 testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
2752 (cir) (cbs) (ebs) (packet_mode)
2756 * ``profile_id``: ID for the meter profile.
2757 * ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
2758 * ``cbs``: Committed Burst Size (CBS) (bytes or packets).
2759 * ``ebs``: Excess Burst Size (EBS) (bytes or packets).
2760 * ``packet_mode``: Packets mode for meter profile.
2762 add port meter profile (trTCM rfc2968)
2763 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2765 Add meter profile (srTCM rfc2698) to the ethernet device::
2767 testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
2768 (cir) (pir) (cbs) (pbs) (packet_mode)
2772 * ``profile_id``: ID for the meter profile.
2773 * ``cir``: Committed information rate (bytes per second or packets per second).
2774 * ``pir``: Peak information rate (bytes per second or packets per second).
2775 * ``cbs``: Committed burst size (bytes or packets).
2776 * ``pbs``: Peak burst size (bytes or packets).
2777 * ``packet_mode``: Packets mode for meter profile.
2779 add port meter profile (trTCM rfc4115)
2780 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2782 Add meter profile (trTCM rfc4115) to the ethernet device::
2784 testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
2785 (cir) (eir) (cbs) (ebs) (packet_mode)
2789 * ``profile_id``: ID for the meter profile.
2790 * ``cir``: Committed information rate (bytes per second or packets per second).
2791 * ``eir``: Excess information rate (bytes per second or packets per second).
2792 * ``cbs``: Committed burst size (bytes or packets).
2793 * ``ebs``: Excess burst size (bytes or packets).
2794 * ``packet_mode``: Packets mode for meter profile.
2796 delete port meter profile
2797 ~~~~~~~~~~~~~~~~~~~~~~~~~
2799 Delete meter profile from the ethernet device::
2801 testpmd> del port meter profile (port_id) (profile_id)
2806 Create new policy object for the ethernet device::
2808 testpmd> add port meter policy (port_id) (policy_id) g_actions \
2809 {action} y_actions {action} r_actions {action}
2813 * ``policy_id``: policy ID.
2814 * ``action``: action lists for green/yellow/red colors.
2819 Delete policy object for the ethernet device::
2821 testpmd> del port meter policy (port_id) (policy_id)
2825 * ``policy_id``: policy ID.
2830 Create new meter object for the ethernet device::
2832 testpmd> create port meter (port_id) (mtr_id) (profile_id) \
2833 (policy_id) (meter_enable) (stats_mask) (shared) \
2834 (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\
2839 * ``mtr_id``: meter object ID.
2840 * ``profile_id``: ID for the meter profile.
2841 * ``policy_id``: ID for the policy.
2842 * ``meter_enable``: When this parameter has a non-zero value, the meter object
2843 gets enabled at the time of creation, otherwise remains disabled.
2844 * ``stats_mask``: Mask of statistics counter types to be enabled for the
2846 * ``shared``: When this parameter has a non-zero value, the meter object is
2847 shared by multiple flows. Otherwise, meter object is used by single flow.
2848 * ``use_pre_meter_color``: When this parameter has a non-zero value, the
2849 input color for the current meter object is determined by the latest meter
2850 object in the same flow. Otherwise, the current meter object uses the
2851 *dscp_table* to determine the input color.
2852 * ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input
2853 color, 0 <= x <= 63.
2858 Enable meter for the ethernet device::
2860 testpmd> enable port meter (port_id) (mtr_id)
2865 Disable meter for the ethernet device::
2867 testpmd> disable port meter (port_id) (mtr_id)
2872 Delete meter for the ethernet device::
2874 testpmd> del port meter (port_id) (mtr_id)
2876 Set port meter profile
2877 ~~~~~~~~~~~~~~~~~~~~~~
2879 Set meter profile for the ethernet device::
2881 testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2883 set port meter dscp table
2884 ~~~~~~~~~~~~~~~~~~~~~~~~~
2886 Set meter dscp table for the ethernet device::
2888 testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0) \
2889 (dscp_tbl_entry1)...(dscp_tbl_entry63)]
2891 set port meter stats mask
2892 ~~~~~~~~~~~~~~~~~~~~~~~~~
2894 Set meter stats mask for the ethernet device::
2896 testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2900 * ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2902 show port meter stats
2903 ~~~~~~~~~~~~~~~~~~~~~
2905 Show meter stats of the ethernet device::
2907 testpmd> show port meter stats (port_id) (mtr_id) (clear)
2911 * ``clear``: Flag that indicates whether the statistics counters should
2912 be cleared (i.e. set to zero) immediately after they have been read or not.
2917 The following section shows functions for configuring traffic management on
2918 the ethernet device through the use of generic TM API.
2920 show port traffic management capability
2921 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2923 Show traffic management capability of the port::
2925 testpmd> show port tm cap (port_id)
2927 show port traffic management capability (hierarchy level)
2928 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2930 Show traffic management hierarchy level capability of the port::
2932 testpmd> show port tm level cap (port_id) (level_id)
2934 show port traffic management capability (hierarchy node level)
2935 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2937 Show the traffic management hierarchy node capability of the port::
2939 testpmd> show port tm node cap (port_id) (node_id)
2941 show port traffic management hierarchy node type
2942 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2944 Show the port traffic management hierarchy node type::
2946 testpmd> show port tm node type (port_id) (node_id)
2948 show port traffic management hierarchy node stats
2949 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2951 Show the port traffic management hierarchy node statistics::
2953 testpmd> show port tm node stats (port_id) (node_id) (clear)
2957 * ``clear``: When this parameter has a non-zero value, the statistics counters
2958 are cleared (i.e. set to zero) immediately after they have been read,
2959 otherwise the statistics counters are left untouched.
2961 Add port traffic management private shaper profile
2962 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2964 Add the port traffic management private shaper profile::
2966 testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
2967 (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
2968 (packet_length_adjust) (packet_mode)
2972 * ``shaper_profile id``: Shaper profile ID for the new profile.
2973 * ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second).
2974 * ``cmit_tb_size``: Committed token bucket size (bytes or packets).
2975 * ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second).
2976 * ``peak_tb_size``: Peak token bucket size (bytes or packets).
2977 * ``packet_length_adjust``: The value (bytes) to be added to the length of
2978 each packet for the purpose of shaping. This parameter value can be used to
2979 correct the packet length with the framing overhead bytes that are consumed
2981 * ``packet_mode``: Shaper configured in packet mode. This parameter value if
2982 zero, configures shaper in byte mode and if non-zero configures it in packet
2985 Delete port traffic management private shaper profile
2986 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2988 Delete the port traffic management private shaper::
2990 testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
2994 * ``shaper_profile id``: Shaper profile ID that needs to be deleted.
2996 Add port traffic management shared shaper
2997 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2999 Create the port traffic management shared shaper::
3001 testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \
3006 * ``shared_shaper_id``: Shared shaper ID to be created.
3007 * ``shaper_profile id``: Shaper profile ID for shared shaper.
3009 Set port traffic management shared shaper
3010 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3012 Update the port traffic management shared shaper::
3014 testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \
3019 * ``shared_shaper_id``: Shared shaper ID to be update.
3020 * ``shaper_profile id``: Shaper profile ID for shared shaper.
3022 Delete port traffic management shared shaper
3023 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3025 Delete the port traffic management shared shaper::
3027 testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
3031 * ``shared_shaper_id``: Shared shaper ID to be deleted.
3033 Set port traffic management hierarchy node private shaper
3034 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3036 set the port traffic management hierarchy node private shaper::
3038 testpmd> set port tm node shaper profile (port_id) (node_id) \
3043 * ``shaper_profile id``: Private shaper profile ID to be enabled on the
3046 Add port traffic management WRED profile
3047 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3049 Create a new WRED profile::
3051 testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
3052 (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
3053 (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
3054 (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
3058 * ``wred_profile id``: Identifier for the newly create WRED profile
3059 * ``color_g``: Packet color (green)
3060 * ``min_th_g``: Minimum queue threshold for packet with green color
3061 * ``max_th_g``: Minimum queue threshold for packet with green color
3062 * ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp)
3063 * ``wq_log2_g``: Negated log2 of queue weight (wq)
3064 * ``color_y``: Packet color (yellow)
3065 * ``min_th_y``: Minimum queue threshold for packet with yellow color
3066 * ``max_th_y``: Minimum queue threshold for packet with yellow color
3067 * ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp)
3068 * ``wq_log2_y``: Negated log2 of queue weight (wq)
3069 * ``color_r``: Packet color (red)
3070 * ``min_th_r``: Minimum queue threshold for packet with yellow color
3071 * ``max_th_r``: Minimum queue threshold for packet with yellow color
3072 * ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp)
3073 * ``wq_log2_r``: Negated log2 of queue weight (wq)
3075 Delete port traffic management WRED profile
3076 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3078 Delete the WRED profile::
3080 testpmd> del port tm node wred profile (port_id) (wred_profile_id)
3082 Add port traffic management hierarchy nonleaf node
3083 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3085 Add nonleaf node to port traffic management hierarchy::
3087 testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \
3088 (priority) (weight) (level_id) (shaper_profile_id) \
3089 (n_sp_priorities) (stats_mask) (n_shared_shapers) \
3090 [(shared_shaper_0) (shared_shaper_1) ...] \
3094 * ``parent_node_id``: Node ID of the parent.
3095 * ``priority``: Node priority (highest node priority is zero). This is used by
3096 the SP algorithm running on the parent node for scheduling this node.
3097 * ``weight``: Node weight (lowest weight is one). The node weight is relative
3098 to the weight sum of all siblings that have the same priority. It is used by
3099 the WFQ algorithm running on the parent node for scheduling this node.
3100 * ``level_id``: Hierarchy level of the node.
3101 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
3103 * ``n_sp_priorities``: Number of strict priorities.
3104 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
3105 * ``n_shared_shapers``: Number of shared shapers.
3106 * ``shared_shaper_id``: Shared shaper id.
3108 Add port traffic management hierarchy nonleaf node with packet mode
3109 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3111 Add nonleaf node with packet mode to port traffic management hierarchy::
3113 testpmd> add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id) \
3114 (priority) (weight) (level_id) (shaper_profile_id) \
3115 (n_sp_priorities) (stats_mask) (n_shared_shapers) \
3116 [(shared_shaper_0) (shared_shaper_1) ...] \
3120 * ``parent_node_id``: Node ID of the parent.
3121 * ``priority``: Node priority (highest node priority is zero). This is used by
3122 the SP algorithm running on the parent node for scheduling this node.
3123 * ``weight``: Node weight (lowest weight is one). The node weight is relative
3124 to the weight sum of all siblings that have the same priority. It is used by
3125 the WFQ algorithm running on the parent node for scheduling this node.
3126 * ``level_id``: Hierarchy level of the node.
3127 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
3129 * ``n_sp_priorities``: Number of strict priorities. Packet mode is enabled on
3131 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
3132 * ``n_shared_shapers``: Number of shared shapers.
3133 * ``shared_shaper_id``: Shared shaper id.
3135 Add port traffic management hierarchy leaf node
3136 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3138 Add leaf node to port traffic management hierarchy::
3140 testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \
3141 (priority) (weight) (level_id) (shaper_profile_id) \
3142 (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \
3143 [(shared_shaper_id) (shared_shaper_id) ...] \
3147 * ``parent_node_id``: Node ID of the parent.
3148 * ``priority``: Node priority (highest node priority is zero). This is used by
3149 the SP algorithm running on the parent node for scheduling this node.
3150 * ``weight``: Node weight (lowest weight is one). The node weight is relative
3151 to the weight sum of all siblings that have the same priority. It is used by
3152 the WFQ algorithm running on the parent node for scheduling this node.
3153 * ``level_id``: Hierarchy level of the node.
3154 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
3156 * ``cman_mode``: Congestion management mode to be enabled for this node.
3157 * ``wred_profile_id``: WRED profile id to be enabled for this node.
3158 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
3159 * ``n_shared_shapers``: Number of shared shapers.
3160 * ``shared_shaper_id``: Shared shaper id.
3162 Delete port traffic management hierarchy node
3163 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3165 Delete node from port traffic management hierarchy::
3167 testpmd> del port tm node (port_id) (node_id)
3169 Update port traffic management hierarchy parent node
3170 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3172 Update port traffic management hierarchy parent node::
3174 testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \
3177 This function can only be called after the hierarchy commit invocation. Its
3178 success depends on the port support for this operation, as advertised through
3179 the port capability set. This function is valid for all nodes of the traffic
3180 management hierarchy except root node.
3182 Suspend port traffic management hierarchy node
3183 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3185 testpmd> suspend port tm node (port_id) (node_id)
3187 Resume port traffic management hierarchy node
3188 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3190 testpmd> resume port tm node (port_id) (node_id)
3192 Commit port traffic management hierarchy
3193 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3195 Commit the traffic management hierarchy on the port::
3197 testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
3201 * ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function
3202 call failure. On the other hand, hierarchy is preserved when this parameter
3205 Set port traffic management mark VLAN dei
3206 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3208 Enables/Disables the traffic management marking on the port for VLAN packets::
3210 testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red>
3214 * ``port_id``: The port which on which VLAN packets marked as ``green`` or
3215 ``yellow`` or ``red`` will have dei bit enabled
3217 * ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green
3219 * ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow
3221 * ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red
3223 Set port traffic management mark IP dscp
3224 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3226 Enables/Disables the traffic management marking on the port for IP dscp packets::
3228 testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red>
3232 * ``port_id``: The port which on which IP packets marked as ``green`` or
3233 ``yellow`` or ``red`` will have IP dscp bits updated
3235 * ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets
3237 * ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets
3239 * ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets
3241 Set port traffic management mark IP ecn
3242 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3244 Enables/Disables the traffic management marking on the port for IP ecn packets::
3246 testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red>
3250 * ``port_id``: The port which on which IP packets marked as ``green`` or
3251 ``yellow`` or ``red`` will have IP ecn bits updated
3253 * ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01 or 2'b10
3254 to ecn of 2'b11 when IP is caring TCP or SCTP
3256 * ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
3257 to ecn of 2'b11 when IP is caring TCP or SCTP
3259 * ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
3260 to ecn of 2'b11 when IP is caring TCP or SCTP
3265 This section details the available filter functions that are available.
3267 Note these functions interface the deprecated legacy filtering framework,
3268 superseded by *rte_flow*. See `Flow rules management`_.
3270 .. _testpmd_flow_director:
3275 Set flow director's input masks::
3277 flow_director_mask (port_id) mode IP vlan (vlan_value) \
3278 src_mask (ipv4_src) (ipv6_src) (src_port) \
3279 dst_mask (ipv4_dst) (ipv6_dst) (dst_port)
3281 flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value)
3283 flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \
3284 mac (mac_value) tunnel-type (tunnel_type_value) \
3285 tunnel-id (tunnel_id_value)
3287 Example, to set flow director mask on port 0::
3289 testpmd> flow_director_mask 0 mode IP vlan 0xefff \
3290 src_mask 255.255.255.255 \
3291 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF \
3292 dst_mask 255.255.255.255 \
3293 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF
3295 flow_director_flex_payload
3296 ~~~~~~~~~~~~~~~~~~~~~~~~~~
3298 Configure flexible payload selection::
3300 flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config)
3302 For example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload::
3304 testpmd> flow_director_flex_payload 0 l4 \
3305 (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
3308 .. _testpmd_rte_flow:
3310 Flow rules management
3311 ---------------------
3313 Control of the generic flow API (*rte_flow*) is fully exposed through the
3314 ``flow`` command (configuration, validation, creation, destruction, queries
3315 and operation modes).
3317 Considering *rte_flow* overlaps with all `Filter Functions`_, using both
3318 features simultaneously may cause undefined side-effects and is therefore
3324 Because the ``flow`` command uses dynamic tokens to handle the large number
3325 of possible flow rules combinations, its behavior differs slightly from
3326 other commands, in particular:
3328 - Pressing *?* or the *<tab>* key displays contextual help for the current
3329 token, not that of the entire command.
3331 - Optional and repeated parameters are supported (provided they are listed
3332 in the contextual help).
3334 The first parameter stands for the operation mode. Possible operations and
3335 their general syntax are described below. They are covered in detail in the
3338 - Get info about flow engine::
3342 - Configure flow engine::
3344 flow configure {port_id}
3345 [queues_number {number}] [queues_size {size}]
3346 [counters_number {number}]
3347 [aging_counters_number {number}]
3348 [meters_number {number}]
3350 - Create a pattern template::
3351 flow pattern_template {port_id} create [pattern_template_id {id}]
3352 [relaxed {boolean}] [ingress] [egress] [transfer]
3353 template {item} [/ {item} [...]] / end
3355 - Destroy a pattern template::
3357 flow pattern_template {port_id} destroy pattern_template {id} [...]
3359 - Create an actions template::
3361 flow actions_template {port_id} create [actions_template_id {id}]
3362 [ingress] [egress] [transfer]
3363 template {action} [/ {action} [...]] / end
3364 mask {action} [/ {action} [...]] / end
3366 - Destroy an actions template::
3368 flow actions_template {port_id} destroy actions_template {id} [...]
3372 flow table {port_id} create
3374 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3375 rules_number {number}
3376 pattern_template {pattern_template_id}
3377 actions_template {actions_template_id}
3381 flow table {port_id} destroy table {id} [...]
3383 - Check whether a flow rule can be created::
3385 flow validate {port_id}
3386 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3387 pattern {item} [/ {item} [...]] / end
3388 actions {action} [/ {action} [...]] / end
3390 - Enqueue creation of a flow rule::
3392 flow queue {port_id} create {queue_id}
3393 [postpone {boolean}] template_table {table_id}
3394 pattern_template {pattern_template_index}
3395 actions_template {actions_template_index}
3396 pattern {item} [/ {item} [...]] / end
3397 actions {action} [/ {action} [...]] / end
3399 - Enqueue destruction of specific flow rules::
3401 flow queue {port_id} destroy {queue_id}
3402 [postpone {boolean}] rule {rule_id} [...]
3404 - Push enqueued operations::
3406 flow push {port_id} queue {queue_id}
3408 - Pull all operations results from a queue::
3410 flow pull {port_id} queue {queue_id}
3412 - Create a flow rule::
3414 flow create {port_id}
3415 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3416 pattern {item} [/ {item} [...]] / end
3417 actions {action} [/ {action} [...]] / end
3419 - Destroy specific flow rules::
3421 flow destroy {port_id} rule {rule_id} [...]
3423 - Destroy all flow rules::
3425 flow flush {port_id}
3427 - Query an existing flow rule::
3429 flow query {port_id} {rule_id} {action}
3431 - List existing flow rules sorted by priority, filtered by group
3434 flow list {port_id} [group {group_id}] [...]
3436 - Restrict ingress traffic to the defined flow rules::
3438 flow isolate {port_id} {boolean}
3440 - Dump internal representation information of all flows in hardware::
3442 flow dump {port_id} all {output_file}
3446 flow dump {port_id} rule {rule_id} {output_file}
3448 - List and destroy aged flow rules::
3450 flow aged {port_id} [destroy]
3452 - Tunnel offload - create a tunnel stub::
3454 flow tunnel create {port_id} type {tunnel_type}
3456 - Tunnel offload - destroy a tunnel stub::
3458 flow tunnel destroy {port_id} id {tunnel_id}
3460 - Tunnel offload - list port tunnel stubs::
3462 flow tunnel list {port_id}
3464 Retrieving info about flow management engine
3465 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3467 ``flow info`` retrieves info on pre-configurable resources in the underlying
3468 device to give a hint of possible values for flow engine configuration.
3470 ``rte_flow_info_get()``::
3474 If successful, it will show::
3476 Flow engine resources on port #[...]:
3477 Number of queues: #[...]
3478 Size of queues: #[...]
3479 Number of counters: #[...]
3480 Number of aging objects: #[...]
3481 Number of meters: #[...]
3483 Otherwise it will show an error message of the form::
3485 Caught error type [...] ([...]): [...]
3487 Configuring flow management engine
3488 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3490 ``flow configure`` pre-allocates all the needed resources in the underlying
3491 device to be used later at the flow creation. Flow queues are allocated as well
3492 for asynchronous flow creation/destruction operations. It is bound to
3493 ``rte_flow_configure()``::
3495 flow configure {port_id}
3496 [queues_number {number}] [queues_size {size}]
3497 [counters_number {number}]
3498 [aging_counters_number {number}]
3499 [meters_number {number}]
3501 If successful, it will show::
3503 Configure flows on port #[...]: number of queues #[...] with #[...] elements
3505 Otherwise it will show an error message of the form::
3507 Caught error type [...] ([...]): [...]
3509 Creating pattern templates
3510 ~~~~~~~~~~~~~~~~~~~~~~~~~~
3512 ``flow pattern_template create`` creates the specified pattern template.
3513 It is bound to ``rte_flow_pattern_template_create()``::
3515 flow pattern_template {port_id} create [pattern_template_id {id}]
3516 [relaxed {boolean}] [ingress] [egress] [transfer]
3517 template {item} [/ {item} [...]] / end
3519 If successful, it will show::
3521 Pattern template #[...] created
3523 Otherwise it will show an error message of the form::
3525 Caught error type [...] ([...]): [...]
3527 This command uses the same pattern items as ``flow create``,
3528 their format is described in `Creating flow rules`_.
3530 Destroying pattern templates
3531 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3533 ``flow pattern_template destroy`` destroys one or more pattern templates
3534 from their template ID (as returned by ``flow pattern_template create``),
3535 this command calls ``rte_flow_pattern_template_destroy()`` as many
3536 times as necessary::
3538 flow pattern_template {port_id} destroy pattern_template {id} [...]
3540 If successful, it will show::
3542 Pattern template #[...] destroyed
3544 It does not report anything for pattern template IDs that do not exist.
3545 The usual error message is shown when a pattern template cannot be destroyed::
3547 Caught error type [...] ([...]): [...]
3549 Creating actions templates
3550 ~~~~~~~~~~~~~~~~~~~~~~~~~~
3552 ``flow actions_template create`` creates the specified actions template.
3553 It is bound to ``rte_flow_actions_template_create()``::
3555 flow actions_template {port_id} create [actions_template_id {id}]
3556 [ingress] [egress] [transfer]
3557 template {action} [/ {action} [...]] / end
3558 mask {action} [/ {action} [...]] / end
3560 If successful, it will show::
3562 Actions template #[...] created
3564 Otherwise it will show an error message of the form::
3566 Caught error type [...] ([...]): [...]
3568 This command uses the same actions as ``flow create``,
3569 their format is described in `Creating flow rules`_.
3571 Destroying actions templates
3572 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3574 ``flow actions_template destroy`` destroys one or more actions templates
3575 from their template ID (as returned by ``flow actions_template create``),
3576 this command calls ``rte_flow_actions_template_destroy()`` as many
3577 times as necessary::
3579 flow actions_template {port_id} destroy actions_template {id} [...]
3581 If successful, it will show::
3583 Actions template #[...] destroyed
3585 It does not report anything for actions template IDs that do not exist.
3586 The usual error message is shown when an actions template cannot be destroyed::
3588 Caught error type [...] ([...]): [...]
3590 Creating template table
3591 ~~~~~~~~~~~~~~~~~~~~~~~
3593 ``flow template_table create`` creates the specified template table.
3594 It is bound to ``rte_flow_template_table_create()``::
3596 flow template_table {port_id} create
3597 [table_id {id}] [group {group_id}]
3598 [priority {level}] [ingress] [egress] [transfer]
3599 rules_number {number}
3600 pattern_template {pattern_template_id}
3601 actions_template {actions_template_id}
3603 If successful, it will show::
3605 Template table #[...] created
3607 Otherwise it will show an error message of the form::
3609 Caught error type [...] ([...]): [...]
3611 Destroying flow table
3612 ~~~~~~~~~~~~~~~~~~~~~
3614 ``flow template_table destroy`` destroys one or more template tables
3615 from their table ID (as returned by ``flow template_table create``),
3616 this command calls ``rte_flow_template_table_destroy()`` as many
3617 times as necessary::
3619 flow template_table {port_id} destroy table {id} [...]
3621 If successful, it will show::
3623 Template table #[...] destroyed
3625 It does not report anything for table IDs that do not exist.
3626 The usual error message is shown when a table cannot be destroyed::
3628 Caught error type [...] ([...]): [...]
3630 Pushing enqueued operations
3631 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
3633 ``flow push`` pushes all the outstanding enqueued operations
3634 to the underlying device immediately.
3635 It is bound to ``rte_flow_push()``::
3637 flow push {port_id} queue {queue_id}
3639 If successful, it will show::
3641 Queue #[...] operations pushed
3643 The usual error message is shown when operations cannot be pushed::
3645 Caught error type [...] ([...]): [...]
3647 Pulling flow operations results
3648 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3650 ``flow pull`` asks the underlying device about flow queue operations
3651 results and return all the processed (successfully or not) operations.
3652 It is bound to ``rte_flow_pull()``::
3654 flow pull {port_id} queue {queue_id}
3656 If successful, it will show::
3658 Queue #[...] pulled #[...] operations (#[...] failed, #[...] succeeded)
3660 The usual error message is shown when operations results cannot be pulled::
3662 Caught error type [...] ([...]): [...]
3664 Creating a tunnel stub for offload
3665 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3667 ``flow tunnel create`` setup a tunnel stub for tunnel offload flow rules::
3669 flow tunnel create {port_id} type {tunnel_type}
3671 If successful, it will return a tunnel stub ID usable with other commands::
3673 port [...]: flow tunnel #[...] type [...]
3675 Tunnel stub ID is relative to a port.
3677 Destroying tunnel offload stub
3678 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3680 ``flow tunnel destroy`` destroy port tunnel stub::
3682 flow tunnel destroy {port_id} id {tunnel_id}
3684 Listing tunnel offload stubs
3685 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3687 ``flow tunnel list`` list port tunnel offload stubs::
3689 flow tunnel list {port_id}
3691 Validating flow rules
3692 ~~~~~~~~~~~~~~~~~~~~~
3694 ``flow validate`` reports whether a flow rule would be accepted by the
3695 underlying device in its current state but stops short of creating it. It is
3696 bound to ``rte_flow_validate()``::
3698 flow validate {port_id}
3699 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3700 pattern {item} [/ {item} [...]] / end
3701 actions {action} [/ {action} [...]] / end
3703 If successful, it will show::
3707 Otherwise it will show an error message of the form::
3709 Caught error type [...] ([...]): [...]
3711 This command uses the same parameters as ``flow create``, their format is
3712 described in `Creating flow rules`_.
3714 Check whether redirecting any Ethernet packet received on port 0 to RX queue
3715 index 6 is supported::
3717 testpmd> flow validate 0 ingress pattern eth / end
3718 actions queue index 6 / end
3722 Port 0 does not support TCPv6 rules::
3724 testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end
3726 Caught error type 9 (specific pattern item): Invalid argument
3732 ``flow create`` validates and creates the specified flow rule. It is bound
3733 to ``rte_flow_create()``::
3735 flow create {port_id}
3736 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3737 [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}]
3738 pattern {item} [/ {item} [...]] / end
3739 actions {action} [/ {action} [...]] / end
3741 If successful, it will return a flow rule ID usable with other commands::
3743 Flow rule #[...] created
3745 Otherwise it will show an error message of the form::
3747 Caught error type [...] ([...]): [...]
3749 Parameters describe in the following order:
3751 - Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens).
3752 - Tunnel offload specification (tunnel_set, tunnel_match)
3753 - A matching pattern, starting with the *pattern* token and terminated by an
3755 - Actions, starting with the *actions* token and terminated by an *end*
3758 These translate directly to *rte_flow* objects provided as-is to the
3759 underlying functions.
3761 The shortest valid definition only comprises mandatory tokens::
3763 testpmd> flow create 0 pattern end actions end
3765 Note that PMDs may refuse rules that essentially do nothing such as this
3768 **All unspecified object values are automatically initialized to 0.**
3770 Enqueueing creation of flow rules
3771 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3773 ``flow queue create`` adds creation operation of a flow rule to a queue.
3774 It is bound to ``rte_flow_async_create()``::
3776 flow queue {port_id} create {queue_id}
3777 [postpone {boolean}] template_table {table_id}
3778 pattern_template {pattern_template_index}
3779 actions_template {actions_template_index}
3780 pattern {item} [/ {item} [...]] / end
3781 actions {action} [/ {action} [...]] / end
3783 If successful, it will return a flow rule ID usable with other commands::
3785 Flow rule #[...] creaion enqueued
3787 Otherwise it will show an error message of the form::
3789 Caught error type [...] ([...]): [...]
3791 This command uses the same pattern items and actions as ``flow create``,
3792 their format is described in `Creating flow rules`_.
3794 ``flow queue pull`` must be called to retrieve the operation status.
3799 These tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3800 specified before the ``pattern`` token.
3802 - ``group {group id}``: priority group.
3803 - ``priority {level}``: priority level within group.
3804 - ``ingress``: rule applies to ingress traffic.
3805 - ``egress``: rule applies to egress traffic.
3806 - ``transfer``: apply rule directly to endpoints found in pattern.
3808 Please note that use of ``transfer`` attribute requires that the flow and
3809 its indirect components be managed via so-called ``transfer`` proxy port.
3810 See `show flow transfer proxy port ID for the given port`_ for details.
3812 Each instance of an attribute specified several times overrides the previous
3813 value as shown below (group 4 is used)::
3815 testpmd> flow create 0 group 42 group 24 group 4 [...]
3817 Note that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3819 While not specifying a direction is an error, some rules may allow both
3822 Most rules affect RX therefore contain the ``ingress`` token::
3824 testpmd> flow create 0 ingress pattern [...]
3829 Indicate tunnel offload rule type
3831 - ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type.
3832 - ``tunnel_match {tunnel_id}``: mark rule as tunnel offload match type.
3837 A matching pattern starts after the ``pattern`` token. It is made of pattern
3838 items and is terminated by a mandatory ``end`` item.
3840 Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3841 rte_flow_item_type``).
3843 The ``/`` token is used as a separator between pattern items as shown
3846 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3848 Note that protocol items like these must be stacked from lowest to highest
3849 layer to make sense. For instance, the following rule is either invalid or
3850 unlikely to match any packet::
3852 testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3854 More information on these restrictions can be found in the *rte_flow*
3857 Several items support additional specification structures, for example
3858 ``ipv4`` allows specifying source and destination addresses as follows::
3860 testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1
3861 dst is 10.2.0.0 / end [...]
3863 This rule matches all IPv4 traffic with the specified properties.
3865 In this example, ``src`` and ``dst`` are field names of the underlying
3866 ``struct rte_flow_item_ipv4`` object. All item properties can be specified
3867 in a similar fashion.
3869 The ``is`` token means that the subsequent value must be matched exactly,
3870 and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3871 accordingly. Possible assignment tokens are:
3873 - ``is``: match value perfectly (with full bit-mask).
3874 - ``spec``: match value according to configured bit-mask.
3875 - ``last``: specify upper bound to establish a range.
3876 - ``mask``: specify bit-mask with relevant bits set to one.
3877 - ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one.
3879 These yield identical results::
3881 ipv4 src is 10.1.1.1
3885 ipv4 src spec 10.1.1.1 src mask 255.255.255.255
3889 ipv4 src spec 10.1.1.1 src prefix 32
3893 ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value
3897 ipv4 src is 10.1.1.1 src last 0 # 0 disables range
3899 Inclusive ranges can be defined with ``last``::
3901 ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4
3903 Note that ``mask`` affects both ``spec`` and ``last``::
3905 ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0
3906 # matches 10.1.0.0 to 10.2.255.255
3908 Properties can be modified multiple times::
3910 ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4
3914 ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16
3919 This section lists supported pattern items and their attributes, if any.
3921 - ``end``: end list of pattern items.
3923 - ``void``: no-op pattern item.
3925 - ``invert``: perform actions when pattern does not match.
3927 - ``any``: match any protocol for the current layer.
3929 - ``num {unsigned}``: number of layers covered.
3931 - ``pf``: match traffic from/to the physical function.
3933 - ``vf``: match traffic from/to a virtual function ID.
3935 - ``id {unsigned}``: VF ID.
3937 - ``phy_port``: match traffic from/to a specific physical port.
3939 - ``index {unsigned}``: physical port index.
3941 - ``port_id``: match traffic from/to a given DPDK port ID.
3943 - ``id {unsigned}``: DPDK port ID.
3945 - ``mark``: match value set in previously matched flow rule using the mark action.
3947 - ``id {unsigned}``: arbitrary integer value.
3949 - ``raw``: match an arbitrary byte string.
3951 - ``relative {boolean}``: look for pattern after the previous item.
3952 - ``search {boolean}``: search pattern from offset (see also limit).
3953 - ``offset {integer}``: absolute or relative offset for pattern.
3954 - ``limit {unsigned}``: search area limit for start of pattern.
3955 - ``pattern {string}``: byte string to look for.
3956 - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for.
3958 - ``eth``: match Ethernet header.
3960 - ``dst {MAC-48}``: destination MAC.
3961 - ``src {MAC-48}``: source MAC.
3962 - ``type {unsigned}``: EtherType or TPID.
3964 - ``vlan``: match 802.1Q/ad VLAN tag.
3966 - ``tci {unsigned}``: tag control information.
3967 - ``pcp {unsigned}``: priority code point.
3968 - ``dei {unsigned}``: drop eligible indicator.
3969 - ``vid {unsigned}``: VLAN identifier.
3970 - ``inner_type {unsigned}``: inner EtherType or TPID.
3972 - ``ipv4``: match IPv4 header.
3974 - ``version_ihl {unsigned}``: IPv4 version and IP header length.
3975 - ``tos {unsigned}``: type of service.
3976 - ``ttl {unsigned}``: time to live.
3977 - ``proto {unsigned}``: next protocol ID.
3978 - ``src {ipv4 address}``: source address.
3979 - ``dst {ipv4 address}``: destination address.
3981 - ``ipv6``: match IPv6 header.
3983 - ``tc {unsigned}``: traffic class.
3984 - ``flow {unsigned}``: flow label.
3985 - ``proto {unsigned}``: protocol (next header).
3986 - ``hop {unsigned}``: hop limit.
3987 - ``src {ipv6 address}``: source address.
3988 - ``dst {ipv6 address}``: destination address.
3990 - ``icmp``: match ICMP header.
3992 - ``type {unsigned}``: ICMP packet type.
3993 - ``code {unsigned}``: ICMP packet code.
3995 - ``udp``: match UDP header.
3997 - ``src {unsigned}``: UDP source port.
3998 - ``dst {unsigned}``: UDP destination port.
4000 - ``tcp``: match TCP header.
4002 - ``src {unsigned}``: TCP source port.
4003 - ``dst {unsigned}``: TCP destination port.
4005 - ``sctp``: match SCTP header.
4007 - ``src {unsigned}``: SCTP source port.
4008 - ``dst {unsigned}``: SCTP destination port.
4009 - ``tag {unsigned}``: validation tag.
4010 - ``cksum {unsigned}``: checksum.
4012 - ``vxlan``: match VXLAN header.
4014 - ``vni {unsigned}``: VXLAN identifier.
4015 - ``last_rsvd {unsigned}``: VXLAN last reserved 8-bits.
4017 - ``e_tag``: match IEEE 802.1BR E-Tag header.
4019 - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
4021 - ``nvgre``: match NVGRE header.
4023 - ``tni {unsigned}``: virtual subnet ID.
4025 - ``mpls``: match MPLS header.
4027 - ``label {unsigned}``: MPLS label.
4029 - ``gre``: match GRE header.
4031 - ``protocol {unsigned}``: protocol type.
4033 - ``gre_key``: match GRE optional key field.
4035 - ``value {unsigned}``: key value.
4037 - ``gre_option``: match GRE optional fields(checksum/key/sequence).
4039 - ``checksum {unsigned}``: checksum value.
4040 - ``key {unsigned}``: key value.
4041 - ``sequence {unsigned}``: sequence number value.
4043 - ``fuzzy``: fuzzy pattern match, expect faster than default.
4045 - ``thresh {unsigned}``: accuracy threshold.
4047 - ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header.
4049 - ``teid {unsigned}``: tunnel endpoint identifier.
4051 - ``geneve``: match GENEVE header.
4053 - ``vni {unsigned}``: virtual network identifier.
4054 - ``protocol {unsigned}``: protocol type.
4056 - ``geneve-opt``: match GENEVE header option.
4058 - ``class {unsigned}``: GENEVE option class.
4059 - ``type {unsigned}``: GENEVE option type.
4060 - ``length {unsigned}``: GENEVE option length in 32-bit words.
4061 - ``data {hex string}``: GENEVE option data, the length is defined by
4064 - ``vxlan-gpe``: match VXLAN-GPE header.
4066 - ``vni {unsigned}``: VXLAN-GPE identifier.
4068 - ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4.
4070 - ``sha {MAC-48}``: sender hardware address.
4071 - ``spa {ipv4 address}``: sender IPv4 address.
4072 - ``tha {MAC-48}``: target hardware address.
4073 - ``tpa {ipv4 address}``: target IPv4 address.
4075 - ``ipv6_ext``: match presence of any IPv6 extension header.
4077 - ``next_hdr {unsigned}``: next header.
4079 - ``icmp6``: match any ICMPv6 header.
4081 - ``type {unsigned}``: ICMPv6 type.
4082 - ``code {unsigned}``: ICMPv6 code.
4084 - ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
4086 - ``target_addr {ipv6 address}``: target address.
4088 - ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement.
4090 - ``target_addr {ipv6 address}``: target address.
4092 - ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option.
4094 - ``type {unsigned}``: ND option type.
4096 - ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet
4097 link-layer address option.
4099 - ``sla {MAC-48}``: source Ethernet LLA.
4101 - ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet
4102 link-layer address option.
4104 - ``tla {MAC-48}``: target Ethernet LLA.
4106 - ``meta``: match application specific metadata.
4108 - ``data {unsigned}``: metadata value.
4110 - ``gtp_psc``: match GTP PDU extension header with type 0x85.
4112 - ``pdu_type {unsigned}``: PDU type.
4114 - ``qfi {unsigned}``: QoS flow identifier.
4116 - ``pppoes``, ``pppoed``: match PPPoE header.
4118 - ``session_id {unsigned}``: session identifier.
4120 - ``pppoe_proto_id``: match PPPoE session protocol identifier.
4122 - ``proto_id {unsigned}``: PPP protocol identifier.
4124 - ``l2tpv3oip``: match L2TPv3 over IP header.
4126 - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
4128 - ``ah``: match AH header.
4130 - ``spi {unsigned}``: security parameters index.
4132 - ``pfcp``: match PFCP header.
4134 - ``s_field {unsigned}``: S field.
4135 - ``seid {unsigned}``: session endpoint identifier.
4137 - ``integrity``: match packet integrity.
4139 - ``level {unsigned}``: Packet encapsulation level the item should
4140 apply to. See rte_flow_action_rss for details.
4141 - ``value {unsigned}``: A bitmask that specify what packet elements
4142 must be matched for integrity.
4144 - ``conntrack``: match conntrack state.
4146 - ``port_representor``: match traffic entering the embedded switch from the given ethdev
4148 - ``port_id {unsigned}``: ethdev port ID
4150 - ``represented_port``: match traffic entering the embedded switch from
4151 the entity represented by the given ethdev
4153 - ``ethdev_port_id {unsigned}``: ethdev port ID
4155 - ``l2tpv2``: match L2TPv2 header.
4157 - ``length {unsigned}``: L2TPv2 option length.
4158 - ``tunnel_id {unsigned}``: L2TPv2 tunnel identifier.
4159 - ``session_id {unsigned}``: L2TPv2 session identifier.
4160 - ``ns {unsigned}``: L2TPv2 option ns.
4161 - ``nr {unsigned}``: L2TPv2 option nr.
4162 - ``offset_size {unsigned}``: L2TPv2 option offset.
4164 - ``ppp``: match PPP header.
4166 - ``addr {unsigned}``: PPP address.
4167 - ``ctrl {unsigned}``: PPP control.
4168 - ``proto_id {unsigned}``: PPP protocol identifier.
4173 A list of actions starts after the ``actions`` token in the same fashion as
4174 `Matching pattern`_; actions are separated by ``/`` tokens and the list is
4175 terminated by a mandatory ``end`` action.
4177 Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
4178 rte_flow_action_type``).
4180 Dropping all incoming UDPv4 packets can be expressed as follows::
4182 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
4185 Several actions have configurable properties which must be specified when
4186 there is no valid default value. For example, ``queue`` requires a target
4189 This rule redirects incoming UDPv4 traffic to queue index 6::
4191 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
4192 actions queue index 6 / end
4194 While this one could be rejected by PMDs (unspecified queue index)::
4196 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
4199 As defined by *rte_flow*, the list is not ordered, all actions of a given
4200 rule are performed simultaneously. These are equivalent::
4202 queue index 6 / void / mark id 42 / end
4206 void / mark id 42 / queue index 6 / end
4208 All actions in a list should have different types, otherwise only the last
4209 action of a given type is taken into account::
4211 queue index 4 / queue index 5 / queue index 6 / end # will use queue 6
4215 drop / drop / drop / end # drop is performed only once
4219 mark id 42 / queue index 3 / mark id 24 / end # mark will be 24
4221 Considering they are performed simultaneously, opposite and overlapping
4222 actions can sometimes be combined when the end result is unambiguous::
4224 drop / queue index 6 / end # drop has no effect
4228 queue index 6 / rss queues 6 7 8 / end # queue has no effect
4232 drop / passthru / end # drop has no effect
4234 Note that PMDs may still refuse such combinations.
4239 This section lists supported actions and their attributes, if any.
4241 - ``end``: end list of actions.
4243 - ``void``: no-op action.
4245 - ``passthru``: let subsequent rule process matched packets.
4247 - ``jump``: redirect traffic to group on device.
4249 - ``group {unsigned}``: group to redirect to.
4251 - ``mark``: attach 32 bit value to packets.
4253 - ``id {unsigned}``: 32 bit value to return with packets.
4255 - ``flag``: flag packets.
4257 - ``queue``: assign packets to a given queue index.
4259 - ``index {unsigned}``: queue index to use.
4261 - ``drop``: drop packets (note: passthru has priority).
4263 - ``count``: enable counters for this rule.
4265 - ``rss``: spread packets among several queues.
4267 - ``func {hash function}``: RSS hash function to apply, allowed tokens are
4268 ``toeplitz``, ``simple_xor``, ``symmetric_toeplitz`` and ``default``.
4270 - ``level {unsigned}``: encapsulation level for ``types``.
4272 - ``types [{RSS hash type} [...]] end``: specific RSS hash types.
4273 Note that an empty list does not disable RSS but instead requests
4274 unspecified "best-effort" settings.
4276 - ``key {string}``: RSS hash key, overrides ``key_len``.
4278 - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in
4279 conjunction with ``key`` to pad or truncate it.
4281 - ``queues [{unsigned} [...]] end``: queue indices to use.
4283 - ``pf``: direct traffic to physical function.
4285 - ``vf``: direct traffic to a virtual function ID.
4287 - ``original {boolean}``: use original VF ID if possible.
4288 - ``id {unsigned}``: VF ID.
4290 - ``phy_port``: direct packets to physical port index.
4292 - ``original {boolean}``: use original port index if possible.
4293 - ``index {unsigned}``: physical port index.
4295 - ``port_id``: direct matching traffic to a given DPDK port ID.
4297 - ``original {boolean}``: use original DPDK port ID if possible.
4298 - ``id {unsigned}``: DPDK port ID.
4300 - ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``.
4302 - ``mpls_ttl``: MPLS TTL.
4304 - ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``.
4306 - ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``.
4308 - ``nw_ttl``: IP TTL.
4310 - ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``.
4312 - ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``.
4314 - ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``.
4316 - ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``.
4318 - ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``.
4320 - ``ethertype``: Ethertype.
4322 - ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``.
4324 - ``vlan_vid``: VLAN id.
4326 - ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``.
4328 - ``vlan_pcp``: VLAN priority.
4330 - ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``.
4332 - ``ethertype``: Ethertype.
4334 - ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``.
4336 - ``ethertype``: Ethertype.
4338 - ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration
4339 is done through `Config VXLAN Encap outer layers`_.
4341 - ``vxlan_decap``: Performs a decapsulation action by stripping all headers of
4342 the VXLAN tunnel network overlay from the matched flow.
4344 - ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration
4345 is done through `Config NVGRE Encap outer layers`_.
4347 - ``nvgre_decap``: Performs a decapsulation action by stripping all headers of
4348 the NVGRE tunnel network overlay from the matched flow.
4350 - ``l2_encap``: Performs a L2 encapsulation, L2 configuration
4351 is done through `Config L2 Encap`_.
4353 - ``l2_decap``: Performs a L2 decapsulation, L2 configuration
4354 is done through `Config L2 Decap`_.
4356 - ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer
4357 configuration is done through `Config MPLSoGRE Encap outer layers`_.
4359 - ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer
4360 configuration is done through `Config MPLSoGRE Decap outer layers`_.
4362 - ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer
4363 configuration is done through `Config MPLSoUDP Encap outer layers`_.
4365 - ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer
4366 configuration is done through `Config MPLSoUDP Decap outer layers`_.
4368 - ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header.
4370 - ``ipv4_addr``: New IPv4 source address.
4372 - ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4
4375 - ``ipv4_addr``: New IPv4 destination address.
4377 - ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header.
4379 - ``ipv6_addr``: New IPv6 source address.
4381 - ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6
4384 - ``ipv6_addr``: New IPv6 destination address.
4386 - ``set_tp_src``: Set a new source port number in the outermost TCP/UDP
4389 - ``port``: New TCP/UDP source port number.
4391 - ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP
4394 - ``port``: New TCP/UDP destination port number.
4396 - ``mac_swap``: Swap the source and destination MAC addresses in the outermost
4399 - ``dec_ttl``: Performs a decrease TTL value action
4401 - ``set_ttl``: Set TTL value with specified value
4402 - ``ttl_value {unsigned}``: The new TTL value to be set
4404 - ``set_mac_src``: set source MAC address
4406 - ``mac_addr {MAC-48}``: new source MAC address
4408 - ``set_mac_dst``: set destination MAC address
4410 - ``mac_addr {MAC-48}``: new destination MAC address
4412 - ``inc_tcp_seq``: Increase sequence number in the outermost TCP header.
4414 - ``value {unsigned}``: Value to increase TCP sequence number by.
4416 - ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header.
4418 - ``value {unsigned}``: Value to decrease TCP sequence number by.
4420 - ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header.
4422 - ``value {unsigned}``: Value to increase TCP acknowledgment number by.
4424 - ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header.
4426 - ``value {unsigned}``: Value to decrease TCP acknowledgment number by.
4428 - ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value
4430 - ``dscp_value {unsigned}``: The new DSCP value to be set
4432 - ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value
4434 - ``dscp_value {unsigned}``: The new DSCP value to be set
4436 - ``indirect``: Use indirect action created via
4437 ``flow indirect_action {port_id} create``
4439 - ``indirect_action_id {unsigned}``: Indirect action ID to use
4441 - ``color``: Color the packet to reflect the meter color result
4443 - ``type {value}``: Set color type with specified value(green/yellow/red)
4445 - ``port_representor``: at embedded switch level, send matching traffic to
4448 - ``port_id {unsigned}``: ethdev port ID
4450 - ``represented_port``: at embedded switch level, send matching traffic to
4451 the entity represented by the given ethdev
4453 - ``ethdev_port_id {unsigned}``: ethdev port ID
4455 Destroying flow rules
4456 ~~~~~~~~~~~~~~~~~~~~~
4458 ``flow destroy`` destroys one or more rules from their rule ID (as returned
4459 by ``flow create``), this command calls ``rte_flow_destroy()`` as many
4460 times as necessary::
4462 flow destroy {port_id} rule {rule_id} [...]
4464 If successful, it will show::
4466 Flow rule #[...] destroyed
4468 It does not report anything for rule IDs that do not exist. The usual error
4469 message is shown when a rule cannot be destroyed::
4471 Caught error type [...] ([...]): [...]
4473 ``flow flush`` destroys all rules on a device and does not take extra
4474 arguments. It is bound to ``rte_flow_flush()``::
4476 flow flush {port_id}
4478 Any errors are reported as above.
4480 Creating several rules and destroying them::
4482 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4483 actions queue index 2 / end
4484 Flow rule #0 created
4485 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4486 actions queue index 3 / end
4487 Flow rule #1 created
4488 testpmd> flow destroy 0 rule 0 rule 1
4489 Flow rule #1 destroyed
4490 Flow rule #0 destroyed
4493 The same result can be achieved using ``flow flush``::
4495 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4496 actions queue index 2 / end
4497 Flow rule #0 created
4498 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4499 actions queue index 3 / end
4500 Flow rule #1 created
4501 testpmd> flow flush 0
4504 Non-existent rule IDs are ignored::
4506 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4507 actions queue index 2 / end
4508 Flow rule #0 created
4509 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4510 actions queue index 3 / end
4511 Flow rule #1 created
4512 testpmd> flow destroy 0 rule 42 rule 10 rule 2
4514 testpmd> flow destroy 0 rule 0
4515 Flow rule #0 destroyed
4518 Enqueueing destruction of flow rules
4519 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4521 ``flow queue destroy`` adds destruction operations to destroy one or more rules
4522 from their rule ID (as returned by ``flow queue create``) to a queue,
4523 this command calls ``rte_flow_async_destroy()`` as many times as necessary::
4525 flow queue {port_id} destroy {queue_id}
4526 [postpone {boolean}] rule {rule_id} [...]
4528 If successful, it will show::
4530 Flow rule #[...] destruction enqueued
4532 It does not report anything for rule IDs that do not exist. The usual error
4533 message is shown when a rule cannot be destroyed::
4535 Caught error type [...] ([...]): [...]
4537 ``flow queue pull`` must be called to retrieve the operation status.
4542 ``flow query`` queries a specific action of a flow rule having that
4543 ability. Such actions collect information that can be reported using this
4544 command. It is bound to ``rte_flow_query()``::
4546 flow query {port_id} {rule_id} {action}
4548 If successful, it will display either the retrieved data for known actions
4549 or the following message::
4551 Cannot display result for action type [...] ([...])
4553 Otherwise, it will complain either that the rule does not exist or that some
4556 Flow rule #[...] not found
4560 Caught error type [...] ([...]): [...]
4562 Currently only the ``count`` action is supported. This action reports the
4563 number of packets that hit the flow rule and the total number of bytes. Its
4564 output has the following format::
4567 hits_set: [...] # whether "hits" contains a valid value
4568 bytes_set: [...] # whether "bytes" contains a valid value
4569 hits: [...] # number of packets
4570 bytes: [...] # number of bytes
4572 Querying counters for TCPv6 packets redirected to queue 6::
4574 testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end
4575 actions queue index 6 / count / end
4576 Flow rule #4 created
4577 testpmd> flow query 0 4 count
4588 ``flow list`` lists existing flow rules sorted by priority and optionally
4589 filtered by group identifiers::
4591 flow list {port_id} [group {group_id}] [...]
4593 This command only fails with the following message if the device does not
4598 Output consists of a header line followed by a short description of each
4599 flow rule, one per line. There is no output at all when no flow rules are
4600 configured on the device::
4602 ID Group Prio Attr Rule
4603 [...] [...] [...] [...] [...]
4605 ``Attr`` column flags:
4607 - ``i`` for ``ingress``.
4608 - ``e`` for ``egress``.
4610 Creating several flow rules and listing them::
4612 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4613 actions queue index 6 / end
4614 Flow rule #0 created
4615 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4616 actions queue index 2 / end
4617 Flow rule #1 created
4618 testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end
4619 actions rss queues 6 7 8 end / end
4620 Flow rule #2 created
4621 testpmd> flow list 0
4622 ID Group Prio Attr Rule
4623 0 0 0 i- ETH IPV4 => QUEUE
4624 1 0 0 i- ETH IPV6 => QUEUE
4625 2 0 5 i- ETH IPV4 UDP => RSS
4628 Rules are sorted by priority (i.e. group ID first, then priority level)::
4630 testpmd> flow list 1
4631 ID Group Prio Attr Rule
4632 0 0 0 i- ETH => COUNT
4633 6 0 500 i- ETH IPV6 TCP => DROP COUNT
4634 5 0 1000 i- ETH IPV6 ICMP => QUEUE
4635 1 24 0 i- ETH IPV4 UDP => QUEUE
4636 4 24 10 i- ETH IPV4 TCP => DROP
4637 3 24 20 i- ETH IPV4 => DROP
4638 2 24 42 i- ETH IPV4 UDP => QUEUE
4639 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE
4642 Output can be limited to specific groups::
4644 testpmd> flow list 1 group 0 group 63
4645 ID Group Prio Attr Rule
4646 0 0 0 i- ETH => COUNT
4647 6 0 500 i- ETH IPV6 TCP => DROP COUNT
4648 5 0 1000 i- ETH IPV6 ICMP => QUEUE
4649 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE
4652 Toggling isolated mode
4653 ~~~~~~~~~~~~~~~~~~~~~~
4655 ``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4656 must only be injected from the defined flow rules; that no default traffic
4657 is expected outside those rules and the driver is free to assign more
4658 resources to handle them. It is bound to ``rte_flow_isolate()``::
4660 flow isolate {port_id} {boolean}
4662 If successful, enabling or disabling isolated mode shows either::
4664 Ingress traffic on port [...]
4665 is now restricted to the defined flow rules
4669 Ingress traffic on port [...]
4670 is not restricted anymore to the defined flow rules
4672 Otherwise, in case of error::
4674 Caught error type [...] ([...]): [...]
4676 Mainly due to its side effects, PMDs supporting this mode may not have the
4677 ability to toggle it more than once without reinitializing affected ports
4678 first (e.g. by exiting testpmd).
4680 Enabling isolated mode::
4682 testpmd> flow isolate 0 true
4683 Ingress traffic on port 0 is now restricted to the defined flow rules
4686 Disabling isolated mode::
4688 testpmd> flow isolate 0 false
4689 Ingress traffic on port 0 is not restricted anymore to the defined flow rules
4692 Dumping HW internal information
4693 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4695 ``flow dump`` dumps the hardware's internal representation information of
4696 all flows. It is bound to ``rte_flow_dev_dump()``::
4698 flow dump {port_id} {output_file}
4700 If successful, it will show::
4704 Otherwise, it will complain error occurred::
4706 Caught error type [...] ([...]): [...]
4708 Listing and destroying aged flow rules
4709 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4711 ``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``,
4712 and ``destroy`` parameter can be used to destroy those flow rules in PMD.
4714 flow aged {port_id} [destroy]
4716 Listing current aged flow rules::
4718 testpmd> flow aged 0
4719 Port 0 total aged flows: 0
4720 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.14 / end
4721 actions age timeout 5 / queue index 0 / end
4722 Flow rule #0 created
4723 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.15 / end
4724 actions age timeout 4 / queue index 0 / end
4725 Flow rule #1 created
4726 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.16 / end
4727 actions age timeout 2 / queue index 0 / end
4728 Flow rule #2 created
4729 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.17 / end
4730 actions age timeout 3 / queue index 0 / end
4731 Flow rule #3 created
4734 Aged Rules are simply list as command ``flow list {port_id}``, but strip the detail rule
4735 information, all the aged flows are sorted by the longest timeout time. For example, if
4736 those rules be configured in the same time, ID 2 will be the first aged out rule, the next
4737 will be ID 3, ID 1, ID 0::
4739 testpmd> flow aged 0
4740 Port 0 total aged flows: 4
4747 If attach ``destroy`` parameter, the command will destroy all the list aged flow rules.
4749 testpmd> flow aged 0 destroy
4750 Port 0 total aged flows: 4
4757 Flow rule #2 destroyed
4758 Flow rule #3 destroyed
4759 Flow rule #1 destroyed
4760 Flow rule #0 destroyed
4761 4 flows be destroyed
4762 testpmd> flow aged 0
4763 Port 0 total aged flows: 0
4765 Creating indirect actions
4766 ~~~~~~~~~~~~~~~~~~~~~~~~~
4768 ``flow indirect_action {port_id} create`` creates indirect action with optional
4769 indirect action ID. It is bound to ``rte_flow_action_handle_create()``::
4771 flow indirect_action {port_id} create [action_id {indirect_action_id}]
4772 [ingress] [egress] [transfer] action {action} / end
4774 If successful, it will show::
4776 Indirect action #[...] created
4778 Otherwise, it will complain either that indirect action already exists or that
4779 some error occurred::
4781 Indirect action #[...] is already assigned, delete it first
4785 Caught error type [...] ([...]): [...]
4787 Create indirect rss action with id 100 to queues 1 and 2 on port 0::
4789 testpmd> flow indirect_action 0 create action_id 100 \
4790 ingress action rss queues 1 2 end / end
4792 Create indirect rss action with id assigned by testpmd to queues 1 and 2 on
4795 testpmd> flow indirect_action 0 create action_id \
4796 ingress action rss queues 0 1 end / end
4798 Enqueueing creation of indirect actions
4799 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4801 ``flow queue indirect_action create`` adds creation operation of an indirect
4802 action to a queue. It is bound to ``rte_flow_async_action_handle_create()``::
4804 flow queue {port_id} create {queue_id} [postpone {boolean}]
4805 table {table_id} item_template {item_template_id}
4806 action_template {action_template_id}
4807 pattern {item} [/ {item} [...]] / end
4808 actions {action} [/ {action} [...]] / end
4810 If successful, it will show::
4812 Indirect action #[...] creation queued
4814 Otherwise it will show an error message of the form::
4816 Caught error type [...] ([...]): [...]
4818 This command uses the same parameters as ``flow indirect_action create``,
4819 described in `Creating indirect actions`_.
4821 ``flow queue pull`` must be called to retrieve the operation status.
4823 Updating indirect actions
4824 ~~~~~~~~~~~~~~~~~~~~~~~~~
4826 ``flow indirect_action {port_id} update`` updates configuration of the indirect
4827 action from its indirect action ID (as returned by
4828 ``flow indirect_action {port_id} create``). It is bound to
4829 ``rte_flow_action_handle_update()``::
4831 flow indirect_action {port_id} update {indirect_action_id}
4832 action {action} / end
4834 If successful, it will show::
4836 Indirect action #[...] updated
4838 Otherwise, it will complain either that indirect action not found or that some
4841 Failed to find indirect action #[...] on port [...]
4845 Caught error type [...] ([...]): [...]
4847 Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3
4848 (in create example above rss queues were 1 and 2)::
4850 testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
4852 Enqueueing update of indirect actions
4853 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4855 ``flow queue indirect_action update`` adds update operation for an indirect
4856 action to a queue. It is bound to ``rte_flow_async_action_handle_update()``::
4858 flow queue {port_id} indirect_action {queue_id} update
4859 {indirect_action_id} [postpone {boolean}] action {action} / end
4861 If successful, it will show::
4863 Indirect action #[...] update queued
4865 Otherwise it will show an error message of the form::
4867 Caught error type [...] ([...]): [...]
4869 ``flow queue pull`` must be called to retrieve the operation status.
4871 Destroying indirect actions
4872 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4874 ``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
4875 from their indirect action IDs (as returned by
4876 ``flow indirect_action {port_id} create``). It is bound to
4877 ``rte_flow_action_handle_destroy()``::
4879 flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
4881 If successful, it will show::
4883 Indirect action #[...] destroyed
4885 It does not report anything for indirect action IDs that do not exist.
4886 The usual error message is shown when a indirect action cannot be destroyed::
4888 Caught error type [...] ([...]): [...]
4890 Destroy indirect actions having id 100 & 101::
4892 testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
4894 Enqueueing destruction of indirect actions
4895 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4897 ``flow queue indirect_action destroy`` adds destruction operation to destroy
4898 one or more indirect actions from their indirect action IDs (as returned by
4899 ``flow queue {port_id} indirect_action {queue_id} create``) to a queue.
4900 It is bound to ``rte_flow_async_action_handle_destroy()``::
4902 flow queue {port_id} indirect_action {queue_id} destroy
4903 [postpone {boolean}] action_id {indirect_action_id} [...]
4905 If successful, it will show::
4907 Indirect action #[...] destruction queued
4909 Otherwise it will show an error message of the form::
4911 Caught error type [...] ([...]): [...]
4913 ``flow queue pull`` must be called to retrieve the operation status.
4915 Query indirect actions
4916 ~~~~~~~~~~~~~~~~~~~~~~
4918 ``flow indirect_action {port_id} query`` queries the indirect action from its
4919 indirect action ID (as returned by ``flow indirect_action {port_id} create``).
4920 It is bound to ``rte_flow_action_handle_query()``::
4922 flow indirect_action {port_id} query {indirect_action_id}
4924 Currently only rss indirect action supported. If successful, it will show::
4926 Indirect RSS action:
4929 Otherwise, it will complain either that indirect action not found or that some
4932 Failed to find indirect action #[...] on port [...]
4936 Caught error type [...] ([...]): [...]
4938 Query indirect action having id 100::
4940 testpmd> flow indirect_action 0 query 100
4942 Sample QinQ flow rules
4943 ~~~~~~~~~~~~~~~~~~~~~~
4945 Before creating QinQ rule(s) the following commands should be issued to enable QinQ::
4947 testpmd> port stop 0
4948 testpmd> vlan set extend on 0
4950 The above command sets the inner and outer TPID's to 0x8100.
4952 To change the TPID's the following commands should be used::
4954 testpmd> vlan set outer tpid 0x88A8 0
4955 testpmd> vlan set inner tpid 0x8100 0
4956 testpmd> port start 0
4958 Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
4962 testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 /
4963 vlan tci is 456 / end actions vf id 1 / queue index 0 / end
4964 Flow rule #0 validated
4966 testpmd> flow create 0 ingress pattern eth / vlan tci is 4 /
4967 vlan tci is 456 / end actions vf id 123 / queue index 0 / end
4968 Flow rule #0 created
4970 testpmd> flow list 0
4971 ID Group Prio Attr Rule
4972 0 0 0 i- ETH VLAN VLAN=>VF QUEUE
4974 Validate and create a QinQ rule on port 0 to steer traffic to a queue on the host.
4978 testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 /
4979 vlan tci is 654 / end actions pf / queue index 0 / end
4980 Flow rule #1 validated
4982 testpmd> flow create 0 ingress pattern eth / vlan tci is 321 /
4983 vlan tci is 654 / end actions pf / queue index 1 / end
4984 Flow rule #1 created
4986 testpmd> flow list 0
4987 ID Group Prio Attr Rule
4988 0 0 0 i- ETH VLAN VLAN=>VF QUEUE
4989 1 0 0 i- ETH VLAN VLAN=>PF QUEUE
4991 Sample VXLAN flow rules
4992 ~~~~~~~~~~~~~~~~~~~~~~~
4994 Before creating VXLAN rule(s), the UDP port should be added for VXLAN packet
4997 testpmd> rx_vxlan_port add 4789 0
4999 Create VXLAN rules on port 0 to steer traffic to PF queues.
5003 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
5004 eth dst is 00:11:22:33:44:55 / end actions pf / queue index 1 / end
5005 Flow rule #0 created
5007 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 3 /
5008 eth dst is 00:11:22:33:44:55 / end actions pf / queue index 2 / end
5009 Flow rule #1 created
5011 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
5012 eth dst is 00:11:22:33:44:55 / vlan tci is 10 / end actions pf /
5014 Flow rule #2 created
5016 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 5 /
5017 eth dst is 00:11:22:33:44:55 / vlan tci is 20 / end actions pf /
5019 Flow rule #3 created
5021 testpmd> flow create 0 ingress pattern eth dst is 00:00:00:00:01:00 / ipv4 /
5022 udp / vxlan vni is 6 / eth dst is 00:11:22:33:44:55 / end actions pf /
5024 Flow rule #4 created
5026 testpmd> flow list 0
5027 ID Group Prio Attr Rule
5028 0 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE
5029 1 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE
5030 2 0 0 i- ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
5031 3 0 0 i- ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
5032 4 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE
5034 Sample VXLAN encapsulation rule
5035 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5037 VXLAN encapsulation outer layer has default value pre-configured in testpmd
5038 source code, those can be changed by using the following commands
5040 IPv4 VXLAN outer header::
5042 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
5043 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5044 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
5047 testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src
5048 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
5049 eth-dst 22:22:22:22:22:22
5050 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
5053 testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-tos 0
5054 ip-ttl 255 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
5055 eth-dst 22:22:22:22:22:22
5056 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
5059 IPv6 VXLAN outer header::
5061 testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1
5062 ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5063 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
5066 testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4
5067 ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11
5068 eth-dst 22:22:22:22:22:22
5069 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
5072 testpmd> set vxlan-tos-ttl ip-version ipv6 vni 4 udp-src 4 udp-dst 4
5073 ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
5074 eth-dst 22:22:22:22:22:22
5075 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
5078 Sample NVGRE encapsulation rule
5079 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5081 NVGRE encapsulation outer layer has default value pre-configured in testpmd
5082 source code, those can be changed by using the following commands
5084 IPv4 NVGRE outer header::
5086 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
5087 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5088 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
5091 testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1
5092 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
5093 eth-dst 22:22:22:22:22:22
5094 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
5097 IPv6 NVGRE outer header::
5099 testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
5100 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5101 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
5104 testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
5105 vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5106 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
5109 Sample L2 encapsulation rule
5110 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5112 L2 encapsulation has default value pre-configured in testpmd
5113 source code, those can be changed by using the following commands
5117 testpmd> set l2_encap ip-version ipv4
5118 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5119 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
5120 mplsoudp_decap / l2_encap / end
5122 L2 with VXLAN header::
5124 testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34
5125 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5126 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
5127 mplsoudp_decap / l2_encap / end
5129 Sample L2 decapsulation rule
5130 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5132 L2 decapsulation has default value pre-configured in testpmd
5133 source code, those can be changed by using the following commands
5137 testpmd> set l2_decap
5138 testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap /
5141 L2 with VXLAN header::
5143 testpmd> set l2_encap-with-vlan
5144 testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap /
5147 Sample MPLSoGRE encapsulation rule
5148 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5150 MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
5151 source code, those can be changed by using the following commands
5153 IPv4 MPLSoGRE outer header::
5155 testpmd> set mplsogre_encap ip-version ipv4 label 4
5156 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
5157 eth-dst 22:22:22:22:22:22
5158 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5159 mplsogre_encap / end
5161 IPv4 MPLSoGRE with VLAN outer header::
5163 testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4
5164 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
5165 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5166 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5167 mplsogre_encap / end
5169 IPv6 MPLSoGRE outer header::
5171 testpmd> set mplsogre_encap ip-version ipv6 mask 4
5172 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
5173 eth-dst 22:22:22:22:22:22
5174 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5175 mplsogre_encap / end
5177 IPv6 MPLSoGRE with VLAN outer header::
5179 testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4
5180 ip-src ::1 ip-dst ::2222 vlan-tci 34
5181 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5182 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5183 mplsogre_encap / end
5185 Sample MPLSoGRE decapsulation rule
5186 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5188 MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
5189 source code, those can be changed by using the following commands
5191 IPv4 MPLSoGRE outer header::
5193 testpmd> set mplsogre_decap ip-version ipv4
5194 testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions
5195 mplsogre_decap / l2_encap / end
5197 IPv4 MPLSoGRE with VLAN outer header::
5199 testpmd> set mplsogre_decap-with-vlan ip-version ipv4
5200 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end
5201 actions mplsogre_decap / l2_encap / end
5203 IPv6 MPLSoGRE outer header::
5205 testpmd> set mplsogre_decap ip-version ipv6
5206 testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end
5207 actions mplsogre_decap / l2_encap / end
5209 IPv6 MPLSoGRE with VLAN outer header::
5211 testpmd> set mplsogre_decap-with-vlan ip-version ipv6
5212 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end
5213 actions mplsogre_decap / l2_encap / end
5215 Sample MPLSoUDP encapsulation rule
5216 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5218 MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
5219 source code, those can be changed by using the following commands
5221 IPv4 MPLSoUDP outer header::
5223 testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10
5224 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
5225 eth-dst 22:22:22:22:22:22
5226 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5227 mplsoudp_encap / end
5229 IPv4 MPLSoUDP with VLAN outer header::
5231 testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5
5232 udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
5233 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5234 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5235 mplsoudp_encap / end
5237 IPv6 MPLSoUDP outer header::
5239 testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10
5240 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
5241 eth-dst 22:22:22:22:22:22
5242 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5243 mplsoudp_encap / end
5245 IPv6 MPLSoUDP with VLAN outer header::
5247 testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5
5248 udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34
5249 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5250 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5251 mplsoudp_encap / end
5253 Sample MPLSoUDP decapsulation rule
5254 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5256 MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
5257 source code, those can be changed by using the following commands
5259 IPv4 MPLSoUDP outer header::
5261 testpmd> set mplsoudp_decap ip-version ipv4
5262 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
5263 mplsoudp_decap / l2_encap / end
5265 IPv4 MPLSoUDP with VLAN outer header::
5267 testpmd> set mplsoudp_decap-with-vlan ip-version ipv4
5268 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end
5269 actions mplsoudp_decap / l2_encap / end
5271 IPv6 MPLSoUDP outer header::
5273 testpmd> set mplsoudp_decap ip-version ipv6
5274 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end
5275 actions mplsoudp_decap / l2_encap / end
5277 IPv6 MPLSoUDP with VLAN outer header::
5279 testpmd> set mplsoudp_decap-with-vlan ip-version ipv6
5280 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end
5281 actions mplsoudp_decap / l2_encap / end
5283 Sample Raw encapsulation rule
5284 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5286 Raw encapsulation configuration can be set by the following commands
5288 Encapsulating VxLAN::
5290 testpmd> set raw_encap 4 eth src is 10:11:22:33:44:55 / vlan tci is 1
5291 inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni
5293 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
5294 raw_encap index 4 / end
5296 Sample Raw decapsulation rule
5297 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5299 Raw decapsulation configuration can be set by the following commands
5301 Decapsulating VxLAN::
5303 testpmd> set raw_decap eth / ipv4 / udp / vxlan / end_set
5304 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 /
5305 end actions raw_decap / queue index 0 / end
5310 ESP rules can be created by the following commands::
5312 testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions
5314 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end
5315 actions queue index 3 / end
5316 testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions
5318 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
5319 actions queue index 3 / end
5324 AH rules can be created by the following commands::
5326 testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions
5328 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end
5329 actions queue index 3 / end
5330 testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions
5332 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end
5333 actions queue index 3 / end
5338 PFCP rules can be created by the following commands(s_field need to be 1
5341 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
5342 actions queue index 3 / end
5343 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
5344 seid is 1 / end actions queue index 3 / end
5345 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
5346 actions queue index 3 / end
5347 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
5348 seid is 1 / end actions queue index 3 / end
5350 Sample Sampling/Mirroring rules
5351 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5353 Sample/Mirroring rules can be set by the following commands
5355 NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1,
5356 and 50% packets are duplicated and marked with 0x1234 and sent to queue 0.
5360 testpmd> set sample_actions 0 mark id 0x1234 / queue index 0 / end
5361 testpmd> flow create 0 ingress group 1 pattern eth / end actions
5362 sample ratio 2 index 0 / queue index 1 / end
5364 Mirroring rule with port representors (with "transfer" attribute), the matched
5365 ingress packets with encapsulation header are sent to port id 0, and also
5366 mirrored the packets and sent to port id 2.
5370 testpmd> set sample_actions 0 port_id id 2 / end
5371 testpmd> flow create 1 ingress transfer pattern eth / end actions
5372 sample ratio 1 index 0 / raw_encap / port_id id 0 / end
5374 Mirroring rule with port representors (with "transfer" attribute), the matched
5375 ingress packets are sent to port id 2, and also mirrored the packets with
5376 encapsulation header and sent to port id 0.
5380 testpmd> set sample_actions 0 raw_encap / port_id id 0 / end
5381 testpmd> flow create 0 ingress transfer pattern eth / end actions
5382 sample ratio 1 index 0 / port_id id 2 / end
5384 Mirroring rule with port representors (with "transfer" attribute), the matched
5385 ingress packets are sent to port id 2, and also mirrored the packets with
5386 VXLAN encapsulation header and sent to port id 0.
5390 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
5391 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5392 testpmd> set sample_actions 0 vxlan_encap / port_id id 0 / end
5393 testpmd> flow create 0 ingress transfer pattern eth / end actions
5394 sample ratio 1 index 0 / port_id id 2 / end
5396 Mirroring rule with port representors (with "transfer" attribute), the matched
5397 ingress packets are sent to port id 2, and also mirrored the packets with
5398 NVGRE encapsulation header and sent to port id 0.
5402 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
5403 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5404 testpmd> set sample_actions 0 nvgre_encap / port_id id 0 / end
5405 testpmd> flow create 0 ingress transfer pattern eth / end actions
5406 sample ratio 1 index 0 / port_id id 2 / end
5408 Sample integrity rules
5409 ~~~~~~~~~~~~~~~~~~~~~~
5411 Integrity rules can be created by the following commands:
5413 Integrity rule that forwards valid TCP packets to group 1.
5414 TCP packet integrity is matched with the ``l4_ok`` bit 3.
5418 testpmd> flow create 0 ingress
5419 pattern eth / ipv4 / tcp / integrity value mask 8 value spec 8 / end
5420 actions jump group 1 / end
5422 Integrity rule that forwards invalid packets to application.
5423 General packet integrity is matched with the ``packet_ok`` bit 0.
5427 testpmd> flow create 0 ingress pattern integrity value mask 1 value spec 0 / end actions queue index 0 / end
5429 Sample conntrack rules
5430 ~~~~~~~~~~~~~~~~~~~~~~
5432 Conntrack rules can be set by the following commands
5434 Need to construct the connection context with provided information.
5435 In the first table, create a flow rule by using conntrack action and jump to
5436 the next table. In the next table, create a rule to check the state.
5440 testpmd> set conntrack com peer 1 is_orig 1 enable 1 live 1 sack 1 cack 0
5441 last_dir 0 liberal 0 state 1 max_ack_win 7 r_lim 5 last_win 510
5442 last_seq 2632987379 last_ack 2532480967 last_end 2632987379
5444 testpmd> set conntrack orig scale 7 fin 0 acked 1 unack_data 0
5445 sent_end 2632987379 reply_end 2633016339 max_win 28960
5447 testpmd> set conntrack rply scale 7 fin 0 acked 1 unack_data 0
5448 sent_end 2532480967 reply_end 2532546247 max_win 65280
5450 testpmd> flow indirect_action 0 create ingress action conntrack / end
5451 testpmd> flow create 0 group 3 ingress pattern eth / ipv4 / tcp / end actions indirect 0 / jump group 5 / end
5452 testpmd> flow create 0 group 5 ingress pattern eth / ipv4 / tcp / conntrack is 1 / end actions queue index 5 / end
5454 Construct the conntrack again with only "is_orig" set to 0 (other fields are
5455 ignored), then use "update" interface to update the direction. Create flow
5456 rules like above for the peer port.
5460 testpmd> flow indirect_action 0 update 0 action conntrack_update dir / end
5462 Sample meter with policy rules
5463 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5465 Meter with policy rules can be created by the following commands:
5467 Need to create policy first and actions are set for green/yellow/red colors.
5468 Create meter with policy id. Create flow with meter id.
5470 Example for policy with meter color action. The purpose is to color the packet
5471 to reflect the meter color result.
5472 The meter policy action list: ``green -> green, yellow -> yellow, red -> red``.
5476 testpmd> add port meter profile srtcm_rfc2697 0 13 21504 2688 0 0
5477 testpmd> add port meter policy 0 1 g_actions color type green / end y_actions color type yellow / end
5478 r_actions color type red / end
5479 testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
5480 testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end
5482 Sample L2TPv2 RSS rules
5483 ~~~~~~~~~~~~~~~~~~~~~~~
5485 L2TPv2 RSS rules can be created by the following commands::
5487 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
5488 / end actions rss types l2tpv2 end queues end / end
5489 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / end
5490 actions rss types eth l2-src-only end queues end / end
5491 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / end
5492 actions rss types l2tpv2 end queues end / end
5493 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5494 / end actions rss types ipv4 end queues end / end
5495 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv6
5496 / udp / end actions rss types ipv6-udp end queues end / end
5497 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv4
5498 / tcp / end actions rss types ipv4-tcp end queues end / end
5499 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
5500 / end actions rss types ipv6 end queues end / end
5502 Sample L2TPv2 FDIR rules
5503 ~~~~~~~~~~~~~~~~~~~~~~~~
5505 L2TPv2 FDIR rules can be created by the following commands::
5507 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
5508 session_id is 0x1111 / end actions queue index 3 / end
5509 testpmd> flow create 0 ingress pattern eth src is 00:00:00:00:00:01 / ipv4
5510 / udp / l2tpv2 type data / end actions queue index 3 / end
5511 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type data
5512 session_id is 0x1111 / ppp / end actions queue index 3 / end
5513 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5514 src is 10.0.0.1 / end actions queue index 3 / end
5515 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
5516 dst is ABAB:910B:6666:3457:8295:3333:1800:2929 / end actions queue index 3 / end
5517 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5518 / udp src is 22 / end actions queue index 3 / end
5519 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5520 / tcp dst is 23 / end actions queue index 3 / end
5525 A RAW rule can be created as following using ``pattern_hex`` key and mask.
5529 testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset
5530 is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a
5531 pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions
5537 The following sections show functions to load/unload eBPF based filters.
5542 Load an eBPF program as a callback for particular RX/TX queue::
5544 testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename)
5546 The available load-flags are:
5548 * ``J``: use JIT generated native code, otherwise BPF interpreter will be used.
5550 * ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data.
5556 You'll need clang v3.7 or above to build bpf program you'd like to load
5560 .. code-block:: console
5563 clang -O2 -target bpf -c t1.c
5565 Then to load (and JIT compile) t1.o at RX queue 0, port 1:
5567 .. code-block:: console
5569 testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
5571 To load (not JITed) t1.o at TX queue 0, port 0:
5573 .. code-block:: console
5575 testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
5580 Unload previously loaded eBPF program for particular RX/TX queue::
5582 testpmd> bpf-unload rx|tx (portid) (queueid)
5584 For example to unload BPF filter from TX queue 0, port 0:
5586 .. code-block:: console
5588 testpmd> bpf-unload tx 0 0
5593 The following sections show functions that configure and create flex item object,
5594 create flex pattern and use it in a flow rule.
5595 The commands will use 20 bytes IPv4 header for examples:
5600 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
5601 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5602 | ver | IHL | TOS | length | +0
5603 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5604 | identification | flg | frag. offset | +4
5605 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5606 | TTL | protocol | checksum | +8
5607 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5608 | source IP address | +12
5609 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5610 | destination IP address | +16
5611 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5617 Flex item object is created by PMD according to a new header configuration. The
5618 header configuration is compiled by the testpmd and stored in
5619 ``rte_flow_item_flex_conf`` type variable.
5623 # flow flex_item create <port> <flex id> <configuration file>
5624 testpmd> flow flex_item init 0 3 ipv4_flex_config.json
5625 port-0: created flex item #3
5627 Flex item configuration is kept in external JSON file.
5628 It describes the following header elements:
5630 **New header length.**
5632 Specify whether the new header has fixed or variable length and the basic/minimal
5633 header length value.
5635 If header length is not fixed, header location with a value that completes header
5636 length calculation and scale/offset function must be added.
5638 Scale function depends on port hardware.
5642 Describes location in the new header that specify following network header type.
5644 **Flow match samples.**
5646 Describes locations in the new header that will be used in flow rules.
5648 Number of flow samples and sample maximal length depend of port hardware.
5652 Describes preceding network header configuration.
5656 Describes conditions that trigger transfer to following network header
5658 .. code-block:: json
5661 "next_header": { "field_mode": "FIELD_MODE_FIXED", "field_size": 20},
5662 "next_protocol": {"field_size": 8, "field_base": 72},
5664 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 0},
5665 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 32},
5666 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 64},
5667 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 96}
5670 {"item": "eth type is 0x0800"},
5671 {"item": "vlan inner_type is 0x0800"}
5674 {"item": "udp", "next": 17},
5675 {"item": "tcp", "next": 6},
5676 {"item": "icmp", "next": 1}
5681 Flex pattern and flow rules
5682 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
5684 Flex pattern describe parts of network header that will trigger flex flow item hit in a flow rule.
5685 Flex pattern directly related to flex item samples configuration.
5686 Flex pattern can be shared between ports.
5688 **Flex pattern and flow rule to match IPv4 version and 20 bytes length**
5692 # set flex_pattern <pattern_id> is <hex bytes sequence>
5693 testpmd> flow flex_item pattern 5 is 45FF
5696 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / flex item is 3 pattern is 5 / end actions mark id 1 / queue index 0 / end
5697 Flow rule #0 created
5699 **Flex pattern and flow rule to match packets with source address 1.2.3.4**
5703 testpmd> flow flex_item pattern 2 spec 45000000000000000000000001020304 mask FF0000000000000000000000FFFFFFFF
5706 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / flex item is 3 pattern is 2 / end actions mark id 1 / queue index 0 / end
5707 Flow rule #0 created
5709 Driver specific commands
5710 ------------------------
5712 Some drivers provide specific features.