Set the packet forwarding mode::
testpmd> set fwd (io|mac|macswap|flowgen| \
- rxonly|txonly|csum|icmpecho|noisy|5tswap) (""|retry)
+ rxonly|txonly|csum|icmpecho|noisy|5tswap|shared-rxq) (""|retry)
``retry`` can be specified for forwarding engines except ``rx_only``.
L4 swaps the source port and destination port of transport layer (TCP and UDP).
+* ``shared-rxq``: Receive only for shared Rx queue.
+ Resolve packet source port from mbuf and update stream statistics accordingly.
+
Example::
testpmd> set fwd rxonly
testpmd> show port (port_id) mcast_macs
+show flow transfer proxy port ID for the given port
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Show proxy port ID to use as the 1st argument in commands to
+manage ``transfer`` flows and their indirect components.
+::
+
+ testpmd> show port (port_id) flow transfer proxy
+
show device info
~~~~~~~~~~~~~~~~
* ``priority`` (0-7): VLAN User Priority.
+set pfc_queue_ctrl
+~~~~~~~~~~~~~~~~~~
+
+Set the priority flow control parameter on a given Rx and Tx queue of a port::
+
+ testpmd> set pfc_queue_ctrl <port_id> rx (on|off) <tx_qid> <tx_tc> \
+ tx (on|off) <rx_qid> <rx_tc> <pause_time>
+
+Where:
+
+* ``tx_qid`` (integer): Tx qid for which ``tx_tc`` will be applied and traffic
+ will be paused when PFC frame is received with ``tx_tc`` enabled.
+
+* ``tx_tc`` (0-15): TC for which traffic is to be paused for xmit.
+
+* ``rx_qid`` (integer): Rx qid for which threshold will be applied and PFC
+ frame will be generated with ``tx_tc`` when exceeds the threshold.
+
+* ``rx_tc`` (0-15): TC filled in PFC frame for which remote Tx is to be paused.
+
+* ``pause_time`` (integer): Pause quanta filled in the PFC frame for which
+ interval, remote Tx will be paused. Valid only if Tx pause is on.
+
set stat_qmap
~~~~~~~~~~~~~
testpmd> set port (port_id) vf (vf_id) rate (rate_value) queue_mask (queue_mask)
-set port - mirror rule
-~~~~~~~~~~~~~~~~~~~~~~
-
-Set pool or vlan type mirror rule for a port::
-
- testpmd> set port (port_id) mirror-rule (rule_id) \
- (pool-mirror-up|pool-mirror-down|vlan-mirror) \
- (poolmask|vlanid[,vlanid]*) dst-pool (pool_id) (on|off)
-
-Set link mirror rule for a port::
-
- testpmd> set port (port_id) mirror-rule (rule_id) \
- (uplink-mirror|downlink-mirror) dst-pool (pool_id) (on|off)
-
-For example to enable mirror traffic with vlan 0,1 to pool 0::
-
- set port 0 mirror-rule 0 vlan-mirror 0,1 dst-pool 0 on
-
-reset port - mirror rule
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-Reset a mirror rule for a port::
-
- testpmd> reset port (port_id) mirror-rule (rule_id)
-
set flush_rx
~~~~~~~~~~~~
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|ecpri|mpls|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|l2tpv2|none)
RSS is on by default.
-The ``all`` option is equivalent to eth|vlan|ip|tcp|udp|sctp|ether|l2tpv3|esp|ah|pfcp.
+The ``all`` option is equivalent to eth|vlan|ip|tcp|udp|sctp|ether|l2tpv3|esp|ah|pfcp|l2tpv2.
The ``default`` option enables all supported RSS types reported by device info.
Active Slaves (3): [1 3 4]
Primary: [3]
+show bonding lacp info
+~~~~~~~~~~~~~~~~~~~~~~
+
+Show information about the Link Bonding device in mode 4 (link-aggregation-802.3ad)::
+
+ testpmd> show bonding lacp info (port_id)
Register Functions
------------------
- ``egress``: rule applies to egress traffic.
- ``transfer``: apply rule directly to endpoints found in pattern.
+Please note that use of ``transfer`` attribute requires that the flow and
+its indirect components be managed via so-called ``transfer`` proxy port.
+See `show flow transfer proxy port ID for the given port`_ for details.
+
Each instance of an attribute specified several times overrides the previous
value as shown below (group 4 is used)::
Indicate tunnel offload rule type
- ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type.
-- ``tunnel_match {tunnel_id}``: mark rule as tunel offload match type.
+- ``tunnel_match {tunnel_id}``: mark rule as tunnel offload match type.
Matching pattern
^^^^^^^^^^^^^^^^
- ``offset {integer}``: absolute or relative offset for pattern.
- ``limit {unsigned}``: search area limit for start of pattern.
- ``pattern {string}``: byte string to look for.
+ - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for.
- ``eth``: match Ethernet header.
- ``value {unsigned}``: key value.
+- ``gre_option``: match GRE optional fields(checksum/key/sequence).
+
+ - ``checksum {unsigned}``: checksum value.
+ - ``key {unsigned}``: key value.
+ - ``sequence {unsigned}``: sequence number value.
+
- ``fuzzy``: fuzzy pattern match, expect faster than default.
- ``thresh {unsigned}``: accuracy threshold.
- ``pdu_type {unsigned}``: PDU type.
- - ``qfi {unsigned}``: PPP, RQI and QoS flow identifier.
+ - ``qfi {unsigned}``: QoS flow identifier.
- ``pppoes``, ``pppoed``: match PPPoE header.
- ``conntrack``: match conntrack state.
+- ``port_representor``: match traffic entering the embedded switch from the given ethdev
+
+ - ``port_id {unsigned}``: ethdev port ID
+
+- ``represented_port``: match traffic entering the embedded switch from
+ the entity represented by the given ethdev
+
+ - ``ethdev_port_id {unsigned}``: ethdev port ID
+
+- ``l2tpv2``: match L2TPv2 header.
+
+ - ``length {unsigned}``: L2TPv2 option length.
+ - ``tunnel_id {unsigned}``: L2TPv2 tunnel identifier.
+ - ``session_id {unsigned}``: L2TPv2 session identifier.
+ - ``ns {unsigned}``: L2TPv2 option ns.
+ - ``nr {unsigned}``: L2TPv2 option nr.
+ - ``offset_size {unsigned}``: L2TPv2 option offset.
+
+- ``ppp``: match PPP header.
+
+ - ``addr {unsigned}``: PPP address.
+ - ``ctrl {unsigned}``: PPP control.
+ - ``proto_id {unsigned}``: PPP protocol identifier.
+
Actions list
^^^^^^^^^^^^
- ``type {value}``: Set color type with specified value(green/yellow/red)
+- ``port_representor``: at embedded switch level, send matching traffic to
+ the given ethdev
+
+ - ``port_id {unsigned}``: ethdev port ID
+
+- ``represented_port``: at embedded switch level, send matching traffic to
+ the entity represented by the given ethdev
+
+ - ``ethdev_port_id {unsigned}``: ethdev port ID
+
Destroying flow rules
~~~~~~~~~~~~~~~~~~~~~
testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end
+Sample L2TPv2 RSS rules
+~~~~~~~~~~~~~~~~~~~~~~~
+
+L2TPv2 RSS rules can be created by the following commands::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
+ / end actions rss types l2tpv2 end queues end / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / end
+ actions rss types eth l2-src-only end queues end / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / end
+ actions rss types l2tpv2 end queues end / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
+ / end actions rss types ipv4 end queues end / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv6
+ / udp / end actions rss types ipv6-udp end queues end / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv4
+ / tcp / end actions rss types ipv4-tcp end queues end / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
+ / end actions rss types ipv6 end queues end / end
+
+Sample L2TPv2 FDIR rules
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+L2TPv2 FDIR rules can be created by the following commands::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
+ session_id is 0x1111 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth src is 00:00:00:00:00:01 / ipv4
+ / udp / l2tpv2 type data / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type data
+ session_id is 0x1111 / ppp / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
+ src is 10.0.0.1 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
+ dst is ABAB:910B:6666:3457:8295:3333:1800:2929 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
+ / udp src is 22 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
+ / tcp dst is 23 / end actions queue index 3 / end
+
+Sample RAW rule
+~~~~~~~~~~~~~~~
+
+A RAW rule can be created as following using ``pattern_hex`` key and mask.
+
+::
+
+ testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset
+ is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a
+ pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions
+ queue index 4 / end
+
BPF Functions
--------------
.. code-block:: console
testpmd> bpf-unload tx 0 0
+
+Flex Item Functions
+-------------------
+
+The following sections show functions that configure and create flex item object,
+create flex pattern and use it in a flow rule.
+The commands will use 20 bytes IPv4 header for examples:
+
+::
+
+ 0 1 2 3
+ 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
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | ver | IHL | TOS | length | +0
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | identification | flg | frag. offset | +4
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | TTL | protocol | checksum | +8
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | source IP address | +12
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | destination IP address | +16
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Create flex item
+~~~~~~~~~~~~~~~~
+
+Flex item object is created by PMD according to a new header configuration. The
+header configuration is compiled by the testpmd and stored in
+``rte_flow_item_flex_conf`` type variable.
+
+::
+
+ # flow flex_item create <port> <flex id> <configuration file>
+ testpmd> flow flex_item init 0 3 ipv4_flex_config.json
+ port-0: created flex item #3
+
+Flex item configuration is kept in external JSON file.
+It describes the following header elements:
+
+**New header length.**
+
+Specify whether the new header has fixed or variable length and the basic/minimal
+header length value.
+
+If header length is not fixed, header location with a value that completes header
+length calculation and scale/offset function must be added.
+
+Scale function depends on port hardware.
+
+**Next protocol.**
+
+Describes location in the new header that specify following network header type.
+
+**Flow match samples.**
+
+Describes locations in the new header that will be used in flow rules.
+
+Number of flow samples and sample maximal length depend of port hardware.
+
+**Input trigger.**
+
+Describes preceding network header configuration.
+
+**Output trigger.**
+
+Describes conditions that trigger transfer to following network header
+
+.. code-block:: json
+
+ {
+ "next_header": { "field_mode": "FIELD_MODE_FIXED", "field_size": 20},
+ "next_protocol": {"field_size": 8, "field_base": 72},
+ "sample_data": [
+ { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 0},
+ { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 32},
+ { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 64},
+ { "field_mode": "FIELD_MODE_FIXED", "field_size": 32, "field_base": 96}
+ ],
+ "input_link": [
+ {"item": "eth type is 0x0800"},
+ {"item": "vlan inner_type is 0x0800"}
+ ],
+ "output_link": [
+ {"item": "udp", "next": 17},
+ {"item": "tcp", "next": 6},
+ {"item": "icmp", "next": 1}
+ ]
+ }
+
+
+Flex pattern and flow rules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Flex pattern describe parts of network header that will trigger flex flow item hit in a flow rule.
+Flex pattern directly related to flex item samples configuration.
+Flex pattern can be shared between ports.
+
+**Flex pattern and flow rule to match IPv4 version and 20 bytes length**
+
+::
+
+ # set flex_pattern <pattern_id> is <hex bytes sequence>
+ testpmd> flow flex_item pattern 5 is 45FF
+ created pattern #5
+
+ 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
+ Flow rule #0 created
+
+**Flex pattern and flow rule to match packets with source address 1.2.3.4**
+
+::
+
+ testpmd> flow flex_item pattern 2 spec 45000000000000000000000001020304 mask FF0000000000000000000000FFFFFFFF
+ created pattern #2
+
+ 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
+ Flow rule #0 created