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