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