1.. BSD LICENSE 2 Copyright(c) 2010-2014 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 31Testpmd Runtime Functions 32========================= 33 34Where the testpmd application is started in interactive mode, (-i|--interactive), 35it displays a prompt that can be used to start and stop forwarding, 36configure the application, display statistics, set the Flow Director and other tasks. 37 38.. code-block:: console 39 40 testpmd> 41 42The testpmd prompt has some, limited, readline support. 43Common bash command- line functions such as Ctrl+a and Ctrl+e to go to the start and end of the prompt line are supported 44as well as access to the command history via the up-arrow. 45 46There is also support for tab completion. 47If you type a partial command and hit <TAB> you get a list of the available completions: 48 49.. code-block:: console 50 51 testpmd> show port <TAB> 52 53 info [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap X 54 info [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap all 55 stats [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap X 56 stats [Mul-choice STRING]: show|clear port info|stats|fdir|stat_qmap all 57 ... 58 59Help Functions 60-------------- 61 62The testpmd has on-line help for the functions that are available at runtime. 63These are divided into sections and can be accessed using help, help section or help all: 64 65.. code-block:: console 66 67 testpmd> help 68 69 Help is available for the following sections: 70 help control : Start and stop forwarding. 71 help display : Displaying port, stats and config information. 72 help config : Configuration information. 73 help ports : Configuring ports. 74 help flowdir : Flow Director filter help. 75 help registers : Reading and setting port registers. 76 help filters : Filters configuration help. 77 help all : All of the above sections. 78 79Control Functions 80----------------- 81 82start 83~~~~~ 84 85Start packet forwarding with current configuration: 86 87start 88 89start tx_first 90~~~~~~~~~~~~~~ 91 92Start packet forwarding with current configuration after sending one burst of packets: 93 94start tx_first 95 96stop 97~~~~ 98 99Stop packet forwarding, and display accumulated statistics: 100 101stop 102 103quit 104~~~~ 105 106Quit to prompt: 107 108quit 109 110Display Functions 111----------------- 112 113The functions in the following sections are used to display information about the 114testpmd configuration or the NIC status. 115 116show port 117~~~~~~~~~ 118 119Display information for a given port or all ports: 120 121show port (info|stats|fdir|stat_qmap) (port_id|all) 122 123The available information categories are: 124 125info : General port information such as MAC address. 126 127stats : RX/TX statistics. 128 129fdir : Flow Director information and statistics. 130 131stat_qmap : Queue statistics mapping. 132 133For example: 134 135.. code-block:: console 136 137 testpmd> show port info 0 138 139 ********************* Infos for port 0 ********************* 140 141 MAC address: XX:XX:XX:XX:XX:XX 142 Link status: up 143 Link speed: 10000 Mbps 144 Link duplex: full-duplex 145 Promiscuous mode: enabled 146 Allmulticast mode: disabled 147 Maximum number of MAC addresses: 127 148 VLAN offload: 149 strip on 150 filter on 151 qinq(extend) off 152 153show port rss-hash 154~~~~~~~~~~~~~~~~~~ 155 156Display the RSS hash functions and RSS hash key of port (port_id). 157 158show port (port_id) rss-hash [key] clear port 159~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 160 161Clear the port statistics for a given port or for all ports: 162 163clear port (info|stats|fdir|stat_qmap) (port_id|all) 164 165For example: 166 167.. code-block:: console 168 169 testpmd> clear port stats all 170 171show config 172~~~~~~~~~~~ 173 174Displays the configuration of the application. 175The configuration comes from the command-line, the runtime or the application defaults: 176 177show config (rxtx|cores|fwd) 178 179The available information categories are: 180 181rxtx : RX/TX configuration items. 182 183cores : List of forwarding cores. 184 185fwd : Packet forwarding configuration. 186 187For example: 188 189.. code-block:: console 190 191 testpmd> show config rxtx 192 193 io packet forwarding - CRC stripping disabled - packets/burst=16 194 nb forwarding cores=2 - nb forwarding ports=1 195 RX queues=1 - RX desc=128 - RX free threshold=0 196 RX threshold registers: pthresh=8 hthresh=8 wthresh=4 197 TX queues=1 - TX desc=512 - TX free threshold=0 198 TX threshold registers: pthresh=36 hthresh=0 wthresh=0 199 TX RS bit threshold=0 - TXQ flags=0x0 200 201read rxd 202~~~~~~~~ 203 204Display an RX descriptor for a port RX queue: 205 206read rxd (port_id) (queue_id) (rxd_id) 207 208For example: 209 210.. code-block:: console 211 212 testpmd> read rxd 0 0 4 213 0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180 214 215read txd 216~~~~~~~~ 217 218Display a TX descriptor for a port TX queue: 219 220read txd (port_id) (queue_id) (txd_id) 221 222For example: 223 224.. code-block:: console 225 226 testpmd> read txd 0 0 4 227 0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C 228 229Configuration Functions 230----------------------- 231 232The testpmd application can be configured from the runtime as well as from the command-line. 233 234This section details the available configuration functions that are available. 235 236.. note:: 237 238 Configuration changes only become active when forwarding is started/restarted. 239 240set default 241~~~~~~~~~~~ 242 243Reset forwarding to the default configuration: 244 245set default 246 247set verbose 248~~~~~~~~~~~ 249 250Set the debug verbosity level: 251 252set verbose (level) 253 254Currently the only available levels are 0 (silent except for error) and 1 (fully verbose). 255 256set nbport 257~~~~~~~~~~ 258 259Set the number of ports used by the application: 260 261set nbport (num) 262 263This is equivalent to the --nb-ports command-line option. 264 265set nbcore 266~~~~~~~~~~ 267 268Set the number of cores used by the application: 269 270set nbcore (num) 271 272This is equivalent to the --nb-cores command-line option. 273 274.. note:: 275 276 The number of cores used must not be greater than number of ports used multiplied by the number of queues per port. 277 278set coremask 279~~~~~~~~~~~~ 280 281Set the forwarding cores hexadecimal mask: 282 283set coremask (mask) 284 285This is equivalent to the --coremask command-line option. 286 287.. note:: 288 289 The master lcore is reserved for command line parsing only and cannot be masked on for packet forwarding. 290 291set portmask 292~~~~~~~~~~~~ 293 294Set the forwarding ports hexadecimal mask: 295 296set portmask (mask) 297 298This is equivalent to the --portmask command-line option. 299 300set burst 301~~~~~~~~~ 302 303Set number of packets per burst: 304 305set burst (num) 306 307This is equivalent to the --burst command-line option. 308 309In mac_retry forwarding mode, the transmit delay time and number of retries can also be set. 310 311set burst tx delay (micrseconds) retry (num) 312 313set txpkts 314~~~~~~~~~~ 315 316Set the length of each segment of the TX-ONLY packets: 317 318set txpkts (x[,y]*) 319 320Where x[,y]* represents a CSV list of values, without white space. 321 322set corelist 323~~~~~~~~~~~~ 324 325Set the list of forwarding cores: 326 327set corelist (x[,y]*) 328 329For example, to change the forwarding cores: 330 331.. code-block:: console 332 333 testpmd> set corelist 3,1 334 testpmd> show config fwd 335 336 io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled 337 Logical Core 3 (socket 0) forwards packets on 1 streams: 338 RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01 339 Logical Core 1 (socket 0) forwards packets on 1 streams: 340 RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00 341 342.. note:: 343 344 The cores are used in the same order as specified on the command line. 345 346set portlist 347~~~~~~~~~~~~ 348 349Set the list of forwarding ports: 350 351set portlist (x[,y]*) 352 353For example, to change the port forwarding: 354 355.. code-block:: console 356 357 testpmd> set portlist 0,2,1,3 358 testpmd> show config fwd 359 360 io packet forwarding - ports=4 - cores=1 - streams=4 361 Logical Core 3 (socket 0) forwards packets on 4 streams: 362 RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01 363 RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00 364 RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03 365 RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02 366 367vlan set strip 368~~~~~~~~~~~~~~ 369 370Set the VLAN strip on a port: 371 372vlan set strip (on|off) (port_id) 373 374vlan set stripq 375~~~~~~~~~~~~~~~ 376 377Set the VLAN strip for a queue on a port: 378 379vlan set stripq (on|off) (port_id,queue_id) 380 381vlan set filter 382~~~~~~~~~~~~~~~ 383 384Set the VLAN filter on a port: 385 386vlan set filter (on|off) (port_id) 387 388vlan set qinq 389~~~~~~~~~~~~~ 390 391Set the VLAN QinQ (extended queue in queue) on for a port: 392 393vlan set qinq (on|off) (port_id) 394 395vlan set tpid 396~~~~~~~~~~~~~ 397 398Set the outer VLAN TPID for packet filtering on a port: 399 400vlan set tpid (value) (port_id) 401 402.. note:: 403 404 TPID value must be a 16-bit number (value <= 65536). 405 406rx_vlan add 407~~~~~~~~~~~ 408 409Add a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID: 410 411rx_vlan add (vlan_id|all) (port_id) 412 413.. note:: 414 415 VLAN filter must be set on that port. VLAN ID < 4096. 416 417rx_vlan rm 418~~~~~~~~~~ 419 420Remove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID: 421 422rx_vlan rm (vlan_id|all) (port_id) 423 424rx_vlan add(for VF) 425~~~~~~~~~~~~~~~~~~~ 426 427Add a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID: 428 429rx_vlan add (vlan_id) port (port_id) vf (vf_mask) 430 431rx_vlan rm(for VF) 432~~~~~~~~~~~~~~~~~~ 433 434Remove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID: 435 436rx_vlan rm (vlan_id) port (port_id) vf (vf_mask) 437 438tx_rate (for Queue) 439~~~~~~~~~~~~~~~~~~~ 440 441Set TX rate limitation for queue of a port ID: 442 443set port (port_id) queue (queue_id) rate (rate_value) 444 445tx_rate (for VF) 446~~~~~~~~~~~~~~~~ 447 448Set TX rate limitation for queues in VF of a port ID: 449 450set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask) 451 452rx_vlan set tpid 453~~~~~~~~~~~~~~~~ 454 455Set the outer VLAN TPID for packet filtering on a port: 456 457rx_vlan set tpid (value) (port_id) 458 459tx_vlan set 460~~~~~~~~~~~ 461 462Set hardware insertion of VLAN ID in packets sent on a port: 463 464tx_vlan set (vlan_id) (port_id) 465 466tx_vlan set pvid 467~~~~~~~~~~~~~~~~ 468 469Set port based hardware insertion of VLAN ID in pacekts sent on a port: 470 471tx_vlan set pvid (port_id) (vlan_id) (on|off) 472 473tx_vlan reset 474~~~~~~~~~~~~~ 475 476Disable hardware insertion of a VLAN header in packets sent on a port: 477 478tx_vlan reset (port_id) 479 480tx_checksum set mask 481~~~~~~~~~~~~~~~~~~~~ 482 483Enable hardware insertion of checksum offload with a 4-bit mask, 0x0 - 0xF, in packets sent on a port: 484 485tx_checksum set (mask) (port_id) 486 487The bits in the mask are: 488 489bit 0 - if set insert ip checksum offload 490 491bit 1 - if set insert udp checksum offload 492 493bit 2 - if set insert tcp checksum offload 494 495bit 3 - if set insert sctp checksum offload 496 497.. note:: 498 499 Check the NIC Datasheet for hardware limits. 500 501 502set fwd 503~~~~~~~ 504 505Set the packet forwarding mode: 506 507set fwd (io|mac|mac_retry|macswap|flowgen|rxonly|txonly|csum|icmpecho) 508 509The available information categories are: 510 511* io: forwards packets "as-is" in I/O mode. 512 This is the fastest possible forwarding operation as it does not access packets data. 513 This is the default mode. 514 515* mac: changes the source and the destination Ethernet addresses of packets before forwarding them. 516 517* mac_retry: same as "mac" forwarding mode, but includes retries if the destination queue is full. 518 519* macswap: MAC swap forwarding mode. 520 Swaps the source and the destination Ethernet addresses of packets before forwarding them. 521 522* flowgen: multi-flow generation mode. 523 Originates a bunch of flows (varying destination IP addresses), and terminate receive traffic. 524 525* rxonly: receives packets but doesn't transmit them. 526 527* txonly: generates and transmits packets without receiving any. 528 529* csum: changes the checksum field with HW or SW methods depending on the offload flags on the packet. 530 531* icmpecho: receives a burst of packets, lookup for IMCP echo requests and, if any, send back ICMP echo replies. 532 533 534Example: 535 536.. code-block:: console 537 538 testpmd> set fwd rxonly 539 540 Set rxonly packet forwarding mode 541 542mac_addr add 543~~~~~~~~~~~~ 544 545Add an alternative MAC address to a port: 546 547mac_addr add (port_id) (XX:XX:XX:XX:XX:XX) 548 549mac_addr remove 550~~~~~~~~~~~~~~~ 551 552Remove a MAC address from a port: 553 554mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX) 555 556mac_addr add(for VF) 557~~~~~~~~~~~~~~~~~~~~ 558 559Add an alternative MAC address for a VF to a port: 560 561mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX) 562 563set port-uta 564~~~~~~~~~~~~ 565 566Set the unicast hash filter(s) on/off for a port X: 567 568set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off) 569 570set promisc 571~~~~~~~~~~~ 572 573Set the promiscuous mode on for a port or for all ports. 574In promiscuous mode packets are not dropped if they aren't for the specified MAC address: 575 576set promisc (port_id|all) (on|off) 577 578set allmulti 579~~~~~~~~~~~~ 580 581Set the allmulti mode for a port or for all ports: 582 583set allmulti (port_id|all) (on|off) 584 585Same as the ifconfig (8) option. Controls how multicast packets are handled. 586 587set flow_ctrl rx 588~~~~~~~~~~~~~~~~ 589 590Set the link flow control parameter on a port: 591 592set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \ 593(pause_time) (send_xon) (port_id) 594 595Where: 596 597high_water (integer): High threshold value to trigger XOFF. 598 599low_water (integer) : Low threshold value to trigger XON. 600 601pause_time (integer): Pause quota in the Pause frame. 602 603send_xon (0/1) : Send XON frame. 604 605mac_ctrl_frame_fwd : Enable receiving MAC control frames 606 607set pfc_ctrl rx 608~~~~~~~~~~~~~~~ 609 610Set the priority flow control parameter on a port: 611 612set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \ (pause_time) (priority) (port_id) 613 614Where: 615 616priority (0-7): VLAN User Priority. 617 618set stat_qmap 619~~~~~~~~~~~~~ 620 621Set statistics mapping (qmapping 0..15) for RX/TX queue on port: 622 623set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping) 624 625For example, to set rx queue 2 on port 0 to mapping 5: 626 627.. code-block:: console 628 629 testpmd>set stat_qmap rx 0 2 5 630 631set port - rx/tx(for VF) 632~~~~~~~~~~~~~~~~~~~~~~~~ 633 634Set VF receive/transmit from a port: 635 636set port (port_id) vf (vf_id) (rx|tx) (on|off) 637 638set port - rx mode(for VF) 639~~~~~~~~~~~~~~~~~~~~~~~~~~ 640 641Set the VF receive mode of a port: 642 643set port (port_id) vf (vf_id) rxmode (AUPE|ROPE|BAM|MPE) (on|off) 644 645The available receive modes are: 646 647* AUPE: accepts untagged VLAN. 648 649* ROPE: accepts unicast hash. 650 651* BAM: accepts broadcast packets 652 653* MPE: accepts all multicast packets 654 655set port - mirror rule 656~~~~~~~~~~~~~~~~~~~~~~ 657 658Set port or vlan type mirror rule for a port. 659 660set port (port_id) mirror-rule (rule_id) (pool-mirror|vlan-mirror) (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off) 661 662For example to enable mirror traffic with vlan 0,1 to pool 0: 663 664.. code-block:: console 665 666 set port 0 mirror-rule 0 vlan-mirror 0,1 dst-pool 0 on 667 668reset port - mirror rule 669~~~~~~~~~~~~~~~~~~~~~~~~ 670 671Reset a mirror rule for a port. 672 673reset port (port_id) mirror-rule (rule_id) 674 675set flush_rx 676~~~~~~~~~~~~ 677 678Flush (default) or don't flush RX streams before forwarding. 679Mainly used with PCAP drivers to avoid the default behavior of flushing the first 512 packets on RX streams. 680 681set flush_rx off 682 683set bypass mode 684~~~~~~~~~~~~~~~ 685 686Set the bypass mode for the lowest port on bypass enabled NIC. 687 688set bypass mode (normal|bypass|isolate) (port_id) 689 690set bypass event 691~~~~~~~~~~~~~~~~ 692 693Set the event required to initiate specified bypass mode for the lowest port on a bypass enabled NIC where: 694 695* timeout: enable bypass after watchdog timeout. 696 697* os_on: enable bypass when OS/board is powered on. 698 699* os_off: enable bypass when OS/board is powered off. 700 701* power_on: enable bypass when power supply is turned on. 702 703* power_off: enable bypass when power supply is turned off. 704 705set bypass event (timeout|os_on|os_off|power_on|power_off) mode (normal|bypass|isolate) (port_id) 706 707set bypass timeout 708~~~~~~~~~~~~~~~~~~ 709 710Set the bypass watchdog timeout to 'n' seconds where 0 = instant. 711 712set bypass timeout (0|1.5|2|3|4|8|16|32) 713 714show bypass config 715~~~~~~~~~~~~~~~~~~ 716 717Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC. 718 719show bypass config (port_id) 720 721add_ethertype_filter 722~~~~~~~~~~~~~~~~~~~~ 723 724Add a L2 Ethertype filter, which identify packets by their L2 Ethertype mainly assign them to a receive queue. 725 726add_ethertype_filter (port_id) ethertype (eth_value) priority (enable|disable) (pri_value) queue (queue_id) index (idx) 727 728The available information parameters are: 729 730* port_id: the port which the Ethertype filter assigned on. 731 732* eth_value: the EtherType value want to match, 733 for example 0x0806 for ARP packet. 0x0800 (IPv4) and 0x86DD (IPv6) are invalid. 734 735* enable: user priority participates in the match. 736 737* disable: user priority doesn't participate in the match. 738 739* pri_value: user priority value that want to match. 740 741* queue_id : The receive queue associated with this EtherType filter 742 743* index: the index of this EtherType filter 744 745Example: 746 747.. code-block:: console 748 749 testpmd> add_ethertype_filter 0 ethertype 0x0806 priority disable 0 queue 3 index 0 750 Assign ARP packet to receive queue 3 751 752remove_ethertype_filter 753~~~~~~~~~~~~~~~~~~~~~~~ 754 755Remove a L2 Ethertype filter 756 757remove_ethertype_filter (port_id) index (idx) 758 759get_ethertype_filter 760~~~~~~~~~~~~~~~~~~~~ 761 762Get and display a L2 Ethertype filter 763 764get_ethertype_filter (port_id) index (idx) 765 766Example: 767 768.. code-block:: console 769 770 testpmd> get_ethertype_filter 0 index 0 771 772 filter[0]: 773 ethertype: 0x0806 774 priority: disable, 0 775 queue: 3 776 777add_2tuple_filter 778~~~~~~~~~~~~~~~~~ 779 780Add a 2-tuple filter, 781which identify packets by specific protocol and destination TCP/UDP port 782and forwards packets into one of the receive queues. 783 784add_2tuple_filter (port_id) protocol (pro_value) (pro_mask) dst_port (port_value) (port_mask) 785flags (flg_value) priority (prio_value) queue (queue_id) index (idx) 786 787The available information parameters are: 788 789* port_id: the port which the 2-tuple filter assigned on. 790 791* pro_value: IP L4 protocol 792 793* pro_mask: protocol participates in the match or not, 1 means participate 794 795* port_value: destination port in L4. 796 797* port_mask: destination port participates in the match or not, 1 means participate. 798 799* flg_value: TCP control bits. The non-zero value is invalid, when the pro_value is not set to 0x06 (TCP). 800 801* prio_value: the priority of this filter. 802 803* queue_id: The receive queue associated with this 2-tuple filter 804 805* index: the index of this 2-tuple filter 806 807Example: 808 809.. code-block:: console 810 811 testpmd> add_2tuple_filter 0 protocol 0x06 1 dst_port 32 1 flags 0x02 priority 3 queue 3 index 0 812 813remove_2tuple_filter 814~~~~~~~~~~~~~~~~~~~~ 815 816Remove a 2-tuple filter 817 818remove_2tuple_filter (port_id) index (idx) 819 820get_2tuple_filter 821~~~~~~~~~~~~~~~~~ 822 823Get and display a 2-tuple filter 824 825get_2tuple_filter (port_id) index (idx) 826 827Example: 828 829.. code-block:: console 830 831 testpmd> get_2tuple_filter 0 index 0 832 833 filter[0]: 834 Destination Port: 0x0020 mask: 1 835 protocol: 0x06 mask:1 tcp_flags: 0x02 836 priority: 3 queue: 3 837 838add_5tuple_filter 839~~~~~~~~~~~~~~~~~ 840 841Add a 5-tuple filter, 842which consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port) 843and routes packets into one of the receive queues. 844 845add_5tuple_filter (port_id) dst_ip (dst_address) src_ip (src_address) dst_port (dst_port_value) src_port (src_port_value) 846protocol (protocol_value) mask (mask_value) flags (flags_value) priority (prio_value) queue (queue_id) index (idx) 847 848The available information parameters are: 849 850* port_id: the port which the 5-tuple filter assigned on. 851 852* dst_address: destination IP address. 853 854* src_address: source IP address. 855 856* dst_port_value: TCP/UDP destination port. 857 858* src_port_value: TCP/UDP source port. 859 860* protocol_value: L4 protocol. 861 862* mask_value: participates in the match or not by bit for field above, 1b means participate 863 864* flags_value: TCP control bits. The non-zero value is invalid, when the protocol_value is not set to 0x06 (TCP). 865 866* prio_value: the priority of this filter. 867 868* queue_id: The receive queue associated with this 5-tuple filter. 869 870* index: the index of this 5-tuple filter 871 872Example: 873 874.. code-block:: console 875 876 testpmd> add_5tuple_filter 1 dst_ip 2.2.2.5 src_ip 2.2.2.4 dst_port 64 src_port 32 protocol 0x06 mask 0x1F flags 0x0 priority 3 queue 3 index 0 877 878remove_5tuple_filter 879~~~~~~~~~~~~~~~~~~~~ 880 881Remove a 5-tuple filter 882 883remove_5tuple_filter (port_id) index (idx) 884 885get_5tuple_filter 886~~~~~~~~~~~~~~~~~ 887 888Get and display a 5-tuple filter 889 890get_5tuple_filter (port_id) index (idx) 891 892Example: 893 894.. code-block:: console 895 896 testpmd> get_5tuple_filter 1 index 0 897 898 filter[0]: 899 Destination IP: 0x02020205 mask: 1 900 Source IP: 0x02020204 mask: 1 901 Destination Port: 0x0040 mask: 1 902 Source Port: 0x0020 mask: 1 903 protocol: 0x06 mask: 1 904 priority: 3 flags: 0x00 queue: 3 905 906add_syn_filter 907~~~~~~~~~~~~~~ 908 909Add SYN filter, which can forward TCP packets whose *SYN* flag is set into a separate queue. 910 911add_syn_filter (port_id) priority (high|low) queue (queue_id) 912 913The available information parameters are: 914 915* port_id: the port which the SYN filter assigned on. 916 917* high: this SYN filter has higher priority than other filters. 918 919* low: this SYN filter has lower priority than other filters. 920 921* queue_id: The receive queue associated with this SYN filter 922 923Example: 924 925.. code-block:: console 926 927 testpmd> add_syn_filter 0 priority high queue 3, 928 929remove_syn_filter 930~~~~~~~~~~~~~~~~~ 931 932Remove SYN filter 933 934remove_syn_filter (port_id) 935 936get_syn_filter 937~~~~~~~~~~~~~~ 938 939Get and display SYN filter 940 941get_syn_filter (port_id) 942 943Example: 944 945.. code-block:: console 946 947 testpmd> get_syn_filter 0 948 949 syn filter: on, priority: high, queue: 3 950 951add_flex_filter 952~~~~~~~~~~~~~~~ 953 954Add a Flex filter, 955which recognizes any arbitrary pattern within the first 128 bytes of the packet 956and routes packets into one of the receive queues. 957 958add_flex_filter (port_id) len (len_value) bytes (bytes_string) mask (mask_value) 959priority (prio_value) queue (queue_id) index (idx) 960 961The available information parameters are: 962 963* port_id: the port which the Flex filter assigned on. 964 965* len_value: filter length in byte, no greater than 128. 966 967* bytes_string: a sting in format of octal, means the value the flex filter need to match. 968 969* mask_value: a sting in format of octal, bit 1 means corresponding byte in DWORD participates in the match. 970 971* prio_value: the priority of this filter. 972 973* queue_id: The receive queue associated with this Flex filter. 974 975* index: the index of this Flex filter 976 977Example: 978 979.. code-block:: console 980 981 testpmd> add_flex_filter 0 len 16 bytes 0x00000000000000000000000008060000 mask 000C priority 3 queue 3 index 0 982 983Assign a packet whose 13th and 14th bytes are 0x0806 to queue 3. 984 985remove_flex_filter 986~~~~~~~~~~~~~~~~~~ 987 988Remove a Flex filter 989 990remove_flex_filter (port_id) index (idx) 991 992get_flex_filter 993~~~~~~~~~~~~~~~ 994 995Get and display a Flex filter 996 997get_flex_filter (port_id) index (idx) 998 999Example: 1000 1001.. code-block:: console 1002 1003 testpmd> get_flex_filter 0 index 0 1004 1005 filter[0]: 1006 1007 length: 16 1008 1009 dword[]: 0x00000000 00000000 00000000 08060000 00000000 00000000 00000000 1010 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 1011 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 1012 00000000 00000000 00000000 00000000 00000000 00000000 00000000 1013 1014 mask[]: 1015 0b0000000000001100000000000000000000000000000000000000000000000000000000 1016 0000000000000000000000000000000000000000000000000000000000 1017 1018 priority: 3 queue: 3 1019 1020set link up 1021~~~~~~~~~~~ 1022 1023Set link up for a port. 1024 1025set link-up port (port id) 1026 1027set link down 1028~~~~~~~~~~~~~ 1029 1030Set link down for a port. 1031 1032set link-down port (port id) 1033 1034Port Functions 1035-------------- 1036 1037The following sections show functions for configuring ports. 1038 1039.. note:: 1040 1041 Port configuration changes only become active when forwarding is started/restarted. 1042 1043port start 1044~~~~~~~~~~ 1045 1046Start all ports or a specific port: 1047 1048port start (port_id|all) 1049 1050port stop 1051~~~~~~~~~ 1052 1053Stop all ports or a specific port: 1054 1055port stop (port_id|all) 1056 1057port close 1058~~~~~~~~~~ 1059 1060Close all ports or a specific port: 1061 1062port close (port_id|all) 1063 1064port config - speed 1065~~~~~~~~~~~~~~~~~~~ 1066 1067Set the speed and duplex mode for all ports or a specific port: 1068 1069port config (port_id|all) speed (10|100|1000|10000|auto) duplex (half|full|auto) 1070 1071port config - queues/descriptors 1072~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1073 1074Set number of queues/descriptors for rxq, txq, rxd and txd: 1075 1076port config all (rxq|txq|rxd|txd) (value) 1077 1078This is equivalent to the --rxq, --txq, --rxd and --txd command-line options. 1079 1080port config - max-pkt-len 1081~~~~~~~~~~~~~~~~~~~~~~~~~ 1082 1083Set the maximum packet length: 1084 1085port config all max-pkt-len (value) 1086 1087This is equivalent to the --max-pkt-len command-line option. 1088 1089port config - CRC Strip 1090~~~~~~~~~~~~~~~~~~~~~~~ 1091 1092Set hardware CRC stripping on or off for all ports: 1093 1094port config all crc-strip (on|off) 1095 1096CRC stripping is off by default. 1097 1098The on option is equivalent to the --crc-strip command-line option. 1099 1100port config - RX Checksum 1101~~~~~~~~~~~~~~~~~~~~~~~~~ 1102 1103Set hardware RX checksum offload to on or off for all ports: 1104 1105port config all rx-cksum (on|off) 1106 1107Checksum offload is off by default. 1108 1109The on option is equivalent to the --enable-rx-cksum command-line option. 1110 1111port config - VLAN 1112~~~~~~~~~~~~~~~~~~ 1113 1114Set hardware VLAN on or off for all ports: 1115 1116port config all hw-vlan (on|off) 1117 1118Hardware VLAN is on by default. 1119 1120The off option is equivalent to the --disable-hw-vlan command-line option. 1121 1122port config - Drop Packets 1123~~~~~~~~~~~~~~~~~~~~~~~~~~ 1124 1125Set packet drop for packets with no descriptors on or off for all ports: 1126 1127port config all drop-en (on|off) 1128 1129Packet dropping for packets with no descriptors is off by default. 1130 1131The on option is equivalent to the --enable-drop-en command-line option. 1132 1133port config - RSS 1134~~~~~~~~~~~~~~~~~ 1135 1136Set the RSS (Receive Side Scaling) mode on or off: 1137 1138port config all rss (ip|udp|none) 1139 1140RSS is on by default. 1141 1142The off option is equivalent to the --disable-rss command-line option. 1143 1144port config - RSS Reta 1145~~~~~~~~~~~~~~~~~~~~~~ 1146 1147Set the RSS (Receive Side Scaling) redirection table: 1148 1149port config all rss reta (hash,queue)[,(hash,queue)] 1150 1151port config - DCB 1152~~~~~~~~~~~~~~~~~ 1153 1154Set the DCB mode for an individual port: 1155 1156port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off) 1157 1158The traffic class should be 4 or 8. 1159 1160port config - Burst 1161~~~~~~~~~~~~~~~~~~~ 1162 1163Set the number of packets per burst: 1164 1165port config all burst (value) 1166 1167This is equivalent to the --burst command-line option. 1168 1169port config - Threshold 1170~~~~~~~~~~~~~~~~~~~~~~~ 1171 1172Set thresholds for TX/RX queues: 1173 1174port config all (threshold) (value) 1175 1176Where the threshold type can be: 1177 1178* txpt: Set the prefetch threshold register of the TX rings, 0 <= value <= 255. 1179 1180* txht: Set the host threshold register of the TX rings, 0 <= value <= 255. 1181 1182* txwt: Set the write-back threshold register of the TX rings, 0 <= value <= 255. 1183 1184* rxpt: Set the prefetch threshold register of the RX rings, 0 <= value <= 255. 1185 1186* rxht: Set the host threshold register of the RX rings, 0 <= value <= 255. 1187 1188* rxwt: Set the write-back threshold register of the RX rings, 0 <= value <= 255. 1189 1190* txfreet: Set the transmit free threshold of the TX rings, 0 <= value <= txd. 1191 1192* rxfreet: Set the transmit free threshold of the RX rings, 0 <= value <= rxd. 1193 1194* txrst: Set the transmit RS bit threshold of TX rings, 0 <= value <= txd. 1195 These threshold options are also available from the command-line. 1196 1197Flow Director Functions 1198----------------------- 1199 1200The Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues. 1201 1202Two types of filtering are supported which are referred to as Perfect Match and Signature filters: 1203 1204* Perfect match filters. 1205 The hardware checks a match between the masked fields of the received packets and the programmed filters. 1206 1207* Signature filters. 1208 The hardware checks a match between a hash-based signature of the masked fields of the received packet. 1209 1210The Flow Director filters can match the following fields in a packet: 1211 1212* Source IP and destination IP addresses. 1213 1214* Source port and destination port numbers (for UDP and TCP packets). 1215 1216* IPv4/IPv6 and UDP/ TCP/SCTP protocol match. 1217 1218* VLAN header. 1219 1220* Flexible 2-byte tuple match anywhere in the first 64 bytes of the packet. 1221 1222The Flow Director can also mask out parts of all of these fields so that filters are only applied to certain fields 1223or parts of the fields. 1224For example it is possible to mask out sub-nets of IP addresses or to ignore VLAN headers. 1225 1226In the following sections, several common parameters are used in the Flow Director filters. 1227These are explained below: 1228 1229* src: A pair of source address values. The source IP, in IPv4 or IPv6 format, and the source port: 1230 1231 src 192.168.0.1 1024 1232 1233 src 2001:DB8:85A3:0:0:8A2E:370:7000 1024 1234 1235* dst: A pair of destination address values. The destination IP, in IPv4 or IPv6 format, and the destination port. 1236 1237* flexbytes: A 2-byte tuple to be matched within the first 64 bytes of a packet. 1238 1239The offset where the match occurs is set by the --pkt-filter-flexbytes-offset command-line parameter 1240and is counted from the first byte of the destination Ethernet MAC address. 1241The default offset is 0xC bytes, which is the "Type" word in the MAC header. 1242Typically, the flexbyte value is set to 0x0800 to match the IPv4 MAC type or 0x86DD to match IPv6. 1243These values change when a VLAN tag is added. 1244 1245* vlan: The VLAN header to match in the packet. 1246 1247* queue: The index of the RX queue to route matched packets to. 1248 1249* soft: The 16-bit value in the MBUF flow director ID field for RX packets matching the filter. 1250 1251add_signature_filter 1252~~~~~~~~~~~~~~~~~~~~ 1253 1254Add a signature filter: 1255 1256# Command is displayed on several lines for clarity. 1257 1258add_signature_filter (port_id) (ip|udp|tcp|sctp) 1259 1260 src (src_ip_address) (src_port) 1261 1262 dst (dst_ip_address) (dst_port) 1263 1264 flexbytes (flexbytes_values) 1265 1266 vlan (vlan_id) queue (queue_id) 1267 1268upd_signature_filter 1269~~~~~~~~~~~~~~~~~~~~ 1270 1271Update a signature filter: 1272 1273# Command is displayed on several lines for clarity. 1274 1275upd_signature_filter (port_id) (ip|udp|tcp|sctp) 1276 1277 src (src_ip_address) (src_port) 1278 1279 dst (dst_ip_address) (dst_port) 1280 1281 flexbytes (flexbytes_values) 1282 1283 vlan (vlan_id) queue (queue_id) 1284 1285rm_signature_filter 1286~~~~~~~~~~~~~~~~~~~ 1287 1288Remove a signature filter: 1289 1290# Command is displayed on several lines for clarity. 1291 1292rm_signature_filter (port_id) (ip|udp|tcp|sctp) 1293 1294 src (src_ip_address) (src_port) 1295 1296 dst (dst_ip_address) (dst_port) 1297 1298 flexbytes (flexbytes_values) 1299 1300 vlan (vlan_id) 1301 1302add_perfect_filter 1303~~~~~~~~~~~~~~~~~~ 1304 1305Add a perfect filter: 1306 1307# Command is displayed on several lines for clarity. 1308 1309add_perfect_filter (port_id) (ip|udp|tcp|sctp) 1310 1311 src (src_ip_address) (src_port) 1312 1313 dst (dst_ip_address) (dst_port) 1314 1315 flexbytes (flexbytes_values) 1316 1317 vlan (vlan_id) queue (queue_id) soft (soft_id) 1318 1319upd_perfect_filter 1320~~~~~~~~~~~~~~~~~~ 1321 1322Update a perfect filter: 1323 1324# Command is displayed on several lines for clarity. 1325 1326upd_perfect_filter (port_id) (ip|udp|tcp|sctp) 1327 1328 src (src_ip_address) (src_port) 1329 1330 dst (dst_ip_address) (dst_port) 1331 1332 flexbytes (flexbytes_values) 1333 1334 vlan (vlan_id) queue (queue_id) 1335 1336rm_perfect_filter 1337~~~~~~~~~~~~~~~~~ 1338 1339Remove a perfect filter: 1340 1341rm_perfect_filter (port_id) (ip|udp|tcp|sctp) 1342 1343 src (src_ip_address) (src_port) 1344 1345 dst (dst_ip_address) (dst_port) 1346 1347 flexbytes (flexbytes_values) 1348 1349 vlan (vlan_id) soft (soft_id) 1350 1351set_masks_filter 1352~~~~~~~~~~~~~~~~ 1353 1354Set IPv4 filter masks: 1355 1356# Command is displayed on several lines for clarity. 1357 1358set_masks_filter (port_id) only_ip_flow (0|1) 1359 1360 src_mask (ip_src_mask) (src_port_mask) 1361 1362 dst_mask (ip_dst_mask) (dst_port_mask) 1363 1364 flexbytes (0|1) vlan_id (0|1) vlan_prio (0|1) 1365 1366set_ipv6_masks_filter 1367~~~~~~~~~~~~~~~~~~~~~ 1368 1369Set IPv6 filter masks: 1370 1371# Command is displayed on several lines for clarity. 1372 1373set_ipv6_masks_filter (port_id) only_ip_flow (0|1) 1374 1375 src_mask (ip_src_mask) (src_port_mask) 1376 1377 dst_mask (ip_dst_mask) (dst_port_mask) 1378 1379 flexbytes (0|1) vlan_id (0|1) vlan_prio (0|1) 1380 1381 compare_dst (0|1) 1382 1383Link Bonding Functions 1384---------------------- 1385 1386The Link Bonding functions make it possible to dynamically create and 1387manage link bonding devices from within testpmd interactive prompt. 1388 1389create bonded device 1390~~~~~~~~~~~~~~~~~~~~ 1391 1392Create a new bonding device: 1393 1394create bonded device (mode) (socket) 1395 1396For example, to create a bonded device in mode 1 on socket 0. 1397 1398.. code-block:: console 1399 1400 testpmd> create bonded 1 0 1401 created new bonded device (port X) 1402 1403add bonding slave 1404~~~~~~~~~~~~~~~~~ 1405 1406Adds Ethernet device to a Link Bonding device: 1407 1408add bonding slave (slave id) (port id) 1409 1410For example, to add Ethernet device (port 6) to a Link Bonding device (port 10). 1411 1412.. code-block:: console 1413 1414 testpmd> add bonding slave 6 10 1415 1416 1417remove bonding slave 1418~~~~~~~~~~~~~~~~~~~~ 1419 1420Removes an Ethernet slave device from a Link Bonding device: 1421 1422remove bonding slave (slave id) (port id) 1423 1424For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10). 1425 1426.. code-block:: console 1427 1428 testpmd> remove bonding slave 6 10 1429 1430set bonding mode 1431~~~~~~~~~~~~~~~~ 1432 1433Set the Link Bonding mode of a Link Bonding device: 1434 1435set bonding mode (value) (port id) 1436 1437For example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3). 1438 1439.. code-block:: console 1440 1441 testpmd> set bonding mode 3 10 1442 1443set bonding primary 1444~~~~~~~~~~~~~~~~~~~ 1445 1446Set an Ethernet slave device as the primary device on a Link Bonding device: 1447 1448set bonding primary (slave id) (port id) 1449 1450For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10). 1451 1452.. code-block:: console 1453 1454 testpmd> set bonding primary 6 10 1455 1456set bonding mac 1457~~~~~~~~~~~~~~~ 1458 1459Set the MAC address of a Link Bonding device: 1460 1461set bonding mac (port id) (mac) 1462 1463For example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01 1464 1465.. code-block:: console 1466 1467 testpmd> set bonding mac 10 00:00:00:00:00:01 1468 1469set bonding xmit_balance_policy 1470~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1471 1472Set the transmission policy for a Link Bonding device when it is in Balance XOR mode: 1473 1474set bonding xmit_balance_policy (port_id) (l2|l23|l34) 1475 1476For example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports ) 1477 1478.. code-block:: console 1479 1480 testpmd> set bonding xmit_balance_policy 10 l34 1481 1482 1483set bonding mon_period 1484~~~~~~~~~~~~~~~~~~~~~~ 1485 1486Set the link status monitoring polling period in milliseconds for a bonding devicie. 1487 1488This adds support for PMD slave devices which do not support link status interrupts. 1489When the mon_period is set to a value greater than 0 then all PMD's which do not support 1490link status ISR will be queried every polling interval to check if their link status has changed. 1491 1492set bonding mon_period (port_id) (value) 1493 1494For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms 1495 1496.. code-block:: console 1497 1498 testpmd> set bonding mon_period 5 150 1499 1500 1501show bonding config 1502~~~~~~~~~~~~~~~~~~~ 1503 1504Show the current configuration of a Link Bonding device: 1505 1506show bonding config (port id) 1507 1508For example, 1509to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4) 1510in balance mode with a transmission policy of layer 2+3. 1511 1512.. code-block:: console 1513 1514 testpmd> show bonding config 9 1515 Bonding mode: 2 1516 Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23 1517 Slaves (3): [1 3 4] 1518 Active Slaves (3): [1 3 4] 1519 Primary: [3] 1520 1521Register Functions 1522------------------ 1523 1524The Register functions can be used to read from and write to registers on the network card referenced by a port number. 1525This is mainly useful for debugging purposes. 1526Reference should be made to the appropriate datasheet for the network card for details on the register addresses 1527and fields that can be accessed. 1528 1529read reg 1530~~~~~~~~ 1531 1532Display the value of a port register: 1533 1534read reg (port_id) (address) 1535 1536For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel® 82599 10 GbE Controller: 1537 1538.. code-block:: console 1539 1540 testpmd> read reg 0 0xEE00 1541 port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241) 1542 1543read regfield 1544~~~~~~~~~~~~~ 1545 1546Display a port register bit field: 1547 1548read regfield (port_id) (address) (bit_x) (bit_y) 1549 1550For example, reading the lowest two bits from the register in the example above: 1551 1552.. code-block:: console 1553 1554 testpmd> read regfield 0 0xEE00 0 1 1555 port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1) 1556 1557read regbit 1558~~~~~~~~~~~ 1559 1560Display a single port register bit: 1561 1562read regbit (port_id) (address) (bit_x) 1563 1564For example, reading the lowest bit from the register in the example above: 1565 1566.. code-block:: console 1567 1568 testpmd> read regbit 0 0xEE00 0 1569 port 0 PCI register at offset 0xEE00: bit 0=1 1570 1571write reg 1572~~~~~~~~~ 1573 1574Set the value of a port register: 1575 1576write reg (port_id) (address) (value) 1577 1578For example, to clear a register: 1579 1580.. code-block:: console 1581 1582 testpmd> write reg 0 0xEE00 0x0 1583 port 0 PCI register at offset 0xEE00: 0x00000000 (0) 1584 1585write regfield 1586~~~~~~~~~~~~~~ 1587 1588Set bit field of a port register: 1589 1590write regfield (port_id) (address) (bit_x) (bit_y) (value) 1591 1592For example, writing to the register cleared in the example above: 1593 1594.. code-block:: console 1595 1596 testpmd> write regfield 0 0xEE00 0 1 2 1597 port 0 PCI register at offset 0xEE00: 0x00000002 (2) 1598 1599write regbit 1600~~~~~~~~~~~~ 1601 1602Set single bit value of a port register: 1603 1604write regbit (port_id) (address) (bit_x) (value) 1605 1606For example, to set the high bit in the register from the example above: 1607 1608.. code-block:: console 1609 1610 testpmd> write regbit 0 0xEE00 31 1 1611 port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658) 1612