1 .. SPDX-License-Identifier: BSD-3-Clause
2 Copyright(c) 2010-2016 Intel Corporation.
6 Testpmd Runtime Functions
7 =========================
9 Where the testpmd application is started in interactive mode, (``-i|--interactive``),
10 it displays a prompt that can be used to start and stop forwarding,
11 configure the application, display statistics (including the extended NIC
12 statistics aka xstats) , set the Flow Director and other tasks::
16 The testpmd prompt has some, limited, readline support.
17 Common bash command-line functions such as ``Ctrl+a`` and ``Ctrl+e`` to go to the start and end of the prompt line are supported
18 as well as access to the command history via the up-arrow.
20 There is also support for tab completion.
21 If you type a partial command and hit ``<TAB>`` you get a list of the available completions:
23 .. code-block:: console
25 testpmd> show port <TAB>
27 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
28 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
29 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
30 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
36 Some examples in this document are too long to fit on one line are shown wrapped at `"\\"` for display purposes::
38 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
39 (pause_time) (send_xon) (port_id)
41 In the real ``testpmd>`` prompt these commands should be on a single line.
46 The testpmd has on-line help for the functions that are available at runtime.
47 These are divided into sections and can be accessed using help, help section or help all:
49 .. code-block:: console
53 help control : Start and stop forwarding.
54 help display : Displaying port, stats and config information.
55 help config : Configuration information.
56 help ports : Configuring ports.
57 help registers : Reading and setting port registers.
58 help filters : Filters configuration help.
59 help all : All of the above sections.
62 Command File Functions
63 ----------------------
65 To facilitate loading large number of commands or to avoid cutting and pasting where not
66 practical or possible testpmd supports alternative methods for executing commands.
68 * If started with the ``--cmdline-file=FILENAME`` command line argument testpmd
69 will execute all CLI commands contained within the file immediately before
70 starting packet forwarding or entering interactive mode.
72 .. code-block:: console
74 ./testpmd -n4 -r2 ... -- -i --cmdline-file=/home/ubuntu/flow-create-commands.txt
75 Interactive-mode selected
76 CLI commands to be read from /home/ubuntu/flow-create-commands.txt
77 Configuring Port 0 (socket 0)
78 Port 0: 7C:FE:90:CB:74:CE
79 Configuring Port 1 (socket 0)
80 Port 1: 7C:FE:90:CB:74:CA
81 Checking link statuses...
82 Port 0 Link Up - speed 10000 Mbps - full-duplex
83 Port 1 Link Up - speed 10000 Mbps - full-duplex
89 Flow rule #498 created
90 Flow rule #499 created
91 Read all CLI commands from /home/ubuntu/flow-create-commands.txt
95 * At run-time additional commands can be loaded in bulk by invoking the ``load FILENAME``
98 .. code-block:: console
100 testpmd> load /home/ubuntu/flow-create-commands.txt
105 Flow rule #498 created
106 Flow rule #499 created
107 Read all CLI commands from /home/ubuntu/flow-create-commands.txt
111 In all cases output from any included command will be displayed as standard output.
112 Execution will continue until the end of the file is reached regardless of
113 whether any errors occur. The end user must examine the output to determine if
114 any failures occurred.
123 Start packet forwarding with current configuration::
130 Start packet forwarding with current configuration after sending specified number of bursts of packets::
132 testpmd> start tx_first (""|burst_num)
134 The default burst number is 1 when ``burst_num`` not presented.
139 Stop packet forwarding, and display accumulated statistics::
154 The functions in the following sections are used to display information about the
155 testpmd configuration or the NIC status.
160 Display information for a given port or all ports::
162 testpmd> show port (info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)
164 The available information categories are:
166 * ``info``: General port information such as MAC address.
168 * ``summary``: Brief port summary such as Device Name, Driver Name etc.
170 * ``stats``: RX/TX statistics.
172 * ``xstats``: RX/TX extended NIC statistics.
174 * ``fdir``: Flow Director information and statistics.
176 * ``stat_qmap``: Queue statistics mapping.
178 * ``dcb_tc``: DCB information such as TC mapping.
180 * ``cap``: Supported offload capabilities.
184 .. code-block:: console
186 testpmd> show port info 0
188 ********************* Infos for port 0 *********************
190 MAC address: XX:XX:XX:XX:XX:XX
192 memory allocation on the socket: 0
194 Link speed: 40000 Mbps
195 Link duplex: full-duplex
196 Promiscuous mode: enabled
197 Allmulticast mode: disabled
198 Maximum number of MAC addresses: 64
199 Maximum number of MAC addresses of hash filtering: 0
201 strip on, filter on, extend off, qinq strip off
202 Redirection table size: 512
203 Supported flow types:
221 show port (module_eeprom|eeprom)
222 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224 Display the EEPROM information of a port::
226 testpmd> show port (port_id) (module_eeprom|eeprom)
231 Display the rss redirection table entry indicated by masks on port X::
233 testpmd> show port (port_id) rss reta (size) (mask0, mask1...)
235 size is used to indicate the hardware supported reta size
240 Display the RSS hash functions and RSS hash key of a port::
242 testpmd> show port (port_id) rss-hash [key]
247 Clear the port statistics and forward engine statistics for a given port or for all ports::
249 testpmd> clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)
253 testpmd> clear port stats all
258 Display information for a given port's RX/TX queue::
260 testpmd> show (rxq|txq) info (port_id) (queue_id)
262 show desc status(rxq|txq)
263 ~~~~~~~~~~~~~~~~~~~~~~~~~
265 Display information for a given port's RX/TX descriptor status::
267 testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status
273 Displays the configuration of the application.
274 The configuration comes from the command-line, the runtime or the application defaults::
276 testpmd> show config (rxtx|cores|fwd|rxpkts|txpkts|txtimes)
278 The available information categories are:
280 * ``rxtx``: RX/TX configuration items.
282 * ``cores``: List of forwarding cores.
284 * ``fwd``: Packet forwarding configuration.
286 * ``rxpkts``: Packets to RX split configuration.
288 * ``txpkts``: Packets to TX configuration.
290 * ``txtimes``: Burst time pattern for Tx only mode.
294 .. code-block:: console
296 testpmd> show config rxtx
298 io packet forwarding - CRC stripping disabled - packets/burst=16
299 nb forwarding cores=2 - nb forwarding ports=1
300 RX queues=1 - RX desc=128 - RX free threshold=0
301 RX threshold registers: pthresh=8 hthresh=8 wthresh=4
302 TX queues=1 - TX desc=512 - TX free threshold=0
303 TX threshold registers: pthresh=36 hthresh=0 wthresh=0
304 TX RS bit threshold=0 - TXQ flags=0x0
309 Set the packet forwarding mode::
311 testpmd> set fwd (io|mac|macswap|flowgen| \
312 rxonly|txonly|csum|icmpecho|noisy|5tswap) (""|retry)
314 ``retry`` can be specified for forwarding engines except ``rx_only``.
316 The available information categories are:
318 * ``io``: Forwards packets "as-is" in I/O mode.
319 This is the fastest possible forwarding operation as it does not access packets data.
320 This is the default mode.
322 * ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them.
323 Default application behavior is to set source Ethernet address to that of the transmitting interface, and destination
324 address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or
325 'eth-peers-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address.
327 * ``macswap``: MAC swap forwarding mode.
328 Swaps the source and the destination Ethernet addresses of packets before forwarding them.
330 * ``flowgen``: Multi-flow generation mode.
331 Originates a number of flows (with varying destination IP addresses), and terminate receive traffic.
333 * ``rxonly``: Receives packets but doesn't transmit them.
335 * ``txonly``: Generates and transmits packets without receiving any.
337 * ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet.
339 * ``icmpecho``: Receives a burst of packets, lookup for ICMP echo requests and, if any, send back ICMP echo replies.
341 * ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX. Requires ``CONFIG_RTE_LIBRTE_IEEE1588=y``.
343 * ``noisy``: Noisy neighbor simulation.
344 Simulate more realistic behavior of a guest machine engaged in receiving
345 and sending packets performing Virtual Network Function (VNF).
347 * ``5tswap``: Swap the source and destination of L2,L3,L4 if they exist.
349 L2 swaps the source address and destination address of Ethernet, as same as ``macswap``.
351 L3 swaps the source address and destination address of IP (v4 and v6).
353 L4 swaps the source port and destination port of transport layer (TCP and UDP).
357 testpmd> set fwd rxonly
359 Set rxonly packet forwarding mode
365 When running, forwarding engines maintain statistics from the time they have been started.
366 Example for the io forwarding engine, with some packet drops on the tx side::
368 testpmd> show fwd stats all
370 ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
371 RX-packets: 274293770 TX-packets: 274293642 TX-dropped: 128
373 ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
374 RX-packets: 274301850 TX-packets: 274301850 TX-dropped: 0
376 ---------------------- Forward statistics for port 0 ----------------------
377 RX-packets: 274293802 RX-dropped: 0 RX-total: 274293802
378 TX-packets: 274301862 TX-dropped: 0 TX-total: 274301862
379 ----------------------------------------------------------------------------
381 ---------------------- Forward statistics for port 1 ----------------------
382 RX-packets: 274301894 RX-dropped: 0 RX-total: 274301894
383 TX-packets: 274293706 TX-dropped: 128 TX-total: 274293834
384 ----------------------------------------------------------------------------
386 +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
387 RX-packets: 548595696 RX-dropped: 0 RX-total: 548595696
388 TX-packets: 548595568 TX-dropped: 128 TX-total: 548595696
389 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
393 Enabling CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES appends "CPU cycles/packet" stats, like:
395 CPU cycles/packet=xx.dd (total cycles=xxxx / total RX packets=xxxx) at xxx MHz clock
400 Clear the forwarding engines statistics::
402 testpmd> clear fwd stats all
407 Display an RX descriptor for a port RX queue::
409 testpmd> read rxd (port_id) (queue_id) (rxd_id)
413 testpmd> read rxd 0 0 4
414 0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180
419 Display a TX descriptor for a port TX queue::
421 testpmd> read txd (port_id) (queue_id) (txd_id)
425 testpmd> read txd 0 0 4
426 0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
431 Get loaded dynamic device personalization (DDP) package info list::
433 testpmd> ddp get list (port_id)
438 Display information about dynamic device personalization (DDP) profile::
440 testpmd> ddp get info (profile_path)
445 Display VF statistics::
447 testpmd> show vf stats (port_id) (vf_id)
452 Reset VF statistics::
454 testpmd> clear vf stats (port_id) (vf_id)
456 show port pctype mapping
457 ~~~~~~~~~~~~~~~~~~~~~~~~
459 List all items from the pctype mapping table::
461 testpmd> show port (port_id) pctype mapping
463 show rx offloading capabilities
464 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
466 List all per queue and per port Rx offloading capabilities of a port::
468 testpmd> show port (port_id) rx_offload capabilities
470 show rx offloading configuration
471 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
473 List port level and all queue level Rx offloading configuration::
475 testpmd> show port (port_id) rx_offload configuration
477 show tx offloading capabilities
478 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
480 List all per queue and per port Tx offloading capabilities of a port::
482 testpmd> show port (port_id) tx_offload capabilities
484 show tx offloading configuration
485 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
487 List port level and all queue level Tx offloading configuration::
489 testpmd> show port (port_id) tx_offload configuration
491 show tx metadata setting
492 ~~~~~~~~~~~~~~~~~~~~~~~~
494 Show Tx metadata value set for a specific port::
496 testpmd> show port (port_id) tx_metadata
498 show port supported ptypes
499 ~~~~~~~~~~~~~~~~~~~~~~~~~~
501 Show ptypes supported for a specific port::
503 testpmd> show port (port_id) ptypes
505 set port supported ptypes
506 ~~~~~~~~~~~~~~~~~~~~~~~~~
508 set packet types classification for a specific port::
510 testpmd> set port (port_id) ptypes_mask (mask)
512 show port mac addresses info
513 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
515 Show mac addresses added for a specific port::
517 testpmd> show port (port_id) macs
520 show port multicast mac addresses info
521 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
523 Show multicast mac addresses added for a specific port::
525 testpmd> show port (port_id) mcast_macs
530 Show general information about devices probed::
532 testpmd> show device info (<identifier>|all)
536 .. code-block:: console
538 testpmd> show device info net_pcap0
540 ********************* Infos for device net_pcap0 *********************
542 Driver name: net_pcap
543 Devargs: iface=enP2p6s0,phy_mac=1
544 Connect to socket: -1
547 MAC address: 1E:37:93:28:04:B8
548 Device name: net_pcap0
553 Dumps all physical memory segment layouts::
555 testpmd> dump_physmem
560 Dumps the layout of all memory zones::
562 testpmd> dump_memzone
567 Dumps the memory usage of all sockets::
569 testpmd> dump_socket_mem
574 Dumps the size of all memory structures::
576 testpmd> dump_struct_sizes
581 Dumps the status of all or specific element in DPDK rings::
583 testpmd> dump_ring [ring_name]
588 Dumps the statistics of all or specific memory pool::
590 testpmd> dump_mempool [mempool_name]
595 Dumps the user device list::
597 testpmd> dump_devargs
602 Dumps the log level for all the dpdk modules::
604 testpmd> dump_log_types
606 show (raw_encap|raw_decap)
607 ~~~~~~~~~~~~~~~~~~~~~~~~~~
609 Display content of raw_encap/raw_decap buffers in hex::
611 testpmd> show <raw_encap|raw_decap> <index>
612 testpmd> show <raw_encap|raw_decap> all
616 testpmd> show raw_encap 6
618 index: 6 at [0x1c565b0], len=50
619 00000000: 00 00 00 00 00 00 16 26 36 46 56 66 08 00 45 00 | .......&6FVf..E.
620 00000010: 00 00 00 00 00 00 00 11 00 00 C0 A8 01 06 C0 A8 | ................
621 00000020: 03 06 00 00 00 FA 00 00 00 00 08 00 00 00 00 00 | ................
624 show fec capabilities
625 ~~~~~~~~~~~~~~~~~~~~~
627 Show fec capabilities of a port::
629 testpmd> show port (port_id) fec capabilities
634 Show fec mode of a port::
636 testpmd> show port (port_id) fec_mode
639 Configuration Functions
640 -----------------------
642 The testpmd application can be configured from the runtime as well as from the command-line.
644 This section details the available configuration functions that are available.
648 Configuration changes only become active when forwarding is started/restarted.
653 Reset forwarding to the default configuration::
660 Set the debug verbosity level::
662 testpmd> set verbose (level)
664 Available levels are as following:
666 * ``0`` silent except for error.
667 * ``1`` fully verbose except for Tx packets.
668 * ``2`` fully verbose except for Rx packets.
669 * ``> 2`` fully verbose.
674 Set the log level for a log type::
676 testpmd> set log global|(type) (level)
680 * ``type`` is the log name.
682 * ``level`` is the log level.
684 For example, to change the global log level::
686 testpmd> set log global (level)
688 Regexes can also be used for type. To change log level of user1, user2 and user3::
690 testpmd> set log user[1-3] (level)
695 Set the number of ports used by the application:
699 This is equivalent to the ``--nb-ports`` command-line option.
704 Set the number of cores used by the application::
706 testpmd> set nbcore (num)
708 This is equivalent to the ``--nb-cores`` command-line option.
712 The number of cores used must not be greater than number of ports used multiplied by the number of queues per port.
717 Set the forwarding cores hexadecimal mask::
719 testpmd> set coremask (mask)
721 This is equivalent to the ``--coremask`` command-line option.
725 The master lcore is reserved for command line parsing only and cannot be masked on for packet forwarding.
730 Set the forwarding ports hexadecimal mask::
732 testpmd> set portmask (mask)
734 This is equivalent to the ``--portmask`` command-line option.
736 set record-core-cycles
737 ~~~~~~~~~~~~~~~~~~~~~~
739 Set the recording of CPU cycles::
741 testpmd> set record-core-cycles (on|off)
745 * ``on`` enables measurement of CPU cycles per packet.
747 * ``off`` disables measurement of CPU cycles per packet.
749 This is equivalent to the ``--record-core-cycles command-line`` option.
751 set record-burst-stats
752 ~~~~~~~~~~~~~~~~~~~~~~
754 Set the displaying of RX and TX bursts::
756 testpmd> set record-burst-stats (on|off)
760 * ``on`` enables display of RX and TX bursts.
762 * ``off`` disables display of RX and TX bursts.
764 This is equivalent to the ``--record-burst-stats command-line`` option.
769 Set number of packets per burst::
771 testpmd> set burst (num)
773 This is equivalent to the ``--burst command-line`` option.
775 When retry is enabled, the transmit delay time and number of retries can also be set::
777 testpmd> set burst tx delay (microseconds) retry (num)
782 Set the length of segments to scatter packets on receiving if split
783 feature is engaged. Affects only the queues configured with split offloads
784 (currently BUFFER_SPLIT is supported only). Optionally the multiple memory
785 pools can be specified with --mbuf-size command line parameter and the mbufs
786 to receive will be allocated sequentially from these extra memory pools (the
787 mbuf for the first segment is allocated from the first pool, the second one
788 from the second pool, and so on, if segment number is greater then pool's the
789 mbuf for remaining segments will be allocated from the last valid pool).
791 testpmd> set rxpkts (x[,y]*)
793 Where x[,y]* represents a CSV list of values, without white space. Zero value
794 means to use the corresponding memory pool data buffer size.
799 Set the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode::
801 testpmd> set txpkts (x[,y]*)
803 Where x[,y]* represents a CSV list of values, without white space.
808 Configure the timing burst pattern for Tx only mode. This command enables
809 the packet send scheduling on dynamic timestamp mbuf field and configures
810 timing pattern in Tx only mode. In this mode, if scheduling is enabled
811 application provides timestamps in the packets being sent. It is possible
812 to configure delay (in unspecified device clock units) between bursts
813 and between the packets within the burst::
815 testpmd> set txtimes (inter),(intra)
819 * ``inter`` is the delay between the bursts in the device clock units.
820 If ``intra`` is zero, this is the time between the beginnings of the
821 first packets in the neighbour bursts, if ``intra`` is not zero,
822 ``inter`` specifies the time between the beginning of the first packet
823 of the current burst and the beginning of the last packet of the
824 previous burst. If ``inter`` parameter is zero the send scheduling
825 on timestamps is disabled (default).
827 * ``intra`` is the delay between the packets within the burst specified
828 in the device clock units. The number of packets in the burst is defined
829 by regular burst setting. If ``intra`` parameter is zero no timestamps
830 provided in the packets excepting the first one in the burst.
832 As the result the bursts of packet will be transmitted with specific
833 delays between the packets within the burst and specific delay between
834 the bursts. The rte_eth_read_clock() must be supported by the device(s)
835 and is supposed to be engaged to get the current device clock value
836 and provide the reference for the timestamps. If there is no supported
837 rte_eth_read_clock() there will be no send scheduling provided on the port.
842 Set the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes::
844 testpmd> set txsplit (off|on|rand)
848 * ``off`` disable packet copy & split for CSUM mode.
850 * ``on`` split outgoing packet into multiple segments. Size of each segment
851 and number of segments per packet is determined by ``set txpkts`` command
854 * ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments.
859 Set the list of forwarding cores::
861 testpmd> set corelist (x[,y]*)
863 For example, to change the forwarding cores:
865 .. code-block:: console
867 testpmd> set corelist 3,1
868 testpmd> show config fwd
870 io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled
871 Logical Core 3 (socket 0) forwards packets on 1 streams:
872 RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
873 Logical Core 1 (socket 0) forwards packets on 1 streams:
874 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
878 The cores are used in the same order as specified on the command line.
883 Set the list of forwarding ports::
885 testpmd> set portlist (x[,y]*)
887 For example, to change the port forwarding:
889 .. code-block:: console
891 testpmd> set portlist 0,2,1,3
892 testpmd> show config fwd
894 io packet forwarding - ports=4 - cores=1 - streams=4
895 Logical Core 3 (socket 0) forwards packets on 4 streams:
896 RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01
897 RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
898 RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03
899 RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02
904 Select how to retrieve new ports created after "port attach" command::
906 testpmd> set port setup on (iterator|event)
908 For each new port, a setup is done.
909 It will find the probed ports via RTE_ETH_FOREACH_MATCHING_DEV loop
910 in iterator mode, or via RTE_ETH_EVENT_NEW in event mode.
915 Enable/disable tx loopback::
917 testpmd> set tx loopback (port_id) (on|off)
922 set drop enable bit for all queues::
924 testpmd> set all queues drop (port_id) (on|off)
926 set split drop enable (for VF)
927 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
929 set split drop enable bit for VF from PF::
931 testpmd> set vf split drop (port_id) (vf_id) (on|off)
933 set mac antispoof (for VF)
934 ~~~~~~~~~~~~~~~~~~~~~~~~~~
936 Set mac antispoof for a VF from the PF::
938 testpmd> set vf mac antispoof (port_id) (vf_id) (on|off)
943 Enable/disable MACsec offload::
945 testpmd> set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)
946 testpmd> set macsec offload (port_id) off
951 Configure MACsec secure connection (SC)::
953 testpmd> set macsec sc (tx|rx) (port_id) (mac) (pi)
957 The pi argument is ignored for tx.
958 Check the NIC Datasheet for hardware limits.
963 Configure MACsec secure association (SA)::
965 testpmd> set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)
969 The IDX value must be 0 or 1.
970 Check the NIC Datasheet for hardware limits.
972 set broadcast mode (for VF)
973 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
975 Set broadcast mode for a VF from the PF::
977 testpmd> set vf broadcast (port_id) (vf_id) (on|off)
982 Set the VLAN strip for a queue on a port::
984 testpmd> vlan set stripq (on|off) (port_id,queue_id)
986 vlan set stripq (for VF)
987 ~~~~~~~~~~~~~~~~~~~~~~~~
989 Set VLAN strip for all queues in a pool for a VF from the PF::
991 testpmd> set vf vlan stripq (port_id) (vf_id) (on|off)
993 vlan set insert (for VF)
994 ~~~~~~~~~~~~~~~~~~~~~~~~
996 Set VLAN insert for a VF from the PF::
998 testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
1000 vlan set tag (for VF)
1001 ~~~~~~~~~~~~~~~~~~~~~
1003 Set VLAN tag for a VF from the PF::
1005 testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
1007 vlan set antispoof (for VF)
1008 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1010 Set VLAN antispoof for a VF from the PF::
1012 testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off)
1014 vlan set (strip|filter|qinq_strip|extend)
1015 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1016 Set the VLAN strip/filter/QinQ strip/extend on for a port::
1018 testpmd> vlan set (strip|filter|qinq_strip|extend) (on|off) (port_id)
1023 Set the inner or outer VLAN TPID for packet filtering on a port::
1025 testpmd> vlan set (inner|outer) tpid (value) (port_id)
1029 TPID value must be a 16-bit number (value <= 65536).
1034 Add a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID::
1036 testpmd> rx_vlan add (vlan_id|all) (port_id)
1040 VLAN filter must be set on that port. VLAN ID < 4096.
1041 Depending on the NIC used, number of vlan_ids may be limited to the maximum entries
1042 in VFTA table. This is important if enabling all vlan_ids.
1047 Remove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID::
1049 testpmd> rx_vlan rm (vlan_id|all) (port_id)
1051 rx_vlan add (for VF)
1052 ~~~~~~~~~~~~~~~~~~~~
1054 Add a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID::
1056 testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask)
1061 Remove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID::
1063 testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask)
1068 Add a tunnel filter on a port::
1070 testpmd> tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) \
1071 (inner_vlan) (vxlan|nvgre|ipingre|vxlan-gpe) (imac-ivlan|imac-ivlan-tenid|\
1072 imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)
1074 The available information categories are:
1076 * ``vxlan``: Set tunnel type as VXLAN.
1078 * ``nvgre``: Set tunnel type as NVGRE.
1080 * ``ipingre``: Set tunnel type as IP-in-GRE.
1082 * ``vxlan-gpe``: Set tunnel type as VXLAN-GPE
1084 * ``imac-ivlan``: Set filter type as Inner MAC and VLAN.
1086 * ``imac-ivlan-tenid``: Set filter type as Inner MAC, VLAN and tenant ID.
1088 * ``imac-tenid``: Set filter type as Inner MAC and tenant ID.
1090 * ``imac``: Set filter type as Inner MAC.
1092 * ``omac-imac-tenid``: Set filter type as Outer MAC, Inner MAC and tenant ID.
1094 * ``oip``: Set filter type as Outer IP.
1096 * ``iip``: Set filter type as Inner IP.
1100 testpmd> tunnel_filter add 0 68:05:CA:28:09:82 00:00:00:00:00:00 \
1101 192.168.2.2 0 ipingre oip 1 1
1103 Set an IP-in-GRE tunnel on port 0, and the filter type is Outer IP.
1105 tunnel_filter remove
1106 ~~~~~~~~~~~~~~~~~~~~
1108 Remove a tunnel filter on a port::
1110 testpmd> tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) \
1111 (inner_vlan) (vxlan|nvgre|ipingre|vxlan-gpe) (imac-ivlan|imac-ivlan-tenid|\
1112 imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)
1117 Add an UDP port for VXLAN packet filter on a port::
1119 testpmd> rx_vxlan_port add (udp_port) (port_id)
1121 rx_vxlan_port remove
1122 ~~~~~~~~~~~~~~~~~~~~
1124 Remove an UDP port for VXLAN packet filter on a port::
1126 testpmd> rx_vxlan_port rm (udp_port) (port_id)
1131 Set hardware insertion of VLAN IDs in packets sent on a port::
1133 testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer]
1135 For example, set a single VLAN ID (5) insertion on port 0::
1139 Or, set double VLAN ID (inner: 2, outer: 3) insertion on port 1::
1147 Set port based hardware insertion of VLAN ID in packets sent on a port::
1149 testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off)
1154 Disable hardware insertion of a VLAN header in packets sent on a port::
1156 testpmd> tx_vlan reset (port_id)
1161 Select hardware or software calculation of the checksum when
1162 transmitting a packet using the ``csum`` forwarding engine::
1164 testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)
1168 * ``ip|udp|tcp|sctp`` always relate to the inner layer.
1170 * ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized
1171 as a tunnel packet by the forwarding engine (geneve, gre, gtp, ipip, vxlan and vxlan-gpe are
1172 supported). See also the ``csum parse-tunnel`` command.
1174 * ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized
1175 as a tunnel packet by the forwarding engine (geneve, gtp, vxlan and vxlan-gpe are
1176 supported). See also the ``csum parse-tunnel`` command.
1180 Check the NIC Datasheet for hardware limits.
1185 Set RSS queue region span on a port::
1187 testpmd> set port (port_id) queue-region region_id (value) \
1188 queue_start_index (value) queue_num (value)
1190 Set flowtype mapping on a RSS queue region on a port::
1192 testpmd> set port (port_id) queue-region region_id (value) flowtype (value)
1196 * For the flowtype(pctype) of packet,the specific index for each type has
1197 been defined in file i40e_type.h as enum i40e_filter_pctype.
1199 Set user priority mapping on a RSS queue region on a port::
1201 testpmd> set port (port_id) queue-region UP (value) region_id (value)
1203 Flush all queue region related configuration on a port::
1205 testpmd> set port (port_id) queue-region flush (on|off)
1209 * ``on``: is just an enable function which server for other configuration,
1210 it is for all configuration about queue region from up layer,
1211 at first will only keep in DPDK software stored in driver,
1212 only after "flush on", it commit all configuration to HW.
1214 * ``"off``: is just clean all configuration about queue region just now,
1215 and restore all to DPDK i40e driver default config when start up.
1217 Show all queue region related configuration info on a port::
1219 testpmd> show port (port_id) queue-region
1223 Queue region only support on PF by now, so these command is
1224 only for configuration of queue region on PF port.
1229 Define how tunneled packets should be handled by the csum forward
1232 testpmd> csum parse-tunnel (on|off) (tx_port_id)
1234 If enabled, the csum forward engine will try to recognize supported
1235 tunnel headers (geneve, gtp, gre, ipip, vxlan, vxlan-gpe).
1237 If disabled, treat tunnel packets as non-tunneled packets (a inner
1238 header is handled as a packet payload).
1242 The port argument is the TX port like in the ``csum set`` command.
1246 Consider a packet in packet like the following::
1248 eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in
1250 * If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1251 command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the
1252 ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ipv4_out`` and ``udp_out``).
1254 * If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1255 command relate to the outer headers, here ``ipv4_out`` and ``udp_out``.
1260 Display tx checksum offload configuration::
1262 testpmd> csum show (port_id)
1267 Enable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine::
1269 testpmd> tso set (segsize) (port_id)
1273 Check the NIC datasheet for hardware limits.
1278 Display the status of TCP Segmentation Offload::
1280 testpmd> tso show (port_id)
1285 Set tso segment size of tunneled packets for a port in csum engine::
1287 testpmd> tunnel_tso set (tso_segsz) (port_id)
1292 Display the status of tunneled TCP Segmentation Offload for a port::
1294 testpmd> tunnel_tso show (port_id)
1299 Enable or disable GRO in ``csum`` forwarding engine::
1301 testpmd> set port <port_id> gro on|off
1303 If enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
1304 packets received from the given port.
1306 If disabled, packets received from the given port won't be performed
1307 GRO. By default, GRO is disabled for all ports.
1311 When enable GRO for a port, TCP/IPv4 packets received from the port
1312 will be performed GRO. After GRO, all merged packets have bad
1313 checksums, since the GRO library doesn't re-calculate checksums for
1314 the merged packets. Therefore, if users want the merged packets to
1315 have correct checksums, please select HW IP checksum calculation and
1316 HW TCP checksum calculation for the port which the merged packets are
1322 Display GRO configuration for a given port::
1324 testpmd> show port <port_id> gro
1329 Set the cycle to flush the GROed packets from reassembly tables::
1331 testpmd> set gro flush <cycles>
1333 When enable GRO, the csum forwarding engine performs GRO on received
1334 packets, and the GROed packets are stored in reassembly tables. Users
1335 can use this command to determine when the GROed packets are flushed
1336 from the reassembly tables.
1338 The ``cycles`` is measured in GRO operation times. The csum forwarding
1339 engine flushes the GROed packets from the tables every ``cycles`` GRO
1342 By default, the value of ``cycles`` is 1, which means flush GROed packets
1343 from the reassembly tables as soon as one GRO operation finishes. The value
1344 of ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
1346 Please note that the large value of ``cycles`` may cause the poor TCP/IP
1347 stack performance. Because the GROed packets are delayed to arrive the
1348 stack, thus causing more duplicated ACKs and TCP retransmissions.
1353 Toggle per-port GSO support in ``csum`` forwarding engine::
1355 testpmd> set port <port_id> gso on|off
1357 If enabled, the csum forwarding engine will perform GSO on supported IPv4
1358 packets, transmitted on the given port.
1360 If disabled, packets transmitted on the given port will not undergo GSO.
1361 By default, GSO is disabled for all ports.
1365 When GSO is enabled on a port, supported IPv4 packets transmitted on that
1366 port undergo GSO. Afterwards, the segmented packets are represented by
1367 multi-segment mbufs; however, the csum forwarding engine doesn't calculation
1368 of checksums for GSO'd segments in SW. As a result, if users want correct
1369 checksums in GSO segments, they should enable HW checksum calculation for
1372 For example, HW checksum calculation for VxLAN GSO'd packets may be enabled
1373 by setting the following options in the csum forwarding engine:
1375 testpmd> csum set outer_ip hw <port_id>
1377 testpmd> csum set ip hw <port_id>
1379 testpmd> csum set tcp hw <port_id>
1381 UDP GSO is the same as IP fragmentation, which treats the UDP header
1382 as the payload and does not modify it during segmentation. That is,
1383 after UDP GSO, only the first output fragment has the original UDP
1384 header. Therefore, users need to enable HW IP checksum calculation
1385 and SW UDP checksum calculation for GSO-enabled ports, if they want
1386 correct checksums for UDP/IPv4 packets.
1391 Set the maximum GSO segment size (measured in bytes), which includes the
1392 packet header and the packet payload for GSO-enabled ports (global)::
1394 testpmd> set gso segsz <length>
1399 Display the status of Generic Segmentation Offload for a given port::
1401 testpmd> show port <port_id> gso
1406 Add an alternative MAC address to a port::
1408 testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)
1413 Remove a MAC address from a port::
1415 testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)
1420 To add the multicast MAC address to/from the set of multicast addresses
1423 testpmd> mcast_addr add (port_id) (mcast_addr)
1428 To remove the multicast MAC address to/from the set of multicast addresses
1431 testpmd> mcast_addr remove (port_id) (mcast_addr)
1433 mac_addr add (for VF)
1434 ~~~~~~~~~~~~~~~~~~~~~
1436 Add an alternative MAC address for a VF to a port::
1438 testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX)
1443 Set the default MAC address for a port::
1445 testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
1447 mac_addr set (for VF)
1448 ~~~~~~~~~~~~~~~~~~~~~
1450 Set the MAC address for a VF from the PF::
1452 testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)
1457 Set the forwarding peer address for certain port::
1459 testpmd> set eth-peer (port_id) (peer_addr)
1461 This is equivalent to the ``--eth-peer`` command-line option.
1466 Set the unicast hash filter(s) on/off for a port::
1468 testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off)
1473 Set the promiscuous mode on for a port or for all ports.
1474 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1476 testpmd> set promisc (port_id|all) (on|off)
1481 Set the allmulti mode for a port or for all ports::
1483 testpmd> set allmulti (port_id|all) (on|off)
1485 Same as the ifconfig (8) option. Controls how multicast packets are handled.
1487 set promisc (for VF)
1488 ~~~~~~~~~~~~~~~~~~~~
1490 Set the unicast promiscuous mode for a VF from PF.
1491 It's supported by Intel i40e NICs now.
1492 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1494 testpmd> set vf promisc (port_id) (vf_id) (on|off)
1496 set allmulticast (for VF)
1497 ~~~~~~~~~~~~~~~~~~~~~~~~~
1499 Set the multicast promiscuous mode for a VF from PF.
1500 It's supported by Intel i40e NICs now.
1501 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1503 testpmd> set vf allmulti (port_id) (vf_id) (on|off)
1505 set tx max bandwidth (for VF)
1506 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1508 Set TX max absolute bandwidth (Mbps) for a VF from PF::
1510 testpmd> set vf tx max-bandwidth (port_id) (vf_id) (max_bandwidth)
1512 set tc tx min bandwidth (for VF)
1513 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1515 Set all TCs' TX min relative bandwidth (%) for a VF from PF::
1517 testpmd> set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)
1519 set tc tx max bandwidth (for VF)
1520 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1522 Set a TC's TX max absolute bandwidth (Mbps) for a VF from PF::
1524 testpmd> set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (max_bandwidth)
1526 set tc strict link priority mode
1527 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1529 Set some TCs' strict link priority mode on a physical port::
1531 testpmd> set tx strict-link-priority (port_id) (tc_bitmap)
1533 set tc tx min bandwidth
1534 ~~~~~~~~~~~~~~~~~~~~~~~
1536 Set all TCs' TX min relative bandwidth (%) globally for all PF and VFs::
1538 testpmd> set tc tx min-bandwidth (port_id) (bw1, bw2, ...)
1543 Set the link flow control parameter on a port::
1545 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1546 (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \
1547 autoneg (on|off) (port_id)
1551 * ``high_water`` (integer): High threshold value to trigger XOFF.
1553 * ``low_water`` (integer): Low threshold value to trigger XON.
1555 * ``pause_time`` (integer): Pause quota in the Pause frame.
1557 * ``send_xon`` (0/1): Send XON frame.
1559 * ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames.
1561 * ``autoneg``: Change the auto-negotiation parameter.
1566 Set the priority flow control parameter on a port::
1568 testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1569 (pause_time) (priority) (port_id)
1573 * ``high_water`` (integer): High threshold value.
1575 * ``low_water`` (integer): Low threshold value.
1577 * ``pause_time`` (integer): Pause quota in the Pause frame.
1579 * ``priority`` (0-7): VLAN User Priority.
1584 Set statistics mapping (qmapping 0..15) for RX/TX queue on port::
1586 testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)
1588 For example, to set rx queue 2 on port 0 to mapping 5::
1590 testpmd>set stat_qmap rx 0 2 5
1592 set xstats-hide-zero
1593 ~~~~~~~~~~~~~~~~~~~~
1595 Set the option to hide zero values for xstats display::
1597 testpmd> set xstats-hide-zero on|off
1601 By default, the zero values are displayed for xstats.
1603 set port - rx/tx (for VF)
1604 ~~~~~~~~~~~~~~~~~~~~~~~~~
1606 Set VF receive/transmit from a port::
1608 testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1610 set port - mac address filter (for VF)
1611 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1613 Add/Remove unicast or multicast MAC addr filter for a VF::
1615 testpmd> set port (port_id) vf (vf_id) (mac_addr) \
1616 (exact-mac|exact-mac-vlan|hashmac|hashmac-vlan) (on|off)
1618 set port - rx mode(for VF)
1619 ~~~~~~~~~~~~~~~~~~~~~~~~~~
1621 Set the VF receive mode of a port::
1623 testpmd> set port (port_id) vf (vf_id) \
1624 rxmode (AUPE|ROPE|BAM|MPE) (on|off)
1626 The available receive modes are:
1628 * ``AUPE``: Accepts untagged VLAN.
1630 * ``ROPE``: Accepts unicast hash.
1632 * ``BAM``: Accepts broadcast packets.
1634 * ``MPE``: Accepts all multicast packets.
1636 set port - tx_rate (for Queue)
1637 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1639 Set TX rate limitation for a queue on a port::
1641 testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1643 set port - tx_rate (for VF)
1644 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1646 Set TX rate limitation for queues in VF on a port::
1648 testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
1650 set port - mirror rule
1651 ~~~~~~~~~~~~~~~~~~~~~~
1653 Set pool or vlan type mirror rule for a port::
1655 testpmd> set port (port_id) mirror-rule (rule_id) \
1656 (pool-mirror-up|pool-mirror-down|vlan-mirror) \
1657 (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off)
1659 Set link mirror rule for a port::
1661 testpmd> set port (port_id) mirror-rule (rule_id) \
1662 (uplink-mirror|downlink-mirror) dst-pool (pool_id) (on|off)
1664 For example to enable mirror traffic with vlan 0,1 to pool 0::
1666 set port 0 mirror-rule 0 vlan-mirror 0,1 dst-pool 0 on
1668 reset port - mirror rule
1669 ~~~~~~~~~~~~~~~~~~~~~~~~
1671 Reset a mirror rule for a port::
1673 testpmd> reset port (port_id) mirror-rule (rule_id)
1678 Set the flush on RX streams before forwarding.
1679 The default is flush ``on``.
1680 Mainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams::
1682 testpmd> set flush_rx off
1687 Set the bypass mode for the lowest port on bypass enabled NIC::
1689 testpmd> set bypass mode (normal|bypass|isolate) (port_id)
1694 Set the event required to initiate specified bypass mode for the lowest port on a bypass enabled::
1696 testpmd> set bypass event (timeout|os_on|os_off|power_on|power_off) \
1697 mode (normal|bypass|isolate) (port_id)
1701 * ``timeout``: Enable bypass after watchdog timeout.
1703 * ``os_on``: Enable bypass when OS/board is powered on.
1705 * ``os_off``: Enable bypass when OS/board is powered off.
1707 * ``power_on``: Enable bypass when power supply is turned on.
1709 * ``power_off``: Enable bypass when power supply is turned off.
1715 Set the bypass watchdog timeout to ``n`` seconds where 0 = instant::
1717 testpmd> set bypass timeout (0|1.5|2|3|4|8|16|32)
1722 Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC::
1724 testpmd> show bypass config (port_id)
1729 Set link up for a port::
1731 testpmd> set link-up port (port id)
1736 Set link down for a port::
1738 testpmd> set link-down port (port id)
1743 Enable E-tag insertion for a VF on a port::
1745 testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
1747 Disable E-tag insertion for a VF on a port::
1749 testpmd> E-tag set insertion off port (port_id) vf (vf_id)
1751 Enable/disable E-tag stripping on a port::
1753 testpmd> E-tag set stripping (on|off) port (port_id)
1755 Enable/disable E-tag based forwarding on a port::
1757 testpmd> E-tag set forwarding (on|off) port (port_id)
1759 Add an E-tag forwarding filter on a port::
1761 testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id) port (port_id)
1763 Delete an E-tag forwarding filter on a port::
1764 testpmd> E-tag set filter del e-tag-id (value) port (port_id)
1769 Load a dynamic device personalization (DDP) profile and store backup profile::
1771 testpmd> ddp add (port_id) (profile_path[,backup_profile_path])
1776 Delete a dynamic device personalization profile and restore backup profile::
1778 testpmd> ddp del (port_id) (backup_profile_path)
1783 List all items from the ptype mapping table::
1785 testpmd> ptype mapping get (port_id) (valid_only)
1789 * ``valid_only``: A flag indicates if only list valid items(=1) or all itemss(=0).
1791 Replace a specific or a group of software defined ptype with a new one::
1793 testpmd> ptype mapping replace (port_id) (target) (mask) (pkt_type)
1797 * ``target``: A specific software ptype or a mask to represent a group of software ptypes.
1799 * ``mask``: A flag indicate if "target" is a specific software ptype(=0) or a ptype mask(=1).
1801 * ``pkt_type``: The new software ptype to replace the old ones.
1803 Update hardware defined ptype to software defined packet type mapping table::
1805 testpmd> ptype mapping update (port_id) (hw_ptype) (sw_ptype)
1809 * ``hw_ptype``: hardware ptype as the index of the ptype mapping table.
1811 * ``sw_ptype``: software ptype as the value of the ptype mapping table.
1813 Reset ptype mapping table::
1815 testpmd> ptype mapping reset (port_id)
1817 config per port Rx offloading
1818 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1820 Enable or disable a per port Rx offloading on all Rx queues of a port::
1822 testpmd> port config (port_id) rx_offload (offloading) on|off
1824 * ``offloading``: can be any of these offloading capability:
1825 vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1826 qinq_strip, outer_ipv4_cksum, macsec_strip,
1827 header_split, vlan_filter, vlan_extend, jumbo_frame,
1828 scatter, timestamp, security, keep_crc, rss_hash
1830 This command should be run when the port is stopped, or else it will fail.
1832 config per queue Rx offloading
1833 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1835 Enable or disable a per queue Rx offloading only on a specific Rx queue::
1837 testpmd> port (port_id) rxq (queue_id) rx_offload (offloading) on|off
1839 * ``offloading``: can be any of these offloading capability:
1840 vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1841 qinq_strip, outer_ipv4_cksum, macsec_strip,
1842 header_split, vlan_filter, vlan_extend, jumbo_frame,
1843 scatter, timestamp, security, keep_crc
1845 This command should be run when the port is stopped, or else it will fail.
1847 config per port Tx offloading
1848 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1850 Enable or disable a per port Tx offloading on all Tx queues of a port::
1852 testpmd> port config (port_id) tx_offload (offloading) on|off
1854 * ``offloading``: can be any of these offloading capability:
1855 vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1856 sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1857 qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1858 ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1859 mt_lockfree, multi_segs, mbuf_fast_free, security
1861 This command should be run when the port is stopped, or else it will fail.
1863 config per queue Tx offloading
1864 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1866 Enable or disable a per queue Tx offloading only on a specific Tx queue::
1868 testpmd> port (port_id) txq (queue_id) tx_offload (offloading) on|off
1870 * ``offloading``: can be any of these offloading capability:
1871 vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1872 sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1873 qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1874 ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1875 mt_lockfree, multi_segs, mbuf_fast_free, security
1877 This command should be run when the port is stopped, or else it will fail.
1879 Config VXLAN Encap outer layers
1880 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1882 Configure the outer layer to encapsulate a packet inside a VXLAN tunnel::
1884 set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1885 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) \
1888 set vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1889 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1890 eth-src (eth-src) eth-dst (eth-dst)
1892 set vxlan-tos-ttl ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1893 udp-dst (udp-dst) ip-tos (ip-tos) ip-ttl (ip-ttl) ip-src (ip-src) \
1894 ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1896 These commands will set an internal configuration inside testpmd, any following
1897 flow rule using the action vxlan_encap will use the last configuration set.
1898 To have a different encapsulation header, one of those commands must be called
1899 before the flow rule creation.
1901 Config NVGRE Encap outer layers
1902 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1904 Configure the outer layer to encapsulate a packet inside a NVGRE tunnel::
1906 set nvgre ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) ip-dst (ip-dst) \
1907 eth-src (eth-src) eth-dst (eth-dst)
1908 set nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) \
1909 ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1911 These commands will set an internal configuration inside testpmd, any following
1912 flow rule using the action nvgre_encap will use the last configuration set.
1913 To have a different encapsulation header, one of those commands must be called
1914 before the flow rule creation.
1919 Configure the l2 to be used when encapsulating a packet with L2::
1921 set l2_encap ip-version (ipv4|ipv6) eth-src (eth-src) eth-dst (eth-dst)
1922 set l2_encap-with-vlan ip-version (ipv4|ipv6) vlan-tci (vlan-tci) \
1923 eth-src (eth-src) eth-dst (eth-dst)
1925 Those commands will set an internal configuration inside testpmd, any following
1926 flow rule using the action l2_encap will use the last configuration set.
1927 To have a different encapsulation header, one of those commands must be called
1928 before the flow rule creation.
1933 Configure the l2 to be removed when decapsulating a packet with L2::
1935 set l2_decap ip-version (ipv4|ipv6)
1936 set l2_decap-with-vlan ip-version (ipv4|ipv6)
1938 Those commands will set an internal configuration inside testpmd, any following
1939 flow rule using the action l2_decap will use the last configuration set.
1940 To have a different encapsulation header, one of those commands must be called
1941 before the flow rule creation.
1943 Config MPLSoGRE Encap outer layers
1944 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1946 Configure the outer layer to encapsulate a packet inside a MPLSoGRE tunnel::
1948 set mplsogre_encap ip-version (ipv4|ipv6) label (label) \
1949 ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1950 set mplsogre_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1951 ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1952 eth-src (eth-src) eth-dst (eth-dst)
1954 These commands will set an internal configuration inside testpmd, any following
1955 flow rule using the action mplsogre_encap will use the last configuration set.
1956 To have a different encapsulation header, one of those commands must be called
1957 before the flow rule creation.
1959 Config MPLSoGRE Decap outer layers
1960 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1962 Configure the outer layer to decapsulate MPLSoGRE packet::
1964 set mplsogre_decap ip-version (ipv4|ipv6)
1965 set mplsogre_decap-with-vlan ip-version (ipv4|ipv6)
1967 These commands will set an internal configuration inside testpmd, any following
1968 flow rule using the action mplsogre_decap will use the last configuration set.
1969 To have a different decapsulation header, one of those commands must be called
1970 before the flow rule creation.
1972 Config MPLSoUDP Encap outer layers
1973 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1975 Configure the outer layer to encapsulate a packet inside a MPLSoUDP tunnel::
1977 set mplsoudp_encap ip-version (ipv4|ipv6) label (label) udp-src (udp-src) \
1978 udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1979 eth-src (eth-src) eth-dst (eth-dst)
1980 set mplsoudp_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1981 udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1982 vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1984 These commands will set an internal configuration inside testpmd, any following
1985 flow rule using the action mplsoudp_encap will use the last configuration set.
1986 To have a different encapsulation header, one of those commands must be called
1987 before the flow rule creation.
1989 Config MPLSoUDP Decap outer layers
1990 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1992 Configure the outer layer to decapsulate MPLSoUDP packet::
1994 set mplsoudp_decap ip-version (ipv4|ipv6)
1995 set mplsoudp_decap-with-vlan ip-version (ipv4|ipv6)
1997 These commands will set an internal configuration inside testpmd, any following
1998 flow rule using the action mplsoudp_decap will use the last configuration set.
1999 To have a different decapsulation header, one of those commands must be called
2000 before the flow rule creation.
2002 Config Raw Encapsulation
2003 ~~~~~~~~~~~~~~~~~~~~~~~~~
2005 Configure the raw data to be used when encapsulating a packet by
2006 rte_flow_action_raw_encap::
2008 set raw_encap {index} {item} [/ {item} [...]] / end_set
2010 There are multiple global buffers for ``raw_encap``, this command will set one
2011 internal buffer index by ``{index}``.
2012 If there is no ``{index}`` specified::
2014 set raw_encap {item} [/ {item} [...]] / end_set
2016 the default index ``0`` is used.
2017 In order to use different encapsulating header, ``index`` must be specified
2018 during the flow rule creation::
2020 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
2021 raw_encap index 2 / end
2023 Otherwise the default index ``0`` is used.
2025 Config Raw Decapsulation
2026 ~~~~~~~~~~~~~~~~~~~~~~~~
2028 Configure the raw data to be used when decapsulating a packet by
2029 rte_flow_action_raw_decap::
2031 set raw_decap {index} {item} [/ {item} [...]] / end_set
2033 There are multiple global buffers for ``raw_decap``, this command will set
2034 one internal buffer index by ``{index}``.
2035 If there is no ``{index}`` specified::
2037 set raw_decap {item} [/ {item} [...]] / end_set
2039 the default index ``0`` is used.
2040 In order to use different decapsulating header, ``index`` must be specified
2041 during the flow rule creation::
2043 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
2044 raw_encap index 3 / end
2046 Otherwise the default index ``0`` is used.
2051 Set fec mode for a specific port::
2053 testpmd> set port (port_id) fec_mode auto|off|rs|baser
2059 The following sections show functions for configuring ports.
2063 Port configuration changes only become active when forwarding is started/restarted.
2068 Attach a port specified by pci address or virtual device args::
2070 testpmd> port attach (identifier)
2072 To attach a new pci device, the device should be recognized by kernel first.
2073 Then it should be moved under DPDK management.
2074 Finally the port can be attached to testpmd.
2076 For example, to move a pci device using ixgbe under DPDK management:
2078 .. code-block:: console
2080 # Check the status of the available devices.
2081 ./usertools/dpdk-devbind.py --status
2083 Network devices using DPDK-compatible driver
2084 ============================================
2087 Network devices using kernel driver
2088 ===================================
2089 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=
2092 # Bind the device to igb_uio.
2093 sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0
2096 # Recheck the status of the devices.
2097 ./usertools/dpdk-devbind.py --status
2098 Network devices using DPDK-compatible driver
2099 ============================================
2100 0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused=
2102 To attach a port created by virtual device, above steps are not needed.
2104 For example, to attach a port whose pci address is 0000:0a:00.0.
2106 .. code-block:: console
2108 testpmd> port attach 0000:0a:00.0
2109 Attaching a new port...
2110 EAL: PCI device 0000:0a:00.0 on NUMA socket -1
2111 EAL: probe driver: 8086:10fb rte_ixgbe_pmd
2112 EAL: PCI memory mapped at 0x7f83bfa00000
2113 EAL: PCI memory mapped at 0x7f83bfa80000
2114 PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5
2115 PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
2116 Port 0 is attached. Now total ports is 1
2119 For example, to attach a port created by pcap PMD.
2121 .. code-block:: console
2123 testpmd> port attach net_pcap0
2124 Attaching a new port...
2125 PMD: Initializing pmd_pcap for net_pcap0
2126 PMD: Creating pcap-backed ethdev on numa socket 0
2127 Port 0 is attached. Now total ports is 1
2130 In this case, identifier is ``net_pcap0``.
2131 This identifier format is the same as ``--vdev`` format of DPDK applications.
2133 For example, to re-attach a bonded port which has been previously detached,
2134 the mode and slave parameters must be given.
2136 .. code-block:: console
2138 testpmd> port attach net_bond_0,mode=0,slave=1
2139 Attaching a new port...
2140 EAL: Initializing pmd_bond for net_bond_0
2141 EAL: Create bonded device net_bond_0 on port 0 in mode 0 on socket 0.
2142 Port 0 is attached. Now total ports is 1
2149 Detach a specific port::
2151 testpmd> port detach (port_id)
2153 Before detaching a port, the port should be stopped and closed.
2155 For example, to detach a pci device port 0.
2157 .. code-block:: console
2159 testpmd> port stop 0
2162 testpmd> port close 0
2166 testpmd> port detach 0
2168 EAL: PCI device 0000:0a:00.0 on NUMA socket -1
2169 EAL: remove driver: 8086:10fb rte_ixgbe_pmd
2170 EAL: PCI memory unmapped at 0x7f83bfa00000
2171 EAL: PCI memory unmapped at 0x7f83bfa80000
2175 For example, to detach a virtual device port 0.
2177 .. code-block:: console
2179 testpmd> port stop 0
2182 testpmd> port close 0
2186 testpmd> port detach 0
2188 PMD: Closing pcap ethdev on numa socket 0
2189 Port 'net_pcap0' is detached. Now total ports is 0
2192 To remove a pci device completely from the system, first detach the port from testpmd.
2193 Then the device should be moved under kernel management.
2194 Finally the device can be removed using kernel pci hotplug functionality.
2196 For example, to move a pci device under kernel management:
2198 .. code-block:: console
2200 sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0
2202 ./usertools/dpdk-devbind.py --status
2204 Network devices using DPDK-compatible driver
2205 ============================================
2208 Network devices using kernel driver
2209 ===================================
2210 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio
2212 To remove a port created by a virtual device, above steps are not needed.
2217 Start all ports or a specific port::
2219 testpmd> port start (port_id|all)
2224 Stop all ports or a specific port::
2226 testpmd> port stop (port_id|all)
2231 Close all ports or a specific port::
2233 testpmd> port close (port_id|all)
2238 Reset all ports or a specific port::
2240 testpmd> port reset (port_id|all)
2242 User should stop port(s) before resetting and (re-)start after reset.
2244 port config - queue ring size
2245 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2247 Configure a rx/tx queue ring size::
2249 testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
2251 Only take effect after command that (re-)start the port or command that setup specific queue.
2253 port start/stop queue
2254 ~~~~~~~~~~~~~~~~~~~~~
2256 Start/stop a rx/tx queue on a specific port::
2258 testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
2260 port config - queue deferred start
2261 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2263 Switch on/off deferred start of a specific port queue::
2265 testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
2268 ~~~~~~~~~~~~~~~~~~~~~
2270 Setup a rx/tx queue on a specific port::
2272 testpmd> port (port_id) (rxq|txq) (queue_id) setup
2274 Only take effect when port is started.
2279 Set the speed and duplex mode for all ports or a specific port::
2281 testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|200000|auto) \
2282 duplex (half|full|auto)
2284 port config - queues/descriptors
2285 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2287 Set number of queues/descriptors for rxq, txq, rxd and txd::
2289 testpmd> port config all (rxq|txq|rxd|txd) (value)
2291 This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2293 port config - max-pkt-len
2294 ~~~~~~~~~~~~~~~~~~~~~~~~~
2296 Set the maximum packet length::
2298 testpmd> port config all max-pkt-len (value)
2300 This is equivalent to the ``--max-pkt-len`` command-line option.
2302 port config - max-lro-pkt-size
2303 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2305 Set the maximum LRO aggregated packet size::
2307 testpmd> port config all max-lro-pkt-size (value)
2309 This is equivalent to the ``--max-lro-pkt-size`` command-line option.
2311 port config - Drop Packets
2312 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2314 Enable or disable packet drop on all RX queues of all ports when no receive buffers available::
2316 testpmd> port config all drop-en (on|off)
2318 Packet dropping when no receive buffers available is off by default.
2320 The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2325 Set the RSS (Receive Side Scaling) mode on or off::
2327 testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|none)
2329 RSS is on by default.
2331 The ``all`` option is equivalent to eth|vlan|ip|tcp|udp|sctp|ether|l2tpv3|esp|ah|pfcp.
2333 The ``default`` option enables all supported RSS types reported by device info.
2335 The ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2337 port config - RSS Reta
2338 ~~~~~~~~~~~~~~~~~~~~~~
2340 Set the RSS (Receive Side Scaling) redirection table::
2342 testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2347 Set the DCB mode for an individual port::
2349 testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2351 The traffic class should be 4 or 8.
2356 Set the number of packets per burst::
2358 testpmd> port config all burst (value)
2360 This is equivalent to the ``--burst`` command-line option.
2362 port config - Threshold
2363 ~~~~~~~~~~~~~~~~~~~~~~~
2365 Set thresholds for TX/RX queues::
2367 testpmd> port config all (threshold) (value)
2369 Where the threshold type can be:
2371 * ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255.
2373 * ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255.
2375 * ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255.
2377 * ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255.
2379 * ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255.
2381 * ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255.
2383 * ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd.
2385 * ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd.
2387 * ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd.
2389 These threshold options are also available from the command-line.
2394 Set the value of ether-type for E-tag::
2396 testpmd> port config (port_id|all) l2-tunnel E-tag ether-type (value)
2398 Enable/disable the E-tag support::
2400 testpmd> port config (port_id|all) l2-tunnel E-tag (enable|disable)
2402 port config pctype mapping
2403 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2405 Reset pctype mapping table::
2407 testpmd> port config (port_id) pctype mapping reset
2409 Update hardware defined pctype to software defined flow type mapping table::
2411 testpmd> port config (port_id) pctype mapping update (pctype_id_0[,pctype_id_1]*) (flow_type_id)
2415 * ``pctype_id_x``: hardware pctype id as index of bit in bitmask value of the pctype mapping table.
2417 * ``flow_type_id``: software flow type id as the index of the pctype mapping table.
2419 port config input set
2420 ~~~~~~~~~~~~~~~~~~~~~
2422 Config RSS/FDIR/FDIR flexible payload input set for some pctype::
2424 testpmd> port config (port_id) pctype (pctype_id) \
2425 (hash_inset|fdir_inset|fdir_flx_inset) \
2426 (get|set|clear) field (field_idx)
2428 Clear RSS/FDIR/FDIR flexible payload input set for some pctype::
2430 testpmd> port config (port_id) pctype (pctype_id) \
2431 (hash_inset|fdir_inset|fdir_flx_inset) clear all
2435 * ``pctype_id``: hardware packet classification types.
2436 * ``field_idx``: hardware field index.
2438 port config udp_tunnel_port
2439 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2441 Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
2443 testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe (udp_port)
2445 port config tx_metadata
2446 ~~~~~~~~~~~~~~~~~~~~~~~
2448 Set Tx metadata value per port.
2449 testpmd will add this value to any Tx packet sent from this port::
2451 testpmd> port config (port_id) tx_metadata (value)
2456 Set/clear dynamic flag per port.
2457 testpmd will register this flag in the mbuf (same registration
2458 for both Tx and Rx). Then set/clear this flag for each Tx
2459 packet sent from this port. The set bit only works for Tx packet::
2461 testpmd> port config (port_id) dynf (name) (set|clear)
2466 To configure MTU(Maximum Transmission Unit) on devices using testpmd::
2468 testpmd> port config mtu (port_id) (value)
2470 port config rss hash key
2471 ~~~~~~~~~~~~~~~~~~~~~~~~
2473 To configure the RSS hash key used to compute the RSS
2474 hash of input [IP] packets received on port::
2476 testpmd> port config <port_id> rss-hash-key (ipv4|ipv4-frag|\
2477 ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|\
2478 ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|\
2479 ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|\
2480 ipv6-udp-ex <string of hex digits \
2481 (variable length, NIC dependent)>)
2486 The following sections show functions for device operations.
2491 Detach a device specified by pci address or virtual device args::
2493 testpmd> device detach (identifier)
2495 Before detaching a device associated with ports, the ports should be stopped and closed.
2497 For example, to detach a pci device whose address is 0002:03:00.0.
2499 .. code-block:: console
2501 testpmd> device detach 0002:03:00.0
2502 Removing a device...
2503 Port 1 is now closed
2504 EAL: Releasing pci mapped resource for 0002:03:00.0
2505 EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218a050000
2506 EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218c050000
2507 Device 0002:03:00.0 is detached
2508 Now total ports is 1
2510 For example, to detach a port created by pcap PMD.
2512 .. code-block:: console
2514 testpmd> device detach net_pcap0
2515 Removing a device...
2516 Port 0 is now closed
2517 Device net_pcap0 is detached
2518 Now total ports is 0
2521 In this case, identifier is ``net_pcap0``.
2522 This identifier format is the same as ``--vdev`` format of DPDK applications.
2524 Link Bonding Functions
2525 ----------------------
2527 The Link Bonding functions make it possible to dynamically create and
2528 manage link bonding devices from within testpmd interactive prompt.
2530 create bonded device
2531 ~~~~~~~~~~~~~~~~~~~~
2533 Create a new bonding device::
2535 testpmd> create bonded device (mode) (socket)
2537 For example, to create a bonded device in mode 1 on socket 0::
2539 testpmd> create bonded device 1 0
2540 created new bonded device (port X)
2545 Adds Ethernet device to a Link Bonding device::
2547 testpmd> add bonding slave (slave id) (port id)
2549 For example, to add Ethernet device (port 6) to a Link Bonding device (port 10)::
2551 testpmd> add bonding slave 6 10
2554 remove bonding slave
2555 ~~~~~~~~~~~~~~~~~~~~
2557 Removes an Ethernet slave device from a Link Bonding device::
2559 testpmd> remove bonding slave (slave id) (port id)
2561 For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10)::
2563 testpmd> remove bonding slave 6 10
2568 Set the Link Bonding mode of a Link Bonding device::
2570 testpmd> set bonding mode (value) (port id)
2572 For example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3)::
2574 testpmd> set bonding mode 3 10
2579 Set an Ethernet slave device as the primary device on a Link Bonding device::
2581 testpmd> set bonding primary (slave id) (port id)
2583 For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10)::
2585 testpmd> set bonding primary 6 10
2590 Set the MAC address of a Link Bonding device::
2592 testpmd> set bonding mac (port id) (mac)
2594 For example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01::
2596 testpmd> set bonding mac 10 00:00:00:00:00:01
2598 set bonding xmit_balance_policy
2599 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2601 Set the transmission policy for a Link Bonding device when it is in Balance XOR mode::
2603 testpmd> set bonding xmit_balance_policy (port_id) (l2|l23|l34)
2605 For example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports)::
2607 testpmd> set bonding xmit_balance_policy 10 l34
2610 set bonding mon_period
2611 ~~~~~~~~~~~~~~~~~~~~~~
2613 Set the link status monitoring polling period in milliseconds for a bonding device.
2615 This adds support for PMD slave devices which do not support link status interrupts.
2616 When the mon_period is set to a value greater than 0 then all PMD's which do not support
2617 link status ISR will be queried every polling interval to check if their link status has changed::
2619 testpmd> set bonding mon_period (port_id) (value)
2621 For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms::
2623 testpmd> set bonding mon_period 5 150
2626 set bonding lacp dedicated_queue
2627 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2629 Enable dedicated tx/rx queues on bonding devices slaves to handle LACP control plane traffic
2630 when in mode 4 (link-aggregation-802.3ad)::
2632 testpmd> set bonding lacp dedicated_queues (port_id) (enable|disable)
2635 set bonding agg_mode
2636 ~~~~~~~~~~~~~~~~~~~~
2638 Enable one of the specific aggregators mode when in mode 4 (link-aggregation-802.3ad)::
2640 testpmd> set bonding agg_mode (port_id) (bandwidth|count|stable)
2646 Show the current configuration of a Link Bonding device::
2648 testpmd> show bonding config (port id)
2651 to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4)
2652 in balance mode with a transmission policy of layer 2+3::
2654 testpmd> show bonding config 9
2656 Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23
2658 Active Slaves (3): [1 3 4]
2665 The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
2666 This is mainly useful for debugging purposes.
2667 Reference should be made to the appropriate datasheet for the network card for details on the register addresses
2668 and fields that can be accessed.
2673 Display the value of a port register::
2675 testpmd> read reg (port_id) (address)
2677 For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
2679 testpmd> read reg 0 0xEE00
2680 port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
2685 Display a port register bit field::
2687 testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
2689 For example, reading the lowest two bits from the register in the example above::
2691 testpmd> read regfield 0 0xEE00 0 1
2692 port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
2697 Display a single port register bit::
2699 testpmd> read regbit (port_id) (address) (bit_x)
2701 For example, reading the lowest bit from the register in the example above::
2703 testpmd> read regbit 0 0xEE00 0
2704 port 0 PCI register at offset 0xEE00: bit 0=1
2709 Set the value of a port register::
2711 testpmd> write reg (port_id) (address) (value)
2713 For example, to clear a register::
2715 testpmd> write reg 0 0xEE00 0x0
2716 port 0 PCI register at offset 0xEE00: 0x00000000 (0)
2721 Set bit field of a port register::
2723 testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
2725 For example, writing to the register cleared in the example above::
2727 testpmd> write regfield 0 0xEE00 0 1 2
2728 port 0 PCI register at offset 0xEE00: 0x00000002 (2)
2733 Set single bit value of a port register::
2735 testpmd> write regbit (port_id) (address) (bit_x) (value)
2737 For example, to set the high bit in the register from the example above::
2739 testpmd> write regbit 0 0xEE00 31 1
2740 port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
2742 Traffic Metering and Policing
2743 -----------------------------
2745 The following section shows functions for configuring traffic metering and
2746 policing on the ethernet device through the use of generic ethdev API.
2748 show port traffic management capability
2749 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2751 Show traffic metering and policing capability of the port::
2753 testpmd> show port meter cap (port_id)
2755 add port meter profile (srTCM rfc2967)
2756 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2758 Add meter profile (srTCM rfc2697) to the ethernet device::
2760 testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
2765 * ``profile_id``: ID for the meter profile.
2766 * ``cir``: Committed Information Rate (CIR) (bytes/second).
2767 * ``cbs``: Committed Burst Size (CBS) (bytes).
2768 * ``ebs``: Excess Burst Size (EBS) (bytes).
2770 add port meter profile (trTCM rfc2968)
2771 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2773 Add meter profile (srTCM rfc2698) to the ethernet device::
2775 testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
2776 (cir) (pir) (cbs) (pbs)
2780 * ``profile_id``: ID for the meter profile.
2781 * ``cir``: Committed information rate (bytes/second).
2782 * ``pir``: Peak information rate (bytes/second).
2783 * ``cbs``: Committed burst size (bytes).
2784 * ``pbs``: Peak burst size (bytes).
2786 add port meter profile (trTCM rfc4115)
2787 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2789 Add meter profile (trTCM rfc4115) to the ethernet device::
2791 testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
2792 (cir) (eir) (cbs) (ebs)
2796 * ``profile_id``: ID for the meter profile.
2797 * ``cir``: Committed information rate (bytes/second).
2798 * ``eir``: Excess information rate (bytes/second).
2799 * ``cbs``: Committed burst size (bytes).
2800 * ``ebs``: Excess burst size (bytes).
2802 delete port meter profile
2803 ~~~~~~~~~~~~~~~~~~~~~~~~~
2805 Delete meter profile from the ethernet device::
2807 testpmd> del port meter profile (port_id) (profile_id)
2812 Create new meter object for the ethernet device::
2814 testpmd> create port meter (port_id) (mtr_id) (profile_id) \
2815 (meter_enable) (g_action) (y_action) (r_action) (stats_mask) (shared) \
2816 (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\
2821 * ``mtr_id``: meter object ID.
2822 * ``profile_id``: ID for the meter profile.
2823 * ``meter_enable``: When this parameter has a non-zero value, the meter object
2824 gets enabled at the time of creation, otherwise remains disabled.
2825 * ``g_action``: Policer action for the packet with green color.
2826 * ``y_action``: Policer action for the packet with yellow color.
2827 * ``r_action``: Policer action for the packet with red color.
2828 * ``stats_mask``: Mask of statistics counter types to be enabled for the
2830 * ``shared``: When this parameter has a non-zero value, the meter object is
2831 shared by multiple flows. Otherwise, meter object is used by single flow.
2832 * ``use_pre_meter_color``: When this parameter has a non-zero value, the
2833 input color for the current meter object is determined by the latest meter
2834 object in the same flow. Otherwise, the current meter object uses the
2835 *dscp_table* to determine the input color.
2836 * ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input
2837 color, 0 <= x <= 63.
2842 Enable meter for the ethernet device::
2844 testpmd> enable port meter (port_id) (mtr_id)
2849 Disable meter for the ethernet device::
2851 testpmd> disable port meter (port_id) (mtr_id)
2856 Delete meter for the ethernet device::
2858 testpmd> del port meter (port_id) (mtr_id)
2860 Set port meter profile
2861 ~~~~~~~~~~~~~~~~~~~~~~
2863 Set meter profile for the ethernet device::
2865 testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2867 set port meter dscp table
2868 ~~~~~~~~~~~~~~~~~~~~~~~~~
2870 Set meter dscp table for the ethernet device::
2872 testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0) \
2873 (dscp_tbl_entry1)...(dscp_tbl_entry63)]
2875 set port meter policer action
2876 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2878 Set meter policer action for the ethernet device::
2880 testpmd> set port meter policer action (port_id) (mtr_id) (action_mask) \
2881 (action0) [(action1) (action1)]
2885 * ``action_mask``: Bit mask indicating which policer actions need to be
2886 updated. One or more policer actions can be updated in a single function
2887 invocation. To update the policer action associated with color C, bit
2888 (1 << C) needs to be set in *action_mask* and element at position C
2889 in the *actions* array needs to be valid.
2890 * ``actionx``: Policer action for the color x,
2891 RTE_MTR_GREEN <= x < RTE_MTR_COLORS
2893 set port meter stats mask
2894 ~~~~~~~~~~~~~~~~~~~~~~~~~
2896 Set meter stats mask for the ethernet device::
2898 testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2902 * ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2904 show port meter stats
2905 ~~~~~~~~~~~~~~~~~~~~~
2907 Show meter stats of the ethernet device::
2909 testpmd> show port meter stats (port_id) (mtr_id) (clear)
2913 * ``clear``: Flag that indicates whether the statistics counters should
2914 be cleared (i.e. set to zero) immediately after they have been read or not.
2919 The following section shows functions for configuring traffic management on
2920 the ethernet device through the use of generic TM API.
2922 show port traffic management capability
2923 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2925 Show traffic management capability of the port::
2927 testpmd> show port tm cap (port_id)
2929 show port traffic management capability (hierarchy level)
2930 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2932 Show traffic management hierarchy level capability of the port::
2934 testpmd> show port tm level cap (port_id) (level_id)
2936 show port traffic management capability (hierarchy node level)
2937 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2939 Show the traffic management hierarchy node capability of the port::
2941 testpmd> show port tm node cap (port_id) (node_id)
2943 show port traffic management hierarchy node type
2944 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2946 Show the port traffic management hierarchy node type::
2948 testpmd> show port tm node type (port_id) (node_id)
2950 show port traffic management hierarchy node stats
2951 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2953 Show the port traffic management hierarchy node statistics::
2955 testpmd> show port tm node stats (port_id) (node_id) (clear)
2959 * ``clear``: When this parameter has a non-zero value, the statistics counters
2960 are cleared (i.e. set to zero) immediately after they have been read,
2961 otherwise the statistics counters are left untouched.
2963 Add port traffic management private shaper profile
2964 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2966 Add the port traffic management private shaper profile::
2968 testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
2969 (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
2970 (packet_length_adjust) (packet_mode)
2974 * ``shaper_profile id``: Shaper profile ID for the new profile.
2975 * ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second).
2976 * ``cmit_tb_size``: Committed token bucket size (bytes or packets).
2977 * ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second).
2978 * ``peak_tb_size``: Peak token bucket size (bytes or packets).
2979 * ``packet_length_adjust``: The value (bytes) to be added to the length of
2980 each packet for the purpose of shaping. This parameter value can be used to
2981 correct the packet length with the framing overhead bytes that are consumed
2983 * ``packet_mode``: Shaper configured in packet mode. This parameter value if
2984 zero, configures shaper in byte mode and if non-zero configures it in packet
2987 Delete port traffic management private shaper profile
2988 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2990 Delete the port traffic management private shaper::
2992 testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
2996 * ``shaper_profile id``: Shaper profile ID that needs to be deleted.
2998 Add port traffic management shared shaper
2999 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3001 Create the port traffic management shared shaper::
3003 testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \
3008 * ``shared_shaper_id``: Shared shaper ID to be created.
3009 * ``shaper_profile id``: Shaper profile ID for shared shaper.
3011 Set port traffic management shared shaper
3012 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3014 Update the port traffic management shared shaper::
3016 testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \
3021 * ``shared_shaper_id``: Shared shaper ID to be update.
3022 * ``shaper_profile id``: Shaper profile ID for shared shaper.
3024 Delete port traffic management shared shaper
3025 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3027 Delete the port traffic management shared shaper::
3029 testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
3033 * ``shared_shaper_id``: Shared shaper ID to be deleted.
3035 Set port traffic management hierarchy node private shaper
3036 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3038 set the port traffic management hierarchy node private shaper::
3040 testpmd> set port tm node shaper profile (port_id) (node_id) \
3045 * ``shaper_profile id``: Private shaper profile ID to be enabled on the
3048 Add port traffic management WRED profile
3049 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3051 Create a new WRED profile::
3053 testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
3054 (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
3055 (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
3056 (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
3060 * ``wred_profile id``: Identifier for the newly create WRED profile
3061 * ``color_g``: Packet color (green)
3062 * ``min_th_g``: Minimum queue threshold for packet with green color
3063 * ``max_th_g``: Minimum queue threshold for packet with green color
3064 * ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp)
3065 * ``wq_log2_g``: Negated log2 of queue weight (wq)
3066 * ``color_y``: Packet color (yellow)
3067 * ``min_th_y``: Minimum queue threshold for packet with yellow color
3068 * ``max_th_y``: Minimum queue threshold for packet with yellow color
3069 * ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp)
3070 * ``wq_log2_y``: Negated log2 of queue weight (wq)
3071 * ``color_r``: Packet color (red)
3072 * ``min_th_r``: Minimum queue threshold for packet with yellow color
3073 * ``max_th_r``: Minimum queue threshold for packet with yellow color
3074 * ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp)
3075 * ``wq_log2_r``: Negated log2 of queue weight (wq)
3077 Delete port traffic management WRED profile
3078 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3080 Delete the WRED profile::
3082 testpmd> del port tm node wred profile (port_id) (wred_profile_id)
3084 Add port traffic management hierarchy nonleaf node
3085 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3087 Add nonleaf node to port traffic management hierarchy::
3089 testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \
3090 (priority) (weight) (level_id) (shaper_profile_id) \
3091 (n_sp_priorities) (stats_mask) (n_shared_shapers) \
3092 [(shared_shaper_0) (shared_shaper_1) ...] \
3096 * ``parent_node_id``: Node ID of the parent.
3097 * ``priority``: Node priority (highest node priority is zero). This is used by
3098 the SP algorithm running on the parent node for scheduling this node.
3099 * ``weight``: Node weight (lowest weight is one). The node weight is relative
3100 to the weight sum of all siblings that have the same priority. It is used by
3101 the WFQ algorithm running on the parent node for scheduling this node.
3102 * ``level_id``: Hierarchy level of the node.
3103 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
3105 * ``n_sp_priorities``: Number of strict priorities.
3106 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
3107 * ``n_shared_shapers``: Number of shared shapers.
3108 * ``shared_shaper_id``: Shared shaper id.
3110 Add port traffic management hierarchy nonleaf node with packet mode
3111 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3113 Add nonleaf node with packet mode to port traffic management hierarchy::
3115 testpmd> add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id) \
3116 (priority) (weight) (level_id) (shaper_profile_id) \
3117 (n_sp_priorities) (stats_mask) (n_shared_shapers) \
3118 [(shared_shaper_0) (shared_shaper_1) ...] \
3122 * ``parent_node_id``: Node ID of the parent.
3123 * ``priority``: Node priority (highest node priority is zero). This is used by
3124 the SP algorithm running on the parent node for scheduling this node.
3125 * ``weight``: Node weight (lowest weight is one). The node weight is relative
3126 to the weight sum of all siblings that have the same priority. It is used by
3127 the WFQ algorithm running on the parent node for scheduling this node.
3128 * ``level_id``: Hierarchy level of the node.
3129 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
3131 * ``n_sp_priorities``: Number of strict priorities. Packet mode is enabled on
3133 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
3134 * ``n_shared_shapers``: Number of shared shapers.
3135 * ``shared_shaper_id``: Shared shaper id.
3137 Add port traffic management hierarchy leaf node
3138 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3140 Add leaf node to port traffic management hierarchy::
3142 testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \
3143 (priority) (weight) (level_id) (shaper_profile_id) \
3144 (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \
3145 [(shared_shaper_id) (shared_shaper_id) ...] \
3149 * ``parent_node_id``: Node ID of the parent.
3150 * ``priority``: Node priority (highest node priority is zero). This is used by
3151 the SP algorithm running on the parent node for scheduling this node.
3152 * ``weight``: Node weight (lowest weight is one). The node weight is relative
3153 to the weight sum of all siblings that have the same priority. It is used by
3154 the WFQ algorithm running on the parent node for scheduling this node.
3155 * ``level_id``: Hierarchy level of the node.
3156 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
3158 * ``cman_mode``: Congestion management mode to be enabled for this node.
3159 * ``wred_profile_id``: WRED profile id to be enabled for this node.
3160 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
3161 * ``n_shared_shapers``: Number of shared shapers.
3162 * ``shared_shaper_id``: Shared shaper id.
3164 Delete port traffic management hierarchy node
3165 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3167 Delete node from port traffic management hierarchy::
3169 testpmd> del port tm node (port_id) (node_id)
3171 Update port traffic management hierarchy parent node
3172 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3174 Update port traffic management hierarchy parent node::
3176 testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \
3179 This function can only be called after the hierarchy commit invocation. Its
3180 success depends on the port support for this operation, as advertised through
3181 the port capability set. This function is valid for all nodes of the traffic
3182 management hierarchy except root node.
3184 Suspend port traffic management hierarchy node
3185 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3187 testpmd> suspend port tm node (port_id) (node_id)
3189 Resume port traffic management hierarchy node
3190 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3192 testpmd> resume port tm node (port_id) (node_id)
3194 Commit port traffic management hierarchy
3195 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3197 Commit the traffic management hierarchy on the port::
3199 testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
3203 * ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function
3204 call failure. On the other hand, hierarchy is preserved when this parameter
3207 Set port traffic management mark VLAN dei
3208 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3210 Enables/Disables the traffic management marking on the port for VLAN packets::
3212 testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red>
3216 * ``port_id``: The port which on which VLAN packets marked as ``green`` or
3217 ``yellow`` or ``red`` will have dei bit enabled
3219 * ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green
3221 * ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow
3223 * ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red
3225 Set port traffic management mark IP dscp
3226 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3228 Enables/Disables the traffic management marking on the port for IP dscp packets::
3230 testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red>
3234 * ``port_id``: The port which on which IP packets marked as ``green`` or
3235 ``yellow`` or ``red`` will have IP dscp bits updated
3237 * ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets
3239 * ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets
3241 * ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets
3243 Set port traffic management mark IP ecn
3244 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3246 Enables/Disables the traffic management marking on the port for IP ecn packets::
3248 testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red>
3252 * ``port_id``: The port which on which IP packets marked as ``green`` or
3253 ``yellow`` or ``red`` will have IP ecn bits updated
3255 * ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01 or 2'b10
3256 to ecn of 2'b11 when IP is caring TCP or SCTP
3258 * ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
3259 to ecn of 2'b11 when IP is caring TCP or SCTP
3261 * ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10
3262 to ecn of 2'b11 when IP is caring TCP or SCTP
3267 This section details the available filter functions that are available.
3269 Note these functions interface the deprecated legacy filtering framework,
3270 superseded by *rte_flow*. See `Flow rules management`_.
3273 ~~~~~~~~~~~~~~~~~~~~
3275 Add or delete a L2 Ethertype filter, which identify packets by their L2 Ethertype mainly assign them to a receive queue::
3277 ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr) (mac_address) \
3278 ethertype (ether_type) (drop|fwd) queue (queue_id)
3280 The available information parameters are:
3282 * ``port_id``: The port which the Ethertype filter assigned on.
3284 * ``mac_addr``: Compare destination mac address.
3286 * ``mac_ignr``: Ignore destination mac address match.
3288 * ``mac_address``: Destination mac address to match.
3290 * ``ether_type``: The EtherType value want to match,
3291 for example 0x0806 for ARP packet. 0x0800 (IPv4) and 0x86DD (IPv6) are invalid.
3293 * ``queue_id``: The receive queue associated with this EtherType filter.
3294 It is meaningless when deleting or dropping.
3296 Example, to add/remove an ethertype filter rule::
3298 testpmd> ethertype_filter 0 add mac_ignr 00:11:22:33:44:55 \
3299 ethertype 0x0806 fwd queue 3
3301 testpmd> ethertype_filter 0 del mac_ignr 00:11:22:33:44:55 \
3302 ethertype 0x0806 fwd queue 3
3307 Add or delete a 2-tuple filter,
3308 which identifies packets by specific protocol and destination TCP/UDP port
3309 and forwards packets into one of the receive queues::
3311 2tuple_filter (port_id) (add|del) dst_port (dst_port_value) \
3312 protocol (protocol_value) mask (mask_value) \
3313 tcp_flags (tcp_flags_value) priority (prio_value) \
3316 The available information parameters are:
3318 * ``port_id``: The port which the 2-tuple filter assigned on.
3320 * ``dst_port_value``: Destination port in L4.
3322 * ``protocol_value``: IP L4 protocol.
3324 * ``mask_value``: Participates in the match or not by bit for field above, 1b means participate.
3326 * ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the pro_value is not set to 0x06 (TCP).
3328 * ``prio_value``: Priority of this filter.
3330 * ``queue_id``: The receive queue associated with this 2-tuple filter.
3332 Example, to add/remove an 2tuple filter rule::
3334 testpmd> 2tuple_filter 0 add dst_port 32 protocol 0x06 mask 0x03 \
3335 tcp_flags 0x02 priority 3 queue 3
3337 testpmd> 2tuple_filter 0 del dst_port 32 protocol 0x06 mask 0x03 \
3338 tcp_flags 0x02 priority 3 queue 3
3343 Add or delete a 5-tuple filter,
3344 which consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port)
3345 and routes packets into one of the receive queues::
3347 5tuple_filter (port_id) (add|del) dst_ip (dst_address) src_ip \
3348 (src_address) dst_port (dst_port_value) \
3349 src_port (src_port_value) protocol (protocol_value) \
3350 mask (mask_value) tcp_flags (tcp_flags_value) \
3351 priority (prio_value) queue (queue_id)
3353 The available information parameters are:
3355 * ``port_id``: The port which the 5-tuple filter assigned on.
3357 * ``dst_address``: Destination IP address.
3359 * ``src_address``: Source IP address.
3361 * ``dst_port_value``: TCP/UDP destination port.
3363 * ``src_port_value``: TCP/UDP source port.
3365 * ``protocol_value``: L4 protocol.
3367 * ``mask_value``: Participates in the match or not by bit for field above, 1b means participate
3369 * ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the protocol_value is not set to 0x06 (TCP).
3371 * ``prio_value``: The priority of this filter.
3373 * ``queue_id``: The receive queue associated with this 5-tuple filter.
3375 Example, to add/remove an 5tuple filter rule::
3377 testpmd> 5tuple_filter 0 add dst_ip 2.2.2.5 src_ip 2.2.2.4 \
3378 dst_port 64 src_port 32 protocol 0x06 mask 0x1F \
3379 flags 0x0 priority 3 queue 3
3381 testpmd> 5tuple_filter 0 del dst_ip 2.2.2.5 src_ip 2.2.2.4 \
3382 dst_port 64 src_port 32 protocol 0x06 mask 0x1F \
3383 flags 0x0 priority 3 queue 3
3388 Using the SYN filter, TCP packets whose *SYN* flag is set can be forwarded to a separate queue::
3390 syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)
3392 The available information parameters are:
3394 * ``port_id``: The port which the SYN filter assigned on.
3396 * ``high``: This SYN filter has higher priority than other filters.
3398 * ``low``: This SYN filter has lower priority than other filters.
3400 * ``queue_id``: The receive queue associated with this SYN filter
3404 testpmd> syn_filter 0 add priority high queue 3
3409 With flex filter, packets can be recognized by any arbitrary pattern within the first 128 bytes of the packet
3410 and routed into one of the receive queues::
3412 flex_filter (port_id) (add|del) len (len_value) bytes (bytes_value) \
3413 mask (mask_value) priority (prio_value) queue (queue_id)
3415 The available information parameters are:
3417 * ``port_id``: The port which the Flex filter is assigned on.
3419 * ``len_value``: Filter length in bytes, no greater than 128.
3421 * ``bytes_value``: A string in hexadecimal, means the value the flex filter needs to match.
3423 * ``mask_value``: A string in hexadecimal, bit 1 means corresponding byte participates in the match.
3425 * ``prio_value``: The priority of this filter.
3427 * ``queue_id``: The receive queue associated with this Flex filter.
3431 testpmd> flex_filter 0 add len 16 bytes 0x00000000000000000000000008060000 \
3432 mask 000C priority 3 queue 3
3434 testpmd> flex_filter 0 del len 16 bytes 0x00000000000000000000000008060000 \
3435 mask 000C priority 3 queue 3
3438 .. _testpmd_flow_director:
3440 flow_director_filter
3441 ~~~~~~~~~~~~~~~~~~~~
3443 The Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues.
3445 Four types of filtering are supported which are referred to as Perfect Match, Signature, Perfect-mac-vlan and
3446 Perfect-tunnel filters, the match mode is set by the ``--pkt-filter-mode`` command-line parameter:
3448 * Perfect match filters.
3449 The hardware checks a match between the masked fields of the received packets and the programmed filters.
3450 The masked fields are for IP flow.
3452 * Signature filters.
3453 The hardware checks a match between a hash-based signature of the masked fields of the received packet.
3455 * Perfect-mac-vlan match filters.
3456 The hardware checks a match between the masked fields of the received packets and the programmed filters.
3457 The masked fields are for MAC VLAN flow.
3459 * Perfect-tunnel match filters.
3460 The hardware checks a match between the masked fields of the received packets and the programmed filters.
3461 The masked fields are for tunnel flow.
3463 * Perfect-raw-flow-type match filters.
3464 The hardware checks a match between the masked fields of the received packets and pre-loaded raw (template) packet.
3465 The masked fields are specified by input sets.
3467 The Flow Director filters can match the different fields for different type of packet: flow type, specific input set
3468 per flow type and the flexible payload.
3470 The Flow Director can also mask out parts of all of these fields so that filters
3471 are only applied to certain fields or parts of the fields.
3473 Note that for raw flow type mode the source and destination fields in the
3474 raw packet buffer need to be presented in a reversed order with respect
3475 to the expected received packets.
3476 For example: IP source and destination addresses or TCP/UDP/SCTP
3477 source and destination ports
3479 Different NICs may have different capabilities, command show port fdir (port_id) can be used to acquire the information.
3481 # Commands to add flow director filters of different flow types::
3483 flow_director_filter (port_id) mode IP (add|del|update) \
3484 flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag) \
3485 src (src_ip_address) dst (dst_ip_address) \
3486 tos (tos_value) proto (proto_value) ttl (ttl_value) \
3487 vlan (vlan_value) flexbytes (flexbytes_value) \
3488 (drop|fwd) pf|vf(vf_id) queue (queue_id) \
3491 flow_director_filter (port_id) mode IP (add|del|update) \
3492 flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp) \
3493 src (src_ip_address) (src_port) \
3494 dst (dst_ip_address) (dst_port) \
3495 tos (tos_value) ttl (ttl_value) \
3496 vlan (vlan_value) flexbytes (flexbytes_value) \
3497 (drop|fwd) queue pf|vf(vf_id) (queue_id) \
3500 flow_director_filter (port_id) mode IP (add|del|update) \
3501 flow (ipv4-sctp|ipv6-sctp) \
3502 src (src_ip_address) (src_port) \
3503 dst (dst_ip_address) (dst_port) \
3504 tos (tos_value) ttl (ttl_value) \
3505 tag (verification_tag) vlan (vlan_value) \
3506 flexbytes (flexbytes_value) (drop|fwd) \
3507 pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
3509 flow_director_filter (port_id) mode IP (add|del|update) flow l2_payload \
3510 ether (ethertype) flexbytes (flexbytes_value) \
3511 (drop|fwd) pf|vf(vf_id) queue (queue_id)
3514 flow_director_filter (port_id) mode MAC-VLAN (add|del|update) \
3515 mac (mac_address) vlan (vlan_value) \
3516 flexbytes (flexbytes_value) (drop|fwd) \
3517 queue (queue_id) fd_id (fd_id_value)
3519 flow_director_filter (port_id) mode Tunnel (add|del|update) \
3520 mac (mac_address) vlan (vlan_value) \
3521 tunnel (NVGRE|VxLAN) tunnel-id (tunnel_id_value) \
3522 flexbytes (flexbytes_value) (drop|fwd) \
3523 queue (queue_id) fd_id (fd_id_value)
3525 flow_director_filter (port_id) mode raw (add|del|update) flow (flow_id) \
3526 (drop|fwd) queue (queue_id) fd_id (fd_id_value) \
3527 packet (packet file name)
3529 For example, to add an ipv4-udp flow type filter::
3531 testpmd> flow_director_filter 0 mode IP add flow ipv4-udp src 2.2.2.3 32 \
3532 dst 2.2.2.5 33 tos 2 ttl 40 vlan 0x1 flexbytes (0x88,0x48) \
3533 fwd pf queue 1 fd_id 1
3535 For example, add an ipv4-other flow type filter::
3537 testpmd> flow_director_filter 0 mode IP add flow ipv4-other src 2.2.2.3 \
3538 dst 2.2.2.5 tos 2 proto 20 ttl 40 vlan 0x1 \
3539 flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
3544 Flush all flow director filters on a device::
3546 testpmd> flush_flow_director (port_id)
3548 Example, to flush all flow director filter on port 0::
3550 testpmd> flush_flow_director 0
3555 Set flow director's input masks::
3557 flow_director_mask (port_id) mode IP vlan (vlan_value) \
3558 src_mask (ipv4_src) (ipv6_src) (src_port) \
3559 dst_mask (ipv4_dst) (ipv6_dst) (dst_port)
3561 flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value)
3563 flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \
3564 mac (mac_value) tunnel-type (tunnel_type_value) \
3565 tunnel-id (tunnel_id_value)
3567 Example, to set flow director mask on port 0::
3569 testpmd> flow_director_mask 0 mode IP vlan 0xefff \
3570 src_mask 255.255.255.255 \
3571 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF \
3572 dst_mask 255.255.255.255 \
3573 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF
3575 flow_director_flex_mask
3576 ~~~~~~~~~~~~~~~~~~~~~~~
3578 set masks of flow director's flexible payload based on certain flow type::
3580 testpmd> flow_director_flex_mask (port_id) \
3581 flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3582 ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
3583 l2_payload|all) (mask)
3585 Example, to set flow director's flex mask for all flow type on port 0::
3587 testpmd> flow_director_flex_mask 0 flow all \
3588 (0xff,0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
3591 flow_director_flex_payload
3592 ~~~~~~~~~~~~~~~~~~~~~~~~~~
3594 Configure flexible payload selection::
3596 flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config)
3598 For example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload::
3600 testpmd> flow_director_flex_payload 0 l4 \
3601 (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
3603 get_sym_hash_ena_per_port
3604 ~~~~~~~~~~~~~~~~~~~~~~~~~
3606 Get symmetric hash enable configuration per port::
3608 get_sym_hash_ena_per_port (port_id)
3610 For example, to get symmetric hash enable configuration of port 1::
3612 testpmd> get_sym_hash_ena_per_port 1
3614 set_sym_hash_ena_per_port
3615 ~~~~~~~~~~~~~~~~~~~~~~~~~
3617 Set symmetric hash enable configuration per port to enable or disable::
3619 set_sym_hash_ena_per_port (port_id) (enable|disable)
3621 For example, to set symmetric hash enable configuration of port 1 to enable::
3623 testpmd> set_sym_hash_ena_per_port 1 enable
3625 get_hash_global_config
3626 ~~~~~~~~~~~~~~~~~~~~~~
3628 Get the global configurations of hash filters::
3630 get_hash_global_config (port_id)
3632 For example, to get the global configurations of hash filters of port 1::
3634 testpmd> get_hash_global_config 1
3636 set_hash_global_config
3637 ~~~~~~~~~~~~~~~~~~~~~~
3639 Set the global configurations of hash filters::
3641 set_hash_global_config (port_id) (toeplitz|simple_xor|symmetric_toeplitz|default) \
3642 (ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|ipv6-frag| \
3643 ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload|<flow_id>) \
3646 For example, to enable simple_xor for flow type of ipv6 on port 2::
3648 testpmd> set_hash_global_config 2 simple_xor ipv6 enable
3653 Set the input set for hash::
3655 set_hash_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3656 ipv4-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \
3657 l2_payload|<flow_id>) (ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6| \
3658 ipv4-tos|ipv4-proto|ipv6-tc|ipv6-next-header|udp-src-port|udp-dst-port| \
3659 tcp-src-port|tcp-dst-port|sctp-src-port|sctp-dst-port|sctp-veri-tag| \
3660 udp-key|gre-key|fld-1st|fld-2nd|fld-3rd|fld-4th|fld-5th|fld-6th|fld-7th| \
3661 fld-8th|none) (select|add)
3663 For example, to add source IP to hash input set for flow type of ipv4-udp on port 0::
3665 testpmd> set_hash_input_set 0 ipv4-udp src-ipv4 add
3670 The Flow Director filters can match the different fields for different type of packet, i.e. specific input set
3671 on per flow type and the flexible payload. This command can be used to change input set for each flow type.
3673 Set the input set for flow director::
3675 set_fdir_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3676 ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \
3677 l2_payload|<flow_id>) (ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6| \
3678 ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|ipv6-hop-limits| \
3679 tudp-src-port|udp-dst-port|cp-src-port|tcp-dst-port|sctp-src-port| \
3680 sctp-dst-port|sctp-veri-tag|none) (select|add)
3682 For example to add source IP to FD input set for flow type of ipv4-udp on port 0::
3684 testpmd> set_fdir_input_set 0 ipv4-udp src-ipv4 add
3689 Set different GRE key length for input set::
3691 global_config (port_id) gre-key-len (number in bytes)
3693 For example to set GRE key length for input set to 4 bytes on port 0::
3695 testpmd> global_config 0 gre-key-len 4
3698 .. _testpmd_rte_flow:
3700 Flow rules management
3701 ---------------------
3703 Control of the generic flow API (*rte_flow*) is fully exposed through the
3704 ``flow`` command (validation, creation, destruction, queries and operation
3707 Considering *rte_flow* overlaps with all `Filter Functions`_, using both
3708 features simultaneously may cause undefined side-effects and is therefore
3714 Because the ``flow`` command uses dynamic tokens to handle the large number
3715 of possible flow rules combinations, its behavior differs slightly from
3716 other commands, in particular:
3718 - Pressing *?* or the *<tab>* key displays contextual help for the current
3719 token, not that of the entire command.
3721 - Optional and repeated parameters are supported (provided they are listed
3722 in the contextual help).
3724 The first parameter stands for the operation mode. Possible operations and
3725 their general syntax are described below. They are covered in detail in the
3728 - Check whether a flow rule can be created::
3730 flow validate {port_id}
3731 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3732 pattern {item} [/ {item} [...]] / end
3733 actions {action} [/ {action} [...]] / end
3735 - Create a flow rule::
3737 flow create {port_id}
3738 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3739 pattern {item} [/ {item} [...]] / end
3740 actions {action} [/ {action} [...]] / end
3742 - Destroy specific flow rules::
3744 flow destroy {port_id} rule {rule_id} [...]
3746 - Destroy all flow rules::
3748 flow flush {port_id}
3750 - Query an existing flow rule::
3752 flow query {port_id} {rule_id} {action}
3754 - List existing flow rules sorted by priority, filtered by group
3757 flow list {port_id} [group {group_id}] [...]
3759 - Restrict ingress traffic to the defined flow rules::
3761 flow isolate {port_id} {boolean}
3763 - Dump internal representation information of all flows in hardware::
3765 flow dump {port_id} {output_file}
3767 - List and destroy aged flow rules::
3769 flow aged {port_id} [destroy]
3771 - Tunnel offload - create a tunnel stub::
3773 flow tunnel create {port_id} type {tunnel_type}
3775 - Tunnel offload - destroy a tunnel stub::
3777 flow tunnel destroy {port_id} id {tunnel_id}
3779 - Tunnel offload - list port tunnel stubs::
3781 flow tunnel list {port_id}
3783 Creating a tunnel stub for offload
3784 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3786 ``flow tunnel create`` setup a tunnel stub for tunnel offload flow rules::
3788 flow tunnel create {port_id} type {tunnel_type}
3790 If successful, it will return a tunnel stub ID usable with other commands::
3792 port [...]: flow tunnel #[...] type [...]
3794 Tunnel stub ID is relative to a port.
3796 Destroying tunnel offload stub
3797 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3799 ``flow tunnel destroy`` destroy port tunnel stub::
3801 flow tunnel destroy {port_id} id {tunnel_id}
3803 Listing tunnel offload stubs
3804 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3806 ``flow tunnel list`` list port tunnel offload stubs::
3808 flow tunnel list {port_id}
3810 Validating flow rules
3811 ~~~~~~~~~~~~~~~~~~~~~
3813 ``flow validate`` reports whether a flow rule would be accepted by the
3814 underlying device in its current state but stops short of creating it. It is
3815 bound to ``rte_flow_validate()``::
3817 flow validate {port_id}
3818 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3819 pattern {item} [/ {item} [...]] / end
3820 actions {action} [/ {action} [...]] / end
3822 If successful, it will show::
3826 Otherwise it will show an error message of the form::
3828 Caught error type [...] ([...]): [...]
3830 This command uses the same parameters as ``flow create``, their format is
3831 described in `Creating flow rules`_.
3833 Check whether redirecting any Ethernet packet received on port 0 to RX queue
3834 index 6 is supported::
3836 testpmd> flow validate 0 ingress pattern eth / end
3837 actions queue index 6 / end
3841 Port 0 does not support TCPv6 rules::
3843 testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end
3845 Caught error type 9 (specific pattern item): Invalid argument
3851 ``flow create`` validates and creates the specified flow rule. It is bound
3852 to ``rte_flow_create()``::
3854 flow create {port_id}
3855 [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3856 [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}]
3857 pattern {item} [/ {item} [...]] / end
3858 actions {action} [/ {action} [...]] / end
3860 If successful, it will return a flow rule ID usable with other commands::
3862 Flow rule #[...] created
3864 Otherwise it will show an error message of the form::
3866 Caught error type [...] ([...]): [...]
3868 Parameters describe in the following order:
3870 - Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens).
3871 - Tunnel offload specification (tunnel_set, tunnel_match)
3872 - A matching pattern, starting with the *pattern* token and terminated by an
3874 - Actions, starting with the *actions* token and terminated by an *end*
3877 These translate directly to *rte_flow* objects provided as-is to the
3878 underlying functions.
3880 The shortest valid definition only comprises mandatory tokens::
3882 testpmd> flow create 0 pattern end actions end
3884 Note that PMDs may refuse rules that essentially do nothing such as this
3887 **All unspecified object values are automatically initialized to 0.**
3892 These tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3893 specified before the ``pattern`` token.
3895 - ``group {group id}``: priority group.
3896 - ``priority {level}``: priority level within group.
3897 - ``ingress``: rule applies to ingress traffic.
3898 - ``egress``: rule applies to egress traffic.
3899 - ``transfer``: apply rule directly to endpoints found in pattern.
3901 Each instance of an attribute specified several times overrides the previous
3902 value as shown below (group 4 is used)::
3904 testpmd> flow create 0 group 42 group 24 group 4 [...]
3906 Note that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3908 While not specifying a direction is an error, some rules may allow both
3911 Most rules affect RX therefore contain the ``ingress`` token::
3913 testpmd> flow create 0 ingress pattern [...]
3918 Indicate tunnel offload rule type
3920 - ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type.
3921 - ``tunnel_match {tunnel_id}``: mark rule as tunel offload match type.
3926 A matching pattern starts after the ``pattern`` token. It is made of pattern
3927 items and is terminated by a mandatory ``end`` item.
3929 Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3930 rte_flow_item_type``).
3932 The ``/`` token is used as a separator between pattern items as shown
3935 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3937 Note that protocol items like these must be stacked from lowest to highest
3938 layer to make sense. For instance, the following rule is either invalid or
3939 unlikely to match any packet::
3941 testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3943 More information on these restrictions can be found in the *rte_flow*
3946 Several items support additional specification structures, for example
3947 ``ipv4`` allows specifying source and destination addresses as follows::
3949 testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1
3950 dst is 10.2.0.0 / end [...]
3952 This rule matches all IPv4 traffic with the specified properties.
3954 In this example, ``src`` and ``dst`` are field names of the underlying
3955 ``struct rte_flow_item_ipv4`` object. All item properties can be specified
3956 in a similar fashion.
3958 The ``is`` token means that the subsequent value must be matched exactly,
3959 and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3960 accordingly. Possible assignment tokens are:
3962 - ``is``: match value perfectly (with full bit-mask).
3963 - ``spec``: match value according to configured bit-mask.
3964 - ``last``: specify upper bound to establish a range.
3965 - ``mask``: specify bit-mask with relevant bits set to one.
3966 - ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one.
3968 These yield identical results::
3970 ipv4 src is 10.1.1.1
3974 ipv4 src spec 10.1.1.1 src mask 255.255.255.255
3978 ipv4 src spec 10.1.1.1 src prefix 32
3982 ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value
3986 ipv4 src is 10.1.1.1 src last 0 # 0 disables range
3988 Inclusive ranges can be defined with ``last``::
3990 ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4
3992 Note that ``mask`` affects both ``spec`` and ``last``::
3994 ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0
3995 # matches 10.1.0.0 to 10.2.255.255
3997 Properties can be modified multiple times::
3999 ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4
4003 ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16
4008 This section lists supported pattern items and their attributes, if any.
4010 - ``end``: end list of pattern items.
4012 - ``void``: no-op pattern item.
4014 - ``invert``: perform actions when pattern does not match.
4016 - ``any``: match any protocol for the current layer.
4018 - ``num {unsigned}``: number of layers covered.
4020 - ``pf``: match traffic from/to the physical function.
4022 - ``vf``: match traffic from/to a virtual function ID.
4024 - ``id {unsigned}``: VF ID.
4026 - ``phy_port``: match traffic from/to a specific physical port.
4028 - ``index {unsigned}``: physical port index.
4030 - ``port_id``: match traffic from/to a given DPDK port ID.
4032 - ``id {unsigned}``: DPDK port ID.
4034 - ``mark``: match value set in previously matched flow rule using the mark action.
4036 - ``id {unsigned}``: arbitrary integer value.
4038 - ``raw``: match an arbitrary byte string.
4040 - ``relative {boolean}``: look for pattern after the previous item.
4041 - ``search {boolean}``: search pattern from offset (see also limit).
4042 - ``offset {integer}``: absolute or relative offset for pattern.
4043 - ``limit {unsigned}``: search area limit for start of pattern.
4044 - ``pattern {string}``: byte string to look for.
4046 - ``eth``: match Ethernet header.
4048 - ``dst {MAC-48}``: destination MAC.
4049 - ``src {MAC-48}``: source MAC.
4050 - ``type {unsigned}``: EtherType or TPID.
4052 - ``vlan``: match 802.1Q/ad VLAN tag.
4054 - ``tci {unsigned}``: tag control information.
4055 - ``pcp {unsigned}``: priority code point.
4056 - ``dei {unsigned}``: drop eligible indicator.
4057 - ``vid {unsigned}``: VLAN identifier.
4058 - ``inner_type {unsigned}``: inner EtherType or TPID.
4060 - ``ipv4``: match IPv4 header.
4062 - ``tos {unsigned}``: type of service.
4063 - ``ttl {unsigned}``: time to live.
4064 - ``proto {unsigned}``: next protocol ID.
4065 - ``src {ipv4 address}``: source address.
4066 - ``dst {ipv4 address}``: destination address.
4068 - ``ipv6``: match IPv6 header.
4070 - ``tc {unsigned}``: traffic class.
4071 - ``flow {unsigned}``: flow label.
4072 - ``proto {unsigned}``: protocol (next header).
4073 - ``hop {unsigned}``: hop limit.
4074 - ``src {ipv6 address}``: source address.
4075 - ``dst {ipv6 address}``: destination address.
4077 - ``icmp``: match ICMP header.
4079 - ``type {unsigned}``: ICMP packet type.
4080 - ``code {unsigned}``: ICMP packet code.
4082 - ``udp``: match UDP header.
4084 - ``src {unsigned}``: UDP source port.
4085 - ``dst {unsigned}``: UDP destination port.
4087 - ``tcp``: match TCP header.
4089 - ``src {unsigned}``: TCP source port.
4090 - ``dst {unsigned}``: TCP destination port.
4092 - ``sctp``: match SCTP header.
4094 - ``src {unsigned}``: SCTP source port.
4095 - ``dst {unsigned}``: SCTP destination port.
4096 - ``tag {unsigned}``: validation tag.
4097 - ``cksum {unsigned}``: checksum.
4099 - ``vxlan``: match VXLAN header.
4101 - ``vni {unsigned}``: VXLAN identifier.
4103 - ``e_tag``: match IEEE 802.1BR E-Tag header.
4105 - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
4107 - ``nvgre``: match NVGRE header.
4109 - ``tni {unsigned}``: virtual subnet ID.
4111 - ``mpls``: match MPLS header.
4113 - ``label {unsigned}``: MPLS label.
4115 - ``gre``: match GRE header.
4117 - ``protocol {unsigned}``: protocol type.
4119 - ``gre_key``: match GRE optional key field.
4121 - ``value {unsigned}``: key value.
4123 - ``fuzzy``: fuzzy pattern match, expect faster than default.
4125 - ``thresh {unsigned}``: accuracy threshold.
4127 - ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header.
4129 - ``teid {unsigned}``: tunnel endpoint identifier.
4131 - ``geneve``: match GENEVE header.
4133 - ``vni {unsigned}``: virtual network identifier.
4134 - ``protocol {unsigned}``: protocol type.
4136 - ``vxlan-gpe``: match VXLAN-GPE header.
4138 - ``vni {unsigned}``: VXLAN-GPE identifier.
4140 - ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4.
4142 - ``sha {MAC-48}``: sender hardware address.
4143 - ``spa {ipv4 address}``: sender IPv4 address.
4144 - ``tha {MAC-48}``: target hardware address.
4145 - ``tpa {ipv4 address}``: target IPv4 address.
4147 - ``ipv6_ext``: match presence of any IPv6 extension header.
4149 - ``next_hdr {unsigned}``: next header.
4151 - ``icmp6``: match any ICMPv6 header.
4153 - ``type {unsigned}``: ICMPv6 type.
4154 - ``code {unsigned}``: ICMPv6 code.
4156 - ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
4158 - ``target_addr {ipv6 address}``: target address.
4160 - ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement.
4162 - ``target_addr {ipv6 address}``: target address.
4164 - ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option.
4166 - ``type {unsigned}``: ND option type.
4168 - ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet
4169 link-layer address option.
4171 - ``sla {MAC-48}``: source Ethernet LLA.
4173 - ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet
4174 link-layer address option.
4176 - ``tla {MAC-48}``: target Ethernet LLA.
4178 - ``meta``: match application specific metadata.
4180 - ``data {unsigned}``: metadata value.
4182 - ``gtp_psc``: match GTP PDU extension header with type 0x85.
4184 - ``pdu_type {unsigned}``: PDU type.
4185 - ``qfi {unsigned}``: QoS flow identifier.
4187 - ``pppoes``, ``pppoed``: match PPPoE header.
4189 - ``session_id {unsigned}``: session identifier.
4191 - ``pppoe_proto_id``: match PPPoE session protocol identifier.
4193 - ``proto_id {unsigned}``: PPP protocol identifier.
4195 - ``l2tpv3oip``: match L2TPv3 over IP header.
4197 - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
4199 - ``ah``: match AH header.
4201 - ``spi {unsigned}``: security parameters index.
4203 - ``pfcp``: match PFCP header.
4205 - ``s_field {unsigned}``: S field.
4206 - ``seid {unsigned}``: session endpoint identifier.
4211 A list of actions starts after the ``actions`` token in the same fashion as
4212 `Matching pattern`_; actions are separated by ``/`` tokens and the list is
4213 terminated by a mandatory ``end`` action.
4215 Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
4216 rte_flow_action_type``).
4218 Dropping all incoming UDPv4 packets can be expressed as follows::
4220 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
4223 Several actions have configurable properties which must be specified when
4224 there is no valid default value. For example, ``queue`` requires a target
4227 This rule redirects incoming UDPv4 traffic to queue index 6::
4229 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
4230 actions queue index 6 / end
4232 While this one could be rejected by PMDs (unspecified queue index)::
4234 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
4237 As defined by *rte_flow*, the list is not ordered, all actions of a given
4238 rule are performed simultaneously. These are equivalent::
4240 queue index 6 / void / mark id 42 / end
4244 void / mark id 42 / queue index 6 / end
4246 All actions in a list should have different types, otherwise only the last
4247 action of a given type is taken into account::
4249 queue index 4 / queue index 5 / queue index 6 / end # will use queue 6
4253 drop / drop / drop / end # drop is performed only once
4257 mark id 42 / queue index 3 / mark id 24 / end # mark will be 24
4259 Considering they are performed simultaneously, opposite and overlapping
4260 actions can sometimes be combined when the end result is unambiguous::
4262 drop / queue index 6 / end # drop has no effect
4266 queue index 6 / rss queues 6 7 8 / end # queue has no effect
4270 drop / passthru / end # drop has no effect
4272 Note that PMDs may still refuse such combinations.
4277 This section lists supported actions and their attributes, if any.
4279 - ``end``: end list of actions.
4281 - ``void``: no-op action.
4283 - ``passthru``: let subsequent rule process matched packets.
4285 - ``jump``: redirect traffic to group on device.
4287 - ``group {unsigned}``: group to redirect to.
4289 - ``mark``: attach 32 bit value to packets.
4291 - ``id {unsigned}``: 32 bit value to return with packets.
4293 - ``flag``: flag packets.
4295 - ``queue``: assign packets to a given queue index.
4297 - ``index {unsigned}``: queue index to use.
4299 - ``drop``: drop packets (note: passthru has priority).
4301 - ``count``: enable counters for this rule.
4303 - ``rss``: spread packets among several queues.
4305 - ``func {hash function}``: RSS hash function to apply, allowed tokens are
4306 the same as `set_hash_global_config`_.
4308 - ``level {unsigned}``: encapsulation level for ``types``.
4310 - ``types [{RSS hash type} [...]] end``: specific RSS hash types, allowed
4311 tokens are the same as `set_hash_input_set`_, except that an empty list
4312 does not disable RSS but instead requests unspecified "best-effort"
4315 - ``key {string}``: RSS hash key, overrides ``key_len``.
4317 - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in
4318 conjunction with ``key`` to pad or truncate it.
4320 - ``queues [{unsigned} [...]] end``: queue indices to use.
4322 - ``pf``: direct traffic to physical function.
4324 - ``vf``: direct traffic to a virtual function ID.
4326 - ``original {boolean}``: use original VF ID if possible.
4327 - ``id {unsigned}``: VF ID.
4329 - ``phy_port``: direct packets to physical port index.
4331 - ``original {boolean}``: use original port index if possible.
4332 - ``index {unsigned}``: physical port index.
4334 - ``port_id``: direct matching traffic to a given DPDK port ID.
4336 - ``original {boolean}``: use original DPDK port ID if possible.
4337 - ``id {unsigned}``: DPDK port ID.
4339 - ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``.
4341 - ``mpls_ttl``: MPLS TTL.
4343 - ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``.
4345 - ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``.
4347 - ``nw_ttl``: IP TTL.
4349 - ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``.
4351 - ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``.
4353 - ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``.
4355 - ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``.
4357 - ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``.
4359 - ``ethertype``: Ethertype.
4361 - ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``.
4363 - ``vlan_vid``: VLAN id.
4365 - ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``.
4367 - ``vlan_pcp``: VLAN priority.
4369 - ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``.
4371 - ``ethertype``: Ethertype.
4373 - ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``.
4375 - ``ethertype``: Ethertype.
4377 - ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration
4378 is done through `Config VXLAN Encap outer layers`_.
4380 - ``vxlan_decap``: Performs a decapsulation action by stripping all headers of
4381 the VXLAN tunnel network overlay from the matched flow.
4383 - ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration
4384 is done through `Config NVGRE Encap outer layers`_.
4386 - ``nvgre_decap``: Performs a decapsulation action by stripping all headers of
4387 the NVGRE tunnel network overlay from the matched flow.
4389 - ``l2_encap``: Performs a L2 encapsulation, L2 configuration
4390 is done through `Config L2 Encap`_.
4392 - ``l2_decap``: Performs a L2 decapsulation, L2 configuration
4393 is done through `Config L2 Decap`_.
4395 - ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer
4396 configuration is done through `Config MPLSoGRE Encap outer layers`_.
4398 - ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer
4399 configuration is done through `Config MPLSoGRE Decap outer layers`_.
4401 - ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer
4402 configuration is done through `Config MPLSoUDP Encap outer layers`_.
4404 - ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer
4405 configuration is done through `Config MPLSoUDP Decap outer layers`_.
4407 - ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header.
4409 - ``ipv4_addr``: New IPv4 source address.
4411 - ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4
4414 - ``ipv4_addr``: New IPv4 destination address.
4416 - ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header.
4418 - ``ipv6_addr``: New IPv6 source address.
4420 - ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6
4423 - ``ipv6_addr``: New IPv6 destination address.
4425 - ``set_tp_src``: Set a new source port number in the outermost TCP/UDP
4428 - ``port``: New TCP/UDP source port number.
4430 - ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP
4433 - ``port``: New TCP/UDP destination port number.
4435 - ``mac_swap``: Swap the source and destination MAC addresses in the outermost
4438 - ``dec_ttl``: Performs a decrease TTL value action
4440 - ``set_ttl``: Set TTL value with specified value
4441 - ``ttl_value {unsigned}``: The new TTL value to be set
4443 - ``set_mac_src``: set source MAC address
4445 - ``mac_addr {MAC-48}``: new source MAC address
4447 - ``set_mac_dst``: set destination MAC address
4449 - ``mac_addr {MAC-48}``: new destination MAC address
4451 - ``inc_tcp_seq``: Increase sequence number in the outermost TCP header.
4453 - ``value {unsigned}``: Value to increase TCP sequence number by.
4455 - ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header.
4457 - ``value {unsigned}``: Value to decrease TCP sequence number by.
4459 - ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header.
4461 - ``value {unsigned}``: Value to increase TCP acknowledgment number by.
4463 - ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header.
4465 - ``value {unsigned}``: Value to decrease TCP acknowledgment number by.
4467 - ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value
4469 - ``dscp_value {unsigned}``: The new DSCP value to be set
4471 - ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value
4473 - ``dscp_value {unsigned}``: The new DSCP value to be set
4475 - ``shared``: Use shared action created via
4476 ``flow shared_action {port_id} create``
4478 - ``shared_action_id {unsigned}``: Shared action ID to use
4480 Destroying flow rules
4481 ~~~~~~~~~~~~~~~~~~~~~
4483 ``flow destroy`` destroys one or more rules from their rule ID (as returned
4484 by ``flow create``), this command calls ``rte_flow_destroy()`` as many
4485 times as necessary::
4487 flow destroy {port_id} rule {rule_id} [...]
4489 If successful, it will show::
4491 Flow rule #[...] destroyed
4493 It does not report anything for rule IDs that do not exist. The usual error
4494 message is shown when a rule cannot be destroyed::
4496 Caught error type [...] ([...]): [...]
4498 ``flow flush`` destroys all rules on a device and does not take extra
4499 arguments. It is bound to ``rte_flow_flush()``::
4501 flow flush {port_id}
4503 Any errors are reported as above.
4505 Creating several rules and destroying them::
4507 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4508 actions queue index 2 / end
4509 Flow rule #0 created
4510 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4511 actions queue index 3 / end
4512 Flow rule #1 created
4513 testpmd> flow destroy 0 rule 0 rule 1
4514 Flow rule #1 destroyed
4515 Flow rule #0 destroyed
4518 The same result can be achieved using ``flow flush``::
4520 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4521 actions queue index 2 / end
4522 Flow rule #0 created
4523 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4524 actions queue index 3 / end
4525 Flow rule #1 created
4526 testpmd> flow flush 0
4529 Non-existent rule IDs are ignored::
4531 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4532 actions queue index 2 / end
4533 Flow rule #0 created
4534 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4535 actions queue index 3 / end
4536 Flow rule #1 created
4537 testpmd> flow destroy 0 rule 42 rule 10 rule 2
4539 testpmd> flow destroy 0 rule 0
4540 Flow rule #0 destroyed
4546 ``flow query`` queries a specific action of a flow rule having that
4547 ability. Such actions collect information that can be reported using this
4548 command. It is bound to ``rte_flow_query()``::
4550 flow query {port_id} {rule_id} {action}
4552 If successful, it will display either the retrieved data for known actions
4553 or the following message::
4555 Cannot display result for action type [...] ([...])
4557 Otherwise, it will complain either that the rule does not exist or that some
4560 Flow rule #[...] not found
4564 Caught error type [...] ([...]): [...]
4566 Currently only the ``count`` action is supported. This action reports the
4567 number of packets that hit the flow rule and the total number of bytes. Its
4568 output has the following format::
4571 hits_set: [...] # whether "hits" contains a valid value
4572 bytes_set: [...] # whether "bytes" contains a valid value
4573 hits: [...] # number of packets
4574 bytes: [...] # number of bytes
4576 Querying counters for TCPv6 packets redirected to queue 6::
4578 testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end
4579 actions queue index 6 / count / end
4580 Flow rule #4 created
4581 testpmd> flow query 0 4 count
4592 ``flow list`` lists existing flow rules sorted by priority and optionally
4593 filtered by group identifiers::
4595 flow list {port_id} [group {group_id}] [...]
4597 This command only fails with the following message if the device does not
4602 Output consists of a header line followed by a short description of each
4603 flow rule, one per line. There is no output at all when no flow rules are
4604 configured on the device::
4606 ID Group Prio Attr Rule
4607 [...] [...] [...] [...] [...]
4609 ``Attr`` column flags:
4611 - ``i`` for ``ingress``.
4612 - ``e`` for ``egress``.
4614 Creating several flow rules and listing them::
4616 testpmd> flow create 0 ingress pattern eth / ipv4 / end
4617 actions queue index 6 / end
4618 Flow rule #0 created
4619 testpmd> flow create 0 ingress pattern eth / ipv6 / end
4620 actions queue index 2 / end
4621 Flow rule #1 created
4622 testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end
4623 actions rss queues 6 7 8 end / end
4624 Flow rule #2 created
4625 testpmd> flow list 0
4626 ID Group Prio Attr Rule
4627 0 0 0 i- ETH IPV4 => QUEUE
4628 1 0 0 i- ETH IPV6 => QUEUE
4629 2 0 5 i- ETH IPV4 UDP => RSS
4632 Rules are sorted by priority (i.e. group ID first, then priority level)::
4634 testpmd> flow list 1
4635 ID Group Prio Attr Rule
4636 0 0 0 i- ETH => COUNT
4637 6 0 500 i- ETH IPV6 TCP => DROP COUNT
4638 5 0 1000 i- ETH IPV6 ICMP => QUEUE
4639 1 24 0 i- ETH IPV4 UDP => QUEUE
4640 4 24 10 i- ETH IPV4 TCP => DROP
4641 3 24 20 i- ETH IPV4 => DROP
4642 2 24 42 i- ETH IPV4 UDP => QUEUE
4643 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE
4646 Output can be limited to specific groups::
4648 testpmd> flow list 1 group 0 group 63
4649 ID Group Prio Attr Rule
4650 0 0 0 i- ETH => COUNT
4651 6 0 500 i- ETH IPV6 TCP => DROP COUNT
4652 5 0 1000 i- ETH IPV6 ICMP => QUEUE
4653 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE
4656 Toggling isolated mode
4657 ~~~~~~~~~~~~~~~~~~~~~~
4659 ``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4660 must only be injected from the defined flow rules; that no default traffic
4661 is expected outside those rules and the driver is free to assign more
4662 resources to handle them. It is bound to ``rte_flow_isolate()``::
4664 flow isolate {port_id} {boolean}
4666 If successful, enabling or disabling isolated mode shows either::
4668 Ingress traffic on port [...]
4669 is now restricted to the defined flow rules
4673 Ingress traffic on port [...]
4674 is not restricted anymore to the defined flow rules
4676 Otherwise, in case of error::
4678 Caught error type [...] ([...]): [...]
4680 Mainly due to its side effects, PMDs supporting this mode may not have the
4681 ability to toggle it more than once without reinitializing affected ports
4682 first (e.g. by exiting testpmd).
4684 Enabling isolated mode::
4686 testpmd> flow isolate 0 true
4687 Ingress traffic on port 0 is now restricted to the defined flow rules
4690 Disabling isolated mode::
4692 testpmd> flow isolate 0 false
4693 Ingress traffic on port 0 is not restricted anymore to the defined flow rules
4696 Dumping HW internal information
4697 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4699 ``flow dump`` dumps the hardware's internal representation information of
4700 all flows. It is bound to ``rte_flow_dev_dump()``::
4702 flow dump {port_id} {output_file}
4704 If successful, it will show::
4708 Otherwise, it will complain error occurred::
4710 Caught error type [...] ([...]): [...]
4712 Listing and destroying aged flow rules
4713 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4715 ``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``,
4716 and ``destroy`` parameter can be used to destroy those flow rules in PMD.
4718 flow aged {port_id} [destroy]
4720 Listing current aged flow rules::
4722 testpmd> flow aged 0
4723 Port 0 total aged flows: 0
4724 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.14 / end
4725 actions age timeout 5 / queue index 0 / end
4726 Flow rule #0 created
4727 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.15 / end
4728 actions age timeout 4 / queue index 0 / end
4729 Flow rule #1 created
4730 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.16 / end
4731 actions age timeout 2 / queue index 0 / end
4732 Flow rule #2 created
4733 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.17 / end
4734 actions age timeout 3 / queue index 0 / end
4735 Flow rule #3 created
4738 Aged Rules are simply list as command ``flow list {port_id}``, but strip the detail rule
4739 information, all the aged flows are sorted by the longest timeout time. For example, if
4740 those rules be configured in the same time, ID 2 will be the first aged out rule, the next
4741 will be ID 3, ID 1, ID 0::
4743 testpmd> flow aged 0
4744 Port 0 total aged flows: 4
4751 If attach ``destroy`` parameter, the command will destroy all the list aged flow rules.
4753 testpmd> flow aged 0 destroy
4754 Port 0 total aged flows: 4
4761 Flow rule #2 destroyed
4762 Flow rule #3 destroyed
4763 Flow rule #1 destroyed
4764 Flow rule #0 destroyed
4765 4 flows be destroyed
4766 testpmd> flow aged 0
4767 Port 0 total aged flows: 0
4769 Creating shared actions
4770 ~~~~~~~~~~~~~~~~~~~~~~~
4771 ``flow shared_action {port_id} create`` creates shared action with optional
4772 shared action ID. It is bound to ``rte_flow_shared_action_create()``::
4774 flow shared_action {port_id} create [action_id {shared_action_id}]
4775 [ingress] [egress] action {action} / end
4777 If successful, it will show::
4779 Shared action #[...] created
4781 Otherwise, it will complain either that shared action already exists or that
4782 some error occurred::
4784 Shared action #[...] is already assigned, delete it first
4788 Caught error type [...] ([...]): [...]
4790 Create shared rss action with id 100 to queues 1 and 2 on port 0::
4792 testpmd> flow shared_action 0 create action_id 100 \
4793 ingress action rss queues 1 2 end / end
4795 Create shared rss action with id assigned by testpmd to queues 1 and 2 on
4798 testpmd> flow shared_action 0 create action_id \
4799 ingress action rss queues 0 1 end / end
4801 Updating shared actions
4802 ~~~~~~~~~~~~~~~~~~~~~~~
4803 ``flow shared_action {port_id} update`` updates configuration of the shared
4804 action from its shared action ID (as returned by
4805 ``flow shared_action {port_id} create``). It is bound to
4806 ``rte_flow_shared_action_update()``::
4808 flow shared_action {port_id} update {shared_action_id}
4809 action {action} / end
4811 If successful, it will show::
4813 Shared action #[...] updated
4815 Otherwise, it will complain either that shared action not found or that some
4818 Failed to find shared action #[...] on port [...]
4822 Caught error type [...] ([...]): [...]
4824 Update shared rss action having id 100 on port 0 with rss to queues 0 and 3
4825 (in create example above rss queues were 1 and 2)::
4827 testpmd> flow shared_action 0 update 100 action rss queues 0 3 end / end
4829 Destroying shared actions
4830 ~~~~~~~~~~~~~~~~~~~~~~~~~
4831 ``flow shared_action {port_id} update`` destroys one or more shared actions
4832 from their shared action IDs (as returned by
4833 ``flow shared_action {port_id} create``). It is bound to
4834 ``rte_flow_shared_action_destroy()``::
4836 flow shared_action {port_id} destroy action_id {shared_action_id} [...]
4838 If successful, it will show::
4840 Shared action #[...] destroyed
4842 It does not report anything for shared action IDs that do not exist.
4843 The usual error message is shown when a shared action cannot be destroyed::
4845 Caught error type [...] ([...]): [...]
4847 Destroy shared actions having id 100 & 101::
4849 testpmd> flow shared_action 0 destroy action_id 100 action_id 101
4851 Query shared actions
4852 ~~~~~~~~~~~~~~~~~~~~
4853 ``flow shared_action {port_id} query`` queries the shared action from its
4854 shared action ID (as returned by ``flow shared_action {port_id} create``).
4855 It is bound to ``rte_flow_shared_action_query()``::
4857 flow shared_action {port_id} query {shared_action_id}
4859 Currently only rss shared action supported. If successful, it will show::
4864 Otherwise, it will complain either that shared action not found or that some
4867 Failed to find shared action #[...] on port [...]
4871 Caught error type [...] ([...]): [...]
4873 Query shared action having id 100::
4875 testpmd> flow shared_action 0 query 100
4877 Sample QinQ flow rules
4878 ~~~~~~~~~~~~~~~~~~~~~~
4880 Before creating QinQ rule(s) the following commands should be issued to enable QinQ::
4882 testpmd> port stop 0
4883 testpmd> vlan set qinq_strip on 0
4885 The above command sets the inner and outer TPID's to 0x8100.
4887 To change the TPID's the following commands should be used::
4889 testpmd> vlan set outer tpid 0xa100 0
4890 testpmd> vlan set inner tpid 0x9100 0
4891 testpmd> port start 0
4893 Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
4897 testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 /
4898 vlan tci is 456 / end actions vf id 1 / queue index 0 / end
4899 Flow rule #0 validated
4901 testpmd> flow create 0 ingress pattern eth / vlan tci is 4 /
4902 vlan tci is 456 / end actions vf id 123 / queue index 0 / end
4903 Flow rule #0 created
4905 testpmd> flow list 0
4906 ID Group Prio Attr Rule
4907 0 0 0 i- ETH VLAN VLAN=>VF QUEUE
4909 Validate and create a QinQ rule on port 0 to steer traffic to a queue on the host.
4913 testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 /
4914 vlan tci is 654 / end actions pf / queue index 0 / end
4915 Flow rule #1 validated
4917 testpmd> flow create 0 ingress pattern eth / vlan tci is 321 /
4918 vlan tci is 654 / end actions pf / queue index 1 / end
4919 Flow rule #1 created
4921 testpmd> flow list 0
4922 ID Group Prio Attr Rule
4923 0 0 0 i- ETH VLAN VLAN=>VF QUEUE
4924 1 0 0 i- ETH VLAN VLAN=>PF QUEUE
4926 Sample VXLAN encapsulation rule
4927 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4929 VXLAN encapsulation outer layer has default value pre-configured in testpmd
4930 source code, those can be changed by using the following commands
4932 IPv4 VXLAN outer header::
4934 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
4935 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4936 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4939 testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src
4940 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4941 eth-dst 22:22:22:22:22:22
4942 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4945 testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-tos 0
4946 ip-ttl 255 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4947 eth-dst 22:22:22:22:22:22
4948 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4951 IPv6 VXLAN outer header::
4953 testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1
4954 ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4955 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4958 testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4959 ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11
4960 eth-dst 22:22:22:22:22:22
4961 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4964 testpmd> set vxlan-tos-ttl ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4965 ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4966 eth-dst 22:22:22:22:22:22
4967 testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4970 Sample NVGRE encapsulation rule
4971 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4973 NVGRE encapsulation outer layer has default value pre-configured in testpmd
4974 source code, those can be changed by using the following commands
4976 IPv4 NVGRE outer header::
4978 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
4979 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4980 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4983 testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1
4984 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4985 eth-dst 22:22:22:22:22:22
4986 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4989 IPv6 NVGRE outer header::
4991 testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4992 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4993 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4996 testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4997 vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4998 testpmd> flow create 0 ingress pattern end actions nvgre_encap /
5001 Sample L2 encapsulation rule
5002 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5004 L2 encapsulation has default value pre-configured in testpmd
5005 source code, those can be changed by using the following commands
5009 testpmd> set l2_encap ip-version ipv4
5010 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5011 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
5012 mplsoudp_decap / l2_encap / end
5014 L2 with VXLAN header::
5016 testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34
5017 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5018 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
5019 mplsoudp_decap / l2_encap / end
5021 Sample L2 decapsulation rule
5022 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5024 L2 decapsulation has default value pre-configured in testpmd
5025 source code, those can be changed by using the following commands
5029 testpmd> set l2_decap
5030 testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap /
5033 L2 with VXLAN header::
5035 testpmd> set l2_encap-with-vlan
5036 testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap /
5039 Sample MPLSoGRE encapsulation rule
5040 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5042 MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
5043 source code, those can be changed by using the following commands
5045 IPv4 MPLSoGRE outer header::
5047 testpmd> set mplsogre_encap ip-version ipv4 label 4
5048 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
5049 eth-dst 22:22:22:22:22:22
5050 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5051 mplsogre_encap / end
5053 IPv4 MPLSoGRE with VLAN outer header::
5055 testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4
5056 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
5057 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5058 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5059 mplsogre_encap / end
5061 IPv6 MPLSoGRE outer header::
5063 testpmd> set mplsogre_encap ip-version ipv6 mask 4
5064 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
5065 eth-dst 22:22:22:22:22:22
5066 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5067 mplsogre_encap / end
5069 IPv6 MPLSoGRE with VLAN outer header::
5071 testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4
5072 ip-src ::1 ip-dst ::2222 vlan-tci 34
5073 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5074 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5075 mplsogre_encap / end
5077 Sample MPLSoGRE decapsulation rule
5078 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5080 MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
5081 source code, those can be changed by using the following commands
5083 IPv4 MPLSoGRE outer header::
5085 testpmd> set mplsogre_decap ip-version ipv4
5086 testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions
5087 mplsogre_decap / l2_encap / end
5089 IPv4 MPLSoGRE with VLAN outer header::
5091 testpmd> set mplsogre_decap-with-vlan ip-version ipv4
5092 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end
5093 actions mplsogre_decap / l2_encap / end
5095 IPv6 MPLSoGRE outer header::
5097 testpmd> set mplsogre_decap ip-version ipv6
5098 testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end
5099 actions mplsogre_decap / l2_encap / end
5101 IPv6 MPLSoGRE with VLAN outer header::
5103 testpmd> set mplsogre_decap-with-vlan ip-version ipv6
5104 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end
5105 actions mplsogre_decap / l2_encap / end
5107 Sample MPLSoUDP encapsulation rule
5108 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5110 MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
5111 source code, those can be changed by using the following commands
5113 IPv4 MPLSoUDP outer header::
5115 testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10
5116 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
5117 eth-dst 22:22:22:22:22:22
5118 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5119 mplsoudp_encap / end
5121 IPv4 MPLSoUDP with VLAN outer header::
5123 testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5
5124 udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
5125 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5126 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5127 mplsoudp_encap / end
5129 IPv6 MPLSoUDP outer header::
5131 testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10
5132 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
5133 eth-dst 22:22:22:22:22:22
5134 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5135 mplsoudp_encap / end
5137 IPv6 MPLSoUDP with VLAN outer header::
5139 testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5
5140 udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34
5141 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
5142 testpmd> flow create 0 egress pattern eth / end actions l2_decap /
5143 mplsoudp_encap / end
5145 Sample MPLSoUDP decapsulation rule
5146 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5148 MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
5149 source code, those can be changed by using the following commands
5151 IPv4 MPLSoUDP outer header::
5153 testpmd> set mplsoudp_decap ip-version ipv4
5154 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
5155 mplsoudp_decap / l2_encap / end
5157 IPv4 MPLSoUDP with VLAN outer header::
5159 testpmd> set mplsoudp_decap-with-vlan ip-version ipv4
5160 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end
5161 actions mplsoudp_decap / l2_encap / end
5163 IPv6 MPLSoUDP outer header::
5165 testpmd> set mplsoudp_decap ip-version ipv6
5166 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end
5167 actions mplsoudp_decap / l2_encap / end
5169 IPv6 MPLSoUDP with VLAN outer header::
5171 testpmd> set mplsoudp_decap-with-vlan ip-version ipv6
5172 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end
5173 actions mplsoudp_decap / l2_encap / end
5175 Sample Raw encapsulation rule
5176 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5178 Raw encapsulation configuration can be set by the following commands
5180 Eecapsulating VxLAN::
5182 testpmd> set raw_encap 4 eth src is 10:11:22:33:44:55 / vlan tci is 1
5183 inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni
5185 testpmd> flow create 0 egress pattern eth / ipv4 / end actions
5186 raw_encap index 4 / end
5188 Sample Raw decapsulation rule
5189 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5191 Raw decapsulation configuration can be set by the following commands
5193 Decapsulating VxLAN::
5195 testpmd> set raw_decap eth / ipv4 / udp / vxlan / end_set
5196 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 /
5197 end actions raw_decap / queue index 0 / end
5202 ESP rules can be created by the following commands::
5204 testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions
5206 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end
5207 actions queue index 3 / end
5208 testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions
5210 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
5211 actions queue index 3 / end
5216 AH rules can be created by the following commands::
5218 testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions
5220 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end
5221 actions queue index 3 / end
5222 testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions
5224 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end
5225 actions queue index 3 / end
5230 PFCP rules can be created by the following commands(s_field need to be 1
5233 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
5234 actions queue index 3 / end
5235 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
5236 seid is 1 / end actions queue index 3 / end
5237 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
5238 actions queue index 3 / end
5239 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
5240 seid is 1 / end actions queue index 3 / end
5245 The following sections show functions to load/unload eBPF based filters.
5250 Load an eBPF program as a callback for particular RX/TX queue::
5252 testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename)
5254 The available load-flags are:
5256 * ``J``: use JIT generated native code, otherwise BPF interpreter will be used.
5258 * ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data.
5264 You'll need clang v3.7 or above to build bpf program you'd like to load
5268 .. code-block:: console
5271 clang -O2 -target bpf -c t1.c
5273 Then to load (and JIT compile) t1.o at RX queue 0, port 1:
5275 .. code-block:: console
5277 testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
5279 To load (not JITed) t1.o at TX queue 0, port 0:
5281 .. code-block:: console
5283 testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
5288 Unload previously loaded eBPF program for particular RX/TX queue::
5290 testpmd> bpf-unload rx|tx (portid) (queueid)
5292 For example to unload BPF filter from TX queue 0, port 0:
5294 .. code-block:: console
5296 testpmd> bpf-unload tx 0 0