1.. BSD LICENSE 2 Copyright(c) 2010-2015 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 X 55 info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all 56 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X 57 stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc 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) (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 150For example: 151 152.. code-block:: console 153 154 testpmd> show port info 0 155 156 ********************* Infos for port 0 ********************* 157 158 MAC address: XX:XX:XX:XX:XX:XX 159 Connect to socket: 0 160 memory allocation on the socket: 0 161 Link status: up 162 Link speed: 40000 Mbps 163 Link duplex: full-duplex 164 Promiscuous mode: enabled 165 Allmulticast mode: disabled 166 Maximum number of MAC addresses: 64 167 Maximum number of MAC addresses of hash filtering: 0 168 VLAN offload: 169 strip on 170 filter on 171 qinq(extend) off 172 Redirection table size: 512 173 Supported flow types: 174 ipv4-frag 175 ipv4-tcp 176 ipv4-udp 177 ipv4-sctp 178 ipv4-other 179 ipv6-frag 180 ipv6-tcp 181 ipv6-udp 182 ipv6-sctp 183 ipv6-other 184 l2_payload 185 port 186 vxlan 187 geneve 188 nvgre 189 190show port rss reta 191~~~~~~~~~~~~~~~~~~ 192 193Display the rss redirection table entry indicated by masks on port X:: 194 195 testpmd> show port (port_id) rss reta (size) (mask0, mask1...) 196 197size is used to indicate the hardware supported reta size 198 199show port rss-hash 200~~~~~~~~~~~~~~~~~~ 201 202Display the RSS hash functions and RSS hash key of a port:: 203 204 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] 205 206clear port 207~~~~~~~~~~ 208 209Clear the port statistics for a given port or for all ports:: 210 211 testpmd> clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all) 212 213For example:: 214 215 testpmd> clear port stats all 216 217show (rxq|txq) 218~~~~~~~~~~~~~~ 219 220Display information for a given port's RX/TX queue:: 221 222 testpmd> show (rxq|txq) info (port_id) (queue_id) 223 224show config 225~~~~~~~~~~~ 226 227Displays the configuration of the application. 228The configuration comes from the command-line, the runtime or the application defaults:: 229 230 testpmd> show config (rxtx|cores|fwd|txpkts) 231 232The available information categories are: 233 234* ``rxtx``: RX/TX configuration items. 235 236* ``cores``: List of forwarding cores. 237 238* ``fwd``: Packet forwarding configuration. 239 240* ``txpkts``: Packets to TX configuration. 241 242For example: 243 244.. code-block:: console 245 246 testpmd> show config rxtx 247 248 io packet forwarding - CRC stripping disabled - packets/burst=16 249 nb forwarding cores=2 - nb forwarding ports=1 250 RX queues=1 - RX desc=128 - RX free threshold=0 251 RX threshold registers: pthresh=8 hthresh=8 wthresh=4 252 TX queues=1 - TX desc=512 - TX free threshold=0 253 TX threshold registers: pthresh=36 hthresh=0 wthresh=0 254 TX RS bit threshold=0 - TXQ flags=0x0 255 256set fwd 257~~~~~~~ 258 259Set the packet forwarding mode:: 260 261 testpmd> set fwd (io|mac|macswap|flowgen| \ 262 rxonly|txonly|csum|icmpecho) (""|retry) 263 264``retry`` can be specified for forwarding engines except ``rx_only``. 265 266The available information categories are: 267 268* ``io``: Forwards packets "as-is" in I/O mode. 269 This is the fastest possible forwarding operation as it does not access packets data. 270 This is the default mode. 271 272* ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them. 273 Default application behaviour is to set source Ethernet address to that of the transmitting interface, and destination 274 address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or 275 'eth-peer-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address. 276 277* ``macswap``: MAC swap forwarding mode. 278 Swaps the source and the destination Ethernet addresses of packets before forwarding them. 279 280* ``flowgen``: Multi-flow generation mode. 281 Originates a number of flows (with varying destination IP addresses), and terminate receive traffic. 282 283* ``rxonly``: Receives packets but doesn't transmit them. 284 285* ``txonly``: Generates and transmits packets without receiving any. 286 287* ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet. 288 289* ``icmpecho``: Receives a burst of packets, lookup for IMCP echo requests and, if any, send back ICMP echo replies. 290 291* ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX. Requires ``CONFIG_RTE_LIBRTE_IEEE1588=y``. 292 293Note: TX timestamping is only available in the "Full Featured" TX path. To force ``testpmd`` into this mode set ``--txqflags=0``. 294 295Example:: 296 297 testpmd> set fwd rxonly 298 299 Set rxonly packet forwarding mode 300 301 302read rxd 303~~~~~~~~ 304 305Display an RX descriptor for a port RX queue:: 306 307 testpmd> read rxd (port_id) (queue_id) (rxd_id) 308 309For example:: 310 311 testpmd> read rxd 0 0 4 312 0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180 313 314read txd 315~~~~~~~~ 316 317Display a TX descriptor for a port TX queue:: 318 319 testpmd> read txd (port_id) (queue_id) (txd_id) 320 321For example:: 322 323 testpmd> read txd 0 0 4 324 0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C 325 326 327Configuration Functions 328----------------------- 329 330The testpmd application can be configured from the runtime as well as from the command-line. 331 332This section details the available configuration functions that are available. 333 334.. note:: 335 336 Configuration changes only become active when forwarding is started/restarted. 337 338set default 339~~~~~~~~~~~ 340 341Reset forwarding to the default configuration:: 342 343 testpmd> set default 344 345set verbose 346~~~~~~~~~~~ 347 348Set the debug verbosity level:: 349 350 testpmd> set verbose (level) 351 352Currently the only available levels are 0 (silent except for error) and 1 (fully verbose). 353 354set nbport 355~~~~~~~~~~ 356 357Set the number of ports used by the application: 358 359set nbport (num) 360 361This is equivalent to the ``--nb-ports`` command-line option. 362 363set nbcore 364~~~~~~~~~~ 365 366Set the number of cores used by the application:: 367 368 testpmd> set nbcore (num) 369 370This is equivalent to the ``--nb-cores`` command-line option. 371 372.. note:: 373 374 The number of cores used must not be greater than number of ports used multiplied by the number of queues per port. 375 376set coremask 377~~~~~~~~~~~~ 378 379Set the forwarding cores hexadecimal mask:: 380 381 testpmd> set coremask (mask) 382 383This is equivalent to the ``--coremask`` command-line option. 384 385.. note:: 386 387 The master lcore is reserved for command line parsing only and cannot be masked on for packet forwarding. 388 389set portmask 390~~~~~~~~~~~~ 391 392Set the forwarding ports hexadecimal mask:: 393 394 testpmd> set portmask (mask) 395 396This is equivalent to the ``--portmask`` command-line option. 397 398set burst 399~~~~~~~~~ 400 401Set number of packets per burst:: 402 403 testpmd> set burst (num) 404 405This is equivalent to the ``--burst command-line`` option. 406 407When retry is enabled, the transmit delay time and number of retries can also be set:: 408 409 testpmd> set burst tx delay (microseconds) retry (num) 410 411set txpkts 412~~~~~~~~~~ 413 414Set the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode:: 415 416 testpmd> set txpkts (x[,y]*) 417 418Where x[,y]* represents a CSV list of values, without white space. 419 420set txsplit 421~~~~~~~~~~~ 422 423Set the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes:: 424 425 testpmd> set txsplit (off|on|rand) 426 427Where: 428 429* ``off`` disable packet copy & split for CSUM mode. 430 431* ``on`` split outgoing packet into multiple segments. Size of each segment 432 and number of segments per packet is determined by ``set txpkts`` command 433 (see above). 434 435* ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments. 436 437set corelist 438~~~~~~~~~~~~ 439 440Set the list of forwarding cores:: 441 442 testpmd> set corelist (x[,y]*) 443 444For example, to change the forwarding cores: 445 446.. code-block:: console 447 448 testpmd> set corelist 3,1 449 testpmd> show config fwd 450 451 io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled 452 Logical Core 3 (socket 0) forwards packets on 1 streams: 453 RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01 454 Logical Core 1 (socket 0) forwards packets on 1 streams: 455 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00 456 457.. note:: 458 459 The cores are used in the same order as specified on the command line. 460 461set portlist 462~~~~~~~~~~~~ 463 464Set the list of forwarding ports:: 465 466 testpmd> set portlist (x[,y]*) 467 468For example, to change the port forwarding: 469 470.. code-block:: console 471 472 testpmd> set portlist 0,2,1,3 473 testpmd> show config fwd 474 475 io packet forwarding - ports=4 - cores=1 - streams=4 476 Logical Core 3 (socket 0) forwards packets on 4 streams: 477 RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01 478 RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00 479 RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03 480 RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02 481 482vlan set strip 483~~~~~~~~~~~~~~ 484 485Set the VLAN strip on a port:: 486 487 testpmd> vlan set strip (on|off) (port_id) 488 489vlan set stripq 490~~~~~~~~~~~~~~~ 491 492Set the VLAN strip for a queue on a port:: 493 494 testpmd> vlan set stripq (on|off) (port_id,queue_id) 495 496vlan set filter 497~~~~~~~~~~~~~~~ 498 499Set the VLAN filter on a port:: 500 501 testpmd> vlan set filter (on|off) (port_id) 502 503vlan set qinq 504~~~~~~~~~~~~~ 505 506Set the VLAN QinQ (extended queue in queue) on for a port:: 507 508 testpmd> vlan set qinq (on|off) (port_id) 509 510vlan set tpid 511~~~~~~~~~~~~~ 512 513Set the inner or outer VLAN TPID for packet filtering on a port:: 514 515 testpmd> vlan set (inner|outer) tpid (value) (port_id) 516 517.. note:: 518 519 TPID value must be a 16-bit number (value <= 65536). 520 521rx_vlan add 522~~~~~~~~~~~ 523 524Add a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID:: 525 526 testpmd> rx_vlan add (vlan_id|all) (port_id) 527 528.. note:: 529 530 VLAN filter must be set on that port. VLAN ID < 4096. 531 Depending on the NIC used, number of vlan_ids may be limited to the maximum entries 532 in VFTA table. This is important if enabling all vlan_ids. 533 534rx_vlan rm 535~~~~~~~~~~ 536 537Remove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID:: 538 539 testpmd> rx_vlan rm (vlan_id|all) (port_id) 540 541rx_vlan add (for VF) 542~~~~~~~~~~~~~~~~~~~~ 543 544Add a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID:: 545 546 testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask) 547 548rx_vlan rm (for VF) 549~~~~~~~~~~~~~~~~~~~ 550 551Remove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID:: 552 553 testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask) 554 555tunnel_filter add 556~~~~~~~~~~~~~~~~~ 557 558Add a tunnel filter on a port:: 559 560 testpmd> tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) \ 561 (inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\ 562 imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id) 563 564The available information categories are: 565 566* ``vxlan``: Set tunnel type as VXLAN. 567 568* ``nvgre``: Set tunnel type as NVGRE. 569 570* ``ipingre``: Set tunnel type as IP-in-GRE. 571 572* ``imac-ivlan``: Set filter type as Inner MAC and VLAN. 573 574* ``imac-ivlan-tenid``: Set filter type as Inner MAC, VLAN and tenant ID. 575 576* ``imac-tenid``: Set filter type as Inner MAC and tenant ID. 577 578* ``imac``: Set filter type as Inner MAC. 579 580* ``omac-imac-tenid``: Set filter type as Outer MAC, Inner MAC and tenant ID. 581 582* ``oip``: Set filter type as Outer IP. 583 584* ``iip``: Set filter type as Inner IP. 585 586Example:: 587 588 testpmd> tunnel_filter add 0 68:05:CA:28:09:82 00:00:00:00:00:00 \ 589 192.168.2.2 0 ipingre oip 1 1 590 591 Set an IP-in-GRE tunnel on port 0, and the filter type is Outer IP. 592 593tunnel_filter remove 594~~~~~~~~~~~~~~~~~~~~ 595 596Remove a tunnel filter on a port:: 597 598 testpmd> tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) \ 599 (inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\ 600 imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id) 601 602rx_vxlan_port add 603~~~~~~~~~~~~~~~~~ 604 605Add an UDP port for VXLAN packet filter on a port:: 606 607 testpmd> rx_vxlan_port add (udp_port) (port_id) 608 609rx_vxlan_port remove 610~~~~~~~~~~~~~~~~~~~~ 611 612Remove an UDP port for VXLAN packet filter on a port:: 613 614 testpmd> rx_vxlan_port rm (udp_port) (port_id) 615 616tx_vlan set 617~~~~~~~~~~~ 618 619Set hardware insertion of VLAN IDs in packets sent on a port:: 620 621 testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer] 622 623For example, set a single VLAN ID (5) insertion on port 0:: 624 625 tx_vlan set 0 5 626 627Or, set double VLAN ID (inner: 2, outer: 3) insertion on port 1:: 628 629 tx_vlan set 1 2 3 630 631 632tx_vlan set pvid 633~~~~~~~~~~~~~~~~ 634 635Set port based hardware insertion of VLAN ID in packets sent on a port:: 636 637 testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off) 638 639tx_vlan reset 640~~~~~~~~~~~~~ 641 642Disable hardware insertion of a VLAN header in packets sent on a port:: 643 644 testpmd> tx_vlan reset (port_id) 645 646csum set 647~~~~~~~~ 648 649Select hardware or software calculation of the checksum when 650transmitting a packet using the ``csum`` forwarding engine:: 651 652 testpmd> csum set (ip|udp|tcp|sctp|outer-ip) (hw|sw) (port_id) 653 654Where: 655 656* ``ip|udp|tcp|sctp`` always relate to the inner layer. 657 658* ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized 659 as a tunnel packet by the forwarding engine (vxlan, gre and ipip are 660 supported). See also the ``csum parse-tunnel`` command. 661 662.. note:: 663 664 Check the NIC Datasheet for hardware limits. 665 666csum parse-tunnel 667~~~~~~~~~~~~~~~~~ 668 669Define how tunneled packets should be handled by the csum forward 670engine:: 671 672 testpmd> csum parse-tunnel (on|off) (tx_port_id) 673 674If enabled, the csum forward engine will try to recognize supported 675tunnel headers (vxlan, gre, ipip). 676 677If disabled, treat tunnel packets as non-tunneled packets (a inner 678header is handled as a packet payload). 679 680.. note:: 681 682 The port argument is the TX port like in the ``csum set`` command. 683 684Example: 685 686Consider a packet in packet like the following:: 687 688 eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in 689 690* If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set`` 691 command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the 692 ``outer-ip parameter`` relates to the outer headers (here ``ipv4_out``). 693 694* If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set`` 695 command relate to the outer headers, here ``ipv4_out`` and ``udp_out``. 696 697csum show 698~~~~~~~~~ 699 700Display tx checksum offload configuration:: 701 702 testpmd> csum show (port_id) 703 704tso set 705~~~~~~~ 706 707Enable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine:: 708 709 testpmd> tso set (segsize) (port_id) 710 711.. note:: 712 713 Check the NIC datasheet for hardware limits. 714 715tso show 716~~~~~~~~ 717 718Display the status of TCP Segmentation Offload:: 719 720 testpmd> tso show (port_id) 721 722mac_addr add 723~~~~~~~~~~~~ 724 725Add an alternative MAC address to a port:: 726 727 testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX) 728 729mac_addr remove 730~~~~~~~~~~~~~~~ 731 732Remove a MAC address from a port:: 733 734 testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX) 735 736mac_addr add(for VF) 737~~~~~~~~~~~~~~~~~~~~ 738 739Add an alternative MAC address for a VF to a port:: 740 741 testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX) 742 743set port-uta 744~~~~~~~~~~~~ 745 746Set the unicast hash filter(s) on/off for a port:: 747 748 testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off) 749 750set promisc 751~~~~~~~~~~~ 752 753Set the promiscuous mode on for a port or for all ports. 754In promiscuous mode packets are not dropped if they aren't for the specified MAC address:: 755 756 testpmd> set promisc (port_id|all) (on|off) 757 758set allmulti 759~~~~~~~~~~~~ 760 761Set the allmulti mode for a port or for all ports:: 762 763 testpmd> set allmulti (port_id|all) (on|off) 764 765Same as the ifconfig (8) option. Controls how multicast packets are handled. 766 767set flow_ctrl rx 768~~~~~~~~~~~~~~~~ 769 770Set the link flow control parameter on a port:: 771 772 testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \ 773 (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \ 774 autoneg (on|off) (port_id) 775 776Where: 777 778* ``high_water`` (integer): High threshold value to trigger XOFF. 779 780* ``low_water`` (integer): Low threshold value to trigger XON. 781 782* ``pause_time`` (integer): Pause quota in the Pause frame. 783 784* ``send_xon`` (0/1): Send XON frame. 785 786* ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames. 787 788* ``autoneg``: Change the auto-negotiation para mete. 789 790set pfc_ctrl rx 791~~~~~~~~~~~~~~~ 792 793Set the priority flow control parameter on a port:: 794 795 testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \ 796 (pause_time) (priority) (port_id) 797 798Where: 799 800* ``high_water`` (integer): High threshold value. 801 802* ``low_water`` (integer): Low threshold value. 803 804* ``pause_time`` (integer): Pause quota in the Pause frame. 805 806* ``priority`` (0-7): VLAN User Priority. 807 808set stat_qmap 809~~~~~~~~~~~~~ 810 811Set statistics mapping (qmapping 0..15) for RX/TX queue on port:: 812 813 testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping) 814 815For example, to set rx queue 2 on port 0 to mapping 5:: 816 817 testpmd>set stat_qmap rx 0 2 5 818 819set port - rx/tx (for VF) 820~~~~~~~~~~~~~~~~~~~~~~~~~ 821 822Set VF receive/transmit from a port:: 823 824 testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off) 825 826set port - mac address filter (for VF) 827~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 828 829Add/Remove unicast or multicast MAC addr filter for a VF:: 830 831 testpmd> set port (port_id) vf (vf_id) (mac_addr) \ 832 (exact-mac|exact-mac-vlan|hashmac|hashmac-vlan) (on|off) 833 834set port - rx mode(for VF) 835~~~~~~~~~~~~~~~~~~~~~~~~~~ 836 837Set the VF receive mode of a port:: 838 839 testpmd> set port (port_id) vf (vf_id) \ 840 rxmode (AUPE|ROPE|BAM|MPE) (on|off) 841 842The available receive modes are: 843 844* ``AUPE``: Accepts untagged VLAN. 845 846* ``ROPE``: Accepts unicast hash. 847 848* ``BAM``: Accepts broadcast packets. 849 850* ``MPE``: Accepts all multicast packets. 851 852set port - tx_rate (for Queue) 853~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 854 855Set TX rate limitation for a queue on a port:: 856 857 testpmd> set port (port_id) queue (queue_id) rate (rate_value) 858 859set port - tx_rate (for VF) 860~~~~~~~~~~~~~~~~~~~~~~~~~~~ 861 862Set TX rate limitation for queues in VF on a port:: 863 864 testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask) 865 866set port - mirror rule 867~~~~~~~~~~~~~~~~~~~~~~ 868 869Set pool or vlan type mirror rule for a port:: 870 871 testpmd> set port (port_id) mirror-rule (rule_id) \ 872 (pool-mirror-up|pool-mirror-down|vlan-mirror) \ 873 (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off) 874 875Set link mirror rule for a port:: 876 877 testpmd> set port (port_id) mirror-rule (rule_id) \ 878 (uplink-mirror|downlink-mirror) dst-pool (pool_id) (on|off) 879 880For example to enable mirror traffic with vlan 0,1 to pool 0:: 881 882 set port 0 mirror-rule 0 vlan-mirror 0,1 dst-pool 0 on 883 884reset port - mirror rule 885~~~~~~~~~~~~~~~~~~~~~~~~ 886 887Reset a mirror rule for a port:: 888 889 testpmd> reset port (port_id) mirror-rule (rule_id) 890 891set flush_rx 892~~~~~~~~~~~~ 893 894Set the flush on RX streams before forwarding. 895The default is flush ``on``. 896Mainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams:: 897 898 testpmd> set flush_rx off 899 900set bypass mode 901~~~~~~~~~~~~~~~ 902 903Set the bypass mode for the lowest port on bypass enabled NIC:: 904 905 testpmd> set bypass mode (normal|bypass|isolate) (port_id) 906 907set bypass event 908~~~~~~~~~~~~~~~~ 909 910Set the event required to initiate specified bypass mode for the lowest port on a bypass enabled:: 911 912 testpmd> set bypass event (timeout|os_on|os_off|power_on|power_off) \ 913 mode (normal|bypass|isolate) (port_id) 914 915Where: 916 917* ``timeout``: Enable bypass after watchdog timeout. 918 919* ``os_on``: Enable bypass when OS/board is powered on. 920 921* ``os_off``: Enable bypass when OS/board is powered off. 922 923* ``power_on``: Enable bypass when power supply is turned on. 924 925* ``power_off``: Enable bypass when power supply is turned off. 926 927 928set bypass timeout 929~~~~~~~~~~~~~~~~~~ 930 931Set the bypass watchdog timeout to ``n`` seconds where 0 = instant:: 932 933 testpmd> set bypass timeout (0|1.5|2|3|4|8|16|32) 934 935show bypass config 936~~~~~~~~~~~~~~~~~~ 937 938Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC:: 939 940 testpmd> show bypass config (port_id) 941 942set link up 943~~~~~~~~~~~ 944 945Set link up for a port:: 946 947 testpmd> set link-up port (port id) 948 949set link down 950~~~~~~~~~~~~~ 951 952Set link down for a port:: 953 954 testpmd> set link-down port (port id) 955 956E-tag set 957~~~~~~~~~ 958 959Enable E-tag insertion for a VF on a port:: 960 961 testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id) 962 963Disable E-tag insertion for a VF on a port:: 964 965 testpmd> E-tag set insertion off port (port_id) vf (vf_id) 966 967Enable/disable E-tag stripping on a port:: 968 969 testpmd> E-tag set stripping (on|off) port (port_id) 970 971Enable/disable E-tag based forwarding on a port:: 972 973 testpmd> E-tag set forwarding (on|off) port (port_id) 974 975Add an E-tag forwarding filter on a port:: 976 977 testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id) port (port_id) 978 979Delete an E-tag forwarding filter on a port:: 980 testpmd> E-tag set filter del e-tag-id (value) port (port_id) 981 982 983Port Functions 984-------------- 985 986The following sections show functions for configuring ports. 987 988.. note:: 989 990 Port configuration changes only become active when forwarding is started/restarted. 991 992port attach 993~~~~~~~~~~~ 994 995Attach a port specified by pci address or virtual device args:: 996 997 testpmd> port attach (identifier) 998 999To attach a new pci device, the device should be recognized by kernel first. 1000Then it should be moved under DPDK management. 1001Finally the port can be attached to testpmd. 1002 1003For example, to move a pci device using ixgbe under DPDK management: 1004 1005.. code-block:: console 1006 1007 # Check the status of the available devices. 1008 ./tools/dpdk-devbind.py --status 1009 1010 Network devices using DPDK-compatible driver 1011 ============================================ 1012 <none> 1013 1014 Network devices using kernel driver 1015 =================================== 1016 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused= 1017 1018 1019 # Bind the device to igb_uio. 1020 sudo ./tools/dpdk-devbind.py -b igb_uio 0000:0a:00.0 1021 1022 1023 # Recheck the status of the devices. 1024 ./tools/dpdk-devbind.py --status 1025 Network devices using DPDK-compatible driver 1026 ============================================ 1027 0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused= 1028 1029To attach a port created by virtual device, above steps are not needed. 1030 1031For example, to attach a port whose pci address is 0000:0a:00.0. 1032 1033.. code-block:: console 1034 1035 testpmd> port attach 0000:0a:00.0 1036 Attaching a new port... 1037 EAL: PCI device 0000:0a:00.0 on NUMA socket -1 1038 EAL: probe driver: 8086:10fb rte_ixgbe_pmd 1039 EAL: PCI memory mapped at 0x7f83bfa00000 1040 EAL: PCI memory mapped at 0x7f83bfa80000 1041 PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5 1042 PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb 1043 Port 0 is attached. Now total ports is 1 1044 Done 1045 1046For example, to attach a port created by pcap PMD. 1047 1048.. code-block:: console 1049 1050 testpmd> port attach net_pcap0 1051 Attaching a new port... 1052 PMD: Initializing pmd_pcap for net_pcap0 1053 PMD: Creating pcap-backed ethdev on numa socket 0 1054 Port 0 is attached. Now total ports is 1 1055 Done 1056 1057In this case, identifier is ``net_pcap0``. 1058This identifier format is the same as ``--vdev`` format of DPDK applications. 1059 1060For example, to re-attach a bonded port which has been previously detached, 1061the mode and slave parameters must be given. 1062 1063.. code-block:: console 1064 1065 testpmd> port attach net_bond_0,mode=0,slave=1 1066 Attaching a new port... 1067 EAL: Initializing pmd_bond for net_bond_0 1068 EAL: Create bonded device net_bond_0 on port 0 in mode 0 on socket 0. 1069 Port 0 is attached. Now total ports is 1 1070 Done 1071 1072 1073port detach 1074~~~~~~~~~~~ 1075 1076Detach a specific port:: 1077 1078 testpmd> port detach (port_id) 1079 1080Before detaching a port, the port should be stopped and closed. 1081 1082For example, to detach a pci device port 0. 1083 1084.. code-block:: console 1085 1086 testpmd> port stop 0 1087 Stopping ports... 1088 Done 1089 testpmd> port close 0 1090 Closing ports... 1091 Done 1092 1093 testpmd> port detach 0 1094 Detaching a port... 1095 EAL: PCI device 0000:0a:00.0 on NUMA socket -1 1096 EAL: remove driver: 8086:10fb rte_ixgbe_pmd 1097 EAL: PCI memory unmapped at 0x7f83bfa00000 1098 EAL: PCI memory unmapped at 0x7f83bfa80000 1099 Done 1100 1101 1102For example, to detach a virtual device port 0. 1103 1104.. code-block:: console 1105 1106 testpmd> port stop 0 1107 Stopping ports... 1108 Done 1109 testpmd> port close 0 1110 Closing ports... 1111 Done 1112 1113 testpmd> port detach 0 1114 Detaching a port... 1115 PMD: Closing pcap ethdev on numa socket 0 1116 Port 'net_pcap0' is detached. Now total ports is 0 1117 Done 1118 1119To remove a pci device completely from the system, first detach the port from testpmd. 1120Then the device should be moved under kernel management. 1121Finally the device can be removed using kernel pci hotplug functionality. 1122 1123For example, to move a pci device under kernel management: 1124 1125.. code-block:: console 1126 1127 sudo ./tools/dpdk-devbind.py -b ixgbe 0000:0a:00.0 1128 1129 ./tools/dpdk-devbind.py --status 1130 1131 Network devices using DPDK-compatible driver 1132 ============================================ 1133 <none> 1134 1135 Network devices using kernel driver 1136 =================================== 1137 0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio 1138 1139To remove a port created by a virtual device, above steps are not needed. 1140 1141port start 1142~~~~~~~~~~ 1143 1144Start all ports or a specific port:: 1145 1146 testpmd> port start (port_id|all) 1147 1148port stop 1149~~~~~~~~~ 1150 1151Stop all ports or a specific port:: 1152 1153 testpmd> port stop (port_id|all) 1154 1155port close 1156~~~~~~~~~~ 1157 1158Close all ports or a specific port:: 1159 1160 testpmd> port close (port_id|all) 1161 1162port start/stop queue 1163~~~~~~~~~~~~~~~~~~~~~ 1164 1165Start/stop a rx/tx queue on a specific port:: 1166 1167 testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop) 1168 1169Only take effect when port is started. 1170 1171port config - speed 1172~~~~~~~~~~~~~~~~~~~ 1173 1174Set the speed and duplex mode for all ports or a specific port:: 1175 1176 testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|auto) \ 1177 duplex (half|full|auto) 1178 1179port config - queues/descriptors 1180~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1181 1182Set number of queues/descriptors for rxq, txq, rxd and txd:: 1183 1184 testpmd> port config all (rxq|txq|rxd|txd) (value) 1185 1186This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options. 1187 1188port config - max-pkt-len 1189~~~~~~~~~~~~~~~~~~~~~~~~~ 1190 1191Set the maximum packet length:: 1192 1193 testpmd> port config all max-pkt-len (value) 1194 1195This is equivalent to the ``--max-pkt-len`` command-line option. 1196 1197port config - CRC Strip 1198~~~~~~~~~~~~~~~~~~~~~~~ 1199 1200Set hardware CRC stripping on or off for all ports:: 1201 1202 testpmd> port config all crc-strip (on|off) 1203 1204CRC stripping is off by default. 1205 1206The ``on`` option is equivalent to the ``--crc-strip`` command-line option. 1207 1208port config - scatter 1209~~~~~~~~~~~~~~~~~~~~~~~ 1210 1211Set RX scatter mode on or off for all ports:: 1212 1213 testpmd> port config all scatter (on|off) 1214 1215RX scatter mode is off by default. 1216 1217The ``on`` option is equivalent to the ``--enable-scatter`` command-line option. 1218 1219port config - TX queue flags 1220~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1221 1222Set a hexadecimal bitmap of TX queue flags for all ports:: 1223 1224 testpmd> port config all txqflags value 1225 1226This command is equivalent to the ``--txqflags`` command-line option. 1227 1228port config - RX Checksum 1229~~~~~~~~~~~~~~~~~~~~~~~~~ 1230 1231Set hardware RX checksum offload to on or off for all ports:: 1232 1233 testpmd> port config all rx-cksum (on|off) 1234 1235Checksum offload is off by default. 1236 1237The ``on`` option is equivalent to the ``--enable-rx-cksum`` command-line option. 1238 1239port config - VLAN 1240~~~~~~~~~~~~~~~~~~ 1241 1242Set hardware VLAN on or off for all ports:: 1243 1244 testpmd> port config all hw-vlan (on|off) 1245 1246Hardware VLAN is on by default. 1247 1248The ``off`` option is equivalent to the ``--disable-hw-vlan`` command-line option. 1249 1250port config - VLAN filter 1251~~~~~~~~~~~~~~~~~~~~~~~~~ 1252 1253Set hardware VLAN filter on or off for all ports:: 1254 1255 testpmd> port config all hw-vlan-filter (on|off) 1256 1257Hardware VLAN filter is on by default. 1258 1259The ``off`` option is equivalent to the ``--disable-hw-vlan-filter`` command-line option. 1260 1261port config - VLAN strip 1262~~~~~~~~~~~~~~~~~~~~~~~~ 1263 1264Set hardware VLAN strip on or off for all ports:: 1265 1266 testpmd> port config all hw-vlan-strip (on|off) 1267 1268Hardware VLAN strip is on by default. 1269 1270The ``off`` option is equivalent to the ``--disable-hw-vlan-strip`` command-line option. 1271 1272port config - VLAN extend 1273~~~~~~~~~~~~~~~~~~~~~~~~~ 1274 1275Set hardware VLAN extend on or off for all ports:: 1276 1277 testpmd> port config all hw-vlan-extend (on|off) 1278 1279Hardware VLAN extend is off by default. 1280 1281The ``off`` option is equivalent to the ``--disable-hw-vlan-extend`` command-line option. 1282 1283port config - Drop Packets 1284~~~~~~~~~~~~~~~~~~~~~~~~~~ 1285 1286Set packet drop for packets with no descriptors on or off for all ports:: 1287 1288 testpmd> port config all drop-en (on|off) 1289 1290Packet dropping for packets with no descriptors is off by default. 1291 1292The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option. 1293 1294port config - RSS 1295~~~~~~~~~~~~~~~~~ 1296 1297Set the RSS (Receive Side Scaling) mode on or off:: 1298 1299 testpmd> port config all rss (all|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none) 1300 1301RSS is on by default. 1302 1303The ``none`` option is equivalent to the ``--disable-rss`` command-line option. 1304 1305port config - RSS Reta 1306~~~~~~~~~~~~~~~~~~~~~~ 1307 1308Set the RSS (Receive Side Scaling) redirection table:: 1309 1310 testpmd> port config all rss reta (hash,queue)[,(hash,queue)] 1311 1312port config - DCB 1313~~~~~~~~~~~~~~~~~ 1314 1315Set the DCB mode for an individual port:: 1316 1317 testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off) 1318 1319The traffic class should be 4 or 8. 1320 1321port config - Burst 1322~~~~~~~~~~~~~~~~~~~ 1323 1324Set the number of packets per burst:: 1325 1326 testpmd> port config all burst (value) 1327 1328This is equivalent to the ``--burst`` command-line option. 1329 1330port config - Threshold 1331~~~~~~~~~~~~~~~~~~~~~~~ 1332 1333Set thresholds for TX/RX queues:: 1334 1335 testpmd> port config all (threshold) (value) 1336 1337Where the threshold type can be: 1338 1339* ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255. 1340 1341* ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255. 1342 1343* ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255. 1344 1345* ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255. 1346 1347* ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255. 1348 1349* ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255. 1350 1351* ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd. 1352 1353* ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd. 1354 1355* ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd. 1356 1357These threshold options are also available from the command-line. 1358 1359port config - E-tag 1360~~~~~~~~~~~~~~~~~~~ 1361 1362Set the value of ether-type for E-tag:: 1363 1364 testpmd> port config (port_id|all) l2-tunnel E-tag ether-type (value) 1365 1366Enable/disable the E-tag support:: 1367 1368 testpmd> port config (port_id|all) l2-tunnel E-tag (enable|disable) 1369 1370 1371Link Bonding Functions 1372---------------------- 1373 1374The Link Bonding functions make it possible to dynamically create and 1375manage link bonding devices from within testpmd interactive prompt. 1376 1377create bonded device 1378~~~~~~~~~~~~~~~~~~~~ 1379 1380Create a new bonding device:: 1381 1382 testpmd> create bonded device (mode) (socket) 1383 1384For example, to create a bonded device in mode 1 on socket 0:: 1385 1386 testpmd> create bonded 1 0 1387 created new bonded device (port X) 1388 1389add bonding slave 1390~~~~~~~~~~~~~~~~~ 1391 1392Adds Ethernet device to a Link Bonding device:: 1393 1394 testpmd> add bonding slave (slave id) (port id) 1395 1396For example, to add Ethernet device (port 6) to a Link Bonding device (port 10):: 1397 1398 testpmd> add bonding slave 6 10 1399 1400 1401remove bonding slave 1402~~~~~~~~~~~~~~~~~~~~ 1403 1404Removes an Ethernet slave device from a Link Bonding device:: 1405 1406 testpmd> remove bonding slave (slave id) (port id) 1407 1408For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10):: 1409 1410 testpmd> remove bonding slave 6 10 1411 1412set bonding mode 1413~~~~~~~~~~~~~~~~ 1414 1415Set the Link Bonding mode of a Link Bonding device:: 1416 1417 testpmd> set bonding mode (value) (port id) 1418 1419For example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3):: 1420 1421 testpmd> set bonding mode 3 10 1422 1423set bonding primary 1424~~~~~~~~~~~~~~~~~~~ 1425 1426Set an Ethernet slave device as the primary device on a Link Bonding device:: 1427 1428 testpmd> set bonding primary (slave id) (port id) 1429 1430For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10):: 1431 1432 testpmd> set bonding primary 6 10 1433 1434set bonding mac 1435~~~~~~~~~~~~~~~ 1436 1437Set the MAC address of a Link Bonding device:: 1438 1439 testpmd> set bonding mac (port id) (mac) 1440 1441For example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01:: 1442 1443 testpmd> set bonding mac 10 00:00:00:00:00:01 1444 1445set bonding xmit_balance_policy 1446~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1447 1448Set the transmission policy for a Link Bonding device when it is in Balance XOR mode:: 1449 1450 testpmd> set bonding xmit_balance_policy (port_id) (l2|l23|l34) 1451 1452For example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports):: 1453 1454 testpmd> set bonding xmit_balance_policy 10 l34 1455 1456 1457set bonding mon_period 1458~~~~~~~~~~~~~~~~~~~~~~ 1459 1460Set the link status monitoring polling period in milliseconds for a bonding device. 1461 1462This adds support for PMD slave devices which do not support link status interrupts. 1463When the mon_period is set to a value greater than 0 then all PMD's which do not support 1464link status ISR will be queried every polling interval to check if their link status has changed:: 1465 1466 testpmd> set bonding mon_period (port_id) (value) 1467 1468For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms:: 1469 1470 testpmd> set bonding mon_period 5 150 1471 1472 1473show bonding config 1474~~~~~~~~~~~~~~~~~~~ 1475 1476Show the current configuration of a Link Bonding device:: 1477 1478 testpmd> show bonding config (port id) 1479 1480For example, 1481to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4) 1482in balance mode with a transmission policy of layer 2+3:: 1483 1484 testpmd> show bonding config 9 1485 Bonding mode: 2 1486 Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23 1487 Slaves (3): [1 3 4] 1488 Active Slaves (3): [1 3 4] 1489 Primary: [3] 1490 1491 1492Register Functions 1493------------------ 1494 1495The Register Functions can be used to read from and write to registers on the network card referenced by a port number. 1496This is mainly useful for debugging purposes. 1497Reference should be made to the appropriate datasheet for the network card for details on the register addresses 1498and fields that can be accessed. 1499 1500read reg 1501~~~~~~~~ 1502 1503Display the value of a port register:: 1504 1505 testpmd> read reg (port_id) (address) 1506 1507For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller:: 1508 1509 testpmd> read reg 0 0xEE00 1510 port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241) 1511 1512read regfield 1513~~~~~~~~~~~~~ 1514 1515Display a port register bit field:: 1516 1517 testpmd> read regfield (port_id) (address) (bit_x) (bit_y) 1518 1519For example, reading the lowest two bits from the register in the example above:: 1520 1521 testpmd> read regfield 0 0xEE00 0 1 1522 port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1) 1523 1524read regbit 1525~~~~~~~~~~~ 1526 1527Display a single port register bit:: 1528 1529 testpmd> read regbit (port_id) (address) (bit_x) 1530 1531For example, reading the lowest bit from the register in the example above:: 1532 1533 testpmd> read regbit 0 0xEE00 0 1534 port 0 PCI register at offset 0xEE00: bit 0=1 1535 1536write reg 1537~~~~~~~~~ 1538 1539Set the value of a port register:: 1540 1541 testpmd> write reg (port_id) (address) (value) 1542 1543For example, to clear a register:: 1544 1545 testpmd> write reg 0 0xEE00 0x0 1546 port 0 PCI register at offset 0xEE00: 0x00000000 (0) 1547 1548write regfield 1549~~~~~~~~~~~~~~ 1550 1551Set bit field of a port register:: 1552 1553 testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value) 1554 1555For example, writing to the register cleared in the example above:: 1556 1557 testpmd> write regfield 0 0xEE00 0 1 2 1558 port 0 PCI register at offset 0xEE00: 0x00000002 (2) 1559 1560write regbit 1561~~~~~~~~~~~~ 1562 1563Set single bit value of a port register:: 1564 1565 testpmd> write regbit (port_id) (address) (bit_x) (value) 1566 1567For example, to set the high bit in the register from the example above:: 1568 1569 testpmd> write regbit 0 0xEE00 31 1 1570 port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658) 1571 1572 1573Filter Functions 1574---------------- 1575 1576This section details the available filter functions that are available. 1577 1578ethertype_filter 1579~~~~~~~~~~~~~~~~~~~~ 1580 1581Add or delete a L2 Ethertype filter, which identify packets by their L2 Ethertype mainly assign them to a receive queue:: 1582 1583 ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr) (mac_address) \ 1584 ethertype (ether_type) (drop|fwd) queue (queue_id) 1585 1586The available information parameters are: 1587 1588* ``port_id``: The port which the Ethertype filter assigned on. 1589 1590* ``mac_addr``: Compare destination mac address. 1591 1592* ``mac_ignr``: Ignore destination mac address match. 1593 1594* ``mac_address``: Destination mac address to match. 1595 1596* ``ether_type``: The EtherType value want to match, 1597 for example 0x0806 for ARP packet. 0x0800 (IPv4) and 0x86DD (IPv6) are invalid. 1598 1599* ``queue_id``: The receive queue associated with this EtherType filter. 1600 It is meaningless when deleting or dropping. 1601 1602Example, to add/remove an ethertype filter rule:: 1603 1604 testpmd> ethertype_filter 0 add mac_ignr 00:11:22:33:44:55 \ 1605 ethertype 0x0806 fwd queue 3 1606 1607 testpmd> ethertype_filter 0 del mac_ignr 00:11:22:33:44:55 \ 1608 ethertype 0x0806 fwd queue 3 1609 16102tuple_filter 1611~~~~~~~~~~~~~~~~~ 1612 1613Add or delete a 2-tuple filter, 1614which identifies packets by specific protocol and destination TCP/UDP port 1615and forwards packets into one of the receive queues:: 1616 1617 2tuple_filter (port_id) (add|del) dst_port (dst_port_value) \ 1618 protocol (protocol_value) mask (mask_value) \ 1619 tcp_flags (tcp_flags_value) priority (prio_value) \ 1620 queue (queue_id) 1621 1622The available information parameters are: 1623 1624* ``port_id``: The port which the 2-tuple filter assigned on. 1625 1626* ``dst_port_value``: Destination port in L4. 1627 1628* ``protocol_value``: IP L4 protocol. 1629 1630* ``mask_value``: Participates in the match or not by bit for field above, 1b means participate. 1631 1632* ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the pro_value is not set to 0x06 (TCP). 1633 1634* ``prio_value``: Priority of this filter. 1635 1636* ``queue_id``: The receive queue associated with this 2-tuple filter. 1637 1638Example, to add/remove an 2tuple filter rule:: 1639 1640 testpmd> 2tuple_filter 0 add dst_port 32 protocol 0x06 mask 0x03 \ 1641 tcp_flags 0x02 priority 3 queue 3 1642 1643 testpmd> 2tuple_filter 0 del dst_port 32 protocol 0x06 mask 0x03 \ 1644 tcp_flags 0x02 priority 3 queue 3 1645 16465tuple_filter 1647~~~~~~~~~~~~~~~~~ 1648 1649Add or delete a 5-tuple filter, 1650which consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port) 1651and routes packets into one of the receive queues:: 1652 1653 5tuple_filter (port_id) (add|del) dst_ip (dst_address) src_ip \ 1654 (src_address) dst_port (dst_port_value) \ 1655 src_port (src_port_value) protocol (protocol_value) \ 1656 mask (mask_value) tcp_flags (tcp_flags_value) \ 1657 priority (prio_value) queue (queue_id) 1658 1659The available information parameters are: 1660 1661* ``port_id``: The port which the 5-tuple filter assigned on. 1662 1663* ``dst_address``: Destination IP address. 1664 1665* ``src_address``: Source IP address. 1666 1667* ``dst_port_value``: TCP/UDP destination port. 1668 1669* ``src_port_value``: TCP/UDP source port. 1670 1671* ``protocol_value``: L4 protocol. 1672 1673* ``mask_value``: Participates in the match or not by bit for field above, 1b means participate 1674 1675* ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the protocol_value is not set to 0x06 (TCP). 1676 1677* ``prio_value``: The priority of this filter. 1678 1679* ``queue_id``: The receive queue associated with this 5-tuple filter. 1680 1681Example, to add/remove an 5tuple filter rule:: 1682 1683 testpmd> 5tuple_filter 0 add dst_ip 2.2.2.5 src_ip 2.2.2.4 \ 1684 dst_port 64 src_port 32 protocol 0x06 mask 0x1F \ 1685 flags 0x0 priority 3 queue 3 1686 1687 testpmd> 5tuple_filter 0 del dst_ip 2.2.2.5 src_ip 2.2.2.4 \ 1688 dst_port 64 src_port 32 protocol 0x06 mask 0x1F \ 1689 flags 0x0 priority 3 queue 3 1690 1691syn_filter 1692~~~~~~~~~~ 1693 1694Using the SYN filter, TCP packets whose *SYN* flag is set can be forwarded to a separate queue:: 1695 1696 syn_filter (port_id) (add|del) priority (high|low) queue (queue_id) 1697 1698The available information parameters are: 1699 1700* ``port_id``: The port which the SYN filter assigned on. 1701 1702* ``high``: This SYN filter has higher priority than other filters. 1703 1704* ``low``: This SYN filter has lower priority than other filters. 1705 1706* ``queue_id``: The receive queue associated with this SYN filter 1707 1708Example:: 1709 1710 testpmd> syn_filter 0 add priority high queue 3 1711 1712flex_filter 1713~~~~~~~~~~~ 1714 1715With flex filter, packets can be recognized by any arbitrary pattern within the first 128 bytes of the packet 1716and routed into one of the receive queues:: 1717 1718 flex_filter (port_id) (add|del) len (len_value) bytes (bytes_value) \ 1719 mask (mask_value) priority (prio_value) queue (queue_id) 1720 1721The available information parameters are: 1722 1723* ``port_id``: The port which the Flex filter is assigned on. 1724 1725* ``len_value``: Filter length in bytes, no greater than 128. 1726 1727* ``bytes_value``: A string in hexadecimal, means the value the flex filter needs to match. 1728 1729* ``mask_value``: A string in hexadecimal, bit 1 means corresponding byte participates in the match. 1730 1731* ``prio_value``: The priority of this filter. 1732 1733* ``queue_id``: The receive queue associated with this Flex filter. 1734 1735Example:: 1736 1737 testpmd> flex_filter 0 add len 16 bytes 0x00000000000000000000000008060000 \ 1738 mask 000C priority 3 queue 3 1739 1740 testpmd> flex_filter 0 del len 16 bytes 0x00000000000000000000000008060000 \ 1741 mask 000C priority 3 queue 3 1742 1743 1744.. _testpmd_flow_director: 1745 1746flow_director_filter 1747~~~~~~~~~~~~~~~~~~~~ 1748 1749The Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues. 1750 1751Four types of filtering are supported which are referred to as Perfect Match, Signature, Perfect-mac-vlan and 1752Perfect-tunnel filters, the match mode is set by the ``--pkt-filter-mode`` command-line parameter: 1753 1754* Perfect match filters. 1755 The hardware checks a match between the masked fields of the received packets and the programmed filters. 1756 The masked fields are for IP flow. 1757 1758* Signature filters. 1759 The hardware checks a match between a hash-based signature of the masked fields of the received packet. 1760 1761* Perfect-mac-vlan match filters. 1762 The hardware checks a match between the masked fields of the received packets and the programmed filters. 1763 The masked fields are for MAC VLAN flow. 1764 1765* Perfect-tunnel match filters. 1766 The hardware checks a match between the masked fields of the received packets and the programmed filters. 1767 The masked fields are for tunnel flow. 1768 1769The Flow Director filters can match the different fields for different type of packet: flow type, specific input set 1770per flow type and the flexible payload. 1771 1772The Flow Director can also mask out parts of all of these fields so that filters 1773are only applied to certain fields or parts of the fields. 1774 1775Different NICs may have different capabilities, command show port fdir (port_id) can be used to acquire the information. 1776 1777# Commands to add flow director filters of different flow types:: 1778 1779 flow_director_filter (port_id) mode IP (add|del|update) \ 1780 flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag) \ 1781 src (src_ip_address) dst (dst_ip_address) \ 1782 tos (tos_value) proto (proto_value) ttl (ttl_value) \ 1783 vlan (vlan_value) flexbytes (flexbytes_value) \ 1784 (drop|fwd) pf|vf(vf_id) queue (queue_id) \ 1785 fd_id (fd_id_value) 1786 1787 flow_director_filter (port_id) mode IP (add|del|update) \ 1788 flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp) \ 1789 src (src_ip_address) (src_port) \ 1790 dst (dst_ip_address) (dst_port) \ 1791 tos (tos_value) ttl (ttl_value) \ 1792 vlan (vlan_value) flexbytes (flexbytes_value) \ 1793 (drop|fwd) queue pf|vf(vf_id) (queue_id) \ 1794 fd_id (fd_id_value) 1795 1796 flow_director_filter (port_id) mode IP (add|del|update) \ 1797 flow (ipv4-sctp|ipv6-sctp) \ 1798 src (src_ip_address) (src_port) \ 1799 dst (dst_ip_address) (dst_port) \ 1800 tos (tos_value) ttl (ttl_value) \ 1801 tag (verification_tag) vlan (vlan_value) \ 1802 flexbytes (flexbytes_value) (drop|fwd) \ 1803 pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value) 1804 1805 flow_director_filter (port_id) mode IP (add|del|update) flow l2_payload \ 1806 ether (ethertype) flexbytes (flexbytes_value) \ 1807 (drop|fwd) pf|vf(vf_id) queue (queue_id) 1808 fd_id (fd_id_value) 1809 1810 flow_director_filter (port_id) mode MAC-VLAN (add|del|update) \ 1811 mac (mac_address) vlan (vlan_value) \ 1812 flexbytes (flexbytes_value) (drop|fwd) \ 1813 queue (queue_id) fd_id (fd_id_value) 1814 1815 flow_director_filter (port_id) mode Tunnel (add|del|update) \ 1816 mac (mac_address) vlan (vlan_value) \ 1817 tunnel (NVGRE|VxLAN) tunnel-id (tunnel_id_value) \ 1818 flexbytes (flexbytes_value) (drop|fwd) \ 1819 queue (queue_id) fd_id (fd_id_value) 1820 1821For example, to add an ipv4-udp flow type filter:: 1822 1823 testpmd> flow_director_filter 0 mode IP add flow ipv4-udp src 2.2.2.3 32 \ 1824 dst 2.2.2.5 33 tos 2 ttl 40 vlan 0x1 flexbytes (0x88,0x48) \ 1825 fwd pf queue 1 fd_id 1 1826 1827For example, add an ipv4-other flow type filter:: 1828 1829 testpmd> flow_director_filter 0 mode IP add flow ipv4-other src 2.2.2.3 \ 1830 dst 2.2.2.5 tos 2 proto 20 ttl 40 vlan 0x1 \ 1831 flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1 1832 1833flush_flow_director 1834~~~~~~~~~~~~~~~~~~~ 1835 1836Flush all flow director filters on a device:: 1837 1838 testpmd> flush_flow_director (port_id) 1839 1840Example, to flush all flow director filter on port 0:: 1841 1842 testpmd> flush_flow_director 0 1843 1844flow_director_mask 1845~~~~~~~~~~~~~~~~~~ 1846 1847Set flow director's input masks:: 1848 1849 flow_director_mask (port_id) mode IP vlan (vlan_value) \ 1850 src_mask (ipv4_src) (ipv6_src) (src_port) \ 1851 dst_mask (ipv4_dst) (ipv6_dst) (dst_port) 1852 1853 flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value) \ 1854 mac (mac_value) 1855 1856 flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \ 1857 mac (mac_value) tunnel-type (tunnel_type_value) \ 1858 tunnel-id (tunnel_id_value) 1859 1860Example, to set flow director mask on port 0:: 1861 1862 testpmd> flow_director_mask 0 mode IP vlan 0xefff \ 1863 src_mask 255.255.255.255 \ 1864 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF \ 1865 dst_mask 255.255.255.255 \ 1866 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF 1867 1868flow_director_flex_mask 1869~~~~~~~~~~~~~~~~~~~~~~~ 1870 1871set masks of flow director's flexible payload based on certain flow type:: 1872 1873 testpmd> flow_director_flex_mask (port_id) \ 1874 flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \ 1875 ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \ 1876 l2_payload|all) (mask) 1877 1878Example, to set flow director's flex mask for all flow type on port 0:: 1879 1880 testpmd> flow_director_flex_mask 0 flow all \ 1881 (0xff,0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0) 1882 1883 1884flow_director_flex_payload 1885~~~~~~~~~~~~~~~~~~~~~~~~~~ 1886 1887Configure flexible payload selection:: 1888 1889 flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config) 1890 1891For example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload:: 1892 1893 testpmd> flow_director_flex_payload 0 l4 \ 1894 (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19) 1895 1896get_sym_hash_ena_per_port 1897~~~~~~~~~~~~~~~~~~~~~~~~~ 1898 1899Get symmetric hash enable configuration per port:: 1900 1901 get_sym_hash_ena_per_port (port_id) 1902 1903For example, to get symmetric hash enable configuration of port 1:: 1904 1905 testpmd> get_sym_hash_ena_per_port 1 1906 1907set_sym_hash_ena_per_port 1908~~~~~~~~~~~~~~~~~~~~~~~~~ 1909 1910Set symmetric hash enable configuration per port to enable or disable:: 1911 1912 set_sym_hash_ena_per_port (port_id) (enable|disable) 1913 1914For example, to set symmetric hash enable configuration of port 1 to enable:: 1915 1916 testpmd> set_sym_hash_ena_per_port 1 enable 1917 1918get_hash_global_config 1919~~~~~~~~~~~~~~~~~~~~~~ 1920 1921Get the global configurations of hash filters:: 1922 1923 get_hash_global_config (port_id) 1924 1925For example, to get the global configurations of hash filters of port 1:: 1926 1927 testpmd> get_hash_global_config 1 1928 1929set_hash_global_config 1930~~~~~~~~~~~~~~~~~~~~~~ 1931 1932Set the global configurations of hash filters:: 1933 1934 set_hash_global_config (port_id) (toeplitz|simple_xor|default) \ 1935 (ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|ipv6-frag| \ 1936 ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload) \ 1937 (enable|disable) 1938 1939For example, to enable simple_xor for flow type of ipv6 on port 2:: 1940 1941 testpmd> set_hash_global_config 2 simple_xor ipv6 enable 1942 1943set_hash_input_set 1944~~~~~~~~~~~~~~~~~~ 1945 1946Set the input set for hash:: 1947 1948 set_hash_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \ 1949 ipv4-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \ 1950 l2_payload) (ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6|ipv4-tos| \ 1951 ipv4-proto|ipv6-tc|ipv6-next-header|udp-src-port|udp-dst-port| \ 1952 tcp-src-port|tcp-dst-port|sctp-src-port|sctp-dst-port|sctp-veri-tag| \ 1953 udp-key|gre-key|fld-1st|fld-2nd|fld-3rd|fld-4th|fld-5th|fld-6th|fld-7th| \ 1954 fld-8th|none) (select|add) 1955 1956For example, to add source IP to hash input set for flow type of ipv4-udp on port 0:: 1957 1958 testpmd> set_hash_input_set 0 ipv4-udp src-ipv4 add 1959 1960set_fdir_input_set 1961~~~~~~~~~~~~~~~~~~ 1962 1963The Flow Director filters can match the different fields for different type of packet, i.e. specific input set 1964on per flow type and the flexible payload. This command can be used to change input set for each flow type. 1965 1966Set the input set for flow director:: 1967 1968 set_fdir_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \ 1969 ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \ 1970 l2_payload) (ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6|ipv4-tos| \ 1971 ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|ipv6-hop-limits| \ 1972 tudp-src-port|udp-dst-port|cp-src-port|tcp-dst-port|sctp-src-port| \ 1973 sctp-dst-port|sctp-veri-tag|none) (select|add) 1974 1975For example to add source IP to FD input set for flow type of ipv4-udp on port 0:: 1976 1977 testpmd> set_fdir_input_set 0 ipv4-udp src-ipv4 add 1978 1979global_config 1980~~~~~~~~~~~~~ 1981 1982Set different GRE key length for input set:: 1983 1984 global_config (port_id) gre-key-len (number in bytes) 1985 1986For example to set GRE key length for input set to 4 bytes on port 0:: 1987 1988 testpmd> global_config 0 gre-key-len 4 1989