1.. SPDX-License-Identifier: BSD-3-Clause 2 Copyright(c) 2010-2016 Intel Corporation. 3 4.. _testpmd_runtime: 5 6Testpmd Runtime Functions 7========================= 8 9Where the testpmd application is started in interactive mode, (``-i|--interactive``), 10it displays a prompt that can be used to start and stop forwarding, 11configure the application, display statistics (including the extended NIC 12statistics aka xstats) , set the Flow Director and other tasks:: 13 14 testpmd> 15 16The testpmd prompt has some, limited, readline support. 17Common bash command-line functions such as ``Ctrl+a`` and ``Ctrl+e`` to go to the start and end of the prompt line are supported 18as well as access to the command history via the up-arrow. 19 20There is also support for tab completion. 21If you type a partial command and hit ``<TAB>`` you get a list of the available completions: 22 23.. code-block:: console 24 25 testpmd> show port <TAB> 26 27 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap X 28 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all 29 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap X 30 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all 31 ... 32 33 34.. note:: 35 36 Some examples in this document are too long to fit on one line are shown wrapped at `"\\"` for display purposes:: 37 38 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \ 39 (pause_time) (send_xon) (port_id) 40 41In the real ``testpmd>`` prompt these commands should be on a single line. 42 43Help Functions 44-------------- 45 46The testpmd has on-line help for the functions that are available at runtime. 47These are divided into sections and can be accessed using help, help section or help all: 48 49.. code-block:: console 50 51 testpmd> help 52 Help is available for the following sections: 53 54 help control : Start and stop forwarding. 55 help display : Displaying port, stats and config information. 56 help config : Configuration information. 57 help ports : Configuring ports. 58 help filters : Filters configuration help. 59 help traffic_management : Traffic Management commands. 60 help devices : Device related commands. 61 help drivers : Driver specific commands. 62 help all : All of the above sections. 63 64Command File Functions 65---------------------- 66 67To facilitate loading large number of commands or to avoid cutting and pasting where not 68practical or possible testpmd supports alternative methods for executing commands. 69 70* If started with the ``--cmdline-file=FILENAME`` command line argument testpmd 71 will execute all CLI commands contained within the file immediately before 72 starting packet forwarding or entering interactive mode. 73 74.. code-block:: console 75 76 ./dpdk-testpmd -n4 -r2 ... -- -i --cmdline-file=/home/ubuntu/flow-create-commands.txt 77 Interactive-mode selected 78 CLI commands to be read from /home/ubuntu/flow-create-commands.txt 79 Configuring Port 0 (socket 0) 80 Port 0: 7C:FE:90:CB:74:CE 81 Configuring Port 1 (socket 0) 82 Port 1: 7C:FE:90:CB:74:CA 83 Checking link statuses... 84 Port 0 Link Up - speed 10000 Mbps - full-duplex 85 Port 1 Link Up - speed 10000 Mbps - full-duplex 86 Done 87 Flow rule #0 created 88 Flow rule #1 created 89 ... 90 ... 91 Flow rule #498 created 92 Flow rule #499 created 93 Read all CLI commands from /home/ubuntu/flow-create-commands.txt 94 testpmd> 95 96 97* At run-time additional commands can be loaded in bulk by invoking the ``load FILENAME`` 98 command. 99 100.. code-block:: console 101 102 testpmd> load /home/ubuntu/flow-create-commands.txt 103 Flow rule #0 created 104 Flow rule #1 created 105 ... 106 ... 107 Flow rule #498 created 108 Flow rule #499 created 109 Read all CLI commands from /home/ubuntu/flow-create-commands.txt 110 testpmd> 111 112 113In all cases output from any included command will be displayed as standard output. 114Execution will continue until the end of the file is reached regardless of 115whether any errors occur. The end user must examine the output to determine if 116any failures occurred. 117 118 119Control Functions 120----------------- 121 122start 123~~~~~ 124 125Start packet forwarding with current configuration:: 126 127 testpmd> start 128 129start tx_first 130~~~~~~~~~~~~~~ 131 132Start packet forwarding with current configuration after sending specified number of bursts of packets:: 133 134 testpmd> start tx_first (""|burst_num) 135 136The default burst number is 1 when ``burst_num`` not presented. 137 138stop 139~~~~ 140 141Stop packet forwarding, and display accumulated statistics:: 142 143 testpmd> stop 144 145quit 146~~~~ 147 148Quit to prompt:: 149 150 testpmd> quit 151 152 153Display Functions 154----------------- 155 156The functions in the following sections are used to display information about the 157testpmd configuration or the NIC status. 158 159show port 160~~~~~~~~~ 161 162Display information for a given port or all ports:: 163 164 testpmd> show port (info|summary|stats|xstats|fdir|dcb_tc|cap) (port_id|all) 165 166The available information categories are: 167 168* ``info``: General port information such as MAC address. 169 170* ``summary``: Brief port summary such as Device Name, Driver Name etc. 171 172* ``stats``: RX/TX statistics. 173 174* ``xstats``: RX/TX extended NIC statistics. 175 176* ``fdir``: Flow Director information and statistics. 177 178* ``dcb_tc``: DCB information such as TC mapping. 179 180For example: 181 182.. code-block:: console 183 184 testpmd> show port info 0 185 186 ********************* Infos for port 0 ********************* 187 188 MAC address: XX:XX:XX:XX:XX:XX 189 Connect to socket: 0 190 memory allocation on the socket: 0 191 Link status: up 192 Link speed: 40000 Mbps 193 Link duplex: full-duplex 194 Promiscuous mode: enabled 195 Allmulticast mode: disabled 196 Maximum number of MAC addresses: 64 197 Maximum number of MAC addresses of hash filtering: 0 198 VLAN offload: 199 strip on, filter on, extend off, qinq strip off 200 Redirection table size: 512 201 Supported flow types: 202 ipv4-frag 203 ipv4-tcp 204 ipv4-udp 205 ipv4-sctp 206 ipv4-other 207 ipv6-frag 208 ipv6-tcp 209 ipv6-udp 210 ipv6-sctp 211 ipv6-other 212 l2_payload 213 port 214 vxlan 215 geneve 216 nvgre 217 vxlan-gpe 218 219show port (module_eeprom|eeprom) 220~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 221 222Display the EEPROM information of a port:: 223 224 testpmd> show port (port_id) (module_eeprom|eeprom) 225 226show port rss reta 227~~~~~~~~~~~~~~~~~~ 228 229Display the rss redirection table entry indicated by masks on port X:: 230 231 testpmd> show port (port_id) rss reta (size) (mask0, mask1...) 232 233size is used to indicate the hardware supported reta size 234 235show port rss-hash 236~~~~~~~~~~~~~~~~~~ 237 238Display the RSS hash functions and RSS hash key of a port:: 239 240 testpmd> show port (port_id) rss-hash [key] 241 242clear port 243~~~~~~~~~~ 244 245Clear the port statistics and forward engine statistics for a given port or for all ports:: 246 247 testpmd> clear port (info|stats|xstats|fdir) (port_id|all) 248 249For example:: 250 251 testpmd> clear port stats all 252 253show (rxq|txq) 254~~~~~~~~~~~~~~ 255 256Display information for a given port's RX/TX queue:: 257 258 testpmd> show (rxq|txq) info (port_id) (queue_id) 259 260show desc status(rxq|txq) 261~~~~~~~~~~~~~~~~~~~~~~~~~ 262 263Display information for a given port's RX/TX descriptor status:: 264 265 testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status 266 267show rxq desc used count 268~~~~~~~~~~~~~~~~~~~~~~~~ 269 270Display the number of receive packet descriptors currently filled by hardware 271and ready to be processed by the driver on a given RX queue:: 272 273 testpmd> show port (port_id) rxq (queue_id) desc used count 274 275show config 276~~~~~~~~~~~ 277 278Displays the configuration of the application. 279The configuration comes from the command-line, the runtime or the application defaults:: 280 281 testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|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 a per port Rx offloading on all Rx queues of a port:: 1574 1575 testpmd> port config (port_id) rx_offload (offloading) on|off 1576 1577* ``offloading``: can be any of these offloading capability: 1578 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 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 a per port Tx offloading on all Tx queues of a port:: 1604 1605 testpmd> port config (port_id) tx_offload (offloading) on|off 1606 1607* ``offloading``: can be any of these offloading capability: 1608 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 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 cleanup txq mbufs 2267~~~~~~~~~~~~~~~~~~~~~~ 2268 2269To cleanup txq mbufs currently cached by driver:: 2270 2271 testpmd> port cleanup (port_id) txq (queue_id) (free_cnt) 2272 2273If the value of ``free_cnt`` is 0, driver should free all cached mbufs. 2274 2275Device Functions 2276---------------- 2277 2278The following sections show functions for device operations. 2279 2280device detach 2281~~~~~~~~~~~~~ 2282 2283Detach a device specified by pci address or virtual device args:: 2284 2285 testpmd> device detach (identifier) 2286 2287Before detaching a device associated with ports, the ports should be stopped and closed. 2288 2289For example, to detach a pci device whose address is 0002:03:00.0. 2290 2291.. code-block:: console 2292 2293 testpmd> device detach 0002:03:00.0 2294 Removing a device... 2295 Port 1 is now closed 2296 EAL: Releasing pci mapped resource for 0002:03:00.0 2297 EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218a050000 2298 EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218c050000 2299 Device 0002:03:00.0 is detached 2300 Now total ports is 1 2301 2302For example, to detach a port created by pcap PMD. 2303 2304.. code-block:: console 2305 2306 testpmd> device detach net_pcap0 2307 Removing a device... 2308 Port 0 is now closed 2309 Device net_pcap0 is detached 2310 Now total ports is 0 2311 Done 2312 2313In this case, identifier is ``net_pcap0``. 2314This identifier format is the same as ``--vdev`` format of DPDK applications. 2315 2316Link Bonding Functions 2317---------------------- 2318 2319The Link Bonding functions make it possible to dynamically create and 2320manage link bonding devices from within testpmd interactive prompt. 2321 2322See :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information. 2323 2324Traffic Metering and Policing 2325----------------------------- 2326 2327The following section shows functions for configuring traffic metering and 2328policing on the ethernet device through the use of generic ethdev API. 2329 2330show port traffic management capability 2331~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2332 2333Show traffic metering and policing capability of the port:: 2334 2335 testpmd> show port meter cap (port_id) 2336 2337add port meter profile (srTCM rfc2967) 2338~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2339 2340Add meter profile (srTCM rfc2697) to the ethernet device:: 2341 2342 testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \ 2343 (cir) (cbs) (ebs) (packet_mode) 2344 2345where: 2346 2347* ``profile_id``: ID for the meter profile. 2348* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second). 2349* ``cbs``: Committed Burst Size (CBS) (bytes or packets). 2350* ``ebs``: Excess Burst Size (EBS) (bytes or packets). 2351* ``packet_mode``: Packets mode for meter profile. 2352 2353add port meter profile (trTCM rfc2968) 2354~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2355 2356Add meter profile (srTCM rfc2698) to the ethernet device:: 2357 2358 testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \ 2359 (cir) (pir) (cbs) (pbs) (packet_mode) 2360 2361where: 2362 2363* ``profile_id``: ID for the meter profile. 2364* ``cir``: Committed information rate (bytes per second or packets per second). 2365* ``pir``: Peak information rate (bytes per second or packets per second). 2366* ``cbs``: Committed burst size (bytes or packets). 2367* ``pbs``: Peak burst size (bytes or packets). 2368* ``packet_mode``: Packets mode for meter profile. 2369 2370add port meter profile (trTCM rfc4115) 2371~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2372 2373Add meter profile (trTCM rfc4115) to the ethernet device:: 2374 2375 testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \ 2376 (cir) (eir) (cbs) (ebs) (packet_mode) 2377 2378where: 2379 2380* ``profile_id``: ID for the meter profile. 2381* ``cir``: Committed information rate (bytes per second or packets per second). 2382* ``eir``: Excess information rate (bytes per second or packets per second). 2383* ``cbs``: Committed burst size (bytes or packets). 2384* ``ebs``: Excess burst size (bytes or packets). 2385* ``packet_mode``: Packets mode for meter profile. 2386 2387delete port meter profile 2388~~~~~~~~~~~~~~~~~~~~~~~~~ 2389 2390Delete meter profile from the ethernet device:: 2391 2392 testpmd> del port meter profile (port_id) (profile_id) 2393 2394create port policy 2395~~~~~~~~~~~~~~~~~~ 2396 2397Create new policy object for the ethernet device:: 2398 2399 testpmd> add port meter policy (port_id) (policy_id) g_actions \ 2400 {action} y_actions {action} r_actions {action} 2401 2402where: 2403 2404* ``policy_id``: policy ID. 2405* ``action``: action lists for green/yellow/red colors. 2406 2407delete port policy 2408~~~~~~~~~~~~~~~~~~ 2409 2410Delete policy object for the ethernet device:: 2411 2412 testpmd> del port meter policy (port_id) (policy_id) 2413 2414where: 2415 2416* ``policy_id``: policy ID. 2417 2418create port meter 2419~~~~~~~~~~~~~~~~~ 2420 2421Create new meter object for the ethernet device:: 2422 2423 testpmd> create port meter (port_id) (mtr_id) (profile_id) \ 2424 (policy_id) (meter_enable) (stats_mask) (shared) (default_input_color) \ 2425 (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\ 2426 (dscp_tbl_entry63)] [(vlan_tbl_entry0) (vlan_tbl_entry1) ... \ 2427 (vlan_tbl_entry15)] 2428 2429where: 2430 2431* ``mtr_id``: meter object ID. 2432* ``profile_id``: ID for the meter profile. 2433* ``policy_id``: ID for the policy. 2434* ``meter_enable``: When this parameter has a non-zero value, the meter object 2435 gets enabled at the time of creation, otherwise remains disabled. 2436* ``stats_mask``: Mask of statistics counter types to be enabled for the 2437 meter object. 2438* ``shared``: When this parameter has a non-zero value, the meter object is 2439 shared by multiple flows. Otherwise, meter object is used by single flow. 2440* ``default_input_color``: Default input color for incoming packets. 2441 If incoming packet misses DSCP or VLAN input color table then it will be used 2442 as input color. 2443* ``use_pre_meter_color``: When this parameter has a non-zero value, the 2444 input color for the current meter object is determined by the latest meter 2445 object in the same flow. Otherwise, the current meter object uses the 2446 *dscp_table* to determine the input color. 2447* ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input 2448 color, 0 <= x <= 63. 2449* ``vlan_tbl_entryx``: VLAN table entry x providing meter input color, 2450 0 <= x <= 15. 2451 2452enable port meter 2453~~~~~~~~~~~~~~~~~ 2454 2455Enable meter for the ethernet device:: 2456 2457 testpmd> enable port meter (port_id) (mtr_id) 2458 2459disable port meter 2460~~~~~~~~~~~~~~~~~~ 2461 2462Disable meter for the ethernet device:: 2463 2464 testpmd> disable port meter (port_id) (mtr_id) 2465 2466delete port meter 2467~~~~~~~~~~~~~~~~~ 2468 2469Delete meter for the ethernet device:: 2470 2471 testpmd> del port meter (port_id) (mtr_id) 2472 2473Set port meter profile 2474~~~~~~~~~~~~~~~~~~~~~~ 2475 2476Set meter profile for the ethernet device:: 2477 2478 testpmd> set port meter profile (port_id) (mtr_id) (profile_id) 2479 2480set port meter dscp table 2481~~~~~~~~~~~~~~~~~~~~~~~~~ 2482 2483Set meter dscp table for the ethernet device:: 2484 2485 testpmd> set port meter dscp table (port_id) (mtr_id) (proto) \ 2486 [(dscp_tbl_entry0) (dscp_tbl_entry1)...(dscp_tbl_entry63)] 2487 2488set port meter vlan table 2489~~~~~~~~~~~~~~~~~~~~~~~~~ 2490Set meter VLAN table for the Ethernet device:: 2491 2492 testpmd> set port meter vlan table (port_id) (mtr_id) (proto) \ 2493 [(vlan_tbl_entry0) (vlan_tbl_entry1)...(vlan_tbl_entry15)] 2494 2495set port meter protocol 2496~~~~~~~~~~~~~~~~~~~~~~~ 2497Set meter protocol and corresponding priority:: 2498 2499 testpmd> set port meter proto (port_id) (mtr_id) (proto) (prio) 2500 2501get port meter protocol 2502~~~~~~~~~~~~~~~~~~~~~~~ 2503Get meter protocol:: 2504 2505 testpmd> get port meter proto (port_id) (mtr_id) 2506 2507get port meter protocol priority 2508~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2509Get priority associated to meter protocol:: 2510 2511 testpmd> get port meter proto_prio (port_id) (mtr_id) (proto) 2512 2513set port meter stats mask 2514~~~~~~~~~~~~~~~~~~~~~~~~~ 2515 2516Set meter stats mask for the ethernet device:: 2517 2518 testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask) 2519 2520where: 2521 2522* ``stats_mask``: Bit mask indicating statistics counter types to be enabled. 2523 2524show port meter stats 2525~~~~~~~~~~~~~~~~~~~~~ 2526 2527Show meter stats of the ethernet device:: 2528 2529 testpmd> show port meter stats (port_id) (mtr_id) (clear) 2530 2531where: 2532 2533* ``clear``: Flag that indicates whether the statistics counters should 2534 be cleared (i.e. set to zero) immediately after they have been read or not. 2535 2536Traffic Management 2537------------------ 2538 2539The following section shows functions for configuring traffic management on 2540the ethernet device through the use of generic TM API. 2541 2542show port traffic management capability 2543~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2544 2545Show traffic management capability of the port:: 2546 2547 testpmd> show port tm cap (port_id) 2548 2549show port traffic management capability (hierarchy level) 2550~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2551 2552Show traffic management hierarchy level capability of the port:: 2553 2554 testpmd> show port tm level cap (port_id) (level_id) 2555 2556show port traffic management capability (hierarchy node level) 2557~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2558 2559Show the traffic management hierarchy node capability of the port:: 2560 2561 testpmd> show port tm node cap (port_id) (node_id) 2562 2563show port traffic management hierarchy node type 2564~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2565 2566Show the port traffic management hierarchy node type:: 2567 2568 testpmd> show port tm node type (port_id) (node_id) 2569 2570show port traffic management hierarchy node stats 2571~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2572 2573Show the port traffic management hierarchy node statistics:: 2574 2575 testpmd> show port tm node stats (port_id) (node_id) (clear) 2576 2577where: 2578 2579* ``clear``: When this parameter has a non-zero value, the statistics counters 2580 are cleared (i.e. set to zero) immediately after they have been read, 2581 otherwise the statistics counters are left untouched. 2582 2583Add port traffic management private shaper profile 2584~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2585 2586Add the port traffic management private shaper profile:: 2587 2588 testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \ 2589 (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \ 2590 (packet_length_adjust) (packet_mode) 2591 2592where: 2593 2594* ``shaper_profile id``: Shaper profile ID for the new profile. 2595* ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second). 2596* ``cmit_tb_size``: Committed token bucket size (bytes or packets). 2597* ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second). 2598* ``peak_tb_size``: Peak token bucket size (bytes or packets). 2599* ``packet_length_adjust``: The value (bytes) to be added to the length of 2600 each packet for the purpose of shaping. This parameter value can be used to 2601 correct the packet length with the framing overhead bytes that are consumed 2602 on the wire. 2603* ``packet_mode``: Shaper configured in packet mode. This parameter value if 2604 zero, configures shaper in byte mode and if non-zero configures it in packet 2605 mode. 2606 2607Delete port traffic management private shaper profile 2608~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2609 2610Delete the port traffic management private shaper:: 2611 2612 testpmd> del port tm node shaper profile (port_id) (shaper_profile_id) 2613 2614where: 2615 2616* ``shaper_profile id``: Shaper profile ID that needs to be deleted. 2617 2618Add port traffic management shared shaper 2619~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2620 2621Create the port traffic management shared shaper:: 2622 2623 testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \ 2624 (shaper_profile_id) 2625 2626where: 2627 2628* ``shared_shaper_id``: Shared shaper ID to be created. 2629* ``shaper_profile id``: Shaper profile ID for shared shaper. 2630 2631Set port traffic management shared shaper 2632~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2633 2634Update the port traffic management shared shaper:: 2635 2636 testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \ 2637 (shaper_profile_id) 2638 2639where: 2640 2641* ``shared_shaper_id``: Shared shaper ID to be update. 2642* ``shaper_profile id``: Shaper profile ID for shared shaper. 2643 2644Delete port traffic management shared shaper 2645~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2646 2647Delete the port traffic management shared shaper:: 2648 2649 testpmd> del port tm node shared shaper (port_id) (shared_shaper_id) 2650 2651where: 2652 2653* ``shared_shaper_id``: Shared shaper ID to be deleted. 2654 2655Set port traffic management hierarchy node private shaper 2656~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2657 2658set the port traffic management hierarchy node private shaper:: 2659 2660 testpmd> set port tm node shaper profile (port_id) (node_id) \ 2661 (shaper_profile_id) 2662 2663where: 2664 2665* ``shaper_profile id``: Private shaper profile ID to be enabled on the 2666 hierarchy node. 2667 2668Add port traffic management WRED profile 2669~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2670 2671Create a new WRED profile:: 2672 2673 testpmd> add port tm node wred profile (port_id) (wred_profile_id) \ 2674 (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \ 2675 (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \ 2676 (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r) 2677 2678where: 2679 2680* ``wred_profile id``: Identifier for the newly create WRED profile 2681* ``color_g``: Packet color (green) 2682* ``min_th_g``: Minimum queue threshold for packet with green color 2683* ``max_th_g``: Minimum queue threshold for packet with green color 2684* ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp) 2685* ``wq_log2_g``: Negated log2 of queue weight (wq) 2686* ``color_y``: Packet color (yellow) 2687* ``min_th_y``: Minimum queue threshold for packet with yellow color 2688* ``max_th_y``: Minimum queue threshold for packet with yellow color 2689* ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp) 2690* ``wq_log2_y``: Negated log2 of queue weight (wq) 2691* ``color_r``: Packet color (red) 2692* ``min_th_r``: Minimum queue threshold for packet with yellow color 2693* ``max_th_r``: Minimum queue threshold for packet with yellow color 2694* ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp) 2695* ``wq_log2_r``: Negated log2 of queue weight (wq) 2696 2697Delete port traffic management WRED profile 2698~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2699 2700Delete the WRED profile:: 2701 2702 testpmd> del port tm node wred profile (port_id) (wred_profile_id) 2703 2704Add port traffic management hierarchy nonleaf node 2705~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2706 2707Add nonleaf node to port traffic management hierarchy:: 2708 2709 testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \ 2710 (priority) (weight) (level_id) (shaper_profile_id) \ 2711 (n_sp_priorities) (stats_mask) (n_shared_shapers) \ 2712 [(shared_shaper_0) (shared_shaper_1) ...] \ 2713 2714where: 2715 2716* ``parent_node_id``: Node ID of the parent. 2717* ``priority``: Node priority (highest node priority is zero). This is used by 2718 the SP algorithm running on the parent node for scheduling this node. 2719* ``weight``: Node weight (lowest weight is one). The node weight is relative 2720 to the weight sum of all siblings that have the same priority. It is used by 2721 the WFQ algorithm running on the parent node for scheduling this node. 2722* ``level_id``: Hierarchy level of the node. 2723* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by 2724 the node. 2725* ``n_sp_priorities``: Number of strict priorities. 2726* ``stats_mask``: Mask of statistics counter types to be enabled for this node. 2727* ``n_shared_shapers``: Number of shared shapers. 2728* ``shared_shaper_id``: Shared shaper id. 2729 2730Add port traffic management hierarchy nonleaf node with packet mode 2731~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2732 2733Add nonleaf node with packet mode to port traffic management hierarchy:: 2734 2735 testpmd> add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id) \ 2736 (priority) (weight) (level_id) (shaper_profile_id) \ 2737 (n_sp_priorities) (stats_mask) (n_shared_shapers) \ 2738 [(shared_shaper_0) (shared_shaper_1) ...] \ 2739 2740where: 2741 2742* ``parent_node_id``: Node ID of the parent. 2743* ``priority``: Node priority (highest node priority is zero). This is used by 2744 the SP algorithm running on the parent node for scheduling this node. 2745* ``weight``: Node weight (lowest weight is one). The node weight is relative 2746 to the weight sum of all siblings that have the same priority. It is used by 2747 the WFQ algorithm running on the parent node for scheduling this node. 2748* ``level_id``: Hierarchy level of the node. 2749* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by 2750 the node. 2751* ``n_sp_priorities``: Number of strict priorities. Packet mode is enabled on 2752 all of them. 2753* ``stats_mask``: Mask of statistics counter types to be enabled for this node. 2754* ``n_shared_shapers``: Number of shared shapers. 2755* ``shared_shaper_id``: Shared shaper id. 2756 2757Add port traffic management hierarchy leaf node 2758~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2759 2760Add leaf node to port traffic management hierarchy:: 2761 2762 testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \ 2763 (priority) (weight) (level_id) (shaper_profile_id) \ 2764 (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \ 2765 [(shared_shaper_id) (shared_shaper_id) ...] \ 2766 2767where: 2768 2769* ``parent_node_id``: Node ID of the parent. 2770* ``priority``: Node priority (highest node priority is zero). This is used by 2771 the SP algorithm running on the parent node for scheduling this node. 2772* ``weight``: Node weight (lowest weight is one). The node weight is relative 2773 to the weight sum of all siblings that have the same priority. It is used by 2774 the WFQ algorithm running on the parent node for scheduling this node. 2775* ``level_id``: Hierarchy level of the node. 2776* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by 2777 the node. 2778* ``cman_mode``: Congestion management mode to be enabled for this node. 2779* ``wred_profile_id``: WRED profile id to be enabled for this node. 2780* ``stats_mask``: Mask of statistics counter types to be enabled for this node. 2781* ``n_shared_shapers``: Number of shared shapers. 2782* ``shared_shaper_id``: Shared shaper id. 2783 2784Delete port traffic management hierarchy node 2785~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2786 2787Delete node from port traffic management hierarchy:: 2788 2789 testpmd> del port tm node (port_id) (node_id) 2790 2791Update port traffic management hierarchy parent node 2792~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2793 2794Update port traffic management hierarchy parent node:: 2795 2796 testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \ 2797 (priority) (weight) 2798 2799This function can only be called after the hierarchy commit invocation. Its 2800success depends on the port support for this operation, as advertised through 2801the port capability set. This function is valid for all nodes of the traffic 2802management hierarchy except root node. 2803 2804Suspend port traffic management hierarchy node 2805~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2806 2807 testpmd> suspend port tm node (port_id) (node_id) 2808 2809Resume port traffic management hierarchy node 2810~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2811 2812 testpmd> resume port tm node (port_id) (node_id) 2813 2814Commit port traffic management hierarchy 2815~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2816 2817Commit the traffic management hierarchy on the port:: 2818 2819 testpmd> port tm hierarchy commit (port_id) (clean_on_fail) 2820 2821where: 2822 2823* ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function 2824 call failure. On the other hand, hierarchy is preserved when this parameter 2825 is equal to zero. 2826 2827Set port traffic management mark VLAN dei 2828~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2829 2830Enables/Disables the traffic management marking on the port for VLAN packets:: 2831 2832 testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red> 2833 2834where: 2835 2836* ``port_id``: The port which on which VLAN packets marked as ``green`` or 2837 ``yellow`` or ``red`` will have dei bit enabled 2838 2839* ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green 2840 2841* ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow 2842 2843* ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red 2844 2845Set port traffic management mark IP dscp 2846~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2847 2848Enables/Disables the traffic management marking on the port for IP dscp packets:: 2849 2850 testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red> 2851 2852where: 2853 2854* ``port_id``: The port which on which IP packets marked as ``green`` or 2855 ``yellow`` or ``red`` will have IP dscp bits updated 2856 2857* ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets 2858 2859* ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets 2860 2861* ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets 2862 2863Set port traffic management mark IP ecn 2864~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2865 2866Enables/Disables the traffic management marking on the port for IP ecn packets:: 2867 2868 testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red> 2869 2870where: 2871 2872* ``port_id``: The port which on which IP packets marked as ``green`` or 2873 ``yellow`` or ``red`` will have IP ecn bits updated 2874 2875* ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01 or 2'b10 2876 to ecn of 2'b11 when IP is caring TCP or SCTP 2877 2878* ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10 2879 to ecn of 2'b11 when IP is caring TCP or SCTP 2880 2881* ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10 2882 to ecn of 2'b11 when IP is caring TCP or SCTP 2883 2884Congestion Management 2885--------------------- 2886 2887Get capabilities 2888~~~~~~~~~~~~~~~~ 2889 2890Retrieve congestion management capabilities supported by driver for given port. 2891Below example command retrieves capabilities for port 0:: 2892 2893 testpmd> show port cman capa 0 2894 2895Get configuration 2896~~~~~~~~~~~~~~~~~ 2897 2898Retrieve congestion management configuration for given port. 2899Below example command retrieves configuration for port 0:: 2900 2901 testpmd> show port cman config 0 2902 2903Set configuration 2904~~~~~~~~~~~~~~~~~ 2905 2906Configures congestion management settings on given queue 2907or mempool associated with queue. 2908Below example command configures RED as congestion management algorithm 2909for port 0 and queue 0:: 2910 2911 testpmd> set port cman config 0 0 obj queue mode red 10 100 1 2912 2913Filter Functions 2914---------------- 2915 2916This section details the available filter functions that are available. 2917 2918Note these functions interface the deprecated legacy filtering framework, 2919superseded by *rte_flow*. See `Flow rules management`_. 2920 2921.. _testpmd_rte_flow: 2922 2923Flow rules management 2924--------------------- 2925 2926Control of the generic flow API (*rte_flow*) is fully exposed through the 2927``flow`` command (configuration, validation, creation, destruction, queries 2928and operation modes). 2929 2930Considering *rte_flow* overlaps with all `Filter Functions`_, using both 2931features simultaneously may cause undefined side-effects and is therefore 2932not recommended. 2933 2934``flow`` syntax 2935~~~~~~~~~~~~~~~ 2936 2937Because the ``flow`` command uses dynamic tokens to handle the large number 2938of possible flow rules combinations, its behavior differs slightly from 2939other commands, in particular: 2940 2941- Pressing *?* or the *<tab>* key displays contextual help for the current 2942 token, not that of the entire command. 2943 2944- Optional and repeated parameters are supported (provided they are listed 2945 in the contextual help). 2946 2947The first parameter stands for the operation mode. Possible operations and 2948their general syntax are described below. They are covered in detail in the 2949following sections. 2950 2951- Get info about flow engine:: 2952 2953 flow info {port_id} 2954 2955- Configure flow engine:: 2956 2957 flow configure {port_id} 2958 [queues_number {number}] [queues_size {size}] 2959 [counters_number {number}] 2960 [aging_counters_number {number}] 2961 [meters_number {number}] [flags {number}] 2962 2963- Create a pattern template:: 2964 2965 flow pattern_template {port_id} create [pattern_template_id {id}] 2966 [relaxed {boolean}] [ingress] [egress] [transfer] 2967 template {item} [/ {item} [...]] / end 2968 2969- Destroy a pattern template:: 2970 2971 flow pattern_template {port_id} destroy pattern_template {id} [...] 2972 2973- Create an actions template:: 2974 2975 flow actions_template {port_id} create [actions_template_id {id}] 2976 [ingress] [egress] [transfer] 2977 template {action} [/ {action} [...]] / end 2978 mask {action} [/ {action} [...]] / end 2979 2980- Destroy an actions template:: 2981 2982 flow actions_template {port_id} destroy actions_template {id} [...] 2983 2984- Create a table:: 2985 2986 flow table {port_id} create 2987 [table_id {id}] 2988 [group {group_id}] [priority {level}] [ingress] [egress] [transfer] 2989 rules_number {number} 2990 pattern_template {pattern_template_id} 2991 actions_template {actions_template_id} 2992 2993- Destroy a table:: 2994 2995 flow table {port_id} destroy table {id} [...] 2996 2997- Check whether a flow rule can be created:: 2998 2999 flow validate {port_id} 3000 [group {group_id}] [priority {level}] [ingress] [egress] [transfer] 3001 pattern {item} [/ {item} [...]] / end 3002 actions {action} [/ {action} [...]] / end 3003 3004- Enqueue creation of a flow rule:: 3005 3006 flow queue {port_id} create {queue_id} 3007 [postpone {boolean}] template_table {table_id} 3008 pattern_template {pattern_template_index} 3009 actions_template {actions_template_index} 3010 pattern {item} [/ {item} [...]] / end 3011 actions {action} [/ {action} [...]] / end 3012 3013- Enqueue destruction of specific flow rules:: 3014 3015 flow queue {port_id} destroy {queue_id} 3016 [postpone {boolean}] rule {rule_id} [...] 3017 3018- Push enqueued operations:: 3019 3020 flow push {port_id} queue {queue_id} 3021 3022- Pull all operations results from a queue:: 3023 3024 flow pull {port_id} queue {queue_id} 3025 3026- Create a flow rule:: 3027 3028 flow create {port_id} 3029 [group {group_id}] [priority {level}] [ingress] [egress] 3030 [transfer] [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}] 3031 [user_id {user_id}] pattern {item} [/ {item} [...]] / end 3032 actions {action} [/ {action} [...]] / end 3033 3034- Destroy specific flow rules:: 3035 3036 flow destroy {port_id} rule {rule_id} [...] [user_id] 3037 3038- Destroy all flow rules:: 3039 3040 flow flush {port_id} 3041 3042- Query an existing flow rule:: 3043 3044 flow query {port_id} {rule_id} {action} [user_id] 3045 3046- List existing flow rules sorted by priority, filtered by group 3047 identifiers:: 3048 3049 flow list {port_id} [group {group_id}] [...] 3050 3051- Restrict ingress traffic to the defined flow rules:: 3052 3053 flow isolate {port_id} {boolean} 3054 3055- Dump internal representation information of all flows in hardware:: 3056 3057 flow dump {port_id} all {output_file} [user_id] 3058 3059 for one flow:: 3060 3061 flow dump {port_id} rule {rule_id} {output_file} [user_id] 3062 3063- List and destroy aged flow rules:: 3064 3065 flow aged {port_id} [destroy] 3066 3067- Enqueue list and destroy aged flow rules:: 3068 3069 flow queue {port_id} aged {queue_id} [destroy] 3070 3071- Tunnel offload - create a tunnel stub:: 3072 3073 flow tunnel create {port_id} type {tunnel_type} 3074 3075- Tunnel offload - destroy a tunnel stub:: 3076 3077 flow tunnel destroy {port_id} id {tunnel_id} 3078 3079- Tunnel offload - list port tunnel stubs:: 3080 3081 flow tunnel list {port_id} 3082 3083Retrieving info about flow management engine 3084~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3085 3086``flow info`` retrieves info on pre-configurable resources in the underlying 3087device to give a hint of possible values for flow engine configuration. 3088 3089``rte_flow_info_get()``:: 3090 3091 flow info {port_id} 3092 3093If successful, it will show:: 3094 3095 Flow engine resources on port #[...]: 3096 Number of queues: #[...] 3097 Size of queues: #[...] 3098 Number of counters: #[...] 3099 Number of aging objects: #[...] 3100 Number of meters: #[...] 3101 3102Otherwise it will show an error message of the form:: 3103 3104 Caught error type [...] ([...]): [...] 3105 3106Configuring flow management engine 3107~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3108 3109``flow configure`` pre-allocates all the needed resources in the underlying 3110device to be used later at the flow creation. Flow queues are allocated as well 3111for asynchronous flow creation/destruction operations. It is bound to 3112``rte_flow_configure()``:: 3113 3114 flow configure {port_id} 3115 [queues_number {number}] [queues_size {size}] 3116 [counters_number {number}] 3117 [aging_counters_number {number}] 3118 [host_port {number}] 3119 [meters_number {number}] 3120 [flags {number}] 3121 3122If successful, it will show:: 3123 3124 Configure flows on port #[...]: number of queues #[...] with #[...] elements 3125 3126Otherwise it will show an error message of the form:: 3127 3128 Caught error type [...] ([...]): [...] 3129 3130Creating pattern templates 3131~~~~~~~~~~~~~~~~~~~~~~~~~~ 3132 3133``flow pattern_template create`` creates the specified pattern template. 3134It is bound to ``rte_flow_pattern_template_create()``:: 3135 3136 flow pattern_template {port_id} create [pattern_template_id {id}] 3137 [relaxed {boolean}] [ingress] [egress] [transfer] 3138 template {item} [/ {item} [...]] / end 3139 3140If successful, it will show:: 3141 3142 Pattern template #[...] created 3143 3144Otherwise it will show an error message of the form:: 3145 3146 Caught error type [...] ([...]): [...] 3147 3148This command uses the same pattern items as ``flow create``, 3149their format is described in `Creating flow rules`_. 3150 3151Destroying pattern templates 3152~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3153 3154``flow pattern_template destroy`` destroys one or more pattern templates 3155from their template ID (as returned by ``flow pattern_template create``), 3156this command calls ``rte_flow_pattern_template_destroy()`` as many 3157times as necessary:: 3158 3159 flow pattern_template {port_id} destroy pattern_template {id} [...] 3160 3161If successful, it will show:: 3162 3163 Pattern template #[...] destroyed 3164 3165It does not report anything for pattern template IDs that do not exist. 3166The usual error message is shown when a pattern template cannot be destroyed:: 3167 3168 Caught error type [...] ([...]): [...] 3169 3170Creating actions templates 3171~~~~~~~~~~~~~~~~~~~~~~~~~~ 3172 3173``flow actions_template create`` creates the specified actions template. 3174It is bound to ``rte_flow_actions_template_create()``:: 3175 3176 flow actions_template {port_id} create [actions_template_id {id}] 3177 [ingress] [egress] [transfer] 3178 template {action} [/ {action} [...]] / end 3179 mask {action} [/ {action} [...]] / end 3180 3181If successful, it will show:: 3182 3183 Actions template #[...] created 3184 3185Otherwise it will show an error message of the form:: 3186 3187 Caught error type [...] ([...]): [...] 3188 3189This command uses the same actions as ``flow create``, 3190their format is described in `Creating flow rules`_. 3191 3192Destroying actions templates 3193~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3194 3195``flow actions_template destroy`` destroys one or more actions templates 3196from their template ID (as returned by ``flow actions_template create``), 3197this command calls ``rte_flow_actions_template_destroy()`` as many 3198times as necessary:: 3199 3200 flow actions_template {port_id} destroy actions_template {id} [...] 3201 3202If successful, it will show:: 3203 3204 Actions template #[...] destroyed 3205 3206It does not report anything for actions template IDs that do not exist. 3207The usual error message is shown when an actions template cannot be destroyed:: 3208 3209 Caught error type [...] ([...]): [...] 3210 3211Creating template table 3212~~~~~~~~~~~~~~~~~~~~~~~ 3213 3214``flow template_table create`` creates the specified template table. 3215It is bound to ``rte_flow_template_table_create()``:: 3216 3217 flow template_table {port_id} create 3218 [table_id {id}] [group {group_id}] 3219 [priority {level}] [ingress] [egress] 3220 [transfer [vport_orig] [wire_orig]] 3221 rules_number {number} 3222 pattern_template {pattern_template_id} 3223 actions_template {actions_template_id} 3224 3225If successful, it will show:: 3226 3227 Template table #[...] created 3228 3229Otherwise it will show an error message of the form:: 3230 3231 Caught error type [...] ([...]): [...] 3232 3233Destroying flow table 3234~~~~~~~~~~~~~~~~~~~~~ 3235 3236``flow template_table destroy`` destroys one or more template tables 3237from their table ID (as returned by ``flow template_table create``), 3238this command calls ``rte_flow_template_table_destroy()`` as many 3239times as necessary:: 3240 3241 flow template_table {port_id} destroy table {id} [...] 3242 3243If successful, it will show:: 3244 3245 Template table #[...] destroyed 3246 3247It does not report anything for table IDs that do not exist. 3248The usual error message is shown when a table cannot be destroyed:: 3249 3250 Caught error type [...] ([...]): [...] 3251 3252Pushing enqueued operations 3253~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3254 3255``flow push`` pushes all the outstanding enqueued operations 3256to the underlying device immediately. 3257It is bound to ``rte_flow_push()``:: 3258 3259 flow push {port_id} queue {queue_id} 3260 3261If successful, it will show:: 3262 3263 Queue #[...] operations pushed 3264 3265The usual error message is shown when operations cannot be pushed:: 3266 3267 Caught error type [...] ([...]): [...] 3268 3269Pulling flow operations results 3270~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3271 3272``flow pull`` asks the underlying device about flow queue operations 3273results and return all the processed (successfully or not) operations. 3274It is bound to ``rte_flow_pull()``:: 3275 3276 flow pull {port_id} queue {queue_id} 3277 3278If successful, it will show:: 3279 3280 Queue #[...] pulled #[...] operations (#[...] failed, #[...] succeeded) 3281 3282The usual error message is shown when operations results cannot be pulled:: 3283 3284 Caught error type [...] ([...]): [...] 3285 3286Calculating hash 3287~~~~~~~~~~~~~~~~ 3288 3289``flow hash`` calculates the hash for a given pattern. 3290It is bound to ``rte_flow_calc_table_hash()``:: 3291 3292 flow hash {port_id} template_table {table_id} 3293 pattern_template {pattern_template_index} 3294 actions_template {actions_template_index} 3295 pattern {item} [/ {item} [...]] / end 3296 3297If successful, it will show the calculated hash result as seen below:: 3298 3299 Hash results 0x[...] 3300 3301Otherwise, it will show an error message of the form:: 3302 3303 Caught error type [...] ([...]): [...] 3304 3305This command uses the same pattern items as ``flow create``, 3306their format is described in `Creating flow rules`_. 3307 3308Creating a tunnel stub for offload 3309~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3310 3311``flow tunnel create`` setup a tunnel stub for tunnel offload flow rules:: 3312 3313 flow tunnel create {port_id} type {tunnel_type} 3314 3315If successful, it will return a tunnel stub ID usable with other commands:: 3316 3317 port [...]: flow tunnel #[...] type [...] 3318 3319Tunnel stub ID is relative to a port. 3320 3321Destroying tunnel offload stub 3322~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3323 3324``flow tunnel destroy`` destroy port tunnel stub:: 3325 3326 flow tunnel destroy {port_id} id {tunnel_id} 3327 3328Listing tunnel offload stubs 3329~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3330 3331``flow tunnel list`` list port tunnel offload stubs:: 3332 3333 flow tunnel list {port_id} 3334 3335Validating flow rules 3336~~~~~~~~~~~~~~~~~~~~~ 3337 3338``flow validate`` reports whether a flow rule would be accepted by the 3339underlying device in its current state but stops short of creating it. It is 3340bound to ``rte_flow_validate()``:: 3341 3342 flow validate {port_id} 3343 [group {group_id}] [priority {level}] [ingress] [egress] [transfer] 3344 pattern {item} [/ {item} [...]] / end 3345 actions {action} [/ {action} [...]] / end 3346 3347If successful, it will show:: 3348 3349 Flow rule validated 3350 3351Otherwise it will show an error message of the form:: 3352 3353 Caught error type [...] ([...]): [...] 3354 3355This command uses the same parameters as ``flow create``, their format is 3356described in `Creating flow rules`_. 3357 3358Check whether redirecting any Ethernet packet received on port 0 to RX queue 3359index 6 is supported:: 3360 3361 testpmd> flow validate 0 ingress pattern eth / end 3362 actions queue index 6 / end 3363 Flow rule validated 3364 testpmd> 3365 3366Port 0 does not support TCPv6 rules:: 3367 3368 testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end 3369 actions drop / end 3370 Caught error type 9 (specific pattern item): Invalid argument 3371 testpmd> 3372 3373Creating flow rules 3374~~~~~~~~~~~~~~~~~~~ 3375 3376``flow create`` validates and creates the specified flow rule. It is bound 3377to ``rte_flow_create()``:: 3378 3379 flow create {port_id} 3380 [group {group_id}] [priority {level}] [ingress] [egress] [transfer] 3381 [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}] 3382 [user_id {user_id}] pattern {item} [/ {item} [...]] / end 3383 actions {action} [/ {action} [...]] / end 3384 3385If successful, it will return a flow rule ID usable with other commands:: 3386 3387 Flow rule #[...] created 3388 3389Or if ``user_id`` is provided:: 3390 3391 Flow rule #[...] created, user-id [...] 3392 3393Otherwise it will show an error message of the form:: 3394 3395 Caught error type [...] ([...]): [...] 3396 3397Parameters describe in the following order: 3398 3399- Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens). 3400- Tunnel offload specification (tunnel_set, tunnel_match) 3401- User identifier for the flow. 3402- A matching pattern, starting with the *pattern* token and terminated by an 3403 *end* pattern item. 3404- Actions, starting with the *actions* token and terminated by an *end* 3405 action. 3406 3407These translate directly to *rte_flow* objects provided as-is to the 3408underlying functions. 3409 3410The shortest valid definition only comprises mandatory tokens:: 3411 3412 testpmd> flow create 0 pattern end actions end 3413 3414Note that PMDs may refuse rules that essentially do nothing such as this 3415one. 3416 3417**All unspecified object values are automatically initialized to 0.** 3418 3419Enqueueing creation of flow rules 3420~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3421 3422``flow queue create`` adds creation operation of a flow rule to a queue. 3423It is bound to ``rte_flow_async_create()``:: 3424 3425 flow queue {port_id} create {queue_id} 3426 [postpone {boolean}] template_table {table_id} 3427 pattern_template {pattern_template_index} 3428 actions_template {actions_template_index} 3429 pattern {item} [/ {item} [...]] / end 3430 actions {action} [/ {action} [...]] / end 3431 3432If successful, it will return a flow rule ID usable with other commands:: 3433 3434 Flow rule #[...] creaion enqueued 3435 3436Otherwise it will show an error message of the form:: 3437 3438 Caught error type [...] ([...]): [...] 3439 3440This command uses the same pattern items and actions as ``flow create``, 3441their format is described in `Creating flow rules`_. 3442 3443``flow queue pull`` must be called to retrieve the operation status. 3444 3445Attributes 3446^^^^^^^^^^ 3447 3448These tokens affect flow rule attributes (``struct rte_flow_attr``) and are 3449specified before the ``pattern`` token. 3450 3451- ``group {group id}``: priority group. 3452- ``priority {level}``: priority level within group. 3453- ``ingress``: rule applies to ingress traffic. 3454- ``egress``: rule applies to egress traffic. 3455- ``transfer``: apply rule directly to endpoints found in pattern. 3456 3457Please note that use of ``transfer`` attribute requires that the flow and 3458its indirect components be managed via so-called ``transfer`` proxy port. 3459See `show flow transfer proxy port ID for the given port`_ for details. 3460 3461Each instance of an attribute specified several times overrides the previous 3462value as shown below (group 4 is used):: 3463 3464 testpmd> flow create 0 group 42 group 24 group 4 [...] 3465 3466Note that once enabled, ``ingress`` and ``egress`` cannot be disabled. 3467 3468While not specifying a direction is an error, some rules may allow both 3469simultaneously. 3470 3471Most rules affect RX therefore contain the ``ingress`` token:: 3472 3473 testpmd> flow create 0 ingress pattern [...] 3474 3475Tunnel offload 3476^^^^^^^^^^^^^^ 3477 3478Indicate tunnel offload rule type 3479 3480- ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type. 3481- ``tunnel_match {tunnel_id}``: mark rule as tunnel offload match type. 3482 3483Matching pattern 3484^^^^^^^^^^^^^^^^ 3485 3486A matching pattern starts after the ``pattern`` token. It is made of pattern 3487items and is terminated by a mandatory ``end`` item. 3488 3489Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum 3490rte_flow_item_type``). 3491 3492The ``/`` token is used as a separator between pattern items as shown 3493below:: 3494 3495 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...] 3496 3497Note that protocol items like these must be stacked from lowest to highest 3498layer to make sense. For instance, the following rule is either invalid or 3499unlikely to match any packet:: 3500 3501 testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...] 3502 3503More information on these restrictions can be found in the *rte_flow* 3504documentation. 3505 3506Several items support additional specification structures, for example 3507``ipv4`` allows specifying source and destination addresses as follows:: 3508 3509 testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1 3510 dst is 10.2.0.0 / end [...] 3511 3512This rule matches all IPv4 traffic with the specified properties. 3513 3514In this example, ``src`` and ``dst`` are field names of the underlying 3515``struct rte_flow_item_ipv4`` object. All item properties can be specified 3516in a similar fashion. 3517 3518The ``is`` token means that the subsequent value must be matched exactly, 3519and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item`` 3520accordingly. Possible assignment tokens are: 3521 3522- ``is``: match value perfectly (with full bit-mask). 3523- ``spec``: match value according to configured bit-mask. 3524- ``last``: specify upper bound to establish a range. 3525- ``mask``: specify bit-mask with relevant bits set to one. 3526- ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one. 3527 3528These yield identical results:: 3529 3530 ipv4 src is 10.1.1.1 3531 3532:: 3533 3534 ipv4 src spec 10.1.1.1 src mask 255.255.255.255 3535 3536:: 3537 3538 ipv4 src spec 10.1.1.1 src prefix 32 3539 3540:: 3541 3542 ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value 3543 3544:: 3545 3546 ipv4 src is 10.1.1.1 src last 0 # 0 disables range 3547 3548Inclusive ranges can be defined with ``last``:: 3549 3550 ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4 3551 3552Note that ``mask`` affects both ``spec`` and ``last``:: 3553 3554 ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0 3555 # matches 10.1.0.0 to 10.2.255.255 3556 3557Properties can be modified multiple times:: 3558 3559 ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4 3560 3561:: 3562 3563 ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16 3564 3565Pattern items 3566^^^^^^^^^^^^^ 3567 3568This section lists supported pattern items and their attributes, if any. 3569 3570- ``end``: end list of pattern items. 3571 3572- ``void``: no-op pattern item. 3573 3574- ``invert``: perform actions when pattern does not match. 3575 3576- ``any``: match any protocol for the current layer. 3577 3578 - ``num {unsigned}``: number of layers covered. 3579 3580- ``port_id``: match traffic from/to a given DPDK port ID. 3581 3582 - ``id {unsigned}``: DPDK port ID. 3583 3584- ``mark``: match value set in previously matched flow rule using the mark action. 3585 3586 - ``id {unsigned}``: arbitrary integer value. 3587 3588- ``raw``: match an arbitrary byte string. 3589 3590 - ``relative {boolean}``: look for pattern after the previous item. 3591 - ``search {boolean}``: search pattern from offset (see also limit). 3592 - ``offset {integer}``: absolute or relative offset for pattern. 3593 - ``limit {unsigned}``: search area limit for start of pattern. 3594 - ``pattern {string}``: byte string to look for. 3595 - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for. 3596 3597- ``eth``: match Ethernet header. 3598 3599 - ``dst {MAC-48}``: destination MAC. 3600 - ``src {MAC-48}``: source MAC. 3601 - ``type {unsigned}``: EtherType or TPID. 3602 3603- ``vlan``: match 802.1Q/ad VLAN tag. 3604 3605 - ``tci {unsigned}``: tag control information. 3606 - ``pcp {unsigned}``: priority code point. 3607 - ``dei {unsigned}``: drop eligible indicator. 3608 - ``vid {unsigned}``: VLAN identifier. 3609 - ``inner_type {unsigned}``: inner EtherType or TPID. 3610 3611- ``ipv4``: match IPv4 header. 3612 3613 - ``version_ihl {unsigned}``: IPv4 version and IP header length. 3614 - ``tos {unsigned}``: type of service. 3615 - ``ttl {unsigned}``: time to live. 3616 - ``proto {unsigned}``: next protocol ID. 3617 - ``src {ipv4 address}``: source address. 3618 - ``dst {ipv4 address}``: destination address. 3619 3620- ``ipv6``: match IPv6 header. 3621 3622 - ``tc {unsigned}``: traffic class. 3623 - ``flow {unsigned}``: flow label. 3624 - ``proto {unsigned}``: protocol (next header). 3625 - ``hop {unsigned}``: hop limit. 3626 - ``src {ipv6 address}``: source address. 3627 - ``dst {ipv6 address}``: destination address. 3628 3629- ``icmp``: match ICMP header. 3630 3631 - ``type {unsigned}``: ICMP packet type. 3632 - ``code {unsigned}``: ICMP packet code. 3633 3634- ``udp``: match UDP header. 3635 3636 - ``src {unsigned}``: UDP source port. 3637 - ``dst {unsigned}``: UDP destination port. 3638 3639- ``tcp``: match TCP header. 3640 3641 - ``src {unsigned}``: TCP source port. 3642 - ``dst {unsigned}``: TCP destination port. 3643 3644- ``sctp``: match SCTP header. 3645 3646 - ``src {unsigned}``: SCTP source port. 3647 - ``dst {unsigned}``: SCTP destination port. 3648 - ``tag {unsigned}``: validation tag. 3649 - ``cksum {unsigned}``: checksum. 3650 3651- ``vxlan``: match VXLAN header. 3652 3653 - ``vni {unsigned}``: VXLAN identifier. 3654 - ``last_rsvd {unsigned}``: VXLAN last reserved 8-bits. 3655 3656- ``e_tag``: match IEEE 802.1BR E-Tag header. 3657 3658 - ``grp_ecid_b {unsigned}``: GRP and E-CID base. 3659 3660- ``nvgre``: match NVGRE header. 3661 3662 - ``tni {unsigned}``: virtual subnet ID. 3663 3664- ``mpls``: match MPLS header. 3665 3666 - ``label {unsigned}``: MPLS label. 3667 3668- ``gre``: match GRE header. 3669 3670 - ``protocol {unsigned}``: protocol type. 3671 3672- ``gre_key``: match GRE optional key field. 3673 3674 - ``value {unsigned}``: key value. 3675 3676- ``gre_option``: match GRE optional fields(checksum/key/sequence). 3677 3678 - ``checksum {unsigned}``: checksum value. 3679 - ``key {unsigned}``: key value. 3680 - ``sequence {unsigned}``: sequence number value. 3681 3682- ``fuzzy``: fuzzy pattern match, expect faster than default. 3683 3684 - ``thresh {unsigned}``: accuracy threshold. 3685 3686- ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header. 3687 3688 - ``teid {unsigned}``: tunnel endpoint identifier. 3689 3690- ``geneve``: match GENEVE header. 3691 3692 - ``vni {unsigned}``: virtual network identifier. 3693 - ``protocol {unsigned}``: protocol type. 3694 3695- ``geneve-opt``: match GENEVE header option. 3696 3697 - ``class {unsigned}``: GENEVE option class. 3698 - ``type {unsigned}``: GENEVE option type. 3699 - ``length {unsigned}``: GENEVE option length in 32-bit words. 3700 - ``data {hex string}``: GENEVE option data, the length is defined by 3701 ``length`` field. 3702 3703- ``vxlan-gpe``: match VXLAN-GPE header. 3704 3705 - ``vni {unsigned}``: VXLAN-GPE identifier. 3706 3707- ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4. 3708 3709 - ``sha {MAC-48}``: sender hardware address. 3710 - ``spa {ipv4 address}``: sender IPv4 address. 3711 - ``tha {MAC-48}``: target hardware address. 3712 - ``tpa {ipv4 address}``: target IPv4 address. 3713 3714- ``ipv6_ext``: match presence of any IPv6 extension header. 3715 3716 - ``next_hdr {unsigned}``: next header. 3717 3718- ``icmp6``: match any ICMPv6 header. 3719 3720 - ``type {unsigned}``: ICMPv6 type. 3721 - ``code {unsigned}``: ICMPv6 code. 3722 3723- ``icmp6_echo_request``: match ICMPv6 echo request. 3724 3725 - ``ident {unsigned}``: ICMPv6 echo request identifier. 3726 - ``seq {unsigned}``: ICMPv6 echo request sequence number. 3727 3728- ``icmp6_echo_reply``: match ICMPv6 echo reply. 3729 3730 - ``ident {unsigned}``: ICMPv6 echo reply identifier. 3731 - ``seq {unsigned}``: ICMPv6 echo reply sequence number. 3732 3733- ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation. 3734 3735 - ``target_addr {ipv6 address}``: target address. 3736 3737- ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement. 3738 3739 - ``target_addr {ipv6 address}``: target address. 3740 3741- ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option. 3742 3743 - ``type {unsigned}``: ND option type. 3744 3745- ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet 3746 link-layer address option. 3747 3748 - ``sla {MAC-48}``: source Ethernet LLA. 3749 3750- ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet 3751 link-layer address option. 3752 3753 - ``tla {MAC-48}``: target Ethernet LLA. 3754 3755- ``meta``: match application specific metadata. 3756 3757 - ``data {unsigned}``: metadata value. 3758 3759- ``gtp_psc``: match GTP PDU extension header with type 0x85. 3760 3761 - ``pdu_type {unsigned}``: PDU type. 3762 3763 - ``qfi {unsigned}``: QoS flow identifier. 3764 3765- ``pppoes``, ``pppoed``: match PPPoE header. 3766 3767 - ``session_id {unsigned}``: session identifier. 3768 3769- ``pppoe_proto_id``: match PPPoE session protocol identifier. 3770 3771 - ``proto_id {unsigned}``: PPP protocol identifier. 3772 3773- ``l2tpv3oip``: match L2TPv3 over IP header. 3774 3775 - ``session_id {unsigned}``: L2TPv3 over IP session identifier. 3776 3777- ``ah``: match AH header. 3778 3779 - ``spi {unsigned}``: security parameters index. 3780 3781- ``pfcp``: match PFCP header. 3782 3783 - ``s_field {unsigned}``: S field. 3784 - ``seid {unsigned}``: session endpoint identifier. 3785 3786- ``integrity``: match packet integrity. 3787 3788 - ``level {unsigned}``: Packet encapsulation level the item should 3789 apply to. See rte_flow_action_rss for details. 3790 - ``value {unsigned}``: A bitmask that specify what packet elements 3791 must be matched for integrity. 3792 3793- ``conntrack``: match conntrack state. 3794 3795- ``port_representor``: match traffic entering the embedded switch from the given ethdev 3796 3797 - ``port_id {unsigned}``: ethdev port ID 3798 3799- ``represented_port``: match traffic entering the embedded switch from 3800 the entity represented by the given ethdev 3801 3802 - ``ethdev_port_id {unsigned}``: ethdev port ID 3803 3804- ``l2tpv2``: match L2TPv2 header. 3805 3806 - ``length {unsigned}``: L2TPv2 option length. 3807 - ``tunnel_id {unsigned}``: L2TPv2 tunnel identifier. 3808 - ``session_id {unsigned}``: L2TPv2 session identifier. 3809 - ``ns {unsigned}``: L2TPv2 option ns. 3810 - ``nr {unsigned}``: L2TPv2 option nr. 3811 - ``offset_size {unsigned}``: L2TPv2 option offset. 3812 3813- ``ppp``: match PPP header. 3814 3815 - ``addr {unsigned}``: PPP address. 3816 - ``ctrl {unsigned}``: PPP control. 3817 - ``proto_id {unsigned}``: PPP protocol identifier. 3818 3819- ``ib_bth``: match InfiniBand BTH(base transport header). 3820 3821 - ``opcode {unsigned}``: Opcode. 3822 - ``pkey {unsigned}``: Partition key. 3823 - ``dst_qp {unsigned}``: Destination Queue Pair. 3824 - ``psn {unsigned}``: Packet Sequence Number. 3825 3826- ``meter``: match meter color. 3827 3828 - ``color {value}``: meter color value (green/yellow/red). 3829 3830- ``aggr_affinity``: match aggregated port. 3831 3832 - ``affinity {value}``: aggregated port (starts from 1). 3833 3834- ``tx_queue``: match Tx queue of sent packet. 3835 3836 - ``tx_queue {value}``: send queue value (starts from 0). 3837 3838- ``send_to_kernel``: send packets to kernel. 3839 3840- ``ptype``: match the packet type (L2/L3/L4 and tunnel information). 3841 3842 - ``packet_type {unsigned}``: packet type. 3843 3844 3845Actions list 3846^^^^^^^^^^^^ 3847 3848A list of actions starts after the ``actions`` token in the same fashion as 3849`Matching pattern`_; actions are separated by ``/`` tokens and the list is 3850terminated by a mandatory ``end`` action. 3851 3852Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum 3853rte_flow_action_type``). 3854 3855Dropping all incoming UDPv4 packets can be expressed as follows:: 3856 3857 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end 3858 actions drop / end 3859 3860Several actions have configurable properties which must be specified when 3861there is no valid default value. For example, ``queue`` requires a target 3862queue index. 3863 3864This rule redirects incoming UDPv4 traffic to queue index 6:: 3865 3866 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end 3867 actions queue index 6 / end 3868 3869While this one could be rejected by PMDs (unspecified queue index):: 3870 3871 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end 3872 actions queue / end 3873 3874As defined by *rte_flow*, the list is not ordered, all actions of a given 3875rule are performed simultaneously. These are equivalent:: 3876 3877 queue index 6 / void / mark id 42 / end 3878 3879:: 3880 3881 void / mark id 42 / queue index 6 / end 3882 3883All actions in a list should have different types, otherwise only the last 3884action of a given type is taken into account:: 3885 3886 queue index 4 / queue index 5 / queue index 6 / end # will use queue 6 3887 3888:: 3889 3890 drop / drop / drop / end # drop is performed only once 3891 3892:: 3893 3894 mark id 42 / queue index 3 / mark id 24 / end # mark will be 24 3895 3896Considering they are performed simultaneously, opposite and overlapping 3897actions can sometimes be combined when the end result is unambiguous:: 3898 3899 drop / queue index 6 / end # drop has no effect 3900 3901:: 3902 3903 queue index 6 / rss queues 6 7 8 / end # queue has no effect 3904 3905:: 3906 3907 drop / passthru / end # drop has no effect 3908 3909Note that PMDs may still refuse such combinations. 3910 3911Actions 3912^^^^^^^ 3913 3914This section lists supported actions and their attributes, if any. 3915 3916- ``end``: end list of actions. 3917 3918- ``void``: no-op action. 3919 3920- ``passthru``: let subsequent rule process matched packets. 3921 3922- ``jump``: redirect traffic to group on device. 3923 3924 - ``group {unsigned}``: group to redirect to. 3925 3926- ``mark``: attach 32 bit value to packets. 3927 3928 - ``id {unsigned}``: 32 bit value to return with packets. 3929 3930- ``flag``: flag packets. 3931 3932- ``queue``: assign packets to a given queue index. 3933 3934 - ``index {unsigned}``: queue index to use. 3935 3936- ``drop``: drop packets (note: passthru has priority). 3937 3938- ``count``: enable counters for this rule. 3939 3940- ``rss``: spread packets among several queues. 3941 3942 - ``func {hash function}``: RSS hash function to apply, allowed tokens are 3943 ``toeplitz``, ``simple_xor``, ``symmetric_toeplitz`` and ``default``. 3944 3945 - ``level {unsigned}``: encapsulation level for ``types``. 3946 3947 - ``types [{RSS hash type} [...]] end``: specific RSS hash types. 3948 Note that an empty list does not disable RSS but instead requests 3949 unspecified "best-effort" settings. 3950 3951 - ``key {string}``: RSS hash key, overrides ``key_len``. 3952 3953 - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in 3954 conjunction with ``key`` to pad or truncate it. 3955 3956 - ``queues [{unsigned} [...]] end``: queue indices to use. 3957 3958- ``pf``: direct traffic to physical function. 3959 3960- ``vf``: direct traffic to a virtual function ID. 3961 3962 - ``original {boolean}``: use original VF ID if possible. 3963 - ``id {unsigned}``: VF ID. 3964 3965- ``port_id``: direct matching traffic to a given DPDK port ID. 3966 3967 - ``original {boolean}``: use original DPDK port ID if possible. 3968 - ``id {unsigned}``: DPDK port ID. 3969 3970- ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``. 3971 3972 - ``mpls_ttl``: MPLS TTL. 3973 3974- ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``. 3975 3976- ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``. 3977 3978 - ``nw_ttl``: IP TTL. 3979 3980- ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``. 3981 3982- ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``. 3983 3984- ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``. 3985 3986- ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``. 3987 3988- ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``. 3989 3990 - ``ethertype``: Ethertype. 3991 3992- ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``. 3993 3994 - ``vlan_vid``: VLAN id. 3995 3996- ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``. 3997 3998 - ``vlan_pcp``: VLAN priority. 3999 4000- ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``. 4001 4002 - ``ethertype``: Ethertype. 4003 4004- ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``. 4005 4006 - ``ethertype``: Ethertype. 4007 4008- ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration 4009 is done through `Config VXLAN Encap outer layers`_. 4010 4011- ``vxlan_decap``: Performs a decapsulation action by stripping all headers of 4012 the VXLAN tunnel network overlay from the matched flow. 4013 4014- ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration 4015 is done through `Config NVGRE Encap outer layers`_. 4016 4017- ``nvgre_decap``: Performs a decapsulation action by stripping all headers of 4018 the NVGRE tunnel network overlay from the matched flow. 4019 4020- ``l2_encap``: Performs a L2 encapsulation, L2 configuration 4021 is done through `Config L2 Encap`_. 4022 4023- ``l2_decap``: Performs a L2 decapsulation, L2 configuration 4024 is done through `Config L2 Decap`_. 4025 4026- ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer 4027 configuration is done through `Config MPLSoGRE Encap outer layers`_. 4028 4029- ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer 4030 configuration is done through `Config MPLSoGRE Decap outer layers`_. 4031 4032- ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer 4033 configuration is done through `Config MPLSoUDP Encap outer layers`_. 4034 4035- ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer 4036 configuration is done through `Config MPLSoUDP Decap outer layers`_. 4037 4038- ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header. 4039 4040 - ``ipv4_addr``: New IPv4 source address. 4041 4042- ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4 4043 header. 4044 4045 - ``ipv4_addr``: New IPv4 destination address. 4046 4047- ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header. 4048 4049 - ``ipv6_addr``: New IPv6 source address. 4050 4051- ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6 4052 header. 4053 4054 - ``ipv6_addr``: New IPv6 destination address. 4055 4056- ``set_tp_src``: Set a new source port number in the outermost TCP/UDP 4057 header. 4058 4059 - ``port``: New TCP/UDP source port number. 4060 4061- ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP 4062 header. 4063 4064 - ``port``: New TCP/UDP destination port number. 4065 4066- ``mac_swap``: Swap the source and destination MAC addresses in the outermost 4067 Ethernet header. 4068 4069- ``dec_ttl``: Performs a decrease TTL value action 4070 4071- ``set_ttl``: Set TTL value with specified value 4072 - ``ttl_value {unsigned}``: The new TTL value to be set 4073 4074- ``set_mac_src``: set source MAC address 4075 4076 - ``mac_addr {MAC-48}``: new source MAC address 4077 4078- ``set_mac_dst``: set destination MAC address 4079 4080 - ``mac_addr {MAC-48}``: new destination MAC address 4081 4082- ``inc_tcp_seq``: Increase sequence number in the outermost TCP header. 4083 4084 - ``value {unsigned}``: Value to increase TCP sequence number by. 4085 4086- ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header. 4087 4088 - ``value {unsigned}``: Value to decrease TCP sequence number by. 4089 4090- ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header. 4091 4092 - ``value {unsigned}``: Value to increase TCP acknowledgment number by. 4093 4094- ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header. 4095 4096 - ``value {unsigned}``: Value to decrease TCP acknowledgment number by. 4097 4098- ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value 4099 4100 - ``dscp_value {unsigned}``: The new DSCP value to be set 4101 4102- ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value 4103 4104 - ``dscp_value {unsigned}``: The new DSCP value to be set 4105 4106- ``indirect``: Use indirect action created via 4107 ``flow indirect_action {port_id} create`` 4108 4109 - ``indirect_action_id {unsigned}``: Indirect action ID to use 4110 4111- ``color``: Color the packet to reflect the meter color result 4112 4113 - ``type {value}``: Set color type with specified value(green/yellow/red) 4114 4115- ``port_representor``: at embedded switch level, send matching traffic to 4116 the given ethdev 4117 4118 - ``port_id {unsigned}``: ethdev port ID 4119 4120- ``represented_port``: at embedded switch level, send matching traffic to 4121 the entity represented by the given ethdev 4122 4123 - ``ethdev_port_id {unsigned}``: ethdev port ID 4124 4125- ``meter_mark``: meter the directed packets using profile and policy 4126 4127 - ``mtr_profile {unsigned}``: meter profile ID to use 4128 - ``mtr_policy {unsigned}``: meter policy ID to use 4129 - ``mtr_color_mode {unsigned}``: meter color-awareness mode (blind/aware) 4130 - ``mtr_init_color {value}``: initial color value (green/yellow/red) 4131 - ``mtr_state {unsigned}``: meter state (disabled/enabled) 4132 4133- ``modify_field``: Modify packet field 4134 4135 - ``op``: modify operation (set/add/sub) 4136 - ``dst_type``: the destination field to be modified, the supported fields as 4137 ``enum rte_flow_field_id`` listed. 4138 - ``dst_level``: destination field level. 4139 - ``dst_tag_index``: destination field tag array. 4140 - ``dst_type_id``: destination field type ID. 4141 - ``dst_class``: destination field class ID. 4142 - ``dst_offset``: destination field bit offset. 4143 - ``src_type``: the modify source field, the supported fields as 4144 ``enum rte_flow_field_id`` listed. 4145 - ``src_level``: source field level. 4146 - ``src_tag_index``: source field tag array. 4147 - ``src_type_id``: source field type ID. 4148 - ``src_class``: source field class ID. 4149 - ``src_offset``: source field bit offset. 4150 - ``src_value``: source immediate value. 4151 - ``src_ptr``: pointer to source immediate value. 4152 - ``width``: number of bits to copy. 4153 4154Destroying flow rules 4155~~~~~~~~~~~~~~~~~~~~~ 4156 4157``flow destroy`` destroys one or more rules from their rule ID (as returned 4158by ``flow create``), this command calls ``rte_flow_destroy()`` as many 4159times as necessary:: 4160 4161 flow destroy {port_id} rule {rule_id} [...] [user_id] 4162 4163If successful, it will show:: 4164 4165 Flow rule #[...] destroyed 4166 4167Or if ``user_id`` flag is provided:: 4168 4169 Flow rule #[...] destroyed, user-id [...] 4170 4171Optional ``user_id`` is a flag that signifies the rule ID 4172is the one provided by the user at creation. 4173It does not report anything for rule IDs that do not exist. The usual error 4174message is shown when a rule cannot be destroyed:: 4175 4176 Caught error type [...] ([...]): [...] 4177 4178``flow flush`` destroys all rules on a device and does not take extra 4179arguments. It is bound to ``rte_flow_flush()``:: 4180 4181 flow flush {port_id} 4182 4183Any errors are reported as above. 4184 4185Creating several rules and destroying them:: 4186 4187 testpmd> flow create 0 ingress pattern eth / ipv6 / end 4188 actions queue index 2 / end 4189 Flow rule #0 created 4190 testpmd> flow create 0 ingress pattern eth / ipv4 / end 4191 actions queue index 3 / end 4192 Flow rule #1 created 4193 testpmd> flow destroy 0 rule 0 rule 1 4194 Flow rule #1 destroyed 4195 Flow rule #0 destroyed 4196 testpmd> 4197 4198The same result can be achieved using ``flow flush``:: 4199 4200 testpmd> flow create 0 ingress pattern eth / ipv6 / end 4201 actions queue index 2 / end 4202 Flow rule #0 created 4203 testpmd> flow create 0 ingress pattern eth / ipv4 / end 4204 actions queue index 3 / end 4205 Flow rule #1 created 4206 testpmd> flow flush 0 4207 testpmd> 4208 4209Non-existent rule IDs are ignored:: 4210 4211 testpmd> flow create 0 ingress pattern eth / ipv6 / end 4212 actions queue index 2 / end 4213 Flow rule #0 created 4214 testpmd> flow create 0 ingress pattern eth / ipv4 / end 4215 actions queue index 3 / end 4216 Flow rule #1 created 4217 testpmd> flow destroy 0 rule 42 rule 10 rule 2 4218 testpmd> 4219 testpmd> flow destroy 0 rule 0 4220 Flow rule #0 destroyed 4221 testpmd> 4222 4223Enqueueing destruction of flow rules 4224~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4225 4226``flow queue destroy`` adds destruction operations to destroy one or more rules 4227from their rule ID (as returned by ``flow queue create``) to a queue, 4228this command calls ``rte_flow_async_destroy()`` as many times as necessary:: 4229 4230 flow queue {port_id} destroy {queue_id} 4231 [postpone {boolean}] rule {rule_id} [...] 4232 4233If successful, it will show:: 4234 4235 Flow rule #[...] destruction enqueued 4236 4237It does not report anything for rule IDs that do not exist. The usual error 4238message is shown when a rule cannot be destroyed:: 4239 4240 Caught error type [...] ([...]): [...] 4241 4242``flow queue pull`` must be called to retrieve the operation status. 4243 4244Querying flow rules 4245~~~~~~~~~~~~~~~~~~~ 4246 4247``flow query`` queries a specific action of a flow rule having that 4248ability. Such actions collect information that can be reported using this 4249command. It is bound to ``rte_flow_query()``:: 4250 4251 flow query {port_id} {rule_id} {action} [user_id] 4252 4253Optional ``user_id`` is a flag that signifies the rule ID 4254is the one provided by the user at creation. 4255If successful, it will display either the retrieved data for known actions 4256or the following message:: 4257 4258 Cannot display result for action type [...] ([...]) 4259 4260Otherwise, it will complain either that the rule does not exist or that some 4261error occurred:: 4262 4263 Flow rule #[...] not found 4264 4265:: 4266 4267 Caught error type [...] ([...]): [...] 4268 4269Currently only the ``count`` action is supported. This action reports the 4270number of packets that hit the flow rule and the total number of bytes. Its 4271output has the following format:: 4272 4273 count: 4274 hits_set: [...] # whether "hits" contains a valid value 4275 bytes_set: [...] # whether "bytes" contains a valid value 4276 hits: [...] # number of packets 4277 bytes: [...] # number of bytes 4278 4279Querying counters for TCPv6 packets redirected to queue 6:: 4280 4281 testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end 4282 actions queue index 6 / count / end 4283 Flow rule #4 created 4284 testpmd> flow query 0 4 count 4285 count: 4286 hits_set: 1 4287 bytes_set: 0 4288 hits: 386446 4289 bytes: 0 4290 testpmd> 4291 4292Listing flow rules 4293~~~~~~~~~~~~~~~~~~ 4294 4295``flow list`` lists existing flow rules sorted by priority and optionally 4296filtered by group identifiers:: 4297 4298 flow list {port_id} [group {group_id}] [...] 4299 4300This command only fails with the following message if the device does not 4301exist:: 4302 4303 Invalid port [...] 4304 4305Output consists of a header line followed by a short description of each 4306flow rule, one per line. There is no output at all when no flow rules are 4307configured on the device:: 4308 4309 ID Group Prio Attr Rule 4310 [...] [...] [...] [...] [...] 4311 4312``Attr`` column flags: 4313 4314- ``i`` for ``ingress``. 4315- ``e`` for ``egress``. 4316 4317Creating several flow rules and listing them:: 4318 4319 testpmd> flow create 0 ingress pattern eth / ipv4 / end 4320 actions queue index 6 / end 4321 Flow rule #0 created 4322 testpmd> flow create 0 ingress pattern eth / ipv6 / end 4323 actions queue index 2 / end 4324 Flow rule #1 created 4325 testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end 4326 actions rss queues 6 7 8 end / end 4327 Flow rule #2 created 4328 testpmd> flow list 0 4329 ID Group Prio Attr Rule 4330 0 0 0 i- ETH IPV4 => QUEUE 4331 1 0 0 i- ETH IPV6 => QUEUE 4332 2 0 5 i- ETH IPV4 UDP => RSS 4333 testpmd> 4334 4335Rules are sorted by priority (i.e. group ID first, then priority level):: 4336 4337 testpmd> flow list 1 4338 ID Group Prio Attr Rule 4339 0 0 0 i- ETH => COUNT 4340 6 0 500 i- ETH IPV6 TCP => DROP COUNT 4341 5 0 1000 i- ETH IPV6 ICMP => QUEUE 4342 1 24 0 i- ETH IPV4 UDP => QUEUE 4343 4 24 10 i- ETH IPV4 TCP => DROP 4344 3 24 20 i- ETH IPV4 => DROP 4345 2 24 42 i- ETH IPV4 UDP => QUEUE 4346 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE 4347 testpmd> 4348 4349Output can be limited to specific groups:: 4350 4351 testpmd> flow list 1 group 0 group 63 4352 ID Group Prio Attr Rule 4353 0 0 0 i- ETH => COUNT 4354 6 0 500 i- ETH IPV6 TCP => DROP COUNT 4355 5 0 1000 i- ETH IPV6 ICMP => QUEUE 4356 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE 4357 testpmd> 4358 4359Toggling isolated mode 4360~~~~~~~~~~~~~~~~~~~~~~ 4361 4362``flow isolate`` can be used to tell the underlying PMD that ingress traffic 4363must only be injected from the defined flow rules; that no default traffic 4364is expected outside those rules and the driver is free to assign more 4365resources to handle them. It is bound to ``rte_flow_isolate()``:: 4366 4367 flow isolate {port_id} {boolean} 4368 4369If successful, enabling or disabling isolated mode shows either:: 4370 4371 Ingress traffic on port [...] 4372 is now restricted to the defined flow rules 4373 4374Or:: 4375 4376 Ingress traffic on port [...] 4377 is not restricted anymore to the defined flow rules 4378 4379Otherwise, in case of error:: 4380 4381 Caught error type [...] ([...]): [...] 4382 4383Mainly due to its side effects, PMDs supporting this mode may not have the 4384ability to toggle it more than once without reinitializing affected ports 4385first (e.g. by exiting testpmd). 4386 4387Enabling isolated mode:: 4388 4389 testpmd> flow isolate 0 true 4390 Ingress traffic on port 0 is now restricted to the defined flow rules 4391 testpmd> 4392 4393Disabling isolated mode:: 4394 4395 testpmd> flow isolate 0 false 4396 Ingress traffic on port 0 is not restricted anymore to the defined flow rules 4397 testpmd> 4398 4399Dumping HW internal information 4400~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4401 4402``flow dump`` dumps the hardware's internal representation information of 4403all flows. It is bound to ``rte_flow_dev_dump()``:: 4404 4405 flow dump {port_id} {output_file} [user_id] 4406 4407If successful, it will show:: 4408 4409 Flow dump finished 4410 4411Otherwise, it will complain error occurred:: 4412 4413 Caught error type [...] ([...]): [...] 4414 4415Optional ``user_id`` is a flag that signifies the rule ID 4416is the one provided by the user at creation. 4417 4418Listing and destroying aged flow rules 4419~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4420 4421``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``, 4422and ``destroy`` parameter can be used to destroy those flow rules in PMD:: 4423 4424 flow aged {port_id} [destroy] 4425 4426Listing current aged flow rules:: 4427 4428 testpmd> flow aged 0 4429 Port 0 total aged flows: 0 4430 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.14 / end 4431 actions age timeout 5 / queue index 0 / end 4432 Flow rule #0 created 4433 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.15 / end 4434 actions age timeout 4 / queue index 0 / end 4435 Flow rule #1 created 4436 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.16 / end 4437 actions age timeout 2 / queue index 0 / end 4438 Flow rule #2 created 4439 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.17 / end 4440 actions age timeout 3 / queue index 0 / end 4441 Flow rule #3 created 4442 4443 4444Aged Rules are simply list as command ``flow list {port_id}``, but strip the detail rule 4445information, all the aged flows are sorted by the longest timeout time. For example, if 4446those rules be configured in the same time, ID 2 will be the first aged out rule, the next 4447will be ID 3, ID 1, ID 0:: 4448 4449 testpmd> flow aged 0 4450 Port 0 total aged flows: 4 4451 ID Group Prio Attr 4452 2 0 0 i-- 4453 3 0 0 i-- 4454 1 0 0 i-- 4455 0 0 0 i-- 4456 4457If attach ``destroy`` parameter, the command will destroy all the list aged flow rules:: 4458 4459 testpmd> flow aged 0 destroy 4460 Port 0 total aged flows: 4 4461 ID Group Prio Attr 4462 2 0 0 i-- 4463 3 0 0 i-- 4464 1 0 0 i-- 4465 0 0 0 i-- 4466 4467 Flow rule #2 destroyed 4468 Flow rule #3 destroyed 4469 Flow rule #1 destroyed 4470 Flow rule #0 destroyed 4471 4 flows be destroyed 4472 testpmd> flow aged 0 4473 Port 0 total aged flows: 0 4474 4475 4476Enqueueing listing and destroying aged flow rules 4477~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4478 4479``flow queue aged`` simply lists aged flow rules be get from 4480``rte_flow_get_q_aged_flows`` API, and ``destroy`` parameter can be used to 4481destroy those flow rules in PMD:: 4482 4483 flow queue {port_id} aged {queue_id} [destroy] 4484 4485Listing current aged flow rules:: 4486 4487 testpmd> flow queue 0 aged 0 4488 Port 0 queue 0 total aged flows: 0 4489 testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0 4490 pattern eth / ipv4 src is 2.2.2.14 / end 4491 actions age timeout 5 / queue index 0 / end 4492 Flow rule #0 creation enqueued 4493 testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0 4494 pattern eth / ipv4 src is 2.2.2.15 / end 4495 actions age timeout 4 / queue index 0 / end 4496 Flow rule #1 creation enqueued 4497 testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0 4498 pattern eth / ipv4 src is 2.2.2.16 / end 4499 actions age timeout 4 / queue index 0 / end 4500 Flow rule #2 creation enqueued 4501 testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0 4502 pattern eth / ipv4 src is 2.2.2.17 / end 4503 actions age timeout 4 / queue index 0 / end 4504 Flow rule #3 creation enqueued 4505 testpmd> flow pull 0 queue 0 4506 Queue #0 pulled 4 operations (0 failed, 4 succeeded) 4507 4508Aged Rules are simply list as command ``flow queue {port_id} list {queue_id}``, 4509but strip the detail rule information, all the aged flows are sorted by the 4510longest timeout time. For example, if those rules is configured in the same time, 4511ID 2 will be the first aged out rule, the next will be ID 3, ID 1, ID 0:: 4512 4513 testpmd> flow queue 0 aged 0 4514 Port 0 queue 0 total aged flows: 4 4515 ID Group Prio Attr 4516 2 0 0 --- 4517 3 0 0 --- 4518 1 0 0 --- 4519 0 0 0 --- 4520 4521 0 flows destroyed 4522 4523If attach ``destroy`` parameter, the command will destroy all the list aged flow rules:: 4524 4525 testpmd> flow queue 0 aged 0 destroy 4526 Port 0 queue 0 total aged flows: 4 4527 ID Group Prio Attr 4528 2 0 0 --- 4529 3 0 0 --- 4530 1 0 0 --- 4531 0 0 0 --- 4532 Flow rule #2 destruction enqueued 4533 Flow rule #3 destruction enqueued 4534 Flow rule #1 destruction enqueued 4535 Flow rule #0 destruction enqueued 4536 4537 4 flows destroyed 4538 testpmd> flow queue 0 aged 0 4539 Port 0 total aged flows: 0 4540 4541.. note:: 4542 4543 The queue must be empty before attaching ``destroy`` parameter. 4544 4545 4546Creating indirect actions 4547~~~~~~~~~~~~~~~~~~~~~~~~~ 4548 4549``flow indirect_action {port_id} create`` creates indirect action with optional 4550indirect action ID. It is bound to ``rte_flow_action_handle_create()``:: 4551 4552 flow indirect_action {port_id} create [action_id {indirect_action_id}] 4553 [ingress] [egress] [transfer] action {action} / end 4554 4555If successful, it will show:: 4556 4557 Indirect action #[...] created 4558 4559Otherwise, it will complain either that indirect action already exists or that 4560some error occurred:: 4561 4562 Indirect action #[...] is already assigned, delete it first 4563 4564:: 4565 4566 Caught error type [...] ([...]): [...] 4567 4568Create indirect rss action with id 100 to queues 1 and 2 on port 0:: 4569 4570 testpmd> flow indirect_action 0 create action_id 100 \ 4571 ingress action rss queues 1 2 end / end 4572 4573Create indirect rss action with id assigned by testpmd to queues 1 and 2 on 4574port 0:: 4575 4576 testpmd> flow indirect_action 0 create action_id \ 4577 ingress action rss queues 0 1 end / end 4578 4579Enqueueing creation of indirect actions 4580~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4581 4582``flow queue indirect_action create`` adds creation operation of an indirect 4583action to a queue. It is bound to ``rte_flow_async_action_handle_create()``:: 4584 4585 flow queue {port_id} create {queue_id} [postpone {boolean}] 4586 table {table_id} item_template {item_template_id} 4587 action_template {action_template_id} 4588 pattern {item} [/ {item} [...]] / end 4589 actions {action} [/ {action} [...]] / end 4590 4591If successful, it will show:: 4592 4593 Indirect action #[...] creation queued 4594 4595Otherwise it will show an error message of the form:: 4596 4597 Caught error type [...] ([...]): [...] 4598 4599This command uses the same parameters as ``flow indirect_action create``, 4600described in `Creating indirect actions`_. 4601 4602``flow queue pull`` must be called to retrieve the operation status. 4603 4604Updating indirect actions 4605~~~~~~~~~~~~~~~~~~~~~~~~~ 4606 4607``flow indirect_action {port_id} update`` updates configuration of the indirect 4608action from its indirect action ID (as returned by 4609``flow indirect_action {port_id} create``). It is bound to 4610``rte_flow_action_handle_update()``:: 4611 4612 flow indirect_action {port_id} update {indirect_action_id} 4613 action {action} / end 4614 4615If successful, it will show:: 4616 4617 Indirect action #[...] updated 4618 4619Otherwise, it will complain either that indirect action not found or that some 4620error occurred:: 4621 4622 Failed to find indirect action #[...] on port [...] 4623 4624:: 4625 4626 Caught error type [...] ([...]): [...] 4627 4628Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3 4629(in create example above rss queues were 1 and 2):: 4630 4631 testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end 4632 4633Enqueueing update of indirect actions 4634~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4635 4636``flow queue indirect_action update`` adds update operation for an indirect 4637action to a queue. It is bound to ``rte_flow_async_action_handle_update()``:: 4638 4639 flow queue {port_id} indirect_action {queue_id} update 4640 {indirect_action_id} [postpone {boolean}] action {action} / end 4641 4642If successful, it will show:: 4643 4644 Indirect action #[...] update queued 4645 4646Otherwise it will show an error message of the form:: 4647 4648 Caught error type [...] ([...]): [...] 4649 4650``flow queue pull`` must be called to retrieve the operation status. 4651 4652Destroying indirect actions 4653~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4654 4655``flow indirect_action {port_id} destroy`` destroys one or more indirect actions 4656from their indirect action IDs (as returned by 4657``flow indirect_action {port_id} create``). It is bound to 4658``rte_flow_action_handle_destroy()``:: 4659 4660 flow indirect_action {port_id} destroy action_id {indirect_action_id} [...] 4661 4662If successful, it will show:: 4663 4664 Indirect action #[...] destroyed 4665 4666It does not report anything for indirect action IDs that do not exist. 4667The usual error message is shown when a indirect action cannot be destroyed:: 4668 4669 Caught error type [...] ([...]): [...] 4670 4671Destroy indirect actions having id 100 & 101:: 4672 4673 testpmd> flow indirect_action 0 destroy action_id 100 action_id 101 4674 4675Enqueueing destruction of indirect actions 4676~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4677 4678``flow queue indirect_action destroy`` adds destruction operation to destroy 4679one or more indirect actions from their indirect action IDs (as returned by 4680``flow queue {port_id} indirect_action {queue_id} create``) to a queue. 4681It is bound to ``rte_flow_async_action_handle_destroy()``:: 4682 4683 flow queue {port_id} indirect_action {queue_id} destroy 4684 [postpone {boolean}] action_id {indirect_action_id} [...] 4685 4686If successful, it will show:: 4687 4688 Indirect action #[...] destruction queued 4689 4690Otherwise it will show an error message of the form:: 4691 4692 Caught error type [...] ([...]): [...] 4693 4694``flow queue pull`` must be called to retrieve the operation status. 4695 4696Query indirect actions 4697~~~~~~~~~~~~~~~~~~~~~~ 4698 4699``flow indirect_action {port_id} query`` queries the indirect action from its 4700indirect action ID (as returned by ``flow indirect_action {port_id} create``). 4701It is bound to ``rte_flow_action_handle_query()``:: 4702 4703 flow indirect_action {port_id} query {indirect_action_id} 4704 4705Currently only rss indirect action supported. If successful, it will show:: 4706 4707 Indirect RSS action: 4708 refs:[...] 4709 4710Otherwise, it will complain either that indirect action not found or that some 4711error occurred:: 4712 4713 Failed to find indirect action #[...] on port [...] 4714 4715:: 4716 4717 Caught error type [...] ([...]): [...] 4718 4719Query indirect action having id 100:: 4720 4721 testpmd> flow indirect_action 0 query 100 4722 4723Enqueueing query of indirect actions 4724~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4725 4726``flow queue indirect_action query`` adds query operation for an indirect 4727action to a queue. It is bound to ``rte_flow_async_action_handle_query()``:: 4728 4729 flow queue {port_id} indirect_action {queue_id} query 4730 {indirect_action_id} [postpone {boolean}] 4731 4732If successful, it will show:: 4733 4734 Indirect action #[...] query queued 4735 4736Otherwise it will show an error message of the form:: 4737 4738 Caught error type [...] ([...]): [...] 4739 4740``flow queue pull`` must be called to retrieve the operation status. 4741 4742Sample QinQ flow rules 4743~~~~~~~~~~~~~~~~~~~~~~ 4744 4745Before creating QinQ rule(s) the following commands should be issued to enable QinQ:: 4746 4747 testpmd> port stop 0 4748 testpmd> vlan set extend on 0 4749 4750The above command sets the inner and outer TPID's to 0x8100. 4751 4752To change the TPID's the following commands should be used:: 4753 4754 testpmd> vlan set outer tpid 0x88A8 0 4755 testpmd> vlan set inner tpid 0x8100 0 4756 testpmd> port start 0 4757 4758Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM. 4759 4760:: 4761 4762 testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 / 4763 vlan tci is 456 / end actions vf id 1 / queue index 0 / end 4764 Flow rule #0 validated 4765 4766 testpmd> flow create 0 ingress pattern eth / vlan tci is 4 / 4767 vlan tci is 456 / end actions vf id 123 / queue index 0 / end 4768 Flow rule #0 created 4769 4770 testpmd> flow list 0 4771 ID Group Prio Attr Rule 4772 0 0 0 i- ETH VLAN VLAN=>VF QUEUE 4773 4774Validate and create a QinQ rule on port 0 to steer traffic to a queue on the host. 4775 4776:: 4777 4778 testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 / 4779 vlan tci is 654 / end actions pf / queue index 0 / end 4780 Flow rule #1 validated 4781 4782 testpmd> flow create 0 ingress pattern eth / vlan tci is 321 / 4783 vlan tci is 654 / end actions pf / queue index 1 / end 4784 Flow rule #1 created 4785 4786 testpmd> flow list 0 4787 ID Group Prio Attr Rule 4788 0 0 0 i- ETH VLAN VLAN=>VF QUEUE 4789 1 0 0 i- ETH VLAN VLAN=>PF QUEUE 4790 4791Sample VXLAN flow rules 4792~~~~~~~~~~~~~~~~~~~~~~~ 4793 4794Before creating VXLAN rule(s), the UDP port should be added for VXLAN packet 4795filter on a port:: 4796 4797 testpmd> rx_vxlan_port add 4789 0 4798 4799Create VXLAN rules on port 0 to steer traffic to PF queues. 4800 4801:: 4802 4803 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / 4804 eth dst is 00:11:22:33:44:55 / end actions pf / queue index 1 / end 4805 Flow rule #0 created 4806 4807 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 3 / 4808 eth dst is 00:11:22:33:44:55 / end actions pf / queue index 2 / end 4809 Flow rule #1 created 4810 4811 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / 4812 eth dst is 00:11:22:33:44:55 / vlan tci is 10 / end actions pf / 4813 queue index 3 / end 4814 Flow rule #2 created 4815 4816 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 5 / 4817 eth dst is 00:11:22:33:44:55 / vlan tci is 20 / end actions pf / 4818 queue index 4 / end 4819 Flow rule #3 created 4820 4821 testpmd> flow create 0 ingress pattern eth dst is 00:00:00:00:01:00 / ipv4 / 4822 udp / vxlan vni is 6 / eth dst is 00:11:22:33:44:55 / end actions pf / 4823 queue index 5 / end 4824 Flow rule #4 created 4825 4826 testpmd> flow list 0 4827 ID Group Prio Attr Rule 4828 0 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE 4829 1 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE 4830 2 0 0 i- ETH IPV4 UDP VXLAN ETH VLAN => QUEUE 4831 3 0 0 i- ETH IPV4 UDP VXLAN ETH VLAN => QUEUE 4832 4 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE 4833 4834Sample VXLAN encapsulation rule 4835~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4836 4837VXLAN encapsulation outer layer has default value pre-configured in testpmd 4838source code, those can be changed by using the following commands 4839 4840IPv4 VXLAN outer header:: 4841 4842 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1 4843 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 4844 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 4845 queue index 0 / end 4846 4847 testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 4848 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11 4849 eth-dst 22:22:22:22:22:22 4850 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 4851 queue index 0 / end 4852 4853 testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-tos 0 4854 ip-ttl 255 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 4855 eth-dst 22:22:22:22:22:22 4856 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 4857 queue index 0 / end 4858 4859IPv6 VXLAN outer header:: 4860 4861 testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1 4862 ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 4863 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 4864 queue index 0 / end 4865 4866 testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 4867 ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11 4868 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-tos-ttl ip-version ipv6 vni 4 udp-src 4 udp-dst 4 4873 ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222 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 4878Sample NVGRE encapsulation rule 4879~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4880 4881NVGRE encapsulation outer layer has default value pre-configured in testpmd 4882source code, those can be changed by using the following commands 4883 4884IPv4 NVGRE outer header:: 4885 4886 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1 4887 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 nvgre_encap / 4889 queue index 0 / end 4890 4891 testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1 4892 ip-dst 128.0.0.1 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 nvgre_encap / 4895 queue index 0 / end 4896 4897IPv6 NVGRE outer header:: 4898 4899 testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222 4900 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 4901 testpmd> flow create 0 ingress pattern end actions nvgre_encap / 4902 queue index 0 / end 4903 4904 testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222 4905 vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 4906 testpmd> flow create 0 ingress pattern end actions nvgre_encap / 4907 queue index 0 / end 4908 4909Sample L2 encapsulation rule 4910~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4911 4912L2 encapsulation has default value pre-configured in testpmd 4913source code, those can be changed by using the following commands 4914 4915L2 header:: 4916 4917 testpmd> set l2_encap ip-version ipv4 4918 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 4919 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions 4920 mplsoudp_decap / l2_encap / end 4921 4922L2 with VXLAN header:: 4923 4924 testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34 4925 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 4926 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions 4927 mplsoudp_decap / l2_encap / end 4928 4929Sample L2 decapsulation rule 4930~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4931 4932L2 decapsulation has default value pre-configured in testpmd 4933source code, those can be changed by using the following commands 4934 4935L2 header:: 4936 4937 testpmd> set l2_decap 4938 testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap / 4939 queue index 0 / end 4940 4941L2 with VXLAN header:: 4942 4943 testpmd> set l2_encap-with-vlan 4944 testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap / 4945 queue index 0 / end 4946 4947Sample MPLSoGRE encapsulation rule 4948~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4949 4950MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd 4951source code, those can be changed by using the following commands 4952 4953IPv4 MPLSoGRE outer header:: 4954 4955 testpmd> set mplsogre_encap ip-version ipv4 label 4 4956 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 4957 eth-dst 22:22:22:22:22:22 4958 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 4959 mplsogre_encap / end 4960 4961IPv4 MPLSoGRE with VLAN outer header:: 4962 4963 testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4 4964 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 4965 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 4966 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 4967 mplsogre_encap / end 4968 4969IPv6 MPLSoGRE outer header:: 4970 4971 testpmd> set mplsogre_encap ip-version ipv6 mask 4 4972 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11 4973 eth-dst 22:22:22:22:22:22 4974 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 4975 mplsogre_encap / end 4976 4977IPv6 MPLSoGRE with VLAN outer header:: 4978 4979 testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4 4980 ip-src ::1 ip-dst ::2222 vlan-tci 34 4981 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 4982 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 4983 mplsogre_encap / end 4984 4985Sample MPLSoGRE decapsulation rule 4986~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4987 4988MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd 4989source code, those can be changed by using the following commands 4990 4991IPv4 MPLSoGRE outer header:: 4992 4993 testpmd> set mplsogre_decap ip-version ipv4 4994 testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions 4995 mplsogre_decap / l2_encap / end 4996 4997IPv4 MPLSoGRE with VLAN outer header:: 4998 4999 testpmd> set mplsogre_decap-with-vlan ip-version ipv4 5000 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end 5001 actions mplsogre_decap / l2_encap / end 5002 5003IPv6 MPLSoGRE outer header:: 5004 5005 testpmd> set mplsogre_decap ip-version ipv6 5006 testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end 5007 actions mplsogre_decap / l2_encap / end 5008 5009IPv6 MPLSoGRE with VLAN outer header:: 5010 5011 testpmd> set mplsogre_decap-with-vlan ip-version ipv6 5012 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end 5013 actions mplsogre_decap / l2_encap / end 5014 5015Sample MPLSoUDP encapsulation rule 5016~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5017 5018MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd 5019source code, those can be changed by using the following commands 5020 5021IPv4 MPLSoUDP outer header:: 5022 5023 testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10 5024 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 5025 eth-dst 22:22:22:22:22:22 5026 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5027 mplsoudp_encap / end 5028 5029IPv4 MPLSoUDP with VLAN outer header:: 5030 5031 testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5 5032 udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 5033 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5034 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5035 mplsoudp_encap / end 5036 5037IPv6 MPLSoUDP outer header:: 5038 5039 testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10 5040 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11 5041 eth-dst 22:22:22:22:22:22 5042 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5043 mplsoudp_encap / end 5044 5045IPv6 MPLSoUDP with VLAN outer header:: 5046 5047 testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5 5048 udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34 5049 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5050 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5051 mplsoudp_encap / end 5052 5053Sample MPLSoUDP decapsulation rule 5054~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5055 5056MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd 5057source code, those can be changed by using the following commands 5058 5059IPv4 MPLSoUDP outer header:: 5060 5061 testpmd> set mplsoudp_decap ip-version ipv4 5062 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions 5063 mplsoudp_decap / l2_encap / end 5064 5065IPv4 MPLSoUDP with VLAN outer header:: 5066 5067 testpmd> set mplsoudp_decap-with-vlan ip-version ipv4 5068 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end 5069 actions mplsoudp_decap / l2_encap / end 5070 5071IPv6 MPLSoUDP outer header:: 5072 5073 testpmd> set mplsoudp_decap ip-version ipv6 5074 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end 5075 actions mplsoudp_decap / l2_encap / end 5076 5077IPv6 MPLSoUDP with VLAN outer header:: 5078 5079 testpmd> set mplsoudp_decap-with-vlan ip-version ipv6 5080 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end 5081 actions mplsoudp_decap / l2_encap / end 5082 5083Sample Raw encapsulation rule 5084~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5085 5086Raw encapsulation configuration can be set by the following commands 5087 5088Encapsulating VxLAN:: 5089 5090 testpmd> set raw_encap 4 eth src is 10:11:22:33:44:55 / vlan tci is 1 5091 inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni 5092 is 2 / end_set 5093 testpmd> flow create 0 egress pattern eth / ipv4 / end actions 5094 raw_encap index 4 / end 5095 5096Sample Raw decapsulation rule 5097~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5098 5099Raw decapsulation configuration can be set by the following commands 5100 5101Decapsulating VxLAN:: 5102 5103 testpmd> set raw_decap eth / ipv4 / udp / vxlan / end_set 5104 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 / 5105 end actions raw_decap / queue index 0 / end 5106 5107Sample ESP rules 5108~~~~~~~~~~~~~~~~ 5109 5110ESP rules can be created by the following commands:: 5111 5112 testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions 5113 queue index 3 / end 5114 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end 5115 actions queue index 3 / end 5116 testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions 5117 queue index 3 / end 5118 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end 5119 actions queue index 3 / end 5120 5121Sample AH rules 5122~~~~~~~~~~~~~~~~ 5123 5124AH rules can be created by the following commands:: 5125 5126 testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions 5127 queue index 3 / end 5128 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end 5129 actions queue index 3 / end 5130 testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions 5131 queue index 3 / end 5132 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end 5133 actions queue index 3 / end 5134 5135Sample PFCP rules 5136~~~~~~~~~~~~~~~~~ 5137 5138PFCP rules can be created by the following commands(s_field need to be 1 5139if seid is set):: 5140 5141 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end 5142 actions queue index 3 / end 5143 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1 5144 seid is 1 / end actions queue index 3 / end 5145 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end 5146 actions queue index 3 / end 5147 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1 5148 seid is 1 / end actions queue index 3 / end 5149 5150Sample Sampling/Mirroring rules 5151~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5152 5153Sample/Mirroring rules can be set by the following commands 5154 5155NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1, 5156and 50% packets are duplicated and marked with 0x1234 and sent to queue 0. 5157 5158:: 5159 5160 testpmd> set sample_actions 0 mark id 0x1234 / queue index 0 / end 5161 testpmd> flow create 0 ingress group 1 pattern eth / end actions 5162 sample ratio 2 index 0 / queue index 1 / end 5163 5164Match packets coming from a VM which is referred to by means of 5165its representor ethdev (port 1), mirror 50% of them to the 5166said representor (for bookkeeping) as well as encapsulate 5167all the packets and steer them to the physical port: 5168 5169:: 5170 5171 testpmd> set sample_actions 0 port_representor ethdev_port_id 1 / end 5172 5173 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 32 udp-dst 4789 ip-src 127.0.0.1 5174 ip-dst 127.0.0.2 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5175 5176 testpmd> flow create 0 transfer pattern represented_port ethdev_port_id is 1 / end 5177 actions sample ratio 2 index 0 / vxlan_encap / 5178 represented_port ethdev_port_id 0 / end 5179 5180The rule is inserted via port 0 (assumed to have "transfer" privilege). 5181 5182Sample integrity rules 5183~~~~~~~~~~~~~~~~~~~~~~ 5184 5185Integrity rules can be created by the following commands: 5186 5187Integrity rule that forwards valid TCP packets to group 1. 5188TCP packet integrity is matched with the ``l4_ok`` bit 3. 5189 5190:: 5191 5192 testpmd> flow create 0 ingress 5193 pattern eth / ipv4 / tcp / integrity value mask 8 value spec 8 / end 5194 actions jump group 1 / end 5195 5196Integrity rule that forwards invalid packets to application. 5197General packet integrity is matched with the ``packet_ok`` bit 0. 5198 5199:: 5200 5201 testpmd> flow create 0 ingress pattern integrity value mask 1 value spec 0 / end actions queue index 0 / end 5202 5203Sample conntrack rules 5204~~~~~~~~~~~~~~~~~~~~~~ 5205 5206Conntrack rules can be set by the following commands 5207 5208Need to construct the connection context with provided information. 5209In the first table, create a flow rule by using conntrack action and jump to 5210the next table. In the next table, create a rule to check the state. 5211 5212:: 5213 5214 testpmd> set conntrack com peer 1 is_orig 1 enable 1 live 1 sack 1 cack 0 5215 last_dir 0 liberal 0 state 1 max_ack_win 7 r_lim 5 last_win 510 5216 last_seq 2632987379 last_ack 2532480967 last_end 2632987379 5217 last_index 0x8 5218 testpmd> set conntrack orig scale 7 fin 0 acked 1 unack_data 0 5219 sent_end 2632987379 reply_end 2633016339 max_win 28960 5220 max_ack 2632987379 5221 testpmd> set conntrack rply scale 7 fin 0 acked 1 unack_data 0 5222 sent_end 2532480967 reply_end 2532546247 max_win 65280 5223 max_ack 2532480967 5224 testpmd> flow indirect_action 0 create ingress action conntrack / end 5225 testpmd> flow create 0 group 3 ingress pattern eth / ipv4 / tcp / end actions indirect 0 / jump group 5 / end 5226 testpmd> flow create 0 group 5 ingress pattern eth / ipv4 / tcp / conntrack is 1 / end actions queue index 5 / end 5227 5228Construct the conntrack again with only "is_orig" set to 0 (other fields are 5229ignored), then use "update" interface to update the direction. Create flow 5230rules like above for the peer port. 5231 5232:: 5233 5234 testpmd> flow indirect_action 0 update 0 action conntrack_update dir / end 5235 5236Sample meter with policy rules 5237~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5238 5239Meter with policy rules can be created by the following commands: 5240 5241Need to create policy first and actions are set for green/yellow/red colors. 5242Create meter with policy id. Create flow with meter id. 5243 5244Example for policy with meter color action. The purpose is to color the packet 5245to reflect the meter color result. 5246The meter policy action list: ``green -> green, yellow -> yellow, red -> red``. 5247 5248:: 5249 5250 testpmd> add port meter profile srtcm_rfc2697 0 13 21504 2688 0 0 5251 testpmd> add port meter policy 0 1 g_actions color type green / end y_actions color type yellow / end 5252 r_actions color type red / end 5253 testpmd> create port meter 0 1 13 1 yes 0xffff 0 0 5254 testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end 5255 5256Sample L2TPv2 RSS rules 5257~~~~~~~~~~~~~~~~~~~~~~~ 5258 5259L2TPv2 RSS rules can be created by the following commands:: 5260 5261 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control 5262 / end actions rss types l2tpv2 end queues end / end 5263 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / end 5264 actions rss types eth l2-src-only end queues end / end 5265 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / end 5266 actions rss types l2tpv2 end queues end / end 5267 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 5268 / end actions rss types ipv4 end queues end / end 5269 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv6 5270 / udp / end actions rss types ipv6-udp end queues end / end 5271 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv4 5272 / tcp / end actions rss types ipv4-tcp end queues end / end 5273 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6 5274 / end actions rss types ipv6 end queues end / end 5275 5276Sample L2TPv2 FDIR rules 5277~~~~~~~~~~~~~~~~~~~~~~~~ 5278 5279L2TPv2 FDIR rules can be created by the following commands:: 5280 5281 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control 5282 session_id is 0x1111 / end actions queue index 3 / end 5283 testpmd> flow create 0 ingress pattern eth src is 00:00:00:00:00:01 / ipv4 5284 / udp / l2tpv2 type data / end actions queue index 3 / end 5285 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type data 5286 session_id is 0x1111 / ppp / end actions queue index 3 / end 5287 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 5288 src is 10.0.0.1 / end actions queue index 3 / end 5289 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6 5290 dst is ABAB:910B:6666:3457:8295:3333:1800:2929 / end actions queue index 3 / end 5291 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 5292 / udp src is 22 / end actions queue index 3 / end 5293 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 5294 / tcp dst is 23 / end actions queue index 3 / end 5295 5296Sample RAW rule 5297~~~~~~~~~~~~~~~ 5298 5299A RAW rule can be created as following using ``pattern_hex`` key and mask. 5300 5301:: 5302 5303 testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset 5304 is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a 5305 pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions 5306 queue index 4 / end 5307 5308BPF Functions 5309-------------- 5310 5311The following sections show functions to load/unload eBPF based filters. 5312 5313bpf-load 5314~~~~~~~~ 5315 5316Load an eBPF program as a callback for particular RX/TX queue:: 5317 5318 testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename) 5319 5320The available load-flags are: 5321 5322* ``J``: use JIT generated native code, otherwise BPF interpreter will be used. 5323 5324* ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data. 5325 5326* ``-``: none. 5327 5328.. note:: 5329 5330 You'll need clang v3.7 or above to build bpf program you'd like to load 5331 5332For example: 5333 5334.. code-block:: console 5335 5336 cd examples/bpf 5337 clang -O2 -target bpf -c t1.c 5338 5339Then to load (and JIT compile) t1.o at RX queue 0, port 1: 5340 5341.. code-block:: console 5342 5343 testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o 5344 5345To load (not JITed) t1.o at TX queue 0, port 0: 5346 5347.. code-block:: console 5348 5349 testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o 5350 5351bpf-unload 5352~~~~~~~~~~ 5353 5354Unload previously loaded eBPF program for particular RX/TX queue:: 5355 5356 testpmd> bpf-unload rx|tx (portid) (queueid) 5357 5358For example to unload BPF filter from TX queue 0, port 0: 5359 5360.. code-block:: console 5361 5362 testpmd> bpf-unload tx 0 0 5363 5364Flex Item Functions 5365------------------- 5366 5367The following sections show functions that configure and create flex item object, 5368create flex pattern and use it in a flow rule. 5369The commands will use 20 bytes IPv4 header for examples: 5370 5371:: 5372 5373 0 1 2 3 5374 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 5375 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5376 | ver | IHL | TOS | length | +0 5377 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5378 | identification | flg | frag. offset | +4 5379 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5380 | TTL | protocol | checksum | +8 5381 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5382 | source IP address | +12 5383 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5384 | destination IP address | +16 5385 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5386 5387 5388Create flex item 5389~~~~~~~~~~~~~~~~ 5390 5391Flex item object is created by PMD according to a new header configuration. The 5392header configuration is compiled by the testpmd and stored in 5393``rte_flow_item_flex_conf`` type variable. 5394 5395:: 5396 5397 # flow flex_item create <port> <flex id> <configuration file> 5398 testpmd> flow flex_item init 0 3 ipv4_flex_config.json 5399 port-0: created flex item #3 5400 5401Flex item configuration is kept in external JSON file. 5402It describes the following header elements: 5403 5404**New header length.** 5405 5406Specify whether the new header has fixed or variable length and the basic/minimal 5407header length value. 5408 5409If header length is not fixed, header location with a value that completes header 5410length calculation and scale/offset function must be added. 5411 5412Scale function depends on port hardware. 5413 5414**Next protocol.** 5415 5416Describes location in the new header that specify following network header type. 5417 5418**Flow match samples.** 5419 5420Describes locations in the new header that will be used in flow rules. 5421 5422Number of flow samples and sample maximal length depend of port hardware. 5423 5424**Input trigger.** 5425 5426Describes preceding network header configuration. 5427 5428**Output trigger.** 5429 5430Describes conditions that trigger transfer to following network header 5431 5432.. code-block:: json 5433 5434 { 5435 "next_header": { "field_mode": "FIELD_MODE_FIXED", "field_size": 20}, 5436 "next_protocol": {"field_size": 8, "field_base": 72}, 5437 "sample_data": [ 5438 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 0}, 5439 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 32}, 5440 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 64}, 5441 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 96} 5442 ], 5443 "input_link": [ 5444 {"item": "eth type is 0x0800"}, 5445 {"item": "vlan inner_type is 0x0800"} 5446 ], 5447 "output_link": [ 5448 {"item": "udp", "next": 17}, 5449 {"item": "tcp", "next": 6}, 5450 {"item": "icmp", "next": 1} 5451 ] 5452 } 5453 5454 5455Flex pattern and flow rules 5456~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5457 5458Flex pattern describe parts of network header that will trigger flex flow item hit in a flow rule. 5459Flex pattern directly related to flex item samples configuration. 5460Flex pattern can be shared between ports. 5461 5462**Flex pattern and flow rule to match IPv4 version and 20 bytes length** 5463 5464:: 5465 5466 # set flex_pattern <pattern_id> is <hex bytes sequence> 5467 testpmd> flow flex_item pattern 5 is 45FF 5468 created pattern #5 5469 5470 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 5471 Flow rule #0 created 5472 5473**Flex pattern and flow rule to match packets with source address 1.2.3.4** 5474 5475:: 5476 5477 testpmd> flow flex_item pattern 2 spec 45000000000000000000000001020304 mask FF0000000000000000000000FFFFFFFF 5478 created pattern #2 5479 5480 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 5481 Flow rule #0 created 5482 5483Driver specific commands 5484------------------------ 5485 5486Some drivers provide specific features. 5487See: 5488 5489- :ref:`net/bonding testpmd driver specific commands <bonding_testpmd_commands>` 5490- :ref:`net/i40e testpmd driver specific commands <net_i40e_testpmd_commands>` 5491- :ref:`net/ixgbe testpmd driver specific commands <net_ixgbe_testpmd_commands>` 5492