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