2018-05-01 20:07:11 +00:00
|
|
|
.. SPDX-License-Identifier: BSD-3-Clause
|
2016-12-21 14:51:18 +00:00
|
|
|
Copyright 2016 6WIND S.A.
|
2018-05-01 20:07:11 +00:00
|
|
|
Copyright 2016 Mellanox Technologies, Ltd
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Generic flow API (rte_flow)
|
|
|
|
===========================
|
|
|
|
|
|
|
|
Overview
|
|
|
|
--------
|
|
|
|
|
|
|
|
This API provides a generic means to configure hardware to match specific
|
2021-10-13 17:34:42 +00:00
|
|
|
traffic, alter its fate and query related counters according to any
|
|
|
|
number of user-defined rules.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
It is named *rte_flow* after the prefix used for all its symbols, and is
|
|
|
|
defined in ``rte_flow.h``.
|
|
|
|
|
|
|
|
- Matching can be performed on packet data (protocol headers, payload) and
|
|
|
|
properties (e.g. associated physical port, virtual device function ID).
|
|
|
|
|
|
|
|
- Possible operations include dropping traffic, diverting it to specific
|
|
|
|
queues, to virtual/physical device functions or ports, performing tunnel
|
|
|
|
offloads, adding marks and so on.
|
|
|
|
|
|
|
|
Flow rule
|
|
|
|
---------
|
|
|
|
|
|
|
|
Description
|
|
|
|
~~~~~~~~~~~
|
|
|
|
|
|
|
|
A flow rule is the combination of attributes with a matching pattern and a
|
|
|
|
list of actions. Flow rules form the basis of this API.
|
|
|
|
|
|
|
|
Flow rules can have several distinct actions (such as counting,
|
|
|
|
encapsulating, decapsulating before redirecting packets to a particular
|
|
|
|
queue, etc.), instead of relying on several rules to achieve this and having
|
|
|
|
applications deal with hardware implementation details regarding their
|
|
|
|
order.
|
|
|
|
|
|
|
|
Support for different priority levels on a rule basis is provided, for
|
|
|
|
example in order to force a more specific rule to come before a more generic
|
|
|
|
one for packets matched by both. However hardware support for more than a
|
|
|
|
single priority level cannot be guaranteed. When supported, the number of
|
|
|
|
available priority levels is usually low, which is why they can also be
|
|
|
|
implemented in software by PMDs (e.g. missing priority levels may be
|
|
|
|
emulated by reordering rules).
|
|
|
|
|
|
|
|
In order to remain as hardware-agnostic as possible, by default all rules
|
|
|
|
are considered to have the same priority, which means that the order between
|
|
|
|
overlapping rules (when a packet is matched by several filters) is
|
|
|
|
undefined.
|
|
|
|
|
|
|
|
PMDs may refuse to create overlapping rules at a given priority level when
|
|
|
|
they can be detected (e.g. if a pattern matches an existing filter).
|
|
|
|
|
|
|
|
Thus predictable results for a given priority level can only be achieved
|
|
|
|
with non-overlapping rules, using perfect matching on all protocol layers.
|
|
|
|
|
|
|
|
Flow rules can also be grouped, the flow rule priority is specific to the
|
2018-04-26 17:29:17 +00:00
|
|
|
group they belong to. All flow rules in a given group are thus processed within
|
|
|
|
the context of that group. Groups are not linked by default, so the logical
|
|
|
|
hierarchy of groups must be explicitly defined by flow rules themselves in each
|
|
|
|
group using the JUMP action to define the next group to redirect too. Only flow
|
|
|
|
rules defined in the default group 0 are guarantee to be matched against, this
|
|
|
|
makes group 0 the origin of any group hierarchy defined by an application.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Support for multiple actions per rule may be implemented internally on top
|
|
|
|
of non-default hardware priorities, as a result both features may not be
|
|
|
|
simultaneously available to applications.
|
|
|
|
|
|
|
|
Considering that allowed pattern/actions combinations cannot be known in
|
|
|
|
advance and would result in an impractically large number of capabilities to
|
|
|
|
expose, a method is provided to validate a given rule from the current
|
|
|
|
device configuration state.
|
|
|
|
|
|
|
|
This enables applications to check if the rule types they need is supported
|
|
|
|
at initialization time, before starting their data path. This method can be
|
|
|
|
used anytime, its only requirement being that the resources needed by a rule
|
|
|
|
should exist (e.g. a target RX queue should be configured first).
|
|
|
|
|
|
|
|
Each defined rule is associated with an opaque handle managed by the PMD,
|
|
|
|
applications are responsible for keeping it. These can be used for queries
|
|
|
|
and rules management, such as retrieving counters or other data and
|
|
|
|
destroying them.
|
|
|
|
|
|
|
|
To avoid resource leaks on the PMD side, handles must be explicitly
|
|
|
|
destroyed by the application before releasing associated resources such as
|
|
|
|
queues and ports.
|
|
|
|
|
ethdev: add capability to keep flow rules on restart
Previously, it was not specified what happens to the flow rules
when the device is stopped, possibly reconfigured, then started.
If flow rules were kept, it could be convenient for application
developers, because they wouldn't need to save and restore them.
However, due to the number of flows and possible creation rate it is
impractical to save all flow rules in DPDK layer. This means that flow
rules persistence really depends on whether PMD and HW can implement it
efficiently. It can also be limited by the rule item and action types,
and its attributes transfer bit (a combination of an item/action type
and a value of the transfer bit is called a rule feature).
Add a device capability bit for PMDs that can keep at least some
of the flow rules across restart. Without this capability behavior
is still unspecified and it is declared that the application must
flush the rules before stopping the device.
Allow the application to test for persistence of rules using
a particular feature by attempting to create a flow rule
using that feature when the device is stopped
and checking for the specific error.
This is logical because if the PMD can to create the flow rule
when the device is not started and use it after the start happens,
it is natural that it can move its internal flow rule object
to the same state when the device is stopped and restore the state
when the device is started.
Rule persistence across a reconfigurations is not required,
because tracking all the rules and configuration-dependent resources
they use may be infeasible. In case a PMD cannot keep the rules
across reconfiguration, it is allowed just to report an error.
Application must then flush the rules before attempting it.
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2021-11-02 17:01:30 +00:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
The following description of rule persistence is an experimental behavior
|
|
|
|
that may change without a prior notice.
|
|
|
|
|
|
|
|
When the device is stopped, its rules do not process the traffic.
|
|
|
|
In particular, transfer rules created using some device
|
|
|
|
stop affecting the traffic even if they refer to different ports.
|
|
|
|
|
|
|
|
If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised,
|
|
|
|
rules cannot be created until the device is started for the first time
|
|
|
|
and cannot be kept when the device is stopped.
|
|
|
|
However, PMD also does not flush them automatically on stop,
|
|
|
|
so the application must call ``rte_flow_flush()`` or ``rte_flow_destroy()``
|
|
|
|
before stopping the device to ensure no rules remain.
|
|
|
|
|
|
|
|
If ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is advertised, this means
|
|
|
|
the PMD can keep at least some rules across the device stop and start.
|
|
|
|
However, ``rte_eth_dev_configure()`` may fail if any rules remain,
|
|
|
|
so the application must flush them before attempting a reconfiguration.
|
|
|
|
Keeping may be unsupported for some types of rule items and actions,
|
|
|
|
as well as depending on the value of flow attributes transfer bit.
|
|
|
|
A combination of a single an item or action type
|
|
|
|
and a value of the transfer bit is called a rule feature.
|
|
|
|
For example: a COUNT action with the transfer bit set.
|
|
|
|
To test if rules with a particular feature are kept, the application must try
|
|
|
|
to create a valid rule using this feature when the device is not started
|
|
|
|
(either before the first start or after a stop).
|
|
|
|
If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``,
|
|
|
|
all rules using this feature must be flushed by the application
|
|
|
|
before stopping the device.
|
|
|
|
If it succeeds, such rules will be kept when the device is stopped,
|
|
|
|
provided they do not use other features that are not supported.
|
|
|
|
Rules that are created when the device is stopped, including the rules
|
|
|
|
created for the test, will be kept after the device is started.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
The following sections cover:
|
|
|
|
|
|
|
|
- **Attributes** (represented by ``struct rte_flow_attr``): properties of a
|
|
|
|
flow rule such as its direction (ingress or egress) and priority.
|
|
|
|
|
|
|
|
- **Pattern item** (represented by ``struct rte_flow_item``): part of a
|
|
|
|
matching pattern that either matches specific packet data or traffic
|
|
|
|
properties. It can also describe properties of the pattern itself, such as
|
|
|
|
inverted matching.
|
|
|
|
|
|
|
|
- **Matching pattern**: traffic properties to look for, a combination of any
|
|
|
|
number of items.
|
|
|
|
|
|
|
|
- **Actions** (represented by ``struct rte_flow_action``): operations to
|
|
|
|
perform whenever a packet is matched by a pattern.
|
|
|
|
|
|
|
|
Attributes
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
Attribute: Group
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-04-26 17:29:17 +00:00
|
|
|
Flow rules can be grouped by assigning them a common group number. Groups
|
|
|
|
allow a logical hierarchy of flow rule groups (tables) to be defined. These
|
|
|
|
groups can be supported virtually in the PMD or in the physical device.
|
|
|
|
Group 0 is the default group and this is the only group which flows are
|
|
|
|
guarantee to matched against, all subsequent groups can only be reached by
|
|
|
|
way of the JUMP action from a matched flow rule.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Although optional, applications are encouraged to group similar rules as
|
|
|
|
much as possible to fully take advantage of hardware capabilities
|
|
|
|
(e.g. optimized matching) and work around limitations (e.g. a single pattern
|
2018-04-26 17:29:17 +00:00
|
|
|
type possibly allowed in a given group), while being aware that the groups
|
|
|
|
hierarchies must be programmed explicitly.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Note that support for more than a single group is not guaranteed.
|
|
|
|
|
|
|
|
Attribute: Priority
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-04-26 17:29:17 +00:00
|
|
|
A priority level can be assigned to a flow rule, lower values
|
2016-12-21 14:51:18 +00:00
|
|
|
denote higher priority, with 0 as the maximum.
|
|
|
|
|
2018-04-26 17:29:17 +00:00
|
|
|
Priority levels are arbitrary and up to the application, they do
|
2016-12-21 14:51:18 +00:00
|
|
|
not need to be contiguous nor start from 0, however the maximum number
|
|
|
|
varies between devices and may be affected by existing flow rules.
|
|
|
|
|
2018-04-26 17:29:17 +00:00
|
|
|
A flow which matches multiple rules in the same group will always matched by
|
|
|
|
the rule with the highest priority in that group.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
If a packet is matched by several rules of a given group for a given
|
|
|
|
priority level, the outcome is undefined. It can take any path, may be
|
|
|
|
duplicated or even cause unrecoverable errors.
|
|
|
|
|
|
|
|
Note that support for more than a single priority level is not guaranteed.
|
|
|
|
|
|
|
|
Attribute: Traffic direction
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2021-10-13 17:34:42 +00:00
|
|
|
Unless `Attribute: Transfer`_ is specified, flow rule patterns apply
|
|
|
|
to inbound and / or outbound traffic. With this respect, ``ingress``
|
|
|
|
and ``egress`` respectively stand for **inbound** and **outbound**
|
|
|
|
based on the standpoint of the application creating a flow rule.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Several pattern items and actions are valid and can be used in both
|
|
|
|
directions. At least one direction must be specified.
|
|
|
|
|
|
|
|
Specifying both directions at once for a given rule is not recommended but
|
2021-10-08 10:26:15 +00:00
|
|
|
may be valid in a few cases.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:28:01 +00:00
|
|
|
Attribute: Transfer
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Instead of simply matching the properties of traffic as it would appear on a
|
|
|
|
given DPDK port ID, enabling this attribute transfers a flow rule to the
|
|
|
|
lowest possible level of any device endpoints found in the pattern.
|
|
|
|
|
|
|
|
When supported, this effectively enables an application to reroute traffic
|
|
|
|
not necessarily intended for it (e.g. coming from or addressed to different
|
|
|
|
physical ports, VFs or applications) at the device level.
|
|
|
|
|
2021-10-13 17:34:42 +00:00
|
|
|
In "transfer" flows, the use of `Attribute: Traffic direction`_ in the sense of
|
|
|
|
implicitly matching packets going to or going from the ethdev used to create
|
|
|
|
flow rules is **deprecated**. `Attribute: Transfer`_ shifts the viewpoint to
|
|
|
|
the embedded switch. In it, `Attribute: Traffic direction`_ is ambiguous as
|
|
|
|
the switch serves many different endpoints. The application should match
|
|
|
|
traffic originating from precise locations. To do so, it should
|
|
|
|
use `Item: PORT_REPRESENTOR`_ and `Item: REPRESENTED_PORT`_.
|
2018-04-25 15:28:01 +00:00
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
Pattern item
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Pattern items fall in two categories:
|
|
|
|
|
2018-04-25 15:27:41 +00:00
|
|
|
- Matching protocol headers and packet data, usually associated with a
|
|
|
|
specification structure. These must be stacked in the same order as the
|
|
|
|
protocol layers to match inside packets, starting from the lowest.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:41 +00:00
|
|
|
- Matching meta-data or affecting pattern processing, often without a
|
|
|
|
specification structure. Since they do not match packet contents, their
|
|
|
|
position in the list is usually not relevant.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Item specification structures are used to match specific values among
|
|
|
|
protocol fields (or item properties). Documentation describes for each item
|
|
|
|
whether they are associated with one and their type name if so.
|
|
|
|
|
|
|
|
Up to three structures of the same type can be set for a given item:
|
|
|
|
|
|
|
|
- ``spec``: values to match (e.g. a given IPv4 address).
|
|
|
|
|
|
|
|
- ``last``: upper bound for an inclusive range with corresponding fields in
|
|
|
|
``spec``.
|
|
|
|
|
|
|
|
- ``mask``: bit-mask applied to both ``spec`` and ``last`` whose purpose is
|
|
|
|
to distinguish the values to take into account and/or partially mask them
|
|
|
|
out (e.g. in order to match an IPv4 address prefix).
|
|
|
|
|
|
|
|
Usage restrictions and expected behavior:
|
|
|
|
|
|
|
|
- Setting either ``mask`` or ``last`` without ``spec`` is an error.
|
|
|
|
|
|
|
|
- Field values in ``last`` which are either 0 or equal to the corresponding
|
|
|
|
values in ``spec`` are ignored; they do not generate a range. Nonzero
|
|
|
|
values lower than those in ``spec`` are not supported.
|
|
|
|
|
|
|
|
- Setting ``spec`` and optionally ``last`` without ``mask`` causes the PMD
|
2017-01-10 13:08:30 +00:00
|
|
|
to use the default mask defined for that item (defined as
|
|
|
|
``rte_flow_item_{name}_mask`` constants).
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2017-01-10 13:08:30 +00:00
|
|
|
- Not setting any of them (assuming item type allows it) is equivalent to
|
|
|
|
providing an empty (zeroed) ``mask`` for broad (nonspecific) matching.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
- ``mask`` is a simple bit-mask applied before interpreting the contents of
|
|
|
|
``spec`` and ``last``, which may yield unexpected results if not used
|
|
|
|
carefully. For example, if for an IPv4 address field, ``spec`` provides
|
|
|
|
*10.1.2.3*, ``last`` provides *10.3.4.5* and ``mask`` provides
|
|
|
|
*255.255.0.0*, the effective range becomes *10.1.0.0* to *10.3.255.255*.
|
|
|
|
|
|
|
|
Example of an item specification matching an Ethernet header:
|
|
|
|
|
|
|
|
.. _table_rte_flow_pattern_item_example:
|
|
|
|
|
|
|
|
.. table:: Ethernet item
|
|
|
|
|
2019-07-17 19:44:18 +00:00
|
|
|
+----------+----------+-----------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+==========+=======================+
|
|
|
|
| ``spec`` | ``src`` | ``00:00:01:02:03:04`` |
|
|
|
|
| +----------+-----------------------+
|
|
|
|
| | ``dst`` | ``00:00:2a:66:00:01`` |
|
|
|
|
| +----------+-----------------------+
|
|
|
|
| | ``type`` | ``0x22aa`` |
|
|
|
|
+----------+----------+-----------------------+
|
|
|
|
| ``last`` | unspecified |
|
|
|
|
+----------+----------+-----------------------+
|
|
|
|
| ``mask`` | ``src`` | ``00:00:ff:ff:ff:00`` |
|
|
|
|
| +----------+-----------------------+
|
|
|
|
| | ``dst`` | ``00:00:00:00:00:ff`` |
|
|
|
|
| +----------+-----------------------+
|
|
|
|
| | ``type`` | ``0x0000`` |
|
|
|
|
+----------+----------+-----------------------+
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Non-masked bits stand for any value (shown as ``?`` below), Ethernet headers
|
|
|
|
with the following properties are thus matched:
|
|
|
|
|
2019-07-17 19:44:18 +00:00
|
|
|
- ``src``: ``??:??:01:02:03:??``
|
|
|
|
- ``dst``: ``??:??:??:??:??:01``
|
2016-12-21 14:51:18 +00:00
|
|
|
- ``type``: ``0x????``
|
|
|
|
|
|
|
|
Matching pattern
|
|
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
A pattern is formed by stacking items starting from the lowest protocol
|
|
|
|
layer to match. This stacking restriction does not apply to meta items which
|
|
|
|
can be placed anywhere in the stack without affecting the meaning of the
|
|
|
|
resulting pattern.
|
|
|
|
|
|
|
|
Patterns are terminated by END items.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
.. _table_rte_flow_tcpv4_as_l4:
|
|
|
|
|
|
|
|
.. table:: TCPv4 as L4
|
|
|
|
|
|
|
|
+-------+----------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+==========+
|
|
|
|
| 0 | Ethernet |
|
|
|
|
+-------+----------+
|
|
|
|
| 1 | IPv4 |
|
|
|
|
+-------+----------+
|
|
|
|
| 2 | TCP |
|
|
|
|
+-------+----------+
|
|
|
|
| 3 | END |
|
|
|
|
+-------+----------+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _table_rte_flow_tcpv6_in_vxlan:
|
|
|
|
|
|
|
|
.. table:: TCPv6 in VXLAN
|
|
|
|
|
|
|
|
+-------+------------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+============+
|
|
|
|
| 0 | Ethernet |
|
|
|
|
+-------+------------+
|
|
|
|
| 1 | IPv4 |
|
|
|
|
+-------+------------+
|
|
|
|
| 2 | UDP |
|
|
|
|
+-------+------------+
|
|
|
|
| 3 | VXLAN |
|
|
|
|
+-------+------------+
|
|
|
|
| 4 | Ethernet |
|
|
|
|
+-------+------------+
|
|
|
|
| 5 | IPv6 |
|
|
|
|
+-------+------------+
|
|
|
|
| 6 | TCP |
|
|
|
|
+-------+------------+
|
|
|
|
| 7 | END |
|
|
|
|
+-------+------------+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _table_rte_flow_tcpv4_as_l4_meta:
|
|
|
|
|
|
|
|
.. table:: TCPv4 as L4 with meta items
|
|
|
|
|
|
|
|
+-------+----------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+==========+
|
|
|
|
| 0 | VOID |
|
|
|
|
+-------+----------+
|
|
|
|
| 1 | Ethernet |
|
|
|
|
+-------+----------+
|
|
|
|
| 2 | VOID |
|
|
|
|
+-------+----------+
|
|
|
|
| 3 | IPv4 |
|
|
|
|
+-------+----------+
|
|
|
|
| 4 | TCP |
|
|
|
|
+-------+----------+
|
|
|
|
| 5 | VOID |
|
|
|
|
+-------+----------+
|
|
|
|
| 6 | VOID |
|
|
|
|
+-------+----------+
|
|
|
|
| 7 | END |
|
|
|
|
+-------+----------+
|
|
|
|
|
|
|
|
The above example shows how meta items do not affect packet data matching
|
|
|
|
items, as long as those remain stacked properly. The resulting matching
|
|
|
|
pattern is identical to "TCPv4 as L4".
|
|
|
|
|
|
|
|
.. _table_rte_flow_udpv6_anywhere:
|
|
|
|
|
|
|
|
.. table:: UDPv6 anywhere
|
|
|
|
|
|
|
|
+-------+------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+======+
|
|
|
|
| 0 | IPv6 |
|
|
|
|
+-------+------+
|
|
|
|
| 1 | UDP |
|
|
|
|
+-------+------+
|
|
|
|
| 2 | END |
|
|
|
|
+-------+------+
|
|
|
|
|
|
|
|
If supported by the PMD, omitting one or several protocol layers at the
|
|
|
|
bottom of the stack as in the above example (missing an Ethernet
|
|
|
|
specification) enables looking up anywhere in packets.
|
|
|
|
|
|
|
|
It is unspecified whether the payload of supported encapsulations
|
|
|
|
(e.g. VXLAN payload) is matched by such a pattern, which may apply to inner,
|
|
|
|
outer or both packets.
|
|
|
|
|
|
|
|
.. _table_rte_flow_invalid_l3:
|
|
|
|
|
|
|
|
.. table:: Invalid, missing L3
|
|
|
|
|
|
|
|
+-------+----------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+==========+
|
|
|
|
| 0 | Ethernet |
|
|
|
|
+-------+----------+
|
|
|
|
| 1 | UDP |
|
|
|
|
+-------+----------+
|
|
|
|
| 2 | END |
|
|
|
|
+-------+----------+
|
|
|
|
|
|
|
|
The above pattern is invalid due to a missing L3 specification between L2
|
|
|
|
(Ethernet) and L4 (UDP). Doing so is only allowed at the bottom and at the
|
|
|
|
top of the stack.
|
|
|
|
|
|
|
|
Meta item types
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
They match meta-data or affect pattern processing instead of matching packet
|
|
|
|
data directly, most of them do not need a specification structure. This
|
|
|
|
particularity allows them to be specified anywhere in the stack without
|
|
|
|
causing any side effect.
|
|
|
|
|
|
|
|
Item: ``END``
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
End marker for item lists. Prevents further processing of items, thereby
|
|
|
|
ending the pattern.
|
|
|
|
|
|
|
|
- Its numeric value is 0 for convenience.
|
|
|
|
- PMD support is mandatory.
|
|
|
|
- ``spec``, ``last`` and ``mask`` are ignored.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_end:
|
|
|
|
|
|
|
|
.. table:: END
|
|
|
|
|
|
|
|
+----------+---------+
|
|
|
|
| Field | Value |
|
|
|
|
+==========+=========+
|
|
|
|
| ``spec`` | ignored |
|
|
|
|
+----------+---------+
|
|
|
|
| ``last`` | ignored |
|
|
|
|
+----------+---------+
|
|
|
|
| ``mask`` | ignored |
|
|
|
|
+----------+---------+
|
|
|
|
|
|
|
|
Item: ``VOID``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Used as a placeholder for convenience. It is ignored and simply discarded by
|
|
|
|
PMDs.
|
|
|
|
|
|
|
|
- PMD support is mandatory.
|
|
|
|
- ``spec``, ``last`` and ``mask`` are ignored.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_void:
|
|
|
|
|
|
|
|
.. table:: VOID
|
|
|
|
|
|
|
|
+----------+---------+
|
|
|
|
| Field | Value |
|
|
|
|
+==========+=========+
|
|
|
|
| ``spec`` | ignored |
|
|
|
|
+----------+---------+
|
|
|
|
| ``last`` | ignored |
|
|
|
|
+----------+---------+
|
|
|
|
| ``mask`` | ignored |
|
|
|
|
+----------+---------+
|
|
|
|
|
|
|
|
One usage example for this type is generating rules that share a common
|
|
|
|
prefix quickly without reallocating memory, only by updating item types:
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_void_example:
|
|
|
|
|
|
|
|
.. table:: TCP, UDP or ICMP as L4
|
|
|
|
|
|
|
|
+-------+--------------------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+====================+
|
|
|
|
| 0 | Ethernet |
|
|
|
|
+-------+--------------------+
|
|
|
|
| 1 | IPv4 |
|
|
|
|
+-------+------+------+------+
|
|
|
|
| 2 | UDP | VOID | VOID |
|
|
|
|
+-------+------+------+------+
|
|
|
|
| 3 | VOID | TCP | VOID |
|
|
|
|
+-------+------+------+------+
|
|
|
|
| 4 | VOID | VOID | ICMP |
|
|
|
|
+-------+------+------+------+
|
|
|
|
| 5 | END |
|
|
|
|
+-------+--------------------+
|
|
|
|
|
|
|
|
Item: ``INVERT``
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Inverted matching, i.e. process packets that do not match the pattern.
|
|
|
|
|
|
|
|
- ``spec``, ``last`` and ``mask`` are ignored.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_invert:
|
|
|
|
|
|
|
|
.. table:: INVERT
|
|
|
|
|
|
|
|
+----------+---------+
|
|
|
|
| Field | Value |
|
|
|
|
+==========+=========+
|
|
|
|
| ``spec`` | ignored |
|
|
|
|
+----------+---------+
|
|
|
|
| ``last`` | ignored |
|
|
|
|
+----------+---------+
|
|
|
|
| ``mask`` | ignored |
|
|
|
|
+----------+---------+
|
|
|
|
|
|
|
|
Usage example, matching non-TCPv4 packets only:
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_invert_example:
|
|
|
|
|
|
|
|
.. table:: Anything but TCPv4
|
|
|
|
|
|
|
|
+-------+----------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+==========+
|
|
|
|
| 0 | INVERT |
|
|
|
|
+-------+----------+
|
|
|
|
| 1 | Ethernet |
|
|
|
|
+-------+----------+
|
|
|
|
| 2 | IPv4 |
|
|
|
|
+-------+----------+
|
|
|
|
| 3 | TCP |
|
|
|
|
+-------+----------+
|
|
|
|
| 4 | END |
|
|
|
|
+-------+----------+
|
|
|
|
|
|
|
|
Item: ``PF``
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
2021-10-13 17:34:41 +00:00
|
|
|
This item is deprecated. Consider:
|
|
|
|
- `Item: PORT_REPRESENTOR`_
|
|
|
|
- `Item: REPRESENTED_PORT`_
|
|
|
|
|
2018-04-25 15:28:03 +00:00
|
|
|
Matches traffic originating from (ingress) or going to (egress) the physical
|
|
|
|
function of the current device.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:28:03 +00:00
|
|
|
If supported, should work even if the physical function is not managed by
|
|
|
|
the application and thus not associated with a DPDK port ID.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
- Can be combined with any number of `Item: VF`_ to match both PF and VF
|
|
|
|
traffic.
|
|
|
|
- ``spec``, ``last`` and ``mask`` must not be set.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_pf:
|
|
|
|
|
|
|
|
.. table:: PF
|
|
|
|
|
|
|
|
+----------+-------+
|
|
|
|
| Field | Value |
|
|
|
|
+==========+=======+
|
|
|
|
| ``spec`` | unset |
|
|
|
|
+----------+-------+
|
|
|
|
| ``last`` | unset |
|
|
|
|
+----------+-------+
|
|
|
|
| ``mask`` | unset |
|
|
|
|
+----------+-------+
|
|
|
|
|
|
|
|
Item: ``VF``
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
2021-10-13 17:34:41 +00:00
|
|
|
This item is deprecated. Consider:
|
|
|
|
- `Item: PORT_REPRESENTOR`_
|
|
|
|
- `Item: REPRESENTED_PORT`_
|
|
|
|
|
2018-04-25 15:28:03 +00:00
|
|
|
Matches traffic originating from (ingress) or going to (egress) a given
|
|
|
|
virtual function of the current device.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:28:03 +00:00
|
|
|
If supported, should work even if the virtual function is not managed by the
|
|
|
|
application and thus not associated with a DPDK port ID.
|
|
|
|
|
|
|
|
Note this pattern item does not match VF representors traffic which, as
|
|
|
|
separate entities, should be addressed through their own DPDK port IDs.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
- Can be specified multiple times to match traffic addressed to several VF
|
|
|
|
IDs.
|
|
|
|
- Can be combined with a PF item to match both PF and VF traffic.
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches any VF ID.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
.. _table_rte_flow_item_vf:
|
|
|
|
|
|
|
|
.. table:: VF
|
|
|
|
|
|
|
|
+----------+----------+---------------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+==========+===========================+
|
|
|
|
| ``spec`` | ``id`` | destination VF ID |
|
|
|
|
+----------+----------+---------------------------+
|
|
|
|
| ``last`` | ``id`` | upper range value |
|
|
|
|
+----------+----------+---------------------------+
|
|
|
|
| ``mask`` | ``id`` | zeroed to match any VF ID |
|
|
|
|
+----------+----------+---------------------------+
|
|
|
|
|
2018-04-25 15:28:06 +00:00
|
|
|
Item: ``PHY_PORT``
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2021-10-13 17:34:41 +00:00
|
|
|
This item is deprecated. Consider:
|
|
|
|
- `Item: PORT_REPRESENTOR`_
|
|
|
|
- `Item: REPRESENTED_PORT`_
|
|
|
|
|
2018-04-25 15:28:06 +00:00
|
|
|
Matches traffic originating from (ingress) or going to (egress) a physical
|
|
|
|
port of the underlying device.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:28:06 +00:00
|
|
|
The first PHY_PORT item overrides the physical port normally associated with
|
|
|
|
the specified DPDK input port (port_id). This item can be provided several
|
|
|
|
times to match additional physical ports.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Note that physical ports are not necessarily tied to DPDK input ports
|
|
|
|
(port_id) when those are not under DPDK control. Possible values are
|
|
|
|
specific to each device, they are not necessarily indexed from zero and may
|
|
|
|
not be contiguous.
|
|
|
|
|
|
|
|
As a device property, the list of allowed values as well as the value
|
|
|
|
associated with a port_id should be retrieved by other means.
|
|
|
|
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches any port index.
|
|
|
|
|
2018-04-25 15:28:06 +00:00
|
|
|
.. _table_rte_flow_item_phy_port:
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:28:06 +00:00
|
|
|
.. table:: PHY_PORT
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
+----------+-----------+--------------------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+===========+================================+
|
|
|
|
| ``spec`` | ``index`` | physical port index |
|
|
|
|
+----------+-----------+--------------------------------+
|
|
|
|
| ``last`` | ``index`` | upper range value |
|
|
|
|
+----------+-----------+--------------------------------+
|
|
|
|
| ``mask`` | ``index`` | zeroed to match any port index |
|
|
|
|
+----------+-----------+--------------------------------+
|
|
|
|
|
2018-04-25 15:28:10 +00:00
|
|
|
Item: ``PORT_ID``
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
2021-10-13 17:34:41 +00:00
|
|
|
This item is deprecated. Consider:
|
|
|
|
- `Item: PORT_REPRESENTOR`_
|
|
|
|
- `Item: REPRESENTED_PORT`_
|
|
|
|
|
2018-04-25 15:28:10 +00:00
|
|
|
Matches traffic originating from (ingress) or going to (egress) a given DPDK
|
|
|
|
port ID.
|
|
|
|
|
|
|
|
Normally only supported if the port ID in question is known by the
|
|
|
|
underlying PMD and related to the device the flow rule is created against.
|
|
|
|
|
|
|
|
This must not be confused with `Item: PHY_PORT`_ which refers to the
|
|
|
|
physical port of a device, whereas `Item: PORT_ID`_ refers to a ``struct
|
|
|
|
rte_eth_dev`` object on the application side (also known as "port
|
|
|
|
representor" depending on the kind of underlying device).
|
|
|
|
|
|
|
|
- Default ``mask`` matches the specified DPDK port ID.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_port_id:
|
|
|
|
|
|
|
|
.. table:: PORT_ID
|
|
|
|
|
|
|
|
+----------+----------+-----------------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+==========+=============================+
|
|
|
|
| ``spec`` | ``id`` | DPDK port ID |
|
|
|
|
+----------+----------+-----------------------------+
|
|
|
|
| ``last`` | ``id`` | upper range value |
|
|
|
|
+----------+----------+-----------------------------+
|
|
|
|
| ``mask`` | ``id`` | zeroed to match any port ID |
|
|
|
|
+----------+----------+-----------------------------+
|
|
|
|
|
2018-04-26 17:29:18 +00:00
|
|
|
Item: ``MARK``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an arbitrary integer value which was set using the ``MARK`` action in
|
|
|
|
a previously matched rule.
|
|
|
|
|
|
|
|
This item can only specified once as a match criteria as the ``MARK`` action can
|
|
|
|
only be specified once in a flow action.
|
|
|
|
|
|
|
|
Note the value of MARK field is arbitrary and application defined.
|
|
|
|
|
|
|
|
Depending on the underlying implementation the MARK item may be supported on
|
|
|
|
the physical device, with virtual groups in the PMD or not at all.
|
|
|
|
|
|
|
|
- Default ``mask`` matches any integer value.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_mark:
|
|
|
|
|
|
|
|
.. table:: MARK
|
|
|
|
|
|
|
|
+----------+----------+---------------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+==========+===========================+
|
|
|
|
| ``spec`` | ``id`` | integer value |
|
|
|
|
+----------+--------------------------------------+
|
|
|
|
| ``last`` | ``id`` | upper range value |
|
|
|
|
+----------+----------+---------------------------+
|
|
|
|
| ``mask`` | ``id`` | zeroed to match any value |
|
|
|
|
+----------+----------+---------------------------+
|
|
|
|
|
2019-10-27 18:42:28 +00:00
|
|
|
Item: ``TAG``
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches tag item set by other flows. Multiple tags are supported by specifying
|
|
|
|
``index``.
|
|
|
|
|
|
|
|
- Default ``mask`` matches the specified tag value and index.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_tag:
|
|
|
|
|
|
|
|
.. table:: TAG
|
|
|
|
|
|
|
|
+----------+----------+----------------------------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+===========+=======================================+
|
|
|
|
| ``spec`` | ``data`` | 32 bit flow tag value |
|
|
|
|
| +-----------+---------------------------------------+
|
|
|
|
| | ``index`` | index of flow tag |
|
|
|
|
+----------+-----------+---------------------------------------+
|
|
|
|
| ``last`` | ``data`` | upper range value |
|
|
|
|
| +-----------+---------------------------------------+
|
|
|
|
| | ``index`` | field is ignored |
|
|
|
|
+----------+-----------+---------------------------------------+
|
|
|
|
| ``mask`` | ``data`` | bit-mask applies to "spec" and "last" |
|
|
|
|
| +-----------+---------------------------------------+
|
|
|
|
| | ``index`` | field is ignored |
|
|
|
|
+----------+-----------+---------------------------------------+
|
|
|
|
|
ethdev: extend flow metadata
Currently, metadata can be set on egress path via mbuf tx_metadata field
with PKT_TX_METADATA flag and RTE_FLOW_ITEM_TYPE_META matches metadata.
This patch extends the metadata feature usability.
1) RTE_FLOW_ACTION_TYPE_SET_META
When supporting multiple tables, Tx metadata can also be set by a rule and
matched by another rule. This new action allows metadata to be set as a
result of flow match.
2) Metadata on ingress
There's also need to support metadata on ingress. Metadata can be set by
SET_META action and matched by META item like Tx. The final value set by
the action will be delivered to application via metadata dynamic field of
mbuf which can be accessed by RTE_FLOW_DYNF_METADATA() macro or with
rte_flow_dynf_metadata_set() and rte_flow_dynf_metadata_get() helper
routines. PKT_RX_DYNF_METADATA flag will be set along with the data.
The mbuf dynamic field must be registered by calling
rte_flow_dynf_metadata_register() prior to use SET_META action.
The availability of dynamic mbuf metadata field can be checked
with rte_flow_dynf_metadata_avail() routine.
If application is going to engage the metadata feature it registers
the metadata dynamic fields, then PMD checks the metadata field
availability and handles the appropriate fields in datapath.
For loopback/hairpin packet, metadata set on Rx/Tx may or may not be
propagated to the other path depending on hardware capability.
MARK and METADATA look similar and might operate in similar way,
but not interacting.
Initially, there were proposed two metadata related actions:
- RTE_FLOW_ACTION_TYPE_FLAG
- RTE_FLOW_ACTION_TYPE_MARK
These actions set the special flag in the packet metadata, MARK action
stores some specified value in the metadata storage, and, on the packet
receiving PMD puts the flag and value to the mbuf and applications can
see the packet was threated inside flow engine according to the appropriate
RTE flow(s). MARK and FLAG are like some kind of gateway to transfer some
per-packet information from the flow engine to the application via
receiving datapath. Also, there is the item of type RTE_FLOW_ITEM_TYPE_MARK
provided. It allows us to extend the flow match pattern with the capability
to match the metadata values set by MARK/FLAG actions on other flows.
From the datapath point of view, the MARK and FLAG are related to the
receiving side only. It would useful to have the same gateway on the
transmitting side and there was the feature of type RTE_FLOW_ITEM_TYPE_META
was proposed. The application can fill the field in mbuf and this value
will be transferred to some field in the packet metadata inside the flow
engine. It did not matter whether these metadata fields are shared because
of MARK and META items belonged to different domains (receiving and
transmitting) and could be vendor-specific.
So far, so good, DPDK proposes some entities to control metadata inside
the flow engine and gateways to exchange these values on a per-packet basis
via datapaths.
As we can see, the MARK and META means are not symmetric, there is absent
action which would allow us to set META value on the transmitting path.
So, the action of type:
- RTE_FLOW_ACTION_TYPE_SET_META was proposed.
The next, applications raise the new requirements for packet metadata.
The flow ngines are getting more complex, internal switches are introduced,
multiple ports might be supported within the same flow engine namespace.
From the DPDK points of view, it means the packets might be sent on one
eth_dev port and received on the other one, and the packet path inside
the flow engine entirely belongs to the same hardware device. The simplest
example is SR-IOV with PF, VFs and the representors. And there is a
brilliant opportunity to provide some out-of-band channel to transfer
some extra data from one port to another one, besides the packet data
itself. And applications would like to use this opportunity.
It is supposed for application to use trials (with rte_flow_validate)
to detect which metadata features (FLAG, MARK, META) actually supported
by PMD and underlying hardware. It might depend on PMD configuration,
system software, hardware settings, etc., and should be detected
in run time.
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ori Kam <orika@mellanox.com>
2019-11-05 14:19:30 +00:00
|
|
|
Item: ``META``
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches 32 bit metadata item set.
|
|
|
|
|
|
|
|
On egress, metadata can be set either by mbuf metadata field with
|
2021-10-15 19:24:08 +00:00
|
|
|
RTE_MBUF_DYNFLAG_TX_METADATA flag or ``SET_META`` action. On ingress, ``SET_META``
|
ethdev: extend flow metadata
Currently, metadata can be set on egress path via mbuf tx_metadata field
with PKT_TX_METADATA flag and RTE_FLOW_ITEM_TYPE_META matches metadata.
This patch extends the metadata feature usability.
1) RTE_FLOW_ACTION_TYPE_SET_META
When supporting multiple tables, Tx metadata can also be set by a rule and
matched by another rule. This new action allows metadata to be set as a
result of flow match.
2) Metadata on ingress
There's also need to support metadata on ingress. Metadata can be set by
SET_META action and matched by META item like Tx. The final value set by
the action will be delivered to application via metadata dynamic field of
mbuf which can be accessed by RTE_FLOW_DYNF_METADATA() macro or with
rte_flow_dynf_metadata_set() and rte_flow_dynf_metadata_get() helper
routines. PKT_RX_DYNF_METADATA flag will be set along with the data.
The mbuf dynamic field must be registered by calling
rte_flow_dynf_metadata_register() prior to use SET_META action.
The availability of dynamic mbuf metadata field can be checked
with rte_flow_dynf_metadata_avail() routine.
If application is going to engage the metadata feature it registers
the metadata dynamic fields, then PMD checks the metadata field
availability and handles the appropriate fields in datapath.
For loopback/hairpin packet, metadata set on Rx/Tx may or may not be
propagated to the other path depending on hardware capability.
MARK and METADATA look similar and might operate in similar way,
but not interacting.
Initially, there were proposed two metadata related actions:
- RTE_FLOW_ACTION_TYPE_FLAG
- RTE_FLOW_ACTION_TYPE_MARK
These actions set the special flag in the packet metadata, MARK action
stores some specified value in the metadata storage, and, on the packet
receiving PMD puts the flag and value to the mbuf and applications can
see the packet was threated inside flow engine according to the appropriate
RTE flow(s). MARK and FLAG are like some kind of gateway to transfer some
per-packet information from the flow engine to the application via
receiving datapath. Also, there is the item of type RTE_FLOW_ITEM_TYPE_MARK
provided. It allows us to extend the flow match pattern with the capability
to match the metadata values set by MARK/FLAG actions on other flows.
From the datapath point of view, the MARK and FLAG are related to the
receiving side only. It would useful to have the same gateway on the
transmitting side and there was the feature of type RTE_FLOW_ITEM_TYPE_META
was proposed. The application can fill the field in mbuf and this value
will be transferred to some field in the packet metadata inside the flow
engine. It did not matter whether these metadata fields are shared because
of MARK and META items belonged to different domains (receiving and
transmitting) and could be vendor-specific.
So far, so good, DPDK proposes some entities to control metadata inside
the flow engine and gateways to exchange these values on a per-packet basis
via datapaths.
As we can see, the MARK and META means are not symmetric, there is absent
action which would allow us to set META value on the transmitting path.
So, the action of type:
- RTE_FLOW_ACTION_TYPE_SET_META was proposed.
The next, applications raise the new requirements for packet metadata.
The flow ngines are getting more complex, internal switches are introduced,
multiple ports might be supported within the same flow engine namespace.
From the DPDK points of view, it means the packets might be sent on one
eth_dev port and received on the other one, and the packet path inside
the flow engine entirely belongs to the same hardware device. The simplest
example is SR-IOV with PF, VFs and the representors. And there is a
brilliant opportunity to provide some out-of-band channel to transfer
some extra data from one port to another one, besides the packet data
itself. And applications would like to use this opportunity.
It is supposed for application to use trials (with rte_flow_validate)
to detect which metadata features (FLAG, MARK, META) actually supported
by PMD and underlying hardware. It might depend on PMD configuration,
system software, hardware settings, etc., and should be detected
in run time.
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ori Kam <orika@mellanox.com>
2019-11-05 14:19:30 +00:00
|
|
|
action sets metadata for a packet and the metadata will be reported via
|
2021-10-15 19:24:08 +00:00
|
|
|
``metadata`` dynamic field of ``rte_mbuf`` with RTE_MBUF_DYNFLAG_RX_METADATA flag.
|
ethdev: extend flow metadata
Currently, metadata can be set on egress path via mbuf tx_metadata field
with PKT_TX_METADATA flag and RTE_FLOW_ITEM_TYPE_META matches metadata.
This patch extends the metadata feature usability.
1) RTE_FLOW_ACTION_TYPE_SET_META
When supporting multiple tables, Tx metadata can also be set by a rule and
matched by another rule. This new action allows metadata to be set as a
result of flow match.
2) Metadata on ingress
There's also need to support metadata on ingress. Metadata can be set by
SET_META action and matched by META item like Tx. The final value set by
the action will be delivered to application via metadata dynamic field of
mbuf which can be accessed by RTE_FLOW_DYNF_METADATA() macro or with
rte_flow_dynf_metadata_set() and rte_flow_dynf_metadata_get() helper
routines. PKT_RX_DYNF_METADATA flag will be set along with the data.
The mbuf dynamic field must be registered by calling
rte_flow_dynf_metadata_register() prior to use SET_META action.
The availability of dynamic mbuf metadata field can be checked
with rte_flow_dynf_metadata_avail() routine.
If application is going to engage the metadata feature it registers
the metadata dynamic fields, then PMD checks the metadata field
availability and handles the appropriate fields in datapath.
For loopback/hairpin packet, metadata set on Rx/Tx may or may not be
propagated to the other path depending on hardware capability.
MARK and METADATA look similar and might operate in similar way,
but not interacting.
Initially, there were proposed two metadata related actions:
- RTE_FLOW_ACTION_TYPE_FLAG
- RTE_FLOW_ACTION_TYPE_MARK
These actions set the special flag in the packet metadata, MARK action
stores some specified value in the metadata storage, and, on the packet
receiving PMD puts the flag and value to the mbuf and applications can
see the packet was threated inside flow engine according to the appropriate
RTE flow(s). MARK and FLAG are like some kind of gateway to transfer some
per-packet information from the flow engine to the application via
receiving datapath. Also, there is the item of type RTE_FLOW_ITEM_TYPE_MARK
provided. It allows us to extend the flow match pattern with the capability
to match the metadata values set by MARK/FLAG actions on other flows.
From the datapath point of view, the MARK and FLAG are related to the
receiving side only. It would useful to have the same gateway on the
transmitting side and there was the feature of type RTE_FLOW_ITEM_TYPE_META
was proposed. The application can fill the field in mbuf and this value
will be transferred to some field in the packet metadata inside the flow
engine. It did not matter whether these metadata fields are shared because
of MARK and META items belonged to different domains (receiving and
transmitting) and could be vendor-specific.
So far, so good, DPDK proposes some entities to control metadata inside
the flow engine and gateways to exchange these values on a per-packet basis
via datapaths.
As we can see, the MARK and META means are not symmetric, there is absent
action which would allow us to set META value on the transmitting path.
So, the action of type:
- RTE_FLOW_ACTION_TYPE_SET_META was proposed.
The next, applications raise the new requirements for packet metadata.
The flow ngines are getting more complex, internal switches are introduced,
multiple ports might be supported within the same flow engine namespace.
From the DPDK points of view, it means the packets might be sent on one
eth_dev port and received on the other one, and the packet path inside
the flow engine entirely belongs to the same hardware device. The simplest
example is SR-IOV with PF, VFs and the representors. And there is a
brilliant opportunity to provide some out-of-band channel to transfer
some extra data from one port to another one, besides the packet data
itself. And applications would like to use this opportunity.
It is supposed for application to use trials (with rte_flow_validate)
to detect which metadata features (FLAG, MARK, META) actually supported
by PMD and underlying hardware. It might depend on PMD configuration,
system software, hardware settings, etc., and should be detected
in run time.
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ori Kam <orika@mellanox.com>
2019-11-05 14:19:30 +00:00
|
|
|
|
|
|
|
- Default ``mask`` matches the specified Rx metadata value.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_meta:
|
|
|
|
|
|
|
|
.. table:: META
|
|
|
|
|
|
|
|
+----------+----------+---------------------------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+==========+=======================================+
|
|
|
|
| ``spec`` | ``data`` | 32 bit metadata value |
|
|
|
|
+----------+----------+---------------------------------------+
|
|
|
|
| ``last`` | ``data`` | upper range value |
|
|
|
|
+----------+----------+---------------------------------------+
|
|
|
|
| ``mask`` | ``data`` | bit-mask applies to "spec" and "last" |
|
|
|
|
+----------+----------+---------------------------------------+
|
|
|
|
|
|
|
|
Data matching item types
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Most of these are basically protocol header definitions with associated
|
|
|
|
bit-masks. They must be specified (stacked) from lowest to highest protocol
|
|
|
|
layer to form a matching pattern.
|
|
|
|
|
|
|
|
Item: ``ANY``
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches any protocol in place of the current layer, a single ANY may also
|
|
|
|
stand for several protocol layers.
|
|
|
|
|
|
|
|
This is usually specified as the first pattern item when looking for a
|
|
|
|
protocol anywhere in a packet.
|
|
|
|
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` stands for any number of layers.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
.. _table_rte_flow_item_any:
|
|
|
|
|
|
|
|
.. table:: ANY
|
|
|
|
|
|
|
|
+----------+----------+--------------------------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+==========+======================================+
|
|
|
|
| ``spec`` | ``num`` | number of layers covered |
|
|
|
|
+----------+----------+--------------------------------------+
|
|
|
|
| ``last`` | ``num`` | upper range value |
|
|
|
|
+----------+----------+--------------------------------------+
|
|
|
|
| ``mask`` | ``num`` | zeroed to cover any number of layers |
|
|
|
|
+----------+----------+--------------------------------------+
|
|
|
|
|
|
|
|
Example for VXLAN TCP payload matching regardless of outer L3 (IPv4 or IPv6)
|
|
|
|
and L4 (UDP) both matched by the first ANY specification, and inner L3 (IPv4
|
|
|
|
or IPv6) matched by the second ANY specification:
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_any_example:
|
|
|
|
|
|
|
|
.. table:: TCP in VXLAN with wildcards
|
|
|
|
|
|
|
|
+-------+------+----------+----------+-------+
|
|
|
|
| Index | Item | Field | Subfield | Value |
|
|
|
|
+=======+======+==========+==========+=======+
|
|
|
|
| 0 | Ethernet |
|
|
|
|
+-------+------+----------+----------+-------+
|
|
|
|
| 1 | ANY | ``spec`` | ``num`` | 2 |
|
|
|
|
+-------+------+----------+----------+-------+
|
|
|
|
| 2 | VXLAN |
|
|
|
|
+-------+------------------------------------+
|
|
|
|
| 3 | Ethernet |
|
|
|
|
+-------+------+----------+----------+-------+
|
|
|
|
| 4 | ANY | ``spec`` | ``num`` | 1 |
|
|
|
|
+-------+------+----------+----------+-------+
|
|
|
|
| 5 | TCP |
|
|
|
|
+-------+------------------------------------+
|
|
|
|
| 6 | END |
|
|
|
|
+-------+------------------------------------+
|
|
|
|
|
|
|
|
Item: ``RAW``
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a byte string of a given length at a given offset.
|
|
|
|
|
|
|
|
Offset is either absolute (using the start of the packet) or relative to the
|
|
|
|
end of the previous matched item in the stack, in which case negative values
|
|
|
|
are allowed.
|
|
|
|
|
|
|
|
If search is enabled, offset is used as the starting point. The search area
|
|
|
|
can be delimited by setting limit to a nonzero value, which is the maximum
|
|
|
|
number of bytes after offset where the pattern may start.
|
|
|
|
|
|
|
|
Matching a zero-length pattern is allowed, doing so resets the relative
|
|
|
|
offset for subsequent items.
|
|
|
|
|
|
|
|
- This type does not support ranges (``last`` field).
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches all fields exactly.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
.. _table_rte_flow_item_raw:
|
|
|
|
|
|
|
|
.. table:: RAW
|
|
|
|
|
|
|
|
+----------+--------------+-------------------------------------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+==============+=================================================+
|
|
|
|
| ``spec`` | ``relative`` | look for pattern after the previous item |
|
|
|
|
| +--------------+-------------------------------------------------+
|
|
|
|
| | ``search`` | search pattern from offset (see also ``limit``) |
|
|
|
|
| +--------------+-------------------------------------------------+
|
|
|
|
| | ``reserved`` | reserved, must be set to zero |
|
|
|
|
| +--------------+-------------------------------------------------+
|
|
|
|
| | ``offset`` | absolute or relative offset for ``pattern`` |
|
|
|
|
| +--------------+-------------------------------------------------+
|
|
|
|
| | ``limit`` | search area limit for start of ``pattern`` |
|
|
|
|
| +--------------+-------------------------------------------------+
|
|
|
|
| | ``length`` | ``pattern`` length |
|
|
|
|
| +--------------+-------------------------------------------------+
|
|
|
|
| | ``pattern`` | byte string to look for |
|
|
|
|
+----------+--------------+-------------------------------------------------+
|
|
|
|
| ``last`` | if specified, either all 0 or with the same values as ``spec`` |
|
|
|
|
+----------+----------------------------------------------------------------+
|
|
|
|
| ``mask`` | bit-mask applied to ``spec`` values with usual behavior |
|
|
|
|
+----------+----------------------------------------------------------------+
|
|
|
|
|
|
|
|
Example pattern looking for several strings at various offsets of a UDP
|
|
|
|
payload, using combined RAW items:
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_raw_example:
|
|
|
|
|
|
|
|
.. table:: UDP payload matching
|
|
|
|
|
|
|
|
+-------+------+----------+--------------+-------+
|
|
|
|
| Index | Item | Field | Subfield | Value |
|
|
|
|
+=======+======+==========+==============+=======+
|
|
|
|
| 0 | Ethernet |
|
|
|
|
+-------+----------------------------------------+
|
|
|
|
| 1 | IPv4 |
|
|
|
|
+-------+----------------------------------------+
|
|
|
|
| 2 | UDP |
|
|
|
|
+-------+------+----------+--------------+-------+
|
|
|
|
| 3 | RAW | ``spec`` | ``relative`` | 1 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``search`` | 1 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``offset`` | 10 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``limit`` | 0 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``length`` | 3 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``pattern`` | "foo" |
|
|
|
|
+-------+------+----------+--------------+-------+
|
|
|
|
| 4 | RAW | ``spec`` | ``relative`` | 1 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``search`` | 0 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``offset`` | 20 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``limit`` | 0 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``length`` | 3 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``pattern`` | "bar" |
|
|
|
|
+-------+------+----------+--------------+-------+
|
|
|
|
| 5 | RAW | ``spec`` | ``relative`` | 1 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``search`` | 0 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``offset`` | -29 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``limit`` | 0 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``length`` | 3 |
|
|
|
|
| | | +--------------+-------+
|
|
|
|
| | | | ``pattern`` | "baz" |
|
|
|
|
+-------+------+----------+--------------+-------+
|
|
|
|
| 6 | END |
|
|
|
|
+-------+----------------------------------------+
|
|
|
|
|
|
|
|
This translates to:
|
|
|
|
|
|
|
|
- Locate "foo" at least 10 bytes deep inside UDP payload.
|
|
|
|
- Locate "bar" after "foo" plus 20 bytes.
|
|
|
|
- Locate "baz" after "bar" minus 29 bytes.
|
|
|
|
|
|
|
|
Such a packet may be represented as follows (not to scale)::
|
|
|
|
|
|
|
|
0 >= 10 B == 20 B
|
|
|
|
| |<--------->| |<--------->|
|
|
|
|
| | | | |
|
|
|
|
|-----|------|-----|-----|-----|-----|-----------|-----|------|
|
|
|
|
| ETH | IPv4 | UDP | ... | baz | foo | ......... | bar | .... |
|
|
|
|
|-----|------|-----|-----|-----|-----|-----------|-----|------|
|
|
|
|
| |
|
|
|
|
|<--------------------------->|
|
|
|
|
== 29 B
|
|
|
|
|
|
|
|
Note that matching subsequent pattern items would resume after "baz", not
|
|
|
|
"bar" since matching is always performed after the previous item of the
|
|
|
|
stack.
|
|
|
|
|
|
|
|
Item: ``ETH``
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an Ethernet header.
|
|
|
|
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
The ``type`` field either stands for "EtherType" or "TPID" when followed by
|
|
|
|
so-called layer 2.5 pattern items such as ``RTE_FLOW_ITEM_TYPE_VLAN``. In
|
|
|
|
the latter case, ``type`` refers to that of the outer header, with the inner
|
|
|
|
EtherType/TPID provided by the subsequent pattern item. This is the same
|
|
|
|
order as on the wire.
|
2020-05-03 07:17:22 +00:00
|
|
|
If the ``type`` field contains a TPID value, then only tagged packets with the
|
|
|
|
specified TPID will match the pattern.
|
2020-10-15 15:51:46 +00:00
|
|
|
The field ``has_vlan`` can be used to match any type of tagged packets,
|
|
|
|
instead of using the ``type`` field.
|
|
|
|
If the ``type`` and ``has_vlan`` fields are not specified, then both tagged
|
|
|
|
and untagged packets will match the pattern.
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
- ``dst``: destination MAC.
|
|
|
|
- ``src``: source MAC.
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
- ``type``: EtherType or TPID.
|
2020-10-15 15:51:46 +00:00
|
|
|
- ``has_vlan``: packet header contains at least one VLAN.
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches destination and source addresses only.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Item: ``VLAN``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an 802.1Q/ad VLAN tag.
|
|
|
|
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
The corresponding standard outer EtherType (TPID) values are
|
2019-05-21 16:13:05 +00:00
|
|
|
``RTE_ETHER_TYPE_VLAN`` or ``RTE_ETHER_TYPE_QINQ``. It can be overridden by the
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
preceding pattern item.
|
2020-05-03 07:17:22 +00:00
|
|
|
If a ``VLAN`` item is present in the pattern, then only tagged packets will
|
|
|
|
match the pattern.
|
2020-10-15 15:51:46 +00:00
|
|
|
The field ``has_more_vlan`` can be used to match any type of tagged packets,
|
|
|
|
instead of using the ``inner_type field``.
|
|
|
|
If the ``inner_type`` and ``has_more_vlan`` fields are not specified,
|
|
|
|
then any tagged packets will match the pattern.
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
- ``tci``: tag control information.
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
- ``inner_type``: inner EtherType or TPID.
|
2020-10-15 15:51:46 +00:00
|
|
|
- ``has_more_vlan``: packet header contains at least one more VLAN, after this VLAN.
|
2018-04-25 15:27:58 +00:00
|
|
|
- Default ``mask`` matches the VID part of TCI only (lower 12 bits).
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Item: ``IPV4``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an IPv4 header.
|
|
|
|
|
|
|
|
Note: IPv4 options are handled by dedicated pattern items.
|
|
|
|
|
|
|
|
- ``hdr``: IPv4 header definition (``rte_ip.h``).
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches source and destination addresses only.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Item: ``IPV6``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an IPv6 header.
|
|
|
|
|
ethdev: add extensions attributes to IPv6 item
Using the current implementation of DPDK, an application cannot match on
IPv6 packets, based on the existing extension headers, in a simple way.
Field 'Next Header' in IPv6 header indicates type of the first extension
header only. Following extension headers can't be identified by
inspecting the IPv6 header.
As a result, the existence or absence of specific extension headers
can't be used for packet matching.
For example, fragmented IPv6 packets contain a dedicated extension header
(which is implemented in a later patch of this series).
Non-fragmented packets don't contain the fragment extension header.
For an application to match on non-fragmented IPv6 packets, the current
implementation doesn't provide a suitable solution.
Matching on the Next Header field is not sufficient, since additional
extension headers might be present in the same packet.
To match on fragmented IPv6 packets, the same difficulty exists.
This patch implements the update as detailed in RFC [1].
A set of additional values will be added to IPv6 header struct.
These values will indicate the existence of every defined extension
header type, providing simple means for identification of existing
extensions in the packet header.
Continuing the above example, fragmented packets can be identified using
the specific value indicating existence of fragment extension header.
To match on non-fragmented IPv6 packets, need to use has_frag_ext 0.
To match on fragmented IPv6 packets, need to use has_frag_ext 1.
To match on any IPv6 packets, the has_frag_ext field should
not be specified for match.
[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html
Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2020-10-14 16:35:47 +00:00
|
|
|
Dedicated flags indicate if header contains specific extension headers.
|
|
|
|
To match on packets containing a specific extension header, an application
|
|
|
|
should match on the dedicated flag set to 1.
|
|
|
|
To match on packets not containing a specific extension header, an application
|
|
|
|
should match on the dedicated flag clear to 0.
|
|
|
|
In case application doesn't care about the existence of a specific extension
|
|
|
|
header, it should not specify the dedicated flag for matching.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
- ``hdr``: IPv6 header definition (``rte_ip.h``).
|
ethdev: add extensions attributes to IPv6 item
Using the current implementation of DPDK, an application cannot match on
IPv6 packets, based on the existing extension headers, in a simple way.
Field 'Next Header' in IPv6 header indicates type of the first extension
header only. Following extension headers can't be identified by
inspecting the IPv6 header.
As a result, the existence or absence of specific extension headers
can't be used for packet matching.
For example, fragmented IPv6 packets contain a dedicated extension header
(which is implemented in a later patch of this series).
Non-fragmented packets don't contain the fragment extension header.
For an application to match on non-fragmented IPv6 packets, the current
implementation doesn't provide a suitable solution.
Matching on the Next Header field is not sufficient, since additional
extension headers might be present in the same packet.
To match on fragmented IPv6 packets, the same difficulty exists.
This patch implements the update as detailed in RFC [1].
A set of additional values will be added to IPv6 header struct.
These values will indicate the existence of every defined extension
header type, providing simple means for identification of existing
extensions in the packet header.
Continuing the above example, fragmented packets can be identified using
the specific value indicating existence of fragment extension header.
To match on non-fragmented IPv6 packets, need to use has_frag_ext 0.
To match on fragmented IPv6 packets, need to use has_frag_ext 1.
To match on any IPv6 packets, the has_frag_ext field should
not be specified for match.
[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html
Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2020-10-14 16:35:47 +00:00
|
|
|
- ``has_hop_ext``: header contains Hop-by-Hop Options extension header.
|
|
|
|
- ``has_route_ext``: header contains Routing extension header.
|
|
|
|
- ``has_frag_ext``: header contains Fragment extension header.
|
|
|
|
- ``has_auth_ext``: header contains Authentication extension header.
|
|
|
|
- ``has_esp_ext``: header contains Encapsulation Security Payload extension header.
|
|
|
|
- ``has_dest_ext``: header contains Destination Options extension header.
|
|
|
|
- ``has_mobil_ext``: header contains Mobility extension header.
|
|
|
|
- ``has_hip_ext``: header contains Host Identity Protocol extension header.
|
|
|
|
- ``has_shim6_ext``: header contains Shim6 Protocol extension header.
|
|
|
|
- Default ``mask`` matches ``hdr`` source and destination addresses only.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Item: ``ICMP``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an ICMP header.
|
|
|
|
|
|
|
|
- ``hdr``: ICMP header definition (``rte_icmp.h``).
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches ICMP type and code only.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Item: ``UDP``
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a UDP header.
|
|
|
|
|
|
|
|
- ``hdr``: UDP header definition (``rte_udp.h``).
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches source and destination ports only.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Item: ``TCP``
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a TCP header.
|
|
|
|
|
|
|
|
- ``hdr``: TCP header definition (``rte_tcp.h``).
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches source and destination ports only.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Item: ``SCTP``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a SCTP header.
|
|
|
|
|
|
|
|
- ``hdr``: SCTP header definition (``rte_sctp.h``).
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches source and destination ports only.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Item: ``VXLAN``
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a VXLAN header (RFC 7348).
|
|
|
|
|
|
|
|
- ``flags``: normally 0x08 (I flag).
|
|
|
|
- ``rsvd0``: reserved, normally 0x000000.
|
|
|
|
- ``vni``: VXLAN network identifier.
|
|
|
|
- ``rsvd1``: reserved, normally 0x00.
|
2017-01-10 13:08:30 +00:00
|
|
|
- Default ``mask`` matches VNI only.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2017-04-26 12:07:21 +00:00
|
|
|
Item: ``E_TAG``
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an IEEE 802.1BR E-Tag header.
|
|
|
|
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
The corresponding standard outer EtherType (TPID) value is
|
2019-05-21 16:13:05 +00:00
|
|
|
``RTE_ETHER_TYPE_ETAG``. It can be overridden by the preceding pattern item.
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
|
2017-04-26 12:07:21 +00:00
|
|
|
- ``epcp_edei_in_ecid_b``: E-Tag control information (E-TCI), E-PCP (3b),
|
|
|
|
E-DEI (1b), ingress E-CID base (12b).
|
|
|
|
- ``rsvd_grp_ecid_b``: reserved (2b), GRP (2b), E-CID base (12b).
|
|
|
|
- ``in_ecid_e``: ingress E-CID ext.
|
|
|
|
- ``ecid_e``: E-CID ext.
|
ethdev: fix TPID handling in flow API
TPID handling in rte_flow VLAN and E_TAG pattern item definitions is not
consistent with the normal stacking order of pattern items, which is
confusing to applications.
Problem is that when followed by one of these layers, the EtherType field
of the preceding layer keeps its "inner" definition, and the "outer" TPID
is provided by the subsequent layer, the reverse of how a packet looks like
on the wire:
Wire: [ ETH TPID = A | VLAN EtherType = B | B DATA ]
rte_flow: [ ETH EtherType = B | VLAN TPID = A | B DATA ]
Worse, when QinQ is involved, the stacking order of VLAN layers is
unspecified. It is unclear whether it should be reversed (innermost to
outermost) as well given TPID applies to the previous layer:
Wire: [ ETH TPID = A | VLAN TPID = B | VLAN EtherType = C | C DATA ]
rte_flow 1: [ ETH EtherType = C | VLAN TPID = B | VLAN TPID = A | C DATA ]
rte_flow 2: [ ETH EtherType = C | VLAN TPID = A | VLAN TPID = B | C DATA ]
While specifying EtherType/TPID is hopefully rarely necessary, the stacking
order in case of QinQ and the lack of documentation remain an issue.
This patch replaces TPID in the VLAN pattern item with an inner
EtherType/TPID as is usually done everywhere else (e.g. struct vlan_hdr),
clarifies documentation and updates all relevant code.
It breaks ABI compatibility for the following public functions:
- rte_flow_copy()
- rte_flow_create()
- rte_flow_query()
- rte_flow_validate()
Summary of changes for PMDs that implement ETH, VLAN or E_TAG pattern
items:
- bnxt: EtherType matching is supported with and without VLAN, but TPID
matching is not and triggers an error.
- e1000: EtherType matching is only supported with the ETHERTYPE filter,
which does not support VLAN matching, therefore no impact.
- enic: same as bnxt.
- i40e: same as bnxt with existing FDIR limitations on allowed EtherType
values. The remaining filter types (VXLAN, NVGRE, QINQ) do not support
EtherType matching.
- ixgbe: same as e1000, with additional minor change to rely on the new
E-Tag macro definition.
- mlx4: EtherType/TPID matching is not supported, no impact.
- mlx5: same as bnxt.
- mvpp2: same as bnxt.
- sfc: same as bnxt.
- tap: same as bnxt.
Fixes: b1a4b4cbc0a8 ("ethdev: introduce generic flow API")
Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-04-25 15:27:56 +00:00
|
|
|
- ``inner_type``: inner EtherType or TPID.
|
2017-04-26 12:07:21 +00:00
|
|
|
- Default ``mask`` simultaneously matches GRP and E-CID base.
|
|
|
|
|
|
|
|
Item: ``NVGRE``
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a NVGRE header (RFC 7637).
|
|
|
|
|
|
|
|
- ``c_k_s_rsvd0_ver``: checksum (1b), undefined (1b), key bit (1b),
|
|
|
|
sequence number (1b), reserved 0 (9b), version (3b). This field must have
|
|
|
|
value 0x2000 according to RFC 7637.
|
|
|
|
- ``protocol``: protocol type (0x6558).
|
|
|
|
- ``tni``: virtual subnet ID.
|
|
|
|
- ``flow_id``: flow ID.
|
|
|
|
- Default ``mask`` matches TNI only.
|
|
|
|
|
2017-03-30 08:29:51 +00:00
|
|
|
Item: ``MPLS``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a MPLS header.
|
|
|
|
|
|
|
|
- ``label_tc_s_ttl``: label, TC, Bottom of Stack and TTL.
|
|
|
|
- Default ``mask`` matches label only.
|
|
|
|
|
|
|
|
Item: ``GRE``
|
2017-07-06 06:32:19 +00:00
|
|
|
^^^^^^^^^^^^^
|
2017-03-30 08:29:51 +00:00
|
|
|
|
|
|
|
Matches a GRE header.
|
|
|
|
|
|
|
|
- ``c_rsvd0_ver``: checksum, reserved 0 and version.
|
|
|
|
- ``protocol``: protocol type.
|
|
|
|
- Default ``mask`` matches protocol only.
|
|
|
|
|
2019-07-05 09:54:23 +00:00
|
|
|
Item: ``GRE_KEY``
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a GRE key field.
|
|
|
|
This should be preceded by item ``GRE``.
|
|
|
|
|
|
|
|
- Value to be matched is a big-endian 32 bit integer.
|
|
|
|
- When this item present it implicitly match K bit in default mask as "1"
|
|
|
|
|
2017-06-13 03:07:05 +00:00
|
|
|
Item: ``FUZZY``
|
2017-07-06 06:32:19 +00:00
|
|
|
^^^^^^^^^^^^^^^
|
2017-06-13 03:07:05 +00:00
|
|
|
|
|
|
|
Fuzzy pattern match, expect faster than default.
|
|
|
|
|
|
|
|
This is for device that support fuzzy match option. Usually a fuzzy match is
|
|
|
|
fast but the cost is accuracy. i.e. Signature Match only match pattern's hash
|
|
|
|
value, but it is possible two different patterns have the same hash value.
|
|
|
|
|
|
|
|
Matching accuracy level can be configured by threshold. Driver can divide the
|
|
|
|
range of threshold and map to different accuracy levels that device support.
|
|
|
|
|
2017-07-06 06:32:19 +00:00
|
|
|
Threshold 0 means perfect match (no fuzziness), while threshold 0xffffffff
|
|
|
|
means fuzziest match.
|
|
|
|
|
2017-06-13 03:07:05 +00:00
|
|
|
.. _table_rte_flow_item_fuzzy:
|
|
|
|
|
|
|
|
.. table:: FUZZY
|
|
|
|
|
|
|
|
+----------+---------------+--------------------------------------------------+
|
|
|
|
| Field | Subfield | Value |
|
2017-07-06 06:32:19 +00:00
|
|
|
+==========+===============+==================================================+
|
2017-06-13 03:07:05 +00:00
|
|
|
| ``spec`` | ``threshold`` | 0 as perfect match, 0xffffffff as fuzziest match |
|
|
|
|
+----------+---------------+--------------------------------------------------+
|
|
|
|
| ``last`` | ``threshold`` | upper range value |
|
2017-07-06 06:32:19 +00:00
|
|
|
+----------+---------------+--------------------------------------------------+
|
2017-06-13 03:07:05 +00:00
|
|
|
| ``mask`` | ``threshold`` | bit-mask apply to "spec" and "last" |
|
2017-07-06 06:32:19 +00:00
|
|
|
+----------+---------------+--------------------------------------------------+
|
2017-06-13 03:07:05 +00:00
|
|
|
|
|
|
|
Usage example, fuzzy match a TCPv4 packets:
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_fuzzy_example:
|
|
|
|
|
|
|
|
.. table:: Fuzzy matching
|
|
|
|
|
|
|
|
+-------+----------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+==========+
|
|
|
|
| 0 | FUZZY |
|
|
|
|
+-------+----------+
|
|
|
|
| 1 | Ethernet |
|
|
|
|
+-------+----------+
|
|
|
|
| 2 | IPv4 |
|
|
|
|
+-------+----------+
|
|
|
|
| 3 | TCP |
|
|
|
|
+-------+----------+
|
|
|
|
| 4 | END |
|
|
|
|
+-------+----------+
|
|
|
|
|
2017-10-05 08:14:53 +00:00
|
|
|
Item: ``GTP``, ``GTPC``, ``GTPU``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a GTPv1 header.
|
|
|
|
|
|
|
|
Note: GTP, GTPC and GTPU use the same structure. GTPC and GTPU item
|
|
|
|
are defined for a user-friendly API when creating GTP-C and GTP-U
|
|
|
|
flow rules.
|
|
|
|
|
|
|
|
- ``v_pt_rsv_flags``: version (3b), protocol type (1b), reserved (1b),
|
|
|
|
extension header flag (1b), sequence number flag (1b), N-PDU number
|
|
|
|
flag (1b).
|
|
|
|
- ``msg_type``: message type.
|
|
|
|
- ``msg_len``: message length.
|
|
|
|
- ``teid``: tunnel endpoint identifier.
|
|
|
|
- Default ``mask`` matches teid only.
|
|
|
|
|
2017-10-25 15:07:22 +00:00
|
|
|
Item: ``ESP``
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an ESP header.
|
|
|
|
|
|
|
|
- ``hdr``: ESP header definition (``rte_esp.h``).
|
|
|
|
- Default ``mask`` matches SPI only.
|
|
|
|
|
2017-12-01 10:43:15 +00:00
|
|
|
Item: ``GENEVE``
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a GENEVE header.
|
|
|
|
|
|
|
|
- ``ver_opt_len_o_c_rsvd0``: version (2b), length of the options fields (6b),
|
|
|
|
OAM packet (1b), critical options present (1b), reserved 0 (6b).
|
|
|
|
- ``protocol``: protocol type.
|
|
|
|
- ``vni``: virtual network identifier.
|
|
|
|
- ``rsvd1``: reserved, normally 0x00.
|
|
|
|
- Default ``mask`` matches VNI only.
|
|
|
|
|
2018-04-23 12:16:32 +00:00
|
|
|
Item: ``VXLAN-GPE``
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a VXLAN-GPE header (draft-ietf-nvo3-vxlan-gpe-05).
|
|
|
|
|
|
|
|
- ``flags``: normally 0x0C (I and P flags).
|
|
|
|
- ``rsvd0``: reserved, normally 0x0000.
|
|
|
|
- ``protocol``: protocol type.
|
|
|
|
- ``vni``: VXLAN network identifier.
|
|
|
|
- ``rsvd1``: reserved, normally 0x00.
|
|
|
|
- Default ``mask`` matches VNI only.
|
|
|
|
|
2018-04-24 15:58:58 +00:00
|
|
|
Item: ``ARP_ETH_IPV4``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an ARP header for Ethernet/IPv4.
|
|
|
|
|
|
|
|
- ``hdr``: hardware type, normally 1.
|
|
|
|
- ``pro``: protocol type, normally 0x0800.
|
|
|
|
- ``hln``: hardware address length, normally 6.
|
|
|
|
- ``pln``: protocol address length, normally 4.
|
|
|
|
- ``op``: opcode (1 for request, 2 for reply).
|
|
|
|
- ``sha``: sender hardware address.
|
|
|
|
- ``spa``: sender IPv4 address.
|
|
|
|
- ``tha``: target hardware address.
|
|
|
|
- ``tpa``: target IPv4 address.
|
|
|
|
- Default ``mask`` matches SHA, SPA, THA and TPA.
|
|
|
|
|
|
|
|
Item: ``IPV6_EXT``
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches the presence of any IPv6 extension header.
|
|
|
|
|
|
|
|
- ``next_hdr``: next header.
|
|
|
|
- Default ``mask`` matches ``next_hdr``.
|
|
|
|
|
|
|
|
Normally preceded by any of:
|
|
|
|
|
|
|
|
- `Item: IPV6`_
|
2020-10-14 16:35:48 +00:00
|
|
|
- `Item: IPV6_EXT`_
|
|
|
|
|
|
|
|
Item: ``IPV6_FRAG_EXT``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches the presence of IPv6 fragment extension header.
|
|
|
|
|
|
|
|
- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
|
|
|
|
|
|
|
|
Normally preceded by any of:
|
|
|
|
|
|
|
|
- `Item: IPV6`_
|
2018-04-24 15:58:58 +00:00
|
|
|
- `Item: IPV6_EXT`_
|
|
|
|
|
|
|
|
Item: ``ICMP6``
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches any ICMPv6 header.
|
|
|
|
|
|
|
|
- ``type``: ICMPv6 type.
|
|
|
|
- ``code``: ICMPv6 code.
|
|
|
|
- ``checksum``: ICMPv6 checksum.
|
|
|
|
- Default ``mask`` matches ``type`` and ``code``.
|
|
|
|
|
|
|
|
Item: ``ICMP6_ND_NS``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an ICMPv6 neighbor discovery solicitation.
|
|
|
|
|
|
|
|
- ``type``: ICMPv6 type, normally 135.
|
|
|
|
- ``code``: ICMPv6 code, normally 0.
|
|
|
|
- ``checksum``: ICMPv6 checksum.
|
|
|
|
- ``reserved``: reserved, normally 0.
|
|
|
|
- ``target_addr``: target address.
|
|
|
|
- Default ``mask`` matches target address only.
|
|
|
|
|
|
|
|
Item: ``ICMP6_ND_NA``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an ICMPv6 neighbor discovery advertisement.
|
|
|
|
|
|
|
|
- ``type``: ICMPv6 type, normally 136.
|
|
|
|
- ``code``: ICMPv6 code, normally 0.
|
|
|
|
- ``checksum``: ICMPv6 checksum.
|
|
|
|
- ``rso_reserved``: route flag (1b), solicited flag (1b), override flag
|
|
|
|
(1b), reserved (29b).
|
|
|
|
- ``target_addr``: target address.
|
|
|
|
- Default ``mask`` matches target address only.
|
|
|
|
|
|
|
|
Item: ``ICMP6_ND_OPT``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches the presence of any ICMPv6 neighbor discovery option.
|
|
|
|
|
|
|
|
- ``type``: ND option type.
|
|
|
|
- ``length``: ND option length.
|
|
|
|
- Default ``mask`` matches type only.
|
|
|
|
|
|
|
|
Normally preceded by any of:
|
|
|
|
|
|
|
|
- `Item: ICMP6_ND_NA`_
|
|
|
|
- `Item: ICMP6_ND_NS`_
|
|
|
|
- `Item: ICMP6_ND_OPT`_
|
|
|
|
|
|
|
|
Item: ``ICMP6_ND_OPT_SLA_ETH``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an ICMPv6 neighbor discovery source Ethernet link-layer address
|
|
|
|
option.
|
|
|
|
|
|
|
|
- ``type``: ND option type, normally 1.
|
|
|
|
- ``length``: ND option length, normally 1.
|
|
|
|
- ``sla``: source Ethernet LLA.
|
|
|
|
- Default ``mask`` matches source link-layer address only.
|
|
|
|
|
|
|
|
Normally preceded by any of:
|
|
|
|
|
|
|
|
- `Item: ICMP6_ND_NA`_
|
|
|
|
- `Item: ICMP6_ND_OPT`_
|
|
|
|
|
|
|
|
Item: ``ICMP6_ND_OPT_TLA_ETH``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an ICMPv6 neighbor discovery target Ethernet link-layer address
|
|
|
|
option.
|
|
|
|
|
|
|
|
- ``type``: ND option type, normally 2.
|
|
|
|
- ``length``: ND option length, normally 1.
|
|
|
|
- ``tla``: target Ethernet LLA.
|
|
|
|
- Default ``mask`` matches target link-layer address only.
|
|
|
|
|
|
|
|
Normally preceded by any of:
|
|
|
|
|
|
|
|
- `Item: ICMP6_ND_NS`_
|
|
|
|
- `Item: ICMP6_ND_OPT`_
|
|
|
|
|
2018-10-21 14:22:47 +00:00
|
|
|
Item: ``META``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches an application specific 32 bit metadata item.
|
|
|
|
|
|
|
|
- Default ``mask`` matches the specified metadata value.
|
|
|
|
|
2019-08-28 06:00:37 +00:00
|
|
|
Item: ``GTP_PSC``
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a GTP PDU extension header with type 0x85.
|
|
|
|
|
|
|
|
- ``pdu_type``: PDU type.
|
|
|
|
- ``qfi``: QoS flow identifier.
|
|
|
|
- Default ``mask`` matches QFI only.
|
|
|
|
|
2019-08-28 06:00:38 +00:00
|
|
|
Item: ``PPPOES``, ``PPPOED``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a PPPoE header.
|
|
|
|
|
|
|
|
- ``version_type``: version (4b), type (4b).
|
|
|
|
- ``code``: message type.
|
|
|
|
- ``session_id``: session identifier.
|
|
|
|
- ``length``: payload length.
|
|
|
|
|
|
|
|
Item: ``PPPOE_PROTO_ID``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a PPPoE session protocol identifier.
|
|
|
|
|
|
|
|
- ``proto_id``: PPP protocol identifier.
|
|
|
|
- Default ``mask`` matches proto_id only.
|
|
|
|
|
2019-07-25 09:03:43 +00:00
|
|
|
Item: ``NSH``
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a network service header (RFC 8300).
|
|
|
|
|
|
|
|
- ``version``: normally 0x0 (2 bits).
|
|
|
|
- ``oam_pkt``: indicate oam packet (1 bit).
|
|
|
|
- ``reserved``: reserved bit (1 bit).
|
|
|
|
- ``ttl``: maximum SFF hopes (6 bits).
|
|
|
|
- ``length``: total length in 4 bytes words (6 bits).
|
|
|
|
- ``reserved1``: reserved1 bits (4 bits).
|
|
|
|
- ``mdtype``: ndicates format of NSH header (4 bits).
|
|
|
|
- ``next_proto``: indicates protocol type of encap data (8 bits).
|
|
|
|
- ``spi``: service path identifier (3 bytes).
|
|
|
|
- ``sindex``: service index (1 byte).
|
|
|
|
- Default ``mask`` matches mdtype, next_proto, spi, sindex.
|
|
|
|
|
|
|
|
|
2019-07-25 09:03:44 +00:00
|
|
|
Item: ``IGMP``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a Internet Group Management Protocol (RFC 2236).
|
|
|
|
|
|
|
|
- ``type``: IGMP message type (Query/Report).
|
|
|
|
- ``max_resp_time``: max time allowed before sending report.
|
|
|
|
- ``checksum``: checksum, 1s complement of whole IGMP message.
|
|
|
|
- ``group_addr``: group address, for Query value will be 0.
|
|
|
|
- Default ``mask`` matches group_addr.
|
|
|
|
|
|
|
|
|
2019-07-25 09:03:45 +00:00
|
|
|
Item: ``AH``
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a IP Authentication Header (RFC 4302).
|
|
|
|
|
|
|
|
- ``next_hdr``: next payload after AH.
|
|
|
|
- ``payload_len``: total length of AH in 4B words.
|
|
|
|
- ``reserved``: reserved bits.
|
|
|
|
- ``spi``: security parameters index.
|
|
|
|
- ``seq_num``: counter value increased by 1 on each packet sent.
|
|
|
|
- Default ``mask`` matches spi.
|
|
|
|
|
2019-10-22 04:16:48 +00:00
|
|
|
Item: ``HIGIG2``
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a HIGIG2 header field. It is layer 2.5 protocol and used in
|
|
|
|
Broadcom switches.
|
|
|
|
|
|
|
|
- Default ``mask`` matches classification and vlan.
|
|
|
|
|
2020-01-13 11:50:40 +00:00
|
|
|
Item: ``L2TPV3OIP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a L2TPv3 over IP header.
|
|
|
|
|
|
|
|
- ``session_id``: L2TPv3 over IP session identifier.
|
|
|
|
- Default ``mask`` matches session_id only.
|
2019-07-25 09:03:45 +00:00
|
|
|
|
2020-03-06 06:39:26 +00:00
|
|
|
Item: ``PFCP``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a PFCP Header.
|
|
|
|
|
|
|
|
- ``s_field``: S field.
|
|
|
|
- ``msg_type``: message type.
|
|
|
|
- ``msg_len``: message length.
|
|
|
|
- ``seid``: session endpoint identifier.
|
|
|
|
- Default ``mask`` matches s_field and seid.
|
|
|
|
|
2020-07-12 13:35:02 +00:00
|
|
|
Item: ``ECPRI``
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a eCPRI header.
|
|
|
|
|
|
|
|
- ``hdr``: eCPRI header definition (``rte_ecpri.h``).
|
|
|
|
- Default ``mask`` matches nothing, for all eCPRI messages.
|
|
|
|
|
ethdev: add packet integrity check flow rules
Currently, DPDK application can offload the checksum check,
and report it in the mbuf.
However, as more and more applications are offloading some or all
logic and action to the HW, there is a need to check the packet
integrity so the right decision can be taken.
The application logic can be positive meaning if the packet is
valid jump / do actions, or negative if packet is not valid
jump to SW / do actions (like drop) and add default flow
(match all in low priority) that will direct the miss packet
to the miss path.
Since currently rte_flow works in positive way the assumption is
that the positive way will be the common way in this case also.
When thinking what is the best API to implement such feature,
we need to consider the following (in no specific order):
1. API breakage.
2. Simplicity.
3. Performance.
4. HW capabilities.
5. rte_flow limitation.
6. Flexibility.
First option: Add integrity flags to each of the items.
For example add checksum_ok to IPv4 item.
Pros:
1. No new rte_flow item.
2. Simple in the way that on each item the app can see
what checks are available.
Cons:
1. API breakage.
2. Increase number of flows, since app can't add global rule and must
have dedicated flow for each of the flow combinations, for example
matching on ICMP traffic or UDP/TCP traffic with IPv4 / IPv6 will
result in 5 flows.
Second option: dedicated item
Pros:
1. No API breakage, and there will be no for some time due to having
extra space. (by using bits)
2. Just one flow to support the ICMP or UDP/TCP traffic with IPv4 /
IPv6.
3. Simplicity application can just look at one place to see all possible
checks.
4. Allow future support for more tests.
Cons:
1. New item, that holds number of fields from different items.
For starter the following bits are suggested:
1. packet_ok - means that all HW checks depending on packet layer have
passed. This may mean that in some HW such flow should be split to
number of flows or fail.
2. l2_ok - all check for layer 2 have passed.
3. l3_ok - all check for layer 3 have passed. If packet doesn't have
L3 layer this check should fail.
4. l4_ok - all check for layer 4 have passed. If packet doesn't
have L4 layer this check should fail.
5. l2_crc_ok - the layer 2 CRC is O.K.
6. ipv4_csum_ok - IPv4 checksum is O.K. It is possible that the
IPv4 checksum will be O.K. but the l3_ok will be 0. It is not
possible that checksum will be 0 and the l3_ok will be 1.
7. l4_csum_ok - layer 4 checksum is O.K.
8. l3_len_OK - check that the reported layer 3 length is smaller than the
frame length.
Example of usage:
1. Check packets from all possible layers for integrity.
flow create integrity spec packet_ok = 1 mask packet_ok = 1 .....
2. Check only packet with layer 4 (UDP / TCP)
flow create integrity spec l3_ok = 1, l4_ok = 1 mask l3_ok = 1
l4_ok = 1
Signed-off-by: Ori Kam <orika@nvidia.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 12:44:30 +00:00
|
|
|
Item: ``PACKET_INTEGRITY_CHECKS``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches packet integrity.
|
|
|
|
For some devices application needs to enable integration checks in HW
|
|
|
|
before using this item.
|
|
|
|
|
|
|
|
- ``level``: the encapsulation level that should be checked:
|
|
|
|
- ``level == 0`` means the default PMD mode (can be inner most / outermost).
|
|
|
|
- ``level == 1`` means outermost header.
|
|
|
|
- ``level > 1`` means inner header. See also RSS level.
|
|
|
|
- ``packet_ok``: All HW packet integrity checks have passed based on the
|
|
|
|
topmost network layer. For example, for ICMP packet the topmost network
|
|
|
|
layer is L3 and for TCP or UDP packet the topmost network layer is L4.
|
|
|
|
- ``l2_ok``: all layer 2 HW integrity checks passed.
|
|
|
|
- ``l3_ok``: all layer 3 HW integrity checks passed.
|
|
|
|
- ``l4_ok``: all layer 4 HW integrity checks passed.
|
|
|
|
- ``l2_crc_ok``: layer 2 CRC check passed.
|
|
|
|
- ``ipv4_csum_ok``: IPv4 checksum check passed.
|
|
|
|
- ``l4_csum_ok``: layer 4 checksum check passed.
|
|
|
|
- ``l3_len_ok``: the layer 3 length is smaller than the frame length.
|
|
|
|
|
ethdev: introduce conntrack flow action and item
This commit introduces the conntrack action and item.
Usually the HW offloading is stateless. For some stateful offloading
like a TCP connection, HW module will help provide the ability of a
full offloading w/o SW participation after the connection was
established.
The basic usage is that in the first flow rule the application should
add the conntrack action and jump to the next flow table. In the
following flow rule(s) of the next table, the application should use
the conntrack item to match on the result.
A TCP connection has two directions traffic. To set a conntrack
action context correctly, the information of packets from both
directions are required.
The conntrack action should be created on one ethdev port and supply
the peer ethdev port as a parameter to the action. After context
created, it could only be used between these two ethdev ports
(dual-port mode) or a single port. The application should modify the
action via the API "rte_action_handle_update" only when before using
it to create a flow rule with conntrack for the opposite direction.
This will help the driver to recognize the direction of the flow to
be created, especially in the single-port mode, in which case the
traffic from both directions will go through the same ethdev port
if the application works as an "forwarding engine" but not an end
point. There is no need to call the update interface if the
subsequent flow rules have nothing to be changed.
Query will be supported via "rte_action_handle_query" interface,
about the current packets information and connection status. The
fields query capabilities depends on the HW.
For the packets received during the conntrack setup, it is suggested
to re-inject the packets in order to make sure the conntrack module
works correctly without missing any packet. Only the valid packets
should pass the conntrack, packets with invalid TCP information,
like out of window, or with invalid header, like malformed, should
not pass.
Naming and definition:
https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/
netfilter/nf_conntrack_tcp.h
https://elixir.bootlin.com/linux/latest/source/net/netfilter/
nf_conntrack_proto_tcp.c
Other reference:
https://www.usenix.org/legacy/events/sec01/invitedtalks/rooij.pdf
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 17:51:30 +00:00
|
|
|
Item: ``CONNTRACK``
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a conntrack state after conntrack action.
|
|
|
|
|
|
|
|
- ``flags``: conntrack packet state flags.
|
|
|
|
- Default ``mask`` matches all state bits.
|
|
|
|
|
2021-10-13 17:34:37 +00:00
|
|
|
Item: ``PORT_REPRESENTOR``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches traffic entering the embedded switch from the given ethdev.
|
|
|
|
|
|
|
|
Term **ethdev** and the concept of **port representor** are synonymous.
|
|
|
|
The **represented port** is an *entity* plugged to the embedded switch
|
|
|
|
at the opposite end of the "wire" leading to the ethdev.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
.--------------------.
|
|
|
|
| PORT_REPRESENTOR | Ethdev (Application Port Referred to by its ID)
|
|
|
|
'--------------------'
|
|
|
|
||
|
|
|
|
\/
|
|
|
|
.----------------.
|
|
|
|
| Logical Port |
|
|
|
|
'----------------'
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
\/
|
|
|
|
.----------.
|
|
|
|
| Switch |
|
|
|
|
'----------'
|
|
|
|
:
|
|
|
|
:
|
|
|
|
:
|
|
|
|
:
|
|
|
|
.----------------.
|
|
|
|
| Logical Port |
|
|
|
|
'----------------'
|
|
|
|
:
|
|
|
|
:
|
|
|
|
.--------------------.
|
|
|
|
| REPRESENTED_PORT | Net / Guest / Another Ethdev (Same Application)
|
|
|
|
'--------------------'
|
|
|
|
|
|
|
|
|
|
|
|
- Incompatible with `Attribute: Traffic direction`_.
|
|
|
|
- Requires `Attribute: Transfer`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_ethdev:
|
|
|
|
|
|
|
|
.. table:: ``struct rte_flow_item_ethdev``
|
|
|
|
|
|
|
|
+----------+-------------+---------------------------+
|
|
|
|
| Field | Subfield | Value |
|
|
|
|
+==========+=============+===========================+
|
|
|
|
| ``spec`` | ``port_id`` | ethdev port ID |
|
|
|
|
+----------+-------------+---------------------------+
|
|
|
|
| ``last`` | ``port_id`` | upper range value |
|
|
|
|
+----------+-------------+---------------------------+
|
|
|
|
| ``mask`` | ``port_id`` | zeroed for wildcard match |
|
|
|
|
+----------+-------------+---------------------------+
|
|
|
|
|
|
|
|
- Default ``mask`` provides exact match behaviour.
|
|
|
|
|
2021-10-13 17:34:39 +00:00
|
|
|
See also `Action: PORT_REPRESENTOR`_.
|
|
|
|
|
2021-10-13 17:34:38 +00:00
|
|
|
Item: ``REPRESENTED_PORT``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches traffic entering the embedded switch from
|
|
|
|
the entity represented by the given ethdev.
|
|
|
|
|
|
|
|
Term **ethdev** and the concept of **port representor** are synonymous.
|
|
|
|
The **represented port** is an *entity* plugged to the embedded switch
|
|
|
|
at the opposite end of the "wire" leading to the ethdev.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
.--------------------.
|
|
|
|
| PORT_REPRESENTOR | Ethdev (Application Port Referred to by its ID)
|
|
|
|
'--------------------'
|
|
|
|
:
|
|
|
|
:
|
|
|
|
.----------------.
|
|
|
|
| Logical Port |
|
|
|
|
'----------------'
|
|
|
|
:
|
|
|
|
:
|
|
|
|
:
|
|
|
|
:
|
|
|
|
.----------.
|
|
|
|
| Switch |
|
|
|
|
'----------'
|
|
|
|
/\
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
.----------------.
|
|
|
|
| Logical Port |
|
|
|
|
'----------------'
|
|
|
|
/\
|
|
|
|
||
|
|
|
|
.--------------------.
|
|
|
|
| REPRESENTED_PORT | Net / Guest / Another Ethdev (Same Application)
|
|
|
|
'--------------------'
|
|
|
|
|
|
|
|
|
|
|
|
- Incompatible with `Attribute: Traffic direction`_.
|
|
|
|
- Requires `Attribute: Transfer`_.
|
|
|
|
|
|
|
|
This item is meant to use the same structure as `Item: PORT_REPRESENTOR`_.
|
|
|
|
|
2021-10-13 17:34:40 +00:00
|
|
|
See also `Action: REPRESENTED_PORT`_.
|
|
|
|
|
ethdev: introduce configurable flexible item
1. Introduction and Retrospective
Nowadays the networks are evolving fast and wide, the network
structures are getting more and more complicated, the new
application areas are emerging. To address these challenges
the new network protocols are continuously being developed,
considered by technical communities, adopted by industry and,
eventually implemented in hardware and software. The DPDK
framework follows the common trends and if we bother
to glance at the RTE Flow API header we see the multiple
new items were introduced during the last years since
the initial release.
The new protocol adoption and implementation process is
not straightforward and takes time, the new protocol passes
development, consideration, adoption, and implementation
phases. The industry tries to mitigate and address the
forthcoming network protocols, for example, many hardware
vendors are implementing flexible and configurable network
protocol parsers. As DPDK developers, could we anticipate
the near future in the same fashion and introduce the similar
flexibility in RTE Flow API?
Let's check what we already have merged in our project, and
we see the nice raw item (rte_flow_item_raw). At the first
glance, it looks superior and we can try to implement a flow
matching on the header of some relatively new tunnel protocol,
say on the GENEVE header with variable length options. And,
under further consideration, we run into the raw item
limitations:
- only fixed size network header can be represented
- the entire network header pattern of fixed format
(header field offsets are fixed) must be provided
- the search for patterns is not robust (the wrong matches
might be triggered), and actually is not supported
by existing PMDs
- no explicitly specified relations with preceding
and following items
- no tunnel hint support
As the result, implementing the support for tunnel protocols
like aforementioned GENEVE with variable extra protocol option
with flow raw item becomes very complicated and would require
multiple flows and multiple raw items chained in the same
flow (by the way, there is no support found for chained raw
items in implemented drivers).
This RFC introduces the dedicated flex item (rte_flow_item_flex)
to handle matches with existing and new network protocol headers
in a unified fashion.
2. Flex Item Life Cycle
Let's assume there are the requirements to support the new
network protocol with RTE Flows. What is given within protocol
specification:
- header format
- header length, (can be variable, depending on options)
- potential presence of extra options following or included
in the header the header
- the relations with preceding protocols. For example,
the GENEVE follows UDP, eCPRI can follow either UDP
or L2 header
- the relations with following protocols. For example,
the next layer after tunnel header can be L2 or L3
- whether the new protocol is a tunnel and the header
is a splitting point between outer and inner layers
The supposed way to operate with flex item:
- application defines the header structures according to
protocol specification
- application calls rte_flow_flex_item_create() with desired
configuration according to the protocol specification, it
creates the flex item object over specified ethernet device
and prepares PMD and underlying hardware to handle flex
item. On item creation call PMD backing the specified
ethernet device returns the opaque handle identifying
the object has been created
- application uses the rte_flow_item_flex with obtained handle
in the flows, the values/masks to match with fields in the
header are specified in the flex item per flow as for regular
items (except that pattern buffer combines all fields)
- flows with flex items match with packets in a regular fashion,
the values and masks for the new protocol header match are
taken from the flex items in the flows
- application destroys flows with flex items
- application calls rte_flow_flex_item_release() as part of
ethernet device API and destroys the flex item object in
PMD and releases the engaged hardware resources
3. Flex Item Structure
The flex item structure is intended to be used as part of the flow
pattern like regular RTE flow items and provides the mask and
value to match with fields of the protocol item was configured
for.
struct rte_flow_item_flex {
void *handle;
uint32_t length;
const uint8_t* pattern;
};
The handle is some opaque object maintained on per device basis
by underlying driver.
The protocol header fields are considered as bit fields, all
offsets and widths are expressed in bits. The pattern is the
buffer containing the bit concatenation of all the fields
presented at item configuration time, in the same order and
same amount. If byte boundary alignment is needed an application
can use a dummy type field, this is just some kind of gap filler.
The length field specifies the pattern buffer length in bytes
and is needed to allow rte_flow_copy() operations. The approach
of multiple pattern pointers and lengths (per field) was
considered and found clumsy - it seems to be much suitable for
the application to maintain the single structure within the
single pattern buffer.
4. Flex Item Configuration
The flex item configuration consists of the following parts:
- header field descriptors:
- next header
- next protocol
- sample to match
- input link descriptors
- output link descriptors
The field descriptors tell the driver and hardware what data should
be extracted from the packet and then control the packet handling
in the flow engine. Besides this, sample fields can be presented
to match with patterns in the flows. Each field is a bit pattern.
It has width, offset from the header beginning, mode of offset
calculation, and offset related parameters.
The next header field is special, no data are actually taken
from the packet, but its offset is used as a pointer to the next
header in the packet, in other words the next header offset
specifies the size of the header being parsed by flex item.
There is one more special field - next protocol, it specifies
where the next protocol identifier is contained and packet data
sampled from this field will be used to determine the next
protocol header type to continue packet parsing. The next
protocol field is like eth_type field in MAC2, or proto field
in IPv4/v6 headers.
The sample fields are used to represent the data be sampled
from the packet and then matched with established flows.
There are several methods supposed to calculate field offset
in runtime depending on configuration and packet content:
- FIELD_MODE_FIXED - fixed offset. The bit offset from
header beginning is permanent and defined by field_base
configuration parameter.
- FIELD_MODE_OFFSET - the field bit offset is extracted
from other header field (indirect offset field). The
resulting field offset to match is calculated from as:
field_base + (*offset_base & offset_mask) << offset_shift
This mode is useful to sample some extra options following
the main header with field containing main header length.
Also, this mode can be used to calculate offset to the
next protocol header, for example - IPv4 header contains
the 4-bit field with IPv4 header length expressed in dwords.
One more example - this mode would allow us to skip GENEVE
header variable length options.
- FIELD_MODE_BITMASK - the field bit offset is extracted
from other header field (indirect offset field), the latter
is considered as bitmask containing some number of one bits,
the resulting field offset to match is calculated as:
field_base + bitcount(*offset_base & offset_mask) << offset_shift
This mode would be useful to skip the GTP header and its
extra options with specified flags.
- FIELD_MODE_DUMMY - dummy field, optionally used for byte
boundary alignment in pattern. Pattern mask and data are
ignored in the match. All configuration parameters besides
field size and offset are ignored.
Note: "*" - means the indirect field offset is calculated
and actual data are extracted from the packet by this
offset (like data are fetched by pointer *p from memory).
The offset mode list can be extended by vendors according to
hardware supported options.
The input link configuration section tells the driver after
what protocols and at what conditions the flex item can follow.
Input link specified the preceding header pattern, for example
for GENEVE it can be UDP item specifying match on destination
port with value 6081. The flex item can follow multiple header
types and multiple input links should be specified. At flow
creation time the item with one of the input link types should
precede the flex item and driver will select the correct flex
item settings, depending on the actual flow pattern.
The output link configuration section tells the driver how
to continue packet parsing after the flex item protocol.
If multiple protocols can follow the flex item header the
flex item should contain the field with the next protocol
identifier and the parsing will be continued depending
on the data contained in this field in the actual packet.
The flex item fields can participate in RSS hash calculation,
the dedicated flag is present in the field description to specify
what fields should be provided for hashing.
5. Flex Item Chaining
If there are multiple protocols supposed to be supported with
flex items in chained fashion - two or more flex items within
the same flow and these ones might be neighbors in the pattern,
it means the flex items are mutual referencing. In this case,
the item that occurred first should be created with empty
output link list or with the list including existing items,
and then the second flex item should be created referencing
the first flex item as input arc, drivers should adjust
the item configuration.
Also, the hardware resources used by flex items to handle
the packet can be limited. If there are multiple flex items
that are supposed to be used within the same flow it would
be nice to provide some hint for the driver that these two
or more flex items are intended for simultaneous usage.
The fields of items should be assigned with hint indices
and these indices from two or more flex items supposed
to be provided within the same flow should be the same
as well. In other words, the field hint index specifies
the group of fields that can be matched simultaneously
within a single flow. If hint indices are specified,
the driver will try to engage not overlapping hardware
resources and provide independent handling of the field
groups with unique indices. If the hint index is zero
the driver assigns resources on its own.
6. Example of New Protocol Handling
Let's suppose we have the requirements to handle the new tunnel
protocol that follows UDP header with destination port 0xFADE
and is followed by MAC header. Let the new protocol header format
be like this:
struct new_protocol_header {
rte_be32 header_length; /* length in dwords, including options */
rte_be32 specific0; /* some protocol data, no intention */
rte_be32 specific1; /* to match in flows on these fields */
rte_be32 crucial; /* data of interest, match is needed */
rte_be32 options[0]; /* optional protocol data, variable length */
};
The supposed flex item configuration:
struct rte_flow_item_flex_field field0 = {
.field_mode = FIELD_MODE_DUMMY, /* Affects match pattern only */
.field_size = 96, /* three dwords from the beginning */
};
struct rte_flow_item_flex_field field1 = {
.field_mode = FIELD_MODE_FIXED,
.field_size = 32, /* Field size is one dword */
.field_base = 96, /* Skip three dwords from the beginning */
};
struct rte_flow_item_udp spec0 = {
.hdr = {
.dst_port = RTE_BE16(0xFADE),
}
};
struct rte_flow_item_udp mask0 = {
.hdr = {
.dst_port = RTE_BE16(0xFFFF),
}
};
struct rte_flow_item_flex_link link0 = {
.item = {
.type = RTE_FLOW_ITEM_TYPE_UDP,
.spec = &spec0,
.mask = &mask0,
};
struct rte_flow_item_flex_conf conf = {
.next_header = {
.tunnel = FLEX_TUNNEL_MODE_SINGLE,
.field_mode = FIELD_MODE_OFFSET,
.field_base = 0,
.offset_base = 0,
.offset_mask = 0xFFFFFFFF,
.offset_shift = 2 /* Expressed in dwords, shift left by 2 */
},
.sample = {
&field0,
&field1,
},
.nb_samples = 2,
.input_link[0] = &link0,
.nb_inputs = 1
};
Let's suppose we have created the flex item successfully, and PMD
returned the handle 0x123456789A. We can use the following item
pattern to match the crucial field in the packet with value 0x00112233:
struct new_protocol_header spec_pattern =
{
.crucial = RTE_BE32(0x00112233),
};
struct new_protocol_header mask_pattern =
{
.crucial = RTE_BE32(0xFFFFFFFF),
};
struct rte_flow_item_flex spec_flex = {
.handle = 0x123456789A
.length = sizeiof(struct new_protocol_header),
.pattern = &spec_pattern,
};
struct rte_flow_item_flex mask_flex = {
.length = sizeof(struct new_protocol_header),
.pattern = &mask_pattern,
};
struct rte_flow_item item_to_match = {
.type = RTE_FLOW_ITEM_TYPE_FLEX,
.spec = &spec_flex,
.mask = &mask_flex,
};
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
2021-10-20 15:14:55 +00:00
|
|
|
Item: ``FLEX``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches with the custom network protocol header that was created
|
|
|
|
using rte_flow_flex_item_create() API. The application describes
|
|
|
|
the desired header structure, defines the header fields attributes
|
|
|
|
and header relations with preceding and following protocols and
|
|
|
|
configures the ethernet devices accordingly via
|
|
|
|
rte_flow_flex_item_create() routine.
|
|
|
|
|
|
|
|
- ``handle``: the flex item handle returned by the PMD on successful
|
|
|
|
rte_flow_flex_item_create() call, mask for this field is ignored.
|
|
|
|
- ``length``: match pattern length in bytes. If the length does not cover
|
|
|
|
all fields defined in item configuration, the pattern spec and mask are
|
|
|
|
considered by the driver as padded with trailing zeroes till the full
|
|
|
|
configured item pattern length.
|
|
|
|
- ``pattern``: pattern to match. The pattern is concatenation of bit fields
|
|
|
|
configured at item creation. At configuration the fields are presented
|
|
|
|
by sample_data array. The order of the bitfields is defined by the order
|
|
|
|
of sample_data elements. The width of each bitfield is defined by the width
|
|
|
|
specified in the corresponding sample_data element as well. If pattern
|
|
|
|
length is smaller than configured fields overall length it is considered
|
|
|
|
as padded with trailing zeroes up to full configured length, both for
|
|
|
|
value and mask.
|
|
|
|
|
2021-10-21 10:49:22 +00:00
|
|
|
Item: ``L2TPV2``
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a L2TPv2 header.
|
|
|
|
|
|
|
|
- ``flags_version``: flags(12b), version(4b).
|
|
|
|
- ``length``: total length of the message.
|
|
|
|
- ``tunnel_id``: identifier for the control connection.
|
|
|
|
- ``session_id``: identifier for a session within a tunnel.
|
|
|
|
- ``ns``: sequence number for this date or control message.
|
|
|
|
- ``nr``: sequence number expected in the next control message to be received.
|
|
|
|
- ``offset_size``: offset of payload data.
|
|
|
|
- ``offset_padding``: offset padding, variable length.
|
|
|
|
- Default ``mask`` matches flags_version only.
|
|
|
|
|
|
|
|
Item: ``PPP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Matches a PPP header.
|
|
|
|
|
|
|
|
- ``addr``: PPP address.
|
|
|
|
- ``ctrl``: PPP control.
|
|
|
|
- ``proto_id``: PPP protocol identifier.
|
|
|
|
- Default ``mask`` matches addr, ctrl, proto_id.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
Actions
|
|
|
|
~~~~~~~
|
|
|
|
|
2019-07-02 14:17:26 +00:00
|
|
|
Each possible action is represented by a type.
|
|
|
|
An action can have an associated configuration object.
|
|
|
|
Several actions combined in a list can be assigned
|
2018-04-25 15:27:46 +00:00
|
|
|
to a flow rule and are performed in order.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
They fall in three categories:
|
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
- Actions that modify the fate of matching traffic, for instance by dropping
|
|
|
|
or assigning it a specific destination.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
- Actions that modify matching traffic contents or its properties. This
|
|
|
|
includes adding/removing encapsulation, encryption, compression and marks.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
- Actions related to the flow rule itself, such as updating counters or
|
|
|
|
making it non-terminating.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
Flow rules being terminating by default, not specifying any action of the
|
|
|
|
fate kind results in undefined behavior. This applies to both ingress and
|
|
|
|
egress.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
PASSTHRU, when supported, makes a flow rule non-terminating.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Like matching patterns, action lists are terminated by END items.
|
|
|
|
|
|
|
|
Example of action that redirects packets to queue index 10:
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_example:
|
|
|
|
|
|
|
|
.. table:: Queue action
|
|
|
|
|
|
|
|
+-----------+-------+
|
|
|
|
| Field | Value |
|
|
|
|
+===========+=======+
|
|
|
|
| ``index`` | 10 |
|
|
|
|
+-----------+-------+
|
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
Actions are performed in list order:
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
.. _table_rte_flow_count_then_drop:
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
.. table:: Count then drop
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
+-------+--------+
|
|
|
|
| Index | Action |
|
|
|
|
+=======+========+
|
|
|
|
| 0 | COUNT |
|
|
|
|
+-------+--------+
|
|
|
|
| 1 | DROP |
|
|
|
|
+-------+--------+
|
|
|
|
| 2 | END |
|
|
|
|
+-------+--------+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _table_rte_flow_mark_count_redirect:
|
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
.. table:: Mark, count then redirect
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-26 17:29:19 +00:00
|
|
|
+-------+--------+------------+-------+
|
|
|
|
| Index | Action | Field | Value |
|
|
|
|
+=======+========+============+=======+
|
|
|
|
| 0 | MARK | ``mark`` | 0x2a |
|
|
|
|
+-------+--------+------------+-------+
|
2021-10-08 10:26:15 +00:00
|
|
|
| 1 | COUNT | ``id`` | 0 |
|
2018-04-26 17:29:19 +00:00
|
|
|
+-------+--------+------------+-------+
|
|
|
|
| 2 | QUEUE | ``queue`` | 10 |
|
|
|
|
+-------+--------+------------+-------+
|
|
|
|
| 3 | END |
|
|
|
|
+-------+-----------------------------+
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _table_rte_flow_redirect_queue_5:
|
|
|
|
|
|
|
|
.. table:: Redirect to queue 5
|
|
|
|
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| Index | Action | Field | Value |
|
|
|
|
+=======+========+===========+=======+
|
|
|
|
| 0 | DROP |
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| 1 | QUEUE | ``queue`` | 5 |
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| 2 | END |
|
|
|
|
+-------+----------------------------+
|
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
In the above example, while DROP and QUEUE must be performed in order, both
|
|
|
|
have to happen before reaching END. Only QUEUE has a visible effect.
|
|
|
|
|
|
|
|
Note that such a list may be thought as ambiguous and rejected on that
|
|
|
|
basis.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
.. _table_rte_flow_redirect_queue_5_3:
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
.. table:: Redirect to queues 5 and 3
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| Index | Action | Field | Value |
|
|
|
|
+=======+========+===========+=======+
|
|
|
|
| 0 | QUEUE | ``queue`` | 5 |
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| 1 | VOID |
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| 2 | QUEUE | ``queue`` | 3 |
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| 3 | END |
|
|
|
|
+-------+----------------------------+
|
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
As previously described, all actions must be taken into account. This
|
|
|
|
effectively duplicates traffic to both queues. The above example also shows
|
|
|
|
that VOID is ignored.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Action types
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
2021-03-29 16:52:14 +00:00
|
|
|
Common action types are described in this section.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Action: ``END``
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
End marker for action lists. Prevents further processing of actions, thereby
|
|
|
|
ending the list.
|
|
|
|
|
|
|
|
- Its numeric value is 0 for convenience.
|
|
|
|
- PMD support is mandatory.
|
|
|
|
- No configurable properties.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_end:
|
|
|
|
|
|
|
|
.. table:: END
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``VOID``
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Used as a placeholder for convenience. It is ignored and simply discarded by
|
|
|
|
PMDs.
|
|
|
|
|
|
|
|
- PMD support is mandatory.
|
|
|
|
- No configurable properties.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_void:
|
|
|
|
|
|
|
|
.. table:: VOID
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``PASSTHRU``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-04-25 15:27:46 +00:00
|
|
|
Leaves traffic up for additional processing by subsequent flow rules; makes
|
|
|
|
a flow rule non-terminating.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
- No configurable properties.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_passthru:
|
|
|
|
|
|
|
|
.. table:: PASSTHRU
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Example to copy a packet to a queue and continue processing by subsequent
|
|
|
|
flow rules:
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_passthru_example:
|
|
|
|
|
|
|
|
.. table:: Copy to queue 8
|
|
|
|
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| Index | Action | Field | Value |
|
|
|
|
+=======+========+===========+=======+
|
|
|
|
| 0 | PASSTHRU |
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| 1 | QUEUE | ``queue`` | 8 |
|
|
|
|
+-------+--------+-----------+-------+
|
|
|
|
| 2 | END |
|
|
|
|
+-------+----------------------------+
|
|
|
|
|
2018-04-26 17:29:17 +00:00
|
|
|
Action: ``JUMP``
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Redirects packets to a group on the current device.
|
|
|
|
|
|
|
|
In a hierarchy of groups, which can be used to represent physical or logical
|
|
|
|
flow group/tables on the device, this action redirects the matched flow to
|
|
|
|
the specified group on that device.
|
|
|
|
|
|
|
|
If a matched flow is redirected to a table which doesn't contain a matching
|
|
|
|
rule for that flow then the behavior is undefined and the resulting behavior
|
|
|
|
is up to the specific device. Best practice when using groups would be define
|
|
|
|
a default flow rule for each group which a defines the default actions in that
|
|
|
|
group so a consistent behavior is defined.
|
|
|
|
|
|
|
|
Defining an action for matched flow in a group to jump to a group which is
|
|
|
|
higher in the group hierarchy may not be supported by physical devices,
|
|
|
|
depending on how groups are mapped to the physical devices. In the
|
|
|
|
definitions of jump actions, applications should be aware that it may be
|
|
|
|
possible to define flow rules which trigger an undefined behavior causing
|
|
|
|
flows to loop between groups.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_jump:
|
|
|
|
|
|
|
|
.. table:: JUMP
|
|
|
|
|
|
|
|
+-----------+------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===========+==============================+
|
|
|
|
| ``group`` | Group to redirect packets to |
|
|
|
|
+-----------+------------------------------+
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
Action: ``MARK``
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
2021-10-15 19:24:08 +00:00
|
|
|
Attaches an integer value to packets and sets ``RTE_MBUF_F_RX_FDIR`` and
|
|
|
|
``RTE_MBUF_F_RX_FDIR_ID`` mbuf flags.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2017-01-10 13:08:28 +00:00
|
|
|
This value is arbitrary and application-defined. Maximum allowed value
|
|
|
|
depends on the underlying implementation. It is returned in the
|
|
|
|
``hash.fdir.hi`` mbuf field.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
.. _table_rte_flow_action_mark:
|
|
|
|
|
|
|
|
.. table:: MARK
|
|
|
|
|
2017-01-10 13:08:28 +00:00
|
|
|
+--------+--------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+========+======================================+
|
|
|
|
| ``id`` | integer value to return with packets |
|
|
|
|
+--------+--------------------------------------+
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Action: ``FLAG``
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
2017-01-10 13:08:28 +00:00
|
|
|
Flags packets. Similar to `Action: MARK`_ without a specific value; only
|
2021-10-15 19:24:08 +00:00
|
|
|
sets the ``RTE_MBUF_F_RX_FDIR`` mbuf flag.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
- No configurable properties.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_flag:
|
|
|
|
|
|
|
|
.. table:: FLAG
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``QUEUE``
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Assigns packets to a given queue index.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_queue:
|
|
|
|
|
|
|
|
.. table:: QUEUE
|
|
|
|
|
|
|
|
+-----------+--------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===========+====================+
|
|
|
|
| ``index`` | queue index to use |
|
|
|
|
+-----------+--------------------+
|
|
|
|
|
|
|
|
Action: ``DROP``
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Drop packets.
|
|
|
|
|
|
|
|
- No configurable properties.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_drop:
|
|
|
|
|
|
|
|
.. table:: DROP
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``COUNT``
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-04-26 17:29:19 +00:00
|
|
|
Adds a counter action to a matched flow.
|
|
|
|
|
|
|
|
If more than one count action is specified in a single flow rule, then each
|
|
|
|
action must specify a unique id.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-26 17:29:19 +00:00
|
|
|
Counters can be retrieved and reset through ``rte_flow_query()``, see
|
2016-12-21 14:51:18 +00:00
|
|
|
``struct rte_flow_query_count``.
|
|
|
|
|
2018-04-26 17:29:19 +00:00
|
|
|
For ports within the same switch domain then the counter id namespace extends
|
|
|
|
to all ports within that switch domain.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
.. _table_rte_flow_action_count:
|
|
|
|
|
|
|
|
.. table:: COUNT
|
|
|
|
|
2020-11-03 14:26:16 +00:00
|
|
|
+------------+---------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+============+=================================+
|
|
|
|
| ``id`` | counter id |
|
|
|
|
+------------+---------------------------------+
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Query structure to retrieve and reset flow rule counters:
|
|
|
|
|
|
|
|
.. _table_rte_flow_query_count:
|
|
|
|
|
|
|
|
.. table:: COUNT query
|
|
|
|
|
|
|
|
+---------------+-----+-----------------------------------+
|
|
|
|
| Field | I/O | Value |
|
|
|
|
+===============+=====+===================================+
|
|
|
|
| ``reset`` | in | reset counter after query |
|
|
|
|
+---------------+-----+-----------------------------------+
|
|
|
|
| ``hits_set`` | out | ``hits`` field is set |
|
|
|
|
+---------------+-----+-----------------------------------+
|
|
|
|
| ``bytes_set`` | out | ``bytes`` field is set |
|
|
|
|
+---------------+-----+-----------------------------------+
|
|
|
|
| ``hits`` | out | number of hits for this rule |
|
|
|
|
+---------------+-----+-----------------------------------+
|
|
|
|
| ``bytes`` | out | number of bytes through this rule |
|
|
|
|
+---------------+-----+-----------------------------------+
|
|
|
|
|
|
|
|
Action: ``RSS``
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Similar to QUEUE, except RSS is additionally performed on packets to spread
|
|
|
|
them among several queues according to the provided parameters.
|
|
|
|
|
2018-04-25 15:27:50 +00:00
|
|
|
Unlike global RSS settings used by other DPDK APIs, unsetting the ``types``
|
|
|
|
field does not disable RSS in a flow rule. Doing so instead requests safe
|
|
|
|
unspecified "best-effort" settings from the underlying PMD, which depending
|
|
|
|
on the flow rule, may result in anything ranging from empty (single queue)
|
|
|
|
to all-inclusive RSS.
|
|
|
|
|
2020-08-10 15:08:25 +00:00
|
|
|
If non-applicable for matching packets RSS types are requested,
|
|
|
|
these RSS types are simply ignored. For example, it happens if:
|
|
|
|
|
|
|
|
- Hashing of both TCP and UDP ports is requested
|
|
|
|
(only one can be present in a packet).
|
|
|
|
|
|
|
|
- Requested RSS types contradict to flow rule pattern
|
|
|
|
(e.g. pattern has UDP item, but RSS types contain TCP).
|
|
|
|
|
|
|
|
If requested RSS hash types are not supported by the Ethernet device at all
|
2020-10-28 04:46:09 +00:00
|
|
|
(not reported in ``dev_info.flow_type_rss_offloads``),
|
2020-08-10 15:08:25 +00:00
|
|
|
the flow creation will fail.
|
|
|
|
|
2017-01-10 13:08:29 +00:00
|
|
|
Note: RSS hash result is stored in the ``hash.rss`` mbuf field which
|
|
|
|
overlaps ``hash.fdir.lo``. Since `Action: MARK`_ sets the ``hash.fdir.hi``
|
|
|
|
field only, both can be requested simultaneously.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
2018-04-25 15:27:54 +00:00
|
|
|
Also, regarding packet encapsulation ``level``:
|
|
|
|
|
|
|
|
- ``0`` requests the default behavior. Depending on the packet type, it can
|
|
|
|
mean outermost, innermost, anything in between or even no RSS.
|
|
|
|
|
|
|
|
It basically stands for the innermost encapsulation level RSS can be
|
|
|
|
performed on according to PMD and device capabilities.
|
|
|
|
|
|
|
|
- ``1`` requests RSS to be performed on the outermost packet encapsulation
|
|
|
|
level.
|
|
|
|
|
|
|
|
- ``2`` and subsequent values request RSS to be performed on the specified
|
|
|
|
inner packet encapsulation level, from outermost to innermost (lower to
|
|
|
|
higher values).
|
|
|
|
|
|
|
|
Values other than ``0`` are not necessarily supported.
|
|
|
|
|
|
|
|
Requesting a specific RSS level on unrecognized traffic results in undefined
|
|
|
|
behavior. For predictable results, it is recommended to make the flow rule
|
|
|
|
pattern match packet headers up to the requested encapsulation level so that
|
|
|
|
only matching traffic goes through.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
.. _table_rte_flow_action_rss:
|
|
|
|
|
|
|
|
.. table:: RSS
|
|
|
|
|
2021-10-22 11:03:12 +00:00
|
|
|
+---------------+-------------------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===============+=================================================+
|
|
|
|
| ``func`` | RSS hash function to apply |
|
|
|
|
+---------------+-------------------------------------------------+
|
|
|
|
| ``level`` | encapsulation level for ``types`` |
|
|
|
|
+---------------+-------------------------------------------------+
|
|
|
|
| ``types`` | specific RSS hash types (see ``RTE_ETH_RSS_*``) |
|
|
|
|
+---------------+-------------------------------------------------+
|
|
|
|
| ``key_len`` | hash key length in bytes |
|
|
|
|
+---------------+-------------------------------------------------+
|
|
|
|
| ``queue_num`` | number of entries in ``queue`` |
|
|
|
|
+---------------+-------------------------------------------------+
|
|
|
|
| ``key`` | hash key |
|
|
|
|
+---------------+-------------------------------------------------+
|
|
|
|
| ``queue`` | queue indices to use |
|
|
|
|
+---------------+-------------------------------------------------+
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Action: ``PF``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
2021-10-13 17:34:41 +00:00
|
|
|
This action is deprecated. Consider:
|
|
|
|
- `Action: PORT_REPRESENTOR`_
|
|
|
|
- `Action: REPRESENTED_PORT`_
|
|
|
|
|
2018-04-25 15:28:03 +00:00
|
|
|
Directs matching traffic to the physical function (PF) of the current
|
|
|
|
device.
|
|
|
|
|
|
|
|
See `Item: PF`_.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
- No configurable properties.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_pf:
|
|
|
|
|
|
|
|
.. table:: PF
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``VF``
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
2021-10-13 17:34:41 +00:00
|
|
|
This action is deprecated. Consider:
|
|
|
|
- `Action: PORT_REPRESENTOR`_
|
|
|
|
- `Action: REPRESENTED_PORT`_
|
|
|
|
|
2018-04-25 15:28:03 +00:00
|
|
|
Directs matching traffic to a given virtual function of the current device.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
Packets matched by a VF pattern item can be redirected to their original VF
|
|
|
|
ID instead of the specified one. This parameter may not be available and is
|
|
|
|
not guaranteed to work properly if the VF part is matched by a prior flow
|
|
|
|
rule or if packets are not addressed to a VF in the first place.
|
|
|
|
|
2018-04-25 15:28:03 +00:00
|
|
|
See `Item: VF`_.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
.. _table_rte_flow_action_vf:
|
|
|
|
|
|
|
|
.. table:: VF
|
|
|
|
|
|
|
|
+--------------+--------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+================================+
|
|
|
|
| ``original`` | use original VF ID if possible |
|
|
|
|
+--------------+--------------------------------+
|
2018-04-25 15:28:03 +00:00
|
|
|
| ``id`` | VF ID |
|
2016-12-21 14:51:18 +00:00
|
|
|
+--------------+--------------------------------+
|
|
|
|
|
2018-04-25 15:28:08 +00:00
|
|
|
Action: ``PHY_PORT``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2021-10-13 17:34:41 +00:00
|
|
|
This action is deprecated. Consider:
|
|
|
|
- `Action: PORT_REPRESENTOR`_
|
|
|
|
- `Action: REPRESENTED_PORT`_
|
|
|
|
|
2018-04-25 15:28:08 +00:00
|
|
|
Directs matching traffic to a given physical port index of the underlying
|
|
|
|
device.
|
|
|
|
|
|
|
|
See `Item: PHY_PORT`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_phy_port:
|
|
|
|
|
|
|
|
.. table:: PHY_PORT
|
|
|
|
|
|
|
|
+--------------+-------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+=====================================+
|
|
|
|
| ``original`` | use original port index if possible |
|
|
|
|
+--------------+-------------------------------------+
|
|
|
|
| ``index`` | physical port index |
|
|
|
|
+--------------+-------------------------------------+
|
|
|
|
|
2018-04-25 15:28:10 +00:00
|
|
|
Action: ``PORT_ID``
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
2021-10-13 17:34:41 +00:00
|
|
|
This action is deprecated. Consider:
|
|
|
|
- `Action: PORT_REPRESENTOR`_
|
|
|
|
- `Action: REPRESENTED_PORT`_
|
|
|
|
|
2018-04-25 15:28:10 +00:00
|
|
|
Directs matching traffic to a given DPDK port ID.
|
|
|
|
|
|
|
|
See `Item: PORT_ID`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_port_id:
|
|
|
|
|
|
|
|
.. table:: PORT_ID
|
|
|
|
|
|
|
|
+--------------+---------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+=======================================+
|
|
|
|
| ``original`` | use original DPDK port ID if possible |
|
|
|
|
+--------------+---------------------------------------+
|
|
|
|
| ``id`` | DPDK port ID |
|
|
|
|
+--------------+---------------------------------------+
|
|
|
|
|
2017-10-13 12:22:14 +00:00
|
|
|
Action: ``METER``
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Applies a stage of metering and policing.
|
|
|
|
|
|
|
|
The metering and policing (MTR) object has to be first created using the
|
|
|
|
rte_mtr_create() API function. The ID of the MTR object is specified as
|
|
|
|
action parameter. More than one flow can use the same MTR object through
|
|
|
|
the meter action. The MTR object can be further updated or queried using
|
|
|
|
the rte_mtr* API.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_meter:
|
|
|
|
|
|
|
|
.. table:: METER
|
|
|
|
|
|
|
|
+--------------+---------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+===============+
|
|
|
|
| ``mtr_id`` | MTR object ID |
|
|
|
|
+--------------+---------------+
|
|
|
|
|
2017-10-25 15:07:22 +00:00
|
|
|
Action: ``SECURITY``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Perform the security action on flows matched by the pattern items
|
|
|
|
according to the configuration of the security session.
|
|
|
|
|
|
|
|
This action modifies the payload of matched flows. For INLINE_CRYPTO, the
|
|
|
|
security protocol headers and IV are fully provided by the application as
|
|
|
|
specified in the flow pattern. The payload of matching packets is
|
|
|
|
encrypted on egress, and decrypted and authenticated on ingress.
|
|
|
|
For INLINE_PROTOCOL, the security protocol is fully offloaded to HW,
|
|
|
|
providing full encapsulation and decapsulation of packets in security
|
|
|
|
protocols. The flow pattern specifies both the outer security header fields
|
|
|
|
and the inner packet fields. The security session specified in the action
|
|
|
|
must match the pattern parameters.
|
|
|
|
|
|
|
|
The security session specified in the action must be created on the same
|
|
|
|
port as the flow action that is being specified.
|
|
|
|
|
|
|
|
The ingress/egress flow attribute should match that specified in the
|
|
|
|
security session if the security session supports the definition of the
|
|
|
|
direction.
|
|
|
|
|
|
|
|
Multiple flows can be configured to use the same security session.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_security:
|
|
|
|
|
|
|
|
.. table:: SECURITY
|
|
|
|
|
|
|
|
+----------------------+--------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+======================+======================================+
|
|
|
|
| ``security_session`` | security session to apply |
|
|
|
|
+----------------------+--------------------------------------+
|
|
|
|
|
|
|
|
The following is an example of configuring IPsec inline using the
|
|
|
|
INLINE_CRYPTO security session:
|
|
|
|
|
|
|
|
The encryption algorithm, keys and salt are part of the opaque
|
|
|
|
``rte_security_session``. The SA is identified according to the IP and ESP
|
|
|
|
fields in the pattern items.
|
|
|
|
|
|
|
|
.. _table_rte_flow_item_esp_inline_example:
|
|
|
|
|
|
|
|
.. table:: IPsec inline crypto flow pattern items.
|
|
|
|
|
|
|
|
+-------+----------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+==========+
|
|
|
|
| 0 | Ethernet |
|
|
|
|
+-------+----------+
|
|
|
|
| 1 | IPv4 |
|
|
|
|
+-------+----------+
|
|
|
|
| 2 | ESP |
|
|
|
|
+-------+----------+
|
|
|
|
| 3 | END |
|
|
|
|
+-------+----------+
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_esp_inline_example:
|
|
|
|
|
|
|
|
.. table:: IPsec inline flow actions.
|
|
|
|
|
|
|
|
+-------+----------+
|
|
|
|
| Index | Action |
|
|
|
|
+=======+==========+
|
|
|
|
| 0 | SECURITY |
|
|
|
|
+-------+----------+
|
|
|
|
| 1 | END |
|
|
|
|
+-------+----------+
|
|
|
|
|
2018-04-24 15:59:00 +00:00
|
|
|
Action: ``OF_SET_MPLS_TTL``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_SET_MPLS_TTL`` ("MPLS TTL") as defined by the `OpenFlow
|
|
|
|
Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_set_mpls_ttl:
|
|
|
|
|
|
|
|
.. table:: OF_SET_MPLS_TTL
|
|
|
|
|
|
|
|
+--------------+----------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+==========+
|
|
|
|
| ``mpls_ttl`` | MPLS TTL |
|
|
|
|
+--------------+----------+
|
|
|
|
|
|
|
|
Action: ``OF_DEC_MPLS_TTL``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_DEC_MPLS_TTL`` ("decrement MPLS TTL") as defined by the
|
|
|
|
`OpenFlow Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_dec_mpls_ttl:
|
|
|
|
|
|
|
|
.. table:: OF_DEC_MPLS_TTL
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``OF_SET_NW_TTL``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_SET_NW_TTL`` ("IP TTL") as defined by the `OpenFlow
|
|
|
|
Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_set_nw_ttl:
|
|
|
|
|
|
|
|
.. table:: OF_SET_NW_TTL
|
|
|
|
|
|
|
|
+------------+--------+
|
|
|
|
| Field | Value |
|
|
|
|
+============+========+
|
|
|
|
| ``nw_ttl`` | IP TTL |
|
|
|
|
+------------+--------+
|
|
|
|
|
|
|
|
Action: ``OF_DEC_NW_TTL``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_DEC_NW_TTL`` ("decrement IP TTL") as defined by the
|
|
|
|
`OpenFlow Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_dec_nw_ttl:
|
|
|
|
|
|
|
|
.. table:: OF_DEC_NW_TTL
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``OF_COPY_TTL_OUT``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_COPY_TTL_OUT`` ("copy TTL "outwards" -- from
|
|
|
|
next-to-outermost to outermost") as defined by the `OpenFlow Switch
|
|
|
|
Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_copy_ttl_out:
|
|
|
|
|
|
|
|
.. table:: OF_COPY_TTL_OUT
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``OF_COPY_TTL_IN``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_COPY_TTL_IN`` ("copy TTL "inwards" -- from outermost to
|
|
|
|
next-to-outermost") as defined by the `OpenFlow Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_copy_ttl_in:
|
|
|
|
|
|
|
|
.. table:: OF_COPY_TTL_IN
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
2018-04-24 15:59:02 +00:00
|
|
|
Action: ``OF_POP_VLAN``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_POP_VLAN`` ("pop the outer VLAN tag") as defined
|
|
|
|
by the `OpenFlow Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_pop_vlan:
|
|
|
|
|
|
|
|
.. table:: OF_POP_VLAN
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``OF_PUSH_VLAN``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_PUSH_VLAN`` ("push a new VLAN tag") as defined by the
|
|
|
|
`OpenFlow Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_push_vlan:
|
|
|
|
|
|
|
|
.. table:: OF_PUSH_VLAN
|
|
|
|
|
|
|
|
+---------------+-----------+
|
|
|
|
| Field | Value |
|
|
|
|
+===============+===========+
|
|
|
|
| ``ethertype`` | EtherType |
|
|
|
|
+---------------+-----------+
|
|
|
|
|
|
|
|
Action: ``OF_SET_VLAN_VID``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_SET_VLAN_VID`` ("set the 802.1q VLAN id") as defined by
|
|
|
|
the `OpenFlow Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_set_vlan_vid:
|
|
|
|
|
|
|
|
.. table:: OF_SET_VLAN_VID
|
|
|
|
|
|
|
|
+--------------+---------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+=========+
|
|
|
|
| ``vlan_vid`` | VLAN id |
|
|
|
|
+--------------+---------+
|
|
|
|
|
|
|
|
Action: ``OF_SET_VLAN_PCP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_SET_LAN_PCP`` ("set the 802.1q priority") as defined by
|
|
|
|
the `OpenFlow Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_set_vlan_pcp:
|
|
|
|
|
|
|
|
.. table:: OF_SET_VLAN_PCP
|
|
|
|
|
|
|
|
+--------------+---------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+===============+
|
|
|
|
| ``vlan_pcp`` | VLAN priority |
|
|
|
|
+--------------+---------------+
|
|
|
|
|
|
|
|
Action: ``OF_POP_MPLS``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_POP_MPLS`` ("pop the outer MPLS tag") as defined by the
|
|
|
|
`OpenFlow Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_pop_mpls:
|
|
|
|
|
|
|
|
.. table:: OF_POP_MPLS
|
|
|
|
|
|
|
|
+---------------+-----------+
|
|
|
|
| Field | Value |
|
|
|
|
+===============+===========+
|
|
|
|
| ``ethertype`` | EtherType |
|
|
|
|
+---------------+-----------+
|
|
|
|
|
|
|
|
Action: ``OF_PUSH_MPLS``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Implements ``OFPAT_PUSH_MPLS`` ("push a new MPLS tag") as defined by the
|
|
|
|
`OpenFlow Switch Specification`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_of_push_mpls:
|
|
|
|
|
|
|
|
.. table:: OF_PUSH_MPLS
|
|
|
|
|
|
|
|
+---------------+-----------+
|
|
|
|
| Field | Value |
|
|
|
|
+===============+===========+
|
|
|
|
| ``ethertype`` | EtherType |
|
|
|
|
+---------------+-----------+
|
|
|
|
|
2018-04-26 17:29:16 +00:00
|
|
|
Action: ``VXLAN_ENCAP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Performs a VXLAN encapsulation action by encapsulating the matched flow in the
|
|
|
|
VXLAN tunnel as defined in the``rte_flow_action_vxlan_encap`` flow items
|
|
|
|
definition.
|
|
|
|
|
|
|
|
This action modifies the payload of matched flows. The flow definition specified
|
|
|
|
in the ``rte_flow_action_tunnel_encap`` action structure must define a valid
|
|
|
|
VLXAN network overlay which conforms with RFC 7348 (Virtual eXtensible Local
|
|
|
|
Area Network (VXLAN): A Framework for Overlaying Virtualized Layer 2 Networks
|
|
|
|
over Layer 3 Networks). The pattern must be terminated with the
|
|
|
|
RTE_FLOW_ITEM_TYPE_END item type.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_vxlan_encap:
|
|
|
|
|
|
|
|
.. table:: VXLAN_ENCAP
|
|
|
|
|
|
|
|
+----------------+-------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+================+=====================================+
|
|
|
|
| ``definition`` | Tunnel end-point overlay definition |
|
|
|
|
+----------------+-------------------------------------+
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_vxlan_encap_example:
|
|
|
|
|
|
|
|
.. table:: IPv4 VxLAN flow pattern example.
|
|
|
|
|
|
|
|
+-------+----------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+==========+
|
|
|
|
| 0 | Ethernet |
|
|
|
|
+-------+----------+
|
|
|
|
| 1 | IPv4 |
|
|
|
|
+-------+----------+
|
|
|
|
| 2 | UDP |
|
|
|
|
+-------+----------+
|
|
|
|
| 3 | VXLAN |
|
|
|
|
+-------+----------+
|
|
|
|
| 4 | END |
|
|
|
|
+-------+----------+
|
|
|
|
|
|
|
|
Action: ``VXLAN_DECAP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Performs a decapsulation action by stripping all headers of the VXLAN tunnel
|
|
|
|
network overlay from the matched flow.
|
|
|
|
|
|
|
|
The flow items pattern defined for the flow rule with which a ``VXLAN_DECAP``
|
|
|
|
action is specified, must define a valid VXLAN tunnel as per RFC7348. If the
|
|
|
|
flow pattern does not specify a valid VXLAN tunnel then a
|
|
|
|
RTE_FLOW_ERROR_TYPE_ACTION error should be returned.
|
|
|
|
|
|
|
|
This action modifies the payload of matched flows.
|
|
|
|
|
|
|
|
Action: ``NVGRE_ENCAP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Performs a NVGRE encapsulation action by encapsulating the matched flow in the
|
|
|
|
NVGRE tunnel as defined in the``rte_flow_action_tunnel_encap`` flow item
|
|
|
|
definition.
|
|
|
|
|
|
|
|
This action modifies the payload of matched flows. The flow definition specified
|
|
|
|
in the ``rte_flow_action_tunnel_encap`` action structure must defined a valid
|
|
|
|
NVGRE network overlay which conforms with RFC 7637 (NVGRE: Network
|
|
|
|
Virtualization Using Generic Routing Encapsulation). The pattern must be
|
|
|
|
terminated with the RTE_FLOW_ITEM_TYPE_END item type.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_nvgre_encap:
|
|
|
|
|
|
|
|
.. table:: NVGRE_ENCAP
|
|
|
|
|
|
|
|
+----------------+-------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+================+=====================================+
|
|
|
|
| ``definition`` | NVGRE end-point overlay definition |
|
|
|
|
+----------------+-------------------------------------+
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_nvgre_encap_example:
|
|
|
|
|
|
|
|
.. table:: IPv4 NVGRE flow pattern example.
|
|
|
|
|
|
|
|
+-------+----------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+==========+
|
|
|
|
| 0 | Ethernet |
|
|
|
|
+-------+----------+
|
|
|
|
| 1 | IPv4 |
|
|
|
|
+-------+----------+
|
|
|
|
| 2 | NVGRE |
|
|
|
|
+-------+----------+
|
|
|
|
| 3 | END |
|
|
|
|
+-------+----------+
|
|
|
|
|
|
|
|
Action: ``NVGRE_DECAP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Performs a decapsulation action by stripping all headers of the NVGRE tunnel
|
|
|
|
network overlay from the matched flow.
|
|
|
|
|
|
|
|
The flow items pattern defined for the flow rule with which a ``NVGRE_DECAP``
|
|
|
|
action is specified, must define a valid NVGRE tunnel as per RFC7637. If the
|
|
|
|
flow pattern does not specify a valid NVGRE tunnel then a
|
|
|
|
RTE_FLOW_ERROR_TYPE_ACTION error should be returned.
|
|
|
|
|
|
|
|
This action modifies the payload of matched flows.
|
|
|
|
|
2018-10-22 17:38:09 +00:00
|
|
|
Action: ``RAW_ENCAP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Adds outer header whose template is provided in its data buffer,
|
|
|
|
as defined in the ``rte_flow_action_raw_encap`` definition.
|
|
|
|
|
|
|
|
This action modifies the payload of matched flows. The data supplied must
|
|
|
|
be a valid header, either holding layer 2 data in case of adding layer 2 after
|
|
|
|
decap layer 3 tunnel (for example MPLSoGRE) or complete tunnel definition
|
|
|
|
starting from layer 2 and moving to the tunnel item itself. When applied to
|
|
|
|
the original packet the resulting packet must be a valid packet.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_raw_encap:
|
|
|
|
|
|
|
|
.. table:: RAW_ENCAP
|
|
|
|
|
|
|
|
+----------------+----------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+================+========================================+
|
|
|
|
| ``data`` | Encapsulation data |
|
|
|
|
+----------------+----------------------------------------+
|
|
|
|
| ``preserve`` | Bit-mask of data to preserve on output |
|
|
|
|
+----------------+----------------------------------------+
|
|
|
|
| ``size`` | Size of data and preserve |
|
|
|
|
+----------------+----------------------------------------+
|
|
|
|
|
|
|
|
Action: ``RAW_DECAP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Remove outer header whose template is provided in its data buffer,
|
|
|
|
as defined in the ``rte_flow_action_raw_decap``
|
|
|
|
|
|
|
|
This action modifies the payload of matched flows. The data supplied must
|
|
|
|
be a valid header, either holding layer 2 data in case of removing layer 2
|
2019-04-26 15:14:21 +00:00
|
|
|
before encapsulation of layer 3 tunnel (for example MPLSoGRE) or complete
|
2018-10-22 17:38:09 +00:00
|
|
|
tunnel definition starting from layer 2 and moving to the tunnel item itself.
|
|
|
|
When applied to the original packet the resulting packet must be a
|
|
|
|
valid packet.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_raw_decap:
|
|
|
|
|
|
|
|
.. table:: RAW_DECAP
|
|
|
|
|
|
|
|
+----------------+----------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+================+========================================+
|
|
|
|
| ``data`` | Decapsulation data |
|
|
|
|
+----------------+----------------------------------------+
|
|
|
|
| ``size`` | Size of data |
|
|
|
|
+----------------+----------------------------------------+
|
|
|
|
|
2018-10-09 08:44:36 +00:00
|
|
|
Action: ``SET_IPV4_SRC``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set a new IPv4 source address in the outermost IPv4 header.
|
|
|
|
|
|
|
|
It must be used with a valid RTE_FLOW_ITEM_TYPE_IPV4 flow pattern item.
|
|
|
|
Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_ipv4_src:
|
|
|
|
|
|
|
|
.. table:: SET_IPV4_SRC
|
|
|
|
|
|
|
|
+-----------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===============+=========================+
|
|
|
|
| ``ipv4_addr`` | new IPv4 source address |
|
|
|
|
+---------------+-------------------------+
|
|
|
|
|
|
|
|
Action: ``SET_IPV4_DST``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set a new IPv4 destination address in the outermost IPv4 header.
|
|
|
|
|
|
|
|
It must be used with a valid RTE_FLOW_ITEM_TYPE_IPV4 flow pattern item.
|
|
|
|
Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_ipv4_dst:
|
|
|
|
|
|
|
|
.. table:: SET_IPV4_DST
|
|
|
|
|
|
|
|
+---------------+------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===============+==============================+
|
|
|
|
| ``ipv4_addr`` | new IPv4 destination address |
|
|
|
|
+---------------+------------------------------+
|
|
|
|
|
|
|
|
Action: ``SET_IPV6_SRC``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set a new IPv6 source address in the outermost IPv6 header.
|
|
|
|
|
|
|
|
It must be used with a valid RTE_FLOW_ITEM_TYPE_IPV6 flow pattern item.
|
|
|
|
Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_ipv6_src:
|
|
|
|
|
|
|
|
.. table:: SET_IPV6_SRC
|
|
|
|
|
|
|
|
+---------------+-------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===============+=========================+
|
|
|
|
| ``ipv6_addr`` | new IPv6 source address |
|
|
|
|
+---------------+-------------------------+
|
|
|
|
|
|
|
|
Action: ``SET_IPV6_DST``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set a new IPv6 destination address in the outermost IPv6 header.
|
|
|
|
|
|
|
|
It must be used with a valid RTE_FLOW_ITEM_TYPE_IPV6 flow pattern item.
|
|
|
|
Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_ipv6_dst:
|
|
|
|
|
|
|
|
.. table:: SET_IPV6_DST
|
|
|
|
|
|
|
|
+---------------+------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===============+==============================+
|
|
|
|
| ``ipv6_addr`` | new IPv6 destination address |
|
|
|
|
+---------------+------------------------------+
|
|
|
|
|
2018-10-09 08:44:37 +00:00
|
|
|
Action: ``SET_TP_SRC``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set a new source port number in the outermost TCP/UDP header.
|
|
|
|
|
|
|
|
It must be used with a valid RTE_FLOW_ITEM_TYPE_TCP or RTE_FLOW_ITEM_TYPE_UDP
|
|
|
|
flow pattern item. Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_tp_src:
|
|
|
|
|
|
|
|
.. table:: SET_TP_SRC
|
|
|
|
|
|
|
|
+----------+-------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==========+=========================+
|
|
|
|
| ``port`` | new TCP/UDP source port |
|
|
|
|
+---------------+--------------------+
|
|
|
|
|
|
|
|
Action: ``SET_TP_DST``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set a new destination port number in the outermost TCP/UDP header.
|
|
|
|
|
|
|
|
It must be used with a valid RTE_FLOW_ITEM_TYPE_TCP or RTE_FLOW_ITEM_TYPE_UDP
|
|
|
|
flow pattern item. Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_tp_dst:
|
|
|
|
|
|
|
|
.. table:: SET_TP_DST
|
|
|
|
|
|
|
|
+----------+------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==========+==============================+
|
|
|
|
| ``port`` | new TCP/UDP destination port |
|
|
|
|
+---------------+-------------------------+
|
|
|
|
|
2018-10-06 15:45:34 +00:00
|
|
|
Action: ``MAC_SWAP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Swap the source and destination MAC addresses in the outermost Ethernet
|
|
|
|
header.
|
|
|
|
|
|
|
|
It must be used with a valid RTE_FLOW_ITEM_TYPE_ETH flow pattern item.
|
|
|
|
Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_mac_swap:
|
|
|
|
|
|
|
|
.. table:: MAC_SWAP
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
2018-10-16 08:14:23 +00:00
|
|
|
Action: ``DEC_TTL``
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Decrease TTL value.
|
|
|
|
|
|
|
|
If there is no valid RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6
|
2019-04-26 15:14:21 +00:00
|
|
|
in pattern, Some PMDs will reject rule because behavior will be undefined.
|
2018-10-16 08:14:23 +00:00
|
|
|
|
|
|
|
.. _table_rte_flow_action_dec_ttl:
|
|
|
|
|
|
|
|
.. table:: DEC_TTL
|
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
|
|
|
Action: ``SET_TTL``
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Assigns a new TTL value.
|
|
|
|
|
|
|
|
If there is no valid RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6
|
2019-04-26 15:14:21 +00:00
|
|
|
in pattern, Some PMDs will reject rule because behavior will be undefined.
|
2018-10-16 08:14:23 +00:00
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_ttl:
|
|
|
|
|
|
|
|
.. table:: SET_TTL
|
|
|
|
|
|
|
|
+---------------+--------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===============+====================+
|
|
|
|
| ``ttl_value`` | new TTL value |
|
|
|
|
+---------------+--------------------+
|
|
|
|
|
2018-10-11 13:31:39 +00:00
|
|
|
Action: ``SET_MAC_SRC``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2019-01-09 11:37:59 +00:00
|
|
|
Set source MAC address.
|
|
|
|
|
|
|
|
It must be used with a valid RTE_FLOW_ITEM_TYPE_ETH flow pattern item.
|
|
|
|
Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
2018-10-11 13:31:39 +00:00
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_mac_src:
|
|
|
|
|
|
|
|
.. table:: SET_MAC_SRC
|
|
|
|
|
|
|
|
+--------------+---------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+===============+
|
|
|
|
| ``mac_addr`` | MAC address |
|
|
|
|
+--------------+---------------+
|
|
|
|
|
|
|
|
Action: ``SET_MAC_DST``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2019-01-09 11:37:59 +00:00
|
|
|
Set destination MAC address.
|
|
|
|
|
|
|
|
It must be used with a valid RTE_FLOW_ITEM_TYPE_ETH flow pattern item.
|
|
|
|
Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
2018-10-11 13:31:39 +00:00
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_mac_dst:
|
|
|
|
|
|
|
|
.. table:: SET_MAC_DST
|
|
|
|
|
|
|
|
+--------------+---------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+===============+
|
|
|
|
| ``mac_addr`` | MAC address |
|
|
|
|
+--------------+---------------+
|
|
|
|
|
2019-07-02 14:44:26 +00:00
|
|
|
Action: ``INC_TCP_SEQ``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Increase sequence number in the outermost TCP header.
|
|
|
|
Value to increase TCP sequence number by is a big-endian 32 bit integer.
|
|
|
|
|
|
|
|
Using this action on non-matching traffic will result in undefined behavior.
|
|
|
|
|
|
|
|
Action: ``DEC_TCP_SEQ``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Decrease sequence number in the outermost TCP header.
|
|
|
|
Value to decrease TCP sequence number by is a big-endian 32 bit integer.
|
|
|
|
|
|
|
|
Using this action on non-matching traffic will result in undefined behavior.
|
|
|
|
|
|
|
|
Action: ``INC_TCP_ACK``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Increase acknowledgment number in the outermost TCP header.
|
|
|
|
Value to increase TCP acknowledgment number by is a big-endian 32 bit integer.
|
|
|
|
|
|
|
|
Using this action on non-matching traffic will result in undefined behavior.
|
|
|
|
|
|
|
|
Action: ``DEC_TCP_ACK``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Decrease acknowledgment number in the outermost TCP header.
|
|
|
|
Value to decrease TCP acknowledgment number by is a big-endian 32 bit integer.
|
|
|
|
|
|
|
|
Using this action on non-matching traffic will result in undefined behavior.
|
|
|
|
|
2019-10-27 18:42:28 +00:00
|
|
|
Action: ``SET_TAG``
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set Tag.
|
|
|
|
|
|
|
|
Tag is a transient data used during flow matching. This is not delivered to
|
|
|
|
application. Multiple tags are supported by specifying index.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_tag:
|
|
|
|
|
|
|
|
.. table:: SET_TAG
|
|
|
|
|
|
|
|
+-----------+----------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===========+============================+
|
|
|
|
| ``data`` | 32 bit tag value |
|
|
|
|
+-----------+----------------------------+
|
|
|
|
| ``mask`` | bit-mask applies to "data" |
|
|
|
|
+-----------+----------------------------+
|
|
|
|
| ``index`` | index of tag to set |
|
|
|
|
+-----------+----------------------------+
|
|
|
|
|
ethdev: extend flow metadata
Currently, metadata can be set on egress path via mbuf tx_metadata field
with PKT_TX_METADATA flag and RTE_FLOW_ITEM_TYPE_META matches metadata.
This patch extends the metadata feature usability.
1) RTE_FLOW_ACTION_TYPE_SET_META
When supporting multiple tables, Tx metadata can also be set by a rule and
matched by another rule. This new action allows metadata to be set as a
result of flow match.
2) Metadata on ingress
There's also need to support metadata on ingress. Metadata can be set by
SET_META action and matched by META item like Tx. The final value set by
the action will be delivered to application via metadata dynamic field of
mbuf which can be accessed by RTE_FLOW_DYNF_METADATA() macro or with
rte_flow_dynf_metadata_set() and rte_flow_dynf_metadata_get() helper
routines. PKT_RX_DYNF_METADATA flag will be set along with the data.
The mbuf dynamic field must be registered by calling
rte_flow_dynf_metadata_register() prior to use SET_META action.
The availability of dynamic mbuf metadata field can be checked
with rte_flow_dynf_metadata_avail() routine.
If application is going to engage the metadata feature it registers
the metadata dynamic fields, then PMD checks the metadata field
availability and handles the appropriate fields in datapath.
For loopback/hairpin packet, metadata set on Rx/Tx may or may not be
propagated to the other path depending on hardware capability.
MARK and METADATA look similar and might operate in similar way,
but not interacting.
Initially, there were proposed two metadata related actions:
- RTE_FLOW_ACTION_TYPE_FLAG
- RTE_FLOW_ACTION_TYPE_MARK
These actions set the special flag in the packet metadata, MARK action
stores some specified value in the metadata storage, and, on the packet
receiving PMD puts the flag and value to the mbuf and applications can
see the packet was threated inside flow engine according to the appropriate
RTE flow(s). MARK and FLAG are like some kind of gateway to transfer some
per-packet information from the flow engine to the application via
receiving datapath. Also, there is the item of type RTE_FLOW_ITEM_TYPE_MARK
provided. It allows us to extend the flow match pattern with the capability
to match the metadata values set by MARK/FLAG actions on other flows.
From the datapath point of view, the MARK and FLAG are related to the
receiving side only. It would useful to have the same gateway on the
transmitting side and there was the feature of type RTE_FLOW_ITEM_TYPE_META
was proposed. The application can fill the field in mbuf and this value
will be transferred to some field in the packet metadata inside the flow
engine. It did not matter whether these metadata fields are shared because
of MARK and META items belonged to different domains (receiving and
transmitting) and could be vendor-specific.
So far, so good, DPDK proposes some entities to control metadata inside
the flow engine and gateways to exchange these values on a per-packet basis
via datapaths.
As we can see, the MARK and META means are not symmetric, there is absent
action which would allow us to set META value on the transmitting path.
So, the action of type:
- RTE_FLOW_ACTION_TYPE_SET_META was proposed.
The next, applications raise the new requirements for packet metadata.
The flow ngines are getting more complex, internal switches are introduced,
multiple ports might be supported within the same flow engine namespace.
From the DPDK points of view, it means the packets might be sent on one
eth_dev port and received on the other one, and the packet path inside
the flow engine entirely belongs to the same hardware device. The simplest
example is SR-IOV with PF, VFs and the representors. And there is a
brilliant opportunity to provide some out-of-band channel to transfer
some extra data from one port to another one, besides the packet data
itself. And applications would like to use this opportunity.
It is supposed for application to use trials (with rte_flow_validate)
to detect which metadata features (FLAG, MARK, META) actually supported
by PMD and underlying hardware. It might depend on PMD configuration,
system software, hardware settings, etc., and should be detected
in run time.
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ori Kam <orika@mellanox.com>
2019-11-05 14:19:30 +00:00
|
|
|
Action: ``SET_META``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set metadata. Item ``META`` matches metadata.
|
|
|
|
|
2021-10-15 19:24:08 +00:00
|
|
|
Metadata set by mbuf metadata field with RTE_MBUF_DYNFLAG_TX_METADATA flag on egress
|
2019-11-05 14:19:31 +00:00
|
|
|
will be overridden by this action. On ingress, the metadata will be carried by
|
ethdev: extend flow metadata
Currently, metadata can be set on egress path via mbuf tx_metadata field
with PKT_TX_METADATA flag and RTE_FLOW_ITEM_TYPE_META matches metadata.
This patch extends the metadata feature usability.
1) RTE_FLOW_ACTION_TYPE_SET_META
When supporting multiple tables, Tx metadata can also be set by a rule and
matched by another rule. This new action allows metadata to be set as a
result of flow match.
2) Metadata on ingress
There's also need to support metadata on ingress. Metadata can be set by
SET_META action and matched by META item like Tx. The final value set by
the action will be delivered to application via metadata dynamic field of
mbuf which can be accessed by RTE_FLOW_DYNF_METADATA() macro or with
rte_flow_dynf_metadata_set() and rte_flow_dynf_metadata_get() helper
routines. PKT_RX_DYNF_METADATA flag will be set along with the data.
The mbuf dynamic field must be registered by calling
rte_flow_dynf_metadata_register() prior to use SET_META action.
The availability of dynamic mbuf metadata field can be checked
with rte_flow_dynf_metadata_avail() routine.
If application is going to engage the metadata feature it registers
the metadata dynamic fields, then PMD checks the metadata field
availability and handles the appropriate fields in datapath.
For loopback/hairpin packet, metadata set on Rx/Tx may or may not be
propagated to the other path depending on hardware capability.
MARK and METADATA look similar and might operate in similar way,
but not interacting.
Initially, there were proposed two metadata related actions:
- RTE_FLOW_ACTION_TYPE_FLAG
- RTE_FLOW_ACTION_TYPE_MARK
These actions set the special flag in the packet metadata, MARK action
stores some specified value in the metadata storage, and, on the packet
receiving PMD puts the flag and value to the mbuf and applications can
see the packet was threated inside flow engine according to the appropriate
RTE flow(s). MARK and FLAG are like some kind of gateway to transfer some
per-packet information from the flow engine to the application via
receiving datapath. Also, there is the item of type RTE_FLOW_ITEM_TYPE_MARK
provided. It allows us to extend the flow match pattern with the capability
to match the metadata values set by MARK/FLAG actions on other flows.
From the datapath point of view, the MARK and FLAG are related to the
receiving side only. It would useful to have the same gateway on the
transmitting side and there was the feature of type RTE_FLOW_ITEM_TYPE_META
was proposed. The application can fill the field in mbuf and this value
will be transferred to some field in the packet metadata inside the flow
engine. It did not matter whether these metadata fields are shared because
of MARK and META items belonged to different domains (receiving and
transmitting) and could be vendor-specific.
So far, so good, DPDK proposes some entities to control metadata inside
the flow engine and gateways to exchange these values on a per-packet basis
via datapaths.
As we can see, the MARK and META means are not symmetric, there is absent
action which would allow us to set META value on the transmitting path.
So, the action of type:
- RTE_FLOW_ACTION_TYPE_SET_META was proposed.
The next, applications raise the new requirements for packet metadata.
The flow ngines are getting more complex, internal switches are introduced,
multiple ports might be supported within the same flow engine namespace.
From the DPDK points of view, it means the packets might be sent on one
eth_dev port and received on the other one, and the packet path inside
the flow engine entirely belongs to the same hardware device. The simplest
example is SR-IOV with PF, VFs and the representors. And there is a
brilliant opportunity to provide some out-of-band channel to transfer
some extra data from one port to another one, besides the packet data
itself. And applications would like to use this opportunity.
It is supposed for application to use trials (with rte_flow_validate)
to detect which metadata features (FLAG, MARK, META) actually supported
by PMD and underlying hardware. It might depend on PMD configuration,
system software, hardware settings, etc., and should be detected
in run time.
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ori Kam <orika@mellanox.com>
2019-11-05 14:19:30 +00:00
|
|
|
``metadata`` dynamic field of ``rte_mbuf`` which can be accessed by
|
2021-10-15 19:24:08 +00:00
|
|
|
``RTE_FLOW_DYNF_METADATA()``. RTE_MBUF_DYNFLAG_RX_METADATA flag will be set along
|
ethdev: extend flow metadata
Currently, metadata can be set on egress path via mbuf tx_metadata field
with PKT_TX_METADATA flag and RTE_FLOW_ITEM_TYPE_META matches metadata.
This patch extends the metadata feature usability.
1) RTE_FLOW_ACTION_TYPE_SET_META
When supporting multiple tables, Tx metadata can also be set by a rule and
matched by another rule. This new action allows metadata to be set as a
result of flow match.
2) Metadata on ingress
There's also need to support metadata on ingress. Metadata can be set by
SET_META action and matched by META item like Tx. The final value set by
the action will be delivered to application via metadata dynamic field of
mbuf which can be accessed by RTE_FLOW_DYNF_METADATA() macro or with
rte_flow_dynf_metadata_set() and rte_flow_dynf_metadata_get() helper
routines. PKT_RX_DYNF_METADATA flag will be set along with the data.
The mbuf dynamic field must be registered by calling
rte_flow_dynf_metadata_register() prior to use SET_META action.
The availability of dynamic mbuf metadata field can be checked
with rte_flow_dynf_metadata_avail() routine.
If application is going to engage the metadata feature it registers
the metadata dynamic fields, then PMD checks the metadata field
availability and handles the appropriate fields in datapath.
For loopback/hairpin packet, metadata set on Rx/Tx may or may not be
propagated to the other path depending on hardware capability.
MARK and METADATA look similar and might operate in similar way,
but not interacting.
Initially, there were proposed two metadata related actions:
- RTE_FLOW_ACTION_TYPE_FLAG
- RTE_FLOW_ACTION_TYPE_MARK
These actions set the special flag in the packet metadata, MARK action
stores some specified value in the metadata storage, and, on the packet
receiving PMD puts the flag and value to the mbuf and applications can
see the packet was threated inside flow engine according to the appropriate
RTE flow(s). MARK and FLAG are like some kind of gateway to transfer some
per-packet information from the flow engine to the application via
receiving datapath. Also, there is the item of type RTE_FLOW_ITEM_TYPE_MARK
provided. It allows us to extend the flow match pattern with the capability
to match the metadata values set by MARK/FLAG actions on other flows.
From the datapath point of view, the MARK and FLAG are related to the
receiving side only. It would useful to have the same gateway on the
transmitting side and there was the feature of type RTE_FLOW_ITEM_TYPE_META
was proposed. The application can fill the field in mbuf and this value
will be transferred to some field in the packet metadata inside the flow
engine. It did not matter whether these metadata fields are shared because
of MARK and META items belonged to different domains (receiving and
transmitting) and could be vendor-specific.
So far, so good, DPDK proposes some entities to control metadata inside
the flow engine and gateways to exchange these values on a per-packet basis
via datapaths.
As we can see, the MARK and META means are not symmetric, there is absent
action which would allow us to set META value on the transmitting path.
So, the action of type:
- RTE_FLOW_ACTION_TYPE_SET_META was proposed.
The next, applications raise the new requirements for packet metadata.
The flow ngines are getting more complex, internal switches are introduced,
multiple ports might be supported within the same flow engine namespace.
From the DPDK points of view, it means the packets might be sent on one
eth_dev port and received on the other one, and the packet path inside
the flow engine entirely belongs to the same hardware device. The simplest
example is SR-IOV with PF, VFs and the representors. And there is a
brilliant opportunity to provide some out-of-band channel to transfer
some extra data from one port to another one, besides the packet data
itself. And applications would like to use this opportunity.
It is supposed for application to use trials (with rte_flow_validate)
to detect which metadata features (FLAG, MARK, META) actually supported
by PMD and underlying hardware. It might depend on PMD configuration,
system software, hardware settings, etc., and should be detected
in run time.
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ori Kam <orika@mellanox.com>
2019-11-05 14:19:30 +00:00
|
|
|
with the data.
|
|
|
|
|
|
|
|
The mbuf dynamic field must be registered by calling
|
|
|
|
``rte_flow_dynf_metadata_register()`` prior to use ``SET_META`` action.
|
|
|
|
|
|
|
|
Altering partial bits is supported with ``mask``. For bits which have never been
|
|
|
|
set, unpredictable value will be seen depending on driver implementation. For
|
|
|
|
loopback/hairpin packet, metadata set on Rx/Tx may or may not be propagated to
|
|
|
|
the other path depending on HW capability.
|
|
|
|
|
2020-10-15 13:08:52 +00:00
|
|
|
In hairpin case with Tx explicit flow mode, metadata could (not mandatory) be
|
|
|
|
used to connect the Rx and Tx flows if it can be propagated from Rx to Tx path.
|
|
|
|
|
ethdev: extend flow metadata
Currently, metadata can be set on egress path via mbuf tx_metadata field
with PKT_TX_METADATA flag and RTE_FLOW_ITEM_TYPE_META matches metadata.
This patch extends the metadata feature usability.
1) RTE_FLOW_ACTION_TYPE_SET_META
When supporting multiple tables, Tx metadata can also be set by a rule and
matched by another rule. This new action allows metadata to be set as a
result of flow match.
2) Metadata on ingress
There's also need to support metadata on ingress. Metadata can be set by
SET_META action and matched by META item like Tx. The final value set by
the action will be delivered to application via metadata dynamic field of
mbuf which can be accessed by RTE_FLOW_DYNF_METADATA() macro or with
rte_flow_dynf_metadata_set() and rte_flow_dynf_metadata_get() helper
routines. PKT_RX_DYNF_METADATA flag will be set along with the data.
The mbuf dynamic field must be registered by calling
rte_flow_dynf_metadata_register() prior to use SET_META action.
The availability of dynamic mbuf metadata field can be checked
with rte_flow_dynf_metadata_avail() routine.
If application is going to engage the metadata feature it registers
the metadata dynamic fields, then PMD checks the metadata field
availability and handles the appropriate fields in datapath.
For loopback/hairpin packet, metadata set on Rx/Tx may or may not be
propagated to the other path depending on hardware capability.
MARK and METADATA look similar and might operate in similar way,
but not interacting.
Initially, there were proposed two metadata related actions:
- RTE_FLOW_ACTION_TYPE_FLAG
- RTE_FLOW_ACTION_TYPE_MARK
These actions set the special flag in the packet metadata, MARK action
stores some specified value in the metadata storage, and, on the packet
receiving PMD puts the flag and value to the mbuf and applications can
see the packet was threated inside flow engine according to the appropriate
RTE flow(s). MARK and FLAG are like some kind of gateway to transfer some
per-packet information from the flow engine to the application via
receiving datapath. Also, there is the item of type RTE_FLOW_ITEM_TYPE_MARK
provided. It allows us to extend the flow match pattern with the capability
to match the metadata values set by MARK/FLAG actions on other flows.
From the datapath point of view, the MARK and FLAG are related to the
receiving side only. It would useful to have the same gateway on the
transmitting side and there was the feature of type RTE_FLOW_ITEM_TYPE_META
was proposed. The application can fill the field in mbuf and this value
will be transferred to some field in the packet metadata inside the flow
engine. It did not matter whether these metadata fields are shared because
of MARK and META items belonged to different domains (receiving and
transmitting) and could be vendor-specific.
So far, so good, DPDK proposes some entities to control metadata inside
the flow engine and gateways to exchange these values on a per-packet basis
via datapaths.
As we can see, the MARK and META means are not symmetric, there is absent
action which would allow us to set META value on the transmitting path.
So, the action of type:
- RTE_FLOW_ACTION_TYPE_SET_META was proposed.
The next, applications raise the new requirements for packet metadata.
The flow ngines are getting more complex, internal switches are introduced,
multiple ports might be supported within the same flow engine namespace.
From the DPDK points of view, it means the packets might be sent on one
eth_dev port and received on the other one, and the packet path inside
the flow engine entirely belongs to the same hardware device. The simplest
example is SR-IOV with PF, VFs and the representors. And there is a
brilliant opportunity to provide some out-of-band channel to transfer
some extra data from one port to another one, besides the packet data
itself. And applications would like to use this opportunity.
It is supposed for application to use trials (with rte_flow_validate)
to detect which metadata features (FLAG, MARK, META) actually supported
by PMD and underlying hardware. It might depend on PMD configuration,
system software, hardware settings, etc., and should be detected
in run time.
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ori Kam <orika@mellanox.com>
2019-11-05 14:19:30 +00:00
|
|
|
.. _table_rte_flow_action_set_meta:
|
|
|
|
|
|
|
|
.. table:: SET_META
|
|
|
|
|
|
|
|
+----------+----------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==========+============================+
|
|
|
|
| ``data`` | 32 bit metadata value |
|
|
|
|
+----------+----------------------------+
|
|
|
|
| ``mask`` | bit-mask applies to "data" |
|
|
|
|
+----------+----------------------------+
|
|
|
|
|
2020-01-07 07:24:01 +00:00
|
|
|
Action: ``SET_IPV4_DSCP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set IPv4 DSCP.
|
|
|
|
|
|
|
|
Modify DSCP in IPv4 header.
|
|
|
|
|
|
|
|
It must be used with RTE_FLOW_ITEM_TYPE_IPV4 in pattern.
|
|
|
|
Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_ipv4_dscp:
|
|
|
|
|
|
|
|
.. table:: SET_IPV4_DSCP
|
|
|
|
|
|
|
|
+-----------+---------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===========+=================================+
|
|
|
|
| ``dscp`` | DSCP in low 6 bits, rest ignore |
|
|
|
|
+-----------+---------------------------------+
|
|
|
|
|
|
|
|
Action: ``SET_IPV6_DSCP``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set IPv6 DSCP.
|
|
|
|
|
|
|
|
Modify DSCP in IPv6 header.
|
|
|
|
|
|
|
|
It must be used with RTE_FLOW_ITEM_TYPE_IPV6 in pattern.
|
|
|
|
Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_set_ipv6_dscp:
|
|
|
|
|
|
|
|
.. table:: SET_IPV6_DSCP
|
|
|
|
|
|
|
|
+-----------+---------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+===========+=================================+
|
|
|
|
| ``dscp`` | DSCP in low 6 bits, rest ignore |
|
|
|
|
+-----------+---------------------------------+
|
|
|
|
|
2020-04-21 10:11:38 +00:00
|
|
|
Action: ``AGE``
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Set ageing timeout configuration to a flow.
|
|
|
|
|
|
|
|
Event RTE_ETH_EVENT_FLOW_AGED will be reported if
|
|
|
|
timeout passed without any matching on the flow.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_age:
|
|
|
|
|
|
|
|
.. table:: AGE
|
|
|
|
|
|
|
|
+--------------+---------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+=================================+
|
|
|
|
| ``timeout`` | 24 bits timeout value |
|
|
|
|
+--------------+---------------------------------+
|
|
|
|
| ``reserved`` | 8 bits reserved, must be zero |
|
|
|
|
+--------------+---------------------------------+
|
|
|
|
| ``context`` | user input flow context |
|
|
|
|
+--------------+---------------------------------+
|
|
|
|
|
2020-10-07 13:28:42 +00:00
|
|
|
Query structure to retrieve ageing status information of a
|
|
|
|
shared AGE action, or a flow rule using the AGE action:
|
|
|
|
|
|
|
|
.. _table_rte_flow_query_age:
|
|
|
|
|
|
|
|
.. table:: AGE query
|
|
|
|
|
|
|
|
+------------------------------+-----+----------------------------------------+
|
|
|
|
| Field | I/O | Value |
|
|
|
|
+==============================+=====+========================================+
|
|
|
|
| ``aged`` | out | Aging timeout expired |
|
|
|
|
+------------------------------+-----+----------------------------------------+
|
|
|
|
| ``sec_since_last_hit_valid`` | out | ``sec_since_last_hit`` value is valid |
|
|
|
|
+------------------------------+-----+----------------------------------------+
|
|
|
|
| ``sec_since_last_hit`` | out | Seconds since last traffic hit |
|
|
|
|
+------------------------------+-----+----------------------------------------+
|
|
|
|
|
2020-10-09 13:46:04 +00:00
|
|
|
Action: ``SAMPLE``
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Adds a sample action to a matched flow.
|
|
|
|
|
|
|
|
The matching packets will be duplicated with the specified ``ratio`` and
|
|
|
|
applied with own set of actions with a fate action, the packets sampled
|
|
|
|
equals is '1/ratio'. All the packets continue to the target destination.
|
|
|
|
|
|
|
|
When the ``ratio`` is set to 1 then the packets will be 100% mirrored.
|
|
|
|
``actions`` represent the different set of actions for the sampled or mirrored
|
|
|
|
packets, and must have a fate action.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_sample:
|
|
|
|
|
|
|
|
.. table:: SAMPLE
|
|
|
|
|
|
|
|
+--------------+---------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==============+=================================+
|
|
|
|
| ``ratio`` | 32 bits sample ratio value |
|
|
|
|
+--------------+---------------------------------+
|
|
|
|
| ``actions`` | sub-action list for sampling |
|
|
|
|
+--------------+---------------------------------+
|
|
|
|
|
ethdev: introduce indirect flow action
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 14:38:29 +00:00
|
|
|
Action: ``INDIRECT``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
ethdev: add shared actions to flow API
Introduce extension of flow action API enabling sharing of single
rte_flow_action in multiple flows. The API intended for PMDs, where
multiple HW offloaded flows can reuse the same HW essence/object
representing flow action and modification of such an essence/object
affects all the rules using it.
Motivation and example
===
Adding or removing one or more queues to RSS used by multiple flow rules
imposes per rule toll for current DPDK flow API; the scenario requires
for each flow sharing cloned RSS action:
- call `rte_flow_destroy()`
- call `rte_flow_create()` with modified RSS action
API for sharing action and its in-place update benefits:
- reduce the overhead of multiple RSS flow rules reconfiguration
- optimize resource utilization by sharing action across multiple
flows
Change description
===
Shared action
===
In order to represent flow action shared by multiple flows new action
type RTE_FLOW_ACTION_TYPE_SHARED is introduced (see `enum
rte_flow_action_type`).
Actually the introduced API decouples action from any specific flow and
enables sharing of single action by its handle across multiple flows.
Shared action create/use/destroy
===
Shared action may be reused by some or none flow rules at any given
moment, i.e. shared action resides outside of the context of any flow.
Shared action represent HW resources/objects used for action offloading
implementation.
API for shared action create (see `rte_flow_shared_action_create()`):
- should allocate HW resources and make related initializations required
for shared action implementation.
- make necessary preparations to maintain shared access to
the action resources, configuration and state.
API for shared action destroy (see `rte_flow_shared_action_destroy()`)
should release HW resources and make related cleanups required for shared
action implementation.
In order to share some flow action reuse the handle of type
`struct rte_flow_shared_action` returned by
rte_flow_shared_action_create() as a `conf` field of
`struct rte_flow_action` (see "example" section).
If some shared action not used by any flow rule all resources allocated
by the shared action can be released by rte_flow_shared_action_destroy()
(see "example" section). The shared action handle passed as argument to
destroy API should not be used any further i.e. result of the usage is
undefined.
Shared action re-configuration
===
Shared action behavior defined by its configuration can be updated via
rte_flow_shared_action_update() (see "example" section). The shared
action update operation modifies HW related resources/objects allocated
on the action creation. The number of operations performed by the update
operation should not depend on the number of flows sharing the related
action. On return of shared action update API action behavior should be
according to updated configuration for all flows sharing the action.
Shared action query
===
Provide separate API to query shared action state (see
rte_flow_shared_action_update()). Taking a counter as an example: query
returns value aggregating all counter increments across all flow rules
sharing the counter. This API doesn't query shared action configuration
since it is controlled by rte_flow_shared_action_create() and
rte_flow_shared_action_update() APIs and no supposed to change by other
means.
example
===
struct rte_flow_action actions[2];
struct rte_flow_shared_action_conf conf;
struct rte_flow_action action;
/* skipped: initialize conf and action */
struct rte_flow_shared_action *handle =
rte_flow_shared_action_create(port_id, &conf, &action, &error);
actions[0].type = RTE_FLOW_ACTION_TYPE_SHARED;
actions[0].conf = handle;
actions[1].type = RTE_FLOW_ACTION_TYPE_END;
/* skipped: init attr0 & pattern0 args */
struct rte_flow *flow0 = rte_flow_create(port_id, &attr0, pattern0,
actions, error);
/* create more rules reusing shared action */
struct rte_flow *flow1 = rte_flow_create(port_id, &attr1, pattern1,
actions, error);
/* skipped: for flows 2 till N */
struct rte_flow *flowN = rte_flow_create(port_id, &attrN, patternN,
actions, error);
/* update shared action */
struct rte_flow_action updated_action;
/*
* skipped: initialize updated_action according to desired action
* configuration change
*/
rte_flow_shared_action_update(port_id, handle, &updated_action, error);
/*
* from now on all flows 1 till N will act according to configuration of
* updated_action
*/
/* skipped: destroy all flows 1 till N */
rte_flow_shared_action_destroy(port_id, handle, error);
Signed-off-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2020-10-14 11:40:14 +00:00
|
|
|
|
ethdev: introduce indirect flow action
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 14:38:29 +00:00
|
|
|
Flow utilize indirect action by handle as returned from
|
|
|
|
``rte_flow_action_handle_create()``.
|
ethdev: add shared actions to flow API
Introduce extension of flow action API enabling sharing of single
rte_flow_action in multiple flows. The API intended for PMDs, where
multiple HW offloaded flows can reuse the same HW essence/object
representing flow action and modification of such an essence/object
affects all the rules using it.
Motivation and example
===
Adding or removing one or more queues to RSS used by multiple flow rules
imposes per rule toll for current DPDK flow API; the scenario requires
for each flow sharing cloned RSS action:
- call `rte_flow_destroy()`
- call `rte_flow_create()` with modified RSS action
API for sharing action and its in-place update benefits:
- reduce the overhead of multiple RSS flow rules reconfiguration
- optimize resource utilization by sharing action across multiple
flows
Change description
===
Shared action
===
In order to represent flow action shared by multiple flows new action
type RTE_FLOW_ACTION_TYPE_SHARED is introduced (see `enum
rte_flow_action_type`).
Actually the introduced API decouples action from any specific flow and
enables sharing of single action by its handle across multiple flows.
Shared action create/use/destroy
===
Shared action may be reused by some or none flow rules at any given
moment, i.e. shared action resides outside of the context of any flow.
Shared action represent HW resources/objects used for action offloading
implementation.
API for shared action create (see `rte_flow_shared_action_create()`):
- should allocate HW resources and make related initializations required
for shared action implementation.
- make necessary preparations to maintain shared access to
the action resources, configuration and state.
API for shared action destroy (see `rte_flow_shared_action_destroy()`)
should release HW resources and make related cleanups required for shared
action implementation.
In order to share some flow action reuse the handle of type
`struct rte_flow_shared_action` returned by
rte_flow_shared_action_create() as a `conf` field of
`struct rte_flow_action` (see "example" section).
If some shared action not used by any flow rule all resources allocated
by the shared action can be released by rte_flow_shared_action_destroy()
(see "example" section). The shared action handle passed as argument to
destroy API should not be used any further i.e. result of the usage is
undefined.
Shared action re-configuration
===
Shared action behavior defined by its configuration can be updated via
rte_flow_shared_action_update() (see "example" section). The shared
action update operation modifies HW related resources/objects allocated
on the action creation. The number of operations performed by the update
operation should not depend on the number of flows sharing the related
action. On return of shared action update API action behavior should be
according to updated configuration for all flows sharing the action.
Shared action query
===
Provide separate API to query shared action state (see
rte_flow_shared_action_update()). Taking a counter as an example: query
returns value aggregating all counter increments across all flow rules
sharing the counter. This API doesn't query shared action configuration
since it is controlled by rte_flow_shared_action_create() and
rte_flow_shared_action_update() APIs and no supposed to change by other
means.
example
===
struct rte_flow_action actions[2];
struct rte_flow_shared_action_conf conf;
struct rte_flow_action action;
/* skipped: initialize conf and action */
struct rte_flow_shared_action *handle =
rte_flow_shared_action_create(port_id, &conf, &action, &error);
actions[0].type = RTE_FLOW_ACTION_TYPE_SHARED;
actions[0].conf = handle;
actions[1].type = RTE_FLOW_ACTION_TYPE_END;
/* skipped: init attr0 & pattern0 args */
struct rte_flow *flow0 = rte_flow_create(port_id, &attr0, pattern0,
actions, error);
/* create more rules reusing shared action */
struct rte_flow *flow1 = rte_flow_create(port_id, &attr1, pattern1,
actions, error);
/* skipped: for flows 2 till N */
struct rte_flow *flowN = rte_flow_create(port_id, &attrN, patternN,
actions, error);
/* update shared action */
struct rte_flow_action updated_action;
/*
* skipped: initialize updated_action according to desired action
* configuration change
*/
rte_flow_shared_action_update(port_id, handle, &updated_action, error);
/*
* from now on all flows 1 till N will act according to configuration of
* updated_action
*/
/* skipped: destroy all flows 1 till N */
rte_flow_shared_action_destroy(port_id, handle, error);
Signed-off-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2020-10-14 11:40:14 +00:00
|
|
|
|
ethdev: introduce indirect flow action
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 14:38:29 +00:00
|
|
|
The behaviour of the indirect action defined by ``action`` argument of type
|
|
|
|
``struct rte_flow_action`` passed to ``rte_flow_action_handle_create()``.
|
ethdev: add shared actions to flow API
Introduce extension of flow action API enabling sharing of single
rte_flow_action in multiple flows. The API intended for PMDs, where
multiple HW offloaded flows can reuse the same HW essence/object
representing flow action and modification of such an essence/object
affects all the rules using it.
Motivation and example
===
Adding or removing one or more queues to RSS used by multiple flow rules
imposes per rule toll for current DPDK flow API; the scenario requires
for each flow sharing cloned RSS action:
- call `rte_flow_destroy()`
- call `rte_flow_create()` with modified RSS action
API for sharing action and its in-place update benefits:
- reduce the overhead of multiple RSS flow rules reconfiguration
- optimize resource utilization by sharing action across multiple
flows
Change description
===
Shared action
===
In order to represent flow action shared by multiple flows new action
type RTE_FLOW_ACTION_TYPE_SHARED is introduced (see `enum
rte_flow_action_type`).
Actually the introduced API decouples action from any specific flow and
enables sharing of single action by its handle across multiple flows.
Shared action create/use/destroy
===
Shared action may be reused by some or none flow rules at any given
moment, i.e. shared action resides outside of the context of any flow.
Shared action represent HW resources/objects used for action offloading
implementation.
API for shared action create (see `rte_flow_shared_action_create()`):
- should allocate HW resources and make related initializations required
for shared action implementation.
- make necessary preparations to maintain shared access to
the action resources, configuration and state.
API for shared action destroy (see `rte_flow_shared_action_destroy()`)
should release HW resources and make related cleanups required for shared
action implementation.
In order to share some flow action reuse the handle of type
`struct rte_flow_shared_action` returned by
rte_flow_shared_action_create() as a `conf` field of
`struct rte_flow_action` (see "example" section).
If some shared action not used by any flow rule all resources allocated
by the shared action can be released by rte_flow_shared_action_destroy()
(see "example" section). The shared action handle passed as argument to
destroy API should not be used any further i.e. result of the usage is
undefined.
Shared action re-configuration
===
Shared action behavior defined by its configuration can be updated via
rte_flow_shared_action_update() (see "example" section). The shared
action update operation modifies HW related resources/objects allocated
on the action creation. The number of operations performed by the update
operation should not depend on the number of flows sharing the related
action. On return of shared action update API action behavior should be
according to updated configuration for all flows sharing the action.
Shared action query
===
Provide separate API to query shared action state (see
rte_flow_shared_action_update()). Taking a counter as an example: query
returns value aggregating all counter increments across all flow rules
sharing the counter. This API doesn't query shared action configuration
since it is controlled by rte_flow_shared_action_create() and
rte_flow_shared_action_update() APIs and no supposed to change by other
means.
example
===
struct rte_flow_action actions[2];
struct rte_flow_shared_action_conf conf;
struct rte_flow_action action;
/* skipped: initialize conf and action */
struct rte_flow_shared_action *handle =
rte_flow_shared_action_create(port_id, &conf, &action, &error);
actions[0].type = RTE_FLOW_ACTION_TYPE_SHARED;
actions[0].conf = handle;
actions[1].type = RTE_FLOW_ACTION_TYPE_END;
/* skipped: init attr0 & pattern0 args */
struct rte_flow *flow0 = rte_flow_create(port_id, &attr0, pattern0,
actions, error);
/* create more rules reusing shared action */
struct rte_flow *flow1 = rte_flow_create(port_id, &attr1, pattern1,
actions, error);
/* skipped: for flows 2 till N */
struct rte_flow *flowN = rte_flow_create(port_id, &attrN, patternN,
actions, error);
/* update shared action */
struct rte_flow_action updated_action;
/*
* skipped: initialize updated_action according to desired action
* configuration change
*/
rte_flow_shared_action_update(port_id, handle, &updated_action, error);
/*
* from now on all flows 1 till N will act according to configuration of
* updated_action
*/
/* skipped: destroy all flows 1 till N */
rte_flow_shared_action_destroy(port_id, handle, error);
Signed-off-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2020-10-14 11:40:14 +00:00
|
|
|
|
ethdev: introduce indirect flow action
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 14:38:29 +00:00
|
|
|
The indirect action can be used by a single flow or shared among multiple flows.
|
|
|
|
The indirect action can be in-place updated by ``rte_flow_action_handle_update()``
|
|
|
|
without destroying flow and creating flow again. The fields that could be
|
|
|
|
updated depend on the type of the ``action`` and different for every type.
|
2021-02-02 12:23:50 +00:00
|
|
|
|
ethdev: introduce indirect flow action
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 14:38:29 +00:00
|
|
|
The indirect action specified data (e.g. counter) can be queried by
|
|
|
|
``rte_flow_action_handle_query()``.
|
2021-02-02 12:23:50 +00:00
|
|
|
|
ethdev: add capability to keep shared objects on restart
rte_flow_action_handle_create() did not mention what happens
with an indirect action when a device is stopped and started again.
It is natural for some indirect actions, like counter, to be persistent.
Keeping others at least saves application time and complexity.
However, not all PMDs can support it, or the support may be limited
by particular action kinds, that is, combinations of action type
and the value of the transfer bit in its configuration.
Add a device capability to indicate if at least some indirect actions
are kept across the above sequence. Without this capability the behavior
is still unspecified, and application is required to destroy
the indirect actions before stopping the device.
In the future, indirect actions may not be the only type of objects
shared between flow rules. The capability bit intends to cover all
possible types of such objects, hence its name.
Declare that the application can test for the persistence
of a particular indirect action kind by attempting to create
an indirect action of that kind when the device is stopped
and checking for the specific error type.
This is logical because if the PMD can to create an indirect action
when the device is not started and use it after the start happens,
it is natural that it can move its internal flow shared object
to the same state when the device is stopped and restore the state
when the device is started.
Indirect action persistence across a reconfigurations is not required.
In case a PMD cannot keep the indirect actions across reconfiguration,
it is allowed just to report an error.
Application must then flush the indirect actions before attempting it.
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2021-11-02 17:01:31 +00:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
The following description of indirect action persistence
|
|
|
|
is an experimental behavior that may change without a prior notice.
|
|
|
|
|
|
|
|
If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised,
|
|
|
|
indirect actions cannot be created until the device is started for the first time
|
|
|
|
and cannot be kept when the device is stopped.
|
|
|
|
However, PMD also does not flush them automatically on stop,
|
|
|
|
so the application must call ``rte_flow_action_handle_destroy()``
|
|
|
|
before stopping the device to ensure no indirect actions remain.
|
|
|
|
|
|
|
|
If ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised,
|
|
|
|
this means that the PMD can keep at least some indirect actions
|
|
|
|
across device stop and start.
|
|
|
|
However, ``rte_eth_dev_configure()`` may fail if any indirect actions remain,
|
|
|
|
so the application must destroy them before attempting a reconfiguration.
|
|
|
|
Keeping may be only supported for certain kinds of indirect actions.
|
|
|
|
A kind is a combination of an action type and a value of its transfer bit.
|
|
|
|
For example: an indirect counter with the transfer bit reset.
|
|
|
|
To test if a particular kind of indirect actions is kept,
|
|
|
|
the application must try to create a valid indirect action of that kind
|
|
|
|
when the device is not started (either before the first start of after a stop).
|
|
|
|
If it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``,
|
|
|
|
application must destroy all indirect actions of this kind
|
|
|
|
before stopping the device.
|
|
|
|
If it succeeds, all indirect actions of the same kind are kept
|
|
|
|
when the device is stopped.
|
|
|
|
Indirect actions of a kept kind that are created when the device is stopped,
|
|
|
|
including the ones created for the test, will be kept after the device start.
|
|
|
|
|
ethdev: introduce indirect flow action
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 14:38:29 +00:00
|
|
|
.. _table_rte_flow_action_handle:
|
ethdev: add shared actions to flow API
Introduce extension of flow action API enabling sharing of single
rte_flow_action in multiple flows. The API intended for PMDs, where
multiple HW offloaded flows can reuse the same HW essence/object
representing flow action and modification of such an essence/object
affects all the rules using it.
Motivation and example
===
Adding or removing one or more queues to RSS used by multiple flow rules
imposes per rule toll for current DPDK flow API; the scenario requires
for each flow sharing cloned RSS action:
- call `rte_flow_destroy()`
- call `rte_flow_create()` with modified RSS action
API for sharing action and its in-place update benefits:
- reduce the overhead of multiple RSS flow rules reconfiguration
- optimize resource utilization by sharing action across multiple
flows
Change description
===
Shared action
===
In order to represent flow action shared by multiple flows new action
type RTE_FLOW_ACTION_TYPE_SHARED is introduced (see `enum
rte_flow_action_type`).
Actually the introduced API decouples action from any specific flow and
enables sharing of single action by its handle across multiple flows.
Shared action create/use/destroy
===
Shared action may be reused by some or none flow rules at any given
moment, i.e. shared action resides outside of the context of any flow.
Shared action represent HW resources/objects used for action offloading
implementation.
API for shared action create (see `rte_flow_shared_action_create()`):
- should allocate HW resources and make related initializations required
for shared action implementation.
- make necessary preparations to maintain shared access to
the action resources, configuration and state.
API for shared action destroy (see `rte_flow_shared_action_destroy()`)
should release HW resources and make related cleanups required for shared
action implementation.
In order to share some flow action reuse the handle of type
`struct rte_flow_shared_action` returned by
rte_flow_shared_action_create() as a `conf` field of
`struct rte_flow_action` (see "example" section).
If some shared action not used by any flow rule all resources allocated
by the shared action can be released by rte_flow_shared_action_destroy()
(see "example" section). The shared action handle passed as argument to
destroy API should not be used any further i.e. result of the usage is
undefined.
Shared action re-configuration
===
Shared action behavior defined by its configuration can be updated via
rte_flow_shared_action_update() (see "example" section). The shared
action update operation modifies HW related resources/objects allocated
on the action creation. The number of operations performed by the update
operation should not depend on the number of flows sharing the related
action. On return of shared action update API action behavior should be
according to updated configuration for all flows sharing the action.
Shared action query
===
Provide separate API to query shared action state (see
rte_flow_shared_action_update()). Taking a counter as an example: query
returns value aggregating all counter increments across all flow rules
sharing the counter. This API doesn't query shared action configuration
since it is controlled by rte_flow_shared_action_create() and
rte_flow_shared_action_update() APIs and no supposed to change by other
means.
example
===
struct rte_flow_action actions[2];
struct rte_flow_shared_action_conf conf;
struct rte_flow_action action;
/* skipped: initialize conf and action */
struct rte_flow_shared_action *handle =
rte_flow_shared_action_create(port_id, &conf, &action, &error);
actions[0].type = RTE_FLOW_ACTION_TYPE_SHARED;
actions[0].conf = handle;
actions[1].type = RTE_FLOW_ACTION_TYPE_END;
/* skipped: init attr0 & pattern0 args */
struct rte_flow *flow0 = rte_flow_create(port_id, &attr0, pattern0,
actions, error);
/* create more rules reusing shared action */
struct rte_flow *flow1 = rte_flow_create(port_id, &attr1, pattern1,
actions, error);
/* skipped: for flows 2 till N */
struct rte_flow *flowN = rte_flow_create(port_id, &attrN, patternN,
actions, error);
/* update shared action */
struct rte_flow_action updated_action;
/*
* skipped: initialize updated_action according to desired action
* configuration change
*/
rte_flow_shared_action_update(port_id, handle, &updated_action, error);
/*
* from now on all flows 1 till N will act according to configuration of
* updated_action
*/
/* skipped: destroy all flows 1 till N */
rte_flow_shared_action_destroy(port_id, handle, error);
Signed-off-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2020-10-14 11:40:14 +00:00
|
|
|
|
ethdev: introduce indirect flow action
Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.
The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.
There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
within a flow rule. Such action is tied to its flow rule and
cannot be reused.
2. the indirect action, in the past, named shared_action. It is
created from a direct actioni, like count or rss, and then used
in the flow rules with an object handle. The PMD will take care
of the retrieve from indirect action to the direct action
when it is referenced.
The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.
The old name "shared" is improper in a sense and should be replaced.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.
The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
counter, the only "update" supported should be the reset. So
passing a rte_flow_action struct pointer is meaningless and
there is even no such corresponding action struct. What's more,
if more than one operations should be supported, for some other
action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
parameter will not provide the ability to indicate which part(s)
to update.
For different types of indirect action objects, the pointer could
either be the same of rte_flow_action* struct - in order not to
break the current driver implementation, or some wrapper
structures with bits as masks to indicate which part to be
updated, depending on real needs of the corresponding direct
action. For different direct actions, the structures of indirect
action objects updating will be different.
All the underlayer PMD callbacks will be moved to these new APIs.
The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.
Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 14:38:29 +00:00
|
|
|
.. table:: INDIRECT
|
ethdev: add shared actions to flow API
Introduce extension of flow action API enabling sharing of single
rte_flow_action in multiple flows. The API intended for PMDs, where
multiple HW offloaded flows can reuse the same HW essence/object
representing flow action and modification of such an essence/object
affects all the rules using it.
Motivation and example
===
Adding or removing one or more queues to RSS used by multiple flow rules
imposes per rule toll for current DPDK flow API; the scenario requires
for each flow sharing cloned RSS action:
- call `rte_flow_destroy()`
- call `rte_flow_create()` with modified RSS action
API for sharing action and its in-place update benefits:
- reduce the overhead of multiple RSS flow rules reconfiguration
- optimize resource utilization by sharing action across multiple
flows
Change description
===
Shared action
===
In order to represent flow action shared by multiple flows new action
type RTE_FLOW_ACTION_TYPE_SHARED is introduced (see `enum
rte_flow_action_type`).
Actually the introduced API decouples action from any specific flow and
enables sharing of single action by its handle across multiple flows.
Shared action create/use/destroy
===
Shared action may be reused by some or none flow rules at any given
moment, i.e. shared action resides outside of the context of any flow.
Shared action represent HW resources/objects used for action offloading
implementation.
API for shared action create (see `rte_flow_shared_action_create()`):
- should allocate HW resources and make related initializations required
for shared action implementation.
- make necessary preparations to maintain shared access to
the action resources, configuration and state.
API for shared action destroy (see `rte_flow_shared_action_destroy()`)
should release HW resources and make related cleanups required for shared
action implementation.
In order to share some flow action reuse the handle of type
`struct rte_flow_shared_action` returned by
rte_flow_shared_action_create() as a `conf` field of
`struct rte_flow_action` (see "example" section).
If some shared action not used by any flow rule all resources allocated
by the shared action can be released by rte_flow_shared_action_destroy()
(see "example" section). The shared action handle passed as argument to
destroy API should not be used any further i.e. result of the usage is
undefined.
Shared action re-configuration
===
Shared action behavior defined by its configuration can be updated via
rte_flow_shared_action_update() (see "example" section). The shared
action update operation modifies HW related resources/objects allocated
on the action creation. The number of operations performed by the update
operation should not depend on the number of flows sharing the related
action. On return of shared action update API action behavior should be
according to updated configuration for all flows sharing the action.
Shared action query
===
Provide separate API to query shared action state (see
rte_flow_shared_action_update()). Taking a counter as an example: query
returns value aggregating all counter increments across all flow rules
sharing the counter. This API doesn't query shared action configuration
since it is controlled by rte_flow_shared_action_create() and
rte_flow_shared_action_update() APIs and no supposed to change by other
means.
example
===
struct rte_flow_action actions[2];
struct rte_flow_shared_action_conf conf;
struct rte_flow_action action;
/* skipped: initialize conf and action */
struct rte_flow_shared_action *handle =
rte_flow_shared_action_create(port_id, &conf, &action, &error);
actions[0].type = RTE_FLOW_ACTION_TYPE_SHARED;
actions[0].conf = handle;
actions[1].type = RTE_FLOW_ACTION_TYPE_END;
/* skipped: init attr0 & pattern0 args */
struct rte_flow *flow0 = rte_flow_create(port_id, &attr0, pattern0,
actions, error);
/* create more rules reusing shared action */
struct rte_flow *flow1 = rte_flow_create(port_id, &attr1, pattern1,
actions, error);
/* skipped: for flows 2 till N */
struct rte_flow *flowN = rte_flow_create(port_id, &attrN, patternN,
actions, error);
/* update shared action */
struct rte_flow_action updated_action;
/*
* skipped: initialize updated_action according to desired action
* configuration change
*/
rte_flow_shared_action_update(port_id, handle, &updated_action, error);
/*
* from now on all flows 1 till N will act according to configuration of
* updated_action
*/
/* skipped: destroy all flows 1 till N */
rte_flow_shared_action_destroy(port_id, handle, error);
Signed-off-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2020-10-14 11:40:14 +00:00
|
|
|
|
|
|
|
+---------------+
|
|
|
|
| Field |
|
|
|
|
+===============+
|
|
|
|
| no properties |
|
|
|
|
+---------------+
|
|
|
|
|
2021-01-18 21:40:25 +00:00
|
|
|
Action: ``MODIFY_FIELD``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Modify ``dst`` field according to ``op`` selected (set, addition,
|
|
|
|
subtraction) with ``width`` bits of data from ``src`` field.
|
|
|
|
|
|
|
|
Any arbitrary header field (as well as mark, metadata or tag values)
|
|
|
|
can be used as both source and destination fields as set by ``field``.
|
|
|
|
The immediate value ``RTE_FLOW_FIELD_VALUE`` (or a pointer to it
|
|
|
|
``RTE_FLOW_FIELD_POINTER``) is allowed as a source only.
|
|
|
|
``RTE_FLOW_FIELD_START`` is used to point to the beginning of a packet.
|
2021-04-08 12:32:58 +00:00
|
|
|
See ``enum rte_flow_field_id`` for the list of supported fields.
|
2021-01-18 21:40:25 +00:00
|
|
|
|
|
|
|
``op`` selects the operation to perform on a destination field.
|
|
|
|
- ``set`` copies the data from ``src`` field to ``dst`` field.
|
|
|
|
- ``add`` adds together ``dst`` and ``src`` and stores the result into ``dst``.
|
|
|
|
- ``sub`` subtracts ``src`` from ``dst`` and stores the result into ``dst``
|
|
|
|
|
|
|
|
``width`` defines a number of bits to use from ``src`` field.
|
|
|
|
|
|
|
|
``level`` is used to access any packet field on any encapsulation level
|
|
|
|
as well as any tag element in the tag array.
|
|
|
|
- ``0`` means the default behaviour. Depending on the packet type, it can
|
|
|
|
mean outermost, innermost or anything in between.
|
|
|
|
- ``1`` requests access to the outermost packet encapsulation level.
|
|
|
|
- ``2`` and subsequent values requests access to the specified packet
|
|
|
|
encapsulation level, from outermost to innermost (lower to higher values).
|
|
|
|
For the tag array (in case of multiple tags are supported and present)
|
|
|
|
``level`` translates directly into the array index.
|
|
|
|
|
|
|
|
``offset`` specifies the number of bits to skip from a field's start.
|
|
|
|
That allows performing a partial copy of the needed part or to divide a big
|
|
|
|
packet field into multiple smaller fields. Alternatively, ``offset`` allows
|
|
|
|
going past the specified packet field boundary to copy a field to an
|
|
|
|
arbitrary place in a packet, essentially providing a way to copy any part of
|
|
|
|
a packet to any other part of it.
|
|
|
|
|
|
|
|
``value`` sets an immediate value to be used as a source or points to a
|
|
|
|
location of the value in memory. It is used instead of ``level`` and ``offset``
|
|
|
|
for ``RTE_FLOW_FIELD_VALUE`` and ``RTE_FLOW_FIELD_POINTER`` respectively.
|
2021-10-13 18:45:12 +00:00
|
|
|
The data in memory should be presented exactly in the same byte order and
|
|
|
|
length as in the relevant flow item, i.e. data for field with type
|
|
|
|
``RTE_FLOW_FIELD_MAC_DST`` should follow the conventions of ``dst`` field
|
|
|
|
in ``rte_flow_item_eth`` structure, with type ``RTE_FLOW_FIELD_IPV6_SRC`` -
|
|
|
|
``rte_flow_item_ipv6`` conventions, and so on. If the field size is larger than
|
|
|
|
16 bytes the pattern can be provided as pointer only.
|
|
|
|
|
|
|
|
The bitfield extracted from the memory being applied as second operation
|
|
|
|
parameter is defined by action width and by the destination field offset.
|
|
|
|
Application should provide the data in immediate value memory (either as
|
|
|
|
buffer or by pointer) exactly as item field without any applied explicit offset,
|
|
|
|
and destination packet field (with specified width and bit offset) will be
|
|
|
|
replaced by immediate source bits from the same bit offset. For example,
|
|
|
|
to replace the third byte of MAC address with value 0x85, application should
|
|
|
|
specify destination width as 8, destination offset as 16, and provide immediate
|
|
|
|
value as sequence of bytes {xxx, xxx, 0x85, xxx, xxx, xxx}.
|
2021-01-18 21:40:25 +00:00
|
|
|
|
|
|
|
.. _table_rte_flow_action_modify_field:
|
|
|
|
|
|
|
|
.. table:: MODIFY_FIELD
|
|
|
|
|
2021-04-08 12:32:58 +00:00
|
|
|
+---------------+-------------------------+
|
2021-01-18 21:40:25 +00:00
|
|
|
| Field | Value |
|
|
|
|
+===============+=========================+
|
|
|
|
| ``op`` | operation to perform |
|
2021-04-08 12:32:58 +00:00
|
|
|
+---------------+-------------------------+
|
2021-01-18 21:40:25 +00:00
|
|
|
| ``dst`` | destination field |
|
2021-04-08 12:32:58 +00:00
|
|
|
+---------------+-------------------------+
|
2021-01-18 21:40:25 +00:00
|
|
|
| ``src`` | source field |
|
2021-04-08 12:32:58 +00:00
|
|
|
+---------------+-------------------------+
|
2021-01-18 21:40:25 +00:00
|
|
|
| ``width`` | number of bits to use |
|
|
|
|
+---------------+-------------------------+
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_modify_data:
|
|
|
|
|
|
|
|
.. table:: destination/source field definition
|
|
|
|
|
2021-04-08 12:32:58 +00:00
|
|
|
+---------------+----------------------------------------------------------+
|
2021-01-18 21:40:25 +00:00
|
|
|
| Field | Value |
|
|
|
|
+===============+==========================================================+
|
|
|
|
| ``field`` | ID: packet field, mark, meta, tag, immediate, pointer |
|
2021-04-08 12:32:58 +00:00
|
|
|
+---------------+----------------------------------------------------------+
|
2021-01-18 21:40:25 +00:00
|
|
|
| ``level`` | encapsulation level of a packet field or tag array index |
|
2021-04-08 12:32:58 +00:00
|
|
|
+---------------+----------------------------------------------------------+
|
2021-01-18 21:40:25 +00:00
|
|
|
| ``offset`` | number of bits to skip at the beginning |
|
2021-04-08 12:32:58 +00:00
|
|
|
+---------------+----------------------------------------------------------+
|
2021-10-13 18:45:12 +00:00
|
|
|
| ``value`` | immediate value buffer (source field only, not |
|
|
|
|
| | applicable to destination) for RTE_FLOW_FIELD_VALUE |
|
|
|
|
| | field type |
|
|
|
|
+---------------+----------------------------------------------------------+
|
|
|
|
| ``pvalue`` | pointer to immediate value data (source field only, not |
|
|
|
|
| | applicable to destination) for RTE_FLOW_FIELD_POINTER |
|
|
|
|
| | field type |
|
2021-01-18 21:40:25 +00:00
|
|
|
+---------------+----------------------------------------------------------+
|
|
|
|
|
ethdev: introduce conntrack flow action and item
This commit introduces the conntrack action and item.
Usually the HW offloading is stateless. For some stateful offloading
like a TCP connection, HW module will help provide the ability of a
full offloading w/o SW participation after the connection was
established.
The basic usage is that in the first flow rule the application should
add the conntrack action and jump to the next flow table. In the
following flow rule(s) of the next table, the application should use
the conntrack item to match on the result.
A TCP connection has two directions traffic. To set a conntrack
action context correctly, the information of packets from both
directions are required.
The conntrack action should be created on one ethdev port and supply
the peer ethdev port as a parameter to the action. After context
created, it could only be used between these two ethdev ports
(dual-port mode) or a single port. The application should modify the
action via the API "rte_action_handle_update" only when before using
it to create a flow rule with conntrack for the opposite direction.
This will help the driver to recognize the direction of the flow to
be created, especially in the single-port mode, in which case the
traffic from both directions will go through the same ethdev port
if the application works as an "forwarding engine" but not an end
point. There is no need to call the update interface if the
subsequent flow rules have nothing to be changed.
Query will be supported via "rte_action_handle_query" interface,
about the current packets information and connection status. The
fields query capabilities depends on the HW.
For the packets received during the conntrack setup, it is suggested
to re-inject the packets in order to make sure the conntrack module
works correctly without missing any packet. Only the valid packets
should pass the conntrack, packets with invalid TCP information,
like out of window, or with invalid header, like malformed, should
not pass.
Naming and definition:
https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/
netfilter/nf_conntrack_tcp.h
https://elixir.bootlin.com/linux/latest/source/net/netfilter/
nf_conntrack_proto_tcp.c
Other reference:
https://www.usenix.org/legacy/events/sec01/invitedtalks/rooij.pdf
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2021-04-19 17:51:30 +00:00
|
|
|
Action: ``CONNTRACK``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Create a conntrack (connection tracking) context with the provided information.
|
|
|
|
|
|
|
|
In stateful session like TCP, the conntrack action provides the ability to
|
|
|
|
examine every packet of this connection and associate the state to every
|
|
|
|
packet. It will help to realize the stateful offload of connections with little
|
|
|
|
software participation. For example, the packets with invalid state may be
|
|
|
|
handled by the software. The control packets could be handled in the hardware.
|
|
|
|
The software just need to query the state of a connection when needed, and then
|
|
|
|
decide how to handle the flow rules and conntrack context.
|
|
|
|
|
|
|
|
A conntrack context should be created via ``rte_flow_action_handle_create()``
|
|
|
|
before using. Then the handle with ``INDIRECT`` type is used for a flow rule
|
|
|
|
creation. If a flow rule with an opposite direction needs to be created, the
|
|
|
|
``rte_flow_action_handle_update()`` should be used to modify the direction.
|
|
|
|
|
|
|
|
Not all the fields of the ``struct rte_flow_action_conntrack`` will be used
|
|
|
|
for a conntrack context creating, depending on the HW, and they should be
|
|
|
|
in host byte order. PMD should convert them into network byte order when
|
|
|
|
needed by the HW.
|
|
|
|
|
|
|
|
The ``struct rte_flow_modify_conntrack`` should be used for an updating.
|
|
|
|
|
|
|
|
The current conntrack context information could be queried via the
|
|
|
|
``rte_flow_action_handle_query()`` interface.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_conntrack:
|
|
|
|
|
|
|
|
.. table:: CONNTRACK
|
|
|
|
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+==========================+=============================================================+
|
|
|
|
| ``peer_port`` | peer port number |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``is_original_dir`` | direction of this connection for creating flow rule |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``enable`` | enable the conntrack context |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``live_connection`` | one ack was seen for this connection |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``selective_ack`` | SACK enabled |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``challenge_ack_passed`` | a challenge ack has passed |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``last_direction`` | direction of the last passed packet |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``liberal_mode`` | only report state change |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``state`` | current state |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``max_ack_window`` | maximal window scaling factor |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``retransmission_limit`` | maximal retransmission times |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``original_dir`` | TCP parameters of the original direction |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``reply_dir`` | TCP parameters of the reply direction |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``last_window`` | window size of the last passed packet |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``last_seq`` | sequence number of the last passed packet |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``last_ack`` | acknowledgment number the last passed packet |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
| ``last_end`` | sum of ack number and length of the last passed packet |
|
|
|
|
+--------------------------+-------------------------------------------------------------+
|
|
|
|
|
|
|
|
.. _table_rte_flow_tcp_dir_param:
|
|
|
|
|
|
|
|
.. table:: configuration parameters for each direction
|
|
|
|
|
|
|
|
+---------------------+---------------------------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+=====================+=========================================================+
|
|
|
|
| ``scale`` | TCP window scaling factor |
|
|
|
|
+---------------------+---------------------------------------------------------+
|
|
|
|
| ``close_initiated`` | FIN sent from this direction |
|
|
|
|
+---------------------+---------------------------------------------------------+
|
|
|
|
| ``last_ack_seen`` | an ACK packet received |
|
|
|
|
+---------------------+---------------------------------------------------------+
|
|
|
|
| ``data_unacked`` | unacknowledged data for packets from this direction |
|
|
|
|
+---------------------+---------------------------------------------------------+
|
|
|
|
| ``sent_end`` | max{seq + len} seen in sent packets |
|
|
|
|
+---------------------+---------------------------------------------------------+
|
|
|
|
| ``reply_end`` | max{sack + max{win, 1}} seen in reply packets |
|
|
|
|
+---------------------+---------------------------------------------------------+
|
|
|
|
| ``max_win`` | max{max{win, 1}} + {sack - ack} seen in sent packets |
|
|
|
|
+---------------------+---------------------------------------------------------+
|
|
|
|
| ``max_ack`` | max{ack} + seen in sent packets |
|
|
|
|
+---------------------+---------------------------------------------------------+
|
|
|
|
|
|
|
|
.. _table_rte_flow_modify_conntrack:
|
|
|
|
|
|
|
|
.. table:: update a conntrack context
|
|
|
|
|
|
|
|
+----------------+-------------------------------------------------+
|
|
|
|
| Field | Value |
|
|
|
|
+================+=================================================+
|
|
|
|
| ``new_ct`` | new conntrack information |
|
|
|
|
+----------------+-------------------------------------------------+
|
|
|
|
| ``direction`` | direction will be updated |
|
|
|
|
+----------------+-------------------------------------------------+
|
|
|
|
| ``state`` | other fields except direction will be updated |
|
|
|
|
+----------------+-------------------------------------------------+
|
|
|
|
| ``reserved`` | reserved bits |
|
|
|
|
+----------------+-------------------------------------------------+
|
|
|
|
|
2021-04-20 14:04:49 +00:00
|
|
|
Action: ``METER_COLOR``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Color the packet to reflect the meter color result.
|
|
|
|
|
|
|
|
The meter action must be configured before meter color action.
|
|
|
|
Meter color action is set to a color to reflect the meter color result.
|
|
|
|
Set the meter color in the mbuf to the selected color.
|
|
|
|
The meter color action output color is the output color of the packet,
|
|
|
|
which is set in the packet meta-data (i.e. struct ``rte_mbuf::sched::color``)
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_meter_color:
|
|
|
|
|
|
|
|
.. table:: METER_COLOR
|
|
|
|
|
|
|
|
+-----------------+--------------+
|
|
|
|
| Field | Value |
|
|
|
|
+=================+==============+
|
|
|
|
| ``meter_color`` | Packet color |
|
|
|
|
+-----------------+--------------+
|
|
|
|
|
2021-10-13 17:34:39 +00:00
|
|
|
Action: ``PORT_REPRESENTOR``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
At embedded switch level, send matching traffic to the given ethdev.
|
|
|
|
|
|
|
|
Term **ethdev** and the concept of **port representor** are synonymous.
|
|
|
|
The **represented port** is an *entity* plugged to the embedded switch
|
|
|
|
at the opposite end of the "wire" leading to the ethdev.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
.--------------------.
|
|
|
|
| PORT_REPRESENTOR | Ethdev (Application Port Referred to by its ID)
|
|
|
|
'--------------------'
|
|
|
|
/\
|
|
|
|
||
|
|
|
|
.----------------.
|
|
|
|
| Logical Port |
|
|
|
|
'----------------'
|
|
|
|
/\
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
.----------. .--------------------.
|
|
|
|
| Switch | <== | Matching Traffic |
|
|
|
|
'----------' '--------------------'
|
|
|
|
:
|
|
|
|
:
|
|
|
|
:
|
|
|
|
:
|
|
|
|
.----------------.
|
|
|
|
| Logical Port |
|
|
|
|
'----------------'
|
|
|
|
:
|
|
|
|
:
|
|
|
|
.--------------------.
|
|
|
|
| REPRESENTED_PORT | Net / Guest / Another Ethdev (Same Application)
|
|
|
|
'--------------------'
|
|
|
|
|
|
|
|
|
|
|
|
- Requires `Attribute: Transfer`_.
|
|
|
|
|
|
|
|
.. _table_rte_flow_action_ethdev:
|
|
|
|
|
|
|
|
.. table:: ``struct rte_flow_action_ethdev``
|
|
|
|
|
|
|
|
+-------------+----------------+
|
|
|
|
| Field | Value |
|
|
|
|
+=============+================+
|
|
|
|
| ``port_id`` | ethdev port ID |
|
|
|
|
+-------------+----------------+
|
|
|
|
|
|
|
|
See also `Item: PORT_REPRESENTOR`_.
|
|
|
|
|
2021-10-13 17:34:40 +00:00
|
|
|
Action: ``REPRESENTED_PORT``
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
At embedded switch level, send matching traffic to
|
|
|
|
the entity represented by the given ethdev.
|
|
|
|
|
|
|
|
Term **ethdev** and the concept of **port representor** are synonymous.
|
|
|
|
The **represented port** is an *entity* plugged to the embedded switch
|
|
|
|
at the opposite end of the "wire" leading to the ethdev.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
.--------------------.
|
|
|
|
| PORT_REPRESENTOR | Ethdev (Application Port Referred to by its ID)
|
|
|
|
'--------------------'
|
|
|
|
:
|
|
|
|
:
|
|
|
|
.----------------.
|
|
|
|
| Logical Port |
|
|
|
|
'----------------'
|
|
|
|
:
|
|
|
|
:
|
|
|
|
:
|
|
|
|
:
|
|
|
|
.----------. .--------------------.
|
|
|
|
| Switch | <== | Matching Traffic |
|
|
|
|
'----------' '--------------------'
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
\/
|
|
|
|
.----------------.
|
|
|
|
| Logical Port |
|
|
|
|
'----------------'
|
|
|
|
||
|
|
|
|
\/
|
|
|
|
.--------------------.
|
|
|
|
| REPRESENTED_PORT | Net / Guest / Another Ethdev (Same Application)
|
|
|
|
'--------------------'
|
|
|
|
|
|
|
|
|
|
|
|
- Requires `Attribute: Transfer`_.
|
|
|
|
|
|
|
|
This action is meant to use the same structure as `Action: PORT_REPRESENTOR`_.
|
|
|
|
|
|
|
|
See also `Item: REPRESENTED_PORT`_.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
Negative types
|
|
|
|
~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
All specified pattern items (``enum rte_flow_item_type``) and actions
|
|
|
|
(``enum rte_flow_action_type``) use positive identifiers.
|
|
|
|
|
|
|
|
The negative space is reserved for dynamic types generated by PMDs during
|
|
|
|
run-time. PMDs may encounter them as a result but must not accept negative
|
|
|
|
identifiers they are not aware of.
|
|
|
|
|
|
|
|
A method to generate them remains to be defined.
|
|
|
|
|
2020-10-16 12:51:05 +00:00
|
|
|
Application may use PMD dynamic items or actions in flow rules. In that case
|
|
|
|
size of configuration object in dynamic element must be a pointer size.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
Rules management
|
|
|
|
----------------
|
|
|
|
|
|
|
|
A rather simple API with few functions is provided to fully manage flow
|
|
|
|
rules.
|
|
|
|
|
|
|
|
Each created flow rule is associated with an opaque, PMD-specific handle
|
|
|
|
pointer. The application is responsible for keeping it until the rule is
|
|
|
|
destroyed.
|
|
|
|
|
|
|
|
Flows rules are represented by ``struct rte_flow`` objects.
|
|
|
|
|
|
|
|
Validation
|
|
|
|
~~~~~~~~~~
|
|
|
|
|
|
|
|
Given that expressing a definite set of device capabilities is not
|
|
|
|
practical, a dedicated function is provided to check if a flow rule is
|
|
|
|
supported and can be created.
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
int
|
2017-10-13 13:17:01 +00:00
|
|
|
rte_flow_validate(uint16_t port_id,
|
2016-12-21 14:51:18 +00:00
|
|
|
const struct rte_flow_attr *attr,
|
|
|
|
const struct rte_flow_item pattern[],
|
|
|
|
const struct rte_flow_action actions[],
|
|
|
|
struct rte_flow_error *error);
|
|
|
|
|
2017-04-20 18:49:33 +00:00
|
|
|
The flow rule is validated for correctness and whether it could be accepted
|
|
|
|
by the device given sufficient resources. The rule is checked against the
|
|
|
|
current device mode and queue configuration. The flow rule may also
|
|
|
|
optionally be validated against existing flow rules and device resources.
|
|
|
|
This function has no effect on the target device.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
The returned value is guaranteed to remain valid only as long as no
|
|
|
|
successful calls to ``rte_flow_create()`` or ``rte_flow_destroy()`` are made
|
|
|
|
in the meantime and no device parameter affecting flow rules in any way are
|
|
|
|
modified, due to possible collisions or resource limitations (although in
|
|
|
|
such cases ``EINVAL`` should not be returned).
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
- ``port_id``: port identifier of Ethernet device.
|
|
|
|
- ``attr``: flow rule attributes.
|
|
|
|
- ``pattern``: pattern specification (list terminated by the END pattern
|
|
|
|
item).
|
|
|
|
- ``actions``: associated actions (list terminated by the END action).
|
|
|
|
- ``error``: perform verbose error reporting if not NULL. PMDs initialize
|
|
|
|
this structure in case of error only.
|
|
|
|
|
|
|
|
Return values:
|
|
|
|
|
|
|
|
- 0 if flow rule is valid and can be created. A negative errno value
|
|
|
|
otherwise (``rte_errno`` is also set), the following errors are defined.
|
|
|
|
- ``-ENOSYS``: underlying device does not support this functionality.
|
|
|
|
- ``-EINVAL``: unknown or invalid rule specification.
|
|
|
|
- ``-ENOTSUP``: valid but unsupported rule specification (e.g. partial
|
|
|
|
bit-masks are unsupported).
|
2017-04-20 18:49:33 +00:00
|
|
|
- ``EEXIST``: collision with an existing rule. Only returned if device
|
|
|
|
supports flow rule collision checking and there was a flow rule
|
|
|
|
collision. Not receiving this return code is no guarantee that creating
|
|
|
|
the rule will not fail due to a collision.
|
|
|
|
- ``ENOMEM``: not enough memory to execute the function, or if the device
|
|
|
|
supports resource validation, resource limitation on the device.
|
2016-12-21 14:51:18 +00:00
|
|
|
- ``-EBUSY``: action cannot be performed due to busy device resources, may
|
|
|
|
succeed if the affected queues or even the entire port are in a stopped
|
|
|
|
state (see ``rte_eth_dev_rx_queue_stop()`` and ``rte_eth_dev_stop()``).
|
|
|
|
|
|
|
|
Creation
|
|
|
|
~~~~~~~~
|
|
|
|
|
|
|
|
Creating a flow rule is similar to validating one, except the rule is
|
|
|
|
actually created and a handle returned.
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
struct rte_flow *
|
2017-10-13 13:17:01 +00:00
|
|
|
rte_flow_create(uint16_t port_id,
|
2016-12-21 14:51:18 +00:00
|
|
|
const struct rte_flow_attr *attr,
|
|
|
|
const struct rte_flow_item pattern[],
|
|
|
|
const struct rte_flow_action *actions[],
|
|
|
|
struct rte_flow_error *error);
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
- ``port_id``: port identifier of Ethernet device.
|
|
|
|
- ``attr``: flow rule attributes.
|
|
|
|
- ``pattern``: pattern specification (list terminated by the END pattern
|
|
|
|
item).
|
|
|
|
- ``actions``: associated actions (list terminated by the END action).
|
|
|
|
- ``error``: perform verbose error reporting if not NULL. PMDs initialize
|
|
|
|
this structure in case of error only.
|
|
|
|
|
|
|
|
Return values:
|
|
|
|
|
|
|
|
A valid handle in case of success, NULL otherwise and ``rte_errno`` is set
|
|
|
|
to the positive version of one of the error codes defined for
|
|
|
|
``rte_flow_validate()``.
|
|
|
|
|
|
|
|
Destruction
|
|
|
|
~~~~~~~~~~~
|
|
|
|
|
|
|
|
Flow rules destruction is not automatic, and a queue or a port should not be
|
|
|
|
released if any are still attached to them. Applications must take care of
|
|
|
|
performing this step before releasing resources.
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
int
|
2017-10-13 13:17:01 +00:00
|
|
|
rte_flow_destroy(uint16_t port_id,
|
2016-12-21 14:51:18 +00:00
|
|
|
struct rte_flow *flow,
|
|
|
|
struct rte_flow_error *error);
|
|
|
|
|
|
|
|
|
|
|
|
Failure to destroy a flow rule handle may occur when other flow rules depend
|
|
|
|
on it, and destroying it would result in an inconsistent state.
|
|
|
|
|
|
|
|
This function is only guaranteed to succeed if handles are destroyed in
|
|
|
|
reverse order of their creation.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
- ``port_id``: port identifier of Ethernet device.
|
|
|
|
- ``flow``: flow rule handle to destroy.
|
|
|
|
- ``error``: perform verbose error reporting if not NULL. PMDs initialize
|
|
|
|
this structure in case of error only.
|
|
|
|
|
|
|
|
Return values:
|
|
|
|
|
|
|
|
- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
|
|
|
|
|
|
|
|
Flush
|
|
|
|
~~~~~
|
|
|
|
|
|
|
|
Convenience function to destroy all flow rule handles associated with a
|
|
|
|
port. They are released as with successive calls to ``rte_flow_destroy()``.
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
int
|
2017-10-13 13:17:01 +00:00
|
|
|
rte_flow_flush(uint16_t port_id,
|
2016-12-21 14:51:18 +00:00
|
|
|
struct rte_flow_error *error);
|
|
|
|
|
|
|
|
In the unlikely event of failure, handles are still considered destroyed and
|
|
|
|
no longer valid but the port must be assumed to be in an inconsistent state.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
- ``port_id``: port identifier of Ethernet device.
|
|
|
|
- ``error``: perform verbose error reporting if not NULL. PMDs initialize
|
|
|
|
this structure in case of error only.
|
|
|
|
|
|
|
|
Return values:
|
|
|
|
|
|
|
|
- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
|
|
|
|
|
|
|
|
Query
|
|
|
|
~~~~~
|
|
|
|
|
|
|
|
Query an existing flow rule.
|
|
|
|
|
|
|
|
This function allows retrieving flow-specific data such as counters. Data
|
|
|
|
is gathered by special actions which must be present in the flow rule
|
|
|
|
definition.
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
int
|
2017-10-13 13:17:01 +00:00
|
|
|
rte_flow_query(uint16_t port_id,
|
2016-12-21 14:51:18 +00:00
|
|
|
struct rte_flow *flow,
|
2018-04-26 17:29:19 +00:00
|
|
|
const struct rte_flow_action *action,
|
2016-12-21 14:51:18 +00:00
|
|
|
void *data,
|
|
|
|
struct rte_flow_error *error);
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
- ``port_id``: port identifier of Ethernet device.
|
|
|
|
- ``flow``: flow rule handle to query.
|
2018-04-26 17:29:19 +00:00
|
|
|
- ``action``: action to query, this must match prototype from flow rule.
|
2016-12-21 14:51:18 +00:00
|
|
|
- ``data``: pointer to storage for the associated query data type.
|
|
|
|
- ``error``: perform verbose error reporting if not NULL. PMDs initialize
|
|
|
|
this structure in case of error only.
|
|
|
|
|
|
|
|
Return values:
|
|
|
|
|
|
|
|
- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
|
|
|
|
|
2019-01-30 11:20:19 +00:00
|
|
|
.. _flow_isolated_mode:
|
|
|
|
|
|
|
|
Flow isolated mode
|
|
|
|
------------------
|
2017-06-14 14:48:51 +00:00
|
|
|
|
|
|
|
The general expectation for ingress traffic is that flow rules process it
|
|
|
|
first; the remaining unmatched or pass-through traffic usually ends up in a
|
|
|
|
queue (with or without RSS, locally or in some sub-device instance)
|
|
|
|
depending on the global configuration settings of a port.
|
|
|
|
|
|
|
|
While fine from a compatibility standpoint, this approach makes drivers more
|
|
|
|
complex as they have to check for possible side effects outside of this API
|
|
|
|
when creating or destroying flow rules. It results in a more limited set of
|
|
|
|
available rule types due to the way device resources are assigned (e.g. no
|
|
|
|
support for the RSS action even on capable hardware).
|
|
|
|
|
|
|
|
Given that nonspecific traffic can be handled by flow rules as well,
|
|
|
|
isolated mode is a means for applications to tell a driver that ingress on
|
|
|
|
the underlying port must be injected from the defined flow rules only; that
|
|
|
|
no default traffic is expected outside those rules.
|
|
|
|
|
|
|
|
This has the following benefits:
|
|
|
|
|
|
|
|
- Applications get finer-grained control over the kind of traffic they want
|
|
|
|
to receive (no traffic by default).
|
|
|
|
|
|
|
|
- More importantly they control at what point nonspecific traffic is handled
|
|
|
|
relative to other flow rules, by adjusting priority levels.
|
|
|
|
|
|
|
|
- Drivers can assign more hardware resources to flow rules and expand the
|
|
|
|
set of supported rule types.
|
|
|
|
|
|
|
|
Because toggling isolated mode may cause profound changes to the ingress
|
|
|
|
processing path of a driver, it may not be possible to leave it once
|
|
|
|
entered. Likewise, existing flow rules or global configuration settings may
|
|
|
|
prevent a driver from entering isolated mode.
|
|
|
|
|
|
|
|
Applications relying on this mode are therefore encouraged to toggle it as
|
|
|
|
soon as possible after device initialization, ideally before the first call
|
|
|
|
to ``rte_eth_dev_configure()`` to avoid possible failures due to conflicting
|
|
|
|
settings.
|
|
|
|
|
|
|
|
Once effective, the following functionality has no effect on the underlying
|
|
|
|
port and may return errors such as ``ENOTSUP`` ("not supported"):
|
|
|
|
|
|
|
|
- Toggling promiscuous mode.
|
|
|
|
- Toggling allmulticast mode.
|
|
|
|
- Configuring MAC addresses.
|
|
|
|
- Configuring multicast addresses.
|
|
|
|
- Configuring VLAN filters.
|
|
|
|
- Configuring global RSS settings.
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
int
|
2017-10-13 13:17:01 +00:00
|
|
|
rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
|
2017-06-14 14:48:51 +00:00
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
- ``port_id``: port identifier of Ethernet device.
|
|
|
|
- ``set``: nonzero to enter isolated mode, attempt to leave it otherwise.
|
|
|
|
- ``error``: perform verbose error reporting if not NULL. PMDs initialize
|
|
|
|
this structure in case of error only.
|
|
|
|
|
|
|
|
Return values:
|
|
|
|
|
|
|
|
- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
Verbose error reporting
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
The defined *errno* values may not be accurate enough for users or
|
|
|
|
application developers who want to investigate issues related to flow rules
|
|
|
|
management. A dedicated error object is defined for this purpose:
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
enum rte_flow_error_type {
|
|
|
|
RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
|
|
|
|
RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< Ingress field. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< Egress field. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_ITEM_NUM, /**< Pattern length. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_ITEM, /**< Specific pattern item. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
|
|
|
|
RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct rte_flow_error {
|
|
|
|
enum rte_flow_error_type type; /**< Cause field and error types. */
|
|
|
|
const void *cause; /**< Object responsible for the error. */
|
|
|
|
const char *message; /**< Human-readable error message. */
|
|
|
|
};
|
|
|
|
|
|
|
|
Error type ``RTE_FLOW_ERROR_TYPE_NONE`` stands for no error, in which case
|
|
|
|
remaining fields can be ignored. Other error types describe the type of the
|
|
|
|
object pointed by ``cause``.
|
|
|
|
|
|
|
|
If non-NULL, ``cause`` points to the object responsible for the error. For a
|
|
|
|
flow rule, this may be a pattern item or an individual action.
|
|
|
|
|
|
|
|
If non-NULL, ``message`` provides a human-readable error message.
|
|
|
|
|
|
|
|
This object is normally allocated by applications and set by PMDs in case of
|
|
|
|
error, the message points to a constant string which does not need to be
|
|
|
|
freed by the application, however its pointer can be considered valid only
|
|
|
|
as long as its associated DPDK port remains configured. Closing the
|
|
|
|
underlying device or unloading the PMD invalidates it.
|
|
|
|
|
2017-10-12 12:19:15 +00:00
|
|
|
Helpers
|
|
|
|
-------
|
|
|
|
|
|
|
|
Error initializer
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
rte_flow_error_set(struct rte_flow_error *error,
|
|
|
|
int code,
|
|
|
|
enum rte_flow_error_type type,
|
|
|
|
const void *cause,
|
|
|
|
const char *message);
|
|
|
|
|
|
|
|
This function initializes ``error`` (if non-NULL) with the provided
|
|
|
|
parameters and sets ``rte_errno`` to ``code``. A negative error ``code`` is
|
|
|
|
then returned.
|
|
|
|
|
2018-08-31 09:01:00 +00:00
|
|
|
Object conversion
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
int
|
|
|
|
rte_flow_conv(enum rte_flow_conv_op op,
|
|
|
|
void *dst,
|
|
|
|
size_t size,
|
|
|
|
const void *src,
|
|
|
|
struct rte_flow_error *error);
|
|
|
|
|
|
|
|
Convert ``src`` to ``dst`` according to operation ``op``. Possible
|
|
|
|
operations include:
|
|
|
|
|
|
|
|
- Attributes, pattern item or action duplication.
|
|
|
|
- Duplication of an entire pattern or list of actions.
|
|
|
|
- Duplication of a complete flow rule description.
|
2018-08-31 09:01:02 +00:00
|
|
|
- Pattern item or action name retrieval.
|
2018-08-31 09:01:00 +00:00
|
|
|
|
ethdev: add tunnel offload model
rte_flow API provides the building blocks for vendor-agnostic flow
classification offloads. The rte_flow "patterns" and "actions"
primitives are fine-grained, thus enabling DPDK applications the
flexibility to offload network stacks and complex pipelines.
Applications wishing to offload tunneled traffic are required to use
the rte_flow primitives, such as group, meta, mark, tag, and others to
model their high-level objects. The hardware model design for
high-level software objects is not trivial. Furthermore, an optimal
design is often vendor-specific.
When hardware offloads tunneled traffic in multi-group logic,
partially offloaded packets may arrive to the application after they
were modified in hardware. In this case, the application may need to
restore the original packet headers. Consider the following sequence:
The application decaps a packet in one group and jumps to a second
group where it tries to match on a 5-tuple, that will miss and send
the packet to the application. In this case, the application does not
receive the original packet but a modified one. Also, in this case,
the application cannot match on the outer header fields, such as VXLAN
vni and 5-tuple.
There are several possible ways to use rte_flow "patterns" and
"actions" to resolve the issues above. For example:
1 Mapping headers to a hardware registers using the
rte_flow_action_mark/rte_flow_action_tag/rte_flow_set_meta objects.
2 Apply the decap only at the last offload stage after all the
"patterns" were matched and the packet will be fully offloaded.
Every approach has its pros and cons and is highly dependent on the
hardware vendor. For example, some hardware may have a limited number
of registers while other hardware could not support inner actions and
must decap before accessing inner headers.
The tunnel offload model resolves these issues. The model goals are:
1 Provide a unified application API to offload tunneled traffic that
is capable to match on outer headers after decap.
2 Allow the application to restore the outer header of partially
offloaded packets.
The tunnel offload model does not introduce new elements to the
existing RTE flow model and is implemented as a set of helper
functions.
For the application to work with the tunnel offload API it
has to adjust flow rules in multi-table tunnel offload in the
following way:
1 Remove explicit call to decap action and replace it with PMD actions
obtained from rte_flow_tunnel_decap_and_set() helper.
2 Add PMD items obtained from rte_flow_tunnel_match() helper to all
other rules in the tunnel offload sequence.
VXLAN Code example:
Assume application needs to do inner NAT on the VXLAN packet.
The first rule in group 0:
flow create <port id> ingress group 0
pattern eth / ipv4 / udp dst is 4789 / vxlan / end
actions {pmd actions} / jump group 3 / end
The first VXLAN packet that arrives matches the rule in group 0 and
jumps to group 3. In group 3 the packet will miss since there is no
flow to match and will be sent to the application. Application will
call rte_flow_get_restore_info() to get the packet outer header.
Application will insert a new rule in group 3 to match outer and inner
headers:
flow create <port id> ingress group 3
pattern {pmd items} / eth / ipv4 dst is 172.10.10.1 /
udp dst 4789 / vxlan vni is 10 /
ipv4 dst is 184.1.2.3 / end
actions set_ipv4_dst 186.1.1.1 / queue index 3 / end
Resulting of the rules will be that VXLAN packet with vni=10, outer
IPv4 dst=172.10.10.1 and inner IPv4 dst=184.1.2.3 will be received
decapped on queue 3 with IPv4 dst=186.1.1.1
Note: The packet in group 3 is considered decapped. All actions in
that group will be done on the header that was inner before decap. The
application may specify an outer header to be matched on. It's PMD
responsibility to translate these items to outer metadata.
API usage:
/**
* 1. Initiate RTE flow tunnel object
*/
const struct rte_flow_tunnel tunnel = {
.type = RTE_FLOW_ITEM_TYPE_VXLAN,
.tun_id = 10,
}
/**
* 2. Obtain PMD tunnel actions
*
* pmd_actions is an intermediate variable application uses to
* compile actions array
*/
struct rte_flow_action **pmd_actions;
rte_flow_tunnel_decap_and_set(&tunnel, &pmd_actions,
&num_pmd_actions, &error);
/**
* 3. offload the first rule
* matching on VXLAN traffic and jumps to group 3
* (implicitly decaps packet)
*/
app_actions = jump group 3
rule_items = app_items; /** eth / ipv4 / udp / vxlan */
rule_actions = { pmd_actions, app_actions };
attr.group = 0;
flow_1 = rte_flow_create(port_id, &attr,
rule_items, rule_actions, &error);
/**
* 4. after flow creation application does not need to keep the
* tunnel action resources.
*/
rte_flow_tunnel_action_release(port_id, pmd_actions,
num_pmd_actions);
/**
* 5. After partially offloaded packet miss because there was no
* matching rule handle miss on group 3
*/
struct rte_flow_restore_info info;
rte_flow_get_restore_info(port_id, mbuf, &info, &error);
/**
* 6. Offload NAT rule:
*/
app_items = { eth / ipv4 dst is 172.10.10.1 / udp dst 4789 /
vxlan vni is 10 / ipv4 dst is 184.1.2.3 }
app_actions = { set_ipv4_dst 186.1.1.1 / queue index 3 }
rte_flow_tunnel_match(&info.tunnel, &pmd_items,
&num_pmd_items, &error);
rule_items = {pmd_items, app_items};
rule_actions = app_actions;
attr.group = info.group_id;
flow_2 = rte_flow_create(port_id, &attr,
rule_items, rule_actions, &error);
/**
* 7. Release PMD items after rule creation
*/
rte_flow_tunnel_item_release(port_id,
pmd_items, num_pmd_items);
References
1. https://mails.dpdk.org/archives/dev/2020-June/index.html
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2020-10-16 12:51:06 +00:00
|
|
|
Tunneled traffic offload
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
rte_flow API provides the building blocks for vendor-agnostic flow
|
|
|
|
classification offloads. The rte_flow "patterns" and "actions"
|
|
|
|
primitives are fine-grained, thus enabling DPDK applications the
|
|
|
|
flexibility to offload network stacks and complex pipelines.
|
|
|
|
Applications wishing to offload tunneled traffic are required to use
|
|
|
|
the rte_flow primitives, such as group, meta, mark, tag, and others to
|
|
|
|
model their high-level objects. The hardware model design for
|
|
|
|
high-level software objects is not trivial. Furthermore, an optimal
|
|
|
|
design is often vendor-specific.
|
|
|
|
|
|
|
|
When hardware offloads tunneled traffic in multi-group logic,
|
|
|
|
partially offloaded packets may arrive to the application after they
|
|
|
|
were modified in hardware. In this case, the application may need to
|
|
|
|
restore the original packet headers. Consider the following sequence:
|
|
|
|
The application decaps a packet in one group and jumps to a second
|
|
|
|
group where it tries to match on a 5-tuple, that will miss and send
|
|
|
|
the packet to the application. In this case, the application does not
|
|
|
|
receive the original packet but a modified one. Also, in this case,
|
|
|
|
the application cannot match on the outer header fields, such as VXLAN
|
|
|
|
vni and 5-tuple.
|
|
|
|
|
|
|
|
There are several possible ways to use rte_flow "patterns" and
|
|
|
|
"actions" to resolve the issues above. For example:
|
|
|
|
|
|
|
|
1 Mapping headers to a hardware registers using the
|
|
|
|
rte_flow_action_mark/rte_flow_action_tag/rte_flow_set_meta objects.
|
|
|
|
|
|
|
|
2 Apply the decap only at the last offload stage after all the
|
|
|
|
"patterns" were matched and the packet will be fully offloaded.
|
|
|
|
|
|
|
|
Every approach has its pros and cons and is highly dependent on the
|
|
|
|
hardware vendor. For example, some hardware may have a limited number
|
|
|
|
of registers while other hardware could not support inner actions and
|
|
|
|
must decap before accessing inner headers.
|
|
|
|
|
|
|
|
The tunnel offload model resolves these issues. The model goals are:
|
|
|
|
|
|
|
|
1 Provide a unified application API to offload tunneled traffic that
|
|
|
|
is capable to match on outer headers after decap.
|
|
|
|
|
|
|
|
2 Allow the application to restore the outer header of partially
|
|
|
|
offloaded packets.
|
|
|
|
|
|
|
|
The tunnel offload model does not introduce new elements to the
|
|
|
|
existing RTE flow model and is implemented as a set of helper
|
|
|
|
functions.
|
|
|
|
|
|
|
|
For the application to work with the tunnel offload API it
|
|
|
|
has to adjust flow rules in multi-table tunnel offload in the
|
|
|
|
following way:
|
|
|
|
|
|
|
|
1 Remove explicit call to decap action and replace it with PMD actions
|
|
|
|
obtained from rte_flow_tunnel_decap_and_set() helper.
|
|
|
|
|
|
|
|
2 Add PMD items obtained from rte_flow_tunnel_match() helper to all
|
|
|
|
other rules in the tunnel offload sequence.
|
|
|
|
|
|
|
|
The model requirements:
|
|
|
|
|
|
|
|
Software application must initialize
|
|
|
|
rte_tunnel object with tunnel parameters before calling
|
|
|
|
rte_flow_tunnel_decap_set() & rte_flow_tunnel_match().
|
|
|
|
|
|
|
|
PMD actions array obtained in rte_flow_tunnel_decap_set() must be
|
|
|
|
released by application with rte_flow_action_release() call.
|
|
|
|
|
|
|
|
PMD items array obtained with rte_flow_tunnel_match() must be released
|
|
|
|
by application with rte_flow_item_release() call. Application can
|
|
|
|
release PMD items and actions after rule was created. However, if the
|
|
|
|
application needs to create additional rule for the same tunnel it
|
|
|
|
will need to obtain PMD items again.
|
|
|
|
|
|
|
|
Application cannot destroy rte_tunnel object before it releases all
|
|
|
|
PMD actions & PMD items referencing that tunnel.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
Caveats
|
|
|
|
-------
|
|
|
|
|
|
|
|
- DPDK does not keep track of flow rules definitions or flow rule objects
|
|
|
|
automatically. Applications may keep track of the former and must keep
|
|
|
|
track of the latter. PMDs may also do it for internal needs, however this
|
|
|
|
must not be relied on by applications.
|
|
|
|
|
|
|
|
- Flow rules are not maintained between successive port initializations. An
|
|
|
|
application exiting without releasing them and restarting must re-create
|
|
|
|
them from scratch.
|
|
|
|
|
|
|
|
- API operations are synchronous and blocking (``EAGAIN`` cannot be
|
|
|
|
returned).
|
|
|
|
|
|
|
|
- Stopping the data path (TX/RX) should not be necessary when managing flow
|
|
|
|
rules. If this cannot be achieved naturally or with workarounds (such as
|
|
|
|
temporarily replacing the burst function pointers), an appropriate error
|
|
|
|
code must be returned (``EBUSY``).
|
|
|
|
|
2020-11-18 16:15:20 +00:00
|
|
|
- Applications, not PMDs, are responsible for maintaining flow rules
|
|
|
|
configuration when closing, stopping or restarting a port or performing other
|
|
|
|
actions which may affect them.
|
|
|
|
Applications must assume that after port close, stop or restart all flows
|
|
|
|
related to that port are not valid, hardware rules are destroyed and relevant
|
|
|
|
PMD resources are released.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
For devices exposing multiple ports sharing global settings affected by flow
|
|
|
|
rules:
|
|
|
|
|
|
|
|
- All ports under DPDK control must behave consistently, PMDs are
|
|
|
|
responsible for making sure that existing flow rules on a port are not
|
|
|
|
affected by other ports.
|
|
|
|
|
|
|
|
- Ports not under DPDK control (unaffected or handled by other applications)
|
|
|
|
are user's responsibility. They may affect existing flow rules and cause
|
|
|
|
undefined behavior. PMDs aware of this may prevent flow rules creation
|
|
|
|
altogether in such cases.
|
|
|
|
|
|
|
|
PMD interface
|
|
|
|
-------------
|
|
|
|
|
|
|
|
The PMD interface is defined in ``rte_flow_driver.h``. It is not subject to
|
|
|
|
API/ABI versioning constraints as it is not exposed to applications and may
|
|
|
|
evolve independently.
|
|
|
|
|
2021-03-21 09:00:00 +00:00
|
|
|
The PMD interface is based on callbacks pointed by the ``struct rte_flow_ops``.
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
- PMD callbacks implement exactly the interface described in `Rules
|
|
|
|
management`_, except for the port ID argument which has already been
|
|
|
|
converted to a pointer to the underlying ``struct rte_eth_dev``.
|
|
|
|
|
|
|
|
- Public API functions do not process flow rules definitions at all before
|
|
|
|
calling PMD functions (no basic error checking, no validation
|
|
|
|
whatsoever). They only make sure these callbacks are non-NULL or return
|
|
|
|
the ``ENOSYS`` (function not supported) error.
|
|
|
|
|
2017-10-12 12:19:15 +00:00
|
|
|
This interface additionally defines the following helper function:
|
2016-12-21 14:51:18 +00:00
|
|
|
|
|
|
|
- ``rte_flow_ops_get()``: get generic flow operations structure from a
|
|
|
|
port.
|
|
|
|
|
ethdev: make flow API thread safe
Currently, the rte_flow functions are not defined as thread safe.
DPDK applications either call the functions in single thread or
protect any concurrent calling for the rte_flow operations using
a lock.
For PMDs support the flow operations thread safe natively, the
redundant protection in application hurts the performance of the
rte_flow operation functions.
And the restriction of thread safe is not guaranteed for the
rte_flow functions also limits the applications' expectation.
This feature is going to change the rte_flow functions to be thread
safe. As different PMDs have different flow operations, some may
support thread safe already and others may not. For PMDs don't
support flow thread safe operation, a new lock is defined in ethdev
in order to protects thread unsafe PMDs from rte_flow level.
A new RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE device flag is added to
determine whether the PMD supports thread safe flow operation or not.
For PMDs support thread safe flow operations, set the
RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE flag, rte_flow level functions will
skip the thread safe helper lock for these PMDs. Again the rte_flow
level thread safe lock only works when PMD operation functions are
not thread safe.
For the PMDs which don't want the default mutex lock, just set the
flag in the PMD, and add the prefer type of lock in the PMD. Then
the default mutex lock is easily replaced by the PMD level lock.
The change has no effect on the current DPDK applications. No change
is required for the current DPDK applications. For the standard posix
pthread_mutex, if no lock contention with the added rte_flow level
mutex, the mutex only does the atomic increasing in
pthread_mutex_lock() and decreasing in
pthread_mutex_unlock(). No futex() syscall will be involved.
Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2020-10-15 01:07:47 +00:00
|
|
|
If PMD interfaces don't support re-entrancy/multi-thread safety,
|
|
|
|
the rte_flow API functions will protect threads by mutex per port.
|
|
|
|
The application can check whether ``RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE``
|
|
|
|
is set in ``dev_flags``, meaning the PMD is thread-safe regarding rte_flow,
|
|
|
|
so the API level protection is disabled.
|
|
|
|
Please note that this API-level mutex protects only rte_flow functions,
|
|
|
|
other control path functions are not in scope.
|
|
|
|
|
2016-12-21 14:51:18 +00:00
|
|
|
Device compatibility
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
No known implementation supports all the described features.
|
|
|
|
|
|
|
|
Unsupported features or combinations are not expected to be fully emulated
|
|
|
|
in software by PMDs for performance reasons. Partially supported features
|
|
|
|
may be completed in software as long as hardware performs most of the work
|
|
|
|
(such as queue redirection and packet recognition).
|
|
|
|
|
|
|
|
However PMDs are expected to do their best to satisfy application requests
|
|
|
|
by working around hardware limitations as long as doing so does not affect
|
|
|
|
the behavior of existing flow rules.
|
|
|
|
|
|
|
|
The following sections provide a few examples of such cases and describe how
|
|
|
|
PMDs should handle them, they are based on limitations built into the
|
|
|
|
previous APIs.
|
|
|
|
|
|
|
|
Global bit-masks
|
|
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Each flow rule comes with its own, per-layer bit-masks, while hardware may
|
|
|
|
support only a single, device-wide bit-mask for a given layer type, so that
|
|
|
|
two IPv4 rules cannot use different bit-masks.
|
|
|
|
|
|
|
|
The expected behavior in this case is that PMDs automatically configure
|
|
|
|
global bit-masks according to the needs of the first flow rule created.
|
|
|
|
|
|
|
|
Subsequent rules are allowed only if their bit-masks match those, the
|
|
|
|
``EEXIST`` error code should be returned otherwise.
|
|
|
|
|
|
|
|
Unsupported layer types
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Many protocols can be simulated by crafting patterns with the `Item: RAW`_
|
|
|
|
type.
|
|
|
|
|
|
|
|
PMDs can rely on this capability to simulate support for protocols with
|
|
|
|
headers not directly recognized by hardware.
|
|
|
|
|
|
|
|
``ANY`` pattern item
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
This pattern item stands for anything, which can be difficult to translate
|
|
|
|
to something hardware would understand, particularly if followed by more
|
|
|
|
specific types.
|
|
|
|
|
|
|
|
Consider the following pattern:
|
|
|
|
|
|
|
|
.. _table_rte_flow_unsupported_any:
|
|
|
|
|
|
|
|
.. table:: Pattern with ANY as L3
|
|
|
|
|
|
|
|
+-------+-----------------------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+=======================+
|
|
|
|
| 0 | ETHER |
|
|
|
|
+-------+-----+---------+-------+
|
|
|
|
| 1 | ANY | ``num`` | ``1`` |
|
|
|
|
+-------+-----+---------+-------+
|
|
|
|
| 2 | TCP |
|
|
|
|
+-------+-----------------------+
|
|
|
|
| 3 | END |
|
|
|
|
+-------+-----------------------+
|
|
|
|
|
|
|
|
Knowing that TCP does not make sense with something other than IPv4 and IPv6
|
|
|
|
as L3, such a pattern may be translated to two flow rules instead:
|
|
|
|
|
|
|
|
.. _table_rte_flow_unsupported_any_ipv4:
|
|
|
|
|
|
|
|
.. table:: ANY replaced with IPV4
|
|
|
|
|
|
|
|
+-------+--------------------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+====================+
|
|
|
|
| 0 | ETHER |
|
|
|
|
+-------+--------------------+
|
|
|
|
| 1 | IPV4 (zeroed mask) |
|
|
|
|
+-------+--------------------+
|
|
|
|
| 2 | TCP |
|
|
|
|
+-------+--------------------+
|
|
|
|
| 3 | END |
|
|
|
|
+-------+--------------------+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _table_rte_flow_unsupported_any_ipv6:
|
|
|
|
|
|
|
|
.. table:: ANY replaced with IPV6
|
|
|
|
|
|
|
|
+-------+--------------------+
|
|
|
|
| Index | Item |
|
|
|
|
+=======+====================+
|
|
|
|
| 0 | ETHER |
|
|
|
|
+-------+--------------------+
|
|
|
|
| 1 | IPV6 (zeroed mask) |
|
|
|
|
+-------+--------------------+
|
|
|
|
| 2 | TCP |
|
|
|
|
+-------+--------------------+
|
|
|
|
| 3 | END |
|
|
|
|
+-------+--------------------+
|
|
|
|
|
|
|
|
Note that as soon as a ANY rule covers several layers, this approach may
|
|
|
|
yield a large number of hidden flow rules. It is thus suggested to only
|
|
|
|
support the most common scenarios (anything as L2 and/or L3).
|
|
|
|
|
|
|
|
Unsupported actions
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
- When combined with `Action: QUEUE`_, packet counting (`Action: COUNT`_)
|
|
|
|
and tagging (`Action: MARK`_ or `Action: FLAG`_) may be implemented in
|
|
|
|
software as long as the target queue is used by a single rule.
|
|
|
|
|
|
|
|
- When a single target queue is provided, `Action: RSS`_ can also be
|
|
|
|
implemented through `Action: QUEUE`_.
|
|
|
|
|
|
|
|
Flow rules priority
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
While it would naturally make sense, flow rules cannot be assumed to be
|
|
|
|
processed by hardware in the same order as their creation for several
|
|
|
|
reasons:
|
|
|
|
|
|
|
|
- They may be managed internally as a tree or a hash table instead of a
|
|
|
|
list.
|
|
|
|
- Removing a flow rule before adding another one can either put the new rule
|
|
|
|
at the end of the list or reuse a freed entry.
|
|
|
|
- Duplication may occur when packets are matched by several rules.
|
|
|
|
|
|
|
|
For overlapping rules (particularly in order to use `Action: PASSTHRU`_)
|
|
|
|
predictable behavior is only guaranteed by using different priority levels.
|
|
|
|
|
|
|
|
Priority levels are not necessarily implemented in hardware, or may be
|
|
|
|
severely limited (e.g. a single priority bit).
|
|
|
|
|
|
|
|
For these reasons, priority levels may be implemented purely in software by
|
|
|
|
PMDs.
|
|
|
|
|
|
|
|
- For devices expecting flow rules to be added in the correct order, PMDs
|
|
|
|
may destroy and re-create existing rules after adding a new one with
|
|
|
|
a higher priority.
|
|
|
|
|
|
|
|
- A configurable number of dummy or empty rules can be created at
|
|
|
|
initialization time to save high priority slots for later.
|
|
|
|
|
|
|
|
- In order to save priority levels, PMDs may evaluate whether rules are
|
|
|
|
likely to collide and adjust their priority accordingly.
|
|
|
|
|
2018-04-24 15:59:00 +00:00
|
|
|
|
|
|
|
.. _OpenFlow Switch Specification: https://www.opennetworking.org/software-defined-standards/specifications/
|