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