app/testpmd: add command for single flow dump
[dpdk.git] / doc / guides / testpmd_app_ug / testpmd_funcs.rst
index 942870b..72667de 100644 (file)
@@ -24,10 +24,10 @@ If you type a partial command and hit ``<TAB>`` you get a list of the available
 
    testpmd> show port <TAB>
 
-       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
-       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
-       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap X
-       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all
+       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X
+       info [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all
+       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc X
+       stats [Mul-choice STRING]: show|clear port info|stats|xstats|fdir|stat_qmap|dcb_tc all
        ...
 
 
@@ -159,7 +159,7 @@ show port
 
 Display information for a given port or all ports::
 
-   testpmd> show port (info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)
+   testpmd> show port (info|summary|stats|xstats|fdir|stat_qmap|dcb_tc) (port_id|all)
 
 The available information categories are:
 
@@ -177,8 +177,6 @@ The available information categories are:
 
 * ``dcb_tc``: DCB information such as TC mapping.
 
-* ``cap``: Supported offload capabilities.
-
 For example:
 
 .. code-block:: console
@@ -266,6 +264,13 @@ Display information for a given port's RX/TX descriptor status::
 
    testpmd> show port (port_id) (rxq|txq) (queue_id) desc (desc_id) status
 
+show rxq desc used count
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Display the number of receive packet descriptors currently filled by hardware
+and ready to be processed by the driver on a given RX queue::
+
+   testpmd> show port (port_id) rxq (queue_id) desc used count
 
 show config
 ~~~~~~~~~~~
@@ -1709,13 +1714,6 @@ Enable/disable E-tag based forwarding on a port::
 
    testpmd> E-tag set forwarding (on|off) port (port_id)
 
-Add an E-tag forwarding filter on a port::
-
-   testpmd> E-tag set filter add e-tag-id (value) dst-pool (pool_id) port (port_id)
-
-Delete an E-tag forwarding filter on a port::
-   testpmd> E-tag set filter del e-tag-id (value) port (port_id)
-
 ddp add
 ~~~~~~~
 
@@ -2005,6 +2003,24 @@ Set fec mode for a specific port::
 
   testpmd> set port (port_id) fec_mode auto|off|rs|baser
 
+Config Sample actions list
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Configure the sample actions list to be used when sampling a packet by
+rte_flow_action_sample::
+
+ set sample_actions {index} {action} [/ {action} [...]] / end
+
+There are multiple global buffers for ``sample_actions``, this command will set
+one internal buffer index by ``{index}``.
+
+In order to use different sample actions list, ``index`` must be specified
+during the flow rule creation::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / end actions
+        sample ratio 2 index 2 / end
+
+Otherwise the default index ``0`` is used.
 
 Port Functions
 --------------
@@ -2277,7 +2293,7 @@ port config - RSS
 
 Set the RSS (Receive Side Scaling) mode on or off::
 
-   testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|none)
+   testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none)
 
 RSS is on by default.
 
@@ -2341,17 +2357,6 @@ Where the threshold type can be:
 
 These threshold options are also available from the command-line.
 
-port config - E-tag
-~~~~~~~~~~~~~~~~~~~
-
-Set the value of ether-type for E-tag::
-
-   testpmd> port config (port_id|all) l2-tunnel E-tag ether-type (value)
-
-Enable/disable the E-tag support::
-
-   testpmd> port config (port_id|all) l2-tunnel E-tag (enable|disable)
-
 port config pctype mapping
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -2393,7 +2398,7 @@ port config udp_tunnel_port
 
 Add/remove UDP tunnel port for VXLAN/GENEVE tunneling protocols::
 
-    testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe (udp_port)
+    testpmd> port config (port_id) udp_tunnel_port add|rm vxlan|geneve|vxlan-gpe|ecpri (udp_port)
 
 port config tx_metadata
 ~~~~~~~~~~~~~~~~~~~~~~~
@@ -2711,14 +2716,15 @@ add port meter profile (srTCM rfc2967)
 Add meter profile (srTCM rfc2697) to the ethernet device::
 
    testpmd> add port meter profile srtcm_rfc2697 (port_id) (profile_id) \
