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