1.. BSD LICENSE 2 Copyright(c) 2010-2016 Intel Corporation. All rights reserved. 3 All rights reserved. 4 5 Redistribution and use in source and binary forms, with or without 6 modification, are permitted provided that the following conditions 7 are met: 8 9 * Redistributions of source code must retain the above copyright 10 notice, this list of conditions and the following disclaimer. 11 * Redistributions in binary form must reproduce the above copyright 12 notice, this list of conditions and the following disclaimer in 13 the documentation and/or other materials provided with the 14 distribution. 15 * Neither the name of Intel Corporation nor the names of its 16 contributors may be used to endorse or promote products derived 17 from this software without specific prior written permission. 18 19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 31.. _testpmd_runtime: 32 33Testpmd Runtime Functions 34========================= 35 36Where the testpmd application is started in interactive mode, (``-i|--interactive``), 37it displays a prompt that can be used to start and stop forwarding, 38configure the application, display statistics (including the extended NIC 39statistics aka xstats) , set the Flow Director and other tasks:: 40 41 testpmd> 42 43The testpmd prompt has some, limited, readline support. 44Common bash command-line functions such as ``Ctrl+a`` and ``Ctrl+e`` to go to the start and end of the prompt line are supported 45as well as access to the command history via the up-arrow. 46 47There is also support for tab completion. 48If you type a partial command and hit ``<TAB>`` you get a list of the available completions: 49 50.. code-block:: console 51 52 testpmd> show port <TAB> 53 54 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X 55 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all 56 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X 57 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all 58 ... 59 60 61.. note:: 62 63 Some examples in this document are too long to fit on one line are are shown wrapped at `"\\"` for display purposes:: 64 65 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \ 66 (pause_time) (send_xon) (port_id) 67 68In the real ``testpmd>`` prompt these commands should be on a single line. 69 70Help Functions 71-------------- 72 73The testpmd has on-line help for the functions that are available at runtime. 74These are divided into sections and can be accessed using help, help section or help all: 75 76.. code-block:: console 77 78 testpmd> help 79 80 help control : Start and stop forwarding. 81 help display : Displaying port, stats and config information. 82 help config : Configuration information. 83 help ports : Configuring ports. 84 help registers : Reading and setting port registers. 85 help filters : Filters configuration help. 86 help all : All of the above sections. 87 88 89Control Functions 90----------------- 91 92start 93~~~~~ 94 95Start packet forwarding with current configuration:: 96 97 testpmd> start 98 99start tx_first 100~~~~~~~~~~~~~~ 101 102Start packet forwarding with current configuration after sending specified number of bursts of packets:: 103 104 testpmd> start tx_first (""|burst_num) 105 106The default burst number is 1 when ``burst_num`` not presented. 107 108stop 109~~~~ 110 111Stop packet forwarding, and display accumulated statistics:: 112 113 testpmd> stop 114 115quit 116~~~~ 117 118Quit to prompt:: 119 120 testpmd> quit 121 122 123Display Functions 124----------------- 125 126The functions in the following sections are used to display information about the 127testpmd configuration or the NIC status. 128 129show port 130~~~~~~~~~ 131 132Display information for a given port or all ports:: 133 134 testpmd> show port (info|stats|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all) 135 136The available information categories are: 137 138* ``info``: General port information such as MAC address. 139 140* ``stats``: RX/TX statistics. 141 142* ``xstats``: RX/TX extended NIC statistics. 143 144* ``fdir``: Flow Director information and statistics. 145 146* ``stat_qmap``: Queue statistics mapping. 147 148* ``dcb_tc``: DCB information such as TC mapping. 149 150* ``cap``: Supported offload capabilities. 151 152For example: 153 154.. code-block:: console 155 156 testpmd> show port info 0 157 158 ********************* Infos for port 0 ********************* 159 160 MAC address: XX:XX:XX:XX:XX:XX 161 Connect to socket: 0 162 memory allocation on the socket: 0 163 Link status: up 164 Link speed: 40000 Mbps 165 Link duplex: full-duplex 166 Promiscuous mode: enabled 167 Allmulticast mode: disabled 168 Maximum number of MAC addresses: 64 169 Maximum number of MAC addresses of hash filtering: 0 170 VLAN offload: 171 strip on 172 filter on 173 qinq(extend) off 174 Redirection table size: 512 175 Supported flow types: 176 ipv4-frag 177 ipv4-tcp 178 ipv4-udp 179 ipv4-sctp 180 ipv4-other 181 ipv6-frag 182 ipv6-tcp 183 ipv6-udp 184 ipv6-sctp 185 ipv6-other 186 l2_payload 187 port 188 vxlan 189 geneve 190 nvgre 191 192show port rss reta 193~~~~~~~~~~~~~~~~~~ 194 195Display the rss redirection table entry indicated by masks on port X:: 196 197 testpmd> show port (port_id) rss reta (size) (mask0, mask1...) 198 199size is used to indicate the hardware supported reta size 200 201show port rss-hash 202~~~~~~~~~~~~~~~~~~ 203 204Display the RSS hash functions and RSS hash key of a port:: 205 206 testpmd> show port (port_id) rss-hash ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex [key] 207 208clear port 209~~~~~~~~~~ 210 211Clear the port statistics for a given port or for all ports:: 212 213 testpmd> clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all) 214 215For example:: 216 217 testpmd> clear port stats all 218 219show (rxq|txq) 220~~~~~~~~~~~~~~ 221 222Display information for a given port's RX/TX queue:: 223 224 testpmd> show (rxq|txq) info (port_id) (queue_id) 225 226show config 227~~~~~~~~~~~ 228 229Displays the configuration of the application. 230The configuration comes from the command-line, the runtime or the application defaults:: 231 232 testpmd> show config (rxtx|cores|fwd|txpkts) 233 234The available information categories are: 235 236* ``rxtx``: RX/TX configuration items. 237 238* ``cores``: List of forwarding cores. 239 240* ``fwd``: Packet forwarding configuration. 241 242* ``txpkts``: Packets to TX configuration. 243 244For example: 245 246.. code-block:: console 247 248 testpmd> show config rxtx 249 250 io packet forwarding - CRC stripping disabled - packets/burst=16 251 nb forwarding cores=2 - nb forwarding ports=1 252 RX queues=1 - RX desc=128 - RX free threshold=0 253 RX threshold registers: pthresh=8 hthresh=8 wthresh=4 254 TX queues=1 - TX desc=512 - TX free threshold=0 255 TX threshold registers: pthresh=36 hthresh=0 wthresh=0 256 TX RS bit threshold=0 - TXQ flags=0x0 257 258set fwd 259~~~~~~~ 260 261Set the packet forwarding mode:: 262 263 testpmd> set fwd (io|mac|macswap|flowgen| \ 264 rxonly|txonly|csum|icmpecho) (""|retry) 265 266``retry`` can be specified for forwarding engines except ``rx_only``. 267 268The available information categories are: 269 270* ``io``: Forwards packets "as-is" in I/O mode. 271 This is the fastest possible forwarding operation as it does not access packets data. 272 This is the default mode. 273 274* ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them. 275 Default application behaviour is to set source Ethernet address to that of the transmitting interface, and destination 276 address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or 277 'eth-peer-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address. 278 279* ``macswap``: MAC swap forwarding mode. 280 Swaps the source and the destination Ethernet addresses of packets before forwarding them. 281 282* ``flowgen``: Multi-flow generation mode. 283 Originates a number of flows (with varying destination IP addresses), and terminate receive traffic. 284 285* ``rxonly``: Receives packets but doesn't transmit them. 286 287* ``txonly``: Generates and transmits packets without receiving any. 288 289* ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet. 290 291* ``icmpecho``: Receives a burst of packets, lookup for IMCP echo requests and, if any, send back ICMP echo replies. 292 293* ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX. Requires ``CONFIG_RTE_LIBRTE_IEEE1588=y``. 294 295Note: TX timestamping is only available in the "Full Featured" TX path. To force ``testpmd`` into this mode set ``--txqflags=0``. 296 297Example:: 298 299 testpmd> set fwd rxonly 300 301 Set rxonly packet forwarding mode 302 303 304read rxd 305~~~~~~~~ 306 307Display an RX descriptor for a port RX queue:: 308 309 testpmd> read rxd (port_id) (queue_id) (rxd_id) 310 311For example:: 312 313 testpmd> read rxd 0 0 4 314 0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180 315 316read txd 317~~~~~~~~ 318 319Display a TX descriptor for a port TX queue:: 320 321 testpmd> read txd (port_id) (queue_id) (txd_id) 322 323For example:: 324 325 testpmd> read txd 0 0 4 326 0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C 327 328 329Configuration Functions 330----------------------- 331 332The testpmd application can be configured from the runtime as well as from the command-line. 333 334This section details the available configuration functions that are available. 335 336.. note:: 337 338 Configuration changes only become active when forwarding is started/restarted. 339 340set default 341~~~~~~~~~~~ 342 343Reset forwarding to the default configuration:: 344 345 testpmd> set default 346 347set verbose 348~~~~~~~~~~~ 349 350Set the debug verbosity level:: 351 352 testpmd> set verbose (level) 353 354Currently the only available levels are 0 (silent except for error) and 1 (fully verbose). 355 356set nbport 357~~~~~~~~~~ 358 359Set the number of ports used by the application: 360 361set nbport (num) 362 363This is equivalent to the ``--nb-ports`` command-line option. 364 365set nbcore 366~~~~~~~~~~ 367 368Set the number of cores used by the application:: 369 370 testpmd> set nbcore (num) 371 372This is equivalent to the ``--nb-cores`` command-line option. 373 374.. note:: 375 376 The number of cores used must not be greater than number of ports used multiplied by the number of queues per port. 377 378set coremask 379~~~~~~~~~~~~ 380 381Set the forwarding cores hexadecimal mask:: 382 383 testpmd> set coremask (mask) 384 385This is equivalent to the ``--coremask`` command-line option. 386 387.. note:: 388 389 The master lcore is reserved for command line parsing only and cannot be masked on for packet forwarding. 390 391set portmask 392~~~~~~~~~~~~ 393 394Set the forwarding ports hexadecimal mask:: 395 396 testpmd> set portmask (mask) 397 398This is equivalent to the ``--portmask`` command-line option. 399 400set burst 401~~~~~~~~~ 402 403Set number of packets per burst:: 404 405 testpmd> set burst (num) 406 407This is equivalent to the ``--burst command-line`` option. 408 409When retry is enabled, the transmit delay time and number of retries can also be set:: 410 411 testpmd> set burst tx delay (microseconds) retry (num) 412 413set txpkts 414~~~~~~~~~~ 415 416Set the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode:: 417 418 testpmd> set txpkts (x[,y]*) 419 420Where x[,y]* represents a CSV list of values, without white space. 421 422set txsplit 423~~~~~~~~~~~ 424 425Set the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes:: 426 427 testpmd> set txsplit (off|on|rand) 428 429Where: 430 431* ``off`` disable packet copy & split for CSUM mode. 432 433* ``on`` split outgoing packet into multiple segments. Size of each segment 434 and number of segments per packet is determined by ``set txpkts`` command 435 (see above). 436 437* ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments. 438 439set corelist 440~~~~~~~~~~~~ 441 442Set the list of forwarding cores:: 443 444 testpmd> set corelist (x[,y]*) 445 446For example, to change the forwarding cores: 447 448.. code-block:: console 449 450 testpmd> set corelist 3,1 451 testpmd> show config fwd 452 453 io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled 454 Logical Core 3 (socket 0) forwards packets on 1 streams: 455 RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01 456 Logical Core 1 (socket 0) forwards packets on 1 streams: 457 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00 458 459.. note:: 460 461 The cores are used in the same order as specified on the command line. 462 463set portlist 464~~~~~~~~~~~~ 465 466Set the list of forwarding ports:: 467 468 testpmd> set portlist (x[,y]*) 469 470For example, to change the port forwarding: 471 472.. code-block:: console 473 474 testpmd> set portlist 0,2,1,3 475 testpmd> show config fwd 476 477 io packet forwarding - ports=4 - cores=1 - streams=4 478 Logical Core 3 (socket 0) forwards packets on 4 streams: 479 RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01 480 RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00 481 RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03 482 RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02 483 484set tx loopback 485~~~~~~~~~~~~~~~ 486 487Enable/disable tx loopback:: 488 489 testpmd> set tx loopback (port_id) (on|off) 490 491set drop enable 492~~~~~~~~~~~~~~~ 493 494set drop enable bit for all queues:: 495 496 testpmd> set all queues drop (port_id) (on|off) 497 498set split drop enable (for VF) 499~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 500 501set split drop enable bit for VF from PF:: 502 503 testpmd> set vf split drop (port_id) (vf_id) (on|off) 504 505set mac antispoof (for VF) 506~~~~~~~~~~~~~~~~~~~~~~~~~~ 507 508Set mac antispoof for a VF from the PF:: 509 510 testpmd> set vf mac antispoof (port_id) (vf_id) (on|off) 511 512set macsec offload 513~~~~~~~~~~~~~~~~~~ 514 515Enable/disable MACsec offload:: 516 517 testpmd> set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off) 518 testpmd> set macsec offload (port_id) off 519 520set macsec sc 521~~~~~~~~~~~~~ 522 523Configure MACsec secure connection (SC):: 524 525 testpmd> set macsec sc (tx|rx) (port_id) (mac) (pi) 526 527.. note:: 528 529 The pi argument is ignored for tx. 530 Check the NIC Datasheet for hardware limits. 531 532set macsec sa 533~~~~~~~~~~~~~ 534 535Configure MACsec secure association (SA):: 536 537 testpmd> set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key) 538 539.. note:: 540 541 The IDX value must be 0 or 1. 542 Check the NIC Datasheet for hardware limits. 543 544set broadcast mode (for VF) 545~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 547Set broadcast mode for a VF from the PF:: 548 549 testpmd> set vf broadcast (port_id) (vf_id) (on|off) 550 551vlan set strip 552~~~~~~~~~~~~~~ 553 554Set the VLAN strip on a port:: 555 556 testpmd> vlan set strip (on|off) (port_id) 557 558vlan set stripq 559~~~~~~~~~~~~~~~ 560 561Set the VLAN strip for a queue on a port:: 562 563 testpmd> vlan set stripq (on|off) (port_id,queue_id) 564 565vlan set stripq (for VF) 566~~~~~~~~~~~~~~~~~~~~~~~~ 567 568Set VLAN strip for all queues in a pool for a VF from the PF:: 569 570 testpmd> set vf vlan stripq (port_id) (vf_id) (on|off) 571 572vlan set insert (for VF) 573~~~~~~~~~~~~~~~~~~~~~~~~ 574 575Set VLAN insert for a VF from the PF:: 576 577 testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id) 578 579vlan set tag (for VF) 580~~~~~~~~~~~~~~~~~~~~~ 581 582Set VLAN tag for a VF from the PF:: 583 584 testpmd> set vf vlan tag (port_id) (vf_id) (on|off) 585 586vlan set antispoof (for VF) 587~~~~~~~~~~~~~~~~~~~~~~~~~~~ 588 589Set VLAN antispoof for a VF from the PF:: 590 591 testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off) 592 593vlan set filter 594~~~~~~~~~~~~~~~ 595 596Set the VLAN filter on a port:: 597 598 testpmd> vlan set filter (on|off) (port_id) 599 600vlan set qinq 601~~~~~~~~~~~~~ 602 603Set the VLAN QinQ (extended queue in queue) on for a port:: 604 605 testpmd> vlan set qinq (on|off) (port_id) 606 607vlan set tpid 608~~~~~~~~~~~~~ 609 610Set the inner or outer VLAN TPID for packet filtering on a port:: 611 612 testpmd> vlan set (inner|outer) tpid (value) (port_id) 613 614.. note:: 615 616 TPID value must be a 16-bit number (value <= 65536). 617 618rx_vlan add 619~~~~~~~~~~~ 620 621Add a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID:: 622 623 testpmd> rx_vlan add (vlan_id|all) (port_id) 624 625.. note:: 626 627 VLAN filter must be set on that port. VLAN ID < 4096. 628 Depending on the NIC used, number of vlan_ids may be limited to the maximum entries 629 in VFTA table. This is important if enabling all vlan_ids. 630 631rx_vlan rm 632~~~~~~~~~~ 633 634Remove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID:: 635 636 testpmd> rx_vlan rm (vlan_id|all) (port_id) 637 638rx_vlan add (for VF) 639~~~~~~~~~~~~~~~~~~~~ 640 641Add a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID:: 642 643 testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask) 644 645rx_vlan rm (for VF) 646~~~~~~~~~~~~~~~~~~~ 647 648Remove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID:: 649 650 testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask) 651 652tunnel_filter add 653~~~~~~~~~~~~~~~~~ 654 655Add a tunnel filter on a port:: 656 657 testpmd> tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) \ 658 (inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\ 659 imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id) 660 661The available information categories are: 662 663* ``vxlan``: Set tunnel type as VXLAN. 664 665* ``nvgre``: Set tunnel type as NVGRE. 666 667* ``ipingre``: Set tunnel type as IP-in-GRE. 668 669* ``imac-ivlan``: Set filter type as Inner MAC and VLAN. 670 671* ``imac-ivlan-tenid``: Set filter type as Inner MAC, VLAN and tenant ID. 672 673* ``imac-tenid``: Set filter type as Inner MAC and tenant ID. 674 675* ``imac``: Set filter type as Inner MAC. 676 677* ``omac-imac-tenid``: Set filter type as Outer MAC, Inner MAC and tenant ID. 678 679* ``oip``: Set filter type as Outer IP. 680 681* ``iip``: Set filter type as Inner IP. 682 683Example:: 684 685 testpmd> tunnel_filter add 0 68:05:CA:28:09:82 00:00:00:00:00:00 \ 686 192.168.2.2 0 ipingre oip 1 1 687 688 Set an IP-in-GRE tunnel on port 0, and the filter type is Outer IP. 689 690tunnel_filter remove 691~~~~~~~~~~~~~~~~~~~~ 692 693Remove a tunnel filter on a port:: 694 695 testpmd> tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) \ 696 (inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\ 697 imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id) 698 699rx_vxlan_port add 700~~~~~~~~~~~~~~~~~ 701 702Add an UDP port for VXLAN packet filter on a port:: 703 704 testpmd> rx_vxlan_port add (udp_port) (port_id) 705 706rx_vxlan_port remove 707~~~~~~~~~~~~~~~~~~~~ 708 709Remove an UDP port for VXLAN packet filter on a port:: 710 711 testpmd> rx_vxlan_port rm (udp_port) (port_id) 712 713tx_vlan set 714~~~~~~~~~~~ 715 716Set hardware insertion of VLAN IDs in packets sent on a port:: 717 718 testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer] 719 720For example, set a single VLAN ID (5) insertion on port 0:: 721 722 tx_vlan set 0 5 723 724Or, set double VLAN ID (inner: 2, outer: 3) insertion on port 1:: 725 726 tx_vlan set 1 2 3 727 728 729tx_vlan set pvid 730~~~~~~~~~~~~~~~~ 731 732Set port based hardware insertion of VLAN ID in packets sent on a port:: 733 734 testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off) 735 736tx_vlan reset 737~~~~~~~~~~~~~ 738 739Disable hardware insertion of a VLAN header in packets sent on a port:: 740 741 testpmd> tx_vlan reset (port_id) 742 743csum set 744~~~~~~~~ 745 746Select hardware or software calculation of the checksum when 747transmitting a packet using the ``csum`` forwarding engine:: 748 749 testpmd> csum set (ip|udp|tcp|sctp|outer-ip) (hw|sw) (port_id) 750 751Where: 752 753* ``ip|udp|tcp|sctp`` always relate to the inner layer. 754 755* ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized 756 as a tunnel packet by the forwarding engine (vxlan, gre and ipip are 757 supported). See also the ``csum parse-tunnel`` command. 758 759.. note:: 760 761 Check the NIC Datasheet for hardware limits. 762 763csum parse-tunnel 764~~~~~~~~~~~~~~~~~ 765 766Define how tunneled packets should be handled by the csum forward 767engine:: 768 769 testpmd> csum parse-tunnel (on|off) (tx_port_id) 770 771If enabled, the csum forward engine will try to recognize supported 772tunnel headers (vxlan, gre, ipip). 773 774If disabled, treat tunnel packets as non-tunneled packets (a inner 775header is handled as a packet payload). 776 777.. note:: 778 779 The port argument is the TX port like in the ``csum set`` command. 780 781Example: 782 783Consider a packet in packet like the following:: 784 785 eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in 786 787* If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set`` 788 command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the 789 ``outer-ip parameter`` relates to the outer headers (here ``ipv4_out``). 790 791* If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set`` 792 command relate to the outer headers, here ``ipv4_out`` and ``udp_out``. 793 794csum show 795~~~~~~~~~ 796 797Display tx checksum offload configuration:: 798 799 testpmd> csum show (port_id) 800 801tso set 802~~~~~~~ 803 804Enable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine:: 805 806 testpmd> tso set (segsize) (port_id) 807 808.. note:: 809 810 Check the NIC datasheet for hardware limits. 811 812tso show 813~~~~~~~~ 814 815Display the status of TCP Segmentation Offload:: 816 817 testpmd> tso show (port_id) 818 819mac_addr add 820~~~~~~~~~~~~ 821 822Add an alternative MAC address to a port:: 823 824 testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX) 825 826mac_addr remove 827~~~~~~~~~~~~~~~ 828 829Remove a MAC address from a port:: 830 831 testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX) 832 833mac_addr add (for VF) 834~~~~~~~~~~~~~~~~~~~~~ 835 836Add an alternative MAC address for a VF to a port:: 837 838 testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX) 839 840mac_addr set 841~~~~~~~~~~~~ 842 843Set the default MAC address for a port:: 844 845 testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX) 846 847mac_addr set (for VF) 848~~~~~~~~~~~~~~~~~~~~~ 849 850Set the MAC address for a VF from the PF:: 851 852 testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX) 853 854set port-uta 855~~~~~~~~~~~~ 856 857Set the unicast hash filter(s) on/off for a port:: 858 859 testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off) 860 861set promisc 862~~~~~~~~~~~ 863 864Set the promiscuous mode on for a port or for all ports. 865In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: 866 867 testpmd> set promisc (port_id|all) (on|off) 868 869set allmulti 870~~~~~~~~~~~~ 871 872Set the allmulti mode for a port or for all ports:: 873 874 testpmd> set allmulti (port_id|all) (on|off) 875 876Same as the ifconfig (8) option. Controls how multicast packets are handled. 877 878set promisc (for VF) 879~~~~~~~~~~~~~~~~~~~~ 880 881Set the unicast promiscuous mode for a VF from PF. 882It's supported by Intel i40e NICs now. 883In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: 884 885 testpmd> set vf promisc (port_id) (vf_id) (on|off) 886 887set allmulticast (for VF) 888~~~~~~~~~~~~~~~~~~~~~~~~~ 889 890Set the multicast promiscuous mode for a VF from PF. 891It's supported by Intel i40e NICs now. 892In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: 893 894 testpmd> set vf allmulti (port_id) (vf_id) (on|off) 895 896set tx max bandwidth (for VF) 897~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 898 899Set TX max absolute bandwidth (Mbps) for a VF from PF:: 900 901 testpmd> set vf tx max-bandwidth (port_id) (vf_id) (max_bandwidth) 902 903set tc tx min bandwidth (for VF) 904~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 905 906Set all TCs' TX min relative bandwidth (%) for a VF from PF:: 907 908 testpmd> set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...) 909 910set tc tx max bandwidth (for VF) 911~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 912 913Set a TC's TX max absolute bandwidth (Mbps) for a VF from PF:: 914 915 testpmd> set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (max_bandwidth) 916 917set flow_ctrl rx 918~~~~~~~~~~~~~~~~ 919 920Set the link flow control parameter on a port:: 921 922 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \ 923 (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \ 924 autoneg (on|off) (port_id) 925 926Where: 927 928* ``high_water`` (integer): High threshold value to trigger XOFF. 929 930* ``low_water`` (integer): Low threshold value to trigger XON. 931 932* ``pause_time`` (integer): Pause quota in the Pause frame. 933 934* ``send_xon`` (0/1): Send XON frame. 935 936* ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames. 937 938* ``autoneg``: Change the auto-negotiation parameter. 939 940set pfc_ctrl rx 941~~~~~~~~~~~~~~~ 942 943Set the priority flow control parameter on a port:: 944 945 testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \ 946 (pause_time) (priority) (port_id) 947 948Where: 949 950* ``high_water`` (integer): High threshold value. 951 952* ``low_water`` (integer): Low threshold value. 953 954* ``pause_time`` (integer): Pause quota in the Pause frame. 955 956* ``priority`` (0-7): VLAN User Priority. 957 958set stat_qmap 959~~~~~~~~~~~~~ 960 961Set statistics mapping (qmapping 0..15) for RX/TX queue on port:: 962 963 testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping) 964 965For example, to set rx queue 2 on port 0 to mapping 5:: 966 967 testpmd>set stat_qmap rx 0 2 5 968 969set port - rx/tx (for VF) 970~~~~~~~~~~~~~~~~~~~~~~~~~ 971 972Set VF receive/transmit from a port:: 973 974 testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off) 975 976set port - mac address filter (for VF) 977~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 978 979Add/Remove unicast or multicast MAC addr filter for a VF:: 980 981 testpmd> set port (port_id) vf (vf_id) (mac_addr) \ 982 (exact-mac|exact-mac-vlan|hashmac|hashmac-vlan) (on|off) 983 984set port - rx mode(for VF) 985~~~~~~~~~~~~~~~~~~~~~~~~~~ 986 987Set the VF receive mode of a port:: 988 989 testpmd> set port (port_id) vf (vf_id) \ 990 rxmode (AUPE|ROPE|BAM|MPE) (on|off) 991 992The available receive modes are: 993 994* ``AUPE``: Accepts untagged VLAN. 995 996* ``ROPE``: Accepts unicast hash. 997 998* ``BAM``: Accepts broadcast packets. 999 1000* ``MPE``: Accepts all multicast packets. 1001 1002set port - tx_rate (for Queue) 1003~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1004 1005Set TX rate limitation for a queue on a port:: 1006 1007 testpmd> set port (port_id) queue (queue_id) rate (rate_value) 1008 1009set port - tx_rate (for VF) 1010~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1011 1012Set TX rate limitation for queues in VF on a port:: 1013 1014 testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask) 1015 1016set port - mirror rule 1017~~~~~~~~~~~~~~~~~~~~~~ 1018 1019Set pool or vlan type mirror rule for a port:: 1020 1021 testpmd> set port (port_id) mirror-rule (rule_id) \ 1022 (pool-mirror-up|pool-mirror-down|vlan-mirror) \ 1023 (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off) 1024 1025Set link mirror rule for a port:: 1026 1027 testpmd> set port (port_id) mirror-rule (rule_id) \ 1028 (uplink-mirror|downlink-mirror) dst-pool (pool_id) (on|off) 1029 1030For example to enable mirror traffic with vlan 0,1 to pool 0:: 1031 1032 set port 0 mirror-rule 0 vlan-mirror 0,1 dst-pool 0 on 1033 1034reset port - mirror rule 1035~~~~~~~~~~~~~~~~~~~~~~~~ 1036 1037Reset a mirror rule for a port:: 1038 1039 testpmd> reset port (port_id) mirror-rule (rule_id) 1040 1041set flush_rx 1042~~~~~~~~~~~~ 1043 1044Set the flush on RX streams before forwarding. 1045The default is flush ``on``. 1046Mainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams:: 1047 1048 testpmd> set flush_rx off 1049 1050set bypass mode 1051~~~~~~~~~~~~~~~ 1052 1053Set the bypass mode for the lowest port on bypass enabled NIC:: 1054 1055 testpmd> set bypass mode (normal|bypass|isolate) (port_id) 1056 1057set bypass event 1058~~~~~~~~~~~~~~~~ 1059 1060Set the event required to initiate specified bypass mode for the lowest port on a bypass enabled:: 1061 1062 testpmd> set bypass event (timeout|os_on|os_off|power_on|power_off) \ 1063 mode (normal|bypass|isolate) (port_id) 1064 1065Where: 1066 1067* ``timeout``: Enable bypass after watchdog timeout. 1068 1069* ``os_on``: Enable bypass when OS/board is powered on. 1070 1071* ``os_off``: Enable bypass when OS/board is powered off. 1072 1073* ``power_on``: Enable bypass when power supply is turned on. 1074 1075* ``power_off``: Enable bypass when power supply is turned off. 1076 1077 1078set bypass timeout 1079~~~~~~~~~~~~~~~~~~ 1080 1081Set the bypass watchdog timeout to ``n`` seconds where 0 = instant:: 1082 1083 testpmd> set bypass timeout (0|1.5|2|3|4|8|16|32) 1084 1085show bypass config 1086~~~~~~~~~~~~~~~~~~ 1087 1088Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC:: 1089 1090 testpmd> show bypass config (port_id) 1091 1092set link up 1093~~~~~~~~~~~ 1094 1095Set link up for a port:: 1096 1097 testpmd> set link-up port (port id) 1098 1099set link down 1100~~~~~~~~~~~~~ 1101 1102Set link down for a port:: 1103 1104 testpmd> set link-down port (port id) 1105 1106E-tag set 1107~~~~~~~~~ 1108 1109Enable E-tag insertion for a VF on a port:: 1110 1111 testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id) 1112 1113Disable E-tag insertion for a VF on a port:: 1114 1115 testpmd> E-tag set insertion off port (port_id) vf (vf_id) 1116 1117Enable/disable E-tag stripping on a port:: 1118 1119 testpmd> E-tag set stripping (on|off) port (port_id) 1120 1121Enable/disable E-tag based forwarding on a port:: 1122 1123 testpmd> E-tag set forwarding (on|off) port (port_id) 1124 1125Add an E-tag forwarding filter on a port:: 1126 1127 testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id) port (port_id) 1128 1129Delete an E-tag forwarding filter on a port:: 1130 testpmd> E-tag set filter del e-tag-id (value) port (port_id) 1131 1132 1133Port Functions 1134-------------- 1135 1136The following sections show functions for configuring ports. 1137 1138.. note:: 1139 1140 Port configuration changes only become active when forwarding is started/restarted. 1141 1142port attach 1143~~~~~~~~~~~ 1144 1145Attach a port specified by pci address or virtual device args:: 1146 1147 testpmd> port attach (identifier) 1148 1149To attach a new pci device, the device should be recognized by kernel first. 1150Then it should be moved under DPDK management. 1151Finally the port can be attached to testpmd. 1152 1153For example, to move a pci device using ixgbe under DPDK management: 1154 1155.. code-block:: console 1156 1157 # Check the status of the available devices. 1158 ./usertools/dpdk-devbind.py --status 1159 1160 Network devices using DPDK-compatible driver 1161 ============================================ 1162 <none> 1163 1164 Network devices using kernel driver 1165 =================================== 1166 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused= 1167 1168 1169 # Bind the device to igb_uio. 1170 sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0 1171 1172 1173 # Recheck the status of the devices. 1174 ./usertools/dpdk-devbind.py --status 1175 Network devices using DPDK-compatible driver 1176 ============================================ 1177 0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused= 1178 1179To attach a port created by virtual device, above steps are not needed. 1180 1181For example, to attach a port whose pci address is 0000:0a:00.0. 1182 1183.. code-block:: console 1184 1185 testpmd> port attach 0000:0a:00.0 1186 Attaching a new port... 1187 EAL: PCI device 0000:0a:00.0 on NUMA socket -1 1188 EAL: probe driver: 8086:10fb rte_ixgbe_pmd 1189 EAL: PCI memory mapped at 0x7f83bfa00000 1190 EAL: PCI memory mapped at 0x7f83bfa80000 1191 PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5 1192 PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb 1193 Port 0 is attached. Now total ports is 1 1194 Done 1195 1196For example, to attach a port created by pcap PMD. 1197 1198.. code-block:: console 1199 1200 testpmd> port attach net_pcap0 1201 Attaching a new port... 1202 PMD: Initializing pmd_pcap for net_pcap0 1203 PMD: Creating pcap-backed ethdev on numa socket 0 1204 Port 0 is attached. Now total ports is 1 1205 Done 1206 1207In this case, identifier is ``net_pcap0``. 1208This identifier format is the same as ``--vdev`` format of DPDK applications. 1209 1210For example, to re-attach a bonded port which has been previously detached, 1211the mode and slave parameters must be given. 1212 1213.. code-block:: console 1214 1215 testpmd> port attach net_bond_0,mode=0,slave=1 1216 Attaching a new port... 1217 EAL: Initializing pmd_bond for net_bond_0 1218 EAL: Create bonded device net_bond_0 on port 0 in mode 0 on socket 0. 1219 Port 0 is attached. Now total ports is 1 1220 Done 1221 1222 1223port detach 1224~~~~~~~~~~~ 1225 1226Detach a specific port:: 1227 1228 testpmd> port detach (port_id) 1229 1230Before detaching a port, the port should be stopped and closed. 1231 1232For example, to detach a pci device port 0. 1233 1234.. code-block:: console 1235 1236 testpmd> port stop 0 1237 Stopping ports... 1238 Done 1239 testpmd> port close 0 1240 Closing ports... 1241 Done 1242 1243 testpmd> port detach 0 1244 Detaching a port... 1245 EAL: PCI device 0000:0a:00.0 on NUMA socket -1 1246 EAL: remove driver: 8086:10fb rte_ixgbe_pmd 1247 EAL: PCI memory unmapped at 0x7f83bfa00000 1248 EAL: PCI memory unmapped at 0x7f83bfa80000 1249 Done 1250 1251 1252For example, to detach a virtual device port 0. 1253 1254.. code-block:: console 1255 1256 testpmd> port stop 0 1257 Stopping ports... 1258 Done 1259 testpmd> port close 0 1260 Closing ports... 1261 Done 1262 1263 testpmd> port detach 0 1264 Detaching a port... 1265 PMD: Closing pcap ethdev on numa socket 0 1266 Port 'net_pcap0' is detached. Now total ports is 0 1267 Done 1268 1269To remove a pci device completely from the system, first detach the port from testpmd. 1270Then the device should be moved under kernel management. 1271Finally the device can be removed using kernel pci hotplug functionality. 1272 1273For example, to move a pci device under kernel management: 1274 1275.. code-block:: console 1276 1277 sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0 1278 1279 ./usertools/dpdk-devbind.py --status 1280 1281 Network devices using DPDK-compatible driver 1282 ============================================ 1283 <none> 1284 1285 Network devices using kernel driver 1286 =================================== 1287 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio 1288 1289To remove a port created by a virtual device, above steps are not needed. 1290 1291port start 1292~~~~~~~~~~ 1293 1294Start all ports or a specific port:: 1295 1296 testpmd> port start (port_id|all) 1297 1298port stop 1299~~~~~~~~~ 1300 1301Stop all ports or a specific port:: 1302 1303 testpmd> port stop (port_id|all) 1304 1305port close 1306~~~~~~~~~~ 1307 1308Close all ports or a specific port:: 1309 1310 testpmd> port close (port_id|all) 1311 1312port start/stop queue 1313~~~~~~~~~~~~~~~~~~~~~ 1314 1315Start/stop a rx/tx queue on a specific port:: 1316 1317 testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop) 1318 1319Only take effect when port is started. 1320 1321port config - speed 1322~~~~~~~~~~~~~~~~~~~ 1323 1324Set the speed and duplex mode for all ports or a specific port:: 1325 1326 testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|auto) \ 1327 duplex (half|full|auto) 1328 1329port config - queues/descriptors 1330~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1331 1332Set number of queues/descriptors for rxq, txq, rxd and txd:: 1333 1334 testpmd> port config all (rxq|txq|rxd|txd) (value) 1335 1336This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options. 1337 1338port config - max-pkt-len 1339~~~~~~~~~~~~~~~~~~~~~~~~~ 1340 1341Set the maximum packet length:: 1342 1343 testpmd> port config all max-pkt-len (value) 1344 1345This is equivalent to the ``--max-pkt-len`` command-line option. 1346 1347port config - CRC Strip 1348~~~~~~~~~~~~~~~~~~~~~~~ 1349 1350Set hardware CRC stripping on or off for all ports:: 1351 1352 testpmd> port config all crc-strip (on|off) 1353 1354CRC stripping is off by default. 1355 1356The ``on`` option is equivalent to the ``--crc-strip`` command-line option. 1357 1358port config - scatter 1359~~~~~~~~~~~~~~~~~~~~~~~ 1360 1361Set RX scatter mode on or off for all ports:: 1362 1363 testpmd> port config all scatter (on|off) 1364 1365RX scatter mode is off by default. 1366 1367The ``on`` option is equivalent to the ``--enable-scatter`` command-line option. 1368 1369port config - TX queue flags 1370~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1371 1372Set a hexadecimal bitmap of TX queue flags for all ports:: 1373 1374 testpmd> port config all txqflags value 1375 1376This command is equivalent to the ``--txqflags`` command-line option. 1377 1378port config - RX Checksum 1379~~~~~~~~~~~~~~~~~~~~~~~~~ 1380 1381Set hardware RX checksum offload to on or off for all ports:: 1382 1383 testpmd> port config all rx-cksum (on|off) 1384 1385Checksum offload is off by default. 1386 1387The ``on`` option is equivalent to the ``--enable-rx-cksum`` command-line option. 1388 1389port config - VLAN 1390~~~~~~~~~~~~~~~~~~ 1391 1392Set hardware VLAN on or off for all ports:: 1393 1394 testpmd> port config all hw-vlan (on|off) 1395 1396Hardware VLAN is on by default. 1397 1398The ``off`` option is equivalent to the ``--disable-hw-vlan`` command-line option. 1399 1400port config - VLAN filter 1401~~~~~~~~~~~~~~~~~~~~~~~~~ 1402 1403Set hardware VLAN filter on or off for all ports:: 1404 1405 testpmd> port config all hw-vlan-filter (on|off) 1406 1407Hardware VLAN filter is on by default. 1408 1409The ``off`` option is equivalent to the ``--disable-hw-vlan-filter`` command-line option. 1410 1411port config - VLAN strip 1412~~~~~~~~~~~~~~~~~~~~~~~~ 1413 1414Set hardware VLAN strip on or off for all ports:: 1415 1416 testpmd> port config all hw-vlan-strip (on|off) 1417 1418Hardware VLAN strip is on by default. 1419 1420The ``off`` option is equivalent to the ``--disable-hw-vlan-strip`` command-line option. 1421 1422port config - VLAN extend 1423~~~~~~~~~~~~~~~~~~~~~~~~~ 1424 1425Set hardware VLAN extend on or off for all ports:: 1426 1427 testpmd> port config all hw-vlan-extend (on|off) 1428 1429Hardware VLAN extend is off by default. 1430 1431The ``off`` option is equivalent to the ``--disable-hw-vlan-extend`` command-line option. 1432 1433port config - Drop Packets 1434~~~~~~~~~~~~~~~~~~~~~~~~~~ 1435 1436Set packet drop for packets with no descriptors on or off for all ports:: 1437 1438 testpmd> port config all drop-en (on|off) 1439 1440Packet dropping for packets with no descriptors is off by default. 1441 1442The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option. 1443 1444port config - RSS 1445~~~~~~~~~~~~~~~~~ 1446 1447Set the RSS (Receive Side Scaling) mode on or off:: 1448 1449 testpmd> port config all rss (all|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none) 1450 1451RSS is on by default. 1452 1453The ``none`` option is equivalent to the ``--disable-rss`` command-line option. 1454 1455port config - RSS Reta 1456~~~~~~~~~~~~~~~~~~~~~~ 1457 1458Set the RSS (Receive Side Scaling) redirection table:: 1459 1460 testpmd> port config all rss reta (hash,queue)[,(hash,queue)] 1461 1462port config - DCB 1463~~~~~~~~~~~~~~~~~ 1464 1465Set the DCB mode for an individual port:: 1466 1467 testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off) 1468 1469The traffic class should be 4 or 8. 1470 1471port config - Burst 1472~~~~~~~~~~~~~~~~~~~ 1473 1474Set the number of packets per burst:: 1475 1476 testpmd> port config all burst (value) 1477 1478This is equivalent to the ``--burst`` command-line option. 1479 1480port config - Threshold 1481~~~~~~~~~~~~~~~~~~~~~~~ 1482 1483Set thresholds for TX/RX queues:: 1484 1485 testpmd> port config all (threshold) (value) 1486 1487Where the threshold type can be: 1488 1489* ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255. 1490 1491* ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255. 1492 1493* ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255. 1494 1495* ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255. 1496 1497* ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255. 1498 1499* ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255. 1500 1501* ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd. 1502 1503* ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd. 1504 1505* ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd. 1506 1507These threshold options are also available from the command-line. 1508 1509port config - E-tag 1510~~~~~~~~~~~~~~~~~~~ 1511 1512Set the value of ether-type for E-tag:: 1513 1514 testpmd> port config (port_id|all) l2-tunnel E-tag ether-type (value) 1515 1516Enable/disable the E-tag support:: 1517 1518 testpmd> port config (port_id|all) l2-tunnel E-tag (enable|disable) 1519 1520 1521Link Bonding Functions 1522---------------------- 1523 1524The Link Bonding functions make it possible to dynamically create and 1525manage link bonding devices from within testpmd interactive prompt. 1526 1527create bonded device 1528~~~~~~~~~~~~~~~~~~~~ 1529 1530Create a new bonding device:: 1531 1532 testpmd> create bonded device (mode) (socket) 1533 1534For example, to create a bonded device in mode 1 on socket 0:: 1535 1536 testpmd> create bonded 1 0 1537 created new bonded device (port X) 1538 1539add bonding slave 1540~~~~~~~~~~~~~~~~~ 1541 1542Adds Ethernet device to a Link Bonding device:: 1543 1544 testpmd> add bonding slave (slave id) (port id) 1545 1546For example, to add Ethernet device (port 6) to a Link Bonding device (port 10):: 1547 1548 testpmd> add bonding slave 6 10 1549 1550 1551remove bonding slave 1552~~~~~~~~~~~~~~~~~~~~ 1553 1554Removes an Ethernet slave device from a Link Bonding device:: 1555 1556 testpmd> remove bonding slave (slave id) (port id) 1557 1558For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10):: 1559 1560 testpmd> remove bonding slave 6 10 1561 1562set bonding mode 1563~~~~~~~~~~~~~~~~ 1564 1565Set the Link Bonding mode of a Link Bonding device:: 1566 1567 testpmd> set bonding mode (value) (port id) 1568 1569For example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3):: 1570 1571 testpmd> set bonding mode 3 10 1572 1573set bonding primary 1574~~~~~~~~~~~~~~~~~~~ 1575 1576Set an Ethernet slave device as the primary device on a Link Bonding device:: 1577 1578 testpmd> set bonding primary (slave id) (port id) 1579 1580For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10):: 1581 1582 testpmd> set bonding primary 6 10 1583 1584set bonding mac 1585~~~~~~~~~~~~~~~ 1586 1587Set the MAC address of a Link Bonding device:: 1588 1589 testpmd> set bonding mac (port id) (mac) 1590 1591For example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01:: 1592 1593 testpmd> set bonding mac 10 00:00:00:00:00:01 1594 1595set bonding xmit_balance_policy 1596~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1597 1598Set the transmission policy for a Link Bonding device when it is in Balance XOR mode:: 1599 1600 testpmd> set bonding xmit_balance_policy (port_id) (l2|l23|l34) 1601 1602For example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports):: 1603 1604 testpmd> set bonding xmit_balance_policy 10 l34 1605 1606 1607set bonding mon_period 1608~~~~~~~~~~~~~~~~~~~~~~ 1609 1610Set the link status monitoring polling period in milliseconds for a bonding device. 1611 1612This adds support for PMD slave devices which do not support link status interrupts. 1613When the mon_period is set to a value greater than 0 then all PMD's which do not support 1614link status ISR will be queried every polling interval to check if their link status has changed:: 1615 1616 testpmd> set bonding mon_period (port_id) (value) 1617 1618For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms:: 1619 1620 testpmd> set bonding mon_period 5 150 1621 1622 1623show bonding config 1624~~~~~~~~~~~~~~~~~~~ 1625 1626Show the current configuration of a Link Bonding device:: 1627 1628 testpmd> show bonding config (port id) 1629 1630For example, 1631to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4) 1632in balance mode with a transmission policy of layer 2+3:: 1633 1634 testpmd> show bonding config 9 1635 Bonding mode: 2 1636 Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23 1637 Slaves (3): [1 3 4] 1638 Active Slaves (3): [1 3 4] 1639 Primary: [3] 1640 1641 1642Register Functions 1643------------------ 1644 1645The Register Functions can be used to read from and write to registers on the network card referenced by a port number. 1646This is mainly useful for debugging purposes. 1647Reference should be made to the appropriate datasheet for the network card for details on the register addresses 1648and fields that can be accessed. 1649 1650read reg 1651~~~~~~~~ 1652 1653Display the value of a port register:: 1654 1655 testpmd> read reg (port_id) (address) 1656 1657For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller:: 1658 1659 testpmd> read reg 0 0xEE00 1660 port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241) 1661 1662read regfield 1663~~~~~~~~~~~~~ 1664 1665Display a port register bit field:: 1666 1667 testpmd> read regfield (port_id) (address) (bit_x) (bit_y) 1668 1669For example, reading the lowest two bits from the register in the example above:: 1670 1671 testpmd> read regfield 0 0xEE00 0 1 1672 port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1) 1673 1674read regbit 1675~~~~~~~~~~~ 1676 1677Display a single port register bit:: 1678 1679 testpmd> read regbit (port_id) (address) (bit_x) 1680 1681For example, reading the lowest bit from the register in the example above:: 1682 1683 testpmd> read regbit 0 0xEE00 0 1684 port 0 PCI register at offset 0xEE00: bit 0=1 1685 1686write reg 1687~~~~~~~~~ 1688 1689Set the value of a port register:: 1690 1691 testpmd> write reg (port_id) (address) (value) 1692 1693For example, to clear a register:: 1694 1695 testpmd> write reg 0 0xEE00 0x0 1696 port 0 PCI register at offset 0xEE00: 0x00000000 (0) 1697 1698write regfield 1699~~~~~~~~~~~~~~ 1700 1701Set bit field of a port register:: 1702 1703 testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value) 1704 1705For example, writing to the register cleared in the example above:: 1706 1707 testpmd> write regfield 0 0xEE00 0 1 2 1708 port 0 PCI register at offset 0xEE00: 0x00000002 (2) 1709 1710write regbit 1711~~~~~~~~~~~~ 1712 1713Set single bit value of a port register:: 1714 1715 testpmd> write regbit (port_id) (address) (bit_x) (value) 1716 1717For example, to set the high bit in the register from the example above:: 1718 1719 testpmd> write regbit 0 0xEE00 31 1 1720 port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658) 1721 1722 1723Filter Functions 1724---------------- 1725 1726This section details the available filter functions that are available. 1727 1728Note these functions interface the deprecated legacy filtering framework, 1729superseded by *rte_flow*. See `Flow rules management`_. 1730 1731ethertype_filter 1732~~~~~~~~~~~~~~~~~~~~ 1733 1734Add or delete a L2 Ethertype filter, which identify packets by their L2 Ethertype mainly assign them to a receive queue:: 1735 1736 ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr) (mac_address) \ 1737 ethertype (ether_type) (drop|fwd) queue (queue_id) 1738 1739The available information parameters are: 1740 1741* ``port_id``: The port which the Ethertype filter assigned on. 1742 1743* ``mac_addr``: Compare destination mac address. 1744 1745* ``mac_ignr``: Ignore destination mac address match. 1746 1747* ``mac_address``: Destination mac address to match. 1748 1749* ``ether_type``: The EtherType value want to match, 1750 for example 0x0806 for ARP packet. 0x0800 (IPv4) and 0x86DD (IPv6) are invalid. 1751 1752* ``queue_id``: The receive queue associated with this EtherType filter. 1753 It is meaningless when deleting or dropping. 1754 1755Example, to add/remove an ethertype filter rule:: 1756 1757 testpmd> ethertype_filter 0 add mac_ignr 00:11:22:33:44:55 \ 1758 ethertype 0x0806 fwd queue 3 1759 1760 testpmd> ethertype_filter 0 del mac_ignr 00:11:22:33:44:55 \ 1761 ethertype 0x0806 fwd queue 3 1762 17632tuple_filter 1764~~~~~~~~~~~~~~~~~ 1765 1766Add or delete a 2-tuple filter, 1767which identifies packets by specific protocol and destination TCP/UDP port 1768and forwards packets into one of the receive queues:: 1769 1770 2tuple_filter (port_id) (add|del) dst_port (dst_port_value) \ 1771 protocol (protocol_value) mask (mask_value) \ 1772 tcp_flags (tcp_flags_value) priority (prio_value) \ 1773 queue (queue_id) 1774 1775The available information parameters are: 1776 1777* ``port_id``: The port which the 2-tuple filter assigned on. 1778 1779* ``dst_port_value``: Destination port in L4. 1780 1781* ``protocol_value``: IP L4 protocol. 1782 1783* ``mask_value``: Participates in the match or not by bit for field above, 1b means participate. 1784 1785* ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the pro_value is not set to 0x06 (TCP). 1786 1787* ``prio_value``: Priority of this filter. 1788 1789* ``queue_id``: The receive queue associated with this 2-tuple filter. 1790 1791Example, to add/remove an 2tuple filter rule:: 1792 1793 testpmd> 2tuple_filter 0 add dst_port 32 protocol 0x06 mask 0x03 \ 1794 tcp_flags 0x02 priority 3 queue 3 1795 1796 testpmd> 2tuple_filter 0 del dst_port 32 protocol 0x06 mask 0x03 \ 1797 tcp_flags 0x02 priority 3 queue 3 1798 17995tuple_filter 1800~~~~~~~~~~~~~~~~~ 1801 1802Add or delete a 5-tuple filter, 1803which consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port) 1804and routes packets into one of the receive queues:: 1805 1806 5tuple_filter (port_id) (add|del) dst_ip (dst_address) src_ip \ 1807 (src_address) dst_port (dst_port_value) \ 1808 src_port (src_port_value) protocol (protocol_value) \ 1809 mask (mask_value) tcp_flags (tcp_flags_value) \ 1810 priority (prio_value) queue (queue_id) 1811 1812The available information parameters are: 1813 1814* ``port_id``: The port which the 5-tuple filter assigned on. 1815 1816* ``dst_address``: Destination IP address. 1817 1818* ``src_address``: Source IP address. 1819 1820* ``dst_port_value``: TCP/UDP destination port. 1821 1822* ``src_port_value``: TCP/UDP source port. 1823 1824* ``protocol_value``: L4 protocol. 1825 1826* ``mask_value``: Participates in the match or not by bit for field above, 1b means participate 1827 1828* ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the protocol_value is not set to 0x06 (TCP). 1829 1830* ``prio_value``: The priority of this filter. 1831 1832* ``queue_id``: The receive queue associated with this 5-tuple filter. 1833 1834Example, to add/remove an 5tuple filter rule:: 1835 1836 testpmd> 5tuple_filter 0 add dst_ip 2.2.2.5 src_ip 2.2.2.4 \ 1837 dst_port 64 src_port 32 protocol 0x06 mask 0x1F \ 1838 flags 0x0 priority 3 queue 3 1839 1840 testpmd> 5tuple_filter 0 del dst_ip 2.2.2.5 src_ip 2.2.2.4 \ 1841 dst_port 64 src_port 32 protocol 0x06 mask 0x1F \ 1842 flags 0x0 priority 3 queue 3 1843 1844syn_filter 1845~~~~~~~~~~ 1846 1847Using the SYN filter, TCP packets whose *SYN* flag is set can be forwarded to a separate queue:: 1848 1849 syn_filter (port_id) (add|del) priority (high|low) queue (queue_id) 1850 1851The available information parameters are: 1852 1853* ``port_id``: The port which the SYN filter assigned on. 1854 1855* ``high``: This SYN filter has higher priority than other filters. 1856 1857* ``low``: This SYN filter has lower priority than other filters. 1858 1859* ``queue_id``: The receive queue associated with this SYN filter 1860 1861Example:: 1862 1863 testpmd> syn_filter 0 add priority high queue 3 1864 1865flex_filter 1866~~~~~~~~~~~ 1867 1868With flex filter, packets can be recognized by any arbitrary pattern within the first 128 bytes of the packet 1869and routed into one of the receive queues:: 1870 1871 flex_filter (port_id) (add|del) len (len_value) bytes (bytes_value) \ 1872 mask (mask_value) priority (prio_value) queue (queue_id) 1873 1874The available information parameters are: 1875 1876* ``port_id``: The port which the Flex filter is assigned on. 1877 1878* ``len_value``: Filter length in bytes, no greater than 128. 1879 1880* ``bytes_value``: A string in hexadecimal, means the value the flex filter needs to match. 1881 1882* ``mask_value``: A string in hexadecimal, bit 1 means corresponding byte participates in the match. 1883 1884* ``prio_value``: The priority of this filter. 1885 1886* ``queue_id``: The receive queue associated with this Flex filter. 1887 1888Example:: 1889 1890 testpmd> flex_filter 0 add len 16 bytes 0x00000000000000000000000008060000 \ 1891 mask 000C priority 3 queue 3 1892 1893 testpmd> flex_filter 0 del len 16 bytes 0x00000000000000000000000008060000 \ 1894 mask 000C priority 3 queue 3 1895 1896 1897.. _testpmd_flow_director: 1898 1899flow_director_filter 1900~~~~~~~~~~~~~~~~~~~~ 1901 1902The Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues. 1903 1904Four types of filtering are supported which are referred to as Perfect Match, Signature, Perfect-mac-vlan and 1905Perfect-tunnel filters, the match mode is set by the ``--pkt-filter-mode`` command-line parameter: 1906 1907* Perfect match filters. 1908 The hardware checks a match between the masked fields of the received packets and the programmed filters. 1909 The masked fields are for IP flow. 1910 1911* Signature filters. 1912 The hardware checks a match between a hash-based signature of the masked fields of the received packet. 1913 1914* Perfect-mac-vlan match filters. 1915 The hardware checks a match between the masked fields of the received packets and the programmed filters. 1916 The masked fields are for MAC VLAN flow. 1917 1918* Perfect-tunnel match filters. 1919 The hardware checks a match between the masked fields of the received packets and the programmed filters. 1920 The masked fields are for tunnel flow. 1921 1922The Flow Director filters can match the different fields for different type of packet: flow type, specific input set 1923per flow type and the flexible payload. 1924 1925The Flow Director can also mask out parts of all of these fields so that filters 1926are only applied to certain fields or parts of the fields. 1927 1928Different NICs may have different capabilities, command show port fdir (port_id) can be used to acquire the information. 1929 1930# Commands to add flow director filters of different flow types:: 1931 1932 flow_director_filter (port_id) mode IP (add|del|update) \ 1933 flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag) \ 1934 src (src_ip_address) dst (dst_ip_address) \ 1935 tos (tos_value) proto (proto_value) ttl (ttl_value) \ 1936 vlan (vlan_value) flexbytes (flexbytes_value) \ 1937 (drop|fwd) pf|vf(vf_id) queue (queue_id) \ 1938 fd_id (fd_id_value) 1939 1940 flow_director_filter (port_id) mode IP (add|del|update) \ 1941 flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp) \ 1942 src (src_ip_address) (src_port) \ 1943 dst (dst_ip_address) (dst_port) \ 1944 tos (tos_value) ttl (ttl_value) \ 1945 vlan (vlan_value) flexbytes (flexbytes_value) \ 1946 (drop|fwd) queue pf|vf(vf_id) (queue_id) \ 1947 fd_id (fd_id_value) 1948 1949 flow_director_filter (port_id) mode IP (add|del|update) \ 1950 flow (ipv4-sctp|ipv6-sctp) \ 1951 src (src_ip_address) (src_port) \ 1952 dst (dst_ip_address) (dst_port) \ 1953 tos (tos_value) ttl (ttl_value) \ 1954 tag (verification_tag) vlan (vlan_value) \ 1955 flexbytes (flexbytes_value) (drop|fwd) \ 1956 pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value) 1957 1958 flow_director_filter (port_id) mode IP (add|del|update) flow l2_payload \ 1959 ether (ethertype) flexbytes (flexbytes_value) \ 1960 (drop|fwd) pf|vf(vf_id) queue (queue_id) 1961 fd_id (fd_id_value) 1962 1963 flow_director_filter (port_id) mode MAC-VLAN (add|del|update) \ 1964 mac (mac_address) vlan (vlan_value) \ 1965 flexbytes (flexbytes_value) (drop|fwd) \ 1966 queue (queue_id) fd_id (fd_id_value) 1967 1968 flow_director_filter (port_id) mode Tunnel (add|del|update) \ 1969 mac (mac_address) vlan (vlan_value) \ 1970 tunnel (NVGRE|VxLAN) tunnel-id (tunnel_id_value) \ 1971 flexbytes (flexbytes_value) (drop|fwd) \ 1972 queue (queue_id) fd_id (fd_id_value) 1973 1974For example, to add an ipv4-udp flow type filter:: 1975 1976 testpmd> flow_director_filter 0 mode IP add flow ipv4-udp src 2.2.2.3 32 \ 1977 dst 2.2.2.5 33 tos 2 ttl 40 vlan 0x1 flexbytes (0x88,0x48) \ 1978 fwd pf queue 1 fd_id 1 1979 1980For example, add an ipv4-other flow type filter:: 1981 1982 testpmd> flow_director_filter 0 mode IP add flow ipv4-other src 2.2.2.3 \ 1983 dst 2.2.2.5 tos 2 proto 20 ttl 40 vlan 0x1 \ 1984 flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1 1985 1986flush_flow_director 1987~~~~~~~~~~~~~~~~~~~ 1988 1989Flush all flow director filters on a device:: 1990 1991 testpmd> flush_flow_director (port_id) 1992 1993Example, to flush all flow director filter on port 0:: 1994 1995 testpmd> flush_flow_director 0 1996 1997flow_director_mask 1998~~~~~~~~~~~~~~~~~~ 1999 2000Set flow director's input masks:: 2001 2002 flow_director_mask (port_id) mode IP vlan (vlan_value) \ 2003 src_mask (ipv4_src) (ipv6_src) (src_port) \ 2004 dst_mask (ipv4_dst) (ipv6_dst) (dst_port) 2005 2006 flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value) 2007 2008 flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \ 2009 mac (mac_value) tunnel-type (tunnel_type_value) \ 2010 tunnel-id (tunnel_id_value) 2011 2012Example, to set flow director mask on port 0:: 2013 2014 testpmd> flow_director_mask 0 mode IP vlan 0xefff \ 2015 src_mask 255.255.255.255 \ 2016 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF \ 2017 dst_mask 255.255.255.255 \ 2018 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF 2019 2020flow_director_flex_mask 2021~~~~~~~~~~~~~~~~~~~~~~~ 2022 2023set masks of flow director's flexible payload based on certain flow type:: 2024 2025 testpmd> flow_director_flex_mask (port_id) \ 2026 flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \ 2027 ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \ 2028 l2_payload|all) (mask) 2029 2030Example, to set flow director's flex mask for all flow type on port 0:: 2031 2032 testpmd> flow_director_flex_mask 0 flow all \ 2033 (0xff,0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0) 2034 2035 2036flow_director_flex_payload 2037~~~~~~~~~~~~~~~~~~~~~~~~~~ 2038 2039Configure flexible payload selection:: 2040 2041 flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config) 2042 2043For example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload:: 2044 2045 testpmd> flow_director_flex_payload 0 l4 \ 2046 (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19) 2047 2048get_sym_hash_ena_per_port 2049~~~~~~~~~~~~~~~~~~~~~~~~~ 2050 2051Get symmetric hash enable configuration per port:: 2052 2053 get_sym_hash_ena_per_port (port_id) 2054 2055For example, to get symmetric hash enable configuration of port 1:: 2056 2057 testpmd> get_sym_hash_ena_per_port 1 2058 2059set_sym_hash_ena_per_port 2060~~~~~~~~~~~~~~~~~~~~~~~~~ 2061 2062Set symmetric hash enable configuration per port to enable or disable:: 2063 2064 set_sym_hash_ena_per_port (port_id) (enable|disable) 2065 2066For example, to set symmetric hash enable configuration of port 1 to enable:: 2067 2068 testpmd> set_sym_hash_ena_per_port 1 enable 2069 2070get_hash_global_config 2071~~~~~~~~~~~~~~~~~~~~~~ 2072 2073Get the global configurations of hash filters:: 2074 2075 get_hash_global_config (port_id) 2076 2077For example, to get the global configurations of hash filters of port 1:: 2078 2079 testpmd> get_hash_global_config 1 2080 2081set_hash_global_config 2082~~~~~~~~~~~~~~~~~~~~~~ 2083 2084Set the global configurations of hash filters:: 2085 2086 set_hash_global_config (port_id) (toeplitz|simple_xor|default) \ 2087 (ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|ipv6-frag| \ 2088 ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload) \ 2089 (enable|disable) 2090 2091For example, to enable simple_xor for flow type of ipv6 on port 2:: 2092 2093 testpmd> set_hash_global_config 2 simple_xor ipv6 enable 2094 2095set_hash_input_set 2096~~~~~~~~~~~~~~~~~~ 2097 2098Set the input set for hash:: 2099 2100 set_hash_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \ 2101 ipv4-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \ 2102 l2_payload) (ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6|ipv4-tos| \ 2103 ipv4-proto|ipv6-tc|ipv6-next-header|udp-src-port|udp-dst-port| \ 2104 tcp-src-port|tcp-dst-port|sctp-src-port|sctp-dst-port|sctp-veri-tag| \ 2105 udp-key|gre-key|fld-1st|fld-2nd|fld-3rd|fld-4th|fld-5th|fld-6th|fld-7th| \ 2106 fld-8th|none) (select|add) 2107 2108For example, to add source IP to hash input set for flow type of ipv4-udp on port 0:: 2109 2110 testpmd> set_hash_input_set 0 ipv4-udp src-ipv4 add 2111 2112set_fdir_input_set 2113~~~~~~~~~~~~~~~~~~ 2114 2115The Flow Director filters can match the different fields for different type of packet, i.e. specific input set 2116on per flow type and the flexible payload. This command can be used to change input set for each flow type. 2117 2118Set the input set for flow director:: 2119 2120 set_fdir_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \ 2121 ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \ 2122 l2_payload) (ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6|ipv4-tos| \ 2123 ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|ipv6-hop-limits| \ 2124 tudp-src-port|udp-dst-port|cp-src-port|tcp-dst-port|sctp-src-port| \ 2125 sctp-dst-port|sctp-veri-tag|none) (select|add) 2126 2127For example to add source IP to FD input set for flow type of ipv4-udp on port 0:: 2128 2129 testpmd> set_fdir_input_set 0 ipv4-udp src-ipv4 add 2130 2131global_config 2132~~~~~~~~~~~~~ 2133 2134Set different GRE key length for input set:: 2135 2136 global_config (port_id) gre-key-len (number in bytes) 2137 2138For example to set GRE key length for input set to 4 bytes on port 0:: 2139 2140 testpmd> global_config 0 gre-key-len 4 2141 2142 2143.. _testpmd_rte_flow: 2144 2145Flow rules management 2146--------------------- 2147 2148Control of the generic flow API (*rte_flow*) is fully exposed through the 2149``flow`` command (validation, creation, destruction and queries). 2150 2151Considering *rte_flow* overlaps with all `Filter Functions`_, using both 2152features simultaneously may cause undefined side-effects and is therefore 2153not recommended. 2154 2155``flow`` syntax 2156~~~~~~~~~~~~~~~ 2157 2158Because the ``flow`` command uses dynamic tokens to handle the large number 2159of possible flow rules combinations, its behavior differs slightly from 2160other commands, in particular: 2161 2162- Pressing *?* or the *<tab>* key displays contextual help for the current 2163 token, not that of the entire command. 2164 2165- Optional and repeated parameters are supported (provided they are listed 2166 in the contextual help). 2167 2168The first parameter stands for the operation mode. Possible operations and 2169their general syntax are described below. They are covered in detail in the 2170following sections. 2171 2172- Check whether a flow rule can be created:: 2173 2174 flow validate {port_id} 2175 [group {group_id}] [priority {level}] [ingress] [egress] 2176 pattern {item} [/ {item} [...]] / end 2177 actions {action} [/ {action} [...]] / end 2178 2179- Create a flow rule:: 2180 2181 flow create {port_id} 2182 [group {group_id}] [priority {level}] [ingress] [egress] 2183 pattern {item} [/ {item} [...]] / end 2184 actions {action} [/ {action} [...]] / end 2185 2186- Destroy specific flow rules:: 2187 2188 flow destroy {port_id} rule {rule_id} [...] 2189 2190- Destroy all flow rules:: 2191 2192 flow flush {port_id} 2193 2194- Query an existing flow rule:: 2195 2196 flow query {port_id} {rule_id} {action} 2197 2198- List existing flow rules sorted by priority, filtered by group 2199 identifiers:: 2200 2201 flow list {port_id} [group {group_id}] [...] 2202 2203Validating flow rules 2204~~~~~~~~~~~~~~~~~~~~~ 2205 2206``flow validate`` reports whether a flow rule would be accepted by the 2207underlying device in its current state but stops short of creating it. It is 2208bound to ``rte_flow_validate()``:: 2209 2210 flow validate {port_id} 2211 [group {group_id}] [priority {level}] [ingress] [egress] 2212 pattern {item} [/ {item} [...]] / end 2213 actions {action} [/ {action} [...]] / end 2214 2215If successful, it will show:: 2216 2217 Flow rule validated 2218 2219Otherwise it will show an error message of the form:: 2220 2221 Caught error type [...] ([...]): [...] 2222 2223This command uses the same parameters as ``flow create``, their format is 2224described in `Creating flow rules`_. 2225 2226Check whether redirecting any Ethernet packet received on port 0 to RX queue 2227index 6 is supported:: 2228 2229 testpmd> flow validate 0 ingress pattern eth / end 2230 actions queue index 6 / end 2231 Flow rule validated 2232 testpmd> 2233 2234Port 0 does not support TCPv6 rules:: 2235 2236 testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end 2237 actions drop / end 2238 Caught error type 9 (specific pattern item): Invalid argument 2239 testpmd> 2240 2241Creating flow rules 2242~~~~~~~~~~~~~~~~~~~ 2243 2244``flow create`` validates and creates the specified flow rule. It is bound 2245to ``rte_flow_create()``:: 2246 2247 flow create {port_id} 2248 [group {group_id}] [priority {level}] [ingress] [egress] 2249 pattern {item} [/ {item} [...]] / end 2250 actions {action} [/ {action} [...]] / end 2251 2252If successful, it will return a flow rule ID usable with other commands:: 2253 2254 Flow rule #[...] created 2255 2256Otherwise it will show an error message of the form:: 2257 2258 Caught error type [...] ([...]): [...] 2259 2260Parameters describe in the following order: 2261 2262- Attributes (*group*, *priority*, *ingress*, *egress* tokens). 2263- A matching pattern, starting with the *pattern* token and terminated by an 2264 *end* pattern item. 2265- Actions, starting with the *actions* token and terminated by an *end* 2266 action. 2267 2268These translate directly to *rte_flow* objects provided as-is to the 2269underlying functions. 2270 2271The shortest valid definition only comprises mandatory tokens:: 2272 2273 testpmd> flow create 0 pattern end actions end 2274 2275Note that PMDs may refuse rules that essentially do nothing such as this 2276one. 2277 2278**All unspecified object values are automatically initialized to 0.** 2279 2280Attributes 2281^^^^^^^^^^ 2282 2283These tokens affect flow rule attributes (``struct rte_flow_attr``) and are 2284specified before the ``pattern`` token. 2285 2286- ``group {group id}``: priority group. 2287- ``priority {level}``: priority level within group. 2288- ``ingress``: rule applies to ingress traffic. 2289- ``egress``: rule applies to egress traffic. 2290 2291Each instance of an attribute specified several times overrides the previous 2292value as shown below (group 4 is used):: 2293 2294 testpmd> flow create 0 group 42 group 24 group 4 [...] 2295 2296Note that once enabled, ``ingress`` and ``egress`` cannot be disabled. 2297 2298While not specifying a direction is an error, some rules may allow both 2299simultaneously. 2300 2301Most rules affect RX therefore contain the ``ingress`` token:: 2302 2303 testpmd> flow create 0 ingress pattern [...] 2304 2305Matching pattern 2306^^^^^^^^^^^^^^^^ 2307 2308A matching pattern starts after the ``pattern`` token. It is made of pattern 2309items and is terminated by a mandatory ``end`` item. 2310 2311Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum 2312rte_flow_item_type``). 2313 2314The ``/`` token is used as a separator between pattern items as shown 2315below:: 2316 2317 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...] 2318 2319Note that protocol items like these must be stacked from lowest to highest 2320layer to make sense. For instance, the following rule is either invalid or 2321unlikely to match any packet:: 2322 2323 testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...] 2324 2325More information on these restrictions can be found in the *rte_flow* 2326documentation. 2327 2328Several items support additional specification structures, for example 2329``ipv4`` allows specifying source and destination addresses as follows:: 2330 2331 testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1 2332 dst is 10.2.0.0 / end [...] 2333 2334This rule matches all IPv4 traffic with the specified properties. 2335 2336In this example, ``src`` and ``dst`` are field names of the underlying 2337``struct rte_flow_item_ipv4`` object. All item properties can be specified 2338in a similar fashion. 2339 2340The ``is`` token means that the subsequent value must be matched exactly, 2341and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item`` 2342accordingly. Possible assignment tokens are: 2343 2344- ``is``: match value perfectly (with full bit-mask). 2345- ``spec``: match value according to configured bit-mask. 2346- ``last``: specify upper bound to establish a range. 2347- ``mask``: specify bit-mask with relevant bits set to one. 2348- ``prefix``: generate bit-mask from a prefix length. 2349 2350These yield identical results:: 2351 2352 ipv4 src is 10.1.1.1 2353 2354:: 2355 2356 ipv4 src spec 10.1.1.1 src mask 255.255.255.255 2357 2358:: 2359 2360 ipv4 src spec 10.1.1.1 src prefix 32 2361 2362:: 2363 2364 ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value 2365 2366:: 2367 2368 ipv4 src is 10.1.1.1 src last 0 # 0 disables range 2369 2370Inclusive ranges can be defined with ``last``:: 2371 2372 ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4 2373 2374Note that ``mask`` affects both ``spec`` and ``last``:: 2375 2376 ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0 2377 # matches 10.1.0.0 to 10.2.255.255 2378 2379Properties can be modified multiple times:: 2380 2381 ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4 2382 2383:: 2384 2385 ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16 2386 2387Pattern items 2388^^^^^^^^^^^^^ 2389 2390This section lists supported pattern items and their attributes, if any. 2391 2392- ``end``: end list of pattern items. 2393 2394- ``void``: no-op pattern item. 2395 2396- ``invert``: perform actions when pattern does not match. 2397 2398- ``any``: match any protocol for the current layer. 2399 2400 - ``num {unsigned}``: number of layers covered. 2401 2402- ``pf``: match packets addressed to the physical function. 2403 2404- ``vf``: match packets addressed to a virtual function ID. 2405 2406 - ``id {unsigned}``: destination VF ID. 2407 2408- ``port``: device-specific physical port index to use. 2409 2410 - ``index {unsigned}``: physical port index. 2411 2412- ``raw``: match an arbitrary byte string. 2413 2414 - ``relative {boolean}``: look for pattern after the previous item. 2415 - ``search {boolean}``: search pattern from offset (see also limit). 2416 - ``offset {integer}``: absolute or relative offset for pattern. 2417 - ``limit {unsigned}``: search area limit for start of pattern. 2418 - ``pattern {string}``: byte string to look for. 2419 2420- ``eth``: match Ethernet header. 2421 2422 - ``dst {MAC-48}``: destination MAC. 2423 - ``src {MAC-48}``: source MAC. 2424 - ``type {unsigned}``: EtherType. 2425 2426- ``vlan``: match 802.1Q/ad VLAN tag. 2427 2428 - ``tpid {unsigned}``: tag protocol identifier. 2429 - ``tci {unsigned}``: tag control information. 2430 - ``pcp {unsigned}``: priority code point. 2431 - ``dei {unsigned}``: drop eligible indicator. 2432 - ``vid {unsigned}``: VLAN identifier. 2433 2434- ``ipv4``: match IPv4 header. 2435 2436 - ``tos {unsigned}``: type of service. 2437 - ``ttl {unsigned}``: time to live. 2438 - ``proto {unsigned}``: next protocol ID. 2439 - ``src {ipv4 address}``: source address. 2440 - ``dst {ipv4 address}``: destination address. 2441 2442- ``ipv6``: match IPv6 header. 2443 2444 - ``tc {unsigned}``: traffic class. 2445 - ``flow {unsigned}``: flow label. 2446 - ``proto {unsigned}``: protocol (next header). 2447 - ``hop {unsigned}``: hop limit. 2448 - ``src {ipv6 address}``: source address. 2449 - ``dst {ipv6 address}``: destination address. 2450 2451- ``icmp``: match ICMP header. 2452 2453 - ``type {unsigned}``: ICMP packet type. 2454 - ``code {unsigned}``: ICMP packet code. 2455 2456- ``udp``: match UDP header. 2457 2458 - ``src {unsigned}``: UDP source port. 2459 - ``dst {unsigned}``: UDP destination port. 2460 2461- ``tcp``: match TCP header. 2462 2463 - ``src {unsigned}``: TCP source port. 2464 - ``dst {unsigned}``: TCP destination port. 2465 2466- ``sctp``: match SCTP header. 2467 2468 - ``src {unsigned}``: SCTP source port. 2469 - ``dst {unsigned}``: SCTP destination port. 2470 - ``tag {unsigned}``: validation tag. 2471 - ``cksum {unsigned}``: checksum. 2472 2473- ``vxlan``: match VXLAN header. 2474 2475 - ``vni {unsigned}``: VXLAN identifier. 2476 2477Actions list 2478^^^^^^^^^^^^ 2479 2480A list of actions starts after the ``actions`` token in the same fashion as 2481`Matching pattern`_; actions are separated by ``/`` tokens and the list is 2482terminated by a mandatory ``end`` action. 2483 2484Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum 2485rte_flow_action_type``). 2486 2487Dropping all incoming UDPv4 packets can be expressed as follows:: 2488 2489 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end 2490 actions drop / end 2491 2492Several actions have configurable properties which must be specified when 2493there is no valid default value. For example, ``queue`` requires a target 2494queue index. 2495 2496This rule redirects incoming UDPv4 traffic to queue index 6:: 2497 2498 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end 2499 actions queue index 6 / end 2500 2501While this one could be rejected by PMDs (unspecified queue index):: 2502 2503 testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end 2504 actions queue / end 2505 2506As defined by *rte_flow*, the list is not ordered, all actions of a given 2507rule are performed simultaneously. These are equivalent:: 2508 2509 queue index 6 / void / mark id 42 / end 2510 2511:: 2512 2513 void / mark id 42 / queue index 6 / end 2514 2515All actions in a list should have different types, otherwise only the last 2516action of a given type is taken into account:: 2517 2518 queue index 4 / queue index 5 / queue index 6 / end # will use queue 6 2519 2520:: 2521 2522 drop / drop / drop / end # drop is performed only once 2523 2524:: 2525 2526 mark id 42 / queue index 3 / mark id 24 / end # mark will be 24 2527 2528Considering they are performed simultaneously, opposite and overlapping 2529actions can sometimes be combined when the end result is unambiguous:: 2530 2531 drop / queue index 6 / end # drop has no effect 2532 2533:: 2534 2535 drop / dup index 6 / end # same as above 2536 2537:: 2538 2539 queue index 6 / rss queues 6 7 8 / end # queue has no effect 2540 2541:: 2542 2543 drop / passthru / end # drop has no effect 2544 2545Note that PMDs may still refuse such combinations. 2546 2547Actions 2548^^^^^^^ 2549 2550This section lists supported actions and their attributes, if any. 2551 2552- ``end``: end list of actions. 2553 2554- ``void``: no-op action. 2555 2556- ``passthru``: let subsequent rule process matched packets. 2557 2558- ``mark``: attach 32 bit value to packets. 2559 2560 - ``id {unsigned}``: 32 bit value to return with packets. 2561 2562- ``flag``: flag packets. 2563 2564- ``queue``: assign packets to a given queue index. 2565 2566 - ``index {unsigned}``: queue index to use. 2567 2568- ``drop``: drop packets (note: passthru has priority). 2569 2570- ``count``: enable counters for this rule. 2571 2572- ``dup``: duplicate packets to a given queue index. 2573 2574 - ``index {unsigned}``: queue index to duplicate packets to. 2575 2576- ``rss``: spread packets among several queues. 2577 2578 - ``queues [{unsigned} [...]] end``: queue indices to use. 2579 2580- ``pf``: redirect packets to physical device function. 2581 2582- ``vf``: redirect packets to virtual device function. 2583 2584 - ``original {boolean}``: use original VF ID if possible. 2585 - ``id {unsigned}``: VF ID to redirect packets to. 2586 2587Destroying flow rules 2588~~~~~~~~~~~~~~~~~~~~~ 2589 2590``flow destroy`` destroys one or more rules from their rule ID (as returned 2591by ``flow create``), this command calls ``rte_flow_destroy()`` as many 2592times as necessary:: 2593 2594 flow destroy {port_id} rule {rule_id} [...] 2595 2596If successful, it will show:: 2597 2598 Flow rule #[...] destroyed 2599 2600It does not report anything for rule IDs that do not exist. The usual error 2601message is shown when a rule cannot be destroyed:: 2602 2603 Caught error type [...] ([...]): [...] 2604 2605``flow flush`` destroys all rules on a device and does not take extra 2606arguments. It is bound to ``rte_flow_flush()``:: 2607 2608 flow flush {port_id} 2609 2610Any errors are reported as above. 2611 2612Creating several rules and destroying them:: 2613 2614 testpmd> flow create 0 ingress pattern eth / ipv6 / end 2615 actions queue index 2 / end 2616 Flow rule #0 created 2617 testpmd> flow create 0 ingress pattern eth / ipv4 / end 2618 actions queue index 3 / end 2619 Flow rule #1 created 2620 testpmd> flow destroy 0 rule 0 rule 1 2621 Flow rule #1 destroyed 2622 Flow rule #0 destroyed 2623 testpmd> 2624 2625The same result can be achieved using ``flow flush``:: 2626 2627 testpmd> flow create 0 ingress pattern eth / ipv6 / end 2628 actions queue index 2 / end 2629 Flow rule #0 created 2630 testpmd> flow create 0 ingress pattern eth / ipv4 / end 2631 actions queue index 3 / end 2632 Flow rule #1 created 2633 testpmd> flow flush 0 2634 testpmd> 2635 2636Non-existent rule IDs are ignored:: 2637 2638 testpmd> flow create 0 ingress pattern eth / ipv6 / end 2639 actions queue index 2 / end 2640 Flow rule #0 created 2641 testpmd> flow create 0 ingress pattern eth / ipv4 / end 2642 actions queue index 3 / end 2643 Flow rule #1 created 2644 testpmd> flow destroy 0 rule 42 rule 10 rule 2 2645 testpmd> 2646 testpmd> flow destroy 0 rule 0 2647 Flow rule #0 destroyed 2648 testpmd> 2649 2650Querying flow rules 2651~~~~~~~~~~~~~~~~~~~ 2652 2653``flow query`` queries a specific action of a flow rule having that 2654ability. Such actions collect information that can be reported using this 2655command. It is bound to ``rte_flow_query()``:: 2656 2657 flow query {port_id} {rule_id} {action} 2658 2659If successful, it will display either the retrieved data for known actions 2660or the following message:: 2661 2662 Cannot display result for action type [...] ([...]) 2663 2664Otherwise, it will complain either that the rule does not exist or that some 2665error occurred:: 2666 2667 Flow rule #[...] not found 2668 2669:: 2670 2671 Caught error type [...] ([...]): [...] 2672 2673Currently only the ``count`` action is supported. This action reports the 2674number of packets that hit the flow rule and the total number of bytes. Its 2675output has the following format:: 2676 2677 count: 2678 hits_set: [...] # whether "hits" contains a valid value 2679 bytes_set: [...] # whether "bytes" contains a valid value 2680 hits: [...] # number of packets 2681 bytes: [...] # number of bytes 2682 2683Querying counters for TCPv6 packets redirected to queue 6:: 2684 2685 testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end 2686 actions queue index 6 / count / end 2687 Flow rule #4 created 2688 testpmd> flow query 0 4 count 2689 count: 2690 hits_set: 1 2691 bytes_set: 0 2692 hits: 386446 2693 bytes: 0 2694 testpmd> 2695 2696Listing flow rules 2697~~~~~~~~~~~~~~~~~~ 2698 2699``flow list`` lists existing flow rules sorted by priority and optionally 2700filtered by group identifiers:: 2701 2702 flow list {port_id} [group {group_id}] [...] 2703 2704This command only fails with the following message if the device does not 2705exist:: 2706 2707 Invalid port [...] 2708 2709Output consists of a header line followed by a short description of each 2710flow rule, one per line. There is no output at all when no flow rules are 2711configured on the device:: 2712 2713 ID Group Prio Attr Rule 2714 [...] [...] [...] [...] [...] 2715 2716``Attr`` column flags: 2717 2718- ``i`` for ``ingress``. 2719- ``e`` for ``egress``. 2720 2721Creating several flow rules and listing them:: 2722 2723 testpmd> flow create 0 ingress pattern eth / ipv4 / end 2724 actions queue index 6 / end 2725 Flow rule #0 created 2726 testpmd> flow create 0 ingress pattern eth / ipv6 / end 2727 actions queue index 2 / end 2728 Flow rule #1 created 2729 testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end 2730 actions rss queues 6 7 8 end / end 2731 Flow rule #2 created 2732 testpmd> flow list 0 2733 ID Group Prio Attr Rule 2734 0 0 0 i- ETH IPV4 => QUEUE 2735 1 0 0 i- ETH IPV6 => QUEUE 2736 2 0 5 i- ETH IPV4 UDP => RSS 2737 testpmd> 2738 2739Rules are sorted by priority (i.e. group ID first, then priority level):: 2740 2741 testpmd> flow list 1 2742 ID Group Prio Attr Rule 2743 0 0 0 i- ETH => COUNT 2744 6 0 500 i- ETH IPV6 TCP => DROP COUNT 2745 5 0 1000 i- ETH IPV6 ICMP => QUEUE 2746 1 24 0 i- ETH IPV4 UDP => QUEUE 2747 4 24 10 i- ETH IPV4 TCP => DROP 2748 3 24 20 i- ETH IPV4 => DROP 2749 2 24 42 i- ETH IPV4 UDP => QUEUE 2750 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE 2751 testpmd> 2752 2753Output can be limited to specific groups:: 2754 2755 testpmd> flow list 1 group 0 group 63 2756 ID Group Prio Attr Rule 2757 0 0 0 i- ETH => COUNT 2758 6 0 500 i- ETH IPV6 TCP => DROP COUNT 2759 5 0 1000 i- ETH IPV6 ICMP => QUEUE 2760 7 63 0 i- ETH IPV6 UDP VXLAN => MARK QUEUE 2761 testpmd> 2762