81f10727f93259f6302ba1c278048c73b2ee6101
[deb_dpdk.git] / doc / guides / testpmd_app_ug / testpmd_funcs.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2010-2016 Intel Corporation.
3
4 .. _testpmd_runtime:
5
6 Testpmd Runtime Functions
7 =========================
8
9 Where the testpmd application is started in interactive mode, (``-i|--interactive``),
10 it displays a prompt that can be used to start and stop forwarding,
11 configure the application, display statistics (including the extended NIC
12 statistics aka xstats) , set the Flow Director and other tasks::
13
14    testpmd>
15
16 The testpmd prompt has some, limited, readline support.
17 Common bash command-line functions such as ``Ctrl+a`` and ``Ctrl+e`` to go to the start and end of the prompt line are supported
18 as well as access to the command history via the up-arrow.
19
20 There is also support for tab completion.
21 If you type a partial command and hit ``<TAB>`` you get a list of the available completions:
22
23 .. code-block:: console
24
25    testpmd> show port <TAB>
26
27        info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
28        info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
29        stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
30        stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
31        ...
32
33
34 .. note::
35
36    Some examples in this document are too long to fit on one line are are shown wrapped at `"\\"` for display purposes::
37
38       testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
39                (pause_time) (send_xon) (port_id)
40
41 In the real ``testpmd>`` prompt these commands should be on a single line.
42
43 Help Functions
44 --------------
45
46 The testpmd has on-line help for the functions that are available at runtime.
47 These are divided into sections and can be accessed using help, help section or help all:
48
49 .. code-block:: console
50
51    testpmd> help
52
53        help control    : Start and stop forwarding.
54        help display    : Displaying port, stats and config information.
55        help config     : Configuration information.
56        help ports      : Configuring ports.
57        help registers  : Reading and setting port registers.
58        help filters    : Filters configuration help.
59        help all        : All of the above sections.
60
61
62 Command File Functions
63 ----------------------
64
65 To facilitate loading large number of commands or to avoid cutting and pasting where not
66 practical or possible testpmd supports alternative methods for executing commands.
67
68 * If started with the ``--cmdline-file=FILENAME`` command line argument testpmd
69   will execute all CLI commands contained within the file immediately before
70   starting packet forwarding or entering interactive mode.
71
72 .. code-block:: console
73
74    ./testpmd -n4 -r2 ... -- -i --cmdline-file=/home/ubuntu/flow-create-commands.txt
75    Interactive-mode selected
76    CLI commands to be read from /home/ubuntu/flow-create-commands.txt
77    Configuring Port 0 (socket 0)
78    Port 0: 7C:FE:90:CB:74:CE
79    Configuring Port 1 (socket 0)
80    Port 1: 7C:FE:90:CB:74:CA
81    Checking link statuses...
82    Port 0 Link Up - speed 10000 Mbps - full-duplex
83    Port 1 Link Up - speed 10000 Mbps - full-duplex
84    Done
85    Flow rule #0 created
86    Flow rule #1 created
87    ...
88    ...
89    Flow rule #498 created
90    Flow rule #499 created
91    Read all CLI commands from /home/ubuntu/flow-create-commands.txt
92    testpmd>
93
94
95 * At run-time additional commands can be loaded in bulk by invoking the ``load FILENAME``
96   command.
97
98 .. code-block:: console
99
100    testpmd> load /home/ubuntu/flow-create-commands.txt
101    Flow rule #0 created
102    Flow rule #1 created
103    ...
104    ...
105    Flow rule #498 created
106    Flow rule #499 created
107    Read all CLI commands from /home/ubuntu/flow-create-commands.txt
108    testpmd>
109
110
111 In all cases output from any included command will be displayed as standard output.
112 Execution will continue until the end of the file is reached regardless of
113 whether any errors occur.  The end user must examine the output to determine if
114 any failures occurred.
115
116
117 Control Functions
118 -----------------
119
120 start
121 ~~~~~
122
123 Start packet forwarding with current configuration::
124
125    testpmd> start
126
127 start tx_first
128 ~~~~~~~~~~~~~~
129
130 Start packet forwarding with current configuration after sending specified number of bursts of packets::
131
132    testpmd> start tx_first (""|burst_num)
133
134 The default burst number is 1 when ``burst_num`` not presented.
135
136 stop
137 ~~~~
138
139 Stop packet forwarding, and display accumulated statistics::
140
141    testpmd> stop
142
143 quit
144 ~~~~
145
146 Quit to prompt::
147
148    testpmd> quit
149
150
151 Display Functions
152 -----------------
153
154 The functions in the following sections are used to display information about the
155 testpmd configuration or the NIC status.
156
157 show port
158 ~~~~~~~~~
159
160 Display information for a given port or all ports::
161
162    testpmd> show port (info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)
163
164 The available information categories are:
165
166 * ``info``: General port information such as MAC address.
167
168 * ``summary``: Brief port summary such as Device Name, Driver Name etc.
169
170 * ``stats``: RX/TX statistics.
171
172 * ``xstats``: RX/TX extended NIC statistics.
173
174 * ``fdir``: Flow Director information and statistics.
175
176 * ``stat_qmap``: Queue statistics mapping.
177
178 * ``dcb_tc``: DCB information such as TC mapping.
179
180 * ``cap``: Supported offload capabilities.
181
182 For example:
183
184 .. code-block:: console
185
186    testpmd> show port info 0
187
188    ********************* Infos for port 0 *********************
189
190    MAC address: XX:XX:XX:XX:XX:XX
191    Connect to socket: 0
192    memory allocation on the socket: 0
193    Link status: up
194    Link speed: 40000 Mbps
195    Link duplex: full-duplex
196    Promiscuous mode: enabled
197    Allmulticast mode: disabled
198    Maximum number of MAC addresses: 64
199    Maximum number of MAC addresses of hash filtering: 0
200    VLAN offload:
201        strip on
202        filter on
203        qinq(extend) off
204    Redirection table size: 512
205    Supported flow types:
206      ipv4-frag
207      ipv4-tcp
208      ipv4-udp
209      ipv4-sctp
210      ipv4-other
211      ipv6-frag
212      ipv6-tcp
213      ipv6-udp
214      ipv6-sctp
215      ipv6-other
216      l2_payload
217      port
218      vxlan
219      geneve
220      nvgre
221
222 show port rss reta
223 ~~~~~~~~~~~~~~~~~~
224
225 Display the rss redirection table entry indicated by masks on port X::
226
227    testpmd> show port (port_id) rss reta (size) (mask0, mask1...)
228
229 size is used to indicate the hardware supported reta size
230
231 show port rss-hash
232 ~~~~~~~~~~~~~~~~~~
233
234 Display the RSS hash functions and RSS hash key of a port::
235
236    testpmd> show port (port_id) rss-hash [key]
237
238 clear port
239 ~~~~~~~~~~
240
241 Clear the port statistics for a given port or for all ports::
242
243    testpmd> clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)
244
245 For example::
246
247    testpmd> clear port stats all
248
249 show (rxq|txq)
250 ~~~~~~~~~~~~~~
251
252 Display information for a given port's RX/TX queue::
253
254    testpmd> show (rxq|txq) info (port_id) (queue_id)
255
256 show config
257 ~~~~~~~~~~~
258
259 Displays the configuration of the application.
260 The configuration comes from the command-line, the runtime or the application defaults::
261
262    testpmd> show config (rxtx|cores|fwd|txpkts)
263
264 The available information categories are:
265
266 * ``rxtx``: RX/TX configuration items.
267
268 * ``cores``: List of forwarding cores.
269
270 * ``fwd``: Packet forwarding configuration.
271
272 * ``txpkts``: Packets to TX configuration.
273
274 For example:
275
276 .. code-block:: console
277
278    testpmd> show config rxtx
279
280    io packet forwarding - CRC stripping disabled - packets/burst=16
281    nb forwarding cores=2 - nb forwarding ports=1
282    RX queues=1 - RX desc=128 - RX free threshold=0
283    RX threshold registers: pthresh=8 hthresh=8 wthresh=4
284    TX queues=1 - TX desc=512 - TX free threshold=0
285    TX threshold registers: pthresh=36 hthresh=0 wthresh=0
286    TX RS bit threshold=0 - TXQ flags=0x0
287
288 set fwd
289 ~~~~~~~
290
291 Set the packet forwarding mode::
292
293    testpmd> set fwd (io|mac|macswap|flowgen| \
294                      rxonly|txonly|csum|icmpecho|noisy) (""|retry)
295
296 ``retry`` can be specified for forwarding engines except ``rx_only``.
297
298 The available information categories are:
299
300 * ``io``: Forwards packets "as-is" in I/O mode.
301   This is the fastest possible forwarding operation as it does not access packets data.
302   This is the default mode.
303
304 * ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them.
305   Default application behavior is to set source Ethernet address to that of the transmitting interface, and destination
306   address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or
307   'eth-peers-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address.
308
309 * ``macswap``: MAC swap forwarding mode.
310   Swaps the source and the destination Ethernet addresses of packets before forwarding them.
311
312 * ``flowgen``: Multi-flow generation mode.
313   Originates a number of flows (with varying destination IP addresses), and terminate receive traffic.
314
315 * ``rxonly``: Receives packets but doesn't transmit them.
316
317 * ``txonly``: Generates and transmits packets without receiving any.
318
319 * ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet.
320
321 * ``icmpecho``: Receives a burst of packets, lookup for ICMP echo requests and, if any, send back ICMP echo replies.
322
323 * ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX. Requires ``CONFIG_RTE_LIBRTE_IEEE1588=y``.
324
325 * ``softnic``: Demonstrates the softnic forwarding operation. In this mode, packet forwarding is
326   similar to I/O mode except for the fact that packets are loopback to the softnic ports only. Therefore, portmask parameter should be set to softnic port only. The various software based custom NIC pipelines specified through the softnic firmware (DPDK packet framework script) can be tested in this mode. Furthermore, it allows to build 5-level hierarchical QoS scheduler as a default option that can be enabled through CLI once testpmd application is initialised. The user can modify the default scheduler hierarchy or can specify the new QoS Scheduler hierarchy through CLI. Requires ``CONFIG_RTE_LIBRTE_PMD_SOFTNIC=y``.
327
328 * ``noisy``: Noisy neighbor simulation.
329   Simulate more realistic behavior of a guest machine engaged in receiving
330   and sending packets performing Virtual Network Function (VNF).
331
332 Example::
333
334    testpmd> set fwd rxonly
335
336    Set rxonly packet forwarding mode
337
338
339 read rxd
340 ~~~~~~~~
341
342 Display an RX descriptor for a port RX queue::
343
344    testpmd> read rxd (port_id) (queue_id) (rxd_id)
345
346 For example::
347
348    testpmd> read rxd 0 0 4
349         0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180
350
351 read txd
352 ~~~~~~~~
353
354 Display a TX descriptor for a port TX queue::
355
356    testpmd> read txd (port_id) (queue_id) (txd_id)
357
358 For example::
359
360    testpmd> read txd 0 0 4
361         0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
362
363 ddp get list
364 ~~~~~~~~~~~~
365
366 Get loaded dynamic device personalization (DDP) package info list::
367
368    testpmd> ddp get list (port_id)
369
370 ddp get info
371 ~~~~~~~~~~~~
372
373 Display information about dynamic device personalization (DDP) profile::
374
375    testpmd> ddp get info (profile_path)
376
377 show vf stats
378 ~~~~~~~~~~~~~
379
380 Display VF statistics::
381
382    testpmd> show vf stats (port_id) (vf_id)
383
384 clear vf stats
385 ~~~~~~~~~~~~~~
386
387 Reset VF statistics::
388
389    testpmd> clear vf stats (port_id) (vf_id)
390
391 show port pctype mapping
392 ~~~~~~~~~~~~~~~~~~~~~~~~
393
394 List all items from the pctype mapping table::
395
396    testpmd> show port (port_id) pctype mapping
397
398 show rx offloading capabilities
399 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
400
401 List all per queue and per port Rx offloading capabilities of a port::
402
403    testpmd> show port (port_id) rx_offload capabilities
404
405 show rx offloading configuration
406 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
407
408 List port level and all queue level Rx offloading configuration::
409
410    testpmd> show port (port_id) rx_offload configuration
411
412 show tx offloading capabilities
413 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
414
415 List all per queue and per port Tx offloading capabilities of a port::
416
417    testpmd> show port (port_id) tx_offload capabilities
418
419 show tx offloading configuration
420 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
421
422 List port level and all queue level Tx offloading configuration::
423
424    testpmd> show port (port_id) tx_offload configuration
425
426 show tx metadata setting
427 ~~~~~~~~~~~~~~~~~~~~~~~~
428
429 Show Tx metadata value set for a specific port::
430
431    testpmd> show port (port_id) tx_metadata
432
433 dump physmem
434 ~~~~~~~~~~~~
435
436 Dumps all physical memory segment layouts::
437
438    testpmd> dump_physmem
439
440 dump memzone
441 ~~~~~~~~~~~~
442
443 Dumps the layout of all memory zones::
444
445    testpmd> dump_memzone
446
447
448 dump struct size
449 ~~~~~~~~~~~~~~~~
450
451 Dumps the size of all memory structures::
452
453    testpmd> dump_struct_sizes
454
455 dump ring
456 ~~~~~~~~~
457
458 Dumps the status of all or specific element in DPDK rings::
459
460    testpmd> dump_ring [ring_name]
461
462 dump mempool
463 ~~~~~~~~~~~~
464
465 Dumps the statistics of all or specific memory pool::
466
467    testpmd> dump_mempool [mempool_name]
468
469 dump devargs
470 ~~~~~~~~~~~~
471
472 Dumps the user device list::
473
474    testpmd> dump_devargs
475
476 dump log types
477 ~~~~~~~~~~~~~~
478
479 Dumps the log level for all the dpdk modules::
480
481    testpmd> dump_log_types
482
483 Configuration Functions
484 -----------------------
485
486 The testpmd application can be configured from the runtime as well as from the command-line.
487
488 This section details the available configuration functions that are available.
489
490 .. note::
491
492    Configuration changes only become active when forwarding is started/restarted.
493
494 set default
495 ~~~~~~~~~~~
496
497 Reset forwarding to the default configuration::
498
499    testpmd> set default
500
501 set verbose
502 ~~~~~~~~~~~
503
504 Set the debug verbosity level::
505
506    testpmd> set verbose (level)
507
508 Available levels are as following:
509
510 * ``0`` silent except for error.
511 * ``1`` fully verbose except for Tx packets.
512 * ``2`` fully verbose except for Rx packets.
513 * ``> 2`` fully verbose.
514
515 set log
516 ~~~~~~~
517
518 Set the log level for a log type::
519
520         testpmd> set log global|(type) (level)
521
522 Where:
523
524 * ``type`` is the log name.
525
526 * ``level`` is the log level.
527
528 For example, to change the global log level::
529
530         testpmd> set log global (level)
531
532 Regexes can also be used for type. To change log level of user1, user2 and user3::
533
534         testpmd> set log user[1-3] (level)
535
536 set nbport
537 ~~~~~~~~~~
538
539 Set the number of ports used by the application:
540
541 set nbport (num)
542
543 This is equivalent to the ``--nb-ports`` command-line option.
544
545 set nbcore
546 ~~~~~~~~~~
547
548 Set the number of cores used by the application::
549
550    testpmd> set nbcore (num)
551
552 This is equivalent to the ``--nb-cores`` command-line option.
553
554 .. note::
555
556    The number of cores used must not be greater than number of ports used multiplied by the number of queues per port.
557
558 set coremask
559 ~~~~~~~~~~~~
560
561 Set the forwarding cores hexadecimal mask::
562
563    testpmd> set coremask (mask)
564
565 This is equivalent to the ``--coremask`` command-line option.
566
567 .. note::
568
569    The master lcore is reserved for command line parsing only and cannot be masked on for packet forwarding.
570
571 set portmask
572 ~~~~~~~~~~~~
573
574 Set the forwarding ports hexadecimal mask::
575
576    testpmd> set portmask (mask)
577
578 This is equivalent to the ``--portmask`` command-line option.
579
580 set burst
581 ~~~~~~~~~
582
583 Set number of packets per burst::
584
585    testpmd> set burst (num)
586
587 This is equivalent to the ``--burst command-line`` option.
588
589 When retry is enabled, the transmit delay time and number of retries can also be set::
590
591    testpmd> set burst tx delay (microseconds) retry (num)
592
593 set txpkts
594 ~~~~~~~~~~
595
596 Set the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode::
597
598    testpmd> set txpkts (x[,y]*)
599
600 Where x[,y]* represents a CSV list of values, without white space.
601
602 set txsplit
603 ~~~~~~~~~~~
604
605 Set the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes::
606
607    testpmd> set txsplit (off|on|rand)
608
609 Where:
610
611 * ``off`` disable packet copy & split for CSUM mode.
612
613 * ``on`` split outgoing packet into multiple segments. Size of each segment
614   and number of segments per packet is determined by ``set txpkts`` command
615   (see above).
616
617 * ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments.
618
619 set corelist
620 ~~~~~~~~~~~~
621
622 Set the list of forwarding cores::
623
624    testpmd> set corelist (x[,y]*)
625
626 For example, to change the forwarding cores:
627
628 .. code-block:: console
629
630    testpmd> set corelist 3,1
631    testpmd> show config fwd
632
633    io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled
634    Logical Core 3 (socket 0) forwards packets on 1 streams:
635    RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
636    Logical Core 1 (socket 0) forwards packets on 1 streams:
637    RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
638
639 .. note::
640
641    The cores are used in the same order as specified on the command line.
642
643 set portlist
644 ~~~~~~~~~~~~
645
646 Set the list of forwarding ports::
647
648    testpmd> set portlist (x[,y]*)
649
650 For example, to change the port forwarding:
651
652 .. code-block:: console
653
654    testpmd> set portlist 0,2,1,3
655    testpmd> show config fwd
656
657    io packet forwarding - ports=4 - cores=1 - streams=4
658    Logical Core 3 (socket 0) forwards packets on 4 streams:
659    RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01
660    RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
661    RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03
662    RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02
663
664 set port setup on
665 ~~~~~~~~~~~~~~~~~
666
667 Select how to retrieve new ports created after "port attach" command::
668
669    testpmd> set port setup on (iterator|event)
670
671 For each new port, a setup is done.
672 It will find the probed ports via RTE_ETH_FOREACH_MATCHING_DEV loop
673 in iterator mode, or via RTE_ETH_EVENT_NEW in event mode.
674
675 set tx loopback
676 ~~~~~~~~~~~~~~~
677
678 Enable/disable tx loopback::
679
680    testpmd> set tx loopback (port_id) (on|off)
681
682 set drop enable
683 ~~~~~~~~~~~~~~~
684
685 set drop enable bit for all queues::
686
687    testpmd> set all queues drop (port_id) (on|off)
688
689 set split drop enable (for VF)
690 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
691
692 set split drop enable bit for VF from PF::
693
694    testpmd> set vf split drop (port_id) (vf_id) (on|off)
695
696 set mac antispoof (for VF)
697 ~~~~~~~~~~~~~~~~~~~~~~~~~~
698
699 Set mac antispoof for a VF from the PF::
700
701    testpmd> set vf mac antispoof  (port_id) (vf_id) (on|off)
702
703 set macsec offload
704 ~~~~~~~~~~~~~~~~~~
705
706 Enable/disable MACsec offload::
707
708    testpmd> set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)
709    testpmd> set macsec offload (port_id) off
710
711 set macsec sc
712 ~~~~~~~~~~~~~
713
714 Configure MACsec secure connection (SC)::
715
716    testpmd> set macsec sc (tx|rx) (port_id) (mac) (pi)
717
718 .. note::
719
720    The pi argument is ignored for tx.
721    Check the NIC Datasheet for hardware limits.
722
723 set macsec sa
724 ~~~~~~~~~~~~~
725
726 Configure MACsec secure association (SA)::
727
728    testpmd> set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)
729
730 .. note::
731
732    The IDX value must be 0 or 1.
733    Check the NIC Datasheet for hardware limits.
734
735 set broadcast mode (for VF)
736 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
737
738 Set broadcast mode for a VF from the PF::
739
740    testpmd> set vf broadcast (port_id) (vf_id) (on|off)
741
742 vlan set strip
743 ~~~~~~~~~~~~~~
744
745 Set the VLAN strip on a port::
746
747    testpmd> vlan set strip (on|off) (port_id)
748
749 vlan set stripq
750 ~~~~~~~~~~~~~~~
751
752 Set the VLAN strip for a queue on a port::
753
754    testpmd> vlan set stripq (on|off) (port_id,queue_id)
755
756 vlan set stripq (for VF)
757 ~~~~~~~~~~~~~~~~~~~~~~~~
758
759 Set VLAN strip for all queues in a pool for a VF from the PF::
760
761    testpmd> set vf vlan stripq (port_id) (vf_id) (on|off)
762
763 vlan set insert (for VF)
764 ~~~~~~~~~~~~~~~~~~~~~~~~
765
766 Set VLAN insert for a VF from the PF::
767
768    testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
769
770 vlan set tag (for VF)
771 ~~~~~~~~~~~~~~~~~~~~~
772
773 Set VLAN tag for a VF from the PF::
774
775    testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
776
777 vlan set antispoof (for VF)
778 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
779
780 Set VLAN antispoof for a VF from the PF::
781
782    testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off)
783
784 vlan set filter
785 ~~~~~~~~~~~~~~~
786
787 Set the VLAN filter on a port::
788
789    testpmd> vlan set filter (on|off) (port_id)
790
791 vlan set qinq
792 ~~~~~~~~~~~~~
793
794 Set the VLAN QinQ (extended queue in queue) on for a port::
795
796    testpmd> vlan set qinq (on|off) (port_id)
797
798 vlan set tpid
799 ~~~~~~~~~~~~~
800
801 Set the inner or outer VLAN TPID for packet filtering on a port::
802
803    testpmd> vlan set (inner|outer) tpid (value) (port_id)
804
805 .. note::
806
807    TPID value must be a 16-bit number (value <= 65536).
808
809 rx_vlan add
810 ~~~~~~~~~~~
811
812 Add a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID::
813
814    testpmd> rx_vlan add (vlan_id|all) (port_id)
815
816 .. note::
817
818    VLAN filter must be set on that port. VLAN ID < 4096.
819    Depending on the NIC used, number of vlan_ids may be limited to the maximum entries
820    in VFTA table. This is important if enabling all vlan_ids.
821
822 rx_vlan rm
823 ~~~~~~~~~~
824
825 Remove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID::
826
827    testpmd> rx_vlan rm (vlan_id|all) (port_id)
828
829 rx_vlan add (for VF)
830 ~~~~~~~~~~~~~~~~~~~~
831
832 Add a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID::
833
834    testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask)
835
836 rx_vlan rm (for VF)
837 ~~~~~~~~~~~~~~~~~~~
838
839 Remove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID::
840
841    testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask)
842
843 tunnel_filter add
844 ~~~~~~~~~~~~~~~~~
845
846 Add a tunnel filter on a port::
847
848    testpmd> tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) \
849             (inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\
850             imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)
851
852 The available information categories are:
853
854 * ``vxlan``: Set tunnel type as VXLAN.
855
856 * ``nvgre``: Set tunnel type as NVGRE.
857
858 * ``ipingre``: Set tunnel type as IP-in-GRE.
859
860 * ``imac-ivlan``: Set filter type as Inner MAC and VLAN.
861
862 * ``imac-ivlan-tenid``: Set filter type as Inner MAC, VLAN and tenant ID.
863
864 * ``imac-tenid``: Set filter type as Inner MAC and tenant ID.
865
866 * ``imac``: Set filter type as Inner MAC.
867
868 * ``omac-imac-tenid``: Set filter type as Outer MAC, Inner MAC and tenant ID.
869
870 * ``oip``: Set filter type as Outer IP.
871
872 * ``iip``: Set filter type as Inner IP.
873
874 Example::
875
876    testpmd> tunnel_filter add 0 68:05:CA:28:09:82 00:00:00:00:00:00 \
877             192.168.2.2 0 ipingre oip 1 1
878
879    Set an IP-in-GRE tunnel on port 0, and the filter type is Outer IP.
880
881 tunnel_filter remove
882 ~~~~~~~~~~~~~~~~~~~~
883
884 Remove a tunnel filter on a port::
885
886    testpmd> tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) \
887             (inner_vlan) (vxlan|nvgre|ipingre) (imac-ivlan|imac-ivlan-tenid|\
888             imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)
889
890 rx_vxlan_port add
891 ~~~~~~~~~~~~~~~~~
892
893 Add an UDP port for VXLAN packet filter on a port::
894
895    testpmd> rx_vxlan_port add (udp_port) (port_id)
896
897 rx_vxlan_port remove
898 ~~~~~~~~~~~~~~~~~~~~
899
900 Remove an UDP port for VXLAN packet filter on a port::
901
902    testpmd> rx_vxlan_port rm (udp_port) (port_id)
903
904 tx_vlan set
905 ~~~~~~~~~~~
906
907 Set hardware insertion of VLAN IDs in packets sent on a port::
908
909    testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer]
910
911 For example, set a single VLAN ID (5) insertion on port 0::
912
913    tx_vlan set 0 5
914
915 Or, set double VLAN ID (inner: 2, outer: 3) insertion on port 1::
916
917    tx_vlan set 1 2 3
918
919
920 tx_vlan set pvid
921 ~~~~~~~~~~~~~~~~
922
923 Set port based hardware insertion of VLAN ID in packets sent on a port::
924
925    testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off)
926
927 tx_vlan reset
928 ~~~~~~~~~~~~~
929
930 Disable hardware insertion of a VLAN header in packets sent on a port::
931
932    testpmd> tx_vlan reset (port_id)
933
934 csum set
935 ~~~~~~~~
936
937 Select hardware or software calculation of the checksum when
938 transmitting a packet using the ``csum`` forwarding engine::
939
940    testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)
941
942 Where:
943
944 * ``ip|udp|tcp|sctp`` always relate to  the inner layer.
945
946 * ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized
947   as a tunnel packet by the forwarding engine (vxlan, gre and ipip are
948   supported). See also the ``csum parse-tunnel`` command.
949
950 * ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized
951   as a tunnel packet by the forwarding engine (vxlan, vxlan-gpe are
952   supported). See also the ``csum parse-tunnel`` command.
953
954 .. note::
955
956    Check the NIC Datasheet for hardware limits.
957
958 RSS queue region
959 ~~~~~~~~~~~~~~~~
960
961 Set RSS queue region span on a port::
962
963    testpmd> set port (port_id) queue-region region_id (value) \
964                 queue_start_index (value) queue_num (value)
965
966 Set flowtype mapping on a RSS queue region on a port::
967
968    testpmd> set port (port_id) queue-region region_id (value) flowtype (value)
969
970 where:
971
972 * For the flowtype(pctype) of packet,the specific index for each type has
973   been defined in file i40e_type.h as enum i40e_filter_pctype.
974
975 Set user priority mapping on a RSS queue region on a port::
976
977    testpmd> set port (port_id) queue-region UP (value) region_id (value)
978
979 Flush all queue region related configuration on a port::
980
981    testpmd> set port (port_id) queue-region flush (on|off)
982
983 where:
984
985 * ``on``: is just an enable function which server for other configuration,
986   it is for all configuration about queue region from up layer,
987   at first will only keep in DPDK software stored in driver,
988   only after "flush on", it commit all configuration to HW.
989
990 * ``off``: is just clean all configuration about queue region just now,
991   and restore all to DPDK i40e driver default config when start up.
992
993 Show all queue region related configuration info on a port::
994
995    testpmd> show port (port_id) queue-region
996
997 .. note::
998
999   Queue region only support on PF by now, so these command is
1000   only for configuration of queue region on PF port.
1001
1002 csum parse-tunnel
1003 ~~~~~~~~~~~~~~~~~
1004
1005 Define how tunneled packets should be handled by the csum forward
1006 engine::
1007
1008    testpmd> csum parse-tunnel (on|off) (tx_port_id)
1009
1010 If enabled, the csum forward engine will try to recognize supported
1011 tunnel headers (vxlan, gre, ipip).
1012
1013 If disabled, treat tunnel packets as non-tunneled packets (a inner
1014 header is handled as a packet payload).
1015
1016 .. note::
1017
1018    The port argument is the TX port like in the ``csum set`` command.
1019
1020 Example:
1021
1022 Consider a packet in packet like the following::
1023
1024    eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in
1025
1026 * If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1027   command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the
1028   ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ipv4_out`` and ``udp_out``).
1029
1030 * If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum  set``
1031    command relate to the outer headers, here ``ipv4_out`` and ``udp_out``.
1032
1033 csum show
1034 ~~~~~~~~~
1035
1036 Display tx checksum offload configuration::
1037
1038    testpmd> csum show (port_id)
1039
1040 tso set
1041 ~~~~~~~
1042
1043 Enable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine::
1044
1045    testpmd> tso set (segsize) (port_id)
1046
1047 .. note::
1048
1049    Check the NIC datasheet for hardware limits.
1050
1051 tso show
1052 ~~~~~~~~
1053
1054 Display the status of TCP Segmentation Offload::
1055
1056    testpmd> tso show (port_id)
1057
1058 tunnel tso set
1059 ~~~~~~~~~~~~~~
1060
1061 Set tso segment size of tunneled packets for a port in csum engine::
1062
1063    testpmd> tunnel_tso set (tso_segsz) (port_id)
1064
1065 tunnel tso show
1066 ~~~~~~~~~~~~~~~
1067
1068 Display the status of tunneled TCP Segmentation Offload for a port::
1069
1070    testpmd> tunnel_tso show (port_id)
1071
1072 set port - gro
1073 ~~~~~~~~~~~~~~
1074
1075 Enable or disable GRO in ``csum`` forwarding engine::
1076
1077    testpmd> set port <port_id> gro on|off
1078
1079 If enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
1080 packets received from the given port.
1081
1082 If disabled, packets received from the given port won't be performed
1083 GRO. By default, GRO is disabled for all ports.
1084
1085 .. note::
1086
1087    When enable GRO for a port, TCP/IPv4 packets received from the port
1088    will be performed GRO. After GRO, all merged packets have bad
1089    checksums, since the GRO library doesn't re-calculate checksums for
1090    the merged packets. Therefore, if users want the merged packets to
1091    have correct checksums, please select HW IP checksum calculation and
1092    HW TCP checksum calculation for the port which the merged packets are
1093    transmitted to.
1094
1095 show port - gro
1096 ~~~~~~~~~~~~~~~
1097
1098 Display GRO configuration for a given port::
1099
1100    testpmd> show port <port_id> gro
1101
1102 set gro flush
1103 ~~~~~~~~~~~~~
1104
1105 Set the cycle to flush the GROed packets from reassembly tables::
1106
1107    testpmd> set gro flush <cycles>
1108
1109 When enable GRO, the csum forwarding engine performs GRO on received
1110 packets, and the GROed packets are stored in reassembly tables. Users
1111 can use this command to determine when the GROed packets are flushed
1112 from the reassembly tables.
1113
1114 The ``cycles`` is measured in GRO operation times. The csum forwarding
1115 engine flushes the GROed packets from the tables every ``cycles`` GRO
1116 operations.
1117
1118 By default, the value of ``cycles`` is 1, which means flush GROed packets
1119 from the reassembly tables as soon as one GRO operation finishes. The value
1120 of ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
1121
1122 Please note that the large value of ``cycles`` may cause the poor TCP/IP
1123 stack performance. Because the GROed packets are delayed to arrive the
1124 stack, thus causing more duplicated ACKs and TCP retransmissions.
1125
1126 set port - gso
1127 ~~~~~~~~~~~~~~
1128
1129 Toggle per-port GSO support in ``csum`` forwarding engine::
1130
1131    testpmd> set port <port_id> gso on|off
1132
1133 If enabled, the csum forwarding engine will perform GSO on supported IPv4
1134 packets, transmitted on the given port.
1135
1136 If disabled, packets transmitted on the given port will not undergo GSO.
1137 By default, GSO is disabled for all ports.
1138
1139 .. note::
1140
1141    When GSO is enabled on a port, supported IPv4 packets transmitted on that
1142    port undergo GSO. Afterwards, the segmented packets are represented by
1143    multi-segment mbufs; however, the csum forwarding engine doesn't calculation
1144    of checksums for GSO'd segments in SW. As a result, if users want correct
1145    checksums in GSO segments, they should enable HW checksum calculation for
1146    GSO-enabled ports.
1147
1148    For example, HW checksum calculation for VxLAN GSO'd packets may be enabled
1149    by setting the following options in the csum forwarding engine:
1150
1151    testpmd> csum set outer_ip hw <port_id>
1152
1153    testpmd> csum set ip hw <port_id>
1154
1155    testpmd> csum set tcp hw <port_id>
1156
1157    UDP GSO is the same as IP fragmentation, which treats the UDP header
1158    as the payload and does not modify it during segmentation. That is,
1159    after UDP GSO, only the first output fragment has the original UDP
1160    header. Therefore, users need to enable HW IP checksum calculation
1161    and SW UDP checksum calculation for GSO-enabled ports, if they want
1162    correct checksums for UDP/IPv4 packets.
1163
1164 set gso segsz
1165 ~~~~~~~~~~~~~
1166
1167 Set the maximum GSO segment size (measured in bytes), which includes the
1168 packet header and the packet payload for GSO-enabled ports (global)::
1169
1170    testpmd> set gso segsz <length>
1171
1172 show port - gso
1173 ~~~~~~~~~~~~~~~
1174
1175 Display the status of Generic Segmentation Offload for a given port::
1176
1177    testpmd> show port <port_id> gso
1178
1179 mac_addr add
1180 ~~~~~~~~~~~~
1181
1182 Add an alternative MAC address to a port::
1183
1184    testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)
1185
1186 mac_addr remove
1187 ~~~~~~~~~~~~~~~
1188
1189 Remove a MAC address from a port::
1190
1191    testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)
1192
1193 mcast_addr add
1194 ~~~~~~~~~~~~~~
1195
1196 To add the multicast MAC address to/from the set of multicast addresses
1197 filtered by port::
1198
1199    testpmd> mcast_addr add (port_id) (mcast_addr)
1200
1201 mcast_addr remove
1202 ~~~~~~~~~~~~~~~~~
1203
1204 To remove the multicast MAC address to/from the set of multicast addresses
1205 filtered by port::
1206
1207    testpmd> mcast_addr remove (port_id) (mcast_addr)
1208
1209 mac_addr add (for VF)
1210 ~~~~~~~~~~~~~~~~~~~~~
1211
1212 Add an alternative MAC address for a VF to a port::
1213
1214    testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX)
1215
1216 mac_addr set
1217 ~~~~~~~~~~~~
1218
1219 Set the default MAC address for a port::
1220
1221    testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
1222
1223 mac_addr set (for VF)
1224 ~~~~~~~~~~~~~~~~~~~~~
1225
1226 Set the MAC address for a VF from the PF::
1227
1228    testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)
1229
1230 set eth-peer
1231 ~~~~~~~~~~~~
1232
1233 Set the forwarding peer address for certain port::
1234
1235    testpmd> set eth-peer (port_id) (peer_addr)
1236
1237 This is equivalent to the ``--eth-peer`` command-line option.
1238
1239 set port-uta
1240 ~~~~~~~~~~~~
1241
1242 Set the unicast hash filter(s) on/off for a port::
1243
1244    testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off)
1245
1246 set promisc
1247 ~~~~~~~~~~~
1248
1249 Set the promiscuous mode on for a port or for all ports.
1250 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1251
1252    testpmd> set promisc (port_id|all) (on|off)
1253
1254 set allmulti
1255 ~~~~~~~~~~~~
1256
1257 Set the allmulti mode for a port or for all ports::
1258
1259    testpmd> set allmulti (port_id|all) (on|off)
1260
1261 Same as the ifconfig (8) option. Controls how multicast packets are handled.
1262
1263 set promisc (for VF)
1264 ~~~~~~~~~~~~~~~~~~~~
1265
1266 Set the unicast promiscuous mode for a VF from PF.
1267 It's supported by Intel i40e NICs now.
1268 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1269
1270    testpmd> set vf promisc (port_id) (vf_id) (on|off)
1271
1272 set allmulticast (for VF)
1273 ~~~~~~~~~~~~~~~~~~~~~~~~~
1274
1275 Set the multicast promiscuous mode for a VF from PF.
1276 It's supported by Intel i40e NICs now.
1277 In promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1278
1279    testpmd> set vf allmulti (port_id) (vf_id) (on|off)
1280
1281 set tx max bandwidth (for VF)
1282 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1283
1284 Set TX max absolute bandwidth (Mbps) for a VF from PF::
1285
1286    testpmd> set vf tx max-bandwidth (port_id) (vf_id) (max_bandwidth)
1287
1288 set tc tx min bandwidth (for VF)
1289 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1290
1291 Set all TCs' TX min relative bandwidth (%) for a VF from PF::
1292
1293    testpmd> set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)
1294
1295 set tc tx max bandwidth (for VF)
1296 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1297
1298 Set a TC's TX max absolute bandwidth (Mbps) for a VF from PF::
1299
1300    testpmd> set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (max_bandwidth)
1301
1302 set tc strict link priority mode
1303 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1304
1305 Set some TCs' strict link priority mode on a physical port::
1306
1307    testpmd> set tx strict-link-priority (port_id) (tc_bitmap)
1308
1309 set tc tx min bandwidth
1310 ~~~~~~~~~~~~~~~~~~~~~~~
1311
1312 Set all TCs' TX min relative bandwidth (%) globally for all PF and VFs::
1313
1314    testpmd> set tc tx min-bandwidth (port_id) (bw1, bw2, ...)
1315
1316 set flow_ctrl rx
1317 ~~~~~~~~~~~~~~~~
1318
1319 Set the link flow control parameter on a port::
1320
1321    testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1322             (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \
1323             autoneg (on|off) (port_id)
1324
1325 Where:
1326
1327 * ``high_water`` (integer): High threshold value to trigger XOFF.
1328
1329 * ``low_water`` (integer): Low threshold value to trigger XON.
1330
1331 * ``pause_time`` (integer): Pause quota in the Pause frame.
1332
1333 * ``send_xon`` (0/1): Send XON frame.
1334
1335 * ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames.
1336
1337 * ``autoneg``: Change the auto-negotiation parameter.
1338
1339 set pfc_ctrl rx
1340 ~~~~~~~~~~~~~~~
1341
1342 Set the priority flow control parameter on a port::
1343
1344    testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1345             (pause_time) (priority) (port_id)
1346
1347 Where:
1348
1349 * ``high_water`` (integer): High threshold value.
1350
1351 * ``low_water`` (integer): Low threshold value.
1352
1353 * ``pause_time`` (integer): Pause quota in the Pause frame.
1354
1355 * ``priority`` (0-7): VLAN User Priority.
1356
1357 set stat_qmap
1358 ~~~~~~~~~~~~~
1359
1360 Set statistics mapping (qmapping 0..15) for RX/TX queue on port::
1361
1362    testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)
1363
1364 For example, to set rx queue 2 on port 0 to mapping 5::
1365
1366    testpmd>set stat_qmap rx 0 2 5
1367
1368 set xstats-hide-zero
1369 ~~~~~~~~~~~~~~~~~~~~
1370
1371 Set the option to hide zero values for xstats display::
1372
1373         testpmd> set xstats-hide-zero on|off
1374
1375 .. note::
1376
1377         By default, the zero values are displayed for xstats.
1378
1379 set port - rx/tx (for VF)
1380 ~~~~~~~~~~~~~~~~~~~~~~~~~
1381
1382 Set VF receive/transmit from a port::
1383
1384    testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1385
1386 set port - mac address filter (for VF)
1387 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1388
1389 Add/Remove unicast or multicast MAC addr filter for a VF::
1390
1391    testpmd> set port (port_id) vf (vf_id) (mac_addr) \
1392             (exact-mac|exact-mac-vlan|hashmac|hashmac-vlan) (on|off)
1393
1394 set port - rx mode(for VF)
1395 ~~~~~~~~~~~~~~~~~~~~~~~~~~
1396
1397 Set the VF receive mode of a port::
1398
1399    testpmd> set port (port_id) vf (vf_id) \
1400             rxmode (AUPE|ROPE|BAM|MPE) (on|off)
1401
1402 The available receive modes are:
1403
1404 * ``AUPE``: Accepts untagged VLAN.
1405
1406 * ``ROPE``: Accepts unicast hash.
1407
1408 * ``BAM``: Accepts broadcast packets.
1409
1410 * ``MPE``: Accepts all multicast packets.
1411
1412 set port - tx_rate (for Queue)
1413 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1414
1415 Set TX rate limitation for a queue on a port::
1416
1417    testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1418
1419 set port - tx_rate (for VF)
1420 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1421
1422 Set TX rate limitation for queues in VF on a port::
1423
1424    testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
1425
1426 set port - mirror rule
1427 ~~~~~~~~~~~~~~~~~~~~~~
1428
1429 Set pool or vlan type mirror rule for a port::
1430
1431    testpmd> set port (port_id) mirror-rule (rule_id) \
1432             (pool-mirror-up|pool-mirror-down|vlan-mirror) \
1433             (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off)
1434
1435 Set link mirror rule for a port::
1436
1437    testpmd> set port (port_id) mirror-rule (rule_id) \
1438            (uplink-mirror|downlink-mirror) dst-pool (pool_id) (on|off)
1439
1440 For example to enable mirror traffic with vlan 0,1 to pool 0::
1441
1442    set port 0 mirror-rule 0 vlan-mirror 0,1 dst-pool 0 on
1443
1444 reset port - mirror rule
1445 ~~~~~~~~~~~~~~~~~~~~~~~~
1446
1447 Reset a mirror rule for a port::
1448
1449    testpmd> reset port (port_id) mirror-rule (rule_id)
1450
1451 set flush_rx
1452 ~~~~~~~~~~~~
1453
1454 Set the flush on RX streams before forwarding.
1455 The default is flush ``on``.
1456 Mainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams::
1457
1458    testpmd> set flush_rx off
1459
1460 set bypass mode
1461 ~~~~~~~~~~~~~~~
1462
1463 Set the bypass mode for the lowest port on bypass enabled NIC::
1464
1465    testpmd> set bypass mode (normal|bypass|isolate) (port_id)
1466
1467 set bypass event
1468 ~~~~~~~~~~~~~~~~
1469
1470 Set the event required to initiate specified bypass mode for the lowest port on a bypass enabled::
1471
1472    testpmd> set bypass event (timeout|os_on|os_off|power_on|power_off) \
1473             mode (normal|bypass|isolate) (port_id)
1474
1475 Where:
1476
1477 * ``timeout``: Enable bypass after watchdog timeout.
1478
1479 * ``os_on``: Enable bypass when OS/board is powered on.
1480
1481 * ``os_off``: Enable bypass when OS/board is powered off.
1482
1483 * ``power_on``: Enable bypass when power supply is turned on.
1484
1485 * ``power_off``: Enable bypass when power supply is turned off.
1486
1487
1488 set bypass timeout
1489 ~~~~~~~~~~~~~~~~~~
1490
1491 Set the bypass watchdog timeout to ``n`` seconds where 0 = instant::
1492
1493    testpmd> set bypass timeout (0|1.5|2|3|4|8|16|32)
1494
1495 show bypass config
1496 ~~~~~~~~~~~~~~~~~~
1497
1498 Show the bypass configuration for a bypass enabled NIC using the lowest port on the NIC::
1499
1500    testpmd> show bypass config (port_id)
1501
1502 set link up
1503 ~~~~~~~~~~~
1504
1505 Set link up for a port::
1506
1507    testpmd> set link-up port (port id)
1508
1509 set link down
1510 ~~~~~~~~~~~~~
1511
1512 Set link down for a port::
1513
1514    testpmd> set link-down port (port id)
1515
1516 E-tag set
1517 ~~~~~~~~~
1518
1519 Enable E-tag insertion for a VF on a port::
1520
1521    testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
1522
1523 Disable E-tag insertion for a VF on a port::
1524
1525    testpmd> E-tag set insertion off port (port_id) vf (vf_id)
1526
1527 Enable/disable E-tag stripping on a port::
1528
1529    testpmd> E-tag set stripping (on|off) port (port_id)
1530
1531 Enable/disable E-tag based forwarding on a port::
1532
1533    testpmd> E-tag set forwarding (on|off) port (port_id)
1534
1535 Add an E-tag forwarding filter on a port::
1536
1537    testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id) port (port_id)
1538
1539 Delete an E-tag forwarding filter on a port::
1540    testpmd> E-tag set filter del e-tag-id (value) port (port_id)
1541
1542 ddp add
1543 ~~~~~~~
1544
1545 Load a dynamic device personalization (DDP) profile and store backup profile::
1546
1547    testpmd> ddp add (port_id) (profile_path[,backup_profile_path])
1548
1549 ddp del
1550 ~~~~~~~
1551
1552 Delete a dynamic device personalization profile and restore backup profile::
1553
1554    testpmd> ddp del (port_id) (backup_profile_path)
1555
1556 ptype mapping
1557 ~~~~~~~~~~~~~
1558
1559 List all items from the ptype mapping table::
1560
1561    testpmd> ptype mapping get (port_id) (valid_only)
1562
1563 Where:
1564
1565 * ``valid_only``: A flag indicates if only list valid items(=1) or all itemss(=0).
1566
1567 Replace a specific or a group of software defined ptype with a new one::
1568
1569    testpmd> ptype mapping replace  (port_id) (target) (mask) (pkt_type)
1570
1571 where:
1572
1573 * ``target``: A specific software ptype or a mask to represent a group of software ptypes.
1574
1575 * ``mask``: A flag indicate if "target" is a specific software ptype(=0) or a ptype mask(=1).
1576
1577 * ``pkt_type``: The new software ptype to replace the old ones.
1578
1579 Update hardware defined ptype to software defined packet type mapping table::
1580
1581    testpmd> ptype mapping update (port_id) (hw_ptype) (sw_ptype)
1582
1583 where:
1584
1585 * ``hw_ptype``: hardware ptype as the index of the ptype mapping table.
1586
1587 * ``sw_ptype``: software ptype as the value of the ptype mapping table.
1588
1589 Reset ptype mapping table::
1590
1591    testpmd> ptype mapping reset (port_id)
1592
1593 config per port Rx offloading
1594 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1595
1596 Enable or disable a per port Rx offloading on all Rx queues of a port::
1597
1598    testpmd> port config (port_id) rx_offload (offloading) on|off
1599
1600 * ``offloading``: can be any of these offloading capability:
1601                   vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1602                   qinq_strip, outer_ipv4_cksum, macsec_strip,
1603                   header_split, vlan_filter, vlan_extend, jumbo_frame,
1604                   crc_strip, scatter, timestamp, security, keep_crc
1605
1606 This command should be run when the port is stopped, or else it will fail.
1607
1608 config per queue Rx offloading
1609 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1610
1611 Enable or disable a per queue Rx offloading only on a specific Rx queue::
1612
1613    testpmd> port (port_id) rxq (queue_id) rx_offload (offloading) on|off
1614
1615 * ``offloading``: can be any of these offloading capability:
1616                   vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1617                   qinq_strip, outer_ipv4_cksum, macsec_strip,
1618                   header_split, vlan_filter, vlan_extend, jumbo_frame,
1619                   crc_strip, scatter, timestamp, security, keep_crc
1620
1621 This command should be run when the port is stopped, or else it will fail.
1622
1623 config per port Tx offloading
1624 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1625
1626 Enable or disable a per port Tx offloading on all Tx queues of a port::
1627
1628    testpmd> port config (port_id) tx_offload (offloading) on|off
1629
1630 * ``offloading``: can be any of these offloading capability:
1631                   vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1632                   sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1633                   qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1634                   ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1635                   mt_lockfree, multi_segs, mbuf_fast_free, security,
1636                   match_metadata
1637
1638 This command should be run when the port is stopped, or else it will fail.
1639
1640 config per queue Tx offloading
1641 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1642
1643 Enable or disable a per queue Tx offloading only on a specific Tx queue::
1644
1645    testpmd> port (port_id) txq (queue_id) tx_offload (offloading) on|off
1646
1647 * ``offloading``: can be any of these offloading capability:
1648                   vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1649                   sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1650                   qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1651                   ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1652                   mt_lockfree, multi_segs, mbuf_fast_free, security
1653
1654 This command should be run when the port is stopped, or else it will fail.
1655
1656 Config VXLAN Encap outer layers
1657 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1658
1659 Configure the outer layer to encapsulate a packet inside a VXLAN tunnel::
1660
1661  set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1662  udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) \
1663  eth-dst (eth-dst)
1664
1665  set vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
1666  udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1667  eth-src (eth-src) eth-dst (eth-dst)
1668
1669 These commands will set an internal configuration inside testpmd, any following
1670 flow rule using the action vxlan_encap will use the last configuration set.
1671 To have a different encapsulation header, one of those commands must be called
1672 before the flow rule creation.
1673
1674 Config NVGRE Encap outer layers
1675 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1676
1677 Configure the outer layer to encapsulate a packet inside a NVGRE tunnel::
1678
1679  set nvgre ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) ip-dst (ip-dst) \
1680         eth-src (eth-src) eth-dst (eth-dst)
1681  set nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) \
1682         ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1683
1684 These commands will set an internal configuration inside testpmd, any following
1685 flow rule using the action nvgre_encap will use the last configuration set.
1686 To have a different encapsulation header, one of those commands must be called
1687 before the flow rule creation.
1688
1689 Config L2 Encap
1690 ~~~~~~~~~~~~~~~
1691
1692 Configure the l2 to be used when encapsulating a packet with L2::
1693
1694  set l2_encap ip-version (ipv4|ipv6) eth-src (eth-src) eth-dst (eth-dst)
1695  set l2_encap-with-vlan ip-version (ipv4|ipv6) vlan-tci (vlan-tci) \
1696         eth-src (eth-src) eth-dst (eth-dst)
1697
1698 Those commands will set an internal configuration inside testpmd, any following
1699 flow rule using the action l2_encap will use the last configuration set.
1700 To have a different encapsulation header, one of those commands must be called
1701 before the flow rule creation.
1702
1703 Config L2 Decap
1704 ~~~~~~~~~~~~~~~
1705
1706 Configure the l2 to be removed when decapsulating a packet with L2::
1707
1708  set l2_decap ip-version (ipv4|ipv6)
1709  set l2_decap-with-vlan ip-version (ipv4|ipv6)
1710
1711 Those commands will set an internal configuration inside testpmd, any following
1712 flow rule using the action l2_decap will use the last configuration set.
1713 To have a different encapsulation header, one of those commands must be called
1714 before the flow rule creation.
1715
1716 Config MPLSoGRE Encap outer layers
1717 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1718
1719 Configure the outer layer to encapsulate a packet inside a MPLSoGRE tunnel::
1720
1721  set mplsogre_encap ip-version (ipv4|ipv6) label (label) \
1722         ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
1723  set mplsogre_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1724         ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
1725         eth-src (eth-src) eth-dst (eth-dst)
1726
1727 These commands will set an internal configuration inside testpmd, any following
1728 flow rule using the action mplsogre_encap will use the last configuration set.
1729 To have a different encapsulation header, one of those commands must be called
1730 before the flow rule creation.
1731
1732 Config MPLSoGRE Decap outer layers
1733 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1734
1735 Configure the outer layer to decapsulate MPLSoGRE packet::
1736
1737  set mplsogre_decap ip-version (ipv4|ipv6)
1738  set mplsogre_decap-with-vlan ip-version (ipv4|ipv6)
1739
1740 These commands will set an internal configuration inside testpmd, any following
1741 flow rule using the action mplsogre_decap will use the last configuration set.
1742 To have a different decapsulation header, one of those commands must be called
1743 before the flow rule creation.
1744
1745 Config MPLSoUDP Encap outer layers
1746 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1747
1748 Configure the outer layer to encapsulate a packet inside a MPLSoUDP tunnel::
1749
1750  set mplsoudp_encap ip-version (ipv4|ipv6) label (label) udp-src (udp-src) \
1751         udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1752         eth-src (eth-src) eth-dst (eth-dst)
1753  set mplsoudp_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1754         udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1755         vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1756
1757 These commands will set an internal configuration inside testpmd, any following
1758 flow rule using the action mplsoudp_encap will use the last configuration set.
1759 To have a different encapsulation header, one of those commands must be called
1760 before the flow rule creation.
1761
1762 Config MPLSoUDP Decap outer layers
1763 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1764
1765 Configure the outer layer to decapsulate MPLSoUDP packet::
1766
1767  set mplsoudp_decap ip-version (ipv4|ipv6)
1768  set mplsoudp_decap-with-vlan ip-version (ipv4|ipv6)
1769
1770 These commands will set an internal configuration inside testpmd, any following
1771 flow rule using the action mplsoudp_decap will use the last configuration set.
1772 To have a different decapsulation header, one of those commands must be called
1773 before the flow rule creation.
1774
1775 Port Functions
1776 --------------
1777
1778 The following sections show functions for configuring ports.
1779
1780 .. note::
1781
1782    Port configuration changes only become active when forwarding is started/restarted.
1783
1784 port attach
1785 ~~~~~~~~~~~
1786
1787 Attach a port specified by pci address or virtual device args::
1788
1789    testpmd> port attach (identifier)
1790
1791 To attach a new pci device, the device should be recognized by kernel first.
1792 Then it should be moved under DPDK management.
1793 Finally the port can be attached to testpmd.
1794
1795 For example, to move a pci device using ixgbe under DPDK management:
1796
1797 .. code-block:: console
1798
1799    # Check the status of the available devices.
1800    ./usertools/dpdk-devbind.py --status
1801
1802    Network devices using DPDK-compatible driver
1803    ============================================
1804    <none>
1805
1806    Network devices using kernel driver
1807    ===================================
1808    0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=
1809
1810
1811    # Bind the device to igb_uio.
1812    sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0
1813
1814
1815    # Recheck the status of the devices.
1816    ./usertools/dpdk-devbind.py --status
1817    Network devices using DPDK-compatible driver
1818    ============================================
1819    0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused=
1820
1821 To attach a port created by virtual device, above steps are not needed.
1822
1823 For example, to attach a port whose pci address is 0000:0a:00.0.
1824
1825 .. code-block:: console
1826
1827    testpmd> port attach 0000:0a:00.0
1828    Attaching a new port...
1829    EAL: PCI device 0000:0a:00.0 on NUMA socket -1
1830    EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
1831    EAL:   PCI memory mapped at 0x7f83bfa00000
1832    EAL:   PCI memory mapped at 0x7f83bfa80000
1833    PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5
1834    PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
1835    Port 0 is attached. Now total ports is 1
1836    Done
1837
1838 For example, to attach a port created by pcap PMD.
1839
1840 .. code-block:: console
1841
1842    testpmd> port attach net_pcap0
1843    Attaching a new port...
1844    PMD: Initializing pmd_pcap for net_pcap0
1845    PMD: Creating pcap-backed ethdev on numa socket 0
1846    Port 0 is attached. Now total ports is 1
1847    Done
1848
1849 In this case, identifier is ``net_pcap0``.
1850 This identifier format is the same as ``--vdev`` format of DPDK applications.
1851
1852 For example, to re-attach a bonded port which has been previously detached,
1853 the mode and slave parameters must be given.
1854
1855 .. code-block:: console
1856
1857    testpmd> port attach net_bond_0,mode=0,slave=1
1858    Attaching a new port...
1859    EAL: Initializing pmd_bond for net_bond_0
1860    EAL: Create bonded device net_bond_0 on port 0 in mode 0 on socket 0.
1861    Port 0 is attached. Now total ports is 1
1862    Done
1863
1864
1865 port detach
1866 ~~~~~~~~~~~
1867
1868 Detach a specific port::
1869
1870    testpmd> port detach (port_id)
1871
1872 Before detaching a port, the port should be stopped and closed.
1873
1874 For example, to detach a pci device port 0.
1875
1876 .. code-block:: console
1877
1878    testpmd> port stop 0
1879    Stopping ports...
1880    Done
1881    testpmd> port close 0
1882    Closing ports...
1883    Done
1884
1885    testpmd> port detach 0
1886    Detaching a port...
1887    EAL: PCI device 0000:0a:00.0 on NUMA socket -1
1888    EAL:   remove driver: 8086:10fb rte_ixgbe_pmd
1889    EAL:   PCI memory unmapped at 0x7f83bfa00000
1890    EAL:   PCI memory unmapped at 0x7f83bfa80000
1891    Done
1892
1893
1894 For example, to detach a virtual device port 0.
1895
1896 .. code-block:: console
1897
1898    testpmd> port stop 0
1899    Stopping ports...
1900    Done
1901    testpmd> port close 0
1902    Closing ports...
1903    Done
1904
1905    testpmd> port detach 0
1906    Detaching a port...
1907    PMD: Closing pcap ethdev on numa socket 0
1908    Port 'net_pcap0' is detached. Now total ports is 0
1909    Done
1910
1911 To remove a pci device completely from the system, first detach the port from testpmd.
1912 Then the device should be moved under kernel management.
1913 Finally the device can be removed using kernel pci hotplug functionality.
1914
1915 For example, to move a pci device under kernel management:
1916
1917 .. code-block:: console
1918
1919    sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0
1920
1921    ./usertools/dpdk-devbind.py --status
1922
1923    Network devices using DPDK-compatible driver
1924    ============================================
1925    <none>
1926
1927    Network devices using kernel driver
1928    ===================================
1929    0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio
1930
1931 To remove a port created by a virtual device, above steps are not needed.
1932
1933 port start
1934 ~~~~~~~~~~
1935
1936 Start all ports or a specific port::
1937
1938    testpmd> port start (port_id|all)
1939
1940 port stop
1941 ~~~~~~~~~
1942
1943 Stop all ports or a specific port::
1944
1945    testpmd> port stop (port_id|all)
1946
1947 port close
1948 ~~~~~~~~~~
1949
1950 Close all ports or a specific port::
1951
1952    testpmd> port close (port_id|all)
1953
1954 port config - queue ring size
1955 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1956
1957 Configure a rx/tx queue ring size::
1958
1959    testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
1960
1961 Only take effect after command that (re-)start the port or command that setup specific queue.
1962
1963 port start/stop queue
1964 ~~~~~~~~~~~~~~~~~~~~~
1965
1966 Start/stop a rx/tx queue on a specific port::
1967
1968    testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
1969
1970 port config - queue deferred start
1971 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1972
1973 Switch on/off deferred start of a specific port queue::
1974
1975    testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
1976
1977 port setup queue
1978 ~~~~~~~~~~~~~~~~~~~~~
1979
1980 Setup a rx/tx queue on a specific port::
1981
1982    testpmd> port (port_id) (rxq|txq) (queue_id) setup
1983
1984 Only take effect when port is started.
1985
1986 port config - speed
1987 ~~~~~~~~~~~~~~~~~~~
1988
1989 Set the speed and duplex mode for all ports or a specific port::
1990
1991    testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|auto) \
1992             duplex (half|full|auto)
1993
1994 port config - queues/descriptors
1995 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1996
1997 Set number of queues/descriptors for rxq, txq, rxd and txd::
1998
1999    testpmd> port config all (rxq|txq|rxd|txd) (value)
2000
2001 This is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2002
2003 port config - max-pkt-len
2004 ~~~~~~~~~~~~~~~~~~~~~~~~~
2005
2006 Set the maximum packet length::
2007
2008    testpmd> port config all max-pkt-len (value)
2009
2010 This is equivalent to the ``--max-pkt-len`` command-line option.
2011
2012 port config - CRC Strip
2013 ~~~~~~~~~~~~~~~~~~~~~~~
2014
2015 Set hardware CRC stripping on or off for all ports::
2016
2017    testpmd> port config all crc-strip (on|off)
2018
2019 CRC stripping is on by default.
2020
2021 The ``off`` option is equivalent to the ``--disable-crc-strip`` command-line option.
2022
2023 port config - scatter
2024 ~~~~~~~~~~~~~~~~~~~~~~~
2025
2026 Set RX scatter mode on or off for all ports::
2027
2028    testpmd> port config all scatter (on|off)
2029
2030 RX scatter mode is off by default.
2031
2032 The ``on`` option is equivalent to the ``--enable-scatter`` command-line option.
2033
2034 port config - RX Checksum
2035 ~~~~~~~~~~~~~~~~~~~~~~~~~
2036
2037 Set hardware RX checksum offload to on or off for all ports::
2038
2039    testpmd> port config all rx-cksum (on|off)
2040
2041 Checksum offload is off by default.
2042
2043 The ``on`` option is equivalent to the ``--enable-rx-cksum`` command-line option.
2044
2045 port config - VLAN
2046 ~~~~~~~~~~~~~~~~~~
2047
2048 Set hardware VLAN on or off for all ports::
2049
2050    testpmd> port config all hw-vlan (on|off)
2051
2052 Hardware VLAN is off by default.
2053
2054 The ``on`` option is equivalent to the ``--enable-hw-vlan`` command-line option.
2055
2056 port config - VLAN filter
2057 ~~~~~~~~~~~~~~~~~~~~~~~~~
2058
2059 Set hardware VLAN filter on or off for all ports::
2060
2061    testpmd> port config all hw-vlan-filter (on|off)
2062
2063 Hardware VLAN filter is off by default.
2064
2065 The ``on`` option is equivalent to the ``--enable-hw-vlan-filter`` command-line option.
2066
2067 port config - VLAN strip
2068 ~~~~~~~~~~~~~~~~~~~~~~~~
2069
2070 Set hardware VLAN strip on or off for all ports::
2071
2072    testpmd> port config all hw-vlan-strip (on|off)
2073
2074 Hardware VLAN strip is off by default.
2075
2076 The ``on`` option is equivalent to the ``--enable-hw-vlan-strip`` command-line option.
2077
2078 port config - VLAN extend
2079 ~~~~~~~~~~~~~~~~~~~~~~~~~
2080
2081 Set hardware VLAN extend on or off for all ports::
2082
2083    testpmd> port config all hw-vlan-extend (on|off)
2084
2085 Hardware VLAN extend is off by default.
2086
2087 The ``on`` option is equivalent to the ``--enable-hw-vlan-extend`` command-line option.
2088
2089 port config - Drop Packets
2090 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2091
2092 Set packet drop for packets with no descriptors on or off for all ports::
2093
2094    testpmd> port config all drop-en (on|off)
2095
2096 Packet dropping for packets with no descriptors is off by default.
2097
2098 The ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2099
2100 port config - RSS
2101 ~~~~~~~~~~~~~~~~~
2102
2103 Set the RSS (Receive Side Scaling) mode on or off::
2104
2105    testpmd> port config all rss (all|default|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|none)
2106
2107 RSS is on by default.
2108
2109 The ``all`` option is equivalent to ip|tcp|udp|sctp|ether.
2110 The ``default`` option enables all supported RSS types reported by device info.
2111 The ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2112
2113 port config - RSS Reta
2114 ~~~~~~~~~~~~~~~~~~~~~~
2115
2116 Set the RSS (Receive Side Scaling) redirection table::
2117
2118    testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2119
2120 port config - DCB
2121 ~~~~~~~~~~~~~~~~~
2122
2123 Set the DCB mode for an individual port::
2124
2125    testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2126
2127 The traffic class should be 4 or 8.
2128
2129 port config - Burst
2130 ~~~~~~~~~~~~~~~~~~~
2131
2132 Set the number of packets per burst::
2133
2134    testpmd> port config all burst (value)
2135
2136 This is equivalent to the ``--burst`` command-line option.
2137
2138 port config - Threshold
2139 ~~~~~~~~~~~~~~~~~~~~~~~
2140
2141 Set thresholds for TX/RX queues::
2142
2143    testpmd> port config all (threshold) (value)
2144
2145 Where the threshold type can be:
2146
2147 * ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255.
2148
2149 * ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255.
2150
2151 * ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255.
2152
2153 * ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255.
2154
2155 * ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255.
2156
2157 * ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255.
2158
2159 * ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd.
2160
2161 * ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd.
2162
2163 * ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd.
2164
2165 These threshold options are also available from the command-line.
2166
2167 port config - E-tag
2168 ~~~~~~~~~~~~~~~~~~~
2169
2170 Set the value of ether-type for E-tag::
2171
2172    testpmd> port config (port_id|all) l2-tunnel E-tag ether-type (value)
2173
2174 Enable/disable the E-tag support::
2175
2176    testpmd> port config (port_id|all) l2-tunnel E-tag (enable|disable)
2177
2178 port config pctype mapping
2179 ~~~~~~~~~~~~~~~~~~~~~~~~~~
2180
2181 Reset pctype mapping table::
2182
2183    testpmd> port config (port_id) pctype mapping reset
2184
2185 Update hardware defined pctype to software defined flow type mapping table::
2186
2187    testpmd> port config (port_id) pctype mapping update (pctype_id_0[,pctype_id_1]*) (flow_type_id)
2188
2189 where:
2190
2191 * ``pctype_id_x``: hardware pctype id as index of bit in bitmask value of the pctype mapping table.
2192
2193 * ``flow_type_id``: software flow type id as the index of the pctype mapping table.
2194
2195 port config input set
2196 ~~~~~~~~~~~~~~~~~~~~~
2197
2198 Config RSS/FDIR/FDIR flexible payload input set for some pctype::
2199
2200    testpmd> port config (port_id) pctype (pctype_id) \
2201             (hash_inset|fdir_inset|fdir_flx_inset) \
2202             (get|set|clear) field (field_idx)
2203
2204 Clear RSS/FDIR/FDIR flexible payload input set for some pctype::
2205
2206    testpmd> port config (port_id) pctype (pctype_id) \
2207             (hash_inset|fdir_inset|fdir_flx_inset) clear all
2208
2209 where:
2210
2211 * ``pctype_id``: hardware packet classification types.
2212 * ``field_idx``: hardware field index.
2213
2214 port config udp_tunnel_port
2215 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2216
2217 Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
2218
2219     testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve (udp_port)
2220
2221 port config tx_metadata
2222 ~~~~~~~~~~~~~~~~~~~~~~~
2223
2224 Set Tx metadata value per port.
2225 testpmd will add this value to any Tx packet sent from this port::
2226
2227    testpmd> port config (port_id) tx_metadata (value)
2228
2229 port config mtu
2230 ~~~~~~~~~~~~~~~
2231
2232 To configure MTU(Maximum Transmission Unit) on devices using testpmd::
2233
2234    testpmd> port config mtu (port_id) (value)
2235
2236 port config rss hash key
2237 ~~~~~~~~~~~~~~~~~~~~~~~~
2238
2239 To configure the RSS hash key used to compute the RSS
2240 hash of input [IP] packets received on port::
2241
2242    testpmd> port config <port_id> rss-hash-key (ipv4|ipv4-frag|\
2243                      ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|\
2244                      ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|\
2245                      ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|\
2246                      ipv6-udp-ex <string of hex digits \
2247                      (variable length, NIC dependent)>)
2248
2249 Link Bonding Functions
2250 ----------------------
2251
2252 The Link Bonding functions make it possible to dynamically create and
2253 manage link bonding devices from within testpmd interactive prompt.
2254
2255 create bonded device
2256 ~~~~~~~~~~~~~~~~~~~~
2257
2258 Create a new bonding device::
2259
2260    testpmd> create bonded device (mode) (socket)
2261
2262 For example, to create a bonded device in mode 1 on socket 0::
2263
2264    testpmd> create bonded device 1 0
2265    created new bonded device (port X)
2266
2267 add bonding slave
2268 ~~~~~~~~~~~~~~~~~
2269
2270 Adds Ethernet device to a Link Bonding device::
2271
2272    testpmd> add bonding slave (slave id) (port id)
2273
2274 For example, to add Ethernet device (port 6) to a Link Bonding device (port 10)::
2275
2276    testpmd> add bonding slave 6 10
2277
2278
2279 remove bonding slave
2280 ~~~~~~~~~~~~~~~~~~~~
2281
2282 Removes an Ethernet slave device from a Link Bonding device::
2283
2284    testpmd> remove bonding slave (slave id) (port id)
2285
2286 For example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10)::
2287
2288    testpmd> remove bonding slave 6 10
2289
2290 set bonding mode
2291 ~~~~~~~~~~~~~~~~
2292
2293 Set the Link Bonding mode of a Link Bonding device::
2294
2295    testpmd> set bonding mode (value) (port id)
2296
2297 For example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3)::
2298
2299    testpmd> set bonding mode 3 10
2300
2301 set bonding primary
2302 ~~~~~~~~~~~~~~~~~~~
2303
2304 Set an Ethernet slave device as the primary device on a Link Bonding device::
2305
2306    testpmd> set bonding primary (slave id) (port id)
2307
2308 For example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10)::
2309
2310    testpmd> set bonding primary 6 10
2311
2312 set bonding mac
2313 ~~~~~~~~~~~~~~~
2314
2315 Set the MAC address of a Link Bonding device::
2316
2317    testpmd> set bonding mac (port id) (mac)
2318
2319 For example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01::
2320
2321    testpmd> set bonding mac 10 00:00:00:00:00:01
2322
2323 set bonding xmit_balance_policy
2324 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2325
2326 Set the transmission policy for a Link Bonding device when it is in Balance XOR mode::
2327
2328    testpmd> set bonding xmit_balance_policy (port_id) (l2|l23|l34)
2329
2330 For example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports)::
2331
2332    testpmd> set bonding xmit_balance_policy 10 l34
2333
2334
2335 set bonding mon_period
2336 ~~~~~~~~~~~~~~~~~~~~~~
2337
2338 Set the link status monitoring polling period in milliseconds for a bonding device.
2339
2340 This adds support for PMD slave devices which do not support link status interrupts.
2341 When the mon_period is set to a value greater than 0 then all PMD's which do not support
2342 link status ISR will be queried every polling interval to check if their link status has changed::
2343
2344    testpmd> set bonding mon_period (port_id) (value)
2345
2346 For example, to set the link status monitoring polling period of bonded device (port 5) to 150ms::
2347
2348    testpmd> set bonding mon_period 5 150
2349
2350
2351 set bonding lacp dedicated_queue
2352 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2353
2354 Enable dedicated tx/rx queues on bonding devices slaves to handle LACP control plane traffic
2355 when in mode 4 (link-aggregation-802.3ad)::
2356
2357    testpmd> set bonding lacp dedicated_queues (port_id) (enable|disable)
2358
2359
2360 set bonding agg_mode
2361 ~~~~~~~~~~~~~~~~~~~~
2362
2363 Enable one of the specific aggregators mode when in mode 4 (link-aggregation-802.3ad)::
2364
2365    testpmd> set bonding agg_mode (port_id) (bandwidth|count|stable)
2366
2367
2368 show bonding config
2369 ~~~~~~~~~~~~~~~~~~~
2370
2371 Show the current configuration of a Link Bonding device::
2372
2373    testpmd> show bonding config (port id)
2374
2375 For example,
2376 to show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4)
2377 in balance mode with a transmission policy of layer 2+3::
2378
2379    testpmd> show bonding config 9
2380         Bonding mode: 2
2381         Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23
2382         Slaves (3): [1 3 4]
2383         Active Slaves (3): [1 3 4]
2384         Primary: [3]
2385
2386
2387 Register Functions
2388 ------------------
2389
2390 The Register Functions can be used to read from and write to registers on the network card referenced by a port number.
2391 This is mainly useful for debugging purposes.
2392 Reference should be made to the appropriate datasheet for the network card for details on the register addresses
2393 and fields that can be accessed.
2394
2395 read reg
2396 ~~~~~~~~
2397
2398 Display the value of a port register::
2399
2400    testpmd> read reg (port_id) (address)
2401
2402 For example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
2403
2404    testpmd> read reg 0 0xEE00
2405    port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
2406
2407 read regfield
2408 ~~~~~~~~~~~~~
2409
2410 Display a port register bit field::
2411
2412    testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
2413
2414 For example, reading the lowest two bits from the register in the example above::
2415
2416    testpmd> read regfield 0 0xEE00 0 1
2417    port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
2418
2419 read regbit
2420 ~~~~~~~~~~~
2421
2422 Display a single port register bit::
2423
2424    testpmd> read regbit (port_id) (address) (bit_x)
2425
2426 For example, reading the lowest bit from the register in the example above::
2427
2428    testpmd> read regbit 0 0xEE00 0
2429    port 0 PCI register at offset 0xEE00: bit 0=1
2430
2431 write reg
2432 ~~~~~~~~~
2433
2434 Set the value of a port register::
2435
2436    testpmd> write reg (port_id) (address) (value)
2437
2438 For example, to clear a register::
2439
2440    testpmd> write reg 0 0xEE00 0x0
2441    port 0 PCI register at offset 0xEE00: 0x00000000 (0)
2442
2443 write regfield
2444 ~~~~~~~~~~~~~~
2445
2446 Set bit field of a port register::
2447
2448    testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
2449
2450 For example, writing to the register cleared in the example above::
2451
2452    testpmd> write regfield 0 0xEE00 0 1 2
2453    port 0 PCI register at offset 0xEE00: 0x00000002 (2)
2454
2455 write regbit
2456 ~~~~~~~~~~~~
2457
2458 Set single bit value of a port register::
2459
2460    testpmd> write regbit (port_id) (address) (bit_x) (value)
2461
2462 For example, to set the high bit in the register from the example above::
2463
2464    testpmd> write regbit 0 0xEE00 31 1
2465    port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
2466
2467 Traffic Metering and Policing
2468 -----------------------------
2469
2470 The following section shows functions for configuring traffic metering and
2471 policing on the ethernet device through the use of generic ethdev API.
2472
2473 show port traffic management capability
2474 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2475
2476 Show traffic metering and policing capability of the port::
2477
2478    testpmd> show port meter cap (port_id)
2479
2480 add port meter profile (srTCM rfc2967)
2481 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2482
2483 Add meter profile (srTCM rfc2697) to the ethernet device::
2484
2485    testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
2486    (cir) (cbs) (ebs)
2487
2488 where:
2489
2490 * ``profile_id``: ID for the meter profile.
2491 * ``cir``: Committed Information Rate (CIR) (bytes/second).
2492 * ``cbs``: Committed Burst Size (CBS) (bytes).
2493 * ``ebs``: Excess Burst Size (EBS) (bytes).
2494
2495 add port meter profile (trTCM rfc2968)
2496 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2497
2498 Add meter profile (srTCM rfc2698) to the ethernet device::
2499
2500    testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
2501    (cir) (pir) (cbs) (pbs)
2502
2503 where:
2504
2505 * ``profile_id``: ID for the meter profile.
2506 * ``cir``: Committed information rate (bytes/second).
2507 * ``pir``: Peak information rate (bytes/second).
2508 * ``cbs``: Committed burst size (bytes).
2509 * ``pbs``: Peak burst size (bytes).
2510
2511 add port meter profile (trTCM rfc4115)
2512 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2513
2514 Add meter profile (trTCM rfc4115) to the ethernet device::
2515
2516    testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
2517    (cir) (eir) (cbs) (ebs)
2518
2519 where:
2520
2521 * ``profile_id``: ID for the meter profile.
2522 * ``cir``: Committed information rate (bytes/second).
2523 * ``eir``: Excess information rate (bytes/second).
2524 * ``cbs``: Committed burst size (bytes).
2525 * ``ebs``: Excess burst size (bytes).
2526
2527 delete port meter profile
2528 ~~~~~~~~~~~~~~~~~~~~~~~~~
2529
2530 Delete meter profile from the ethernet device::
2531
2532    testpmd> del port meter profile (port_id) (profile_id)
2533
2534 create port meter
2535 ~~~~~~~~~~~~~~~~~
2536
2537 Create new meter object for the ethernet device::
2538
2539    testpmd> create port meter (port_id) (mtr_id) (profile_id) \
2540    (meter_enable) (g_action) (y_action) (r_action) (stats_mask) (shared) \
2541    (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\
2542    (dscp_tbl_entry63)]
2543
2544 where:
2545
2546 * ``mtr_id``: meter object ID.
2547 * ``profile_id``: ID for the meter profile.
2548 * ``meter_enable``: When this parameter has a non-zero value, the meter object
2549   gets enabled at the time of creation, otherwise remains disabled.
2550 * ``g_action``: Policer action for the packet with green color.
2551 * ``y_action``: Policer action for the packet with yellow color.
2552 * ``r_action``: Policer action for the packet with red color.
2553 * ``stats_mask``: Mask of statistics counter types to be enabled for the
2554   meter object.
2555 * ``shared``:  When this parameter has a non-zero value, the meter object is
2556   shared by multiple flows. Otherwise, meter object is used by single flow.
2557 * ``use_pre_meter_color``: When this parameter has a non-zero value, the
2558   input color for the current meter object is determined by the latest meter
2559   object in the same flow. Otherwise, the current meter object uses the
2560   *dscp_table* to determine the input color.
2561 * ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input
2562   color, 0 <= x <= 63.
2563
2564 enable port meter
2565 ~~~~~~~~~~~~~~~~~
2566
2567 Enable meter for the ethernet device::
2568
2569    testpmd> enable port meter (port_id) (mtr_id)
2570
2571 disable port meter
2572 ~~~~~~~~~~~~~~~~~~
2573
2574 Disable meter for the ethernet device::
2575
2576    testpmd> disable port meter (port_id) (mtr_id)
2577
2578 delete port meter
2579 ~~~~~~~~~~~~~~~~~
2580
2581 Delete meter for the ethernet device::
2582
2583    testpmd> del port meter (port_id) (mtr_id)
2584
2585 Set port meter profile
2586 ~~~~~~~~~~~~~~~~~~~~~~
2587
2588 Set meter profile for the ethernet device::
2589
2590    testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2591
2592 set port meter dscp table
2593 ~~~~~~~~~~~~~~~~~~~~~~~~~
2594
2595 Set meter dscp table for the ethernet device::
2596
2597    testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0) \
2598    (dscp_tbl_entry1)...(dscp_tbl_entry63)]
2599
2600 set port meter policer action
2601 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2602
2603 Set meter policer action for the ethernet device::
2604
2605    testpmd> set port meter policer action (port_id) (mtr_id) (action_mask) \
2606    (action0) [(action1) (action1)]
2607
2608 where:
2609
2610 * ``action_mask``: Bit mask indicating which policer actions need to be
2611   updated. One or more policer actions can be updated in a single function
2612   invocation. To update the policer action associated with color C, bit
2613   (1 << C) needs to be set in *action_mask* and element at position C
2614   in the *actions* array needs to be valid.
2615 * ``actionx``: Policer action for the color x,
2616   RTE_MTR_GREEN <= x < RTE_MTR_COLORS
2617
2618 set port meter stats mask
2619 ~~~~~~~~~~~~~~~~~~~~~~~~~
2620
2621 Set meter stats mask for the ethernet device::
2622
2623    testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2624
2625 where:
2626
2627 * ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2628
2629 show port meter stats
2630 ~~~~~~~~~~~~~~~~~~~~~
2631
2632 Show meter stats of the ethernet device::
2633
2634    testpmd> show port meter stats (port_id) (mtr_id) (clear)
2635
2636 where:
2637
2638 * ``clear``: Flag that indicates whether the statistics counters should
2639   be cleared (i.e. set to zero) immediately after they have been read or not.
2640
2641 Traffic Management
2642 ------------------
2643
2644 The following section shows functions for configuring traffic management on
2645 on the ethernet device through the use of generic TM API.
2646
2647 show port traffic management capability
2648 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2649
2650 Show traffic management capability of the port::
2651
2652    testpmd> show port tm cap (port_id)
2653
2654 show port traffic management capability (hierarchy level)
2655 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2656
2657 Show traffic management hierarchy level capability of the port::
2658
2659    testpmd> show port tm level cap (port_id) (level_id)
2660
2661 show port traffic management capability (hierarchy node level)
2662 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2663
2664 Show the traffic management hierarchy node capability of the port::
2665
2666    testpmd> show port tm node cap (port_id) (node_id)
2667
2668 show port traffic management hierarchy node type
2669 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2670
2671 Show the port traffic management hierarchy node type::
2672
2673    testpmd> show port tm node type (port_id) (node_id)
2674
2675 show port traffic management hierarchy node stats
2676 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2677
2678 Show the port traffic management hierarchy node statistics::
2679
2680    testpmd> show port tm node stats (port_id) (node_id) (clear)
2681
2682 where:
2683
2684 * ``clear``: When this parameter has a non-zero value, the statistics counters
2685   are cleared (i.e. set to zero) immediately after they have been read,
2686   otherwise the statistics counters are left untouched.
2687
2688 Add port traffic management private shaper profile
2689 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2690
2691 Add the port traffic management private shaper profile::
2692
2693    testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
2694    (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
2695    (packet_length_adjust)
2696
2697 where:
2698
2699 * ``shaper_profile id``: Shaper profile ID for the new profile.
2700 * ``cmit_tb_rate``: Committed token bucket rate (bytes per second).
2701 * ``cmit_tb_size``: Committed token bucket size (bytes).
2702 * ``peak_tb_rate``: Peak token bucket rate (bytes per second).
2703 * ``peak_tb_size``: Peak token bucket size (bytes).
2704 * ``packet_length_adjust``: The value (bytes) to be added to the length of
2705   each packet for the purpose of shaping. This parameter value can be used to
2706   correct the packet length with the framing overhead bytes that are consumed
2707   on the wire.
2708
2709 Delete port traffic management private shaper profile
2710 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2711
2712 Delete the port traffic management private shaper::
2713
2714    testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
2715
2716 where:
2717
2718 * ``shaper_profile id``: Shaper profile ID that needs to be deleted.
2719
2720 Add port traffic management shared shaper
2721 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2722
2723 Create the port traffic management shared shaper::
2724
2725    testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \
2726    (shaper_profile_id)
2727
2728 where:
2729
2730 * ``shared_shaper_id``: Shared shaper ID to be created.
2731 * ``shaper_profile id``: Shaper profile ID for shared shaper.
2732
2733 Set port traffic management shared shaper
2734 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2735
2736 Update the port traffic management shared shaper::
2737
2738    testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \
2739    (shaper_profile_id)
2740
2741 where:
2742
2743 * ``shared_shaper_id``: Shared shaper ID to be update.
2744 * ``shaper_profile id``: Shaper profile ID for shared shaper.
2745
2746 Delete port traffic management shared shaper
2747 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2748
2749 Delete the port traffic management shared shaper::
2750
2751    testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
2752
2753 where:
2754
2755 * ``shared_shaper_id``: Shared shaper ID to be deleted.
2756
2757 Set port traffic management hierarchy node private shaper
2758 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2759
2760 set the port traffic management hierarchy node private shaper::
2761
2762    testpmd> set port tm node shaper profile (port_id) (node_id) \
2763    (shaper_profile_id)
2764
2765 where:
2766
2767 * ``shaper_profile id``: Private shaper profile ID to be enabled on the
2768   hierarchy node.
2769
2770 Add port traffic management WRED profile
2771 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2772
2773 Create a new WRED profile::
2774
2775    testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
2776    (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
2777    (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
2778    (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
2779
2780 where:
2781
2782 * ``wred_profile id``: Identifier for the newly create WRED profile
2783 * ``color_g``: Packet color (green)
2784 * ``min_th_g``: Minimum queue threshold for packet with green color
2785 * ``max_th_g``: Minimum queue threshold for packet with green color
2786 * ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp)
2787 * ``wq_log2_g``: Negated log2 of queue weight (wq)
2788 * ``color_y``: Packet color (yellow)
2789 * ``min_th_y``: Minimum queue threshold for packet with yellow color
2790 * ``max_th_y``: Minimum queue threshold for packet with yellow color
2791 * ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp)
2792 * ``wq_log2_y``: Negated log2 of queue weight (wq)
2793 * ``color_r``: Packet color (red)
2794 * ``min_th_r``: Minimum queue threshold for packet with yellow color
2795 * ``max_th_r``: Minimum queue threshold for packet with yellow color
2796 * ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp)
2797 * ``wq_log2_r``: Negated log2 of queue weight (wq)
2798
2799 Delete port traffic management WRED profile
2800 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2801
2802 Delete the WRED profile::
2803
2804    testpmd> del port tm node wred profile (port_id) (wred_profile_id)
2805
2806 Add port traffic management hierarchy nonleaf node
2807 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2808
2809 Add nonleaf node to port traffic management hierarchy::
2810
2811    testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \
2812    (priority) (weight) (level_id) (shaper_profile_id) \
2813    (n_sp_priorities) (stats_mask) (n_shared_shapers) \
2814    [(shared_shaper_0) (shared_shaper_1) ...] \
2815
2816 where:
2817
2818 * ``parent_node_id``: Node ID of the parent.
2819 * ``priority``: Node priority (highest node priority is zero). This is used by
2820   the SP algorithm running on the parent node for scheduling this node.
2821 * ``weight``: Node weight (lowest weight is one). The node weight is relative
2822   to the weight sum of all siblings that have the same priority. It is used by
2823   the WFQ algorithm running on the parent node for scheduling this node.
2824 * ``level_id``: Hierarchy level of the node.
2825 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2826   the node.
2827 * ``n_sp_priorities``: Number of strict priorities.
2828 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2829 * ``n_shared_shapers``: Number of shared shapers.
2830 * ``shared_shaper_id``: Shared shaper id.
2831
2832 Add port traffic management hierarchy leaf node
2833 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2834
2835 Add leaf node to port traffic management hierarchy::
2836
2837    testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \
2838    (priority) (weight) (level_id) (shaper_profile_id) \
2839    (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \
2840    [(shared_shaper_id) (shared_shaper_id) ...] \
2841
2842 where:
2843
2844 * ``parent_node_id``: Node ID of the parent.
2845 * ``priority``: Node priority (highest node priority is zero). This is used by
2846   the SP algorithm running on the parent node for scheduling this node.
2847 * ``weight``: Node weight (lowest weight is one). The node weight is relative
2848   to the weight sum of all siblings that have the same priority. It is used by
2849   the WFQ algorithm running on the parent node for scheduling this node.
2850 * ``level_id``: Hierarchy level of the node.
2851 * ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2852   the node.
2853 * ``cman_mode``: Congestion management mode to be enabled for this node.
2854 * ``wred_profile_id``: WRED profile id to be enabled for this node.
2855 * ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2856 * ``n_shared_shapers``: Number of shared shapers.
2857 * ``shared_shaper_id``: Shared shaper id.
2858
2859 Delete port traffic management hierarchy node
2860 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2861
2862 Delete node from port traffic management hierarchy::
2863
2864    testpmd> del port tm node (port_id) (node_id)
2865
2866 Update port traffic management hierarchy parent node
2867 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2868
2869 Update port traffic management hierarchy parent node::
2870
2871    testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \
2872    (priority) (weight)
2873
2874 This function can only be called after the hierarchy commit invocation. Its
2875 success depends on the port support for this operation, as advertised through
2876 the port capability set. This function is valid for all nodes of the traffic
2877 management hierarchy except root node.
2878
2879 Suspend port traffic management hierarchy node
2880 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2881
2882    testpmd> suspend port tm node (port_id) (node_id)
2883
2884 Resume port traffic management hierarchy node
2885 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2886
2887    testpmd> resume port tm node (port_id) (node_id)
2888
2889 Commit port traffic management hierarchy
2890 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2891
2892 Commit the traffic management hierarchy on the port::
2893
2894    testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
2895
2896 where:
2897
2898 * ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function
2899   call failure. On the other hand, hierarchy is preserved when this parameter
2900   is equal to zero.
2901
2902 Set port traffic management mark VLAN dei
2903 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2904
2905 Enables/Disables the traffic management marking on the port for VLAN packets::
2906
2907    testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red>
2908
2909 where:
2910
2911 * ``port_id``: The port which on which VLAN packets marked as ``green`` or
2912   ``yellow`` or ``red`` will have dei bit enabled
2913
2914 * ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green
2915
2916 * ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow
2917
2918 * ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red
2919
2920 Set port traffic management mark IP dscp
2921 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2922
2923 Enables/Disables the traffic management marking on the port for IP dscp packets::
2924
2925    testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red>
2926
2927 where:
2928
2929 * ``port_id``: The port which on which IP packets marked as ``green`` or
2930   ``yellow`` or ``red`` will have IP dscp bits updated
2931
2932 * ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets
2933
2934 * ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets
2935
2936 * ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets
2937
2938 Set port traffic management mark IP ecn
2939 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2940
2941 Enables/Disables the traffic management marking on the port for IP ecn packets::
2942
2943    testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red>
2944
2945 where:
2946
2947 * ``port_id``: The port which on which IP packets marked as ``green`` or
2948   ``yellow`` or ``red`` will have IP ecn bits updated
2949
2950 * ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01  or 2'b10
2951   to ecn of 2'b11 when IP is caring TCP or SCTP
2952
2953 * ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
2954   to ecn of 2'b11 when IP is caring TCP or SCTP
2955
2956 * ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
2957   to ecn of 2'b11 when IP is caring TCP or SCTP
2958
2959 Set port traffic management default hierarchy (softnic forwarding mode)
2960 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2961
2962 set the traffic management default hierarchy on the port::
2963
2964    testpmd> set port tm hierarchy default (port_id)
2965
2966 Filter Functions
2967 ----------------
2968
2969 This section details the available filter functions that are available.
2970
2971 Note these functions interface the deprecated legacy filtering framework,
2972 superseded by *rte_flow*. See `Flow rules management`_.
2973
2974 ethertype_filter
2975 ~~~~~~~~~~~~~~~~~~~~
2976
2977 Add or delete a L2 Ethertype filter, which identify packets by their L2 Ethertype mainly assign them to a receive queue::
2978
2979    ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr) (mac_address) \
2980                     ethertype (ether_type) (drop|fwd) queue (queue_id)
2981
2982 The available information parameters are:
2983
2984 * ``port_id``: The port which the Ethertype filter assigned on.
2985
2986 * ``mac_addr``: Compare destination mac address.
2987
2988 * ``mac_ignr``: Ignore destination mac address match.
2989
2990 * ``mac_address``: Destination mac address to match.
2991
2992 * ``ether_type``: The EtherType value want to match,
2993   for example 0x0806 for ARP packet. 0x0800 (IPv4) and 0x86DD (IPv6) are invalid.
2994
2995 * ``queue_id``: The receive queue associated with this EtherType filter.
2996   It is meaningless when deleting or dropping.
2997
2998 Example, to add/remove an ethertype filter rule::
2999
3000    testpmd> ethertype_filter 0 add mac_ignr 00:11:22:33:44:55 \
3001                              ethertype 0x0806 fwd queue 3
3002
3003    testpmd> ethertype_filter 0 del mac_ignr 00:11:22:33:44:55 \
3004                              ethertype 0x0806 fwd queue 3
3005
3006 2tuple_filter
3007 ~~~~~~~~~~~~~~~~~
3008
3009 Add or delete a 2-tuple filter,
3010 which identifies packets by specific protocol and destination TCP/UDP port
3011 and forwards packets into one of the receive queues::
3012
3013    2tuple_filter (port_id) (add|del) dst_port (dst_port_value) \
3014                  protocol (protocol_value) mask (mask_value) \
3015                  tcp_flags (tcp_flags_value) priority (prio_value) \
3016                  queue (queue_id)
3017
3018 The available information parameters are:
3019
3020 * ``port_id``: The port which the 2-tuple filter assigned on.
3021
3022 * ``dst_port_value``: Destination port in L4.
3023
3024 * ``protocol_value``: IP L4 protocol.
3025
3026 * ``mask_value``: Participates in the match or not by bit for field above, 1b means participate.
3027
3028 * ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the pro_value is not set to 0x06 (TCP).
3029
3030 * ``prio_value``: Priority of this filter.
3031
3032 * ``queue_id``: The receive queue associated with this 2-tuple filter.
3033
3034 Example, to add/remove an 2tuple filter rule::
3035
3036    testpmd> 2tuple_filter 0 add dst_port 32 protocol 0x06 mask 0x03 \
3037                           tcp_flags 0x02 priority 3 queue 3
3038
3039    testpmd> 2tuple_filter 0 del dst_port 32 protocol 0x06 mask 0x03 \
3040                           tcp_flags 0x02 priority 3 queue 3
3041
3042 5tuple_filter
3043 ~~~~~~~~~~~~~~~~~
3044
3045 Add or delete a 5-tuple filter,
3046 which consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port)
3047 and routes packets into one of the receive queues::
3048
3049    5tuple_filter (port_id) (add|del) dst_ip (dst_address) src_ip \
3050                  (src_address) dst_port (dst_port_value) \
3051                  src_port (src_port_value) protocol (protocol_value) \
3052                  mask (mask_value) tcp_flags (tcp_flags_value) \
3053                  priority (prio_value) queue (queue_id)
3054
3055 The available information parameters are:
3056
3057 * ``port_id``: The port which the 5-tuple filter assigned on.
3058
3059 * ``dst_address``: Destination IP address.
3060
3061 * ``src_address``: Source IP address.
3062
3063 * ``dst_port_value``: TCP/UDP destination port.
3064
3065 * ``src_port_value``: TCP/UDP source port.
3066
3067 * ``protocol_value``: L4 protocol.
3068
3069 * ``mask_value``: Participates in the match or not by bit for field above, 1b means participate
3070
3071 * ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the protocol_value is not set to 0x06 (TCP).
3072
3073 * ``prio_value``: The priority of this filter.
3074
3075 * ``queue_id``: The receive queue associated with this 5-tuple filter.
3076
3077 Example, to add/remove an 5tuple filter rule::
3078
3079    testpmd> 5tuple_filter 0 add dst_ip 2.2.2.5 src_ip 2.2.2.4 \
3080             dst_port 64 src_port 32 protocol 0x06 mask 0x1F \
3081             flags 0x0 priority 3 queue 3
3082
3083    testpmd> 5tuple_filter 0 del dst_ip 2.2.2.5 src_ip 2.2.2.4 \
3084             dst_port 64 src_port 32 protocol 0x06 mask 0x1F \
3085             flags 0x0 priority 3 queue 3
3086
3087 syn_filter
3088 ~~~~~~~~~~
3089
3090 Using the  SYN filter, TCP packets whose *SYN* flag is set can be forwarded to a separate queue::
3091
3092    syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)
3093
3094 The available information parameters are:
3095
3096 * ``port_id``: The port which the SYN filter assigned on.
3097
3098 * ``high``: This SYN filter has higher priority than other filters.
3099
3100 * ``low``: This SYN filter has lower priority than other filters.
3101
3102 * ``queue_id``: The receive queue associated with this SYN filter
3103
3104 Example::
3105
3106    testpmd> syn_filter 0 add priority high queue 3
3107
3108 flex_filter
3109 ~~~~~~~~~~~
3110
3111 With flex filter, packets can be recognized by any arbitrary pattern within the first 128 bytes of the packet
3112 and routed into one of the receive queues::
3113
3114    flex_filter (port_id) (add|del) len (len_value) bytes (bytes_value) \
3115                mask (mask_value) priority (prio_value) queue (queue_id)
3116
3117 The available information parameters are:
3118
3119 * ``port_id``: The port which the Flex filter is assigned on.
3120
3121 * ``len_value``: Filter length in bytes, no greater than 128.
3122
3123 * ``bytes_value``: A string in hexadecimal, means the value the flex filter needs to match.
3124
3125 * ``mask_value``: A string in hexadecimal, bit 1 means corresponding byte participates in the match.
3126
3127 * ``prio_value``: The priority of this filter.
3128
3129 * ``queue_id``: The receive queue associated with this Flex filter.
3130
3131 Example::
3132
3133    testpmd> flex_filter 0 add len 16 bytes 0x00000000000000000000000008060000 \
3134                           mask 000C priority 3 queue 3
3135
3136    testpmd> flex_filter 0 del len 16 bytes 0x00000000000000000000000008060000 \
3137                           mask 000C priority 3 queue 3
3138
3139
3140 .. _testpmd_flow_director:
3141
3142 flow_director_filter
3143 ~~~~~~~~~~~~~~~~~~~~
3144
3145 The Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues.
3146
3147 Four types of filtering are supported which are referred to as Perfect Match, Signature, Perfect-mac-vlan and
3148 Perfect-tunnel filters, the match mode is set by the ``--pkt-filter-mode`` command-line parameter:
3149
3150 * Perfect match filters.
3151   The hardware checks a match between the masked fields of the received packets and the programmed filters.
3152   The masked fields are for IP flow.
3153
3154 * Signature filters.
3155   The hardware checks a match between a hash-based signature of the masked fields of the received packet.
3156
3157 * Perfect-mac-vlan match filters.
3158   The hardware checks a match between the masked fields of the received packets and the programmed filters.
3159   The masked fields are for MAC VLAN flow.
3160
3161 * Perfect-tunnel match filters.
3162   The hardware checks a match between the masked fields of the received packets and the programmed filters.
3163   The masked fields are for tunnel flow.
3164
3165 * Perfect-raw-flow-type match filters.
3166   The hardware checks a match between the masked fields of the received packets and pre-loaded raw (template) packet.
3167   The masked fields are specified by input sets.
3168
3169 The Flow Director filters can match the different fields for different type of packet: flow type, specific input set
3170 per flow type and the flexible payload.
3171
3172 The Flow Director can also mask out parts of all of these fields so that filters
3173 are only applied to certain fields or parts of the fields.
3174
3175 Note that for raw flow type mode the source and destination fields in the
3176 raw packet buffer need to be presented in a reversed order with respect
3177 to the expected received packets.
3178 For example: IP source and destination addresses or TCP/UDP/SCTP
3179 source and destination ports
3180
3181 Different NICs may have different capabilities, command show port fdir (port_id) can be used to acquire the information.
3182
3183 # Commands to add flow director filters of different flow types::
3184
3185    flow_director_filter (port_id) mode IP (add|del|update) \
3186                         flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag) \
3187                         src (src_ip_address) dst (dst_ip_address) \
3188                         tos (tos_value) proto (proto_value) ttl (ttl_value) \
3189                         vlan (vlan_value) flexbytes (flexbytes_value) \
3190                         (drop|fwd) pf|vf(vf_id) queue (queue_id) \
3191                         fd_id (fd_id_value)
3192
3193    flow_director_filter (port_id) mode IP (add|del|update) \
3194                         flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp) \
3195                         src (src_ip_address) (src_port) \
3196                         dst (dst_ip_address) (dst_port) \
3197                         tos (tos_value) ttl (ttl_value) \
3198                         vlan (vlan_value) flexbytes (flexbytes_value) \
3199                         (drop|fwd) queue pf|vf(vf_id) (queue_id) \
3200                         fd_id (fd_id_value)
3201
3202    flow_director_filter (port_id) mode IP (add|del|update) \
3203                         flow (ipv4-sctp|ipv6-sctp) \
3204                         src (src_ip_address) (src_port) \
3205                         dst (dst_ip_address) (dst_port) \
3206                         tos (tos_value) ttl (ttl_value) \
3207                         tag (verification_tag) vlan (vlan_value) \
3208                         flexbytes (flexbytes_value) (drop|fwd) \
3209                         pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
3210
3211    flow_director_filter (port_id) mode IP (add|del|update) flow l2_payload \
3212                         ether (ethertype) flexbytes (flexbytes_value) \
3213                         (drop|fwd) pf|vf(vf_id) queue (queue_id)
3214                         fd_id (fd_id_value)
3215
3216    flow_director_filter (port_id) mode MAC-VLAN (add|del|update) \
3217                         mac (mac_address) vlan (vlan_value) \
3218                         flexbytes (flexbytes_value) (drop|fwd) \
3219                         queue (queue_id) fd_id (fd_id_value)
3220
3221    flow_director_filter (port_id) mode Tunnel (add|del|update) \
3222                         mac (mac_address) vlan (vlan_value) \
3223                         tunnel (NVGRE|VxLAN) tunnel-id (tunnel_id_value) \
3224                         flexbytes (flexbytes_value) (drop|fwd) \
3225                         queue (queue_id) fd_id (fd_id_value)
3226
3227    flow_director_filter (port_id) mode raw (add|del|update) flow (flow_id) \
3228                         (drop|fwd) queue (queue_id) fd_id (fd_id_value) \
3229                         packet (packet file name)
3230
3231 For example, to add an ipv4-udp flow type filter::
3232
3233    testpmd> flow_director_filter 0 mode IP add flow ipv4-udp src 2.2.2.3 32 \
3234             dst 2.2.2.5 33 tos 2 ttl 40 vlan 0x1 flexbytes (0x88,0x48) \
3235             fwd pf queue 1 fd_id 1
3236
3237 For example, add an ipv4-other flow type filter::
3238
3239    testpmd> flow_director_filter 0 mode IP add flow ipv4-other src 2.2.2.3 \
3240              dst 2.2.2.5 tos 2 proto 20 ttl 40 vlan 0x1 \
3241              flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
3242
3243 flush_flow_director
3244 ~~~~~~~~~~~~~~~~~~~
3245
3246 Flush all flow director filters on a device::
3247
3248    testpmd> flush_flow_director (port_id)
3249
3250 Example, to flush all flow director filter on port 0::
3251
3252    testpmd> flush_flow_director 0
3253
3254 flow_director_mask
3255 ~~~~~~~~~~~~~~~~~~
3256
3257 Set flow director's input masks::
3258
3259    flow_director_mask (port_id) mode IP vlan (vlan_value) \
3260                       src_mask (ipv4_src) (ipv6_src) (src_port) \
3261                       dst_mask (ipv4_dst) (ipv6_dst) (dst_port)
3262
3263    flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value)
3264
3265    flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \
3266                       mac (mac_value) tunnel-type (tunnel_type_value) \
3267                       tunnel-id (tunnel_id_value)
3268
3269 Example, to set flow director mask on port 0::
3270
3271    testpmd> flow_director_mask 0 mode IP vlan 0xefff \
3272             src_mask 255.255.255.255 \
3273                 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF \
3274             dst_mask 255.255.255.255 \
3275                 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF
3276
3277 flow_director_flex_mask
3278 ~~~~~~~~~~~~~~~~~~~~~~~
3279
3280 set masks of flow director's flexible payload based on certain flow type::
3281
3282    testpmd> flow_director_flex_mask (port_id) \
3283             flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3284                   ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
3285                   l2_payload|all) (mask)
3286
3287 Example, to set flow director's flex mask for all flow type on port 0::
3288
3289    testpmd> flow_director_flex_mask 0 flow all \
3290             (0xff,0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
3291
3292
3293 flow_director_flex_payload
3294 ~~~~~~~~~~~~~~~~~~~~~~~~~~
3295
3296 Configure flexible payload selection::
3297
3298    flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config)
3299
3300 For example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload::
3301
3302    testpmd> flow_director_flex_payload 0 l4 \
3303             (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
3304
3305 get_sym_hash_ena_per_port
3306 ~~~~~~~~~~~~~~~~~~~~~~~~~
3307
3308 Get symmetric hash enable configuration per port::
3309
3310    get_sym_hash_ena_per_port (port_id)
3311
3312 For example, to get symmetric hash enable configuration of port 1::
3313
3314    testpmd> get_sym_hash_ena_per_port 1
3315
3316 set_sym_hash_ena_per_port
3317 ~~~~~~~~~~~~~~~~~~~~~~~~~
3318
3319 Set symmetric hash enable configuration per port to enable or disable::
3320
3321    set_sym_hash_ena_per_port (port_id) (enable|disable)
3322
3323 For example, to set symmetric hash enable configuration of port 1 to enable::
3324
3325    testpmd> set_sym_hash_ena_per_port 1 enable
3326
3327 get_hash_global_config
3328 ~~~~~~~~~~~~~~~~~~~~~~
3329
3330 Get the global configurations of hash filters::
3331
3332    get_hash_global_config (port_id)
3333
3334 For example, to get the global configurations of hash filters of port 1::
3335
3336    testpmd> get_hash_global_config 1
3337
3338 set_hash_global_config
3339 ~~~~~~~~~~~~~~~~~~~~~~
3340
3341 Set the global configurations of hash filters::
3342
3343    set_hash_global_config (port_id) (toeplitz|simple_xor|default) \
3344    (ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|ipv6-frag| \
3345    ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload|<flow_id>) \
3346    (enable|disable)
3347
3348 For example, to enable simple_xor for flow type of ipv6 on port 2::
3349
3350    testpmd> set_hash_global_config 2 simple_xor ipv6 enable
3351
3352 set_hash_input_set
3353 ~~~~~~~~~~~~~~~~~~
3354
3355 Set the input set for hash::
3356
3357    set_hash_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3358    ipv4-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \
3359    l2_payload|<flow_id>) (ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6| \
3360    ipv4-tos|ipv4-proto|ipv6-tc|ipv6-next-header|udp-src-port|udp-dst-port| \
3361    tcp-src-port|tcp-dst-port|sctp-src-port|sctp-dst-port|sctp-veri-tag| \
3362    udp-key|gre-key|fld-1st|fld-2nd|fld-3rd|fld-4th|fld-5th|fld-6th|fld-7th| \
3363    fld-8th|none) (select|add)
3364
3365 For example, to add source IP to hash input set for flow type of ipv4-udp on port 0::
3366
3367    testpmd> set_hash_input_set 0 ipv4-udp src-ipv4 add
3368
3369 set_fdir_input_set
3370 ~~~~~~~~~~~~~~~~~~
3371
3372 The Flow Director filters can match the different fields for different type of packet, i.e. specific input set
3373 on per flow type and the flexible payload. This command can be used to change input set for each flow type.
3374
3375 Set the input set for flow director::
3376
3377    set_fdir_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3378    ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \
3379    l2_payload|<flow_id>) (ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6| \
3380    ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|ipv6-hop-limits| \
3381    tudp-src-port|udp-dst-port|cp-src-port|tcp-dst-port|sctp-src-port| \
3382    sctp-dst-port|sctp-veri-tag|none) (select|add)
3383
3384 For example to add source IP to FD input set for flow type of ipv4-udp on port 0::
3385
3386    testpmd> set_fdir_input_set 0 ipv4-udp src-ipv4 add
3387
3388 global_config
3389 ~~~~~~~~~~~~~
3390
3391 Set different GRE key length for input set::
3392
3393    global_config (port_id) gre-key-len (number in bytes)
3394
3395 For example to set GRE key length for input set to 4 bytes on port 0::
3396
3397    testpmd> global_config 0 gre-key-len 4
3398
3399
3400 .. _testpmd_rte_flow:
3401
3402 Flow rules management
3403 ---------------------
3404
3405 Control of the generic flow API (*rte_flow*) is fully exposed through the
3406 ``flow`` command (validation, creation, destruction, queries and operation
3407 modes).
3408
3409 Considering *rte_flow* overlaps with all `Filter Functions`_, using both
3410 features simultaneously may cause undefined side-effects and is therefore
3411 not recommended.
3412
3413 ``flow`` syntax
3414 ~~~~~~~~~~~~~~~
3415
3416 Because the ``flow`` command uses dynamic tokens to handle the large number
3417 of possible flow rules combinations, its behavior differs slightly from
3418 other commands, in particular:
3419
3420 - Pressing *?* or the *<tab>* key displays contextual help for the current
3421   token, not that of the entire command.
3422
3423 - Optional and repeated parameters are supported (provided they are listed
3424   in the contextual help).
3425
3426 The first parameter stands for the operation mode. Possible operations and
3427 their general syntax are described below. They are covered in detail in the
3428 following sections.
3429
3430 - Check whether a flow rule can be created::
3431
3432    flow validate {port_id}
3433        [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3434        pattern {item} [/ {item} [...]] / end
3435        actions {action} [/ {action} [...]] / end
3436
3437 - Create a flow rule::
3438
3439    flow create {port_id}
3440        [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3441        pattern {item} [/ {item} [...]] / end
3442        actions {action} [/ {action} [...]] / end
3443
3444 - Destroy specific flow rules::
3445
3446    flow destroy {port_id} rule {rule_id} [...]
3447
3448 - Destroy all flow rules::
3449
3450    flow flush {port_id}
3451
3452 - Query an existing flow rule::
3453
3454    flow query {port_id} {rule_id} {action}
3455
3456 - List existing flow rules sorted by priority, filtered by group
3457   identifiers::
3458
3459    flow list {port_id} [group {group_id}] [...]
3460
3461 - Restrict ingress traffic to the defined flow rules::
3462
3463    flow isolate {port_id} {boolean}
3464
3465 Validating flow rules
3466 ~~~~~~~~~~~~~~~~~~~~~
3467
3468 ``flow validate`` reports whether a flow rule would be accepted by the
3469 underlying device in its current state but stops short of creating it. It is
3470 bound to ``rte_flow_validate()``::
3471
3472    flow validate {port_id}
3473       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3474       pattern {item} [/ {item} [...]] / end
3475       actions {action} [/ {action} [...]] / end
3476
3477 If successful, it will show::
3478
3479    Flow rule validated
3480
3481 Otherwise it will show an error message of the form::
3482
3483    Caught error type [...] ([...]): [...]
3484
3485 This command uses the same parameters as ``flow create``, their format is
3486 described in `Creating flow rules`_.
3487
3488 Check whether redirecting any Ethernet packet received on port 0 to RX queue
3489 index 6 is supported::
3490
3491    testpmd> flow validate 0 ingress pattern eth / end
3492       actions queue index 6 / end
3493    Flow rule validated
3494    testpmd>
3495
3496 Port 0 does not support TCPv6 rules::
3497
3498    testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end
3499       actions drop / end
3500    Caught error type 9 (specific pattern item): Invalid argument
3501    testpmd>
3502
3503 Creating flow rules
3504 ~~~~~~~~~~~~~~~~~~~
3505
3506 ``flow create`` validates and creates the specified flow rule. It is bound
3507 to ``rte_flow_create()``::
3508
3509    flow create {port_id}
3510       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3511       pattern {item} [/ {item} [...]] / end
3512       actions {action} [/ {action} [...]] / end
3513
3514 If successful, it will return a flow rule ID usable with other commands::
3515
3516    Flow rule #[...] created
3517
3518 Otherwise it will show an error message of the form::
3519
3520    Caught error type [...] ([...]): [...]
3521
3522 Parameters describe in the following order:
3523
3524 - Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens).
3525 - A matching pattern, starting with the *pattern* token and terminated by an
3526   *end* pattern item.
3527 - Actions, starting with the *actions* token and terminated by an *end*
3528   action.
3529
3530 These translate directly to *rte_flow* objects provided as-is to the
3531 underlying functions.
3532
3533 The shortest valid definition only comprises mandatory tokens::
3534
3535    testpmd> flow create 0 pattern end actions end
3536
3537 Note that PMDs may refuse rules that essentially do nothing such as this
3538 one.
3539
3540 **All unspecified object values are automatically initialized to 0.**
3541
3542 Attributes
3543 ^^^^^^^^^^
3544
3545 These tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3546 specified before the ``pattern`` token.
3547
3548 - ``group {group id}``: priority group.
3549 - ``priority {level}``: priority level within group.
3550 - ``ingress``: rule applies to ingress traffic.
3551 - ``egress``: rule applies to egress traffic.
3552 - ``transfer``: apply rule directly to endpoints found in pattern.
3553
3554 Each instance of an attribute specified several times overrides the previous
3555 value as shown below (group 4 is used)::
3556
3557    testpmd> flow create 0 group 42 group 24 group 4 [...]
3558
3559 Note that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3560
3561 While not specifying a direction is an error, some rules may allow both
3562 simultaneously.
3563
3564 Most rules affect RX therefore contain the ``ingress`` token::
3565
3566    testpmd> flow create 0 ingress pattern [...]
3567
3568 Matching pattern
3569 ^^^^^^^^^^^^^^^^
3570
3571 A matching pattern starts after the ``pattern`` token. It is made of pattern
3572 items and is terminated by a mandatory ``end`` item.
3573
3574 Items are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3575 rte_flow_item_type``).
3576
3577 The ``/`` token is used as a separator between pattern items as shown
3578 below::
3579
3580    testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3581
3582 Note that protocol items like these must be stacked from lowest to highest
3583 layer to make sense. For instance, the following rule is either invalid or
3584 unlikely to match any packet::
3585
3586    testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3587
3588 More information on these restrictions can be found in the *rte_flow*
3589 documentation.
3590
3591 Several items support additional specification structures, for example
3592 ``ipv4`` allows specifying source and destination addresses as follows::
3593
3594    testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1
3595       dst is 10.2.0.0 / end [...]
3596
3597 This rule matches all IPv4 traffic with the specified properties.
3598
3599 In this example, ``src`` and ``dst`` are field names of the underlying
3600 ``struct rte_flow_item_ipv4`` object. All item properties can be specified
3601 in a similar fashion.
3602
3603 The ``is`` token means that the subsequent value must be matched exactly,
3604 and assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3605 accordingly. Possible assignment tokens are:
3606
3607 - ``is``: match value perfectly (with full bit-mask).
3608 - ``spec``: match value according to configured bit-mask.
3609 - ``last``: specify upper bound to establish a range.
3610 - ``mask``: specify bit-mask with relevant bits set to one.
3611 - ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one.
3612
3613 These yield identical results::
3614
3615    ipv4 src is 10.1.1.1
3616
3617 ::
3618
3619    ipv4 src spec 10.1.1.1 src mask 255.255.255.255
3620
3621 ::
3622
3623    ipv4 src spec 10.1.1.1 src prefix 32
3624
3625 ::
3626
3627    ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value
3628
3629 ::
3630
3631    ipv4 src is 10.1.1.1 src last 0 # 0 disables range
3632
3633 Inclusive ranges can be defined with ``last``::
3634
3635    ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4
3636
3637 Note that ``mask`` affects both ``spec`` and ``last``::
3638
3639    ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0
3640       # matches 10.1.0.0 to 10.2.255.255
3641
3642 Properties can be modified multiple times::
3643
3644    ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4
3645
3646 ::
3647
3648    ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16
3649
3650 Pattern items
3651 ^^^^^^^^^^^^^
3652
3653 This section lists supported pattern items and their attributes, if any.
3654
3655 - ``end``: end list of pattern items.
3656
3657 - ``void``: no-op pattern item.
3658
3659 - ``invert``: perform actions when pattern does not match.
3660
3661 - ``any``: match any protocol for the current layer.
3662
3663   - ``num {unsigned}``: number of layers covered.
3664
3665 - ``pf``: match traffic from/to the physical function.
3666
3667 - ``vf``: match traffic from/to a virtual function ID.
3668
3669   - ``id {unsigned}``: VF ID.
3670
3671 - ``phy_port``: match traffic from/to a specific physical port.
3672
3673   - ``index {unsigned}``: physical port index.
3674
3675 - ``port_id``: match traffic from/to a given DPDK port ID.
3676
3677   - ``id {unsigned}``: DPDK port ID.
3678
3679 - ``mark``: match value set in previously matched flow rule using the mark action.
3680
3681   - ``id {unsigned}``: arbitrary integer value.
3682
3683 - ``raw``: match an arbitrary byte string.
3684
3685   - ``relative {boolean}``: look for pattern after the previous item.
3686   - ``search {boolean}``: search pattern from offset (see also limit).
3687   - ``offset {integer}``: absolute or relative offset for pattern.
3688   - ``limit {unsigned}``: search area limit for start of pattern.
3689   - ``pattern {string}``: byte string to look for.
3690
3691 - ``eth``: match Ethernet header.
3692
3693   - ``dst {MAC-48}``: destination MAC.
3694   - ``src {MAC-48}``: source MAC.
3695   - ``type {unsigned}``: EtherType or TPID.
3696
3697 - ``vlan``: match 802.1Q/ad VLAN tag.
3698
3699   - ``tci {unsigned}``: tag control information.
3700   - ``pcp {unsigned}``: priority code point.
3701   - ``dei {unsigned}``: drop eligible indicator.
3702   - ``vid {unsigned}``: VLAN identifier.
3703   - ``inner_type {unsigned}``: inner EtherType or TPID.
3704
3705 - ``ipv4``: match IPv4 header.
3706
3707   - ``tos {unsigned}``: type of service.
3708   - ``ttl {unsigned}``: time to live.
3709   - ``proto {unsigned}``: next protocol ID.
3710   - ``src {ipv4 address}``: source address.
3711   - ``dst {ipv4 address}``: destination address.
3712
3713 - ``ipv6``: match IPv6 header.
3714
3715   - ``tc {unsigned}``: traffic class.
3716   - ``flow {unsigned}``: flow label.
3717   - ``proto {unsigned}``: protocol (next header).
3718   - ``hop {unsigned}``: hop limit.
3719   - ``src {ipv6 address}``: source address.
3720   - ``dst {ipv6 address}``: destination address.
3721
3722 - ``icmp``: match ICMP header.
3723
3724   - ``type {unsigned}``: ICMP packet type.
3725   - ``code {unsigned}``: ICMP packet code.
3726
3727 - ``udp``: match UDP header.
3728
3729   - ``src {unsigned}``: UDP source port.
3730   - ``dst {unsigned}``: UDP destination port.
3731
3732 - ``tcp``: match TCP header.
3733
3734   - ``src {unsigned}``: TCP source port.
3735   - ``dst {unsigned}``: TCP destination port.
3736
3737 - ``sctp``: match SCTP header.
3738
3739   - ``src {unsigned}``: SCTP source port.
3740   - ``dst {unsigned}``: SCTP destination port.
3741   - ``tag {unsigned}``: validation tag.
3742   - ``cksum {unsigned}``: checksum.
3743
3744 - ``vxlan``: match VXLAN header.
3745
3746   - ``vni {unsigned}``: VXLAN identifier.
3747
3748 - ``e_tag``: match IEEE 802.1BR E-Tag header.
3749
3750   - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
3751
3752 - ``nvgre``: match NVGRE header.
3753
3754   - ``tni {unsigned}``: virtual subnet ID.
3755
3756 - ``mpls``: match MPLS header.
3757
3758   - ``label {unsigned}``: MPLS label.
3759
3760 - ``gre``: match GRE header.
3761
3762   - ``protocol {unsigned}``: protocol type.
3763
3764 - ``fuzzy``: fuzzy pattern match, expect faster than default.
3765
3766   - ``thresh {unsigned}``: accuracy threshold.
3767
3768 - ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header.
3769
3770   - ``teid {unsigned}``: tunnel endpoint identifier.
3771
3772 - ``geneve``: match GENEVE header.
3773
3774   - ``vni {unsigned}``: virtual network identifier.
3775   - ``protocol {unsigned}``: protocol type.
3776
3777 - ``vxlan-gpe``: match VXLAN-GPE header.
3778
3779   - ``vni {unsigned}``: VXLAN-GPE identifier.
3780
3781 - ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4.
3782
3783   - ``sha {MAC-48}``: sender hardware address.
3784   - ``spa {ipv4 address}``: sender IPv4 address.
3785   - ``tha {MAC-48}``: target hardware address.
3786   - ``tpa {ipv4 address}``: target IPv4 address.
3787
3788 - ``ipv6_ext``: match presence of any IPv6 extension header.
3789
3790   - ``next_hdr {unsigned}``: next header.
3791
3792 - ``icmp6``: match any ICMPv6 header.
3793
3794   - ``type {unsigned}``: ICMPv6 type.
3795   - ``code {unsigned}``: ICMPv6 code.
3796
3797 - ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
3798
3799   - ``target_addr {ipv6 address}``: target address.
3800
3801 - ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement.
3802
3803   - ``target_addr {ipv6 address}``: target address.
3804
3805 - ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option.
3806
3807   - ``type {unsigned}``: ND option type.
3808
3809 - ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet
3810   link-layer address option.
3811
3812   - ``sla {MAC-48}``: source Ethernet LLA.
3813
3814 - ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet
3815   link-layer address option.
3816
3817   - ``tla {MAC-48}``: target Ethernet LLA.
3818
3819 - ``meta``: match application specific metadata.
3820
3821   - ``data {unsigned}``: metadata value.
3822
3823 Actions list
3824 ^^^^^^^^^^^^
3825
3826 A list of actions starts after the ``actions`` token in the same fashion as
3827 `Matching pattern`_; actions are separated by ``/`` tokens and the list is
3828 terminated by a mandatory ``end`` action.
3829
3830 Actions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
3831 rte_flow_action_type``).
3832
3833 Dropping all incoming UDPv4 packets can be expressed as follows::
3834
3835    testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3836       actions drop / end
3837
3838 Several actions have configurable properties which must be specified when
3839 there is no valid default value. For example, ``queue`` requires a target
3840 queue index.
3841
3842 This rule redirects incoming UDPv4 traffic to queue index 6::
3843
3844    testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3845       actions queue index 6 / end
3846
3847 While this one could be rejected by PMDs (unspecified queue index)::
3848
3849    testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3850       actions queue / end
3851
3852 As defined by *rte_flow*, the list is not ordered, all actions of a given
3853 rule are performed simultaneously. These are equivalent::
3854
3855    queue index 6 / void / mark id 42 / end
3856
3857 ::
3858
3859    void / mark id 42 / queue index 6 / end
3860
3861 All actions in a list should have different types, otherwise only the last
3862 action of a given type is taken into account::
3863
3864    queue index 4 / queue index 5 / queue index 6 / end # will use queue 6
3865
3866 ::
3867
3868    drop / drop / drop / end # drop is performed only once
3869
3870 ::
3871
3872    mark id 42 / queue index 3 / mark id 24 / end # mark will be 24
3873
3874 Considering they are performed simultaneously, opposite and overlapping
3875 actions can sometimes be combined when the end result is unambiguous::
3876
3877    drop / queue index 6 / end # drop has no effect
3878
3879 ::
3880
3881    queue index 6 / rss queues 6 7 8 / end # queue has no effect
3882
3883 ::
3884
3885    drop / passthru / end # drop has no effect
3886
3887 Note that PMDs may still refuse such combinations.
3888
3889 Actions
3890 ^^^^^^^
3891
3892 This section lists supported actions and their attributes, if any.
3893
3894 - ``end``: end list of actions.
3895
3896 - ``void``: no-op action.
3897
3898 - ``passthru``: let subsequent rule process matched packets.
3899
3900 - ``jump``: redirect traffic to group on device.
3901
3902   - ``group {unsigned}``: group to redirect to.
3903
3904 - ``mark``: attach 32 bit value to packets.
3905
3906   - ``id {unsigned}``: 32 bit value to return with packets.
3907
3908 - ``flag``: flag packets.
3909
3910 - ``queue``: assign packets to a given queue index.
3911
3912   - ``index {unsigned}``: queue index to use.
3913
3914 - ``drop``: drop packets (note: passthru has priority).
3915
3916 - ``count``: enable counters for this rule.
3917
3918 - ``rss``: spread packets among several queues.
3919
3920   - ``func {hash function}``: RSS hash function to apply, allowed tokens are
3921     the same as `set_hash_global_config`_.
3922
3923   - ``level {unsigned}``: encapsulation level for ``types``.
3924
3925   - ``types [{RSS hash type} [...]] end``: specific RSS hash types, allowed
3926     tokens are the same as `set_hash_input_set`_, except that an empty list
3927     does not disable RSS but instead requests unspecified "best-effort"
3928     settings.
3929
3930   - ``key {string}``: RSS hash key, overrides ``key_len``.
3931
3932   - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in
3933     conjunction with ``key`` to pad or truncate it.
3934
3935   - ``queues [{unsigned} [...]] end``: queue indices to use.
3936
3937 - ``pf``: direct traffic to physical function.
3938
3939 - ``vf``: direct traffic to a virtual function ID.
3940
3941   - ``original {boolean}``: use original VF ID if possible.
3942   - ``id {unsigned}``: VF ID.
3943
3944 - ``phy_port``: direct packets to physical port index.
3945
3946   - ``original {boolean}``: use original port index if possible.
3947   - ``index {unsigned}``: physical port index.
3948
3949 - ``port_id``: direct matching traffic to a given DPDK port ID.
3950
3951   - ``original {boolean}``: use original DPDK port ID if possible.
3952   - ``id {unsigned}``: DPDK port ID.
3953
3954 - ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``.
3955
3956   - ``mpls_ttl``: MPLS TTL.
3957
3958 - ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``.
3959
3960 - ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``.
3961
3962   - ``nw_ttl``: IP TTL.
3963
3964 - ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``.
3965
3966 - ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``.
3967
3968 - ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``.
3969
3970 - ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``.
3971
3972 - ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``.
3973
3974   - ``ethertype``: Ethertype.
3975
3976 - ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``.
3977
3978   - ``vlan_vid``: VLAN id.
3979
3980 - ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``.
3981
3982   - ``vlan_pcp``: VLAN priority.
3983
3984 - ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``.
3985
3986   - ``ethertype``: Ethertype.
3987
3988 - ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``.
3989
3990   - ``ethertype``: Ethertype.
3991
3992 - ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration
3993   is done through `Config VXLAN Encap outer layers`_.
3994
3995 - ``vxlan_decap``: Performs a decapsulation action by stripping all headers of
3996   the VXLAN tunnel network overlay from the matched flow.
3997
3998 - ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration
3999   is done through `Config NVGRE Encap outer layers`_.
4000
4001 - ``nvgre_decap``: Performs a decapsulation action by stripping all headers of
4002   the NVGRE tunnel network overlay from the matched flow.
4003
4004 - ``l2_encap``: Performs a L2 encapsulation, L2 configuration
4005   is done through `Config L2 Encap`_.
4006
4007 - ``l2_decap``: Performs a L2 decapsulation, L2 configuration
4008   is done through `Config L2 Decap`_.
4009
4010 - ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer
4011   configuration is done through `Config MPLSoGRE Encap outer layers`_.
4012
4013 - ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer
4014   configuration is done through `Config MPLSoGRE Decap outer layers`_.
4015
4016 - ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer
4017   configuration is done through `Config MPLSoUDP Encap outer layers`_.
4018
4019 - ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer
4020   configuration is done through `Config MPLSoUDP Decap outer layers`_.
4021
4022 - ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header.
4023
4024   - ``ipv4_addr``: New IPv4 source address.
4025
4026 - ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4
4027   header.
4028
4029   - ``ipv4_addr``: New IPv4 destination address.
4030
4031 - ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header.
4032
4033   - ``ipv6_addr``: New IPv6 source address.
4034
4035 - ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6
4036   header.
4037
4038   - ``ipv6_addr``: New IPv6 destination address.
4039
4040 - ``set_tp_src``: Set a new source port number in the outermost TCP/UDP
4041   header.
4042
4043   - ``port``: New TCP/UDP source port number.
4044
4045 - ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP
4046   header.
4047
4048   - ``port``: New TCP/UDP destination port number.
4049
4050 - ``mac_swap``: Swap the source and destination MAC addresses in the outermost
4051   Ethernet header.
4052
4053 - ``dec_ttl``: Performs a decrease TTL value action
4054
4055 - ``set_ttl``: Set TTL value with specified value
4056   - ``ttl_value {unsigned}``: The new TTL value to be set
4057
4058 - ``set_mac_src``: set source MAC address
4059
4060   - ``mac_addr {MAC-48}``: new source MAC address
4061
4062 - ``set_mac_dst``: set destination MAC address
4063
4064   - ``mac_addr {MAC-48}``: new destination MAC address
4065
4066 Destroying flow rules
4067 ~~~~~~~~~~~~~~~~~~~~~
4068
4069 ``flow destroy`` destroys one or more rules from their rule ID (as returned
4070 by ``flow create``), this command calls ``rte_flow_destroy()`` as many
4071 times as necessary::
4072
4073    flow destroy {port_id} rule {rule_id} [...]
4074
4075 If successful, it will show::
4076
4077    Flow rule #[...] destroyed
4078
4079 It does not report anything for rule IDs that do not exist. The usual error
4080 message is shown when a rule cannot be destroyed::
4081
4082    Caught error type [...] ([...]): [...]
4083
4084 ``flow flush`` destroys all rules on a device and does not take extra
4085 arguments. It is bound to ``rte_flow_flush()``::
4086
4087    flow flush {port_id}
4088
4089 Any errors are reported as above.
4090
4091 Creating several rules and destroying them::
4092
4093    testpmd> flow create 0 ingress pattern eth / ipv6 / end
4094       actions queue index 2 / end
4095    Flow rule #0 created
4096    testpmd> flow create 0 ingress pattern eth / ipv4 / end
4097       actions queue index 3 / end
4098    Flow rule #1 created
4099    testpmd> flow destroy 0 rule 0 rule 1
4100    Flow rule #1 destroyed
4101    Flow rule #0 destroyed
4102    testpmd>
4103
4104 The same result can be achieved using ``flow flush``::
4105
4106    testpmd> flow create 0 ingress pattern eth / ipv6 / end
4107       actions queue index 2 / end
4108    Flow rule #0 created
4109    testpmd> flow create 0 ingress pattern eth / ipv4 / end
4110       actions queue index 3 / end
4111    Flow rule #1 created
4112    testpmd> flow flush 0
4113    testpmd>
4114
4115 Non-existent rule IDs are ignored::
4116
4117    testpmd> flow create 0 ingress pattern eth / ipv6 / end
4118       actions queue index 2 / end
4119    Flow rule #0 created
4120    testpmd> flow create 0 ingress pattern eth / ipv4 / end
4121       actions queue index 3 / end
4122    Flow rule #1 created
4123    testpmd> flow destroy 0 rule 42 rule 10 rule 2
4124    testpmd>
4125    testpmd> flow destroy 0 rule 0
4126    Flow rule #0 destroyed
4127    testpmd>
4128
4129 Querying flow rules
4130 ~~~~~~~~~~~~~~~~~~~
4131
4132 ``flow query`` queries a specific action of a flow rule having that
4133 ability. Such actions collect information that can be reported using this
4134 command. It is bound to ``rte_flow_query()``::
4135
4136    flow query {port_id} {rule_id} {action}
4137
4138 If successful, it will display either the retrieved data for known actions
4139 or the following message::
4140
4141    Cannot display result for action type [...] ([...])
4142
4143 Otherwise, it will complain either that the rule does not exist or that some
4144 error occurred::
4145
4146    Flow rule #[...] not found
4147
4148 ::
4149
4150    Caught error type [...] ([...]): [...]
4151
4152 Currently only the ``count`` action is supported. This action reports the
4153 number of packets that hit the flow rule and the total number of bytes. Its
4154 output has the following format::
4155
4156    count:
4157     hits_set: [...] # whether "hits" contains a valid value
4158     bytes_set: [...] # whether "bytes" contains a valid value
4159     hits: [...] # number of packets
4160     bytes: [...] # number of bytes
4161
4162 Querying counters for TCPv6 packets redirected to queue 6::
4163
4164    testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end
4165       actions queue index 6 / count / end
4166    Flow rule #4 created
4167    testpmd> flow query 0 4 count
4168    count:
4169     hits_set: 1
4170     bytes_set: 0
4171     hits: 386446
4172     bytes: 0
4173    testpmd>
4174
4175 Listing flow rules
4176 ~~~~~~~~~~~~~~~~~~
4177
4178 ``flow list`` lists existing flow rules sorted by priority and optionally
4179 filtered by group identifiers::
4180
4181    flow list {port_id} [group {group_id}] [...]
4182
4183 This command only fails with the following message if the device does not
4184 exist::
4185
4186    Invalid port [...]
4187
4188 Output consists of a header line followed by a short description of each
4189 flow rule, one per line. There is no output at all when no flow rules are
4190 configured on the device::
4191
4192    ID      Group   Prio    Attr    Rule
4193    [...]   [...]   [...]   [...]   [...]
4194
4195 ``Attr`` column flags:
4196
4197 - ``i`` for ``ingress``.
4198 - ``e`` for ``egress``.
4199
4200 Creating several flow rules and listing them::
4201
4202    testpmd> flow create 0 ingress pattern eth / ipv4 / end
4203       actions queue index 6 / end
4204    Flow rule #0 created
4205    testpmd> flow create 0 ingress pattern eth / ipv6 / end
4206       actions queue index 2 / end
4207    Flow rule #1 created
4208    testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end
4209       actions rss queues 6 7 8 end / end
4210    Flow rule #2 created
4211    testpmd> flow list 0
4212    ID      Group   Prio    Attr    Rule
4213    0       0       0       i-      ETH IPV4 => QUEUE
4214    1       0       0       i-      ETH IPV6 => QUEUE
4215    2       0       5       i-      ETH IPV4 UDP => RSS
4216    testpmd>
4217
4218 Rules are sorted by priority (i.e. group ID first, then priority level)::
4219
4220    testpmd> flow list 1
4221    ID      Group   Prio    Attr    Rule
4222    0       0       0       i-      ETH => COUNT
4223    6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4224    5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4225    1       24      0       i-      ETH IPV4 UDP => QUEUE
4226    4       24      10      i-      ETH IPV4 TCP => DROP
4227    3       24      20      i-      ETH IPV4 => DROP
4228    2       24      42      i-      ETH IPV4 UDP => QUEUE
4229    7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4230    testpmd>
4231
4232 Output can be limited to specific groups::
4233
4234    testpmd> flow list 1 group 0 group 63
4235    ID      Group   Prio    Attr    Rule
4236    0       0       0       i-      ETH => COUNT
4237    6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4238    5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4239    7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4240    testpmd>
4241
4242 Toggling isolated mode
4243 ~~~~~~~~~~~~~~~~~~~~~~
4244
4245 ``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4246 must only be injected from the defined flow rules; that no default traffic
4247 is expected outside those rules and the driver is free to assign more
4248 resources to handle them. It is bound to ``rte_flow_isolate()``::
4249
4250  flow isolate {port_id} {boolean}
4251
4252 If successful, enabling or disabling isolated mode shows either::
4253
4254  Ingress traffic on port [...]
4255     is now restricted to the defined flow rules
4256
4257 Or::
4258
4259  Ingress traffic on port [...]
4260     is not restricted anymore to the defined flow rules
4261
4262 Otherwise, in case of error::
4263
4264    Caught error type [...] ([...]): [...]
4265
4266 Mainly due to its side effects, PMDs supporting this mode may not have the
4267 ability to toggle it more than once without reinitializing affected ports
4268 first (e.g. by exiting testpmd).
4269
4270 Enabling isolated mode::
4271
4272  testpmd> flow isolate 0 true
4273  Ingress traffic on port 0 is now restricted to the defined flow rules
4274  testpmd>
4275
4276 Disabling isolated mode::
4277
4278  testpmd> flow isolate 0 false
4279  Ingress traffic on port 0 is not restricted anymore to the defined flow rules
4280  testpmd>
4281
4282 Sample QinQ flow rules
4283 ~~~~~~~~~~~~~~~~~~~~~~
4284
4285 Before creating QinQ rule(s) the following commands should be issued to enable QinQ::
4286
4287    testpmd> port stop 0
4288    testpmd> vlan set qinq on 0
4289
4290 The above command sets the inner and outer TPID's to 0x8100.
4291
4292 To change the TPID's the following commands should be used::
4293
4294    testpmd> vlan set outer tpid 0xa100 0
4295    testpmd> vlan set inner tpid 0x9100 0
4296    testpmd> port start 0
4297
4298 Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
4299
4300 ::
4301
4302    testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 /
4303        vlan tci is 456 / end actions vf id 1 / queue index 0 / end
4304    Flow rule #0 validated
4305
4306    testpmd> flow create 0 ingress pattern eth / vlan tci is 4 /
4307        vlan tci is 456 / end actions vf id 123 / queue index 0 / end
4308    Flow rule #0 created
4309
4310    testpmd> flow list 0
4311    ID      Group   Prio    Attr    Rule
4312    0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
4313
4314 Validate and create a QinQ rule on port 0 to steer traffic to a queue on the host.
4315
4316 ::
4317
4318    testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 /
4319         vlan tci is 654 / end actions pf / queue index 0 / end
4320    Flow rule #1 validated
4321
4322    testpmd> flow create 0 ingress pattern eth / vlan tci is 321 /
4323         vlan tci is 654 / end actions pf / queue index 1 / end
4324    Flow rule #1 created
4325
4326    testpmd> flow list 0
4327    ID      Group   Prio    Attr    Rule
4328    0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
4329    1       0       0       i-      ETH VLAN VLAN=>PF QUEUE
4330
4331 Sample VXLAN encapsulation rule
4332 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4333
4334 VXLAN encapsulation outer layer has default value pre-configured in testpmd
4335 source code, those can be changed by using the following commands
4336
4337 IPv4 VXLAN outer header::
4338
4339  testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
4340         ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4341  testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4342         queue index 0 / end
4343
4344  testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src
4345          127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4346          eth-dst 22:22:22:22:22:22
4347  testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4348          queue index 0 / end
4349
4350 IPv6 VXLAN outer header::
4351
4352  testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1
4353         ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4354  testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4355          queue index 0 / end
4356
4357  testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4
4358          ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11
4359          eth-dst 22:22:22:22:22:22
4360  testpmd> flow create 0 ingress pattern end actions vxlan_encap /
4361          queue index 0 / end
4362
4363 Sample NVGRE encapsulation rule
4364 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4365
4366 NVGRE encapsulation outer layer has default value pre-configured in testpmd
4367 source code, those can be changed by using the following commands
4368
4369 IPv4 NVGRE outer header::
4370
4371  testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
4372         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4373  testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4374         queue index 0 / end
4375
4376  testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1
4377          ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4378          eth-dst 22:22:22:22:22:22
4379  testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4380          queue index 0 / end
4381
4382 IPv6 NVGRE outer header::
4383
4384  testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4385         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4386  testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4387         queue index 0 / end
4388
4389  testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4390         vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4391  testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4392         queue index 0 / end
4393
4394 Sample L2 encapsulation rule
4395 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4396
4397 L2 encapsulation has default value pre-configured in testpmd
4398 source code, those can be changed by using the following commands
4399
4400 L2 header::
4401
4402  testpmd> set l2_encap ip-version ipv4
4403         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4404  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4405         mplsoudp_decap / l2_encap / end
4406
4407 L2 with VXLAN header::
4408
4409  testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34
4410          eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4411  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4412         mplsoudp_decap / l2_encap / end
4413
4414 Sample L2 decapsulation rule
4415 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4416
4417 L2 decapsulation has default value pre-configured in testpmd
4418 source code, those can be changed by using the following commands
4419
4420 L2 header::
4421
4422  testpmd> set l2_decap
4423  testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap /
4424         queue index 0 / end
4425
4426 L2 with VXLAN header::
4427
4428  testpmd> set l2_encap-with-vlan
4429  testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap /
4430          queue index 0 / end
4431
4432 Sample MPLSoGRE encapsulation rule
4433 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4434
4435 MPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
4436 source code, those can be changed by using the following commands
4437
4438 IPv4 MPLSoGRE outer header::
4439
4440  testpmd> set mplsogre_encap ip-version ipv4 label 4
4441         ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4442         eth-dst 22:22:22:22:22:22
4443  testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4444         mplsogre_encap / end
4445
4446 IPv4 MPLSoGRE with VLAN outer header::
4447
4448  testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4
4449         ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4450         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4451  testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4452         mplsogre_encap / end
4453
4454 IPv6 MPLSoGRE outer header::
4455
4456  testpmd> set mplsogre_encap ip-version ipv6 mask 4
4457         ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4458         eth-dst 22:22:22:22:22:22
4459  testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4460         mplsogre_encap / end
4461
4462 IPv6 MPLSoGRE with VLAN outer header::
4463
4464  testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4
4465         ip-src ::1 ip-dst ::2222 vlan-tci 34
4466         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4467  testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4468         mplsogre_encap / end
4469
4470 Sample MPLSoGRE decapsulation rule
4471 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4472
4473 MPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
4474 source code, those can be changed by using the following commands
4475
4476 IPv4 MPLSoGRE outer header::
4477
4478  testpmd> set mplsogre_decap ip-version ipv4
4479  testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions
4480         mplsogre_decap / l2_encap / end
4481
4482 IPv4 MPLSoGRE with VLAN outer header::
4483
4484  testpmd> set mplsogre_decap-with-vlan ip-version ipv4
4485  testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end
4486         actions mplsogre_decap / l2_encap / end
4487
4488 IPv6 MPLSoGRE outer header::
4489
4490  testpmd> set mplsogre_decap ip-version ipv6
4491  testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end
4492         actions mplsogre_decap / l2_encap / end
4493
4494 IPv6 MPLSoGRE with VLAN outer header::
4495
4496  testpmd> set mplsogre_decap-with-vlan ip-version ipv6
4497  testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end
4498         actions mplsogre_decap / l2_encap / end
4499
4500 Sample MPLSoUDP encapsulation rule
4501 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4502
4503 MPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
4504 source code, those can be changed by using the following commands
4505
4506 IPv4 MPLSoUDP outer header::
4507
4508  testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10
4509         ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4510         eth-dst 22:22:22:22:22:22
4511  testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4512         mplsoudp_encap / end
4513
4514 IPv4 MPLSoUDP with VLAN outer header::
4515
4516  testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5
4517         udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4518         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4519  testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4520         mplsoudp_encap / end
4521
4522 IPv6 MPLSoUDP outer header::
4523
4524  testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10
4525         ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4526         eth-dst 22:22:22:22:22:22
4527  testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4528         mplsoudp_encap / end
4529
4530 IPv6 MPLSoUDP with VLAN outer header::
4531
4532  testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5
4533         udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34
4534         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4535  testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4536         mplsoudp_encap / end
4537
4538 Sample MPLSoUDP decapsulation rule
4539 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4540
4541 MPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
4542 source code, those can be changed by using the following commands
4543
4544 IPv4 MPLSoUDP outer header::
4545
4546  testpmd> set mplsoudp_decap ip-version ipv4
4547  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4548         mplsoudp_decap / l2_encap / end
4549
4550 IPv4 MPLSoUDP with VLAN outer header::
4551
4552  testpmd> set mplsoudp_decap-with-vlan ip-version ipv4
4553  testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end
4554         actions mplsoudp_decap / l2_encap / end
4555
4556 IPv6 MPLSoUDP outer header::
4557
4558  testpmd> set mplsoudp_decap ip-version ipv6
4559  testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end
4560         actions mplsoudp_decap / l2_encap / end
4561
4562 IPv6 MPLSoUDP with VLAN outer header::
4563
4564  testpmd> set mplsoudp_decap-with-vlan ip-version ipv6
4565  testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end
4566         actions mplsoudp_decap / l2_encap / end
4567
4568 BPF Functions
4569 --------------
4570
4571 The following sections show functions to load/unload eBPF based filters.
4572
4573 bpf-load
4574 ~~~~~~~~
4575
4576 Load an eBPF program as a callback for particular RX/TX queue::
4577
4578    testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename)
4579
4580 The available load-flags are:
4581
4582 * ``J``: use JIT generated native code, otherwise BPF interpreter will be used.
4583
4584 * ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data.
4585
4586 * ``-``: none.
4587
4588 .. note::
4589
4590    You'll need clang v3.7 or above to build bpf program you'd like to load
4591
4592 For example:
4593
4594 .. code-block:: console
4595
4596    cd test/bpf
4597    clang -O2 -target bpf -c t1.c
4598
4599 Then to load (and JIT compile) t1.o at RX queue 0, port 1:
4600
4601 .. code-block:: console
4602
4603    testpmd> bpf-load rx 1 0 J ./dpdk.org/test/bpf/t1.o
4604
4605 To load (not JITed) t1.o at TX queue 0, port 0:
4606
4607 .. code-block:: console
4608
4609    testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o
4610
4611 bpf-unload
4612 ~~~~~~~~~~
4613
4614 Unload previously loaded eBPF program for particular RX/TX queue::
4615
4616    testpmd> bpf-unload rx|tx (portid) (queueid)
4617
4618 For example to unload BPF filter from TX queue 0, port 0:
4619
4620 .. code-block:: console
4621
4622    testpmd> bpf-load tx 0 0 - ./dpdk.org/test/bpf/t1.o