xref: /dpdk/doc/guides/testpmd_app_ug/testpmd_funcs.rst (revision 966eb55e9a009d7575a75a9e7db8ea9f90a21f13)
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
27a2258ea1SHuisong Li       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap X
28a2258ea1SHuisong Li       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all
29a2258ea1SHuisong Li       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap X
30a2258ea1SHuisong Li       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|dcb_tc|cap all
31ac718398SBernard Iremonger       ...
32ac718398SBernard Iremonger
33e76d7a76SJohn McNamara
34e76d7a76SJohn McNamara.. note::
35e76d7a76SJohn McNamara
36f43d3dbbSDavid Marchand   Some examples in this document are too long to fit on one line 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
52592ab76fSDavid Marchand       Help is available for the following sections:
53ac718398SBernard Iremonger
54ac718398SBernard Iremonger           help control                    : Start and stop forwarding.
55ac718398SBernard Iremonger           help display                    : Displaying port, stats and config information.
56ac718398SBernard Iremonger           help config                     : Configuration information.
57ac718398SBernard Iremonger           help ports                      : Configuring ports.
58ac718398SBernard Iremonger           help filters                    : Filters configuration help.
59592ab76fSDavid Marchand           help traffic_management         : Traffic Management commands.
60592ab76fSDavid Marchand           help devices                    : Device related commands.
61592ab76fSDavid Marchand           help drivers                    : Driver specific commands.
62ac718398SBernard Iremonger           help all                        : All of the above sections.
63ac718398SBernard Iremonger
6481ef862bSAllain LegacyCommand File Functions
6581ef862bSAllain Legacy----------------------
6681ef862bSAllain Legacy
6781ef862bSAllain LegacyTo facilitate loading large number of commands or to avoid cutting and pasting where not
6881ef862bSAllain Legacypractical or possible testpmd supports alternative methods for executing commands.
6981ef862bSAllain Legacy
7081ef862bSAllain Legacy* If started with the ``--cmdline-file=FILENAME`` command line argument testpmd
7181ef862bSAllain Legacy  will execute all CLI commands contained within the file immediately before
7281ef862bSAllain Legacy  starting packet forwarding or entering interactive mode.
7381ef862bSAllain Legacy
7481ef862bSAllain Legacy.. code-block:: console
7581ef862bSAllain Legacy
76e2a94f9aSCiara Power   ./dpdk-testpmd -n4 -r2 ... -- -i --cmdline-file=/home/ubuntu/flow-create-commands.txt
7781ef862bSAllain Legacy   Interactive-mode selected
7881ef862bSAllain Legacy   CLI commands to be read from /home/ubuntu/flow-create-commands.txt
7981ef862bSAllain Legacy   Configuring Port 0 (socket 0)
8081ef862bSAllain Legacy   Port 0: 7C:FE:90:CB:74:CE
8181ef862bSAllain Legacy   Configuring Port 1 (socket 0)
8281ef862bSAllain Legacy   Port 1: 7C:FE:90:CB:74:CA
8381ef862bSAllain Legacy   Checking link statuses...
8481ef862bSAllain Legacy   Port 0 Link Up - speed 10000 Mbps - full-duplex
8581ef862bSAllain Legacy   Port 1 Link Up - speed 10000 Mbps - full-duplex
8681ef862bSAllain Legacy   Done
8781ef862bSAllain Legacy   Flow rule #0 created
8881ef862bSAllain Legacy   Flow rule #1 created
8981ef862bSAllain Legacy   ...
9081ef862bSAllain Legacy   ...
9181ef862bSAllain Legacy   Flow rule #498 created
9281ef862bSAllain Legacy   Flow rule #499 created
9381ef862bSAllain Legacy   Read all CLI commands from /home/ubuntu/flow-create-commands.txt
9481ef862bSAllain Legacy   testpmd>
9581ef862bSAllain Legacy
9681ef862bSAllain Legacy
97a8c6a1aeSAllain Legacy* At run-time additional commands can be loaded in bulk by invoking the ``load FILENAME``
98a8c6a1aeSAllain Legacy  command.
99a8c6a1aeSAllain Legacy
100a8c6a1aeSAllain Legacy.. code-block:: console
101a8c6a1aeSAllain Legacy
102a8c6a1aeSAllain Legacy   testpmd> load /home/ubuntu/flow-create-commands.txt
103a8c6a1aeSAllain Legacy   Flow rule #0 created
104a8c6a1aeSAllain Legacy   Flow rule #1 created
105a8c6a1aeSAllain Legacy   ...
106a8c6a1aeSAllain Legacy   ...
107a8c6a1aeSAllain Legacy   Flow rule #498 created
108a8c6a1aeSAllain Legacy   Flow rule #499 created
109a8c6a1aeSAllain Legacy   Read all CLI commands from /home/ubuntu/flow-create-commands.txt
110a8c6a1aeSAllain Legacy   testpmd>
111a8c6a1aeSAllain Legacy
112a8c6a1aeSAllain Legacy
11381ef862bSAllain LegacyIn all cases output from any included command will be displayed as standard output.
11481ef862bSAllain LegacyExecution will continue until the end of the file is reached regardless of
11581ef862bSAllain Legacywhether any errors occur.  The end user must examine the output to determine if
11681ef862bSAllain Legacyany failures occurred.
11781ef862bSAllain Legacy
11881ef862bSAllain Legacy
119ac718398SBernard IremongerControl Functions
120ac718398SBernard Iremonger-----------------
121ac718398SBernard Iremonger
122ac718398SBernard Iremongerstart
123ac718398SBernard Iremonger~~~~~
124ac718398SBernard Iremonger
125e76d7a76SJohn McNamaraStart packet forwarding with current configuration::
126ac718398SBernard Iremonger
127e76d7a76SJohn McNamara   testpmd> start
128ac718398SBernard Iremonger
129ac718398SBernard Iremongerstart tx_first
130ac718398SBernard Iremonger~~~~~~~~~~~~~~
131ac718398SBernard Iremonger
132acbf77a6SZhihong WangStart packet forwarding with current configuration after sending specified number of bursts of packets::
133ac718398SBernard Iremonger
134acbf77a6SZhihong Wang   testpmd> start tx_first (""|burst_num)
135acbf77a6SZhihong Wang
136acbf77a6SZhihong WangThe default burst number is 1 when ``burst_num`` not presented.
137ac718398SBernard Iremonger
138ac718398SBernard Iremongerstop
139ac718398SBernard Iremonger~~~~
140ac718398SBernard Iremonger
141e76d7a76SJohn McNamaraStop packet forwarding, and display accumulated statistics::
142ac718398SBernard Iremonger
143e76d7a76SJohn McNamara   testpmd> stop
144ac718398SBernard Iremonger
145ac718398SBernard Iremongerquit
146ac718398SBernard Iremonger~~~~
147ac718398SBernard Iremonger
148e76d7a76SJohn McNamaraQuit to prompt::
149ac718398SBernard Iremonger
150e76d7a76SJohn McNamara   testpmd> quit
151e76d7a76SJohn McNamara
152ac718398SBernard Iremonger
153ac718398SBernard IremongerDisplay Functions
154ac718398SBernard Iremonger-----------------
155ac718398SBernard Iremonger
156ac718398SBernard IremongerThe functions in the following sections are used to display information about the
157ac718398SBernard Iremongertestpmd configuration or the NIC status.
158ac718398SBernard Iremonger
159ac718398SBernard Iremongershow port
160ac718398SBernard Iremonger~~~~~~~~~
161ac718398SBernard Iremonger
162e76d7a76SJohn McNamaraDisplay information for a given port or all ports::
163ac718398SBernard Iremonger
164a2258ea1SHuisong Li   testpmd> show port (info|summary|stats|xstats|fdir|dcb_tc|cap) (port_id|all)
165ac718398SBernard Iremonger
166ac718398SBernard IremongerThe available information categories are:
167ac718398SBernard Iremonger
168e76d7a76SJohn McNamara* ``info``: General port information such as MAC address.
169ac718398SBernard Iremonger
1704bfcbcf5SEmma Finn* ``summary``: Brief port summary such as Device Name, Driver Name etc.
1714bfcbcf5SEmma Finn
172e76d7a76SJohn McNamara* ``stats``: RX/TX statistics.
173ac718398SBernard Iremonger
1740e51eb87SMaryam Tahhan* ``xstats``: RX/TX extended NIC statistics.
1750e51eb87SMaryam Tahhan
176e76d7a76SJohn McNamara* ``fdir``: Flow Director information and statistics.
177ac718398SBernard Iremonger
178cd80f411SJingjing Wu* ``dcb_tc``: DCB information such as TC mapping.
179cd80f411SJingjing Wu
180ac718398SBernard IremongerFor example:
181ac718398SBernard Iremonger
182ac718398SBernard Iremonger.. code-block:: console
183ac718398SBernard Iremonger
184ac718398SBernard Iremonger   testpmd> show port info 0
185ac718398SBernard Iremonger
186ac718398SBernard Iremonger   ********************* Infos for port 0 *********************
187ac718398SBernard Iremonger
188ac718398SBernard Iremonger   MAC address: XX:XX:XX:XX:XX:XX
189ef7d2866SHelin Zhang   Connect to socket: 0
190ef7d2866SHelin Zhang   memory allocation on the socket: 0
191ac718398SBernard Iremonger   Link status: up
192ef7d2866SHelin Zhang   Link speed: 40000 Mbps
193ac718398SBernard Iremonger   Link duplex: full-duplex
194ac718398SBernard Iremonger   Promiscuous mode: enabled
195ac718398SBernard Iremonger   Allmulticast mode: disabled
196ef7d2866SHelin Zhang   Maximum number of MAC addresses: 64
197ef7d2866SHelin Zhang   Maximum number of MAC addresses of hash filtering: 0
198ac718398SBernard Iremonger   VLAN offload:
1992a0b4198SVivek Sharma       strip on, filter on, extend off, qinq strip off
200ef7d2866SHelin Zhang   Redirection table size: 512
201ef7d2866SHelin Zhang   Supported flow types:
202ef7d2866SHelin Zhang     ipv4-frag
203ef7d2866SHelin Zhang     ipv4-tcp
204ef7d2866SHelin Zhang     ipv4-udp
205ef7d2866SHelin Zhang     ipv4-sctp
206ef7d2866SHelin Zhang     ipv4-other
207ef7d2866SHelin Zhang     ipv6-frag
208ef7d2866SHelin Zhang     ipv6-tcp
209ef7d2866SHelin Zhang     ipv6-udp
210ef7d2866SHelin Zhang     ipv6-sctp
211ef7d2866SHelin Zhang     ipv6-other
212ef7d2866SHelin Zhang     l2_payload
213f56620ddSJerin Jacob     port
214f56620ddSJerin Jacob     vxlan
215f56620ddSJerin Jacob     geneve
216f56620ddSJerin Jacob     nvgre
2171aec68d1SQiming Yang     vxlan-gpe
218ac718398SBernard Iremonger
2196b67721dSDavid Liushow port (module_eeprom|eeprom)
2206b67721dSDavid Liu~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2216b67721dSDavid Liu
2226b67721dSDavid LiuDisplay the EEPROM information of a port::
2236b67721dSDavid Liu
2246b67721dSDavid Liu   testpmd> show port (port_id) (module_eeprom|eeprom)
2256b67721dSDavid Liu
2266fe5f2f7SPablo de Larashow port rss reta
2276fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~~
2286fe5f2f7SPablo de Lara
229e76d7a76SJohn McNamaraDisplay the rss redirection table entry indicated by masks on port X::
2306fe5f2f7SPablo de Lara
231e76d7a76SJohn McNamara   testpmd> show port (port_id) rss reta (size) (mask0, mask1...)
2326fe5f2f7SPablo de Lara
2336fe5f2f7SPablo de Larasize is used to indicate the hardware supported reta size
2346fe5f2f7SPablo de Lara
235ac718398SBernard Iremongershow port rss-hash
236ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~
237ac718398SBernard Iremonger
238e76d7a76SJohn McNamaraDisplay the RSS hash functions and RSS hash key of a port::
239ac718398SBernard Iremonger
2405b4557ecSFerruh Yigit   testpmd> show port (port_id) rss-hash [key]
2415e2d17aeSPablo de Lara
2425e2d17aeSPablo de Laraclear port
2435e2d17aeSPablo de Lara~~~~~~~~~~
244ac718398SBernard Iremonger
2459eb97422SWei Hu (Xavier)Clear the port statistics and forward engine statistics for a given port or for all ports::
246ac718398SBernard Iremonger
247a2258ea1SHuisong Li   testpmd> clear port (info|stats|xstats|fdir) (port_id|all)
248ac718398SBernard Iremonger
249e76d7a76SJohn McNamaraFor example::
250ac718398SBernard Iremonger
251ac718398SBernard Iremonger   testpmd> clear port stats all
252ac718398SBernard Iremonger
25357ccb278SKonstantin Ananyevshow (rxq|txq)
25457ccb278SKonstantin Ananyev~~~~~~~~~~~~~~
25557ccb278SKonstantin Ananyev
25657ccb278SKonstantin AnanyevDisplay information for a given port's RX/TX queue::
25757ccb278SKonstantin Ananyev
25857ccb278SKonstantin Ananyev   testpmd> show (rxq|txq) info (port_id) (queue_id)
25957ccb278SKonstantin Ananyev
260fae9aa71SKiran Kumar Kshow desc status(rxq|txq)
261fae9aa71SKiran Kumar K~~~~~~~~~~~~~~~~~~~~~~~~~
262fae9aa71SKiran Kumar K
263fae9aa71SKiran Kumar KDisplay information for a given port's RX/TX descriptor status::
264fae9aa71SKiran Kumar K
265fae9aa71SKiran Kumar K   testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status
266fae9aa71SKiran Kumar K
2676f04fa45SLance Richardsonshow rxq desc used count
2686f04fa45SLance Richardson~~~~~~~~~~~~~~~~~~~~~~~~
2696f04fa45SLance Richardson
2706f04fa45SLance RichardsonDisplay the number of receive packet descriptors currently filled by hardware
2716f04fa45SLance Richardsonand ready to be processed by the driver on a given RX queue::
2726f04fa45SLance Richardson
2736f04fa45SLance Richardson   testpmd> show port (port_id) rxq (queue_id) desc used count
274fae9aa71SKiran Kumar K
275ac718398SBernard Iremongershow config
276ac718398SBernard Iremonger~~~~~~~~~~~
277ac718398SBernard Iremonger
278ac718398SBernard IremongerDisplays the configuration of the application.
279e76d7a76SJohn McNamaraThe configuration comes from the command-line, the runtime or the application defaults::
280ac718398SBernard Iremonger
28152e2e7edSYuan Wang   testpmd> show config (rxtx|cores|fwd|rxoffs|rxpkts|rxhdrs|txpkts|txtimes)
282ac718398SBernard Iremonger
283ac718398SBernard IremongerThe available information categories are:
284ac718398SBernard Iremonger
285e76d7a76SJohn McNamara* ``rxtx``: RX/TX configuration items.
286ac718398SBernard Iremonger
287e76d7a76SJohn McNamara* ``cores``: List of forwarding cores.
288ac718398SBernard Iremonger
289e76d7a76SJohn McNamara* ``fwd``: Packet forwarding configuration.
290ac718398SBernard Iremonger
29191c78e09SViacheslav Ovsiienko* ``rxoffs``: Packet offsets for RX split.
29291c78e09SViacheslav Ovsiienko
29352e2e7edSYuan Wang* ``rxpkts``: Packets to RX length-based split configuration.
29452e2e7edSYuan Wang
29552e2e7edSYuan Wang* ``rxhdrs``: Packets to RX proto-based split configuration.
2960f2096d7SViacheslav Ovsiienko
29779bec05bSKonstantin Ananyev* ``txpkts``: Packets to TX configuration.
29879bec05bSKonstantin Ananyev
2994940344dSViacheslav Ovsiienko* ``txtimes``: Burst time pattern for Tx only mode.
3004940344dSViacheslav Ovsiienko
301ac718398SBernard IremongerFor example:
302ac718398SBernard Iremonger
303ac718398SBernard Iremonger.. code-block:: console
304ac718398SBernard Iremonger
305ac718398SBernard Iremonger   testpmd> show config rxtx
306ac718398SBernard Iremonger
307ac718398SBernard Iremonger   io packet forwarding - CRC stripping disabled - packets/burst=16
308ac718398SBernard Iremonger   nb forwarding cores=2 - nb forwarding ports=1
309ac718398SBernard Iremonger   RX queues=1 - RX desc=128 - RX free threshold=0
310ac718398SBernard Iremonger   RX threshold registers: pthresh=8 hthresh=8 wthresh=4
311ac718398SBernard Iremonger   TX queues=1 - TX desc=512 - TX free threshold=0
312ac718398SBernard Iremonger   TX threshold registers: pthresh=36 hthresh=0 wthresh=0
313ac718398SBernard Iremonger   TX RS bit threshold=0 - TXQ flags=0x0
314ac718398SBernard Iremonger
315e76d7a76SJohn McNamaraset fwd
316e76d7a76SJohn McNamara~~~~~~~
317e76d7a76SJohn McNamara
318e76d7a76SJohn McNamaraSet the packet forwarding mode::
319e76d7a76SJohn McNamara
320bf56fce1SZhihong Wang   testpmd> set fwd (io|mac|macswap|flowgen| \
32159840375SXueming Li                     rxonly|txonly|csum|icmpecho|noisy|5tswap|shared-rxq) (""|retry)
322bf56fce1SZhihong Wang
323bf56fce1SZhihong Wang``retry`` can be specified for forwarding engines except ``rx_only``.
324e76d7a76SJohn McNamara
325e76d7a76SJohn McNamaraThe available information categories are:
326e76d7a76SJohn McNamara
327e76d7a76SJohn McNamara* ``io``: Forwards packets "as-is" in I/O mode.
328e76d7a76SJohn McNamara  This is the fastest possible forwarding operation as it does not access packets data.
329e76d7a76SJohn McNamara  This is the default mode.
330e76d7a76SJohn McNamara
331e76d7a76SJohn McNamara* ``mac``: Changes the source and the destination Ethernet addresses of packets before forwarding them.
332d629b7b5SJohn McNamara  Default application behavior is to set source Ethernet address to that of the transmitting interface, and destination
333a67857e9SMark Kavanagh  address to a dummy value (set during init). The user may specify a target destination Ethernet address via the 'eth-peer' or
334132a08b5SRami Rosen  'eth-peers-configfile' command-line options. It is not currently possible to specify a specific source Ethernet address.
335e76d7a76SJohn McNamara
336e76d7a76SJohn McNamara* ``macswap``: MAC swap forwarding mode.
337e76d7a76SJohn McNamara  Swaps the source and the destination Ethernet addresses of packets before forwarding them.
338e76d7a76SJohn McNamara
339e76d7a76SJohn McNamara* ``flowgen``: Multi-flow generation mode.
340e76d7a76SJohn McNamara  Originates a number of flows (with varying destination IP addresses), and terminate receive traffic.
341e76d7a76SJohn McNamara
342e76d7a76SJohn McNamara* ``rxonly``: Receives packets but doesn't transmit them.
343e76d7a76SJohn McNamara
344e76d7a76SJohn McNamara* ``txonly``: Generates and transmits packets without receiving any.
345e76d7a76SJohn McNamara
346e76d7a76SJohn McNamara* ``csum``: Changes the checksum field with hardware or software methods depending on the offload flags on the packet.
347e76d7a76SJohn McNamara
34810ad83d0SRami Rosen* ``icmpecho``: Receives a burst of packets, lookup for ICMP echo requests and, if any, send back ICMP echo replies.
349e76d7a76SJohn McNamara
350e2a94f9aSCiara Power* ``ieee1588``: Demonstrate L2 IEEE1588 V2 PTP timestamping for RX and TX.
351e76d7a76SJohn McNamara
352d629b7b5SJohn McNamara* ``noisy``: Noisy neighbor simulation.
3533c156061SJens Freimann  Simulate more realistic behavior of a guest machine engaged in receiving
3543c156061SJens Freimann  and sending packets performing Virtual Network Function (VNF).
3553c156061SJens Freimann
3562564abdaSShiri Kuzin* ``5tswap``: Swap the source and destination of L2,L3,L4 if they exist.
3572564abdaSShiri Kuzin
3582564abdaSShiri Kuzin  L2 swaps the source address and destination address of Ethernet, as same as ``macswap``.
3592564abdaSShiri Kuzin
3602564abdaSShiri Kuzin  L3 swaps the source address and destination address of IP (v4 and v6).
3612564abdaSShiri Kuzin
3622564abdaSShiri Kuzin  L4 swaps the source port and destination port of transport layer (TCP and UDP).
3632564abdaSShiri Kuzin
36459840375SXueming Li* ``shared-rxq``: Receive only for shared Rx queue.
36559840375SXueming Li  Resolve packet source port from mbuf and update stream statistics accordingly.
36659840375SXueming Li
367e76d7a76SJohn McNamaraExample::
368e76d7a76SJohn McNamara
369e76d7a76SJohn McNamara   testpmd> set fwd rxonly
370e76d7a76SJohn McNamara
371e76d7a76SJohn McNamara   Set rxonly packet forwarding mode
372e76d7a76SJohn McNamara
373e76d7a76SJohn McNamara
37453324971SDavid Marchandshow fwd
37553324971SDavid Marchand~~~~~~~~
37653324971SDavid Marchand
37753324971SDavid MarchandWhen running, forwarding engines maintain statistics from the time they have been started.
37853324971SDavid MarchandExample for the io forwarding engine, with some packet drops on the tx side::
37953324971SDavid Marchand
38053324971SDavid Marchand   testpmd> show fwd stats all
38153324971SDavid Marchand
38253324971SDavid Marchand     ------- Forward Stats for RX Port= 0/Queue= 0 -> TX Port= 1/Queue= 0 -------
38353324971SDavid Marchand     RX-packets: 274293770      TX-packets: 274293642      TX-dropped: 128
38453324971SDavid Marchand
38553324971SDavid Marchand     ------- Forward Stats for RX Port= 1/Queue= 0 -> TX Port= 0/Queue= 0 -------
38653324971SDavid Marchand     RX-packets: 274301850      TX-packets: 274301850      TX-dropped: 0
38753324971SDavid Marchand
38853324971SDavid Marchand     ---------------------- Forward statistics for port 0  ----------------------
38953324971SDavid Marchand     RX-packets: 274293802      RX-dropped: 0             RX-total: 274293802
39053324971SDavid Marchand     TX-packets: 274301862      TX-dropped: 0             TX-total: 274301862
39153324971SDavid Marchand     ----------------------------------------------------------------------------
39253324971SDavid Marchand
39353324971SDavid Marchand     ---------------------- Forward statistics for port 1  ----------------------
39453324971SDavid Marchand     RX-packets: 274301894      RX-dropped: 0             RX-total: 274301894
39553324971SDavid Marchand     TX-packets: 274293706      TX-dropped: 128           TX-total: 274293834
39653324971SDavid Marchand     ----------------------------------------------------------------------------
39753324971SDavid Marchand
39853324971SDavid Marchand     +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
39953324971SDavid Marchand     RX-packets: 548595696      RX-dropped: 0             RX-total: 548595696
40053324971SDavid Marchand     TX-packets: 548595568      TX-dropped: 128           TX-total: 548595696
40153324971SDavid Marchand     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
40253324971SDavid Marchand
4036d249887SDharmik Thakkar
40453324971SDavid Marchandclear fwd
40553324971SDavid Marchand~~~~~~~~~
40653324971SDavid Marchand
40753324971SDavid MarchandClear the forwarding engines statistics::
40853324971SDavid Marchand
40953324971SDavid Marchand   testpmd> clear fwd stats all
41053324971SDavid Marchand
411ac718398SBernard Iremongerread rxd
412ac718398SBernard Iremonger~~~~~~~~
413ac718398SBernard Iremonger
414e76d7a76SJohn McNamaraDisplay an RX descriptor for a port RX queue::
415ac718398SBernard Iremonger
416e76d7a76SJohn McNamara   testpmd> read rxd (port_id) (queue_id) (rxd_id)
417ac718398SBernard Iremonger
418e76d7a76SJohn McNamaraFor example::
419ac718398SBernard Iremonger
420ac718398SBernard Iremonger   testpmd> read rxd 0 0 4
421ac718398SBernard Iremonger        0x0000000B - 0x001D0180 / 0x0000000B - 0x001D0180
422ac718398SBernard Iremonger
423ac718398SBernard Iremongerread txd
424ac718398SBernard Iremonger~~~~~~~~
425ac718398SBernard Iremonger
426e76d7a76SJohn McNamaraDisplay a TX descriptor for a port TX queue::
427ac718398SBernard Iremonger
428e76d7a76SJohn McNamara   testpmd> read txd (port_id) (queue_id) (txd_id)
429ac718398SBernard Iremonger
430e76d7a76SJohn McNamaraFor example::
431ac718398SBernard Iremonger
432ac718398SBernard Iremonger   testpmd> read txd 0 0 4
433ac718398SBernard Iremonger        0x00000001 - 0x24C3C440 / 0x000F0000 - 0x2330003C
434ac718398SBernard Iremonger
4358c32c192SQi Zhangshow vf stats
4368c32c192SQi Zhang~~~~~~~~~~~~~
4378c32c192SQi Zhang
4388c32c192SQi ZhangDisplay VF statistics::
4398c32c192SQi Zhang
4408c32c192SQi Zhang   testpmd> show vf stats (port_id) (vf_id)
4418c32c192SQi Zhang
4428c32c192SQi Zhangclear vf stats
4438c32c192SQi Zhang~~~~~~~~~~~~~~
4448c32c192SQi Zhang
4458c32c192SQi ZhangReset VF statistics::
4468c32c192SQi Zhang
4478c32c192SQi Zhang   testpmd> clear vf stats (port_id) (vf_id)
448e76d7a76SJohn McNamara
449c73a9071SWei Daishow rx offloading capabilities
450c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
451c73a9071SWei Dai
452c73a9071SWei DaiList all per queue and per port Rx offloading capabilities of a port::
453c73a9071SWei Dai
454c73a9071SWei Dai   testpmd> show port (port_id) rx_offload capabilities
455c73a9071SWei Dai
456c73a9071SWei Daishow rx offloading configuration
457c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
458c73a9071SWei Dai
459c73a9071SWei DaiList port level and all queue level Rx offloading configuration::
460c73a9071SWei Dai
461c73a9071SWei Dai   testpmd> show port (port_id) rx_offload configuration
462c73a9071SWei Dai
463c73a9071SWei Daishow tx offloading capabilities
464c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
465c73a9071SWei Dai
466c73a9071SWei DaiList all per queue and per port Tx offloading capabilities of a port::
467c73a9071SWei Dai
468c73a9071SWei Dai   testpmd> show port (port_id) tx_offload capabilities
469c73a9071SWei Dai
470c73a9071SWei Daishow tx offloading configuration
471c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
472c73a9071SWei Dai
473c73a9071SWei DaiList port level and all queue level Tx offloading configuration::
474c73a9071SWei Dai
475c73a9071SWei Dai   testpmd> show port (port_id) tx_offload configuration
476c73a9071SWei Dai
477c18feafaSDekel Peledshow tx metadata setting
478c18feafaSDekel Peled~~~~~~~~~~~~~~~~~~~~~~~~
479c18feafaSDekel Peled
480c18feafaSDekel PeledShow Tx metadata value set for a specific port::
481c18feafaSDekel Peled
482c18feafaSDekel Peled   testpmd> show port (port_id) tx_metadata
4835a4806d3SKirill Rybalchenko
4849e06e39bSVamsi Attunurushow port supported ptypes
4859e06e39bSVamsi Attunuru~~~~~~~~~~~~~~~~~~~~~~~~~~
4869e06e39bSVamsi Attunuru
4879e06e39bSVamsi AttunuruShow ptypes supported for a specific port::
4889e06e39bSVamsi Attunuru
4899e06e39bSVamsi Attunuru   testpmd> show port (port_id) ptypes
4909e06e39bSVamsi Attunuru
491e48491afSPavan Nikhileshset port supported ptypes
492e48491afSPavan Nikhilesh~~~~~~~~~~~~~~~~~~~~~~~~~
493e48491afSPavan Nikhilesh
494e48491afSPavan Nikhileshset packet types classification for a specific port::
495e48491afSPavan Nikhilesh
496e48491afSPavan Nikhilesh   testpmd> set port (port_id) ptypes_mask (mask)
497e48491afSPavan Nikhilesh
498e1d44d0aSKalesh APshow port mac addresses info
499e1d44d0aSKalesh AP~~~~~~~~~~~~~~~~~~~~~~~~~~~~
500e1d44d0aSKalesh AP
501e1d44d0aSKalesh APShow mac addresses added for a specific port::
502e1d44d0aSKalesh AP
503e1d44d0aSKalesh AP   testpmd> show port (port_id) macs
504e1d44d0aSKalesh AP
505e1d44d0aSKalesh AP
506e1d44d0aSKalesh APshow port multicast mac addresses info
507e1d44d0aSKalesh AP~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
508e1d44d0aSKalesh AP
509e1d44d0aSKalesh APShow multicast mac addresses added for a specific port::
510e1d44d0aSKalesh AP
511e1d44d0aSKalesh AP   testpmd> show port (port_id) mcast_macs
512e1d44d0aSKalesh AP
5132490bb89SIvan Malovshow flow transfer proxy port ID for the given port
5142490bb89SIvan Malov~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5152490bb89SIvan Malov
5162490bb89SIvan MalovShow proxy port ID to use as the 1st argument in commands to
5172490bb89SIvan Malovmanage ``transfer`` flows and their indirect components.
5182490bb89SIvan Malov::
5192490bb89SIvan Malov
5202490bb89SIvan Malov   testpmd> show port (port_id) flow transfer proxy
5212490bb89SIvan Malov
52255e51c96SNithin Dabilpuramshow device info
52355e51c96SNithin Dabilpuram~~~~~~~~~~~~~~~~
52455e51c96SNithin Dabilpuram
52555e51c96SNithin DabilpuramShow general information about devices probed::
52655e51c96SNithin Dabilpuram
52755e51c96SNithin Dabilpuram   testpmd> show device info (<identifier>|all)
52855e51c96SNithin Dabilpuram
52955e51c96SNithin DabilpuramFor example:
53055e51c96SNithin Dabilpuram
53155e51c96SNithin Dabilpuram.. code-block:: console
53255e51c96SNithin Dabilpuram
53355e51c96SNithin Dabilpuram    testpmd> show device info net_pcap0
53455e51c96SNithin Dabilpuram
53555e51c96SNithin Dabilpuram    ********************* Infos for device net_pcap0 *********************
53655e51c96SNithin Dabilpuram    Bus name: vdev
53755e51c96SNithin Dabilpuram    Driver name: net_pcap
53855e51c96SNithin Dabilpuram    Devargs: iface=enP2p6s0,phy_mac=1
53955e51c96SNithin Dabilpuram    Connect to socket: -1
54055e51c96SNithin Dabilpuram
54155e51c96SNithin Dabilpuram            Port id: 2
54255e51c96SNithin Dabilpuram            MAC address: 1E:37:93:28:04:B8
54355e51c96SNithin Dabilpuram            Device name: net_pcap0
54455e51c96SNithin Dabilpuram
545d82ee2ccSAgalya Babu RadhaKrishnandump physmem
546d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~
547d82ee2ccSAgalya Babu RadhaKrishnan
548d82ee2ccSAgalya Babu RadhaKrishnanDumps all physical memory segment layouts::
549d82ee2ccSAgalya Babu RadhaKrishnan
550d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_physmem
551d82ee2ccSAgalya Babu RadhaKrishnan
552d82ee2ccSAgalya Babu RadhaKrishnandump memzone
553d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~
554d82ee2ccSAgalya Babu RadhaKrishnan
555d82ee2ccSAgalya Babu RadhaKrishnanDumps the layout of all memory zones::
556d82ee2ccSAgalya Babu RadhaKrishnan
557d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_memzone
558d82ee2ccSAgalya Babu RadhaKrishnan
5599b1249d9SXueming Lidump socket memory
5609b1249d9SXueming Li~~~~~~~~~~~~~~~~~~
5619b1249d9SXueming Li
5629b1249d9SXueming LiDumps the memory usage of all sockets::
5639b1249d9SXueming Li
5649b1249d9SXueming Li   testpmd> dump_socket_mem
565d82ee2ccSAgalya Babu RadhaKrishnan
566d82ee2ccSAgalya Babu RadhaKrishnandump struct size
567d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~~
568d82ee2ccSAgalya Babu RadhaKrishnan
569d82ee2ccSAgalya Babu RadhaKrishnanDumps the size of all memory structures::
570d82ee2ccSAgalya Babu RadhaKrishnan
571d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_struct_sizes
572d82ee2ccSAgalya Babu RadhaKrishnan
573d82ee2ccSAgalya Babu RadhaKrishnandump ring
574d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~
575d82ee2ccSAgalya Babu RadhaKrishnan
576d82ee2ccSAgalya Babu RadhaKrishnanDumps the status of all or specific element in DPDK rings::
577d82ee2ccSAgalya Babu RadhaKrishnan
578d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_ring [ring_name]
579d82ee2ccSAgalya Babu RadhaKrishnan
580d82ee2ccSAgalya Babu RadhaKrishnandump mempool
581d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~
582d82ee2ccSAgalya Babu RadhaKrishnan
583d82ee2ccSAgalya Babu RadhaKrishnanDumps the statistics of all or specific memory pool::
584d82ee2ccSAgalya Babu RadhaKrishnan
585d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_mempool [mempool_name]
586d82ee2ccSAgalya Babu RadhaKrishnan
587d82ee2ccSAgalya Babu RadhaKrishnandump devargs
588d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~
589d82ee2ccSAgalya Babu RadhaKrishnan
590d82ee2ccSAgalya Babu RadhaKrishnanDumps the user device list::
591d82ee2ccSAgalya Babu RadhaKrishnan
592d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_devargs
593d82ee2ccSAgalya Babu RadhaKrishnan
594d82ee2ccSAgalya Babu RadhaKrishnandump log types
595d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~
596d82ee2ccSAgalya Babu RadhaKrishnan
597d82ee2ccSAgalya Babu RadhaKrishnanDumps the log level for all the dpdk modules::
598d82ee2ccSAgalya Babu RadhaKrishnan
599d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> dump_log_types
600d82ee2ccSAgalya Babu RadhaKrishnan
601739e045bSXiaoyu Minshow (raw_encap|raw_decap)
602739e045bSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~~~
603739e045bSXiaoyu Min
604739e045bSXiaoyu MinDisplay content of raw_encap/raw_decap buffers in hex::
605739e045bSXiaoyu Min
606739e045bSXiaoyu Min  testpmd> show <raw_encap|raw_decap> <index>
607739e045bSXiaoyu Min  testpmd> show <raw_encap|raw_decap> all
608739e045bSXiaoyu Min
609739e045bSXiaoyu MinFor example::
610739e045bSXiaoyu Min
611739e045bSXiaoyu Min  testpmd> show raw_encap 6
612739e045bSXiaoyu Min
613739e045bSXiaoyu Min  index: 6 at [0x1c565b0], len=50
614739e045bSXiaoyu Min  00000000: 00 00 00 00 00 00 16 26 36 46 56 66 08 00 45 00 | .......&6FVf..E.
615739e045bSXiaoyu Min  00000010: 00 00 00 00 00 00 00 11 00 00 C0 A8 01 06 C0 A8 | ................
616739e045bSXiaoyu Min  00000020: 03 06 00 00 00 FA 00 00 00 00 08 00 00 00 00 00 | ................
617739e045bSXiaoyu Min  00000030: 06 00                                           | ..
618739e045bSXiaoyu Min
619b19da32eSMin Hu (Connor)show fec capabilities
620b19da32eSMin Hu (Connor)~~~~~~~~~~~~~~~~~~~~~
621b19da32eSMin Hu (Connor)
622b19da32eSMin Hu (Connor)Show fec capabilities of a port::
623b19da32eSMin Hu (Connor)
624b19da32eSMin Hu (Connor)  testpmd> show port (port_id) fec capabilities
625b19da32eSMin Hu (Connor)
626b19da32eSMin Hu (Connor)show fec mode
627b19da32eSMin Hu (Connor)~~~~~~~~~~~~~
628b19da32eSMin Hu (Connor)
629b19da32eSMin Hu (Connor)Show fec mode of a port::
630b19da32eSMin Hu (Connor)
631b19da32eSMin Hu (Connor)  testpmd> show port (port_id) fec_mode
632b19da32eSMin Hu (Connor)
633739e045bSXiaoyu Min
634ac718398SBernard IremongerConfiguration Functions
635ac718398SBernard Iremonger-----------------------
636ac718398SBernard Iremonger
637ac718398SBernard IremongerThe testpmd application can be configured from the runtime as well as from the command-line.
638ac718398SBernard Iremonger
639ac718398SBernard IremongerThis section details the available configuration functions that are available.
640ac718398SBernard Iremonger
641ac718398SBernard Iremonger.. note::
642ac718398SBernard Iremonger
643ac718398SBernard Iremonger   Configuration changes only become active when forwarding is started/restarted.
644ac718398SBernard Iremonger
645ac718398SBernard Iremongerset default
646ac718398SBernard Iremonger~~~~~~~~~~~
647ac718398SBernard Iremonger
648e76d7a76SJohn McNamaraReset forwarding to the default configuration::
649ac718398SBernard Iremonger
650e76d7a76SJohn McNamara   testpmd> set default
651ac718398SBernard Iremonger
652ac718398SBernard Iremongerset verbose
653ac718398SBernard Iremonger~~~~~~~~~~~
654ac718398SBernard Iremonger
655e76d7a76SJohn McNamaraSet the debug verbosity level::
656ac718398SBernard Iremonger
657e76d7a76SJohn McNamara   testpmd> set verbose (level)
658ac718398SBernard Iremonger
659b5b38ed8SRaslan DarawshehAvailable levels are as following:
660b5b38ed8SRaslan Darawsheh
661b5b38ed8SRaslan Darawsheh* ``0`` silent except for error.
662b5b38ed8SRaslan Darawsheh* ``1`` fully verbose except for Tx packets.
663b5b38ed8SRaslan Darawsheh* ``2`` fully verbose except for Rx packets.
664b5b38ed8SRaslan Darawsheh* ``> 2`` fully verbose.
665ac718398SBernard Iremonger
666c7217b9dSElza Mathewset log
667c7217b9dSElza Mathew~~~~~~~
668c7217b9dSElza Mathew
669c7217b9dSElza MathewSet the log level for a log type::
670c7217b9dSElza Mathew
671c7217b9dSElza Mathew	testpmd> set log global|(type) (level)
672c7217b9dSElza Mathew
673c7217b9dSElza MathewWhere:
674c7217b9dSElza Mathew
675c7217b9dSElza Mathew* ``type`` is the log name.
676c7217b9dSElza Mathew
677c7217b9dSElza Mathew* ``level`` is the log level.
678c7217b9dSElza Mathew
679c7217b9dSElza MathewFor example, to change the global log level::
6807fa1a2deSKevin Traynor
681c7217b9dSElza Mathew	testpmd> set log global (level)
682c7217b9dSElza Mathew
683c7217b9dSElza MathewRegexes can also be used for type. To change log level of user1, user2 and user3::
6847fa1a2deSKevin Traynor
685c7217b9dSElza Mathew	testpmd> set log user[1-3] (level)
686c7217b9dSElza Mathew
687ac718398SBernard Iremongerset nbport
688ac718398SBernard Iremonger~~~~~~~~~~
689ac718398SBernard Iremonger
690ac718398SBernard IremongerSet the number of ports used by the application:
691ac718398SBernard Iremonger
692ac718398SBernard Iremongerset nbport (num)
693ac718398SBernard Iremonger
694e76d7a76SJohn McNamaraThis is equivalent to the ``--nb-ports`` command-line option.
695ac718398SBernard Iremonger
696ac718398SBernard Iremongerset nbcore
697ac718398SBernard Iremonger~~~~~~~~~~
698ac718398SBernard Iremonger
699e76d7a76SJohn McNamaraSet the number of cores used by the application::
700ac718398SBernard Iremonger
701e76d7a76SJohn McNamara   testpmd> set nbcore (num)
702ac718398SBernard Iremonger
703e76d7a76SJohn McNamaraThis is equivalent to the ``--nb-cores`` command-line option.
704ac718398SBernard Iremonger
705ac718398SBernard Iremonger.. note::
706ac718398SBernard Iremonger
707ac718398SBernard Iremonger   The number of cores used must not be greater than number of ports used multiplied by the number of queues per port.
708ac718398SBernard Iremonger
709ac718398SBernard Iremongerset coremask
710ac718398SBernard Iremonger~~~~~~~~~~~~
711ac718398SBernard Iremonger
712e76d7a76SJohn McNamaraSet the forwarding cores hexadecimal mask::
713ac718398SBernard Iremonger
714e76d7a76SJohn McNamara   testpmd> set coremask (mask)
715ac718398SBernard Iremonger
716e76d7a76SJohn McNamaraThis is equivalent to the ``--coremask`` command-line option.
717ac718398SBernard Iremonger
718ac718398SBernard Iremonger.. note::
719ac718398SBernard Iremonger
720cb056611SStephen Hemminger   The main lcore is reserved for command line parsing only and cannot be masked on for packet forwarding.
721ac718398SBernard Iremonger
722ac718398SBernard Iremongerset portmask
723ac718398SBernard Iremonger~~~~~~~~~~~~
724ac718398SBernard Iremonger
725e76d7a76SJohn McNamaraSet the forwarding ports hexadecimal mask::
726ac718398SBernard Iremonger
727e76d7a76SJohn McNamara   testpmd> set portmask (mask)
728ac718398SBernard Iremonger
729e76d7a76SJohn McNamaraThis is equivalent to the ``--portmask`` command-line option.
730ac718398SBernard Iremonger
731bc700b67SDharmik Thakkarset record-core-cycles
732bc700b67SDharmik Thakkar~~~~~~~~~~~~~~~~~~~~~~
733bc700b67SDharmik Thakkar
734bc700b67SDharmik ThakkarSet the recording of CPU cycles::
735bc700b67SDharmik Thakkar
736bc700b67SDharmik Thakkar   testpmd> set record-core-cycles (on|off)
737bc700b67SDharmik Thakkar
738bc700b67SDharmik ThakkarWhere:
739bc700b67SDharmik Thakkar
740bc700b67SDharmik Thakkar* ``on`` enables measurement of CPU cycles per packet.
741bc700b67SDharmik Thakkar
742bc700b67SDharmik Thakkar* ``off`` disables measurement of CPU cycles per packet.
743bc700b67SDharmik Thakkar
744bc700b67SDharmik ThakkarThis is equivalent to the ``--record-core-cycles command-line`` option.
745bc700b67SDharmik Thakkar
7460e4b1963SDharmik Thakkarset record-burst-stats
7470e4b1963SDharmik Thakkar~~~~~~~~~~~~~~~~~~~~~~
7480e4b1963SDharmik Thakkar
7490e4b1963SDharmik ThakkarSet the displaying of RX and TX bursts::
7500e4b1963SDharmik Thakkar
7510e4b1963SDharmik Thakkar   testpmd> set record-burst-stats (on|off)
7520e4b1963SDharmik Thakkar
7530e4b1963SDharmik ThakkarWhere:
7540e4b1963SDharmik Thakkar
7550e4b1963SDharmik Thakkar* ``on`` enables display of RX and TX bursts.
7560e4b1963SDharmik Thakkar
7570e4b1963SDharmik Thakkar* ``off`` disables display of RX and TX bursts.
7580e4b1963SDharmik Thakkar
7590e4b1963SDharmik ThakkarThis is equivalent to the ``--record-burst-stats command-line`` option.
7600e4b1963SDharmik Thakkar
761ac718398SBernard Iremongerset burst
762ac718398SBernard Iremonger~~~~~~~~~
763ac718398SBernard Iremonger
764e76d7a76SJohn McNamaraSet number of packets per burst::
765ac718398SBernard Iremonger
766e76d7a76SJohn McNamara   testpmd> set burst (num)
767ac718398SBernard Iremonger
768e76d7a76SJohn McNamaraThis is equivalent to the ``--burst command-line`` option.
769ac718398SBernard Iremonger
770bf56fce1SZhihong WangWhen retry is enabled, the transmit delay time and number of retries can also be set::
771ac718398SBernard Iremonger
772bf56fce1SZhihong Wang   testpmd> set burst tx delay (microseconds) retry (num)
773ac718398SBernard Iremonger
77491c78e09SViacheslav Ovsiienkoset rxoffs
77591c78e09SViacheslav Ovsiienko~~~~~~~~~~
77691c78e09SViacheslav Ovsiienko
77791c78e09SViacheslav OvsiienkoSet the offsets of segments relating to the data buffer beginning on receiving
77891c78e09SViacheslav Ovsiienkoif split feature is engaged. Affects only the queues configured with split
77991c78e09SViacheslav Ovsiienkooffloads (currently BUFFER_SPLIT is supported only).
78091c78e09SViacheslav Ovsiienko
78191c78e09SViacheslav Ovsiienko   testpmd> set rxoffs (x[,y]*)
78291c78e09SViacheslav Ovsiienko
78391c78e09SViacheslav OvsiienkoWhere x[,y]* represents a CSV list of values, without white space. If the list
78491c78e09SViacheslav Ovsiienkoof offsets is shorter than the list of segments the zero offsets will be used
78591c78e09SViacheslav Ovsiienkofor the remaining segments.
78691c78e09SViacheslav Ovsiienko
7870f2096d7SViacheslav Ovsiienkoset rxpkts
7880f2096d7SViacheslav Ovsiienko~~~~~~~~~~
7890f2096d7SViacheslav Ovsiienko
7900f2096d7SViacheslav OvsiienkoSet the length of segments to scatter packets on receiving if split
7910f2096d7SViacheslav Ovsiienkofeature is engaged. Affects only the queues configured with split offloads
7920f2096d7SViacheslav Ovsiienko(currently BUFFER_SPLIT is supported only). Optionally the multiple memory
7930f2096d7SViacheslav Ovsiienkopools can be specified with --mbuf-size command line parameter and the mbufs
7940f2096d7SViacheslav Ovsiienkoto receive will be allocated sequentially from these extra memory pools (the
7950f2096d7SViacheslav Ovsiienkombuf for the first segment is allocated from the first pool, the second one
7960f2096d7SViacheslav Ovsiienkofrom the second pool, and so on, if segment number is greater then pool's the
7970f2096d7SViacheslav Ovsiienkombuf for remaining segments will be allocated from the last valid pool).
7980f2096d7SViacheslav Ovsiienko
7990f2096d7SViacheslav Ovsiienko   testpmd> set rxpkts (x[,y]*)
8000f2096d7SViacheslav Ovsiienko
8010f2096d7SViacheslav OvsiienkoWhere x[,y]* represents a CSV list of values, without white space. Zero value
8020f2096d7SViacheslav Ovsiienkomeans to use the corresponding memory pool data buffer size.
8030f2096d7SViacheslav Ovsiienko
80452e2e7edSYuan Wangset rxhdrs
80552e2e7edSYuan Wang~~~~~~~~~~
80652e2e7edSYuan Wang
80752e2e7edSYuan WangSet the protocol headers of segments to scatter packets on receiving
80852e2e7edSYuan Wangif split feature is engaged.
80952e2e7edSYuan WangAffects only the queues configured with split offloads
81052e2e7edSYuan Wang(currently BUFFER_SPLIT is supported only).
81152e2e7edSYuan Wang
81252e2e7edSYuan Wang   testpmd> set rxhdrs (eth[,ipv4]*)
81352e2e7edSYuan Wang
81452e2e7edSYuan WangWhere eth[,ipv4]* represents a CSV list of values, without white space.
81552e2e7edSYuan WangIf the list of offsets is shorter than the list of segments,
81652e2e7edSYuan Wangzero offsets will be used for the remaining segments.
81752e2e7edSYuan Wang
818ac718398SBernard Iremongerset txpkts
819ac718398SBernard Iremonger~~~~~~~~~~
820ac718398SBernard Iremonger
8212ebacaa7SMaciej CzekajSet the length of each segment of the TX-ONLY packets or length of packet for FLOWGEN mode::
822ac718398SBernard Iremonger
823e76d7a76SJohn McNamara   testpmd> set txpkts (x[,y]*)
824ac718398SBernard Iremonger
825ac718398SBernard IremongerWhere x[,y]* represents a CSV list of values, without white space.
826ac718398SBernard Iremonger
8274940344dSViacheslav Ovsiienkoset txtimes
8284940344dSViacheslav Ovsiienko~~~~~~~~~~~
8294940344dSViacheslav Ovsiienko
8304940344dSViacheslav OvsiienkoConfigure the timing burst pattern for Tx only mode. This command enables
8314940344dSViacheslav Ovsiienkothe packet send scheduling on dynamic timestamp mbuf field and configures
8324940344dSViacheslav Ovsiienkotiming pattern in Tx only mode. In this mode, if scheduling is enabled
8334940344dSViacheslav Ovsiienkoapplication provides timestamps in the packets being sent. It is possible
8344940344dSViacheslav Ovsiienkoto configure delay (in unspecified device clock units) between bursts
8354940344dSViacheslav Ovsiienkoand between the packets within the burst::
8364940344dSViacheslav Ovsiienko
8374940344dSViacheslav Ovsiienko   testpmd> set txtimes (inter),(intra)
8384940344dSViacheslav Ovsiienko
8394940344dSViacheslav Ovsiienkowhere:
8404940344dSViacheslav Ovsiienko
8414940344dSViacheslav Ovsiienko* ``inter``  is the delay between the bursts in the device clock units.
8424940344dSViacheslav Ovsiienko  If ``intra`` is zero, this is the time between the beginnings of the
8434940344dSViacheslav Ovsiienko  first packets in the neighbour bursts, if ``intra`` is not zero,
8444940344dSViacheslav Ovsiienko  ``inter`` specifies the time between the beginning of the first packet
8454940344dSViacheslav Ovsiienko  of the current burst and the beginning of the last packet of the
8464940344dSViacheslav Ovsiienko  previous burst. If ``inter`` parameter is zero the send scheduling
8474940344dSViacheslav Ovsiienko  on timestamps is disabled (default).
8484940344dSViacheslav Ovsiienko
8494940344dSViacheslav Ovsiienko* ``intra`` is the delay between the packets within the burst specified
8504940344dSViacheslav Ovsiienko  in the device clock units. The number of packets in the burst is defined
8514940344dSViacheslav Ovsiienko  by regular burst setting. If ``intra`` parameter is zero no timestamps
8524940344dSViacheslav Ovsiienko  provided in the packets excepting the first one in the burst.
8534940344dSViacheslav Ovsiienko
8544940344dSViacheslav OvsiienkoAs the result the bursts of packet will be transmitted with specific
8554940344dSViacheslav Ovsiienkodelays between the packets within the burst and specific delay between
8564940344dSViacheslav Ovsiienkothe bursts. The rte_eth_read_clock() must be supported by the device(s)
8574940344dSViacheslav Ovsiienkoand is supposed to be engaged to get the current device clock value
8584940344dSViacheslav Ovsiienkoand provide the reference for the timestamps. If there is no supported
8594940344dSViacheslav Ovsiienkorte_eth_read_clock() there will be no send scheduling provided on the port.
8604940344dSViacheslav Ovsiienko
86179bec05bSKonstantin Ananyevset txsplit
86279bec05bSKonstantin Ananyev~~~~~~~~~~~
86379bec05bSKonstantin Ananyev
86479bec05bSKonstantin AnanyevSet the split policy for the TX packets, applicable for TX-ONLY and CSUM forwarding modes::
86579bec05bSKonstantin Ananyev
86679bec05bSKonstantin Ananyev   testpmd> set txsplit (off|on|rand)
86779bec05bSKonstantin Ananyev
86879bec05bSKonstantin AnanyevWhere:
86979bec05bSKonstantin Ananyev
87079bec05bSKonstantin Ananyev* ``off`` disable packet copy & split for CSUM mode.
87179bec05bSKonstantin Ananyev
87279bec05bSKonstantin Ananyev* ``on`` split outgoing packet into multiple segments. Size of each segment
87379bec05bSKonstantin Ananyev  and number of segments per packet is determined by ``set txpkts`` command
87479bec05bSKonstantin Ananyev  (see above).
87579bec05bSKonstantin Ananyev
87679bec05bSKonstantin Ananyev* ``rand`` same as 'on', but number of segments per each packet is a random value between 1 and total number of segments.
87779bec05bSKonstantin Ananyev
878ac718398SBernard Iremongerset corelist
879ac718398SBernard Iremonger~~~~~~~~~~~~
880ac718398SBernard Iremonger
881e76d7a76SJohn McNamaraSet the list of forwarding cores::
882ac718398SBernard Iremonger
883e76d7a76SJohn McNamara   testpmd> set corelist (x[,y]*)
884ac718398SBernard Iremonger
885ac718398SBernard IremongerFor example, to change the forwarding cores:
886ac718398SBernard Iremonger
887ac718398SBernard Iremonger.. code-block:: console
888ac718398SBernard Iremonger
889ac718398SBernard Iremonger   testpmd> set corelist 3,1
890ac718398SBernard Iremonger   testpmd> show config fwd
891ac718398SBernard Iremonger
892ac718398SBernard Iremonger   io packet forwarding - ports=2 - cores=2 - streams=2 - NUMA support disabled
893ac718398SBernard Iremonger   Logical Core 3 (socket 0) forwards packets on 1 streams:
894ac718398SBernard Iremonger   RX P=0/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:01
895ac718398SBernard Iremonger   Logical Core 1 (socket 0) forwards packets on 1 streams:
896ac718398SBernard Iremonger   RX P=1/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
897ac718398SBernard Iremonger
898ac718398SBernard Iremonger.. note::
899ac718398SBernard Iremonger
900ac718398SBernard Iremonger   The cores are used in the same order as specified on the command line.
901ac718398SBernard Iremonger
902ac718398SBernard Iremongerset portlist
903ac718398SBernard Iremonger~~~~~~~~~~~~
904ac718398SBernard Iremonger
905e76d7a76SJohn McNamaraSet the list of forwarding ports::
906ac718398SBernard Iremonger
907e76d7a76SJohn McNamara   testpmd> set portlist (x[,y]*)
908ac718398SBernard Iremonger
909ac718398SBernard IremongerFor example, to change the port forwarding:
910ac718398SBernard Iremonger
911ac718398SBernard Iremonger.. code-block:: console
912ac718398SBernard Iremonger
913ac718398SBernard Iremonger   testpmd> set portlist 0,2,1,3
914ac718398SBernard Iremonger   testpmd> show config fwd
915ac718398SBernard Iremonger
916ac718398SBernard Iremonger   io packet forwarding - ports=4 - cores=1 - streams=4
917ac718398SBernard Iremonger   Logical Core 3 (socket 0) forwards packets on 4 streams:
918ac718398SBernard Iremonger   RX P=0/Q=0 (socket 0) -> TX P=2/Q=0 (socket 0) peer=02:00:00:00:00:01
919ac718398SBernard Iremonger   RX P=2/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
920ac718398SBernard Iremonger   RX P=1/Q=0 (socket 0) -> TX P=3/Q=0 (socket 0) peer=02:00:00:00:00:03
921ac718398SBernard Iremonger   RX P=3/Q=0 (socket 0) -> TX P=1/Q=0 (socket 0) peer=02:00:00:00:00:02
922ac718398SBernard Iremonger
9234f1ed78eSThomas Monjalonset port setup on
9244f1ed78eSThomas Monjalon~~~~~~~~~~~~~~~~~
9254f1ed78eSThomas Monjalon
9264f1ed78eSThomas MonjalonSelect how to retrieve new ports created after "port attach" command::
9274f1ed78eSThomas Monjalon
9284f1ed78eSThomas Monjalon   testpmd> set port setup on (iterator|event)
9294f1ed78eSThomas Monjalon
9304f1ed78eSThomas MonjalonFor each new port, a setup is done.
9314f1ed78eSThomas MonjalonIt will find the probed ports via RTE_ETH_FOREACH_MATCHING_DEV loop
9324f1ed78eSThomas Monjalonin iterator mode, or via RTE_ETH_EVENT_NEW in event mode.
9334f1ed78eSThomas Monjalon
934425781ffSBernard Iremongerset tx loopback
935425781ffSBernard Iremonger~~~~~~~~~~~~~~~
936425781ffSBernard Iremonger
937425781ffSBernard IremongerEnable/disable tx loopback::
938425781ffSBernard Iremonger
939425781ffSBernard Iremonger   testpmd> set tx loopback (port_id) (on|off)
940425781ffSBernard Iremonger
941425781ffSBernard Iremongerset drop enable
942425781ffSBernard Iremonger~~~~~~~~~~~~~~~
943425781ffSBernard Iremonger
944425781ffSBernard Iremongerset drop enable bit for all queues::
945425781ffSBernard Iremonger
946425781ffSBernard Iremonger   testpmd> set all queues drop (port_id) (on|off)
947425781ffSBernard Iremonger
948425781ffSBernard Iremongerset mac antispoof (for VF)
949425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~
950425781ffSBernard Iremonger
951425781ffSBernard IremongerSet mac antispoof for a VF from the PF::
952425781ffSBernard Iremonger
953425781ffSBernard Iremonger   testpmd> set vf mac antispoof  (port_id) (vf_id) (on|off)
954425781ffSBernard Iremonger
955ac718398SBernard Iremongervlan set stripq
956ac718398SBernard Iremonger~~~~~~~~~~~~~~~
957ac718398SBernard Iremonger
958e76d7a76SJohn McNamaraSet the VLAN strip for a queue on a port::
959ac718398SBernard Iremonger
960e76d7a76SJohn McNamara   testpmd> vlan set stripq (on|off) (port_id,queue_id)
961ac718398SBernard Iremonger
962425781ffSBernard Iremongervlan set stripq (for VF)
963425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~
964425781ffSBernard Iremonger
965425781ffSBernard IremongerSet VLAN strip for all queues in a pool for a VF from the PF::
966425781ffSBernard Iremonger
967425781ffSBernard Iremonger   testpmd> set vf vlan stripq (port_id) (vf_id) (on|off)
968425781ffSBernard Iremonger
969425781ffSBernard Iremongervlan set insert (for VF)
970425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~
971425781ffSBernard Iremonger
972425781ffSBernard IremongerSet VLAN insert for a VF from the PF::
973425781ffSBernard Iremonger
974aaffc740SE. Scott Daniels   testpmd> set vf vlan insert (port_id) (vf_id) (vlan_id)
975425781ffSBernard Iremonger
976425781ffSBernard Iremongervlan set antispoof (for VF)
977425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~
978425781ffSBernard Iremonger
979425781ffSBernard IremongerSet VLAN antispoof for a VF from the PF::
980425781ffSBernard Iremonger
981425781ffSBernard Iremonger   testpmd> set vf vlan antispoof (port_id) (vf_id) (on|off)
982425781ffSBernard Iremonger
9832a0b4198SVivek Sharmavlan set (strip|filter|qinq_strip|extend)
9842a0b4198SVivek Sharma~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9852a0b4198SVivek SharmaSet the VLAN strip/filter/QinQ strip/extend on for a port::
986ac718398SBernard Iremonger
9872a0b4198SVivek Sharma   testpmd> vlan set (strip|filter|qinq_strip|extend) (on|off) (port_id)
988ac718398SBernard Iremonger
989ac718398SBernard Iremongervlan set tpid
990ac718398SBernard Iremonger~~~~~~~~~~~~~
991ac718398SBernard Iremonger
99219b16e2fSHelin ZhangSet the inner or outer VLAN TPID for packet filtering on a port::
993ac718398SBernard Iremonger
99419b16e2fSHelin Zhang   testpmd> vlan set (inner|outer) tpid (value) (port_id)
995ac718398SBernard Iremonger
996ac718398SBernard Iremonger.. note::
997ac718398SBernard Iremonger
998ac718398SBernard Iremonger   TPID value must be a 16-bit number (value <= 65536).
999ac718398SBernard Iremonger
1000ac718398SBernard Iremongerrx_vlan add
1001ac718398SBernard Iremonger~~~~~~~~~~~
1002ac718398SBernard Iremonger
1003e76d7a76SJohn McNamaraAdd a VLAN ID, or all identifiers, to the set of VLAN identifiers filtered by port ID::
1004ac718398SBernard Iremonger
1005e76d7a76SJohn McNamara   testpmd> rx_vlan add (vlan_id|all) (port_id)
1006ac718398SBernard Iremonger
1007ac718398SBernard Iremonger.. note::
1008ac718398SBernard Iremonger
1009ac718398SBernard Iremonger   VLAN filter must be set on that port. VLAN ID < 4096.
1010a7dde4ffSMichal Jastrzebski   Depending on the NIC used, number of vlan_ids may be limited to the maximum entries
1011a7dde4ffSMichal Jastrzebski   in VFTA table. This is important if enabling all vlan_ids.
1012ac718398SBernard Iremonger
1013ac718398SBernard Iremongerrx_vlan rm
1014ac718398SBernard Iremonger~~~~~~~~~~
1015ac718398SBernard Iremonger
1016e76d7a76SJohn McNamaraRemove a VLAN ID, or all identifiers, from the set of VLAN identifiers filtered by port ID::
1017ac718398SBernard Iremonger
1018e76d7a76SJohn McNamara   testpmd> rx_vlan rm (vlan_id|all) (port_id)
1019ac718398SBernard Iremonger
1020ac718398SBernard Iremongerrx_vlan add (for VF)
1021e76d7a76SJohn McNamara~~~~~~~~~~~~~~~~~~~~
1022ac718398SBernard Iremonger
1023e76d7a76SJohn McNamaraAdd a VLAN ID, to the set of VLAN identifiers filtered for VF(s) for port ID::
1024ac718398SBernard Iremonger
1025e76d7a76SJohn McNamara   testpmd> rx_vlan add (vlan_id) port (port_id) vf (vf_mask)
1026ac718398SBernard Iremonger
1027ac718398SBernard Iremongerrx_vlan rm (for VF)
1028e76d7a76SJohn McNamara~~~~~~~~~~~~~~~~~~~
1029ac718398SBernard Iremonger
1030e76d7a76SJohn McNamaraRemove a VLAN ID, from the set of VLAN identifiers filtered for VF(s) for port ID::
1031ac718398SBernard Iremonger
1032e76d7a76SJohn McNamara   testpmd> rx_vlan rm (vlan_id) port (port_id) vf (vf_mask)
1033ac718398SBernard Iremonger
10346fe5f2f7SPablo de Lararx_vxlan_port add
10356fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~
10366fe5f2f7SPablo de Lara
1037e76d7a76SJohn McNamaraAdd an UDP port for VXLAN packet filter on a port::
10386fe5f2f7SPablo de Lara
1039e76d7a76SJohn McNamara   testpmd> rx_vxlan_port add (udp_port) (port_id)
10406fe5f2f7SPablo de Lara
10416fe5f2f7SPablo de Lararx_vxlan_port remove
10426fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~~~~
10436fe5f2f7SPablo de Lara
1044e76d7a76SJohn McNamaraRemove an UDP port for VXLAN packet filter on a port::
10456fe5f2f7SPablo de Lara
1046e76d7a76SJohn McNamara   testpmd> rx_vxlan_port rm (udp_port) (port_id)
10476fe5f2f7SPablo de Lara
1048ac718398SBernard Iremongertx_vlan set
1049ac718398SBernard Iremonger~~~~~~~~~~~
1050ac718398SBernard Iremonger
1051e76d7a76SJohn McNamaraSet hardware insertion of VLAN IDs in packets sent on a port::
1052ac718398SBernard Iremonger
1053e76d7a76SJohn McNamara   testpmd> tx_vlan set (port_id) vlan_id[, vlan_id_outer]
105492ebda07SHelin Zhang
1055e76d7a76SJohn McNamaraFor example, set a single VLAN ID (5) insertion on port 0::
105692ebda07SHelin Zhang
105792ebda07SHelin Zhang   tx_vlan set 0 5
105892ebda07SHelin Zhang
1059e76d7a76SJohn McNamaraOr, set double VLAN ID (inner: 2, outer: 3) insertion on port 1::
106092ebda07SHelin Zhang
106192ebda07SHelin Zhang   tx_vlan set 1 2 3
1062ac718398SBernard Iremonger
1063e76d7a76SJohn McNamara
1064ac718398SBernard Iremongertx_vlan set pvid
1065ac718398SBernard Iremonger~~~~~~~~~~~~~~~~
1066ac718398SBernard Iremonger
1067e76d7a76SJohn McNamaraSet port based hardware insertion of VLAN ID in packets sent on a port::
1068ac718398SBernard Iremonger
1069e76d7a76SJohn McNamara   testpmd> tx_vlan set pvid (port_id) (vlan_id) (on|off)
1070ac718398SBernard Iremonger
1071ac718398SBernard Iremongertx_vlan reset
1072ac718398SBernard Iremonger~~~~~~~~~~~~~
1073ac718398SBernard Iremonger
1074e76d7a76SJohn McNamaraDisable hardware insertion of a VLAN header in packets sent on a port::
1075ac718398SBernard Iremonger
1076e76d7a76SJohn McNamara   testpmd> tx_vlan reset (port_id)
1077ac718398SBernard Iremonger
1078c22f2feeSOlivier Matzcsum set
1079c22f2feeSOlivier Matz~~~~~~~~
1080ac718398SBernard Iremonger
1081186e5586SPablo de LaraSelect hardware or software calculation of the checksum when
1082e76d7a76SJohn McNamaratransmitting a packet using the ``csum`` forwarding engine::
1083ac718398SBernard Iremonger
1084bf5618faSJerin Jacob   testpmd> csum set (ip|udp|tcp|sctp|outer-ip|outer-udp) (hw|sw) (port_id)
1085ac718398SBernard Iremonger
1086e76d7a76SJohn McNamaraWhere:
1087c22f2feeSOlivier Matz
1088e76d7a76SJohn McNamara* ``ip|udp|tcp|sctp`` always relate to  the inner layer.
1089e76d7a76SJohn McNamara
1090e76d7a76SJohn McNamara* ``outer-ip`` relates to the outer IP layer (only for IPv4) in the case where the packet is recognized
1091df655504SOphir Munk  as a tunnel packet by the forwarding engine (geneve, gre, gtp, ipip, vxlan and vxlan-gpe are
1092e76d7a76SJohn McNamara  supported). See also the ``csum parse-tunnel`` command.
1093ac718398SBernard Iremonger
1094bf5618faSJerin Jacob* ``outer-udp`` relates to the outer UDP layer in the case where the packet is recognized
1095df655504SOphir Munk  as a tunnel packet by the forwarding engine (geneve, gtp, vxlan and vxlan-gpe are
1096bf5618faSJerin Jacob  supported). See also the ``csum parse-tunnel`` command.
1097bf5618faSJerin Jacob
1098ac718398SBernard Iremonger.. note::
1099ac718398SBernard Iremonger
1100ac718398SBernard Iremonger   Check the NIC Datasheet for hardware limits.
1101ac718398SBernard Iremonger
1102c22f2feeSOlivier Matzcsum parse-tunnel
1103c22f2feeSOlivier Matz~~~~~~~~~~~~~~~~~
1104c22f2feeSOlivier Matz
1105c22f2feeSOlivier MatzDefine how tunneled packets should be handled by the csum forward
1106e76d7a76SJohn McNamaraengine::
1107c22f2feeSOlivier Matz
1108e76d7a76SJohn McNamara   testpmd> csum parse-tunnel (on|off) (tx_port_id)
1109c22f2feeSOlivier Matz
1110c22f2feeSOlivier MatzIf enabled, the csum forward engine will try to recognize supported
1111df655504SOphir Munktunnel headers (geneve, gtp, gre, ipip, vxlan, vxlan-gpe).
1112c22f2feeSOlivier Matz
1113c22f2feeSOlivier MatzIf disabled, treat tunnel packets as non-tunneled packets (a inner
1114c22f2feeSOlivier Matzheader is handled as a packet payload).
1115c22f2feeSOlivier Matz
1116c22f2feeSOlivier Matz.. note::
1117c22f2feeSOlivier Matz
1118e76d7a76SJohn McNamara   The port argument is the TX port like in the ``csum set`` command.
1119c22f2feeSOlivier Matz
1120c22f2feeSOlivier MatzExample:
1121c22f2feeSOlivier Matz
1122e76d7a76SJohn McNamaraConsider a packet in packet like the following::
1123c22f2feeSOlivier Matz
1124e76d7a76SJohn McNamara   eth_out/ipv4_out/udp_out/vxlan/eth_in/ipv4_in/tcp_in
1125c22f2feeSOlivier Matz
1126e76d7a76SJohn McNamara* If parse-tunnel is enabled, the ``ip|udp|tcp|sctp`` parameters of ``csum set``
1127e76d7a76SJohn McNamara  command relate to the inner headers (here ``ipv4_in`` and ``tcp_in``), and the
1128bf5618faSJerin Jacob  ``outer-ip|outer-udp`` parameter relates to the outer headers (here ``ipv4_out`` and ``udp_out``).
1129e76d7a76SJohn McNamara
1130e76d7a76SJohn McNamara* If parse-tunnel is disabled, the ``ip|udp|tcp|sctp`` parameters of ``csum  set``
1131e76d7a76SJohn McNamara   command relate to the outer headers, here ``ipv4_out`` and ``udp_out``.
1132c22f2feeSOlivier Matz
1133c22f2feeSOlivier Matzcsum show
1134c22f2feeSOlivier Matz~~~~~~~~~
11356fe5f2f7SPablo de Lara
1136e76d7a76SJohn McNamaraDisplay tx checksum offload configuration::
11376fe5f2f7SPablo de Lara
1138e76d7a76SJohn McNamara   testpmd> csum show (port_id)
11396fe5f2f7SPablo de Lara
11406fe5f2f7SPablo de Laratso set
11416fe5f2f7SPablo de Lara~~~~~~~
11426fe5f2f7SPablo de Lara
1143e76d7a76SJohn McNamaraEnable TCP Segmentation Offload (TSO) in the ``csum`` forwarding engine::
11446fe5f2f7SPablo de Lara
1145e76d7a76SJohn McNamara   testpmd> tso set (segsize) (port_id)
11466fe5f2f7SPablo de Lara
11476fe5f2f7SPablo de Lara.. note::
1148c22f2feeSOlivier Matz
1149e76d7a76SJohn McNamara   Check the NIC datasheet for hardware limits.
11506fe5f2f7SPablo de Lara
11516fe5f2f7SPablo de Laratso show
11526fe5f2f7SPablo de Lara~~~~~~~~
11536fe5f2f7SPablo de Lara
1154e76d7a76SJohn McNamaraDisplay the status of TCP Segmentation Offload::
11556fe5f2f7SPablo de Lara
1156e76d7a76SJohn McNamara   testpmd> tso show (port_id)
1157ac718398SBernard Iremonger
1158d82ee2ccSAgalya Babu RadhaKrishnantunnel tso set
1159d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~
1160d82ee2ccSAgalya Babu RadhaKrishnan
1161d82ee2ccSAgalya Babu RadhaKrishnanSet tso segment size of tunneled packets for a port in csum engine::
1162d82ee2ccSAgalya Babu RadhaKrishnan
1163d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> tunnel_tso set (tso_segsz) (port_id)
1164d82ee2ccSAgalya Babu RadhaKrishnan
1165d82ee2ccSAgalya Babu RadhaKrishnantunnel tso show
1166d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~
1167d82ee2ccSAgalya Babu RadhaKrishnan
1168d82ee2ccSAgalya Babu RadhaKrishnanDisplay the status of tunneled TCP Segmentation Offload for a port::
1169d82ee2ccSAgalya Babu RadhaKrishnan
1170d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> tunnel_tso show (port_id)
1171d82ee2ccSAgalya Babu RadhaKrishnan
1172b7091f1dSJiayu Huset port - gro
1173b7091f1dSJiayu Hu~~~~~~~~~~~~~~
1174b40f8d78SJiayu Hu
1175b40f8d78SJiayu HuEnable or disable GRO in ``csum`` forwarding engine::
1176b40f8d78SJiayu Hu
1177b7091f1dSJiayu Hu   testpmd> set port <port_id> gro on|off
1178b40f8d78SJiayu Hu
1179b40f8d78SJiayu HuIf enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
1180b40f8d78SJiayu Hupackets received from the given port.
1181b40f8d78SJiayu Hu
1182b40f8d78SJiayu HuIf disabled, packets received from the given port won't be performed
1183b40f8d78SJiayu HuGRO. By default, GRO is disabled for all ports.
1184b40f8d78SJiayu Hu
1185b40f8d78SJiayu Hu.. note::
1186b40f8d78SJiayu Hu
1187b40f8d78SJiayu Hu   When enable GRO for a port, TCP/IPv4 packets received from the port
1188b7091f1dSJiayu Hu   will be performed GRO. After GRO, all merged packets have bad
1189b7091f1dSJiayu Hu   checksums, since the GRO library doesn't re-calculate checksums for
1190b7091f1dSJiayu Hu   the merged packets. Therefore, if users want the merged packets to
1191b7091f1dSJiayu Hu   have correct checksums, please select HW IP checksum calculation and
1192b7091f1dSJiayu Hu   HW TCP checksum calculation for the port which the merged packets are
1193b7091f1dSJiayu Hu   transmitted to.
1194b40f8d78SJiayu Hu
1195b7091f1dSJiayu Hushow port - gro
1196b7091f1dSJiayu Hu~~~~~~~~~~~~~~~
1197b40f8d78SJiayu Hu
1198b7091f1dSJiayu HuDisplay GRO configuration for a given port::
1199b40f8d78SJiayu Hu
1200b7091f1dSJiayu Hu   testpmd> show port <port_id> gro
1201b40f8d78SJiayu Hu
1202b7091f1dSJiayu Huset gro flush
1203b7091f1dSJiayu Hu~~~~~~~~~~~~~
1204b40f8d78SJiayu Hu
1205b7091f1dSJiayu HuSet the cycle to flush the GROed packets from reassembly tables::
1206b7091f1dSJiayu Hu
1207b7091f1dSJiayu Hu   testpmd> set gro flush <cycles>
1208b7091f1dSJiayu Hu
1209b7091f1dSJiayu HuWhen enable GRO, the csum forwarding engine performs GRO on received
1210b7091f1dSJiayu Hupackets, and the GROed packets are stored in reassembly tables. Users
1211b7091f1dSJiayu Hucan use this command to determine when the GROed packets are flushed
1212b7091f1dSJiayu Hufrom the reassembly tables.
1213b7091f1dSJiayu Hu
1214b7091f1dSJiayu HuThe ``cycles`` is measured in GRO operation times. The csum forwarding
1215b7091f1dSJiayu Huengine flushes the GROed packets from the tables every ``cycles`` GRO
1216b7091f1dSJiayu Huoperations.
1217b7091f1dSJiayu Hu
1218b7091f1dSJiayu HuBy default, the value of ``cycles`` is 1, which means flush GROed packets
1219b7091f1dSJiayu Hufrom the reassembly tables as soon as one GRO operation finishes. The value
1220b7091f1dSJiayu Huof ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
1221b7091f1dSJiayu Hu
1222b7091f1dSJiayu HuPlease note that the large value of ``cycles`` may cause the poor TCP/IP
1223b7091f1dSJiayu Hustack performance. Because the GROed packets are delayed to arrive the
1224b7091f1dSJiayu Hustack, thus causing more duplicated ACKs and TCP retransmissions.
1225b40f8d78SJiayu Hu
122652f38a20SJiayu Huset port - gso
122752f38a20SJiayu Hu~~~~~~~~~~~~~~
122852f38a20SJiayu Hu
122952f38a20SJiayu HuToggle per-port GSO support in ``csum`` forwarding engine::
123052f38a20SJiayu Hu
123152f38a20SJiayu Hu   testpmd> set port <port_id> gso on|off
123252f38a20SJiayu Hu
123352f38a20SJiayu HuIf enabled, the csum forwarding engine will perform GSO on supported IPv4
123452f38a20SJiayu Hupackets, transmitted on the given port.
123552f38a20SJiayu Hu
123652f38a20SJiayu HuIf disabled, packets transmitted on the given port will not undergo GSO.
123752f38a20SJiayu HuBy default, GSO is disabled for all ports.
123852f38a20SJiayu Hu
123952f38a20SJiayu Hu.. note::
124052f38a20SJiayu Hu
124152f38a20SJiayu Hu   When GSO is enabled on a port, supported IPv4 packets transmitted on that
124252f38a20SJiayu Hu   port undergo GSO. Afterwards, the segmented packets are represented by
124352f38a20SJiayu Hu   multi-segment mbufs; however, the csum forwarding engine doesn't calculation
124452f38a20SJiayu Hu   of checksums for GSO'd segments in SW. As a result, if users want correct
124552f38a20SJiayu Hu   checksums in GSO segments, they should enable HW checksum calculation for
124652f38a20SJiayu Hu   GSO-enabled ports.
124752f38a20SJiayu Hu
124852f38a20SJiayu Hu   For example, HW checksum calculation for VxLAN GSO'd packets may be enabled
124952f38a20SJiayu Hu   by setting the following options in the csum forwarding engine:
125052f38a20SJiayu Hu
125152f38a20SJiayu Hu   testpmd> csum set outer_ip hw <port_id>
125252f38a20SJiayu Hu
125352f38a20SJiayu Hu   testpmd> csum set ip hw <port_id>
125452f38a20SJiayu Hu
125552f38a20SJiayu Hu   testpmd> csum set tcp hw <port_id>
125652f38a20SJiayu Hu
1257250c9eb3SJiayu Hu   UDP GSO is the same as IP fragmentation, which treats the UDP header
1258250c9eb3SJiayu Hu   as the payload and does not modify it during segmentation. That is,
1259250c9eb3SJiayu Hu   after UDP GSO, only the first output fragment has the original UDP
1260250c9eb3SJiayu Hu   header. Therefore, users need to enable HW IP checksum calculation
1261250c9eb3SJiayu Hu   and SW UDP checksum calculation for GSO-enabled ports, if they want
1262250c9eb3SJiayu Hu   correct checksums for UDP/IPv4 packets.
1263250c9eb3SJiayu Hu
126452f38a20SJiayu Huset gso segsz
126552f38a20SJiayu Hu~~~~~~~~~~~~~
126652f38a20SJiayu Hu
126752f38a20SJiayu HuSet the maximum GSO segment size (measured in bytes), which includes the
126852f38a20SJiayu Hupacket header and the packet payload for GSO-enabled ports (global)::
126952f38a20SJiayu Hu
127052f38a20SJiayu Hu   testpmd> set gso segsz <length>
127152f38a20SJiayu Hu
127252f38a20SJiayu Hushow port - gso
127352f38a20SJiayu Hu~~~~~~~~~~~~~~~
127452f38a20SJiayu Hu
127552f38a20SJiayu HuDisplay the status of Generic Segmentation Offload for a given port::
127652f38a20SJiayu Hu
127752f38a20SJiayu Hu   testpmd> show port <port_id> gso
127852f38a20SJiayu Hu
1279ac718398SBernard Iremongermac_addr add
1280ac718398SBernard Iremonger~~~~~~~~~~~~
1281ac718398SBernard Iremonger
1282e76d7a76SJohn McNamaraAdd an alternative MAC address to a port::
1283ac718398SBernard Iremonger
1284e76d7a76SJohn McNamara   testpmd> mac_addr add (port_id) (XX:XX:XX:XX:XX:XX)
1285ac718398SBernard Iremonger
1286ac718398SBernard Iremongermac_addr remove
1287ac718398SBernard Iremonger~~~~~~~~~~~~~~~
1288ac718398SBernard Iremonger
1289e76d7a76SJohn McNamaraRemove a MAC address from a port::
1290ac718398SBernard Iremonger
1291e76d7a76SJohn McNamara   testpmd> mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)
1292ac718398SBernard Iremonger
1293d82ee2ccSAgalya Babu RadhaKrishnanmcast_addr add
1294d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~
1295d82ee2ccSAgalya Babu RadhaKrishnan
1296d82ee2ccSAgalya Babu RadhaKrishnanTo add the multicast MAC address to/from the set of multicast addresses
1297d82ee2ccSAgalya Babu RadhaKrishnanfiltered by port::
1298d82ee2ccSAgalya Babu RadhaKrishnan
1299d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> mcast_addr add (port_id) (mcast_addr)
1300d82ee2ccSAgalya Babu RadhaKrishnan
1301d82ee2ccSAgalya Babu RadhaKrishnanmcast_addr remove
1302d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~~~
1303d82ee2ccSAgalya Babu RadhaKrishnan
1304d82ee2ccSAgalya Babu RadhaKrishnanTo remove the multicast MAC address to/from the set of multicast addresses
1305d82ee2ccSAgalya Babu RadhaKrishnanfiltered by port::
1306d82ee2ccSAgalya Babu RadhaKrishnan
1307d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> mcast_addr remove (port_id) (mcast_addr)
1308d82ee2ccSAgalya Babu RadhaKrishnan
1309ac718398SBernard Iremongermac_addr add (for VF)
1310425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~
1311ac718398SBernard Iremonger
1312e76d7a76SJohn McNamaraAdd an alternative MAC address for a VF to a port::
1313ac718398SBernard Iremonger
1314e76d7a76SJohn McNamara   testpmd> mac_add add port (port_id) vf (vf_id) (XX:XX:XX:XX:XX:XX)
1315ac718398SBernard Iremonger
13165852bf6aSPascal Mazonmac_addr set
13175852bf6aSPascal Mazon~~~~~~~~~~~~
13185852bf6aSPascal Mazon
13195852bf6aSPascal MazonSet the default MAC address for a port::
13205852bf6aSPascal Mazon
13215852bf6aSPascal Mazon   testpmd> mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)
13225852bf6aSPascal Mazon
1323425781ffSBernard Iremongermac_addr set (for VF)
1324425781ffSBernard Iremonger~~~~~~~~~~~~~~~~~~~~~
1325425781ffSBernard Iremonger
1326425781ffSBernard IremongerSet the MAC address for a VF from the PF::
1327425781ffSBernard Iremonger
1328425781ffSBernard Iremonger   testpmd> set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)
1329425781ffSBernard Iremonger
1330aac6f11fSWisam Jaddoset eth-peer
1331aac6f11fSWisam Jaddo~~~~~~~~~~~~
1332aac6f11fSWisam Jaddo
1333aac6f11fSWisam JaddoSet the forwarding peer address for certain port::
1334aac6f11fSWisam Jaddo
13353caef7e1SRami Rosen   testpmd> set eth-peer (port_id) (peer_addr)
1336aac6f11fSWisam Jaddo
1337aac6f11fSWisam JaddoThis is equivalent to the ``--eth-peer`` command-line option.
1338aac6f11fSWisam Jaddo
1339ac718398SBernard Iremongerset port-uta
1340ac718398SBernard Iremonger~~~~~~~~~~~~
1341ac718398SBernard Iremonger
1342e76d7a76SJohn McNamaraSet the unicast hash filter(s) on/off for a port::
1343ac718398SBernard Iremonger
1344e76d7a76SJohn McNamara   testpmd> set port (port_id) uta (XX:XX:XX:XX:XX:XX|all) (on|off)
1345ac718398SBernard Iremonger
1346ac718398SBernard Iremongerset promisc
1347ac718398SBernard Iremonger~~~~~~~~~~~
1348ac718398SBernard Iremonger
1349ac718398SBernard IremongerSet the promiscuous mode on for a port or for all ports.
1350e76d7a76SJohn McNamaraIn promiscuous mode packets are not dropped if they aren't for the specified MAC address::
1351ac718398SBernard Iremonger
1352e76d7a76SJohn McNamara   testpmd> set promisc (port_id|all) (on|off)
1353ac718398SBernard Iremonger
1354ac718398SBernard Iremongerset allmulti
1355ac718398SBernard Iremonger~~~~~~~~~~~~
1356ac718398SBernard Iremonger
1357e76d7a76SJohn McNamaraSet the allmulti mode for a port or for all ports::
1358ac718398SBernard Iremonger
1359e76d7a76SJohn McNamara   testpmd> set allmulti (port_id|all) (on|off)
1360ac718398SBernard Iremonger
1361ac718398SBernard IremongerSame as the ifconfig (8) option. Controls how multicast packets are handled.
1362ac718398SBernard Iremonger
1363ac718398SBernard Iremongerset flow_ctrl rx
1364ac718398SBernard Iremonger~~~~~~~~~~~~~~~~
1365ac718398SBernard Iremonger
1366e76d7a76SJohn McNamaraSet the link flow control parameter on a port::
1367ac718398SBernard Iremonger
1368e76d7a76SJohn McNamara   testpmd> set flow_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1369e76d7a76SJohn McNamara            (pause_time) (send_xon) mac_ctrl_frame_fwd (on|off) \
1370e76d7a76SJohn McNamara	    autoneg (on|off) (port_id)
1371ac718398SBernard Iremonger
1372ac718398SBernard IremongerWhere:
1373ac718398SBernard Iremonger
1374e76d7a76SJohn McNamara* ``high_water`` (integer): High threshold value to trigger XOFF.
1375ac718398SBernard Iremonger
1376e76d7a76SJohn McNamara* ``low_water`` (integer): Low threshold value to trigger XON.
1377ac718398SBernard Iremonger
1378e76d7a76SJohn McNamara* ``pause_time`` (integer): Pause quota in the Pause frame.
1379ac718398SBernard Iremonger
1380e76d7a76SJohn McNamara* ``send_xon`` (0/1): Send XON frame.
1381ac718398SBernard Iremonger
1382e76d7a76SJohn McNamara* ``mac_ctrl_frame_fwd``: Enable receiving MAC control frames.
1383e76d7a76SJohn McNamara
13840e2db9d3SRami Rosen* ``autoneg``: Change the auto-negotiation parameter.
1385ac718398SBernard Iremonger
1386f4367c0bSHuisong Lishow flow control
1387f4367c0bSHuisong Li~~~~~~~~~~~~~~~~~
1388f4367c0bSHuisong Li
1389f4367c0bSHuisong Lishow the link flow control parameter on a port::
1390f4367c0bSHuisong Li
1391f4367c0bSHuisong Li   testpmd> show port <port_id> flow_ctrl
1392f4367c0bSHuisong Li
1393ac718398SBernard Iremongerset pfc_ctrl rx
1394ac718398SBernard Iremonger~~~~~~~~~~~~~~~
1395ac718398SBernard Iremonger
1396e76d7a76SJohn McNamaraSet the priority flow control parameter on a port::
1397ac718398SBernard Iremonger
1398e76d7a76SJohn McNamara   testpmd> set pfc_ctrl rx (on|off) tx (on|off) (high_water) (low_water) \
1399e76d7a76SJohn McNamara            (pause_time) (priority) (port_id)
1400ac718398SBernard Iremonger
1401ac718398SBernard IremongerWhere:
1402ac718398SBernard Iremonger
1403e76d7a76SJohn McNamara* ``high_water`` (integer): High threshold value.
1404e76d7a76SJohn McNamara
1405e76d7a76SJohn McNamara* ``low_water`` (integer): Low threshold value.
1406e76d7a76SJohn McNamara
1407e76d7a76SJohn McNamara* ``pause_time`` (integer): Pause quota in the Pause frame.
1408e76d7a76SJohn McNamara
1409e76d7a76SJohn McNamara* ``priority`` (0-7): VLAN User Priority.
1410ac718398SBernard Iremonger
1411a5e579f4SSunil Kumar Koriset pfc_queue_ctrl
1412a5e579f4SSunil Kumar Kori~~~~~~~~~~~~~~~~~~
1413a5e579f4SSunil Kumar Kori
1414a5e579f4SSunil Kumar KoriSet the priority flow control parameter on a given Rx and Tx queue of a port::
1415a5e579f4SSunil Kumar Kori
1416a5e579f4SSunil Kumar Kori   testpmd> set pfc_queue_ctrl <port_id> rx (on|off) <tx_qid> <tx_tc> \
1417a5e579f4SSunil Kumar Kori            tx (on|off) <rx_qid> <rx_tc> <pause_time>
1418a5e579f4SSunil Kumar Kori
1419a5e579f4SSunil Kumar KoriWhere:
1420a5e579f4SSunil Kumar Kori
1421a5e579f4SSunil Kumar Kori* ``tx_qid`` (integer): Tx qid for which ``tx_tc`` will be applied and traffic
1422a5e579f4SSunil Kumar Kori  will be paused when PFC frame is received with ``tx_tc`` enabled.
1423a5e579f4SSunil Kumar Kori
1424a5e579f4SSunil Kumar Kori* ``tx_tc`` (0-15): TC for which traffic is to be paused for xmit.
1425a5e579f4SSunil Kumar Kori
1426a5e579f4SSunil Kumar Kori* ``rx_qid`` (integer): Rx qid for which threshold will be applied and PFC
1427a5e579f4SSunil Kumar Kori  frame will be generated with ``tx_tc`` when exceeds the threshold.
1428a5e579f4SSunil Kumar Kori
1429a5e579f4SSunil Kumar Kori* ``rx_tc`` (0-15): TC filled in PFC frame for which remote Tx is to be paused.
1430a5e579f4SSunil Kumar Kori
1431a5e579f4SSunil Kumar Kori* ``pause_time`` (integer): Pause quanta filled in the PFC frame for which
1432a5e579f4SSunil Kumar Kori  interval, remote Tx will be paused. Valid only if Tx pause is on.
1433a5e579f4SSunil Kumar Kori
1434bc70e559SSpike DuSet Rx queue available descriptors threshold
1435bc70e559SSpike Du~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1436bc70e559SSpike Du
1437bc70e559SSpike DuSet available descriptors threshold for a specific Rx queue of port::
1438bc70e559SSpike Du
1439bc70e559SSpike Du  testpmd> set port (port_id) rxq (queue_id) avail_thresh (0..99)
1440bc70e559SSpike Du
1441bc70e559SSpike DuUse 0 value to disable the threshold and corresponding event.
1442bc70e559SSpike Du
1443ac718398SBernard Iremongerset stat_qmap
1444ac718398SBernard Iremonger~~~~~~~~~~~~~
1445ac718398SBernard Iremonger
1446e76d7a76SJohn McNamaraSet statistics mapping (qmapping 0..15) for RX/TX queue on port::
1447ac718398SBernard Iremonger
1448e76d7a76SJohn McNamara   testpmd> set stat_qmap (tx|rx) (port_id) (queue_id) (qmapping)
1449ac718398SBernard Iremonger
1450e76d7a76SJohn McNamaraFor example, to set rx queue 2 on port 0 to mapping 5::
1451ac718398SBernard Iremonger
1452ac718398SBernard Iremonger   testpmd>set stat_qmap rx 0 2 5
1453ac718398SBernard Iremonger
1454a4fd5eeeSElza Mathewset xstats-hide-zero
1455a4fd5eeeSElza Mathew~~~~~~~~~~~~~~~~~~~~
1456a4fd5eeeSElza Mathew
1457a4fd5eeeSElza MathewSet the option to hide zero values for xstats display::
1458a4fd5eeeSElza Mathew
1459a4fd5eeeSElza Mathew	testpmd> set xstats-hide-zero on|off
1460a4fd5eeeSElza Mathew
1461a4fd5eeeSElza Mathew.. note::
1462a4fd5eeeSElza Mathew
1463a4fd5eeeSElza Mathew	By default, the zero values are displayed for xstats.
1464a4fd5eeeSElza Mathew
1465ac718398SBernard Iremongerset port - rx/tx (for VF)
1466e76d7a76SJohn McNamara~~~~~~~~~~~~~~~~~~~~~~~~~
1467ac718398SBernard Iremonger
1468e76d7a76SJohn McNamaraSet VF receive/transmit from a port::
1469ac718398SBernard Iremonger
1470e76d7a76SJohn McNamara   testpmd> set port (port_id) vf (vf_id) (rx|tx) (on|off)
1471ac718398SBernard Iremonger
1472ac718398SBernard Iremongerset port - rx mode(for VF)
1473ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~
1474ac718398SBernard Iremonger
1475e76d7a76SJohn McNamaraSet the VF receive mode of a port::
1476ac718398SBernard Iremonger
1477e76d7a76SJohn McNamara   testpmd> set port (port_id) vf (vf_id) \
1478e76d7a76SJohn McNamara            rxmode (AUPE|ROPE|BAM|MPE) (on|off)
1479ac718398SBernard Iremonger
1480ac718398SBernard IremongerThe available receive modes are:
1481ac718398SBernard Iremonger
1482e76d7a76SJohn McNamara* ``AUPE``: Accepts untagged VLAN.
1483ac718398SBernard Iremonger
1484e76d7a76SJohn McNamara* ``ROPE``: Accepts unicast hash.
1485ac718398SBernard Iremonger
1486e76d7a76SJohn McNamara* ``BAM``: Accepts broadcast packets.
1487ac718398SBernard Iremonger
1488e76d7a76SJohn McNamara* ``MPE``: Accepts all multicast packets.
1489ac718398SBernard Iremonger
1490aa49f366SPablo de Laraset port - tx_rate (for Queue)
1491aa49f366SPablo de Lara~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1492aa49f366SPablo de Lara
1493e76d7a76SJohn McNamaraSet TX rate limitation for a queue on a port::
1494aa49f366SPablo de Lara
1495e76d7a76SJohn McNamara   testpmd> set port (port_id) queue (queue_id) rate (rate_value)
1496aa49f366SPablo de Lara
1497aa49f366SPablo de Laraset port - tx_rate (for VF)
1498aa49f366SPablo de Lara~~~~~~~~~~~~~~~~~~~~~~~~~~~
1499aa49f366SPablo de Lara
1500e76d7a76SJohn McNamaraSet TX rate limitation for queues in VF on a port::
1501aa49f366SPablo de Lara
1502e76d7a76SJohn McNamara   testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
1503aa49f366SPablo de Lara
1504ac718398SBernard Iremongerset flush_rx
1505ac718398SBernard Iremonger~~~~~~~~~~~~
1506ac718398SBernard Iremonger
1507e76d7a76SJohn McNamaraSet the flush on RX streams before forwarding.
1508e76d7a76SJohn McNamaraThe default is flush ``on``.
1509e76d7a76SJohn McNamaraMainly used with PCAP drivers to turn off the default behavior of flushing the first 512 packets on RX streams::
1510ac718398SBernard Iremonger
1511e76d7a76SJohn McNamara   testpmd> set flush_rx off
1512ac718398SBernard Iremonger
1513ac718398SBernard Iremongerset link up
1514ac718398SBernard Iremonger~~~~~~~~~~~
1515ac718398SBernard Iremonger
1516e76d7a76SJohn McNamaraSet link up for a port::
1517ac718398SBernard Iremonger
1518e76d7a76SJohn McNamara   testpmd> set link-up port (port id)
1519ac718398SBernard Iremonger
1520ac718398SBernard Iremongerset link down
1521ac718398SBernard Iremonger~~~~~~~~~~~~~
1522ac718398SBernard Iremonger
1523e76d7a76SJohn McNamaraSet link down for a port::
1524ac718398SBernard Iremonger
1525e76d7a76SJohn McNamara   testpmd> set link-down port (port id)
1526e76d7a76SJohn McNamara
15270eec728eSWenzhuo LuE-tag set
15280eec728eSWenzhuo Lu~~~~~~~~~
15290eec728eSWenzhuo Lu
15300eec728eSWenzhuo LuEnable E-tag insertion for a VF on a port::
15310eec728eSWenzhuo Lu
15320eec728eSWenzhuo Lu   testpmd> E-tag set insertion on port-tag-id (value) port (port_id) vf (vf_id)
15330eec728eSWenzhuo Lu
15340eec728eSWenzhuo LuDisable E-tag insertion for a VF on a port::
15350eec728eSWenzhuo Lu
15360eec728eSWenzhuo Lu   testpmd> E-tag set insertion off port (port_id) vf (vf_id)
15370eec728eSWenzhuo Lu
15380eec728eSWenzhuo LuEnable/disable E-tag stripping on a port::
15390eec728eSWenzhuo Lu
15400eec728eSWenzhuo Lu   testpmd> E-tag set stripping (on|off) port (port_id)
15410eec728eSWenzhuo Lu
15420eec728eSWenzhuo LuEnable/disable E-tag based forwarding on a port::
15430eec728eSWenzhuo Lu
15440eec728eSWenzhuo Lu   testpmd> E-tag set forwarding (on|off) port (port_id)
15450eec728eSWenzhuo Lu
1546c73a9071SWei Daiconfig per port Rx offloading
1547c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1548c73a9071SWei Dai
1549c73a9071SWei DaiEnable or disable a per port Rx offloading on all Rx queues of a port::
1550c73a9071SWei Dai
1551c73a9071SWei Dai   testpmd> port config (port_id) rx_offload (offloading) on|off
1552c73a9071SWei Dai
1553c73a9071SWei Dai* ``offloading``: can be any of these offloading capability:
1554c73a9071SWei Dai                  vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1555c73a9071SWei Dai                  qinq_strip, outer_ipv4_cksum, macsec_strip,
1556020dbb4cSChengwen Feng                  vlan_filter, vlan_extend, scatter, timestamp, security,
1557020dbb4cSChengwen Feng                  keep_crc, rss_hash
1558c73a9071SWei Dai
1559c73a9071SWei DaiThis command should be run when the port is stopped, or else it will fail.
1560c73a9071SWei Dai
1561c73a9071SWei Daiconfig per queue Rx offloading
1562c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1563c73a9071SWei Dai
1564c73a9071SWei DaiEnable or disable a per queue Rx offloading only on a specific Rx queue::
1565c73a9071SWei Dai
1566c73a9071SWei Dai   testpmd> port (port_id) rxq (queue_id) rx_offload (offloading) on|off
1567c73a9071SWei Dai
1568c73a9071SWei Dai* ``offloading``: can be any of these offloading capability:
1569c73a9071SWei Dai                  vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro,
1570c73a9071SWei Dai                  qinq_strip, outer_ipv4_cksum, macsec_strip,
1571020dbb4cSChengwen Feng                  vlan_filter, vlan_extend, scatter, timestamp, security,
1572020dbb4cSChengwen Feng                  keep_crc
1573c73a9071SWei Dai
1574c73a9071SWei DaiThis command should be run when the port is stopped, or else it will fail.
1575c73a9071SWei Dai
1576c73a9071SWei Daiconfig per port Tx offloading
1577c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1578c73a9071SWei Dai
1579c73a9071SWei DaiEnable or disable a per port Tx offloading on all Tx queues of a port::
1580c73a9071SWei Dai
1581c73a9071SWei Dai   testpmd> port config (port_id) tx_offload (offloading) on|off
1582c73a9071SWei Dai
1583c73a9071SWei Dai* ``offloading``: can be any of these offloading capability:
1584d9ddc004SFerruh Yigit                  vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1585c73a9071SWei Dai                  sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1586c73a9071SWei Dai                  qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1587c73a9071SWei Dai                  ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1588d56ec3dcSDekel Peled                  mt_lockfree, multi_segs, mbuf_fast_free, security
1589c73a9071SWei Dai
1590c73a9071SWei DaiThis command should be run when the port is stopped, or else it will fail.
1591c73a9071SWei Dai
1592c73a9071SWei Daiconfig per queue Tx offloading
1593c73a9071SWei Dai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1594c73a9071SWei Dai
1595c73a9071SWei DaiEnable or disable a per queue Tx offloading only on a specific Tx queue::
1596c73a9071SWei Dai
1597c73a9071SWei Dai   testpmd> port (port_id) txq (queue_id) tx_offload (offloading) on|off
1598c73a9071SWei Dai
1599c73a9071SWei Dai* ``offloading``: can be any of these offloading capability:
1600d9ddc004SFerruh Yigit                  vlan_insert, ipv4_cksum, udp_cksum, tcp_cksum,
1601c73a9071SWei Dai                  sctp_cksum, tcp_tso, udp_tso, outer_ipv4_cksum,
1602c73a9071SWei Dai                  qinq_insert, vxlan_tnl_tso, gre_tnl_tso,
1603c73a9071SWei Dai                  ipip_tnl_tso, geneve_tnl_tso, macsec_insert,
1604e3386f9aSWei Dai                  mt_lockfree, multi_segs, mbuf_fast_free, security
1605c73a9071SWei Dai
1606c73a9071SWei DaiThis command should be run when the port is stopped, or else it will fail.
1607c73a9071SWei Dai
16081960be7dSNelio LaranjeiroConfig VXLAN Encap outer layers
16091960be7dSNelio Laranjeiro~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16101960be7dSNelio Laranjeiro
16111960be7dSNelio LaranjeiroConfigure the outer layer to encapsulate a packet inside a VXLAN tunnel::
16121960be7dSNelio Laranjeiro
16131960be7dSNelio Laranjeiro set vxlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
16141960be7dSNelio Laranjeiro udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) \
16151960be7dSNelio Laranjeiro eth-dst (eth-dst)
16161960be7dSNelio Laranjeiro
16171960be7dSNelio Laranjeiro set vxlan-with-vlan ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
16181960be7dSNelio Laranjeiro udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
16191960be7dSNelio Laranjeiro eth-src (eth-src) eth-dst (eth-dst)
16201960be7dSNelio Laranjeiro
162162e8a5a8SViacheslav Ovsiienko set vxlan-tos-ttl ip-version (ipv4|ipv6) vni (vni) udp-src (udp-src) \
162262e8a5a8SViacheslav Ovsiienko udp-dst (udp-dst) ip-tos (ip-tos) ip-ttl (ip-ttl) ip-src (ip-src) \
162362e8a5a8SViacheslav Ovsiienko ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
162462e8a5a8SViacheslav Ovsiienko
1625205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
16261960be7dSNelio Laranjeiroflow rule using the action vxlan_encap will use the last configuration set.
16271960be7dSNelio LaranjeiroTo have a different encapsulation header, one of those commands must be called
16281960be7dSNelio Laranjeirobefore the flow rule creation.
1629c73a9071SWei Dai
1630dcd962fcSNelio LaranjeiroConfig NVGRE Encap outer layers
1631dcd962fcSNelio Laranjeiro~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1632dcd962fcSNelio Laranjeiro
1633dcd962fcSNelio LaranjeiroConfigure the outer layer to encapsulate a packet inside a NVGRE tunnel::
1634dcd962fcSNelio Laranjeiro
1635dcd962fcSNelio Laranjeiro set nvgre ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) ip-dst (ip-dst) \
1636dcd962fcSNelio Laranjeiro        eth-src (eth-src) eth-dst (eth-dst)
1637dcd962fcSNelio Laranjeiro set nvgre-with-vlan ip-version (ipv4|ipv6) tni (tni) ip-src (ip-src) \
1638dcd962fcSNelio Laranjeiro        ip-dst (ip-dst) vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1639dcd962fcSNelio Laranjeiro
1640205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
1641dcd962fcSNelio Laranjeiroflow rule using the action nvgre_encap will use the last configuration set.
1642dcd962fcSNelio LaranjeiroTo have a different encapsulation header, one of those commands must be called
1643dcd962fcSNelio Laranjeirobefore the flow rule creation.
1644dcd962fcSNelio Laranjeiro
1645a1191d39SOri KamConfig L2 Encap
1646a1191d39SOri Kam~~~~~~~~~~~~~~~
1647a1191d39SOri Kam
1648a1191d39SOri KamConfigure the l2 to be used when encapsulating a packet with L2::
1649a1191d39SOri Kam
1650a1191d39SOri Kam set l2_encap ip-version (ipv4|ipv6) eth-src (eth-src) eth-dst (eth-dst)
1651a1191d39SOri Kam set l2_encap-with-vlan ip-version (ipv4|ipv6) vlan-tci (vlan-tci) \
1652a1191d39SOri Kam        eth-src (eth-src) eth-dst (eth-dst)
1653a1191d39SOri Kam
1654a1191d39SOri KamThose commands will set an internal configuration inside testpmd, any following
1655a1191d39SOri Kamflow rule using the action l2_encap will use the last configuration set.
1656a1191d39SOri KamTo have a different encapsulation header, one of those commands must be called
1657a1191d39SOri Kambefore the flow rule creation.
1658a1191d39SOri Kam
1659a1191d39SOri KamConfig L2 Decap
1660a1191d39SOri Kam~~~~~~~~~~~~~~~
1661a1191d39SOri Kam
1662a1191d39SOri KamConfigure the l2 to be removed when decapsulating a packet with L2::
1663a1191d39SOri Kam
1664a1191d39SOri Kam set l2_decap ip-version (ipv4|ipv6)
1665a1191d39SOri Kam set l2_decap-with-vlan ip-version (ipv4|ipv6)
1666a1191d39SOri Kam
1667a1191d39SOri KamThose commands will set an internal configuration inside testpmd, any following
1668a1191d39SOri Kamflow rule using the action l2_decap will use the last configuration set.
1669a1191d39SOri KamTo have a different encapsulation header, one of those commands must be called
1670a1191d39SOri Kambefore the flow rule creation.
1671a1191d39SOri Kam
16723e77031bSOri KamConfig MPLSoGRE Encap outer layers
16733e77031bSOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16743e77031bSOri Kam
16753e77031bSOri KamConfigure the outer layer to encapsulate a packet inside a MPLSoGRE tunnel::
16763e77031bSOri Kam
16773e77031bSOri Kam set mplsogre_encap ip-version (ipv4|ipv6) label (label) \
16783e77031bSOri Kam        ip-src (ip-src) ip-dst (ip-dst) eth-src (eth-src) eth-dst (eth-dst)
16793e77031bSOri Kam set mplsogre_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
16803e77031bSOri Kam        ip-src (ip-src) ip-dst (ip-dst) vlan-tci (vlan-tci) \
16813e77031bSOri Kam        eth-src (eth-src) eth-dst (eth-dst)
16823e77031bSOri Kam
1683205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
16843e77031bSOri Kamflow rule using the action mplsogre_encap will use the last configuration set.
16853e77031bSOri KamTo have a different encapsulation header, one of those commands must be called
16863e77031bSOri Kambefore the flow rule creation.
16873e77031bSOri Kam
16883e77031bSOri KamConfig MPLSoGRE Decap outer layers
16893e77031bSOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16903e77031bSOri Kam
16913e77031bSOri KamConfigure the outer layer to decapsulate MPLSoGRE packet::
16923e77031bSOri Kam
16933e77031bSOri Kam set mplsogre_decap ip-version (ipv4|ipv6)
16943e77031bSOri Kam set mplsogre_decap-with-vlan ip-version (ipv4|ipv6)
16953e77031bSOri Kam
1696205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
16973e77031bSOri Kamflow rule using the action mplsogre_decap will use the last configuration set.
16983e77031bSOri KamTo have a different decapsulation header, one of those commands must be called
16993e77031bSOri Kambefore the flow rule creation.
17003e77031bSOri Kam
1701a1191d39SOri KamConfig MPLSoUDP Encap outer layers
1702a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1703a1191d39SOri Kam
1704a1191d39SOri KamConfigure the outer layer to encapsulate a packet inside a MPLSoUDP tunnel::
1705a1191d39SOri Kam
1706a1191d39SOri Kam set mplsoudp_encap ip-version (ipv4|ipv6) label (label) udp-src (udp-src) \
1707a1191d39SOri Kam        udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1708a1191d39SOri Kam        eth-src (eth-src) eth-dst (eth-dst)
1709a1191d39SOri Kam set mplsoudp_encap-with-vlan ip-version (ipv4|ipv6) label (label) \
1710a1191d39SOri Kam        udp-src (udp-src) udp-dst (udp-dst) ip-src (ip-src) ip-dst (ip-dst) \
1711a1191d39SOri Kam        vlan-tci (vlan-tci) eth-src (eth-src) eth-dst (eth-dst)
1712a1191d39SOri Kam
1713205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
1714a1191d39SOri Kamflow rule using the action mplsoudp_encap will use the last configuration set.
1715a1191d39SOri KamTo have a different encapsulation header, one of those commands must be called
1716a1191d39SOri Kambefore the flow rule creation.
1717a1191d39SOri Kam
1718a1191d39SOri KamConfig MPLSoUDP Decap outer layers
1719a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1720a1191d39SOri Kam
1721a1191d39SOri KamConfigure the outer layer to decapsulate MPLSoUDP packet::
1722a1191d39SOri Kam
1723a1191d39SOri Kam set mplsoudp_decap ip-version (ipv4|ipv6)
1724a1191d39SOri Kam set mplsoudp_decap-with-vlan ip-version (ipv4|ipv6)
1725a1191d39SOri Kam
1726205d9d3cSDekel PeledThese commands will set an internal configuration inside testpmd, any following
1727a1191d39SOri Kamflow rule using the action mplsoudp_decap will use the last configuration set.
1728a1191d39SOri KamTo have a different decapsulation header, one of those commands must be called
1729a1191d39SOri Kambefore the flow rule creation.
1730a1191d39SOri Kam
173130626defSXiaoyu MinConfig Raw Encapsulation
173230626defSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~~
173330626defSXiaoyu Min
173430626defSXiaoyu MinConfigure the raw data to be used when encapsulating a packet by
173530626defSXiaoyu Minrte_flow_action_raw_encap::
173630626defSXiaoyu Min
1737739e045bSXiaoyu Min set raw_encap {index} {item} [/ {item} [...]] / end_set
1738739e045bSXiaoyu Min
1739739e045bSXiaoyu MinThere are multiple global buffers for ``raw_encap``, this command will set one
1740739e045bSXiaoyu Mininternal buffer index by ``{index}``.
1741739e045bSXiaoyu MinIf there is no ``{index}`` specified::
1742739e045bSXiaoyu Min
174330626defSXiaoyu Min set raw_encap {item} [/ {item} [...]] / end_set
174430626defSXiaoyu Min
1745739e045bSXiaoyu Minthe default index ``0`` is used.
1746739e045bSXiaoyu MinIn order to use different encapsulating header, ``index`` must be specified
1747739e045bSXiaoyu Minduring the flow rule creation::
1748739e045bSXiaoyu Min
1749739e045bSXiaoyu Min testpmd> flow create 0 egress pattern eth / ipv4 / end actions
1750739e045bSXiaoyu Min        raw_encap index 2 / end
1751739e045bSXiaoyu Min
1752739e045bSXiaoyu MinOtherwise the default index ``0`` is used.
175330626defSXiaoyu Min
175430626defSXiaoyu MinConfig Raw Decapsulation
175530626defSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~
175630626defSXiaoyu Min
175730626defSXiaoyu MinConfigure the raw data to be used when decapsulating a packet by
175830626defSXiaoyu Minrte_flow_action_raw_decap::
175930626defSXiaoyu Min
1760739e045bSXiaoyu Min set raw_decap {index} {item} [/ {item} [...]] / end_set
1761739e045bSXiaoyu Min
1762739e045bSXiaoyu MinThere are multiple global buffers for ``raw_decap``, this command will set
1763739e045bSXiaoyu Minone internal buffer index by ``{index}``.
1764739e045bSXiaoyu MinIf there is no ``{index}`` specified::
1765739e045bSXiaoyu Min
176630626defSXiaoyu Min set raw_decap {item} [/ {item} [...]] / end_set
176730626defSXiaoyu Min
1768739e045bSXiaoyu Minthe default index ``0`` is used.
1769739e045bSXiaoyu MinIn order to use different decapsulating header, ``index`` must be specified
1770739e045bSXiaoyu Minduring the flow rule creation::
1771739e045bSXiaoyu Min
1772739e045bSXiaoyu Min testpmd> flow create 0 egress pattern eth / ipv4 / end actions
1773739e045bSXiaoyu Min          raw_encap index 3 / end
1774739e045bSXiaoyu Min
1775739e045bSXiaoyu MinOtherwise the default index ``0`` is used.
177630626defSXiaoyu Min
1777b19da32eSMin Hu (Connor)Set fec mode
1778b19da32eSMin Hu (Connor)~~~~~~~~~~~~
1779b19da32eSMin Hu (Connor)
1780b19da32eSMin Hu (Connor)Set fec mode for a specific port::
1781b19da32eSMin Hu (Connor)
1782b19da32eSMin Hu (Connor)  testpmd> set port (port_id) fec_mode auto|off|rs|baser
1783b19da32eSMin Hu (Connor)
178401ee2e49SJiawei WangConfig Sample actions list
178501ee2e49SJiawei Wang~~~~~~~~~~~~~~~~~~~~~~~~~~
178601ee2e49SJiawei Wang
178701ee2e49SJiawei WangConfigure the sample actions list to be used when sampling a packet by
178801ee2e49SJiawei Wangrte_flow_action_sample::
178901ee2e49SJiawei Wang
179001ee2e49SJiawei Wang set sample_actions {index} {action} [/ {action} [...]] / end
179101ee2e49SJiawei Wang
179201ee2e49SJiawei WangThere are multiple global buffers for ``sample_actions``, this command will set
179301ee2e49SJiawei Wangone internal buffer index by ``{index}``.
179401ee2e49SJiawei Wang
179501ee2e49SJiawei WangIn order to use different sample actions list, ``index`` must be specified
179601ee2e49SJiawei Wangduring the flow rule creation::
179701ee2e49SJiawei Wang
179801ee2e49SJiawei Wang testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
179901ee2e49SJiawei Wang        sample ratio 2 index 2 / end
180001ee2e49SJiawei Wang
180101ee2e49SJiawei WangOtherwise the default index ``0`` is used.
1802b19da32eSMin Hu (Connor)
1803ac718398SBernard IremongerPort Functions
1804ac718398SBernard Iremonger--------------
1805ac718398SBernard Iremonger
1806ac718398SBernard IremongerThe following sections show functions for configuring ports.
1807ac718398SBernard Iremonger
1808ac718398SBernard Iremonger.. note::
1809ac718398SBernard Iremonger
1810ac718398SBernard Iremonger   Port configuration changes only become active when forwarding is started/restarted.
1811ac718398SBernard Iremonger
181285d9252eSMichael Baum.. _port_attach:
181385d9252eSMichael Baum
1814edab33b1STetsuya Mukawaport attach
1815edab33b1STetsuya Mukawa~~~~~~~~~~~
1816edab33b1STetsuya Mukawa
18174cd69cc8SPablo de LaraAttach a port specified by pci address or virtual device args::
18184cd69cc8SPablo de Lara
18194cd69cc8SPablo de Lara   testpmd> port attach (identifier)
1820edab33b1STetsuya Mukawa
1821edab33b1STetsuya MukawaTo attach a new pci device, the device should be recognized by kernel first.
1822edab33b1STetsuya MukawaThen it should be moved under DPDK management.
1823edab33b1STetsuya MukawaFinally the port can be attached to testpmd.
1824edab33b1STetsuya Mukawa
182581b97563SBernard IremongerFor example, to move a pci device using ixgbe under DPDK management:
1826edab33b1STetsuya Mukawa
1827edab33b1STetsuya Mukawa.. code-block:: console
1828edab33b1STetsuya Mukawa
1829e76d7a76SJohn McNamara   # Check the status of the available devices.
1830c6dab2a8SThomas Monjalon   ./usertools/dpdk-devbind.py --status
183181b97563SBernard Iremonger
183281b97563SBernard Iremonger   Network devices using DPDK-compatible driver
183381b97563SBernard Iremonger   ============================================
183481b97563SBernard Iremonger   <none>
183581b97563SBernard Iremonger
183681b97563SBernard Iremonger   Network devices using kernel driver
183781b97563SBernard Iremonger   ===================================
1838e76d7a76SJohn McNamara   0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=
183981b97563SBernard Iremonger
1840e76d7a76SJohn McNamara
1841e76d7a76SJohn McNamara   # Bind the device to igb_uio.
1842c6dab2a8SThomas Monjalon   sudo ./usertools/dpdk-devbind.py -b igb_uio 0000:0a:00.0
1843e76d7a76SJohn McNamara
1844e76d7a76SJohn McNamara
1845e76d7a76SJohn McNamara   # Recheck the status of the devices.
1846c6dab2a8SThomas Monjalon   ./usertools/dpdk-devbind.py --status
184781b97563SBernard Iremonger   Network devices using DPDK-compatible driver
184881b97563SBernard Iremonger   ============================================
1849e76d7a76SJohn McNamara   0000:0a:00.0 '82599ES 10-Gigabit' drv=igb_uio unused=
185081b97563SBernard Iremonger
185181b97563SBernard IremongerTo attach a port created by virtual device, above steps are not needed.
185281b97563SBernard Iremonger
185381b97563SBernard IremongerFor example, to attach a port whose pci address is 0000:0a:00.0.
185481b97563SBernard Iremonger
185581b97563SBernard Iremonger.. code-block:: console
185681b97563SBernard Iremonger
185781b97563SBernard Iremonger   testpmd> port attach 0000:0a:00.0
1858edab33b1STetsuya Mukawa   Attaching a new port...
185981b97563SBernard Iremonger   EAL: PCI device 0000:0a:00.0 on NUMA socket -1
186081b97563SBernard Iremonger   EAL:   probe driver: 8086:10fb rte_ixgbe_pmd
186181b97563SBernard Iremonger   EAL:   PCI memory mapped at 0x7f83bfa00000
186281b97563SBernard Iremonger   EAL:   PCI memory mapped at 0x7f83bfa80000
186381b97563SBernard Iremonger   PMD: eth_ixgbe_dev_init(): MAC: 2, PHY: 18, SFP+: 5
186481b97563SBernard Iremonger   PMD: eth_ixgbe_dev_init(): port 0 vendorID=0x8086 deviceID=0x10fb
1865edab33b1STetsuya Mukawa   Port 0 is attached. Now total ports is 1
1866edab33b1STetsuya Mukawa   Done
1867edab33b1STetsuya Mukawa
1868edab33b1STetsuya MukawaFor example, to attach a port created by pcap PMD.
1869edab33b1STetsuya Mukawa
1870edab33b1STetsuya Mukawa.. code-block:: console
1871edab33b1STetsuya Mukawa
187258c82067SThomas Monjalon   testpmd> port attach net_pcap0
1873edab33b1STetsuya Mukawa   Attaching a new port...
187458c82067SThomas Monjalon   PMD: Initializing pmd_pcap for net_pcap0
187581b97563SBernard Iremonger   PMD: Creating pcap-backed ethdev on numa socket 0
1876edab33b1STetsuya Mukawa   Port 0 is attached. Now total ports is 1
1877edab33b1STetsuya Mukawa   Done
1878edab33b1STetsuya Mukawa
187958c82067SThomas MonjalonIn this case, identifier is ``net_pcap0``.
1880e76d7a76SJohn McNamaraThis identifier format is the same as ``--vdev`` format of DPDK applications.
1881edab33b1STetsuya Mukawa
1882ef97d308SBernard IremongerFor example, to re-attach a bonded port which has been previously detached,
1883ef97d308SBernard Iremongerthe mode and slave parameters must be given.
1884ef97d308SBernard Iremonger
1885ef97d308SBernard Iremonger.. code-block:: console
1886ef97d308SBernard Iremonger
188758c82067SThomas Monjalon   testpmd> port attach net_bond_0,mode=0,slave=1
1888ef97d308SBernard Iremonger   Attaching a new port...
188958c82067SThomas Monjalon   EAL: Initializing pmd_bond for net_bond_0
189058c82067SThomas Monjalon   EAL: Create bonded device net_bond_0 on port 0 in mode 0 on socket 0.
1891ef97d308SBernard Iremonger   Port 0 is attached. Now total ports is 1
1892ef97d308SBernard Iremonger   Done
1893ef97d308SBernard Iremonger
1894ef97d308SBernard Iremonger
1895edab33b1STetsuya Mukawaport detach
1896edab33b1STetsuya Mukawa~~~~~~~~~~~
1897edab33b1STetsuya Mukawa
18984cd69cc8SPablo de LaraDetach a specific port::
1899edab33b1STetsuya Mukawa
1900e76d7a76SJohn McNamara   testpmd> port detach (port_id)
1901edab33b1STetsuya Mukawa
19024cd69cc8SPablo de LaraBefore detaching a port, the port should be stopped and closed.
19034cd69cc8SPablo de Lara
190481b97563SBernard IremongerFor example, to detach a pci device port 0.
1905edab33b1STetsuya Mukawa
1906edab33b1STetsuya Mukawa.. code-block:: console
1907edab33b1STetsuya Mukawa
19084cd69cc8SPablo de Lara   testpmd> port stop 0
19094cd69cc8SPablo de Lara   Stopping ports...
19104cd69cc8SPablo de Lara   Done
191181b97563SBernard Iremonger   testpmd> port close 0
191281b97563SBernard Iremonger   Closing ports...
191381b97563SBernard Iremonger   Done
1914e76d7a76SJohn McNamara
1915edab33b1STetsuya Mukawa   testpmd> port detach 0
1916edab33b1STetsuya Mukawa   Detaching a port...
191781b97563SBernard Iremonger   EAL: PCI device 0000:0a:00.0 on NUMA socket -1
191881b97563SBernard Iremonger   EAL:   remove driver: 8086:10fb rte_ixgbe_pmd
191981b97563SBernard Iremonger   EAL:   PCI memory unmapped at 0x7f83bfa00000
192081b97563SBernard Iremonger   EAL:   PCI memory unmapped at 0x7f83bfa80000
1921edab33b1STetsuya Mukawa   Done
1922e76d7a76SJohn McNamara
192381b97563SBernard Iremonger
192481b97563SBernard IremongerFor example, to detach a virtual device port 0.
192581b97563SBernard Iremonger
192681b97563SBernard Iremonger.. code-block:: console
192781b97563SBernard Iremonger
19284cd69cc8SPablo de Lara   testpmd> port stop 0
19294cd69cc8SPablo de Lara   Stopping ports...
19304cd69cc8SPablo de Lara   Done
193181b97563SBernard Iremonger   testpmd> port close 0
193281b97563SBernard Iremonger   Closing ports...
193381b97563SBernard Iremonger   Done
1934e76d7a76SJohn McNamara
193581b97563SBernard Iremonger   testpmd> port detach 0
193681b97563SBernard Iremonger   Detaching a port...
193781b97563SBernard Iremonger   PMD: Closing pcap ethdev on numa socket 0
193858c82067SThomas Monjalon   Port 'net_pcap0' is detached. Now total ports is 0
193981b97563SBernard Iremonger   Done
194081b97563SBernard Iremonger
194181b97563SBernard IremongerTo remove a pci device completely from the system, first detach the port from testpmd.
194281b97563SBernard IremongerThen the device should be moved under kernel management.
194381b97563SBernard IremongerFinally the device can be removed using kernel pci hotplug functionality.
194481b97563SBernard Iremonger
194581b97563SBernard IremongerFor example, to move a pci device under kernel management:
194681b97563SBernard Iremonger
194781b97563SBernard Iremonger.. code-block:: console
194881b97563SBernard Iremonger
1949c6dab2a8SThomas Monjalon   sudo ./usertools/dpdk-devbind.py -b ixgbe 0000:0a:00.0
1950e76d7a76SJohn McNamara
1951c6dab2a8SThomas Monjalon   ./usertools/dpdk-devbind.py --status
195281b97563SBernard Iremonger
195381b97563SBernard Iremonger   Network devices using DPDK-compatible driver
195481b97563SBernard Iremonger   ============================================
195581b97563SBernard Iremonger   <none>
195681b97563SBernard Iremonger
195781b97563SBernard Iremonger   Network devices using kernel driver
195881b97563SBernard Iremonger   ===================================
1959e76d7a76SJohn McNamara   0000:0a:00.0 '82599ES 10-Gigabit' if=eth2 drv=ixgbe unused=igb_uio
196081b97563SBernard Iremonger
196181b97563SBernard IremongerTo remove a port created by a virtual device, above steps are not needed.
1962edab33b1STetsuya Mukawa
1963ac718398SBernard Iremongerport start
1964ac718398SBernard Iremonger~~~~~~~~~~
1965ac718398SBernard Iremonger
1966e76d7a76SJohn McNamaraStart all ports or a specific port::
1967ac718398SBernard Iremonger
1968e76d7a76SJohn McNamara   testpmd> port start (port_id|all)
1969ac718398SBernard Iremonger
1970ac718398SBernard Iremongerport stop
1971ac718398SBernard Iremonger~~~~~~~~~
1972ac718398SBernard Iremonger
1973e76d7a76SJohn McNamaraStop all ports or a specific port::
1974ac718398SBernard Iremonger
1975e76d7a76SJohn McNamara   testpmd> port stop (port_id|all)
1976ac718398SBernard Iremonger
1977ac718398SBernard Iremongerport close
1978ac718398SBernard Iremonger~~~~~~~~~~
1979ac718398SBernard Iremonger
1980e76d7a76SJohn McNamaraClose all ports or a specific port::
1981ac718398SBernard Iremonger
1982e76d7a76SJohn McNamara   testpmd> port close (port_id|all)
1983ac718398SBernard Iremonger
19841cde1b9aSShougang Wangport reset
19851cde1b9aSShougang Wang~~~~~~~~~~
19861cde1b9aSShougang Wang
19871cde1b9aSShougang WangReset all ports or a specific port::
19881cde1b9aSShougang Wang
19891cde1b9aSShougang Wang   testpmd> port reset (port_id|all)
19901cde1b9aSShougang Wang
19911cde1b9aSShougang WangUser should stop port(s) before resetting and (re-)start after reset.
19921cde1b9aSShougang Wang
19931a77cffaSQi Zhangport config - queue ring size
19941a77cffaSQi Zhang~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19951a77cffaSQi Zhang
19961a77cffaSQi ZhangConfigure a rx/tx queue ring size::
19971a77cffaSQi Zhang
19981a77cffaSQi Zhang   testpmd> port (port_id) (rxq|txq) (queue_id) ring_size (value)
19991a77cffaSQi Zhang
20001a77cffaSQi ZhangOnly take effect after command that (re-)start the port or command that setup specific queue.
20011a77cffaSQi Zhang
20026fe5f2f7SPablo de Laraport start/stop queue
20036fe5f2f7SPablo de Lara~~~~~~~~~~~~~~~~~~~~~
20046fe5f2f7SPablo de Lara
2005e76d7a76SJohn McNamaraStart/stop a rx/tx queue on a specific port::
20066fe5f2f7SPablo de Lara
2007e76d7a76SJohn McNamara   testpmd> port (port_id) (rxq|txq) (queue_id) (start|stop)
20086fe5f2f7SPablo de Lara
2009d3a67720SIan Dolzhanskyport config - queue deferred start
2010d3a67720SIan Dolzhansky~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2011d3a67720SIan Dolzhansky
2012d3a67720SIan DolzhanskySwitch on/off deferred start of a specific port queue::
2013d3a67720SIan Dolzhansky
2014d3a67720SIan Dolzhansky   testpmd> port (port_id) (rxq|txq) (queue_id) deferred_start (on|off)
2015d3a67720SIan Dolzhansky
2016d326e671SQi Zhangport setup queue
2017d326e671SQi Zhang~~~~~~~~~~~~~~~~~~~~~
2018d326e671SQi Zhang
2019d326e671SQi ZhangSetup a rx/tx queue on a specific port::
2020d326e671SQi Zhang
2021d326e671SQi Zhang   testpmd> port (port_id) (rxq|txq) (queue_id) setup
2022d326e671SQi Zhang
20236fe5f2f7SPablo de LaraOnly take effect when port is started.
20246fe5f2f7SPablo de Lara
2025ac718398SBernard Iremongerport config - speed
2026ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~
2027ac718398SBernard Iremonger
2028e76d7a76SJohn McNamaraSet the speed and duplex mode for all ports or a specific port::
2029ac718398SBernard Iremonger
2030f6eb3938SAsaf Penso   testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|200000|auto) \
2031e76d7a76SJohn McNamara            duplex (half|full|auto)
2032ac718398SBernard Iremonger
2033ac718398SBernard Iremongerport config - queues/descriptors
2034ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2035ac718398SBernard Iremonger
2036e76d7a76SJohn McNamaraSet number of queues/descriptors for rxq, txq, rxd and txd::
2037ac718398SBernard Iremonger
2038e76d7a76SJohn McNamara   testpmd> port config all (rxq|txq|rxd|txd) (value)
2039ac718398SBernard Iremonger
2040e76d7a76SJohn McNamaraThis is equivalent to the ``--rxq``, ``--txq``, ``--rxd`` and ``--txd`` command-line options.
2041ac718398SBernard Iremonger
2042ac718398SBernard Iremongerport config - max-pkt-len
2043ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~
2044ac718398SBernard Iremonger
2045e76d7a76SJohn McNamaraSet the maximum packet length::
2046ac718398SBernard Iremonger
2047e76d7a76SJohn McNamara   testpmd> port config all max-pkt-len (value)
2048ac718398SBernard Iremonger
2049e76d7a76SJohn McNamaraThis is equivalent to the ``--max-pkt-len`` command-line option.
2050ac718398SBernard Iremonger
20514a729092SDekel Peledport config - max-lro-pkt-size
20524a729092SDekel Peled~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20534a729092SDekel Peled
20544a729092SDekel PeledSet the maximum LRO aggregated packet size::
20554a729092SDekel Peled
20564a729092SDekel Peled   testpmd> port config all max-lro-pkt-size (value)
20574a729092SDekel Peled
20584a729092SDekel PeledThis is equivalent to the ``--max-lro-pkt-size`` command-line option.
20594a729092SDekel Peled
2060ac718398SBernard Iremongerport config - Drop Packets
2061ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~~~~
2062ac718398SBernard Iremonger
2063e5db17a1SFlavia MusatescuEnable or disable packet drop on all RX queues of all ports when no receive buffers available::
2064ac718398SBernard Iremonger
2065e76d7a76SJohn McNamara   testpmd> port config all drop-en (on|off)
2066ac718398SBernard Iremonger
2067e5db17a1SFlavia MusatescuPacket dropping when no receive buffers available is off by default.
2068ac718398SBernard Iremonger
2069e76d7a76SJohn McNamaraThe ``on`` option is equivalent to the ``--enable-drop-en`` command-line option.
2070ac718398SBernard Iremonger
2071ac718398SBernard Iremongerport config - RSS
2072ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~
2073ac718398SBernard Iremonger
2074e76d7a76SJohn McNamaraSet the RSS (Receive Side Scaling) mode on or off::
20759ad341b5SHuisong Li   testpmd> port config all rss (all|default|level-default|level-outer|level-inner| \
20769ad341b5SHuisong Li                                 ip|tcp|udp|sctp|tunnel|vlan|none| \
20779ad341b5SHuisong Li                                 ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other| \
20789ad341b5SHuisong Li                                 ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
20799ad341b5SHuisong Li                                 ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex| \
20809ad341b5SHuisong Li                                 l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan| \
20819ad341b5SHuisong Li                                 esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum| \
20829ad341b5SHuisong Li                                 l2tpv2|l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32| \
20839ad341b5SHuisong Li                                 l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|<rsstype_id>)
2084ac718398SBernard Iremonger
2085ac718398SBernard IremongerRSS is on by default.
2086ac718398SBernard Iremonger
2087f840cf77SJie WangThe ``all`` option is equivalent to eth|vlan|ip|tcp|udp|sctp|ether|l2tpv3|esp|ah|pfcp|l2tpv2.
2088a8a54489SJeff Guo
2089d9aa619cSXueming LiThe ``default`` option enables all supported RSS types reported by device info.
2090a8a54489SJeff Guo
2091e76d7a76SJohn McNamaraThe ``none`` option is equivalent to the ``--disable-rss`` command-line option.
2092ac718398SBernard Iremonger
2093ac718398SBernard Iremongerport config - RSS Reta
2094ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~
2095ac718398SBernard Iremonger
2096e76d7a76SJohn McNamaraSet the RSS (Receive Side Scaling) redirection table::
2097ac718398SBernard Iremonger
2098e76d7a76SJohn McNamara   testpmd> port config all rss reta (hash,queue)[,(hash,queue)]
2099ac718398SBernard Iremonger
2100ac718398SBernard Iremongerport config - DCB
2101ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~
2102ac718398SBernard Iremonger
2103e76d7a76SJohn McNamaraSet the DCB mode for an individual port::
2104ac718398SBernard Iremonger
2105e76d7a76SJohn McNamara   testpmd> port config (port_id) dcb vt (on|off) (traffic_class) pfc (on|off)
2106ac718398SBernard Iremonger
2107ac718398SBernard IremongerThe traffic class should be 4 or 8.
2108ac718398SBernard Iremonger
2109ac718398SBernard Iremongerport config - Burst
2110ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~
2111ac718398SBernard Iremonger
2112e76d7a76SJohn McNamaraSet the number of packets per burst::
2113ac718398SBernard Iremonger
2114e76d7a76SJohn McNamara   testpmd> port config all burst (value)
2115ac718398SBernard Iremonger
2116e76d7a76SJohn McNamaraThis is equivalent to the ``--burst`` command-line option.
2117ac718398SBernard Iremonger
2118ac718398SBernard Iremongerport config - Threshold
2119ac718398SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~~
2120ac718398SBernard Iremonger
2121e76d7a76SJohn McNamaraSet thresholds for TX/RX queues::
2122ac718398SBernard Iremonger
2123e76d7a76SJohn McNamara   testpmd> port config all (threshold) (value)
2124ac718398SBernard Iremonger
2125ac718398SBernard IremongerWhere the threshold type can be:
2126ac718398SBernard Iremonger
2127e76d7a76SJohn McNamara* ``txpt:`` Set the prefetch threshold register of the TX rings, 0 <= value <= 255.
2128ac718398SBernard Iremonger
2129e76d7a76SJohn McNamara* ``txht:`` Set the host threshold register of the TX rings, 0 <= value <= 255.
2130ac718398SBernard Iremonger
2131e76d7a76SJohn McNamara* ``txwt:`` Set the write-back threshold register of the TX rings, 0 <= value <= 255.
2132ac718398SBernard Iremonger
2133e76d7a76SJohn McNamara* ``rxpt:`` Set the prefetch threshold register of the RX rings, 0 <= value <= 255.
2134ac718398SBernard Iremonger
2135e76d7a76SJohn McNamara* ``rxht:`` Set the host threshold register of the RX rings, 0 <= value <= 255.
2136ac718398SBernard Iremonger
2137e76d7a76SJohn McNamara* ``rxwt:`` Set the write-back threshold register of the RX rings, 0 <= value <= 255.
2138ac718398SBernard Iremonger
2139e76d7a76SJohn McNamara* ``txfreet:`` Set the transmit free threshold of the TX rings, 0 <= value <= txd.
2140ac718398SBernard Iremonger
2141e76d7a76SJohn McNamara* ``rxfreet:`` Set the transmit free threshold of the RX rings, 0 <= value <= rxd.
2142ac718398SBernard Iremonger
2143e76d7a76SJohn McNamara* ``txrst:`` Set the transmit RS bit threshold of TX rings, 0 <= value <= txd.
2144e76d7a76SJohn McNamara
2145ac718398SBernard IremongerThese threshold options are also available from the command-line.
2146ac718398SBernard Iremonger
21475a4806d3SKirill Rybalchenkoport config pctype mapping
21485a4806d3SKirill Rybalchenko~~~~~~~~~~~~~~~~~~~~~~~~~~
21495a4806d3SKirill Rybalchenko
21505a4806d3SKirill RybalchenkoReset pctype mapping table::
21515a4806d3SKirill Rybalchenko
21525a4806d3SKirill Rybalchenko   testpmd> port config (port_id) pctype mapping reset
21535a4806d3SKirill Rybalchenko
21545a4806d3SKirill RybalchenkoUpdate hardware defined pctype to software defined flow type mapping table::
21555a4806d3SKirill Rybalchenko
21565a4806d3SKirill Rybalchenko   testpmd> port config (port_id) pctype mapping update (pctype_id_0[,pctype_id_1]*) (flow_type_id)
21575a4806d3SKirill Rybalchenko
21585a4806d3SKirill Rybalchenkowhere:
21595a4806d3SKirill Rybalchenko
21605a4806d3SKirill Rybalchenko* ``pctype_id_x``: hardware pctype id as index of bit in bitmask value of the pctype mapping table.
21615a4806d3SKirill Rybalchenko
21625a4806d3SKirill Rybalchenko* ``flow_type_id``: software flow type id as the index of the pctype mapping table.
21635a4806d3SKirill Rybalchenko
2164e38ea44fSBeilei Xingport config input set
2165e38ea44fSBeilei Xing~~~~~~~~~~~~~~~~~~~~~
2166e38ea44fSBeilei Xing
2167e38ea44fSBeilei XingConfig RSS/FDIR/FDIR flexible payload input set for some pctype::
21687fa1a2deSKevin Traynor
2169e38ea44fSBeilei Xing   testpmd> port config (port_id) pctype (pctype_id) \
2170e38ea44fSBeilei Xing            (hash_inset|fdir_inset|fdir_flx_inset) \
2171e38ea44fSBeilei Xing	    (get|set|clear) field (field_idx)
2172e38ea44fSBeilei Xing
2173e38ea44fSBeilei XingClear RSS/FDIR/FDIR flexible payload input set for some pctype::
21747fa1a2deSKevin Traynor
2175e38ea44fSBeilei Xing   testpmd> port config (port_id) pctype (pctype_id) \
2176e38ea44fSBeilei Xing            (hash_inset|fdir_inset|fdir_flx_inset) clear all
2177e38ea44fSBeilei Xing
2178e38ea44fSBeilei Xingwhere:
2179e38ea44fSBeilei Xing
2180e38ea44fSBeilei Xing* ``pctype_id``: hardware packet classification types.
2181e38ea44fSBeilei Xing* ``field_idx``: hardware field index.
2182e76d7a76SJohn McNamara
218308e0b344SShahed Shaikhport config udp_tunnel_port
218408e0b344SShahed Shaikh~~~~~~~~~~~~~~~~~~~~~~~~~~~
218508e0b344SShahed Shaikh
218608e0b344SShahed ShaikhAdd/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
21877fa1a2deSKevin Traynor
2188934f36b5SJeff Guo    testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe|ecpri (udp_port)
218908e0b344SShahed Shaikh
2190c18feafaSDekel Peledport config tx_metadata
2191c18feafaSDekel Peled~~~~~~~~~~~~~~~~~~~~~~~
2192c18feafaSDekel Peled
2193c18feafaSDekel PeledSet Tx metadata value per port.
2194c18feafaSDekel Peledtestpmd will add this value to any Tx packet sent from this port::
2195c18feafaSDekel Peled
2196c18feafaSDekel Peled   testpmd> port config (port_id) tx_metadata (value)
2197c18feafaSDekel Peled
2198b57b66a9SOri Kamport config dynf
2199b57b66a9SOri Kam~~~~~~~~~~~~~~~~
2200b57b66a9SOri Kam
2201b57b66a9SOri KamSet/clear dynamic flag per port.
2202b57b66a9SOri Kamtestpmd will register this flag in the mbuf (same registration
2203b57b66a9SOri Kamfor both Tx and Rx). Then set/clear this flag for each Tx
2204b57b66a9SOri Kampacket sent from this port. The set bit only works for Tx packet::
2205b57b66a9SOri Kam
2206b57b66a9SOri Kam   testpmd> port config (port_id) dynf (name) (set|clear)
2207b57b66a9SOri Kam
2208d82ee2ccSAgalya Babu RadhaKrishnanport config mtu
2209d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~
2210d82ee2ccSAgalya Babu RadhaKrishnan
2211d82ee2ccSAgalya Babu RadhaKrishnanTo configure MTU(Maximum Transmission Unit) on devices using testpmd::
2212d82ee2ccSAgalya Babu RadhaKrishnan
2213d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> port config mtu (port_id) (value)
2214d82ee2ccSAgalya Babu RadhaKrishnan
2215d82ee2ccSAgalya Babu RadhaKrishnanport config rss hash key
2216d82ee2ccSAgalya Babu RadhaKrishnan~~~~~~~~~~~~~~~~~~~~~~~~
2217d82ee2ccSAgalya Babu RadhaKrishnan
2218d82ee2ccSAgalya Babu RadhaKrishnanTo configure the RSS hash key used to compute the RSS
2219d82ee2ccSAgalya Babu RadhaKrishnanhash of input [IP] packets received on port::
2220d82ee2ccSAgalya Babu RadhaKrishnan
2221d82ee2ccSAgalya Babu RadhaKrishnan   testpmd> port config <port_id> rss-hash-key (ipv4|ipv4-frag|\
2222d82ee2ccSAgalya Babu RadhaKrishnan                     ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|\
2223d82ee2ccSAgalya Babu RadhaKrishnan                     ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|\
2224d82ee2ccSAgalya Babu RadhaKrishnan                     ipv6-other|l2-payload|ipv6-ex|ipv6-tcp-ex|\
2225d82ee2ccSAgalya Babu RadhaKrishnan                     ipv6-udp-ex <string of hex digits \
2226d82ee2ccSAgalya Babu RadhaKrishnan                     (variable length, NIC dependent)>)
2227d82ee2ccSAgalya Babu RadhaKrishnan
2228bafe8a68SChengwen Fengport cleanup txq mbufs
2229bafe8a68SChengwen Feng~~~~~~~~~~~~~~~~~~~~~~
2230bafe8a68SChengwen Feng
2231bafe8a68SChengwen FengTo cleanup txq mbufs currently cached by driver::
2232bafe8a68SChengwen Feng
2233bafe8a68SChengwen Feng   testpmd> port cleanup (port_id) txq (queue_id) (free_cnt)
2234bafe8a68SChengwen Feng
2235bafe8a68SChengwen FengIf the value of ``free_cnt`` is 0, driver should free all cached mbufs.
2236bafe8a68SChengwen Feng
223755e51c96SNithin DabilpuramDevice Functions
223855e51c96SNithin Dabilpuram----------------
223955e51c96SNithin Dabilpuram
224055e51c96SNithin DabilpuramThe following sections show functions for device operations.
224155e51c96SNithin Dabilpuram
224255e51c96SNithin Dabilpuramdevice detach
224355e51c96SNithin Dabilpuram~~~~~~~~~~~~~
224455e51c96SNithin Dabilpuram
224555e51c96SNithin DabilpuramDetach a device specified by pci address or virtual device args::
224655e51c96SNithin Dabilpuram
224755e51c96SNithin Dabilpuram   testpmd> device detach (identifier)
224855e51c96SNithin Dabilpuram
224955e51c96SNithin DabilpuramBefore detaching a device associated with ports, the ports should be stopped and closed.
225055e51c96SNithin Dabilpuram
225155e51c96SNithin DabilpuramFor example, to detach a pci device whose address is 0002:03:00.0.
225255e51c96SNithin Dabilpuram
225355e51c96SNithin Dabilpuram.. code-block:: console
225455e51c96SNithin Dabilpuram
225555e51c96SNithin Dabilpuram    testpmd> device detach 0002:03:00.0
225655e51c96SNithin Dabilpuram    Removing a device...
225755e51c96SNithin Dabilpuram    Port 1 is now closed
225855e51c96SNithin Dabilpuram    EAL: Releasing pci mapped resource for 0002:03:00.0
225955e51c96SNithin Dabilpuram    EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218a050000
226055e51c96SNithin Dabilpuram    EAL: Calling pci_unmap_resource for 0002:03:00.0 at 0x218c050000
226155e51c96SNithin Dabilpuram    Device 0002:03:00.0 is detached
226255e51c96SNithin Dabilpuram    Now total ports is 1
226355e51c96SNithin Dabilpuram
226455e51c96SNithin DabilpuramFor example, to detach a port created by pcap PMD.
226555e51c96SNithin Dabilpuram
226655e51c96SNithin Dabilpuram.. code-block:: console
226755e51c96SNithin Dabilpuram
226855e51c96SNithin Dabilpuram    testpmd> device detach net_pcap0
226955e51c96SNithin Dabilpuram    Removing a device...
227055e51c96SNithin Dabilpuram    Port 0 is now closed
227155e51c96SNithin Dabilpuram    Device net_pcap0 is detached
227255e51c96SNithin Dabilpuram    Now total ports is 0
227355e51c96SNithin Dabilpuram    Done
227455e51c96SNithin Dabilpuram
227555e51c96SNithin DabilpuramIn this case, identifier is ``net_pcap0``.
227655e51c96SNithin DabilpuramThis identifier format is the same as ``--vdev`` format of DPDK applications.
227755e51c96SNithin Dabilpuram
2278ac718398SBernard IremongerLink Bonding Functions
2279ac718398SBernard Iremonger----------------------
2280ac718398SBernard Iremonger
2281ac718398SBernard IremongerThe Link Bonding functions make it possible to dynamically create and
2282ac718398SBernard Iremongermanage link bonding devices from within testpmd interactive prompt.
2283ac718398SBernard Iremonger
2284703178f8SDavid MarchandSee :doc:`../prog_guide/link_bonding_poll_mode_drv_lib` for more information.
2285e76d7a76SJohn McNamara
2286f06125c0SJasvinder SinghTraffic Metering and Policing
2287f06125c0SJasvinder Singh-----------------------------
2288f06125c0SJasvinder Singh
2289f06125c0SJasvinder SinghThe following section shows functions for configuring traffic metering and
2290f06125c0SJasvinder Singhpolicing on the ethernet device through the use of generic ethdev API.
2291f06125c0SJasvinder Singh
2292f06125c0SJasvinder Singhshow port traffic management capability
2293f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2294f06125c0SJasvinder Singh
2295f06125c0SJasvinder SinghShow traffic metering and policing capability of the port::
2296f06125c0SJasvinder Singh
2297f06125c0SJasvinder Singh   testpmd> show port meter cap (port_id)
2298f06125c0SJasvinder Singh
2299f06125c0SJasvinder Singhadd port meter profile (srTCM rfc2967)
2300f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2301f06125c0SJasvinder Singh
2302f06125c0SJasvinder SinghAdd meter profile (srTCM rfc2697) to the ethernet device::
2303f06125c0SJasvinder Singh
2304f06125c0SJasvinder Singh   testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
2305c5a3860fSLi Zhang   (cir) (cbs) (ebs) (packet_mode)
2306f06125c0SJasvinder Singh
2307f06125c0SJasvinder Singhwhere:
2308f06125c0SJasvinder Singh
2309f06125c0SJasvinder Singh* ``profile_id``: ID for the meter profile.
2310c5a3860fSLi Zhang* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
2311c5a3860fSLi Zhang* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
2312c5a3860fSLi Zhang* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
2313c5a3860fSLi Zhang* ``packet_mode``: Packets mode for meter profile.
2314f06125c0SJasvinder Singh
2315f06125c0SJasvinder Singhadd port meter profile (trTCM rfc2968)
2316f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2317f06125c0SJasvinder Singh
2318f06125c0SJasvinder SinghAdd meter profile (srTCM rfc2698) to the ethernet device::
2319f06125c0SJasvinder Singh
2320f06125c0SJasvinder Singh   testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
2321c5a3860fSLi Zhang   (cir) (pir) (cbs) (pbs) (packet_mode)
2322f06125c0SJasvinder Singh
2323f06125c0SJasvinder Singhwhere:
2324f06125c0SJasvinder Singh
2325f06125c0SJasvinder Singh* ``profile_id``: ID for the meter profile.
2326c5a3860fSLi Zhang* ``cir``: Committed information rate (bytes per second or packets per second).
2327c5a3860fSLi Zhang* ``pir``: Peak information rate (bytes per second or packets per second).
2328c5a3860fSLi Zhang* ``cbs``: Committed burst size (bytes or packets).
2329c5a3860fSLi Zhang* ``pbs``: Peak burst size (bytes or packets).
2330c5a3860fSLi Zhang* ``packet_mode``: Packets mode for meter profile.
2331f06125c0SJasvinder Singh
2332f06125c0SJasvinder Singhadd port meter profile (trTCM rfc4115)
2333f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2334f06125c0SJasvinder Singh
2335f06125c0SJasvinder SinghAdd meter profile (trTCM rfc4115) to the ethernet device::
2336f06125c0SJasvinder Singh
2337f06125c0SJasvinder Singh   testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
2338c5a3860fSLi Zhang   (cir) (eir) (cbs) (ebs) (packet_mode)
2339f06125c0SJasvinder Singh
2340f06125c0SJasvinder Singhwhere:
2341f06125c0SJasvinder Singh
2342f06125c0SJasvinder Singh* ``profile_id``: ID for the meter profile.
2343c5a3860fSLi Zhang* ``cir``: Committed information rate (bytes per second or packets per second).
2344c5a3860fSLi Zhang* ``eir``: Excess information rate (bytes per second or packets per second).
2345c5a3860fSLi Zhang* ``cbs``: Committed burst size (bytes or packets).
2346c5a3860fSLi Zhang* ``ebs``: Excess burst size (bytes or packets).
2347c5a3860fSLi Zhang* ``packet_mode``: Packets mode for meter profile.
2348f06125c0SJasvinder Singh
2349f06125c0SJasvinder Singhdelete port meter profile
2350f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~
2351f06125c0SJasvinder Singh
2352f06125c0SJasvinder SinghDelete meter profile from the ethernet device::
2353f06125c0SJasvinder Singh
2354f06125c0SJasvinder Singh   testpmd> del port meter profile (port_id) (profile_id)
2355f06125c0SJasvinder Singh
2356f29fa2c5SHaifei Luocreate port policy
2357f29fa2c5SHaifei Luo~~~~~~~~~~~~~~~~~~
2358f29fa2c5SHaifei Luo
2359f29fa2c5SHaifei LuoCreate new policy object for the ethernet device::
2360f29fa2c5SHaifei Luo
2361f29fa2c5SHaifei Luo   testpmd> add port meter policy (port_id) (policy_id) g_actions \
2362f29fa2c5SHaifei Luo   {action} y_actions {action} r_actions {action}
2363f29fa2c5SHaifei Luo
2364f29fa2c5SHaifei Luowhere:
2365f29fa2c5SHaifei Luo
2366f29fa2c5SHaifei Luo* ``policy_id``: policy ID.
2367f29fa2c5SHaifei Luo* ``action``: action lists for green/yellow/red colors.
2368f29fa2c5SHaifei Luo
2369f29fa2c5SHaifei Luodelete port policy
2370f29fa2c5SHaifei Luo~~~~~~~~~~~~~~~~~~
2371f29fa2c5SHaifei Luo
2372f29fa2c5SHaifei LuoDelete policy object for the ethernet device::
2373f29fa2c5SHaifei Luo
2374f29fa2c5SHaifei Luo   testpmd> del port meter policy (port_id) (policy_id)
2375f29fa2c5SHaifei Luo
2376f29fa2c5SHaifei Luowhere:
2377f29fa2c5SHaifei Luo
2378f29fa2c5SHaifei Luo* ``policy_id``: policy ID.
2379f29fa2c5SHaifei Luo
2380f06125c0SJasvinder Singhcreate port meter
2381f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~
2382f06125c0SJasvinder Singh
2383f06125c0SJasvinder SinghCreate new meter object for the ethernet device::
2384f06125c0SJasvinder Singh
2385f06125c0SJasvinder Singh   testpmd> create port meter (port_id) (mtr_id) (profile_id) \
23869f5488e3SSunil Kumar Kori   (policy_id) (meter_enable) (stats_mask) (shared) (default_input_color) \
2387f06125c0SJasvinder Singh   (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\
23889f5488e3SSunil Kumar Kori   (dscp_tbl_entry63)] [(vlan_tbl_entry0) (vlan_tbl_entry1) ... \
23899f5488e3SSunil Kumar Kori   (vlan_tbl_entry15)]
2390f06125c0SJasvinder Singh
2391f06125c0SJasvinder Singhwhere:
2392f06125c0SJasvinder Singh
2393f06125c0SJasvinder Singh* ``mtr_id``: meter object ID.
2394f06125c0SJasvinder Singh* ``profile_id``: ID for the meter profile.
2395f29fa2c5SHaifei Luo* ``policy_id``: ID for the policy.
2396f06125c0SJasvinder Singh* ``meter_enable``: When this parameter has a non-zero value, the meter object
2397f06125c0SJasvinder Singh  gets enabled at the time of creation, otherwise remains disabled.
2398f06125c0SJasvinder Singh* ``stats_mask``: Mask of statistics counter types to be enabled for the
2399f06125c0SJasvinder Singh  meter object.
2400f06125c0SJasvinder Singh* ``shared``:  When this parameter has a non-zero value, the meter object is
2401f06125c0SJasvinder Singh  shared by multiple flows. Otherwise, meter object is used by single flow.
24029f5488e3SSunil Kumar Kori* ``default_input_color``:  Default input color for incoming packets.
24039f5488e3SSunil Kumar Kori  If incoming packet misses DSCP or VLAN input color table then it will be used
24049f5488e3SSunil Kumar Kori  as input color.
2405f06125c0SJasvinder Singh* ``use_pre_meter_color``: When this parameter has a non-zero value, the
2406f06125c0SJasvinder Singh  input color for the current meter object is determined by the latest meter
2407f06125c0SJasvinder Singh  object in the same flow. Otherwise, the current meter object uses the
2408f06125c0SJasvinder Singh  *dscp_table* to determine the input color.
2409f06125c0SJasvinder Singh* ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input
2410f06125c0SJasvinder Singh  color, 0 <= x <= 63.
24119f5488e3SSunil Kumar Kori* ``vlan_tbl_entryx``: VLAN table entry x providing meter input color,
24129f5488e3SSunil Kumar Kori  0 <= x <= 15.
2413f06125c0SJasvinder Singh
2414f06125c0SJasvinder Singhenable port meter
2415f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~
2416f06125c0SJasvinder Singh
2417f06125c0SJasvinder SinghEnable meter for the ethernet device::
2418f06125c0SJasvinder Singh
2419f06125c0SJasvinder Singh   testpmd> enable port meter (port_id) (mtr_id)
2420f06125c0SJasvinder Singh
2421f06125c0SJasvinder Singhdisable port meter
2422f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~
2423f06125c0SJasvinder Singh
2424f06125c0SJasvinder SinghDisable meter for the ethernet device::
2425f06125c0SJasvinder Singh
2426f06125c0SJasvinder Singh   testpmd> disable port meter (port_id) (mtr_id)
2427f06125c0SJasvinder Singh
2428f06125c0SJasvinder Singhdelete port meter
2429f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~
2430f06125c0SJasvinder Singh
2431f06125c0SJasvinder SinghDelete meter for the ethernet device::
2432f06125c0SJasvinder Singh
2433f06125c0SJasvinder Singh   testpmd> del port meter (port_id) (mtr_id)
2434f06125c0SJasvinder Singh
2435f06125c0SJasvinder SinghSet port meter profile
2436f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~
2437f06125c0SJasvinder Singh
2438f06125c0SJasvinder SinghSet meter profile for the ethernet device::
2439f06125c0SJasvinder Singh
2440f06125c0SJasvinder Singh   testpmd> set port meter profile (port_id) (mtr_id) (profile_id)
2441f06125c0SJasvinder Singh
2442f06125c0SJasvinder Singhset port meter dscp table
2443f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~
2444f06125c0SJasvinder Singh
2445f06125c0SJasvinder SinghSet meter dscp table for the ethernet device::
2446f06125c0SJasvinder Singh
2447204daeeaSSunil Kumar Kori   testpmd> set port meter dscp table (port_id) (mtr_id) (proto) \
2448204daeeaSSunil Kumar Kori   [(dscp_tbl_entry0) (dscp_tbl_entry1)...(dscp_tbl_entry63)]
2449f06125c0SJasvinder Singh
24509f5488e3SSunil Kumar Koriset port meter vlan table
24519f5488e3SSunil Kumar Kori~~~~~~~~~~~~~~~~~~~~~~~~~
24529f5488e3SSunil Kumar KoriSet meter VLAN table for the Ethernet device::
24539f5488e3SSunil Kumar Kori
2454204daeeaSSunil Kumar Kori   testpmd> set port meter vlan table (port_id) (mtr_id) (proto) \
2455204daeeaSSunil Kumar Kori   [(vlan_tbl_entry0) (vlan_tbl_entry1)...(vlan_tbl_entry15)]
24569f5488e3SSunil Kumar Kori
24579f5488e3SSunil Kumar Koriset port meter protocol
24589f5488e3SSunil Kumar Kori~~~~~~~~~~~~~~~~~~~~~~~
24599f5488e3SSunil Kumar KoriSet meter protocol and corresponding priority::
24609f5488e3SSunil Kumar Kori
24619f5488e3SSunil Kumar Kori   testpmd> set port meter proto (port_id) (mtr_id) (proto) (prio)
24629f5488e3SSunil Kumar Kori
24639f5488e3SSunil Kumar Koriget port meter protocol
24649f5488e3SSunil Kumar Kori~~~~~~~~~~~~~~~~~~~~~~~
24659f5488e3SSunil Kumar KoriGet meter protocol::
24669f5488e3SSunil Kumar Kori
24679f5488e3SSunil Kumar Kori   testpmd> get port meter proto (port_id) (mtr_id)
24689f5488e3SSunil Kumar Kori
24699f5488e3SSunil Kumar Koriget port meter protocol priority
24709f5488e3SSunil Kumar Kori~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24719f5488e3SSunil Kumar KoriGet priority associated to meter protocol::
24729f5488e3SSunil Kumar Kori
24739f5488e3SSunil Kumar Kori   testpmd> get port meter proto_prio (port_id) (mtr_id) (proto)
24749f5488e3SSunil Kumar Kori
2475f06125c0SJasvinder Singhset port meter stats mask
2476f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~
2477f06125c0SJasvinder Singh
2478f06125c0SJasvinder SinghSet meter stats mask for the ethernet device::
2479f06125c0SJasvinder Singh
2480f06125c0SJasvinder Singh   testpmd> set port meter stats mask (port_id) (mtr_id) (stats_mask)
2481f06125c0SJasvinder Singh
2482f06125c0SJasvinder Singhwhere:
2483f06125c0SJasvinder Singh
2484f06125c0SJasvinder Singh* ``stats_mask``: Bit mask indicating statistics counter types to be enabled.
2485f06125c0SJasvinder Singh
2486f06125c0SJasvinder Singhshow port meter stats
2487f06125c0SJasvinder Singh~~~~~~~~~~~~~~~~~~~~~
2488f06125c0SJasvinder Singh
2489f06125c0SJasvinder SinghShow meter stats of the ethernet device::
2490f06125c0SJasvinder Singh
2491f06125c0SJasvinder Singh   testpmd> show port meter stats (port_id) (mtr_id) (clear)
2492f06125c0SJasvinder Singh
2493f06125c0SJasvinder Singhwhere:
2494f06125c0SJasvinder Singh
2495f06125c0SJasvinder Singh* ``clear``: Flag that indicates whether the statistics counters should
2496f06125c0SJasvinder Singh  be cleared (i.e. set to zero) immediately after they have been read or not.
2497e76d7a76SJohn McNamara
24985b590fbeSJasvinder SinghTraffic Management
24995b590fbeSJasvinder Singh------------------
25005b590fbeSJasvinder Singh
25015b590fbeSJasvinder SinghThe following section shows functions for configuring traffic management on
2502f43d3dbbSDavid Marchandthe ethernet device through the use of generic TM API.
25035b590fbeSJasvinder Singh
25045b590fbeSJasvinder Singhshow port traffic management capability
25055b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25065b590fbeSJasvinder Singh
25075b590fbeSJasvinder SinghShow traffic management capability of the port::
25085b590fbeSJasvinder Singh
25095b590fbeSJasvinder Singh   testpmd> show port tm cap (port_id)
25105b590fbeSJasvinder Singh
25115b590fbeSJasvinder Singhshow port traffic management capability (hierarchy level)
25125b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25135b590fbeSJasvinder Singh
25145b590fbeSJasvinder SinghShow traffic management hierarchy level capability of the port::
25155b590fbeSJasvinder Singh
25160bd797e9STomasz Duszynski   testpmd> show port tm level cap (port_id) (level_id)
25175b590fbeSJasvinder Singh
25185b590fbeSJasvinder Singhshow port traffic management capability (hierarchy node level)
25195b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25205b590fbeSJasvinder Singh
25215b590fbeSJasvinder SinghShow the traffic management hierarchy node capability of the port::
25225b590fbeSJasvinder Singh
25230bd797e9STomasz Duszynski   testpmd> show port tm node cap (port_id) (node_id)
25245b590fbeSJasvinder Singh
25255b590fbeSJasvinder Singhshow port traffic management hierarchy node type
25265b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25275b590fbeSJasvinder Singh
25285b590fbeSJasvinder SinghShow the port traffic management hierarchy node type::
25295b590fbeSJasvinder Singh
25305b590fbeSJasvinder Singh   testpmd> show port tm node type (port_id) (node_id)
25315b590fbeSJasvinder Singh
25325b590fbeSJasvinder Singhshow port traffic management hierarchy node stats
25335b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25345b590fbeSJasvinder Singh
25355b590fbeSJasvinder SinghShow the port traffic management hierarchy node statistics::
25365b590fbeSJasvinder Singh
25375b590fbeSJasvinder Singh   testpmd> show port tm node stats (port_id) (node_id) (clear)
25385b590fbeSJasvinder Singh
25395b590fbeSJasvinder Singhwhere:
25405b590fbeSJasvinder Singh
25415b590fbeSJasvinder Singh* ``clear``: When this parameter has a non-zero value, the statistics counters
25425b590fbeSJasvinder Singh  are cleared (i.e. set to zero) immediately after they have been read,
25435b590fbeSJasvinder Singh  otherwise the statistics counters are left untouched.
25445b590fbeSJasvinder Singh
25455b590fbeSJasvinder SinghAdd port traffic management private shaper profile
25465b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25475b590fbeSJasvinder Singh
25485b590fbeSJasvinder SinghAdd the port traffic management private shaper profile::
25495b590fbeSJasvinder Singh
25505b590fbeSJasvinder Singh   testpmd> add port tm node shaper profile (port_id) (shaper_profile_id) \
2551c2c15f76SRosen Xu   (cmit_tb_rate) (cmit_tb_size) (peak_tb_rate) (peak_tb_size) \
2552bb52561eSNithin Dabilpuram   (packet_length_adjust) (packet_mode)
25535b590fbeSJasvinder Singh
25545b590fbeSJasvinder Singhwhere:
25555b590fbeSJasvinder Singh
25565b590fbeSJasvinder Singh* ``shaper_profile id``: Shaper profile ID for the new profile.
2557bb52561eSNithin Dabilpuram* ``cmit_tb_rate``: Committed token bucket rate (bytes per second or packets per second).
2558bb52561eSNithin Dabilpuram* ``cmit_tb_size``: Committed token bucket size (bytes or packets).
2559bb52561eSNithin Dabilpuram* ``peak_tb_rate``: Peak token bucket rate (bytes per second or packets per second).
2560bb52561eSNithin Dabilpuram* ``peak_tb_size``: Peak token bucket size (bytes or packets).
25615b590fbeSJasvinder Singh* ``packet_length_adjust``: The value (bytes) to be added to the length of
25625b590fbeSJasvinder Singh  each packet for the purpose of shaping. This parameter value can be used to
25635b590fbeSJasvinder Singh  correct the packet length with the framing overhead bytes that are consumed
25645b590fbeSJasvinder Singh  on the wire.
2565bb52561eSNithin Dabilpuram* ``packet_mode``: Shaper configured in packet mode. This parameter value if
2566bb52561eSNithin Dabilpuram  zero, configures shaper in byte mode and if non-zero configures it in packet
2567bb52561eSNithin Dabilpuram  mode.
25685b590fbeSJasvinder Singh
25695b590fbeSJasvinder SinghDelete port traffic management private shaper profile
25705b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25715b590fbeSJasvinder Singh
25725b590fbeSJasvinder SinghDelete the port traffic management private shaper::
25735b590fbeSJasvinder Singh
25745b590fbeSJasvinder Singh   testpmd> del port tm node shaper profile (port_id) (shaper_profile_id)
25755b590fbeSJasvinder Singh
25765b590fbeSJasvinder Singhwhere:
25775b590fbeSJasvinder Singh
25785b590fbeSJasvinder Singh* ``shaper_profile id``: Shaper profile ID that needs to be deleted.
25795b590fbeSJasvinder Singh
25805b590fbeSJasvinder SinghAdd port traffic management shared shaper
25815b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25825b590fbeSJasvinder Singh
25835b590fbeSJasvinder SinghCreate the port traffic management shared shaper::
25845b590fbeSJasvinder Singh
25855b590fbeSJasvinder Singh   testpmd> add port tm node shared shaper (port_id) (shared_shaper_id) \
25865b590fbeSJasvinder Singh   (shaper_profile_id)
25875b590fbeSJasvinder Singh
25885b590fbeSJasvinder Singhwhere:
25895b590fbeSJasvinder Singh
25905b590fbeSJasvinder Singh* ``shared_shaper_id``: Shared shaper ID to be created.
25915b590fbeSJasvinder Singh* ``shaper_profile id``: Shaper profile ID for shared shaper.
25925b590fbeSJasvinder Singh
25935b590fbeSJasvinder SinghSet port traffic management shared shaper
25945b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25955b590fbeSJasvinder Singh
25965b590fbeSJasvinder SinghUpdate the port traffic management shared shaper::
25975b590fbeSJasvinder Singh
25985b590fbeSJasvinder Singh   testpmd> set port tm node shared shaper (port_id) (shared_shaper_id) \
25995b590fbeSJasvinder Singh   (shaper_profile_id)
26005b590fbeSJasvinder Singh
26015b590fbeSJasvinder Singhwhere:
26025b590fbeSJasvinder Singh
26035b590fbeSJasvinder Singh* ``shared_shaper_id``: Shared shaper ID to be update.
26045b590fbeSJasvinder Singh* ``shaper_profile id``: Shaper profile ID for shared shaper.
26055b590fbeSJasvinder Singh
26065b590fbeSJasvinder SinghDelete port traffic management shared shaper
26075b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26085b590fbeSJasvinder Singh
26095b590fbeSJasvinder SinghDelete the port traffic management shared shaper::
26105b590fbeSJasvinder Singh
26115b590fbeSJasvinder Singh   testpmd> del port tm node shared shaper (port_id) (shared_shaper_id)
26125b590fbeSJasvinder Singh
26135b590fbeSJasvinder Singhwhere:
26145b590fbeSJasvinder Singh
26155b590fbeSJasvinder Singh* ``shared_shaper_id``: Shared shaper ID to be deleted.
26165b590fbeSJasvinder Singh
2617d629b7b5SJohn McNamaraSet port traffic management hierarchy node private shaper
2618d629b7b5SJohn McNamara~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26195b590fbeSJasvinder Singh
26205b590fbeSJasvinder Singhset the port traffic management hierarchy node private shaper::
26215b590fbeSJasvinder Singh
26225b590fbeSJasvinder Singh   testpmd> set port tm node shaper profile (port_id) (node_id) \
26235b590fbeSJasvinder Singh   (shaper_profile_id)
26245b590fbeSJasvinder Singh
26255b590fbeSJasvinder Singhwhere:
26265b590fbeSJasvinder Singh
26275b590fbeSJasvinder Singh* ``shaper_profile id``: Private shaper profile ID to be enabled on the
26285b590fbeSJasvinder Singh  hierarchy node.
26295b590fbeSJasvinder Singh
26305b590fbeSJasvinder SinghAdd port traffic management WRED profile
26315b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26325b590fbeSJasvinder Singh
26335b590fbeSJasvinder SinghCreate a new WRED profile::
26345b590fbeSJasvinder Singh
26355b590fbeSJasvinder Singh   testpmd> add port tm node wred profile (port_id) (wred_profile_id) \
26365b590fbeSJasvinder Singh   (color_g) (min_th_g) (max_th_g) (maxp_inv_g) (wq_log2_g) \
26375b590fbeSJasvinder Singh   (color_y) (min_th_y) (max_th_y) (maxp_inv_y) (wq_log2_y) \
26385b590fbeSJasvinder Singh   (color_r) (min_th_r) (max_th_r) (maxp_inv_r) (wq_log2_r)
26395b590fbeSJasvinder Singh
26405b590fbeSJasvinder Singhwhere:
26415b590fbeSJasvinder Singh
26425b590fbeSJasvinder Singh* ``wred_profile id``: Identifier for the newly create WRED profile
26435b590fbeSJasvinder Singh* ``color_g``: Packet color (green)
26445b590fbeSJasvinder Singh* ``min_th_g``: Minimum queue threshold for packet with green color
26455b590fbeSJasvinder Singh* ``max_th_g``: Minimum queue threshold for packet with green color
26465b590fbeSJasvinder Singh* ``maxp_inv_g``: Inverse of packet marking probability maximum value (maxp)
26475b590fbeSJasvinder Singh* ``wq_log2_g``: Negated log2 of queue weight (wq)
26485b590fbeSJasvinder Singh* ``color_y``: Packet color (yellow)
26495b590fbeSJasvinder Singh* ``min_th_y``: Minimum queue threshold for packet with yellow color
26505b590fbeSJasvinder Singh* ``max_th_y``: Minimum queue threshold for packet with yellow color
26515b590fbeSJasvinder Singh* ``maxp_inv_y``: Inverse of packet marking probability maximum value (maxp)
26525b590fbeSJasvinder Singh* ``wq_log2_y``: Negated log2 of queue weight (wq)
26535b590fbeSJasvinder Singh* ``color_r``: Packet color (red)
26545b590fbeSJasvinder Singh* ``min_th_r``: Minimum queue threshold for packet with yellow color
26555b590fbeSJasvinder Singh* ``max_th_r``: Minimum queue threshold for packet with yellow color
26565b590fbeSJasvinder Singh* ``maxp_inv_r``: Inverse of packet marking probability maximum value (maxp)
26575b590fbeSJasvinder Singh* ``wq_log2_r``: Negated log2 of queue weight (wq)
26585b590fbeSJasvinder Singh
26595b590fbeSJasvinder SinghDelete port traffic management WRED profile
26605b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26615b590fbeSJasvinder Singh
26625b590fbeSJasvinder SinghDelete the WRED profile::
26635b590fbeSJasvinder Singh
26645b590fbeSJasvinder Singh   testpmd> del port tm node wred profile (port_id) (wred_profile_id)
26655b590fbeSJasvinder Singh
26665b590fbeSJasvinder SinghAdd port traffic management hierarchy nonleaf node
26675b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26685b590fbeSJasvinder Singh
2669d629b7b5SJohn McNamaraAdd nonleaf node to port traffic management hierarchy::
26705b590fbeSJasvinder Singh
26715b590fbeSJasvinder Singh   testpmd> add port tm nonleaf node (port_id) (node_id) (parent_node_id) \
26725b590fbeSJasvinder Singh   (priority) (weight) (level_id) (shaper_profile_id) \
2673448c2332SJasvinder Singh   (n_sp_priorities) (stats_mask) (n_shared_shapers) \
2674448c2332SJasvinder Singh   [(shared_shaper_0) (shared_shaper_1) ...] \
26755b590fbeSJasvinder Singh
26765b590fbeSJasvinder Singhwhere:
26775b590fbeSJasvinder Singh
26785b590fbeSJasvinder Singh* ``parent_node_id``: Node ID of the parent.
26795b590fbeSJasvinder Singh* ``priority``: Node priority (highest node priority is zero). This is used by
26805b590fbeSJasvinder Singh  the SP algorithm running on the parent node for scheduling this node.
26815b590fbeSJasvinder Singh* ``weight``: Node weight (lowest weight is one). The node weight is relative
26825b590fbeSJasvinder Singh  to the weight sum of all siblings that have the same priority. It is used by
26835b590fbeSJasvinder Singh  the WFQ algorithm running on the parent node for scheduling this node.
2684d629b7b5SJohn McNamara* ``level_id``: Hierarchy level of the node.
26855b590fbeSJasvinder Singh* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
26865b590fbeSJasvinder Singh  the node.
26875b590fbeSJasvinder Singh* ``n_sp_priorities``: Number of strict priorities.
26885b590fbeSJasvinder Singh* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2689448c2332SJasvinder Singh* ``n_shared_shapers``: Number of shared shapers.
2690448c2332SJasvinder Singh* ``shared_shaper_id``: Shared shaper id.
26915b590fbeSJasvinder Singh
2692bb52561eSNithin DabilpuramAdd port traffic management hierarchy nonleaf node with packet mode
2693bb52561eSNithin Dabilpuram~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2694bb52561eSNithin Dabilpuram
2695bb52561eSNithin DabilpuramAdd nonleaf node with packet mode to port traffic management hierarchy::
2696bb52561eSNithin Dabilpuram
2697bb52561eSNithin Dabilpuram   testpmd> add port tm nonleaf node pktmode (port_id) (node_id) (parent_node_id) \
2698bb52561eSNithin Dabilpuram   (priority) (weight) (level_id) (shaper_profile_id) \
2699bb52561eSNithin Dabilpuram   (n_sp_priorities) (stats_mask) (n_shared_shapers) \
2700bb52561eSNithin Dabilpuram   [(shared_shaper_0) (shared_shaper_1) ...] \
2701bb52561eSNithin Dabilpuram
2702bb52561eSNithin Dabilpuramwhere:
2703bb52561eSNithin Dabilpuram
2704bb52561eSNithin Dabilpuram* ``parent_node_id``: Node ID of the parent.
2705bb52561eSNithin Dabilpuram* ``priority``: Node priority (highest node priority is zero). This is used by
2706bb52561eSNithin Dabilpuram  the SP algorithm running on the parent node for scheduling this node.
2707bb52561eSNithin Dabilpuram* ``weight``: Node weight (lowest weight is one). The node weight is relative
2708bb52561eSNithin Dabilpuram  to the weight sum of all siblings that have the same priority. It is used by
2709bb52561eSNithin Dabilpuram  the WFQ algorithm running on the parent node for scheduling this node.
2710bb52561eSNithin Dabilpuram* ``level_id``: Hierarchy level of the node.
2711bb52561eSNithin Dabilpuram* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
2712bb52561eSNithin Dabilpuram  the node.
2713bb52561eSNithin Dabilpuram* ``n_sp_priorities``: Number of strict priorities. Packet mode is enabled on
2714bb52561eSNithin Dabilpuram  all of them.
2715bb52561eSNithin Dabilpuram* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2716bb52561eSNithin Dabilpuram* ``n_shared_shapers``: Number of shared shapers.
2717bb52561eSNithin Dabilpuram* ``shared_shaper_id``: Shared shaper id.
2718bb52561eSNithin Dabilpuram
27195b590fbeSJasvinder SinghAdd port traffic management hierarchy leaf node
27205b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27215b590fbeSJasvinder Singh
2722d629b7b5SJohn McNamaraAdd leaf node to port traffic management hierarchy::
27235b590fbeSJasvinder Singh
27245b590fbeSJasvinder Singh   testpmd> add port tm leaf node (port_id) (node_id) (parent_node_id) \
27255b590fbeSJasvinder Singh   (priority) (weight) (level_id) (shaper_profile_id) \
2726448c2332SJasvinder Singh   (cman_mode) (wred_profile_id) (stats_mask) (n_shared_shapers) \
2727448c2332SJasvinder Singh   [(shared_shaper_id) (shared_shaper_id) ...] \
27285b590fbeSJasvinder Singh
27295b590fbeSJasvinder Singhwhere:
27305b590fbeSJasvinder Singh
27315b590fbeSJasvinder Singh* ``parent_node_id``: Node ID of the parent.
27325b590fbeSJasvinder Singh* ``priority``: Node priority (highest node priority is zero). This is used by
27335b590fbeSJasvinder Singh  the SP algorithm running on the parent node for scheduling this node.
27345b590fbeSJasvinder Singh* ``weight``: Node weight (lowest weight is one). The node weight is relative
27355b590fbeSJasvinder Singh  to the weight sum of all siblings that have the same priority. It is used by
27365b590fbeSJasvinder Singh  the WFQ algorithm running on the parent node for scheduling this node.
2737d629b7b5SJohn McNamara* ``level_id``: Hierarchy level of the node.
27385b590fbeSJasvinder Singh* ``shaper_profile_id``: Shaper profile ID of the private shaper to be used by
27395b590fbeSJasvinder Singh  the node.
27405b590fbeSJasvinder Singh* ``cman_mode``: Congestion management mode to be enabled for this node.
27415b590fbeSJasvinder Singh* ``wred_profile_id``: WRED profile id to be enabled for this node.
27425b590fbeSJasvinder Singh* ``stats_mask``: Mask of statistics counter types to be enabled for this node.
2743448c2332SJasvinder Singh* ``n_shared_shapers``: Number of shared shapers.
2744448c2332SJasvinder Singh* ``shared_shaper_id``: Shared shaper id.
27455b590fbeSJasvinder Singh
27465b590fbeSJasvinder SinghDelete port traffic management hierarchy node
27475b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27485b590fbeSJasvinder Singh
2749d629b7b5SJohn McNamaraDelete node from port traffic management hierarchy::
27505b590fbeSJasvinder Singh
27515b590fbeSJasvinder Singh   testpmd> del port tm node (port_id) (node_id)
27525b590fbeSJasvinder Singh
27535b590fbeSJasvinder SinghUpdate port traffic management hierarchy parent node
27545b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27555b590fbeSJasvinder Singh
27565b590fbeSJasvinder SinghUpdate port traffic management hierarchy parent node::
27575b590fbeSJasvinder Singh
27585b590fbeSJasvinder Singh   testpmd> set port tm node parent (port_id) (node_id) (parent_node_id) \
27595b590fbeSJasvinder Singh   (priority) (weight)
27605b590fbeSJasvinder Singh
27615b590fbeSJasvinder SinghThis function can only be called after the hierarchy commit invocation. Its
27625b590fbeSJasvinder Singhsuccess depends on the port support for this operation, as advertised through
27635b590fbeSJasvinder Singhthe port capability set. This function is valid for all nodes of the traffic
27645b590fbeSJasvinder Singhmanagement hierarchy except root node.
27655b590fbeSJasvinder Singh
2766079dcbb8STomasz DuszynskiSuspend port traffic management hierarchy node
2767079dcbb8STomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2768079dcbb8STomasz Duszynski
2769079dcbb8STomasz Duszynski   testpmd> suspend port tm node (port_id) (node_id)
2770079dcbb8STomasz Duszynski
277112f76f52STomasz DuszynskiResume port traffic management hierarchy node
277212f76f52STomasz Duszynski~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
277312f76f52STomasz Duszynski
277412f76f52STomasz Duszynski   testpmd> resume port tm node (port_id) (node_id)
277512f76f52STomasz Duszynski
27765b590fbeSJasvinder SinghCommit port traffic management hierarchy
27775b590fbeSJasvinder Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27785b590fbeSJasvinder Singh
27795b590fbeSJasvinder SinghCommit the traffic management hierarchy on the port::
27805b590fbeSJasvinder Singh
27815b590fbeSJasvinder Singh   testpmd> port tm hierarchy commit (port_id) (clean_on_fail)
27825b590fbeSJasvinder Singh
27835b590fbeSJasvinder Singhwhere:
27845b590fbeSJasvinder Singh
27855b590fbeSJasvinder Singh* ``clean_on_fail``: When set to non-zero, hierarchy is cleared on function
27865b590fbeSJasvinder Singh  call failure. On the other hand, hierarchy is preserved when this parameter
27875b590fbeSJasvinder Singh  is equal to zero.
27885b590fbeSJasvinder Singh
27896673fe0cSKrzysztof KanasSet port traffic management mark VLAN dei
27906673fe0cSKrzysztof Kanas~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27916673fe0cSKrzysztof Kanas
27926673fe0cSKrzysztof KanasEnables/Disables the traffic management marking on the port for VLAN packets::
27936673fe0cSKrzysztof Kanas
27946673fe0cSKrzysztof Kanas   testpmd> set port tm mark vlan_dei <port_id> <green> <yellow> <red>
27956673fe0cSKrzysztof Kanas
27966673fe0cSKrzysztof Kanaswhere:
27976673fe0cSKrzysztof Kanas
27986673fe0cSKrzysztof Kanas* ``port_id``: The port which on which VLAN packets marked as ``green`` or
27996673fe0cSKrzysztof Kanas  ``yellow`` or ``red`` will have dei bit enabled
28006673fe0cSKrzysztof Kanas
28016673fe0cSKrzysztof Kanas* ``green`` enable 1, disable 0 marking for dei bit of VLAN packets marked as green
28026673fe0cSKrzysztof Kanas
28036673fe0cSKrzysztof Kanas* ``yellow`` enable 1, disable 0 marking for dei bit of VLAN packets marked as yellow
28046673fe0cSKrzysztof Kanas
28056673fe0cSKrzysztof Kanas* ``red`` enable 1, disable 0 marking for dei bit of VLAN packets marked as red
28066673fe0cSKrzysztof Kanas
28076673fe0cSKrzysztof KanasSet port traffic management mark IP dscp
28086673fe0cSKrzysztof Kanas~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28096673fe0cSKrzysztof Kanas
28106673fe0cSKrzysztof KanasEnables/Disables the traffic management marking on the port for IP dscp packets::
28116673fe0cSKrzysztof Kanas
28126673fe0cSKrzysztof Kanas   testpmd> set port tm mark ip_dscp <port_id> <green> <yellow> <red>
28136673fe0cSKrzysztof Kanas
28146673fe0cSKrzysztof Kanaswhere:
28156673fe0cSKrzysztof Kanas
28166673fe0cSKrzysztof Kanas* ``port_id``: The port which on which IP packets marked as ``green`` or
28176673fe0cSKrzysztof Kanas  ``yellow`` or ``red`` will have IP dscp bits updated
28186673fe0cSKrzysztof Kanas
28196673fe0cSKrzysztof Kanas* ``green`` enable 1, disable 0 marking IP dscp to low drop precedence for green packets
28206673fe0cSKrzysztof Kanas
28216673fe0cSKrzysztof Kanas* ``yellow`` enable 1, disable 0 marking IP dscp to medium drop precedence for yellow packets
28226673fe0cSKrzysztof Kanas
28236673fe0cSKrzysztof Kanas* ``red`` enable 1, disable 0 marking IP dscp to high drop precedence for red packets
28246673fe0cSKrzysztof Kanas
28256673fe0cSKrzysztof KanasSet port traffic management mark IP ecn
28266673fe0cSKrzysztof Kanas~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28276673fe0cSKrzysztof Kanas
28286673fe0cSKrzysztof KanasEnables/Disables the traffic management marking on the port for IP ecn packets::
28296673fe0cSKrzysztof Kanas
28306673fe0cSKrzysztof Kanas   testpmd> set port tm mark ip_ecn <port_id> <green> <yellow> <red>
28316673fe0cSKrzysztof Kanas
28326673fe0cSKrzysztof Kanaswhere:
28336673fe0cSKrzysztof Kanas
28346673fe0cSKrzysztof Kanas* ``port_id``: The port which on which IP packets marked as ``green`` or
28356673fe0cSKrzysztof Kanas  ``yellow`` or ``red`` will have IP ecn bits updated
28366673fe0cSKrzysztof Kanas
28376673fe0cSKrzysztof Kanas* ``green`` enable 1, disable 0 marking IP ecn for green marked packets with ecn of 2'b01  or 2'b10
28386673fe0cSKrzysztof Kanas  to ecn of 2'b11 when IP is caring TCP or SCTP
28396673fe0cSKrzysztof Kanas
28406673fe0cSKrzysztof Kanas* ``yellow`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
28416673fe0cSKrzysztof Kanas  to ecn of 2'b11 when IP is caring TCP or SCTP
28426673fe0cSKrzysztof Kanas
28436673fe0cSKrzysztof Kanas* ``red`` enable 1, disable 0 marking IP ecn for yellow marked packets with ecn of 2'b01  or 2'b10
28446673fe0cSKrzysztof Kanas  to ecn of 2'b11 when IP is caring TCP or SCTP
28456673fe0cSKrzysztof Kanas
2846aa49f366SPablo de LaraFilter Functions
2847aa49f366SPablo de Lara----------------
2848aa49f366SPablo de Lara
2849aa49f366SPablo de LaraThis section details the available filter functions that are available.
2850aa49f366SPablo de Lara
2851a997a33bSAdrien MazarguilNote these functions interface the deprecated legacy filtering framework,
2852a997a33bSAdrien Mazarguilsuperseded by *rte_flow*. See `Flow rules management`_.
2853a997a33bSAdrien Mazarguil
2854a997a33bSAdrien Mazarguil.. _testpmd_rte_flow:
2855a997a33bSAdrien Mazarguil
2856a997a33bSAdrien MazarguilFlow rules management
2857a997a33bSAdrien Mazarguil---------------------
2858a997a33bSAdrien Mazarguil
2859a997a33bSAdrien MazarguilControl of the generic flow API (*rte_flow*) is fully exposed through the
28609ad3a41aSAlexander Kozyrev``flow`` command (configuration, validation, creation, destruction, queries
28619ad3a41aSAlexander Kozyrevand operation modes).
2862a997a33bSAdrien Mazarguil
2863a997a33bSAdrien MazarguilConsidering *rte_flow* overlaps with all `Filter Functions`_, using both
2864a997a33bSAdrien Mazarguilfeatures simultaneously may cause undefined side-effects and is therefore
2865a997a33bSAdrien Mazarguilnot recommended.
2866a997a33bSAdrien Mazarguil
2867a997a33bSAdrien Mazarguil``flow`` syntax
2868a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~
2869a997a33bSAdrien Mazarguil
2870a997a33bSAdrien MazarguilBecause the ``flow`` command uses dynamic tokens to handle the large number
2871a997a33bSAdrien Mazarguilof possible flow rules combinations, its behavior differs slightly from
2872a997a33bSAdrien Mazarguilother commands, in particular:
2873a997a33bSAdrien Mazarguil
2874a997a33bSAdrien Mazarguil- Pressing *?* or the *<tab>* key displays contextual help for the current
2875a997a33bSAdrien Mazarguil  token, not that of the entire command.
2876a997a33bSAdrien Mazarguil
2877a997a33bSAdrien Mazarguil- Optional and repeated parameters are supported (provided they are listed
2878a997a33bSAdrien Mazarguil  in the contextual help).
2879a997a33bSAdrien Mazarguil
2880a997a33bSAdrien MazarguilThe first parameter stands for the operation mode. Possible operations and
2881a997a33bSAdrien Mazarguiltheir general syntax are described below. They are covered in detail in the
2882a997a33bSAdrien Mazarguilfollowing sections.
2883a997a33bSAdrien Mazarguil
28849ad3a41aSAlexander Kozyrev- Get info about flow engine::
28859ad3a41aSAlexander Kozyrev
28869ad3a41aSAlexander Kozyrev   flow info {port_id}
28879ad3a41aSAlexander Kozyrev
28889ad3a41aSAlexander Kozyrev- Configure flow engine::
28899ad3a41aSAlexander Kozyrev
28909ad3a41aSAlexander Kozyrev   flow configure {port_id}
28919ad3a41aSAlexander Kozyrev       [queues_number {number}] [queues_size {size}]
28929ad3a41aSAlexander Kozyrev       [counters_number {number}]
28939ad3a41aSAlexander Kozyrev       [aging_counters_number {number}]
2894dcc9a80cSMichael Baum       [meters_number {number}] [flags {number}]
28959ad3a41aSAlexander Kozyrev
289604cc665fSAlexander Kozyrev- Create a pattern template::
289704cc665fSAlexander Kozyrev   flow pattern_template {port_id} create [pattern_template_id {id}]
289804cc665fSAlexander Kozyrev       [relaxed {boolean}] [ingress] [egress] [transfer]
289904cc665fSAlexander Kozyrev	   template {item} [/ {item} [...]] / end
290004cc665fSAlexander Kozyrev
290104cc665fSAlexander Kozyrev- Destroy a pattern template::
290204cc665fSAlexander Kozyrev
290304cc665fSAlexander Kozyrev   flow pattern_template {port_id} destroy pattern_template {id} [...]
290404cc665fSAlexander Kozyrev
290504cc665fSAlexander Kozyrev- Create an actions template::
290604cc665fSAlexander Kozyrev
290704cc665fSAlexander Kozyrev   flow actions_template {port_id} create [actions_template_id {id}]
290804cc665fSAlexander Kozyrev       [ingress] [egress] [transfer]
290904cc665fSAlexander Kozyrev       template {action} [/ {action} [...]] / end
291004cc665fSAlexander Kozyrev       mask {action} [/ {action} [...]] / end
291104cc665fSAlexander Kozyrev
291204cc665fSAlexander Kozyrev- Destroy an actions template::
291304cc665fSAlexander Kozyrev
291404cc665fSAlexander Kozyrev   flow actions_template {port_id} destroy actions_template {id} [...]
291504cc665fSAlexander Kozyrev
2916c4b38873SAlexander Kozyrev- Create a table::
2917c4b38873SAlexander Kozyrev
2918c4b38873SAlexander Kozyrev   flow table {port_id} create
2919c4b38873SAlexander Kozyrev       [table_id {id}]
2920c4b38873SAlexander Kozyrev       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
2921c4b38873SAlexander Kozyrev       rules_number {number}
2922c4b38873SAlexander Kozyrev       pattern_template {pattern_template_id}
2923c4b38873SAlexander Kozyrev       actions_template {actions_template_id}
2924c4b38873SAlexander Kozyrev
2925c4b38873SAlexander Kozyrev- Destroy a table::
2926c4b38873SAlexander Kozyrev
2927c4b38873SAlexander Kozyrev   flow table {port_id} destroy table {id} [...]
2928c4b38873SAlexander Kozyrev
2929a997a33bSAdrien Mazarguil- Check whether a flow rule can be created::
2930a997a33bSAdrien Mazarguil
2931a997a33bSAdrien Mazarguil   flow validate {port_id}
293276e9a55bSAdrien Mazarguil       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
2933a997a33bSAdrien Mazarguil       pattern {item} [/ {item} [...]] / end
2934a997a33bSAdrien Mazarguil       actions {action} [/ {action} [...]] / end
2935a997a33bSAdrien Mazarguil
2936ecdc927bSAlexander Kozyrev- Enqueue creation of a flow rule::
2937ecdc927bSAlexander Kozyrev
2938ecdc927bSAlexander Kozyrev   flow queue {port_id} create {queue_id}
2939ecdc927bSAlexander Kozyrev       [postpone {boolean}] template_table {table_id}
2940ecdc927bSAlexander Kozyrev       pattern_template {pattern_template_index}
2941ecdc927bSAlexander Kozyrev       actions_template {actions_template_index}
2942ecdc927bSAlexander Kozyrev       pattern {item} [/ {item} [...]] / end
2943ecdc927bSAlexander Kozyrev       actions {action} [/ {action} [...]] / end
2944ecdc927bSAlexander Kozyrev
2945ecdc927bSAlexander Kozyrev- Enqueue destruction of specific flow rules::
2946ecdc927bSAlexander Kozyrev
2947ecdc927bSAlexander Kozyrev   flow queue {port_id} destroy {queue_id}
2948ecdc927bSAlexander Kozyrev       [postpone {boolean}] rule {rule_id} [...]
2949ecdc927bSAlexander Kozyrev
29509cbbee14SAlexander Kozyrev- Push enqueued operations::
29519cbbee14SAlexander Kozyrev
29529cbbee14SAlexander Kozyrev   flow push {port_id} queue {queue_id}
29539cbbee14SAlexander Kozyrev
2954f9bf7dffSAlexander Kozyrev- Pull all operations results from a queue::
2955f9bf7dffSAlexander Kozyrev
2956f9bf7dffSAlexander Kozyrev   flow pull {port_id} queue {queue_id}
2957f9bf7dffSAlexander Kozyrev
2958a997a33bSAdrien Mazarguil- Create a flow rule::
2959a997a33bSAdrien Mazarguil
2960a997a33bSAdrien Mazarguil   flow create {port_id}
296176e9a55bSAdrien Mazarguil       [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
2962a997a33bSAdrien Mazarguil       pattern {item} [/ {item} [...]] / end
2963a997a33bSAdrien Mazarguil       actions {action} [/ {action} [...]] / end
2964a997a33bSAdrien Mazarguil
2965a997a33bSAdrien Mazarguil- Destroy specific flow rules::
2966a997a33bSAdrien Mazarguil
2967a997a33bSAdrien Mazarguil   flow destroy {port_id} rule {rule_id} [...]
2968a997a33bSAdrien Mazarguil
2969a997a33bSAdrien Mazarguil- Destroy all flow rules::
2970a997a33bSAdrien Mazarguil
2971a997a33bSAdrien Mazarguil   flow flush {port_id}
2972a997a33bSAdrien Mazarguil
2973a997a33bSAdrien Mazarguil- Query an existing flow rule::
2974a997a33bSAdrien Mazarguil
2975a997a33bSAdrien Mazarguil   flow query {port_id} {rule_id} {action}
2976a997a33bSAdrien Mazarguil
2977a997a33bSAdrien Mazarguil- List existing flow rules sorted by priority, filtered by group
2978a997a33bSAdrien Mazarguil  identifiers::
2979a997a33bSAdrien Mazarguil
2980a997a33bSAdrien Mazarguil   flow list {port_id} [group {group_id}] [...]
2981a997a33bSAdrien Mazarguil
2982323f811aSAdrien Mazarguil- Restrict ingress traffic to the defined flow rules::
2983323f811aSAdrien Mazarguil
2984323f811aSAdrien Mazarguil   flow isolate {port_id} {boolean}
2985323f811aSAdrien Mazarguil
2986a69c335dSXiaoyu Min- Dump internal representation information of all flows in hardware::
2987a69c335dSXiaoyu Min
2988bf085dcbSHaifei Luo   flow dump {port_id} all {output_file}
2989bf085dcbSHaifei Luo
2990bf085dcbSHaifei Luo  for one flow::
2991bf085dcbSHaifei Luo
2992bf085dcbSHaifei Luo   flow dump {port_id} rule {rule_id} {output_file}
2993a69c335dSXiaoyu Min
29940e459ffaSDong Zhou- List and destroy aged flow rules::
29950e459ffaSDong Zhou
29960e459ffaSDong Zhou   flow aged {port_id} [destroy]
29970e459ffaSDong Zhou
2998*966eb55eSMichael Baum- Enqueue list and destroy aged flow rules::
2999*966eb55eSMichael Baum
3000*966eb55eSMichael Baum   flow queue {port_id} aged {queue_id} [destroy]
3001*966eb55eSMichael Baum
30021b9f2746SGregory Etelson- Tunnel offload - create a tunnel stub::
30031b9f2746SGregory Etelson
30041b9f2746SGregory Etelson   flow tunnel create {port_id} type {tunnel_type}
30051b9f2746SGregory Etelson
30061b9f2746SGregory Etelson- Tunnel offload - destroy a tunnel stub::
30071b9f2746SGregory Etelson
30081b9f2746SGregory Etelson   flow tunnel destroy {port_id} id {tunnel_id}
30091b9f2746SGregory Etelson
30101b9f2746SGregory Etelson- Tunnel offload - list port tunnel stubs::
30111b9f2746SGregory Etelson
30121b9f2746SGregory Etelson   flow tunnel list {port_id}
30131b9f2746SGregory Etelson
30149ad3a41aSAlexander KozyrevRetrieving info about flow management engine
30159ad3a41aSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30169ad3a41aSAlexander Kozyrev
30179ad3a41aSAlexander Kozyrev``flow info`` retrieves info on pre-configurable resources in the underlying
30189ad3a41aSAlexander Kozyrevdevice to give a hint of possible values for flow engine configuration.
30199ad3a41aSAlexander Kozyrev
30209ad3a41aSAlexander Kozyrev``rte_flow_info_get()``::
30219ad3a41aSAlexander Kozyrev
30229ad3a41aSAlexander Kozyrev   flow info {port_id}
30239ad3a41aSAlexander Kozyrev
30249ad3a41aSAlexander KozyrevIf successful, it will show::
30259ad3a41aSAlexander Kozyrev
30269ad3a41aSAlexander Kozyrev   Flow engine resources on port #[...]:
30279ad3a41aSAlexander Kozyrev   Number of queues: #[...]
30289ad3a41aSAlexander Kozyrev   Size of queues: #[...]
30299ad3a41aSAlexander Kozyrev   Number of counters: #[...]
30309ad3a41aSAlexander Kozyrev   Number of aging objects: #[...]
30319ad3a41aSAlexander Kozyrev   Number of meters: #[...]
30329ad3a41aSAlexander Kozyrev
30339ad3a41aSAlexander KozyrevOtherwise it will show an error message of the form::
30349ad3a41aSAlexander Kozyrev
30359ad3a41aSAlexander Kozyrev   Caught error type [...] ([...]): [...]
30369ad3a41aSAlexander Kozyrev
30379ad3a41aSAlexander KozyrevConfiguring flow management engine
30389ad3a41aSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30399ad3a41aSAlexander Kozyrev
30409ad3a41aSAlexander Kozyrev``flow configure`` pre-allocates all the needed resources in the underlying
30419ad3a41aSAlexander Kozyrevdevice to be used later at the flow creation. Flow queues are allocated as well
30429ad3a41aSAlexander Kozyrevfor asynchronous flow creation/destruction operations. It is bound to
30439ad3a41aSAlexander Kozyrev``rte_flow_configure()``::
30449ad3a41aSAlexander Kozyrev
30459ad3a41aSAlexander Kozyrev   flow configure {port_id}
30469ad3a41aSAlexander Kozyrev       [queues_number {number}] [queues_size {size}]
30479ad3a41aSAlexander Kozyrev       [counters_number {number}]
30489ad3a41aSAlexander Kozyrev       [aging_counters_number {number}]
3049dcc9a80cSMichael Baum       [meters_number {number}] [flags {number}]
30509ad3a41aSAlexander Kozyrev
30519ad3a41aSAlexander KozyrevIf successful, it will show::
30529ad3a41aSAlexander Kozyrev
30539ad3a41aSAlexander Kozyrev   Configure flows on port #[...]: number of queues #[...] with #[...] elements
30549ad3a41aSAlexander Kozyrev
30559ad3a41aSAlexander KozyrevOtherwise it will show an error message of the form::
30569ad3a41aSAlexander Kozyrev
30579ad3a41aSAlexander Kozyrev   Caught error type [...] ([...]): [...]
30589ad3a41aSAlexander Kozyrev
305904cc665fSAlexander KozyrevCreating pattern templates
306004cc665fSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~
306104cc665fSAlexander Kozyrev
306204cc665fSAlexander Kozyrev``flow pattern_template create`` creates the specified pattern template.
306304cc665fSAlexander KozyrevIt is bound to ``rte_flow_pattern_template_create()``::
306404cc665fSAlexander Kozyrev
306504cc665fSAlexander Kozyrev   flow pattern_template {port_id} create [pattern_template_id {id}]
306604cc665fSAlexander Kozyrev       [relaxed {boolean}] [ingress] [egress] [transfer]
306704cc665fSAlexander Kozyrev	   template {item} [/ {item} [...]] / end
306804cc665fSAlexander Kozyrev
306904cc665fSAlexander KozyrevIf successful, it will show::
307004cc665fSAlexander Kozyrev
307104cc665fSAlexander Kozyrev   Pattern template #[...] created
307204cc665fSAlexander Kozyrev
307304cc665fSAlexander KozyrevOtherwise it will show an error message of the form::
307404cc665fSAlexander Kozyrev
307504cc665fSAlexander Kozyrev   Caught error type [...] ([...]): [...]
307604cc665fSAlexander Kozyrev
307704cc665fSAlexander KozyrevThis command uses the same pattern items as ``flow create``,
307804cc665fSAlexander Kozyrevtheir format is described in `Creating flow rules`_.
307904cc665fSAlexander Kozyrev
308004cc665fSAlexander KozyrevDestroying pattern templates
308104cc665fSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308204cc665fSAlexander Kozyrev
308304cc665fSAlexander Kozyrev``flow pattern_template destroy`` destroys one or more pattern templates
308404cc665fSAlexander Kozyrevfrom their template ID (as returned by ``flow pattern_template create``),
308504cc665fSAlexander Kozyrevthis command calls ``rte_flow_pattern_template_destroy()`` as many
308604cc665fSAlexander Kozyrevtimes as necessary::
308704cc665fSAlexander Kozyrev
308804cc665fSAlexander Kozyrev   flow pattern_template {port_id} destroy pattern_template {id} [...]
308904cc665fSAlexander Kozyrev
309004cc665fSAlexander KozyrevIf successful, it will show::
309104cc665fSAlexander Kozyrev
309204cc665fSAlexander Kozyrev   Pattern template #[...] destroyed
309304cc665fSAlexander Kozyrev
309404cc665fSAlexander KozyrevIt does not report anything for pattern template IDs that do not exist.
309504cc665fSAlexander KozyrevThe usual error message is shown when a pattern template cannot be destroyed::
309604cc665fSAlexander Kozyrev
309704cc665fSAlexander Kozyrev   Caught error type [...] ([...]): [...]
309804cc665fSAlexander Kozyrev
309904cc665fSAlexander KozyrevCreating actions templates
310004cc665fSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~
310104cc665fSAlexander Kozyrev
310204cc665fSAlexander Kozyrev``flow actions_template create`` creates the specified actions template.
310304cc665fSAlexander KozyrevIt is bound to ``rte_flow_actions_template_create()``::
310404cc665fSAlexander Kozyrev
310504cc665fSAlexander Kozyrev   flow actions_template {port_id} create [actions_template_id {id}]
310604cc665fSAlexander Kozyrev       [ingress] [egress] [transfer]
310704cc665fSAlexander Kozyrev	   template {action} [/ {action} [...]] / end
310804cc665fSAlexander Kozyrev       mask {action} [/ {action} [...]] / end
310904cc665fSAlexander Kozyrev
311004cc665fSAlexander KozyrevIf successful, it will show::
311104cc665fSAlexander Kozyrev
311204cc665fSAlexander Kozyrev   Actions template #[...] created
311304cc665fSAlexander Kozyrev
311404cc665fSAlexander KozyrevOtherwise it will show an error message of the form::
311504cc665fSAlexander Kozyrev
311604cc665fSAlexander Kozyrev   Caught error type [...] ([...]): [...]
311704cc665fSAlexander Kozyrev
311804cc665fSAlexander KozyrevThis command uses the same actions as ``flow create``,
311904cc665fSAlexander Kozyrevtheir format is described in `Creating flow rules`_.
312004cc665fSAlexander Kozyrev
312104cc665fSAlexander KozyrevDestroying actions templates
312204cc665fSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~
312304cc665fSAlexander Kozyrev
312404cc665fSAlexander Kozyrev``flow actions_template destroy`` destroys one or more actions templates
312504cc665fSAlexander Kozyrevfrom their template ID (as returned by ``flow actions_template create``),
312604cc665fSAlexander Kozyrevthis command calls ``rte_flow_actions_template_destroy()`` as many
312704cc665fSAlexander Kozyrevtimes as necessary::
312804cc665fSAlexander Kozyrev
312904cc665fSAlexander Kozyrev   flow actions_template {port_id} destroy actions_template {id} [...]
313004cc665fSAlexander Kozyrev
313104cc665fSAlexander KozyrevIf successful, it will show::
313204cc665fSAlexander Kozyrev
313304cc665fSAlexander Kozyrev   Actions template #[...] destroyed
313404cc665fSAlexander Kozyrev
313504cc665fSAlexander KozyrevIt does not report anything for actions template IDs that do not exist.
313604cc665fSAlexander KozyrevThe usual error message is shown when an actions template cannot be destroyed::
313704cc665fSAlexander Kozyrev
313804cc665fSAlexander Kozyrev   Caught error type [...] ([...]): [...]
313904cc665fSAlexander Kozyrev
3140c4b38873SAlexander KozyrevCreating template table
3141c4b38873SAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~
3142c4b38873SAlexander Kozyrev
3143c4b38873SAlexander Kozyrev``flow template_table create`` creates the specified template table.
3144c4b38873SAlexander KozyrevIt is bound to ``rte_flow_template_table_create()``::
3145c4b38873SAlexander Kozyrev
3146c4b38873SAlexander Kozyrev   flow template_table {port_id} create
3147c4b38873SAlexander Kozyrev       [table_id {id}] [group {group_id}]
3148c4b38873SAlexander Kozyrev       [priority {level}] [ingress] [egress] [transfer]
3149c4b38873SAlexander Kozyrev       rules_number {number}
3150c4b38873SAlexander Kozyrev       pattern_template {pattern_template_id}
3151c4b38873SAlexander Kozyrev       actions_template {actions_template_id}
3152c4b38873SAlexander Kozyrev
3153c4b38873SAlexander KozyrevIf successful, it will show::
3154c4b38873SAlexander Kozyrev
3155c4b38873SAlexander Kozyrev   Template table #[...] created
3156c4b38873SAlexander Kozyrev
3157c4b38873SAlexander KozyrevOtherwise it will show an error message of the form::
3158c4b38873SAlexander Kozyrev
3159c4b38873SAlexander Kozyrev   Caught error type [...] ([...]): [...]
3160c4b38873SAlexander Kozyrev
3161c4b38873SAlexander KozyrevDestroying flow table
3162c4b38873SAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~
3163c4b38873SAlexander Kozyrev
3164c4b38873SAlexander Kozyrev``flow template_table destroy`` destroys one or more template tables
3165c4b38873SAlexander Kozyrevfrom their table ID (as returned by ``flow template_table create``),
3166c4b38873SAlexander Kozyrevthis command calls ``rte_flow_template_table_destroy()`` as many
3167c4b38873SAlexander Kozyrevtimes as necessary::
3168c4b38873SAlexander Kozyrev
3169c4b38873SAlexander Kozyrev   flow template_table {port_id} destroy table {id} [...]
3170c4b38873SAlexander Kozyrev
3171c4b38873SAlexander KozyrevIf successful, it will show::
3172c4b38873SAlexander Kozyrev
3173c4b38873SAlexander Kozyrev   Template table #[...] destroyed
3174c4b38873SAlexander Kozyrev
3175c4b38873SAlexander KozyrevIt does not report anything for table IDs that do not exist.
3176c4b38873SAlexander KozyrevThe usual error message is shown when a table cannot be destroyed::
3177c4b38873SAlexander Kozyrev
3178c4b38873SAlexander Kozyrev   Caught error type [...] ([...]): [...]
3179c4b38873SAlexander Kozyrev
31809cbbee14SAlexander KozyrevPushing enqueued operations
31819cbbee14SAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~
31829cbbee14SAlexander Kozyrev
31839cbbee14SAlexander Kozyrev``flow push`` pushes all the outstanding enqueued operations
31849cbbee14SAlexander Kozyrevto the underlying device immediately.
31859cbbee14SAlexander KozyrevIt is bound to ``rte_flow_push()``::
31869cbbee14SAlexander Kozyrev
31879cbbee14SAlexander Kozyrev   flow push {port_id} queue {queue_id}
31889cbbee14SAlexander Kozyrev
31899cbbee14SAlexander KozyrevIf successful, it will show::
31909cbbee14SAlexander Kozyrev
31919cbbee14SAlexander Kozyrev   Queue #[...] operations pushed
31929cbbee14SAlexander Kozyrev
31939cbbee14SAlexander KozyrevThe usual error message is shown when operations cannot be pushed::
31949cbbee14SAlexander Kozyrev
31959cbbee14SAlexander Kozyrev   Caught error type [...] ([...]): [...]
31969cbbee14SAlexander Kozyrev
3197f9bf7dffSAlexander KozyrevPulling flow operations results
3198f9bf7dffSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3199f9bf7dffSAlexander Kozyrev
3200f9bf7dffSAlexander Kozyrev``flow pull`` asks the underlying device about flow queue operations
3201f9bf7dffSAlexander Kozyrevresults and return all the processed (successfully or not) operations.
3202f9bf7dffSAlexander KozyrevIt is bound to ``rte_flow_pull()``::
3203f9bf7dffSAlexander Kozyrev
3204f9bf7dffSAlexander Kozyrev   flow pull {port_id} queue {queue_id}
3205f9bf7dffSAlexander Kozyrev
3206f9bf7dffSAlexander KozyrevIf successful, it will show::
3207f9bf7dffSAlexander Kozyrev
3208f9bf7dffSAlexander Kozyrev   Queue #[...] pulled #[...] operations (#[...] failed, #[...] succeeded)
3209f9bf7dffSAlexander Kozyrev
3210f9bf7dffSAlexander KozyrevThe usual error message is shown when operations results cannot be pulled::
3211f9bf7dffSAlexander Kozyrev
3212f9bf7dffSAlexander Kozyrev   Caught error type [...] ([...]): [...]
3213f9bf7dffSAlexander Kozyrev
32141b9f2746SGregory EtelsonCreating a tunnel stub for offload
32151b9f2746SGregory Etelson~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32161b9f2746SGregory Etelson
32171b9f2746SGregory Etelson``flow tunnel create`` setup a tunnel stub for tunnel offload flow rules::
32181b9f2746SGregory Etelson
32191b9f2746SGregory Etelson   flow tunnel create {port_id} type {tunnel_type}
32201b9f2746SGregory Etelson
32211b9f2746SGregory EtelsonIf successful, it will return a tunnel stub ID usable with other commands::
32221b9f2746SGregory Etelson
32231b9f2746SGregory Etelson   port [...]: flow tunnel #[...] type [...]
32241b9f2746SGregory Etelson
32251b9f2746SGregory EtelsonTunnel stub ID is relative to a port.
32261b9f2746SGregory Etelson
32271b9f2746SGregory EtelsonDestroying tunnel offload stub
32281b9f2746SGregory Etelson~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32291b9f2746SGregory Etelson
32301b9f2746SGregory Etelson``flow tunnel destroy`` destroy port tunnel stub::
32311b9f2746SGregory Etelson
32321b9f2746SGregory Etelson   flow tunnel destroy {port_id} id {tunnel_id}
32331b9f2746SGregory Etelson
32341b9f2746SGregory EtelsonListing tunnel offload stubs
32351b9f2746SGregory Etelson~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32361b9f2746SGregory Etelson
32371b9f2746SGregory Etelson``flow tunnel list`` list port tunnel offload stubs::
32381b9f2746SGregory Etelson
32391b9f2746SGregory Etelson   flow tunnel list {port_id}
32401b9f2746SGregory Etelson
3241a997a33bSAdrien MazarguilValidating flow rules
3242a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~~~
3243a997a33bSAdrien Mazarguil
3244a997a33bSAdrien Mazarguil``flow validate`` reports whether a flow rule would be accepted by the
3245a997a33bSAdrien Mazarguilunderlying device in its current state but stops short of creating it. It is
3246a997a33bSAdrien Mazarguilbound to ``rte_flow_validate()``::
3247a997a33bSAdrien Mazarguil
3248a997a33bSAdrien Mazarguil   flow validate {port_id}
324976e9a55bSAdrien Mazarguil      [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
3250a997a33bSAdrien Mazarguil      pattern {item} [/ {item} [...]] / end
3251a997a33bSAdrien Mazarguil      actions {action} [/ {action} [...]] / end
3252a997a33bSAdrien Mazarguil
3253a997a33bSAdrien MazarguilIf successful, it will show::
3254a997a33bSAdrien Mazarguil
3255a997a33bSAdrien Mazarguil   Flow rule validated
3256a997a33bSAdrien Mazarguil
3257a997a33bSAdrien MazarguilOtherwise it will show an error message of the form::
3258a997a33bSAdrien Mazarguil
3259a997a33bSAdrien Mazarguil   Caught error type [...] ([...]): [...]
3260a997a33bSAdrien Mazarguil
3261a997a33bSAdrien MazarguilThis command uses the same parameters as ``flow create``, their format is
3262a997a33bSAdrien Mazarguildescribed in `Creating flow rules`_.
3263a997a33bSAdrien Mazarguil
3264a997a33bSAdrien MazarguilCheck whether redirecting any Ethernet packet received on port 0 to RX queue
3265a997a33bSAdrien Mazarguilindex 6 is supported::
3266a997a33bSAdrien Mazarguil
3267a997a33bSAdrien Mazarguil   testpmd> flow validate 0 ingress pattern eth / end
3268a997a33bSAdrien Mazarguil      actions queue index 6 / end
3269a997a33bSAdrien Mazarguil   Flow rule validated
3270a997a33bSAdrien Mazarguil   testpmd>
3271a997a33bSAdrien Mazarguil
3272a997a33bSAdrien MazarguilPort 0 does not support TCPv6 rules::
3273a997a33bSAdrien Mazarguil
3274a997a33bSAdrien Mazarguil   testpmd> flow validate 0 ingress pattern eth / ipv6 / tcp / end
3275a997a33bSAdrien Mazarguil      actions drop / end
3276a997a33bSAdrien Mazarguil   Caught error type 9 (specific pattern item): Invalid argument
3277a997a33bSAdrien Mazarguil   testpmd>
3278a997a33bSAdrien Mazarguil
3279a997a33bSAdrien MazarguilCreating flow rules
3280a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~
3281a997a33bSAdrien Mazarguil
3282a997a33bSAdrien Mazarguil``flow create`` validates and creates the specified flow rule. It is bound
3283a997a33bSAdrien Mazarguilto ``rte_flow_create()``::
3284a997a33bSAdrien Mazarguil
3285a997a33bSAdrien Mazarguil   flow create {port_id}
328676e9a55bSAdrien Mazarguil      [group {group_id}] [priority {level}] [ingress] [egress] [transfer]
32871b9f2746SGregory Etelson      [tunnel_set {tunnel_id}] [tunnel_match {tunnel_id}]
3288a997a33bSAdrien Mazarguil      pattern {item} [/ {item} [...]] / end
3289a997a33bSAdrien Mazarguil      actions {action} [/ {action} [...]] / end
3290a997a33bSAdrien Mazarguil
3291a997a33bSAdrien MazarguilIf successful, it will return a flow rule ID usable with other commands::
3292a997a33bSAdrien Mazarguil
3293a997a33bSAdrien Mazarguil   Flow rule #[...] created
3294a997a33bSAdrien Mazarguil
3295a997a33bSAdrien MazarguilOtherwise it will show an error message of the form::
3296a997a33bSAdrien Mazarguil
3297a997a33bSAdrien Mazarguil   Caught error type [...] ([...]): [...]
3298a997a33bSAdrien Mazarguil
3299a997a33bSAdrien MazarguilParameters describe in the following order:
3300a997a33bSAdrien Mazarguil
330176e9a55bSAdrien Mazarguil- Attributes (*group*, *priority*, *ingress*, *egress*, *transfer* tokens).
33021b9f2746SGregory Etelson- Tunnel offload specification (tunnel_set, tunnel_match)
3303a997a33bSAdrien Mazarguil- A matching pattern, starting with the *pattern* token and terminated by an
3304a997a33bSAdrien Mazarguil  *end* pattern item.
3305a997a33bSAdrien Mazarguil- Actions, starting with the *actions* token and terminated by an *end*
3306a997a33bSAdrien Mazarguil  action.
3307a997a33bSAdrien Mazarguil
3308a997a33bSAdrien MazarguilThese translate directly to *rte_flow* objects provided as-is to the
3309a997a33bSAdrien Mazarguilunderlying functions.
3310a997a33bSAdrien Mazarguil
3311a997a33bSAdrien MazarguilThe shortest valid definition only comprises mandatory tokens::
3312a997a33bSAdrien Mazarguil
3313a997a33bSAdrien Mazarguil   testpmd> flow create 0 pattern end actions end
3314a997a33bSAdrien Mazarguil
3315a997a33bSAdrien MazarguilNote that PMDs may refuse rules that essentially do nothing such as this
3316a997a33bSAdrien Mazarguilone.
3317a997a33bSAdrien Mazarguil
3318a997a33bSAdrien Mazarguil**All unspecified object values are automatically initialized to 0.**
3319a997a33bSAdrien Mazarguil
3320ecdc927bSAlexander KozyrevEnqueueing creation of flow rules
3321ecdc927bSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3322ecdc927bSAlexander Kozyrev
3323ecdc927bSAlexander Kozyrev``flow queue create`` adds creation operation of a flow rule to a queue.
3324ecdc927bSAlexander KozyrevIt is bound to ``rte_flow_async_create()``::
3325ecdc927bSAlexander Kozyrev
3326ecdc927bSAlexander Kozyrev   flow queue {port_id} create {queue_id}
3327ecdc927bSAlexander Kozyrev       [postpone {boolean}] template_table {table_id}
3328ecdc927bSAlexander Kozyrev       pattern_template {pattern_template_index}
3329ecdc927bSAlexander Kozyrev       actions_template {actions_template_index}
3330ecdc927bSAlexander Kozyrev       pattern {item} [/ {item} [...]] / end
3331ecdc927bSAlexander Kozyrev       actions {action} [/ {action} [...]] / end
3332ecdc927bSAlexander Kozyrev
3333ecdc927bSAlexander KozyrevIf successful, it will return a flow rule ID usable with other commands::
3334ecdc927bSAlexander Kozyrev
3335ecdc927bSAlexander Kozyrev   Flow rule #[...] creaion enqueued
3336ecdc927bSAlexander Kozyrev
3337ecdc927bSAlexander KozyrevOtherwise it will show an error message of the form::
3338ecdc927bSAlexander Kozyrev
3339ecdc927bSAlexander Kozyrev   Caught error type [...] ([...]): [...]
3340ecdc927bSAlexander Kozyrev
3341ecdc927bSAlexander KozyrevThis command uses the same pattern items and actions as ``flow create``,
3342ecdc927bSAlexander Kozyrevtheir format is described in `Creating flow rules`_.
3343ecdc927bSAlexander Kozyrev
3344f9bf7dffSAlexander Kozyrev``flow queue pull`` must be called to retrieve the operation status.
3345f9bf7dffSAlexander Kozyrev
3346a997a33bSAdrien MazarguilAttributes
3347a997a33bSAdrien Mazarguil^^^^^^^^^^
3348a997a33bSAdrien Mazarguil
3349a997a33bSAdrien MazarguilThese tokens affect flow rule attributes (``struct rte_flow_attr``) and are
3350a997a33bSAdrien Mazarguilspecified before the ``pattern`` token.
3351a997a33bSAdrien Mazarguil
3352a997a33bSAdrien Mazarguil- ``group {group id}``: priority group.
3353a997a33bSAdrien Mazarguil- ``priority {level}``: priority level within group.
3354a997a33bSAdrien Mazarguil- ``ingress``: rule applies to ingress traffic.
3355a997a33bSAdrien Mazarguil- ``egress``: rule applies to egress traffic.
335676e9a55bSAdrien Mazarguil- ``transfer``: apply rule directly to endpoints found in pattern.
3357a997a33bSAdrien Mazarguil
33582490bb89SIvan MalovPlease note that use of ``transfer`` attribute requires that the flow and
33592490bb89SIvan Malovits indirect components be managed via so-called ``transfer`` proxy port.
33602490bb89SIvan MalovSee `show flow transfer proxy port ID for the given port`_ for details.
33612490bb89SIvan Malov
3362a997a33bSAdrien MazarguilEach instance of an attribute specified several times overrides the previous
3363a997a33bSAdrien Mazarguilvalue as shown below (group 4 is used)::
3364a997a33bSAdrien Mazarguil
3365a997a33bSAdrien Mazarguil   testpmd> flow create 0 group 42 group 24 group 4 [...]
3366a997a33bSAdrien Mazarguil
3367a997a33bSAdrien MazarguilNote that once enabled, ``ingress`` and ``egress`` cannot be disabled.
3368a997a33bSAdrien Mazarguil
3369a997a33bSAdrien MazarguilWhile not specifying a direction is an error, some rules may allow both
3370a997a33bSAdrien Mazarguilsimultaneously.
3371a997a33bSAdrien Mazarguil
3372a997a33bSAdrien MazarguilMost rules affect RX therefore contain the ``ingress`` token::
3373a997a33bSAdrien Mazarguil
3374a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern [...]
3375a997a33bSAdrien Mazarguil
33761b9f2746SGregory EtelsonTunnel offload
33771b9f2746SGregory Etelson^^^^^^^^^^^^^^
33781b9f2746SGregory Etelson
33791b9f2746SGregory EtelsonIndicate tunnel offload rule type
33801b9f2746SGregory Etelson
33811b9f2746SGregory Etelson- ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type.
33827be78d02SJosh Soref- ``tunnel_match {tunnel_id}``:  mark rule as tunnel offload match type.
33831b9f2746SGregory Etelson
3384a997a33bSAdrien MazarguilMatching pattern
3385a997a33bSAdrien Mazarguil^^^^^^^^^^^^^^^^
3386a997a33bSAdrien Mazarguil
3387a997a33bSAdrien MazarguilA matching pattern starts after the ``pattern`` token. It is made of pattern
3388a997a33bSAdrien Mazarguilitems and is terminated by a mandatory ``end`` item.
3389a997a33bSAdrien Mazarguil
3390a997a33bSAdrien MazarguilItems are named after their type (*RTE_FLOW_ITEM_TYPE_* from ``enum
3391a997a33bSAdrien Mazarguilrte_flow_item_type``).
3392a997a33bSAdrien Mazarguil
3393a997a33bSAdrien MazarguilThe ``/`` token is used as a separator between pattern items as shown
3394a997a33bSAdrien Mazarguilbelow::
3395a997a33bSAdrien Mazarguil
3396a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end [...]
3397a997a33bSAdrien Mazarguil
3398a997a33bSAdrien MazarguilNote that protocol items like these must be stacked from lowest to highest
3399a997a33bSAdrien Mazarguillayer to make sense. For instance, the following rule is either invalid or
3400a997a33bSAdrien Mazarguilunlikely to match any packet::
3401a997a33bSAdrien Mazarguil
3402a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / udp / ipv4 / end [...]
3403a997a33bSAdrien Mazarguil
3404a997a33bSAdrien MazarguilMore information on these restrictions can be found in the *rte_flow*
3405a997a33bSAdrien Mazarguildocumentation.
3406a997a33bSAdrien Mazarguil
3407a997a33bSAdrien MazarguilSeveral items support additional specification structures, for example
3408a997a33bSAdrien Mazarguil``ipv4`` allows specifying source and destination addresses as follows::
3409a997a33bSAdrien Mazarguil
3410a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 src is 10.1.1.1
3411a997a33bSAdrien Mazarguil      dst is 10.2.0.0 / end [...]
3412a997a33bSAdrien Mazarguil
3413a997a33bSAdrien MazarguilThis rule matches all IPv4 traffic with the specified properties.
3414a997a33bSAdrien Mazarguil
3415a997a33bSAdrien MazarguilIn this example, ``src`` and ``dst`` are field names of the underlying
3416a997a33bSAdrien Mazarguil``struct rte_flow_item_ipv4`` object. All item properties can be specified
3417a997a33bSAdrien Mazarguilin a similar fashion.
3418a997a33bSAdrien Mazarguil
3419a997a33bSAdrien MazarguilThe ``is`` token means that the subsequent value must be matched exactly,
3420a997a33bSAdrien Mazarguiland assigns ``spec`` and ``mask`` fields in ``struct rte_flow_item``
3421a997a33bSAdrien Mazarguilaccordingly. Possible assignment tokens are:
3422a997a33bSAdrien Mazarguil
3423a997a33bSAdrien Mazarguil- ``is``: match value perfectly (with full bit-mask).
3424a997a33bSAdrien Mazarguil- ``spec``: match value according to configured bit-mask.
3425a997a33bSAdrien Mazarguil- ``last``: specify upper bound to establish a range.
3426a997a33bSAdrien Mazarguil- ``mask``: specify bit-mask with relevant bits set to one.
3427892cfaddSDekel Peled- ``prefix``: generate bit-mask with <prefix-length> most-significant bits set to one.
3428a997a33bSAdrien Mazarguil
3429a997a33bSAdrien MazarguilThese yield identical results::
3430a997a33bSAdrien Mazarguil
3431a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1
3432a997a33bSAdrien Mazarguil
3433a997a33bSAdrien Mazarguil::
3434a997a33bSAdrien Mazarguil
3435a997a33bSAdrien Mazarguil   ipv4 src spec 10.1.1.1 src mask 255.255.255.255
3436a997a33bSAdrien Mazarguil
3437a997a33bSAdrien Mazarguil::
3438a997a33bSAdrien Mazarguil
3439a997a33bSAdrien Mazarguil   ipv4 src spec 10.1.1.1 src prefix 32
3440a997a33bSAdrien Mazarguil
3441a997a33bSAdrien Mazarguil::
3442a997a33bSAdrien Mazarguil
3443a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src last 10.1.1.1 # range with a single value
3444a997a33bSAdrien Mazarguil
3445a997a33bSAdrien Mazarguil::
3446a997a33bSAdrien Mazarguil
3447a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src last 0 # 0 disables range
3448a997a33bSAdrien Mazarguil
3449a997a33bSAdrien MazarguilInclusive ranges can be defined with ``last``::
3450a997a33bSAdrien Mazarguil
3451a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src last 10.2.3.4 # 10.1.1.1 to 10.2.3.4
3452a997a33bSAdrien Mazarguil
3453a997a33bSAdrien MazarguilNote that ``mask`` affects both ``spec`` and ``last``::
3454a997a33bSAdrien Mazarguil
3455a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src last 10.2.3.4 src mask 255.255.0.0
3456a997a33bSAdrien Mazarguil      # matches 10.1.0.0 to 10.2.255.255
3457a997a33bSAdrien Mazarguil
3458a997a33bSAdrien MazarguilProperties can be modified multiple times::
3459a997a33bSAdrien Mazarguil
3460a997a33bSAdrien 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
3461a997a33bSAdrien Mazarguil
3462a997a33bSAdrien Mazarguil::
3463a997a33bSAdrien Mazarguil
3464a997a33bSAdrien Mazarguil   ipv4 src is 10.1.1.1 src prefix 24 src prefix 16 # matches 10.1.0.0/16
3465a997a33bSAdrien Mazarguil
3466a997a33bSAdrien MazarguilPattern items
3467a997a33bSAdrien Mazarguil^^^^^^^^^^^^^
3468a997a33bSAdrien Mazarguil
3469a997a33bSAdrien MazarguilThis section lists supported pattern items and their attributes, if any.
3470a997a33bSAdrien Mazarguil
3471a997a33bSAdrien Mazarguil- ``end``: end list of pattern items.
3472a997a33bSAdrien Mazarguil
3473a997a33bSAdrien Mazarguil- ``void``: no-op pattern item.
3474a997a33bSAdrien Mazarguil
3475a997a33bSAdrien Mazarguil- ``invert``: perform actions when pattern does not match.
3476a997a33bSAdrien Mazarguil
3477a997a33bSAdrien Mazarguil- ``any``: match any protocol for the current layer.
3478a997a33bSAdrien Mazarguil
3479a997a33bSAdrien Mazarguil  - ``num {unsigned}``: number of layers covered.
3480a997a33bSAdrien Mazarguil
3481fc6bbb3fSAdrien Mazarguil- ``port_id``: match traffic from/to a given DPDK port ID.
3482fc6bbb3fSAdrien Mazarguil
3483fc6bbb3fSAdrien Mazarguil  - ``id {unsigned}``: DPDK port ID.
3484fc6bbb3fSAdrien Mazarguil
3485e05419b3SDeclan Doherty- ``mark``: match value set in previously matched flow rule using the mark action.
3486e05419b3SDeclan Doherty
3487e05419b3SDeclan Doherty  - ``id {unsigned}``: arbitrary integer value.
3488e05419b3SDeclan Doherty
3489a997a33bSAdrien Mazarguil- ``raw``: match an arbitrary byte string.
3490a997a33bSAdrien Mazarguil
3491a997a33bSAdrien Mazarguil  - ``relative {boolean}``: look for pattern after the previous item.
3492a997a33bSAdrien Mazarguil  - ``search {boolean}``: search pattern from offset (see also limit).
3493a997a33bSAdrien Mazarguil  - ``offset {integer}``: absolute or relative offset for pattern.
3494a997a33bSAdrien Mazarguil  - ``limit {unsigned}``: search area limit for start of pattern.
3495a997a33bSAdrien Mazarguil  - ``pattern {string}``: byte string to look for.
3496cb43641eSNipun Gupta  - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for.
3497a997a33bSAdrien Mazarguil
3498a997a33bSAdrien Mazarguil- ``eth``: match Ethernet header.
3499a997a33bSAdrien Mazarguil
3500a997a33bSAdrien Mazarguil  - ``dst {MAC-48}``: destination MAC.
3501a997a33bSAdrien Mazarguil  - ``src {MAC-48}``: source MAC.
3502e58638c3SAdrien Mazarguil  - ``type {unsigned}``: EtherType or TPID.
3503a997a33bSAdrien Mazarguil
3504a997a33bSAdrien Mazarguil- ``vlan``: match 802.1Q/ad VLAN tag.
3505a997a33bSAdrien Mazarguil
3506a997a33bSAdrien Mazarguil  - ``tci {unsigned}``: tag control information.
35071419fd5aSAdrien Mazarguil  - ``pcp {unsigned}``: priority code point.
35081419fd5aSAdrien Mazarguil  - ``dei {unsigned}``: drop eligible indicator.
35091419fd5aSAdrien Mazarguil  - ``vid {unsigned}``: VLAN identifier.
3510e58638c3SAdrien Mazarguil  - ``inner_type {unsigned}``: inner EtherType or TPID.
3511a997a33bSAdrien Mazarguil
3512a997a33bSAdrien Mazarguil- ``ipv4``: match IPv4 header.
3513a997a33bSAdrien Mazarguil
3514730bf066SGregory Etelson  - ``version_ihl {unsigned}``: IPv4 version and IP header length.
35151419fd5aSAdrien Mazarguil  - ``tos {unsigned}``: type of service.
35161419fd5aSAdrien Mazarguil  - ``ttl {unsigned}``: time to live.
35171419fd5aSAdrien Mazarguil  - ``proto {unsigned}``: next protocol ID.
3518a997a33bSAdrien Mazarguil  - ``src {ipv4 address}``: source address.
3519a997a33bSAdrien Mazarguil  - ``dst {ipv4 address}``: destination address.
3520a997a33bSAdrien Mazarguil
3521a997a33bSAdrien Mazarguil- ``ipv6``: match IPv6 header.
3522a997a33bSAdrien Mazarguil
35231419fd5aSAdrien Mazarguil  - ``tc {unsigned}``: traffic class.
35241419fd5aSAdrien Mazarguil  - ``flow {unsigned}``: flow label.
35251419fd5aSAdrien Mazarguil  - ``proto {unsigned}``: protocol (next header).
35261419fd5aSAdrien Mazarguil  - ``hop {unsigned}``: hop limit.
3527a997a33bSAdrien Mazarguil  - ``src {ipv6 address}``: source address.
3528a997a33bSAdrien Mazarguil  - ``dst {ipv6 address}``: destination address.
3529a997a33bSAdrien Mazarguil
3530a997a33bSAdrien Mazarguil- ``icmp``: match ICMP header.
3531a997a33bSAdrien Mazarguil
3532a997a33bSAdrien Mazarguil  - ``type {unsigned}``: ICMP packet type.
3533a997a33bSAdrien Mazarguil  - ``code {unsigned}``: ICMP packet code.
3534a997a33bSAdrien Mazarguil
3535a997a33bSAdrien Mazarguil- ``udp``: match UDP header.
3536a997a33bSAdrien Mazarguil
3537a997a33bSAdrien Mazarguil  - ``src {unsigned}``: UDP source port.
3538a997a33bSAdrien Mazarguil  - ``dst {unsigned}``: UDP destination port.
3539a997a33bSAdrien Mazarguil
3540a997a33bSAdrien Mazarguil- ``tcp``: match TCP header.
3541a997a33bSAdrien Mazarguil
3542a997a33bSAdrien Mazarguil  - ``src {unsigned}``: TCP source port.
3543a997a33bSAdrien Mazarguil  - ``dst {unsigned}``: TCP destination port.
3544a997a33bSAdrien Mazarguil
3545a997a33bSAdrien Mazarguil- ``sctp``: match SCTP header.
3546a997a33bSAdrien Mazarguil
3547a997a33bSAdrien Mazarguil  - ``src {unsigned}``: SCTP source port.
3548a997a33bSAdrien Mazarguil  - ``dst {unsigned}``: SCTP destination port.
35491419fd5aSAdrien Mazarguil  - ``tag {unsigned}``: validation tag.
35501419fd5aSAdrien Mazarguil  - ``cksum {unsigned}``: checksum.
3551a997a33bSAdrien Mazarguil
3552a997a33bSAdrien Mazarguil- ``vxlan``: match VXLAN header.
3553a997a33bSAdrien Mazarguil
3554a997a33bSAdrien Mazarguil  - ``vni {unsigned}``: VXLAN identifier.
3555dbd8e410SRongwei Liu  - ``last_rsvd {unsigned}``: VXLAN last reserved 8-bits.
3556a997a33bSAdrien Mazarguil
3557e4840ef2SAdrien Mazarguil- ``e_tag``: match IEEE 802.1BR E-Tag header.
3558e4840ef2SAdrien Mazarguil
3559e4840ef2SAdrien Mazarguil  - ``grp_ecid_b {unsigned}``: GRP and E-CID base.
3560e4840ef2SAdrien Mazarguil
3561e4840ef2SAdrien Mazarguil- ``nvgre``: match NVGRE header.
3562e4840ef2SAdrien Mazarguil
3563e4840ef2SAdrien Mazarguil  - ``tni {unsigned}``: virtual subnet ID.
3564e4840ef2SAdrien Mazarguil
35651315219aSBeilei Xing- ``mpls``: match MPLS header.
35661315219aSBeilei Xing
35671315219aSBeilei Xing  - ``label {unsigned}``: MPLS label.
35681315219aSBeilei Xing
35691315219aSBeilei Xing- ``gre``: match GRE header.
35701315219aSBeilei Xing
35711315219aSBeilei Xing  - ``protocol {unsigned}``: protocol type.
35721315219aSBeilei Xing
3573c6ef1454SXiaoyu Min- ``gre_key``: match GRE optional key field.
3574c6ef1454SXiaoyu Min
3575c6ef1454SXiaoyu Min  - ``value {unsigned}``: key value.
3576c6ef1454SXiaoyu Min
357726b7259aSSean Zhang- ``gre_option``: match GRE optional fields(checksum/key/sequence).
357826b7259aSSean Zhang
357926b7259aSSean Zhang  - ``checksum {unsigned}``: checksum value.
358026b7259aSSean Zhang  - ``key {unsigned}``: key value.
358126b7259aSSean Zhang  - ``sequence {unsigned}``: sequence number value.
358226b7259aSSean Zhang
3583a3a2e2c8SQi Zhang- ``fuzzy``: fuzzy pattern match, expect faster than default.
3584a3a2e2c8SQi Zhang
3585a3a2e2c8SQi Zhang  - ``thresh {unsigned}``: accuracy threshold.
3586a3a2e2c8SQi Zhang
3587576f459eSBeilei Xing- ``gtp``, ``gtpc``, ``gtpu``: match GTPv1 header.
3588576f459eSBeilei Xing
3589576f459eSBeilei Xing  - ``teid {unsigned}``: tunnel endpoint identifier.
3590576f459eSBeilei Xing
35910f4203feSRoman Zhukov- ``geneve``: match GENEVE header.
35920f4203feSRoman Zhukov
35930f4203feSRoman Zhukov  - ``vni {unsigned}``: virtual network identifier.
35940f4203feSRoman Zhukov  - ``protocol {unsigned}``: protocol type.
35950f4203feSRoman Zhukov
359655c074f3SViacheslav Ovsiienko- ``geneve-opt``: match GENEVE header option.
359755c074f3SViacheslav Ovsiienko
359855c074f3SViacheslav Ovsiienko  - ``class {unsigned}``: GENEVE option class.
359955c074f3SViacheslav Ovsiienko  - ``type {unsigned}``: GENEVE option type.
360055c074f3SViacheslav Ovsiienko  - ``length {unsigned}``: GENEVE option length in 32-bit words.
360155c074f3SViacheslav Ovsiienko  - ``data {hex string}``: GENEVE option data, the length is defined by
360255c074f3SViacheslav Ovsiienko    ``length`` field.
360355c074f3SViacheslav Ovsiienko
360439e5e20fSXueming Li- ``vxlan-gpe``: match VXLAN-GPE header.
360539e5e20fSXueming Li
360639e5e20fSXueming Li  - ``vni {unsigned}``: VXLAN-GPE identifier.
360739e5e20fSXueming Li
3608a903c049SQi Zhang- ``arp_eth_ipv4``: match ARP header for Ethernet/IPv4.
3609a903c049SQi Zhang
3610a903c049SQi Zhang  - ``sha {MAC-48}``: sender hardware address.
3611a903c049SQi Zhang  - ``spa {ipv4 address}``: sender IPv4 address.
3612a903c049SQi Zhang  - ``tha {MAC-48}``: target hardware address.
3613a903c049SQi Zhang  - ``tpa {ipv4 address}``: target IPv4 address.
3614a903c049SQi Zhang
3615a903c049SQi Zhang- ``ipv6_ext``: match presence of any IPv6 extension header.
3616a903c049SQi Zhang
3617a903c049SQi Zhang  - ``next_hdr {unsigned}``: next header.
3618a903c049SQi Zhang
3619a903c049SQi Zhang- ``icmp6``: match any ICMPv6 header.
3620a903c049SQi Zhang
3621a903c049SQi Zhang  - ``type {unsigned}``: ICMPv6 type.
3622a903c049SQi Zhang  - ``code {unsigned}``: ICMPv6 code.
3623a903c049SQi Zhang
3624a903c049SQi Zhang- ``icmp6_nd_ns``: match ICMPv6 neighbor discovery solicitation.
3625a903c049SQi Zhang
3626a903c049SQi Zhang  - ``target_addr {ipv6 address}``: target address.
3627a903c049SQi Zhang
3628a903c049SQi Zhang- ``icmp6_nd_na``: match ICMPv6 neighbor discovery advertisement.
3629a903c049SQi Zhang
3630a903c049SQi Zhang  - ``target_addr {ipv6 address}``: target address.
3631a903c049SQi Zhang
3632a903c049SQi Zhang- ``icmp6_nd_opt``: match presence of any ICMPv6 neighbor discovery option.
3633a903c049SQi Zhang
3634a903c049SQi Zhang  - ``type {unsigned}``: ND option type.
3635a903c049SQi Zhang
3636a903c049SQi Zhang- ``icmp6_nd_opt_sla_eth``: match ICMPv6 neighbor discovery source Ethernet
3637a903c049SQi Zhang  link-layer address option.
3638a903c049SQi Zhang
3639a903c049SQi Zhang  - ``sla {MAC-48}``: source Ethernet LLA.
3640a903c049SQi Zhang
3641205d9d3cSDekel Peled- ``icmp6_nd_opt_tla_eth``: match ICMPv6 neighbor discovery target Ethernet
3642a903c049SQi Zhang  link-layer address option.
3643a903c049SQi Zhang
3644a903c049SQi Zhang  - ``tla {MAC-48}``: target Ethernet LLA.
3645a903c049SQi Zhang
3646c18feafaSDekel Peled- ``meta``: match application specific metadata.
3647c18feafaSDekel Peled
3648c18feafaSDekel Peled  - ``data {unsigned}``: metadata value.
3649c18feafaSDekel Peled
3650346553dbSYing A Wang- ``gtp_psc``: match GTP PDU extension header with type 0x85.
3651346553dbSYing A Wang
3652346553dbSYing A Wang  - ``pdu_type {unsigned}``: PDU type.
36537d96f571SRaslan Darawsheh
365416b8e92dSRaslan Darawsheh  - ``qfi {unsigned}``: QoS flow identifier.
3655346553dbSYing A Wang
3656226c6e60SYing A Wang- ``pppoes``, ``pppoed``: match PPPoE header.
3657226c6e60SYing A Wang
3658226c6e60SYing A Wang  - ``session_id {unsigned}``: session identifier.
3659226c6e60SYing A Wang
3660226c6e60SYing A Wang- ``pppoe_proto_id``: match PPPoE session protocol identifier.
3661226c6e60SYing A Wang
3662226c6e60SYing A Wang  - ``proto_id {unsigned}``: PPP protocol identifier.
3663226c6e60SYing A Wang
366465388f4cSRory Sexton- ``l2tpv3oip``: match L2TPv3 over IP header.
366565388f4cSRory Sexton
366665388f4cSRory Sexton  - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
366765388f4cSRory Sexton
3668573ef95dSXiao Zhang- ``ah``: match AH header.
3669573ef95dSXiao Zhang
3670573ef95dSXiao Zhang  - ``spi {unsigned}``: security parameters index.
3671573ef95dSXiao Zhang
3672ecbc8570SXiao Zhang- ``pfcp``: match PFCP header.
3673ecbc8570SXiao Zhang
3674ecbc8570SXiao Zhang  - ``s_field {unsigned}``: S field.
3675ecbc8570SXiao Zhang  - ``seid {unsigned}``: session endpoint identifier.
3676ecbc8570SXiao Zhang
36770797fa6cSOri Kam- ``integrity``: match packet integrity.
36780797fa6cSOri Kam
36790797fa6cSOri Kam   - ``level {unsigned}``: Packet encapsulation level the item should
36800797fa6cSOri Kam     apply to. See rte_flow_action_rss for details.
36810797fa6cSOri Kam   - ``value {unsigned}``: A bitmask that specify what packet elements
36820797fa6cSOri Kam     must be matched for integrity.
36830797fa6cSOri Kam
36844d07cbefSBing Zhao- ``conntrack``: match conntrack state.
36854d07cbefSBing Zhao
3686081e42daSIvan Malov- ``port_representor``: match traffic entering the embedded switch from the given ethdev
3687081e42daSIvan Malov
3688081e42daSIvan Malov  - ``port_id {unsigned}``: ethdev port ID
3689081e42daSIvan Malov
369049863ae2SIvan Malov- ``represented_port``: match traffic entering the embedded switch from
369149863ae2SIvan Malov  the entity represented by the given ethdev
369249863ae2SIvan Malov
369349863ae2SIvan Malov  - ``ethdev_port_id {unsigned}``: ethdev port ID
369449863ae2SIvan Malov
3695748530f0SJie Wang- ``l2tpv2``: match L2TPv2 header.
3696748530f0SJie Wang
3697748530f0SJie Wang  - ``length {unsigned}``: L2TPv2 option length.
3698748530f0SJie Wang  - ``tunnel_id {unsigned}``: L2TPv2 tunnel identifier.
3699748530f0SJie Wang  - ``session_id {unsigned}``: L2TPv2 session identifier.
3700748530f0SJie Wang  - ``ns {unsigned}``: L2TPv2 option ns.
3701748530f0SJie Wang  - ``nr {unsigned}``: L2TPv2 option nr.
3702988cd040SJie Wang  - ``offset_size {unsigned}``: L2TPv2 option offset.
3703748530f0SJie Wang
3704748530f0SJie Wang- ``ppp``: match PPP header.
3705748530f0SJie Wang
3706748530f0SJie Wang  - ``addr {unsigned}``: PPP address.
3707748530f0SJie Wang  - ``ctrl {unsigned}``: PPP control.
3708748530f0SJie Wang  - ``proto_id {unsigned}``: PPP protocol identifier.
3709748530f0SJie Wang
37103af7a4afSAlexander Kozyrev- ``meter``: match meter color.
37113af7a4afSAlexander Kozyrev
37123af7a4afSAlexander Kozyrev  - ``color {value}``: meter color value (green/yellow/red).
37133af7a4afSAlexander Kozyrev
37146838dd4bSMichael Savisko- ``send_to_kernel``: send packets to kernel.
37156838dd4bSMichael Savisko
37166838dd4bSMichael Savisko
3717a997a33bSAdrien MazarguilActions list
3718a997a33bSAdrien Mazarguil^^^^^^^^^^^^
3719a997a33bSAdrien Mazarguil
3720a997a33bSAdrien MazarguilA list of actions starts after the ``actions`` token in the same fashion as
3721a997a33bSAdrien Mazarguil`Matching pattern`_; actions are separated by ``/`` tokens and the list is
3722a997a33bSAdrien Mazarguilterminated by a mandatory ``end`` action.
3723a997a33bSAdrien Mazarguil
3724a997a33bSAdrien MazarguilActions are named after their type (*RTE_FLOW_ACTION_TYPE_* from ``enum
3725a997a33bSAdrien Mazarguilrte_flow_action_type``).
3726a997a33bSAdrien Mazarguil
3727a997a33bSAdrien MazarguilDropping all incoming UDPv4 packets can be expressed as follows::
3728a997a33bSAdrien Mazarguil
3729a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3730a997a33bSAdrien Mazarguil      actions drop / end
3731a997a33bSAdrien Mazarguil
3732a997a33bSAdrien MazarguilSeveral actions have configurable properties which must be specified when
3733a997a33bSAdrien Mazarguilthere is no valid default value. For example, ``queue`` requires a target
3734a997a33bSAdrien Mazarguilqueue index.
3735a997a33bSAdrien Mazarguil
3736a997a33bSAdrien MazarguilThis rule redirects incoming UDPv4 traffic to queue index 6::
3737a997a33bSAdrien Mazarguil
3738a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3739a997a33bSAdrien Mazarguil      actions queue index 6 / end
3740a997a33bSAdrien Mazarguil
3741a997a33bSAdrien MazarguilWhile this one could be rejected by PMDs (unspecified queue index)::
3742a997a33bSAdrien Mazarguil
3743a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / end
3744a997a33bSAdrien Mazarguil      actions queue / end
3745a997a33bSAdrien Mazarguil
3746a997a33bSAdrien MazarguilAs defined by *rte_flow*, the list is not ordered, all actions of a given
3747a997a33bSAdrien Mazarguilrule are performed simultaneously. These are equivalent::
3748a997a33bSAdrien Mazarguil
3749a997a33bSAdrien Mazarguil   queue index 6 / void / mark id 42 / end
3750a997a33bSAdrien Mazarguil
3751a997a33bSAdrien Mazarguil::
3752a997a33bSAdrien Mazarguil
3753a997a33bSAdrien Mazarguil   void / mark id 42 / queue index 6 / end
3754a997a33bSAdrien Mazarguil
3755a997a33bSAdrien MazarguilAll actions in a list should have different types, otherwise only the last
3756a997a33bSAdrien Mazarguilaction of a given type is taken into account::
3757a997a33bSAdrien Mazarguil
3758a997a33bSAdrien Mazarguil   queue index 4 / queue index 5 / queue index 6 / end # will use queue 6
3759a997a33bSAdrien Mazarguil
3760a997a33bSAdrien Mazarguil::
3761a997a33bSAdrien Mazarguil
3762a997a33bSAdrien Mazarguil   drop / drop / drop / end # drop is performed only once
3763a997a33bSAdrien Mazarguil
3764a997a33bSAdrien Mazarguil::
3765a997a33bSAdrien Mazarguil
3766a997a33bSAdrien Mazarguil   mark id 42 / queue index 3 / mark id 24 / end # mark will be 24
3767a997a33bSAdrien Mazarguil
3768a997a33bSAdrien MazarguilConsidering they are performed simultaneously, opposite and overlapping
3769a997a33bSAdrien Mazarguilactions can sometimes be combined when the end result is unambiguous::
3770a997a33bSAdrien Mazarguil
3771a997a33bSAdrien Mazarguil   drop / queue index 6 / end # drop has no effect
3772a997a33bSAdrien Mazarguil
3773a997a33bSAdrien Mazarguil::
3774a997a33bSAdrien Mazarguil
3775a997a33bSAdrien Mazarguil   queue index 6 / rss queues 6 7 8 / end # queue has no effect
3776a997a33bSAdrien Mazarguil
3777a997a33bSAdrien Mazarguil::
3778a997a33bSAdrien Mazarguil
3779a997a33bSAdrien Mazarguil   drop / passthru / end # drop has no effect
3780a997a33bSAdrien Mazarguil
3781a997a33bSAdrien MazarguilNote that PMDs may still refuse such combinations.
3782a997a33bSAdrien Mazarguil
3783a997a33bSAdrien MazarguilActions
3784a997a33bSAdrien Mazarguil^^^^^^^
3785a997a33bSAdrien Mazarguil
3786a997a33bSAdrien MazarguilThis section lists supported actions and their attributes, if any.
3787a997a33bSAdrien Mazarguil
3788a997a33bSAdrien Mazarguil- ``end``: end list of actions.
3789a997a33bSAdrien Mazarguil
3790a997a33bSAdrien Mazarguil- ``void``: no-op action.
3791a997a33bSAdrien Mazarguil
3792a997a33bSAdrien Mazarguil- ``passthru``: let subsequent rule process matched packets.
3793a997a33bSAdrien Mazarguil
37942f82d143SDeclan Doherty- ``jump``: redirect traffic to group on device.
37952f82d143SDeclan Doherty
37962f82d143SDeclan Doherty  - ``group {unsigned}``: group to redirect to.
37972f82d143SDeclan Doherty
3798a997a33bSAdrien Mazarguil- ``mark``: attach 32 bit value to packets.
3799a997a33bSAdrien Mazarguil
3800a997a33bSAdrien Mazarguil  - ``id {unsigned}``: 32 bit value to return with packets.
3801a997a33bSAdrien Mazarguil
3802a997a33bSAdrien Mazarguil- ``flag``: flag packets.
3803a997a33bSAdrien Mazarguil
3804a997a33bSAdrien Mazarguil- ``queue``: assign packets to a given queue index.
3805a997a33bSAdrien Mazarguil
3806a997a33bSAdrien Mazarguil  - ``index {unsigned}``: queue index to use.
3807a997a33bSAdrien Mazarguil
3808a997a33bSAdrien Mazarguil- ``drop``: drop packets (note: passthru has priority).
3809a997a33bSAdrien Mazarguil
3810a997a33bSAdrien Mazarguil- ``count``: enable counters for this rule.
3811a997a33bSAdrien Mazarguil
3812a997a33bSAdrien Mazarguil- ``rss``: spread packets among several queues.
3813a997a33bSAdrien Mazarguil
3814929e3319SAdrien Mazarguil  - ``func {hash function}``: RSS hash function to apply, allowed tokens are
381581db321dSAndrew Rybchenko    ``toeplitz``, ``simple_xor``, ``symmetric_toeplitz`` and ``default``.
3816929e3319SAdrien Mazarguil
381718aee286SAdrien Mazarguil  - ``level {unsigned}``: encapsulation level for ``types``.
381818aee286SAdrien Mazarguil
381981db321dSAndrew Rybchenko  - ``types [{RSS hash type} [...]] end``: specific RSS hash types.
382081db321dSAndrew Rybchenko    Note that an empty list does not disable RSS but instead requests
382181db321dSAndrew Rybchenko    unspecified "best-effort" settings.
3822f4d623f9SAdrien Mazarguil
3823f4d623f9SAdrien Mazarguil  - ``key {string}``: RSS hash key, overrides ``key_len``.
3824f4d623f9SAdrien Mazarguil
3825f4d623f9SAdrien Mazarguil  - ``key_len {unsigned}``: RSS hash key length in bytes, can be used in
3826f4d623f9SAdrien Mazarguil    conjunction with ``key`` to pad or truncate it.
3827f4d623f9SAdrien Mazarguil
3828a997a33bSAdrien Mazarguil  - ``queues [{unsigned} [...]] end``: queue indices to use.
3829a997a33bSAdrien Mazarguil
383039b8dda7SAdrien Mazarguil- ``pf``: direct traffic to physical function.
3831a997a33bSAdrien Mazarguil
383239b8dda7SAdrien Mazarguil- ``vf``: direct traffic to a virtual function ID.
3833a997a33bSAdrien Mazarguil
3834a997a33bSAdrien Mazarguil  - ``original {boolean}``: use original VF ID if possible.
383539b8dda7SAdrien Mazarguil  - ``id {unsigned}``: VF ID.
3836a997a33bSAdrien Mazarguil
3837fc6bbb3fSAdrien Mazarguil- ``port_id``: direct matching traffic to a given DPDK port ID.
3838fc6bbb3fSAdrien Mazarguil
3839fc6bbb3fSAdrien Mazarguil  - ``original {boolean}``: use original DPDK port ID if possible.
3840fc6bbb3fSAdrien Mazarguil  - ``id {unsigned}``: DPDK port ID.
3841fc6bbb3fSAdrien Mazarguil
38421c54c938SQi Zhang- ``of_set_mpls_ttl``: OpenFlow's ``OFPAT_SET_MPLS_TTL``.
38431c54c938SQi Zhang
38441c54c938SQi Zhang  - ``mpls_ttl``: MPLS TTL.
38451c54c938SQi Zhang
38461c54c938SQi Zhang- ``of_dec_mpls_ttl``: OpenFlow's ``OFPAT_DEC_MPLS_TTL``.
38471c54c938SQi Zhang
38481c54c938SQi Zhang- ``of_set_nw_ttl``: OpenFlow's ``OFPAT_SET_NW_TTL``.
38491c54c938SQi Zhang
38501c54c938SQi Zhang  - ``nw_ttl``: IP TTL.
38511c54c938SQi Zhang
38521c54c938SQi Zhang- ``of_dec_nw_ttl``: OpenFlow's ``OFPAT_DEC_NW_TTL``.
38531c54c938SQi Zhang
38541c54c938SQi Zhang- ``of_copy_ttl_out``: OpenFlow's ``OFPAT_COPY_TTL_OUT``.
38551c54c938SQi Zhang
38561c54c938SQi Zhang- ``of_copy_ttl_in``: OpenFlow's ``OFPAT_COPY_TTL_IN``.
38571c54c938SQi Zhang
38587e3389b1SQi Zhang- ``of_pop_vlan``: OpenFlow's ``OFPAT_POP_VLAN``.
38597e3389b1SQi Zhang
38607e3389b1SQi Zhang- ``of_push_vlan``: OpenFlow's ``OFPAT_PUSH_VLAN``.
38617e3389b1SQi Zhang
38627e3389b1SQi Zhang  - ``ethertype``: Ethertype.
38637e3389b1SQi Zhang
38647e3389b1SQi Zhang- ``of_set_vlan_vid``: OpenFlow's ``OFPAT_SET_VLAN_VID``.
38657e3389b1SQi Zhang
38667e3389b1SQi Zhang  - ``vlan_vid``: VLAN id.
38677e3389b1SQi Zhang
38687e3389b1SQi Zhang- ``of_set_vlan_pcp``: OpenFlow's ``OFPAT_SET_VLAN_PCP``.
38697e3389b1SQi Zhang
38707e3389b1SQi Zhang  - ``vlan_pcp``: VLAN priority.
38717e3389b1SQi Zhang
38727e3389b1SQi Zhang- ``of_pop_mpls``: OpenFlow's ``OFPAT_POP_MPLS``.
38737e3389b1SQi Zhang
38747e3389b1SQi Zhang  - ``ethertype``: Ethertype.
38757e3389b1SQi Zhang
38767e3389b1SQi Zhang- ``of_push_mpls``: OpenFlow's ``OFPAT_PUSH_MPLS``.
38777e3389b1SQi Zhang
38787e3389b1SQi Zhang  - ``ethertype``: Ethertype.
38797e3389b1SQi Zhang
38801960be7dSNelio Laranjeiro- ``vxlan_encap``: Performs a VXLAN encapsulation, outer layer configuration
38811960be7dSNelio Laranjeiro  is done through `Config VXLAN Encap outer layers`_.
38821960be7dSNelio Laranjeiro
38831960be7dSNelio Laranjeiro- ``vxlan_decap``: Performs a decapsulation action by stripping all headers of
38841960be7dSNelio Laranjeiro  the VXLAN tunnel network overlay from the matched flow.
38851960be7dSNelio Laranjeiro
3886dcd962fcSNelio Laranjeiro- ``nvgre_encap``: Performs a NVGRE encapsulation, outer layer configuration
3887dcd962fcSNelio Laranjeiro  is done through `Config NVGRE Encap outer layers`_.
3888dcd962fcSNelio Laranjeiro
3889dcd962fcSNelio Laranjeiro- ``nvgre_decap``: Performs a decapsulation action by stripping all headers of
3890dcd962fcSNelio Laranjeiro  the NVGRE tunnel network overlay from the matched flow.
3891dcd962fcSNelio Laranjeiro
3892a1191d39SOri Kam- ``l2_encap``: Performs a L2 encapsulation, L2 configuration
3893a1191d39SOri Kam  is done through `Config L2 Encap`_.
3894a1191d39SOri Kam
3895a1191d39SOri Kam- ``l2_decap``: Performs a L2 decapsulation, L2 configuration
3896a1191d39SOri Kam  is done through `Config L2 Decap`_.
3897a1191d39SOri Kam
38983e77031bSOri Kam- ``mplsogre_encap``: Performs a MPLSoGRE encapsulation, outer layer
38993e77031bSOri Kam  configuration is done through `Config MPLSoGRE Encap outer layers`_.
39003e77031bSOri Kam
39013e77031bSOri Kam- ``mplsogre_decap``: Performs a MPLSoGRE decapsulation, outer layer
39023e77031bSOri Kam  configuration is done through `Config MPLSoGRE Decap outer layers`_.
39033e77031bSOri Kam
3904a1191d39SOri Kam- ``mplsoudp_encap``: Performs a MPLSoUDP encapsulation, outer layer
3905a1191d39SOri Kam  configuration is done through `Config MPLSoUDP Encap outer layers`_.
3906a1191d39SOri Kam
3907a1191d39SOri Kam- ``mplsoudp_decap``: Performs a MPLSoUDP decapsulation, outer layer
3908a1191d39SOri Kam  configuration is done through `Config MPLSoUDP Decap outer layers`_.
3909a1191d39SOri Kam
39100517eea7SRahul Lakkireddy- ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header.
39110517eea7SRahul Lakkireddy
39120517eea7SRahul Lakkireddy  - ``ipv4_addr``: New IPv4 source address.
39130517eea7SRahul Lakkireddy
39140517eea7SRahul Lakkireddy- ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4
39150517eea7SRahul Lakkireddy  header.
39160517eea7SRahul Lakkireddy
39170517eea7SRahul Lakkireddy  - ``ipv4_addr``: New IPv4 destination address.
39180517eea7SRahul Lakkireddy
39190517eea7SRahul Lakkireddy- ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header.
39200517eea7SRahul Lakkireddy
39210517eea7SRahul Lakkireddy  - ``ipv6_addr``: New IPv6 source address.
39220517eea7SRahul Lakkireddy
39230517eea7SRahul Lakkireddy- ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6
39240517eea7SRahul Lakkireddy  header.
39250517eea7SRahul Lakkireddy
39260517eea7SRahul Lakkireddy  - ``ipv6_addr``: New IPv6 destination address.
39270517eea7SRahul Lakkireddy
392847182a79SDekel Peled- ``set_tp_src``: Set a new source port number in the outermost TCP/UDP
39299ccc9491SRahul Lakkireddy  header.
39309ccc9491SRahul Lakkireddy
39319ccc9491SRahul Lakkireddy  - ``port``: New TCP/UDP source port number.
39329ccc9491SRahul Lakkireddy
393347182a79SDekel Peled- ``set_tp_dst``: Set a new destination port number in the outermost TCP/UDP
39349ccc9491SRahul Lakkireddy  header.
39359ccc9491SRahul Lakkireddy
39369ccc9491SRahul Lakkireddy  - ``port``: New TCP/UDP destination port number.
39379ccc9491SRahul Lakkireddy
393882875970SRahul Lakkireddy- ``mac_swap``: Swap the source and destination MAC addresses in the outermost
393982875970SRahul Lakkireddy  Ethernet header.
394082875970SRahul Lakkireddy
3941708d0bcbSXiaoyu Min- ``dec_ttl``: Performs a decrease TTL value action
3942708d0bcbSXiaoyu Min
3943d629b7b5SJohn McNamara- ``set_ttl``: Set TTL value with specified value
3944708d0bcbSXiaoyu Min  - ``ttl_value {unsigned}``: The new TTL value to be set
3945708d0bcbSXiaoyu Min
39464dff9e29SXiaoyu Min- ``set_mac_src``: set source MAC address
39474dff9e29SXiaoyu Min
39484dff9e29SXiaoyu Min  - ``mac_addr {MAC-48}``: new source MAC address
39494dff9e29SXiaoyu Min
39504dff9e29SXiaoyu Min- ``set_mac_dst``: set destination MAC address
39514dff9e29SXiaoyu Min
39524dff9e29SXiaoyu Min  - ``mac_addr {MAC-48}``: new destination MAC address
39534dff9e29SXiaoyu Min
395427a2c126SDekel Peled- ``inc_tcp_seq``: Increase sequence number in the outermost TCP header.
395527a2c126SDekel Peled
395627a2c126SDekel Peled  - ``value {unsigned}``: Value to increase TCP sequence number by.
395727a2c126SDekel Peled
395827a2c126SDekel Peled- ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header.
395927a2c126SDekel Peled
396027a2c126SDekel Peled  - ``value {unsigned}``: Value to decrease TCP sequence number by.
396127a2c126SDekel Peled
396227a2c126SDekel Peled- ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header.
396327a2c126SDekel Peled
396427a2c126SDekel Peled  - ``value {unsigned}``: Value to increase TCP acknowledgment number by.
396527a2c126SDekel Peled
396627a2c126SDekel Peled- ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header.
396727a2c126SDekel Peled
396827a2c126SDekel Peled  - ``value {unsigned}``: Value to decrease TCP acknowledgment number by.
396927a2c126SDekel Peled
39708482ffe4SSuanming Mou- ``set_ipv4_dscp``: Set IPv4 DSCP value with specified value
39718482ffe4SSuanming Mou
39728482ffe4SSuanming Mou  - ``dscp_value {unsigned}``: The new DSCP value to be set
39738482ffe4SSuanming Mou
39748482ffe4SSuanming Mou- ``set_ipv6_dscp``: Set IPv6 DSCP value with specified value
39758482ffe4SSuanming Mou
39768482ffe4SSuanming Mou  - ``dscp_value {unsigned}``: The new DSCP value to be set
39778482ffe4SSuanming Mou
39784b61b877SBing Zhao- ``indirect``: Use indirect action created via
39794b61b877SBing Zhao  ``flow indirect_action {port_id} create``
398055509e3aSAndrey Vesnovaty
39814b61b877SBing Zhao  - ``indirect_action_id {unsigned}``: Indirect action ID to use
398255509e3aSAndrey Vesnovaty
3983c5c50710SHaifei Luo- ``color``: Color the packet to reflect the meter color result
3984c5c50710SHaifei Luo
3985c5c50710SHaifei Luo  - ``type {value}``: Set color type with specified value(green/yellow/red)
3986c5c50710SHaifei Luo
39878edb6bc0SIvan Malov- ``port_representor``: at embedded switch level, send matching traffic to
39888edb6bc0SIvan Malov  the given ethdev
39898edb6bc0SIvan Malov
39908edb6bc0SIvan Malov  - ``port_id {unsigned}``: ethdev port ID
39918edb6bc0SIvan Malov
399288caad25SIvan Malov- ``represented_port``: at embedded switch level, send matching traffic to
399388caad25SIvan Malov  the entity represented by the given ethdev
399488caad25SIvan Malov
399588caad25SIvan Malov  - ``ethdev_port_id {unsigned}``: ethdev port ID
399688caad25SIvan Malov
39979c4a0c18SAlexander Kozyrev- ``meter_mark``:  meter the directed packets using profile and policy
39989c4a0c18SAlexander Kozyrev
39999c4a0c18SAlexander Kozyrev  - ``mtr_profile {unsigned}``: meter profile ID to use
40009c4a0c18SAlexander Kozyrev  - ``mtr_policy {unsigned}``: meter policy ID to use
40019c4a0c18SAlexander Kozyrev  - ``mtr_color_mode {unsigned}``: meter color-awareness mode (blind/aware)
40029c4a0c18SAlexander Kozyrev  - ``mtr_init_color {value}``: initial color value (green/yellow/red)
40039c4a0c18SAlexander Kozyrev  - ``mtr_state {unsigned}``: meter state (disabled/enabled)
40049c4a0c18SAlexander Kozyrev
4005a997a33bSAdrien MazarguilDestroying flow rules
4006a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~~~
4007a997a33bSAdrien Mazarguil
4008a997a33bSAdrien Mazarguil``flow destroy`` destroys one or more rules from their rule ID (as returned
4009a997a33bSAdrien Mazarguilby ``flow create``), this command calls ``rte_flow_destroy()`` as many
4010a997a33bSAdrien Mazarguiltimes as necessary::
4011a997a33bSAdrien Mazarguil
4012a997a33bSAdrien Mazarguil   flow destroy {port_id} rule {rule_id} [...]
4013a997a33bSAdrien Mazarguil
4014a997a33bSAdrien MazarguilIf successful, it will show::
4015a997a33bSAdrien Mazarguil
4016a997a33bSAdrien Mazarguil   Flow rule #[...] destroyed
4017a997a33bSAdrien Mazarguil
4018a997a33bSAdrien MazarguilIt does not report anything for rule IDs that do not exist. The usual error
4019a997a33bSAdrien Mazarguilmessage is shown when a rule cannot be destroyed::
4020a997a33bSAdrien Mazarguil
4021a997a33bSAdrien Mazarguil   Caught error type [...] ([...]): [...]
4022a997a33bSAdrien Mazarguil
4023a997a33bSAdrien Mazarguil``flow flush`` destroys all rules on a device and does not take extra
4024a997a33bSAdrien Mazarguilarguments. It is bound to ``rte_flow_flush()``::
4025a997a33bSAdrien Mazarguil
4026a997a33bSAdrien Mazarguil   flow flush {port_id}
4027a997a33bSAdrien Mazarguil
4028a997a33bSAdrien MazarguilAny errors are reported as above.
4029a997a33bSAdrien Mazarguil
4030a997a33bSAdrien MazarguilCreating several rules and destroying them::
4031a997a33bSAdrien Mazarguil
4032a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4033a997a33bSAdrien Mazarguil      actions queue index 2 / end
4034a997a33bSAdrien Mazarguil   Flow rule #0 created
4035a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4036a997a33bSAdrien Mazarguil      actions queue index 3 / end
4037a997a33bSAdrien Mazarguil   Flow rule #1 created
4038a997a33bSAdrien Mazarguil   testpmd> flow destroy 0 rule 0 rule 1
4039a997a33bSAdrien Mazarguil   Flow rule #1 destroyed
4040a997a33bSAdrien Mazarguil   Flow rule #0 destroyed
4041a997a33bSAdrien Mazarguil   testpmd>
4042a997a33bSAdrien Mazarguil
4043a997a33bSAdrien MazarguilThe same result can be achieved using ``flow flush``::
4044a997a33bSAdrien Mazarguil
4045a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4046a997a33bSAdrien Mazarguil      actions queue index 2 / end
4047a997a33bSAdrien Mazarguil   Flow rule #0 created
4048a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4049a997a33bSAdrien Mazarguil      actions queue index 3 / end
4050a997a33bSAdrien Mazarguil   Flow rule #1 created
4051a997a33bSAdrien Mazarguil   testpmd> flow flush 0
4052a997a33bSAdrien Mazarguil   testpmd>
4053a997a33bSAdrien Mazarguil
4054a997a33bSAdrien MazarguilNon-existent rule IDs are ignored::
4055a997a33bSAdrien Mazarguil
4056a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4057a997a33bSAdrien Mazarguil      actions queue index 2 / end
4058a997a33bSAdrien Mazarguil   Flow rule #0 created
4059a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4060a997a33bSAdrien Mazarguil      actions queue index 3 / end
4061a997a33bSAdrien Mazarguil   Flow rule #1 created
4062a997a33bSAdrien Mazarguil   testpmd> flow destroy 0 rule 42 rule 10 rule 2
4063a997a33bSAdrien Mazarguil   testpmd>
4064a997a33bSAdrien Mazarguil   testpmd> flow destroy 0 rule 0
4065a997a33bSAdrien Mazarguil   Flow rule #0 destroyed
4066a997a33bSAdrien Mazarguil   testpmd>
4067a997a33bSAdrien Mazarguil
4068ecdc927bSAlexander KozyrevEnqueueing destruction of flow rules
4069ecdc927bSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4070ecdc927bSAlexander Kozyrev
4071ecdc927bSAlexander Kozyrev``flow queue destroy`` adds destruction operations to destroy one or more rules
4072ecdc927bSAlexander Kozyrevfrom their rule ID (as returned by ``flow queue create``) to a queue,
4073ecdc927bSAlexander Kozyrevthis command calls ``rte_flow_async_destroy()`` as many times as necessary::
4074ecdc927bSAlexander Kozyrev
4075ecdc927bSAlexander Kozyrev   flow queue {port_id} destroy {queue_id}
4076ecdc927bSAlexander Kozyrev        [postpone {boolean}] rule {rule_id} [...]
4077ecdc927bSAlexander Kozyrev
4078ecdc927bSAlexander KozyrevIf successful, it will show::
4079ecdc927bSAlexander Kozyrev
4080ecdc927bSAlexander Kozyrev   Flow rule #[...] destruction enqueued
4081ecdc927bSAlexander Kozyrev
4082ecdc927bSAlexander KozyrevIt does not report anything for rule IDs that do not exist. The usual error
4083ecdc927bSAlexander Kozyrevmessage is shown when a rule cannot be destroyed::
4084ecdc927bSAlexander Kozyrev
4085ecdc927bSAlexander Kozyrev   Caught error type [...] ([...]): [...]
4086ecdc927bSAlexander Kozyrev
4087f9bf7dffSAlexander Kozyrev``flow queue pull`` must be called to retrieve the operation status.
4088f9bf7dffSAlexander Kozyrev
4089a997a33bSAdrien MazarguilQuerying flow rules
4090a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~
4091a997a33bSAdrien Mazarguil
4092a997a33bSAdrien Mazarguil``flow query`` queries a specific action of a flow rule having that
4093a997a33bSAdrien Mazarguilability. Such actions collect information that can be reported using this
4094a997a33bSAdrien Mazarguilcommand. It is bound to ``rte_flow_query()``::
4095a997a33bSAdrien Mazarguil
4096a997a33bSAdrien Mazarguil   flow query {port_id} {rule_id} {action}
4097a997a33bSAdrien Mazarguil
4098a997a33bSAdrien MazarguilIf successful, it will display either the retrieved data for known actions
4099a997a33bSAdrien Mazarguilor the following message::
4100a997a33bSAdrien Mazarguil
4101a997a33bSAdrien Mazarguil   Cannot display result for action type [...] ([...])
4102a997a33bSAdrien Mazarguil
4103a997a33bSAdrien MazarguilOtherwise, it will complain either that the rule does not exist or that some
4104a997a33bSAdrien Mazarguilerror occurred::
4105a997a33bSAdrien Mazarguil
4106a997a33bSAdrien Mazarguil   Flow rule #[...] not found
4107a997a33bSAdrien Mazarguil
4108a997a33bSAdrien Mazarguil::
4109a997a33bSAdrien Mazarguil
4110a997a33bSAdrien Mazarguil   Caught error type [...] ([...]): [...]
4111a997a33bSAdrien Mazarguil
4112a997a33bSAdrien MazarguilCurrently only the ``count`` action is supported. This action reports the
4113a997a33bSAdrien Mazarguilnumber of packets that hit the flow rule and the total number of bytes. Its
4114a997a33bSAdrien Mazarguiloutput has the following format::
4115a997a33bSAdrien Mazarguil
4116a997a33bSAdrien Mazarguil   count:
4117a997a33bSAdrien Mazarguil    hits_set: [...] # whether "hits" contains a valid value
4118a997a33bSAdrien Mazarguil    bytes_set: [...] # whether "bytes" contains a valid value
4119a997a33bSAdrien Mazarguil    hits: [...] # number of packets
4120a997a33bSAdrien Mazarguil    bytes: [...] # number of bytes
4121a997a33bSAdrien Mazarguil
4122a997a33bSAdrien MazarguilQuerying counters for TCPv6 packets redirected to queue 6::
4123a997a33bSAdrien Mazarguil
4124a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / tcp / end
4125a997a33bSAdrien Mazarguil      actions queue index 6 / count / end
4126a997a33bSAdrien Mazarguil   Flow rule #4 created
4127a997a33bSAdrien Mazarguil   testpmd> flow query 0 4 count
4128a997a33bSAdrien Mazarguil   count:
4129a997a33bSAdrien Mazarguil    hits_set: 1
4130a997a33bSAdrien Mazarguil    bytes_set: 0
4131a997a33bSAdrien Mazarguil    hits: 386446
4132a997a33bSAdrien Mazarguil    bytes: 0
4133a997a33bSAdrien Mazarguil   testpmd>
4134a997a33bSAdrien Mazarguil
4135a997a33bSAdrien MazarguilListing flow rules
4136a997a33bSAdrien Mazarguil~~~~~~~~~~~~~~~~~~
4137a997a33bSAdrien Mazarguil
4138a997a33bSAdrien Mazarguil``flow list`` lists existing flow rules sorted by priority and optionally
4139a997a33bSAdrien Mazarguilfiltered by group identifiers::
4140a997a33bSAdrien Mazarguil
4141a997a33bSAdrien Mazarguil   flow list {port_id} [group {group_id}] [...]
4142a997a33bSAdrien Mazarguil
4143a997a33bSAdrien MazarguilThis command only fails with the following message if the device does not
4144a997a33bSAdrien Mazarguilexist::
4145a997a33bSAdrien Mazarguil
4146a997a33bSAdrien Mazarguil   Invalid port [...]
4147a997a33bSAdrien Mazarguil
4148a997a33bSAdrien MazarguilOutput consists of a header line followed by a short description of each
4149a997a33bSAdrien Mazarguilflow rule, one per line. There is no output at all when no flow rules are
4150a997a33bSAdrien Mazarguilconfigured on the device::
4151a997a33bSAdrien Mazarguil
4152a997a33bSAdrien Mazarguil   ID      Group   Prio    Attr    Rule
4153a997a33bSAdrien Mazarguil   [...]   [...]   [...]   [...]   [...]
4154a997a33bSAdrien Mazarguil
4155a997a33bSAdrien Mazarguil``Attr`` column flags:
4156a997a33bSAdrien Mazarguil
4157a997a33bSAdrien Mazarguil- ``i`` for ``ingress``.
4158a997a33bSAdrien Mazarguil- ``e`` for ``egress``.
4159a997a33bSAdrien Mazarguil
4160a997a33bSAdrien MazarguilCreating several flow rules and listing them::
4161a997a33bSAdrien Mazarguil
4162a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv4 / end
4163a997a33bSAdrien Mazarguil      actions queue index 6 / end
4164a997a33bSAdrien Mazarguil   Flow rule #0 created
4165a997a33bSAdrien Mazarguil   testpmd> flow create 0 ingress pattern eth / ipv6 / end
4166a997a33bSAdrien Mazarguil      actions queue index 2 / end
4167a997a33bSAdrien Mazarguil   Flow rule #1 created
4168a997a33bSAdrien Mazarguil   testpmd> flow create 0 priority 5 ingress pattern eth / ipv4 / udp / end
4169a997a33bSAdrien Mazarguil      actions rss queues 6 7 8 end / end
4170a997a33bSAdrien Mazarguil   Flow rule #2 created
4171a997a33bSAdrien Mazarguil   testpmd> flow list 0
4172a997a33bSAdrien Mazarguil   ID      Group   Prio    Attr    Rule
4173a997a33bSAdrien Mazarguil   0       0       0       i-      ETH IPV4 => QUEUE
4174a997a33bSAdrien Mazarguil   1       0       0       i-      ETH IPV6 => QUEUE
4175a997a33bSAdrien Mazarguil   2       0       5       i-      ETH IPV4 UDP => RSS
4176a997a33bSAdrien Mazarguil   testpmd>
4177a997a33bSAdrien Mazarguil
4178a997a33bSAdrien MazarguilRules are sorted by priority (i.e. group ID first, then priority level)::
4179a997a33bSAdrien Mazarguil
4180a997a33bSAdrien Mazarguil   testpmd> flow list 1
4181a997a33bSAdrien Mazarguil   ID      Group   Prio    Attr    Rule
4182a997a33bSAdrien Mazarguil   0       0       0       i-      ETH => COUNT
4183a997a33bSAdrien Mazarguil   6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4184a997a33bSAdrien Mazarguil   5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4185a997a33bSAdrien Mazarguil   1       24      0       i-      ETH IPV4 UDP => QUEUE
4186a997a33bSAdrien Mazarguil   4       24      10      i-      ETH IPV4 TCP => DROP
4187a997a33bSAdrien Mazarguil   3       24      20      i-      ETH IPV4 => DROP
4188a997a33bSAdrien Mazarguil   2       24      42      i-      ETH IPV4 UDP => QUEUE
4189a997a33bSAdrien Mazarguil   7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4190a997a33bSAdrien Mazarguil   testpmd>
4191a997a33bSAdrien Mazarguil
4192a997a33bSAdrien MazarguilOutput can be limited to specific groups::
4193a997a33bSAdrien Mazarguil
4194a997a33bSAdrien Mazarguil   testpmd> flow list 1 group 0 group 63
4195a997a33bSAdrien Mazarguil   ID      Group   Prio    Attr    Rule
4196a997a33bSAdrien Mazarguil   0       0       0       i-      ETH => COUNT
4197a997a33bSAdrien Mazarguil   6       0       500     i-      ETH IPV6 TCP => DROP COUNT
4198a997a33bSAdrien Mazarguil   5       0       1000    i-      ETH IPV6 ICMP => QUEUE
4199a997a33bSAdrien Mazarguil   7       63      0       i-      ETH IPV6 UDP VXLAN => MARK QUEUE
4200a997a33bSAdrien Mazarguil   testpmd>
42015a1affd8SBernard Iremonger
4202323f811aSAdrien MazarguilToggling isolated mode
4203323f811aSAdrien Mazarguil~~~~~~~~~~~~~~~~~~~~~~
4204323f811aSAdrien Mazarguil
4205323f811aSAdrien Mazarguil``flow isolate`` can be used to tell the underlying PMD that ingress traffic
4206323f811aSAdrien Mazarguilmust only be injected from the defined flow rules; that no default traffic
4207323f811aSAdrien Mazarguilis expected outside those rules and the driver is free to assign more
4208323f811aSAdrien Mazarguilresources to handle them. It is bound to ``rte_flow_isolate()``::
4209323f811aSAdrien Mazarguil
4210323f811aSAdrien Mazarguil flow isolate {port_id} {boolean}
4211323f811aSAdrien Mazarguil
4212323f811aSAdrien MazarguilIf successful, enabling or disabling isolated mode shows either::
4213323f811aSAdrien Mazarguil
4214323f811aSAdrien Mazarguil Ingress traffic on port [...]
4215323f811aSAdrien Mazarguil    is now restricted to the defined flow rules
4216323f811aSAdrien Mazarguil
4217323f811aSAdrien MazarguilOr::
4218323f811aSAdrien Mazarguil
4219323f811aSAdrien Mazarguil Ingress traffic on port [...]
4220323f811aSAdrien Mazarguil    is not restricted anymore to the defined flow rules
4221323f811aSAdrien Mazarguil
4222323f811aSAdrien MazarguilOtherwise, in case of error::
4223323f811aSAdrien Mazarguil
4224323f811aSAdrien Mazarguil   Caught error type [...] ([...]): [...]
4225323f811aSAdrien Mazarguil
4226323f811aSAdrien MazarguilMainly due to its side effects, PMDs supporting this mode may not have the
4227323f811aSAdrien Mazarguilability to toggle it more than once without reinitializing affected ports
4228323f811aSAdrien Mazarguilfirst (e.g. by exiting testpmd).
4229323f811aSAdrien Mazarguil
4230323f811aSAdrien MazarguilEnabling isolated mode::
4231323f811aSAdrien Mazarguil
4232323f811aSAdrien Mazarguil testpmd> flow isolate 0 true
4233323f811aSAdrien Mazarguil Ingress traffic on port 0 is now restricted to the defined flow rules
4234323f811aSAdrien Mazarguil testpmd>
4235323f811aSAdrien Mazarguil
4236323f811aSAdrien MazarguilDisabling isolated mode::
4237323f811aSAdrien Mazarguil
4238323f811aSAdrien Mazarguil testpmd> flow isolate 0 false
4239323f811aSAdrien Mazarguil Ingress traffic on port 0 is not restricted anymore to the defined flow rules
4240323f811aSAdrien Mazarguil testpmd>
4241323f811aSAdrien Mazarguil
4242a69c335dSXiaoyu MinDumping HW internal information
4243a69c335dSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4244a69c335dSXiaoyu Min
4245a69c335dSXiaoyu Min``flow dump`` dumps the hardware's internal representation information of
4246a69c335dSXiaoyu Minall flows. It is bound to ``rte_flow_dev_dump()``::
4247a69c335dSXiaoyu Min
4248a69c335dSXiaoyu Min   flow dump {port_id} {output_file}
4249a69c335dSXiaoyu Min
4250a69c335dSXiaoyu MinIf successful, it will show::
4251a69c335dSXiaoyu Min
4252a69c335dSXiaoyu Min   Flow dump finished
4253a69c335dSXiaoyu Min
4254a69c335dSXiaoyu MinOtherwise, it will complain error occurred::
4255a69c335dSXiaoyu Min
4256a69c335dSXiaoyu Min   Caught error type [...] ([...]): [...]
4257a69c335dSXiaoyu Min
42580e459ffaSDong ZhouListing and destroying aged flow rules
42590e459ffaSDong Zhou~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42600e459ffaSDong Zhou
42610e459ffaSDong Zhou``flow aged`` simply lists aged flow rules be get from api ``rte_flow_get_aged_flows``,
42620e459ffaSDong Zhouand ``destroy`` parameter can be used to destroy those flow rules in PMD.
42630e459ffaSDong Zhou
42640e459ffaSDong Zhou   flow aged {port_id} [destroy]
42650e459ffaSDong Zhou
42660e459ffaSDong ZhouListing current aged flow rules::
42670e459ffaSDong Zhou
42680e459ffaSDong Zhou   testpmd> flow aged 0
42690e459ffaSDong Zhou   Port 0 total aged flows: 0
42700e459ffaSDong Zhou   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.14 / end
42710e459ffaSDong Zhou      actions age timeout 5 / queue index 0 /  end
42720e459ffaSDong Zhou   Flow rule #0 created
42730e459ffaSDong Zhou   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.15 / end
42740e459ffaSDong Zhou      actions age timeout 4 / queue index 0 /  end
42750e459ffaSDong Zhou   Flow rule #1 created
42760e459ffaSDong Zhou   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.16 / end
42770e459ffaSDong Zhou      actions age timeout 2 / queue index 0 /  end
42780e459ffaSDong Zhou   Flow rule #2 created
42790e459ffaSDong Zhou   testpmd> flow create 0 ingress pattern eth / ipv4 src is 2.2.2.17 / end
42800e459ffaSDong Zhou      actions age timeout 3 / queue index 0 /  end
42810e459ffaSDong Zhou   Flow rule #3 created
42820e459ffaSDong Zhou
42830e459ffaSDong Zhou
42840e459ffaSDong ZhouAged Rules are simply list as command ``flow list {port_id}``, but strip the detail rule
42850e459ffaSDong Zhouinformation, all the aged flows are sorted by the longest timeout time. For example, if
42860e459ffaSDong Zhouthose rules be configured in the same time, ID 2 will be the first aged out rule, the next
42870e459ffaSDong Zhouwill be ID 3, ID 1, ID 0::
42880e459ffaSDong Zhou
42890e459ffaSDong Zhou   testpmd> flow aged 0
42900e459ffaSDong Zhou   Port 0 total aged flows: 4
42910e459ffaSDong Zhou   ID      Group   Prio    Attr
42920e459ffaSDong Zhou   2       0       0       i--
42930e459ffaSDong Zhou   3       0       0       i--
42940e459ffaSDong Zhou   1       0       0       i--
42950e459ffaSDong Zhou   0       0       0       i--
42960e459ffaSDong Zhou
42970e459ffaSDong ZhouIf attach ``destroy`` parameter, the command will destroy all the list aged flow rules.
42980e459ffaSDong Zhou
42990e459ffaSDong Zhou   testpmd> flow aged 0 destroy
43000e459ffaSDong Zhou   Port 0 total aged flows: 4
43010e459ffaSDong Zhou   ID      Group   Prio    Attr
43020e459ffaSDong Zhou   2       0       0       i--
43030e459ffaSDong Zhou   3       0       0       i--
43040e459ffaSDong Zhou   1       0       0       i--
43050e459ffaSDong Zhou   0       0       0       i--
43060e459ffaSDong Zhou
43070e459ffaSDong Zhou   Flow rule #2 destroyed
43080e459ffaSDong Zhou   Flow rule #3 destroyed
43090e459ffaSDong Zhou   Flow rule #1 destroyed
43100e459ffaSDong Zhou   Flow rule #0 destroyed
43110e459ffaSDong Zhou   4 flows be destroyed
43120e459ffaSDong Zhou   testpmd> flow aged 0
43130e459ffaSDong Zhou   Port 0 total aged flows: 0
43140e459ffaSDong Zhou
4315*966eb55eSMichael Baum
4316*966eb55eSMichael BaumEnqueueing listing and destroying aged flow rules
4317*966eb55eSMichael Baum~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4318*966eb55eSMichael Baum
4319*966eb55eSMichael Baum``flow queue aged`` simply lists aged flow rules be get from
4320*966eb55eSMichael Baum``rte_flow_get_q_aged_flows`` API, and ``destroy`` parameter can be used to
4321*966eb55eSMichael Baumdestroy those flow rules in PMD::
4322*966eb55eSMichael Baum
4323*966eb55eSMichael Baum   flow queue {port_id} aged {queue_id} [destroy]
4324*966eb55eSMichael Baum
4325*966eb55eSMichael BaumListing current aged flow rules::
4326*966eb55eSMichael Baum
4327*966eb55eSMichael Baum   testpmd> flow queue 0 aged 0
4328*966eb55eSMichael Baum   Port 0 queue 0 total aged flows: 0
4329*966eb55eSMichael Baum   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4330*966eb55eSMichael Baum      pattern eth / ipv4 src is 2.2.2.14 / end
4331*966eb55eSMichael Baum      actions age timeout 5 / queue index 0 /  end
4332*966eb55eSMichael Baum   Flow rule #0 creation enqueued
4333*966eb55eSMichael Baum   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4334*966eb55eSMichael Baum      pattern eth / ipv4 src is 2.2.2.15 / end
4335*966eb55eSMichael Baum      actions age timeout 4 / queue index 0 /  end
4336*966eb55eSMichael Baum   Flow rule #1 creation enqueued
4337*966eb55eSMichael Baum   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4338*966eb55eSMichael Baum      pattern eth / ipv4 src is 2.2.2.16 / end
4339*966eb55eSMichael Baum      actions age timeout 4 / queue index 0 /  end
4340*966eb55eSMichael Baum   Flow rule #2 creation enqueued
4341*966eb55eSMichael Baum   testpmd> flow queue 0 create 0 ingress tanle 0 item_template 0 action_template 0
4342*966eb55eSMichael Baum      pattern eth / ipv4 src is 2.2.2.17 / end
4343*966eb55eSMichael Baum      actions age timeout 4 / queue index 0 /  end
4344*966eb55eSMichael Baum   Flow rule #3 creation enqueued
4345*966eb55eSMichael Baum   testpmd> flow pull 0 queue 0
4346*966eb55eSMichael Baum   Queue #0 pulled 4 operations (0 failed, 4 succeeded)
4347*966eb55eSMichael Baum
4348*966eb55eSMichael BaumAged Rules are simply list as command ``flow queue {port_id} list {queue_id}``,
4349*966eb55eSMichael Baumbut strip the detail rule information, all the aged flows are sorted by the
4350*966eb55eSMichael Baumlongest timeout time. For example, if those rules is configured in the same time,
4351*966eb55eSMichael BaumID 2 will be the first aged out rule, the next will be ID 3, ID 1, ID 0::
4352*966eb55eSMichael Baum
4353*966eb55eSMichael Baum   testpmd> flow queue 0 aged 0
4354*966eb55eSMichael Baum   Port 0 queue 0 total aged flows: 4
4355*966eb55eSMichael Baum   ID      Group   Prio    Attr
4356*966eb55eSMichael Baum   2       0       0       ---
4357*966eb55eSMichael Baum   3       0       0       ---
4358*966eb55eSMichael Baum   1       0       0       ---
4359*966eb55eSMichael Baum   0       0       0       ---
4360*966eb55eSMichael Baum
4361*966eb55eSMichael Baum   0 flows destroyed
4362*966eb55eSMichael Baum
4363*966eb55eSMichael BaumIf attach ``destroy`` parameter, the command will destroy all the list aged flow rules::
4364*966eb55eSMichael Baum
4365*966eb55eSMichael Baum   testpmd> flow queue 0 aged 0 destroy
4366*966eb55eSMichael Baum   Port 0 queue 0 total aged flows: 4
4367*966eb55eSMichael Baum   ID      Group   Prio    Attr
4368*966eb55eSMichael Baum   2       0       0       ---
4369*966eb55eSMichael Baum   3       0       0       ---
4370*966eb55eSMichael Baum   1       0       0       ---
4371*966eb55eSMichael Baum   0       0       0       ---
4372*966eb55eSMichael Baum   Flow rule #2 destruction enqueued
4373*966eb55eSMichael Baum   Flow rule #3 destruction enqueued
4374*966eb55eSMichael Baum   Flow rule #1 destruction enqueued
4375*966eb55eSMichael Baum   Flow rule #0 destruction enqueued
4376*966eb55eSMichael Baum
4377*966eb55eSMichael Baum   4 flows destroyed
4378*966eb55eSMichael Baum   testpmd> flow queue 0 aged 0
4379*966eb55eSMichael Baum   Port 0 total aged flows: 0
4380*966eb55eSMichael Baum
4381*966eb55eSMichael Baum.. note::
4382*966eb55eSMichael Baum
4383*966eb55eSMichael Baum   The queue must be empty before attaching ``destroy`` parameter.
4384*966eb55eSMichael Baum
4385*966eb55eSMichael Baum
43864b61b877SBing ZhaoCreating indirect actions
43874b61b877SBing Zhao~~~~~~~~~~~~~~~~~~~~~~~~~
438855509e3aSAndrey Vesnovaty
43894b61b877SBing Zhao``flow indirect_action {port_id} create`` creates indirect action with optional
43904b61b877SBing Zhaoindirect action ID. It is bound to ``rte_flow_action_handle_create()``::
43914b61b877SBing Zhao
43924b61b877SBing Zhao   flow indirect_action {port_id} create [action_id {indirect_action_id}]
4393f1a6a986SIvan Malov      [ingress] [egress] [transfer] action {action} / end
439455509e3aSAndrey Vesnovaty
439555509e3aSAndrey VesnovatyIf successful, it will show::
439655509e3aSAndrey Vesnovaty
43974b61b877SBing Zhao   Indirect action #[...] created
439855509e3aSAndrey Vesnovaty
43994b61b877SBing ZhaoOtherwise, it will complain either that indirect action already exists or that
440055509e3aSAndrey Vesnovatysome error occurred::
440155509e3aSAndrey Vesnovaty
44024b61b877SBing Zhao   Indirect action #[...] is already assigned, delete it first
440355509e3aSAndrey Vesnovaty
440455509e3aSAndrey Vesnovaty::
440555509e3aSAndrey Vesnovaty
440655509e3aSAndrey Vesnovaty   Caught error type [...] ([...]): [...]
440755509e3aSAndrey Vesnovaty
44084b61b877SBing ZhaoCreate indirect rss action with id 100 to queues 1 and 2 on port 0::
440955509e3aSAndrey Vesnovaty
44104b61b877SBing Zhao   testpmd> flow indirect_action 0 create action_id 100 \
441155509e3aSAndrey Vesnovaty      ingress action rss queues 1 2 end / end
441255509e3aSAndrey Vesnovaty
44134b61b877SBing ZhaoCreate indirect rss action with id assigned by testpmd to queues 1 and 2 on
441455509e3aSAndrey Vesnovatyport 0::
441555509e3aSAndrey Vesnovaty
44164b61b877SBing Zhao	testpmd> flow indirect_action 0 create action_id \
441755509e3aSAndrey Vesnovaty		ingress action rss queues 0 1 end / end
441855509e3aSAndrey Vesnovaty
4419d906fff5SAlexander KozyrevEnqueueing creation of indirect actions
4420d906fff5SAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4421d906fff5SAlexander Kozyrev
4422d906fff5SAlexander Kozyrev``flow queue indirect_action create`` adds creation operation of an indirect
4423d906fff5SAlexander Kozyrevaction to a queue. It is bound to ``rte_flow_async_action_handle_create()``::
4424d906fff5SAlexander Kozyrev
4425d906fff5SAlexander Kozyrev   flow queue {port_id} create {queue_id} [postpone {boolean}]
4426d906fff5SAlexander Kozyrev       table {table_id} item_template {item_template_id}
4427d906fff5SAlexander Kozyrev       action_template {action_template_id}
4428d906fff5SAlexander Kozyrev       pattern {item} [/ {item} [...]] / end
4429d906fff5SAlexander Kozyrev       actions {action} [/ {action} [...]] / end
4430d906fff5SAlexander Kozyrev
4431d906fff5SAlexander KozyrevIf successful, it will show::
4432d906fff5SAlexander Kozyrev
4433d906fff5SAlexander Kozyrev   Indirect action #[...] creation queued
4434d906fff5SAlexander Kozyrev
4435d906fff5SAlexander KozyrevOtherwise it will show an error message of the form::
4436d906fff5SAlexander Kozyrev
4437d906fff5SAlexander Kozyrev   Caught error type [...] ([...]): [...]
4438d906fff5SAlexander Kozyrev
4439d906fff5SAlexander KozyrevThis command uses the same parameters as  ``flow indirect_action create``,
4440d906fff5SAlexander Kozyrevdescribed in `Creating indirect actions`_.
4441d906fff5SAlexander Kozyrev
4442d906fff5SAlexander Kozyrev``flow queue pull`` must be called to retrieve the operation status.
4443d906fff5SAlexander Kozyrev
44444b61b877SBing ZhaoUpdating indirect actions
44454b61b877SBing Zhao~~~~~~~~~~~~~~~~~~~~~~~~~
444655509e3aSAndrey Vesnovaty
44474b61b877SBing Zhao``flow indirect_action {port_id} update`` updates configuration of the indirect
44484b61b877SBing Zhaoaction from its indirect action ID (as returned by
44494b61b877SBing Zhao``flow indirect_action {port_id} create``). It is bound to
44504b61b877SBing Zhao``rte_flow_action_handle_update()``::
44514b61b877SBing Zhao
44524b61b877SBing Zhao   flow indirect_action {port_id} update {indirect_action_id}
445355509e3aSAndrey Vesnovaty      action {action} / end
445455509e3aSAndrey Vesnovaty
445555509e3aSAndrey VesnovatyIf successful, it will show::
445655509e3aSAndrey Vesnovaty
44574b61b877SBing Zhao   Indirect action #[...] updated
445855509e3aSAndrey Vesnovaty
44594b61b877SBing ZhaoOtherwise, it will complain either that indirect action not found or that some
446055509e3aSAndrey Vesnovatyerror occurred::
446155509e3aSAndrey Vesnovaty
44624b61b877SBing Zhao   Failed to find indirect action #[...] on port [...]
446355509e3aSAndrey Vesnovaty
446455509e3aSAndrey Vesnovaty::
446555509e3aSAndrey Vesnovaty
446655509e3aSAndrey Vesnovaty   Caught error type [...] ([...]): [...]
446755509e3aSAndrey Vesnovaty
44684b61b877SBing ZhaoUpdate indirect rss action having id 100 on port 0 with rss to queues 0 and 3
446955509e3aSAndrey Vesnovaty(in create example above rss queues were 1 and 2)::
447055509e3aSAndrey Vesnovaty
44714b61b877SBing Zhao   testpmd> flow indirect_action 0 update 100 action rss queues 0 3 end / end
447255509e3aSAndrey Vesnovaty
4473d906fff5SAlexander KozyrevEnqueueing update of indirect actions
4474d906fff5SAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4475d906fff5SAlexander Kozyrev
4476d906fff5SAlexander Kozyrev``flow queue indirect_action update`` adds update operation for an indirect
4477d906fff5SAlexander Kozyrevaction to a queue. It is bound to ``rte_flow_async_action_handle_update()``::
4478d906fff5SAlexander Kozyrev
4479d906fff5SAlexander Kozyrev   flow queue {port_id} indirect_action {queue_id} update
4480d906fff5SAlexander Kozyrev      {indirect_action_id} [postpone {boolean}] action {action} / end
4481d906fff5SAlexander Kozyrev
4482d906fff5SAlexander KozyrevIf successful, it will show::
4483d906fff5SAlexander Kozyrev
4484d906fff5SAlexander Kozyrev   Indirect action #[...] update queued
4485d906fff5SAlexander Kozyrev
4486d906fff5SAlexander KozyrevOtherwise it will show an error message of the form::
4487d906fff5SAlexander Kozyrev
4488d906fff5SAlexander Kozyrev   Caught error type [...] ([...]): [...]
4489d906fff5SAlexander Kozyrev
4490d906fff5SAlexander Kozyrev``flow queue pull`` must be called to retrieve the operation status.
4491d906fff5SAlexander Kozyrev
44924b61b877SBing ZhaoDestroying indirect actions
44934b61b877SBing Zhao~~~~~~~~~~~~~~~~~~~~~~~~~~~
449455509e3aSAndrey Vesnovaty
44954b61b877SBing Zhao``flow indirect_action {port_id} destroy`` destroys one or more indirect actions
44964b61b877SBing Zhaofrom their indirect action IDs (as returned by
44974b61b877SBing Zhao``flow indirect_action {port_id} create``). It is bound to
44984b61b877SBing Zhao``rte_flow_action_handle_destroy()``::
44994b61b877SBing Zhao
45004b61b877SBing Zhao   flow indirect_action {port_id} destroy action_id {indirect_action_id} [...]
450155509e3aSAndrey Vesnovaty
450255509e3aSAndrey VesnovatyIf successful, it will show::
450355509e3aSAndrey Vesnovaty
45044b61b877SBing Zhao   Indirect action #[...] destroyed
450555509e3aSAndrey Vesnovaty
45064b61b877SBing ZhaoIt does not report anything for indirect action IDs that do not exist.
45074b61b877SBing ZhaoThe usual error message is shown when a indirect action cannot be destroyed::
450855509e3aSAndrey Vesnovaty
450955509e3aSAndrey Vesnovaty   Caught error type [...] ([...]): [...]
451055509e3aSAndrey Vesnovaty
45114b61b877SBing ZhaoDestroy indirect actions having id 100 & 101::
451255509e3aSAndrey Vesnovaty
45134b61b877SBing Zhao   testpmd> flow indirect_action 0 destroy action_id 100 action_id 101
451455509e3aSAndrey Vesnovaty
4515d906fff5SAlexander KozyrevEnqueueing destruction of indirect actions
4516d906fff5SAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4517d906fff5SAlexander Kozyrev
4518d906fff5SAlexander Kozyrev``flow queue indirect_action destroy`` adds destruction operation to destroy
4519d906fff5SAlexander Kozyrevone or more indirect actions from their indirect action IDs (as returned by
4520d906fff5SAlexander Kozyrev``flow queue {port_id} indirect_action {queue_id} create``) to a queue.
4521d906fff5SAlexander KozyrevIt is bound to ``rte_flow_async_action_handle_destroy()``::
4522d906fff5SAlexander Kozyrev
4523d906fff5SAlexander Kozyrev   flow queue {port_id} indirect_action {queue_id} destroy
4524d906fff5SAlexander Kozyrev      [postpone {boolean}] action_id {indirect_action_id} [...]
4525d906fff5SAlexander Kozyrev
4526d906fff5SAlexander KozyrevIf successful, it will show::
4527d906fff5SAlexander Kozyrev
4528d906fff5SAlexander Kozyrev   Indirect action #[...] destruction queued
4529d906fff5SAlexander Kozyrev
4530d906fff5SAlexander KozyrevOtherwise it will show an error message of the form::
4531d906fff5SAlexander Kozyrev
4532d906fff5SAlexander Kozyrev   Caught error type [...] ([...]): [...]
4533d906fff5SAlexander Kozyrev
4534d906fff5SAlexander Kozyrev``flow queue pull`` must be called to retrieve the operation status.
4535d906fff5SAlexander Kozyrev
45364b61b877SBing ZhaoQuery indirect actions
45374b61b877SBing Zhao~~~~~~~~~~~~~~~~~~~~~~
453855509e3aSAndrey Vesnovaty
45394b61b877SBing Zhao``flow indirect_action {port_id} query`` queries the indirect action from its
45404b61b877SBing Zhaoindirect action ID (as returned by ``flow indirect_action {port_id} create``).
45414b61b877SBing ZhaoIt is bound to ``rte_flow_action_handle_query()``::
454255509e3aSAndrey Vesnovaty
45434b61b877SBing Zhao  flow indirect_action {port_id} query {indirect_action_id}
454455509e3aSAndrey Vesnovaty
45454b61b877SBing ZhaoCurrently only rss indirect action supported. If successful, it will show::
45464b61b877SBing Zhao
45474b61b877SBing Zhao   Indirect RSS action:
454855509e3aSAndrey Vesnovaty      refs:[...]
454955509e3aSAndrey Vesnovaty
45504b61b877SBing ZhaoOtherwise, it will complain either that indirect action not found or that some
455155509e3aSAndrey Vesnovatyerror occurred::
455255509e3aSAndrey Vesnovaty
45534b61b877SBing Zhao   Failed to find indirect action #[...] on port [...]
455455509e3aSAndrey Vesnovaty
455555509e3aSAndrey Vesnovaty::
455655509e3aSAndrey Vesnovaty
455755509e3aSAndrey Vesnovaty   Caught error type [...] ([...]): [...]
455855509e3aSAndrey Vesnovaty
45594b61b877SBing ZhaoQuery indirect action having id 100::
456055509e3aSAndrey Vesnovaty
45614b61b877SBing Zhao   testpmd> flow indirect_action 0 query 100
45620e459ffaSDong Zhou
4563c9dc0384SSuanming MouEnqueueing query of indirect actions
4564c9dc0384SSuanming Mou~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4565c9dc0384SSuanming Mou
4566c9dc0384SSuanming Mou``flow queue indirect_action query`` adds query operation for an indirect
4567c9dc0384SSuanming Mouaction to a queue. It is bound to ``rte_flow_async_action_handle_query()``::
4568c9dc0384SSuanming Mou
4569c9dc0384SSuanming Mou   flow queue {port_id} indirect_action {queue_id} query
4570c9dc0384SSuanming Mou      {indirect_action_id} [postpone {boolean}]
4571c9dc0384SSuanming Mou
4572c9dc0384SSuanming MouIf successful, it will show::
4573c9dc0384SSuanming Mou
4574c9dc0384SSuanming Mou   Indirect action #[...] query queued
4575c9dc0384SSuanming Mou
4576c9dc0384SSuanming MouOtherwise it will show an error message of the form::
4577c9dc0384SSuanming Mou
4578c9dc0384SSuanming Mou   Caught error type [...] ([...]): [...]
4579c9dc0384SSuanming Mou
4580c9dc0384SSuanming Mou``flow queue pull`` must be called to retrieve the operation status.
4581c9dc0384SSuanming Mou
45825a1affd8SBernard IremongerSample QinQ flow rules
45835a1affd8SBernard Iremonger~~~~~~~~~~~~~~~~~~~~~~
45845a1affd8SBernard Iremonger
4585bef3bfe7SBernard IremongerBefore creating QinQ rule(s) the following commands should be issued to enable QinQ::
4586bef3bfe7SBernard Iremonger
4587bef3bfe7SBernard Iremonger   testpmd> port stop 0
4588836cdce4SBernard Iremonger   testpmd> vlan set extend on 0
4589bef3bfe7SBernard Iremonger
4590bef3bfe7SBernard IremongerThe above command sets the inner and outer TPID's to 0x8100.
4591bef3bfe7SBernard Iremonger
4592bef3bfe7SBernard IremongerTo change the TPID's the following commands should be used::
4593bef3bfe7SBernard Iremonger
4594836cdce4SBernard Iremonger   testpmd> vlan set outer tpid 0x88A8 0
4595836cdce4SBernard Iremonger   testpmd> vlan set inner tpid 0x8100 0
4596bef3bfe7SBernard Iremonger   testpmd> port start 0
4597bef3bfe7SBernard Iremonger
45985a1affd8SBernard IremongerValidate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
45995a1affd8SBernard Iremonger
46005a1affd8SBernard Iremonger::
46015a1affd8SBernard Iremonger
4602bef3bfe7SBernard Iremonger   testpmd> flow validate 0 ingress pattern eth / vlan tci is 123 /
4603bef3bfe7SBernard Iremonger       vlan tci is 456 / end actions vf id 1 / queue index 0 / end
46045a1affd8SBernard Iremonger   Flow rule #0 validated
46055a1affd8SBernard Iremonger
4606bef3bfe7SBernard Iremonger   testpmd> flow create 0 ingress pattern eth / vlan tci is 4 /
4607bef3bfe7SBernard Iremonger       vlan tci is 456 / end actions vf id 123 / queue index 0 / end
46085a1affd8SBernard Iremonger   Flow rule #0 created
46095a1affd8SBernard Iremonger
46105a1affd8SBernard Iremonger   testpmd> flow list 0
46115a1affd8SBernard Iremonger   ID      Group   Prio    Attr    Rule
46125a1affd8SBernard Iremonger   0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
46135a1affd8SBernard Iremonger
46145a1affd8SBernard IremongerValidate and create a QinQ rule on port 0 to steer traffic to a queue on the host.
46155a1affd8SBernard Iremonger
46165a1affd8SBernard Iremonger::
46175a1affd8SBernard Iremonger
4618bef3bfe7SBernard Iremonger   testpmd> flow validate 0 ingress pattern eth / vlan tci is 321 /
4619bef3bfe7SBernard Iremonger        vlan tci is 654 / end actions pf / queue index 0 / end
46205a1affd8SBernard Iremonger   Flow rule #1 validated
46215a1affd8SBernard Iremonger
4622bef3bfe7SBernard Iremonger   testpmd> flow create 0 ingress pattern eth / vlan tci is 321 /
4623bef3bfe7SBernard Iremonger        vlan tci is 654 / end actions pf / queue index 1 / end
46245a1affd8SBernard Iremonger   Flow rule #1 created
46255a1affd8SBernard Iremonger
46265a1affd8SBernard Iremonger   testpmd> flow list 0
46275a1affd8SBernard Iremonger   ID      Group   Prio    Attr    Rule
46285a1affd8SBernard Iremonger   0       0       0       i-      ETH VLAN VLAN=>VF QUEUE
46295a1affd8SBernard Iremonger   1       0       0       i-      ETH VLAN VLAN=>PF QUEUE
4630e977e419SKonstantin Ananyev
4631079981e9SXiaoyun LiSample VXLAN flow rules
4632079981e9SXiaoyun Li~~~~~~~~~~~~~~~~~~~~~~~
4633079981e9SXiaoyun Li
4634079981e9SXiaoyun LiBefore creating VXLAN rule(s), the UDP port should be added for VXLAN packet
4635079981e9SXiaoyun Lifilter on a port::
4636079981e9SXiaoyun Li
4637079981e9SXiaoyun Li  testpmd> rx_vxlan_port add 4789 0
4638079981e9SXiaoyun Li
4639079981e9SXiaoyun LiCreate VXLAN rules on port 0 to steer traffic to PF queues.
4640079981e9SXiaoyun Li
4641079981e9SXiaoyun Li::
4642079981e9SXiaoyun Li
4643079981e9SXiaoyun Li  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
4644079981e9SXiaoyun Li         eth dst is 00:11:22:33:44:55 / end actions pf / queue index 1 / end
4645079981e9SXiaoyun Li  Flow rule #0 created
4646079981e9SXiaoyun Li
4647079981e9SXiaoyun Li  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 3 /
4648079981e9SXiaoyun Li         eth dst is 00:11:22:33:44:55 / end actions pf / queue index 2 / end
4649079981e9SXiaoyun Li  Flow rule #1 created
4650079981e9SXiaoyun Li
4651079981e9SXiaoyun Li  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan /
4652079981e9SXiaoyun Li         eth dst is 00:11:22:33:44:55 / vlan tci is 10 / end actions pf /
4653079981e9SXiaoyun Li         queue index 3 / end
4654079981e9SXiaoyun Li  Flow rule #2 created
4655079981e9SXiaoyun Li
4656079981e9SXiaoyun Li  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan vni is 5 /
4657079981e9SXiaoyun Li         eth dst is 00:11:22:33:44:55 / vlan tci is 20 / end actions pf /
4658079981e9SXiaoyun Li         queue index 4 / end
4659079981e9SXiaoyun Li  Flow rule #3 created
4660079981e9SXiaoyun Li
4661079981e9SXiaoyun Li  testpmd> flow create 0 ingress pattern eth dst is 00:00:00:00:01:00 / ipv4 /
4662079981e9SXiaoyun Li         udp / vxlan vni is 6 /  eth dst is 00:11:22:33:44:55 / end actions pf /
4663079981e9SXiaoyun Li         queue index 5 / end
4664079981e9SXiaoyun Li  Flow rule #4 created
4665079981e9SXiaoyun Li
4666079981e9SXiaoyun Li  testpmd> flow list 0
4667079981e9SXiaoyun Li  ID      Group   Prio    Attr    Rule
4668079981e9SXiaoyun Li  0       0       0       i-      ETH IPV4 UDP VXLAN ETH => QUEUE
4669079981e9SXiaoyun Li  1       0       0       i-      ETH IPV4 UDP VXLAN ETH => QUEUE
4670079981e9SXiaoyun Li  2       0       0       i-      ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
4671079981e9SXiaoyun Li  3       0       0       i-      ETH IPV4 UDP VXLAN ETH VLAN => QUEUE
4672079981e9SXiaoyun Li  4       0       0       i-      ETH IPV4 UDP VXLAN ETH => QUEUE
4673079981e9SXiaoyun Li
46741960be7dSNelio LaranjeiroSample VXLAN encapsulation rule
46751960be7dSNelio Laranjeiro~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46761960be7dSNelio Laranjeiro
46771960be7dSNelio LaranjeiroVXLAN encapsulation outer layer has default value pre-configured in testpmd
46781960be7dSNelio Laranjeirosource code, those can be changed by using the following commands
46791960be7dSNelio Laranjeiro
46801960be7dSNelio LaranjeiroIPv4 VXLAN outer header::
46811960be7dSNelio Laranjeiro
46821960be7dSNelio Laranjeiro testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
46831960be7dSNelio Laranjeiro        ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
46841960be7dSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions vxlan_encap /
46851960be7dSNelio Laranjeiro        queue index 0 / end
46861960be7dSNelio Laranjeiro
46871960be7dSNelio Laranjeiro testpmd> set vxlan-with-vlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src
46881960be7dSNelio Laranjeiro         127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
46891960be7dSNelio Laranjeiro         eth-dst 22:22:22:22:22:22
46901960be7dSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions vxlan_encap /
46911960be7dSNelio Laranjeiro         queue index 0 / end
46921960be7dSNelio Laranjeiro
469362e8a5a8SViacheslav Ovsiienko testpmd> set vxlan-tos-ttl ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-tos 0
469462e8a5a8SViacheslav Ovsiienko         ip-ttl 255 ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
469562e8a5a8SViacheslav Ovsiienko         eth-dst 22:22:22:22:22:22
469662e8a5a8SViacheslav Ovsiienko testpmd> flow create 0 ingress pattern end actions vxlan_encap /
469762e8a5a8SViacheslav Ovsiienko         queue index 0 / end
469862e8a5a8SViacheslav Ovsiienko
46991960be7dSNelio LaranjeiroIPv6 VXLAN outer header::
47001960be7dSNelio Laranjeiro
47011960be7dSNelio Laranjeiro testpmd> set vxlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4 ip-src ::1
47021960be7dSNelio Laranjeiro        ip-dst ::2222 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
47031960be7dSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions vxlan_encap /
47041960be7dSNelio Laranjeiro         queue index 0 / end
47051960be7dSNelio Laranjeiro
47061960be7dSNelio Laranjeiro testpmd> set vxlan-with-vlan ip-version ipv6 vni 4 udp-src 4 udp-dst 4
47071960be7dSNelio Laranjeiro         ip-src ::1 ip-dst ::2222 vlan-tci 34 eth-src 11:11:11:11:11:11
47081960be7dSNelio Laranjeiro         eth-dst 22:22:22:22:22:22
47091960be7dSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions vxlan_encap /
47101960be7dSNelio Laranjeiro         queue index 0 / end
47111960be7dSNelio Laranjeiro
471262e8a5a8SViacheslav Ovsiienko testpmd> set vxlan-tos-ttl ip-version ipv6 vni 4 udp-src 4 udp-dst 4
471362e8a5a8SViacheslav Ovsiienko         ip-tos 0 ip-ttl 255 ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
471462e8a5a8SViacheslav Ovsiienko         eth-dst 22:22:22:22:22:22
471562e8a5a8SViacheslav Ovsiienko testpmd> flow create 0 ingress pattern end actions vxlan_encap /
471662e8a5a8SViacheslav Ovsiienko         queue index 0 / end
471762e8a5a8SViacheslav Ovsiienko
4718dcd962fcSNelio LaranjeiroSample NVGRE encapsulation rule
4719dcd962fcSNelio Laranjeiro~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4720dcd962fcSNelio Laranjeiro
4721dcd962fcSNelio LaranjeiroNVGRE encapsulation outer layer has default value pre-configured in testpmd
4722dcd962fcSNelio Laranjeirosource code, those can be changed by using the following commands
4723dcd962fcSNelio Laranjeiro
4724dcd962fcSNelio LaranjeiroIPv4 NVGRE outer header::
4725dcd962fcSNelio Laranjeiro
4726dcd962fcSNelio Laranjeiro testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
4727dcd962fcSNelio Laranjeiro        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4728dcd962fcSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4729dcd962fcSNelio Laranjeiro        queue index 0 / end
4730dcd962fcSNelio Laranjeiro
4731dcd962fcSNelio Laranjeiro testpmd> set nvgre-with-vlan ip-version ipv4 tni 4 ip-src 127.0.0.1
4732dcd962fcSNelio Laranjeiro         ip-dst 128.0.0.1 vlan-tci 34 eth-src 11:11:11:11:11:11
4733dcd962fcSNelio Laranjeiro         eth-dst 22:22:22:22:22:22
4734dcd962fcSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4735dcd962fcSNelio Laranjeiro         queue index 0 / end
4736dcd962fcSNelio Laranjeiro
4737dcd962fcSNelio LaranjeiroIPv6 NVGRE outer header::
4738dcd962fcSNelio Laranjeiro
4739dcd962fcSNelio Laranjeiro testpmd> set nvgre ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4740dcd962fcSNelio Laranjeiro        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4741dcd962fcSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4742dcd962fcSNelio Laranjeiro        queue index 0 / end
4743dcd962fcSNelio Laranjeiro
4744dcd962fcSNelio Laranjeiro testpmd> set nvgre-with-vlan ip-version ipv6 tni 4 ip-src ::1 ip-dst ::2222
4745dcd962fcSNelio Laranjeiro        vlan-tci 34 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4746dcd962fcSNelio Laranjeiro testpmd> flow create 0 ingress pattern end actions nvgre_encap /
4747dcd962fcSNelio Laranjeiro        queue index 0 / end
4748dcd962fcSNelio Laranjeiro
4749a1191d39SOri KamSample L2 encapsulation rule
4750a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4751a1191d39SOri Kam
4752a1191d39SOri KamL2 encapsulation has default value pre-configured in testpmd
4753a1191d39SOri Kamsource code, those can be changed by using the following commands
4754a1191d39SOri Kam
4755a1191d39SOri KamL2 header::
4756a1191d39SOri Kam
4757a1191d39SOri Kam testpmd> set l2_encap ip-version ipv4
4758a1191d39SOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4759a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4760a1191d39SOri Kam        mplsoudp_decap / l2_encap / end
4761a1191d39SOri Kam
4762a1191d39SOri KamL2 with VXLAN header::
4763a1191d39SOri Kam
4764a1191d39SOri Kam testpmd> set l2_encap-with-vlan ip-version ipv4 vlan-tci 34
4765a1191d39SOri Kam         eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4766a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4767a1191d39SOri Kam        mplsoudp_decap / l2_encap / end
4768a1191d39SOri Kam
4769a1191d39SOri KamSample L2 decapsulation rule
4770a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4771a1191d39SOri Kam
4772a1191d39SOri KamL2 decapsulation has default value pre-configured in testpmd
4773a1191d39SOri Kamsource code, those can be changed by using the following commands
4774a1191d39SOri Kam
4775a1191d39SOri KamL2 header::
4776a1191d39SOri Kam
4777a1191d39SOri Kam testpmd> set l2_decap
4778a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap / mplsoudp_encap /
4779a1191d39SOri Kam        queue index 0 / end
4780a1191d39SOri Kam
4781a1191d39SOri KamL2 with VXLAN header::
4782a1191d39SOri Kam
4783a1191d39SOri Kam testpmd> set l2_encap-with-vlan
4784a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_encap / mplsoudp_encap /
4785a1191d39SOri Kam         queue index 0 / end
4786a1191d39SOri Kam
47873e77031bSOri KamSample MPLSoGRE encapsulation rule
47883e77031bSOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47893e77031bSOri Kam
47903e77031bSOri KamMPLSoGRE encapsulation outer layer has default value pre-configured in testpmd
47913e77031bSOri Kamsource code, those can be changed by using the following commands
47923e77031bSOri Kam
47933e77031bSOri KamIPv4 MPLSoGRE outer header::
47943e77031bSOri Kam
47953e77031bSOri Kam testpmd> set mplsogre_encap ip-version ipv4 label 4
47963e77031bSOri Kam        ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
47973e77031bSOri Kam        eth-dst 22:22:22:22:22:22
47983e77031bSOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
47993e77031bSOri Kam        mplsogre_encap / end
48003e77031bSOri Kam
48013e77031bSOri KamIPv4 MPLSoGRE with VLAN outer header::
48023e77031bSOri Kam
48033e77031bSOri Kam testpmd> set mplsogre_encap-with-vlan ip-version ipv4 label 4
48043e77031bSOri Kam        ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
48053e77031bSOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
48063e77031bSOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
48073e77031bSOri Kam        mplsogre_encap / end
48083e77031bSOri Kam
48093e77031bSOri KamIPv6 MPLSoGRE outer header::
48103e77031bSOri Kam
48113e77031bSOri Kam testpmd> set mplsogre_encap ip-version ipv6 mask 4
48123e77031bSOri Kam        ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
48133e77031bSOri Kam        eth-dst 22:22:22:22:22:22
48143e77031bSOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
48153e77031bSOri Kam        mplsogre_encap / end
48163e77031bSOri Kam
48173e77031bSOri KamIPv6 MPLSoGRE with VLAN outer header::
48183e77031bSOri Kam
48193e77031bSOri Kam testpmd> set mplsogre_encap-with-vlan ip-version ipv6 mask 4
48203e77031bSOri Kam        ip-src ::1 ip-dst ::2222 vlan-tci 34
48213e77031bSOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
48223e77031bSOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
48233e77031bSOri Kam        mplsogre_encap / end
48243e77031bSOri Kam
48253e77031bSOri KamSample MPLSoGRE decapsulation rule
48263e77031bSOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48273e77031bSOri Kam
48283e77031bSOri KamMPLSoGRE decapsulation outer layer has default value pre-configured in testpmd
48293e77031bSOri Kamsource code, those can be changed by using the following commands
48303e77031bSOri Kam
48313e77031bSOri KamIPv4 MPLSoGRE outer header::
48323e77031bSOri Kam
48333e77031bSOri Kam testpmd> set mplsogre_decap ip-version ipv4
48343e77031bSOri Kam testpmd> flow create 0 ingress pattern eth / ipv4 / gre / mpls / end actions
48353e77031bSOri Kam        mplsogre_decap / l2_encap / end
48363e77031bSOri Kam
48373e77031bSOri KamIPv4 MPLSoGRE with VLAN outer header::
48383e77031bSOri Kam
48393e77031bSOri Kam testpmd> set mplsogre_decap-with-vlan ip-version ipv4
48403e77031bSOri Kam testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / gre / mpls / end
48413e77031bSOri Kam        actions mplsogre_decap / l2_encap / end
48423e77031bSOri Kam
48433e77031bSOri KamIPv6 MPLSoGRE outer header::
48443e77031bSOri Kam
48453e77031bSOri Kam testpmd> set mplsogre_decap ip-version ipv6
48463e77031bSOri Kam testpmd> flow create 0 ingress pattern eth / ipv6 / gre / mpls / end
48473e77031bSOri Kam        actions mplsogre_decap / l2_encap / end
48483e77031bSOri Kam
48493e77031bSOri KamIPv6 MPLSoGRE with VLAN outer header::
48503e77031bSOri Kam
48513e77031bSOri Kam testpmd> set mplsogre_decap-with-vlan ip-version ipv6
48523e77031bSOri Kam testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / gre / mpls / end
48533e77031bSOri Kam        actions mplsogre_decap / l2_encap / end
48543e77031bSOri Kam
4855a1191d39SOri KamSample MPLSoUDP encapsulation rule
4856a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4857a1191d39SOri Kam
4858a1191d39SOri KamMPLSoUDP encapsulation outer layer has default value pre-configured in testpmd
4859a1191d39SOri Kamsource code, those can be changed by using the following commands
4860a1191d39SOri Kam
4861a1191d39SOri KamIPv4 MPLSoUDP outer header::
4862a1191d39SOri Kam
4863a1191d39SOri Kam testpmd> set mplsoudp_encap ip-version ipv4 label 4 udp-src 5 udp-dst 10
4864a1191d39SOri Kam        ip-src 127.0.0.1 ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11
4865a1191d39SOri Kam        eth-dst 22:22:22:22:22:22
4866a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4867a1191d39SOri Kam        mplsoudp_encap / end
4868a1191d39SOri Kam
4869a1191d39SOri KamIPv4 MPLSoUDP with VLAN outer header::
4870a1191d39SOri Kam
4871a1191d39SOri Kam testpmd> set mplsoudp_encap-with-vlan ip-version ipv4 label 4 udp-src 5
4872a1191d39SOri Kam        udp-dst 10 ip-src 127.0.0.1 ip-dst 128.0.0.1 vlan-tci 34
4873a1191d39SOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4874a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4875a1191d39SOri Kam        mplsoudp_encap / end
4876a1191d39SOri Kam
4877a1191d39SOri KamIPv6 MPLSoUDP outer header::
4878a1191d39SOri Kam
4879a1191d39SOri Kam testpmd> set mplsoudp_encap ip-version ipv6 mask 4 udp-src 5 udp-dst 10
4880a1191d39SOri Kam        ip-src ::1 ip-dst ::2222 eth-src 11:11:11:11:11:11
4881a1191d39SOri Kam        eth-dst 22:22:22:22:22:22
4882a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4883a1191d39SOri Kam        mplsoudp_encap / end
4884a1191d39SOri Kam
4885a1191d39SOri KamIPv6 MPLSoUDP with VLAN outer header::
4886a1191d39SOri Kam
4887a1191d39SOri Kam testpmd> set mplsoudp_encap-with-vlan ip-version ipv6 mask 4 udp-src 5
4888a1191d39SOri Kam        udp-dst 10 ip-src ::1 ip-dst ::2222 vlan-tci 34
4889a1191d39SOri Kam        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
4890a1191d39SOri Kam testpmd> flow create 0 egress pattern eth / end actions l2_decap /
4891a1191d39SOri Kam        mplsoudp_encap / end
4892a1191d39SOri Kam
4893a1191d39SOri KamSample MPLSoUDP decapsulation rule
4894a1191d39SOri Kam~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4895a1191d39SOri Kam
4896a1191d39SOri KamMPLSoUDP decapsulation outer layer has default value pre-configured in testpmd
4897a1191d39SOri Kamsource code, those can be changed by using the following commands
4898a1191d39SOri Kam
4899a1191d39SOri KamIPv4 MPLSoUDP outer header::
4900a1191d39SOri Kam
4901a1191d39SOri Kam testpmd> set mplsoudp_decap ip-version ipv4
4902a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / ipv4 / udp / mpls / end actions
4903a1191d39SOri Kam        mplsoudp_decap / l2_encap / end
4904a1191d39SOri Kam
4905a1191d39SOri KamIPv4 MPLSoUDP with VLAN outer header::
4906a1191d39SOri Kam
4907a1191d39SOri Kam testpmd> set mplsoudp_decap-with-vlan ip-version ipv4
4908a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / vlan / ipv4 / udp / mpls / end
4909a1191d39SOri Kam        actions mplsoudp_decap / l2_encap / end
4910a1191d39SOri Kam
4911a1191d39SOri KamIPv6 MPLSoUDP outer header::
4912a1191d39SOri Kam
4913a1191d39SOri Kam testpmd> set mplsoudp_decap ip-version ipv6
4914a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / ipv6 / udp / mpls / end
4915a1191d39SOri Kam        actions mplsoudp_decap / l2_encap / end
4916a1191d39SOri Kam
4917a1191d39SOri KamIPv6 MPLSoUDP with VLAN outer header::
4918a1191d39SOri Kam
4919a1191d39SOri Kam testpmd> set mplsoudp_decap-with-vlan ip-version ipv6
4920a1191d39SOri Kam testpmd> flow create 0 ingress pattern eth / vlan / ipv6 / udp / mpls / end
4921a1191d39SOri Kam        actions mplsoudp_decap / l2_encap / end
4922a1191d39SOri Kam
492330626defSXiaoyu MinSample Raw encapsulation rule
492430626defSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
492530626defSXiaoyu Min
492630626defSXiaoyu MinRaw encapsulation configuration can be set by the following commands
492730626defSXiaoyu Min
49289c30a6f3SHenry NadeauEncapsulating VxLAN::
492930626defSXiaoyu Min
4930739e045bSXiaoyu Min testpmd> set raw_encap 4 eth src is 10:11:22:33:44:55 / vlan tci is 1
493130626defSXiaoyu Min        inner_type is 0x0800 / ipv4 / udp dst is 4789 / vxlan vni
493230626defSXiaoyu Min        is 2 / end_set
493330626defSXiaoyu Min testpmd> flow create 0 egress pattern eth / ipv4 / end actions
4934739e045bSXiaoyu Min        raw_encap index 4 / end
493530626defSXiaoyu Min
493630626defSXiaoyu MinSample Raw decapsulation rule
493730626defSXiaoyu Min~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
493830626defSXiaoyu Min
493930626defSXiaoyu MinRaw decapsulation configuration can be set by the following commands
494030626defSXiaoyu Min
494130626defSXiaoyu MinDecapsulating VxLAN::
494230626defSXiaoyu Min
494330626defSXiaoyu Min testpmd> set raw_decap eth / ipv4 / udp / vxlan / end_set
494430626defSXiaoyu Min testpmd> flow create 0 ingress pattern eth / ipv4 / udp / vxlan / eth / ipv4 /
494530626defSXiaoyu Min        end actions raw_decap / queue index 0 / end
494630626defSXiaoyu Min
49476a42e7efSBernard IremongerSample ESP rules
49486a42e7efSBernard Iremonger~~~~~~~~~~~~~~~~
49496a42e7efSBernard Iremonger
49506a42e7efSBernard IremongerESP rules can be created by the following commands::
49516a42e7efSBernard Iremonger
49526a42e7efSBernard Iremonger testpmd> flow create 0 ingress pattern eth / ipv4 / esp spi is 1 / end actions
49536a42e7efSBernard Iremonger        queue index 3 / end
49546a42e7efSBernard Iremonger testpmd> flow create 0 ingress pattern eth / ipv4 / udp / esp spi is 1 / end
49556a42e7efSBernard Iremonger        actions queue index 3 / end
49566a42e7efSBernard Iremonger testpmd> flow create 0 ingress pattern eth / ipv6 / esp spi is 1 / end actions
49576a42e7efSBernard Iremonger        queue index 3 / end
49586a42e7efSBernard Iremonger testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is 1 / end
49596a42e7efSBernard Iremonger        actions queue index 3 / end
49606a42e7efSBernard Iremonger
4961573ef95dSXiao ZhangSample AH rules
4962573ef95dSXiao Zhang~~~~~~~~~~~~~~~~
4963573ef95dSXiao Zhang
4964573ef95dSXiao ZhangAH rules can be created by the following commands::
4965573ef95dSXiao Zhang
4966573ef95dSXiao Zhang testpmd> flow create 0 ingress pattern eth / ipv4 / ah spi is 1 / end actions
4967573ef95dSXiao Zhang        queue index 3 / end
4968573ef95dSXiao Zhang testpmd> flow create 0 ingress pattern eth / ipv4 / udp / ah spi is 1 / end
4969573ef95dSXiao Zhang        actions queue index 3 / end
4970573ef95dSXiao Zhang testpmd> flow create 0 ingress pattern eth / ipv6 / ah spi is 1 / end actions
4971573ef95dSXiao Zhang        queue index 3 / end
4972573ef95dSXiao Zhang testpmd> flow create 0 ingress pattern eth / ipv6 / udp / ah spi is 1 / end
4973573ef95dSXiao Zhang        actions queue index 3 / end
4974573ef95dSXiao Zhang
4975ecbc8570SXiao ZhangSample PFCP rules
4976ecbc8570SXiao Zhang~~~~~~~~~~~~~~~~~
4977ecbc8570SXiao Zhang
4978ecbc8570SXiao ZhangPFCP rules can be created by the following commands(s_field need to be 1
4979ecbc8570SXiao Zhangif seid is set)::
4980ecbc8570SXiao Zhang
4981ecbc8570SXiao Zhang testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 0 / end
4982ecbc8570SXiao Zhang        actions queue index 3 / end
4983ecbc8570SXiao Zhang testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is 1
4984ecbc8570SXiao Zhang        seid is 1 / end actions queue index 3 / end
4985ecbc8570SXiao Zhang testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 0 / end
4986ecbc8570SXiao Zhang        actions queue index 3 / end
4987ecbc8570SXiao Zhang testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
4988ecbc8570SXiao Zhang        seid is 1 / end actions queue index 3 / end
4989ecbc8570SXiao Zhang
499001ee2e49SJiawei WangSample Sampling/Mirroring rules
499101ee2e49SJiawei Wang~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
499201ee2e49SJiawei Wang
499301ee2e49SJiawei WangSample/Mirroring rules can be set by the following commands
499401ee2e49SJiawei Wang
499501ee2e49SJiawei WangNIC-RX Sampling rule, the matched ingress packets and sent to the queue 1,
499601ee2e49SJiawei Wangand 50% packets are duplicated and marked with 0x1234 and sent to queue 0.
499701ee2e49SJiawei Wang
499801ee2e49SJiawei Wang::
499901ee2e49SJiawei Wang
500001ee2e49SJiawei Wang testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
500101ee2e49SJiawei Wang testpmd> flow create 0 ingress group 1 pattern eth / end actions
500201ee2e49SJiawei Wang        sample ratio 2 index 0 / queue index 1 / end
500301ee2e49SJiawei Wang
5004ce88d5daSIvan MalovMatch packets coming from a VM which is referred to by means of
5005ce88d5daSIvan Malovits representor ethdev (port 1), mirror 50% of them to the
5006ce88d5daSIvan Malovsaid representor (for bookkeeping) as well as encapsulate
5007ce88d5daSIvan Malovall the packets and steer them to the physical port:
500801ee2e49SJiawei Wang
500901ee2e49SJiawei Wang::
501001ee2e49SJiawei Wang
5011ce88d5daSIvan Malov   testpmd> set sample_actions 0 port_representor ethdev_port_id 1 / end
501201ee2e49SJiawei Wang
5013ce88d5daSIvan Malov   testpmd> set vxlan ip-version ipv4 vni 4 udp-src 32 udp-dst 4789 ip-src 127.0.0.1
5014ce88d5daSIvan Malov      ip-dst 127.0.0.2 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
501501ee2e49SJiawei Wang
5016ce88d5daSIvan Malov   testpmd> flow create 0 transfer pattern represented_port ethdev_port_id is 1 / end
5017ce88d5daSIvan Malov      actions sample ratio 2 index 0 / vxlan_encap /
5018ce88d5daSIvan Malov      represented_port ethdev_port_id 0 / end
501901ee2e49SJiawei Wang
5020ce88d5daSIvan MalovThe rule is inserted via port 0 (assumed to have "transfer" privilege).
50213b622711SSalem Sol
50220797fa6cSOri KamSample integrity rules
50230797fa6cSOri Kam~~~~~~~~~~~~~~~~~~~~~~
50240797fa6cSOri Kam
50250797fa6cSOri KamIntegrity rules can be created by the following commands:
50260797fa6cSOri Kam
50270797fa6cSOri KamIntegrity rule that forwards valid TCP packets to group 1.
50280797fa6cSOri KamTCP packet integrity is matched with the ``l4_ok`` bit 3.
50290797fa6cSOri Kam
50300797fa6cSOri Kam::
50310797fa6cSOri Kam
50320797fa6cSOri Kam testpmd> flow create 0 ingress
50330797fa6cSOri Kam            pattern eth / ipv4 / tcp / integrity value mask 8 value spec 8 / end
50340797fa6cSOri Kam            actions jump group 1 / end
50350797fa6cSOri Kam
50360797fa6cSOri KamIntegrity rule that forwards invalid packets to application.
50370797fa6cSOri KamGeneral packet integrity is matched with the ``packet_ok`` bit 0.
50380797fa6cSOri Kam
50390797fa6cSOri Kam::
50400797fa6cSOri Kam
50410797fa6cSOri Kam testpmd> flow create 0 ingress pattern integrity value mask 1 value spec 0 / end actions queue index 0 / end
50420797fa6cSOri Kam
50434d07cbefSBing ZhaoSample conntrack rules
50444d07cbefSBing Zhao~~~~~~~~~~~~~~~~~~~~~~
50454d07cbefSBing Zhao
50464d07cbefSBing ZhaoConntrack rules can be set by the following commands
50474d07cbefSBing Zhao
50484d07cbefSBing ZhaoNeed to construct the connection context with provided information.
50494d07cbefSBing ZhaoIn the first table, create a flow rule by using conntrack action and jump to
50504d07cbefSBing Zhaothe next table. In the next table, create a rule to check the state.
50514d07cbefSBing Zhao
50524d07cbefSBing Zhao::
50534d07cbefSBing Zhao
50544d07cbefSBing Zhao testpmd> set conntrack com peer 1 is_orig 1 enable 1 live 1 sack 1 cack 0
50554d07cbefSBing Zhao        last_dir 0 liberal 0 state 1 max_ack_win 7 r_lim 5 last_win 510
50564d07cbefSBing Zhao        last_seq 2632987379 last_ack 2532480967 last_end 2632987379
50574d07cbefSBing Zhao        last_index 0x8
50584d07cbefSBing Zhao testpmd> set conntrack orig scale 7 fin 0 acked 1 unack_data 0
50594d07cbefSBing Zhao        sent_end 2632987379 reply_end 2633016339 max_win 28960
50604d07cbefSBing Zhao        max_ack 2632987379
50614d07cbefSBing Zhao testpmd> set conntrack rply scale 7 fin 0 acked 1 unack_data 0
50624d07cbefSBing Zhao        sent_end 2532480967 reply_end 2532546247 max_win 65280
50634d07cbefSBing Zhao        max_ack 2532480967
50644d07cbefSBing Zhao testpmd> flow indirect_action 0 create ingress action conntrack / end
50654d07cbefSBing Zhao testpmd> flow create 0 group 3 ingress pattern eth / ipv4 / tcp / end actions indirect 0 / jump group 5 / end
50664d07cbefSBing Zhao testpmd> flow create 0 group 5 ingress pattern eth / ipv4 / tcp / conntrack is 1 / end actions queue index 5 / end
50674d07cbefSBing Zhao
50684d07cbefSBing ZhaoConstruct the conntrack again with only "is_orig" set to 0 (other fields are
50694d07cbefSBing Zhaoignored), then use "update" interface to update the direction. Create flow
50704d07cbefSBing Zhaorules like above for the peer port.
50714d07cbefSBing Zhao
50724d07cbefSBing Zhao::
50734d07cbefSBing Zhao
50744d07cbefSBing Zhao testpmd> flow indirect_action 0 update 0 action conntrack_update dir / end
50754d07cbefSBing Zhao
5076c5c50710SHaifei LuoSample meter with policy rules
5077c5c50710SHaifei Luo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5078c5c50710SHaifei Luo
5079c5c50710SHaifei LuoMeter with policy rules can be created by the following commands:
5080c5c50710SHaifei Luo
5081c5c50710SHaifei LuoNeed to create policy first and actions are set for green/yellow/red colors.
5082c5c50710SHaifei LuoCreate meter with policy id. Create flow with meter id.
5083c5c50710SHaifei Luo
5084c5c50710SHaifei LuoExample for policy with meter color action. The purpose is to color the packet
5085c5c50710SHaifei Luoto reflect the meter color result.
5086c5c50710SHaifei LuoThe meter policy action list: ``green -> green, yellow -> yellow, red -> red``.
5087c5c50710SHaifei Luo
5088c5c50710SHaifei Luo::
5089c5c50710SHaifei Luo
5090c5c50710SHaifei Luo   testpmd> add port meter profile srtcm_rfc2697 0 13 21504 2688 0 0
5091c5c50710SHaifei Luo   testpmd> add port meter policy 0 1 g_actions color type green / end y_actions color type yellow / end
5092c5c50710SHaifei Luo            r_actions color type red / end
5093c5c50710SHaifei Luo   testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
5094c5c50710SHaifei Luo   testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end
5095c5c50710SHaifei Luo
5096988cd040SJie WangSample L2TPv2 RSS rules
5097988cd040SJie Wang~~~~~~~~~~~~~~~~~~~~~~~
5098748530f0SJie Wang
5099988cd040SJie WangL2TPv2 RSS rules can be created by the following commands::
5100748530f0SJie Wang
5101988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
5102988cd040SJie Wang            / end actions rss types l2tpv2 end queues end / end
5103988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / end
5104988cd040SJie Wang            actions rss types eth l2-src-only end queues end / end
5105988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / end
5106988cd040SJie Wang            actions rss types l2tpv2 end queues end / end
5107748530f0SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5108748530f0SJie Wang            / end actions rss types ipv4 end queues end / end
5109748530f0SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv6
5110748530f0SJie Wang            / udp / end actions rss types ipv6-udp end queues end / end
5111748530f0SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv4
5112748530f0SJie Wang            / tcp / end actions rss types ipv4-tcp end queues end / end
5113748530f0SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
5114748530f0SJie Wang            / end actions rss types ipv6 end queues end / end
5115748530f0SJie Wang
5116988cd040SJie WangSample L2TPv2 FDIR rules
5117988cd040SJie Wang~~~~~~~~~~~~~~~~~~~~~~~~
5118988cd040SJie Wang
5119988cd040SJie WangL2TPv2 FDIR rules can be created by the following commands::
5120988cd040SJie Wang
5121988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
5122988cd040SJie Wang            session_id is 0x1111 / end actions queue index 3 / end
5123988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth src is 00:00:00:00:00:01 / ipv4
5124988cd040SJie Wang            / udp / l2tpv2 type data / end actions queue index 3 / end
5125988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type data
5126988cd040SJie Wang            session_id is 0x1111 / ppp / end actions queue index 3 / end
5127988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5128988cd040SJie Wang            src is 10.0.0.1 / end actions queue index 3 / end
5129988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
5130988cd040SJie Wang            dst is ABAB:910B:6666:3457:8295:3333:1800:2929 / end actions queue index 3 / end
5131988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5132988cd040SJie Wang            / udp src is 22 / end actions queue index 3 / end
5133988cd040SJie Wang   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
5134988cd040SJie Wang            / tcp dst is 23 / end actions queue index 3 / end
5135988cd040SJie Wang
5136cb43641eSNipun GuptaSample RAW rule
5137cb43641eSNipun Gupta~~~~~~~~~~~~~~~
5138cb43641eSNipun Gupta
5139cb43641eSNipun GuptaA RAW rule can be created as following using ``pattern_hex`` key and mask.
5140cb43641eSNipun Gupta
5141cb43641eSNipun Gupta::
5142cb43641eSNipun Gupta
5143cb43641eSNipun Gupta    testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset
5144cb43641eSNipun Gupta             is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a
5145cb43641eSNipun Gupta             pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions
5146cb43641eSNipun Gupta             queue index 4 / end
5147cb43641eSNipun Gupta
5148e977e419SKonstantin AnanyevBPF Functions
5149e977e419SKonstantin Ananyev--------------
5150e977e419SKonstantin Ananyev
5151e977e419SKonstantin AnanyevThe following sections show functions to load/unload eBPF based filters.
5152e977e419SKonstantin Ananyev
5153e977e419SKonstantin Ananyevbpf-load
5154e977e419SKonstantin Ananyev~~~~~~~~
5155e977e419SKonstantin Ananyev
5156d629b7b5SJohn McNamaraLoad an eBPF program as a callback for particular RX/TX queue::
5157e977e419SKonstantin Ananyev
5158e977e419SKonstantin Ananyev   testpmd> bpf-load rx|tx (portid) (queueid) (load-flags) (bpf-prog-filename)
5159e977e419SKonstantin Ananyev
5160e977e419SKonstantin AnanyevThe available load-flags are:
5161e977e419SKonstantin Ananyev
5162e977e419SKonstantin Ananyev* ``J``: use JIT generated native code, otherwise BPF interpreter will be used.
5163e977e419SKonstantin Ananyev
5164e977e419SKonstantin Ananyev* ``M``: assume input parameter is a pointer to rte_mbuf, otherwise assume it is a pointer to first segment's data.
5165e977e419SKonstantin Ananyev
5166e977e419SKonstantin Ananyev* ``-``: none.
5167e977e419SKonstantin Ananyev
5168e977e419SKonstantin Ananyev.. note::
5169e977e419SKonstantin Ananyev
5170e977e419SKonstantin Ananyev   You'll need clang v3.7 or above to build bpf program you'd like to load
5171e977e419SKonstantin Ananyev
5172e977e419SKonstantin AnanyevFor example:
5173e977e419SKonstantin Ananyev
5174e977e419SKonstantin Ananyev.. code-block:: console
5175e977e419SKonstantin Ananyev
517625d11a86SBruce Richardson   cd examples/bpf
5177e977e419SKonstantin Ananyev   clang -O2 -target bpf -c t1.c
5178e977e419SKonstantin Ananyev
51797fa1a2deSKevin TraynorThen to load (and JIT compile) t1.o at RX queue 0, port 1:
5180e977e419SKonstantin Ananyev
5181e977e419SKonstantin Ananyev.. code-block:: console
5182e977e419SKonstantin Ananyev
518325d11a86SBruce Richardson   testpmd> bpf-load rx 1 0 J ./dpdk.org/examples/bpf/t1.o
5184e977e419SKonstantin Ananyev
51857fa1a2deSKevin TraynorTo load (not JITed) t1.o at TX queue 0, port 0:
5186e977e419SKonstantin Ananyev
5187e977e419SKonstantin Ananyev.. code-block:: console
5188e977e419SKonstantin Ananyev
518925d11a86SBruce Richardson   testpmd> bpf-load tx 0 0 - ./dpdk.org/examples/bpf/t1.o
5190e977e419SKonstantin Ananyev
5191e977e419SKonstantin Ananyevbpf-unload
5192e977e419SKonstantin Ananyev~~~~~~~~~~
5193e977e419SKonstantin Ananyev
5194d629b7b5SJohn McNamaraUnload previously loaded eBPF program for particular RX/TX queue::
5195e977e419SKonstantin Ananyev
5196e977e419SKonstantin Ananyev   testpmd> bpf-unload rx|tx (portid) (queueid)
5197e977e419SKonstantin Ananyev
5198e977e419SKonstantin AnanyevFor example to unload BPF filter from TX queue 0, port 0:
5199e977e419SKonstantin Ananyev
5200e977e419SKonstantin Ananyev.. code-block:: console
5201e977e419SKonstantin Ananyev
520225d11a86SBruce Richardson   testpmd> bpf-unload tx 0 0
520359f3a8acSGregory Etelson
520459f3a8acSGregory EtelsonFlex Item Functions
520559f3a8acSGregory Etelson-------------------
520659f3a8acSGregory Etelson
520759f3a8acSGregory EtelsonThe following sections show functions that configure and create flex item object,
520859f3a8acSGregory Etelsoncreate flex pattern and use it in a flow rule.
520959f3a8acSGregory EtelsonThe commands will use 20 bytes IPv4 header for examples:
521059f3a8acSGregory Etelson
521159f3a8acSGregory Etelson::
521259f3a8acSGregory Etelson
521359f3a8acSGregory Etelson   0                   1                   2                   3
521459f3a8acSGregory Etelson   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
521559f3a8acSGregory Etelson   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
521659f3a8acSGregory Etelson   |  ver  |  IHL  |     TOS       |        length                 | +0
521759f3a8acSGregory Etelson   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
521859f3a8acSGregory Etelson   |       identification          | flg |    frag. offset         | +4
521959f3a8acSGregory Etelson   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
522059f3a8acSGregory Etelson   |       TTL     |  protocol     |        checksum               | +8
522159f3a8acSGregory Etelson   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
522259f3a8acSGregory Etelson   |               source IP address                               | +12
522359f3a8acSGregory Etelson   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
522459f3a8acSGregory Etelson   |              destination IP address                           | +16
522559f3a8acSGregory Etelson   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
522659f3a8acSGregory Etelson
522759f3a8acSGregory Etelson
522859f3a8acSGregory EtelsonCreate flex item
522959f3a8acSGregory Etelson~~~~~~~~~~~~~~~~
523059f3a8acSGregory Etelson
523159f3a8acSGregory EtelsonFlex item object is created by PMD according to a new header configuration. The
523259f3a8acSGregory Etelsonheader configuration is compiled by the testpmd and stored in
523359f3a8acSGregory Etelson``rte_flow_item_flex_conf`` type variable.
523459f3a8acSGregory Etelson
523559f3a8acSGregory Etelson::
523659f3a8acSGregory Etelson
523759f3a8acSGregory Etelson   # flow flex_item create <port> <flex id> <configuration file>
523859f3a8acSGregory Etelson   testpmd> flow flex_item init 0 3 ipv4_flex_config.json
523959f3a8acSGregory Etelson   port-0: created flex item #3
524059f3a8acSGregory Etelson
524159f3a8acSGregory EtelsonFlex item configuration is kept in external JSON file.
524259f3a8acSGregory EtelsonIt describes the following header elements:
524359f3a8acSGregory Etelson
524459f3a8acSGregory Etelson**New header length.**
524559f3a8acSGregory Etelson
524659f3a8acSGregory EtelsonSpecify whether the new header has fixed or variable length and the basic/minimal
524759f3a8acSGregory Etelsonheader length value.
524859f3a8acSGregory Etelson
524959f3a8acSGregory EtelsonIf header length is not fixed, header location with a value that completes header
525059f3a8acSGregory Etelsonlength calculation and scale/offset function must be added.
525159f3a8acSGregory Etelson
525259f3a8acSGregory EtelsonScale function depends on port hardware.
525359f3a8acSGregory Etelson
525459f3a8acSGregory Etelson**Next protocol.**
525559f3a8acSGregory Etelson
525659f3a8acSGregory EtelsonDescribes location in the new header that specify following network header type.
525759f3a8acSGregory Etelson
525859f3a8acSGregory Etelson**Flow match samples.**
525959f3a8acSGregory Etelson
526059f3a8acSGregory EtelsonDescribes locations in the new header that will be used in flow rules.
526159f3a8acSGregory Etelson
526259f3a8acSGregory EtelsonNumber of flow samples and sample maximal length depend of port hardware.
526359f3a8acSGregory Etelson
526459f3a8acSGregory Etelson**Input trigger.**
526559f3a8acSGregory Etelson
526659f3a8acSGregory EtelsonDescribes preceding network header configuration.
526759f3a8acSGregory Etelson
526859f3a8acSGregory Etelson**Output trigger.**
526959f3a8acSGregory Etelson
527059f3a8acSGregory EtelsonDescribes conditions that trigger transfer to following network header
527159f3a8acSGregory Etelson
527259f3a8acSGregory Etelson.. code-block:: json
527359f3a8acSGregory Etelson
527459f3a8acSGregory Etelson   {
527559f3a8acSGregory Etelson      "next_header": { "field_mode": "FIELD_MODE_FIXED", "field_size": 20},
527659f3a8acSGregory Etelson      "next_protocol": {"field_size": 8, "field_base": 72},
527759f3a8acSGregory Etelson      "sample_data": [
527859f3a8acSGregory Etelson         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 0},
527959f3a8acSGregory Etelson         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 32},
528059f3a8acSGregory Etelson         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 64},
528159f3a8acSGregory Etelson         { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 96}
528259f3a8acSGregory Etelson      ],
528359f3a8acSGregory Etelson      "input_link": [
528459f3a8acSGregory Etelson         {"item": "eth type is 0x0800"},
528559f3a8acSGregory Etelson         {"item": "vlan inner_type is 0x0800"}
528659f3a8acSGregory Etelson      ],
528759f3a8acSGregory Etelson      "output_link": [
528859f3a8acSGregory Etelson         {"item": "udp", "next": 17},
528959f3a8acSGregory Etelson         {"item": "tcp", "next": 6},
529059f3a8acSGregory Etelson         {"item": "icmp", "next": 1}
529159f3a8acSGregory Etelson      ]
529259f3a8acSGregory Etelson   }
529359f3a8acSGregory Etelson
529459f3a8acSGregory Etelson
529559f3a8acSGregory EtelsonFlex pattern and flow rules
529659f3a8acSGregory Etelson~~~~~~~~~~~~~~~~~~~~~~~~~~~
529759f3a8acSGregory Etelson
529859f3a8acSGregory EtelsonFlex pattern describe parts of network header that will trigger flex flow item hit in a flow rule.
529959f3a8acSGregory EtelsonFlex pattern directly related to flex item samples configuration.
530059f3a8acSGregory EtelsonFlex pattern can be shared between ports.
530159f3a8acSGregory Etelson
530259f3a8acSGregory Etelson**Flex pattern and flow rule to match IPv4 version and 20 bytes length**
530359f3a8acSGregory Etelson
530459f3a8acSGregory Etelson::
530559f3a8acSGregory Etelson
530659f3a8acSGregory Etelson   # set flex_pattern <pattern_id> is <hex bytes sequence>
530759f3a8acSGregory Etelson   testpmd> flow flex_item pattern 5 is 45FF
530859f3a8acSGregory Etelson   created pattern #5
530959f3a8acSGregory Etelson
531059f3a8acSGregory Etelson   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / flex item is 3 pattern is 5 / end actions mark id 1 / queue index 0 / end
531159f3a8acSGregory Etelson   Flow rule #0 created
531259f3a8acSGregory Etelson
531359f3a8acSGregory Etelson**Flex pattern and flow rule to match packets with source address 1.2.3.4**
531459f3a8acSGregory Etelson
531559f3a8acSGregory Etelson::
531659f3a8acSGregory Etelson
531759f3a8acSGregory Etelson   testpmd> flow flex_item pattern 2 spec 45000000000000000000000001020304 mask FF0000000000000000000000FFFFFFFF
531859f3a8acSGregory Etelson   created pattern #2
531959f3a8acSGregory Etelson
532059f3a8acSGregory Etelson   testpmd> flow create 0 ingress pattern eth / ipv4 / udp / flex item is 3 pattern is 2 / end actions mark id 1 / queue index 0 / end
532159f3a8acSGregory Etelson   Flow rule #0 created
5322592ab76fSDavid Marchand
5323592ab76fSDavid MarchandDriver specific commands
5324592ab76fSDavid Marchand------------------------
5325592ab76fSDavid Marchand
5326592ab76fSDavid MarchandSome drivers provide specific features.
5327592ab76fSDavid MarchandSee:
5328703178f8SDavid Marchand
5329703178f8SDavid Marchand- :ref:`net/bonding testpmd driver specific commands <bonding_testpmd_commands>`
533094b3c1a7SDavid Marchand- :ref:`net/i40e testpmd driver specific commands <net_i40e_testpmd_commands>`
53310100a038SDavid Marchand- :ref:`net/ixgbe testpmd driver specific commands <net_ixgbe_testpmd_commands>`
5332