xref: /dpdk/doc/guides/testpmd_app_ug/testpmd_funcs.rst (revision 1cde1b9a9b4dbf31cb5e5ccdfc5da3cb079f43a2)
15630257fSFerruh Yigit..  SPDX-License-Identifier: BSD-3-Clause
25630257fSFerruh Yigit    Copyright(c) 2010-2016 Intel Corporation.
3ac718398SBernard Iremonger
4e76d7a76SJohn McNamara.. _testpmd_runtime:
5e76d7a76SJohn McNamara
6ac718398SBernard IremongerTestpmd Runtime Functions
7ac718398SBernard Iremonger=========================
8ac718398SBernard Iremonger
9e76d7a76SJohn McNamaraWhere the testpmd application is started in interactive mode, (``-i|--interactive``),
10ac718398SBernard Iremongerit displays a prompt that can be used to start and stop forwarding,
110e51eb87SMaryam Tahhanconfigure the application, display statistics (including the extended NIC
120e51eb87SMaryam Tahhanstatistics aka xstats) , set the Flow Director and other tasks::
13ac718398SBernard Iremonger
14ac718398SBernard Iremonger   testpmd>
15ac718398SBernard Iremonger
16ac718398SBernard IremongerThe testpmd prompt has some, limited, readline support.
17e76d7a76SJohn McNamaraCommon bash command-line functions such as ``Ctrl+a`` and ``Ctrl+e`` to go to the start and end of the prompt line are supported
18ac718398SBernard Iremongeras well as access to the command history via the up-arrow.
19ac718398SBernard Iremonger
20ac718398SBernard IremongerThere is also support for tab completion.
21e76d7a76SJohn McNamaraIf you type a partial command and hit ``<TAB>`` you get a list of the available completions:
22ac718398SBernard Iremonger
23ac718398SBernard Iremonger.. code-block:: console
24ac718398SBernard Iremonger
25ac718398SBernard Iremonger   testpmd> show port <TAB>
26ac718398SBernard Iremonger
27d28645c7SQiming Yang       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
28d28645c7SQiming Yang       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
29d28645c7SQiming Yang       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
30d28645c7SQiming Yang       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
31ac718398SBernard Iremonger       ...
32ac718398SBernard Iremonger
33e76d7a76SJohn McNamara
34e76d7a76SJohn McNamara.. note::
35e76d7a76SJohn McNamara
36e76d7a76SJohn McNamara   Some examples in this document are too long to fit on one line are are shown wrapped at `"\\"` for display purposes::
37e76d7a76SJohn McNamara
38e76d7a76SJohn McNamara      testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
39e76d7a76SJohn McNamara               (pause_time) (send_xon) (port_id)
40e76d7a76SJohn McNamara
41e76d7a76SJohn McNamaraIn the real ``testpmd>`` prompt these commands should be on a single line.
42e76d7a76SJohn McNamara
43ac718398SBernard IremongerHelp Functions
44ac718398SBernard Iremonger--------------
45ac718398SBernard Iremonger
46ac718398SBernard IremongerThe testpmd has on-line help for the functions that are available at runtime.
47ac718398SBernard IremongerThese are divided into sections and can be accessed using help, help section or help all:
48ac718398SBernard Iremonger
49ac718398SBernard Iremonger.. code-block:: console
50ac718398SBernard Iremonger
51ac718398SBernard Iremonger   testpmd> help
52ac718398SBernard Iremonger
53ac718398SBernard Iremonger       help control    : Start and stop forwarding.
54ac718398SBernard Iremonger       help display    : Displaying port, stats and config information.
55ac718398SBernard Iremonger       help config     : Configuration information.
56ac718398SBernard Iremonger       help ports      : Configuring ports.
57ac718398SBernard Iremonger       help registers  : Reading and setting port registers.
58ac718398SBernard Iremonger       help filters    : Filters configuration help.
59ac718398SBernard Iremonger       help all        : All of the above sections.
60ac718398SBernard Iremonger
61e76d7a76SJohn McNamara
6281ef862bSAllain LegacyCommand File Functions
6381ef862bSAllain Legacy----------------------
6481ef862bSAllain Legacy
6581ef862bSAllain LegacyTo facilitate loading large number of commands or to avoid cutting and pasting where not
6681ef862bSAllain Legacypractical or possible testpmd supports alternative methods for executing commands.
6781ef862bSAllain Legacy
6881ef862bSAllain Legacy* If started with the ``--cmdline-file=FILENAME`` command line argument testpmd
6981ef862bSAllain Legacy  will execute all CLI commands contained within the file immediately before
7081ef862bSAllain Legacy  starting packet forwarding or entering interactive mode.
7181ef862bSAllain Legacy
7281ef862bSAllain Legacy.. code-block:: console
7381ef862bSAllain Legacy
7481ef862bSAllain Legacy   ./testpmd -n4 -r2 ... -- -i --cmdline-file=/home/ubuntu/flow-create-commands.txt
7581ef862bSAllain Legacy   Interactive-mode selected
7681ef862bSAllain Legacy   CLI commands to be read from /home/ubuntu/flow-create-commands.txt
7781ef862bSAllain Legacy   Configuring Port 0 (socket 0)
7881ef862bSAllain Legacy   Port 0: 7C:FE:90:CB:74:CE
7981ef862bSAllain Legacy   Configuring Port 1 (socket 0)
8081ef862bSAllain Legacy   Port 1: 7C:FE:90:CB:74:CA
8181ef862bSAllain Legacy   Checking link statuses...
8281ef862bSAllain Legacy   Port 0 Link Up - speed 10000 Mbps - full-duplex
8381ef862bSAllain Legacy   Port 1 Link Up - speed 10000 Mbps - full-duplex
8481ef862bSAllain Legacy   Done
8581ef862bSAllain Legacy   Flow rule #0 created
8681ef862bSAllain Legacy   Flow rule #1 created
8781ef862bSAllain Legacy   ...
8881ef862bSAllain Legacy   ...
8981ef862bSAllain Legacy   Flow rule #498 created
9081ef862bSAllain Legacy   Flow rule #499 created
9181ef862bSAllain Legacy   Read all CLI commands from /home/ubuntu/flow-create-commands.txt
9281ef862bSAllain Legacy   testpmd>
9381ef862bSAllain Legacy
9481ef862bSAllain Legacy
95a8c6a1aeSAllain Legacy* At run-time additional commands can be loaded in bulk by invoking the ``load FILENAME``
96a8c6a1aeSAllain Legacy  command.
97a8c6a1aeSAllain Legacy
98a8c6a1aeSAllain Legacy.. code-block:: console
99a8c6a1aeSAllain Legacy
100a8c6a1aeSAllain Legacy   testpmd> load /home/ubuntu/flow-create-commands.txt
101a8c6a1aeSAllain Legacy   Flow rule #0 created
102a8c6a1aeSAllain Legacy   Flow rule #1 created
103a8c6a1aeSAllain Legacy   ...
104a8c6a1aeSAllain Legacy   ...
105a8c6a1aeSAllain Legacy   Flow rule #498 created
106a8c6a1aeSAllain Legacy   Flow rule #499 created
107a8c6a1aeSAllain Legacy   Read all CLI commands from /home/ubuntu/flow-create-commands.txt
108a8c6a1aeSAllain Legacy   testpmd>
109a8c6a1aeSAllain Legacy
110a8c6a1aeSAllain Legacy
11181ef862bSAllain LegacyIn all cases output from any included command will be displayed as standard output.
11281ef862bSAllain LegacyExecution will continue until the end of the file is reached regardless of
11381ef862bSAllain Legacywhether any errors occur.  The end user must examine the output to determine if
11481ef862bSAllain Legacyany failures occurred.
11581ef862bSAllain Legacy
11681ef862bSAllain Legacy
117ac718398SBernard IremongerControl Functions
118ac718398SBernard Iremonger-----------------
119ac718398SBernard Iremonger
120ac718398SBernard Iremongerstart
121ac718398SBernard Iremonger~~~~~
122ac718398SBernard Iremonger
123e76d7a76SJohn McNamaraStart packet forwarding with current configuration::
124ac718398SBernard Iremonger
125e76d7a76SJohn McNamara   testpmd> start
126ac718398SBernard Iremonger
127ac718398SBernard Iremongerstart tx_first
128ac718398SBernard Iremonger~~~~~~~~~~~~~~
129ac718398SBernard Iremonger
130acbf77a6SZhihong WangStart packet forwarding with current configuration after sending specified number of bursts of packets::
131ac718398SBernard Iremonger
132acbf77a6SZhihong Wang   testpmd> start tx_first (""|burst_num)
133acbf77a6SZhihong Wang
134acbf77a6SZhihong WangThe default burst number is 1 when ``burst_num`` not presented.
135ac718398SBernard Iremonger
136ac718398SBernard Iremongerstop
137ac718398SBernard Iremonger~~~~
138ac718398SBernard Iremonger
139e76d7a76SJohn McNamaraStop packet forwarding, and display accumulated statistics::
140ac718398SBernard Iremonger
141e76d7a76SJohn McNamara   testpmd> stop
142ac718398SBernard Iremonger
143ac718398SBernard Iremongerquit
144ac718398SBernard Iremonger~~~~
145ac718398SBernard Iremonger
146e76d7a76SJohn McNamaraQuit to prompt::
147ac718398SBernard Iremonger
148e76d7a76SJohn McNamara   testpmd> quit
149e76d7a76SJohn McNamara
150ac718398SBernard Iremonger
151ac718398SBernard IremongerDisplay Functions
152ac718398SBernard Iremonger-----------------
153ac718398SBernard Iremonger
154ac718398SBernard IremongerThe functions in the following sections are used to display information about the
155ac718398SBernard Iremongertestpmd configuration or the NIC status.
156ac718398SBernard Iremonger
157ac718398SBernard Iremongershow port
158ac718398SBernard Iremonger~~~~~~~~~
159ac718398SBernard Iremonger
160e76d7a76SJohn McNamaraDisplay information for a given port or all ports::
161ac718398SBernard Iremonger
1624bfcbcf5SEmma Finn   testpmd> show port (info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)
163ac718398SBernard Iremonger
164ac718398SBernard IremongerThe available information categories are:
165ac718398SBernard Iremonger
166e76d7a76SJohn McNamara* ``info``: General port information such as MAC address.
167ac718398SBernard Iremonger
1684bfcbcf5SEmma Finn* ``summary``: Brief port summary such as Device Name, Driver Name etc.
1694bfcbcf5SEmma Finn
170e76d7a76SJohn McNamara* ``stats``: RX/TX statistics.
171ac718398SBernard Iremonger
1720e51eb87SMaryam Tahhan* ``xstats``: RX/TX extended NIC statistics.
1730e51eb87SMaryam Tahhan
174e76d7a76SJohn McNamara* ``fdir``: Flow Director information and statistics.
175ac718398SBernard Iremonger
176e76d7a76SJohn McNamara* ``stat_qmap``: Queue statistics mapping.
177ac718398SBernard Iremonger
178cd80f411SJingjing Wu* ``dcb_tc``: DCB information such as TC mapping.
179cd80f411SJingjing Wu
180d28645c7SQiming Yang* ``cap``: Supported offload capabilities.
181d28645c7SQiming Yang
182ac718398SBernard IremongerFor example:
183ac718398SBernard Iremonger
184ac718398SBernard Iremonger.. code-block:: console
185ac718398SBernard Iremonger
186ac718398SBernard Iremonger   testpmd> show port info 0
187ac718398SBernard Iremonger
188ac718398SBernard Iremonger   ********************* Infos for port 0 *********************
189ac718398SBernard Iremonger
190ac718398SBernard Iremonger   MAC address: XX:XX:XX:XX:XX:XX
191ef7d2866SHelin Zhang   Connect to socket: 0
192ef7d2866SHelin Zhang   memory allocation on the socket: 0
193ac718398SBernard Iremonger   Link status: up
194ef7d2866SHelin Zhang   Link speed: 40000 Mbps
195ac718398SBernard Iremonger   Link duplex: full-duplex
196ac718398SBernard Iremonger   Promiscuous mode: enabled
197ac718398SBernard Iremonger   Allmulticast mode: disabled
198ef7d2866SHelin Zhang   Maximum number of MAC addresses: 64
199ef7d2866SHelin Zhang   Maximum number of MAC addresses of hash filtering: 0
200ac718398SBernard Iremonger   VLAN offload:
201ac718398SBernard Iremonger       strip on
202ac718398SBernard Iremonger       filter on
203ac718398SBernard Iremonger       qinq(extend) off
204ef7d2866SHelin Zhang   Redirection table size: 512
205ef7d2866SHelin Zhang   Supported flow types:
206ef7d2866SHelin Zhang     ipv4-frag
207ef7d2866SHelin Zhang     ipv4-tcp
208ef7d2866SHelin Zhang     ipv4-udp
209ef7d2866SHelin Zhang     ipv4-sctp
210ef7d2866SHelin Zhang     ipv4-other
211ef7d2866SHelin Zhang     ipv6-frag
212ef7d2866SHelin Zhang     ipv6-tcp
213ef7d2866SHelin Zhang     ipv6-udp
214ef7d2866SHelin Zhang     ipv6-sctp
215ef7d2866SHelin Zhang     ipv6-other
216ef7d2866SHelin Zhang     l2_payload
217f56620ddSJerin Jacob     port
218f56620ddSJerin Jacob     vxlan
219f56620ddSJerin Jacob     geneve
220f56620ddSJerin Jacob     nvgre
2211aec68d1SQiming Yang     vxlan-gpe
222ac718398SBernard Iremonger
2236fe5f2f7SPablo de Larashow port rss reta
2246fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~~
2256fe5f2f7SPablo de Lara
226e76d7a76SJohn McNamaraDisplay the rss redirection table entry indicated by masks on port X::
2276fe5f2f7SPablo de Lara
228e76d7a76SJohn McNamara   testpmd> show port (port_id) rss reta (size) (mask0, mask1...)
2296fe5f2f7SPablo de Lara
2306fe5f2f7SPablo de Larasize is used to indicate the hardware supported reta size
2316fe5f2f7SPablo de Lara
232ac718398SBernard Iremongershow port rss-hash
233ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~
234ac718398SBernard Iremonger
235e76d7a76SJohn McNamaraDisplay the RSS hash functions and RSS hash key of a port::
236ac718398SBernard Iremonger
2375b4557ecSFerruh Yigit   testpmd> show port (port_id) rss-hash [key]
2385e2d17aeSPablo de Lara
2395e2d17aeSPablo de Laraclear port
2405e2d17aeSPablo de Lara~~~~~~~~~~
241ac718398SBernard Iremonger
242e76d7a76SJohn McNamaraClear the port statistics for a given port or for all ports::
243ac718398SBernard Iremonger
2440e51eb87SMaryam Tahhan   testpmd> clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)
245ac718398SBernard Iremonger
246e76d7a76SJohn McNamaraFor example::
247ac718398SBernard Iremonger
248ac718398SBernard Iremonger   testpmd> clear port stats all
249ac718398SBernard Iremonger
25057ccb278SKonstantin Ananyevshow (rxq|txq)
25157ccb278SKonstantin Ananyev~~~~~~~~~~~~~~
25257ccb278SKonstantin Ananyev
25357ccb278SKonstantin AnanyevDisplay information for a given port's RX/TX queue::
25457ccb278SKonstantin Ananyev
25557ccb278SKonstantin Ananyev   testpmd> show (rxq|txq) info (port_id) (queue_id)
25657ccb278SKonstantin Ananyev
257ac718398SBernard Iremongershow config
258ac718398SBernard Iremonger~~~~~~~~~~~
259ac718398SBernard Iremonger
260ac718398SBernard IremongerDisplays the configuration of the application.
261e76d7a76SJohn McNamaraThe configuration comes from the command-line, the runtime or the application defaults::
262ac718398SBernard Iremonger
26379bec05bSKonstantin Ananyev   testpmd> show config (rxtx|cores|fwd|txpkts)
264ac718398SBernard Iremonger
265ac718398SBernard IremongerThe available information categories are:
266ac718398SBernard Iremonger
267e76d7a76SJohn McNamara* ``rxtx``: RX/TX configuration items.
268ac718398SBernard Iremonger
269e76d7a76SJohn McNamara* ``cores``: List of forwarding cores.
270ac718398SBernard Iremonger
271e76d7a76SJohn McNamara* ``fwd``: Packet forwarding configuration.
272ac718398SBernard Iremonger
27379bec05bSKonstantin Ananyev* ``txpkts``: Packets to TX configuration.
27479bec05bSKonstantin Ananyev
275ac718398SBernard IremongerFor example:
276ac718398SBernard Iremonger
277ac718398SBernard Iremonger.. code-block:: console
278ac718398SBernard Iremonger
279ac718398SBernard Iremonger   testpmd> show config rxtx
280ac718398SBernard Iremonger
281ac718398SBernard Iremonger   io packet forwarding - CRC stripping disabled - packets/burst=16
282ac718398SBernard Iremonger   nb forwarding cores=2 - nb forwarding ports=1
283ac718398SBernard Iremonger   RX queues=1 - RX desc=128 - RX free threshold=0
284ac718398SBernard Iremonger   RX threshold registers: pthresh=8 hthresh=8 wthresh=4
285ac718398SBernard Iremonger   TX queues=1 - TX desc=512 - TX free threshold=0
286ac718398SBernard Iremonger   TX threshold registers: pthresh=36 hthresh=0 wthresh=0
287ac718398SBernard Iremonger   TX RS bit threshold=0 - TXQ flags=0x0
288ac718398SBernard Iremonger
289e76d7a76SJohn McNamaraset fwd
290e76d7a76SJohn McNamara~~~~~~~
291e76d7a76SJohn McNamara
292e76d7a76SJohn McNamaraSet the packet forwarding mode::
293e76d7a76SJohn McNamara
294bf56fce1SZhihong Wang   testpmd> set fwd (io|mac|macswap|flowgen| \
2953c156061SJens Freimann                     rxonly|txonly|csum|icmpecho|noisy) (""|retry)
296bf56fce1SZhihong Wang
297bf56fce1SZhihong Wang``retry`` can be specified for forwarding engines except ``rx_only``.
298e76d7a76SJohn McNamara
299e76d7a76SJohn McNamaraThe available information categories are:
300e76d7a76SJohn McNamara
301e76d7a76SJohn McNamara* ``io``: Forwards packets "as-is" in I/O mode.
302e76d7a76SJohn McNamara  This is the fastest possible forwarding operation as it does not access packets data.
303e76d7a76SJohn McNamara  This is the default mode.
304e76d7a76SJohn McNamara
305e76d7a76SJohn McNamara* ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them.
306d629b7b5SJohn McNamara  Default application behavior is to set source Ethernet address to that of the transmitting interface, and destination
307a67857e9SMark Kavanagh  address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or
308132a08b5SRami Rosen  'eth-peers-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address.
309e76d7a76SJohn McNamara
310e76d7a76SJohn McNamara* ``macswap``: MAC swap forwarding mode.
311e76d7a76SJohn McNamara  Swaps the source and the destination Ethernet addresses of packets before forwarding them.
312e76d7a76SJohn McNamara
313e76d7a76SJohn McNamara* ``flowgen``: Multi-flow generation mode.
314e76d7a76SJohn McNamara  Originates a number of flows (with varying destination IP addresses), and terminate receive traffic.
315e76d7a76SJohn McNamara
316e76d7a76SJohn McNamara* ``rxonly``: Receives packets but doesn't transmit them.
317e76d7a76SJohn McNamara
318e76d7a76SJohn McNamara* ``txonly``: Generates and transmits packets without receiving any.
319e76d7a76SJohn McNamara
320e76d7a76SJohn McNamara* ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet.
321e76d7a76SJohn McNamara
32210ad83d0SRami Rosen* ``icmpecho``: Receives a burst of packets, lookup for ICMP echo requests and, if any, send back ICMP echo replies.
323e76d7a76SJohn McNamara
324e76d7a76SJohn McNamara* ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX. Requires ``CONFIG_RTE_LIBRTE_IEEE1588=y``.
325e76d7a76SJohn McNamara
3268d9d4c24SJasvinder Singh* ``softnic``: Demonstrates the softnic forwarding operation. In this mode, packet forwarding is
3278d9d4c24SJasvinder Singh  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``.
3285b590fbeSJasvinder Singh
329d629b7b5SJohn McNamara* ``noisy``: Noisy neighbor simulation.
3303c156061SJens Freimann  Simulate more realistic behavior of a guest machine engaged in receiving
3313c156061SJens Freimann  and sending packets performing Virtual Network Function (VNF).
3323c156061SJens Freimann
333e76d7a76SJohn McNamaraExample::
334e76d7a76SJohn McNamara
335e76d7a76SJohn McNamara   testpmd> set fwd rxonly
336e76d7a76SJohn McNamara
337e76d7a76SJohn McNamara   Set rxonly packet forwarding mode
338e76d7a76SJohn McNamara
339e76d7a76SJohn McNamara
34053324971SDavid Marchandshow fwd
34153324971SDavid Marchand~~~~~~~~
34253324971SDavid Marchand
34353324971SDavid MarchandWhen running, forwarding engines maintain statistics from the time they have been started.
34453324971SDavid MarchandExample for the io forwarding engine, with some packet drops on the tx side::
34553324971SDavid Marchand
34653324971SDavid Marchand   testpmd> show fwd stats all
34753324971SDavid Marchand
34853324971SDavid Marchand     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
34953324971SDavid Marchand     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
35053324971SDavid Marchand
35153324971SDavid Marchand     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
35253324971SDavid Marchand     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
35353324971SDavid Marchand
35453324971SDavid Marchand     ---------------------- Forward statistics for port 0  ----------------------
35553324971SDavid Marchand     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
35653324971SDavid Marchand     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
35753324971SDavid Marchand     ----------------------------------------------------------------------------
35853324971SDavid Marchand
35953324971SDavid Marchand     ---------------------- Forward statistics for port 1  ----------------------
36053324971SDavid Marchand     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
36153324971SDavid Marchand     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
36253324971SDavid Marchand     ----------------------------------------------------------------------------
36353324971SDavid Marchand
36453324971SDavid Marchand     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
36553324971SDavid Marchand     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
36653324971SDavid Marchand     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
36753324971SDavid Marchand     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
36853324971SDavid Marchand
36953324971SDavid Marchandclear fwd
37053324971SDavid Marchand~~~~~~~~~
37153324971SDavid Marchand
37253324971SDavid MarchandClear the forwarding engines statistics::
37353324971SDavid Marchand
37453324971SDavid Marchand   testpmd> clear fwd stats all
37553324971SDavid Marchand
376ac718398SBernard Iremongerread rxd
377ac718398SBernard Iremonger~~~~~~~~
378ac718398SBernard Iremonger
379e76d7a76SJohn McNamaraDisplay an RX descriptor for a port RX queue::
380ac718398SBernard Iremonger
381e76d7a76SJohn McNamara   testpmd> read rxd (port_id) (queue_id) (rxd_id)
382ac718398SBernard Iremonger
383e76d7a76SJohn McNamaraFor example::
384ac718398SBernard Iremonger
385ac718398SBernard Iremonger   testpmd> read rxd 0 0 4
386ac718398SBernard Iremonger        0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180
387ac718398SBernard Iremonger
388ac718398SBernard Iremongerread txd
389ac718398SBernard Iremonger~~~~~~~~
390ac718398SBernard Iremonger
391e76d7a76SJohn McNamaraDisplay a TX descriptor for a port TX queue::
392ac718398SBernard Iremonger
393e76d7a76SJohn McNamara   testpmd> read txd (port_id) (queue_id) (txd_id)
394ac718398SBernard Iremonger
395e76d7a76SJohn McNamaraFor example::
396ac718398SBernard Iremonger
397ac718398SBernard Iremonger   testpmd> read txd 0 0 4
398ac718398SBernard Iremonger        0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
399ac718398SBernard Iremonger
400cc8d20c4SBeilei Xingddp get list
401cc8d20c4SBeilei Xing~~~~~~~~~~~~
402cc8d20c4SBeilei Xing
403cc8d20c4SBeilei XingGet loaded dynamic device personalization (DDP) package info list::
404cc8d20c4SBeilei Xing
405cc8d20c4SBeilei Xing   testpmd> ddp get list (port_id)
406cc8d20c4SBeilei Xing
40737a56cceSAndrey Chilikinddp get info
40837a56cceSAndrey Chilikin~~~~~~~~~~~~
40937a56cceSAndrey Chilikin
41037a56cceSAndrey ChilikinDisplay information about dynamic device personalization (DDP) profile::
41137a56cceSAndrey Chilikin
4125c451eb5SRami Rosen   testpmd> ddp get info (profile_path)
41337a56cceSAndrey Chilikin
4148c32c192SQi Zhangshow vf stats
4158c32c192SQi Zhang~~~~~~~~~~~~~
4168c32c192SQi Zhang
4178c32c192SQi ZhangDisplay VF statistics::
4188c32c192SQi Zhang
4198c32c192SQi Zhang   testpmd> show vf stats (port_id) (vf_id)
4208c32c192SQi Zhang
4218c32c192SQi Zhangclear vf stats
4228c32c192SQi Zhang~~~~~~~~~~~~~~
4238c32c192SQi Zhang
4248c32c192SQi ZhangReset VF statistics::
4258c32c192SQi Zhang
4268c32c192SQi Zhang   testpmd> clear vf stats (port_id) (vf_id)
427e76d7a76SJohn McNamara
4285a4806d3SKirill Rybalchenkoshow port pctype mapping
4295a4806d3SKirill Rybalchenko~~~~~~~~~~~~~~~~~~~~~~~~
4305a4806d3SKirill Rybalchenko
4315a4806d3SKirill RybalchenkoList all items from the pctype mapping table::
4325a4806d3SKirill Rybalchenko
4335a4806d3SKirill Rybalchenko   testpmd> show port (port_id) pctype mapping
4345a4806d3SKirill Rybalchenko
435c73a9071SWei Daishow rx offloading capabilities
436c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
437c73a9071SWei Dai
438c73a9071SWei DaiList all per queue and per port Rx offloading capabilities of a port::
439c73a9071SWei Dai
440c73a9071SWei Dai   testpmd> show port (port_id) rx_offload capabilities
441c73a9071SWei Dai
442c73a9071SWei Daishow rx offloading configuration
443c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
444c73a9071SWei Dai
445c73a9071SWei DaiList port level and all queue level Rx offloading configuration::
446c73a9071SWei Dai
447c73a9071SWei Dai   testpmd> show port (port_id) rx_offload configuration
448c73a9071SWei Dai
449c73a9071SWei Daishow tx offloading capabilities
450c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
451c73a9071SWei Dai
452c73a9071SWei DaiList all per queue and per port Tx offloading capabilities of a port::
453c73a9071SWei Dai
454c73a9071SWei Dai   testpmd> show port (port_id) tx_offload capabilities
455c73a9071SWei Dai
456c73a9071SWei Daishow tx offloading configuration
457c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
458c73a9071SWei Dai
459c73a9071SWei DaiList port level and all queue level Tx offloading configuration::
460c73a9071SWei Dai
461c73a9071SWei Dai   testpmd> show port (port_id) tx_offload configuration
462c73a9071SWei Dai
463c18feafaSDekel Peledshow tx metadata setting
464c18feafaSDekel Peled~~~~~~~~~~~~~~~~~~~~~~~~
465c18feafaSDekel Peled
466c18feafaSDekel PeledShow Tx metadata value set for a specific port::
467c18feafaSDekel Peled
468c18feafaSDekel Peled   testpmd> show port (port_id) tx_metadata
4695a4806d3SKirill Rybalchenko
47055e51c96SNithin Dabilpuramshow device info
47155e51c96SNithin Dabilpuram~~~~~~~~~~~~~~~~
47255e51c96SNithin Dabilpuram
47355e51c96SNithin DabilpuramShow general information about devices probed::
47455e51c96SNithin Dabilpuram
47555e51c96SNithin Dabilpuram   testpmd> show device info (<identifier>|all)
47655e51c96SNithin Dabilpuram
47755e51c96SNithin DabilpuramFor example:
47855e51c96SNithin Dabilpuram
47955e51c96SNithin Dabilpuram.. code-block:: console
48055e51c96SNithin Dabilpuram
48155e51c96SNithin Dabilpuram    testpmd> show device info net_pcap0
48255e51c96SNithin Dabilpuram
48355e51c96SNithin Dabilpuram    ********************* Infos for device net_pcap0 *********************
48455e51c96SNithin Dabilpuram    Bus name: vdev
48555e51c96SNithin Dabilpuram    Driver name: net_pcap
48655e51c96SNithin Dabilpuram    Devargs: iface=enP2p6s0,phy_mac=1
48755e51c96SNithin Dabilpuram    Connect to socket: -1
48855e51c96SNithin Dabilpuram
48955e51c96SNithin Dabilpuram            Port id: 2
49055e51c96SNithin Dabilpuram            MAC address: 1E:37:93:28:04:B8
49155e51c96SNithin Dabilpuram            Device name: net_pcap0
49255e51c96SNithin Dabilpuram
493d82ee2ccSAgalya Babu RadhaKrishnandump physmem
494d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~
495d82ee2ccSAgalya Babu RadhaKrishnan
496d82ee2ccSAgalya Babu RadhaKrishnanDumps all physical memory segment layouts::
497d82ee2ccSAgalya Babu RadhaKrishnan
498d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_physmem
499d82ee2ccSAgalya Babu RadhaKrishnan
500d82ee2ccSAgalya Babu RadhaKrishnandump memzone
501d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~
502d82ee2ccSAgalya Babu RadhaKrishnan
503d82ee2ccSAgalya Babu RadhaKrishnanDumps the layout of all memory zones::
504d82ee2ccSAgalya Babu RadhaKrishnan
505d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_memzone
506d82ee2ccSAgalya Babu RadhaKrishnan
507d82ee2ccSAgalya Babu RadhaKrishnan
508d82ee2ccSAgalya Babu RadhaKrishnandump struct size
509d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~~
510d82ee2ccSAgalya Babu RadhaKrishnan
511d82ee2ccSAgalya Babu RadhaKrishnanDumps the size of all memory structures::
512d82ee2ccSAgalya Babu RadhaKrishnan
513d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_struct_sizes
514d82ee2ccSAgalya Babu RadhaKrishnan
515d82ee2ccSAgalya Babu RadhaKrishnandump ring
516d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~
517d82ee2ccSAgalya Babu RadhaKrishnan
518d82ee2ccSAgalya Babu RadhaKrishnanDumps the status of all or specific element in DPDK rings::
519d82ee2ccSAgalya Babu RadhaKrishnan
520d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_ring [ring_name]
521d82ee2ccSAgalya Babu RadhaKrishnan
522d82ee2ccSAgalya Babu RadhaKrishnandump mempool
523d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~
524d82ee2ccSAgalya Babu RadhaKrishnan
525d82ee2ccSAgalya Babu RadhaKrishnanDumps the statistics of all or specific memory pool::
526d82ee2ccSAgalya Babu RadhaKrishnan
527d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_mempool [mempool_name]
528d82ee2ccSAgalya Babu RadhaKrishnan
529d82ee2ccSAgalya Babu RadhaKrishnandump devargs
530d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~
531d82ee2ccSAgalya Babu RadhaKrishnan
532d82ee2ccSAgalya Babu RadhaKrishnanDumps the user device list::
533d82ee2ccSAgalya Babu RadhaKrishnan
534d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_devargs
535d82ee2ccSAgalya Babu RadhaKrishnan
536d82ee2ccSAgalya Babu RadhaKrishnandump log types
537d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~
538d82ee2ccSAgalya Babu RadhaKrishnan
539d82ee2ccSAgalya Babu RadhaKrishnanDumps the log level for all the dpdk modules::
540d82ee2ccSAgalya Babu RadhaKrishnan
541d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_log_types
542d82ee2ccSAgalya Babu RadhaKrishnan
543ac718398SBernard IremongerConfiguration Functions
544ac718398SBernard Iremonger-----------------------
545ac718398SBernard Iremonger
546ac718398SBernard IremongerThe testpmd application can be configured from the runtime as well as from the command-line.
547ac718398SBernard Iremonger
548ac718398SBernard IremongerThis section details the available configuration functions that are available.
549ac718398SBernard Iremonger
550ac718398SBernard Iremonger.. note::
551ac718398SBernard Iremonger
552ac718398SBernard Iremonger   Configuration changes only become active when forwarding is started/restarted.
553ac718398SBernard Iremonger
554ac718398SBernard Iremongerset default
555ac718398SBernard Iremonger~~~~~~~~~~~
556ac718398SBernard Iremonger
557e76d7a76SJohn McNamaraReset forwarding to the default configuration::
558ac718398SBernard Iremonger
559e76d7a76SJohn McNamara   testpmd> set default
560ac718398SBernard Iremonger
561ac718398SBernard Iremongerset verbose
562ac718398SBernard Iremonger~~~~~~~~~~~
563ac718398SBernard Iremonger
564e76d7a76SJohn McNamaraSet the debug verbosity level::
565ac718398SBernard Iremonger
566e76d7a76SJohn McNamara   testpmd> set verbose (level)
567ac718398SBernard Iremonger
568b5b38ed8SRaslan DarawshehAvailable levels are as following:
569b5b38ed8SRaslan Darawsheh
570b5b38ed8SRaslan Darawsheh* ``0`` silent except for error.
571b5b38ed8SRaslan Darawsheh* ``1`` fully verbose except for Tx packets.
572b5b38ed8SRaslan Darawsheh* ``2`` fully verbose except for Rx packets.
573b5b38ed8SRaslan Darawsheh* ``> 2`` fully verbose.
574ac718398SBernard Iremonger
575c7217b9dSElza Mathewset log
576c7217b9dSElza Mathew~~~~~~~
577c7217b9dSElza Mathew
578c7217b9dSElza MathewSet the log level for a log type::
579c7217b9dSElza Mathew
580c7217b9dSElza Mathew	testpmd> set log global|(type) (level)
581c7217b9dSElza Mathew
582c7217b9dSElza MathewWhere:
583c7217b9dSElza Mathew
584c7217b9dSElza Mathew* ``type`` is the log name.
585c7217b9dSElza Mathew
586c7217b9dSElza Mathew* ``level`` is the log level.
587c7217b9dSElza Mathew
588c7217b9dSElza MathewFor example, to change the global log level::
5897fa1a2deSKevin Traynor
590c7217b9dSElza Mathew	testpmd> set log global (level)
591c7217b9dSElza Mathew
592c7217b9dSElza MathewRegexes can also be used for type. To change log level of user1, user2 and user3::
5937fa1a2deSKevin Traynor
594c7217b9dSElza Mathew	testpmd> set log user[1-3] (level)
595c7217b9dSElza Mathew
596ac718398SBernard Iremongerset nbport
597ac718398SBernard Iremonger~~~~~~~~~~
598ac718398SBernard Iremonger
599ac718398SBernard IremongerSet the number of ports used by the application:
600ac718398SBernard Iremonger
601ac718398SBernard Iremongerset nbport (num)
602ac718398SBernard Iremonger
603e76d7a76SJohn McNamaraThis is equivalent to the ``--nb-ports`` command-line option.
604ac718398SBernard Iremonger
605ac718398SBernard Iremongerset nbcore
606ac718398SBernard Iremonger~~~~~~~~~~
607ac718398SBernard Iremonger
608e76d7a76SJohn McNamaraSet the number of cores used by the application::
609ac718398SBernard Iremonger
610e76d7a76SJohn McNamara   testpmd> set nbcore (num)
611ac718398SBernard Iremonger
612e76d7a76SJohn McNamaraThis is equivalent to the ``--nb-cores`` command-line option.
613ac718398SBernard Iremonger
614ac718398SBernard Iremonger.. note::
615ac718398SBernard Iremonger
616ac718398SBernard Iremonger   The number of cores used must not be greater than number of ports used multiplied by the number of queues per port.
617ac718398SBernard Iremonger
618ac718398SBernard Iremongerset coremask
619ac718398SBernard Iremonger~~~~~~~~~~~~
620ac718398SBernard Iremonger
621e76d7a76SJohn McNamaraSet the forwarding cores hexadecimal mask::
622ac718398SBernard Iremonger
623e76d7a76SJohn McNamara   testpmd> set coremask (mask)
624ac718398SBernard Iremonger
625e76d7a76SJohn McNamaraThis is equivalent to the ``--coremask`` command-line option.
626ac718398SBernard Iremonger
627ac718398SBernard Iremonger.. note::
628ac718398SBernard Iremonger
629ac718398SBernard Iremonger   The master lcore is reserved for command line parsing only and cannot be masked on for packet forwarding.
630ac718398SBernard Iremonger
631ac718398SBernard Iremongerset portmask
632ac718398SBernard Iremonger~~~~~~~~~~~~
633ac718398SBernard Iremonger
634e76d7a76SJohn McNamaraSet the forwarding ports hexadecimal mask::
635ac718398SBernard Iremonger
636e76d7a76SJohn McNamara   testpmd> set portmask (mask)
637ac718398SBernard Iremonger
638e76d7a76SJohn McNamaraThis is equivalent to the ``--portmask`` command-line option.
639ac718398SBernard Iremonger
640ac718398SBernard Iremongerset burst
641ac718398SBernard Iremonger~~~~~~~~~
642ac718398SBernard Iremonger
643e76d7a76SJohn McNamaraSet number of packets per burst::
644ac718398SBernard Iremonger
645e76d7a76SJohn McNamara   testpmd> set burst (num)
646ac718398SBernard Iremonger
647e76d7a76SJohn McNamaraThis is equivalent to the ``--burst command-line`` option.
648ac718398SBernard Iremonger
649bf56fce1SZhihong WangWhen retry is enabled, the transmit delay time and number of retries can also be set::
650ac718398SBernard Iremonger
651bf56fce1SZhihong Wang   testpmd> set burst tx delay (microseconds) retry (num)
652ac718398SBernard Iremonger
653ac718398SBernard Iremongerset txpkts
654ac718398SBernard Iremonger~~~~~~~~~~
655ac718398SBernard Iremonger
6562ebacaa7SMaciej CzekajSet the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode::
657ac718398SBernard Iremonger
658e76d7a76SJohn McNamara   testpmd> set txpkts (x[,y]*)
659ac718398SBernard Iremonger
660ac718398SBernard IremongerWhere x[,y]* represents a CSV list of values, without white space.
661ac718398SBernard Iremonger
66279bec05bSKonstantin Ananyevset txsplit
66379bec05bSKonstantin Ananyev~~~~~~~~~~~
66479bec05bSKonstantin Ananyev
66579bec05bSKonstantin AnanyevSet the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes::
66679bec05bSKonstantin Ananyev
66779bec05bSKonstantin Ananyev   testpmd> set txsplit (off|on|rand)
66879bec05bSKonstantin Ananyev
66979bec05bSKonstantin AnanyevWhere:
67079bec05bSKonstantin Ananyev
67179bec05bSKonstantin Ananyev* ``off`` disable packet copy & split for CSUM mode.
67279bec05bSKonstantin Ananyev
67379bec05bSKonstantin Ananyev* ``on`` split outgoing packet into multiple segments. Size of each segment
67479bec05bSKonstantin Ananyev  and number of segments per packet is determined by ``set txpkts`` command
67579bec05bSKonstantin Ananyev  (see above).
67679bec05bSKonstantin Ananyev
67779bec05bSKonstantin Ananyev* ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments.
67879bec05bSKonstantin Ananyev
679ac718398SBernard Iremongerset corelist
680ac718398SBernard Iremonger~~~~~~~~~~~~
681ac718398SBernard Iremonger
682e76d7a76SJohn McNamaraSet the list of forwarding cores::
683ac718398SBernard Iremonger
684e76d7a76SJohn McNamara   testpmd> set corelist (x[,y]*)
685ac718398SBernard Iremonger
686ac718398SBernard IremongerFor example, to change the forwarding cores:
687ac718398SBernard Iremonger
688ac718398SBernard Iremonger.. code-block:: console
689ac718398SBernard Iremonger
690ac718398SBernard Iremonger   testpmd> set corelist 3,1
691ac718398SBernard Iremonger   testpmd> show config fwd
692ac718398SBernard Iremonger
693ac718398SBernard Iremonger   io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled
694ac718398SBernard Iremonger   Logical Core 3 (socket 0) forwards packets on 1 streams:
695ac718398SBernard Iremonger   RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
696ac718398SBernard Iremonger   Logical Core 1 (socket 0) forwards packets on 1 streams:
697ac718398SBernard Iremonger   RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
698ac718398SBernard Iremonger
699ac718398SBernard Iremonger.. note::
700ac718398SBernard Iremonger
701ac718398SBernard Iremonger   The cores are used in the same order as specified on the command line.
702ac718398SBernard Iremonger
703ac718398SBernard Iremongerset portlist
704ac718398SBernard Iremonger~~~~~~~~~~~~
705ac718398SBernard Iremonger
706e76d7a76SJohn McNamaraSet the list of forwarding ports::
707ac718398SBernard Iremonger
708e76d7a76SJohn McNamara   testpmd> set portlist (x[,y]*)
709ac718398SBernard Iremonger
710ac718398SBernard IremongerFor example, to change the port forwarding:
711ac718398SBernard Iremonger
712ac718398SBernard Iremonger.. code-block:: console
713ac718398SBernard Iremonger
714ac718398SBernard Iremonger   testpmd> set portlist 0,2,1,3
715ac718398SBernard Iremonger   testpmd> show config fwd
716ac718398SBernard Iremonger
717ac718398SBernard Iremonger   io packet forwarding - ports=4 - cores=1 - streams=4
718ac718398SBernard Iremonger   Logical Core 3 (socket 0) forwards packets on 4 streams:
719ac718398SBernard Iremonger   RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01
720ac718398SBernard Iremonger   RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
721ac718398SBernard Iremonger   RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03
722ac718398SBernard Iremonger   RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02
723ac718398SBernard Iremonger
7244f1ed78eSThomas Monjalonset port setup on
7254f1ed78eSThomas Monjalon~~~~~~~~~~~~~~~~~
7264f1ed78eSThomas Monjalon
7274f1ed78eSThomas MonjalonSelect how to retrieve new ports created after "port attach" command::
7284f1ed78eSThomas Monjalon
7294f1ed78eSThomas Monjalon   testpmd> set port setup on (iterator|event)
7304f1ed78eSThomas Monjalon
7314f1ed78eSThomas MonjalonFor each new port, a setup is done.
7324f1ed78eSThomas MonjalonIt will find the probed ports via RTE_ETH_FOREACH_MATCHING_DEV loop
7334f1ed78eSThomas Monjalonin iterator mode, or via RTE_ETH_EVENT_NEW in event mode.
7344f1ed78eSThomas Monjalon
735425781ffSBernard Iremongerset tx loopback
736425781ffSBernard Iremonger~~~~~~~~~~~~~~~
737425781ffSBernard Iremonger
738425781ffSBernard IremongerEnable/disable tx loopback::
739425781ffSBernard Iremonger
740425781ffSBernard Iremonger   testpmd> set tx loopback (port_id) (on|off)
741425781ffSBernard Iremonger
742425781ffSBernard Iremongerset drop enable
743425781ffSBernard Iremonger~~~~~~~~~~~~~~~
744425781ffSBernard Iremonger
745425781ffSBernard Iremongerset drop enable bit for all queues::
746425781ffSBernard Iremonger
747425781ffSBernard Iremonger   testpmd> set all queues drop (port_id) (on|off)
748425781ffSBernard Iremonger
749425781ffSBernard Iremongerset split drop enable (for VF)
750425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
751425781ffSBernard Iremonger
752425781ffSBernard Iremongerset split drop enable bit for VF from PF::
753425781ffSBernard Iremonger
754425781ffSBernard Iremonger   testpmd> set vf split drop (port_id) (vf_id) (on|off)
755425781ffSBernard Iremonger
756425781ffSBernard Iremongerset mac antispoof (for VF)
757425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~
758425781ffSBernard Iremonger
759425781ffSBernard IremongerSet mac antispoof for a VF from the PF::
760425781ffSBernard Iremonger
761425781ffSBernard Iremonger   testpmd> set vf mac antispoof  (port_id) (vf_id) (on|off)
762425781ffSBernard Iremonger
763bb98856fSTiwei Bieset macsec offload
764bb98856fSTiwei Bie~~~~~~~~~~~~~~~~~~
765bb98856fSTiwei Bie
766bb98856fSTiwei BieEnable/disable MACsec offload::
767bb98856fSTiwei Bie
768bb98856fSTiwei Bie   testpmd> set macsec offload (port_id) on encrypt (on|off) replay-protect (on|off)
769bb98856fSTiwei Bie   testpmd> set macsec offload (port_id) off
770bb98856fSTiwei Bie
771bb98856fSTiwei Bieset macsec sc
772bb98856fSTiwei Bie~~~~~~~~~~~~~
773bb98856fSTiwei Bie
774bb98856fSTiwei BieConfigure MACsec secure connection (SC)::
775bb98856fSTiwei Bie
776bb98856fSTiwei Bie   testpmd> set macsec sc (tx|rx) (port_id) (mac) (pi)
777bb98856fSTiwei Bie
778bb98856fSTiwei Bie.. note::
779bb98856fSTiwei Bie
780bb98856fSTiwei Bie   The pi argument is ignored for tx.
781bb98856fSTiwei Bie   Check the NIC Datasheet for hardware limits.
782bb98856fSTiwei Bie
783bb98856fSTiwei Bieset macsec sa
784bb98856fSTiwei Bie~~~~~~~~~~~~~
785bb98856fSTiwei Bie
786bb98856fSTiwei BieConfigure MACsec secure association (SA)::
787bb98856fSTiwei Bie
788bb98856fSTiwei Bie   testpmd> set macsec sa (tx|rx) (port_id) (idx) (an) (pn) (key)
789bb98856fSTiwei Bie
790bb98856fSTiwei Bie.. note::
791bb98856fSTiwei Bie
792bb98856fSTiwei Bie   The IDX value must be 0 or 1.
793bb98856fSTiwei Bie   Check the NIC Datasheet for hardware limits.
794bb98856fSTiwei Bie
795675783e0SBernard Iremongerset broadcast mode (for VF)
796675783e0SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~
797675783e0SBernard Iremonger
798675783e0SBernard IremongerSet broadcast mode for a VF from the PF::
799675783e0SBernard Iremonger
800675783e0SBernard Iremonger   testpmd> set vf broadcast (port_id) (vf_id) (on|off)
801675783e0SBernard Iremonger
802ac718398SBernard Iremongervlan set strip
803ac718398SBernard Iremonger~~~~~~~~~~~~~~
804ac718398SBernard Iremonger
805e76d7a76SJohn McNamaraSet the VLAN strip on a port::
806ac718398SBernard Iremonger
807e76d7a76SJohn McNamara   testpmd> vlan set strip (on|off) (port_id)
808ac718398SBernard Iremonger
809ac718398SBernard Iremongervlan set stripq
810ac718398SBernard Iremonger~~~~~~~~~~~~~~~
811ac718398SBernard Iremonger
812e76d7a76SJohn McNamaraSet the VLAN strip for a queue on a port::
813ac718398SBernard Iremonger
814e76d7a76SJohn McNamara   testpmd> vlan set stripq (on|off) (port_id,queue_id)
815ac718398SBernard Iremonger
816425781ffSBernard Iremongervlan set stripq (for VF)
817425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~
818425781ffSBernard Iremonger
819425781ffSBernard IremongerSet VLAN strip for all queues in a pool for a VF from the PF::
820425781ffSBernard Iremonger
821425781ffSBernard Iremonger   testpmd> set vf vlan stripq (port_id) (vf_id) (on|off)
822425781ffSBernard Iremonger
823425781ffSBernard Iremongervlan set insert (for VF)
824425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~
825425781ffSBernard Iremonger
826425781ffSBernard IremongerSet VLAN insert for a VF from the PF::
827425781ffSBernard Iremonger
828aaffc740SE. Scott Daniels   testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
829425781ffSBernard Iremonger
830ff1c07a0SBernard Iremongervlan set tag (for VF)
831ff1c07a0SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~
832ff1c07a0SBernard Iremonger
833ff1c07a0SBernard IremongerSet VLAN tag for a VF from the PF::
834ff1c07a0SBernard Iremonger
835ff1c07a0SBernard Iremonger   testpmd> set vf vlan tag (port_id) (vf_id) (on|off)
836ff1c07a0SBernard Iremonger
837425781ffSBernard Iremongervlan set antispoof (for VF)
838425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~
839425781ffSBernard Iremonger
840425781ffSBernard IremongerSet VLAN antispoof for a VF from the PF::
841425781ffSBernard Iremonger
842425781ffSBernard Iremonger   testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off)
843425781ffSBernard Iremonger
844ac718398SBernard Iremongervlan set filter
845ac718398SBernard Iremonger~~~~~~~~~~~~~~~
846ac718398SBernard Iremonger
847e76d7a76SJohn McNamaraSet the VLAN filter on a port::
848ac718398SBernard Iremonger
849e76d7a76SJohn McNamara   testpmd> vlan set filter (on|off) (port_id)
850ac718398SBernard Iremonger
851ac718398SBernard Iremongervlan set qinq
852ac718398SBernard Iremonger~~~~~~~~~~~~~
853ac718398SBernard Iremonger
854e76d7a76SJohn McNamaraSet the VLAN QinQ (extended queue in queue) on for a port::
855ac718398SBernard Iremonger
856e76d7a76SJohn McNamara   testpmd> vlan set qinq (on|off) (port_id)
857ac718398SBernard Iremonger
858ac718398SBernard Iremongervlan set tpid
859ac718398SBernard Iremonger~~~~~~~~~~~~~
860ac718398SBernard Iremonger
86119b16e2fSHelin ZhangSet the inner or outer VLAN TPID for packet filtering on a port::
862ac718398SBernard Iremonger
86319b16e2fSHelin Zhang   testpmd> vlan set (inner|outer) tpid (value) (port_id)
864ac718398SBernard Iremonger
865ac718398SBernard Iremonger.. note::
866ac718398SBernard Iremonger
867ac718398SBernard Iremonger   TPID value must be a 16-bit number (value <= 65536).
868ac718398SBernard Iremonger
869ac718398SBernard Iremongerrx_vlan add
870ac718398SBernard Iremonger~~~~~~~~~~~
871ac718398SBernard Iremonger
872e76d7a76SJohn McNamaraAdd a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID::
873ac718398SBernard Iremonger
874e76d7a76SJohn McNamara   testpmd> rx_vlan add (vlan_id|all) (port_id)
875ac718398SBernard Iremonger
876ac718398SBernard Iremonger.. note::
877ac718398SBernard Iremonger
878ac718398SBernard Iremonger   VLAN filter must be set on that port. VLAN ID < 4096.
879a7dde4ffSMichal Jastrzebski   Depending on the NIC used, number of vlan_ids may be limited to the maximum entries
880a7dde4ffSMichal Jastrzebski   in VFTA table. This is important if enabling all vlan_ids.
881ac718398SBernard Iremonger
882ac718398SBernard Iremongerrx_vlan rm
883ac718398SBernard Iremonger~~~~~~~~~~
884ac718398SBernard Iremonger
885e76d7a76SJohn McNamaraRemove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID::
886ac718398SBernard Iremonger
887e76d7a76SJohn McNamara   testpmd> rx_vlan rm (vlan_id|all) (port_id)
888ac718398SBernard Iremonger
889ac718398SBernard Iremongerrx_vlan add (for VF)
890e76d7a76SJohn McNamara~~~~~~~~~~~~~~~~~~~~
891ac718398SBernard Iremonger
892e76d7a76SJohn McNamaraAdd a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID::
893ac718398SBernard Iremonger
894e76d7a76SJohn McNamara   testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask)
895ac718398SBernard Iremonger
896ac718398SBernard Iremongerrx_vlan rm (for VF)
897e76d7a76SJohn McNamara~~~~~~~~~~~~~~~~~~~
898ac718398SBernard Iremonger
899e76d7a76SJohn McNamaraRemove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID::
900ac718398SBernard Iremonger
901e76d7a76SJohn McNamara   testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask)
902ac718398SBernard Iremonger
9036fe5f2f7SPablo de Laratunnel_filter add
9046fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~
9056fe5f2f7SPablo de Lara
906e76d7a76SJohn McNamaraAdd a tunnel filter on a port::
9076fe5f2f7SPablo de Lara
908e76d7a76SJohn McNamara   testpmd> tunnel_filter add (port_id) (outer_mac) (inner_mac) (ip_addr) \
9091aec68d1SQiming Yang            (inner_vlan) (vxlan|nvgre|ipingre|vxlan-gpe) (imac-ivlan|imac-ivlan-tenid|\
9107b131289SXutao Sun            imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)
9117b131289SXutao Sun
9127b131289SXutao SunThe available information categories are:
9137b131289SXutao Sun
9147b131289SXutao Sun* ``vxlan``: Set tunnel type as VXLAN.
9157b131289SXutao Sun
9167b131289SXutao Sun* ``nvgre``: Set tunnel type as NVGRE.
9177b131289SXutao Sun
9187b131289SXutao Sun* ``ipingre``: Set tunnel type as IP-in-GRE.
9197b131289SXutao Sun
9201aec68d1SQiming Yang* ``vxlan-gpe``: Set tunnel type as VXLAN-GPE
9211aec68d1SQiming Yang
9227b131289SXutao Sun* ``imac-ivlan``: Set filter type as Inner MAC and VLAN.
9237b131289SXutao Sun
9247b131289SXutao Sun* ``imac-ivlan-tenid``: Set filter type as Inner MAC, VLAN and tenant ID.
9257b131289SXutao Sun
9267b131289SXutao Sun* ``imac-tenid``: Set filter type as Inner MAC and tenant ID.
9277b131289SXutao Sun
9287b131289SXutao Sun* ``imac``: Set filter type as Inner MAC.
9297b131289SXutao Sun
9307b131289SXutao Sun* ``omac-imac-tenid``: Set filter type as Outer MAC, Inner MAC and tenant ID.
9317b131289SXutao Sun
9327b131289SXutao Sun* ``oip``: Set filter type as Outer IP.
9337b131289SXutao Sun
9347b131289SXutao Sun* ``iip``: Set filter type as Inner IP.
9357b131289SXutao Sun
9367b131289SXutao SunExample::
9377b131289SXutao Sun
9387b131289SXutao Sun   testpmd> tunnel_filter add 0 68:05:CA:28:09:82 00:00:00:00:00:00 \
9397b131289SXutao Sun            192.168.2.2 0 ipingre oip 1 1
9407b131289SXutao Sun
9417b131289SXutao Sun   Set an IP-in-GRE tunnel on port 0, and the filter type is Outer IP.
9426fe5f2f7SPablo de Lara
9436fe5f2f7SPablo de Laratunnel_filter remove
9446fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~~~~
9456fe5f2f7SPablo de Lara
946e76d7a76SJohn McNamaraRemove a tunnel filter on a port::
9476fe5f2f7SPablo de Lara
948e76d7a76SJohn McNamara   testpmd> tunnel_filter rm (port_id) (outer_mac) (inner_mac) (ip_addr) \
9491aec68d1SQiming Yang            (inner_vlan) (vxlan|nvgre|ipingre|vxlan-gpe) (imac-ivlan|imac-ivlan-tenid|\
9507b131289SXutao Sun            imac-tenid|imac|omac-imac-tenid|oip|iip) (tenant_id) (queue_id)
9516fe5f2f7SPablo de Lara
9526fe5f2f7SPablo de Lararx_vxlan_port add
9536fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~
9546fe5f2f7SPablo de Lara
955e76d7a76SJohn McNamaraAdd an UDP port for VXLAN packet filter on a port::
9566fe5f2f7SPablo de Lara
957e76d7a76SJohn McNamara   testpmd> rx_vxlan_port add (udp_port) (port_id)
9586fe5f2f7SPablo de Lara
9596fe5f2f7SPablo de Lararx_vxlan_port remove
9606fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~~~~
9616fe5f2f7SPablo de Lara
962e76d7a76SJohn McNamaraRemove an UDP port for VXLAN packet filter on a port::
9636fe5f2f7SPablo de Lara
964e76d7a76SJohn McNamara   testpmd> rx_vxlan_port rm (udp_port) (port_id)
9656fe5f2f7SPablo de Lara
966ac718398SBernard Iremongertx_vlan set
967ac718398SBernard Iremonger~~~~~~~~~~~
968ac718398SBernard Iremonger
969e76d7a76SJohn McNamaraSet hardware insertion of VLAN IDs in packets sent on a port::
970ac718398SBernard Iremonger
971e76d7a76SJohn McNamara   testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer]
97292ebda07SHelin Zhang
973e76d7a76SJohn McNamaraFor example, set a single VLAN ID (5) insertion on port 0::
97492ebda07SHelin Zhang
97592ebda07SHelin Zhang   tx_vlan set 0 5
97692ebda07SHelin Zhang
977e76d7a76SJohn McNamaraOr, set double VLAN ID (inner: 2, outer: 3) insertion on port 1::
97892ebda07SHelin Zhang
97992ebda07SHelin Zhang   tx_vlan set 1 2 3
980ac718398SBernard Iremonger
981e76d7a76SJohn McNamara
982ac718398SBernard Iremongertx_vlan set pvid
983ac718398SBernard Iremonger~~~~~~~~~~~~~~~~
984ac718398SBernard Iremonger
985e76d7a76SJohn McNamaraSet port based hardware insertion of VLAN ID in packets sent on a port::
986ac718398SBernard Iremonger
987e76d7a76SJohn McNamara   testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off)
988ac718398SBernard Iremonger
989ac718398SBernard Iremongertx_vlan reset
990ac718398SBernard Iremonger~~~~~~~~~~~~~
991ac718398SBernard Iremonger
992e76d7a76SJohn McNamaraDisable hardware insertion of a VLAN header in packets sent on a port::
993ac718398SBernard Iremonger
994e76d7a76SJohn McNamara   testpmd> tx_vlan reset (port_id)
995ac718398SBernard Iremonger
996c22f2feeSOlivier Matzcsum set
997c22f2feeSOlivier Matz~~~~~~~~
998ac718398SBernard Iremonger
999186e5586SPablo de LaraSelect hardware or software calculation of the checksum when
1000e76d7a76SJohn McNamaratransmitting a packet using the ``csum`` forwarding engine::
1001ac718398SBernard Iremonger
1002bf5618faSJerin Jacob   testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)
1003ac718398SBernard Iremonger
1004e76d7a76SJohn McNamaraWhere:
1005c22f2feeSOlivier Matz
1006e76d7a76SJohn McNamara* ``ip|udp|tcp|sctp`` always relate to  the inner layer.
1007e76d7a76SJohn McNamara
1008e76d7a76SJohn McNamara* ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized
1009e76d7a76SJohn McNamara  as a tunnel packet by the forwarding engine (vxlan, gre and ipip are
1010e76d7a76SJohn McNamara  supported). See also the ``csum parse-tunnel`` command.
1011ac718398SBernard Iremonger
1012bf5618faSJerin Jacob* ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized
1013bf5618faSJerin Jacob  as a tunnel packet by the forwarding engine (vxlan, vxlan-gpe are
1014bf5618faSJerin Jacob  supported). See also the ``csum parse-tunnel`` command.
1015bf5618faSJerin Jacob
1016ac718398SBernard Iremonger.. note::
1017ac718398SBernard Iremonger
1018ac718398SBernard Iremonger   Check the NIC Datasheet for hardware limits.
1019ac718398SBernard Iremonger
10203c272b28SWei ZhaoRSS queue region
10213c272b28SWei Zhao~~~~~~~~~~~~~~~~
10223c272b28SWei Zhao
10233c272b28SWei ZhaoSet RSS queue region span on a port::
10243c272b28SWei Zhao
10253c272b28SWei Zhao   testpmd> set port (port_id) queue-region region_id (value) \
10263c272b28SWei Zhao		queue_start_index (value) queue_num (value)
10273c272b28SWei Zhao
10283c272b28SWei ZhaoSet flowtype mapping on a RSS queue region on a port::
10293c272b28SWei Zhao
10303c272b28SWei Zhao   testpmd> set port (port_id) queue-region region_id (value) flowtype (value)
10313c272b28SWei Zhao
10323c272b28SWei Zhaowhere:
10333c272b28SWei Zhao
10343c272b28SWei Zhao* For the flowtype(pctype) of packet,the specific index for each type has
10353c272b28SWei Zhao  been defined in file i40e_type.h as enum i40e_filter_pctype.
10363c272b28SWei Zhao
10373c272b28SWei ZhaoSet user priority mapping on a RSS queue region on a port::
10383c272b28SWei Zhao
10393c272b28SWei Zhao   testpmd> set port (port_id) queue-region UP (value) region_id (value)
10403c272b28SWei Zhao
10413c272b28SWei ZhaoFlush all queue region related configuration on a port::
10423c272b28SWei Zhao
10433c272b28SWei Zhao   testpmd> set port (port_id) queue-region flush (on|off)
10443c272b28SWei Zhao
10453c272b28SWei Zhaowhere:
10463c272b28SWei Zhao
10477fa1a2deSKevin Traynor* ``on``: is just an enable function which server for other configuration,
10483c272b28SWei Zhao  it is for all configuration about queue region from up layer,
10493c272b28SWei Zhao  at first will only keep in DPDK software stored in driver,
10503c272b28SWei Zhao  only after "flush on", it commit all configuration to HW.
10517fa1a2deSKevin Traynor
10527fa1a2deSKevin Traynor* ``"off``: is just clean all configuration about queue region just now,
10533c272b28SWei Zhao  and restore all to DPDK i40e driver default config when start up.
10543c272b28SWei Zhao
10553c272b28SWei ZhaoShow all queue region related configuration info on a port::
10563c272b28SWei Zhao
10573c272b28SWei Zhao   testpmd> show port (port_id) queue-region
10583c272b28SWei Zhao
10593c272b28SWei Zhao.. note::
10603c272b28SWei Zhao
10613c272b28SWei Zhao  Queue region only support on PF by now, so these command is
10623c272b28SWei Zhao  only for configuration of queue region on PF port.
10633c272b28SWei Zhao
1064c22f2feeSOlivier Matzcsum parse-tunnel
1065c22f2feeSOlivier Matz~~~~~~~~~~~~~~~~~
1066c22f2feeSOlivier Matz
1067c22f2feeSOlivier MatzDefine how tunneled packets should be handled by the csum forward
1068e76d7a76SJohn McNamaraengine::
1069c22f2feeSOlivier Matz
1070e76d7a76SJohn McNamara   testpmd> csum parse-tunnel (on|off) (tx_port_id)
1071c22f2feeSOlivier Matz
1072c22f2feeSOlivier MatzIf enabled, the csum forward engine will try to recognize supported
1073c22f2feeSOlivier Matztunnel headers (vxlan, gre, ipip).
1074c22f2feeSOlivier Matz
1075c22f2feeSOlivier MatzIf disabled, treat tunnel packets as non-tunneled packets (a inner
1076c22f2feeSOlivier Matzheader is handled as a packet payload).
1077c22f2feeSOlivier Matz
1078c22f2feeSOlivier Matz.. note::
1079c22f2feeSOlivier Matz
1080e76d7a76SJohn McNamara   The port argument is the TX port like in the ``csum set`` command.
1081c22f2feeSOlivier Matz
1082c22f2feeSOlivier MatzExample:
1083c22f2feeSOlivier Matz
1084e76d7a76SJohn McNamaraConsider a packet in packet like the following::
1085c22f2feeSOlivier Matz
1086e76d7a76SJohn McNamara   eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in
1087c22f2feeSOlivier Matz
1088e76d7a76SJohn McNamara* If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1089e76d7a76SJohn McNamara  command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the
1090bf5618faSJerin Jacob  ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ipv4_out`` and ``udp_out``).
1091e76d7a76SJohn McNamara
1092e76d7a76SJohn McNamara* If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum  set``
1093e76d7a76SJohn McNamara   command relate to the outer headers, here ``ipv4_out`` and ``udp_out``.
1094c22f2feeSOlivier Matz
1095c22f2feeSOlivier Matzcsum show
1096c22f2feeSOlivier Matz~~~~~~~~~
10976fe5f2f7SPablo de Lara
1098e76d7a76SJohn McNamaraDisplay tx checksum offload configuration::
10996fe5f2f7SPablo de Lara
1100e76d7a76SJohn McNamara   testpmd> csum show (port_id)
11016fe5f2f7SPablo de Lara
11026fe5f2f7SPablo de Laratso set
11036fe5f2f7SPablo de Lara~~~~~~~
11046fe5f2f7SPablo de Lara
1105e76d7a76SJohn McNamaraEnable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine::
11066fe5f2f7SPablo de Lara
1107e76d7a76SJohn McNamara   testpmd> tso set (segsize) (port_id)
11086fe5f2f7SPablo de Lara
11096fe5f2f7SPablo de Lara.. note::
1110c22f2feeSOlivier Matz
1111e76d7a76SJohn McNamara   Check the NIC datasheet for hardware limits.
11126fe5f2f7SPablo de Lara
11136fe5f2f7SPablo de Laratso show
11146fe5f2f7SPablo de Lara~~~~~~~~
11156fe5f2f7SPablo de Lara
1116e76d7a76SJohn McNamaraDisplay the status of TCP Segmentation Offload::
11176fe5f2f7SPablo de Lara
1118e76d7a76SJohn McNamara   testpmd> tso show (port_id)
1119ac718398SBernard Iremonger
1120d82ee2ccSAgalya Babu RadhaKrishnantunnel tso set
1121d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~
1122d82ee2ccSAgalya Babu RadhaKrishnan
1123d82ee2ccSAgalya Babu RadhaKrishnanSet tso segment size of tunneled packets for a port in csum engine::
1124d82ee2ccSAgalya Babu RadhaKrishnan
1125d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> tunnel_tso set (tso_segsz) (port_id)
1126d82ee2ccSAgalya Babu RadhaKrishnan
1127d82ee2ccSAgalya Babu RadhaKrishnantunnel tso show
1128d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~
1129d82ee2ccSAgalya Babu RadhaKrishnan
1130d82ee2ccSAgalya Babu RadhaKrishnanDisplay the status of tunneled TCP Segmentation Offload for a port::
1131d82ee2ccSAgalya Babu RadhaKrishnan
1132d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> tunnel_tso show (port_id)
1133d82ee2ccSAgalya Babu RadhaKrishnan
1134b7091f1dSJiayu Huset port - gro
1135b7091f1dSJiayu Hu~~~~~~~~~~~~~~
1136b40f8d78SJiayu Hu
1137b40f8d78SJiayu HuEnable or disable GRO in ``csum`` forwarding engine::
1138b40f8d78SJiayu Hu
1139b7091f1dSJiayu Hu   testpmd> set port <port_id> gro on|off
1140b40f8d78SJiayu Hu
1141b40f8d78SJiayu HuIf enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
1142b40f8d78SJiayu Hupackets received from the given port.
1143b40f8d78SJiayu Hu
1144b40f8d78SJiayu HuIf disabled, packets received from the given port won't be performed
1145b40f8d78SJiayu HuGRO. By default, GRO is disabled for all ports.
1146b40f8d78SJiayu Hu
1147b40f8d78SJiayu Hu.. note::
1148b40f8d78SJiayu Hu
1149b40f8d78SJiayu Hu   When enable GRO for a port, TCP/IPv4 packets received from the port
1150b7091f1dSJiayu Hu   will be performed GRO. After GRO, all merged packets have bad
1151b7091f1dSJiayu Hu   checksums, since the GRO library doesn't re-calculate checksums for
1152b7091f1dSJiayu Hu   the merged packets. Therefore, if users want the merged packets to
1153b7091f1dSJiayu Hu   have correct checksums, please select HW IP checksum calculation and
1154b7091f1dSJiayu Hu   HW TCP checksum calculation for the port which the merged packets are
1155b7091f1dSJiayu Hu   transmitted to.
1156b40f8d78SJiayu Hu
1157b7091f1dSJiayu Hushow port - gro
1158b7091f1dSJiayu Hu~~~~~~~~~~~~~~~
1159b40f8d78SJiayu Hu
1160b7091f1dSJiayu HuDisplay GRO configuration for a given port::
1161b40f8d78SJiayu Hu
1162b7091f1dSJiayu Hu   testpmd> show port <port_id> gro
1163b40f8d78SJiayu Hu
1164b7091f1dSJiayu Huset gro flush
1165b7091f1dSJiayu Hu~~~~~~~~~~~~~
1166b40f8d78SJiayu Hu
1167b7091f1dSJiayu HuSet the cycle to flush the GROed packets from reassembly tables::
1168b7091f1dSJiayu Hu
1169b7091f1dSJiayu Hu   testpmd> set gro flush <cycles>
1170b7091f1dSJiayu Hu
1171b7091f1dSJiayu HuWhen enable GRO, the csum forwarding engine performs GRO on received
1172b7091f1dSJiayu Hupackets, and the GROed packets are stored in reassembly tables. Users
1173b7091f1dSJiayu Hucan use this command to determine when the GROed packets are flushed
1174b7091f1dSJiayu Hufrom the reassembly tables.
1175b7091f1dSJiayu Hu
1176b7091f1dSJiayu HuThe ``cycles`` is measured in GRO operation times. The csum forwarding
1177b7091f1dSJiayu Huengine flushes the GROed packets from the tables every ``cycles`` GRO
1178b7091f1dSJiayu Huoperations.
1179b7091f1dSJiayu Hu
1180b7091f1dSJiayu HuBy default, the value of ``cycles`` is 1, which means flush GROed packets
1181b7091f1dSJiayu Hufrom the reassembly tables as soon as one GRO operation finishes. The value
1182b7091f1dSJiayu Huof ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
1183b7091f1dSJiayu Hu
1184b7091f1dSJiayu HuPlease note that the large value of ``cycles`` may cause the poor TCP/IP
1185b7091f1dSJiayu Hustack performance. Because the GROed packets are delayed to arrive the
1186b7091f1dSJiayu Hustack, thus causing more duplicated ACKs and TCP retransmissions.
1187b40f8d78SJiayu Hu
118852f38a20SJiayu Huset port - gso
118952f38a20SJiayu Hu~~~~~~~~~~~~~~
119052f38a20SJiayu Hu
119152f38a20SJiayu HuToggle per-port GSO support in ``csum`` forwarding engine::
119252f38a20SJiayu Hu
119352f38a20SJiayu Hu   testpmd> set port <port_id> gso on|off
119452f38a20SJiayu Hu
119552f38a20SJiayu HuIf enabled, the csum forwarding engine will perform GSO on supported IPv4
119652f38a20SJiayu Hupackets, transmitted on the given port.
119752f38a20SJiayu Hu
119852f38a20SJiayu HuIf disabled, packets transmitted on the given port will not undergo GSO.
119952f38a20SJiayu HuBy default, GSO is disabled for all ports.
120052f38a20SJiayu Hu
120152f38a20SJiayu Hu.. note::
120252f38a20SJiayu Hu
120352f38a20SJiayu Hu   When GSO is enabled on a port, supported IPv4 packets transmitted on that
120452f38a20SJiayu Hu   port undergo GSO. Afterwards, the segmented packets are represented by
120552f38a20SJiayu Hu   multi-segment mbufs; however, the csum forwarding engine doesn't calculation
120652f38a20SJiayu Hu   of checksums for GSO'd segments in SW. As a result, if users want correct
120752f38a20SJiayu Hu   checksums in GSO segments, they should enable HW checksum calculation for
120852f38a20SJiayu Hu   GSO-enabled ports.
120952f38a20SJiayu Hu
121052f38a20SJiayu Hu   For example, HW checksum calculation for VxLAN GSO'd packets may be enabled
121152f38a20SJiayu Hu   by setting the following options in the csum forwarding engine:
121252f38a20SJiayu Hu
121352f38a20SJiayu Hu   testpmd> csum set outer_ip hw <port_id>
121452f38a20SJiayu Hu
121552f38a20SJiayu Hu   testpmd> csum set ip hw <port_id>
121652f38a20SJiayu Hu
121752f38a20SJiayu Hu   testpmd> csum set tcp hw <port_id>
121852f38a20SJiayu Hu
1219250c9eb3SJiayu Hu   UDP GSO is the same as IP fragmentation, which treats the UDP header
1220250c9eb3SJiayu Hu   as the payload and does not modify it during segmentation. That is,
1221250c9eb3SJiayu Hu   after UDP GSO, only the first output fragment has the original UDP
1222250c9eb3SJiayu Hu   header. Therefore, users need to enable HW IP checksum calculation
1223250c9eb3SJiayu Hu   and SW UDP checksum calculation for GSO-enabled ports, if they want
1224250c9eb3SJiayu Hu   correct checksums for UDP/IPv4 packets.
1225250c9eb3SJiayu Hu
122652f38a20SJiayu Huset gso segsz
122752f38a20SJiayu Hu~~~~~~~~~~~~~
122852f38a20SJiayu Hu
122952f38a20SJiayu HuSet the maximum GSO segment size (measured in bytes), which includes the
123052f38a20SJiayu Hupacket header and the packet payload for GSO-enabled ports (global)::
123152f38a20SJiayu Hu
123252f38a20SJiayu Hu   testpmd> set gso segsz <length>
123352f38a20SJiayu Hu
123452f38a20SJiayu Hushow port - gso
123552f38a20SJiayu Hu~~~~~~~~~~~~~~~
123652f38a20SJiayu Hu
123752f38a20SJiayu HuDisplay the status of Generic Segmentation Offload for a given port::
123852f38a20SJiayu Hu
123952f38a20SJiayu Hu   testpmd> show port <port_id> gso
124052f38a20SJiayu Hu
1241ac718398SBernard Iremongermac_addr add
1242ac718398SBernard Iremonger~~~~~~~~~~~~
1243ac718398SBernard Iremonger
1244e76d7a76SJohn McNamaraAdd an alternative MAC address to a port::
1245ac718398SBernard Iremonger
1246e76d7a76SJohn McNamara   testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)
1247ac718398SBernard Iremonger
1248ac718398SBernard Iremongermac_addr remove
1249ac718398SBernard Iremonger~~~~~~~~~~~~~~~
1250ac718398SBernard Iremonger
1251e76d7a76SJohn McNamaraRemove a MAC address from a port::
1252ac718398SBernard Iremonger
1253e76d7a76SJohn McNamara   testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)
1254ac718398SBernard Iremonger
1255d82ee2ccSAgalya Babu RadhaKrishnanmcast_addr add
1256d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~
1257d82ee2ccSAgalya Babu RadhaKrishnan
1258d82ee2ccSAgalya Babu RadhaKrishnanTo add the multicast MAC address to/from the set of multicast addresses
1259d82ee2ccSAgalya Babu RadhaKrishnanfiltered by port::
1260d82ee2ccSAgalya Babu RadhaKrishnan
1261d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> mcast_addr add (port_id) (mcast_addr)
1262d82ee2ccSAgalya Babu RadhaKrishnan
1263d82ee2ccSAgalya Babu RadhaKrishnanmcast_addr remove
1264d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~~~
1265d82ee2ccSAgalya Babu RadhaKrishnan
1266d82ee2ccSAgalya Babu RadhaKrishnanTo remove the multicast MAC address to/from the set of multicast addresses
1267d82ee2ccSAgalya Babu RadhaKrishnanfiltered by port::
1268d82ee2ccSAgalya Babu RadhaKrishnan
1269d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> mcast_addr remove (port_id) (mcast_addr)
1270d82ee2ccSAgalya Babu RadhaKrishnan
1271ac718398SBernard Iremongermac_addr add (for VF)
1272425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~
1273ac718398SBernard Iremonger
1274e76d7a76SJohn McNamaraAdd an alternative MAC address for a VF to a port::
1275ac718398SBernard Iremonger
1276e76d7a76SJohn McNamara   testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX)
1277ac718398SBernard Iremonger
12785852bf6aSPascal Mazonmac_addr set
12795852bf6aSPascal Mazon~~~~~~~~~~~~
12805852bf6aSPascal Mazon
12815852bf6aSPascal MazonSet the default MAC address for a port::
12825852bf6aSPascal Mazon
12835852bf6aSPascal Mazon   testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
12845852bf6aSPascal Mazon
1285425781ffSBernard Iremongermac_addr set (for VF)
1286425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~
1287425781ffSBernard Iremonger
1288425781ffSBernard IremongerSet the MAC address for a VF from the PF::
1289425781ffSBernard Iremonger
1290425781ffSBernard Iremonger   testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)
1291425781ffSBernard Iremonger
1292aac6f11fSWisam Jaddoset eth-peer
1293aac6f11fSWisam Jaddo~~~~~~~~~~~~
1294aac6f11fSWisam Jaddo
1295aac6f11fSWisam JaddoSet the forwarding peer address for certain port::
1296aac6f11fSWisam Jaddo
12973caef7e1SRami Rosen   testpmd> set eth-peer (port_id) (peer_addr)
1298aac6f11fSWisam Jaddo
1299aac6f11fSWisam JaddoThis is equivalent to the ``--eth-peer`` command-line option.
1300aac6f11fSWisam Jaddo
1301ac718398SBernard Iremongerset port-uta
1302ac718398SBernard Iremonger~~~~~~~~~~~~
1303ac718398SBernard Iremonger
1304e76d7a76SJohn McNamaraSet the unicast hash filter(s) on/off for a port::
1305ac718398SBernard Iremonger
1306e76d7a76SJohn McNamara   testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off)
1307ac718398SBernard Iremonger
1308ac718398SBernard Iremongerset promisc
1309ac718398SBernard Iremonger~~~~~~~~~~~
1310ac718398SBernard Iremonger
1311ac718398SBernard IremongerSet the promiscuous mode on for a port or for all ports.
1312e76d7a76SJohn McNamaraIn promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1313ac718398SBernard Iremonger
1314e76d7a76SJohn McNamara   testpmd> set promisc (port_id|all) (on|off)
1315ac718398SBernard Iremonger
1316ac718398SBernard Iremongerset allmulti
1317ac718398SBernard Iremonger~~~~~~~~~~~~
1318ac718398SBernard Iremonger
1319e76d7a76SJohn McNamaraSet the allmulti mode for a port or for all ports::
1320ac718398SBernard Iremonger
1321e76d7a76SJohn McNamara   testpmd> set allmulti (port_id|all) (on|off)
1322ac718398SBernard Iremonger
1323ac718398SBernard IremongerSame as the ifconfig (8) option. Controls how multicast packets are handled.
1324ac718398SBernard Iremonger
13251aa94d05SWenzhuo Luset promisc (for VF)
13261aa94d05SWenzhuo Lu~~~~~~~~~~~~~~~~~~~~
13271aa94d05SWenzhuo Lu
13281aa94d05SWenzhuo LuSet the unicast promiscuous mode for a VF from PF.
13291aa94d05SWenzhuo LuIt's supported by Intel i40e NICs now.
13301aa94d05SWenzhuo LuIn promiscuous mode packets are not dropped if they aren't for the specified MAC address::
13311aa94d05SWenzhuo Lu
13321aa94d05SWenzhuo Lu   testpmd> set vf promisc (port_id) (vf_id) (on|off)
13331aa94d05SWenzhuo Lu
1334982a8970SWenzhuo Luset allmulticast (for VF)
1335982a8970SWenzhuo Lu~~~~~~~~~~~~~~~~~~~~~~~~~
1336982a8970SWenzhuo Lu
1337982a8970SWenzhuo LuSet the multicast promiscuous mode for a VF from PF.
1338982a8970SWenzhuo LuIt's supported by Intel i40e NICs now.
1339982a8970SWenzhuo LuIn promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1340982a8970SWenzhuo Lu
1341982a8970SWenzhuo Lu   testpmd> set vf allmulti (port_id) (vf_id) (on|off)
1342982a8970SWenzhuo Lu
1343cac48219SWenzhuo Luset tx max bandwidth (for VF)
1344cac48219SWenzhuo Lu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1345cac48219SWenzhuo Lu
1346cac48219SWenzhuo LuSet TX max absolute bandwidth (Mbps) for a VF from PF::
1347cac48219SWenzhuo Lu
1348cac48219SWenzhuo Lu   testpmd> set vf tx max-bandwidth (port_id) (vf_id) (max_bandwidth)
1349cac48219SWenzhuo Lu
135042d0baaeSWenzhuo Luset tc tx min bandwidth (for VF)
135142d0baaeSWenzhuo Lu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135242d0baaeSWenzhuo Lu
135342d0baaeSWenzhuo LuSet all TCs' TX min relative bandwidth (%) for a VF from PF::
135442d0baaeSWenzhuo Lu
135542d0baaeSWenzhuo Lu   testpmd> set vf tc tx min-bandwidth (port_id) (vf_id) (bw1, bw2, ...)
135642d0baaeSWenzhuo Lu
1357909fd9acSWenzhuo Luset tc tx max bandwidth (for VF)
1358909fd9acSWenzhuo Lu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1359909fd9acSWenzhuo Lu
1360909fd9acSWenzhuo LuSet a TC's TX max absolute bandwidth (Mbps) for a VF from PF::
1361909fd9acSWenzhuo Lu
1362909fd9acSWenzhuo Lu   testpmd> set vf tc tx max-bandwidth (port_id) (vf_id) (tc_no) (max_bandwidth)
1363909fd9acSWenzhuo Lu
136422e6545fSWenzhuo Luset tc strict link priority mode
136522e6545fSWenzhuo Lu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136622e6545fSWenzhuo Lu
136722e6545fSWenzhuo LuSet some TCs' strict link priority mode on a physical port::
136822e6545fSWenzhuo Lu
136922e6545fSWenzhuo Lu   testpmd> set tx strict-link-priority (port_id) (tc_bitmap)
137022e6545fSWenzhuo Lu
13719fd6c4dfSBernard Iremongerset tc tx min bandwidth
13729fd6c4dfSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~
13739fd6c4dfSBernard Iremonger
13749fd6c4dfSBernard IremongerSet all TCs' TX min relative bandwidth (%) globally for all PF and VFs::
13759fd6c4dfSBernard Iremonger
13769fd6c4dfSBernard Iremonger   testpmd> set tc tx min-bandwidth (port_id) (bw1, bw2, ...)
13779fd6c4dfSBernard Iremonger
1378ac718398SBernard Iremongerset flow_ctrl rx
1379ac718398SBernard Iremonger~~~~~~~~~~~~~~~~
1380ac718398SBernard Iremonger
1381e76d7a76SJohn McNamaraSet the link flow control parameter on a port::
1382ac718398SBernard Iremonger
1383e76d7a76SJohn McNamara   testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1384e76d7a76SJohn McNamara            (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \
1385e76d7a76SJohn McNamara	    autoneg (on|off) (port_id)
1386ac718398SBernard Iremonger
1387ac718398SBernard IremongerWhere:
1388ac718398SBernard Iremonger
1389e76d7a76SJohn McNamara* ``high_water`` (integer): High threshold value to trigger XOFF.
1390ac718398SBernard Iremonger
1391e76d7a76SJohn McNamara* ``low_water`` (integer): Low threshold value to trigger XON.
1392ac718398SBernard Iremonger
1393e76d7a76SJohn McNamara* ``pause_time`` (integer): Pause quota in the Pause frame.
1394ac718398SBernard Iremonger
1395e76d7a76SJohn McNamara* ``send_xon`` (0/1): Send XON frame.
1396ac718398SBernard Iremonger
1397e76d7a76SJohn McNamara* ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames.
1398e76d7a76SJohn McNamara
13990e2db9d3SRami Rosen* ``autoneg``: Change the auto-negotiation parameter.
1400ac718398SBernard Iremonger
1401ac718398SBernard Iremongerset pfc_ctrl rx
1402ac718398SBernard Iremonger~~~~~~~~~~~~~~~
1403ac718398SBernard Iremonger
1404e76d7a76SJohn McNamaraSet the priority flow control parameter on a port::
1405ac718398SBernard Iremonger
1406e76d7a76SJohn McNamara   testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1407e76d7a76SJohn McNamara            (pause_time) (priority) (port_id)
1408ac718398SBernard Iremonger
1409ac718398SBernard IremongerWhere:
1410ac718398SBernard Iremonger
1411e76d7a76SJohn McNamara* ``high_water`` (integer): High threshold value.
1412e76d7a76SJohn McNamara
1413e76d7a76SJohn McNamara* ``low_water`` (integer): Low threshold value.
1414e76d7a76SJohn McNamara
1415e76d7a76SJohn McNamara* ``pause_time`` (integer): Pause quota in the Pause frame.
1416e76d7a76SJohn McNamara
1417e76d7a76SJohn McNamara* ``priority`` (0-7): VLAN User Priority.
1418ac718398SBernard Iremonger
1419ac718398SBernard Iremongerset stat_qmap
1420ac718398SBernard Iremonger~~~~~~~~~~~~~
1421ac718398SBernard Iremonger
1422e76d7a76SJohn McNamaraSet statistics mapping (qmapping 0..15) for RX/TX queue on port::
1423ac718398SBernard Iremonger
1424e76d7a76SJohn McNamara   testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)
1425ac718398SBernard Iremonger
1426e76d7a76SJohn McNamaraFor example, to set rx queue 2 on port 0 to mapping 5::
1427ac718398SBernard Iremonger
1428ac718398SBernard Iremonger   testpmd>set stat_qmap rx 0 2 5
1429ac718398SBernard Iremonger
1430a4fd5eeeSElza Mathewset xstats-hide-zero
1431a4fd5eeeSElza Mathew~~~~~~~~~~~~~~~~~~~~
1432a4fd5eeeSElza Mathew
1433a4fd5eeeSElza MathewSet the option to hide zero values for xstats display::
1434a4fd5eeeSElza Mathew
1435a4fd5eeeSElza Mathew	testpmd> set xstats-hide-zero on|off
1436a4fd5eeeSElza Mathew
1437a4fd5eeeSElza Mathew.. note::
1438a4fd5eeeSElza Mathew
1439a4fd5eeeSElza Mathew	By default, the zero values are displayed for xstats.
1440a4fd5eeeSElza Mathew
1441ac718398SBernard Iremongerset port - rx/tx (for VF)
1442e76d7a76SJohn McNamara~~~~~~~~~~~~~~~~~~~~~~~~~
1443ac718398SBernard Iremonger
1444e76d7a76SJohn McNamaraSet VF receive/transmit from a port::
1445ac718398SBernard Iremonger
1446e76d7a76SJohn McNamara   testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1447ac718398SBernard Iremonger
14486fe5f2f7SPablo de Laraset port - mac address filter (for VF)
14496fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14506fe5f2f7SPablo de Lara
1451e76d7a76SJohn McNamaraAdd/Remove unicast or multicast MAC addr filter for a VF::
14526fe5f2f7SPablo de Lara
1453e76d7a76SJohn McNamara   testpmd> set port (port_id) vf (vf_id) (mac_addr) \
14546fe5f2f7SPablo de Lara            (exact-mac|exact-mac-vlan|hashmac|hashmac-vlan) (on|off)
14556fe5f2f7SPablo de Lara
1456ac718398SBernard Iremongerset port - rx mode(for VF)
1457ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~
1458ac718398SBernard Iremonger
1459e76d7a76SJohn McNamaraSet the VF receive mode of a port::
1460ac718398SBernard Iremonger
1461e76d7a76SJohn McNamara   testpmd> set port (port_id) vf (vf_id) \
1462e76d7a76SJohn McNamara            rxmode (AUPE|ROPE|BAM|MPE) (on|off)
1463ac718398SBernard Iremonger
1464ac718398SBernard IremongerThe available receive modes are:
1465ac718398SBernard Iremonger
1466e76d7a76SJohn McNamara* ``AUPE``: Accepts untagged VLAN.
1467ac718398SBernard Iremonger
1468e76d7a76SJohn McNamara* ``ROPE``: Accepts unicast hash.
1469ac718398SBernard Iremonger
1470e76d7a76SJohn McNamara* ``BAM``: Accepts broadcast packets.
1471ac718398SBernard Iremonger
1472e76d7a76SJohn McNamara* ``MPE``: Accepts all multicast packets.
1473ac718398SBernard Iremonger
1474aa49f366SPablo de Laraset port - tx_rate (for Queue)
1475aa49f366SPablo de Lara~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1476aa49f366SPablo de Lara
1477e76d7a76SJohn McNamaraSet TX rate limitation for a queue on a port::
1478aa49f366SPablo de Lara
1479e76d7a76SJohn McNamara   testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1480aa49f366SPablo de Lara
1481aa49f366SPablo de Laraset port - tx_rate (for VF)
1482aa49f366SPablo de Lara~~~~~~~~~~~~~~~~~~~~~~~~~~~
1483aa49f366SPablo de Lara
1484e76d7a76SJohn McNamaraSet TX rate limitation for queues in VF on a port::
1485aa49f366SPablo de Lara
1486e76d7a76SJohn McNamara   testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
1487aa49f366SPablo de Lara
1488ac718398SBernard Iremongerset port - mirror rule
1489ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~
1490ac718398SBernard Iremonger
1491e76d7a76SJohn McNamaraSet pool or vlan type mirror rule for a port::
1492ac718398SBernard Iremonger
1493e76d7a76SJohn McNamara   testpmd> set port (port_id) mirror-rule (rule_id) \
1494e76d7a76SJohn McNamara            (pool-mirror-up|pool-mirror-down|vlan-mirror) \
1495e76d7a76SJohn McNamara            (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off)
14967ba29a76SJingjing Wu
1497e76d7a76SJohn McNamaraSet link mirror rule for a port::
14987ba29a76SJingjing Wu
1499e76d7a76SJohn McNamara   testpmd> set port (port_id) mirror-rule (rule_id) \
1500e76d7a76SJohn McNamara           (uplink-mirror|downlink-mirror) dst-pool (pool_id) (on|off)
1501ac718398SBernard Iremonger
1502e76d7a76SJohn McNamaraFor example to enable mirror traffic with vlan 0,1 to pool 0::
1503ac718398SBernard Iremonger
1504ac718398SBernard Iremonger   set port 0 mirror-rule 0 vlan-mirror 0,1 dst-pool 0 on
1505ac718398SBernard Iremonger
1506ac718398SBernard Iremongerreset port - mirror rule
1507ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~
1508ac718398SBernard Iremonger
1509e76d7a76SJohn McNamaraReset a mirror rule for a port::
1510ac718398SBernard Iremonger
1511e76d7a76SJohn McNamara   testpmd> reset port (port_id) mirror-rule (rule_id)
1512ac718398SBernard Iremonger
1513ac718398SBernard Iremongerset flush_rx
1514ac718398SBernard Iremonger~~~~~~~~~~~~
1515ac718398SBernard Iremonger
1516e76d7a76SJohn McNamaraSet the flush on RX streams before forwarding.
1517e76d7a76SJohn McNamaraThe default is flush ``on``.
1518e76d7a76SJohn McNamaraMainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams::
1519ac718398SBernard Iremonger
1520e76d7a76SJohn McNamara   testpmd> set flush_rx off
1521ac718398SBernard Iremonger
1522ac718398SBernard Iremongerset bypass mode
1523ac718398SBernard Iremonger~~~~~~~~~~~~~~~
1524ac718398SBernard Iremonger
1525e76d7a76SJohn McNamaraSet the bypass mode for the lowest port on bypass enabled NIC::
1526ac718398SBernard Iremonger
1527e76d7a76SJohn McNamara   testpmd> set bypass mode (normal|bypass|isolate) (port_id)
1528ac718398SBernard Iremonger
1529ac718398SBernard Iremongerset bypass event
1530ac718398SBernard Iremonger~~~~~~~~~~~~~~~~
1531ac718398SBernard Iremonger
1532e76d7a76SJohn McNamaraSet the event required to initiate specified bypass mode for the lowest port on a bypass enabled::
1533ac718398SBernard Iremonger
1534e76d7a76SJohn McNamara   testpmd> set bypass event (timeout|os_on|os_off|power_on|power_off) \
1535e76d7a76SJohn McNamara            mode (normal|bypass|isolate) (port_id)
1536ac718398SBernard Iremonger
1537e76d7a76SJohn McNamaraWhere:
1538ac718398SBernard Iremonger
1539e76d7a76SJohn McNamara* ``timeout``: Enable bypass after watchdog timeout.
1540ac718398SBernard Iremonger
1541e76d7a76SJohn McNamara* ``os_on``: Enable bypass when OS/board is powered on.
1542ac718398SBernard Iremonger
1543e76d7a76SJohn McNamara* ``os_off``: Enable bypass when OS/board is powered off.
1544ac718398SBernard Iremonger
1545e76d7a76SJohn McNamara* ``power_on``: Enable bypass when power supply is turned on.
1546e76d7a76SJohn McNamara
1547e76d7a76SJohn McNamara* ``power_off``: Enable bypass when power supply is turned off.
1548e76d7a76SJohn McNamara
1549ac718398SBernard Iremonger
1550ac718398SBernard Iremongerset bypass timeout
1551ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~
1552ac718398SBernard Iremonger
1553e76d7a76SJohn McNamaraSet the bypass watchdog timeout to ``n`` seconds where 0 = instant::
1554ac718398SBernard Iremonger
1555e76d7a76SJohn McNamara   testpmd> set bypass timeout (0|1.5|2|3|4|8|16|32)
1556ac718398SBernard Iremonger
1557ac718398SBernard Iremongershow bypass config
1558ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~
1559ac718398SBernard Iremonger
1560e76d7a76SJohn McNamaraShow the bypass configuration for a bypass enabled NIC using the lowest port on the NIC::
1561ac718398SBernard Iremonger
1562e76d7a76SJohn McNamara   testpmd> show bypass config (port_id)
1563ac718398SBernard Iremonger
1564ac718398SBernard Iremongerset link up
1565ac718398SBernard Iremonger~~~~~~~~~~~
1566ac718398SBernard Iremonger
1567e76d7a76SJohn McNamaraSet link up for a port::
1568ac718398SBernard Iremonger
1569e76d7a76SJohn McNamara   testpmd> set link-up port (port id)
1570ac718398SBernard Iremonger
1571ac718398SBernard Iremongerset link down
1572ac718398SBernard Iremonger~~~~~~~~~~~~~
1573ac718398SBernard Iremonger
1574e76d7a76SJohn McNamaraSet link down for a port::
1575ac718398SBernard Iremonger
1576e76d7a76SJohn McNamara   testpmd> set link-down port (port id)
1577e76d7a76SJohn McNamara
15780eec728eSWenzhuo LuE-tag set
15790eec728eSWenzhuo Lu~~~~~~~~~
15800eec728eSWenzhuo Lu
15810eec728eSWenzhuo LuEnable E-tag insertion for a VF on a port::
15820eec728eSWenzhuo Lu
15830eec728eSWenzhuo Lu   testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
15840eec728eSWenzhuo Lu
15850eec728eSWenzhuo LuDisable E-tag insertion for a VF on a port::
15860eec728eSWenzhuo Lu
15870eec728eSWenzhuo Lu   testpmd> E-tag set insertion off port (port_id) vf (vf_id)
15880eec728eSWenzhuo Lu
15890eec728eSWenzhuo LuEnable/disable E-tag stripping on a port::
15900eec728eSWenzhuo Lu
15910eec728eSWenzhuo Lu   testpmd> E-tag set stripping (on|off) port (port_id)
15920eec728eSWenzhuo Lu
15930eec728eSWenzhuo LuEnable/disable E-tag based forwarding on a port::
15940eec728eSWenzhuo Lu
15950eec728eSWenzhuo Lu   testpmd> E-tag set forwarding (on|off) port (port_id)
15960eec728eSWenzhuo Lu
15970eec728eSWenzhuo LuAdd an E-tag forwarding filter on a port::
15980eec728eSWenzhuo Lu
15990eec728eSWenzhuo Lu   testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id) port (port_id)
16000eec728eSWenzhuo Lu
16010eec728eSWenzhuo LuDelete an E-tag forwarding filter on a port::
16020eec728eSWenzhuo Lu   testpmd> E-tag set filter del e-tag-id (value) port (port_id)
16030eec728eSWenzhuo Lu
1604cc8d20c4SBeilei Xingddp add
1605cc8d20c4SBeilei Xing~~~~~~~
1606cc8d20c4SBeilei Xing
1607e0e45bdcSKirill RybalchenkoLoad a dynamic device personalization (DDP) profile and store backup profile::
1608cc8d20c4SBeilei Xing
1609e0e45bdcSKirill Rybalchenko   testpmd> ddp add (port_id) (profile_path[,backup_profile_path])
1610cc8d20c4SBeilei Xing
1611856ceb33SAndrey Chilikinddp del
1612856ceb33SAndrey Chilikin~~~~~~~
1613856ceb33SAndrey Chilikin
1614e0e45bdcSKirill RybalchenkoDelete a dynamic device personalization profile and restore backup profile::
1615856ceb33SAndrey Chilikin
1616e0e45bdcSKirill Rybalchenko   testpmd> ddp del (port_id) (backup_profile_path)
1617856ceb33SAndrey Chilikin
1618156a31b5SQi Zhangptype mapping
1619156a31b5SQi Zhang~~~~~~~~~~~~~
1620156a31b5SQi Zhang
1621156a31b5SQi ZhangList all items from the ptype mapping table::
1622156a31b5SQi Zhang
1623156a31b5SQi Zhang   testpmd> ptype mapping get (port_id) (valid_only)
1624156a31b5SQi Zhang
1625156a31b5SQi ZhangWhere:
1626156a31b5SQi Zhang
1627156a31b5SQi Zhang* ``valid_only``: A flag indicates if only list valid items(=1) or all itemss(=0).
1628156a31b5SQi Zhang
1629156a31b5SQi ZhangReplace a specific or a group of software defined ptype with a new one::
1630156a31b5SQi Zhang
1631156a31b5SQi Zhang   testpmd> ptype mapping replace  (port_id) (target) (mask) (pkt_type)
1632156a31b5SQi Zhang
1633156a31b5SQi Zhangwhere:
1634156a31b5SQi Zhang
1635156a31b5SQi Zhang* ``target``: A specific software ptype or a mask to represent a group of software ptypes.
1636156a31b5SQi Zhang
1637156a31b5SQi Zhang* ``mask``: A flag indicate if "target" is a specific software ptype(=0) or a ptype mask(=1).
1638156a31b5SQi Zhang
1639156a31b5SQi Zhang* ``pkt_type``: The new software ptype to replace the old ones.
1640156a31b5SQi Zhang
1641156a31b5SQi ZhangUpdate hardware defined ptype to software defined packet type mapping table::
1642156a31b5SQi Zhang
1643156a31b5SQi Zhang   testpmd> ptype mapping update (port_id) (hw_ptype) (sw_ptype)
1644156a31b5SQi Zhang
1645156a31b5SQi Zhangwhere:
1646156a31b5SQi Zhang
1647156a31b5SQi Zhang* ``hw_ptype``: hardware ptype as the index of the ptype mapping table.
1648156a31b5SQi Zhang
1649156a31b5SQi Zhang* ``sw_ptype``: software ptype as the value of the ptype mapping table.
1650156a31b5SQi Zhang
1651156a31b5SQi ZhangReset ptype mapping table::
1652156a31b5SQi Zhang
1653156a31b5SQi Zhang   testpmd> ptype mapping reset (port_id)
1654ac718398SBernard Iremonger
1655c73a9071SWei Daiconfig per port Rx offloading
1656c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1657c73a9071SWei Dai
1658c73a9071SWei DaiEnable or disable a per port Rx offloading on all Rx queues of a port::
1659c73a9071SWei Dai
1660c73a9071SWei Dai   testpmd> port config (port_id) rx_offload (offloading) on|off
1661c73a9071SWei Dai
1662c73a9071SWei Dai* ``offloading``: can be any of these offloading capability:
1663c73a9071SWei Dai                  vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1664c73a9071SWei Dai                  qinq_strip, outer_ipv4_cksum, macsec_strip,
1665c73a9071SWei Dai                  header_split, vlan_filter, vlan_extend, jumbo_frame,
1666e3386f9aSWei Dai                  crc_strip, scatter, timestamp, security, keep_crc
1667c73a9071SWei Dai
1668c73a9071SWei DaiThis command should be run when the port is stopped, or else it will fail.
1669c73a9071SWei Dai
1670c73a9071SWei Daiconfig per queue Rx offloading
1671c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1672c73a9071SWei Dai
1673c73a9071SWei DaiEnable or disable a per queue Rx offloading only on a specific Rx queue::
1674c73a9071SWei Dai
1675c73a9071SWei Dai   testpmd> port (port_id) rxq (queue_id) rx_offload (offloading) on|off
1676c73a9071SWei Dai
1677c73a9071SWei Dai* ``offloading``: can be any of these offloading capability:
1678c73a9071SWei Dai                  vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1679c73a9071SWei Dai                  qinq_strip, outer_ipv4_cksum, macsec_strip,
1680c73a9071SWei Dai                  header_split, vlan_filter, vlan_extend, jumbo_frame,
1681e3386f9aSWei Dai                  crc_strip, scatter, timestamp, security, keep_crc
1682c73a9071SWei Dai
1683c73a9071SWei DaiThis command should be run when the port is stopped, or else it will fail.
1684c73a9071SWei Dai
1685c73a9071SWei Daiconfig per port Tx offloading
1686c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1687c73a9071SWei Dai
1688c73a9071SWei DaiEnable or disable a per port Tx offloading on all Tx queues of a port::
1689c73a9071SWei Dai
1690c73a9071SWei Dai   testpmd> port config (port_id) tx_offload (offloading) on|off
1691c73a9071SWei Dai
1692c73a9071SWei Dai* ``offloading``: can be any of these offloading capability:
1693d9ddc004SFerruh Yigit                  vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1694c73a9071SWei Dai                  sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1695c73a9071SWei Dai                  qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1696c73a9071SWei Dai                  ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1697c18feafaSDekel Peled                  mt_lockfree, multi_segs, mbuf_fast_free, security,
1698c18feafaSDekel Peled                  match_metadata
1699c73a9071SWei Dai
1700c73a9071SWei DaiThis command should be run when the port is stopped, or else it will fail.
1701c73a9071SWei Dai
1702c73a9071SWei Daiconfig per queue Tx offloading
1703c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1704c73a9071SWei Dai
1705c73a9071SWei DaiEnable or disable a per queue Tx offloading only on a specific Tx queue::
1706c73a9071SWei Dai
1707c73a9071SWei Dai   testpmd> port (port_id) txq (queue_id) tx_offload (offloading) on|off
1708c73a9071SWei Dai
1709c73a9071SWei Dai* ``offloading``: can be any of these offloading capability:
1710d9ddc004SFerruh Yigit                  vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1711c73a9071SWei Dai                  sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1712c73a9071SWei Dai                  qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1713c73a9071SWei Dai                  ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1714e3386f9aSWei Dai                  mt_lockfree, multi_segs, mbuf_fast_free, security
1715c73a9071SWei Dai
1716c73a9071SWei DaiThis command should be run when the port is stopped, or else it will fail.
1717c73a9071SWei Dai
17181960be7dSNelio LaranjeiroConfig VXLAN Encap outer layers
17191960be7dSNelio Laranjeiro~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17201960be7dSNelio Laranjeiro
17211960be7dSNelio LaranjeiroConfigure the outer layer to encapsulate a packet inside a VXLAN tunnel::
17221960be7dSNelio Laranjeiro
17231960be7dSNelio Laranjeiro set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
17241960be7dSNelio Laranjeiro udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) \
17251960be7dSNelio Laranjeiro eth-dst (eth-dst)
17261960be7dSNelio Laranjeiro
17271960be7dSNelio Laranjeiro set vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
17281960be7dSNelio Laranjeiro udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
17291960be7dSNelio Laranjeiro eth-src (eth-src) eth-dst (eth-dst)
17301960be7dSNelio Laranjeiro
173162e8a5a8SViacheslav Ovsiienko set vxlan-tos-ttl ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
173262e8a5a8SViacheslav Ovsiienko udp-dst (udp-dst) ip-tos (ip-tos) ip-ttl (ip-ttl) ip-src (ip-src) \
173362e8a5a8SViacheslav Ovsiienko ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
173462e8a5a8SViacheslav Ovsiienko
1735205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
17361960be7dSNelio Laranjeiroflow rule using the action vxlan_encap will use the last configuration set.
17371960be7dSNelio LaranjeiroTo have a different encapsulation header, one of those commands must be called
17381960be7dSNelio Laranjeirobefore the flow rule creation.
1739c73a9071SWei Dai
1740dcd962fcSNelio LaranjeiroConfig NVGRE Encap outer layers
1741dcd962fcSNelio Laranjeiro~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1742dcd962fcSNelio Laranjeiro
1743dcd962fcSNelio LaranjeiroConfigure the outer layer to encapsulate a packet inside a NVGRE tunnel::
1744dcd962fcSNelio Laranjeiro
1745dcd962fcSNelio Laranjeiro set nvgre ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) ip-dst (ip-dst) \
1746dcd962fcSNelio Laranjeiro        eth-src (eth-src) eth-dst (eth-dst)
1747dcd962fcSNelio Laranjeiro set nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) \
1748dcd962fcSNelio Laranjeiro        ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1749dcd962fcSNelio Laranjeiro
1750205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
1751dcd962fcSNelio Laranjeiroflow rule using the action nvgre_encap will use the last configuration set.
1752dcd962fcSNelio LaranjeiroTo have a different encapsulation header, one of those commands must be called
1753dcd962fcSNelio Laranjeirobefore the flow rule creation.
1754dcd962fcSNelio Laranjeiro
1755a1191d39SOri KamConfig L2 Encap
1756a1191d39SOri Kam~~~~~~~~~~~~~~~
1757a1191d39SOri Kam
1758a1191d39SOri KamConfigure the l2 to be used when encapsulating a packet with L2::
1759a1191d39SOri Kam
1760a1191d39SOri Kam set l2_encap ip-version (ipv4|ipv6) eth-src (eth-src) eth-dst (eth-dst)
1761a1191d39SOri Kam set l2_encap-with-vlan ip-version (ipv4|ipv6) vlan-tci (vlan-tci) \
1762a1191d39SOri Kam        eth-src (eth-src) eth-dst (eth-dst)
1763a1191d39SOri Kam
1764a1191d39SOri KamThose commands will set an internal configuration inside testpmd, any following
1765a1191d39SOri Kamflow rule using the action l2_encap will use the last configuration set.
1766a1191d39SOri KamTo have a different encapsulation header, one of those commands must be called
1767a1191d39SOri Kambefore the flow rule creation.
1768a1191d39SOri Kam
1769a1191d39SOri KamConfig L2 Decap
1770a1191d39SOri Kam~~~~~~~~~~~~~~~
1771a1191d39SOri Kam
1772a1191d39SOri KamConfigure the l2 to be removed when decapsulating a packet with L2::
1773a1191d39SOri Kam
1774a1191d39SOri Kam set l2_decap ip-version (ipv4|ipv6)
1775a1191d39SOri Kam set l2_decap-with-vlan ip-version (ipv4|ipv6)
1776a1191d39SOri Kam
1777a1191d39SOri KamThose commands will set an internal configuration inside testpmd, any following
1778a1191d39SOri Kamflow rule using the action l2_decap will use the last configuration set.
1779a1191d39SOri KamTo have a different encapsulation header, one of those commands must be called
1780a1191d39SOri Kambefore the flow rule creation.
1781a1191d39SOri Kam
17823e77031bSOri KamConfig MPLSoGRE Encap outer layers
17833e77031bSOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17843e77031bSOri Kam
17853e77031bSOri KamConfigure the outer layer to encapsulate a packet inside a MPLSoGRE tunnel::
17863e77031bSOri Kam
17873e77031bSOri Kam set mplsogre_encap ip-version (ipv4|ipv6) label (label) \
17883e77031bSOri Kam        ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
17893e77031bSOri Kam set mplsogre_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
17903e77031bSOri Kam        ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
17913e77031bSOri Kam        eth-src (eth-src) eth-dst (eth-dst)
17923e77031bSOri Kam
1793205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
17943e77031bSOri Kamflow rule using the action mplsogre_encap will use the last configuration set.
17953e77031bSOri KamTo have a different encapsulation header, one of those commands must be called
17963e77031bSOri Kambefore the flow rule creation.
17973e77031bSOri Kam
17983e77031bSOri KamConfig MPLSoGRE Decap outer layers
17993e77031bSOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18003e77031bSOri Kam
18013e77031bSOri KamConfigure the outer layer to decapsulate MPLSoGRE packet::
18023e77031bSOri Kam
18033e77031bSOri Kam set mplsogre_decap ip-version (ipv4|ipv6)
18043e77031bSOri Kam set mplsogre_decap-with-vlan ip-version (ipv4|ipv6)
18053e77031bSOri Kam
1806205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
18073e77031bSOri Kamflow rule using the action mplsogre_decap will use the last configuration set.
18083e77031bSOri KamTo have a different decapsulation header, one of those commands must be called
18093e77031bSOri Kambefore the flow rule creation.
18103e77031bSOri Kam
1811a1191d39SOri KamConfig MPLSoUDP Encap outer layers
1812a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1813a1191d39SOri Kam
1814a1191d39SOri KamConfigure the outer layer to encapsulate a packet inside a MPLSoUDP tunnel::
1815a1191d39SOri Kam
1816a1191d39SOri Kam set mplsoudp_encap ip-version (ipv4|ipv6) label (label) udp-src (udp-src) \
1817a1191d39SOri Kam        udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1818a1191d39SOri Kam        eth-src (eth-src) eth-dst (eth-dst)
1819a1191d39SOri Kam set mplsoudp_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1820a1191d39SOri Kam        udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1821a1191d39SOri Kam        vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1822a1191d39SOri Kam
1823205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
1824a1191d39SOri Kamflow rule using the action mplsoudp_encap will use the last configuration set.
1825a1191d39SOri KamTo have a different encapsulation header, one of those commands must be called
1826a1191d39SOri Kambefore the flow rule creation.
1827a1191d39SOri Kam
1828a1191d39SOri KamConfig MPLSoUDP Decap outer layers
1829a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1830a1191d39SOri Kam
1831a1191d39SOri KamConfigure the outer layer to decapsulate MPLSoUDP packet::
1832a1191d39SOri Kam
1833a1191d39SOri Kam set mplsoudp_decap ip-version (ipv4|ipv6)
1834a1191d39SOri Kam set mplsoudp_decap-with-vlan ip-version (ipv4|ipv6)
1835a1191d39SOri Kam
1836205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
1837a1191d39SOri Kamflow rule using the action mplsoudp_decap will use the last configuration set.
1838a1191d39SOri KamTo have a different decapsulation header, one of those commands must be called
1839a1191d39SOri Kambefore the flow rule creation.
1840a1191d39SOri Kam
184130626defSXiaoyu MinConfig Raw Encapsulation
184230626defSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~~
184330626defSXiaoyu Min
184430626defSXiaoyu MinConfigure the raw data to be used when encapsulating a packet by
184530626defSXiaoyu Minrte_flow_action_raw_encap::
184630626defSXiaoyu Min
184730626defSXiaoyu Min set raw_encap {item} [/ {item} [...]] / end_set
184830626defSXiaoyu Min
184930626defSXiaoyu MinThis command will set an internal buffer inside testpmd, any following flow rule
185030626defSXiaoyu Minusing the action raw_encap will use the last configuration set.
185130626defSXiaoyu MinTo have a different encapsulation header, this command must be called before the
185230626defSXiaoyu Minflow rule creation.
185330626defSXiaoyu Min
185430626defSXiaoyu MinConfig Raw Decapsulation
185530626defSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~
185630626defSXiaoyu Min
185730626defSXiaoyu MinConfigure the raw data to be used when decapsulating a packet by
185830626defSXiaoyu Minrte_flow_action_raw_decap::
185930626defSXiaoyu Min
186030626defSXiaoyu Min set raw_decap {item} [/ {item} [...]] / end_set
186130626defSXiaoyu Min
186230626defSXiaoyu MinThis command will set an internal buffer inside testpmd, any following flow rule
186330626defSXiaoyu Minusing the action raw_decap will use the last configuration set.
186430626defSXiaoyu Min
1865ac718398SBernard IremongerPort Functions
1866ac718398SBernard Iremonger--------------
1867ac718398SBernard Iremonger
1868ac718398SBernard IremongerThe following sections show functions for configuring ports.
1869ac718398SBernard Iremonger
1870ac718398SBernard Iremonger.. note::
1871ac718398SBernard Iremonger
1872ac718398SBernard Iremonger   Port configuration changes only become active when forwarding is started/restarted.
1873ac718398SBernard Iremonger
1874edab33b1STetsuya Mukawaport attach
1875edab33b1STetsuya Mukawa~~~~~~~~~~~
1876edab33b1STetsuya Mukawa
18774cd69cc8SPablo de LaraAttach a port specified by pci address or virtual device args::
18784cd69cc8SPablo de Lara
18794cd69cc8SPablo de Lara   testpmd> port attach (identifier)
1880edab33b1STetsuya Mukawa
1881edab33b1STetsuya MukawaTo attach a new pci device, the device should be recognized by kernel first.
1882edab33b1STetsuya MukawaThen it should be moved under DPDK management.
1883edab33b1STetsuya MukawaFinally the port can be attached to testpmd.
1884edab33b1STetsuya Mukawa
188581b97563SBernard IremongerFor example, to move a pci device using ixgbe under DPDK management:
1886edab33b1STetsuya Mukawa
1887edab33b1STetsuya Mukawa.. code-block:: console
1888edab33b1STetsuya Mukawa
1889e76d7a76SJohn McNamara   # Check the status of the available devices.
1890c6dab2a8SThomas Monjalon   ./usertools/dpdk-devbind.py --status
189181b97563SBernard Iremonger
189281b97563SBernard Iremonger   Network devices using DPDK-compatible driver
189381b97563SBernard Iremonger   ============================================
189481b97563SBernard Iremonger   <none>
189581b97563SBernard Iremonger
189681b97563SBernard Iremonger   Network devices using kernel driver
189781b97563SBernard Iremonger   ===================================
1898e76d7a76SJohn McNamara   0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=
189981b97563SBernard Iremonger
1900e76d7a76SJohn McNamara
1901e76d7a76SJohn McNamara   # Bind the device to igb_uio.
1902c6dab2a8SThomas Monjalon   sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0
1903e76d7a76SJohn McNamara
1904e76d7a76SJohn McNamara
1905e76d7a76SJohn McNamara   # Recheck the status of the devices.
1906c6dab2a8SThomas Monjalon   ./usertools/dpdk-devbind.py --status
190781b97563SBernard Iremonger   Network devices using DPDK-compatible driver
190881b97563SBernard Iremonger   ============================================
1909e76d7a76SJohn McNamara   0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused=
191081b97563SBernard Iremonger
191181b97563SBernard IremongerTo attach a port created by virtual device, above steps are not needed.
191281b97563SBernard Iremonger
191381b97563SBernard IremongerFor example, to attach a port whose pci address is 0000:0a:00.0.
191481b97563SBernard Iremonger
191581b97563SBernard Iremonger.. code-block:: console
191681b97563SBernard Iremonger
191781b97563SBernard Iremonger   testpmd> port attach 0000:0a:00.0
1918edab33b1STetsuya Mukawa   Attaching a new port...
191981b97563SBernard Iremonger   EAL: PCI device 0000:0a:00.0 on NUMA socket -1
192081b97563SBernard Iremonger   EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
192181b97563SBernard Iremonger   EAL:   PCI memory mapped at 0x7f83bfa00000
192281b97563SBernard Iremonger   EAL:   PCI memory mapped at 0x7f83bfa80000
192381b97563SBernard Iremonger   PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5
192481b97563SBernard Iremonger   PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
1925edab33b1STetsuya Mukawa   Port 0 is attached. Now total ports is 1
1926edab33b1STetsuya Mukawa   Done
1927edab33b1STetsuya Mukawa
1928edab33b1STetsuya MukawaFor example, to attach a port created by pcap PMD.
1929edab33b1STetsuya Mukawa
1930edab33b1STetsuya Mukawa.. code-block:: console
1931edab33b1STetsuya Mukawa
193258c82067SThomas Monjalon   testpmd> port attach net_pcap0
1933edab33b1STetsuya Mukawa   Attaching a new port...
193458c82067SThomas Monjalon   PMD: Initializing pmd_pcap for net_pcap0
193581b97563SBernard Iremonger   PMD: Creating pcap-backed ethdev on numa socket 0
1936edab33b1STetsuya Mukawa   Port 0 is attached. Now total ports is 1
1937edab33b1STetsuya Mukawa   Done
1938edab33b1STetsuya Mukawa
193958c82067SThomas MonjalonIn this case, identifier is ``net_pcap0``.
1940e76d7a76SJohn McNamaraThis identifier format is the same as ``--vdev`` format of DPDK applications.
1941edab33b1STetsuya Mukawa
1942ef97d308SBernard IremongerFor example, to re-attach a bonded port which has been previously detached,
1943ef97d308SBernard Iremongerthe mode and slave parameters must be given.
1944ef97d308SBernard Iremonger
1945ef97d308SBernard Iremonger.. code-block:: console
1946ef97d308SBernard Iremonger
194758c82067SThomas Monjalon   testpmd> port attach net_bond_0,mode=0,slave=1
1948ef97d308SBernard Iremonger   Attaching a new port...
194958c82067SThomas Monjalon   EAL: Initializing pmd_bond for net_bond_0
195058c82067SThomas Monjalon   EAL: Create bonded device net_bond_0 on port 0 in mode 0 on socket 0.
1951ef97d308SBernard Iremonger   Port 0 is attached. Now total ports is 1
1952ef97d308SBernard Iremonger   Done
1953ef97d308SBernard Iremonger
1954ef97d308SBernard Iremonger
1955edab33b1STetsuya Mukawaport detach
1956edab33b1STetsuya Mukawa~~~~~~~~~~~
1957edab33b1STetsuya Mukawa
19584cd69cc8SPablo de LaraDetach a specific port::
1959edab33b1STetsuya Mukawa
1960e76d7a76SJohn McNamara   testpmd> port detach (port_id)
1961edab33b1STetsuya Mukawa
19624cd69cc8SPablo de LaraBefore detaching a port, the port should be stopped and closed.
19634cd69cc8SPablo de Lara
196481b97563SBernard IremongerFor example, to detach a pci device port 0.
1965edab33b1STetsuya Mukawa
1966edab33b1STetsuya Mukawa.. code-block:: console
1967edab33b1STetsuya Mukawa
19684cd69cc8SPablo de Lara   testpmd> port stop 0
19694cd69cc8SPablo de Lara   Stopping ports...
19704cd69cc8SPablo de Lara   Done
197181b97563SBernard Iremonger   testpmd> port close 0
197281b97563SBernard Iremonger   Closing ports...
197381b97563SBernard Iremonger   Done
1974e76d7a76SJohn McNamara
1975edab33b1STetsuya Mukawa   testpmd> port detach 0
1976edab33b1STetsuya Mukawa   Detaching a port...
197781b97563SBernard Iremonger   EAL: PCI device 0000:0a:00.0 on NUMA socket -1
197881b97563SBernard Iremonger   EAL:   remove driver: 8086:10fb rte_ixgbe_pmd
197981b97563SBernard Iremonger   EAL:   PCI memory unmapped at 0x7f83bfa00000
198081b97563SBernard Iremonger   EAL:   PCI memory unmapped at 0x7f83bfa80000
1981edab33b1STetsuya Mukawa   Done
1982e76d7a76SJohn McNamara
198381b97563SBernard Iremonger
198481b97563SBernard IremongerFor example, to detach a virtual device port 0.
198581b97563SBernard Iremonger
198681b97563SBernard Iremonger.. code-block:: console
198781b97563SBernard Iremonger
19884cd69cc8SPablo de Lara   testpmd> port stop 0
19894cd69cc8SPablo de Lara   Stopping ports...
19904cd69cc8SPablo de Lara   Done
199181b97563SBernard Iremonger   testpmd> port close 0
199281b97563SBernard Iremonger   Closing ports...
199381b97563SBernard Iremonger   Done
1994e76d7a76SJohn McNamara
199581b97563SBernard Iremonger   testpmd> port detach 0
199681b97563SBernard Iremonger   Detaching a port...
199781b97563SBernard Iremonger   PMD: Closing pcap ethdev on numa socket 0
199858c82067SThomas Monjalon   Port 'net_pcap0' is detached. Now total ports is 0
199981b97563SBernard Iremonger   Done
200081b97563SBernard Iremonger
200181b97563SBernard IremongerTo remove a pci device completely from the system, first detach the port from testpmd.
200281b97563SBernard IremongerThen the device should be moved under kernel management.
200381b97563SBernard IremongerFinally the device can be removed using kernel pci hotplug functionality.
200481b97563SBernard Iremonger
200581b97563SBernard IremongerFor example, to move a pci device under kernel management:
200681b97563SBernard Iremonger
200781b97563SBernard Iremonger.. code-block:: console
200881b97563SBernard Iremonger
2009c6dab2a8SThomas Monjalon   sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0
2010e76d7a76SJohn McNamara
2011c6dab2a8SThomas Monjalon   ./usertools/dpdk-devbind.py --status
201281b97563SBernard Iremonger
201381b97563SBernard Iremonger   Network devices using DPDK-compatible driver
201481b97563SBernard Iremonger   ============================================
201581b97563SBernard Iremonger   <none>
201681b97563SBernard Iremonger
201781b97563SBernard Iremonger   Network devices using kernel driver
201881b97563SBernard Iremonger   ===================================
2019e76d7a76SJohn McNamara   0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio
202081b97563SBernard Iremonger
202181b97563SBernard IremongerTo remove a port created by a virtual device, above steps are not needed.
2022edab33b1STetsuya Mukawa
2023ac718398SBernard Iremongerport start
2024ac718398SBernard Iremonger~~~~~~~~~~
2025ac718398SBernard Iremonger
2026e76d7a76SJohn McNamaraStart all ports or a specific port::
2027ac718398SBernard Iremonger
2028e76d7a76SJohn McNamara   testpmd> port start (port_id|all)
2029ac718398SBernard Iremonger
2030ac718398SBernard Iremongerport stop
2031ac718398SBernard Iremonger~~~~~~~~~
2032ac718398SBernard Iremonger
2033e76d7a76SJohn McNamaraStop all ports or a specific port::
2034ac718398SBernard Iremonger
2035e76d7a76SJohn McNamara   testpmd> port stop (port_id|all)
2036ac718398SBernard Iremonger
2037ac718398SBernard Iremongerport close
2038ac718398SBernard Iremonger~~~~~~~~~~
2039ac718398SBernard Iremonger
2040e76d7a76SJohn McNamaraClose all ports or a specific port::
2041ac718398SBernard Iremonger
2042e76d7a76SJohn McNamara   testpmd> port close (port_id|all)
2043ac718398SBernard Iremonger
2044*1cde1b9aSShougang Wangport reset
2045*1cde1b9aSShougang Wang~~~~~~~~~~
2046*1cde1b9aSShougang Wang
2047*1cde1b9aSShougang WangReset all ports or a specific port::
2048*1cde1b9aSShougang Wang
2049*1cde1b9aSShougang Wang   testpmd> port reset (port_id|all)
2050*1cde1b9aSShougang Wang
2051*1cde1b9aSShougang WangUser should stop port(s) before resetting and (re-)start after reset.
2052*1cde1b9aSShougang Wang
20531a77cffaSQi Zhangport config - queue ring size
20541a77cffaSQi Zhang~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20551a77cffaSQi Zhang
20561a77cffaSQi ZhangConfigure a rx/tx queue ring size::
20571a77cffaSQi Zhang
20581a77cffaSQi Zhang   testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
20591a77cffaSQi Zhang
20601a77cffaSQi ZhangOnly take effect after command that (re-)start the port or command that setup specific queue.
20611a77cffaSQi Zhang
20626fe5f2f7SPablo de Laraport start/stop queue
20636fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~~~~~
20646fe5f2f7SPablo de Lara
2065e76d7a76SJohn McNamaraStart/stop a rx/tx queue on a specific port::
20666fe5f2f7SPablo de Lara
2067e76d7a76SJohn McNamara   testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
20686fe5f2f7SPablo de Lara
2069d3a67720SIan Dolzhanskyport config - queue deferred start
2070d3a67720SIan Dolzhansky~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2071d3a67720SIan Dolzhansky
2072d3a67720SIan DolzhanskySwitch on/off deferred start of a specific port queue::
2073d3a67720SIan Dolzhansky
2074d3a67720SIan Dolzhansky   testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
2075d3a67720SIan Dolzhansky
2076d326e671SQi Zhangport setup queue
2077d326e671SQi Zhang~~~~~~~~~~~~~~~~~~~~~
2078d326e671SQi Zhang
2079d326e671SQi ZhangSetup a rx/tx queue on a specific port::
2080d326e671SQi Zhang
2081d326e671SQi Zhang   testpmd> port (port_id) (rxq|txq) (queue_id) setup
2082d326e671SQi Zhang
20836fe5f2f7SPablo de LaraOnly take effect when port is started.
20846fe5f2f7SPablo de Lara
2085ac718398SBernard Iremongerport config - speed
2086ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~
2087ac718398SBernard Iremonger
2088e76d7a76SJohn McNamaraSet the speed and duplex mode for all ports or a specific port::
2089ac718398SBernard Iremonger
2090f7103a91SAjit Khaparde   testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|auto) \
2091e76d7a76SJohn McNamara            duplex (half|full|auto)
2092ac718398SBernard Iremonger
2093ac718398SBernard Iremongerport config - queues/descriptors
2094ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2095ac718398SBernard Iremonger
2096e76d7a76SJohn McNamaraSet number of queues/descriptors for rxq, txq, rxd and txd::
2097ac718398SBernard Iremonger
2098e76d7a76SJohn McNamara   testpmd> port config all (rxq|txq|rxd|txd) (value)
2099ac718398SBernard Iremonger
2100e76d7a76SJohn McNamaraThis is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2101ac718398SBernard Iremonger
2102ac718398SBernard Iremongerport config - max-pkt-len
2103ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~
2104ac718398SBernard Iremonger
2105e76d7a76SJohn McNamaraSet the maximum packet length::
2106ac718398SBernard Iremonger
2107e76d7a76SJohn McNamara   testpmd> port config all max-pkt-len (value)
2108ac718398SBernard Iremonger
2109e76d7a76SJohn McNamaraThis is equivalent to the ``--max-pkt-len`` command-line option.
2110ac718398SBernard Iremonger
2111ac718398SBernard Iremongerport config - Drop Packets
2112ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~
2113ac718398SBernard Iremonger
2114e5db17a1SFlavia MusatescuEnable or disable packet drop on all RX queues of all ports when no receive buffers available::
2115ac718398SBernard Iremonger
2116e76d7a76SJohn McNamara   testpmd> port config all drop-en (on|off)
2117ac718398SBernard Iremonger
2118e5db17a1SFlavia MusatescuPacket dropping when no receive buffers available is off by default.
2119ac718398SBernard Iremonger
2120e76d7a76SJohn McNamaraThe ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2121ac718398SBernard Iremonger
2122ac718398SBernard Iremongerport config - RSS
2123ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~
2124ac718398SBernard Iremonger
2125e76d7a76SJohn McNamaraSet the RSS (Receive Side Scaling) mode on or off::
2126ac718398SBernard Iremonger
21271aec68d1SQiming Yang   testpmd> port config all rss (all|default|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|none)
2128ac718398SBernard Iremonger
2129ac718398SBernard IremongerRSS is on by default.
2130ac718398SBernard Iremonger
2131d9aa619cSXueming LiThe ``all`` option is equivalent to ip|tcp|udp|sctp|ether.
2132d9aa619cSXueming LiThe ``default`` option enables all supported RSS types reported by device info.
2133e76d7a76SJohn McNamaraThe ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2134ac718398SBernard Iremonger
2135ac718398SBernard Iremongerport config - RSS Reta
2136ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~
2137ac718398SBernard Iremonger
2138e76d7a76SJohn McNamaraSet the RSS (Receive Side Scaling) redirection table::
2139ac718398SBernard Iremonger
2140e76d7a76SJohn McNamara   testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2141ac718398SBernard Iremonger
2142ac718398SBernard Iremongerport config - DCB
2143ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~
2144ac718398SBernard Iremonger
2145e76d7a76SJohn McNamaraSet the DCB mode for an individual port::
2146ac718398SBernard Iremonger
2147e76d7a76SJohn McNamara   testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2148ac718398SBernard Iremonger
2149ac718398SBernard IremongerThe traffic class should be 4 or 8.
2150ac718398SBernard Iremonger
2151ac718398SBernard Iremongerport config - Burst
2152ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~
2153ac718398SBernard Iremonger
2154e76d7a76SJohn McNamaraSet the number of packets per burst::
2155ac718398SBernard Iremonger
2156e76d7a76SJohn McNamara   testpmd> port config all burst (value)
2157ac718398SBernard Iremonger
2158e76d7a76SJohn McNamaraThis is equivalent to the ``--burst`` command-line option.
2159ac718398SBernard Iremonger
2160ac718398SBernard Iremongerport config - Threshold
2161ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~
2162ac718398SBernard Iremonger
2163e76d7a76SJohn McNamaraSet thresholds for TX/RX queues::
2164ac718398SBernard Iremonger
2165e76d7a76SJohn McNamara   testpmd> port config all (threshold) (value)
2166ac718398SBernard Iremonger
2167ac718398SBernard IremongerWhere the threshold type can be:
2168ac718398SBernard Iremonger
2169e76d7a76SJohn McNamara* ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255.
2170ac718398SBernard Iremonger
2171e76d7a76SJohn McNamara* ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255.
2172ac718398SBernard Iremonger
2173e76d7a76SJohn McNamara* ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255.
2174ac718398SBernard Iremonger
2175e76d7a76SJohn McNamara* ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255.
2176ac718398SBernard Iremonger
2177e76d7a76SJohn McNamara* ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255.
2178ac718398SBernard Iremonger
2179e76d7a76SJohn McNamara* ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255.
2180ac718398SBernard Iremonger
2181e76d7a76SJohn McNamara* ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd.
2182ac718398SBernard Iremonger
2183e76d7a76SJohn McNamara* ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd.
2184ac718398SBernard Iremonger
2185e76d7a76SJohn McNamara* ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd.
2186e76d7a76SJohn McNamara
2187ac718398SBernard IremongerThese threshold options are also available from the command-line.
2188ac718398SBernard Iremonger
218905f1b9c8SWenzhuo Luport config - E-tag
219005f1b9c8SWenzhuo Lu~~~~~~~~~~~~~~~~~~~
219105f1b9c8SWenzhuo Lu
219205f1b9c8SWenzhuo LuSet the value of ether-type for E-tag::
219305f1b9c8SWenzhuo Lu
219405f1b9c8SWenzhuo Lu   testpmd> port config (port_id|all) l2-tunnel E-tag ether-type (value)
219505f1b9c8SWenzhuo Lu
219605f1b9c8SWenzhuo LuEnable/disable the E-tag support::
219705f1b9c8SWenzhuo Lu
219805f1b9c8SWenzhuo Lu   testpmd> port config (port_id|all) l2-tunnel E-tag (enable|disable)
219905f1b9c8SWenzhuo Lu
22005a4806d3SKirill Rybalchenkoport config pctype mapping
22015a4806d3SKirill Rybalchenko~~~~~~~~~~~~~~~~~~~~~~~~~~
22025a4806d3SKirill Rybalchenko
22035a4806d3SKirill RybalchenkoReset pctype mapping table::
22045a4806d3SKirill Rybalchenko
22055a4806d3SKirill Rybalchenko   testpmd> port config (port_id) pctype mapping reset
22065a4806d3SKirill Rybalchenko
22075a4806d3SKirill RybalchenkoUpdate hardware defined pctype to software defined flow type mapping table::
22085a4806d3SKirill Rybalchenko
22095a4806d3SKirill Rybalchenko   testpmd> port config (port_id) pctype mapping update (pctype_id_0[,pctype_id_1]*) (flow_type_id)
22105a4806d3SKirill Rybalchenko
22115a4806d3SKirill Rybalchenkowhere:
22125a4806d3SKirill Rybalchenko
22135a4806d3SKirill Rybalchenko* ``pctype_id_x``: hardware pctype id as index of bit in bitmask value of the pctype mapping table.
22145a4806d3SKirill Rybalchenko
22155a4806d3SKirill Rybalchenko* ``flow_type_id``: software flow type id as the index of the pctype mapping table.
22165a4806d3SKirill Rybalchenko
2217e38ea44fSBeilei Xingport config input set
2218e38ea44fSBeilei Xing~~~~~~~~~~~~~~~~~~~~~
2219e38ea44fSBeilei Xing
2220e38ea44fSBeilei XingConfig RSS/FDIR/FDIR flexible payload input set for some pctype::
22217fa1a2deSKevin Traynor
2222e38ea44fSBeilei Xing   testpmd> port config (port_id) pctype (pctype_id) \
2223e38ea44fSBeilei Xing            (hash_inset|fdir_inset|fdir_flx_inset) \
2224e38ea44fSBeilei Xing	    (get|set|clear) field (field_idx)
2225e38ea44fSBeilei Xing
2226e38ea44fSBeilei XingClear RSS/FDIR/FDIR flexible payload input set for some pctype::
22277fa1a2deSKevin Traynor
2228e38ea44fSBeilei Xing   testpmd> port config (port_id) pctype (pctype_id) \
2229e38ea44fSBeilei Xing            (hash_inset|fdir_inset|fdir_flx_inset) clear all
2230e38ea44fSBeilei Xing
2231e38ea44fSBeilei Xingwhere:
2232e38ea44fSBeilei Xing
2233e38ea44fSBeilei Xing* ``pctype_id``: hardware packet classification types.
2234e38ea44fSBeilei Xing* ``field_idx``: hardware field index.
2235e76d7a76SJohn McNamara
223608e0b344SShahed Shaikhport config udp_tunnel_port
223708e0b344SShahed Shaikh~~~~~~~~~~~~~~~~~~~~~~~~~~~
223808e0b344SShahed Shaikh
223908e0b344SShahed ShaikhAdd/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
22407fa1a2deSKevin Traynor
22411aec68d1SQiming Yang    testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe (udp_port)
224208e0b344SShahed Shaikh
2243c18feafaSDekel Peledport config tx_metadata
2244c18feafaSDekel Peled~~~~~~~~~~~~~~~~~~~~~~~
2245c18feafaSDekel Peled
2246c18feafaSDekel PeledSet Tx metadata value per port.
2247c18feafaSDekel Peledtestpmd will add this value to any Tx packet sent from this port::
2248c18feafaSDekel Peled
2249c18feafaSDekel Peled   testpmd> port config (port_id) tx_metadata (value)
2250c18feafaSDekel Peled
2251d82ee2ccSAgalya Babu RadhaKrishnanport config mtu
2252d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~
2253d82ee2ccSAgalya Babu RadhaKrishnan
2254d82ee2ccSAgalya Babu RadhaKrishnanTo configure MTU(Maximum Transmission Unit) on devices using testpmd::
2255d82ee2ccSAgalya Babu RadhaKrishnan
2256d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> port config mtu (port_id) (value)
2257d82ee2ccSAgalya Babu RadhaKrishnan
2258d82ee2ccSAgalya Babu RadhaKrishnanport config rss hash key
2259d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~~~~~~~~~~
2260d82ee2ccSAgalya Babu RadhaKrishnan
2261d82ee2ccSAgalya Babu RadhaKrishnanTo configure the RSS hash key used to compute the RSS
2262d82ee2ccSAgalya Babu RadhaKrishnanhash of input [IP] packets received on port::
2263d82ee2ccSAgalya Babu RadhaKrishnan
2264d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> port config <port_id> rss-hash-key (ipv4|ipv4-frag|\
2265d82ee2ccSAgalya Babu RadhaKrishnan                     ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|\
2266d82ee2ccSAgalya Babu RadhaKrishnan                     ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|\
2267d82ee2ccSAgalya Babu RadhaKrishnan                     ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|\
2268d82ee2ccSAgalya Babu RadhaKrishnan                     ipv6-udp-ex <string of hex digits \
2269d82ee2ccSAgalya Babu RadhaKrishnan                     (variable length, NIC dependent)>)
2270d82ee2ccSAgalya Babu RadhaKrishnan
227155e51c96SNithin DabilpuramDevice Functions
227255e51c96SNithin Dabilpuram----------------
227355e51c96SNithin Dabilpuram
227455e51c96SNithin DabilpuramThe following sections show functions for device operations.
227555e51c96SNithin Dabilpuram
227655e51c96SNithin Dabilpuramdevice detach
227755e51c96SNithin Dabilpuram~~~~~~~~~~~~~
227855e51c96SNithin Dabilpuram
227955e51c96SNithin DabilpuramDetach a device specified by pci address or virtual device args::
228055e51c96SNithin Dabilpuram
228155e51c96SNithin Dabilpuram   testpmd> device detach (identifier)
228255e51c96SNithin Dabilpuram
228355e51c96SNithin DabilpuramBefore detaching a device associated with ports, the ports should be stopped and closed.
228455e51c96SNithin Dabilpuram
228555e51c96SNithin DabilpuramFor example, to detach a pci device whose address is 0002:03:00.0.
228655e51c96SNithin Dabilpuram
228755e51c96SNithin Dabilpuram.. code-block:: console
228855e51c96SNithin Dabilpuram
228955e51c96SNithin Dabilpuram    testpmd> device detach 0002:03:00.0
229055e51c96SNithin Dabilpuram    Removing a device...
229155e51c96SNithin Dabilpuram    Port 1 is now closed
229255e51c96SNithin Dabilpuram    EAL: Releasing pci mapped resource for 0002:03:00.0
229355e51c96SNithin Dabilpuram    EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218a050000
229455e51c96SNithin Dabilpuram    EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218c050000
229555e51c96SNithin Dabilpuram    Device 0002:03:00.0 is detached
229655e51c96SNithin Dabilpuram    Now total ports is 1
229755e51c96SNithin Dabilpuram
229855e51c96SNithin DabilpuramFor example, to detach a port created by pcap PMD.
229955e51c96SNithin Dabilpuram
230055e51c96SNithin Dabilpuram.. code-block:: console
230155e51c96SNithin Dabilpuram
230255e51c96SNithin Dabilpuram    testpmd> device detach net_pcap0
230355e51c96SNithin Dabilpuram    Removing a device...
230455e51c96SNithin Dabilpuram    Port 0 is now closed
230555e51c96SNithin Dabilpuram    Device net_pcap0 is detached
230655e51c96SNithin Dabilpuram    Now total ports is 0
230755e51c96SNithin Dabilpuram    Done
230855e51c96SNithin Dabilpuram
230955e51c96SNithin DabilpuramIn this case, identifier is ``net_pcap0``.
231055e51c96SNithin DabilpuramThis identifier format is the same as ``--vdev`` format of DPDK applications.
231155e51c96SNithin Dabilpuram
2312ac718398SBernard IremongerLink Bonding Functions
2313ac718398SBernard Iremonger----------------------
2314ac718398SBernard Iremonger
2315ac718398SBernard IremongerThe Link Bonding functions make it possible to dynamically create and
2316ac718398SBernard Iremongermanage link bonding devices from within testpmd interactive prompt.
2317ac718398SBernard Iremonger
2318ac718398SBernard Iremongercreate bonded device
2319ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~
2320ac718398SBernard Iremonger
2321e76d7a76SJohn McNamaraCreate a new bonding device::
2322ac718398SBernard Iremonger
2323e76d7a76SJohn McNamara   testpmd> create bonded device (mode) (socket)
2324ac718398SBernard Iremonger
2325e76d7a76SJohn McNamaraFor example, to create a bonded device in mode 1 on socket 0::
2326ac718398SBernard Iremonger
23270c00abfdSShreyansh Jain   testpmd> create bonded device 1 0
2328ac718398SBernard Iremonger   created new bonded device (port X)
2329ac718398SBernard Iremonger
2330ac718398SBernard Iremongeradd bonding slave
2331ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~
2332ac718398SBernard Iremonger
2333e76d7a76SJohn McNamaraAdds Ethernet device to a Link Bonding device::
2334ac718398SBernard Iremonger
2335e76d7a76SJohn McNamara   testpmd> add bonding slave (slave id) (port id)
2336ac718398SBernard Iremonger
2337e76d7a76SJohn McNamaraFor example, to add Ethernet device (port 6) to a Link Bonding device (port 10)::
2338ac718398SBernard Iremonger
2339ac718398SBernard Iremonger   testpmd> add bonding slave 6 10
2340ac718398SBernard Iremonger
2341ac718398SBernard Iremonger
2342ac718398SBernard Iremongerremove bonding slave
2343ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~
2344ac718398SBernard Iremonger
2345e76d7a76SJohn McNamaraRemoves an Ethernet slave device from a Link Bonding device::
2346ac718398SBernard Iremonger
2347e76d7a76SJohn McNamara   testpmd> remove bonding slave (slave id) (port id)
2348ac718398SBernard Iremonger
2349e76d7a76SJohn McNamaraFor example, to remove Ethernet slave device (port 6) to a Link Bonding device (port 10)::
2350ac718398SBernard Iremonger
2351ac718398SBernard Iremonger   testpmd> remove bonding slave 6 10
2352ac718398SBernard Iremonger
2353ac718398SBernard Iremongerset bonding mode
2354ac718398SBernard Iremonger~~~~~~~~~~~~~~~~
2355ac718398SBernard Iremonger
2356e76d7a76SJohn McNamaraSet the Link Bonding mode of a Link Bonding device::
2357ac718398SBernard Iremonger
2358e76d7a76SJohn McNamara   testpmd> set bonding mode (value) (port id)
2359ac718398SBernard Iremonger
2360e76d7a76SJohn McNamaraFor example, to set the bonding mode of a Link Bonding device (port 10) to broadcast (mode 3)::
2361ac718398SBernard Iremonger
2362ac718398SBernard Iremonger   testpmd> set bonding mode 3 10
2363ac718398SBernard Iremonger
2364ac718398SBernard Iremongerset bonding primary
2365ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~
2366ac718398SBernard Iremonger
2367e76d7a76SJohn McNamaraSet an Ethernet slave device as the primary device on a Link Bonding device::
2368ac718398SBernard Iremonger
2369e76d7a76SJohn McNamara   testpmd> set bonding primary (slave id) (port id)
2370ac718398SBernard Iremonger
2371e76d7a76SJohn McNamaraFor example, to set the Ethernet slave device (port 6) as the primary port of a Link Bonding device (port 10)::
2372ac718398SBernard Iremonger
2373ac718398SBernard Iremonger   testpmd> set bonding primary 6 10
2374ac718398SBernard Iremonger
2375ac718398SBernard Iremongerset bonding mac
2376ac718398SBernard Iremonger~~~~~~~~~~~~~~~
2377ac718398SBernard Iremonger
2378e76d7a76SJohn McNamaraSet the MAC address of a Link Bonding device::
2379ac718398SBernard Iremonger
2380e76d7a76SJohn McNamara   testpmd> set bonding mac (port id) (mac)
2381ac718398SBernard Iremonger
2382e76d7a76SJohn McNamaraFor example, to set the MAC address of a Link Bonding device (port 10) to 00:00:00:00:00:01::
2383ac718398SBernard Iremonger
2384ac718398SBernard Iremonger   testpmd> set bonding mac 10 00:00:00:00:00:01
2385ac718398SBernard Iremonger
2386ac718398SBernard Iremongerset bonding xmit_balance_policy
2387ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2388ac718398SBernard Iremonger
2389e76d7a76SJohn McNamaraSet the transmission policy for a Link Bonding device when it is in Balance XOR mode::
2390ac718398SBernard Iremonger
2391e76d7a76SJohn McNamara   testpmd> set bonding xmit_balance_policy (port_id) (l2|l23|l34)
2392ac718398SBernard Iremonger
2393e76d7a76SJohn McNamaraFor example, set a Link Bonding device (port 10) to use a balance policy of layer 3+4 (IP addresses & UDP ports)::
2394ac718398SBernard Iremonger
2395ac718398SBernard Iremonger   testpmd> set bonding xmit_balance_policy 10 l34
2396ac718398SBernard Iremonger
2397a45b288eSDeclan Doherty
2398a45b288eSDeclan Dohertyset bonding mon_period
2399a45b288eSDeclan Doherty~~~~~~~~~~~~~~~~~~~~~~
2400a45b288eSDeclan Doherty
2401fea1d908SJohn McNamaraSet the link status monitoring polling period in milliseconds for a bonding device.
2402a45b288eSDeclan Doherty
2403a45b288eSDeclan DohertyThis adds support for PMD slave devices which do not support link status interrupts.
2404a45b288eSDeclan DohertyWhen the mon_period is set to a value greater than 0 then all PMD's which do not support
2405e76d7a76SJohn McNamaralink status ISR will be queried every polling interval to check if their link status has changed::
2406a45b288eSDeclan Doherty
2407e76d7a76SJohn McNamara   testpmd> set bonding mon_period (port_id) (value)
2408a45b288eSDeclan Doherty
2409e76d7a76SJohn McNamaraFor example, to set the link status monitoring polling period of bonded device (port 5) to 150ms::
2410a45b288eSDeclan Doherty
2411a45b288eSDeclan Doherty   testpmd> set bonding mon_period 5 150
2412a45b288eSDeclan Doherty
2413a45b288eSDeclan Doherty
2414c735b831STomasz Kulasekset bonding lacp dedicated_queue
2415c735b831STomasz Kulasek~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2416c735b831STomasz Kulasek
2417c735b831STomasz KulasekEnable dedicated tx/rx queues on bonding devices slaves to handle LACP control plane traffic
2418d629b7b5SJohn McNamarawhen in mode 4 (link-aggregation-802.3ad)::
2419c735b831STomasz Kulasek
2420c735b831STomasz Kulasek   testpmd> set bonding lacp dedicated_queues (port_id) (enable|disable)
2421c735b831STomasz Kulasek
2422c735b831STomasz Kulasek
24230aeb7077SDaniel Mrzyglodset bonding agg_mode
24240aeb7077SDaniel Mrzyglod~~~~~~~~~~~~~~~~~~~~
24250aeb7077SDaniel Mrzyglod
2426d629b7b5SJohn McNamaraEnable one of the specific aggregators mode when in mode 4 (link-aggregation-802.3ad)::
24270aeb7077SDaniel Mrzyglod
24280aeb7077SDaniel Mrzyglod   testpmd> set bonding agg_mode (port_id) (bandwidth|count|stable)
24290aeb7077SDaniel Mrzyglod
24300aeb7077SDaniel Mrzyglod
2431ac718398SBernard Iremongershow bonding config
2432ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~
2433ac718398SBernard Iremonger
2434e76d7a76SJohn McNamaraShow the current configuration of a Link Bonding device::
2435ac718398SBernard Iremonger
2436e76d7a76SJohn McNamara   testpmd> show bonding config (port id)
2437ac718398SBernard Iremonger
2438ac718398SBernard IremongerFor example,
2439ac718398SBernard Iremongerto show the configuration a Link Bonding device (port 9) with 3 slave devices (1, 3, 4)
2440e76d7a76SJohn McNamarain balance mode with a transmission policy of layer 2+3::
2441ac718398SBernard Iremonger
2442ac718398SBernard Iremonger   testpmd> show bonding config 9
2443ac718398SBernard Iremonger        Bonding mode: 2
2444ac718398SBernard Iremonger        Balance Xmit Policy: BALANCE_XMIT_POLICY_LAYER23
2445ac718398SBernard Iremonger        Slaves (3): [1 3 4]
2446ac718398SBernard Iremonger        Active Slaves (3): [1 3 4]
2447ac718398SBernard Iremonger        Primary: [3]
2448ac718398SBernard Iremonger
2449e76d7a76SJohn McNamara
2450ac718398SBernard IremongerRegister Functions
2451ac718398SBernard Iremonger------------------
2452ac718398SBernard Iremonger
2453e76d7a76SJohn McNamaraThe Register Functions can be used to read from and write to registers on the network card referenced by a port number.
2454ac718398SBernard IremongerThis is mainly useful for debugging purposes.
2455ac718398SBernard IremongerReference should be made to the appropriate datasheet for the network card for details on the register addresses
2456ac718398SBernard Iremongerand fields that can be accessed.
2457ac718398SBernard Iremonger
2458ac718398SBernard Iremongerread reg
2459ac718398SBernard Iremonger~~~~~~~~
2460ac718398SBernard Iremonger
2461e76d7a76SJohn McNamaraDisplay the value of a port register::
2462ac718398SBernard Iremonger
2463e76d7a76SJohn McNamara   testpmd> read reg (port_id) (address)
2464ac718398SBernard Iremonger
2465e76d7a76SJohn McNamaraFor example, to examine the Flow Director control register (FDIRCTL, 0x0000EE000) on an Intel 82599 10 GbE Controller::
2466ac718398SBernard Iremonger
2467ac718398SBernard Iremonger   testpmd> read reg 0 0xEE00
2468ac718398SBernard Iremonger   port 0 PCI register at offset 0xEE00: 0x4A060029 (1241907241)
2469ac718398SBernard Iremonger
2470ac718398SBernard Iremongerread regfield
2471ac718398SBernard Iremonger~~~~~~~~~~~~~
2472ac718398SBernard Iremonger
2473e76d7a76SJohn McNamaraDisplay a port register bit field::
2474ac718398SBernard Iremonger
2475e76d7a76SJohn McNamara   testpmd> read regfield (port_id) (address) (bit_x) (bit_y)
2476ac718398SBernard Iremonger
2477e76d7a76SJohn McNamaraFor example, reading the lowest two bits from the register in the example above::
2478ac718398SBernard Iremonger
2479ac718398SBernard Iremonger   testpmd> read regfield 0 0xEE00 0 1
2480ac718398SBernard Iremonger   port 0 PCI register at offset 0xEE00: bits[0, 1]=0x1 (1)
2481ac718398SBernard Iremonger
2482ac718398SBernard Iremongerread regbit
2483ac718398SBernard Iremonger~~~~~~~~~~~
2484ac718398SBernard Iremonger
2485e76d7a76SJohn McNamaraDisplay a single port register bit::
2486ac718398SBernard Iremonger
2487e76d7a76SJohn McNamara   testpmd> read regbit (port_id) (address) (bit_x)
2488ac718398SBernard Iremonger
2489e76d7a76SJohn McNamaraFor example, reading the lowest bit from the register in the example above::
2490ac718398SBernard Iremonger
2491ac718398SBernard Iremonger   testpmd> read regbit 0 0xEE00 0
2492ac718398SBernard Iremonger   port 0 PCI register at offset 0xEE00: bit 0=1
2493ac718398SBernard Iremonger
2494ac718398SBernard Iremongerwrite reg
2495ac718398SBernard Iremonger~~~~~~~~~
2496ac718398SBernard Iremonger
2497e76d7a76SJohn McNamaraSet the value of a port register::
2498ac718398SBernard Iremonger
2499e76d7a76SJohn McNamara   testpmd> write reg (port_id) (address) (value)
2500ac718398SBernard Iremonger
2501e76d7a76SJohn McNamaraFor example, to clear a register::
2502ac718398SBernard Iremonger
2503ac718398SBernard Iremonger   testpmd> write reg 0 0xEE00 0x0
2504ac718398SBernard Iremonger   port 0 PCI register at offset 0xEE00: 0x00000000 (0)
2505ac718398SBernard Iremonger
2506ac718398SBernard Iremongerwrite regfield
2507ac718398SBernard Iremonger~~~~~~~~~~~~~~
2508ac718398SBernard Iremonger
2509e76d7a76SJohn McNamaraSet bit field of a port register::
2510ac718398SBernard Iremonger
2511e76d7a76SJohn McNamara   testpmd> write regfield (port_id) (address) (bit_x) (bit_y) (value)
2512ac718398SBernard Iremonger
2513e76d7a76SJohn McNamaraFor example, writing to the register cleared in the example above::
2514ac718398SBernard Iremonger
2515ac718398SBernard Iremonger   testpmd> write regfield 0 0xEE00 0 1 2
2516ac718398SBernard Iremonger   port 0 PCI register at offset 0xEE00: 0x00000002 (2)
2517ac718398SBernard Iremonger
2518ac718398SBernard Iremongerwrite regbit
2519ac718398SBernard Iremonger~~~~~~~~~~~~
2520ac718398SBernard Iremonger
2521e76d7a76SJohn McNamaraSet single bit value of a port register::
2522ac718398SBernard Iremonger
2523e76d7a76SJohn McNamara   testpmd> write regbit (port_id) (address) (bit_x) (value)
2524ac718398SBernard Iremonger
2525e76d7a76SJohn McNamaraFor example, to set the high bit in the register from the example above::
2526ac718398SBernard Iremonger
2527ac718398SBernard Iremonger   testpmd> write regbit 0 0xEE00 31 1
2528ac718398SBernard Iremonger   port 0 PCI register at offset 0xEE00: 0x8000000A (2147483658)
2529aa49f366SPablo de Lara
2530f06125c0SJasvinder SinghTraffic Metering and Policing
2531f06125c0SJasvinder Singh-----------------------------
2532f06125c0SJasvinder Singh
2533f06125c0SJasvinder SinghThe following section shows functions for configuring traffic metering and
2534f06125c0SJasvinder Singhpolicing on the ethernet device through the use of generic ethdev API.
2535f06125c0SJasvinder Singh
2536f06125c0SJasvinder Singhshow port traffic management capability
2537f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2538f06125c0SJasvinder Singh
2539f06125c0SJasvinder SinghShow traffic metering and policing capability of the port::
2540f06125c0SJasvinder Singh
2541f06125c0SJasvinder Singh   testpmd> show port meter cap (port_id)
2542f06125c0SJasvinder Singh
2543f06125c0SJasvinder Singhadd port meter profile (srTCM rfc2967)
2544f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2545f06125c0SJasvinder Singh
2546f06125c0SJasvinder SinghAdd meter profile (srTCM rfc2697) to the ethernet device::
2547f06125c0SJasvinder Singh
2548f06125c0SJasvinder Singh   testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
2549f06125c0SJasvinder Singh   (cir) (cbs) (ebs)
2550f06125c0SJasvinder Singh
2551f06125c0SJasvinder Singhwhere:
2552f06125c0SJasvinder Singh
2553f06125c0SJasvinder Singh* ``profile_id``: ID for the meter profile.
2554f06125c0SJasvinder Singh* ``cir``: Committed Information Rate (CIR) (bytes/second).
2555f06125c0SJasvinder Singh* ``cbs``: Committed Burst Size (CBS) (bytes).
2556f06125c0SJasvinder Singh* ``ebs``: Excess Burst Size (EBS) (bytes).
2557f06125c0SJasvinder Singh
2558f06125c0SJasvinder Singhadd port meter profile (trTCM rfc2968)
2559f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2560f06125c0SJasvinder Singh
2561f06125c0SJasvinder SinghAdd meter profile (srTCM rfc2698) to the ethernet device::
2562f06125c0SJasvinder Singh
2563f06125c0SJasvinder Singh   testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
2564f06125c0SJasvinder Singh   (cir) (pir) (cbs) (pbs)
2565f06125c0SJasvinder Singh
2566f06125c0SJasvinder Singhwhere:
2567f06125c0SJasvinder Singh
2568f06125c0SJasvinder Singh* ``profile_id``: ID for the meter profile.
2569f06125c0SJasvinder Singh* ``cir``: Committed information rate (bytes/second).
2570f06125c0SJasvinder Singh* ``pir``: Peak information rate (bytes/second).
2571f06125c0SJasvinder Singh* ``cbs``: Committed burst size (bytes).
2572f06125c0SJasvinder Singh* ``pbs``: Peak burst size (bytes).
2573f06125c0SJasvinder Singh
2574f06125c0SJasvinder Singhadd port meter profile (trTCM rfc4115)
2575f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2576f06125c0SJasvinder Singh
2577f06125c0SJasvinder SinghAdd meter profile (trTCM rfc4115) to the ethernet device::
2578f06125c0SJasvinder Singh
2579f06125c0SJasvinder Singh   testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
2580f06125c0SJasvinder Singh   (cir) (eir) (cbs) (ebs)
2581f06125c0SJasvinder Singh
2582f06125c0SJasvinder Singhwhere:
2583f06125c0SJasvinder Singh
2584f06125c0SJasvinder Singh* ``profile_id``: ID for the meter profile.
2585f06125c0SJasvinder Singh* ``cir``: Committed information rate (bytes/second).
2586f06125c0SJasvinder Singh* ``eir``: Excess information rate (bytes/second).
2587f06125c0SJasvinder Singh* ``cbs``: Committed burst size (bytes).
2588f06125c0SJasvinder Singh* ``ebs``: Excess burst size (bytes).
2589f06125c0SJasvinder Singh
2590f06125c0SJasvinder Singhdelete port meter profile
2591f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~
2592f06125c0SJasvinder Singh
2593f06125c0SJasvinder SinghDelete meter profile from the ethernet device::
2594f06125c0SJasvinder Singh
2595f06125c0SJasvinder Singh   testpmd> del port meter profile (port_id) (profile_id)
2596f06125c0SJasvinder Singh
2597f06125c0SJasvinder Singhcreate port meter
2598f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~
2599f06125c0SJasvinder Singh
2600f06125c0SJasvinder SinghCreate new meter object for the ethernet device::
2601f06125c0SJasvinder Singh
2602f06125c0SJasvinder Singh   testpmd> create port meter (port_id) (mtr_id) (profile_id) \
2603f06125c0SJasvinder Singh   (meter_enable) (g_action) (y_action) (r_action) (stats_mask) (shared) \
2604f06125c0SJasvinder Singh   (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\
2605f06125c0SJasvinder Singh   (dscp_tbl_entry63)]
2606f06125c0SJasvinder Singh
2607f06125c0SJasvinder Singhwhere:
2608f06125c0SJasvinder Singh
2609f06125c0SJasvinder Singh* ``mtr_id``: meter object ID.
2610f06125c0SJasvinder Singh* ``profile_id``: ID for the meter profile.
2611f06125c0SJasvinder Singh* ``meter_enable``: When this parameter has a non-zero value, the meter object
2612f06125c0SJasvinder Singh  gets enabled at the time of creation, otherwise remains disabled.
2613f06125c0SJasvinder Singh* ``g_action``: Policer action for the packet with green color.
2614f06125c0SJasvinder Singh* ``y_action``: Policer action for the packet with yellow color.
2615f06125c0SJasvinder Singh* ``r_action``: Policer action for the packet with red color.
2616f06125c0SJasvinder Singh* ``stats_mask``: Mask of statistics counter types to be enabled for the
2617f06125c0SJasvinder Singh  meter object.
2618f06125c0SJasvinder Singh* ``shared``:  When this parameter has a non-zero value, the meter object is
2619f06125c0SJasvinder Singh  shared by multiple flows. Otherwise, meter object is used by single flow.
2620f06125c0SJasvinder Singh* ``use_pre_meter_color``: When this parameter has a non-zero value, the
2621f06125c0SJasvinder Singh  input color for the current meter object is determined by the latest meter
2622f06125c0SJasvinder Singh  object in the same flow. Otherwise, the current meter object uses the
2623f06125c0SJasvinder Singh  *dscp_table* to determine the input color.
2624f06125c0SJasvinder Singh* ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input
2625f06125c0SJasvinder Singh  color, 0 <= x <= 63.
2626f06125c0SJasvinder Singh
2627f06125c0SJasvinder Singhenable port meter
2628f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~
2629f06125c0SJasvinder Singh
2630f06125c0SJasvinder SinghEnable meter for the ethernet device::
2631f06125c0SJasvinder Singh
2632f06125c0SJasvinder Singh   testpmd> enable port meter (port_id) (mtr_id)
2633f06125c0SJasvinder Singh
2634f06125c0SJasvinder Singhdisable port meter
2635f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~
2636f06125c0SJasvinder Singh
2637f06125c0SJasvinder SinghDisable meter for the ethernet device::
2638f06125c0SJasvinder Singh
2639f06125c0SJasvinder Singh   testpmd> disable port meter (port_id) (mtr_id)
2640f06125c0SJasvinder Singh
2641f06125c0SJasvinder Singhdelete port meter
2642f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~
2643f06125c0SJasvinder Singh
2644f06125c0SJasvinder SinghDelete meter for the ethernet device::
2645f06125c0SJasvinder Singh
2646f06125c0SJasvinder Singh   testpmd> del port meter (port_id) (mtr_id)
2647f06125c0SJasvinder Singh
2648f06125c0SJasvinder SinghSet port meter profile
2649f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~
2650f06125c0SJasvinder Singh
2651f06125c0SJasvinder SinghSet meter profile for the ethernet device::
2652f06125c0SJasvinder Singh
2653f06125c0SJasvinder Singh   testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2654f06125c0SJasvinder Singh
2655f06125c0SJasvinder Singhset port meter dscp table
2656f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~
2657f06125c0SJasvinder Singh
2658f06125c0SJasvinder SinghSet meter dscp table for the ethernet device::
2659f06125c0SJasvinder Singh
2660f06125c0SJasvinder Singh   testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0) \
2661f06125c0SJasvinder Singh   (dscp_tbl_entry1)...(dscp_tbl_entry63)]
2662f06125c0SJasvinder Singh
2663f06125c0SJasvinder Singhset port meter policer action
2664f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2665f06125c0SJasvinder Singh
2666f06125c0SJasvinder SinghSet meter policer action for the ethernet device::
2667f06125c0SJasvinder Singh
2668f06125c0SJasvinder Singh   testpmd> set port meter policer action (port_id) (mtr_id) (action_mask) \
2669f06125c0SJasvinder Singh   (action0) [(action1) (action1)]
2670f06125c0SJasvinder Singh
2671f06125c0SJasvinder Singhwhere:
2672f06125c0SJasvinder Singh
2673f06125c0SJasvinder Singh* ``action_mask``: Bit mask indicating which policer actions need to be
2674f06125c0SJasvinder Singh  updated. One or more policer actions can be updated in a single function
2675f06125c0SJasvinder Singh  invocation. To update the policer action associated with color C, bit
2676f06125c0SJasvinder Singh  (1 << C) needs to be set in *action_mask* and element at position C
2677f06125c0SJasvinder Singh  in the *actions* array needs to be valid.
2678f06125c0SJasvinder Singh* ``actionx``: Policer action for the color x,
2679f06125c0SJasvinder Singh  RTE_MTR_GREEN <= x < RTE_MTR_COLORS
2680f06125c0SJasvinder Singh
2681f06125c0SJasvinder Singhset port meter stats mask
2682f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~
2683f06125c0SJasvinder Singh
2684f06125c0SJasvinder SinghSet meter stats mask for the ethernet device::
2685f06125c0SJasvinder Singh
2686f06125c0SJasvinder Singh   testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2687f06125c0SJasvinder Singh
2688f06125c0SJasvinder Singhwhere:
2689f06125c0SJasvinder Singh
2690f06125c0SJasvinder Singh* ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2691f06125c0SJasvinder Singh
2692f06125c0SJasvinder Singhshow port meter stats
2693f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~
2694f06125c0SJasvinder Singh
2695f06125c0SJasvinder SinghShow meter stats of the ethernet device::
2696f06125c0SJasvinder Singh
2697f06125c0SJasvinder Singh   testpmd> show port meter stats (port_id) (mtr_id) (clear)
2698f06125c0SJasvinder Singh
2699f06125c0SJasvinder Singhwhere:
2700f06125c0SJasvinder Singh
2701f06125c0SJasvinder Singh* ``clear``: Flag that indicates whether the statistics counters should
2702f06125c0SJasvinder Singh  be cleared (i.e. set to zero) immediately after they have been read or not.
2703e76d7a76SJohn McNamara
27045b590fbeSJasvinder SinghTraffic Management
27055b590fbeSJasvinder Singh------------------
27065b590fbeSJasvinder Singh
27075b590fbeSJasvinder SinghThe following section shows functions for configuring traffic management on
27085b590fbeSJasvinder Singhon the ethernet device through the use of generic TM API.
27095b590fbeSJasvinder Singh
27105b590fbeSJasvinder Singhshow port traffic management capability
27115b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27125b590fbeSJasvinder Singh
27135b590fbeSJasvinder SinghShow traffic management capability of the port::
27145b590fbeSJasvinder Singh
27155b590fbeSJasvinder Singh   testpmd> show port tm cap (port_id)
27165b590fbeSJasvinder Singh
27175b590fbeSJasvinder Singhshow port traffic management capability (hierarchy level)
27185b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27195b590fbeSJasvinder Singh
27205b590fbeSJasvinder SinghShow traffic management hierarchy level capability of the port::
27215b590fbeSJasvinder Singh
27220bd797e9STomasz Duszynski   testpmd> show port tm level cap (port_id) (level_id)
27235b590fbeSJasvinder Singh
27245b590fbeSJasvinder Singhshow port traffic management capability (hierarchy node level)
27255b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27265b590fbeSJasvinder Singh
27275b590fbeSJasvinder SinghShow the traffic management hierarchy node capability of the port::
27285b590fbeSJasvinder Singh
27290bd797e9STomasz Duszynski   testpmd> show port tm node cap (port_id) (node_id)
27305b590fbeSJasvinder Singh
27315b590fbeSJasvinder Singhshow port traffic management hierarchy node type
27325b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27335b590fbeSJasvinder Singh
27345b590fbeSJasvinder SinghShow the port traffic management hierarchy node type::
27355b590fbeSJasvinder Singh
27365b590fbeSJasvinder Singh   testpmd> show port tm node type (port_id) (node_id)
27375b590fbeSJasvinder Singh
27385b590fbeSJasvinder Singhshow port traffic management hierarchy node stats
27395b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27405b590fbeSJasvinder Singh
27415b590fbeSJasvinder SinghShow the port traffic management hierarchy node statistics::
27425b590fbeSJasvinder Singh
27435b590fbeSJasvinder Singh   testpmd> show port tm node stats (port_id) (node_id) (clear)
27445b590fbeSJasvinder Singh
27455b590fbeSJasvinder Singhwhere:
27465b590fbeSJasvinder Singh
27475b590fbeSJasvinder Singh* ``clear``: When this parameter has a non-zero value, the statistics counters
27485b590fbeSJasvinder Singh  are cleared (i.e. set to zero) immediately after they have been read,
27495b590fbeSJasvinder Singh  otherwise the statistics counters are left untouched.
27505b590fbeSJasvinder Singh
27515b590fbeSJasvinder SinghAdd port traffic management private shaper profile
27525b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27535b590fbeSJasvinder Singh
27545b590fbeSJasvinder SinghAdd the port traffic management private shaper profile::
27555b590fbeSJasvinder Singh
27565b590fbeSJasvinder Singh   testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
2757c2c15f76SRosen Xu   (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
2758c2c15f76SRosen Xu   (packet_length_adjust)
27595b590fbeSJasvinder Singh
27605b590fbeSJasvinder Singhwhere:
27615b590fbeSJasvinder Singh
27625b590fbeSJasvinder Singh* ``shaper_profile id``: Shaper profile ID for the new profile.
2763c2c15f76SRosen Xu* ``cmit_tb_rate``: Committed token bucket rate (bytes per second).
2764c2c15f76SRosen Xu* ``cmit_tb_size``: Committed token bucket size (bytes).
2765c2c15f76SRosen Xu* ``peak_tb_rate``: Peak token bucket rate (bytes per second).
2766c2c15f76SRosen Xu* ``peak_tb_size``: Peak token bucket size (bytes).
27675b590fbeSJasvinder Singh* ``packet_length_adjust``: The value (bytes) to be added to the length of
27685b590fbeSJasvinder Singh  each packet for the purpose of shaping. This parameter value can be used to
27695b590fbeSJasvinder Singh  correct the packet length with the framing overhead bytes that are consumed
27705b590fbeSJasvinder Singh  on the wire.
27715b590fbeSJasvinder Singh
27725b590fbeSJasvinder SinghDelete port traffic management private shaper profile
27735b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27745b590fbeSJasvinder Singh
27755b590fbeSJasvinder SinghDelete the port traffic management private shaper::
27765b590fbeSJasvinder Singh
27775b590fbeSJasvinder Singh   testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
27785b590fbeSJasvinder Singh
27795b590fbeSJasvinder Singhwhere:
27805b590fbeSJasvinder Singh
27815b590fbeSJasvinder Singh* ``shaper_profile id``: Shaper profile ID that needs to be deleted.
27825b590fbeSJasvinder Singh
27835b590fbeSJasvinder SinghAdd port traffic management shared shaper
27845b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27855b590fbeSJasvinder Singh
27865b590fbeSJasvinder SinghCreate the port traffic management shared shaper::
27875b590fbeSJasvinder Singh
27885b590fbeSJasvinder Singh   testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \
27895b590fbeSJasvinder Singh   (shaper_profile_id)
27905b590fbeSJasvinder Singh
27915b590fbeSJasvinder Singhwhere:
27925b590fbeSJasvinder Singh
27935b590fbeSJasvinder Singh* ``shared_shaper_id``: Shared shaper ID to be created.
27945b590fbeSJasvinder Singh* ``shaper_profile id``: Shaper profile ID for shared shaper.
27955b590fbeSJasvinder Singh
27965b590fbeSJasvinder SinghSet port traffic management shared shaper
27975b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27985b590fbeSJasvinder Singh
27995b590fbeSJasvinder SinghUpdate the port traffic management shared shaper::
28005b590fbeSJasvinder Singh
28015b590fbeSJasvinder Singh   testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \
28025b590fbeSJasvinder Singh   (shaper_profile_id)
28035b590fbeSJasvinder Singh
28045b590fbeSJasvinder Singhwhere:
28055b590fbeSJasvinder Singh
28065b590fbeSJasvinder Singh* ``shared_shaper_id``: Shared shaper ID to be update.
28075b590fbeSJasvinder Singh* ``shaper_profile id``: Shaper profile ID for shared shaper.
28085b590fbeSJasvinder Singh
28095b590fbeSJasvinder SinghDelete port traffic management shared shaper
28105b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28115b590fbeSJasvinder Singh
28125b590fbeSJasvinder SinghDelete the port traffic management shared shaper::
28135b590fbeSJasvinder Singh
28145b590fbeSJasvinder Singh   testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
28155b590fbeSJasvinder Singh
28165b590fbeSJasvinder Singhwhere:
28175b590fbeSJasvinder Singh
28185b590fbeSJasvinder Singh* ``shared_shaper_id``: Shared shaper ID to be deleted.
28195b590fbeSJasvinder Singh
2820d629b7b5SJohn McNamaraSet port traffic management hierarchy node private shaper
2821d629b7b5SJohn McNamara~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28225b590fbeSJasvinder Singh
28235b590fbeSJasvinder Singhset the port traffic management hierarchy node private shaper::
28245b590fbeSJasvinder Singh
28255b590fbeSJasvinder Singh   testpmd> set port tm node shaper profile (port_id) (node_id) \
28265b590fbeSJasvinder Singh   (shaper_profile_id)
28275b590fbeSJasvinder Singh
28285b590fbeSJasvinder Singhwhere:
28295b590fbeSJasvinder Singh
28305b590fbeSJasvinder Singh* ``shaper_profile id``: Private shaper profile ID to be enabled on the
28315b590fbeSJasvinder Singh  hierarchy node.
28325b590fbeSJasvinder Singh
28335b590fbeSJasvinder SinghAdd port traffic management WRED profile
28345b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28355b590fbeSJasvinder Singh
28365b590fbeSJasvinder SinghCreate a new WRED profile::
28375b590fbeSJasvinder Singh
28385b590fbeSJasvinder Singh   testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
28395b590fbeSJasvinder Singh   (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
28405b590fbeSJasvinder Singh   (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
28415b590fbeSJasvinder Singh   (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
28425b590fbeSJasvinder Singh
28435b590fbeSJasvinder Singhwhere:
28445b590fbeSJasvinder Singh
28455b590fbeSJasvinder Singh* ``wred_profile id``: Identifier for the newly create WRED profile
28465b590fbeSJasvinder Singh* ``color_g``: Packet color (green)
28475b590fbeSJasvinder Singh* ``min_th_g``: Minimum queue threshold for packet with green color
28485b590fbeSJasvinder Singh* ``max_th_g``: Minimum queue threshold for packet with green color
28495b590fbeSJasvinder Singh* ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp)
28505b590fbeSJasvinder Singh* ``wq_log2_g``: Negated log2 of queue weight (wq)
28515b590fbeSJasvinder Singh* ``color_y``: Packet color (yellow)
28525b590fbeSJasvinder Singh* ``min_th_y``: Minimum queue threshold for packet with yellow color
28535b590fbeSJasvinder Singh* ``max_th_y``: Minimum queue threshold for packet with yellow color
28545b590fbeSJasvinder Singh* ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp)
28555b590fbeSJasvinder Singh* ``wq_log2_y``: Negated log2 of queue weight (wq)
28565b590fbeSJasvinder Singh* ``color_r``: Packet color (red)
28575b590fbeSJasvinder Singh* ``min_th_r``: Minimum queue threshold for packet with yellow color
28585b590fbeSJasvinder Singh* ``max_th_r``: Minimum queue threshold for packet with yellow color
28595b590fbeSJasvinder Singh* ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp)
28605b590fbeSJasvinder Singh* ``wq_log2_r``: Negated log2 of queue weight (wq)
28615b590fbeSJasvinder Singh
28625b590fbeSJasvinder SinghDelete port traffic management WRED profile
28635b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28645b590fbeSJasvinder Singh
28655b590fbeSJasvinder SinghDelete the WRED profile::
28665b590fbeSJasvinder Singh
28675b590fbeSJasvinder Singh   testpmd> del port tm node wred profile (port_id) (wred_profile_id)
28685b590fbeSJasvinder Singh
28695b590fbeSJasvinder SinghAdd port traffic management hierarchy nonleaf node
28705b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28715b590fbeSJasvinder Singh
2872d629b7b5SJohn McNamaraAdd nonleaf node to port traffic management hierarchy::
28735b590fbeSJasvinder Singh
28745b590fbeSJasvinder Singh   testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \
28755b590fbeSJasvinder Singh   (priority) (weight) (level_id) (shaper_profile_id) \
2876448c2332SJasvinder Singh   (n_sp_priorities) (stats_mask) (n_shared_shapers) \
2877448c2332SJasvinder Singh   [(shared_shaper_0) (shared_shaper_1) ...] \
28785b590fbeSJasvinder Singh
28795b590fbeSJasvinder Singhwhere:
28805b590fbeSJasvinder Singh
28815b590fbeSJasvinder Singh* ``parent_node_id``: Node ID of the parent.
28825b590fbeSJasvinder Singh* ``priority``: Node priority (highest node priority is zero). This is used by
28835b590fbeSJasvinder Singh  the SP algorithm running on the parent node for scheduling this node.
28845b590fbeSJasvinder Singh* ``weight``: Node weight (lowest weight is one). The node weight is relative
28855b590fbeSJasvinder Singh  to the weight sum of all siblings that have the same priority. It is used by
28865b590fbeSJasvinder Singh  the WFQ algorithm running on the parent node for scheduling this node.
2887d629b7b5SJohn McNamara* ``level_id``: Hierarchy level of the node.
28885b590fbeSJasvinder Singh* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
28895b590fbeSJasvinder Singh  the node.
28905b590fbeSJasvinder Singh* ``n_sp_priorities``: Number of strict priorities.
28915b590fbeSJasvinder Singh* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2892448c2332SJasvinder Singh* ``n_shared_shapers``: Number of shared shapers.
2893448c2332SJasvinder Singh* ``shared_shaper_id``: Shared shaper id.
28945b590fbeSJasvinder Singh
28955b590fbeSJasvinder SinghAdd port traffic management hierarchy leaf node
28965b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28975b590fbeSJasvinder Singh
2898d629b7b5SJohn McNamaraAdd leaf node to port traffic management hierarchy::
28995b590fbeSJasvinder Singh
29005b590fbeSJasvinder Singh   testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \
29015b590fbeSJasvinder Singh   (priority) (weight) (level_id) (shaper_profile_id) \
2902448c2332SJasvinder Singh   (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \
2903448c2332SJasvinder Singh   [(shared_shaper_id) (shared_shaper_id) ...] \
29045b590fbeSJasvinder Singh
29055b590fbeSJasvinder Singhwhere:
29065b590fbeSJasvinder Singh
29075b590fbeSJasvinder Singh* ``parent_node_id``: Node ID of the parent.
29085b590fbeSJasvinder Singh* ``priority``: Node priority (highest node priority is zero). This is used by
29095b590fbeSJasvinder Singh  the SP algorithm running on the parent node for scheduling this node.
29105b590fbeSJasvinder Singh* ``weight``: Node weight (lowest weight is one). The node weight is relative
29115b590fbeSJasvinder Singh  to the weight sum of all siblings that have the same priority. It is used by
29125b590fbeSJasvinder Singh  the WFQ algorithm running on the parent node for scheduling this node.
2913d629b7b5SJohn McNamara* ``level_id``: Hierarchy level of the node.
29145b590fbeSJasvinder Singh* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
29155b590fbeSJasvinder Singh  the node.
29165b590fbeSJasvinder Singh* ``cman_mode``: Congestion management mode to be enabled for this node.
29175b590fbeSJasvinder Singh* ``wred_profile_id``: WRED profile id to be enabled for this node.
29185b590fbeSJasvinder Singh* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2919448c2332SJasvinder Singh* ``n_shared_shapers``: Number of shared shapers.
2920448c2332SJasvinder Singh* ``shared_shaper_id``: Shared shaper id.
29215b590fbeSJasvinder Singh
29225b590fbeSJasvinder SinghDelete port traffic management hierarchy node
29235b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29245b590fbeSJasvinder Singh
2925d629b7b5SJohn McNamaraDelete node from port traffic management hierarchy::
29265b590fbeSJasvinder Singh
29275b590fbeSJasvinder Singh   testpmd> del port tm node (port_id) (node_id)
29285b590fbeSJasvinder Singh
29295b590fbeSJasvinder SinghUpdate port traffic management hierarchy parent node
29305b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29315b590fbeSJasvinder Singh
29325b590fbeSJasvinder SinghUpdate port traffic management hierarchy parent node::
29335b590fbeSJasvinder Singh
29345b590fbeSJasvinder Singh   testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \
29355b590fbeSJasvinder Singh   (priority) (weight)
29365b590fbeSJasvinder Singh
29375b590fbeSJasvinder SinghThis function can only be called after the hierarchy commit invocation. Its
29385b590fbeSJasvinder Singhsuccess depends on the port support for this operation, as advertised through
29395b590fbeSJasvinder Singhthe port capability set. This function is valid for all nodes of the traffic
29405b590fbeSJasvinder Singhmanagement hierarchy except root node.
29415b590fbeSJasvinder Singh
2942079dcbb8STomasz DuszynskiSuspend port traffic management hierarchy node
2943079dcbb8STomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2944079dcbb8STomasz Duszynski
2945079dcbb8STomasz Duszynski   testpmd> suspend port tm node (port_id) (node_id)
2946079dcbb8STomasz Duszynski
294712f76f52STomasz DuszynskiResume port traffic management hierarchy node
294812f76f52STomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
294912f76f52STomasz Duszynski
295012f76f52STomasz Duszynski   testpmd> resume port tm node (port_id) (node_id)
295112f76f52STomasz Duszynski
29525b590fbeSJasvinder SinghCommit port traffic management hierarchy
29535b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29545b590fbeSJasvinder Singh
29555b590fbeSJasvinder SinghCommit the traffic management hierarchy on the port::
29565b590fbeSJasvinder Singh
29575b590fbeSJasvinder Singh   testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
29585b590fbeSJasvinder Singh
29595b590fbeSJasvinder Singhwhere:
29605b590fbeSJasvinder Singh
29615b590fbeSJasvinder Singh* ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function
29625b590fbeSJasvinder Singh  call failure. On the other hand, hierarchy is preserved when this parameter
29635b590fbeSJasvinder Singh  is equal to zero.
29645b590fbeSJasvinder Singh
29656673fe0cSKrzysztof KanasSet port traffic management mark VLAN dei
29666673fe0cSKrzysztof Kanas~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29676673fe0cSKrzysztof Kanas
29686673fe0cSKrzysztof KanasEnables/Disables the traffic management marking on the port for VLAN packets::
29696673fe0cSKrzysztof Kanas
29706673fe0cSKrzysztof Kanas   testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red>
29716673fe0cSKrzysztof Kanas
29726673fe0cSKrzysztof Kanaswhere:
29736673fe0cSKrzysztof Kanas
29746673fe0cSKrzysztof Kanas* ``port_id``: The port which on which VLAN packets marked as ``green`` or
29756673fe0cSKrzysztof Kanas  ``yellow`` or ``red`` will have dei bit enabled
29766673fe0cSKrzysztof Kanas
29776673fe0cSKrzysztof Kanas* ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green
29786673fe0cSKrzysztof Kanas
29796673fe0cSKrzysztof Kanas* ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow
29806673fe0cSKrzysztof Kanas
29816673fe0cSKrzysztof Kanas* ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red
29826673fe0cSKrzysztof Kanas
29836673fe0cSKrzysztof KanasSet port traffic management mark IP dscp
29846673fe0cSKrzysztof Kanas~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29856673fe0cSKrzysztof Kanas
29866673fe0cSKrzysztof KanasEnables/Disables the traffic management marking on the port for IP dscp packets::
29876673fe0cSKrzysztof Kanas
29886673fe0cSKrzysztof Kanas   testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red>
29896673fe0cSKrzysztof Kanas
29906673fe0cSKrzysztof Kanaswhere:
29916673fe0cSKrzysztof Kanas
29926673fe0cSKrzysztof Kanas* ``port_id``: The port which on which IP packets marked as ``green`` or
29936673fe0cSKrzysztof Kanas  ``yellow`` or ``red`` will have IP dscp bits updated
29946673fe0cSKrzysztof Kanas
29956673fe0cSKrzysztof Kanas* ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets
29966673fe0cSKrzysztof Kanas
29976673fe0cSKrzysztof Kanas* ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets
29986673fe0cSKrzysztof Kanas
29996673fe0cSKrzysztof Kanas* ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets
30006673fe0cSKrzysztof Kanas
30016673fe0cSKrzysztof KanasSet port traffic management mark IP ecn
30026673fe0cSKrzysztof Kanas~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30036673fe0cSKrzysztof Kanas
30046673fe0cSKrzysztof KanasEnables/Disables the traffic management marking on the port for IP ecn packets::
30056673fe0cSKrzysztof Kanas
30066673fe0cSKrzysztof Kanas   testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red>
30076673fe0cSKrzysztof Kanas
30086673fe0cSKrzysztof Kanaswhere:
30096673fe0cSKrzysztof Kanas
30106673fe0cSKrzysztof Kanas* ``port_id``: The port which on which IP packets marked as ``green`` or
30116673fe0cSKrzysztof Kanas  ``yellow`` or ``red`` will have IP ecn bits updated
30126673fe0cSKrzysztof Kanas
30136673fe0cSKrzysztof Kanas* ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01  or 2'b10
30146673fe0cSKrzysztof Kanas  to ecn of 2'b11 when IP is caring TCP or SCTP
30156673fe0cSKrzysztof Kanas
30166673fe0cSKrzysztof Kanas* ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
30176673fe0cSKrzysztof Kanas  to ecn of 2'b11 when IP is caring TCP or SCTP
30186673fe0cSKrzysztof Kanas
30196673fe0cSKrzysztof Kanas* ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
30206673fe0cSKrzysztof Kanas  to ecn of 2'b11 when IP is caring TCP or SCTP
30216673fe0cSKrzysztof Kanas
30228d9d4c24SJasvinder SinghSet port traffic management default hierarchy (softnic forwarding mode)
30238d9d4c24SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30245b590fbeSJasvinder Singh
30255b590fbeSJasvinder Singhset the traffic management default hierarchy on the port::
30265b590fbeSJasvinder Singh
30275b590fbeSJasvinder Singh   testpmd> set port tm hierarchy default (port_id)
30285b590fbeSJasvinder Singh
3029aa49f366SPablo de LaraFilter Functions
3030aa49f366SPablo de Lara----------------
3031aa49f366SPablo de Lara
3032aa49f366SPablo de LaraThis section details the available filter functions that are available.
3033aa49f366SPablo de Lara
3034a997a33bSAdrien MazarguilNote these functions interface the deprecated legacy filtering framework,
3035a997a33bSAdrien Mazarguilsuperseded by *rte_flow*. See `Flow rules management`_.
3036a997a33bSAdrien Mazarguil
3037675c4cedSJingjing Wuethertype_filter
3038aa49f366SPablo de Lara~~~~~~~~~~~~~~~~~~~~
3039aa49f366SPablo de Lara
3040e76d7a76SJohn McNamaraAdd or delete a L2 Ethertype filter, which identify packets by their L2 Ethertype mainly assign them to a receive queue::
3041aa49f366SPablo de Lara
3042e76d7a76SJohn McNamara   ethertype_filter (port_id) (add|del) (mac_addr|mac_ignr) (mac_address) \
3043e76d7a76SJohn McNamara                    ethertype (ether_type) (drop|fwd) queue (queue_id)
3044aa49f366SPablo de Lara
3045aa49f366SPablo de LaraThe available information parameters are:
3046aa49f366SPablo de Lara
3047e76d7a76SJohn McNamara* ``port_id``: The port which the Ethertype filter assigned on.
3048aa49f366SPablo de Lara
3049e76d7a76SJohn McNamara* ``mac_addr``: Compare destination mac address.
3050675c4cedSJingjing Wu
3051e76d7a76SJohn McNamara* ``mac_ignr``: Ignore destination mac address match.
3052675c4cedSJingjing Wu
3053e76d7a76SJohn McNamara* ``mac_address``: Destination mac address to match.
3054675c4cedSJingjing Wu
3055e76d7a76SJohn McNamara* ``ether_type``: The EtherType value want to match,
3056aa49f366SPablo de Lara  for example 0x0806 for ARP packet. 0x0800 (IPv4) and 0x86DD (IPv6) are invalid.
3057aa49f366SPablo de Lara
3058e76d7a76SJohn McNamara* ``queue_id``: The receive queue associated with this EtherType filter.
3059e76d7a76SJohn McNamara  It is meaningless when deleting or dropping.
3060aa49f366SPablo de Lara
3061e76d7a76SJohn McNamaraExample, to add/remove an ethertype filter rule::
3062aa49f366SPablo de Lara
3063e76d7a76SJohn McNamara   testpmd> ethertype_filter 0 add mac_ignr 00:11:22:33:44:55 \
3064e76d7a76SJohn McNamara                             ethertype 0x0806 fwd queue 3
3065aa49f366SPablo de Lara
3066e76d7a76SJohn McNamara   testpmd> ethertype_filter 0 del mac_ignr 00:11:22:33:44:55 \
3067e76d7a76SJohn McNamara                             ethertype 0x0806 fwd queue 3
3068aa49f366SPablo de Lara
3069990d3703SJingjing Wu2tuple_filter
3070aa49f366SPablo de Lara~~~~~~~~~~~~~~~~~
3071aa49f366SPablo de Lara
3072990d3703SJingjing WuAdd or delete a 2-tuple filter,
3073e76d7a76SJohn McNamarawhich identifies packets by specific protocol and destination TCP/UDP port
3074e76d7a76SJohn McNamaraand forwards packets into one of the receive queues::
3075aa49f366SPablo de Lara
3076e76d7a76SJohn McNamara   2tuple_filter (port_id) (add|del) dst_port (dst_port_value) \
3077e76d7a76SJohn McNamara                 protocol (protocol_value) mask (mask_value) \
3078e76d7a76SJohn McNamara                 tcp_flags (tcp_flags_value) priority (prio_value) \
3079e76d7a76SJohn McNamara                 queue (queue_id)
3080aa49f366SPablo de Lara
3081aa49f366SPablo de LaraThe available information parameters are:
3082aa49f366SPablo de Lara
3083e76d7a76SJohn McNamara* ``port_id``: The port which the 2-tuple filter assigned on.
3084aa49f366SPablo de Lara
3085e76d7a76SJohn McNamara* ``dst_port_value``: Destination port in L4.
3086aa49f366SPablo de Lara
3087e76d7a76SJohn McNamara* ``protocol_value``: IP L4 protocol.
3088aa49f366SPablo de Lara
3089e76d7a76SJohn McNamara* ``mask_value``: Participates in the match or not by bit for field above, 1b means participate.
3090aa49f366SPablo de Lara
3091e76d7a76SJohn McNamara* ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the pro_value is not set to 0x06 (TCP).
3092aa49f366SPablo de Lara
3093e76d7a76SJohn McNamara* ``prio_value``: Priority of this filter.
3094aa49f366SPablo de Lara
3095e76d7a76SJohn McNamara* ``queue_id``: The receive queue associated with this 2-tuple filter.
3096aa49f366SPablo de Lara
3097e76d7a76SJohn McNamaraExample, to add/remove an 2tuple filter rule::
3098aa49f366SPablo de Lara
3099e76d7a76SJohn McNamara   testpmd> 2tuple_filter 0 add dst_port 32 protocol 0x06 mask 0x03 \
3100e76d7a76SJohn McNamara                          tcp_flags 0x02 priority 3 queue 3
3101aa49f366SPablo de Lara
3102e76d7a76SJohn McNamara   testpmd> 2tuple_filter 0 del dst_port 32 protocol 0x06 mask 0x03 \
3103e76d7a76SJohn McNamara                          tcp_flags 0x02 priority 3 queue 3
3104aa49f366SPablo de Lara
3105990d3703SJingjing Wu5tuple_filter
3106aa49f366SPablo de Lara~~~~~~~~~~~~~~~~~
3107aa49f366SPablo de Lara
3108990d3703SJingjing WuAdd or delete a 5-tuple filter,
3109aa49f366SPablo de Larawhich consists of a 5-tuple (protocol, source and destination IP addresses, source and destination TCP/UDP/SCTP port)
3110e76d7a76SJohn McNamaraand routes packets into one of the receive queues::
3111aa49f366SPablo de Lara
3112e76d7a76SJohn McNamara   5tuple_filter (port_id) (add|del) dst_ip (dst_address) src_ip \
3113e76d7a76SJohn McNamara                 (src_address) dst_port (dst_port_value) \
3114e76d7a76SJohn McNamara                 src_port (src_port_value) protocol (protocol_value) \
3115e76d7a76SJohn McNamara                 mask (mask_value) tcp_flags (tcp_flags_value) \
3116e76d7a76SJohn McNamara                 priority (prio_value) queue (queue_id)
3117aa49f366SPablo de Lara
3118aa49f366SPablo de LaraThe available information parameters are:
3119aa49f366SPablo de Lara
3120e76d7a76SJohn McNamara* ``port_id``: The port which the 5-tuple filter assigned on.
3121aa49f366SPablo de Lara
3122e76d7a76SJohn McNamara* ``dst_address``: Destination IP address.
3123aa49f366SPablo de Lara
3124e76d7a76SJohn McNamara* ``src_address``: Source IP address.
3125aa49f366SPablo de Lara
3126e76d7a76SJohn McNamara* ``dst_port_value``: TCP/UDP destination port.
3127aa49f366SPablo de Lara
3128e76d7a76SJohn McNamara* ``src_port_value``: TCP/UDP source port.
3129aa49f366SPablo de Lara
3130e76d7a76SJohn McNamara* ``protocol_value``: L4 protocol.
3131aa49f366SPablo de Lara
3132e76d7a76SJohn McNamara* ``mask_value``: Participates in the match or not by bit for field above, 1b means participate
3133aa49f366SPablo de Lara
3134e76d7a76SJohn McNamara* ``tcp_flags_value``: TCP control bits. The non-zero value is invalid, when the protocol_value is not set to 0x06 (TCP).
3135aa49f366SPablo de Lara
3136e76d7a76SJohn McNamara* ``prio_value``: The priority of this filter.
3137aa49f366SPablo de Lara
3138e76d7a76SJohn McNamara* ``queue_id``: The receive queue associated with this 5-tuple filter.
3139aa49f366SPablo de Lara
3140e76d7a76SJohn McNamaraExample, to add/remove an 5tuple filter rule::
3141aa49f366SPablo de Lara
3142e76d7a76SJohn McNamara   testpmd> 5tuple_filter 0 add dst_ip 2.2.2.5 src_ip 2.2.2.4 \
3143e76d7a76SJohn McNamara            dst_port 64 src_port 32 protocol 0x06 mask 0x1F \
3144e76d7a76SJohn McNamara            flags 0x0 priority 3 queue 3
3145aa49f366SPablo de Lara
3146e76d7a76SJohn McNamara   testpmd> 5tuple_filter 0 del dst_ip 2.2.2.5 src_ip 2.2.2.4 \
3147e76d7a76SJohn McNamara            dst_port 64 src_port 32 protocol 0x06 mask 0x1F \
3148e76d7a76SJohn McNamara            flags 0x0 priority 3 queue 3
3149aa49f366SPablo de Lara
31509df58d41SJingjing Wusyn_filter
3151e76d7a76SJohn McNamara~~~~~~~~~~
3152aa49f366SPablo de Lara
3153e76d7a76SJohn McNamaraUsing the  SYN filter, TCP packets whose *SYN* flag is set can be forwarded to a separate queue::
3154aa49f366SPablo de Lara
31559df58d41SJingjing Wu   syn_filter (port_id) (add|del) priority (high|low) queue (queue_id)
3156aa49f366SPablo de Lara
3157aa49f366SPablo de LaraThe available information parameters are:
3158aa49f366SPablo de Lara
3159e76d7a76SJohn McNamara* ``port_id``: The port which the SYN filter assigned on.
3160aa49f366SPablo de Lara
3161e76d7a76SJohn McNamara* ``high``: This SYN filter has higher priority than other filters.
3162aa49f366SPablo de Lara
3163e76d7a76SJohn McNamara* ``low``: This SYN filter has lower priority than other filters.
3164aa49f366SPablo de Lara
3165e76d7a76SJohn McNamara* ``queue_id``: The receive queue associated with this SYN filter
3166aa49f366SPablo de Lara
3167e76d7a76SJohn McNamaraExample::
3168aa49f366SPablo de Lara
31699df58d41SJingjing Wu   testpmd> syn_filter 0 add priority high queue 3
3170aa49f366SPablo de Lara
3171a47ce915SJingjing Wuflex_filter
3172a47ce915SJingjing Wu~~~~~~~~~~~
3173aa49f366SPablo de Lara
3174a47ce915SJingjing WuWith flex filter, packets can be recognized by any arbitrary pattern within the first 128 bytes of the packet
3175e76d7a76SJohn McNamaraand routed into one of the receive queues::
3176aa49f366SPablo de Lara
3177e76d7a76SJohn McNamara   flex_filter (port_id) (add|del) len (len_value) bytes (bytes_value) \
3178a47ce915SJingjing Wu               mask (mask_value) priority (prio_value) queue (queue_id)
3179aa49f366SPablo de Lara
3180aa49f366SPablo de LaraThe available information parameters are:
3181aa49f366SPablo de Lara
3182e76d7a76SJohn McNamara* ``port_id``: The port which the Flex filter is assigned on.
3183aa49f366SPablo de Lara
3184e76d7a76SJohn McNamara* ``len_value``: Filter length in bytes, no greater than 128.
3185aa49f366SPablo de Lara
3186e76d7a76SJohn McNamara* ``bytes_value``: A string in hexadecimal, means the value the flex filter needs to match.
3187aa49f366SPablo de Lara
3188e76d7a76SJohn McNamara* ``mask_value``: A string in hexadecimal, bit 1 means corresponding byte participates in the match.
3189aa49f366SPablo de Lara
3190e76d7a76SJohn McNamara* ``prio_value``: The priority of this filter.
3191aa49f366SPablo de Lara
3192e76d7a76SJohn McNamara* ``queue_id``: The receive queue associated with this Flex filter.
3193aa49f366SPablo de Lara
3194e76d7a76SJohn McNamaraExample::
3195aa49f366SPablo de Lara
3196e76d7a76SJohn McNamara   testpmd> flex_filter 0 add len 16 bytes 0x00000000000000000000000008060000 \
3197a47ce915SJingjing Wu                          mask 000C priority 3 queue 3
3198aa49f366SPablo de Lara
3199e76d7a76SJohn McNamara   testpmd> flex_filter 0 del len 16 bytes 0x00000000000000000000000008060000 \
3200a47ce915SJingjing Wu                          mask 000C priority 3 queue 3
3201a5633592SJingjing Wu
3202e76d7a76SJohn McNamara
3203e76d7a76SJohn McNamara.. _testpmd_flow_director:
3204e76d7a76SJohn McNamara
3205a5633592SJingjing Wuflow_director_filter
3206a5633592SJingjing Wu~~~~~~~~~~~~~~~~~~~~
3207a5633592SJingjing Wu
3208a5633592SJingjing WuThe Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues.
3209a5633592SJingjing Wu
32102892fcc1SWenzhuo LuFour types of filtering are supported which are referred to as Perfect Match, Signature, Perfect-mac-vlan and
32112892fcc1SWenzhuo LuPerfect-tunnel filters, the match mode is set by the ``--pkt-filter-mode`` command-line parameter:
3212a5633592SJingjing Wu
3213a5633592SJingjing Wu* Perfect match filters.
3214a5633592SJingjing Wu  The hardware checks a match between the masked fields of the received packets and the programmed filters.
32152892fcc1SWenzhuo Lu  The masked fields are for IP flow.
3216a5633592SJingjing Wu
3217a5633592SJingjing Wu* Signature filters.
3218a5633592SJingjing Wu  The hardware checks a match between a hash-based signature of the masked fields of the received packet.
3219a5633592SJingjing Wu
32202892fcc1SWenzhuo Lu* Perfect-mac-vlan match filters.
32212892fcc1SWenzhuo Lu  The hardware checks a match between the masked fields of the received packets and the programmed filters.
32222892fcc1SWenzhuo Lu  The masked fields are for MAC VLAN flow.
32232892fcc1SWenzhuo Lu
32242892fcc1SWenzhuo Lu* Perfect-tunnel match filters.
32252892fcc1SWenzhuo Lu  The hardware checks a match between the masked fields of the received packets and the programmed filters.
32262892fcc1SWenzhuo Lu  The masked fields are for tunnel flow.
32272892fcc1SWenzhuo Lu
32285dba3b9cSKirill Rybalchenko* Perfect-raw-flow-type match filters.
32295dba3b9cSKirill Rybalchenko  The hardware checks a match between the masked fields of the received packets and pre-loaded raw (template) packet.
32305dba3b9cSKirill Rybalchenko  The masked fields are specified by input sets.
32315dba3b9cSKirill Rybalchenko
3232a5633592SJingjing WuThe Flow Director filters can match the different fields for different type of packet: flow type, specific input set
3233e76d7a76SJohn McNamaraper flow type and the flexible payload.
3234e76d7a76SJohn McNamara
3235e76d7a76SJohn McNamaraThe Flow Director can also mask out parts of all of these fields so that filters
3236a5633592SJingjing Wuare only applied to certain fields or parts of the fields.
3237a5633592SJingjing Wu
32385dba3b9cSKirill RybalchenkoNote that for raw flow type mode the source and destination fields in the
32395dba3b9cSKirill Rybalchenkoraw packet buffer need to be presented in a reversed order with respect
32405dba3b9cSKirill Rybalchenkoto the expected received packets.
32415dba3b9cSKirill RybalchenkoFor example: IP source and destination addresses or TCP/UDP/SCTP
32425dba3b9cSKirill Rybalchenkosource and destination ports
32435dba3b9cSKirill Rybalchenko
3244a5633592SJingjing WuDifferent NICs may have different capabilities, command show port fdir (port_id) can be used to acquire the information.
3245a5633592SJingjing Wu
3246e76d7a76SJohn McNamara# Commands to add flow director filters of different flow types::
3247a5633592SJingjing Wu
32482892fcc1SWenzhuo Lu   flow_director_filter (port_id) mode IP (add|del|update) \
324928d62131SJingjing Wu                        flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag) \
3250e76d7a76SJohn McNamara                        src (src_ip_address) dst (dst_ip_address) \
325128d62131SJingjing Wu                        tos (tos_value) proto (proto_value) ttl (ttl_value) \
3252e76d7a76SJohn McNamara                        vlan (vlan_value) flexbytes (flexbytes_value) \
3253e6a68c01SJingjing Wu                        (drop|fwd) pf|vf(vf_id) queue (queue_id) \
3254e6a68c01SJingjing Wu                        fd_id (fd_id_value)
3255a5633592SJingjing Wu
32562892fcc1SWenzhuo Lu   flow_director_filter (port_id) mode IP (add|del|update) \
3257e76d7a76SJohn McNamara                        flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp) \
3258e76d7a76SJohn McNamara                        src (src_ip_address) (src_port) \
3259e76d7a76SJohn McNamara                        dst (dst_ip_address) (dst_port) \
326028d62131SJingjing Wu                        tos (tos_value) ttl (ttl_value) \
3261e76d7a76SJohn McNamara                        vlan (vlan_value) flexbytes (flexbytes_value) \
3262e6a68c01SJingjing Wu                        (drop|fwd) queue pf|vf(vf_id) (queue_id) \
3263e6a68c01SJingjing Wu                        fd_id (fd_id_value)
3264a5633592SJingjing Wu
32652892fcc1SWenzhuo Lu   flow_director_filter (port_id) mode IP (add|del|update) \
3266e76d7a76SJohn McNamara                        flow (ipv4-sctp|ipv6-sctp) \
3267e76d7a76SJohn McNamara                        src (src_ip_address) (src_port) \
326828d62131SJingjing Wu                        dst (dst_ip_address) (dst_port) \
326928d62131SJingjing Wu                        tos (tos_value) ttl (ttl_value) \
3270e76d7a76SJohn McNamara                        tag (verification_tag) vlan (vlan_value) \
3271e76d7a76SJohn McNamara                        flexbytes (flexbytes_value) (drop|fwd) \
3272e6a68c01SJingjing Wu                        pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
3273a5633592SJingjing Wu
32742892fcc1SWenzhuo Lu   flow_director_filter (port_id) mode IP (add|del|update) flow l2_payload \
3275e76d7a76SJohn McNamara                        ether (ethertype) flexbytes (flexbytes_value) \
3276e6a68c01SJingjing Wu                        (drop|fwd) pf|vf(vf_id) queue (queue_id)
3277e6a68c01SJingjing Wu                        fd_id (fd_id_value)
327875ba29fdSJingjing Wu
32792892fcc1SWenzhuo Lu   flow_director_filter (port_id) mode MAC-VLAN (add|del|update) \
32802892fcc1SWenzhuo Lu                        mac (mac_address) vlan (vlan_value) \
32812892fcc1SWenzhuo Lu                        flexbytes (flexbytes_value) (drop|fwd) \
32822892fcc1SWenzhuo Lu                        queue (queue_id) fd_id (fd_id_value)
32832892fcc1SWenzhuo Lu
32842892fcc1SWenzhuo Lu   flow_director_filter (port_id) mode Tunnel (add|del|update) \
32852892fcc1SWenzhuo Lu                        mac (mac_address) vlan (vlan_value) \
32862892fcc1SWenzhuo Lu                        tunnel (NVGRE|VxLAN) tunnel-id (tunnel_id_value) \
32872892fcc1SWenzhuo Lu                        flexbytes (flexbytes_value) (drop|fwd) \
32882892fcc1SWenzhuo Lu                        queue (queue_id) fd_id (fd_id_value)
32892892fcc1SWenzhuo Lu
32905dba3b9cSKirill Rybalchenko   flow_director_filter (port_id) mode raw (add|del|update) flow (flow_id) \
32915dba3b9cSKirill Rybalchenko                        (drop|fwd) queue (queue_id) fd_id (fd_id_value) \
32925dba3b9cSKirill Rybalchenko                        packet (packet file name)
32935dba3b9cSKirill Rybalchenko
3294e76d7a76SJohn McNamaraFor example, to add an ipv4-udp flow type filter::
3295a5633592SJingjing Wu
3296190c878aSMauricio Vasquez B   testpmd> flow_director_filter 0 mode IP add flow ipv4-udp src 2.2.2.3 32 \
329728d62131SJingjing Wu            dst 2.2.2.5 33 tos 2 ttl 40 vlan 0x1 flexbytes (0x88,0x48) \
329828d62131SJingjing Wu            fwd pf queue 1 fd_id 1
3299a5633592SJingjing Wu
3300e76d7a76SJohn McNamaraFor example, add an ipv4-other flow type filter::
3301a5633592SJingjing Wu
3302190c878aSMauricio Vasquez B   testpmd> flow_director_filter 0 mode IP add flow ipv4-other src 2.2.2.3 \
330328d62131SJingjing Wu             dst 2.2.2.5 tos 2 proto 20 ttl 40 vlan 0x1 \
330428d62131SJingjing Wu             flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
3305a5633592SJingjing Wu
3306a5633592SJingjing Wuflush_flow_director
3307a5633592SJingjing Wu~~~~~~~~~~~~~~~~~~~
3308a5633592SJingjing Wu
3309e76d7a76SJohn McNamaraFlush all flow director filters on a device::
3310a5633592SJingjing Wu
3311e76d7a76SJohn McNamara   testpmd> flush_flow_director (port_id)
3312a5633592SJingjing Wu
3313e76d7a76SJohn McNamaraExample, to flush all flow director filter on port 0::
3314a5633592SJingjing Wu
3315a5633592SJingjing Wu   testpmd> flush_flow_director 0
3316a5633592SJingjing Wu
3317a5633592SJingjing Wuflow_director_mask
3318a5633592SJingjing Wu~~~~~~~~~~~~~~~~~~
3319a5633592SJingjing Wu
3320e76d7a76SJohn McNamaraSet flow director's input masks::
3321a5633592SJingjing Wu
33222892fcc1SWenzhuo Lu   flow_director_mask (port_id) mode IP vlan (vlan_value) \
3323e76d7a76SJohn McNamara                      src_mask (ipv4_src) (ipv6_src) (src_port) \
3324e76d7a76SJohn McNamara                      dst_mask (ipv4_dst) (ipv6_dst) (dst_port)
3325a5633592SJingjing Wu
332621f3fc46SWenzhuo Lu   flow_director_mask (port_id) mode MAC-VLAN vlan (vlan_value)
33272892fcc1SWenzhuo Lu
33282892fcc1SWenzhuo Lu   flow_director_mask (port_id) mode Tunnel vlan (vlan_value) \
33292892fcc1SWenzhuo Lu                      mac (mac_value) tunnel-type (tunnel_type_value) \
33302892fcc1SWenzhuo Lu                      tunnel-id (tunnel_id_value)
33312892fcc1SWenzhuo Lu
3332e76d7a76SJohn McNamaraExample, to set flow director mask on port 0::
3333a5633592SJingjing Wu
3334190c878aSMauricio Vasquez B   testpmd> flow_director_mask 0 mode IP vlan 0xefff \
3335e76d7a76SJohn McNamara            src_mask 255.255.255.255 \
3336e76d7a76SJohn McNamara                FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF \
3337e76d7a76SJohn McNamara            dst_mask 255.255.255.255 \
3338e76d7a76SJohn McNamara                FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF
3339a5633592SJingjing Wu
3340a5633592SJingjing Wuflow_director_flex_mask
3341a5633592SJingjing Wu~~~~~~~~~~~~~~~~~~~~~~~
3342a5633592SJingjing Wu
3343e76d7a76SJohn McNamaraset masks of flow director's flexible payload based on certain flow type::
3344a5633592SJingjing Wu
3345e76d7a76SJohn McNamara   testpmd> flow_director_flex_mask (port_id) \
3346e76d7a76SJohn McNamara            flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
3347e76d7a76SJohn McNamara                  ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
3348e76d7a76SJohn McNamara                  l2_payload|all) (mask)
3349a5633592SJingjing Wu
3350e76d7a76SJohn McNamaraExample, to set flow director's flex mask for all flow type on port 0::
3351a5633592SJingjing Wu
3352e76d7a76SJohn McNamara   testpmd> flow_director_flex_mask 0 flow all \
3353e76d7a76SJohn McNamara            (0xff,0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
3354a5633592SJingjing Wu
3355a5633592SJingjing Wu
3356a5633592SJingjing Wuflow_director_flex_payload
3357a5633592SJingjing Wu~~~~~~~~~~~~~~~~~~~~~~~~~~
3358a5633592SJingjing Wu
3359e76d7a76SJohn McNamaraConfigure flexible payload selection::
3360a5633592SJingjing Wu
3361a5633592SJingjing Wu   flow_director_flex_payload (port_id) (raw|l2|l3|l4) (config)
3362a5633592SJingjing Wu
3363e76d7a76SJohn McNamaraFor example, to select the first 16 bytes from the offset 4 (bytes) of packet's payload as flexible payload::
3364a5633592SJingjing Wu
3365e76d7a76SJohn McNamara   testpmd> flow_director_flex_payload 0 l4 \
3366e76d7a76SJohn McNamara            (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
3367ef7d2866SHelin Zhang
3368ef7d2866SHelin Zhangget_sym_hash_ena_per_port
3369ef7d2866SHelin Zhang~~~~~~~~~~~~~~~~~~~~~~~~~
3370ef7d2866SHelin Zhang
3371e76d7a76SJohn McNamaraGet symmetric hash enable configuration per port::
3372ef7d2866SHelin Zhang
3373ef7d2866SHelin Zhang   get_sym_hash_ena_per_port (port_id)
3374ef7d2866SHelin Zhang
3375e76d7a76SJohn McNamaraFor example, to get symmetric hash enable configuration of port 1::
3376ef7d2866SHelin Zhang
3377ef7d2866SHelin Zhang   testpmd> get_sym_hash_ena_per_port 1
3378ef7d2866SHelin Zhang
3379ef7d2866SHelin Zhangset_sym_hash_ena_per_port
3380ef7d2866SHelin Zhang~~~~~~~~~~~~~~~~~~~~~~~~~
3381ef7d2866SHelin Zhang
3382e76d7a76SJohn McNamaraSet symmetric hash enable configuration per port to enable or disable::
3383ef7d2866SHelin Zhang
3384ef7d2866SHelin Zhang   set_sym_hash_ena_per_port (port_id) (enable|disable)
3385ef7d2866SHelin Zhang
3386e76d7a76SJohn McNamaraFor example, to set symmetric hash enable configuration of port 1 to enable::
3387ef7d2866SHelin Zhang
3388ef7d2866SHelin Zhang   testpmd> set_sym_hash_ena_per_port 1 enable
3389ef7d2866SHelin Zhang
3390ef7d2866SHelin Zhangget_hash_global_config
3391ef7d2866SHelin Zhang~~~~~~~~~~~~~~~~~~~~~~
3392ef7d2866SHelin Zhang
3393e76d7a76SJohn McNamaraGet the global configurations of hash filters::
3394ef7d2866SHelin Zhang
3395ef7d2866SHelin Zhang   get_hash_global_config (port_id)
3396ef7d2866SHelin Zhang
3397e76d7a76SJohn McNamaraFor example, to get the global configurations of hash filters of port 1::
3398ef7d2866SHelin Zhang
3399ef7d2866SHelin Zhang   testpmd> get_hash_global_config 1
3400ef7d2866SHelin Zhang
3401ef7d2866SHelin Zhangset_hash_global_config
3402ef7d2866SHelin Zhang~~~~~~~~~~~~~~~~~~~~~~
3403ef7d2866SHelin Zhang
3404e76d7a76SJohn McNamaraSet the global configurations of hash filters::
3405ef7d2866SHelin Zhang
3406e76d7a76SJohn McNamara   set_hash_global_config (port_id) (toeplitz|simple_xor|default) \
3407e76d7a76SJohn McNamara   (ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|ipv6|ipv6-frag| \
34085dba3b9cSKirill Rybalchenko   ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|l2_payload|<flow_id>) \
3409ef7d2866SHelin Zhang   (enable|disable)
3410ef7d2866SHelin Zhang
3411e76d7a76SJohn McNamaraFor example, to enable simple_xor for flow type of ipv6 on port 2::
3412ef7d2866SHelin Zhang
3413ef7d2866SHelin Zhang   testpmd> set_hash_global_config 2 simple_xor ipv6 enable
3414c5fcdd04SHelin Zhang
3415c5fcdd04SHelin Zhangset_hash_input_set
3416c5fcdd04SHelin Zhang~~~~~~~~~~~~~~~~~~
3417c5fcdd04SHelin Zhang
3418c5fcdd04SHelin ZhangSet the input set for hash::
3419c5fcdd04SHelin Zhang
342028d62131SJingjing Wu   set_hash_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
342128d62131SJingjing Wu   ipv4-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \
34225dba3b9cSKirill Rybalchenko   l2_payload|<flow_id>) (ovlan|ivlan|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6| \
34235dba3b9cSKirill Rybalchenko   ipv4-tos|ipv4-proto|ipv6-tc|ipv6-next-header|udp-src-port|udp-dst-port| \
3424c5fcdd04SHelin Zhang   tcp-src-port|tcp-dst-port|sctp-src-port|sctp-dst-port|sctp-veri-tag| \
3425c5fcdd04SHelin Zhang   udp-key|gre-key|fld-1st|fld-2nd|fld-3rd|fld-4th|fld-5th|fld-6th|fld-7th| \
3426c5fcdd04SHelin Zhang   fld-8th|none) (select|add)
3427c5fcdd04SHelin Zhang
342828d62131SJingjing WuFor example, to add source IP to hash input set for flow type of ipv4-udp on port 0::
3429c5fcdd04SHelin Zhang
343028d62131SJingjing Wu   testpmd> set_hash_input_set 0 ipv4-udp src-ipv4 add
3431c5fcdd04SHelin Zhang
3432c5fcdd04SHelin Zhangset_fdir_input_set
3433c5fcdd04SHelin Zhang~~~~~~~~~~~~~~~~~~
3434c5fcdd04SHelin Zhang
343528d62131SJingjing WuThe Flow Director filters can match the different fields for different type of packet, i.e. specific input set
343628d62131SJingjing Wuon per flow type and the flexible payload. This command can be used to change input set for each flow type.
3437c5fcdd04SHelin Zhang
343828d62131SJingjing WuSet the input set for flow director::
3439c5fcdd04SHelin Zhang
344028d62131SJingjing Wu   set_fdir_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
344128d62131SJingjing Wu   ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \
34425dba3b9cSKirill Rybalchenko   l2_payload|<flow_id>) (ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6| \
34435dba3b9cSKirill Rybalchenko   ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|ipv6-hop-limits| \
344428d62131SJingjing Wu   tudp-src-port|udp-dst-port|cp-src-port|tcp-dst-port|sctp-src-port| \
344528d62131SJingjing Wu   sctp-dst-port|sctp-veri-tag|none) (select|add)
3446c5fcdd04SHelin Zhang
344728d62131SJingjing WuFor example to add source IP to FD input set for flow type of ipv4-udp on port 0::
344828d62131SJingjing Wu
344928d62131SJingjing Wu   testpmd> set_fdir_input_set 0 ipv4-udp src-ipv4 add
345034a068dbSHelin Zhang
345134a068dbSHelin Zhangglobal_config
345234a068dbSHelin Zhang~~~~~~~~~~~~~
345334a068dbSHelin Zhang
345434a068dbSHelin ZhangSet different GRE key length for input set::
345534a068dbSHelin Zhang
345634a068dbSHelin Zhang   global_config (port_id) gre-key-len (number in bytes)
345734a068dbSHelin Zhang
345834a068dbSHelin ZhangFor example to set GRE key length for input set to 4 bytes on port 0::
345934a068dbSHelin Zhang
346034a068dbSHelin Zhang   testpmd> global_config 0 gre-key-len 4
3461a997a33bSAdrien Mazarguil
3462a997a33bSAdrien Mazarguil
3463a997a33bSAdrien Mazarguil.. _testpmd_rte_flow:
3464a997a33bSAdrien Mazarguil
3465a997a33bSAdrien MazarguilFlow rules management
3466a997a33bSAdrien Mazarguil---------------------
3467a997a33bSAdrien Mazarguil
3468a997a33bSAdrien MazarguilControl of the generic flow API (*rte_flow*) is fully exposed through the
3469323f811aSAdrien Mazarguil``flow`` command (validation, creation, destruction, queries and operation
3470323f811aSAdrien Mazarguilmodes).
3471a997a33bSAdrien Mazarguil
3472a997a33bSAdrien MazarguilConsidering *rte_flow* overlaps with all `Filter Functions`_, using both
3473a997a33bSAdrien Mazarguilfeatures simultaneously may cause undefined side-effects and is therefore
3474a997a33bSAdrien Mazarguilnot recommended.
3475a997a33bSAdrien Mazarguil
3476a997a33bSAdrien Mazarguil``flow`` syntax
3477a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~
3478a997a33bSAdrien Mazarguil
3479a997a33bSAdrien MazarguilBecause the ``flow`` command uses dynamic tokens to handle the large number
3480a997a33bSAdrien Mazarguilof possible flow rules combinations, its behavior differs slightly from
3481a997a33bSAdrien Mazarguilother commands, in particular:
3482a997a33bSAdrien Mazarguil
3483a997a33bSAdrien Mazarguil- Pressing *?* or the *<tab>* key displays contextual help for the current
3484a997a33bSAdrien Mazarguil  token, not that of the entire command.
3485a997a33bSAdrien Mazarguil
3486a997a33bSAdrien Mazarguil- Optional and repeated parameters are supported (provided they are listed
3487a997a33bSAdrien Mazarguil  in the contextual help).
3488a997a33bSAdrien Mazarguil
3489a997a33bSAdrien MazarguilThe first parameter stands for the operation mode. Possible operations and
3490a997a33bSAdrien Mazarguiltheir general syntax are described below. They are covered in detail in the
3491a997a33bSAdrien Mazarguilfollowing sections.
3492a997a33bSAdrien Mazarguil
3493a997a33bSAdrien Mazarguil- Check whether a flow rule can be created::
3494a997a33bSAdrien Mazarguil
3495a997a33bSAdrien Mazarguil   flow validate {port_id}
349676e9a55bSAdrien Mazarguil       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3497a997a33bSAdrien Mazarguil       pattern {item} [/ {item} [...]] / end
3498a997a33bSAdrien Mazarguil       actions {action} [/ {action} [...]] / end
3499a997a33bSAdrien Mazarguil
3500a997a33bSAdrien Mazarguil- Create a flow rule::
3501a997a33bSAdrien Mazarguil
3502a997a33bSAdrien Mazarguil   flow create {port_id}
350376e9a55bSAdrien Mazarguil       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3504a997a33bSAdrien Mazarguil       pattern {item} [/ {item} [...]] / end
3505a997a33bSAdrien Mazarguil       actions {action} [/ {action} [...]] / end
3506a997a33bSAdrien Mazarguil
3507a997a33bSAdrien Mazarguil- Destroy specific flow rules::
3508a997a33bSAdrien Mazarguil
3509a997a33bSAdrien Mazarguil   flow destroy {port_id} rule {rule_id} [...]
3510a997a33bSAdrien Mazarguil
3511a997a33bSAdrien Mazarguil- Destroy all flow rules::
3512a997a33bSAdrien Mazarguil
3513a997a33bSAdrien Mazarguil   flow flush {port_id}
3514a997a33bSAdrien Mazarguil
3515a997a33bSAdrien Mazarguil- Query an existing flow rule::
3516a997a33bSAdrien Mazarguil
3517a997a33bSAdrien Mazarguil   flow query {port_id} {rule_id} {action}
3518a997a33bSAdrien Mazarguil
3519a997a33bSAdrien Mazarguil- List existing flow rules sorted by priority, filtered by group
3520a997a33bSAdrien Mazarguil  identifiers::
3521a997a33bSAdrien Mazarguil
3522a997a33bSAdrien Mazarguil   flow list {port_id} [group {group_id}] [...]
3523a997a33bSAdrien Mazarguil
3524323f811aSAdrien Mazarguil- Restrict ingress traffic to the defined flow rules::
3525323f811aSAdrien Mazarguil
3526323f811aSAdrien Mazarguil   flow isolate {port_id} {boolean}
3527323f811aSAdrien Mazarguil
3528a997a33bSAdrien MazarguilValidating flow rules
3529a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~~~
3530a997a33bSAdrien Mazarguil
3531a997a33bSAdrien Mazarguil``flow validate`` reports whether a flow rule would be accepted by the
3532a997a33bSAdrien Mazarguilunderlying device in its current state but stops short of creating it. It is
3533a997a33bSAdrien Mazarguilbound to ``rte_flow_validate()``::
3534a997a33bSAdrien Mazarguil
3535a997a33bSAdrien Mazarguil   flow validate {port_id}
353676e9a55bSAdrien Mazarguil      [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3537a997a33bSAdrien Mazarguil      pattern {item} [/ {item} [...]] / end
3538a997a33bSAdrien Mazarguil      actions {action} [/ {action} [...]] / end
3539a997a33bSAdrien Mazarguil
3540a997a33bSAdrien MazarguilIf successful, it will show::
3541a997a33bSAdrien Mazarguil
3542a997a33bSAdrien Mazarguil   Flow rule validated
3543a997a33bSAdrien Mazarguil
3544a997a33bSAdrien MazarguilOtherwise it will show an error message of the form::
3545a997a33bSAdrien Mazarguil
3546a997a33bSAdrien Mazarguil   Caught error type [...] ([...]): [...]
3547a997a33bSAdrien Mazarguil
3548a997a33bSAdrien MazarguilThis command uses the same parameters as ``flow create``, their format is
3549a997a33bSAdrien Mazarguildescribed in `Creating flow rules`_.
3550a997a33bSAdrien Mazarguil
3551a997a33bSAdrien MazarguilCheck whether redirecting any Ethernet packet received on port 0 to RX queue
3552a997a33bSAdrien Mazarguilindex 6 is supported::
3553a997a33bSAdrien Mazarguil
3554a997a33bSAdrien Mazarguil   testpmd> flow validate 0 ingress pattern eth / end
3555a997a33bSAdrien Mazarguil      actions queue index 6 / end
3556a997a33bSAdrien Mazarguil   Flow rule validated
3557a997a33bSAdrien Mazarguil   testpmd>
3558a997a33bSAdrien Mazarguil
3559a997a33bSAdrien MazarguilPort 0 does not support TCPv6 rules::
3560a997a33bSAdrien Mazarguil
3561a997a33bSAdrien Mazarguil   testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end
3562a997a33bSAdrien Mazarguil      actions drop / end
3563a997a33bSAdrien Mazarguil   Caught error type 9 (specific pattern item): Invalid argument
3564a997a33bSAdrien Mazarguil   testpmd>
3565a997a33bSAdrien Mazarguil
3566a997a33bSAdrien MazarguilCreating flow rules
3567a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~
3568a997a33bSAdrien Mazarguil
3569a997a33bSAdrien Mazarguil``flow create`` validates and creates the specified flow rule. It is bound
3570a997a33bSAdrien Mazarguilto ``rte_flow_create()``::
3571a997a33bSAdrien Mazarguil
3572a997a33bSAdrien Mazarguil   flow create {port_id}
357376e9a55bSAdrien Mazarguil      [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3574a997a33bSAdrien Mazarguil      pattern {item} [/ {item} [...]] / end
3575a997a33bSAdrien Mazarguil      actions {action} [/ {action} [...]] / end
3576a997a33bSAdrien Mazarguil
3577a997a33bSAdrien MazarguilIf successful, it will return a flow rule ID usable with other commands::
3578a997a33bSAdrien Mazarguil
3579a997a33bSAdrien Mazarguil   Flow rule #[...] created
3580a997a33bSAdrien Mazarguil
3581a997a33bSAdrien MazarguilOtherwise it will show an error message of the form::
3582a997a33bSAdrien Mazarguil
3583a997a33bSAdrien Mazarguil   Caught error type [...] ([...]): [...]
3584a997a33bSAdrien Mazarguil
3585a997a33bSAdrien MazarguilParameters describe in the following order:
3586a997a33bSAdrien Mazarguil
358776e9a55bSAdrien Mazarguil- Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens).
3588a997a33bSAdrien Mazarguil- A matching pattern, starting with the *pattern* token and terminated by an
3589a997a33bSAdrien Mazarguil  *end* pattern item.
3590a997a33bSAdrien Mazarguil- Actions, starting with the *actions* token and terminated by an *end*
3591a997a33bSAdrien Mazarguil  action.
3592a997a33bSAdrien Mazarguil
3593a997a33bSAdrien MazarguilThese translate directly to *rte_flow* objects provided as-is to the
3594a997a33bSAdrien Mazarguilunderlying functions.
3595a997a33bSAdrien Mazarguil
3596a997a33bSAdrien MazarguilThe shortest valid definition only comprises mandatory tokens::
3597a997a33bSAdrien Mazarguil
3598a997a33bSAdrien Mazarguil   testpmd> flow create 0 pattern end actions end
3599a997a33bSAdrien Mazarguil
3600a997a33bSAdrien MazarguilNote that PMDs may refuse rules that essentially do nothing such as this
3601a997a33bSAdrien Mazarguilone.
3602a997a33bSAdrien Mazarguil
3603a997a33bSAdrien Mazarguil**All unspecified object values are automatically initialized to 0.**
3604a997a33bSAdrien Mazarguil
3605a997a33bSAdrien MazarguilAttributes
3606a997a33bSAdrien Mazarguil^^^^^^^^^^
3607a997a33bSAdrien Mazarguil
3608a997a33bSAdrien MazarguilThese tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3609a997a33bSAdrien Mazarguilspecified before the ``pattern`` token.
3610a997a33bSAdrien Mazarguil
3611a997a33bSAdrien Mazarguil- ``group {group id}``: priority group.
3612a997a33bSAdrien Mazarguil- ``priority {level}``: priority level within group.
3613a997a33bSAdrien Mazarguil- ``ingress``: rule applies to ingress traffic.
3614a997a33bSAdrien Mazarguil- ``egress``: rule applies to egress traffic.
361576e9a55bSAdrien Mazarguil- ``transfer``: apply rule directly to endpoints found in pattern.
3616a997a33bSAdrien Mazarguil
3617a997a33bSAdrien MazarguilEach instance of an attribute specified several times overrides the previous
3618a997a33bSAdrien Mazarguilvalue as shown below (group 4 is used)::
3619a997a33bSAdrien Mazarguil
3620a997a33bSAdrien Mazarguil   testpmd> flow create 0 group 42 group 24 group 4 [...]
3621a997a33bSAdrien Mazarguil
3622a997a33bSAdrien MazarguilNote that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3623a997a33bSAdrien Mazarguil
3624a997a33bSAdrien MazarguilWhile not specifying a direction is an error, some rules may allow both
3625a997a33bSAdrien Mazarguilsimultaneously.
3626a997a33bSAdrien Mazarguil
3627a997a33bSAdrien MazarguilMost rules affect RX therefore contain the ``ingress`` token::
3628a997a33bSAdrien Mazarguil
3629a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern [...]
3630a997a33bSAdrien Mazarguil
3631a997a33bSAdrien MazarguilMatching pattern
3632a997a33bSAdrien Mazarguil^^^^^^^^^^^^^^^^
3633a997a33bSAdrien Mazarguil
3634a997a33bSAdrien MazarguilA matching pattern starts after the ``pattern`` token. It is made of pattern
3635a997a33bSAdrien Mazarguilitems and is terminated by a mandatory ``end`` item.
3636a997a33bSAdrien Mazarguil
3637a997a33bSAdrien MazarguilItems are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3638a997a33bSAdrien Mazarguilrte_flow_item_type``).
3639a997a33bSAdrien Mazarguil
3640a997a33bSAdrien MazarguilThe ``/`` token is used as a separator between pattern items as shown
3641a997a33bSAdrien Mazarguilbelow::
3642a997a33bSAdrien Mazarguil
3643a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3644a997a33bSAdrien Mazarguil
3645a997a33bSAdrien MazarguilNote that protocol items like these must be stacked from lowest to highest
3646a997a33bSAdrien Mazarguillayer to make sense. For instance, the following rule is either invalid or
3647a997a33bSAdrien Mazarguilunlikely to match any packet::
3648a997a33bSAdrien Mazarguil
3649a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3650a997a33bSAdrien Mazarguil
3651a997a33bSAdrien MazarguilMore information on these restrictions can be found in the *rte_flow*
3652a997a33bSAdrien Mazarguildocumentation.
3653a997a33bSAdrien Mazarguil
3654a997a33bSAdrien MazarguilSeveral items support additional specification structures, for example
3655a997a33bSAdrien Mazarguil``ipv4`` allows specifying source and destination addresses as follows::
3656a997a33bSAdrien Mazarguil
3657a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1
3658a997a33bSAdrien Mazarguil      dst is 10.2.0.0 / end [...]
3659a997a33bSAdrien Mazarguil
3660a997a33bSAdrien MazarguilThis rule matches all IPv4 traffic with the specified properties.
3661a997a33bSAdrien Mazarguil
3662a997a33bSAdrien MazarguilIn this example, ``src`` and ``dst`` are field names of the underlying
3663a997a33bSAdrien Mazarguil``struct rte_flow_item_ipv4`` object. All item properties can be specified
3664a997a33bSAdrien Mazarguilin a similar fashion.
3665a997a33bSAdrien Mazarguil
3666a997a33bSAdrien MazarguilThe ``is`` token means that the subsequent value must be matched exactly,
3667a997a33bSAdrien Mazarguiland assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3668a997a33bSAdrien Mazarguilaccordingly. Possible assignment tokens are:
3669a997a33bSAdrien Mazarguil
3670a997a33bSAdrien Mazarguil- ``is``: match value perfectly (with full bit-mask).
3671a997a33bSAdrien Mazarguil- ``spec``: match value according to configured bit-mask.
3672a997a33bSAdrien Mazarguil- ``last``: specify upper bound to establish a range.
3673a997a33bSAdrien Mazarguil- ``mask``: specify bit-mask with relevant bits set to one.
3674892cfaddSDekel Peled- ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one.
3675a997a33bSAdrien Mazarguil
3676a997a33bSAdrien MazarguilThese yield identical results::
3677a997a33bSAdrien Mazarguil
3678a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1
3679a997a33bSAdrien Mazarguil
3680a997a33bSAdrien Mazarguil::
3681a997a33bSAdrien Mazarguil
3682a997a33bSAdrien Mazarguil   ipv4 src spec 10.1.1.1 src mask 255.255.255.255
3683a997a33bSAdrien Mazarguil
3684a997a33bSAdrien Mazarguil::
3685a997a33bSAdrien Mazarguil
3686a997a33bSAdrien Mazarguil   ipv4 src spec 10.1.1.1 src prefix 32
3687a997a33bSAdrien Mazarguil
3688a997a33bSAdrien Mazarguil::
3689a997a33bSAdrien Mazarguil
3690a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value
3691a997a33bSAdrien Mazarguil
3692a997a33bSAdrien Mazarguil::
3693a997a33bSAdrien Mazarguil
3694a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src last 0 # 0 disables range
3695a997a33bSAdrien Mazarguil
3696a997a33bSAdrien MazarguilInclusive ranges can be defined with ``last``::
3697a997a33bSAdrien Mazarguil
3698a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4
3699a997a33bSAdrien Mazarguil
3700a997a33bSAdrien MazarguilNote that ``mask`` affects both ``spec`` and ``last``::
3701a997a33bSAdrien Mazarguil
3702a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0
3703a997a33bSAdrien Mazarguil      # matches 10.1.0.0 to 10.2.255.255
3704a997a33bSAdrien Mazarguil
3705a997a33bSAdrien MazarguilProperties can be modified multiple times::
3706a997a33bSAdrien Mazarguil
3707a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src is 10.1.2.3 src is 10.2.3.4 # matches 10.2.3.4
3708a997a33bSAdrien Mazarguil
3709a997a33bSAdrien Mazarguil::
3710a997a33bSAdrien Mazarguil
3711a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16
3712a997a33bSAdrien Mazarguil
3713a997a33bSAdrien MazarguilPattern items
3714a997a33bSAdrien Mazarguil^^^^^^^^^^^^^
3715a997a33bSAdrien Mazarguil
3716a997a33bSAdrien MazarguilThis section lists supported pattern items and their attributes, if any.
3717a997a33bSAdrien Mazarguil
3718a997a33bSAdrien Mazarguil- ``end``: end list of pattern items.
3719a997a33bSAdrien Mazarguil
3720a997a33bSAdrien Mazarguil- ``void``: no-op pattern item.
3721a997a33bSAdrien Mazarguil
3722a997a33bSAdrien Mazarguil- ``invert``: perform actions when pattern does not match.
3723a997a33bSAdrien Mazarguil
3724a997a33bSAdrien Mazarguil- ``any``: match any protocol for the current layer.
3725a997a33bSAdrien Mazarguil
3726a997a33bSAdrien Mazarguil  - ``num {unsigned}``: number of layers covered.
3727a997a33bSAdrien Mazarguil
372839b8dda7SAdrien Mazarguil- ``pf``: match traffic from/to the physical function.
3729a997a33bSAdrien Mazarguil
373039b8dda7SAdrien Mazarguil- ``vf``: match traffic from/to a virtual function ID.
3731a997a33bSAdrien Mazarguil
373239b8dda7SAdrien Mazarguil  - ``id {unsigned}``: VF ID.
3733a997a33bSAdrien Mazarguil
3734fee1fa02SAdrien Mazarguil- ``phy_port``: match traffic from/to a specific physical port.
3735a997a33bSAdrien Mazarguil
3736a997a33bSAdrien Mazarguil  - ``index {unsigned}``: physical port index.
3737a997a33bSAdrien Mazarguil
3738fc6bbb3fSAdrien Mazarguil- ``port_id``: match traffic from/to a given DPDK port ID.
3739fc6bbb3fSAdrien Mazarguil
3740fc6bbb3fSAdrien Mazarguil  - ``id {unsigned}``: DPDK port ID.
3741fc6bbb3fSAdrien Mazarguil
3742e05419b3SDeclan Doherty- ``mark``: match value set in previously matched flow rule using the mark action.
3743e05419b3SDeclan Doherty
3744e05419b3SDeclan Doherty  - ``id {unsigned}``: arbitrary integer value.
3745e05419b3SDeclan Doherty
3746a997a33bSAdrien Mazarguil- ``raw``: match an arbitrary byte string.
3747a997a33bSAdrien Mazarguil
3748a997a33bSAdrien Mazarguil  - ``relative {boolean}``: look for pattern after the previous item.
3749a997a33bSAdrien Mazarguil  - ``search {boolean}``: search pattern from offset (see also limit).
3750a997a33bSAdrien Mazarguil  - ``offset {integer}``: absolute or relative offset for pattern.
3751a997a33bSAdrien Mazarguil  - ``limit {unsigned}``: search area limit for start of pattern.
3752a997a33bSAdrien Mazarguil  - ``pattern {string}``: byte string to look for.
3753a997a33bSAdrien Mazarguil
3754a997a33bSAdrien Mazarguil- ``eth``: match Ethernet header.
3755a997a33bSAdrien Mazarguil
3756a997a33bSAdrien Mazarguil  - ``dst {MAC-48}``: destination MAC.
3757a997a33bSAdrien Mazarguil  - ``src {MAC-48}``: source MAC.
3758e58638c3SAdrien Mazarguil  - ``type {unsigned}``: EtherType or TPID.
3759a997a33bSAdrien Mazarguil
3760a997a33bSAdrien Mazarguil- ``vlan``: match 802.1Q/ad VLAN tag.
3761a997a33bSAdrien Mazarguil
3762a997a33bSAdrien Mazarguil  - ``tci {unsigned}``: tag control information.
37631419fd5aSAdrien Mazarguil  - ``pcp {unsigned}``: priority code point.
37641419fd5aSAdrien Mazarguil  - ``dei {unsigned}``: drop eligible indicator.
37651419fd5aSAdrien Mazarguil  - ``vid {unsigned}``: VLAN identifier.
3766e58638c3SAdrien Mazarguil  - ``inner_type {unsigned}``: inner EtherType or TPID.
3767a997a33bSAdrien Mazarguil
3768a997a33bSAdrien Mazarguil- ``ipv4``: match IPv4 header.
3769a997a33bSAdrien Mazarguil
37701419fd5aSAdrien Mazarguil  - ``tos {unsigned}``: type of service.
37711419fd5aSAdrien Mazarguil  - ``ttl {unsigned}``: time to live.
37721419fd5aSAdrien Mazarguil  - ``proto {unsigned}``: next protocol ID.
3773a997a33bSAdrien Mazarguil  - ``src {ipv4 address}``: source address.
3774a997a33bSAdrien Mazarguil  - ``dst {ipv4 address}``: destination address.
3775a997a33bSAdrien Mazarguil
3776a997a33bSAdrien Mazarguil- ``ipv6``: match IPv6 header.
3777a997a33bSAdrien Mazarguil
37781419fd5aSAdrien Mazarguil  - ``tc {unsigned}``: traffic class.
37791419fd5aSAdrien Mazarguil  - ``flow {unsigned}``: flow label.
37801419fd5aSAdrien Mazarguil  - ``proto {unsigned}``: protocol (next header).
37811419fd5aSAdrien Mazarguil  - ``hop {unsigned}``: hop limit.
3782a997a33bSAdrien Mazarguil  - ``src {ipv6 address}``: source address.
3783a997a33bSAdrien Mazarguil  - ``dst {ipv6 address}``: destination address.
3784a997a33bSAdrien Mazarguil
3785a997a33bSAdrien Mazarguil- ``icmp``: match ICMP header.
3786a997a33bSAdrien Mazarguil
3787a997a33bSAdrien Mazarguil  - ``type {unsigned}``: ICMP packet type.
3788a997a33bSAdrien Mazarguil  - ``code {unsigned}``: ICMP packet code.
3789a997a33bSAdrien Mazarguil
3790a997a33bSAdrien Mazarguil- ``udp``: match UDP header.
3791a997a33bSAdrien Mazarguil
3792a997a33bSAdrien Mazarguil  - ``src {unsigned}``: UDP source port.
3793a997a33bSAdrien Mazarguil  - ``dst {unsigned}``: UDP destination port.
3794a997a33bSAdrien Mazarguil
3795a997a33bSAdrien Mazarguil- ``tcp``: match TCP header.
3796a997a33bSAdrien Mazarguil
3797a997a33bSAdrien Mazarguil  - ``src {unsigned}``: TCP source port.
3798a997a33bSAdrien Mazarguil  - ``dst {unsigned}``: TCP destination port.
3799a997a33bSAdrien Mazarguil
3800a997a33bSAdrien Mazarguil- ``sctp``: match SCTP header.
3801a997a33bSAdrien Mazarguil
3802a997a33bSAdrien Mazarguil  - ``src {unsigned}``: SCTP source port.
3803a997a33bSAdrien Mazarguil  - ``dst {unsigned}``: SCTP destination port.
38041419fd5aSAdrien Mazarguil  - ``tag {unsigned}``: validation tag.
38051419fd5aSAdrien Mazarguil  - ``cksum {unsigned}``: checksum.
3806a997a33bSAdrien Mazarguil
3807a997a33bSAdrien Mazarguil- ``vxlan``: match VXLAN header.
3808a997a33bSAdrien Mazarguil
3809a997a33bSAdrien Mazarguil  - ``vni {unsigned}``: VXLAN identifier.
3810a997a33bSAdrien Mazarguil
3811e4840ef2SAdrien Mazarguil- ``e_tag``: match IEEE 802.1BR E-Tag header.
3812e4840ef2SAdrien Mazarguil
3813e4840ef2SAdrien Mazarguil  - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
3814e4840ef2SAdrien Mazarguil
3815e4840ef2SAdrien Mazarguil- ``nvgre``: match NVGRE header.
3816e4840ef2SAdrien Mazarguil
3817e4840ef2SAdrien Mazarguil  - ``tni {unsigned}``: virtual subnet ID.
3818e4840ef2SAdrien Mazarguil
38191315219aSBeilei Xing- ``mpls``: match MPLS header.
38201315219aSBeilei Xing
38211315219aSBeilei Xing  - ``label {unsigned}``: MPLS label.
38221315219aSBeilei Xing
38231315219aSBeilei Xing- ``gre``: match GRE header.
38241315219aSBeilei Xing
38251315219aSBeilei Xing  - ``protocol {unsigned}``: protocol type.
38261315219aSBeilei Xing
3827c6ef1454SXiaoyu Min- ``gre_key``: match GRE optional key field.
3828c6ef1454SXiaoyu Min
3829c6ef1454SXiaoyu Min  - ``value {unsigned}``: key value.
3830c6ef1454SXiaoyu Min
3831a3a2e2c8SQi Zhang- ``fuzzy``: fuzzy pattern match, expect faster than default.
3832a3a2e2c8SQi Zhang
3833a3a2e2c8SQi Zhang  - ``thresh {unsigned}``: accuracy threshold.
3834a3a2e2c8SQi Zhang
3835576f459eSBeilei Xing- ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header.
3836576f459eSBeilei Xing
3837576f459eSBeilei Xing  - ``teid {unsigned}``: tunnel endpoint identifier.
3838576f459eSBeilei Xing
38390f4203feSRoman Zhukov- ``geneve``: match GENEVE header.
38400f4203feSRoman Zhukov
38410f4203feSRoman Zhukov  - ``vni {unsigned}``: virtual network identifier.
38420f4203feSRoman Zhukov  - ``protocol {unsigned}``: protocol type.
38430f4203feSRoman Zhukov
384439e5e20fSXueming Li- ``vxlan-gpe``: match VXLAN-GPE header.
384539e5e20fSXueming Li
384639e5e20fSXueming Li  - ``vni {unsigned}``: VXLAN-GPE identifier.
384739e5e20fSXueming Li
3848a903c049SQi Zhang- ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4.
3849a903c049SQi Zhang
3850a903c049SQi Zhang  - ``sha {MAC-48}``: sender hardware address.
3851a903c049SQi Zhang  - ``spa {ipv4 address}``: sender IPv4 address.
3852a903c049SQi Zhang  - ``tha {MAC-48}``: target hardware address.
3853a903c049SQi Zhang  - ``tpa {ipv4 address}``: target IPv4 address.
3854a903c049SQi Zhang
3855a903c049SQi Zhang- ``ipv6_ext``: match presence of any IPv6 extension header.
3856a903c049SQi Zhang
3857a903c049SQi Zhang  - ``next_hdr {unsigned}``: next header.
3858a903c049SQi Zhang
3859a903c049SQi Zhang- ``icmp6``: match any ICMPv6 header.
3860a903c049SQi Zhang
3861a903c049SQi Zhang  - ``type {unsigned}``: ICMPv6 type.
3862a903c049SQi Zhang  - ``code {unsigned}``: ICMPv6 code.
3863a903c049SQi Zhang
3864a903c049SQi Zhang- ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
3865a903c049SQi Zhang
3866a903c049SQi Zhang  - ``target_addr {ipv6 address}``: target address.
3867a903c049SQi Zhang
3868a903c049SQi Zhang- ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement.
3869a903c049SQi Zhang
3870a903c049SQi Zhang  - ``target_addr {ipv6 address}``: target address.
3871a903c049SQi Zhang
3872a903c049SQi Zhang- ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option.
3873a903c049SQi Zhang
3874a903c049SQi Zhang  - ``type {unsigned}``: ND option type.
3875a903c049SQi Zhang
3876a903c049SQi Zhang- ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet
3877a903c049SQi Zhang  link-layer address option.
3878a903c049SQi Zhang
3879a903c049SQi Zhang  - ``sla {MAC-48}``: source Ethernet LLA.
3880a903c049SQi Zhang
3881205d9d3cSDekel Peled- ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet
3882a903c049SQi Zhang  link-layer address option.
3883a903c049SQi Zhang
3884a903c049SQi Zhang  - ``tla {MAC-48}``: target Ethernet LLA.
3885a903c049SQi Zhang
3886c18feafaSDekel Peled- ``meta``: match application specific metadata.
3887c18feafaSDekel Peled
3888c18feafaSDekel Peled  - ``data {unsigned}``: metadata value.
3889c18feafaSDekel Peled
3890a997a33bSAdrien MazarguilActions list
3891a997a33bSAdrien Mazarguil^^^^^^^^^^^^
3892a997a33bSAdrien Mazarguil
3893a997a33bSAdrien MazarguilA list of actions starts after the ``actions`` token in the same fashion as
3894a997a33bSAdrien Mazarguil`Matching pattern`_; actions are separated by ``/`` tokens and the list is
3895a997a33bSAdrien Mazarguilterminated by a mandatory ``end`` action.
3896a997a33bSAdrien Mazarguil
3897a997a33bSAdrien MazarguilActions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
3898a997a33bSAdrien Mazarguilrte_flow_action_type``).
3899a997a33bSAdrien Mazarguil
3900a997a33bSAdrien MazarguilDropping all incoming UDPv4 packets can be expressed as follows::
3901a997a33bSAdrien Mazarguil
3902a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3903a997a33bSAdrien Mazarguil      actions drop / end
3904a997a33bSAdrien Mazarguil
3905a997a33bSAdrien MazarguilSeveral actions have configurable properties which must be specified when
3906a997a33bSAdrien Mazarguilthere is no valid default value. For example, ``queue`` requires a target
3907a997a33bSAdrien Mazarguilqueue index.
3908a997a33bSAdrien Mazarguil
3909a997a33bSAdrien MazarguilThis rule redirects incoming UDPv4 traffic to queue index 6::
3910a997a33bSAdrien Mazarguil
3911a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3912a997a33bSAdrien Mazarguil      actions queue index 6 / end
3913a997a33bSAdrien Mazarguil
3914a997a33bSAdrien MazarguilWhile this one could be rejected by PMDs (unspecified queue index)::
3915a997a33bSAdrien Mazarguil
3916a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3917a997a33bSAdrien Mazarguil      actions queue / end
3918a997a33bSAdrien Mazarguil
3919a997a33bSAdrien MazarguilAs defined by *rte_flow*, the list is not ordered, all actions of a given
3920a997a33bSAdrien Mazarguilrule are performed simultaneously. These are equivalent::
3921a997a33bSAdrien Mazarguil
3922a997a33bSAdrien Mazarguil   queue index 6 / void / mark id 42 / end
3923a997a33bSAdrien Mazarguil
3924a997a33bSAdrien Mazarguil::
3925a997a33bSAdrien Mazarguil
3926a997a33bSAdrien Mazarguil   void / mark id 42 / queue index 6 / end
3927a997a33bSAdrien Mazarguil
3928a997a33bSAdrien MazarguilAll actions in a list should have different types, otherwise only the last
3929a997a33bSAdrien Mazarguilaction of a given type is taken into account::
3930a997a33bSAdrien Mazarguil
3931a997a33bSAdrien Mazarguil   queue index 4 / queue index 5 / queue index 6 / end # will use queue 6
3932a997a33bSAdrien Mazarguil
3933a997a33bSAdrien Mazarguil::
3934a997a33bSAdrien Mazarguil
3935a997a33bSAdrien Mazarguil   drop / drop / drop / end # drop is performed only once
3936a997a33bSAdrien Mazarguil
3937a997a33bSAdrien Mazarguil::
3938a997a33bSAdrien Mazarguil
3939a997a33bSAdrien Mazarguil   mark id 42 / queue index 3 / mark id 24 / end # mark will be 24
3940a997a33bSAdrien Mazarguil
3941a997a33bSAdrien MazarguilConsidering they are performed simultaneously, opposite and overlapping
3942a997a33bSAdrien Mazarguilactions can sometimes be combined when the end result is unambiguous::
3943a997a33bSAdrien Mazarguil
3944a997a33bSAdrien Mazarguil   drop / queue index 6 / end # drop has no effect
3945a997a33bSAdrien Mazarguil
3946a997a33bSAdrien Mazarguil::
3947a997a33bSAdrien Mazarguil
3948a997a33bSAdrien Mazarguil   queue index 6 / rss queues 6 7 8 / end # queue has no effect
3949a997a33bSAdrien Mazarguil
3950a997a33bSAdrien Mazarguil::
3951a997a33bSAdrien Mazarguil
3952a997a33bSAdrien Mazarguil   drop / passthru / end # drop has no effect
3953a997a33bSAdrien Mazarguil
3954a997a33bSAdrien MazarguilNote that PMDs may still refuse such combinations.
3955a997a33bSAdrien Mazarguil
3956a997a33bSAdrien MazarguilActions
3957a997a33bSAdrien Mazarguil^^^^^^^
3958a997a33bSAdrien Mazarguil
3959a997a33bSAdrien MazarguilThis section lists supported actions and their attributes, if any.
3960a997a33bSAdrien Mazarguil
3961a997a33bSAdrien Mazarguil- ``end``: end list of actions.
3962a997a33bSAdrien Mazarguil
3963a997a33bSAdrien Mazarguil- ``void``: no-op action.
3964a997a33bSAdrien Mazarguil
3965a997a33bSAdrien Mazarguil- ``passthru``: let subsequent rule process matched packets.
3966a997a33bSAdrien Mazarguil
39672f82d143SDeclan Doherty- ``jump``: redirect traffic to group on device.
39682f82d143SDeclan Doherty
39692f82d143SDeclan Doherty  - ``group {unsigned}``: group to redirect to.
39702f82d143SDeclan Doherty
3971a997a33bSAdrien Mazarguil- ``mark``: attach 32 bit value to packets.
3972a997a33bSAdrien Mazarguil
3973a997a33bSAdrien Mazarguil  - ``id {unsigned}``: 32 bit value to return with packets.
3974a997a33bSAdrien Mazarguil
3975a997a33bSAdrien Mazarguil- ``flag``: flag packets.
3976a997a33bSAdrien Mazarguil
3977a997a33bSAdrien Mazarguil- ``queue``: assign packets to a given queue index.
3978a997a33bSAdrien Mazarguil
3979a997a33bSAdrien Mazarguil  - ``index {unsigned}``: queue index to use.
3980a997a33bSAdrien Mazarguil
3981a997a33bSAdrien Mazarguil- ``drop``: drop packets (note: passthru has priority).
3982a997a33bSAdrien Mazarguil
3983a997a33bSAdrien Mazarguil- ``count``: enable counters for this rule.
3984a997a33bSAdrien Mazarguil
3985a997a33bSAdrien Mazarguil- ``rss``: spread packets among several queues.
3986a997a33bSAdrien Mazarguil
3987929e3319SAdrien Mazarguil  - ``func {hash function}``: RSS hash function to apply, allowed tokens are
3988929e3319SAdrien Mazarguil    the same as `set_hash_global_config`_.
3989929e3319SAdrien Mazarguil
399018aee286SAdrien Mazarguil  - ``level {unsigned}``: encapsulation level for ``types``.
399118aee286SAdrien Mazarguil
3992ac8d22deSAdrien Mazarguil  - ``types [{RSS hash type} [...]] end``: specific RSS hash types, allowed
3993ac8d22deSAdrien Mazarguil    tokens are the same as `set_hash_input_set`_, except that an empty list
3994ac8d22deSAdrien Mazarguil    does not disable RSS but instead requests unspecified "best-effort"
3995ac8d22deSAdrien Mazarguil    settings.
3996f4d623f9SAdrien Mazarguil
3997f4d623f9SAdrien Mazarguil  - ``key {string}``: RSS hash key, overrides ``key_len``.
3998f4d623f9SAdrien Mazarguil
3999f4d623f9SAdrien Mazarguil  - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in
4000f4d623f9SAdrien Mazarguil    conjunction with ``key`` to pad or truncate it.
4001f4d623f9SAdrien Mazarguil
4002a997a33bSAdrien Mazarguil  - ``queues [{unsigned} [...]] end``: queue indices to use.
4003a997a33bSAdrien Mazarguil
400439b8dda7SAdrien Mazarguil- ``pf``: direct traffic to physical function.
4005a997a33bSAdrien Mazarguil
400639b8dda7SAdrien Mazarguil- ``vf``: direct traffic to a virtual function ID.
4007a997a33bSAdrien Mazarguil
4008a997a33bSAdrien Mazarguil  - ``original {boolean}``: use original VF ID if possible.
400939b8dda7SAdrien Mazarguil  - ``id {unsigned}``: VF ID.
4010a997a33bSAdrien Mazarguil
4011e7b65705SAdrien Mazarguil- ``phy_port``: direct packets to physical port index.
4012e7b65705SAdrien Mazarguil
4013e7b65705SAdrien Mazarguil  - ``original {boolean}``: use original port index if possible.
4014e7b65705SAdrien Mazarguil  - ``index {unsigned}``: physical port index.
4015e7b65705SAdrien Mazarguil
4016fc6bbb3fSAdrien Mazarguil- ``port_id``: direct matching traffic to a given DPDK port ID.
4017fc6bbb3fSAdrien Mazarguil
4018fc6bbb3fSAdrien Mazarguil  - ``original {boolean}``: use original DPDK port ID if possible.
4019fc6bbb3fSAdrien Mazarguil  - ``id {unsigned}``: DPDK port ID.
4020fc6bbb3fSAdrien Mazarguil
40211c54c938SQi Zhang- ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``.
40221c54c938SQi Zhang
40231c54c938SQi Zhang  - ``mpls_ttl``: MPLS TTL.
40241c54c938SQi Zhang
40251c54c938SQi Zhang- ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``.
40261c54c938SQi Zhang
40271c54c938SQi Zhang- ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``.
40281c54c938SQi Zhang
40291c54c938SQi Zhang  - ``nw_ttl``: IP TTL.
40301c54c938SQi Zhang
40311c54c938SQi Zhang- ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``.
40321c54c938SQi Zhang
40331c54c938SQi Zhang- ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``.
40341c54c938SQi Zhang
40351c54c938SQi Zhang- ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``.
40361c54c938SQi Zhang
40377e3389b1SQi Zhang- ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``.
40387e3389b1SQi Zhang
40397e3389b1SQi Zhang- ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``.
40407e3389b1SQi Zhang
40417e3389b1SQi Zhang  - ``ethertype``: Ethertype.
40427e3389b1SQi Zhang
40437e3389b1SQi Zhang- ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``.
40447e3389b1SQi Zhang
40457e3389b1SQi Zhang  - ``vlan_vid``: VLAN id.
40467e3389b1SQi Zhang
40477e3389b1SQi Zhang- ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``.
40487e3389b1SQi Zhang
40497e3389b1SQi Zhang  - ``vlan_pcp``: VLAN priority.
40507e3389b1SQi Zhang
40517e3389b1SQi Zhang- ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``.
40527e3389b1SQi Zhang
40537e3389b1SQi Zhang  - ``ethertype``: Ethertype.
40547e3389b1SQi Zhang
40557e3389b1SQi Zhang- ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``.
40567e3389b1SQi Zhang
40577e3389b1SQi Zhang  - ``ethertype``: Ethertype.
40587e3389b1SQi Zhang
40591960be7dSNelio Laranjeiro- ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration
40601960be7dSNelio Laranjeiro  is done through `Config VXLAN Encap outer layers`_.
40611960be7dSNelio Laranjeiro
40621960be7dSNelio Laranjeiro- ``vxlan_decap``: Performs a decapsulation action by stripping all headers of
40631960be7dSNelio Laranjeiro  the VXLAN tunnel network overlay from the matched flow.
40641960be7dSNelio Laranjeiro
4065dcd962fcSNelio Laranjeiro- ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration
4066dcd962fcSNelio Laranjeiro  is done through `Config NVGRE Encap outer layers`_.
4067dcd962fcSNelio Laranjeiro
4068dcd962fcSNelio Laranjeiro- ``nvgre_decap``: Performs a decapsulation action by stripping all headers of
4069dcd962fcSNelio Laranjeiro  the NVGRE tunnel network overlay from the matched flow.
4070dcd962fcSNelio Laranjeiro
4071a1191d39SOri Kam- ``l2_encap``: Performs a L2 encapsulation, L2 configuration
4072a1191d39SOri Kam  is done through `Config L2 Encap`_.
4073a1191d39SOri Kam
4074a1191d39SOri Kam- ``l2_decap``: Performs a L2 decapsulation, L2 configuration
4075a1191d39SOri Kam  is done through `Config L2 Decap`_.
4076a1191d39SOri Kam
40773e77031bSOri Kam- ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer
40783e77031bSOri Kam  configuration is done through `Config MPLSoGRE Encap outer layers`_.
40793e77031bSOri Kam
40803e77031bSOri Kam- ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer
40813e77031bSOri Kam  configuration is done through `Config MPLSoGRE Decap outer layers`_.
40823e77031bSOri Kam
4083a1191d39SOri Kam- ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer
4084a1191d39SOri Kam  configuration is done through `Config MPLSoUDP Encap outer layers`_.
4085a1191d39SOri Kam
4086a1191d39SOri Kam- ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer
4087a1191d39SOri Kam  configuration is done through `Config MPLSoUDP Decap outer layers`_.
4088a1191d39SOri Kam
40890517eea7SRahul Lakkireddy- ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header.
40900517eea7SRahul Lakkireddy
40910517eea7SRahul Lakkireddy  - ``ipv4_addr``: New IPv4 source address.
40920517eea7SRahul Lakkireddy
40930517eea7SRahul Lakkireddy- ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4
40940517eea7SRahul Lakkireddy  header.
40950517eea7SRahul Lakkireddy
40960517eea7SRahul Lakkireddy  - ``ipv4_addr``: New IPv4 destination address.
40970517eea7SRahul Lakkireddy
40980517eea7SRahul Lakkireddy- ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header.
40990517eea7SRahul Lakkireddy
41000517eea7SRahul Lakkireddy  - ``ipv6_addr``: New IPv6 source address.
41010517eea7SRahul Lakkireddy
41020517eea7SRahul Lakkireddy- ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6
41030517eea7SRahul Lakkireddy  header.
41040517eea7SRahul Lakkireddy
41050517eea7SRahul Lakkireddy  - ``ipv6_addr``: New IPv6 destination address.
41060517eea7SRahul Lakkireddy
410747182a79SDekel Peled- ``set_tp_src``: Set a new source port number in the outermost TCP/UDP
41089ccc9491SRahul Lakkireddy  header.
41099ccc9491SRahul Lakkireddy
41109ccc9491SRahul Lakkireddy  - ``port``: New TCP/UDP source port number.
41119ccc9491SRahul Lakkireddy
411247182a79SDekel Peled- ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP
41139ccc9491SRahul Lakkireddy  header.
41149ccc9491SRahul Lakkireddy
41159ccc9491SRahul Lakkireddy  - ``port``: New TCP/UDP destination port number.
41169ccc9491SRahul Lakkireddy
411782875970SRahul Lakkireddy- ``mac_swap``: Swap the source and destination MAC addresses in the outermost
411882875970SRahul Lakkireddy  Ethernet header.
411982875970SRahul Lakkireddy
4120708d0bcbSXiaoyu Min- ``dec_ttl``: Performs a decrease TTL value action
4121708d0bcbSXiaoyu Min
4122d629b7b5SJohn McNamara- ``set_ttl``: Set TTL value with specified value
4123708d0bcbSXiaoyu Min  - ``ttl_value {unsigned}``: The new TTL value to be set
4124708d0bcbSXiaoyu Min
41254dff9e29SXiaoyu Min- ``set_mac_src``: set source MAC address
41264dff9e29SXiaoyu Min
41274dff9e29SXiaoyu Min  - ``mac_addr {MAC-48}``: new source MAC address
41284dff9e29SXiaoyu Min
41294dff9e29SXiaoyu Min- ``set_mac_dst``: set destination MAC address
41304dff9e29SXiaoyu Min
41314dff9e29SXiaoyu Min  - ``mac_addr {MAC-48}``: new destination MAC address
41324dff9e29SXiaoyu Min
413327a2c126SDekel Peled- ``inc_tcp_seq``: Increase sequence number in the outermost TCP header.
413427a2c126SDekel Peled
413527a2c126SDekel Peled  - ``value {unsigned}``: Value to increase TCP sequence number by.
413627a2c126SDekel Peled
413727a2c126SDekel Peled- ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header.
413827a2c126SDekel Peled
413927a2c126SDekel Peled  - ``value {unsigned}``: Value to decrease TCP sequence number by.
414027a2c126SDekel Peled
414127a2c126SDekel Peled- ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header.
414227a2c126SDekel Peled
414327a2c126SDekel Peled  - ``value {unsigned}``: Value to increase TCP acknowledgment number by.
414427a2c126SDekel Peled
414527a2c126SDekel Peled- ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header.
414627a2c126SDekel Peled
414727a2c126SDekel Peled  - ``value {unsigned}``: Value to decrease TCP acknowledgment number by.
414827a2c126SDekel Peled
4149a997a33bSAdrien MazarguilDestroying flow rules
4150a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~~~
4151a997a33bSAdrien Mazarguil
4152a997a33bSAdrien Mazarguil``flow destroy`` destroys one or more rules from their rule ID (as returned
4153a997a33bSAdrien Mazarguilby ``flow create``), this command calls ``rte_flow_destroy()`` as many
4154a997a33bSAdrien Mazarguiltimes as necessary::
4155a997a33bSAdrien Mazarguil
4156a997a33bSAdrien Mazarguil   flow destroy {port_id} rule {rule_id} [...]
4157a997a33bSAdrien Mazarguil
4158a997a33bSAdrien MazarguilIf successful, it will show::
4159a997a33bSAdrien Mazarguil
4160a997a33bSAdrien Mazarguil   Flow rule #[...] destroyed
4161a997a33bSAdrien Mazarguil
4162a997a33bSAdrien MazarguilIt does not report anything for rule IDs that do not exist. The usual error
4163a997a33bSAdrien Mazarguilmessage is shown when a rule cannot be destroyed::
4164a997a33bSAdrien Mazarguil
4165a997a33bSAdrien Mazarguil   Caught error type [...] ([...]): [...]
4166a997a33bSAdrien Mazarguil
4167a997a33bSAdrien Mazarguil``flow flush`` destroys all rules on a device and does not take extra
4168a997a33bSAdrien Mazarguilarguments. It is bound to ``rte_flow_flush()``::
4169a997a33bSAdrien Mazarguil
4170a997a33bSAdrien Mazarguil   flow flush {port_id}
4171a997a33bSAdrien Mazarguil
4172a997a33bSAdrien MazarguilAny errors are reported as above.
4173a997a33bSAdrien Mazarguil
4174a997a33bSAdrien MazarguilCreating several rules and destroying them::
4175a997a33bSAdrien Mazarguil
4176a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4177a997a33bSAdrien Mazarguil      actions queue index 2 / end
4178a997a33bSAdrien Mazarguil   Flow rule #0 created
4179a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4180a997a33bSAdrien Mazarguil      actions queue index 3 / end
4181a997a33bSAdrien Mazarguil   Flow rule #1 created
4182a997a33bSAdrien Mazarguil   testpmd> flow destroy 0 rule 0 rule 1
4183a997a33bSAdrien Mazarguil   Flow rule #1 destroyed
4184a997a33bSAdrien Mazarguil   Flow rule #0 destroyed
4185a997a33bSAdrien Mazarguil   testpmd>
4186a997a33bSAdrien Mazarguil
4187a997a33bSAdrien MazarguilThe same result can be achieved using ``flow flush``::
4188a997a33bSAdrien Mazarguil
4189a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4190a997a33bSAdrien Mazarguil      actions queue index 2 / end
4191a997a33bSAdrien Mazarguil   Flow rule #0 created
4192a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4193a997a33bSAdrien Mazarguil      actions queue index 3 / end
4194a997a33bSAdrien Mazarguil   Flow rule #1 created
4195a997a33bSAdrien Mazarguil   testpmd> flow flush 0
4196a997a33bSAdrien Mazarguil   testpmd>
4197a997a33bSAdrien Mazarguil
4198a997a33bSAdrien MazarguilNon-existent rule IDs are ignored::
4199a997a33bSAdrien Mazarguil
4200a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4201a997a33bSAdrien Mazarguil      actions queue index 2 / end
4202a997a33bSAdrien Mazarguil   Flow rule #0 created
4203a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4204a997a33bSAdrien Mazarguil      actions queue index 3 / end
4205a997a33bSAdrien Mazarguil   Flow rule #1 created
4206a997a33bSAdrien Mazarguil   testpmd> flow destroy 0 rule 42 rule 10 rule 2
4207a997a33bSAdrien Mazarguil   testpmd>
4208a997a33bSAdrien Mazarguil   testpmd> flow destroy 0 rule 0
4209a997a33bSAdrien Mazarguil   Flow rule #0 destroyed
4210a997a33bSAdrien Mazarguil   testpmd>
4211a997a33bSAdrien Mazarguil
4212a997a33bSAdrien MazarguilQuerying flow rules
4213a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~
4214a997a33bSAdrien Mazarguil
4215a997a33bSAdrien Mazarguil``flow query`` queries a specific action of a flow rule having that
4216a997a33bSAdrien Mazarguilability. Such actions collect information that can be reported using this
4217a997a33bSAdrien Mazarguilcommand. It is bound to ``rte_flow_query()``::
4218a997a33bSAdrien Mazarguil
4219a997a33bSAdrien Mazarguil   flow query {port_id} {rule_id} {action}
4220a997a33bSAdrien Mazarguil
4221a997a33bSAdrien MazarguilIf successful, it will display either the retrieved data for known actions
4222a997a33bSAdrien Mazarguilor the following message::
4223a997a33bSAdrien Mazarguil
4224a997a33bSAdrien Mazarguil   Cannot display result for action type [...] ([...])
4225a997a33bSAdrien Mazarguil
4226a997a33bSAdrien MazarguilOtherwise, it will complain either that the rule does not exist or that some
4227a997a33bSAdrien Mazarguilerror occurred::
4228a997a33bSAdrien Mazarguil
4229a997a33bSAdrien Mazarguil   Flow rule #[...] not found
4230a997a33bSAdrien Mazarguil
4231a997a33bSAdrien Mazarguil::
4232a997a33bSAdrien Mazarguil
4233a997a33bSAdrien Mazarguil   Caught error type [...] ([...]): [...]
4234a997a33bSAdrien Mazarguil
4235a997a33bSAdrien MazarguilCurrently only the ``count`` action is supported. This action reports the
4236a997a33bSAdrien Mazarguilnumber of packets that hit the flow rule and the total number of bytes. Its
4237a997a33bSAdrien Mazarguiloutput has the following format::
4238a997a33bSAdrien Mazarguil
4239a997a33bSAdrien Mazarguil   count:
4240a997a33bSAdrien Mazarguil    hits_set: [...] # whether "hits" contains a valid value
4241a997a33bSAdrien Mazarguil    bytes_set: [...] # whether "bytes" contains a valid value
4242a997a33bSAdrien Mazarguil    hits: [...] # number of packets
4243a997a33bSAdrien Mazarguil    bytes: [...] # number of bytes
4244a997a33bSAdrien Mazarguil
4245a997a33bSAdrien MazarguilQuerying counters for TCPv6 packets redirected to queue 6::
4246a997a33bSAdrien Mazarguil
4247a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end
4248a997a33bSAdrien Mazarguil      actions queue index 6 / count / end
4249a997a33bSAdrien Mazarguil   Flow rule #4 created
4250a997a33bSAdrien Mazarguil   testpmd> flow query 0 4 count
4251a997a33bSAdrien Mazarguil   count:
4252a997a33bSAdrien Mazarguil    hits_set: 1
4253a997a33bSAdrien Mazarguil    bytes_set: 0
4254a997a33bSAdrien Mazarguil    hits: 386446
4255a997a33bSAdrien Mazarguil    bytes: 0
4256a997a33bSAdrien Mazarguil   testpmd>
4257a997a33bSAdrien Mazarguil
4258a997a33bSAdrien MazarguilListing flow rules
4259a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~
4260a997a33bSAdrien Mazarguil
4261a997a33bSAdrien Mazarguil``flow list`` lists existing flow rules sorted by priority and optionally
4262a997a33bSAdrien Mazarguilfiltered by group identifiers::
4263a997a33bSAdrien Mazarguil
4264a997a33bSAdrien Mazarguil   flow list {port_id} [group {group_id}] [...]
4265a997a33bSAdrien Mazarguil
4266a997a33bSAdrien MazarguilThis command only fails with the following message if the device does not
4267a997a33bSAdrien Mazarguilexist::
4268a997a33bSAdrien Mazarguil
4269a997a33bSAdrien Mazarguil   Invalid port [...]
4270a997a33bSAdrien Mazarguil
4271a997a33bSAdrien MazarguilOutput consists of a header line followed by a short description of each
4272a997a33bSAdrien Mazarguilflow rule, one per line. There is no output at all when no flow rules are
4273a997a33bSAdrien Mazarguilconfigured on the device::
4274a997a33bSAdrien Mazarguil
4275a997a33bSAdrien Mazarguil   ID      Group   Prio    Attr    Rule
4276a997a33bSAdrien Mazarguil   [...]   [...]   [...]   [...]   [...]
4277a997a33bSAdrien Mazarguil
4278a997a33bSAdrien Mazarguil``Attr`` column flags:
4279a997a33bSAdrien Mazarguil
4280a997a33bSAdrien Mazarguil- ``i`` for ``ingress``.
4281a997a33bSAdrien Mazarguil- ``e`` for ``egress``.
4282a997a33bSAdrien Mazarguil
4283a997a33bSAdrien MazarguilCreating several flow rules and listing them::
4284a997a33bSAdrien Mazarguil
4285a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4286a997a33bSAdrien Mazarguil      actions queue index 6 / end
4287a997a33bSAdrien Mazarguil   Flow rule #0 created
4288a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4289a997a33bSAdrien Mazarguil      actions queue index 2 / end
4290a997a33bSAdrien Mazarguil   Flow rule #1 created
4291a997a33bSAdrien Mazarguil   testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end
4292a997a33bSAdrien Mazarguil      actions rss queues 6 7 8 end / end
4293a997a33bSAdrien Mazarguil   Flow rule #2 created
4294a997a33bSAdrien Mazarguil   testpmd> flow list 0
4295a997a33bSAdrien Mazarguil   ID      Group   Prio    Attr    Rule
4296a997a33bSAdrien Mazarguil   0       0       0       i-      ETH IPV4 => QUEUE
4297a997a33bSAdrien Mazarguil   1       0       0       i-      ETH IPV6 => QUEUE
4298a997a33bSAdrien Mazarguil   2       0       5       i-      ETH IPV4 UDP => RSS
4299a997a33bSAdrien Mazarguil   testpmd>
4300a997a33bSAdrien Mazarguil
4301a997a33bSAdrien MazarguilRules are sorted by priority (i.e. group ID first, then priority level)::
4302a997a33bSAdrien Mazarguil
4303a997a33bSAdrien Mazarguil   testpmd> flow list 1
4304a997a33bSAdrien Mazarguil   ID      Group   Prio    Attr    Rule
4305a997a33bSAdrien Mazarguil   0       0       0       i-      ETH => COUNT
4306a997a33bSAdrien Mazarguil   6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4307a997a33bSAdrien Mazarguil   5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4308a997a33bSAdrien Mazarguil   1       24      0       i-      ETH IPV4 UDP => QUEUE
4309a997a33bSAdrien Mazarguil   4       24      10      i-      ETH IPV4 TCP => DROP
4310a997a33bSAdrien Mazarguil   3       24      20      i-      ETH IPV4 => DROP
4311a997a33bSAdrien Mazarguil   2       24      42      i-      ETH IPV4 UDP => QUEUE
4312a997a33bSAdrien Mazarguil   7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4313a997a33bSAdrien Mazarguil   testpmd>
4314a997a33bSAdrien Mazarguil
4315a997a33bSAdrien MazarguilOutput can be limited to specific groups::
4316a997a33bSAdrien Mazarguil
4317a997a33bSAdrien Mazarguil   testpmd> flow list 1 group 0 group 63
4318a997a33bSAdrien Mazarguil   ID      Group   Prio    Attr    Rule
4319a997a33bSAdrien Mazarguil   0       0       0       i-      ETH => COUNT
4320a997a33bSAdrien Mazarguil   6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4321a997a33bSAdrien Mazarguil   5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4322a997a33bSAdrien Mazarguil   7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4323a997a33bSAdrien Mazarguil   testpmd>
43245a1affd8SBernard Iremonger
4325323f811aSAdrien MazarguilToggling isolated mode
4326323f811aSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~~~~
4327323f811aSAdrien Mazarguil
4328323f811aSAdrien Mazarguil``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4329323f811aSAdrien Mazarguilmust only be injected from the defined flow rules; that no default traffic
4330323f811aSAdrien Mazarguilis expected outside those rules and the driver is free to assign more
4331323f811aSAdrien Mazarguilresources to handle them. It is bound to ``rte_flow_isolate()``::
4332323f811aSAdrien Mazarguil
4333323f811aSAdrien Mazarguil flow isolate {port_id} {boolean}
4334323f811aSAdrien Mazarguil
4335323f811aSAdrien MazarguilIf successful, enabling or disabling isolated mode shows either::
4336323f811aSAdrien Mazarguil
4337323f811aSAdrien Mazarguil Ingress traffic on port [...]
4338323f811aSAdrien Mazarguil    is now restricted to the defined flow rules
4339323f811aSAdrien Mazarguil
4340323f811aSAdrien MazarguilOr::
4341323f811aSAdrien Mazarguil
4342323f811aSAdrien Mazarguil Ingress traffic on port [...]
4343323f811aSAdrien Mazarguil    is not restricted anymore to the defined flow rules
4344323f811aSAdrien Mazarguil
4345323f811aSAdrien MazarguilOtherwise, in case of error::
4346323f811aSAdrien Mazarguil
4347323f811aSAdrien Mazarguil   Caught error type [...] ([...]): [...]
4348323f811aSAdrien Mazarguil
4349323f811aSAdrien MazarguilMainly due to its side effects, PMDs supporting this mode may not have the
4350323f811aSAdrien Mazarguilability to toggle it more than once without reinitializing affected ports
4351323f811aSAdrien Mazarguilfirst (e.g. by exiting testpmd).
4352323f811aSAdrien Mazarguil
4353323f811aSAdrien MazarguilEnabling isolated mode::
4354323f811aSAdrien Mazarguil
4355323f811aSAdrien Mazarguil testpmd> flow isolate 0 true
4356323f811aSAdrien Mazarguil Ingress traffic on port 0 is now restricted to the defined flow rules
4357323f811aSAdrien Mazarguil testpmd>
4358323f811aSAdrien Mazarguil
4359323f811aSAdrien MazarguilDisabling isolated mode::
4360323f811aSAdrien Mazarguil
4361323f811aSAdrien Mazarguil testpmd> flow isolate 0 false
4362323f811aSAdrien Mazarguil Ingress traffic on port 0 is not restricted anymore to the defined flow rules
4363323f811aSAdrien Mazarguil testpmd>
4364323f811aSAdrien Mazarguil
43655a1affd8SBernard IremongerSample QinQ flow rules
43665a1affd8SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~
43675a1affd8SBernard Iremonger
4368bef3bfe7SBernard IremongerBefore creating QinQ rule(s) the following commands should be issued to enable QinQ::
4369bef3bfe7SBernard Iremonger
4370bef3bfe7SBernard Iremonger   testpmd> port stop 0
4371bef3bfe7SBernard Iremonger   testpmd> vlan set qinq on 0
4372bef3bfe7SBernard Iremonger
4373bef3bfe7SBernard IremongerThe above command sets the inner and outer TPID's to 0x8100.
4374bef3bfe7SBernard Iremonger
4375bef3bfe7SBernard IremongerTo change the TPID's the following commands should be used::
4376bef3bfe7SBernard Iremonger
4377bef3bfe7SBernard Iremonger   testpmd> vlan set outer tpid 0xa100 0
4378bef3bfe7SBernard Iremonger   testpmd> vlan set inner tpid 0x9100 0
4379bef3bfe7SBernard Iremonger   testpmd> port start 0
4380bef3bfe7SBernard Iremonger
43815a1affd8SBernard IremongerValidate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
43825a1affd8SBernard Iremonger
43835a1affd8SBernard Iremonger::
43845a1affd8SBernard Iremonger
4385bef3bfe7SBernard Iremonger   testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 /
4386bef3bfe7SBernard Iremonger       vlan tci is 456 / end actions vf id 1 / queue index 0 / end
43875a1affd8SBernard Iremonger   Flow rule #0 validated
43885a1affd8SBernard Iremonger
4389bef3bfe7SBernard Iremonger   testpmd> flow create 0 ingress pattern eth / vlan tci is 4 /
4390bef3bfe7SBernard Iremonger       vlan tci is 456 / end actions vf id 123 / queue index 0 / end
43915a1affd8SBernard Iremonger   Flow rule #0 created
43925a1affd8SBernard Iremonger
43935a1affd8SBernard Iremonger   testpmd> flow list 0
43945a1affd8SBernard Iremonger   ID      Group   Prio    Attr    Rule
43955a1affd8SBernard Iremonger   0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
43965a1affd8SBernard Iremonger
43975a1affd8SBernard IremongerValidate and create a QinQ rule on port 0 to steer traffic to a queue on the host.
43985a1affd8SBernard Iremonger
43995a1affd8SBernard Iremonger::
44005a1affd8SBernard Iremonger
4401bef3bfe7SBernard Iremonger   testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 /
4402bef3bfe7SBernard Iremonger        vlan tci is 654 / end actions pf / queue index 0 / end
44035a1affd8SBernard Iremonger   Flow rule #1 validated
44045a1affd8SBernard Iremonger
4405bef3bfe7SBernard Iremonger   testpmd> flow create 0 ingress pattern eth / vlan tci is 321 /
4406bef3bfe7SBernard Iremonger        vlan tci is 654 / end actions pf / queue index 1 / end
44075a1affd8SBernard Iremonger   Flow rule #1 created
44085a1affd8SBernard Iremonger
44095a1affd8SBernard Iremonger   testpmd> flow list 0
44105a1affd8SBernard Iremonger   ID      Group   Prio    Attr    Rule
44115a1affd8SBernard Iremonger   0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
44125a1affd8SBernard Iremonger   1       0       0       i-      ETH VLAN VLAN=>PF QUEUE
4413e977e419SKonstantin Ananyev
44141960be7dSNelio LaranjeiroSample VXLAN encapsulation rule
44151960be7dSNelio Laranjeiro~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44161960be7dSNelio Laranjeiro
44171960be7dSNelio LaranjeiroVXLAN encapsulation outer layer has default value pre-configured in testpmd
44181960be7dSNelio Laranjeirosource code, those can be changed by using the following commands
44191960be7dSNelio Laranjeiro
44201960be7dSNelio LaranjeiroIPv4 VXLAN outer header::
44211960be7dSNelio Laranjeiro
44221960be7dSNelio Laranjeiro testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
44231960be7dSNelio Laranjeiro        ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
44241960be7dSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions vxlan_encap /
44251960be7dSNelio Laranjeiro        queue index 0 / end
44261960be7dSNelio Laranjeiro
44271960be7dSNelio Laranjeiro testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src
44281960be7dSNelio Laranjeiro         127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
44291960be7dSNelio Laranjeiro         eth-dst 22:22:22:22:22:22
44301960be7dSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions vxlan_encap /
44311960be7dSNelio Laranjeiro         queue index 0 / end
44321960be7dSNelio Laranjeiro
443362e8a5a8SViacheslav Ovsiienko testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-tos 0
443462e8a5a8SViacheslav Ovsiienko         ip-ttl 255 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
443562e8a5a8SViacheslav Ovsiienko         eth-dst 22:22:22:22:22:22
443662e8a5a8SViacheslav Ovsiienko testpmd> flow create 0 ingress pattern end actions vxlan_encap /
443762e8a5a8SViacheslav Ovsiienko         queue index 0 / end
443862e8a5a8SViacheslav Ovsiienko
44391960be7dSNelio LaranjeiroIPv6 VXLAN outer header::
44401960be7dSNelio Laranjeiro
44411960be7dSNelio Laranjeiro testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1
44421960be7dSNelio Laranjeiro        ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
44431960be7dSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions vxlan_encap /
44441960be7dSNelio Laranjeiro         queue index 0 / end
44451960be7dSNelio Laranjeiro
44461960be7dSNelio Laranjeiro testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4
44471960be7dSNelio Laranjeiro         ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11
44481960be7dSNelio Laranjeiro         eth-dst 22:22:22:22:22:22
44491960be7dSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions vxlan_encap /
44501960be7dSNelio Laranjeiro         queue index 0 / end
44511960be7dSNelio Laranjeiro
445262e8a5a8SViacheslav Ovsiienko testpmd> set vxlan-tos-ttl ip-version ipv6 vni 4 udp-src 4 udp-dst 4
445362e8a5a8SViacheslav Ovsiienko         ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
445462e8a5a8SViacheslav Ovsiienko         eth-dst 22:22:22:22:22:22
445562e8a5a8SViacheslav Ovsiienko testpmd> flow create 0 ingress pattern end actions vxlan_encap /
445662e8a5a8SViacheslav Ovsiienko         queue index 0 / end
445762e8a5a8SViacheslav Ovsiienko
4458dcd962fcSNelio LaranjeiroSample NVGRE encapsulation rule
4459dcd962fcSNelio Laranjeiro~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4460dcd962fcSNelio Laranjeiro
4461dcd962fcSNelio LaranjeiroNVGRE encapsulation outer layer has default value pre-configured in testpmd
4462dcd962fcSNelio Laranjeirosource code, those can be changed by using the following commands
4463dcd962fcSNelio Laranjeiro
4464dcd962fcSNelio LaranjeiroIPv4 NVGRE outer header::
4465dcd962fcSNelio Laranjeiro
4466dcd962fcSNelio Laranjeiro testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
4467dcd962fcSNelio Laranjeiro        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4468dcd962fcSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4469dcd962fcSNelio Laranjeiro        queue index 0 / end
4470dcd962fcSNelio Laranjeiro
4471dcd962fcSNelio Laranjeiro testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1
4472dcd962fcSNelio Laranjeiro         ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4473dcd962fcSNelio Laranjeiro         eth-dst 22:22:22:22:22:22
4474dcd962fcSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4475dcd962fcSNelio Laranjeiro         queue index 0 / end
4476dcd962fcSNelio Laranjeiro
4477dcd962fcSNelio LaranjeiroIPv6 NVGRE outer header::
4478dcd962fcSNelio Laranjeiro
4479dcd962fcSNelio Laranjeiro testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4480dcd962fcSNelio Laranjeiro        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4481dcd962fcSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4482dcd962fcSNelio Laranjeiro        queue index 0 / end
4483dcd962fcSNelio Laranjeiro
4484dcd962fcSNelio Laranjeiro testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4485dcd962fcSNelio Laranjeiro        vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4486dcd962fcSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4487dcd962fcSNelio Laranjeiro        queue index 0 / end
4488dcd962fcSNelio Laranjeiro
4489a1191d39SOri KamSample L2 encapsulation rule
4490a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4491a1191d39SOri Kam
4492a1191d39SOri KamL2 encapsulation has default value pre-configured in testpmd
4493a1191d39SOri Kamsource code, those can be changed by using the following commands
4494a1191d39SOri Kam
4495a1191d39SOri KamL2 header::
4496a1191d39SOri Kam
4497a1191d39SOri Kam testpmd> set l2_encap ip-version ipv4
4498a1191d39SOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4499a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4500a1191d39SOri Kam        mplsoudp_decap / l2_encap / end
4501a1191d39SOri Kam
4502a1191d39SOri KamL2 with VXLAN header::
4503a1191d39SOri Kam
4504a1191d39SOri Kam testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34
4505a1191d39SOri Kam         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4506a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4507a1191d39SOri Kam        mplsoudp_decap / l2_encap / end
4508a1191d39SOri Kam
4509a1191d39SOri KamSample L2 decapsulation rule
4510a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4511a1191d39SOri Kam
4512a1191d39SOri KamL2 decapsulation has default value pre-configured in testpmd
4513a1191d39SOri Kamsource code, those can be changed by using the following commands
4514a1191d39SOri Kam
4515a1191d39SOri KamL2 header::
4516a1191d39SOri Kam
4517a1191d39SOri Kam testpmd> set l2_decap
4518a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap /
4519a1191d39SOri Kam        queue index 0 / end
4520a1191d39SOri Kam
4521a1191d39SOri KamL2 with VXLAN header::
4522a1191d39SOri Kam
4523a1191d39SOri Kam testpmd> set l2_encap-with-vlan
4524a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap /
4525a1191d39SOri Kam         queue index 0 / end
4526a1191d39SOri Kam
45273e77031bSOri KamSample MPLSoGRE encapsulation rule
45283e77031bSOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45293e77031bSOri Kam
45303e77031bSOri KamMPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
45313e77031bSOri Kamsource code, those can be changed by using the following commands
45323e77031bSOri Kam
45333e77031bSOri KamIPv4 MPLSoGRE outer header::
45343e77031bSOri Kam
45353e77031bSOri Kam testpmd> set mplsogre_encap ip-version ipv4 label 4
45363e77031bSOri Kam        ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
45373e77031bSOri Kam        eth-dst 22:22:22:22:22:22
45383e77031bSOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
45393e77031bSOri Kam        mplsogre_encap / end
45403e77031bSOri Kam
45413e77031bSOri KamIPv4 MPLSoGRE with VLAN outer header::
45423e77031bSOri Kam
45433e77031bSOri Kam testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4
45443e77031bSOri Kam        ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
45453e77031bSOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
45463e77031bSOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
45473e77031bSOri Kam        mplsogre_encap / end
45483e77031bSOri Kam
45493e77031bSOri KamIPv6 MPLSoGRE outer header::
45503e77031bSOri Kam
45513e77031bSOri Kam testpmd> set mplsogre_encap ip-version ipv6 mask 4
45523e77031bSOri Kam        ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
45533e77031bSOri Kam        eth-dst 22:22:22:22:22:22
45543e77031bSOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
45553e77031bSOri Kam        mplsogre_encap / end
45563e77031bSOri Kam
45573e77031bSOri KamIPv6 MPLSoGRE with VLAN outer header::
45583e77031bSOri Kam
45593e77031bSOri Kam testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4
45603e77031bSOri Kam        ip-src ::1 ip-dst ::2222 vlan-tci 34
45613e77031bSOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
45623e77031bSOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
45633e77031bSOri Kam        mplsogre_encap / end
45643e77031bSOri Kam
45653e77031bSOri KamSample MPLSoGRE decapsulation rule
45663e77031bSOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45673e77031bSOri Kam
45683e77031bSOri KamMPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
45693e77031bSOri Kamsource code, those can be changed by using the following commands
45703e77031bSOri Kam
45713e77031bSOri KamIPv4 MPLSoGRE outer header::
45723e77031bSOri Kam
45733e77031bSOri Kam testpmd> set mplsogre_decap ip-version ipv4
45743e77031bSOri Kam testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions
45753e77031bSOri Kam        mplsogre_decap / l2_encap / end
45763e77031bSOri Kam
45773e77031bSOri KamIPv4 MPLSoGRE with VLAN outer header::
45783e77031bSOri Kam
45793e77031bSOri Kam testpmd> set mplsogre_decap-with-vlan ip-version ipv4
45803e77031bSOri Kam testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end
45813e77031bSOri Kam        actions mplsogre_decap / l2_encap / end
45823e77031bSOri Kam
45833e77031bSOri KamIPv6 MPLSoGRE outer header::
45843e77031bSOri Kam
45853e77031bSOri Kam testpmd> set mplsogre_decap ip-version ipv6
45863e77031bSOri Kam testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end
45873e77031bSOri Kam        actions mplsogre_decap / l2_encap / end
45883e77031bSOri Kam
45893e77031bSOri KamIPv6 MPLSoGRE with VLAN outer header::
45903e77031bSOri Kam
45913e77031bSOri Kam testpmd> set mplsogre_decap-with-vlan ip-version ipv6
45923e77031bSOri Kam testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end
45933e77031bSOri Kam        actions mplsogre_decap / l2_encap / end
45943e77031bSOri Kam
4595a1191d39SOri KamSample MPLSoUDP encapsulation rule
4596a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4597a1191d39SOri Kam
4598a1191d39SOri KamMPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
4599a1191d39SOri Kamsource code, those can be changed by using the following commands
4600a1191d39SOri Kam
4601a1191d39SOri KamIPv4 MPLSoUDP outer header::
4602a1191d39SOri Kam
4603a1191d39SOri Kam testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10
4604a1191d39SOri Kam        ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4605a1191d39SOri Kam        eth-dst 22:22:22:22:22:22
4606a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4607a1191d39SOri Kam        mplsoudp_encap / end
4608a1191d39SOri Kam
4609a1191d39SOri KamIPv4 MPLSoUDP with VLAN outer header::
4610a1191d39SOri Kam
4611a1191d39SOri Kam testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5
4612a1191d39SOri Kam        udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4613a1191d39SOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4614a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4615a1191d39SOri Kam        mplsoudp_encap / end
4616a1191d39SOri Kam
4617a1191d39SOri KamIPv6 MPLSoUDP outer header::
4618a1191d39SOri Kam
4619a1191d39SOri Kam testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10
4620a1191d39SOri Kam        ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4621a1191d39SOri Kam        eth-dst 22:22:22:22:22:22
4622a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4623a1191d39SOri Kam        mplsoudp_encap / end
4624a1191d39SOri Kam
4625a1191d39SOri KamIPv6 MPLSoUDP with VLAN outer header::
4626a1191d39SOri Kam
4627a1191d39SOri Kam testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5
4628a1191d39SOri Kam        udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34
4629a1191d39SOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4630a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4631a1191d39SOri Kam        mplsoudp_encap / end
4632a1191d39SOri Kam
4633a1191d39SOri KamSample MPLSoUDP decapsulation rule
4634a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4635a1191d39SOri Kam
4636a1191d39SOri KamMPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
4637a1191d39SOri Kamsource code, those can be changed by using the following commands
4638a1191d39SOri Kam
4639a1191d39SOri KamIPv4 MPLSoUDP outer header::
4640a1191d39SOri Kam
4641a1191d39SOri Kam testpmd> set mplsoudp_decap ip-version ipv4
4642a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4643a1191d39SOri Kam        mplsoudp_decap / l2_encap / end
4644a1191d39SOri Kam
4645a1191d39SOri KamIPv4 MPLSoUDP with VLAN outer header::
4646a1191d39SOri Kam
4647a1191d39SOri Kam testpmd> set mplsoudp_decap-with-vlan ip-version ipv4
4648a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end
4649a1191d39SOri Kam        actions mplsoudp_decap / l2_encap / end
4650a1191d39SOri Kam
4651a1191d39SOri KamIPv6 MPLSoUDP outer header::
4652a1191d39SOri Kam
4653a1191d39SOri Kam testpmd> set mplsoudp_decap ip-version ipv6
4654a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end
4655a1191d39SOri Kam        actions mplsoudp_decap / l2_encap / end
4656a1191d39SOri Kam
4657a1191d39SOri KamIPv6 MPLSoUDP with VLAN outer header::
4658a1191d39SOri Kam
4659a1191d39SOri Kam testpmd> set mplsoudp_decap-with-vlan ip-version ipv6
4660a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end
4661a1191d39SOri Kam        actions mplsoudp_decap / l2_encap / end
4662a1191d39SOri Kam
466330626defSXiaoyu MinSample Raw encapsulation rule
466430626defSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
466530626defSXiaoyu Min
466630626defSXiaoyu MinRaw encapsulation configuration can be set by the following commands
466730626defSXiaoyu Min
466830626defSXiaoyu MinEecapsulating VxLAN::
466930626defSXiaoyu Min
467030626defSXiaoyu Min testpmd> set raw_encap eth src is 10:11:22:33:44:55 / vlan tci is 1
467130626defSXiaoyu Min        inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni
467230626defSXiaoyu Min        is 2 / end_set
467330626defSXiaoyu Min testpmd> flow create 0 egress pattern eth / ipv4 / end actions
467430626defSXiaoyu Min        raw_encap / end
467530626defSXiaoyu Min
467630626defSXiaoyu MinSample Raw decapsulation rule
467730626defSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
467830626defSXiaoyu Min
467930626defSXiaoyu MinRaw decapsulation configuration can be set by the following commands
468030626defSXiaoyu Min
468130626defSXiaoyu MinDecapsulating VxLAN::
468230626defSXiaoyu Min
468330626defSXiaoyu Min testpmd> set raw_decap eth / ipv4 / udp / vxlan / end_set
468430626defSXiaoyu Min testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 /
468530626defSXiaoyu Min        end actions raw_decap / queue index 0 / end
468630626defSXiaoyu Min
4687e977e419SKonstantin AnanyevBPF Functions
4688e977e419SKonstantin Ananyev--------------
4689e977e419SKonstantin Ananyev
4690e977e419SKonstantin AnanyevThe following sections show functions to load/unload eBPF based filters.
4691e977e419SKonstantin Ananyev
4692e977e419SKonstantin Ananyevbpf-load
4693e977e419SKonstantin Ananyev~~~~~~~~
4694e977e419SKonstantin Ananyev
4695d629b7b5SJohn McNamaraLoad an eBPF program as a callback for particular RX/TX queue::
4696e977e419SKonstantin Ananyev
4697e977e419SKonstantin Ananyev   testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename)
4698e977e419SKonstantin Ananyev
4699e977e419SKonstantin AnanyevThe available load-flags are:
4700e977e419SKonstantin Ananyev
4701e977e419SKonstantin Ananyev* ``J``: use JIT generated native code, otherwise BPF interpreter will be used.
4702e977e419SKonstantin Ananyev
4703e977e419SKonstantin Ananyev* ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data.
4704e977e419SKonstantin Ananyev
4705e977e419SKonstantin Ananyev* ``-``: none.
4706e977e419SKonstantin Ananyev
4707e977e419SKonstantin Ananyev.. note::
4708e977e419SKonstantin Ananyev
4709e977e419SKonstantin Ananyev   You'll need clang v3.7 or above to build bpf program you'd like to load
4710e977e419SKonstantin Ananyev
4711e977e419SKonstantin AnanyevFor example:
4712e977e419SKonstantin Ananyev
4713e977e419SKonstantin Ananyev.. code-block:: console
4714e977e419SKonstantin Ananyev
471525d11a86SBruce Richardson   cd examples/bpf
4716e977e419SKonstantin Ananyev   clang -O2 -target bpf -c t1.c
4717e977e419SKonstantin Ananyev
47187fa1a2deSKevin TraynorThen to load (and JIT compile) t1.o at RX queue 0, port 1:
4719e977e419SKonstantin Ananyev
4720e977e419SKonstantin Ananyev.. code-block:: console
4721e977e419SKonstantin Ananyev
472225d11a86SBruce Richardson   testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
4723e977e419SKonstantin Ananyev
47247fa1a2deSKevin TraynorTo load (not JITed) t1.o at TX queue 0, port 0:
4725e977e419SKonstantin Ananyev
4726e977e419SKonstantin Ananyev.. code-block:: console
4727e977e419SKonstantin Ananyev
472825d11a86SBruce Richardson   testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
4729e977e419SKonstantin Ananyev
4730e977e419SKonstantin Ananyevbpf-unload
4731e977e419SKonstantin Ananyev~~~~~~~~~~
4732e977e419SKonstantin Ananyev
4733d629b7b5SJohn McNamaraUnload previously loaded eBPF program for particular RX/TX queue::
4734e977e419SKonstantin Ananyev
4735e977e419SKonstantin Ananyev   testpmd> bpf-unload rx|tx (portid) (queueid)
4736e977e419SKonstantin Ananyev
4737e977e419SKonstantin AnanyevFor example to unload BPF filter from TX queue 0, port 0:
4738e977e419SKonstantin Ananyev
4739e977e419SKonstantin Ananyev.. code-block:: console
4740e977e419SKonstantin Ananyev
474125d11a86SBruce Richardson   testpmd> bpf-unload tx 0 0
4742