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