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