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 2524create bonded device 2525~~~~~~~~~~~~~~~~~~~~ 2526 2527Create a new bonding device:: 2528 2529 testpmd> create bonded device (mode) (socket) 2530 2531For example, to create a bonded device in mode 1 on socket 0:: 2532 2533 testpmd> create bonded device 1 0 2534 created new bonded device (port X) 2535 2536add bonding slave 2537~~~~~~~~~~~~~~~~~ 2538 2539Adds Ethernet device to a Link Bonding device:: 2540 2541 testpmd> add bonding slave (slave id) (port id) 2542 2543For example, to add Ethernet device (port 6) to a Link Bonding device (port 10):: 2544 2545 testpmd> add bonding slave 6 10 2546 2547 2548remove bonding slave 2549~~~~~~~~~~~~~~~~~~~~ 2550 2551Removes an Ethernet slave device from a Link Bonding device:: 2552 2553 testpmd> remove bonding slave (slave id) (port id) 2554 2555For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10):: 2556 2557 testpmd> remove bonding slave 6 10 2558 2559set bonding mode 2560~~~~~~~~~~~~~~~~ 2561 2562Set the Link Bonding mode of a Link Bonding device:: 2563 2564 testpmd> set bonding mode (value) (port id) 2565 2566For example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3):: 2567 2568 testpmd> set bonding mode 3 10 2569 2570set bonding primary 2571~~~~~~~~~~~~~~~~~~~ 2572 2573Set an Ethernet slave device as the primary device on a Link Bonding device:: 2574 2575 testpmd> set bonding primary (slave id) (port id) 2576 2577For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10):: 2578 2579 testpmd> set bonding primary 6 10 2580 2581set bonding mac 2582~~~~~~~~~~~~~~~ 2583 2584Set the MAC address of a Link Bonding device:: 2585 2586 testpmd> set bonding mac (port id) (mac) 2587 2588For example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01:: 2589 2590 testpmd> set bonding mac 10 00:00:00:00:00:01 2591 2592set bonding balance_xmit_policy 2593~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2594 2595Set the transmission policy for a Link Bonding device when it is in Balance XOR mode:: 2596 2597 testpmd> set bonding balance_xmit_policy (port_id) (l2|l23|l34) 2598 2599For example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports):: 2600 2601 testpmd> set bonding balance_xmit_policy 10 l34 2602 2603 2604set bonding mon_period 2605~~~~~~~~~~~~~~~~~~~~~~ 2606 2607Set the link status monitoring polling period in milliseconds for a bonding device. 2608 2609This adds support for PMD slave devices which do not support link status interrupts. 2610When the mon_period is set to a value greater than 0 then all PMD's which do not support 2611link status ISR will be queried every polling interval to check if their link status has changed:: 2612 2613 testpmd> set bonding mon_period (port_id) (value) 2614 2615For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms:: 2616 2617 testpmd> set bonding mon_period 5 150 2618 2619 2620set bonding lacp dedicated_queue 2621~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2622 2623Enable dedicated tx/rx queues on bonding devices slaves to handle LACP control plane traffic 2624when in mode 4 (link-aggregation-802.3ad):: 2625 2626 testpmd> set bonding lacp dedicated_queues (port_id) (enable|disable) 2627 2628 2629set bonding agg_mode 2630~~~~~~~~~~~~~~~~~~~~ 2631 2632Enable one of the specific aggregators mode when in mode 4 (link-aggregation-802.3ad):: 2633 2634 testpmd> set bonding agg_mode (port_id) (bandwidth|count|stable) 2635 2636 2637show bonding config 2638~~~~~~~~~~~~~~~~~~~ 2639 2640Show the current configuration of a Link Bonding device:: 2641 2642 testpmd> show bonding config (port id) 2643 2644For example, 2645to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4) 2646in balance mode with a transmission policy of layer 2+3:: 2647 2648 testpmd> show bonding config 9 2649 Bonding mode: 2 2650 Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23 2651 Slaves (3): [1 3 4] 2652 Active Slaves (3): [1 3 4] 2653 Primary: [3] 2654 2655show bonding lacp info 2656~~~~~~~~~~~~~~~~~~~~~~ 2657 2658Show information about the Link Bonding device in mode 4 (link-aggregation-802.3ad):: 2659 2660 testpmd> show bonding lacp info (port_id) 2661 2662Register Functions 2663------------------ 2664 2665The Register Functions can be used to read from and write to registers on the network card referenced by a port number. 2666This is mainly useful for debugging purposes. 2667Reference should be made to the appropriate datasheet for the network card for details on the register addresses 2668and fields that can be accessed. 2669 2670read reg 2671~~~~~~~~ 2672 2673Display the value of a port register:: 2674 2675 testpmd> read reg (port_id) (address) 2676 2677For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller:: 2678 2679 testpmd> read reg 0 0xEE00 2680 port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241) 2681 2682read regfield 2683~~~~~~~~~~~~~ 2684 2685Display a port register bit field:: 2686 2687 testpmd> read regfield (port_id) (address) (bit_x) (bit_y) 2688 2689For example, reading the lowest two bits from the register in the example above:: 2690 2691 testpmd> read regfield 0 0xEE00 0 1 2692 port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1) 2693 2694read regbit 2695~~~~~~~~~~~ 2696 2697Display a single port register bit:: 2698 2699 testpmd> read regbit (port_id) (address) (bit_x) 2700 2701For example, reading the lowest bit from the register in the example above:: 2702 2703 testpmd> read regbit 0 0xEE00 0 2704 port 0 PCI register at offset 0xEE00: bit 0=1 2705 2706write reg 2707~~~~~~~~~ 2708 2709Set the value of a port register:: 2710 2711 testpmd> write reg (port_id) (address) (value) 2712 2713For example, to clear a register:: 2714 2715 testpmd> write reg 0 0xEE00 0x0 2716 port 0 PCI register at offset 0xEE00: 0x00000000 (0) 2717 2718write regfield 2719~~~~~~~~~~~~~~ 2720 2721Set bit field of a port register:: 2722 2723 testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value) 2724 2725For example, writing to the register cleared in the example above:: 2726 2727 testpmd> write regfield 0 0xEE00 0 1 2 2728 port 0 PCI register at offset 0xEE00: 0x00000002 (2) 2729 2730write regbit 2731~~~~~~~~~~~~ 2732 2733Set single bit value of a port register:: 2734 2735 testpmd> write regbit (port_id) (address) (bit_x) (value) 2736 2737For example, to set the high bit in the register from the example above:: 2738 2739 testpmd> write regbit 0 0xEE00 31 1 2740 port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658) 2741 2742Traffic Metering and Policing 2743----------------------------- 2744 2745The following section shows functions for configuring traffic metering and 2746policing on the ethernet device through the use of generic ethdev API. 2747 2748show port traffic management capability 2749~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2750 2751Show traffic metering and policing capability of the port:: 2752 2753 testpmd> show port meter cap (port_id) 2754 2755add port meter profile (srTCM rfc2967) 2756~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2757 2758Add meter profile (srTCM rfc2697) to the ethernet device:: 2759 2760 testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \ 2761 (cir) (cbs) (ebs) (packet_mode) 2762 2763where: 2764 2765* ``profile_id``: ID for the meter profile. 2766* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second). 2767* ``cbs``: Committed Burst Size (CBS) (bytes or packets). 2768* ``ebs``: Excess Burst Size (EBS) (bytes or packets). 2769* ``packet_mode``: Packets mode for meter profile. 2770 2771add port meter profile (trTCM rfc2968) 2772~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2773 2774Add meter profile (srTCM rfc2698) to the ethernet device:: 2775 2776 testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \ 2777 (cir) (pir) (cbs) (pbs) (packet_mode) 2778 2779where: 2780 2781* ``profile_id``: ID for the meter profile. 2782* ``cir``: Committed information rate (bytes per second or packets per second). 2783* ``pir``: Peak information rate (bytes per second or packets per second). 2784* ``cbs``: Committed burst size (bytes or packets). 2785* ``pbs``: Peak burst size (bytes or packets). 2786* ``packet_mode``: Packets mode for meter profile. 2787 2788add port meter profile (trTCM rfc4115) 2789~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2790 2791Add meter profile (trTCM rfc4115) to the ethernet device:: 2792 2793 testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \ 2794 (cir) (eir) (cbs) (ebs) (packet_mode) 2795 2796where: 2797 2798* ``profile_id``: ID for the meter profile. 2799* ``cir``: Committed information rate (bytes per second or packets per second). 2800* ``eir``: Excess information rate (bytes per second or packets per second). 2801* ``cbs``: Committed burst size (bytes or packets). 2802* ``ebs``: Excess burst size (bytes or packets). 2803* ``packet_mode``: Packets mode for meter profile. 2804 2805delete port meter profile 2806~~~~~~~~~~~~~~~~~~~~~~~~~ 2807 2808Delete meter profile from the ethernet device:: 2809 2810 testpmd> del port meter profile (port_id) (profile_id) 2811 2812create port policy 2813~~~~~~~~~~~~~~~~~~ 2814 2815Create new policy object for the ethernet device:: 2816 2817 testpmd> add port meter policy (port_id) (policy_id) g_actions \ 2818 {action} y_actions {action} r_actions {action} 2819 2820where: 2821 2822* ``policy_id``: policy ID. 2823* ``action``: action lists for green/yellow/red colors. 2824 2825delete port policy 2826~~~~~~~~~~~~~~~~~~ 2827 2828Delete policy object for the ethernet device:: 2829 2830 testpmd> del port meter policy (port_id) (policy_id) 2831 2832where: 2833 2834* ``policy_id``: policy ID. 2835 2836create port meter 2837~~~~~~~~~~~~~~~~~ 2838 2839Create new meter object for the ethernet device:: 2840 2841 testpmd> create port meter (port_id) (mtr_id) (profile_id) \ 2842 (policy_id) (meter_enable) (stats_mask) (shared) \ 2843 (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\ 2844 (dscp_tbl_entry63)] 2845 2846where: 2847 2848* ``mtr_id``: meter object ID. 2849* ``profile_id``: ID for the meter profile. 2850* ``policy_id``: ID for the policy. 2851* ``meter_enable``: When this parameter has a non-zero value, the meter object 2852 gets enabled at the time of creation, otherwise remains disabled. 2853* ``stats_mask``: Mask of statistics counter types to be enabled for the 2854 meter object. 2855* ``shared``: When this parameter has a non-zero value, the meter object is 2856 shared by multiple flows. Otherwise, meter object is used by single flow. 2857* ``use_pre_meter_color``: When this parameter has a non-zero value, the 2858 input color for the current meter object is determined by the latest meter 2859 object in the same flow. Otherwise, the current meter object uses the 2860 *dscp_table* to determine the input color. 2861* ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input 2862 color, 0 <= x <= 63. 2863 2864enable port meter 2865~~~~~~~~~~~~~~~~~ 2866 2867Enable meter for the ethernet device:: 2868 2869 testpmd> enable port meter (port_id) (mtr_id) 2870 2871disable port meter 2872~~~~~~~~~~~~~~~~~~ 2873 2874Disable meter for the ethernet device:: 2875 2876 testpmd> disable port meter (port_id) (mtr_id) 2877 2878delete port meter 2879~~~~~~~~~~~~~~~~~ 2880 2881Delete meter for the ethernet device:: 2882 2883 testpmd> del port meter (port_id) (mtr_id) 2884 2885Set port meter profile 2886~~~~~~~~~~~~~~~~~~~~~~ 2887 2888Set meter profile for the ethernet device:: 2889 2890 testpmd> set port meter profile (port_id) (mtr_id) (profile_id) 2891 2892set port meter dscp table 2893~~~~~~~~~~~~~~~~~~~~~~~~~ 2894 2895Set meter dscp table for the ethernet device:: 2896 2897 testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0) \ 2898 (dscp_tbl_entry1)...(dscp_tbl_entry63)] 2899 2900set port meter stats mask 2901~~~~~~~~~~~~~~~~~~~~~~~~~ 2902 2903Set meter stats mask for the ethernet device:: 2904 2905 testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask) 2906 2907where: 2908 2909* ``stats_mask``: Bit mask indicating statistics counter types to be enabled. 2910 2911show port meter stats 2912~~~~~~~~~~~~~~~~~~~~~ 2913 2914Show meter stats of the ethernet device:: 2915 2916 testpmd> show port meter stats (port_id) (mtr_id) (clear) 2917 2918where: 2919 2920* ``clear``: Flag that indicates whether the statistics counters should 2921 be cleared (i.e. set to zero) immediately after they have been read or not. 2922 2923Traffic Management 2924------------------ 2925 2926The following section shows functions for configuring traffic management on 2927the ethernet device through the use of generic TM API. 2928 2929show port traffic management capability 2930~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2931 2932Show traffic management capability of the port:: 2933 2934 testpmd> show port tm cap (port_id) 2935 2936show port traffic management capability (hierarchy level) 2937~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2938 2939Show traffic management hierarchy level capability of the port:: 2940 2941 testpmd> show port tm level cap (port_id) (level_id) 2942 2943show port traffic management capability (hierarchy node level) 2944~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2945 2946Show the traffic management hierarchy node capability of the port:: 2947 2948 testpmd> show port tm node cap (port_id) (node_id) 2949 2950show port traffic management hierarchy node type 2951~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2952 2953Show the port traffic management hierarchy node type:: 2954 2955 testpmd> show port tm node type (port_id) (node_id) 2956 2957show port traffic management hierarchy node stats 2958~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2959 2960Show the port traffic management hierarchy node statistics:: 2961 2962 testpmd> show port tm node stats (port_id) (node_id) (clear) 2963 2964where: 2965 2966* ``clear``: When this parameter has a non-zero value, the statistics counters 2967 are cleared (i.e. set to zero) immediately after they have been read, 2968 otherwise the statistics counters are left untouched. 2969 2970Add port traffic management private shaper profile 2971~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2972 2973Add the port traffic management private shaper profile:: 2974 2975 testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \ 2976 (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \ 2977 (packet_length_adjust) (packet_mode) 2978 2979where: 2980 2981* ``shaper_profile id``: Shaper profile ID for the new profile. 2982* ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second). 2983* ``cmit_tb_size``: Committed token bucket size (bytes or packets). 2984* ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second). 2985* ``peak_tb_size``: Peak token bucket size (bytes or packets). 2986* ``packet_length_adjust``: The value (bytes) to be added to the length of 2987 each packet for the purpose of shaping. This parameter value can be used to 2988 correct the packet length with the framing overhead bytes that are consumed 2989 on the wire. 2990* ``packet_mode``: Shaper configured in packet mode. This parameter value if 2991 zero, configures shaper in byte mode and if non-zero configures it in packet 2992 mode. 2993 2994Delete port traffic management private shaper profile 2995~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2996 2997Delete the port traffic management private shaper:: 2998 2999 testpmd> del port tm node shaper profile (port_id) (shaper_profile_id) 3000 3001where: 3002 3003* ``shaper_profile id``: Shaper profile ID that needs to be deleted. 3004 3005Add port traffic management shared shaper 3006~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3007 3008Create the port traffic management shared shaper:: 3009 3010 testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \ 3011 (shaper_profile_id) 3012 3013where: 3014 3015* ``shared_shaper_id``: Shared shaper ID to be created. 3016* ``shaper_profile id``: Shaper profile ID for shared shaper. 3017 3018Set port traffic management shared shaper 3019~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3020 3021Update the port traffic management shared shaper:: 3022 3023 testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \ 3024 (shaper_profile_id) 3025 3026where: 3027 3028* ``shared_shaper_id``: Shared shaper ID to be update. 3029* ``shaper_profile id``: Shaper profile ID for shared shaper. 3030 3031Delete port traffic management shared shaper 3032~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3033 3034Delete the port traffic management shared shaper:: 3035 3036 testpmd> del port tm node shared shaper (port_id) (shared_shaper_id) 3037 3038where: 3039 3040* ``shared_shaper_id``: Shared shaper ID to be deleted. 3041 3042Set port traffic management hierarchy node private shaper 3043~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3044 3045set the port traffic management hierarchy node private shaper:: 3046 3047 testpmd> set port tm node shaper profile (port_id) (node_id) \ 3048 (shaper_profile_id) 3049 3050where: 3051 3052* ``shaper_profile id``: Private shaper profile ID to be enabled on the 3053 hierarchy node. 3054 3055Add port traffic management WRED profile 3056~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3057 3058Create a new WRED profile:: 3059 3060 testpmd> add port tm node wred profile (port_id) (wred_profile_id) \ 3061 (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \ 3062 (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \ 3063 (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r) 3064 3065where: 3066 3067* ``wred_profile id``: Identifier for the newly create WRED profile 3068* ``color_g``: Packet color (green) 3069* ``min_th_g``: Minimum queue threshold for packet with green color 3070* ``max_th_g``: Minimum queue threshold for packet with green color 3071* ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp) 3072* ``wq_log2_g``: Negated log2 of queue weight (wq) 3073* ``color_y``: Packet color (yellow) 3074* ``min_th_y``: Minimum queue threshold for packet with yellow color 3075* ``max_th_y``: Minimum queue threshold for packet with yellow color 3076* ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp) 3077* ``wq_log2_y``: Negated log2 of queue weight (wq) 3078* ``color_r``: Packet color (red) 3079* ``min_th_r``: Minimum queue threshold for packet with yellow color 3080* ``max_th_r``: Minimum queue threshold for packet with yellow color 3081* ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp) 3082* ``wq_log2_r``: Negated log2 of queue weight (wq) 3083 3084Delete port traffic management WRED profile 3085~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3086 3087Delete the WRED profile:: 3088 3089 testpmd> del port tm node wred profile (port_id) (wred_profile_id) 3090 3091Add port traffic management hierarchy nonleaf node 3092~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3093 3094Add nonleaf node to port traffic management hierarchy:: 3095 3096 testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \ 3097 (priority) (weight) (level_id) (shaper_profile_id) \ 3098 (n_sp_priorities) (stats_mask) (n_shared_shapers) \ 3099 [(shared_shaper_0) (shared_shaper_1) ...] \ 3100 3101where: 3102 3103* ``parent_node_id``: Node ID of the parent. 3104* ``priority``: Node priority (highest node priority is zero). This is used by 3105 the SP algorithm running on the parent node for scheduling this node. 3106* ``weight``: Node weight (lowest weight is one). The node weight is relative 3107 to the weight sum of all siblings that have the same priority. It is used by 3108 the WFQ algorithm running on the parent node for scheduling this node. 3109* ``level_id``: Hierarchy level of the node. 3110* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by 3111 the node. 3112* ``n_sp_priorities``: Number of strict priorities. 3113* ``stats_mask``: Mask of statistics counter types to be enabled for this node. 3114* ``n_shared_shapers``: Number of shared shapers. 3115* ``shared_shaper_id``: Shared shaper id. 3116 3117Add port traffic management hierarchy nonleaf node with packet mode 3118~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3119 3120Add nonleaf node with packet mode to port traffic management hierarchy:: 3121 3122 testpmd> add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id) \ 3123 (priority) (weight) (level_id) (shaper_profile_id) \ 3124 (n_sp_priorities) (stats_mask) (n_shared_shapers) \ 3125 [(shared_shaper_0) (shared_shaper_1) ...] \ 3126 3127where: 3128 3129* ``parent_node_id``: Node ID of the parent. 3130* ``priority``: Node priority (highest node priority is zero). This is used by 3131 the SP algorithm running on the parent node for scheduling this node. 3132* ``weight``: Node weight (lowest weight is one). The node weight is relative 3133 to the weight sum of all siblings that have the same priority. It is used by 3134 the WFQ algorithm running on the parent node for scheduling this node. 3135* ``level_id``: Hierarchy level of the node. 3136* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by 3137 the node. 3138* ``n_sp_priorities``: Number of strict priorities. Packet mode is enabled on 3139 all of them. 3140* ``stats_mask``: Mask of statistics counter types to be enabled for this node. 3141* ``n_shared_shapers``: Number of shared shapers. 3142* ``shared_shaper_id``: Shared shaper id. 3143 3144Add port traffic management hierarchy leaf node 3145~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3146 3147Add leaf node to port traffic management hierarchy:: 3148 3149 testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \ 3150 (priority) (weight) (level_id) (shaper_profile_id) \ 3151 (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \ 3152 [(shared_shaper_id) (shared_shaper_id) ...] \ 3153 3154where: 3155 3156* ``parent_node_id``: Node ID of the parent. 3157* ``priority``: Node priority (highest node priority is zero). This is used by 3158 the SP algorithm running on the parent node for scheduling this node. 3159* ``weight``: Node weight (lowest weight is one). The node weight is relative 3160 to the weight sum of all siblings that have the same priority. It is used by 3161 the WFQ algorithm running on the parent node for scheduling this node. 3162* ``level_id``: Hierarchy level of the node. 3163* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by 3164 the node. 3165* ``cman_mode``: Congestion management mode to be enabled for this node. 3166* ``wred_profile_id``: WRED profile id to be enabled for this node. 3167* ``stats_mask``: Mask of statistics counter types to be enabled for this node. 3168* ``n_shared_shapers``: Number of shared shapers. 3169* ``shared_shaper_id``: Shared shaper id. 3170 3171Delete port traffic management hierarchy node 3172~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3173 3174Delete node from port traffic management hierarchy:: 3175 3176 testpmd> del port tm node (port_id) (node_id) 3177 3178Update port traffic management hierarchy parent node 3179~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3180 3181Update port traffic management hierarchy parent node:: 3182 3183 testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \ 3184 (priority) (weight) 3185 3186This function can only be called after the hierarchy commit invocation. Its 3187success depends on the port support for this operation, as advertised through 3188the port capability set. This function is valid for all nodes of the traffic 3189management hierarchy except root node. 3190 3191Suspend port traffic management hierarchy node 3192~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3193 3194 testpmd> suspend port tm node (port_id) (node_id) 3195 3196Resume port traffic management hierarchy node 3197~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3198 3199 testpmd> resume port tm node (port_id) (node_id) 3200 3201Commit port traffic management hierarchy 3202~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3203 3204Commit the traffic management hierarchy on the port:: 3205 3206 testpmd> port tm hierarchy commit (port_id) (clean_on_fail) 3207 3208where: 3209 3210* ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function 3211 call failure. On the other hand, hierarchy is preserved when this parameter 3212 is equal to zero. 3213 3214Set port traffic management mark VLAN dei 3215~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3216 3217Enables/Disables the traffic management marking on the port for VLAN packets:: 3218 3219 testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red> 3220 3221where: 3222 3223* ``port_id``: The port which on which VLAN packets marked as ``green`` or 3224 ``yellow`` or ``red`` will have dei bit enabled 3225 3226* ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green 3227 3228* ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow 3229 3230* ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red 3231 3232Set port traffic management mark IP dscp 3233~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3234 3235Enables/Disables the traffic management marking on the port for IP dscp packets:: 3236 3237 testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red> 3238 3239where: 3240 3241* ``port_id``: The port which on which IP packets marked as ``green`` or 3242 ``yellow`` or ``red`` will have IP dscp bits updated 3243 3244* ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets 3245 3246* ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets 3247 3248* ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets 3249 3250Set port traffic management mark IP ecn 3251~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3252 3253Enables/Disables the traffic management marking on the port for IP ecn packets:: 3254 3255 testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red> 3256 3257where: 3258 3259* ``port_id``: The port which on which IP packets marked as ``green`` or 3260 ``yellow`` or ``red`` will have IP ecn bits updated 3261 3262* ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01 or 2'b10 3263 to ecn of 2'b11 when IP is caring TCP or SCTP 3264 3265* ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10 3266 to ecn of 2'b11 when IP is caring TCP or SCTP 3267 3268* ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01 or 2'b10 3269 to ecn of 2'b11 when IP is caring TCP or SCTP 3270 3271Filter Functions 3272---------------- 3273 3274This section details the available filter functions that are available. 3275 3276Note these functions interface the deprecated legacy filtering framework, 3277superseded by *rte_flow*. See `Flow rules management`_. 3278 3279.. _testpmd_flow_director: 3280 3281flow_director_mask 3282~~~~~~~~~~~~~~~~~~ 3283 3284Set flow director's input masks:: 3285 3286 flow_director_mask (port_id) mode IP vlan (vlan_value) \ 3287 src_mask (ipv4_src) (ipv6_src) (src_port) \ 3288 dst_mask (ipv4_dst) (ipv6_dst) (dst_port) 3289 3290 flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value) 3291 3292 flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \ 3293 mac (mac_value) tunnel-type (tunnel_type_value) \ 3294 tunnel-id (tunnel_id_value) 3295 3296Example, to set flow director mask on port 0:: 3297 3298 testpmd> flow_director_mask 0 mode IP vlan 0xefff \ 3299 src_mask 255.255.255.255 \ 3300 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF \ 3301 dst_mask 255.255.255.255 \ 3302 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF 3303 3304flow_director_flex_payload 3305~~~~~~~~~~~~~~~~~~~~~~~~~~ 3306 3307Configure flexible payload selection:: 3308 3309 flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config) 3310 3311For example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload:: 3312 3313 testpmd> flow_director_flex_payload 0 l4 \ 3314 (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19) 3315 3316 3317.. _testpmd_rte_flow: 3318 3319Flow rules management 3320--------------------- 3321 3322Control of the generic flow API (*rte_flow*) is fully exposed through the 3323``flow`` command (configuration, validation, creation, destruction, queries 3324and operation modes). 3325 3326Considering *rte_flow* overlaps with all `Filter Functions`_, using both 3327features simultaneously may cause undefined side-effects and is therefore 3328not recommended. 3329 3330``flow`` syntax 3331~~~~~~~~~~~~~~~ 3332 3333Because the ``flow`` command uses dynamic tokens to handle the large number 3334of possible flow rules combinations, its behavior differs slightly from 3335other commands, in particular: 3336 3337- Pressing *?* or the *<tab>* key displays contextual help for the current 3338 token, not that of the entire command. 3339 3340- Optional and repeated parameters are supported (provided they are listed 3341 in the contextual help). 3342 3343The first parameter stands for the operation mode. Possible operations and 3344their general syntax are described below. They are covered in detail in the 3345following sections. 3346 3347- Get info about flow engine:: 3348 3349 flow info {port_id} 3350 3351- Configure flow engine:: 3352 3353 flow configure {port_id} 3354 [queues_number {number}] [queues_size {size}] 3355 [counters_number {number}] 3356 [aging_counters_number {number}] 3357 [meters_number {number}] 3358 3359- Create a pattern template:: 3360 flow pattern_template {port_id} create [pattern_template_id {id}] 3361 [relaxed {boolean}] [ingress] [egress] [transfer] 3362 template {item} [/ {item} [...]] / end 3363 3364- Destroy a pattern template:: 3365 3366 flow pattern_template {port_id} destroy pattern_template {id} [...] 3367 3368- Create an actions template:: 3369 3370 flow actions_template {port_id} create [actions_template_id {id}] 3371 [ingress] [egress] [transfer] 3372 template {action} [/ {action} [...]] / end 3373 mask {action} [/ {action} [...]] / end 3374 3375- Destroy an actions template:: 3376 3377 flow actions_template {port_id} destroy actions_template {id} [...] 3378 3379- Create a table:: 3380 3381 flow table {port_id} create 3382 [table_id {id}] 3383 [group {group_id}] [priority {level}] [ingress] [egress] [transfer] 3384 rules_number {number} 3385 pattern_template {pattern_template_id} 3386 actions_template {actions_template_id} 3387 3388- Destroy a table:: 3389 3390 flow table {port_id} destroy table {id} [...] 3391 3392- Check whether a flow rule can be created:: 3393 3394 flow validate {port_id} 3395 [group {group_id}] [priority {level}] [ingress] [egress] [transfer] 3396 pattern {item} [/ {item} [...]] / end 3397 actions {action} [/ {action} [...]] / end 3398 3399- Enqueue creation of a flow rule:: 3400 3401 flow queue {port_id} create {queue_id} 3402 [postpone {boolean}] template_table {table_id} 3403 pattern_template {pattern_template_index} 3404 actions_template {actions_template_index} 3405 pattern {item} [/ {item} [...]] / end 3406 actions {action} [/ {action} [...]] / end 3407 3408- Enqueue destruction of specific flow rules:: 3409 3410 flow queue {port_id} destroy {queue_id} 3411 [postpone {boolean}] rule {rule_id} [...] 3412 3413- Push enqueued operations:: 3414 3415 flow push {port_id} queue {queue_id} 3416 3417- Pull all operations results from a queue:: 3418 3419 flow pull {port_id} queue {queue_id} 3420 3421- Create a flow rule:: 3422 3423 flow create {port_id} 3424 [group {group_id}] [priority {level}] [ingress] [egress] [transfer] 3425 pattern {item} [/ {item} [...]] / end 3426 actions {action} [/ {action} [...]] / end 3427 3428- Destroy specific flow rules:: 3429 3430 flow destroy {port_id} rule {rule_id} [...] 3431 3432- Destroy all flow rules:: 3433 3434 flow flush {port_id} 3435 3436- Query an existing flow rule:: 3437 3438 flow query {port_id} {rule_id} {action} 3439 3440- List existing flow rules sorted by priority, filtered by group 3441 identifiers:: 3442 3443 flow list {port_id} [group {group_id}] [...] 3444 3445- Restrict ingress traffic to the defined flow rules:: 3446 3447 flow isolate {port_id} {boolean} 3448 3449- Dump internal representation information of all flows in hardware:: 3450 3451 flow dump {port_id} all {output_file} 3452 3453 for one flow:: 3454 3455 flow dump {port_id} rule {rule_id} {output_file} 3456 3457- List and destroy aged flow rules:: 3458 3459 flow aged {port_id} [destroy] 3460 3461- Tunnel offload - create a tunnel stub:: 3462 3463 flow tunnel create {port_id} type {tunnel_type} 3464 3465- Tunnel offload - destroy a tunnel stub:: 3466 3467 flow tunnel destroy {port_id} id {tunnel_id} 3468 3469- Tunnel offload - list port tunnel stubs:: 3470 3471 flow tunnel list {port_id} 3472 3473Retrieving info about flow management engine 3474~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3475 3476``flow info`` retrieves info on pre-configurable resources in the underlying 3477device to give a hint of possible values for flow engine configuration. 3478 3479``rte_flow_info_get()``:: 3480 3481 flow info {port_id} 3482 3483If successful, it will show:: 3484 3485 Flow engine resources on port #[...]: 3486 Number of queues: #[...] 3487 Size of queues: #[...] 3488 Number of counters: #[...] 3489 Number of aging objects: #[...] 3490 Number of meters: #[...] 3491 3492Otherwise it will show an error message of the form:: 3493 3494 Caught error type [...] ([...]): [...] 3495 3496Configuring flow management engine 3497~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3498 3499``flow configure`` pre-allocates all the needed resources in the underlying 3500device to be used later at the flow creation. Flow queues are allocated as well 3501for asynchronous flow creation/destruction operations. It is bound to 3502``rte_flow_configure()``:: 3503 3504 flow configure {port_id} 3505 [queues_number {number}] [queues_size {size}] 3506 [counters_number {number}] 3507 [aging_counters_number {number}] 3508 [meters_number {number}] 3509 3510If successful, it will show:: 3511 3512 Configure flows on port #[...]: number of queues #[...] with #[...] elements 3513 3514Otherwise it will show an error message of the form:: 3515 3516 Caught error type [...] ([...]): [...] 3517 3518Creating pattern templates 3519~~~~~~~~~~~~~~~~~~~~~~~~~~ 3520 3521``flow pattern_template create`` creates the specified pattern template. 3522It is bound to ``rte_flow_pattern_template_create()``:: 3523 3524 flow pattern_template {port_id} create [pattern_template_id {id}] 3525 [relaxed {boolean}] [ingress] [egress] [transfer] 3526 template {item} [/ {item} [...]] / end 3527 3528If successful, it will show:: 3529 3530 Pattern template #[...] created 3531 3532Otherwise it will show an error message of the form:: 3533 3534 Caught error type [...] ([...]): [...] 3535 3536This command uses the same pattern items as ``flow create``, 3537their format is described in `Creating flow rules`_. 3538 3539Destroying pattern templates 3540~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3541 3542``flow pattern_template destroy`` destroys one or more pattern templates 3543from their template ID (as returned by ``flow pattern_template create``), 3544this command calls ``rte_flow_pattern_template_destroy()`` as many 3545times as necessary:: 3546 3547 flow pattern_template {port_id} destroy pattern_template {id} [...] 3548 3549If successful, it will show:: 3550 3551 Pattern template #[...] destroyed 3552 3553It does not report anything for pattern template IDs that do not exist. 3554The usual error message is shown when a pattern template cannot be destroyed:: 3555 3556 Caught error type [...] ([...]): [...] 3557 3558Creating actions templates 3559~~~~~~~~~~~~~~~~~~~~~~~~~~ 3560 3561``flow actions_template create`` creates the specified actions template. 3562It is bound to ``rte_flow_actions_template_create()``:: 3563 3564 flow actions_template {port_id} create [actions_template_id {id}] 3565 [ingress] [egress] [transfer] 3566 template {action} [/ {action} [...]] / end 3567 mask {action} [/ {action} [...]] / end 3568 3569If successful, it will show:: 3570 3571 Actions template #[...] created 3572 3573Otherwise it will show an error message of the form:: 3574 3575 Caught error type [...] ([...]): [...] 3576 3577This command uses the same actions as ``flow create``, 3578their format is described in `Creating flow rules`_. 3579 3580Destroying actions templates 3581~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3582 3583``flow actions_template destroy`` destroys one or more actions templates 3584from their template ID (as returned by ``flow actions_template create``), 3585this command calls ``rte_flow_actions_template_destroy()`` as many 3586times as necessary:: 3587 3588 flow actions_template {port_id} destroy actions_template {id} [...] 3589 3590If successful, it will show:: 3591 3592 Actions template #[...] destroyed 3593 3594It does not report anything for actions template IDs that do not exist. 3595The usual error message is shown when an actions template cannot be destroyed:: 3596 3597 Caught error type [...] ([...]): [...] 3598 3599Creating template table 3600~~~~~~~~~~~~~~~~~~~~~~~ 3601 3602``flow template_table create`` creates the specified template table. 3603It is bound to ``rte_flow_template_table_create()``:: 3604 3605 flow template_table {port_id} create 3606 [table_id {id}] [group {group_id}] 3607 [priority {level}] [ingress] [egress] [transfer] 3608 rules_number {number} 3609 pattern_template {pattern_template_id} 3610 actions_template {actions_template_id} 3611 3612If successful, it will show:: 3613 3614 Template table #[...] created 3615 3616Otherwise it will show an error message of the form:: 3617 3618 Caught error type [...] ([...]): [...] 3619 3620Destroying flow table 3621~~~~~~~~~~~~~~~~~~~~~ 3622 3623``flow template_table destroy`` destroys one or more template tables 3624from their table ID (as returned by ``flow template_table create``), 3625this command calls ``rte_flow_template_table_destroy()`` as many 3626times as necessary:: 3627 3628 flow template_table {port_id} destroy table {id} [...] 3629 3630If successful, it will show:: 3631 3632 Template table #[...] destroyed 3633 3634It does not report anything for table IDs that do not exist. 3635The usual error message is shown when a table cannot be destroyed:: 3636 3637 Caught error type [...] ([...]): [...] 3638 3639Pushing enqueued operations 3640~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3641 3642``flow push`` pushes all the outstanding enqueued operations 3643to the underlying device immediately. 3644It is bound to ``rte_flow_push()``:: 3645 3646 flow push {port_id} queue {queue_id} 3647 3648If successful, it will show:: 3649 3650 Queue #[...] operations pushed 3651 3652The usual error message is shown when operations cannot be pushed:: 3653 3654 Caught error type [...] ([...]): [...] 3655 3656Pulling flow operations results 3657~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3658 3659``flow pull`` asks the underlying device about flow queue operations 3660results and return all the processed (successfully or not) operations. 3661It is bound to ``rte_flow_pull()``:: 3662 3663 flow pull {port_id} queue {queue_id} 3664 3665If successful, it will show:: 3666 3667 Queue #[...] pulled #[...] operations (#[...] failed, #[...] succeeded) 3668 3669The usual error message is shown when operations results cannot be pulled:: 3670 3671 Caught error type [...] ([...]): [...] 3672 3673Creating a tunnel stub for offload 3674~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3675 3676``flow tunnel create`` setup a tunnel stub for tunnel offload flow rules:: 3677 3678 flow tunnel create {port_id} type {tunnel_type} 3679 3680If successful, it will return a tunnel stub ID usable with other commands:: 3681 3682 port [...]: flow tunnel #[...] type [...] 3683 3684Tunnel stub ID is relative to a port. 3685 3686Destroying tunnel offload stub 3687~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3688 3689``flow tunnel destroy`` destroy port tunnel stub:: 3690 3691 flow tunnel destroy {port_id} id {tunnel_id} 3692 3693Listing tunnel offload stubs 3694~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3695 3696``flow tunnel list`` list port tunnel offload stubs:: 3697 3698 flow tunnel list {port_id} 3699 3700Validating flow rules 3701~~~~~~~~~~~~~~~~~~~~~ 3702 3703``flow validate`` reports whether a flow rule would be accepted by the 3704underlying device in its current state but stops short of creating it. It is 3705bound to ``rte_flow_validate()``:: 3706 3707 flow validate {port_id} 3708 [group {group_id}] [priority {level}] [ingress] [egress] [transfer] 3709 pattern {item} [/ {item} [...]] / end 3710 actions {action} [/ {action} [...]] / end 3711 3712If successful, it will show:: 3713 3714 Flow rule validated 3715 3716Otherwise it will show an error message of the form:: 3717 3718 Caught error type [...] ([...]): [...] 3719 3720This command uses the same parameters as ``flow create``, their format is 3721described in `Creating flow rules`_. 3722 3723Check whether redirecting any Ethernet packet received on port 0 to RX queue 3724index 6 is supported:: 3725 3726 testpmd> flow validate 0 ingress pattern eth / end 3727 actions queue index 6 / end 3728 Flow rule validated 3729 testpmd> 3730 3731Port 0 does not support TCPv6 rules:: 3732 3733 testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end 3734 actions drop / end 3735 Caught error type 9 (specific pattern item): Invalid argument 3736 testpmd> 3737 3738Creating flow rules 3739~~~~~~~~~~~~~~~~~~~ 3740 3741``flow create`` validates and creates the specified flow rule. It is bound 3742to ``rte_flow_create()``:: 3743 3744 flow create {port_id} 3745 [group {group_id}] [priority {level}] [ingress] [egress] [transfer] 3746 [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}] 3747 pattern {item} [/ {item} [...]] / end 3748 actions {action} [/ {action} [...]] / end 3749 3750If successful, it will return a flow rule ID usable with other commands:: 3751 3752 Flow rule #[...] created 3753 3754Otherwise it will show an error message of the form:: 3755 3756 Caught error type [...] ([...]): [...] 3757 3758Parameters describe in the following order: 3759 3760- Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens). 3761- Tunnel offload specification (tunnel_set, tunnel_match) 3762- A matching pattern, starting with the *pattern* token and terminated by an 3763 *end* pattern item. 3764- Actions, starting with the *actions* token and terminated by an *end* 3765 action. 3766 3767These translate directly to *rte_flow* objects provided as-is to the 3768underlying functions. 3769 3770The shortest valid definition only comprises mandatory tokens:: 3771 3772 testpmd> flow create 0 pattern end actions end 3773 3774Note that PMDs may refuse rules that essentially do nothing such as this 3775one. 3776 3777**All unspecified object values are automatically initialized to 0.** 3778 3779Enqueueing creation of flow rules 3780~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3781 3782``flow queue create`` adds creation operation of a flow rule to a queue. 3783It is bound to ``rte_flow_async_create()``:: 3784 3785 flow queue {port_id} create {queue_id} 3786 [postpone {boolean}] template_table {table_id} 3787 pattern_template {pattern_template_index} 3788 actions_template {actions_template_index} 3789 pattern {item} [/ {item} [...]] / end 3790 actions {action} [/ {action} [...]] / end 3791 3792If successful, it will return a flow rule ID usable with other commands:: 3793 3794 Flow rule #[...] creaion enqueued 3795 3796Otherwise it will show an error message of the form:: 3797 3798 Caught error type [...] ([...]): [...] 3799 3800This command uses the same pattern items and actions as ``flow create``, 3801their format is described in `Creating flow rules`_. 3802 3803``flow queue pull`` must be called to retrieve the operation status. 3804 3805Attributes 3806^^^^^^^^^^ 3807 3808These tokens affect flow rule attributes (``struct rte_flow_attr``) and are 3809specified before the ``pattern`` token. 3810 3811- ``group {group id}``: priority group. 3812- ``priority {level}``: priority level within group. 3813- ``ingress``: rule applies to ingress traffic. 3814- ``egress``: rule applies to egress traffic. 3815- ``transfer``: apply rule directly to endpoints found in pattern. 3816 3817Please note that use of ``transfer`` attribute requires that the flow and 3818its indirect components be managed via so-called ``transfer`` proxy port. 3819See `show flow transfer proxy port ID for the given port`_ for details. 3820 3821Each instance of an attribute specified several times overrides the previous 3822value as shown below (group 4 is used):: 3823 3824 testpmd> flow create 0 group 42 group 24 group 4 [...] 3825 3826Note that once enabled, ``ingress`` and ``egress`` cannot be disabled. 3827 3828While not specifying a direction is an error, some rules may allow both 3829simultaneously. 3830 3831Most rules affect RX therefore contain the ``ingress`` token:: 3832 3833 testpmd> flow create 0 ingress pattern [...] 3834 3835Tunnel offload 3836^^^^^^^^^^^^^^ 3837 3838Indicate tunnel offload rule type 3839 3840- ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type. 3841- ``tunnel_match {tunnel_id}``: mark rule as tunnel offload match type. 3842 3843Matching pattern 3844^^^^^^^^^^^^^^^^ 3845 3846A matching pattern starts after the ``pattern`` token. It is made of pattern 3847items and is terminated by a mandatory ``end`` item. 3848 3849Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum 3850rte_flow_item_type``). 3851 3852The ``/`` token is used as a separator between pattern items as shown 3853below:: 3854 3855 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...] 3856 3857Note that protocol items like these must be stacked from lowest to highest 3858layer to make sense. For instance, the following rule is either invalid or 3859unlikely to match any packet:: 3860 3861 testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...] 3862 3863More information on these restrictions can be found in the *rte_flow* 3864documentation. 3865 3866Several items support additional specification structures, for example 3867``ipv4`` allows specifying source and destination addresses as follows:: 3868 3869 testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1 3870 dst is 10.2.0.0 / end [...] 3871 3872This rule matches all IPv4 traffic with the specified properties. 3873 3874In this example, ``src`` and ``dst`` are field names of the underlying 3875``struct rte_flow_item_ipv4`` object. All item properties can be specified 3876in a similar fashion. 3877 3878The ``is`` token means that the subsequent value must be matched exactly, 3879and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item`` 3880accordingly. Possible assignment tokens are: 3881 3882- ``is``: match value perfectly (with full bit-mask). 3883- ``spec``: match value according to configured bit-mask. 3884- ``last``: specify upper bound to establish a range. 3885- ``mask``: specify bit-mask with relevant bits set to one. 3886- ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one. 3887 3888These yield identical results:: 3889 3890 ipv4 src is 10.1.1.1 3891 3892:: 3893 3894 ipv4 src spec 10.1.1.1 src mask 255.255.255.255 3895 3896:: 3897 3898 ipv4 src spec 10.1.1.1 src prefix 32 3899 3900:: 3901 3902 ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value 3903 3904:: 3905 3906 ipv4 src is 10.1.1.1 src last 0 # 0 disables range 3907 3908Inclusive ranges can be defined with ``last``:: 3909 3910 ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4 3911 3912Note that ``mask`` affects both ``spec`` and ``last``:: 3913 3914 ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0 3915 # matches 10.1.0.0 to 10.2.255.255 3916 3917Properties can be modified multiple times:: 3918 3919 ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4 3920 3921:: 3922 3923 ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16 3924 3925Pattern items 3926^^^^^^^^^^^^^ 3927 3928This section lists supported pattern items and their attributes, if any. 3929 3930- ``end``: end list of pattern items. 3931 3932- ``void``: no-op pattern item. 3933 3934- ``invert``: perform actions when pattern does not match. 3935 3936- ``any``: match any protocol for the current layer. 3937 3938 - ``num {unsigned}``: number of layers covered. 3939 3940- ``pf``: match traffic from/to the physical function. 3941 3942- ``vf``: match traffic from/to a virtual function ID. 3943 3944 - ``id {unsigned}``: VF ID. 3945 3946- ``phy_port``: match traffic from/to a specific physical port. 3947 3948 - ``index {unsigned}``: physical port index. 3949 3950- ``port_id``: match traffic from/to a given DPDK port ID. 3951 3952 - ``id {unsigned}``: DPDK port ID. 3953 3954- ``mark``: match value set in previously matched flow rule using the mark action. 3955 3956 - ``id {unsigned}``: arbitrary integer value. 3957 3958- ``raw``: match an arbitrary byte string. 3959 3960 - ``relative {boolean}``: look for pattern after the previous item. 3961 - ``search {boolean}``: search pattern from offset (see also limit). 3962 - ``offset {integer}``: absolute or relative offset for pattern. 3963 - ``limit {unsigned}``: search area limit for start of pattern. 3964 - ``pattern {string}``: byte string to look for. 3965 - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for. 3966 3967- ``eth``: match Ethernet header. 3968 3969 - ``dst {MAC-48}``: destination MAC. 3970 - ``src {MAC-48}``: source MAC. 3971 - ``type {unsigned}``: EtherType or TPID. 3972 3973- ``vlan``: match 802.1Q/ad VLAN tag. 3974 3975 - ``tci {unsigned}``: tag control information. 3976 - ``pcp {unsigned}``: priority code point. 3977 - ``dei {unsigned}``: drop eligible indicator. 3978 - ``vid {unsigned}``: VLAN identifier. 3979 - ``inner_type {unsigned}``: inner EtherType or TPID. 3980 3981- ``ipv4``: match IPv4 header. 3982 3983 - ``version_ihl {unsigned}``: IPv4 version and IP header length. 3984 - ``tos {unsigned}``: type of service. 3985 - ``ttl {unsigned}``: time to live. 3986 - ``proto {unsigned}``: next protocol ID. 3987 - ``src {ipv4 address}``: source address. 3988 - ``dst {ipv4 address}``: destination address. 3989 3990- ``ipv6``: match IPv6 header. 3991 3992 - ``tc {unsigned}``: traffic class. 3993 - ``flow {unsigned}``: flow label. 3994 - ``proto {unsigned}``: protocol (next header). 3995 - ``hop {unsigned}``: hop limit. 3996 - ``src {ipv6 address}``: source address. 3997 - ``dst {ipv6 address}``: destination address. 3998 3999- ``icmp``: match ICMP header. 4000 4001 - ``type {unsigned}``: ICMP packet type. 4002 - ``code {unsigned}``: ICMP packet code. 4003 4004- ``udp``: match UDP header. 4005 4006 - ``src {unsigned}``: UDP source port. 4007 - ``dst {unsigned}``: UDP destination port. 4008 4009- ``tcp``: match TCP header. 4010 4011 - ``src {unsigned}``: TCP source port. 4012 - ``dst {unsigned}``: TCP destination port. 4013 4014- ``sctp``: match SCTP header. 4015 4016 - ``src {unsigned}``: SCTP source port. 4017 - ``dst {unsigned}``: SCTP destination port. 4018 - ``tag {unsigned}``: validation tag. 4019 - ``cksum {unsigned}``: checksum. 4020 4021- ``vxlan``: match VXLAN header. 4022 4023 - ``vni {unsigned}``: VXLAN identifier. 4024 - ``last_rsvd {unsigned}``: VXLAN last reserved 8-bits. 4025 4026- ``e_tag``: match IEEE 802.1BR E-Tag header. 4027 4028 - ``grp_ecid_b {unsigned}``: GRP and E-CID base. 4029 4030- ``nvgre``: match NVGRE header. 4031 4032 - ``tni {unsigned}``: virtual subnet ID. 4033 4034- ``mpls``: match MPLS header. 4035 4036 - ``label {unsigned}``: MPLS label. 4037 4038- ``gre``: match GRE header. 4039 4040 - ``protocol {unsigned}``: protocol type. 4041 4042- ``gre_key``: match GRE optional key field. 4043 4044 - ``value {unsigned}``: key value. 4045 4046- ``gre_option``: match GRE optional fields(checksum/key/sequence). 4047 4048 - ``checksum {unsigned}``: checksum value. 4049 - ``key {unsigned}``: key value. 4050 - ``sequence {unsigned}``: sequence number value. 4051 4052- ``fuzzy``: fuzzy pattern match, expect faster than default. 4053 4054 - ``thresh {unsigned}``: accuracy threshold. 4055 4056- ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header. 4057 4058 - ``teid {unsigned}``: tunnel endpoint identifier. 4059 4060- ``geneve``: match GENEVE header. 4061 4062 - ``vni {unsigned}``: virtual network identifier. 4063 - ``protocol {unsigned}``: protocol type. 4064 4065- ``geneve-opt``: match GENEVE header option. 4066 4067 - ``class {unsigned}``: GENEVE option class. 4068 - ``type {unsigned}``: GENEVE option type. 4069 - ``length {unsigned}``: GENEVE option length in 32-bit words. 4070 - ``data {hex string}``: GENEVE option data, the length is defined by 4071 ``length`` field. 4072 4073- ``vxlan-gpe``: match VXLAN-GPE header. 4074 4075 - ``vni {unsigned}``: VXLAN-GPE identifier. 4076 4077- ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4. 4078 4079 - ``sha {MAC-48}``: sender hardware address. 4080 - ``spa {ipv4 address}``: sender IPv4 address. 4081 - ``tha {MAC-48}``: target hardware address. 4082 - ``tpa {ipv4 address}``: target IPv4 address. 4083 4084- ``ipv6_ext``: match presence of any IPv6 extension header. 4085 4086 - ``next_hdr {unsigned}``: next header. 4087 4088- ``icmp6``: match any ICMPv6 header. 4089 4090 - ``type {unsigned}``: ICMPv6 type. 4091 - ``code {unsigned}``: ICMPv6 code. 4092 4093- ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation. 4094 4095 - ``target_addr {ipv6 address}``: target address. 4096 4097- ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement. 4098 4099 - ``target_addr {ipv6 address}``: target address. 4100 4101- ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option. 4102 4103 - ``type {unsigned}``: ND option type. 4104 4105- ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet 4106 link-layer address option. 4107 4108 - ``sla {MAC-48}``: source Ethernet LLA. 4109 4110- ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet 4111 link-layer address option. 4112 4113 - ``tla {MAC-48}``: target Ethernet LLA. 4114 4115- ``meta``: match application specific metadata. 4116 4117 - ``data {unsigned}``: metadata value. 4118 4119- ``gtp_psc``: match GTP PDU extension header with type 0x85. 4120 4121 - ``pdu_type {unsigned}``: PDU type. 4122 4123 - ``qfi {unsigned}``: QoS flow identifier. 4124 4125- ``pppoes``, ``pppoed``: match PPPoE header. 4126 4127 - ``session_id {unsigned}``: session identifier. 4128 4129- ``pppoe_proto_id``: match PPPoE session protocol identifier. 4130 4131 - ``proto_id {unsigned}``: PPP protocol identifier. 4132 4133- ``l2tpv3oip``: match L2TPv3 over IP header. 4134 4135 - ``session_id {unsigned}``: L2TPv3 over IP session identifier. 4136 4137- ``ah``: match AH header. 4138 4139 - ``spi {unsigned}``: security parameters index. 4140 4141- ``pfcp``: match PFCP header. 4142 4143 - ``s_field {unsigned}``: S field. 4144 - ``seid {unsigned}``: session endpoint identifier. 4145 4146- ``integrity``: match packet integrity. 4147 4148 - ``level {unsigned}``: Packet encapsulation level the item should 4149 apply to. See rte_flow_action_rss for details. 4150 - ``value {unsigned}``: A bitmask that specify what packet elements 4151 must be matched for integrity. 4152 4153- ``conntrack``: match conntrack state. 4154 4155- ``port_representor``: match traffic entering the embedded switch from the given ethdev 4156 4157 - ``port_id {unsigned}``: ethdev port ID 4158 4159- ``represented_port``: match traffic entering the embedded switch from 4160 the entity represented by the given ethdev 4161 4162 - ``ethdev_port_id {unsigned}``: ethdev port ID 4163 4164- ``l2tpv2``: match L2TPv2 header. 4165 4166 - ``length {unsigned}``: L2TPv2 option length. 4167 - ``tunnel_id {unsigned}``: L2TPv2 tunnel identifier. 4168 - ``session_id {unsigned}``: L2TPv2 session identifier. 4169 - ``ns {unsigned}``: L2TPv2 option ns. 4170 - ``nr {unsigned}``: L2TPv2 option nr. 4171 - ``offset_size {unsigned}``: L2TPv2 option offset. 4172 4173- ``ppp``: match PPP header. 4174 4175 - ``addr {unsigned}``: PPP address. 4176 - ``ctrl {unsigned}``: PPP control. 4177 - ``proto_id {unsigned}``: PPP protocol identifier. 4178 4179Actions list 4180^^^^^^^^^^^^ 4181 4182A list of actions starts after the ``actions`` token in the same fashion as 4183`Matching pattern`_; actions are separated by ``/`` tokens and the list is 4184terminated by a mandatory ``end`` action. 4185 4186Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum 4187rte_flow_action_type``). 4188 4189Dropping all incoming UDPv4 packets can be expressed as follows:: 4190 4191 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end 4192 actions drop / end 4193 4194Several actions have configurable properties which must be specified when 4195there is no valid default value. For example, ``queue`` requires a target 4196queue index. 4197 4198This rule redirects incoming UDPv4 traffic to queue index 6:: 4199 4200 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end 4201 actions queue index 6 / end 4202 4203While this one could be rejected by PMDs (unspecified queue index):: 4204 4205 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end 4206 actions queue / end 4207 4208As defined by *rte_flow*, the list is not ordered, all actions of a given 4209rule are performed simultaneously. These are equivalent:: 4210 4211 queue index 6 / void / mark id 42 / end 4212 4213:: 4214 4215 void / mark id 42 / queue index 6 / end 4216 4217All actions in a list should have different types, otherwise only the last 4218action of a given type is taken into account:: 4219 4220 queue index 4 / queue index 5 / queue index 6 / end # will use queue 6 4221 4222:: 4223 4224 drop / drop / drop / end # drop is performed only once 4225 4226:: 4227 4228 mark id 42 / queue index 3 / mark id 24 / end # mark will be 24 4229 4230Considering they are performed simultaneously, opposite and overlapping 4231actions can sometimes be combined when the end result is unambiguous:: 4232 4233 drop / queue index 6 / end # drop has no effect 4234 4235:: 4236 4237 queue index 6 / rss queues 6 7 8 / end # queue has no effect 4238 4239:: 4240 4241 drop / passthru / end # drop has no effect 4242 4243Note that PMDs may still refuse such combinations. 4244 4245Actions 4246^^^^^^^ 4247 4248This section lists supported actions and their attributes, if any. 4249 4250- ``end``: end list of actions. 4251 4252- ``void``: no-op action. 4253 4254- ``passthru``: let subsequent rule process matched packets. 4255 4256- ``jump``: redirect traffic to group on device. 4257 4258 - ``group {unsigned}``: group to redirect to. 4259 4260- ``mark``: attach 32 bit value to packets. 4261 4262 - ``id {unsigned}``: 32 bit value to return with packets. 4263 4264- ``flag``: flag packets. 4265 4266- ``queue``: assign packets to a given queue index. 4267 4268 - ``index {unsigned}``: queue index to use. 4269 4270- ``drop``: drop packets (note: passthru has priority). 4271 4272- ``count``: enable counters for this rule. 4273 4274- ``rss``: spread packets among several queues. 4275 4276 - ``func {hash function}``: RSS hash function to apply, allowed tokens are 4277 ``toeplitz``, ``simple_xor``, ``symmetric_toeplitz`` and ``default``. 4278 4279 - ``level {unsigned}``: encapsulation level for ``types``. 4280 4281 - ``types [{RSS hash type} [...]] end``: specific RSS hash types. 4282 Note that an empty list does not disable RSS but instead requests 4283 unspecified "best-effort" settings. 4284 4285 - ``key {string}``: RSS hash key, overrides ``key_len``. 4286 4287 - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in 4288 conjunction with ``key`` to pad or truncate it. 4289 4290 - ``queues [{unsigned} [...]] end``: queue indices to use. 4291 4292- ``pf``: direct traffic to physical function. 4293 4294- ``vf``: direct traffic to a virtual function ID. 4295 4296 - ``original {boolean}``: use original VF ID if possible. 4297 - ``id {unsigned}``: VF ID. 4298 4299- ``phy_port``: direct packets to physical port index. 4300 4301 - ``original {boolean}``: use original port index if possible. 4302 - ``index {unsigned}``: physical port index. 4303 4304- ``port_id``: direct matching traffic to a given DPDK port ID. 4305 4306 - ``original {boolean}``: use original DPDK port ID if possible. 4307 - ``id {unsigned}``: DPDK port ID. 4308 4309- ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``. 4310 4311 - ``mpls_ttl``: MPLS TTL. 4312 4313- ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``. 4314 4315- ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``. 4316 4317 - ``nw_ttl``: IP TTL. 4318 4319- ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``. 4320 4321- ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``. 4322 4323- ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``. 4324 4325- ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``. 4326 4327- ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``. 4328 4329 - ``ethertype``: Ethertype. 4330 4331- ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``. 4332 4333 - ``vlan_vid``: VLAN id. 4334 4335- ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``. 4336 4337 - ``vlan_pcp``: VLAN priority. 4338 4339- ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``. 4340 4341 - ``ethertype``: Ethertype. 4342 4343- ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``. 4344 4345 - ``ethertype``: Ethertype. 4346 4347- ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration 4348 is done through `Config VXLAN Encap outer layers`_. 4349 4350- ``vxlan_decap``: Performs a decapsulation action by stripping all headers of 4351 the VXLAN tunnel network overlay from the matched flow. 4352 4353- ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration 4354 is done through `Config NVGRE Encap outer layers`_. 4355 4356- ``nvgre_decap``: Performs a decapsulation action by stripping all headers of 4357 the NVGRE tunnel network overlay from the matched flow. 4358 4359- ``l2_encap``: Performs a L2 encapsulation, L2 configuration 4360 is done through `Config L2 Encap`_. 4361 4362- ``l2_decap``: Performs a L2 decapsulation, L2 configuration 4363 is done through `Config L2 Decap`_. 4364 4365- ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer 4366 configuration is done through `Config MPLSoGRE Encap outer layers`_. 4367 4368- ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer 4369 configuration is done through `Config MPLSoGRE Decap outer layers`_. 4370 4371- ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer 4372 configuration is done through `Config MPLSoUDP Encap outer layers`_. 4373 4374- ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer 4375 configuration is done through `Config MPLSoUDP Decap outer layers`_. 4376 4377- ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header. 4378 4379 - ``ipv4_addr``: New IPv4 source address. 4380 4381- ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4 4382 header. 4383 4384 - ``ipv4_addr``: New IPv4 destination address. 4385 4386- ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header. 4387 4388 - ``ipv6_addr``: New IPv6 source address. 4389 4390- ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6 4391 header. 4392 4393 - ``ipv6_addr``: New IPv6 destination address. 4394 4395- ``set_tp_src``: Set a new source port number in the outermost TCP/UDP 4396 header. 4397 4398 - ``port``: New TCP/UDP source port number. 4399 4400- ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP 4401 header. 4402 4403 - ``port``: New TCP/UDP destination port number. 4404 4405- ``mac_swap``: Swap the source and destination MAC addresses in the outermost 4406 Ethernet header. 4407 4408- ``dec_ttl``: Performs a decrease TTL value action 4409 4410- ``set_ttl``: Set TTL value with specified value 4411 - ``ttl_value {unsigned}``: The new TTL value to be set 4412 4413- ``set_mac_src``: set source MAC address 4414 4415 - ``mac_addr {MAC-48}``: new source MAC address 4416 4417- ``set_mac_dst``: set destination MAC address 4418 4419 - ``mac_addr {MAC-48}``: new destination MAC address 4420 4421- ``inc_tcp_seq``: Increase sequence number in the outermost TCP header. 4422 4423 - ``value {unsigned}``: Value to increase TCP sequence number by. 4424 4425- ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header. 4426 4427 - ``value {unsigned}``: Value to decrease TCP sequence number by. 4428 4429- ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header. 4430 4431 - ``value {unsigned}``: Value to increase TCP acknowledgment number by. 4432 4433- ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header. 4434 4435 - ``value {unsigned}``: Value to decrease TCP acknowledgment number by. 4436 4437- ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value 4438 4439 - ``dscp_value {unsigned}``: The new DSCP value to be set 4440 4441- ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value 4442 4443 - ``dscp_value {unsigned}``: The new DSCP value to be set 4444 4445- ``indirect``: Use indirect action created via 4446 ``flow indirect_action {port_id} create`` 4447 4448 - ``indirect_action_id {unsigned}``: Indirect action ID to use 4449 4450- ``color``: Color the packet to reflect the meter color result 4451 4452 - ``type {value}``: Set color type with specified value(green/yellow/red) 4453 4454- ``port_representor``: at embedded switch level, send matching traffic to 4455 the given ethdev 4456 4457 - ``port_id {unsigned}``: ethdev port ID 4458 4459- ``represented_port``: at embedded switch level, send matching traffic to 4460 the entity represented by the given ethdev 4461 4462 - ``ethdev_port_id {unsigned}``: ethdev port ID 4463 4464Destroying flow rules 4465~~~~~~~~~~~~~~~~~~~~~ 4466 4467``flow destroy`` destroys one or more rules from their rule ID (as returned 4468by ``flow create``), this command calls ``rte_flow_destroy()`` as many 4469times as necessary:: 4470 4471 flow destroy {port_id} rule {rule_id} [...] 4472 4473If successful, it will show:: 4474 4475 Flow rule #[...] destroyed 4476 4477It does not report anything for rule IDs that do not exist. The usual error 4478message is shown when a rule cannot be destroyed:: 4479 4480 Caught error type [...] ([...]): [...] 4481 4482``flow flush`` destroys all rules on a device and does not take extra 4483arguments. It is bound to ``rte_flow_flush()``:: 4484 4485 flow flush {port_id} 4486 4487Any errors are reported as above. 4488 4489Creating several rules and destroying them:: 4490 4491 testpmd> flow create 0 ingress pattern eth / ipv6 / end 4492 actions queue index 2 / end 4493 Flow rule #0 created 4494 testpmd> flow create 0 ingress pattern eth / ipv4 / end 4495 actions queue index 3 / end 4496 Flow rule #1 created 4497 testpmd> flow destroy 0 rule 0 rule 1 4498 Flow rule #1 destroyed 4499 Flow rule #0 destroyed 4500 testpmd> 4501 4502The same result can be achieved using ``flow flush``:: 4503 4504 testpmd> flow create 0 ingress pattern eth / ipv6 / end 4505 actions queue index 2 / end 4506 Flow rule #0 created 4507 testpmd> flow create 0 ingress pattern eth / ipv4 / end 4508 actions queue index 3 / end 4509 Flow rule #1 created 4510 testpmd> flow flush 0 4511 testpmd> 4512 4513Non-existent rule IDs are ignored:: 4514 4515 testpmd> flow create 0 ingress pattern eth / ipv6 / end 4516 actions queue index 2 / end 4517 Flow rule #0 created 4518 testpmd> flow create 0 ingress pattern eth / ipv4 / end 4519 actions queue index 3 / end 4520 Flow rule #1 created 4521 testpmd> flow destroy 0 rule 42 rule 10 rule 2 4522 testpmd> 4523 testpmd> flow destroy 0 rule 0 4524 Flow rule #0 destroyed 4525 testpmd> 4526 4527Enqueueing destruction of flow rules 4528~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4529 4530``flow queue destroy`` adds destruction operations to destroy one or more rules 4531from their rule ID (as returned by ``flow queue create``) to a queue, 4532this command calls ``rte_flow_async_destroy()`` as many times as necessary:: 4533 4534 flow queue {port_id} destroy {queue_id} 4535 [postpone {boolean}] rule {rule_id} [...] 4536 4537If successful, it will show:: 4538 4539 Flow rule #[...] destruction enqueued 4540 4541It does not report anything for rule IDs that do not exist. The usual error 4542message is shown when a rule cannot be destroyed:: 4543 4544 Caught error type [...] ([...]): [...] 4545 4546``flow queue pull`` must be called to retrieve the operation status. 4547 4548Querying flow rules 4549~~~~~~~~~~~~~~~~~~~ 4550 4551``flow query`` queries a specific action of a flow rule having that 4552ability. Such actions collect information that can be reported using this 4553command. It is bound to ``rte_flow_query()``:: 4554 4555 flow query {port_id} {rule_id} {action} 4556 4557If successful, it will display either the retrieved data for known actions 4558or the following message:: 4559 4560 Cannot display result for action type [...] ([...]) 4561 4562Otherwise, it will complain either that the rule does not exist or that some 4563error occurred:: 4564 4565 Flow rule #[...] not found 4566 4567:: 4568 4569 Caught error type [...] ([...]): [...] 4570 4571Currently only the ``count`` action is supported. This action reports the 4572number of packets that hit the flow rule and the total number of bytes. Its 4573output has the following format:: 4574 4575 count: 4576 hits_set: [...] # whether "hits" contains a valid value 4577 bytes_set: [...] # whether "bytes" contains a valid value 4578 hits: [...] # number of packets 4579 bytes: [...] # number of bytes 4580 4581Querying counters for TCPv6 packets redirected to queue 6:: 4582 4583 testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end 4584 actions queue index 6 / count / end 4585 Flow rule #4 created 4586 testpmd> flow query 0 4 count 4587 count: 4588 hits_set: 1 4589 bytes_set: 0 4590 hits: 386446 4591 bytes: 0 4592 testpmd> 4593 4594Listing flow rules 4595~~~~~~~~~~~~~~~~~~ 4596 4597``flow list`` lists existing flow rules sorted by priority and optionally 4598filtered by group identifiers:: 4599 4600 flow list {port_id} [group {group_id}] [...] 4601 4602This command only fails with the following message if the device does not 4603exist:: 4604 4605 Invalid port [...] 4606 4607Output consists of a header line followed by a short description of each 4608flow rule, one per line. There is no output at all when no flow rules are 4609configured on the device:: 4610 4611 ID Group Prio Attr Rule 4612 [...] [...] [...] [...] [...] 4613 4614``Attr`` column flags: 4615 4616- ``i`` for ``ingress``. 4617- ``e`` for ``egress``. 4618 4619Creating several flow rules and listing them:: 4620 4621 testpmd> flow create 0 ingress pattern eth / ipv4 / end 4622 actions queue index 6 / end 4623 Flow rule #0 created 4624 testpmd> flow create 0 ingress pattern eth / ipv6 / end 4625 actions queue index 2 / end 4626 Flow rule #1 created 4627 testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end 4628 actions rss queues 6 7 8 end / end 4629 Flow rule #2 created 4630 testpmd> flow list 0 4631 ID Group Prio Attr Rule 4632 0 0 0 i- ETH IPV4 => QUEUE 4633 1 0 0 i- ETH IPV6 => QUEUE 4634 2 0 5 i- ETH IPV4 UDP => RSS 4635 testpmd> 4636 4637Rules are sorted by priority (i.e. group ID first, then priority level):: 4638 4639 testpmd> flow list 1 4640 ID Group Prio Attr Rule 4641 0 0 0 i- ETH => COUNT 4642 6 0 500 i- ETH IPV6 TCP => DROP COUNT 4643 5 0 1000 i- ETH IPV6 ICMP => QUEUE 4644 1 24 0 i- ETH IPV4 UDP => QUEUE 4645 4 24 10 i- ETH IPV4 TCP => DROP 4646 3 24 20 i- ETH IPV4 => DROP 4647 2 24 42 i- ETH IPV4 UDP => QUEUE 4648 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE 4649 testpmd> 4650 4651Output can be limited to specific groups:: 4652 4653 testpmd> flow list 1 group 0 group 63 4654 ID Group Prio Attr Rule 4655 0 0 0 i- ETH => COUNT 4656 6 0 500 i- ETH IPV6 TCP => DROP COUNT 4657 5 0 1000 i- ETH IPV6 ICMP => QUEUE 4658 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE 4659 testpmd> 4660 4661Toggling isolated mode 4662~~~~~~~~~~~~~~~~~~~~~~ 4663 4664``flow isolate`` can be used to tell the underlying PMD that ingress traffic 4665must only be injected from the defined flow rules; that no default traffic 4666is expected outside those rules and the driver is free to assign more 4667resources to handle them. It is bound to ``rte_flow_isolate()``:: 4668 4669 flow isolate {port_id} {boolean} 4670 4671If successful, enabling or disabling isolated mode shows either:: 4672 4673 Ingress traffic on port [...] 4674 is now restricted to the defined flow rules 4675 4676Or:: 4677 4678 Ingress traffic on port [...] 4679 is not restricted anymore to the defined flow rules 4680 4681Otherwise, in case of error:: 4682 4683 Caught error type [...] ([...]): [...] 4684 4685Mainly due to its side effects, PMDs supporting this mode may not have the 4686ability to toggle it more than once without reinitializing affected ports 4687first (e.g. by exiting testpmd). 4688 4689Enabling isolated mode:: 4690 4691 testpmd> flow isolate 0 true 4692 Ingress traffic on port 0 is now restricted to the defined flow rules 4693 testpmd> 4694 4695Disabling isolated mode:: 4696 4697 testpmd> flow isolate 0 false 4698 Ingress traffic on port 0 is not restricted anymore to the defined flow rules 4699 testpmd> 4700 4701Dumping HW internal information 4702~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4703 4704``flow dump`` dumps the hardware's internal representation information of 4705all flows. It is bound to ``rte_flow_dev_dump()``:: 4706 4707 flow dump {port_id} {output_file} 4708 4709If successful, it will show:: 4710 4711 Flow dump finished 4712 4713Otherwise, it will complain error occurred:: 4714 4715 Caught error type [...] ([...]): [...] 4716 4717Listing and destroying aged flow rules 4718~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4719 4720``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``, 4721and ``destroy`` parameter can be used to destroy those flow rules in PMD. 4722 4723 flow aged {port_id} [destroy] 4724 4725Listing current aged flow rules:: 4726 4727 testpmd> flow aged 0 4728 Port 0 total aged flows: 0 4729 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.14 / end 4730 actions age timeout 5 / queue index 0 / end 4731 Flow rule #0 created 4732 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.15 / end 4733 actions age timeout 4 / queue index 0 / end 4734 Flow rule #1 created 4735 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.16 / end 4736 actions age timeout 2 / queue index 0 / end 4737 Flow rule #2 created 4738 testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.17 / end 4739 actions age timeout 3 / queue index 0 / end 4740 Flow rule #3 created 4741 4742 4743Aged Rules are simply list as command ``flow list {port_id}``, but strip the detail rule 4744information, all the aged flows are sorted by the longest timeout time. For example, if 4745those rules be configured in the same time, ID 2 will be the first aged out rule, the next 4746will be ID 3, ID 1, ID 0:: 4747 4748 testpmd> flow aged 0 4749 Port 0 total aged flows: 4 4750 ID Group Prio Attr 4751 2 0 0 i-- 4752 3 0 0 i-- 4753 1 0 0 i-- 4754 0 0 0 i-- 4755 4756If attach ``destroy`` parameter, the command will destroy all the list aged flow rules. 4757 4758 testpmd> flow aged 0 destroy 4759 Port 0 total aged flows: 4 4760 ID Group Prio Attr 4761 2 0 0 i-- 4762 3 0 0 i-- 4763 1 0 0 i-- 4764 0 0 0 i-- 4765 4766 Flow rule #2 destroyed 4767 Flow rule #3 destroyed 4768 Flow rule #1 destroyed 4769 Flow rule #0 destroyed 4770 4 flows be destroyed 4771 testpmd> flow aged 0 4772 Port 0 total aged flows: 0 4773 4774Creating indirect actions 4775~~~~~~~~~~~~~~~~~~~~~~~~~ 4776 4777``flow indirect_action {port_id} create`` creates indirect action with optional 4778indirect action ID. It is bound to ``rte_flow_action_handle_create()``:: 4779 4780 flow indirect_action {port_id} create [action_id {indirect_action_id}] 4781 [ingress] [egress] [transfer] action {action} / end 4782 4783If successful, it will show:: 4784 4785 Indirect action #[...] created 4786 4787Otherwise, it will complain either that indirect action already exists or that 4788some error occurred:: 4789 4790 Indirect action #[...] is already assigned, delete it first 4791 4792:: 4793 4794 Caught error type [...] ([...]): [...] 4795 4796Create indirect rss action with id 100 to queues 1 and 2 on port 0:: 4797 4798 testpmd> flow indirect_action 0 create action_id 100 \ 4799 ingress action rss queues 1 2 end / end 4800 4801Create indirect rss action with id assigned by testpmd to queues 1 and 2 on 4802port 0:: 4803 4804 testpmd> flow indirect_action 0 create action_id \ 4805 ingress action rss queues 0 1 end / end 4806 4807Enqueueing creation of indirect actions 4808~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4809 4810``flow queue indirect_action create`` adds creation operation of an indirect 4811action to a queue. It is bound to ``rte_flow_async_action_handle_create()``:: 4812 4813 flow queue {port_id} create {queue_id} [postpone {boolean}] 4814 table {table_id} item_template {item_template_id} 4815 action_template {action_template_id} 4816 pattern {item} [/ {item} [...]] / end 4817 actions {action} [/ {action} [...]] / end 4818 4819If successful, it will show:: 4820 4821 Indirect action #[...] creation queued 4822 4823Otherwise it will show an error message of the form:: 4824 4825 Caught error type [...] ([...]): [...] 4826 4827This command uses the same parameters as ``flow indirect_action create``, 4828described in `Creating indirect actions`_. 4829 4830``flow queue pull`` must be called to retrieve the operation status. 4831 4832Updating indirect actions 4833~~~~~~~~~~~~~~~~~~~~~~~~~ 4834 4835``flow indirect_action {port_id} update`` updates configuration of the indirect 4836action from its indirect action ID (as returned by 4837``flow indirect_action {port_id} create``). It is bound to 4838``rte_flow_action_handle_update()``:: 4839 4840 flow indirect_action {port_id} update {indirect_action_id} 4841 action {action} / end 4842 4843If successful, it will show:: 4844 4845 Indirect action #[...] updated 4846 4847Otherwise, it will complain either that indirect action not found or that some 4848error occurred:: 4849 4850 Failed to find indirect action #[...] on port [...] 4851 4852:: 4853 4854 Caught error type [...] ([...]): [...] 4855 4856Update indirect rss action having id 100 on port 0 with rss to queues 0 and 3 4857(in create example above rss queues were 1 and 2):: 4858 4859 testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end 4860 4861Enqueueing update of indirect actions 4862~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4863 4864``flow queue indirect_action update`` adds update operation for an indirect 4865action to a queue. It is bound to ``rte_flow_async_action_handle_update()``:: 4866 4867 flow queue {port_id} indirect_action {queue_id} update 4868 {indirect_action_id} [postpone {boolean}] action {action} / end 4869 4870If successful, it will show:: 4871 4872 Indirect action #[...] update queued 4873 4874Otherwise it will show an error message of the form:: 4875 4876 Caught error type [...] ([...]): [...] 4877 4878``flow queue pull`` must be called to retrieve the operation status. 4879 4880Destroying indirect actions 4881~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4882 4883``flow indirect_action {port_id} destroy`` destroys one or more indirect actions 4884from their indirect action IDs (as returned by 4885``flow indirect_action {port_id} create``). It is bound to 4886``rte_flow_action_handle_destroy()``:: 4887 4888 flow indirect_action {port_id} destroy action_id {indirect_action_id} [...] 4889 4890If successful, it will show:: 4891 4892 Indirect action #[...] destroyed 4893 4894It does not report anything for indirect action IDs that do not exist. 4895The usual error message is shown when a indirect action cannot be destroyed:: 4896 4897 Caught error type [...] ([...]): [...] 4898 4899Destroy indirect actions having id 100 & 101:: 4900 4901 testpmd> flow indirect_action 0 destroy action_id 100 action_id 101 4902 4903Enqueueing destruction of indirect actions 4904~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4905 4906``flow queue indirect_action destroy`` adds destruction operation to destroy 4907one or more indirect actions from their indirect action IDs (as returned by 4908``flow queue {port_id} indirect_action {queue_id} create``) to a queue. 4909It is bound to ``rte_flow_async_action_handle_destroy()``:: 4910 4911 flow queue {port_id} indirect_action {queue_id} destroy 4912 [postpone {boolean}] action_id {indirect_action_id} [...] 4913 4914If successful, it will show:: 4915 4916 Indirect action #[...] destruction queued 4917 4918Otherwise it will show an error message of the form:: 4919 4920 Caught error type [...] ([...]): [...] 4921 4922``flow queue pull`` must be called to retrieve the operation status. 4923 4924Query indirect actions 4925~~~~~~~~~~~~~~~~~~~~~~ 4926 4927``flow indirect_action {port_id} query`` queries the indirect action from its 4928indirect action ID (as returned by ``flow indirect_action {port_id} create``). 4929It is bound to ``rte_flow_action_handle_query()``:: 4930 4931 flow indirect_action {port_id} query {indirect_action_id} 4932 4933Currently only rss indirect action supported. If successful, it will show:: 4934 4935 Indirect RSS action: 4936 refs:[...] 4937 4938Otherwise, it will complain either that indirect action not found or that some 4939error occurred:: 4940 4941 Failed to find indirect action #[...] on port [...] 4942 4943:: 4944 4945 Caught error type [...] ([...]): [...] 4946 4947Query indirect action having id 100:: 4948 4949 testpmd> flow indirect_action 0 query 100 4950 4951Sample QinQ flow rules 4952~~~~~~~~~~~~~~~~~~~~~~ 4953 4954Before creating QinQ rule(s) the following commands should be issued to enable QinQ:: 4955 4956 testpmd> port stop 0 4957 testpmd> vlan set extend on 0 4958 4959The above command sets the inner and outer TPID's to 0x8100. 4960 4961To change the TPID's the following commands should be used:: 4962 4963 testpmd> vlan set outer tpid 0x88A8 0 4964 testpmd> vlan set inner tpid 0x8100 0 4965 testpmd> port start 0 4966 4967Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM. 4968 4969:: 4970 4971 testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 / 4972 vlan tci is 456 / end actions vf id 1 / queue index 0 / end 4973 Flow rule #0 validated 4974 4975 testpmd> flow create 0 ingress pattern eth / vlan tci is 4 / 4976 vlan tci is 456 / end actions vf id 123 / queue index 0 / end 4977 Flow rule #0 created 4978 4979 testpmd> flow list 0 4980 ID Group Prio Attr Rule 4981 0 0 0 i- ETH VLAN VLAN=>VF QUEUE 4982 4983Validate and create a QinQ rule on port 0 to steer traffic to a queue on the host. 4984 4985:: 4986 4987 testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 / 4988 vlan tci is 654 / end actions pf / queue index 0 / end 4989 Flow rule #1 validated 4990 4991 testpmd> flow create 0 ingress pattern eth / vlan tci is 321 / 4992 vlan tci is 654 / end actions pf / queue index 1 / end 4993 Flow rule #1 created 4994 4995 testpmd> flow list 0 4996 ID Group Prio Attr Rule 4997 0 0 0 i- ETH VLAN VLAN=>VF QUEUE 4998 1 0 0 i- ETH VLAN VLAN=>PF QUEUE 4999 5000Sample VXLAN flow rules 5001~~~~~~~~~~~~~~~~~~~~~~~ 5002 5003Before creating VXLAN rule(s), the UDP port should be added for VXLAN packet 5004filter on a port:: 5005 5006 testpmd> rx_vxlan_port add 4789 0 5007 5008Create VXLAN rules on port 0 to steer traffic to PF queues. 5009 5010:: 5011 5012 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / 5013 eth dst is 00:11:22:33:44:55 / end actions pf / queue index 1 / end 5014 Flow rule #0 created 5015 5016 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 3 / 5017 eth dst is 00:11:22:33:44:55 / end actions pf / queue index 2 / end 5018 Flow rule #1 created 5019 5020 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / 5021 eth dst is 00:11:22:33:44:55 / vlan tci is 10 / end actions pf / 5022 queue index 3 / end 5023 Flow rule #2 created 5024 5025 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 5 / 5026 eth dst is 00:11:22:33:44:55 / vlan tci is 20 / end actions pf / 5027 queue index 4 / end 5028 Flow rule #3 created 5029 5030 testpmd> flow create 0 ingress pattern eth dst is 00:00:00:00:01:00 / ipv4 / 5031 udp / vxlan vni is 6 / eth dst is 00:11:22:33:44:55 / end actions pf / 5032 queue index 5 / end 5033 Flow rule #4 created 5034 5035 testpmd> flow list 0 5036 ID Group Prio Attr Rule 5037 0 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE 5038 1 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE 5039 2 0 0 i- ETH IPV4 UDP VXLAN ETH VLAN => QUEUE 5040 3 0 0 i- ETH IPV4 UDP VXLAN ETH VLAN => QUEUE 5041 4 0 0 i- ETH IPV4 UDP VXLAN ETH => QUEUE 5042 5043Sample VXLAN encapsulation rule 5044~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5045 5046VXLAN encapsulation outer layer has default value pre-configured in testpmd 5047source code, those can be changed by using the following commands 5048 5049IPv4 VXLAN outer header:: 5050 5051 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1 5052 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5053 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 5054 queue index 0 / end 5055 5056 testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 5057 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11 5058 eth-dst 22:22:22:22:22:22 5059 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 5060 queue index 0 / end 5061 5062 testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-tos 0 5063 ip-ttl 255 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 5064 eth-dst 22:22:22:22:22:22 5065 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 5066 queue index 0 / end 5067 5068IPv6 VXLAN outer header:: 5069 5070 testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1 5071 ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5072 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 5073 queue index 0 / end 5074 5075 testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 5076 ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11 5077 eth-dst 22:22:22:22:22:22 5078 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 5079 queue index 0 / end 5080 5081 testpmd> set vxlan-tos-ttl ip-version ipv6 vni 4 udp-src 4 udp-dst 4 5082 ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11 5083 eth-dst 22:22:22:22:22:22 5084 testpmd> flow create 0 ingress pattern end actions vxlan_encap / 5085 queue index 0 / end 5086 5087Sample NVGRE encapsulation rule 5088~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5089 5090NVGRE encapsulation outer layer has default value pre-configured in testpmd 5091source code, those can be changed by using the following commands 5092 5093IPv4 NVGRE outer header:: 5094 5095 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1 5096 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5097 testpmd> flow create 0 ingress pattern end actions nvgre_encap / 5098 queue index 0 / end 5099 5100 testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1 5101 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11 5102 eth-dst 22:22:22:22:22:22 5103 testpmd> flow create 0 ingress pattern end actions nvgre_encap / 5104 queue index 0 / end 5105 5106IPv6 NVGRE outer header:: 5107 5108 testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222 5109 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5110 testpmd> flow create 0 ingress pattern end actions nvgre_encap / 5111 queue index 0 / end 5112 5113 testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222 5114 vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5115 testpmd> flow create 0 ingress pattern end actions nvgre_encap / 5116 queue index 0 / end 5117 5118Sample L2 encapsulation rule 5119~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5120 5121L2 encapsulation has default value pre-configured in testpmd 5122source code, those can be changed by using the following commands 5123 5124L2 header:: 5125 5126 testpmd> set l2_encap ip-version ipv4 5127 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5128 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions 5129 mplsoudp_decap / l2_encap / end 5130 5131L2 with VXLAN header:: 5132 5133 testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34 5134 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5135 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions 5136 mplsoudp_decap / l2_encap / end 5137 5138Sample L2 decapsulation rule 5139~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5140 5141L2 decapsulation has default value pre-configured in testpmd 5142source code, those can be changed by using the following commands 5143 5144L2 header:: 5145 5146 testpmd> set l2_decap 5147 testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap / 5148 queue index 0 / end 5149 5150L2 with VXLAN header:: 5151 5152 testpmd> set l2_encap-with-vlan 5153 testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap / 5154 queue index 0 / end 5155 5156Sample MPLSoGRE encapsulation rule 5157~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5158 5159MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd 5160source code, those can be changed by using the following commands 5161 5162IPv4 MPLSoGRE outer header:: 5163 5164 testpmd> set mplsogre_encap ip-version ipv4 label 4 5165 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 5166 eth-dst 22:22:22:22:22:22 5167 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5168 mplsogre_encap / end 5169 5170IPv4 MPLSoGRE with VLAN outer header:: 5171 5172 testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4 5173 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 5174 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5175 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5176 mplsogre_encap / end 5177 5178IPv6 MPLSoGRE outer header:: 5179 5180 testpmd> set mplsogre_encap ip-version ipv6 mask 4 5181 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11 5182 eth-dst 22:22:22:22:22:22 5183 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5184 mplsogre_encap / end 5185 5186IPv6 MPLSoGRE with VLAN outer header:: 5187 5188 testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4 5189 ip-src ::1 ip-dst ::2222 vlan-tci 34 5190 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5191 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5192 mplsogre_encap / end 5193 5194Sample MPLSoGRE decapsulation rule 5195~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5196 5197MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd 5198source code, those can be changed by using the following commands 5199 5200IPv4 MPLSoGRE outer header:: 5201 5202 testpmd> set mplsogre_decap ip-version ipv4 5203 testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions 5204 mplsogre_decap / l2_encap / end 5205 5206IPv4 MPLSoGRE with VLAN outer header:: 5207 5208 testpmd> set mplsogre_decap-with-vlan ip-version ipv4 5209 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end 5210 actions mplsogre_decap / l2_encap / end 5211 5212IPv6 MPLSoGRE outer header:: 5213 5214 testpmd> set mplsogre_decap ip-version ipv6 5215 testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end 5216 actions mplsogre_decap / l2_encap / end 5217 5218IPv6 MPLSoGRE with VLAN outer header:: 5219 5220 testpmd> set mplsogre_decap-with-vlan ip-version ipv6 5221 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end 5222 actions mplsogre_decap / l2_encap / end 5223 5224Sample MPLSoUDP encapsulation rule 5225~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5226 5227MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd 5228source code, those can be changed by using the following commands 5229 5230IPv4 MPLSoUDP outer header:: 5231 5232 testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10 5233 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 5234 eth-dst 22:22:22:22:22:22 5235 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5236 mplsoudp_encap / end 5237 5238IPv4 MPLSoUDP with VLAN outer header:: 5239 5240 testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5 5241 udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 5242 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5243 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5244 mplsoudp_encap / end 5245 5246IPv6 MPLSoUDP outer header:: 5247 5248 testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10 5249 ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11 5250 eth-dst 22:22:22:22:22:22 5251 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5252 mplsoudp_encap / end 5253 5254IPv6 MPLSoUDP with VLAN outer header:: 5255 5256 testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5 5257 udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34 5258 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5259 testpmd> flow create 0 egress pattern eth / end actions l2_decap / 5260 mplsoudp_encap / end 5261 5262Sample MPLSoUDP decapsulation rule 5263~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5264 5265MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd 5266source code, those can be changed by using the following commands 5267 5268IPv4 MPLSoUDP outer header:: 5269 5270 testpmd> set mplsoudp_decap ip-version ipv4 5271 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions 5272 mplsoudp_decap / l2_encap / end 5273 5274IPv4 MPLSoUDP with VLAN outer header:: 5275 5276 testpmd> set mplsoudp_decap-with-vlan ip-version ipv4 5277 testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end 5278 actions mplsoudp_decap / l2_encap / end 5279 5280IPv6 MPLSoUDP outer header:: 5281 5282 testpmd> set mplsoudp_decap ip-version ipv6 5283 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end 5284 actions mplsoudp_decap / l2_encap / end 5285 5286IPv6 MPLSoUDP with VLAN outer header:: 5287 5288 testpmd> set mplsoudp_decap-with-vlan ip-version ipv6 5289 testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end 5290 actions mplsoudp_decap / l2_encap / end 5291 5292Sample Raw encapsulation rule 5293~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5294 5295Raw encapsulation configuration can be set by the following commands 5296 5297Encapsulating VxLAN:: 5298 5299 testpmd> set raw_encap 4 eth src is 10:11:22:33:44:55 / vlan tci is 1 5300 inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni 5301 is 2 / end_set 5302 testpmd> flow create 0 egress pattern eth / ipv4 / end actions 5303 raw_encap index 4 / end 5304 5305Sample Raw decapsulation rule 5306~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5307 5308Raw decapsulation configuration can be set by the following commands 5309 5310Decapsulating VxLAN:: 5311 5312 testpmd> set raw_decap eth / ipv4 / udp / vxlan / end_set 5313 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 / 5314 end actions raw_decap / queue index 0 / end 5315 5316Sample ESP rules 5317~~~~~~~~~~~~~~~~ 5318 5319ESP rules can be created by the following commands:: 5320 5321 testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions 5322 queue index 3 / end 5323 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end 5324 actions queue index 3 / end 5325 testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions 5326 queue index 3 / end 5327 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end 5328 actions queue index 3 / end 5329 5330Sample AH rules 5331~~~~~~~~~~~~~~~~ 5332 5333AH rules can be created by the following commands:: 5334 5335 testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions 5336 queue index 3 / end 5337 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end 5338 actions queue index 3 / end 5339 testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions 5340 queue index 3 / end 5341 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end 5342 actions queue index 3 / end 5343 5344Sample PFCP rules 5345~~~~~~~~~~~~~~~~~ 5346 5347PFCP rules can be created by the following commands(s_field need to be 1 5348if seid is set):: 5349 5350 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end 5351 actions queue index 3 / end 5352 testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1 5353 seid is 1 / end actions queue index 3 / end 5354 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end 5355 actions queue index 3 / end 5356 testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1 5357 seid is 1 / end actions queue index 3 / end 5358 5359Sample Sampling/Mirroring rules 5360~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5361 5362Sample/Mirroring rules can be set by the following commands 5363 5364NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1, 5365and 50% packets are duplicated and marked with 0x1234 and sent to queue 0. 5366 5367:: 5368 5369 testpmd> set sample_actions 0 mark id 0x1234 / queue index 0 / end 5370 testpmd> flow create 0 ingress group 1 pattern eth / end actions 5371 sample ratio 2 index 0 / queue index 1 / end 5372 5373Mirroring rule with port representors (with "transfer" attribute), the matched 5374ingress packets with encapsulation header are sent to port id 0, and also 5375mirrored the packets and sent to port id 2. 5376 5377:: 5378 5379 testpmd> set sample_actions 0 port_id id 2 / end 5380 testpmd> flow create 1 ingress transfer pattern eth / end actions 5381 sample ratio 1 index 0 / raw_encap / port_id id 0 / end 5382 5383Mirroring rule with port representors (with "transfer" attribute), the matched 5384ingress packets are sent to port id 2, and also mirrored the packets with 5385encapsulation header and sent to port id 0. 5386 5387:: 5388 5389 testpmd> set sample_actions 0 raw_encap / port_id id 0 / end 5390 testpmd> flow create 0 ingress transfer pattern eth / end actions 5391 sample ratio 1 index 0 / port_id id 2 / end 5392 5393Mirroring rule with port representors (with "transfer" attribute), the matched 5394ingress packets are sent to port id 2, and also mirrored the packets with 5395VXLAN encapsulation header and sent to port id 0. 5396 5397:: 5398 5399 testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1 5400 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5401 testpmd> set sample_actions 0 vxlan_encap / port_id id 0 / end 5402 testpmd> flow create 0 ingress transfer pattern eth / end actions 5403 sample ratio 1 index 0 / port_id id 2 / end 5404 5405Mirroring rule with port representors (with "transfer" attribute), the matched 5406ingress packets are sent to port id 2, and also mirrored the packets with 5407NVGRE encapsulation header and sent to port id 0. 5408 5409:: 5410 5411 testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1 5412 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22 5413 testpmd> set sample_actions 0 nvgre_encap / port_id id 0 / end 5414 testpmd> flow create 0 ingress transfer pattern eth / end actions 5415 sample ratio 1 index 0 / port_id id 2 / end 5416 5417Sample integrity rules 5418~~~~~~~~~~~~~~~~~~~~~~ 5419 5420Integrity rules can be created by the following commands: 5421 5422Integrity rule that forwards valid TCP packets to group 1. 5423TCP packet integrity is matched with the ``l4_ok`` bit 3. 5424 5425:: 5426 5427 testpmd> flow create 0 ingress 5428 pattern eth / ipv4 / tcp / integrity value mask 8 value spec 8 / end 5429 actions jump group 1 / end 5430 5431Integrity rule that forwards invalid packets to application. 5432General packet integrity is matched with the ``packet_ok`` bit 0. 5433 5434:: 5435 5436 testpmd> flow create 0 ingress pattern integrity value mask 1 value spec 0 / end actions queue index 0 / end 5437 5438Sample conntrack rules 5439~~~~~~~~~~~~~~~~~~~~~~ 5440 5441Conntrack rules can be set by the following commands 5442 5443Need to construct the connection context with provided information. 5444In the first table, create a flow rule by using conntrack action and jump to 5445the next table. In the next table, create a rule to check the state. 5446 5447:: 5448 5449 testpmd> set conntrack com peer 1 is_orig 1 enable 1 live 1 sack 1 cack 0 5450 last_dir 0 liberal 0 state 1 max_ack_win 7 r_lim 5 last_win 510 5451 last_seq 2632987379 last_ack 2532480967 last_end 2632987379 5452 last_index 0x8 5453 testpmd> set conntrack orig scale 7 fin 0 acked 1 unack_data 0 5454 sent_end 2632987379 reply_end 2633016339 max_win 28960 5455 max_ack 2632987379 5456 testpmd> set conntrack rply scale 7 fin 0 acked 1 unack_data 0 5457 sent_end 2532480967 reply_end 2532546247 max_win 65280 5458 max_ack 2532480967 5459 testpmd> flow indirect_action 0 create ingress action conntrack / end 5460 testpmd> flow create 0 group 3 ingress pattern eth / ipv4 / tcp / end actions indirect 0 / jump group 5 / end 5461 testpmd> flow create 0 group 5 ingress pattern eth / ipv4 / tcp / conntrack is 1 / end actions queue index 5 / end 5462 5463Construct the conntrack again with only "is_orig" set to 0 (other fields are 5464ignored), then use "update" interface to update the direction. Create flow 5465rules like above for the peer port. 5466 5467:: 5468 5469 testpmd> flow indirect_action 0 update 0 action conntrack_update dir / end 5470 5471Sample meter with policy rules 5472~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5473 5474Meter with policy rules can be created by the following commands: 5475 5476Need to create policy first and actions are set for green/yellow/red colors. 5477Create meter with policy id. Create flow with meter id. 5478 5479Example for policy with meter color action. The purpose is to color the packet 5480to reflect the meter color result. 5481The meter policy action list: ``green -> green, yellow -> yellow, red -> red``. 5482 5483:: 5484 5485 testpmd> add port meter profile srtcm_rfc2697 0 13 21504 2688 0 0 5486 testpmd> add port meter policy 0 1 g_actions color type green / end y_actions color type yellow / end 5487 r_actions color type red / end 5488 testpmd> create port meter 0 1 13 1 yes 0xffff 0 0 5489 testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end 5490 5491Sample L2TPv2 RSS rules 5492~~~~~~~~~~~~~~~~~~~~~~~ 5493 5494L2TPv2 RSS rules can be created by the following commands:: 5495 5496 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control 5497 / end actions rss types l2tpv2 end queues end / end 5498 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / end 5499 actions rss types eth l2-src-only end queues end / end 5500 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / end 5501 actions rss types l2tpv2 end queues end / end 5502 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 5503 / end actions rss types ipv4 end queues end / end 5504 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv6 5505 / udp / end actions rss types ipv6-udp end queues end / end 5506 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv4 5507 / tcp / end actions rss types ipv4-tcp end queues end / end 5508 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6 5509 / end actions rss types ipv6 end queues end / end 5510 5511Sample L2TPv2 FDIR rules 5512~~~~~~~~~~~~~~~~~~~~~~~~ 5513 5514L2TPv2 FDIR rules can be created by the following commands:: 5515 5516 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control 5517 session_id is 0x1111 / end actions queue index 3 / end 5518 testpmd> flow create 0 ingress pattern eth src is 00:00:00:00:00:01 / ipv4 5519 / udp / l2tpv2 type data / end actions queue index 3 / end 5520 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type data 5521 session_id is 0x1111 / ppp / end actions queue index 3 / end 5522 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 5523 src is 10.0.0.1 / end actions queue index 3 / end 5524 testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6 5525 dst is ABAB:910B:6666:3457:8295:3333:1800:2929 / end actions queue index 3 / end 5526 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 5527 / udp src is 22 / end actions queue index 3 / end 5528 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4 5529 / tcp dst is 23 / end actions queue index 3 / end 5530 5531Sample RAW rule 5532~~~~~~~~~~~~~~~ 5533 5534A RAW rule can be created as following using ``pattern_hex`` key and mask. 5535 5536:: 5537 5538 testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset 5539 is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a 5540 pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions 5541 queue index 4 / end 5542 5543BPF Functions 5544-------------- 5545 5546The following sections show functions to load/unload eBPF based filters. 5547 5548bpf-load 5549~~~~~~~~ 5550 5551Load an eBPF program as a callback for particular RX/TX queue:: 5552 5553 testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename) 5554 5555The available load-flags are: 5556 5557* ``J``: use JIT generated native code, otherwise BPF interpreter will be used. 5558 5559* ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data. 5560 5561* ``-``: none. 5562 5563.. note:: 5564 5565 You'll need clang v3.7 or above to build bpf program you'd like to load 5566 5567For example: 5568 5569.. code-block:: console 5570 5571 cd examples/bpf 5572 clang -O2 -target bpf -c t1.c 5573 5574Then to load (and JIT compile) t1.o at RX queue 0, port 1: 5575 5576.. code-block:: console 5577 5578 testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o 5579 5580To load (not JITed) t1.o at TX queue 0, port 0: 5581 5582.. code-block:: console 5583 5584 testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o 5585 5586bpf-unload 5587~~~~~~~~~~ 5588 5589Unload previously loaded eBPF program for particular RX/TX queue:: 5590 5591 testpmd> bpf-unload rx|tx (portid) (queueid) 5592 5593For example to unload BPF filter from TX queue 0, port 0: 5594 5595.. code-block:: console 5596 5597 testpmd> bpf-unload tx 0 0 5598 5599Flex Item Functions 5600------------------- 5601 5602The following sections show functions that configure and create flex item object, 5603create flex pattern and use it in a flow rule. 5604The commands will use 20 bytes IPv4 header for examples: 5605 5606:: 5607 5608 0 1 2 3 5609 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 5610 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5611 | ver | IHL | TOS | length | +0 5612 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5613 | identification | flg | frag. offset | +4 5614 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5615 | TTL | protocol | checksum | +8 5616 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5617 | source IP address | +12 5618 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5619 | destination IP address | +16 5620 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 5621 5622 5623Create flex item 5624~~~~~~~~~~~~~~~~ 5625 5626Flex item object is created by PMD according to a new header configuration. The 5627header configuration is compiled by the testpmd and stored in 5628``rte_flow_item_flex_conf`` type variable. 5629 5630:: 5631 5632 # flow flex_item create <port> <flex id> <configuration file> 5633 testpmd> flow flex_item init 0 3 ipv4_flex_config.json 5634 port-0: created flex item #3 5635 5636Flex item configuration is kept in external JSON file. 5637It describes the following header elements: 5638 5639**New header length.** 5640 5641Specify whether the new header has fixed or variable length and the basic/minimal 5642header length value. 5643 5644If header length is not fixed, header location with a value that completes header 5645length calculation and scale/offset function must be added. 5646 5647Scale function depends on port hardware. 5648 5649**Next protocol.** 5650 5651Describes location in the new header that specify following network header type. 5652 5653**Flow match samples.** 5654 5655Describes locations in the new header that will be used in flow rules. 5656 5657Number of flow samples and sample maximal length depend of port hardware. 5658 5659**Input trigger.** 5660 5661Describes preceding network header configuration. 5662 5663**Output trigger.** 5664 5665Describes conditions that trigger transfer to following network header 5666 5667.. code-block:: json 5668 5669 { 5670 "next_header": { "field_mode": "FIELD_MODE_FIXED", "field_size": 20}, 5671 "next_protocol": {"field_size": 8, "field_base": 72}, 5672 "sample_data": [ 5673 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 0}, 5674 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 32}, 5675 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 64}, 5676 { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 96} 5677 ], 5678 "input_link": [ 5679 {"item": "eth type is 0x0800"}, 5680 {"item": "vlan inner_type is 0x0800"} 5681 ], 5682 "output_link": [ 5683 {"item": "udp", "next": 17}, 5684 {"item": "tcp", "next": 6}, 5685 {"item": "icmp", "next": 1} 5686 ] 5687 } 5688 5689 5690Flex pattern and flow rules 5691~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5692 5693Flex pattern describe parts of network header that will trigger flex flow item hit in a flow rule. 5694Flex pattern directly related to flex item samples configuration. 5695Flex pattern can be shared between ports. 5696 5697**Flex pattern and flow rule to match IPv4 version and 20 bytes length** 5698 5699:: 5700 5701 # set flex_pattern <pattern_id> is <hex bytes sequence> 5702 testpmd> flow flex_item pattern 5 is 45FF 5703 created pattern #5 5704 5705 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 5706 Flow rule #0 created 5707 5708**Flex pattern and flow rule to match packets with source address 1.2.3.4** 5709 5710:: 5711 5712 testpmd> flow flex_item pattern 2 spec 45000000000000000000000001020304 mask FF0000000000000000000000FFFFFFFF 5713 created pattern #2 5714 5715 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 5716 Flow rule #0 created 5717 5718Driver specific commands 5719------------------------ 5720 5721Some drivers provide specific features. 5722See: 5723