-   (cir) (cbs) (ebs)
+   (cir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed Information Rate (CIR) (bytes/second).
-* ``cbs``: Committed Burst Size (CBS) (bytes).
-* ``ebs``: Excess Burst Size (EBS) (bytes).
+* ``cir``: Committed Information Rate (CIR) (bytes per second or packets per second).
+* ``cbs``: Committed Burst Size (CBS) (bytes or packets).
+* ``ebs``: Excess Burst Size (EBS) (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc2968)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2726,15 +2732,16 @@ add port meter profile (trTCM rfc2968)
 Add meter profile (srTCM rfc2698) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc2698 (port_id) (profile_id) \
-   (cir) (pir) (cbs) (pbs)
+   (cir) (pir) (cbs) (pbs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``pir``: Peak information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``pbs``: Peak burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``pir``: Peak information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``pbs``: Peak burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 add port meter profile (trTCM rfc4115)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2742,15 +2749,16 @@ add port meter profile (trTCM rfc4115)
 Add meter profile (trTCM rfc4115) to the ethernet device::
 
    testpmd> add port meter profile trtcm_rfc4115 (port_id) (profile_id) \
-   (cir) (eir) (cbs) (ebs)
+   (cir) (eir) (cbs) (ebs) (packet_mode)
 
 where:
 
 * ``profile_id``: ID for the meter profile.
-* ``cir``: Committed information rate (bytes/second).
-* ``eir``: Excess information rate (bytes/second).
-* ``cbs``: Committed burst size (bytes).
-* ``ebs``: Excess burst size (bytes).
+* ``cir``: Committed information rate (bytes per second or packets per second).
+* ``eir``: Excess information rate (bytes per second or packets per second).
+* ``cbs``: Committed burst size (bytes or packets).
+* ``ebs``: Excess burst size (bytes or packets).
+* ``packet_mode``: Packets mode for meter profile.
 
 delete port meter profile
 ~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3224,118 +3232,6 @@ superseded by *rte_flow*. See `Flow rules management`_.
 
 .. _testpmd_flow_director:
 
-flow_director_filter
-~~~~~~~~~~~~~~~~~~~~
-
-The Flow Director works in receive mode to identify specific flows or sets of flows and route them to specific queues.
-
-Four types of filtering are supported which are referred to as Perfect Match, Signature, Perfect-mac-vlan and
-Perfect-tunnel filters, the match mode is set by the ``--pkt-filter-mode`` command-line parameter:
-
-* Perfect match filters.
-  The hardware checks a match between the masked fields of the received packets and the programmed filters.
-  The masked fields are for IP flow.
-
-* Signature filters.
-  The hardware checks a match between a hash-based signature of the masked fields of the received packet.
-
-* Perfect-mac-vlan match filters.
-  The hardware checks a match between the masked fields of the received packets and the programmed filters.
-  The masked fields are for MAC VLAN flow.
-
-* Perfect-tunnel match filters.
-  The hardware checks a match between the masked fields of the received packets and the programmed filters.
-  The masked fields are for tunnel flow.
-
-* Perfect-raw-flow-type match filters.
-  The hardware checks a match between the masked fields of the received packets and pre-loaded raw (template) packet.
-  The masked fields are specified by input sets.
-
-The Flow Director filters can match the different fields for different type of packet: flow type, specific input set
-per flow type and the flexible payload.
-
-The Flow Director can also mask out parts of all of these fields so that filters
-are only applied to certain fields or parts of the fields.
-
-Note that for raw flow type mode the source and destination fields in the
-raw packet buffer need to be presented in a reversed order with respect
-to the expected received packets.
-For example: IP source and destination addresses or TCP/UDP/SCTP
-source and destination ports
-
-Different NICs may have different capabilities, command show port fdir (port_id) can be used to acquire the information.
-
-# Commands to add flow director filters of different flow types::
-
-   flow_director_filter (port_id) mode IP (add|del|update) \
-                        flow (ipv4-other|ipv4-frag|ipv6-other|ipv6-frag) \
-                        src (src_ip_address) dst (dst_ip_address) \
-                        tos (tos_value) proto (proto_value) ttl (ttl_value) \
-                        vlan (vlan_value) flexbytes (flexbytes_value) \
-                        (drop|fwd) pf|vf(vf_id) queue (queue_id) \
-                        fd_id (fd_id_value)
-
-   flow_director_filter (port_id) mode IP (add|del|update) \
-                        flow (ipv4-tcp|ipv4-udp|ipv6-tcp|ipv6-udp) \
-                        src (src_ip_address) (src_port) \
-                        dst (dst_ip_address) (dst_port) \
-                        tos (tos_value) ttl (ttl_value) \
-                        vlan (vlan_value) flexbytes (flexbytes_value) \
-                        (drop|fwd) queue pf|vf(vf_id) (queue_id) \
-                        fd_id (fd_id_value)
-
-   flow_director_filter (port_id) mode IP (add|del|update) \
-                        flow (ipv4-sctp|ipv6-sctp) \
-                        src (src_ip_address) (src_port) \
-                        dst (dst_ip_address) (dst_port) \
-                        tos (tos_value) ttl (ttl_value) \
-                        tag (verification_tag) vlan (vlan_value) \
-                        flexbytes (flexbytes_value) (drop|fwd) \
-                        pf|vf(vf_id) queue (queue_id) fd_id (fd_id_value)
-
-   flow_director_filter (port_id) mode IP (add|del|update) flow l2_payload \
-                        ether (ethertype) flexbytes (flexbytes_value) \
-                        (drop|fwd) pf|vf(vf_id) queue (queue_id)
-                        fd_id (fd_id_value)
-
-   flow_director_filter (port_id) mode MAC-VLAN (add|del|update) \
-                        mac (mac_address) vlan (vlan_value) \
-                        flexbytes (flexbytes_value) (drop|fwd) \
-                        queue (queue_id) fd_id (fd_id_value)
-
-   flow_director_filter (port_id) mode Tunnel (add|del|update) \
-                        mac (mac_address) vlan (vlan_value) \
-                        tunnel (NVGRE|VxLAN) tunnel-id (tunnel_id_value) \
-                        flexbytes (flexbytes_value) (drop|fwd) \
-                        queue (queue_id) fd_id (fd_id_value)
-
-   flow_director_filter (port_id) mode raw (add|del|update) flow (flow_id) \
-                        (drop|fwd) queue (queue_id) fd_id (fd_id_value) \
-                        packet (packet file name)
-
-For example, to add an ipv4-udp flow type filter::
-
-   testpmd> flow_director_filter 0 mode IP add flow ipv4-udp src 2.2.2.3 32 \
-            dst 2.2.2.5 33 tos 2 ttl 40 vlan 0x1 flexbytes (0x88,0x48) \
-            fwd pf queue 1 fd_id 1
-
-For example, add an ipv4-other flow type filter::
-
-   testpmd> flow_director_filter 0 mode IP add flow ipv4-other src 2.2.2.3 \
-             dst 2.2.2.5 tos 2 proto 20 ttl 40 vlan 0x1 \
-             flexbytes (0x88,0x48) fwd pf queue 1 fd_id 1
-
-flush_flow_director
-~~~~~~~~~~~~~~~~~~~
-
-Flush all flow director filters on a device::
-
-   testpmd> flush_flow_director (port_id)
-
-Example, to flush all flow director filter on port 0::
-
-   testpmd> flush_flow_director 0
-
 flow_director_mask
 ~~~~~~~~~~~~~~~~~~
 
@@ -3359,22 +3255,6 @@ Example, to set flow director mask on port 0::
             dst_mask 255.255.255.255 \
                 FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF 0xFFFF
 
-flow_director_flex_mask
-~~~~~~~~~~~~~~~~~~~~~~~
-
-set masks of flow director's flexible payload based on certain flow type::
-
-   testpmd> flow_director_flex_mask (port_id) \
-            flow (none|ipv4-other|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
-                  ipv6-other|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \
-                  l2_payload|all) (mask)
-
-Example, to set flow director's flex mask for all flow type on port 0::
-
-   testpmd> flow_director_flex_mask 0 flow all \
-            (0xff,0xff,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
-
-
 flow_director_flex_payload
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -3387,36 +3267,6 @@ For example, to select the first 16 bytes from the offset 4 (bytes) of packet's
    testpmd> flow_director_flex_payload 0 l4 \
             (4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19)
 
-set_fdir_input_set
-~~~~~~~~~~~~~~~~~~
-
-The Flow Director filters can match the different fields for different type of packet, i.e. specific input set
-on per flow type and the flexible payload. This command can be used to change input set for each flow type.
-
-Set the input set for flow director::
-
-   set_fdir_input_set (port_id) (ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp| \
-   ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other| \
-   l2_payload|<flow_id>) (ivlan|ethertype|src-ipv4|dst-ipv4|src-ipv6|dst-ipv6| \
-   ipv4-tos|ipv4-proto|ipv4-ttl|ipv6-tc|ipv6-next-header|ipv6-hop-limits| \
-   tudp-src-port|udp-dst-port|cp-src-port|tcp-dst-port|sctp-src-port| \
-   sctp-dst-port|sctp-veri-tag|none) (select|add)
-
-For example to add source IP to FD input set for flow type of ipv4-udp on port 0::
-
-   testpmd> set_fdir_input_set 0 ipv4-udp src-ipv4 add
-
-global_config
-~~~~~~~~~~~~~
-
-Set different GRE key length for input set::
-
-   global_config (port_id) gre-key-len (number in bytes)
-
-For example to set GRE key length for input set to 4 bytes on port 0::
-
-   testpmd> global_config 0 gre-key-len 4
-
 
 .. _testpmd_rte_flow:
 
@@ -3485,7 +3335,11 @@ following sections.
 
 - Dump internal representation information of all flows in hardware::
 
-   flow dump {port_id} {output_file}
+   flow dump {port_id} all {output_file}
+
+  for one flow::
+
+   flow dump {port_id} rule {rule_id} {output_file}
 
 - List and destroy aged flow rules::
 
@@ -3856,6 +3710,14 @@ This section lists supported pattern items and their attributes, if any.
   - ``vni {unsigned}``: virtual network identifier.
   - ``protocol {unsigned}``: protocol type.
 
+- ``geneve-opt``: match GENEVE header option.
+
+  - ``class {unsigned}``: GENEVE option class.
+  - ``type {unsigned}``: GENEVE option type.
+  - ``length {unsigned}``: GENEVE option length in 32-bit words.
+  - ``data {hex string}``: GENEVE option data, the length is defined by
+    ``length`` field.
+
 - ``vxlan-gpe``: match VXLAN-GPE header.
 
   - ``vni {unsigned}``: VXLAN-GPE identifier.
@@ -4494,7 +4356,7 @@ Creating shared actions
 shared action ID. It is bound to ``rte_flow_shared_action_create()``::
 
    flow shared_action {port_id} create [action_id {shared_action_id}]
-      [ingress] [egress] action {action} / end
+      [ingress] [egress] [transfer] action {action} / end
 
 If successful, it will show::
 
@@ -4602,14 +4464,14 @@ Sample QinQ flow rules
 Before creating QinQ rule(s) the following commands should be issued to enable QinQ::
 
    testpmd> port stop 0
-   testpmd> vlan set qinq_strip on 0
+   testpmd> vlan set extend on 0
 
 The above command sets the inner and outer TPID's to 0x8100.
 
 To change the TPID's the following commands should be used::
 
-   testpmd> vlan set outer tpid 0xa100 0
-   testpmd> vlan set inner tpid 0x9100 0
+   testpmd> vlan set outer tpid 0x88A8 0
+   testpmd> vlan set inner tpid 0x8100 0
    testpmd> port start 0
 
 Validate and create a QinQ rule on port 0 to steer traffic to a VF queue in a VM.
@@ -5004,6 +4866,64 @@ if seid is set)::
  testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is 1
         seid is 1 / end actions queue index 3 / end
 
+Sample Sampling/Mirroring rules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sample/Mirroring rules can be set by the following commands
+
+NIC-RX Sampling rule, the matched ingress packets and sent to the queue 1,
+and 50% packets are duplicated and marked with 0x1234 and sent to queue 0.
+
+::
+
+ testpmd> set sample_actions 0 mark id  0x1234 / queue index 0 / end
+ testpmd> flow create 0 ingress group 1 pattern eth / end actions
+        sample ratio 2 index 0 / queue index 1 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets with encapsulation header are sent to port id 0, and also
+mirrored the packets and sent to port id 2.
+
+::
+
+ testpmd> set sample_actions 0 port_id id 2 / end
+ testpmd> flow create 1 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / raw_encap / port_id id 0 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set sample_actions 0 raw_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+VXLAN encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set vxlan ip-version ipv4 vni 4 udp-src 4 udp-dst 4 ip-src 127.0.0.1
+        ip-dst 128.0.0.1 eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
+ testpmd> set sample_actions 0 vxlan_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
+Mirroring rule with port representors (with "transfer" attribute), the matched
+ingress packets are sent to port id 2, and also mirrored the packets with
+NVGRE encapsulation header and sent to port id 0.
+
+::
+
+ testpmd> set nvgre ip-version ipv4 tni 4 ip-src 127.0.0.1 ip-dst 128.0.0.1
+        eth-src 11:11:11:11:11:11 eth-dst 22:22:22:22:22:22
+ testpmd> set sample_actions 0 nvgre_encap / port_id id 0 / end
+ testpmd> flow create 0 ingress transfer pattern eth / end actions
+        sample ratio 1 index 0  / port_id id 2 / end
+
 BPF Functions
 --------------