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