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