xref: /dpdk/doc/guides/prog_guide/ethdev/flow_offload.rst (revision 16158f34900075f2f30b879bf3708e54e07455f4)
141dd9a6bSDavid Young..  SPDX-License-Identifier: BSD-3-Clause
241dd9a6bSDavid Young    Copyright 2016 6WIND S.A.
341dd9a6bSDavid Young    Copyright 2016 Mellanox Technologies, Ltd
441dd9a6bSDavid Young
541dd9a6bSDavid YoungGeneric flow API
641dd9a6bSDavid Young================
741dd9a6bSDavid Young
841dd9a6bSDavid YoungOverview
941dd9a6bSDavid Young--------
1041dd9a6bSDavid Young
1141dd9a6bSDavid YoungThis API provides a generic means to configure hardware to match specific
1241dd9a6bSDavid Youngtraffic, alter its fate and query related counters according to any
1341dd9a6bSDavid Youngnumber of user-defined rules.
1441dd9a6bSDavid Young
1541dd9a6bSDavid YoungIt is named *rte_flow* after the prefix used for all its symbols, and is
1641dd9a6bSDavid Youngdefined in ``rte_flow.h``.
1741dd9a6bSDavid Young
1841dd9a6bSDavid Young- Matching can be performed on packet data (protocol headers, payload) and
1941dd9a6bSDavid Young  properties (e.g. associated physical port, virtual device function ID).
2041dd9a6bSDavid Young
2141dd9a6bSDavid Young- Possible operations include dropping traffic, diverting it to specific
2241dd9a6bSDavid Young  queues, to virtual/physical device functions or ports, performing tunnel
2341dd9a6bSDavid Young  offloads, adding marks and so on.
2441dd9a6bSDavid Young
2541dd9a6bSDavid YoungFlow rule
2641dd9a6bSDavid Young---------
2741dd9a6bSDavid Young
2841dd9a6bSDavid YoungDescription
2941dd9a6bSDavid Young~~~~~~~~~~~
3041dd9a6bSDavid Young
3141dd9a6bSDavid YoungA flow rule is the combination of attributes with a matching pattern and a
3241dd9a6bSDavid Younglist of actions. Flow rules form the basis of this API.
3341dd9a6bSDavid Young
3441dd9a6bSDavid YoungFlow rules can have several distinct actions (such as counting,
3541dd9a6bSDavid Youngencapsulating, decapsulating before redirecting packets to a particular
3641dd9a6bSDavid Youngqueue, etc.), instead of relying on several rules to achieve this and having
3741dd9a6bSDavid Youngapplications deal with hardware implementation details regarding their
3841dd9a6bSDavid Youngorder.
3941dd9a6bSDavid Young
4041dd9a6bSDavid YoungSupport for different priority levels on a rule basis is provided, for
4141dd9a6bSDavid Youngexample in order to force a more specific rule to come before a more generic
4241dd9a6bSDavid Youngone for packets matched by both. However hardware support for more than a
4341dd9a6bSDavid Youngsingle priority level cannot be guaranteed. When supported, the number of
4441dd9a6bSDavid Youngavailable priority levels is usually low, which is why they can also be
4541dd9a6bSDavid Youngimplemented in software by PMDs (e.g. missing priority levels may be
4641dd9a6bSDavid Youngemulated by reordering rules).
4741dd9a6bSDavid Young
4841dd9a6bSDavid YoungIn order to remain as hardware-agnostic as possible, by default all rules
4941dd9a6bSDavid Youngare considered to have the same priority, which means that the order between
5041dd9a6bSDavid Youngoverlapping rules (when a packet is matched by several filters) is
5141dd9a6bSDavid Youngundefined.
5241dd9a6bSDavid Young
5341dd9a6bSDavid YoungPMDs may refuse to create overlapping rules at a given priority level when
5441dd9a6bSDavid Youngthey can be detected (e.g. if a pattern matches an existing filter).
5541dd9a6bSDavid Young
5641dd9a6bSDavid YoungThus predictable results for a given priority level can only be achieved
5741dd9a6bSDavid Youngwith non-overlapping rules, using perfect matching on all protocol layers.
5841dd9a6bSDavid Young
5941dd9a6bSDavid YoungFlow rules can also be grouped, the flow rule priority is specific to the
6041dd9a6bSDavid Younggroup they belong to. All flow rules in a given group are thus processed within
6141dd9a6bSDavid Youngthe context of that group. Groups are not linked by default, so the logical
6241dd9a6bSDavid Younghierarchy of groups must be explicitly defined by flow rules themselves in each
6341dd9a6bSDavid Younggroup using the JUMP action to define the next group to redirect to. Only flow
6441dd9a6bSDavid Youngrules defined in the default group 0 are guaranteed to be matched against. This
6541dd9a6bSDavid Youngmakes group 0 the origin of any group hierarchy defined by an application.
6641dd9a6bSDavid Young
6741dd9a6bSDavid YoungSupport for multiple actions per rule may be implemented internally on top
6841dd9a6bSDavid Youngof non-default hardware priorities. As a result, both features may not be
6941dd9a6bSDavid Youngsimultaneously available to applications.
7041dd9a6bSDavid Young
7141dd9a6bSDavid YoungConsidering that allowed pattern/actions combinations cannot be known in
7241dd9a6bSDavid Youngadvance and would result in an impractically large number of capabilities to
7341dd9a6bSDavid Youngexpose, a method is provided to validate a given rule from the current
7441dd9a6bSDavid Youngdevice configuration state.
7541dd9a6bSDavid Young
7641dd9a6bSDavid YoungThis enables applications to check if the rule types they need is supported
7741dd9a6bSDavid Youngat initialization time, before starting their data path. This method can be
7841dd9a6bSDavid Youngused anytime, its only requirement being that the resources needed by a rule
7941dd9a6bSDavid Youngshould exist (e.g. a target RX queue should be configured first).
8041dd9a6bSDavid Young
8141dd9a6bSDavid YoungEach defined rule is associated with an opaque handle managed by the PMD,
8241dd9a6bSDavid Youngapplications are responsible for keeping it. These can be used for queries
8341dd9a6bSDavid Youngand rules management, such as retrieving counters or other data and
8441dd9a6bSDavid Youngdestroying them.
8541dd9a6bSDavid Young
8641dd9a6bSDavid YoungTo avoid resource leaks on the PMD side, handles must be explicitly
8741dd9a6bSDavid Youngdestroyed by the application before releasing associated resources such as
8841dd9a6bSDavid Youngqueues and ports.
8941dd9a6bSDavid Young
9041dd9a6bSDavid Young.. warning::
9141dd9a6bSDavid Young
9241dd9a6bSDavid Young   The following description of rule persistence is an experimental behavior
9341dd9a6bSDavid Young   that may change without a prior notice.
9441dd9a6bSDavid Young
9541dd9a6bSDavid YoungWhen the device is stopped, its rules do not process the traffic.
9641dd9a6bSDavid YoungIn particular, transfer rules created using some device
9741dd9a6bSDavid Youngstop affecting the traffic even if they refer to different ports.
9841dd9a6bSDavid Young
9941dd9a6bSDavid YoungIf ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is not advertised,
10041dd9a6bSDavid Youngrules cannot be created until the device is started for the first time
10141dd9a6bSDavid Youngand cannot be kept when the device is stopped.
10241dd9a6bSDavid YoungHowever, PMD also does not flush them automatically on stop,
10341dd9a6bSDavid Youngso the application must call ``rte_flow_flush()`` or ``rte_flow_destroy()``
10441dd9a6bSDavid Youngbefore stopping the device to ensure no rules remain.
10541dd9a6bSDavid Young
10641dd9a6bSDavid YoungIf ``RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP`` is advertised, this means
10741dd9a6bSDavid Youngthe PMD can keep at least some rules across the device stop and start.
10841dd9a6bSDavid YoungHowever, ``rte_eth_dev_configure()`` may fail if any rules remain,
10941dd9a6bSDavid Youngso the application must flush them before attempting a reconfiguration.
11041dd9a6bSDavid YoungKeeping may be unsupported for some types of rule items and actions,
11141dd9a6bSDavid Youngas well as depending on the value of flow attributes transfer bit.
11241dd9a6bSDavid YoungA combination of a single an item or action type
11341dd9a6bSDavid Youngand a value of the transfer bit is called a rule feature.
11441dd9a6bSDavid YoungFor example: a COUNT action with the transfer bit set.
11541dd9a6bSDavid YoungTo test if rules with a particular feature are kept, the application must try
11641dd9a6bSDavid Youngto create a valid rule using this feature when the device is not started
11741dd9a6bSDavid Young(either before the first start or after a stop).
11841dd9a6bSDavid YoungIf it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``,
11941dd9a6bSDavid Youngall rules using this feature must be flushed by the application
12041dd9a6bSDavid Youngbefore stopping the device.
12141dd9a6bSDavid YoungIf it succeeds, such rules will be kept when the device is stopped,
12241dd9a6bSDavid Youngprovided they do not use other features that are not supported.
12341dd9a6bSDavid YoungRules that are created when the device is stopped, including the rules
12441dd9a6bSDavid Youngcreated for the test, will be kept after the device is started.
12541dd9a6bSDavid Young
12641dd9a6bSDavid YoungThe following sections cover:
12741dd9a6bSDavid Young
12841dd9a6bSDavid Young- **Attributes** (represented by ``struct rte_flow_attr``): properties of a
12941dd9a6bSDavid Young  flow rule such as its direction (ingress or egress) and priority.
13041dd9a6bSDavid Young
13141dd9a6bSDavid Young- **Pattern item** (represented by ``struct rte_flow_item``): part of a
13241dd9a6bSDavid Young  matching pattern that either matches specific packet data or traffic
13341dd9a6bSDavid Young  properties. It can also describe properties of the pattern itself, such as
13441dd9a6bSDavid Young  inverted matching.
13541dd9a6bSDavid Young
13641dd9a6bSDavid Young- **Matching pattern**: traffic properties to look for, a combination of any
13741dd9a6bSDavid Young  number of items.
13841dd9a6bSDavid Young
13941dd9a6bSDavid Young- **Actions** (represented by ``struct rte_flow_action``): operations to
14041dd9a6bSDavid Young  perform whenever a packet is matched by a pattern.
14141dd9a6bSDavid Young
14241dd9a6bSDavid YoungAttributes
14341dd9a6bSDavid Young~~~~~~~~~~
14441dd9a6bSDavid Young
14541dd9a6bSDavid YoungAttribute: Group
14641dd9a6bSDavid Young^^^^^^^^^^^^^^^^
14741dd9a6bSDavid Young
14841dd9a6bSDavid YoungFlow rules can be grouped by assigning them a common group number. Groups
14941dd9a6bSDavid Youngallow a logical hierarchy of flow rule groups (tables) to be defined. These
15041dd9a6bSDavid Younggroups can be supported virtually in the PMD or in the physical device.
15141dd9a6bSDavid YoungGroup 0 is the default group and is the only group that
15241dd9a6bSDavid Youngflows are guaranteed to be matched against.
15341dd9a6bSDavid YoungAll subsequent groups can only be reached by using a JUMP action
15441dd9a6bSDavid Youngfrom a matched flow rule.
15541dd9a6bSDavid Young
15641dd9a6bSDavid YoungAlthough optional, applications are encouraged to group similar rules as
15741dd9a6bSDavid Youngmuch as possible to fully take advantage of hardware capabilities
15841dd9a6bSDavid Young(e.g. optimized matching) and work around limitations (e.g. a single pattern
15941dd9a6bSDavid Youngtype possibly allowed in a given group), while being aware that the groups'
16041dd9a6bSDavid Younghierarchies must be programmed explicitly.
16141dd9a6bSDavid Young
16241dd9a6bSDavid YoungNote that support for more than a single group is not guaranteed.
16341dd9a6bSDavid Young
16441dd9a6bSDavid YoungAttribute: Priority
16541dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^
16641dd9a6bSDavid Young
16741dd9a6bSDavid YoungA priority level can be assigned to a flow rule, lower values
16841dd9a6bSDavid Youngdenote higher priority, with 0 as the maximum.
16941dd9a6bSDavid Young
17041dd9a6bSDavid YoungPriority levels are arbitrary and up to the application, they do
17141dd9a6bSDavid Youngnot need to be contiguous nor start from 0, however the maximum number
17241dd9a6bSDavid Youngvaries between devices and may be affected by existing flow rules.
17341dd9a6bSDavid Young
17441dd9a6bSDavid YoungA flow which matches multiple rules in the same group will always be matched by
17541dd9a6bSDavid Youngthe rule with the highest priority in that group.
17641dd9a6bSDavid Young
17741dd9a6bSDavid YoungIf a packet is matched by several rules of a given group for a given
17841dd9a6bSDavid Youngpriority level, the outcome is undefined. It can take any path, may be
17941dd9a6bSDavid Youngduplicated or even cause unrecoverable errors.
18041dd9a6bSDavid Young
18141dd9a6bSDavid YoungNote that support for more than a single priority level is not guaranteed.
18241dd9a6bSDavid Young
18341dd9a6bSDavid YoungAttribute: Traffic direction
18441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18541dd9a6bSDavid Young
18641dd9a6bSDavid YoungUnless `Attribute: Transfer`_ is specified, flow rule patterns apply
18741dd9a6bSDavid Youngto inbound and / or outbound traffic. With this respect, ``ingress``
18841dd9a6bSDavid Youngand ``egress`` respectively stand for **inbound** and **outbound**
18941dd9a6bSDavid Youngbased on the standpoint of the application creating a flow rule.
19041dd9a6bSDavid Young
19141dd9a6bSDavid YoungSeveral pattern items and actions are valid and can be used in both
19241dd9a6bSDavid Youngdirections. At least one direction must be specified.
19341dd9a6bSDavid Young
19441dd9a6bSDavid YoungSpecifying both directions at once for a given rule is not recommended but
19541dd9a6bSDavid Youngmay be valid in a few cases.
19641dd9a6bSDavid Young
19741dd9a6bSDavid YoungAttribute: Transfer
19841dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^
19941dd9a6bSDavid Young
20041dd9a6bSDavid YoungInstead of simply matching the properties of traffic as it would appear on a
20141dd9a6bSDavid Younggiven DPDK port ID, enabling this attribute transfers a flow rule to the
20241dd9a6bSDavid Younglowest possible level of any device endpoints found in the pattern.
20341dd9a6bSDavid Young
20441dd9a6bSDavid YoungWhen supported, this effectively enables an application to reroute traffic
20541dd9a6bSDavid Youngnot necessarily intended for it (e.g. coming from or addressed to different
20641dd9a6bSDavid Youngphysical ports, VFs or applications) at the device level.
20741dd9a6bSDavid Young
20841dd9a6bSDavid YoungIn "transfer" flows, the use of `Attribute: Traffic direction`_ in not allowed.
20941dd9a6bSDavid YoungOne may use `Item: PORT_REPRESENTOR`_ and `Item: REPRESENTED_PORT`_ instead.
21041dd9a6bSDavid Young
21141dd9a6bSDavid YoungPattern item
21241dd9a6bSDavid Young~~~~~~~~~~~~
21341dd9a6bSDavid Young
21441dd9a6bSDavid YoungPattern items fall in two categories:
21541dd9a6bSDavid Young
21641dd9a6bSDavid Young- Matching protocol headers and packet data, usually associated with a
21741dd9a6bSDavid Young  specification structure. These must be stacked in the same order as the
21841dd9a6bSDavid Young  protocol layers to match inside packets, starting from the lowest.
21941dd9a6bSDavid Young
22041dd9a6bSDavid Young- Matching meta-data or affecting pattern processing, often without a
22141dd9a6bSDavid Young  specification structure. Since they do not match packet contents, their
22241dd9a6bSDavid Young  position in the list is usually not relevant.
22341dd9a6bSDavid Young
22441dd9a6bSDavid YoungItem specification structures are used to match specific values among
22541dd9a6bSDavid Youngprotocol fields (or item properties). Documentation describes for each item
22641dd9a6bSDavid Youngwhether they are associated with one and their type name if so.
22741dd9a6bSDavid Young
22841dd9a6bSDavid YoungUp to three structures of the same type can be set for a given item:
22941dd9a6bSDavid Young
23041dd9a6bSDavid Young- ``spec``: values to match (e.g. a given IPv4 address).
23141dd9a6bSDavid Young
23241dd9a6bSDavid Young- ``last``: upper bound for an inclusive range with corresponding fields in
23341dd9a6bSDavid Young  ``spec``.
23441dd9a6bSDavid Young
23541dd9a6bSDavid Young- ``mask``: bit-mask applied to both ``spec`` and ``last`` whose purpose is
23641dd9a6bSDavid Young  to distinguish the values to take into account and/or partially mask them
23741dd9a6bSDavid Young  out (e.g. in order to match an IPv4 address prefix).
23841dd9a6bSDavid Young
23941dd9a6bSDavid YoungUsage restrictions and expected behavior:
24041dd9a6bSDavid Young
24141dd9a6bSDavid Young- Setting either ``mask`` or ``last`` without ``spec`` is an error.
24241dd9a6bSDavid Young
24341dd9a6bSDavid Young- Field values in ``last`` which are either 0 or equal to the corresponding
24441dd9a6bSDavid Young  values in ``spec`` are ignored; they do not generate a range. Nonzero
24541dd9a6bSDavid Young  values lower than those in ``spec`` are not supported.
24641dd9a6bSDavid Young
24741dd9a6bSDavid Young- Setting ``spec`` and optionally ``last`` without ``mask`` causes the PMD
24841dd9a6bSDavid Young  to use the default mask defined for that item (defined as
24941dd9a6bSDavid Young  ``rte_flow_item_{name}_mask`` constants).
25041dd9a6bSDavid Young
25141dd9a6bSDavid Young- Not setting any of them (assuming item type allows it) is equivalent to
25241dd9a6bSDavid Young  providing an empty (zeroed) ``mask`` for broad (nonspecific) matching.
25341dd9a6bSDavid Young
25441dd9a6bSDavid Young- ``mask`` is a simple bit-mask applied before interpreting the contents of
25541dd9a6bSDavid Young  ``spec`` and ``last``, which may yield unexpected results if not used
25641dd9a6bSDavid Young  carefully. For example, if for an IPv4 address field, ``spec`` provides
25741dd9a6bSDavid Young  *10.1.2.3*, ``last`` provides *10.3.4.5* and ``mask`` provides
25841dd9a6bSDavid Young  *255.255.0.0*, the effective range becomes *10.1.0.0* to *10.3.255.255*.
25941dd9a6bSDavid Young
26041dd9a6bSDavid YoungExample of an item specification matching an Ethernet header:
26141dd9a6bSDavid Young
26241dd9a6bSDavid Young.. _table_rte_flow_pattern_item_example:
26341dd9a6bSDavid Young
26441dd9a6bSDavid Young.. table:: Ethernet item
26541dd9a6bSDavid Young
26641dd9a6bSDavid Young   +----------+----------+-----------------------+
26741dd9a6bSDavid Young   | Field    | Subfield | Value                 |
26841dd9a6bSDavid Young   +==========+==========+=======================+
26941dd9a6bSDavid Young   | ``spec`` | ``src``  | ``00:00:01:02:03:04`` |
27041dd9a6bSDavid Young   |          +----------+-----------------------+
27141dd9a6bSDavid Young   |          | ``dst``  | ``00:00:2a:66:00:01`` |
27241dd9a6bSDavid Young   |          +----------+-----------------------+
27341dd9a6bSDavid Young   |          | ``type`` | ``0x22aa``            |
27441dd9a6bSDavid Young   +----------+----------+-----------------------+
27541dd9a6bSDavid Young   | ``last`` | unspecified                      |
27641dd9a6bSDavid Young   +----------+----------+-----------------------+
27741dd9a6bSDavid Young   | ``mask`` | ``src``  | ``00:00:ff:ff:ff:00`` |
27841dd9a6bSDavid Young   |          +----------+-----------------------+
27941dd9a6bSDavid Young   |          | ``dst``  | ``00:00:00:00:00:ff`` |
28041dd9a6bSDavid Young   |          +----------+-----------------------+
28141dd9a6bSDavid Young   |          | ``type`` | ``0x0000``            |
28241dd9a6bSDavid Young   +----------+----------+-----------------------+
28341dd9a6bSDavid Young
28441dd9a6bSDavid YoungNon-masked bits stand for any value (shown as ``?`` below), Ethernet headers
28541dd9a6bSDavid Youngwith the following properties are thus matched:
28641dd9a6bSDavid Young
28741dd9a6bSDavid Young- ``src``: ``??:??:01:02:03:??``
28841dd9a6bSDavid Young- ``dst``: ``??:??:??:??:??:01``
28941dd9a6bSDavid Young- ``type``: ``0x????``
29041dd9a6bSDavid Young
29141dd9a6bSDavid YoungMatching pattern
29241dd9a6bSDavid Young~~~~~~~~~~~~~~~~
29341dd9a6bSDavid Young
29441dd9a6bSDavid YoungA pattern is formed by stacking items starting from the lowest protocol
29541dd9a6bSDavid Younglayer to match. This stacking restriction does not apply to meta items which
29641dd9a6bSDavid Youngcan be placed anywhere in the stack without affecting the meaning of the
29741dd9a6bSDavid Youngresulting pattern.
29841dd9a6bSDavid Young
29941dd9a6bSDavid YoungPatterns are terminated by END items.
30041dd9a6bSDavid Young
30141dd9a6bSDavid YoungExamples:
30241dd9a6bSDavid Young
30341dd9a6bSDavid Young.. _table_rte_flow_tcpv4_as_l4:
30441dd9a6bSDavid Young
30541dd9a6bSDavid Young.. table:: TCPv4 as L4
30641dd9a6bSDavid Young
30741dd9a6bSDavid Young   +-------+----------+
30841dd9a6bSDavid Young   | Index | Item     |
30941dd9a6bSDavid Young   +=======+==========+
31041dd9a6bSDavid Young   | 0     | Ethernet |
31141dd9a6bSDavid Young   +-------+----------+
31241dd9a6bSDavid Young   | 1     | IPv4     |
31341dd9a6bSDavid Young   +-------+----------+
31441dd9a6bSDavid Young   | 2     | TCP      |
31541dd9a6bSDavid Young   +-------+----------+
31641dd9a6bSDavid Young   | 3     | END      |
31741dd9a6bSDavid Young   +-------+----------+
31841dd9a6bSDavid Young
31941dd9a6bSDavid Young|
32041dd9a6bSDavid Young
32141dd9a6bSDavid Young.. _table_rte_flow_tcpv6_in_vxlan:
32241dd9a6bSDavid Young
32341dd9a6bSDavid Young.. table:: TCPv6 in VXLAN
32441dd9a6bSDavid Young
32541dd9a6bSDavid Young   +-------+------------+
32641dd9a6bSDavid Young   | Index | Item       |
32741dd9a6bSDavid Young   +=======+============+
32841dd9a6bSDavid Young   | 0     | Ethernet   |
32941dd9a6bSDavid Young   +-------+------------+
33041dd9a6bSDavid Young   | 1     | IPv4       |
33141dd9a6bSDavid Young   +-------+------------+
33241dd9a6bSDavid Young   | 2     | UDP        |
33341dd9a6bSDavid Young   +-------+------------+
33441dd9a6bSDavid Young   | 3     | VXLAN      |
33541dd9a6bSDavid Young   +-------+------------+
33641dd9a6bSDavid Young   | 4     | Ethernet   |
33741dd9a6bSDavid Young   +-------+------------+
33841dd9a6bSDavid Young   | 5     | IPv6       |
33941dd9a6bSDavid Young   +-------+------------+
34041dd9a6bSDavid Young   | 6     | TCP        |
34141dd9a6bSDavid Young   +-------+------------+
34241dd9a6bSDavid Young   | 7     | END        |
34341dd9a6bSDavid Young   +-------+------------+
34441dd9a6bSDavid Young
34541dd9a6bSDavid Young|
34641dd9a6bSDavid Young
34741dd9a6bSDavid Young.. _table_rte_flow_tcpv4_as_l4_meta:
34841dd9a6bSDavid Young
34941dd9a6bSDavid Young.. table:: TCPv4 as L4 with meta items
35041dd9a6bSDavid Young
35141dd9a6bSDavid Young   +-------+----------+
35241dd9a6bSDavid Young   | Index | Item     |
35341dd9a6bSDavid Young   +=======+==========+
35441dd9a6bSDavid Young   | 0     | VOID     |
35541dd9a6bSDavid Young   +-------+----------+
35641dd9a6bSDavid Young   | 1     | Ethernet |
35741dd9a6bSDavid Young   +-------+----------+
35841dd9a6bSDavid Young   | 2     | VOID     |
35941dd9a6bSDavid Young   +-------+----------+
36041dd9a6bSDavid Young   | 3     | IPv4     |
36141dd9a6bSDavid Young   +-------+----------+
36241dd9a6bSDavid Young   | 4     | TCP      |
36341dd9a6bSDavid Young   +-------+----------+
36441dd9a6bSDavid Young   | 5     | VOID     |
36541dd9a6bSDavid Young   +-------+----------+
36641dd9a6bSDavid Young   | 6     | VOID     |
36741dd9a6bSDavid Young   +-------+----------+
36841dd9a6bSDavid Young   | 7     | END      |
36941dd9a6bSDavid Young   +-------+----------+
37041dd9a6bSDavid Young
37141dd9a6bSDavid YoungThe above example shows how meta items do not affect packet data matching
37241dd9a6bSDavid Youngitems, as long as those remain stacked properly. The resulting matching
37341dd9a6bSDavid Youngpattern is identical to "TCPv4 as L4".
37441dd9a6bSDavid Young
37541dd9a6bSDavid Young.. _table_rte_flow_udpv6_anywhere:
37641dd9a6bSDavid Young
37741dd9a6bSDavid Young.. table:: UDPv6 anywhere
37841dd9a6bSDavid Young
37941dd9a6bSDavid Young   +-------+------+
38041dd9a6bSDavid Young   | Index | Item |
38141dd9a6bSDavid Young   +=======+======+
38241dd9a6bSDavid Young   | 0     | IPv6 |
38341dd9a6bSDavid Young   +-------+------+
38441dd9a6bSDavid Young   | 1     | UDP  |
38541dd9a6bSDavid Young   +-------+------+
38641dd9a6bSDavid Young   | 2     | END  |
38741dd9a6bSDavid Young   +-------+------+
38841dd9a6bSDavid Young
38941dd9a6bSDavid YoungIf supported by the PMD, omitting one or several protocol layers at the
39041dd9a6bSDavid Youngbottom of the stack as in the above example (missing an Ethernet
39141dd9a6bSDavid Youngspecification) enables looking up anywhere in packets.
39241dd9a6bSDavid Young
39341dd9a6bSDavid YoungIt is unspecified whether the payload of supported encapsulations
39441dd9a6bSDavid Young(e.g. VXLAN payload) is matched by such a pattern, which may apply to inner,
39541dd9a6bSDavid Youngouter or both packets.
39641dd9a6bSDavid Young
39741dd9a6bSDavid Young.. _table_rte_flow_invalid_l3:
39841dd9a6bSDavid Young
39941dd9a6bSDavid Young.. table:: Invalid, missing L3
40041dd9a6bSDavid Young
40141dd9a6bSDavid Young   +-------+----------+
40241dd9a6bSDavid Young   | Index | Item     |
40341dd9a6bSDavid Young   +=======+==========+
40441dd9a6bSDavid Young   | 0     | Ethernet |
40541dd9a6bSDavid Young   +-------+----------+
40641dd9a6bSDavid Young   | 1     | UDP      |
40741dd9a6bSDavid Young   +-------+----------+
40841dd9a6bSDavid Young   | 2     | END      |
40941dd9a6bSDavid Young   +-------+----------+
41041dd9a6bSDavid Young
41141dd9a6bSDavid YoungThe above pattern is invalid due to a missing L3 specification between L2
41241dd9a6bSDavid Young(Ethernet) and L4 (UDP). Doing so is only allowed at the bottom and at the
41341dd9a6bSDavid Youngtop of the stack.
41441dd9a6bSDavid Young
41541dd9a6bSDavid YoungMeta item types
41641dd9a6bSDavid Young~~~~~~~~~~~~~~~
41741dd9a6bSDavid Young
41841dd9a6bSDavid YoungThey match meta-data or affect pattern processing instead of matching packet
41941dd9a6bSDavid Youngdata directly, most of them do not need a specification structure. This
42041dd9a6bSDavid Youngparticularity allows them to be specified anywhere in the stack without
42141dd9a6bSDavid Youngcausing any side effect.
42241dd9a6bSDavid Young
42341dd9a6bSDavid YoungItem: ``END``
42441dd9a6bSDavid Young^^^^^^^^^^^^^
42541dd9a6bSDavid Young
42641dd9a6bSDavid YoungEnd marker for item lists. Prevents further processing of items, thereby
42741dd9a6bSDavid Youngending the pattern.
42841dd9a6bSDavid Young
42941dd9a6bSDavid Young- Its numeric value is 0 for convenience.
43041dd9a6bSDavid Young- PMD support is mandatory.
43141dd9a6bSDavid Young- ``spec``, ``last`` and ``mask`` are ignored.
43241dd9a6bSDavid Young
43341dd9a6bSDavid Young.. _table_rte_flow_item_end:
43441dd9a6bSDavid Young
43541dd9a6bSDavid Young.. table:: END
43641dd9a6bSDavid Young
43741dd9a6bSDavid Young   +----------+---------+
43841dd9a6bSDavid Young   | Field    | Value   |
43941dd9a6bSDavid Young   +==========+=========+
44041dd9a6bSDavid Young   | ``spec`` | ignored |
44141dd9a6bSDavid Young   +----------+---------+
44241dd9a6bSDavid Young   | ``last`` | ignored |
44341dd9a6bSDavid Young   +----------+---------+
44441dd9a6bSDavid Young   | ``mask`` | ignored |
44541dd9a6bSDavid Young   +----------+---------+
44641dd9a6bSDavid Young
44741dd9a6bSDavid YoungItem: ``VOID``
44841dd9a6bSDavid Young^^^^^^^^^^^^^^
44941dd9a6bSDavid Young
45041dd9a6bSDavid YoungUsed as a placeholder for convenience. It is ignored and simply discarded by
45141dd9a6bSDavid YoungPMDs.
45241dd9a6bSDavid Young
45341dd9a6bSDavid Young- PMD support is mandatory.
45441dd9a6bSDavid Young- ``spec``, ``last`` and ``mask`` are ignored.
45541dd9a6bSDavid Young
45641dd9a6bSDavid Young.. _table_rte_flow_item_void:
45741dd9a6bSDavid Young
45841dd9a6bSDavid Young.. table:: VOID
45941dd9a6bSDavid Young
46041dd9a6bSDavid Young   +----------+---------+
46141dd9a6bSDavid Young   | Field    | Value   |
46241dd9a6bSDavid Young   +==========+=========+
46341dd9a6bSDavid Young   | ``spec`` | ignored |
46441dd9a6bSDavid Young   +----------+---------+
46541dd9a6bSDavid Young   | ``last`` | ignored |
46641dd9a6bSDavid Young   +----------+---------+
46741dd9a6bSDavid Young   | ``mask`` | ignored |
46841dd9a6bSDavid Young   +----------+---------+
46941dd9a6bSDavid Young
47041dd9a6bSDavid YoungOne usage example for this type is generating rules that share a common
47141dd9a6bSDavid Youngprefix quickly without reallocating memory, only by updating item types:
47241dd9a6bSDavid Young
47341dd9a6bSDavid Young.. _table_rte_flow_item_void_example:
47441dd9a6bSDavid Young
47541dd9a6bSDavid Young.. table:: TCP, UDP or ICMP as L4
47641dd9a6bSDavid Young
47741dd9a6bSDavid Young   +-------+--------------------+
47841dd9a6bSDavid Young   | Index | Item               |
47941dd9a6bSDavid Young   +=======+====================+
48041dd9a6bSDavid Young   | 0     | Ethernet           |
48141dd9a6bSDavid Young   +-------+--------------------+
48241dd9a6bSDavid Young   | 1     | IPv4               |
48341dd9a6bSDavid Young   +-------+------+------+------+
48441dd9a6bSDavid Young   | 2     | UDP  | VOID | VOID |
48541dd9a6bSDavid Young   +-------+------+------+------+
48641dd9a6bSDavid Young   | 3     | VOID | TCP  | VOID |
48741dd9a6bSDavid Young   +-------+------+------+------+
48841dd9a6bSDavid Young   | 4     | VOID | VOID | ICMP |
48941dd9a6bSDavid Young   +-------+------+------+------+
49041dd9a6bSDavid Young   | 5     | END                |
49141dd9a6bSDavid Young   +-------+--------------------+
49241dd9a6bSDavid Young
49341dd9a6bSDavid YoungItem: ``INVERT``
49441dd9a6bSDavid Young^^^^^^^^^^^^^^^^
49541dd9a6bSDavid Young
49641dd9a6bSDavid YoungInverted matching, i.e. process packets that do not match the pattern.
49741dd9a6bSDavid Young
49841dd9a6bSDavid Young- ``spec``, ``last`` and ``mask`` are ignored.
49941dd9a6bSDavid Young
50041dd9a6bSDavid Young.. _table_rte_flow_item_invert:
50141dd9a6bSDavid Young
50241dd9a6bSDavid Young.. table:: INVERT
50341dd9a6bSDavid Young
50441dd9a6bSDavid Young   +----------+---------+
50541dd9a6bSDavid Young   | Field    | Value   |
50641dd9a6bSDavid Young   +==========+=========+
50741dd9a6bSDavid Young   | ``spec`` | ignored |
50841dd9a6bSDavid Young   +----------+---------+
50941dd9a6bSDavid Young   | ``last`` | ignored |
51041dd9a6bSDavid Young   +----------+---------+
51141dd9a6bSDavid Young   | ``mask`` | ignored |
51241dd9a6bSDavid Young   +----------+---------+
51341dd9a6bSDavid Young
51441dd9a6bSDavid YoungUsage example, matching non-TCPv4 packets only:
51541dd9a6bSDavid Young
51641dd9a6bSDavid Young.. _table_rte_flow_item_invert_example:
51741dd9a6bSDavid Young
51841dd9a6bSDavid Young.. table:: Anything but TCPv4
51941dd9a6bSDavid Young
52041dd9a6bSDavid Young   +-------+----------+
52141dd9a6bSDavid Young   | Index | Item     |
52241dd9a6bSDavid Young   +=======+==========+
52341dd9a6bSDavid Young   | 0     | INVERT   |
52441dd9a6bSDavid Young   +-------+----------+
52541dd9a6bSDavid Young   | 1     | Ethernet |
52641dd9a6bSDavid Young   +-------+----------+
52741dd9a6bSDavid Young   | 2     | IPv4     |
52841dd9a6bSDavid Young   +-------+----------+
52941dd9a6bSDavid Young   | 3     | TCP      |
53041dd9a6bSDavid Young   +-------+----------+
53141dd9a6bSDavid Young   | 4     | END      |
53241dd9a6bSDavid Young   +-------+----------+
53341dd9a6bSDavid Young
53441dd9a6bSDavid YoungItem: ``PORT_ID``
53541dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
53641dd9a6bSDavid Young
53741dd9a6bSDavid YoungThis item is deprecated. Consider:
53841dd9a6bSDavid Young - `Item: PORT_REPRESENTOR`_
53941dd9a6bSDavid Young - `Item: REPRESENTED_PORT`_
54041dd9a6bSDavid Young
54141dd9a6bSDavid YoungMatches traffic originating from (ingress) or going to (egress) a given DPDK
54241dd9a6bSDavid Youngport ID.
54341dd9a6bSDavid Young
54441dd9a6bSDavid YoungNormally only supported if the port ID in question is known by the
54541dd9a6bSDavid Youngunderlying PMD and related to the device the flow rule is created against.
54641dd9a6bSDavid Young
54741dd9a6bSDavid Young- Default ``mask`` matches the specified DPDK port ID.
54841dd9a6bSDavid Young
54941dd9a6bSDavid Young.. _table_rte_flow_item_port_id:
55041dd9a6bSDavid Young
55141dd9a6bSDavid Young.. table:: PORT_ID
55241dd9a6bSDavid Young
55341dd9a6bSDavid Young   +----------+----------+-----------------------------+
55441dd9a6bSDavid Young   | Field    | Subfield | Value                       |
55541dd9a6bSDavid Young   +==========+==========+=============================+
55641dd9a6bSDavid Young   | ``spec`` | ``id``   | DPDK port ID                |
55741dd9a6bSDavid Young   +----------+----------+-----------------------------+
55841dd9a6bSDavid Young   | ``last`` | ``id``   | upper range value           |
55941dd9a6bSDavid Young   +----------+----------+-----------------------------+
56041dd9a6bSDavid Young   | ``mask`` | ``id``   | zeroed to match any port ID |
56141dd9a6bSDavid Young   +----------+----------+-----------------------------+
56241dd9a6bSDavid Young
56341dd9a6bSDavid YoungItem: ``MARK``
56441dd9a6bSDavid Young^^^^^^^^^^^^^^
56541dd9a6bSDavid Young
56641dd9a6bSDavid YoungMatches an arbitrary integer value which was set using the ``MARK`` action in
56741dd9a6bSDavid Younga previously matched rule.
56841dd9a6bSDavid Young
56941dd9a6bSDavid YoungThis item can only specified once as a match criteria as the ``MARK`` action can
57041dd9a6bSDavid Youngonly be specified once in a flow action.
57141dd9a6bSDavid Young
57241dd9a6bSDavid YoungNote the value of MARK field is arbitrary and application defined.
57341dd9a6bSDavid Young
57441dd9a6bSDavid YoungDepending on the underlying implementation the MARK item may be supported on
57541dd9a6bSDavid Youngthe physical device, with virtual groups in the PMD or not at all.
57641dd9a6bSDavid Young
57741dd9a6bSDavid Young- Default ``mask`` matches any integer value.
57841dd9a6bSDavid Young
57941dd9a6bSDavid Young.. _table_rte_flow_item_mark:
58041dd9a6bSDavid Young
58141dd9a6bSDavid Young.. table:: MARK
58241dd9a6bSDavid Young
58341dd9a6bSDavid Young   +----------+----------+---------------------------+
58441dd9a6bSDavid Young   | Field    | Subfield | Value                     |
58541dd9a6bSDavid Young   +==========+==========+===========================+
58641dd9a6bSDavid Young   | ``spec`` | ``id``   | integer value             |
58741dd9a6bSDavid Young   +----------+--------------------------------------+
58841dd9a6bSDavid Young   | ``last`` | ``id``   | upper range value         |
58941dd9a6bSDavid Young   +----------+----------+---------------------------+
59041dd9a6bSDavid Young   | ``mask`` | ``id``   | zeroed to match any value |
59141dd9a6bSDavid Young   +----------+----------+---------------------------+
59241dd9a6bSDavid Young
59341dd9a6bSDavid YoungItem: ``TAG``
59441dd9a6bSDavid Young^^^^^^^^^^^^^
59541dd9a6bSDavid Young
59641dd9a6bSDavid YoungMatches tag item set by other flows. Multiple tags are supported by specifying
59741dd9a6bSDavid Young``index``.
59841dd9a6bSDavid Young
59941dd9a6bSDavid Young- Default ``mask`` matches the specified tag value and index.
60041dd9a6bSDavid Young
60141dd9a6bSDavid Young.. _table_rte_flow_item_tag:
60241dd9a6bSDavid Young
60341dd9a6bSDavid Young.. table:: TAG
60441dd9a6bSDavid Young
60541dd9a6bSDavid Young   +----------+----------+----------------------------------------+
60641dd9a6bSDavid Young   | Field    | Subfield  | Value                                 |
60741dd9a6bSDavid Young   +==========+===========+=======================================+
60841dd9a6bSDavid Young   | ``spec`` | ``data``  | 32 bit flow tag value                 |
60941dd9a6bSDavid Young   |          +-----------+---------------------------------------+
61041dd9a6bSDavid Young   |          | ``index`` | index of flow tag                     |
61141dd9a6bSDavid Young   +----------+-----------+---------------------------------------+
61241dd9a6bSDavid Young   | ``last`` | ``data``  | upper range value                     |
61341dd9a6bSDavid Young   |          +-----------+---------------------------------------+
61441dd9a6bSDavid Young   |          | ``index`` | field is ignored                      |
61541dd9a6bSDavid Young   +----------+-----------+---------------------------------------+
61641dd9a6bSDavid Young   | ``mask`` | ``data``  | bit-mask applies to "spec" and "last" |
61741dd9a6bSDavid Young   |          +-----------+---------------------------------------+
61841dd9a6bSDavid Young   |          | ``index`` | field is ignored                      |
61941dd9a6bSDavid Young   +----------+-----------+---------------------------------------+
62041dd9a6bSDavid Young
62141dd9a6bSDavid YoungItem: ``META``
62241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
62341dd9a6bSDavid Young
62441dd9a6bSDavid YoungMatches 32 bit metadata item set.
62541dd9a6bSDavid Young
62641dd9a6bSDavid YoungOn egress, metadata can be set either by mbuf metadata field with
62741dd9a6bSDavid YoungRTE_MBUF_DYNFLAG_TX_METADATA flag or ``SET_META`` action. On ingress, ``SET_META``
62841dd9a6bSDavid Youngaction sets metadata for a packet and the metadata will be reported via
62941dd9a6bSDavid Young``metadata`` dynamic field of ``rte_mbuf`` with RTE_MBUF_DYNFLAG_RX_METADATA flag.
63041dd9a6bSDavid Young
63141dd9a6bSDavid Young- Default ``mask`` matches the specified Rx metadata value.
63241dd9a6bSDavid Young
63341dd9a6bSDavid Young.. _table_rte_flow_item_meta:
63441dd9a6bSDavid Young
63541dd9a6bSDavid Young.. table:: META
63641dd9a6bSDavid Young
63741dd9a6bSDavid Young   +----------+----------+---------------------------------------+
63841dd9a6bSDavid Young   | Field    | Subfield | Value                                 |
63941dd9a6bSDavid Young   +==========+==========+=======================================+
64041dd9a6bSDavid Young   | ``spec`` | ``data`` | 32 bit metadata value                 |
64141dd9a6bSDavid Young   +----------+----------+---------------------------------------+
64241dd9a6bSDavid Young   | ``last`` | ``data`` | upper range value                     |
64341dd9a6bSDavid Young   +----------+----------+---------------------------------------+
64441dd9a6bSDavid Young   | ``mask`` | ``data`` | bit-mask applies to "spec" and "last" |
64541dd9a6bSDavid Young   +----------+----------+---------------------------------------+
64641dd9a6bSDavid Young
64741dd9a6bSDavid YoungData matching item types
64841dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~
64941dd9a6bSDavid Young
65041dd9a6bSDavid YoungMost of these are basically protocol header definitions with associated
65141dd9a6bSDavid Youngbit-masks. They must be specified (stacked) from lowest to highest protocol
65241dd9a6bSDavid Younglayer to form a matching pattern.
65341dd9a6bSDavid Young
65441dd9a6bSDavid YoungItem: ``ANY``
65541dd9a6bSDavid Young^^^^^^^^^^^^^
65641dd9a6bSDavid Young
65741dd9a6bSDavid YoungMatches any protocol in place of the current layer, a single ANY may also
65841dd9a6bSDavid Youngstand for several protocol layers.
65941dd9a6bSDavid Young
66041dd9a6bSDavid YoungThis is usually specified as the first pattern item when looking for a
66141dd9a6bSDavid Youngprotocol anywhere in a packet.
66241dd9a6bSDavid Young
66341dd9a6bSDavid Young- Default ``mask`` stands for any number of layers.
66441dd9a6bSDavid Young
66541dd9a6bSDavid Young.. _table_rte_flow_item_any:
66641dd9a6bSDavid Young
66741dd9a6bSDavid Young.. table:: ANY
66841dd9a6bSDavid Young
66941dd9a6bSDavid Young   +----------+----------+--------------------------------------+
67041dd9a6bSDavid Young   | Field    | Subfield | Value                                |
67141dd9a6bSDavid Young   +==========+==========+======================================+
67241dd9a6bSDavid Young   | ``spec`` | ``num``  | number of layers covered             |
67341dd9a6bSDavid Young   +----------+----------+--------------------------------------+
67441dd9a6bSDavid Young   | ``last`` | ``num``  | upper range value                    |
67541dd9a6bSDavid Young   +----------+----------+--------------------------------------+
67641dd9a6bSDavid Young   | ``mask`` | ``num``  | zeroed to cover any number of layers |
67741dd9a6bSDavid Young   +----------+----------+--------------------------------------+
67841dd9a6bSDavid Young
67941dd9a6bSDavid YoungExample for VXLAN TCP payload matching regardless of outer L3 (IPv4 or IPv6)
68041dd9a6bSDavid Youngand L4 (UDP) both matched by the first ANY specification, and inner L3 (IPv4
68141dd9a6bSDavid Youngor IPv6) matched by the second ANY specification:
68241dd9a6bSDavid Young
68341dd9a6bSDavid Young.. _table_rte_flow_item_any_example:
68441dd9a6bSDavid Young
68541dd9a6bSDavid Young.. table:: TCP in VXLAN with wildcards
68641dd9a6bSDavid Young
68741dd9a6bSDavid Young   +-------+------+----------+----------+-------+
68841dd9a6bSDavid Young   | Index | Item | Field    | Subfield | Value |
68941dd9a6bSDavid Young   +=======+======+==========+==========+=======+
69041dd9a6bSDavid Young   | 0     | Ethernet                           |
69141dd9a6bSDavid Young   +-------+------+----------+----------+-------+
69241dd9a6bSDavid Young   | 1     | ANY  | ``spec`` | ``num``  | 2     |
69341dd9a6bSDavid Young   +-------+------+----------+----------+-------+
69441dd9a6bSDavid Young   | 2     | VXLAN                              |
69541dd9a6bSDavid Young   +-------+------------------------------------+
69641dd9a6bSDavid Young   | 3     | Ethernet                           |
69741dd9a6bSDavid Young   +-------+------+----------+----------+-------+
69841dd9a6bSDavid Young   | 4     | ANY  | ``spec`` | ``num``  | 1     |
69941dd9a6bSDavid Young   +-------+------+----------+----------+-------+
70041dd9a6bSDavid Young   | 5     | TCP                                |
70141dd9a6bSDavid Young   +-------+------------------------------------+
70241dd9a6bSDavid Young   | 6     | END                                |
70341dd9a6bSDavid Young   +-------+------------------------------------+
70441dd9a6bSDavid Young
70541dd9a6bSDavid YoungItem: ``RAW``
70641dd9a6bSDavid Young^^^^^^^^^^^^^
70741dd9a6bSDavid Young
70841dd9a6bSDavid YoungMatches a byte string of a given length at a given offset.
70941dd9a6bSDavid Young
71041dd9a6bSDavid YoungOffset is either absolute (using the start of the packet) or relative to the
71141dd9a6bSDavid Youngend of the previous matched item in the stack, in which case negative values
71241dd9a6bSDavid Youngare allowed.
71341dd9a6bSDavid Young
71441dd9a6bSDavid YoungIf search is enabled, offset is used as the starting point. The search area
71541dd9a6bSDavid Youngcan be delimited by setting limit to a nonzero value, which is the maximum
71641dd9a6bSDavid Youngnumber of bytes after offset where the pattern may start.
71741dd9a6bSDavid Young
71841dd9a6bSDavid YoungMatching a zero-length pattern is allowed, doing so resets the relative
71941dd9a6bSDavid Youngoffset for subsequent items.
72041dd9a6bSDavid Young
72141dd9a6bSDavid Young- This type does not support ranges (``last`` field).
72241dd9a6bSDavid Young- Default ``mask`` matches all fields exactly.
72341dd9a6bSDavid Young
72441dd9a6bSDavid Young.. _table_rte_flow_item_raw:
72541dd9a6bSDavid Young
72641dd9a6bSDavid Young.. table:: RAW
72741dd9a6bSDavid Young
72841dd9a6bSDavid Young   +----------+--------------+-------------------------------------------------+
72941dd9a6bSDavid Young   | Field    | Subfield     | Value                                           |
73041dd9a6bSDavid Young   +==========+==============+=================================================+
73141dd9a6bSDavid Young   | ``spec`` | ``relative`` | look for pattern after the previous item        |
73241dd9a6bSDavid Young   |          +--------------+-------------------------------------------------+
73341dd9a6bSDavid Young   |          | ``search``   | search pattern from offset (see also ``limit``) |
73441dd9a6bSDavid Young   |          +--------------+-------------------------------------------------+
73541dd9a6bSDavid Young   |          | ``reserved`` | reserved, must be set to zero                   |
73641dd9a6bSDavid Young   |          +--------------+-------------------------------------------------+
73741dd9a6bSDavid Young   |          | ``offset``   | absolute or relative offset for ``pattern``     |
73841dd9a6bSDavid Young   |          +--------------+-------------------------------------------------+
73941dd9a6bSDavid Young   |          | ``limit``    | search area limit for start of ``pattern``      |
74041dd9a6bSDavid Young   |          +--------------+-------------------------------------------------+
74141dd9a6bSDavid Young   |          | ``length``   | ``pattern`` length                              |
74241dd9a6bSDavid Young   |          +--------------+-------------------------------------------------+
74341dd9a6bSDavid Young   |          | ``pattern``  | byte string to look for                         |
74441dd9a6bSDavid Young   +----------+--------------+-------------------------------------------------+
74541dd9a6bSDavid Young   | ``last`` | if specified, either all 0 or with the same values as ``spec`` |
74641dd9a6bSDavid Young   +----------+----------------------------------------------------------------+
74741dd9a6bSDavid Young   | ``mask`` | bit-mask applied to ``spec`` values with usual behavior        |
74841dd9a6bSDavid Young   +----------+----------------------------------------------------------------+
74941dd9a6bSDavid Young
75041dd9a6bSDavid YoungExample pattern looking for several strings at various offsets of a UDP
75141dd9a6bSDavid Youngpayload, using combined RAW items:
75241dd9a6bSDavid Young
75341dd9a6bSDavid Young.. _table_rte_flow_item_raw_example:
75441dd9a6bSDavid Young
75541dd9a6bSDavid Young.. table:: UDP payload matching
75641dd9a6bSDavid Young
75741dd9a6bSDavid Young   +-------+------+----------+--------------+-------+
75841dd9a6bSDavid Young   | Index | Item | Field    | Subfield     | Value |
75941dd9a6bSDavid Young   +=======+======+==========+==============+=======+
76041dd9a6bSDavid Young   | 0     | Ethernet                               |
76141dd9a6bSDavid Young   +-------+----------------------------------------+
76241dd9a6bSDavid Young   | 1     | IPv4                                   |
76341dd9a6bSDavid Young   +-------+----------------------------------------+
76441dd9a6bSDavid Young   | 2     | UDP                                    |
76541dd9a6bSDavid Young   +-------+------+----------+--------------+-------+
76641dd9a6bSDavid Young   | 3     | RAW  | ``spec`` | ``relative`` | 1     |
76741dd9a6bSDavid Young   |       |      |          +--------------+-------+
76841dd9a6bSDavid Young   |       |      |          | ``search``   | 1     |
76941dd9a6bSDavid Young   |       |      |          +--------------+-------+
77041dd9a6bSDavid Young   |       |      |          | ``offset``   | 10    |
77141dd9a6bSDavid Young   |       |      |          +--------------+-------+
77241dd9a6bSDavid Young   |       |      |          | ``limit``    | 0     |
77341dd9a6bSDavid Young   |       |      |          +--------------+-------+
77441dd9a6bSDavid Young   |       |      |          | ``length``   | 3     |
77541dd9a6bSDavid Young   |       |      |          +--------------+-------+
77641dd9a6bSDavid Young   |       |      |          | ``pattern``  | "foo" |
77741dd9a6bSDavid Young   +-------+------+----------+--------------+-------+
77841dd9a6bSDavid Young   | 4     | RAW  | ``spec`` | ``relative`` | 1     |
77941dd9a6bSDavid Young   |       |      |          +--------------+-------+
78041dd9a6bSDavid Young   |       |      |          | ``search``   | 0     |
78141dd9a6bSDavid Young   |       |      |          +--------------+-------+
78241dd9a6bSDavid Young   |       |      |          | ``offset``   | 20    |
78341dd9a6bSDavid Young   |       |      |          +--------------+-------+
78441dd9a6bSDavid Young   |       |      |          | ``limit``    | 0     |
78541dd9a6bSDavid Young   |       |      |          +--------------+-------+
78641dd9a6bSDavid Young   |       |      |          | ``length``   | 3     |
78741dd9a6bSDavid Young   |       |      |          +--------------+-------+
78841dd9a6bSDavid Young   |       |      |          | ``pattern``  | "bar" |
78941dd9a6bSDavid Young   +-------+------+----------+--------------+-------+
79041dd9a6bSDavid Young   | 5     | RAW  | ``spec`` | ``relative`` | 1     |
79141dd9a6bSDavid Young   |       |      |          +--------------+-------+
79241dd9a6bSDavid Young   |       |      |          | ``search``   | 0     |
79341dd9a6bSDavid Young   |       |      |          +--------------+-------+
79441dd9a6bSDavid Young   |       |      |          | ``offset``   | -29   |
79541dd9a6bSDavid Young   |       |      |          +--------------+-------+
79641dd9a6bSDavid Young   |       |      |          | ``limit``    | 0     |
79741dd9a6bSDavid Young   |       |      |          +--------------+-------+
79841dd9a6bSDavid Young   |       |      |          | ``length``   | 3     |
79941dd9a6bSDavid Young   |       |      |          +--------------+-------+
80041dd9a6bSDavid Young   |       |      |          | ``pattern``  | "baz" |
80141dd9a6bSDavid Young   +-------+------+----------+--------------+-------+
80241dd9a6bSDavid Young   | 6     | END                                    |
80341dd9a6bSDavid Young   +-------+----------------------------------------+
80441dd9a6bSDavid Young
80541dd9a6bSDavid YoungThis translates to:
80641dd9a6bSDavid Young
80741dd9a6bSDavid Young- Locate "foo" at least 10 bytes deep inside UDP payload.
80841dd9a6bSDavid Young- Locate "bar" after "foo" plus 20 bytes.
80941dd9a6bSDavid Young- Locate "baz" after "bar" minus 29 bytes.
81041dd9a6bSDavid Young
81141dd9a6bSDavid YoungSuch a packet may be represented as follows (not to scale)::
81241dd9a6bSDavid Young
81341dd9a6bSDavid Young 0                     >= 10 B           == 20 B
81441dd9a6bSDavid Young |                  |<--------->|     |<--------->|
81541dd9a6bSDavid Young |                  |           |     |           |
81641dd9a6bSDavid Young |-----|------|-----|-----|-----|-----|-----------|-----|------|
81741dd9a6bSDavid Young | ETH | IPv4 | UDP | ... | baz | foo | ......... | bar | .... |
81841dd9a6bSDavid Young |-----|------|-----|-----|-----|-----|-----------|-----|------|
81941dd9a6bSDavid Young                          |                             |
82041dd9a6bSDavid Young                          |<--------------------------->|
82141dd9a6bSDavid Young                                      == 29 B
82241dd9a6bSDavid Young
82341dd9a6bSDavid YoungNote that matching subsequent pattern items would resume after "baz", not
82441dd9a6bSDavid Young"bar" since matching is always performed after the previous item of the
82541dd9a6bSDavid Youngstack.
82641dd9a6bSDavid Young
82741dd9a6bSDavid YoungItem: ``ETH``
82841dd9a6bSDavid Young^^^^^^^^^^^^^
82941dd9a6bSDavid Young
83041dd9a6bSDavid YoungMatches an Ethernet header.
83141dd9a6bSDavid Young
83241dd9a6bSDavid YoungThe ``type`` field either stands for "EtherType" or "TPID" when followed by
83341dd9a6bSDavid Youngso-called layer 2.5 pattern items such as ``RTE_FLOW_ITEM_TYPE_VLAN``. In
83441dd9a6bSDavid Youngthe latter case, ``type`` refers to that of the outer header, with the inner
83541dd9a6bSDavid YoungEtherType/TPID provided by the subsequent pattern item. This is the same
83641dd9a6bSDavid Youngorder as on the wire.
83741dd9a6bSDavid YoungIf the ``type`` field contains a TPID value, then only tagged packets with the
83841dd9a6bSDavid Youngspecified TPID will match the pattern.
83941dd9a6bSDavid YoungThe field ``has_vlan`` can be used to match any type of tagged packets,
84041dd9a6bSDavid Younginstead of using the ``type`` field.
84141dd9a6bSDavid YoungIf the ``type`` and ``has_vlan`` fields are not specified, then both tagged
84241dd9a6bSDavid Youngand untagged packets will match the pattern.
84341dd9a6bSDavid Young
84441dd9a6bSDavid Young- ``hdr``:  header definition (``rte_ether.h``).
84541dd9a6bSDavid Young- ``has_vlan``: packet header contains at least one VLAN.
84641dd9a6bSDavid Young- Default ``mask`` matches destination and source addresses only.
84741dd9a6bSDavid Young
84841dd9a6bSDavid YoungItem: ``VLAN``
84941dd9a6bSDavid Young^^^^^^^^^^^^^^
85041dd9a6bSDavid Young
85141dd9a6bSDavid YoungMatches an 802.1Q/ad VLAN tag.
85241dd9a6bSDavid Young
85341dd9a6bSDavid YoungThe corresponding standard outer EtherType (TPID) values are
85441dd9a6bSDavid Young``RTE_ETHER_TYPE_VLAN`` or ``RTE_ETHER_TYPE_QINQ``. It can be overridden by the
85541dd9a6bSDavid Youngpreceding pattern item.
85641dd9a6bSDavid YoungIf a ``VLAN`` item is present in the pattern, then only tagged packets will
85741dd9a6bSDavid Youngmatch the pattern.
85841dd9a6bSDavid YoungThe field ``has_more_vlan`` can be used to match any type of tagged packets,
85941dd9a6bSDavid Younginstead of using the ``inner_type field``.
86041dd9a6bSDavid YoungIf the ``inner_type`` and ``has_more_vlan`` fields are not specified,
86141dd9a6bSDavid Youngthen any tagged packets will match the pattern.
86241dd9a6bSDavid Young
86341dd9a6bSDavid Young- ``hdr``:  header definition (``rte_ether.h``).
86441dd9a6bSDavid Young- ``has_more_vlan``: packet header contains at least one more VLAN, after this VLAN.
86541dd9a6bSDavid Young- Default ``mask`` matches the VID part of TCI only (lower 12 bits).
86641dd9a6bSDavid Young
86741dd9a6bSDavid YoungItem: ``IPV4``
86841dd9a6bSDavid Young^^^^^^^^^^^^^^
86941dd9a6bSDavid Young
87041dd9a6bSDavid YoungMatches an IPv4 header.
87141dd9a6bSDavid Young
87241dd9a6bSDavid YoungNote: IPv4 options are handled by dedicated pattern items.
87341dd9a6bSDavid Young
87441dd9a6bSDavid Young- ``hdr``: IPv4 header definition (``rte_ip.h``).
87541dd9a6bSDavid Young- Default ``mask`` matches source and destination addresses only.
87641dd9a6bSDavid Young
87741dd9a6bSDavid YoungItem: ``IPV6``
87841dd9a6bSDavid Young^^^^^^^^^^^^^^
87941dd9a6bSDavid Young
88041dd9a6bSDavid YoungMatches an IPv6 header.
88141dd9a6bSDavid Young
88241dd9a6bSDavid YoungDedicated flags indicate if header contains specific extension headers.
88341dd9a6bSDavid YoungTo match on packets containing a specific extension header, an application
88441dd9a6bSDavid Youngshould match on the dedicated flag set to 1.
88541dd9a6bSDavid YoungTo match on packets not containing a specific extension header, an application
88641dd9a6bSDavid Youngshould match on the dedicated flag clear to 0.
88741dd9a6bSDavid YoungIn case application doesn't care about the existence of a specific extension
88841dd9a6bSDavid Youngheader, it should not specify the dedicated flag for matching.
88941dd9a6bSDavid Young
89041dd9a6bSDavid Young- ``hdr``: IPv6 header definition (``rte_ip.h``).
89141dd9a6bSDavid Young- ``has_hop_ext``: header contains Hop-by-Hop Options extension header.
89241dd9a6bSDavid Young- ``has_route_ext``: header contains Routing extension header.
89341dd9a6bSDavid Young- ``has_frag_ext``: header contains Fragment extension header.
89441dd9a6bSDavid Young- ``has_auth_ext``: header contains Authentication extension header.
89541dd9a6bSDavid Young- ``has_esp_ext``: header contains Encapsulation Security Payload extension header.
89641dd9a6bSDavid Young- ``has_dest_ext``: header contains Destination Options extension header.
89741dd9a6bSDavid Young- ``has_mobil_ext``: header contains Mobility extension header.
89841dd9a6bSDavid Young- ``has_hip_ext``: header contains Host Identity Protocol extension header.
89941dd9a6bSDavid Young- ``has_shim6_ext``: header contains Shim6 Protocol extension header.
90041dd9a6bSDavid Young- Default ``mask`` matches ``hdr`` source and destination addresses only.
90141dd9a6bSDavid Young
90241dd9a6bSDavid YoungItem: ``ICMP``
90341dd9a6bSDavid Young^^^^^^^^^^^^^^
90441dd9a6bSDavid Young
90541dd9a6bSDavid YoungMatches an ICMP header.
90641dd9a6bSDavid Young
90741dd9a6bSDavid Young- ``hdr``: ICMP header definition (``rte_icmp.h``).
90841dd9a6bSDavid Young- Default ``mask`` matches ICMP type and code only.
90941dd9a6bSDavid Young
91041dd9a6bSDavid YoungItem: ``UDP``
91141dd9a6bSDavid Young^^^^^^^^^^^^^
91241dd9a6bSDavid Young
91341dd9a6bSDavid YoungMatches a UDP header.
91441dd9a6bSDavid Young
91541dd9a6bSDavid Young- ``hdr``: UDP header definition (``rte_udp.h``).
91641dd9a6bSDavid Young- Default ``mask`` matches source and destination ports only.
91741dd9a6bSDavid Young
91841dd9a6bSDavid YoungItem: ``TCP``
91941dd9a6bSDavid Young^^^^^^^^^^^^^
92041dd9a6bSDavid Young
92141dd9a6bSDavid YoungMatches a TCP header.
92241dd9a6bSDavid Young
92341dd9a6bSDavid Young- ``hdr``: TCP header definition (``rte_tcp.h``).
92441dd9a6bSDavid Young- Default ``mask`` matches source and destination ports only.
92541dd9a6bSDavid Young
92641dd9a6bSDavid YoungItem: ``SCTP``
92741dd9a6bSDavid Young^^^^^^^^^^^^^^
92841dd9a6bSDavid Young
92941dd9a6bSDavid YoungMatches a SCTP header.
93041dd9a6bSDavid Young
93141dd9a6bSDavid Young- ``hdr``: SCTP header definition (``rte_sctp.h``).
93241dd9a6bSDavid Young- Default ``mask`` matches source and destination ports only.
93341dd9a6bSDavid Young
93441dd9a6bSDavid YoungItem: ``VXLAN``
93541dd9a6bSDavid Young^^^^^^^^^^^^^^^
93641dd9a6bSDavid Young
93741dd9a6bSDavid YoungMatches a VXLAN header (RFC 7348).
93841dd9a6bSDavid Young
93941dd9a6bSDavid Young- ``hdr``:  header definition (``rte_vxlan.h``).
94041dd9a6bSDavid Young- Default ``mask`` matches VNI only.
94141dd9a6bSDavid Young
94241dd9a6bSDavid YoungItem: ``E_TAG``
94341dd9a6bSDavid Young^^^^^^^^^^^^^^^
94441dd9a6bSDavid Young
94541dd9a6bSDavid YoungMatches an IEEE 802.1BR E-Tag header.
94641dd9a6bSDavid Young
94741dd9a6bSDavid YoungThe corresponding standard outer EtherType (TPID) value is
94841dd9a6bSDavid Young``RTE_ETHER_TYPE_ETAG``. It can be overridden by the preceding pattern item.
94941dd9a6bSDavid Young
95041dd9a6bSDavid Young- ``epcp_edei_in_ecid_b``: E-Tag control information (E-TCI), E-PCP (3b),
95141dd9a6bSDavid Young  E-DEI (1b), ingress E-CID base (12b).
95241dd9a6bSDavid Young- ``rsvd_grp_ecid_b``: reserved (2b), GRP (2b), E-CID base (12b).
95341dd9a6bSDavid Young- ``in_ecid_e``: ingress E-CID ext.
95441dd9a6bSDavid Young- ``ecid_e``: E-CID ext.
95541dd9a6bSDavid Young- ``inner_type``: inner EtherType or TPID.
95641dd9a6bSDavid Young- Default ``mask`` simultaneously matches GRP and E-CID base.
95741dd9a6bSDavid Young
95841dd9a6bSDavid YoungItem: ``NVGRE``
95941dd9a6bSDavid Young^^^^^^^^^^^^^^^
96041dd9a6bSDavid Young
96141dd9a6bSDavid YoungMatches a NVGRE header (RFC 7637).
96241dd9a6bSDavid Young
96341dd9a6bSDavid Young- ``c_k_s_rsvd0_ver``: checksum (1b), undefined (1b), key bit (1b),
96441dd9a6bSDavid Young  sequence number (1b), reserved 0 (9b), version (3b). This field must have
96541dd9a6bSDavid Young  value 0x2000 according to RFC 7637.
96641dd9a6bSDavid Young- ``protocol``: protocol type (0x6558).
96741dd9a6bSDavid Young- ``tni``: virtual subnet ID.
96841dd9a6bSDavid Young- ``flow_id``: flow ID.
96941dd9a6bSDavid Young- Default ``mask`` matches TNI only.
97041dd9a6bSDavid Young
97141dd9a6bSDavid YoungItem: ``MPLS``
97241dd9a6bSDavid Young^^^^^^^^^^^^^^
97341dd9a6bSDavid Young
97441dd9a6bSDavid YoungMatches a MPLS header.
97541dd9a6bSDavid Young
97641dd9a6bSDavid Young- ``label_tc_s_ttl``: label, TC, Bottom of Stack and TTL.
97741dd9a6bSDavid Young- Default ``mask`` matches label only.
97841dd9a6bSDavid Young
97941dd9a6bSDavid YoungItem: ``GRE``
98041dd9a6bSDavid Young^^^^^^^^^^^^^
98141dd9a6bSDavid Young
98241dd9a6bSDavid YoungMatches a GRE header.
98341dd9a6bSDavid Young
98441dd9a6bSDavid Young- ``c_rsvd0_ver``: checksum, reserved 0 and version.
98541dd9a6bSDavid Young- ``protocol``: protocol type.
98641dd9a6bSDavid Young- Default ``mask`` matches protocol only.
98741dd9a6bSDavid Young
98841dd9a6bSDavid YoungItem: ``GRE_KEY``
98941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
99041dd9a6bSDavid YoungThis action is deprecated. Consider `Item: GRE_OPTION`.
99141dd9a6bSDavid Young
99241dd9a6bSDavid YoungMatches a GRE key field.
99341dd9a6bSDavid YoungThis should be preceded by item ``GRE``.
99441dd9a6bSDavid Young
99541dd9a6bSDavid Young- Value to be matched is a big-endian 32 bit integer.
99641dd9a6bSDavid Young- When this item present it implicitly match K bit in default mask as "1"
99741dd9a6bSDavid Young
99841dd9a6bSDavid YoungItem: ``GRE_OPTION``
99941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^
100041dd9a6bSDavid Young
100141dd9a6bSDavid YoungMatches a GRE optional fields (checksum/key/sequence).
100241dd9a6bSDavid YoungThis should be preceded by item ``GRE``.
100341dd9a6bSDavid Young
100441dd9a6bSDavid Young- ``checksum``: checksum.
100541dd9a6bSDavid Young- ``key``: key.
100641dd9a6bSDavid Young- ``sequence``: sequence.
100741dd9a6bSDavid Young- The items in GRE_OPTION do not change bit flags(c_bit/k_bit/s_bit) in GRE
100841dd9a6bSDavid Young  item. The bit flags need be set with GRE item by application. When the items
100941dd9a6bSDavid Young  present, the corresponding bits in GRE spec and mask should be set "1" by
101041dd9a6bSDavid Young  application, it means to match specified value of the fields. When the items
101141dd9a6bSDavid Young  no present, but the corresponding bits in GRE spec and mask is "1", it means
101241dd9a6bSDavid Young  to match any value of the fields.
101341dd9a6bSDavid Young
101441dd9a6bSDavid YoungItem: ``FUZZY``
101541dd9a6bSDavid Young^^^^^^^^^^^^^^^
101641dd9a6bSDavid Young
101741dd9a6bSDavid YoungFuzzy pattern match, expect faster than default.
101841dd9a6bSDavid Young
101941dd9a6bSDavid YoungThis is for device that support fuzzy match option. Usually a fuzzy match is
102041dd9a6bSDavid Youngfast but the cost is accuracy. i.e. Signature Match only match pattern's hash
102141dd9a6bSDavid Youngvalue, but it is possible two different patterns have the same hash value.
102241dd9a6bSDavid Young
102341dd9a6bSDavid YoungMatching accuracy level can be configured by threshold. Driver can divide the
102441dd9a6bSDavid Youngrange of threshold and map to different accuracy levels that device support.
102541dd9a6bSDavid Young
102641dd9a6bSDavid YoungThreshold 0 means perfect match (no fuzziness), while threshold 0xffffffff
102741dd9a6bSDavid Youngmeans fuzziest match.
102841dd9a6bSDavid Young
102941dd9a6bSDavid Young.. _table_rte_flow_item_fuzzy:
103041dd9a6bSDavid Young
103141dd9a6bSDavid Young.. table:: FUZZY
103241dd9a6bSDavid Young
103341dd9a6bSDavid Young   +----------+---------------+--------------------------------------------------+
103441dd9a6bSDavid Young   | Field    |   Subfield    | Value                                            |
103541dd9a6bSDavid Young   +==========+===============+==================================================+
103641dd9a6bSDavid Young   | ``spec`` | ``threshold`` | 0 as perfect match, 0xffffffff as fuzziest match |
103741dd9a6bSDavid Young   +----------+---------------+--------------------------------------------------+
103841dd9a6bSDavid Young   | ``last`` | ``threshold`` | upper range value                                |
103941dd9a6bSDavid Young   +----------+---------------+--------------------------------------------------+
104041dd9a6bSDavid Young   | ``mask`` | ``threshold`` | bit-mask apply to "spec" and "last"              |
104141dd9a6bSDavid Young   +----------+---------------+--------------------------------------------------+
104241dd9a6bSDavid Young
104341dd9a6bSDavid YoungUsage example, fuzzy match a TCPv4 packets:
104441dd9a6bSDavid Young
104541dd9a6bSDavid Young.. _table_rte_flow_item_fuzzy_example:
104641dd9a6bSDavid Young
104741dd9a6bSDavid Young.. table:: Fuzzy matching
104841dd9a6bSDavid Young
104941dd9a6bSDavid Young   +-------+----------+
105041dd9a6bSDavid Young   | Index | Item     |
105141dd9a6bSDavid Young   +=======+==========+
105241dd9a6bSDavid Young   | 0     | FUZZY    |
105341dd9a6bSDavid Young   +-------+----------+
105441dd9a6bSDavid Young   | 1     | Ethernet |
105541dd9a6bSDavid Young   +-------+----------+
105641dd9a6bSDavid Young   | 2     | IPv4     |
105741dd9a6bSDavid Young   +-------+----------+
105841dd9a6bSDavid Young   | 3     | TCP      |
105941dd9a6bSDavid Young   +-------+----------+
106041dd9a6bSDavid Young   | 4     | END      |
106141dd9a6bSDavid Young   +-------+----------+
106241dd9a6bSDavid Young
106341dd9a6bSDavid YoungItem: ``GTP``, ``GTPC``, ``GTPU``
106441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106541dd9a6bSDavid Young
106641dd9a6bSDavid YoungMatches a GTPv1 header.
106741dd9a6bSDavid Young
106841dd9a6bSDavid YoungNote: GTP, GTPC and GTPU use the same structure. GTPC and GTPU item
106941dd9a6bSDavid Youngare defined for a user-friendly API when creating GTP-C and GTP-U
107041dd9a6bSDavid Youngflow rules.
107141dd9a6bSDavid Young
107241dd9a6bSDavid Young- ``hdr``:  header definition (``rte_gtp.h``).
107341dd9a6bSDavid Young- Default ``mask`` matches teid only.
107441dd9a6bSDavid Young
107541dd9a6bSDavid YoungItem: ``ESP``
107641dd9a6bSDavid Young^^^^^^^^^^^^^
107741dd9a6bSDavid Young
107841dd9a6bSDavid YoungMatches an ESP header.
107941dd9a6bSDavid Young
108041dd9a6bSDavid Young- ``hdr``: ESP header definition (``rte_esp.h``).
108141dd9a6bSDavid Young- Default ``mask`` matches SPI only.
108241dd9a6bSDavid Young
108341dd9a6bSDavid YoungItem: ``GENEVE``
108441dd9a6bSDavid Young^^^^^^^^^^^^^^^^
108541dd9a6bSDavid Young
108641dd9a6bSDavid YoungMatches a GENEVE header.
108741dd9a6bSDavid Young
108841dd9a6bSDavid Young- ``ver_opt_len_o_c_rsvd0``: version (2b), length of the options fields (6b),
108941dd9a6bSDavid Young  OAM packet (1b), critical options present (1b), reserved 0 (6b).
109041dd9a6bSDavid Young- ``protocol``: protocol type.
109141dd9a6bSDavid Young- ``vni``: virtual network identifier.
109241dd9a6bSDavid Young- ``rsvd1``: reserved, normally 0x00.
109341dd9a6bSDavid Young- Default ``mask`` matches VNI only.
109441dd9a6bSDavid Young
109541dd9a6bSDavid YoungItem: ``VXLAN-GPE``
109641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^
109741dd9a6bSDavid Young
109841dd9a6bSDavid YoungMatches a VXLAN-GPE header (draft-ietf-nvo3-vxlan-gpe-05).
109941dd9a6bSDavid Young
110041dd9a6bSDavid Young- ``hdr``:  header definition (``rte_vxlan.h``).
110141dd9a6bSDavid Young- Default ``mask`` matches VNI only.
110241dd9a6bSDavid Young
110341dd9a6bSDavid YoungItem: ``ARP_ETH_IPV4``
110441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^
110541dd9a6bSDavid Young
110641dd9a6bSDavid YoungMatches an ARP header for Ethernet/IPv4.
110741dd9a6bSDavid Young
110841dd9a6bSDavid Young- ``hdr``:  header definition (``rte_arp.h``).
110941dd9a6bSDavid Young- Default ``mask`` matches SHA, SPA, THA and TPA.
111041dd9a6bSDavid Young
111141dd9a6bSDavid YoungItem: ``IPV6_EXT``
111241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^
111341dd9a6bSDavid Young
111441dd9a6bSDavid YoungMatches the presence of any IPv6 extension header.
111541dd9a6bSDavid Young
111641dd9a6bSDavid Young- ``next_hdr``: next header.
111741dd9a6bSDavid Young- Default ``mask`` matches ``next_hdr``.
111841dd9a6bSDavid Young
111941dd9a6bSDavid YoungNormally preceded by any of:
112041dd9a6bSDavid Young
112141dd9a6bSDavid Young- `Item: IPV6`_
112241dd9a6bSDavid Young- `Item: IPV6_EXT`_
112341dd9a6bSDavid Young
112441dd9a6bSDavid YoungItem: ``IPV6_FRAG_EXT``
112541dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
112641dd9a6bSDavid Young
112741dd9a6bSDavid YoungMatches the presence of IPv6 fragment extension header.
112841dd9a6bSDavid Young
112941dd9a6bSDavid Young- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
113041dd9a6bSDavid Young
113141dd9a6bSDavid YoungNormally preceded by any of:
113241dd9a6bSDavid Young
113341dd9a6bSDavid Young- `Item: IPV6`_
113441dd9a6bSDavid Young- `Item: IPV6_EXT`_
113541dd9a6bSDavid Young
113641dd9a6bSDavid YoungItem: ``IPV6_ROUTING_EXT``
113741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^
113841dd9a6bSDavid Young
113941dd9a6bSDavid YoungMatches IPv6 routing extension header.
114041dd9a6bSDavid Young
114141dd9a6bSDavid Young- ``next_hdr``: Next layer header type.
114241dd9a6bSDavid Young- ``type``: IPv6 routing extension header type.
114341dd9a6bSDavid Young- ``segments_left``: How many IPv6 destination addresses carries on.
114441dd9a6bSDavid Young
114541dd9a6bSDavid YoungItem: ``ICMP6``
114641dd9a6bSDavid Young^^^^^^^^^^^^^^^
114741dd9a6bSDavid Young
114841dd9a6bSDavid YoungMatches any ICMPv6 header.
114941dd9a6bSDavid Young
115041dd9a6bSDavid Young- ``type``: ICMPv6 type.
115141dd9a6bSDavid Young- ``code``: ICMPv6 code.
115241dd9a6bSDavid Young- ``checksum``: ICMPv6 checksum.
115341dd9a6bSDavid Young- Default ``mask`` matches ``type`` and ``code``.
115441dd9a6bSDavid Young
115541dd9a6bSDavid YoungItem: ``ICMP6_ECHO_REQUEST``
115641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115741dd9a6bSDavid Young
115841dd9a6bSDavid YoungMatches an ICMPv6 echo request.
115941dd9a6bSDavid Young
116041dd9a6bSDavid Young- ``hdr``: ICMP6 echo header definition (``rte_icmp.h``).
116141dd9a6bSDavid Young
116241dd9a6bSDavid YoungItem: ``ICMP6_ECHO_REPLY``
116341dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^
116441dd9a6bSDavid Young
116541dd9a6bSDavid YoungMatches an ICMPv6 echo reply.
116641dd9a6bSDavid Young
116741dd9a6bSDavid Young- ``hdr``: ICMP6 echo header definition (``rte_icmp.h``).
116841dd9a6bSDavid Young
116941dd9a6bSDavid YoungItem: ``ICMP6_ND_NS``
117041dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^
117141dd9a6bSDavid Young
117241dd9a6bSDavid YoungMatches an ICMPv6 neighbor discovery solicitation.
117341dd9a6bSDavid Young
117441dd9a6bSDavid Young- ``type``: ICMPv6 type, normally 135.
117541dd9a6bSDavid Young- ``code``: ICMPv6 code, normally 0.
117641dd9a6bSDavid Young- ``checksum``: ICMPv6 checksum.
117741dd9a6bSDavid Young- ``reserved``: reserved, normally 0.
117841dd9a6bSDavid Young- ``target_addr``: target address.
117941dd9a6bSDavid Young- Default ``mask`` matches target address only.
118041dd9a6bSDavid Young
118141dd9a6bSDavid YoungItem: ``ICMP6_ND_NA``
118241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^
118341dd9a6bSDavid Young
118441dd9a6bSDavid YoungMatches an ICMPv6 neighbor discovery advertisement.
118541dd9a6bSDavid Young
118641dd9a6bSDavid Young- ``type``: ICMPv6 type, normally 136.
118741dd9a6bSDavid Young- ``code``: ICMPv6 code, normally 0.
118841dd9a6bSDavid Young- ``checksum``: ICMPv6 checksum.
118941dd9a6bSDavid Young- ``rso_reserved``: route flag (1b), solicited flag (1b), override flag
119041dd9a6bSDavid Young  (1b), reserved (29b).
119141dd9a6bSDavid Young- ``target_addr``: target address.
119241dd9a6bSDavid Young- Default ``mask`` matches target address only.
119341dd9a6bSDavid Young
119441dd9a6bSDavid YoungItem: ``ICMP6_ND_OPT``
119541dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^
119641dd9a6bSDavid Young
119741dd9a6bSDavid YoungMatches the presence of any ICMPv6 neighbor discovery option.
119841dd9a6bSDavid Young
119941dd9a6bSDavid Young- ``type``: ND option type.
120041dd9a6bSDavid Young- ``length``: ND option length.
120141dd9a6bSDavid Young- Default ``mask`` matches type only.
120241dd9a6bSDavid Young
120341dd9a6bSDavid YoungNormally preceded by any of:
120441dd9a6bSDavid Young
120541dd9a6bSDavid Young- `Item: ICMP6_ND_NA`_
120641dd9a6bSDavid Young- `Item: ICMP6_ND_NS`_
120741dd9a6bSDavid Young- `Item: ICMP6_ND_OPT`_
120841dd9a6bSDavid Young
120941dd9a6bSDavid YoungItem: ``ICMP6_ND_OPT_SLA_ETH``
121041dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
121141dd9a6bSDavid Young
121241dd9a6bSDavid YoungMatches an ICMPv6 neighbor discovery source Ethernet link-layer address
121341dd9a6bSDavid Youngoption.
121441dd9a6bSDavid Young
121541dd9a6bSDavid Young- ``type``: ND option type, normally 1.
121641dd9a6bSDavid Young- ``length``: ND option length, normally 1.
121741dd9a6bSDavid Young- ``sla``: source Ethernet LLA.
121841dd9a6bSDavid Young- Default ``mask`` matches source link-layer address only.
121941dd9a6bSDavid Young
122041dd9a6bSDavid YoungNormally preceded by any of:
122141dd9a6bSDavid Young
122241dd9a6bSDavid Young- `Item: ICMP6_ND_NA`_
122341dd9a6bSDavid Young- `Item: ICMP6_ND_OPT`_
122441dd9a6bSDavid Young
122541dd9a6bSDavid YoungItem: ``ICMP6_ND_OPT_TLA_ETH``
122641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122741dd9a6bSDavid Young
122841dd9a6bSDavid YoungMatches an ICMPv6 neighbor discovery target Ethernet link-layer address
122941dd9a6bSDavid Youngoption.
123041dd9a6bSDavid Young
123141dd9a6bSDavid Young- ``type``: ND option type, normally 2.
123241dd9a6bSDavid Young- ``length``: ND option length, normally 1.
123341dd9a6bSDavid Young- ``tla``: target Ethernet LLA.
123441dd9a6bSDavid Young- Default ``mask`` matches target link-layer address only.
123541dd9a6bSDavid Young
123641dd9a6bSDavid YoungNormally preceded by any of:
123741dd9a6bSDavid Young
123841dd9a6bSDavid Young- `Item: ICMP6_ND_NS`_
123941dd9a6bSDavid Young- `Item: ICMP6_ND_OPT`_
124041dd9a6bSDavid Young
124141dd9a6bSDavid YoungItem: ``META``
124241dd9a6bSDavid Young^^^^^^^^^^^^^^
124341dd9a6bSDavid Young
124441dd9a6bSDavid YoungMatches an application specific 32 bit metadata item.
124541dd9a6bSDavid Young
124641dd9a6bSDavid Young- Default ``mask`` matches the specified metadata value.
124741dd9a6bSDavid Young
124841dd9a6bSDavid YoungItem: ``GTP_PSC``
124941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
125041dd9a6bSDavid Young
125141dd9a6bSDavid YoungMatches a GTP PDU extension header with type 0x85.
125241dd9a6bSDavid Young
125341dd9a6bSDavid Young- ``hdr``:  header definition (``rte_gtp.h``).
125441dd9a6bSDavid Young- Default ``mask`` matches QFI only.
125541dd9a6bSDavid Young
125641dd9a6bSDavid YoungItem: ``PPPOES``, ``PPPOED``
125741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125841dd9a6bSDavid Young
125941dd9a6bSDavid YoungMatches a PPPoE header.
126041dd9a6bSDavid Young
126141dd9a6bSDavid Young- ``version_type``: version (4b), type (4b).
126241dd9a6bSDavid Young- ``code``: message type.
126341dd9a6bSDavid Young- ``session_id``: session identifier.
126441dd9a6bSDavid Young- ``length``: payload length.
126541dd9a6bSDavid Young
126641dd9a6bSDavid YoungItem: ``PPPOE_PROTO_ID``
126741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^
126841dd9a6bSDavid Young
126941dd9a6bSDavid YoungMatches a PPPoE session protocol identifier.
127041dd9a6bSDavid Young
127141dd9a6bSDavid Young- ``proto_id``: PPP protocol identifier.
127241dd9a6bSDavid Young- Default ``mask`` matches proto_id only.
127341dd9a6bSDavid Young
127441dd9a6bSDavid YoungItem: ``NSH``
127541dd9a6bSDavid Young^^^^^^^^^^^^^
127641dd9a6bSDavid Young
127741dd9a6bSDavid YoungMatches a network service header (RFC 8300).
127841dd9a6bSDavid Young
127941dd9a6bSDavid Young- ``version``: normally 0x0 (2 bits).
128041dd9a6bSDavid Young- ``oam_pkt``: indicate oam packet (1 bit).
128141dd9a6bSDavid Young- ``reserved``: reserved bit (1 bit).
128241dd9a6bSDavid Young- ``ttl``: maximum SFF hopes (6 bits).
128341dd9a6bSDavid Young- ``length``: total length in 4 bytes words (6 bits).
128441dd9a6bSDavid Young- ``reserved1``: reserved1 bits (4 bits).
128541dd9a6bSDavid Young- ``mdtype``: indicates format of NSH header (4 bits).
128641dd9a6bSDavid Young- ``next_proto``: indicates protocol type of encap data (8 bits).
128741dd9a6bSDavid Young- ``spi``: service path identifier (3 bytes).
128841dd9a6bSDavid Young- ``sindex``: service index (1 byte).
128941dd9a6bSDavid Young- Default ``mask`` matches mdtype, next_proto, spi, sindex.
129041dd9a6bSDavid Young
129141dd9a6bSDavid Young
129241dd9a6bSDavid YoungItem: ``IGMP``
129341dd9a6bSDavid Young^^^^^^^^^^^^^^
129441dd9a6bSDavid Young
129541dd9a6bSDavid YoungMatches a Internet Group Management Protocol (RFC 2236).
129641dd9a6bSDavid Young
129741dd9a6bSDavid Young- ``type``: IGMP message type (Query/Report).
129841dd9a6bSDavid Young- ``max_resp_time``: max time allowed before sending report.
129941dd9a6bSDavid Young- ``checksum``: checksum, 1s complement of whole IGMP message.
130041dd9a6bSDavid Young- ``group_addr``: group address, for Query value will be 0.
130141dd9a6bSDavid Young- Default ``mask`` matches group_addr.
130241dd9a6bSDavid Young
130341dd9a6bSDavid Young
130441dd9a6bSDavid YoungItem: ``AH``
130541dd9a6bSDavid Young^^^^^^^^^^^^
130641dd9a6bSDavid Young
130741dd9a6bSDavid YoungMatches a IP Authentication Header (RFC 4302).
130841dd9a6bSDavid Young
130941dd9a6bSDavid Young- ``next_hdr``: next payload after AH.
131041dd9a6bSDavid Young- ``payload_len``: total length of AH in 4B words.
131141dd9a6bSDavid Young- ``reserved``: reserved bits.
131241dd9a6bSDavid Young- ``spi``: security parameters index.
131341dd9a6bSDavid Young- ``seq_num``: counter value increased by 1 on each packet sent.
131441dd9a6bSDavid Young- Default ``mask`` matches spi.
131541dd9a6bSDavid Young
131641dd9a6bSDavid YoungItem: ``HIGIG2``
131741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
131841dd9a6bSDavid Young
131941dd9a6bSDavid YoungMatches a HIGIG2 header field. It is layer 2.5 protocol and used in
132041dd9a6bSDavid YoungBroadcom switches.
132141dd9a6bSDavid Young
132241dd9a6bSDavid Young- Default ``mask`` matches classification and vlan.
132341dd9a6bSDavid Young
132441dd9a6bSDavid YoungItem: ``L2TPV3OIP``
132541dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^
132641dd9a6bSDavid Young
132741dd9a6bSDavid YoungMatches a L2TPv3 over IP header.
132841dd9a6bSDavid Young
132941dd9a6bSDavid Young- ``session_id``: L2TPv3 over IP session identifier.
133041dd9a6bSDavid Young- Default ``mask`` matches session_id only.
133141dd9a6bSDavid Young
133241dd9a6bSDavid YoungItem: ``PFCP``
133341dd9a6bSDavid Young^^^^^^^^^^^^^^
133441dd9a6bSDavid Young
133541dd9a6bSDavid YoungMatches a PFCP Header.
133641dd9a6bSDavid Young
133741dd9a6bSDavid Young- ``s_field``: S field.
133841dd9a6bSDavid Young- ``msg_type``: message type.
133941dd9a6bSDavid Young- ``msg_len``: message length.
134041dd9a6bSDavid Young- ``seid``: session endpoint identifier.
134141dd9a6bSDavid Young- Default ``mask`` matches s_field and seid.
134241dd9a6bSDavid Young
134341dd9a6bSDavid YoungItem: ``ECPRI``
134441dd9a6bSDavid Young^^^^^^^^^^^^^^^
134541dd9a6bSDavid Young
134641dd9a6bSDavid YoungMatches a eCPRI header.
134741dd9a6bSDavid Young
134841dd9a6bSDavid Young- ``hdr``: eCPRI header definition (``rte_ecpri.h``).
134941dd9a6bSDavid Young- Default ``mask`` matches nothing, for all eCPRI messages.
135041dd9a6bSDavid Young
135141dd9a6bSDavid YoungItem: ``PACKET_INTEGRITY_CHECKS``
135241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
135341dd9a6bSDavid Young
135441dd9a6bSDavid YoungMatches packet integrity.
135541dd9a6bSDavid YoungFor some devices application needs to enable integration checks in HW
135641dd9a6bSDavid Youngbefore using this item.
135741dd9a6bSDavid Young
135841dd9a6bSDavid Young- ``level``: the encapsulation level that should be checked:
135941dd9a6bSDavid Young   - ``level == 0`` means the default PMD mode (can be inner most / outermost).
136041dd9a6bSDavid Young   - ``level == 1`` means outermost header.
136141dd9a6bSDavid Young   - ``level > 1``  means inner header. See also RSS level.
136241dd9a6bSDavid Young- ``packet_ok``: All HW packet integrity checks have passed based on the
136341dd9a6bSDavid Young  topmost network layer. For example, for ICMP packet the topmost network
136441dd9a6bSDavid Young  layer is L3 and for TCP or UDP packet the topmost network layer is L4.
136541dd9a6bSDavid Young- ``l2_ok``: all layer 2 HW integrity checks passed.
136641dd9a6bSDavid Young- ``l3_ok``: all layer 3 HW integrity checks passed.
136741dd9a6bSDavid Young- ``l4_ok``: all layer 4 HW integrity checks passed.
136841dd9a6bSDavid Young- ``l2_crc_ok``: layer 2 CRC check passed.
136941dd9a6bSDavid Young- ``ipv4_csum_ok``: IPv4 checksum check passed.
137041dd9a6bSDavid Young- ``l4_csum_ok``: layer 4 checksum check passed.
137141dd9a6bSDavid Young- ``l3_len_ok``: the layer 3 length is smaller than the frame length.
137241dd9a6bSDavid Young
137341dd9a6bSDavid YoungItem: ``CONNTRACK``
137441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^
137541dd9a6bSDavid Young
137641dd9a6bSDavid YoungMatches a conntrack state after conntrack action.
137741dd9a6bSDavid Young
137841dd9a6bSDavid Young- ``flags``: conntrack packet state flags.
137941dd9a6bSDavid Young- Default ``mask`` matches all state bits.
138041dd9a6bSDavid Young
138141dd9a6bSDavid YoungItem: ``PORT_REPRESENTOR``
138241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^
138341dd9a6bSDavid Young
138441dd9a6bSDavid YoungMatches traffic entering the embedded switch from the given ethdev.
138541dd9a6bSDavid Young
138641dd9a6bSDavid YoungTerm **ethdev** and the concept of **port representor** are synonymous.
138741dd9a6bSDavid YoungThe **represented port** is an *entity* plugged to the embedded switch
138841dd9a6bSDavid Youngat the opposite end of the "wire" leading to the ethdev.
138941dd9a6bSDavid Young
139041dd9a6bSDavid Young::
139141dd9a6bSDavid Young
139241dd9a6bSDavid Young    .--------------------.
139341dd9a6bSDavid Young    |  PORT_REPRESENTOR  |  Ethdev (Application Port Referred to by its ID)
139441dd9a6bSDavid Young    '--------------------'
139541dd9a6bSDavid Young              ||
139641dd9a6bSDavid Young              \/
139741dd9a6bSDavid Young      .----------------.
139841dd9a6bSDavid Young      |  Logical Port  |
139941dd9a6bSDavid Young      '----------------'
140041dd9a6bSDavid Young              ||
140141dd9a6bSDavid Young              ||
140241dd9a6bSDavid Young              ||
140341dd9a6bSDavid Young              \/
140441dd9a6bSDavid Young         .----------.
140541dd9a6bSDavid Young         |  Switch  |
140641dd9a6bSDavid Young         '----------'
140741dd9a6bSDavid Young              :
140841dd9a6bSDavid Young               :
140941dd9a6bSDavid Young              :
141041dd9a6bSDavid Young               :
141141dd9a6bSDavid Young      .----------------.
141241dd9a6bSDavid Young      |  Logical Port  |
141341dd9a6bSDavid Young      '----------------'
141441dd9a6bSDavid Young              :
141541dd9a6bSDavid Young               :
141641dd9a6bSDavid Young    .--------------------.
141741dd9a6bSDavid Young    |  REPRESENTED_PORT  |  Net / Guest / Another Ethdev (Same Application)
141841dd9a6bSDavid Young    '--------------------'
141941dd9a6bSDavid Young
142041dd9a6bSDavid Young
142141dd9a6bSDavid Young- Incompatible with `Attribute: Traffic direction`_.
142241dd9a6bSDavid Young- Requires `Attribute: Transfer`_.
142341dd9a6bSDavid Young
142441dd9a6bSDavid Young.. _table_rte_flow_item_ethdev:
142541dd9a6bSDavid Young
142641dd9a6bSDavid Young.. table:: ``struct rte_flow_item_ethdev``
142741dd9a6bSDavid Young
142841dd9a6bSDavid Young   +----------+-------------+---------------------------+
142941dd9a6bSDavid Young   | Field    | Subfield    | Value                     |
143041dd9a6bSDavid Young   +==========+=============+===========================+
143141dd9a6bSDavid Young   | ``spec`` | ``port_id`` | ethdev port ID            |
143241dd9a6bSDavid Young   +----------+-------------+---------------------------+
143341dd9a6bSDavid Young   | ``last`` | ``port_id`` | upper range value         |
143441dd9a6bSDavid Young   +----------+-------------+---------------------------+
143541dd9a6bSDavid Young   | ``mask`` | ``port_id`` | zeroed for wildcard match |
143641dd9a6bSDavid Young   +----------+-------------+---------------------------+
143741dd9a6bSDavid Young
143841dd9a6bSDavid Young- Default ``mask`` provides exact match behaviour.
143941dd9a6bSDavid Young
144041dd9a6bSDavid YoungSee also `Action: PORT_REPRESENTOR`_.
144141dd9a6bSDavid Young
144241dd9a6bSDavid YoungItem: ``REPRESENTED_PORT``
144341dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^
144441dd9a6bSDavid Young
144541dd9a6bSDavid YoungMatches traffic entering the embedded switch from
144641dd9a6bSDavid Youngthe entity represented by the given ethdev.
144741dd9a6bSDavid Young
144841dd9a6bSDavid YoungTerm **ethdev** and the concept of **port representor** are synonymous.
144941dd9a6bSDavid YoungThe **represented port** is an *entity* plugged to the embedded switch
145041dd9a6bSDavid Youngat the opposite end of the "wire" leading to the ethdev.
145141dd9a6bSDavid Young
145241dd9a6bSDavid Young::
145341dd9a6bSDavid Young
145441dd9a6bSDavid Young    .--------------------.
145541dd9a6bSDavid Young    |  PORT_REPRESENTOR  |  Ethdev (Application Port Referred to by its ID)
145641dd9a6bSDavid Young    '--------------------'
145741dd9a6bSDavid Young              :
145841dd9a6bSDavid Young               :
145941dd9a6bSDavid Young      .----------------.
146041dd9a6bSDavid Young      |  Logical Port  |
146141dd9a6bSDavid Young      '----------------'
146241dd9a6bSDavid Young              :
146341dd9a6bSDavid Young               :
146441dd9a6bSDavid Young              :
146541dd9a6bSDavid Young               :
146641dd9a6bSDavid Young         .----------.
146741dd9a6bSDavid Young         |  Switch  |
146841dd9a6bSDavid Young         '----------'
146941dd9a6bSDavid Young              /\
147041dd9a6bSDavid Young              ||
147141dd9a6bSDavid Young              ||
147241dd9a6bSDavid Young              ||
147341dd9a6bSDavid Young      .----------------.
147441dd9a6bSDavid Young      |  Logical Port  |
147541dd9a6bSDavid Young      '----------------'
147641dd9a6bSDavid Young              /\
147741dd9a6bSDavid Young              ||
147841dd9a6bSDavid Young    .--------------------.
147941dd9a6bSDavid Young    |  REPRESENTED_PORT  |  Net / Guest / Another Ethdev (Same Application)
148041dd9a6bSDavid Young    '--------------------'
148141dd9a6bSDavid Young
148241dd9a6bSDavid Young
148341dd9a6bSDavid Young- Incompatible with `Attribute: Traffic direction`_.
148441dd9a6bSDavid Young- Requires `Attribute: Transfer`_.
148541dd9a6bSDavid Young
148641dd9a6bSDavid YoungThis item is meant to use the same structure as `Item: PORT_REPRESENTOR`_.
148741dd9a6bSDavid Young
148841dd9a6bSDavid YoungSee also `Action: REPRESENTED_PORT`_.
148941dd9a6bSDavid Young
149041dd9a6bSDavid YoungItem: ``TX_QUEUE``
149141dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^
149241dd9a6bSDavid Young
149341dd9a6bSDavid YoungMatches on the Tx queue of sent packet.
149441dd9a6bSDavid Young
149541dd9a6bSDavid Young- ``tx_queue``: Tx queue.
149641dd9a6bSDavid Young
149741dd9a6bSDavid YoungItem: ``AGGR_AFFINITY``
149841dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
149941dd9a6bSDavid Young
150041dd9a6bSDavid YoungMatches on the aggregated port of the received packet.
150141dd9a6bSDavid YoungIn case of multiple aggregated ports, the affinity numbering starts from 1.
150241dd9a6bSDavid Young
150341dd9a6bSDavid Young- ``affinity``: Aggregated affinity.
150441dd9a6bSDavid Young
150541dd9a6bSDavid YoungItem: ``FLEX``
150641dd9a6bSDavid Young^^^^^^^^^^^^^^
150741dd9a6bSDavid Young
150841dd9a6bSDavid YoungMatches with the custom network protocol header that was created
150941dd9a6bSDavid Youngusing rte_flow_flex_item_create() API. The application describes
151041dd9a6bSDavid Youngthe desired header structure, defines the header fields attributes
151141dd9a6bSDavid Youngand header relations with preceding and following protocols and
151241dd9a6bSDavid Youngconfigures the ethernet devices accordingly via
151341dd9a6bSDavid Youngrte_flow_flex_item_create() routine.
151441dd9a6bSDavid Young
151541dd9a6bSDavid Young- ``handle``: the flex item handle returned by the PMD on successful
151641dd9a6bSDavid Young  rte_flow_flex_item_create() call, mask for this field is ignored.
151741dd9a6bSDavid Young- ``length``: match pattern length in bytes. If the length does not cover
151841dd9a6bSDavid Young  all fields defined in item configuration, the pattern spec and mask are
151941dd9a6bSDavid Young  considered by the driver as padded with trailing zeroes till the full
152041dd9a6bSDavid Young  configured item pattern length.
152141dd9a6bSDavid Young- ``pattern``: pattern to match. The pattern is concatenation of bit fields
152241dd9a6bSDavid Young  configured at item creation. At configuration the fields are presented
152341dd9a6bSDavid Young  by sample_data array. The order of the bitfields is defined by the order
152441dd9a6bSDavid Young  of sample_data elements. The width of each bitfield is defined by the width
152541dd9a6bSDavid Young  specified in the corresponding sample_data element as well. If pattern
152641dd9a6bSDavid Young  length is smaller than configured fields overall length it is considered
152741dd9a6bSDavid Young  as padded with trailing zeroes up to full configured length, both for
152841dd9a6bSDavid Young  value and mask.
152941dd9a6bSDavid Young
153041dd9a6bSDavid YoungItem: ``L2TPV2``
153141dd9a6bSDavid Young^^^^^^^^^^^^^^^^
153241dd9a6bSDavid Young
153341dd9a6bSDavid YoungMatches a L2TPv2 header.
153441dd9a6bSDavid Young
153541dd9a6bSDavid Young- ``hdr``:  header definition (``rte_l2tpv2.h``).
153641dd9a6bSDavid Young- Default ``mask`` matches flags_version only.
153741dd9a6bSDavid Young
153841dd9a6bSDavid YoungItem: ``PPP``
153941dd9a6bSDavid Young^^^^^^^^^^^^^
154041dd9a6bSDavid Young
154141dd9a6bSDavid YoungMatches a PPP header.
154241dd9a6bSDavid Young
154341dd9a6bSDavid Young- ``addr``: PPP address.
154441dd9a6bSDavid Young- ``ctrl``: PPP control.
154541dd9a6bSDavid Young- ``proto_id``: PPP protocol identifier.
154641dd9a6bSDavid Young- Default ``mask`` matches addr, ctrl, proto_id.
154741dd9a6bSDavid Young
154841dd9a6bSDavid YoungItem: ``METER_COLOR``
154941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^
155041dd9a6bSDavid Young
155141dd9a6bSDavid YoungMatches Color Marker set by a Meter.
155241dd9a6bSDavid Young
155341dd9a6bSDavid Young- ``color``: Metering color marker.
155441dd9a6bSDavid Young
155541dd9a6bSDavid YoungItem: ``QUOTA``
155641dd9a6bSDavid Young^^^^^^^^^^^^^^^
155741dd9a6bSDavid Young
155841dd9a6bSDavid YoungMatches flow quota state set by quota action.
155941dd9a6bSDavid Young
156041dd9a6bSDavid Young- ``state``: Flow quota state
156141dd9a6bSDavid Young
156241dd9a6bSDavid YoungItem: ``IB_BTH``
156341dd9a6bSDavid Young^^^^^^^^^^^^^^^^
156441dd9a6bSDavid Young
156541dd9a6bSDavid YoungMatches an InfiniBand base transport header in RoCE packet.
156641dd9a6bSDavid Young
156741dd9a6bSDavid Young- ``hdr``: InfiniBand base transport header definition (``rte_ib.h``).
156841dd9a6bSDavid Young
156941dd9a6bSDavid YoungItem: ``PTYPE``
157041dd9a6bSDavid Young^^^^^^^^^^^^^^^
157141dd9a6bSDavid Young
157241dd9a6bSDavid YoungMatches the packet type as defined in rte_mbuf_ptype.
157341dd9a6bSDavid Young
157441dd9a6bSDavid Young- ``packet_type``: L2/L3/L4 and tunnel information.
157541dd9a6bSDavid Young
157641dd9a6bSDavid YoungItem: ``RANDOM``
157741dd9a6bSDavid Young^^^^^^^^^^^^^^^^
157841dd9a6bSDavid Young
157941dd9a6bSDavid YoungMatches a random value.
158041dd9a6bSDavid Young
158141dd9a6bSDavid YoungA random unsigned integer (at most 32-bit) is generated for each packet
158241dd9a6bSDavid Youngduring flow rule processing, by either HW, SW or some external source.
158341dd9a6bSDavid YoungApplication can match on either exact value or range of values.
158441dd9a6bSDavid YoungThis value is not based on the packet data/headers.
158541dd9a6bSDavid YoungThe application shouldn't assume that this value is kept
158641dd9a6bSDavid Youngduring the lifetime of the packet.
158741dd9a6bSDavid Young
158841dd9a6bSDavid Young- ``value``: Specific value to match.
158941dd9a6bSDavid Young
159041dd9a6bSDavid YoungItem: ``COMPARE``
159141dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
159241dd9a6bSDavid Young
159341dd9a6bSDavid YoungMatches the comparison result between packet fields or value.
159441dd9a6bSDavid Young
159541dd9a6bSDavid Young- ``compare``: Comparison information.
159641dd9a6bSDavid Young
159741dd9a6bSDavid YoungActions
159841dd9a6bSDavid Young~~~~~~~
159941dd9a6bSDavid Young
160041dd9a6bSDavid YoungEach possible action is represented by a type.
160141dd9a6bSDavid YoungAn action can have an associated configuration object.
160241dd9a6bSDavid YoungSeveral actions combined in a list can be assigned
160341dd9a6bSDavid Youngto a flow rule and are performed in order.
160441dd9a6bSDavid Young
160541dd9a6bSDavid YoungThey fall in three categories:
160641dd9a6bSDavid Young
160741dd9a6bSDavid Young- Actions that modify the fate of matching traffic, for instance by dropping
160841dd9a6bSDavid Young  or assigning it a specific destination.
160941dd9a6bSDavid Young
161041dd9a6bSDavid Young- Actions that modify matching traffic contents or its properties. This
161141dd9a6bSDavid Young  includes adding/removing encapsulation, encryption, compression and marks.
161241dd9a6bSDavid Young
161341dd9a6bSDavid Young- Actions related to the flow rule itself, such as updating counters or
161441dd9a6bSDavid Young  making it non-terminating.
161541dd9a6bSDavid Young
161641dd9a6bSDavid YoungFlow rules being terminating by default, not specifying any action of the
161741dd9a6bSDavid Youngfate kind results in undefined behavior. This applies to both ingress and
161841dd9a6bSDavid Youngegress.
161941dd9a6bSDavid Young
162041dd9a6bSDavid YoungPASSTHRU, when supported, makes a flow rule non-terminating.
162141dd9a6bSDavid Young
162241dd9a6bSDavid YoungLike matching patterns, action lists are terminated by END items.
162341dd9a6bSDavid Young
162441dd9a6bSDavid YoungExample of action that redirects packets to queue index 10:
162541dd9a6bSDavid Young
162641dd9a6bSDavid Young.. _table_rte_flow_action_example:
162741dd9a6bSDavid Young
162841dd9a6bSDavid Young.. table:: Queue action
162941dd9a6bSDavid Young
163041dd9a6bSDavid Young   +-----------+-------+
163141dd9a6bSDavid Young   | Field     | Value |
163241dd9a6bSDavid Young   +===========+=======+
163341dd9a6bSDavid Young   | ``index`` | 10    |
163441dd9a6bSDavid Young   +-----------+-------+
163541dd9a6bSDavid Young
163641dd9a6bSDavid YoungActions are performed in list order:
163741dd9a6bSDavid Young
163841dd9a6bSDavid Young.. _table_rte_flow_count_then_drop:
163941dd9a6bSDavid Young
164041dd9a6bSDavid Young.. table:: Count then drop
164141dd9a6bSDavid Young
164241dd9a6bSDavid Young   +-------+--------+
164341dd9a6bSDavid Young   | Index | Action |
164441dd9a6bSDavid Young   +=======+========+
164541dd9a6bSDavid Young   | 0     | COUNT  |
164641dd9a6bSDavid Young   +-------+--------+
164741dd9a6bSDavid Young   | 1     | DROP   |
164841dd9a6bSDavid Young   +-------+--------+
164941dd9a6bSDavid Young   | 2     | END    |
165041dd9a6bSDavid Young   +-------+--------+
165141dd9a6bSDavid Young
165241dd9a6bSDavid Young|
165341dd9a6bSDavid Young
165441dd9a6bSDavid Young.. _table_rte_flow_mark_count_redirect:
165541dd9a6bSDavid Young
165641dd9a6bSDavid Young.. table:: Mark, count then redirect
165741dd9a6bSDavid Young
165841dd9a6bSDavid Young   +-------+--------+------------+-------+
165941dd9a6bSDavid Young   | Index | Action | Field      | Value |
166041dd9a6bSDavid Young   +=======+========+============+=======+
166141dd9a6bSDavid Young   | 0     | MARK   | ``mark``   | 0x2a  |
166241dd9a6bSDavid Young   +-------+--------+------------+-------+
166341dd9a6bSDavid Young   | 1     | COUNT  | ``id``     | 0     |
166441dd9a6bSDavid Young   +-------+--------+------------+-------+
166541dd9a6bSDavid Young   | 2     | QUEUE  | ``queue``  | 10    |
166641dd9a6bSDavid Young   +-------+--------+------------+-------+
166741dd9a6bSDavid Young   | 3     | END                         |
166841dd9a6bSDavid Young   +-------+-----------------------------+
166941dd9a6bSDavid Young
167041dd9a6bSDavid Young|
167141dd9a6bSDavid Young
167241dd9a6bSDavid Young.. _table_rte_flow_redirect_queue_5:
167341dd9a6bSDavid Young
167441dd9a6bSDavid Young.. table:: Redirect to queue 5
167541dd9a6bSDavid Young
167641dd9a6bSDavid Young   +-------+--------+-----------+-------+
167741dd9a6bSDavid Young   | Index | Action | Field     | Value |
167841dd9a6bSDavid Young   +=======+========+===========+=======+
167941dd9a6bSDavid Young   | 0     | DROP                       |
168041dd9a6bSDavid Young   +-------+--------+-----------+-------+
168141dd9a6bSDavid Young   | 1     | QUEUE  | ``queue`` | 5     |
168241dd9a6bSDavid Young   +-------+--------+-----------+-------+
168341dd9a6bSDavid Young   | 2     | END                        |
168441dd9a6bSDavid Young   +-------+----------------------------+
168541dd9a6bSDavid Young
168641dd9a6bSDavid YoungIn the above example, while DROP and QUEUE must be performed in order, both
168741dd9a6bSDavid Younghave to happen before reaching END. Only QUEUE has a visible effect.
168841dd9a6bSDavid Young
168941dd9a6bSDavid YoungNote that such a list may be thought as ambiguous and rejected on that
169041dd9a6bSDavid Youngbasis.
169141dd9a6bSDavid Young
169241dd9a6bSDavid Young.. _table_rte_flow_redirect_queue_5_3:
169341dd9a6bSDavid Young
169441dd9a6bSDavid Young.. table:: Redirect to queues 5 and 3
169541dd9a6bSDavid Young
169641dd9a6bSDavid Young   +-------+--------+-----------+-------+
169741dd9a6bSDavid Young   | Index | Action | Field     | Value |
169841dd9a6bSDavid Young   +=======+========+===========+=======+
169941dd9a6bSDavid Young   | 0     | QUEUE  | ``queue`` | 5     |
170041dd9a6bSDavid Young   +-------+--------+-----------+-------+
170141dd9a6bSDavid Young   | 1     | VOID                       |
170241dd9a6bSDavid Young   +-------+--------+-----------+-------+
170341dd9a6bSDavid Young   | 2     | QUEUE  | ``queue`` | 3     |
170441dd9a6bSDavid Young   +-------+--------+-----------+-------+
170541dd9a6bSDavid Young   | 3     | END                        |
170641dd9a6bSDavid Young   +-------+----------------------------+
170741dd9a6bSDavid Young
170841dd9a6bSDavid YoungAs previously described, all actions must be taken into account. This
170941dd9a6bSDavid Youngeffectively duplicates traffic to both queues. The above example also shows
171041dd9a6bSDavid Youngthat VOID is ignored.
171141dd9a6bSDavid Young
171241dd9a6bSDavid YoungAction types
171341dd9a6bSDavid Young~~~~~~~~~~~~
171441dd9a6bSDavid Young
171541dd9a6bSDavid YoungCommon action types are described in this section.
171641dd9a6bSDavid Young
171741dd9a6bSDavid YoungAction: ``END``
171841dd9a6bSDavid Young^^^^^^^^^^^^^^^
171941dd9a6bSDavid Young
172041dd9a6bSDavid YoungEnd marker for action lists. Prevents further processing of actions, thereby
172141dd9a6bSDavid Youngending the list.
172241dd9a6bSDavid Young
172341dd9a6bSDavid Young- Its numeric value is 0 for convenience.
172441dd9a6bSDavid Young- PMD support is mandatory.
172541dd9a6bSDavid Young- No configurable properties.
172641dd9a6bSDavid Young
172741dd9a6bSDavid Young.. _table_rte_flow_action_end:
172841dd9a6bSDavid Young
172941dd9a6bSDavid Young.. table:: END
173041dd9a6bSDavid Young
173141dd9a6bSDavid Young   +---------------+
173241dd9a6bSDavid Young   | Field         |
173341dd9a6bSDavid Young   +===============+
173441dd9a6bSDavid Young   | no properties |
173541dd9a6bSDavid Young   +---------------+
173641dd9a6bSDavid Young
173741dd9a6bSDavid YoungAction: ``VOID``
173841dd9a6bSDavid Young^^^^^^^^^^^^^^^^
173941dd9a6bSDavid Young
174041dd9a6bSDavid YoungUsed as a placeholder for convenience. It is ignored and simply discarded by
174141dd9a6bSDavid YoungPMDs.
174241dd9a6bSDavid Young
174341dd9a6bSDavid Young- PMD support is mandatory.
174441dd9a6bSDavid Young- No configurable properties.
174541dd9a6bSDavid Young
174641dd9a6bSDavid Young.. _table_rte_flow_action_void:
174741dd9a6bSDavid Young
174841dd9a6bSDavid Young.. table:: VOID
174941dd9a6bSDavid Young
175041dd9a6bSDavid Young   +---------------+
175141dd9a6bSDavid Young   | Field         |
175241dd9a6bSDavid Young   +===============+
175341dd9a6bSDavid Young   | no properties |
175441dd9a6bSDavid Young   +---------------+
175541dd9a6bSDavid Young
175641dd9a6bSDavid YoungAction: ``PASSTHRU``
175741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^
175841dd9a6bSDavid Young
175941dd9a6bSDavid YoungLeaves traffic up for additional processing by subsequent flow rules; makes
176041dd9a6bSDavid Younga flow rule non-terminating.
176141dd9a6bSDavid Young
176241dd9a6bSDavid Young- No configurable properties.
176341dd9a6bSDavid Young
176441dd9a6bSDavid Young.. _table_rte_flow_action_passthru:
176541dd9a6bSDavid Young
176641dd9a6bSDavid Young.. table:: PASSTHRU
176741dd9a6bSDavid Young
176841dd9a6bSDavid Young   +---------------+
176941dd9a6bSDavid Young   | Field         |
177041dd9a6bSDavid Young   +===============+
177141dd9a6bSDavid Young   | no properties |
177241dd9a6bSDavid Young   +---------------+
177341dd9a6bSDavid Young
177441dd9a6bSDavid YoungExample to copy a packet to a queue and continue processing by subsequent
177541dd9a6bSDavid Youngflow rules:
177641dd9a6bSDavid Young
177741dd9a6bSDavid Young.. _table_rte_flow_action_passthru_example:
177841dd9a6bSDavid Young
177941dd9a6bSDavid Young.. table:: Copy to queue 8
178041dd9a6bSDavid Young
178141dd9a6bSDavid Young   +-------+--------+-----------+-------+
178241dd9a6bSDavid Young   | Index | Action | Field     | Value |
178341dd9a6bSDavid Young   +=======+========+===========+=======+
178441dd9a6bSDavid Young   | 0     | PASSTHRU                   |
178541dd9a6bSDavid Young   +-------+--------+-----------+-------+
178641dd9a6bSDavid Young   | 1     | QUEUE  | ``queue`` | 8     |
178741dd9a6bSDavid Young   +-------+--------+-----------+-------+
178841dd9a6bSDavid Young   | 2     | END                        |
178941dd9a6bSDavid Young   +-------+----------------------------+
179041dd9a6bSDavid Young
179141dd9a6bSDavid YoungAction: ``JUMP``
179241dd9a6bSDavid Young^^^^^^^^^^^^^^^^
179341dd9a6bSDavid Young
179441dd9a6bSDavid YoungRedirects packets to a group on the current device.
179541dd9a6bSDavid Young
179641dd9a6bSDavid YoungIn a hierarchy of groups, which can be used to represent physical or logical
179741dd9a6bSDavid Youngflow group/tables on the device, this action redirects the matched flow to
179841dd9a6bSDavid Youngthe specified group on that device.
179941dd9a6bSDavid Young
180041dd9a6bSDavid YoungIf a matched flow is redirected to a table which doesn't contain a matching
180141dd9a6bSDavid Youngrule for that flow, then the behavior is undefined and the resulting behavior
180241dd9a6bSDavid Youngis up to the specific device. Best practice when using groups would be to define
180341dd9a6bSDavid Younga default flow rule for each group which a defines the default actions in that
180441dd9a6bSDavid Younggroup so a consistent behavior is defined.
180541dd9a6bSDavid Young
180641dd9a6bSDavid YoungDefining an action for a matched flow in a group to jump to a group which is
180741dd9a6bSDavid Younghigher in the group hierarchy may not be supported by physical devices,
180841dd9a6bSDavid Youngdepending on how groups are mapped to the physical devices. In the
180941dd9a6bSDavid Youngdefinitions of jump actions, applications should be aware that it may be
181041dd9a6bSDavid Youngpossible to define flow rules which trigger an undefined behavior causing
181141dd9a6bSDavid Youngflows to loop between groups.
181241dd9a6bSDavid Young
181341dd9a6bSDavid Young.. _table_rte_flow_action_jump:
181441dd9a6bSDavid Young
181541dd9a6bSDavid Young.. table:: JUMP
181641dd9a6bSDavid Young
181741dd9a6bSDavid Young   +-----------+------------------------------+
181841dd9a6bSDavid Young   | Field     | Value                        |
181941dd9a6bSDavid Young   +===========+==============================+
182041dd9a6bSDavid Young   | ``group`` | Group to redirect packets to |
182141dd9a6bSDavid Young   +-----------+------------------------------+
182241dd9a6bSDavid Young
1823af154d7aSAlexander KozyrevAction: ``JUMP_TO_TABLE_INDEX``
1824af154d7aSAlexander Kozyrev^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1825af154d7aSAlexander Kozyrev
1826af154d7aSAlexander KozyrevRedirects packets to a particular index in a flow table.
1827af154d7aSAlexander Kozyrev
1828af154d7aSAlexander KozyrevBypassing a hierarchy of groups,
1829af154d7aSAlexander Kozyrevthis action redirects the matched flow to the specified index
1830af154d7aSAlexander Kozyrevin the particular template table on the device.
1831af154d7aSAlexander Kozyrev
1832af154d7aSAlexander KozyrevIf a matched flow is redirected to a non-existing template table
1833af154d7aSAlexander Kozyrevor the table which doesn't contain a rule at the specified index,
1834af154d7aSAlexander Kozyrevthen the behavior is undefined and the resulting behavior is up to driver.
1835af154d7aSAlexander Kozyrev
1836af154d7aSAlexander Kozyrev.. _table_rte_flow_action_jump_to_table_index:
1837af154d7aSAlexander Kozyrev
1838af154d7aSAlexander Kozyrev.. table:: JUMP_TO_TABLE_INDEX
1839af154d7aSAlexander Kozyrev
1840af154d7aSAlexander Kozyrev   +-----------+-------------------------------------------+
1841af154d7aSAlexander Kozyrev   | Field     | Value                                     |
1842af154d7aSAlexander Kozyrev   +===========+===========================================+
1843af154d7aSAlexander Kozyrev   | ``table`` | Template table to redirect packets to     |
1844af154d7aSAlexander Kozyrev   +-----------+-------------------------------------------+
1845af154d7aSAlexander Kozyrev   | ``index`` | Index in the table to redirect packets to |
1846af154d7aSAlexander Kozyrev   +-----------+-------------------------------------------+
1847af154d7aSAlexander Kozyrev
184841dd9a6bSDavid YoungAction: ``MARK``
184941dd9a6bSDavid Young^^^^^^^^^^^^^^^^
185041dd9a6bSDavid Young
185141dd9a6bSDavid YoungAttaches an integer value to packets and sets ``RTE_MBUF_F_RX_FDIR`` and
185241dd9a6bSDavid Young``RTE_MBUF_F_RX_FDIR_ID`` mbuf flags.
185341dd9a6bSDavid Young
185441dd9a6bSDavid YoungThis value is arbitrary and application-defined. Maximum allowed value
185541dd9a6bSDavid Youngdepends on the underlying implementation. It is returned in the
185641dd9a6bSDavid Young``hash.fdir.hi`` mbuf field.
185741dd9a6bSDavid Young
185841dd9a6bSDavid Young.. _table_rte_flow_action_mark:
185941dd9a6bSDavid Young
186041dd9a6bSDavid Young.. table:: MARK
186141dd9a6bSDavid Young
186241dd9a6bSDavid Young   +--------+--------------------------------------+
186341dd9a6bSDavid Young   | Field  | Value                                |
186441dd9a6bSDavid Young   +========+======================================+
186541dd9a6bSDavid Young   | ``id`` | integer value to return with packets |
186641dd9a6bSDavid Young   +--------+--------------------------------------+
186741dd9a6bSDavid Young
186841dd9a6bSDavid YoungAction: ``FLAG``
186941dd9a6bSDavid Young^^^^^^^^^^^^^^^^
187041dd9a6bSDavid Young
187141dd9a6bSDavid YoungFlags packets. Similar to `Action: MARK`_ without a specific value; only
187241dd9a6bSDavid Youngsets the ``RTE_MBUF_F_RX_FDIR`` mbuf flag.
187341dd9a6bSDavid Young
187441dd9a6bSDavid Young- No configurable properties.
187541dd9a6bSDavid Young
187641dd9a6bSDavid Young.. _table_rte_flow_action_flag:
187741dd9a6bSDavid Young
187841dd9a6bSDavid Young.. table:: FLAG
187941dd9a6bSDavid Young
188041dd9a6bSDavid Young   +---------------+
188141dd9a6bSDavid Young   | Field         |
188241dd9a6bSDavid Young   +===============+
188341dd9a6bSDavid Young   | no properties |
188441dd9a6bSDavid Young   +---------------+
188541dd9a6bSDavid Young
188641dd9a6bSDavid YoungAction: ``QUEUE``
188741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
188841dd9a6bSDavid Young
188941dd9a6bSDavid YoungAssigns packets to a given queue index.
189041dd9a6bSDavid Young
189141dd9a6bSDavid Young.. _table_rte_flow_action_queue:
189241dd9a6bSDavid Young
189341dd9a6bSDavid Young.. table:: QUEUE
189441dd9a6bSDavid Young
189541dd9a6bSDavid Young   +-----------+--------------------+
189641dd9a6bSDavid Young   | Field     | Value              |
189741dd9a6bSDavid Young   +===========+====================+
189841dd9a6bSDavid Young   | ``index`` | queue index to use |
189941dd9a6bSDavid Young   +-----------+--------------------+
190041dd9a6bSDavid Young
190141dd9a6bSDavid YoungAction: ``DROP``
190241dd9a6bSDavid Young^^^^^^^^^^^^^^^^
190341dd9a6bSDavid Young
190441dd9a6bSDavid YoungDrop packets.
190541dd9a6bSDavid Young
190641dd9a6bSDavid Young- No configurable properties.
190741dd9a6bSDavid Young
190841dd9a6bSDavid Young.. _table_rte_flow_action_drop:
190941dd9a6bSDavid Young
191041dd9a6bSDavid Young.. table:: DROP
191141dd9a6bSDavid Young
191241dd9a6bSDavid Young   +---------------+
191341dd9a6bSDavid Young   | Field         |
191441dd9a6bSDavid Young   +===============+
191541dd9a6bSDavid Young   | no properties |
191641dd9a6bSDavid Young   +---------------+
191741dd9a6bSDavid Young
191841dd9a6bSDavid Young
191941dd9a6bSDavid YoungAction: ``SKIP_CMAN``
192041dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^
192141dd9a6bSDavid Young
192241dd9a6bSDavid YoungSkip congestion management on received packets.
192341dd9a6bSDavid Young
192441dd9a6bSDavid Young- Using ``rte_eth_cman_config_set()``,
192541dd9a6bSDavid Young  an application can configure ethdev Rx queue's congestion mechanism.
192641dd9a6bSDavid Young  Once applied, packets congestion configuration is bypassed
192741dd9a6bSDavid Young  on that particular ethdev Rx queue for all packets directed to that queue.
192841dd9a6bSDavid Young
192941dd9a6bSDavid Young.. _table_rte_flow_action_skip_cman:
193041dd9a6bSDavid Young
193141dd9a6bSDavid Young.. table:: SKIP_CMAN
193241dd9a6bSDavid Young
193341dd9a6bSDavid Young   +---------------+
193441dd9a6bSDavid Young   | Field         |
193541dd9a6bSDavid Young   +===============+
193641dd9a6bSDavid Young   | no properties |
193741dd9a6bSDavid Young   +---------------+
193841dd9a6bSDavid Young
193941dd9a6bSDavid Young
194041dd9a6bSDavid YoungAction: ``COUNT``
194141dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
194241dd9a6bSDavid Young
194341dd9a6bSDavid YoungAdds a counter action to a matched flow.
194441dd9a6bSDavid Young
194541dd9a6bSDavid YoungIf more than one count action is specified in a single flow rule, then each
194641dd9a6bSDavid Youngaction must specify a unique id.
194741dd9a6bSDavid Young
194841dd9a6bSDavid YoungCounters can be retrieved and reset through ``rte_flow_query()``, see
194941dd9a6bSDavid Young``struct rte_flow_query_count``.
195041dd9a6bSDavid Young
195141dd9a6bSDavid YoungFor ports within the same switch domain then the counter id namespace extends
195241dd9a6bSDavid Youngto all ports within that switch domain.
195341dd9a6bSDavid Young
195441dd9a6bSDavid Young.. _table_rte_flow_action_count:
195541dd9a6bSDavid Young
195641dd9a6bSDavid Young.. table:: COUNT
195741dd9a6bSDavid Young
195841dd9a6bSDavid Young   +------------+---------------------------------+
195941dd9a6bSDavid Young   | Field      | Value                           |
196041dd9a6bSDavid Young   +============+=================================+
196141dd9a6bSDavid Young   | ``id``     | counter id                      |
196241dd9a6bSDavid Young   +------------+---------------------------------+
196341dd9a6bSDavid Young
196441dd9a6bSDavid YoungQuery structure to retrieve and reset flow rule counters:
196541dd9a6bSDavid Young
196641dd9a6bSDavid Young.. _table_rte_flow_query_count:
196741dd9a6bSDavid Young
196841dd9a6bSDavid Young.. table:: COUNT query
196941dd9a6bSDavid Young
197041dd9a6bSDavid Young   +---------------+-----+-----------------------------------+
197141dd9a6bSDavid Young   | Field         | I/O | Value                             |
197241dd9a6bSDavid Young   +===============+=====+===================================+
197341dd9a6bSDavid Young   | ``reset``     | in  | reset counter after query         |
197441dd9a6bSDavid Young   +---------------+-----+-----------------------------------+
197541dd9a6bSDavid Young   | ``hits_set``  | out | ``hits`` field is set             |
197641dd9a6bSDavid Young   +---------------+-----+-----------------------------------+
197741dd9a6bSDavid Young   | ``bytes_set`` | out | ``bytes`` field is set            |
197841dd9a6bSDavid Young   +---------------+-----+-----------------------------------+
197941dd9a6bSDavid Young   | ``hits``      | out | number of hits for this rule      |
198041dd9a6bSDavid Young   +---------------+-----+-----------------------------------+
198141dd9a6bSDavid Young   | ``bytes``     | out | number of bytes through this rule |
198241dd9a6bSDavid Young   +---------------+-----+-----------------------------------+
198341dd9a6bSDavid Young
198441dd9a6bSDavid YoungAction: ``RSS``
198541dd9a6bSDavid Young^^^^^^^^^^^^^^^
198641dd9a6bSDavid Young
198741dd9a6bSDavid YoungSimilar to QUEUE, except RSS is additionally performed on packets to spread
198841dd9a6bSDavid Youngthem among several queues according to the provided parameters.
198941dd9a6bSDavid Young
199041dd9a6bSDavid YoungUnlike global RSS settings used by other DPDK APIs, unsetting the ``types``
199141dd9a6bSDavid Youngfield does not disable RSS in a flow rule. Doing so instead requests safe
199241dd9a6bSDavid Youngunspecified "best-effort" settings from the underlying PMD, which depending
199341dd9a6bSDavid Youngon the flow rule, may result in anything ranging from empty (single queue)
199441dd9a6bSDavid Youngto all-inclusive RSS.
199541dd9a6bSDavid Young
199641dd9a6bSDavid YoungIf non-applicable for matching packets RSS types are requested,
199741dd9a6bSDavid Youngthese RSS types are simply ignored. For example, it happens if:
199841dd9a6bSDavid Young
199941dd9a6bSDavid Young- Hashing of both TCP and UDP ports is requested
200041dd9a6bSDavid Young  (only one can be present in a packet).
200141dd9a6bSDavid Young
200241dd9a6bSDavid Young- Requested RSS types contradict to flow rule pattern
200341dd9a6bSDavid Young  (e.g. pattern has UDP item, but RSS types contain TCP).
200441dd9a6bSDavid Young
200541dd9a6bSDavid YoungIf requested RSS hash types are not supported by the Ethernet device at all
200641dd9a6bSDavid Young(not reported in ``dev_info.flow_type_rss_offloads``),
200741dd9a6bSDavid Youngthe flow creation will fail.
200841dd9a6bSDavid Young
200941dd9a6bSDavid YoungNote: RSS hash result is stored in the ``hash.rss`` mbuf field which
201041dd9a6bSDavid Youngoverlaps ``hash.fdir.lo``. Since `Action: MARK`_ sets the ``hash.fdir.hi``
201141dd9a6bSDavid Youngfield only, both can be requested simultaneously.
201241dd9a6bSDavid Young
201341dd9a6bSDavid YoungAlso, regarding packet encapsulation ``level``:
201441dd9a6bSDavid Young
201541dd9a6bSDavid Young- ``0`` requests the default behavior. Depending on the packet type, it can
201641dd9a6bSDavid Young  mean outermost, innermost, anything in between or even no RSS.
201741dd9a6bSDavid Young
201841dd9a6bSDavid Young  It basically stands for the innermost encapsulation level RSS can be
201941dd9a6bSDavid Young  performed on according to PMD and device capabilities.
202041dd9a6bSDavid Young
202141dd9a6bSDavid Young- ``1`` requests RSS to be performed on the outermost packet encapsulation
202241dd9a6bSDavid Young  level.
202341dd9a6bSDavid Young
202441dd9a6bSDavid Young- ``2`` and subsequent values request RSS to be performed on the specified
202541dd9a6bSDavid Young  inner packet encapsulation level, from outermost to innermost (lower to
202641dd9a6bSDavid Young  higher values).
202741dd9a6bSDavid Young
202841dd9a6bSDavid YoungValues other than ``0`` are not necessarily supported.
202941dd9a6bSDavid Young
203041dd9a6bSDavid YoungRequesting a specific RSS level on unrecognized traffic results in undefined
203141dd9a6bSDavid Youngbehavior. For predictable results, it is recommended to make the flow rule
203241dd9a6bSDavid Youngpattern match packet headers up to the requested encapsulation level so that
203341dd9a6bSDavid Youngonly matching traffic goes through.
203441dd9a6bSDavid Young
203541dd9a6bSDavid Young.. _table_rte_flow_action_rss:
203641dd9a6bSDavid Young
203741dd9a6bSDavid Young.. table:: RSS
203841dd9a6bSDavid Young
203941dd9a6bSDavid Young   +---------------+-------------------------------------------------+
204041dd9a6bSDavid Young   | Field         | Value                                           |
204141dd9a6bSDavid Young   +===============+=================================================+
204241dd9a6bSDavid Young   | ``func``      | RSS hash function to apply                      |
204341dd9a6bSDavid Young   +---------------+-------------------------------------------------+
204441dd9a6bSDavid Young   | ``level``     | encapsulation level for ``types``               |
204541dd9a6bSDavid Young   +---------------+-------------------------------------------------+
204641dd9a6bSDavid Young   | ``types``     | specific RSS hash types (see ``RTE_ETH_RSS_*``) |
204741dd9a6bSDavid Young   +---------------+-------------------------------------------------+
204841dd9a6bSDavid Young   | ``key_len``   | hash key length in bytes                        |
204941dd9a6bSDavid Young   +---------------+-------------------------------------------------+
205041dd9a6bSDavid Young   | ``queue_num`` | number of entries in ``queue``                  |
205141dd9a6bSDavid Young   +---------------+-------------------------------------------------+
205241dd9a6bSDavid Young   | ``key``       | hash key                                        |
205341dd9a6bSDavid Young   +---------------+-------------------------------------------------+
205441dd9a6bSDavid Young   | ``queue``     | queue indices to use                            |
205541dd9a6bSDavid Young   +---------------+-------------------------------------------------+
205641dd9a6bSDavid Young
205741dd9a6bSDavid YoungAction: ``PF``
205841dd9a6bSDavid Young^^^^^^^^^^^^^^
205941dd9a6bSDavid Young
206041dd9a6bSDavid YoungThis action is deprecated. Consider:
206141dd9a6bSDavid Young - `Action: PORT_REPRESENTOR`_
206241dd9a6bSDavid Young - `Action: REPRESENTED_PORT`_
206341dd9a6bSDavid Young
206441dd9a6bSDavid YoungDirects matching traffic to the physical function (PF) of the current
206541dd9a6bSDavid Youngdevice.
206641dd9a6bSDavid Young
206741dd9a6bSDavid Young- No configurable properties.
206841dd9a6bSDavid Young
206941dd9a6bSDavid Young.. _table_rte_flow_action_pf:
207041dd9a6bSDavid Young
207141dd9a6bSDavid Young.. table:: PF
207241dd9a6bSDavid Young
207341dd9a6bSDavid Young   +---------------+
207441dd9a6bSDavid Young   | Field         |
207541dd9a6bSDavid Young   +===============+
207641dd9a6bSDavid Young   | no properties |
207741dd9a6bSDavid Young   +---------------+
207841dd9a6bSDavid Young
207941dd9a6bSDavid YoungAction: ``VF``
208041dd9a6bSDavid Young^^^^^^^^^^^^^^
208141dd9a6bSDavid Young
208241dd9a6bSDavid YoungThis action is deprecated. Consider:
208341dd9a6bSDavid Young - `Action: PORT_REPRESENTOR`_
208441dd9a6bSDavid Young - `Action: REPRESENTED_PORT`_
208541dd9a6bSDavid Young
208641dd9a6bSDavid YoungDirects matching traffic to a given virtual function of the current device.
208741dd9a6bSDavid Young
208841dd9a6bSDavid YoungPackets can be redirected to the VF they originate from,
208941dd9a6bSDavid Younginstead of the specified one. This parameter may not be available and is
209041dd9a6bSDavid Youngnot guaranteed to work properly if the VF part is matched by a prior flow
209141dd9a6bSDavid Youngrule or if packets are not addressed to a VF in the first place.
209241dd9a6bSDavid Young
209341dd9a6bSDavid Young.. _table_rte_flow_action_vf:
209441dd9a6bSDavid Young
209541dd9a6bSDavid Young.. table:: VF
209641dd9a6bSDavid Young
209741dd9a6bSDavid Young   +--------------+--------------------------------+
209841dd9a6bSDavid Young   | Field        | Value                          |
209941dd9a6bSDavid Young   +==============+================================+
210041dd9a6bSDavid Young   | ``original`` | use original VF ID if possible |
210141dd9a6bSDavid Young   +--------------+--------------------------------+
210241dd9a6bSDavid Young   | ``id``       | VF ID                          |
210341dd9a6bSDavid Young   +--------------+--------------------------------+
210441dd9a6bSDavid Young
210541dd9a6bSDavid YoungAction: ``PORT_ID``
210641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^
210741dd9a6bSDavid YoungThis action is deprecated. Consider:
210841dd9a6bSDavid Young - `Action: PORT_REPRESENTOR`_
210941dd9a6bSDavid Young - `Action: REPRESENTED_PORT`_
211041dd9a6bSDavid Young
211141dd9a6bSDavid YoungDirects matching traffic to a given DPDK port ID.
211241dd9a6bSDavid Young
211341dd9a6bSDavid YoungSee `Item: PORT_ID`_.
211441dd9a6bSDavid Young
211541dd9a6bSDavid Young.. _table_rte_flow_action_port_id:
211641dd9a6bSDavid Young
211741dd9a6bSDavid Young.. table:: PORT_ID
211841dd9a6bSDavid Young
211941dd9a6bSDavid Young   +--------------+---------------------------------------+
212041dd9a6bSDavid Young   | Field        | Value                                 |
212141dd9a6bSDavid Young   +==============+=======================================+
212241dd9a6bSDavid Young   | ``original`` | use original DPDK port ID if possible |
212341dd9a6bSDavid Young   +--------------+---------------------------------------+
212441dd9a6bSDavid Young   | ``id``       | DPDK port ID                          |
212541dd9a6bSDavid Young   +--------------+---------------------------------------+
212641dd9a6bSDavid Young
212741dd9a6bSDavid YoungAction: ``METER``
212841dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
212941dd9a6bSDavid Young
213041dd9a6bSDavid YoungApplies a stage of metering and policing.
213141dd9a6bSDavid Young
213241dd9a6bSDavid YoungThe metering and policing (MTR) object has to be first created using the
213341dd9a6bSDavid Youngrte_mtr_create() API function. The ID of the MTR object is specified as
213441dd9a6bSDavid Youngaction parameter. More than one flow can use the same MTR object through
213541dd9a6bSDavid Youngthe meter action. The MTR object can be further updated or queried using
213641dd9a6bSDavid Youngthe rte_mtr* API.
213741dd9a6bSDavid Young
213841dd9a6bSDavid Young.. _table_rte_flow_action_meter:
213941dd9a6bSDavid Young
214041dd9a6bSDavid Young.. table:: METER
214141dd9a6bSDavid Young
214241dd9a6bSDavid Young   +--------------+---------------+
214341dd9a6bSDavid Young   | Field        | Value         |
214441dd9a6bSDavid Young   +==============+===============+
214541dd9a6bSDavid Young   | ``mtr_id``   | MTR object ID |
214641dd9a6bSDavid Young   +--------------+---------------+
214741dd9a6bSDavid Young
214841dd9a6bSDavid YoungAction: ``SECURITY``
214941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^
215041dd9a6bSDavid Young
215141dd9a6bSDavid YoungPerform the security action on flows matched by the pattern items
215241dd9a6bSDavid Youngaccording to the configuration of the security session.
215341dd9a6bSDavid Young
215441dd9a6bSDavid YoungThis action modifies the payload of matched flows. For INLINE_CRYPTO, the
215541dd9a6bSDavid Youngsecurity protocol headers and IV are fully provided by the application as
215641dd9a6bSDavid Youngspecified in the flow pattern. The payload of matching packets is
215741dd9a6bSDavid Youngencrypted on egress, and decrypted and authenticated on ingress.
215841dd9a6bSDavid YoungFor INLINE_PROTOCOL, the security protocol is fully offloaded to HW,
215941dd9a6bSDavid Youngproviding full encapsulation and decapsulation of packets in security
216041dd9a6bSDavid Youngprotocols. The flow pattern specifies both the outer security header fields
216141dd9a6bSDavid Youngand the inner packet fields. The security session specified in the action
216241dd9a6bSDavid Youngmust match the pattern parameters.
216341dd9a6bSDavid Young
216441dd9a6bSDavid YoungThe security session specified in the action must be created on the same
216541dd9a6bSDavid Youngport as the flow action that is being specified.
216641dd9a6bSDavid Young
216741dd9a6bSDavid YoungThe ingress/egress flow attribute should match that specified in the
216841dd9a6bSDavid Youngsecurity session if the security session supports the definition of the
216941dd9a6bSDavid Youngdirection.
217041dd9a6bSDavid Young
217141dd9a6bSDavid YoungMultiple flows can be configured to use the same security session.
217241dd9a6bSDavid Young
217341dd9a6bSDavid Young.. _table_rte_flow_action_security:
217441dd9a6bSDavid Young
217541dd9a6bSDavid Young.. table:: SECURITY
217641dd9a6bSDavid Young
217741dd9a6bSDavid Young   +----------------------+--------------------------------------+
217841dd9a6bSDavid Young   | Field                | Value                                |
217941dd9a6bSDavid Young   +======================+======================================+
218041dd9a6bSDavid Young   | ``security_session`` | security session to apply            |
218141dd9a6bSDavid Young   +----------------------+--------------------------------------+
218241dd9a6bSDavid Young
218341dd9a6bSDavid YoungThe following is an example of configuring IPsec inline using the
218441dd9a6bSDavid YoungINLINE_CRYPTO security session:
218541dd9a6bSDavid Young
218641dd9a6bSDavid YoungThe encryption algorithm, keys and salt are part of the opaque
218741dd9a6bSDavid Young``rte_security_session``. The SA is identified according to the IP and ESP
218841dd9a6bSDavid Youngfields in the pattern items.
218941dd9a6bSDavid Young
219041dd9a6bSDavid Young.. _table_rte_flow_item_esp_inline_example:
219141dd9a6bSDavid Young
219241dd9a6bSDavid Young.. table:: IPsec inline crypto flow pattern items.
219341dd9a6bSDavid Young
219441dd9a6bSDavid Young   +-------+----------+
219541dd9a6bSDavid Young   | Index | Item     |
219641dd9a6bSDavid Young   +=======+==========+
219741dd9a6bSDavid Young   | 0     | Ethernet |
219841dd9a6bSDavid Young   +-------+----------+
219941dd9a6bSDavid Young   | 1     | IPv4     |
220041dd9a6bSDavid Young   +-------+----------+
220141dd9a6bSDavid Young   | 2     | ESP      |
220241dd9a6bSDavid Young   +-------+----------+
220341dd9a6bSDavid Young   | 3     | END      |
220441dd9a6bSDavid Young   +-------+----------+
220541dd9a6bSDavid Young
220641dd9a6bSDavid Young.. _table_rte_flow_action_esp_inline_example:
220741dd9a6bSDavid Young
220841dd9a6bSDavid Young.. table:: IPsec inline flow actions.
220941dd9a6bSDavid Young
221041dd9a6bSDavid Young   +-------+----------+
221141dd9a6bSDavid Young   | Index | Action   |
221241dd9a6bSDavid Young   +=======+==========+
221341dd9a6bSDavid Young   | 0     | SECURITY |
221441dd9a6bSDavid Young   +-------+----------+
221541dd9a6bSDavid Young   | 1     | END      |
221641dd9a6bSDavid Young   +-------+----------+
221741dd9a6bSDavid Young
221841dd9a6bSDavid YoungAction: ``OF_DEC_NW_TTL``
221941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^
222041dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
222141dd9a6bSDavid Young
222241dd9a6bSDavid YoungImplements ``OFPAT_DEC_NW_TTL`` ("decrement IP TTL") as defined by the
222341dd9a6bSDavid Young`OpenFlow Switch Specification`_.
222441dd9a6bSDavid Young
222541dd9a6bSDavid Young.. _table_rte_flow_action_of_dec_nw_ttl:
222641dd9a6bSDavid Young
222741dd9a6bSDavid Young.. table:: OF_DEC_NW_TTL
222841dd9a6bSDavid Young
222941dd9a6bSDavid Young   +---------------+
223041dd9a6bSDavid Young   | Field         |
223141dd9a6bSDavid Young   +===============+
223241dd9a6bSDavid Young   | no properties |
223341dd9a6bSDavid Young   +---------------+
223441dd9a6bSDavid Young
223541dd9a6bSDavid YoungAction: ``OF_POP_VLAN``
223641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
223741dd9a6bSDavid Young
223841dd9a6bSDavid YoungImplements ``OFPAT_POP_VLAN`` ("pop the outer VLAN tag") as defined
223941dd9a6bSDavid Youngby the `OpenFlow Switch Specification`_.
224041dd9a6bSDavid Young
224141dd9a6bSDavid Young.. _table_rte_flow_action_of_pop_vlan:
224241dd9a6bSDavid Young
224341dd9a6bSDavid Young.. table:: OF_POP_VLAN
224441dd9a6bSDavid Young
224541dd9a6bSDavid Young   +---------------+
224641dd9a6bSDavid Young   | Field         |
224741dd9a6bSDavid Young   +===============+
224841dd9a6bSDavid Young   | no properties |
224941dd9a6bSDavid Young   +---------------+
225041dd9a6bSDavid Young
225141dd9a6bSDavid YoungAction: ``OF_PUSH_VLAN``
225241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^
225341dd9a6bSDavid Young
225441dd9a6bSDavid YoungImplements ``OFPAT_PUSH_VLAN`` ("push a new VLAN tag") as defined by the
225541dd9a6bSDavid Young`OpenFlow Switch Specification`_.
225641dd9a6bSDavid Young
225741dd9a6bSDavid Young.. _table_rte_flow_action_of_push_vlan:
225841dd9a6bSDavid Young
225941dd9a6bSDavid Young.. table:: OF_PUSH_VLAN
226041dd9a6bSDavid Young
226141dd9a6bSDavid Young   +---------------+-----------+
226241dd9a6bSDavid Young   | Field         | Value     |
226341dd9a6bSDavid Young   +===============+===========+
226441dd9a6bSDavid Young   | ``ethertype`` | EtherType |
226541dd9a6bSDavid Young   +---------------+-----------+
226641dd9a6bSDavid Young
226741dd9a6bSDavid YoungAction: ``OF_SET_VLAN_VID``
226841dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^
226941dd9a6bSDavid Young
227041dd9a6bSDavid YoungImplements ``OFPAT_SET_VLAN_VID`` ("set the 802.1q VLAN id") as defined by
227141dd9a6bSDavid Youngthe `OpenFlow Switch Specification`_.
227241dd9a6bSDavid Young
227341dd9a6bSDavid Young.. _table_rte_flow_action_of_set_vlan_vid:
227441dd9a6bSDavid Young
227541dd9a6bSDavid Young.. table:: OF_SET_VLAN_VID
227641dd9a6bSDavid Young
227741dd9a6bSDavid Young   +--------------+---------+
227841dd9a6bSDavid Young   | Field        | Value   |
227941dd9a6bSDavid Young   +==============+=========+
228041dd9a6bSDavid Young   | ``vlan_vid`` | VLAN id |
228141dd9a6bSDavid Young   +--------------+---------+
228241dd9a6bSDavid Young
228341dd9a6bSDavid YoungAction: ``OF_SET_VLAN_PCP``
228441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^
228541dd9a6bSDavid Young
228641dd9a6bSDavid YoungImplements ``OFPAT_SET_LAN_PCP`` ("set the 802.1q priority") as defined by
228741dd9a6bSDavid Youngthe `OpenFlow Switch Specification`_.
228841dd9a6bSDavid Young
228941dd9a6bSDavid Young.. _table_rte_flow_action_of_set_vlan_pcp:
229041dd9a6bSDavid Young
229141dd9a6bSDavid Young.. table:: OF_SET_VLAN_PCP
229241dd9a6bSDavid Young
229341dd9a6bSDavid Young   +--------------+---------------+
229441dd9a6bSDavid Young   | Field        | Value         |
229541dd9a6bSDavid Young   +==============+===============+
229641dd9a6bSDavid Young   | ``vlan_pcp`` | VLAN priority |
229741dd9a6bSDavid Young   +--------------+---------------+
229841dd9a6bSDavid Young
229941dd9a6bSDavid YoungAction: ``OF_POP_MPLS``
230041dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
230141dd9a6bSDavid Young
230241dd9a6bSDavid YoungImplements ``OFPAT_POP_MPLS`` ("pop the outer MPLS tag") as defined by the
230341dd9a6bSDavid Young`OpenFlow Switch Specification`_.
230441dd9a6bSDavid Young
230541dd9a6bSDavid Young.. _table_rte_flow_action_of_pop_mpls:
230641dd9a6bSDavid Young
230741dd9a6bSDavid Young.. table:: OF_POP_MPLS
230841dd9a6bSDavid Young
230941dd9a6bSDavid Young   +---------------+-----------+
231041dd9a6bSDavid Young   | Field         | Value     |
231141dd9a6bSDavid Young   +===============+===========+
231241dd9a6bSDavid Young   | ``ethertype`` | EtherType |
231341dd9a6bSDavid Young   +---------------+-----------+
231441dd9a6bSDavid Young
231541dd9a6bSDavid YoungAction: ``OF_PUSH_MPLS``
231641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^
231741dd9a6bSDavid Young
231841dd9a6bSDavid YoungImplements ``OFPAT_PUSH_MPLS`` ("push a new MPLS tag") as defined by the
231941dd9a6bSDavid Young`OpenFlow Switch Specification`_.
232041dd9a6bSDavid Young
232141dd9a6bSDavid Young.. _table_rte_flow_action_of_push_mpls:
232241dd9a6bSDavid Young
232341dd9a6bSDavid Young.. table:: OF_PUSH_MPLS
232441dd9a6bSDavid Young
232541dd9a6bSDavid Young   +---------------+-----------+
232641dd9a6bSDavid Young   | Field         | Value     |
232741dd9a6bSDavid Young   +===============+===========+
232841dd9a6bSDavid Young   | ``ethertype`` | EtherType |
232941dd9a6bSDavid Young   +---------------+-----------+
233041dd9a6bSDavid Young
233141dd9a6bSDavid YoungAction: ``VXLAN_ENCAP``
233241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
233341dd9a6bSDavid Young
233441dd9a6bSDavid YoungPerforms a VXLAN encapsulation action by encapsulating the matched flow in the
233541dd9a6bSDavid YoungVXLAN tunnel as defined in the``rte_flow_action_vxlan_encap`` flow items
233641dd9a6bSDavid Youngdefinition.
233741dd9a6bSDavid Young
233841dd9a6bSDavid YoungThis action modifies the payload of matched flows. The flow definition specified
233941dd9a6bSDavid Youngin the ``rte_flow_action_tunnel_encap`` action structure must define a valid
234041dd9a6bSDavid YoungVLXAN network overlay which conforms with RFC 7348 (Virtual eXtensible Local
234141dd9a6bSDavid YoungArea Network (VXLAN): A Framework for Overlaying Virtualized Layer 2 Networks
234241dd9a6bSDavid Youngover Layer 3 Networks). The pattern must be terminated with the
234341dd9a6bSDavid YoungRTE_FLOW_ITEM_TYPE_END item type.
234441dd9a6bSDavid Young
234541dd9a6bSDavid Young.. _table_rte_flow_action_vxlan_encap:
234641dd9a6bSDavid Young
234741dd9a6bSDavid Young.. table:: VXLAN_ENCAP
234841dd9a6bSDavid Young
234941dd9a6bSDavid Young   +----------------+-------------------------------------+
235041dd9a6bSDavid Young   | Field          | Value                               |
235141dd9a6bSDavid Young   +================+=====================================+
235241dd9a6bSDavid Young   | ``definition`` | Tunnel end-point overlay definition |
235341dd9a6bSDavid Young   +----------------+-------------------------------------+
235441dd9a6bSDavid Young
235541dd9a6bSDavid Young.. _table_rte_flow_action_vxlan_encap_example:
235641dd9a6bSDavid Young
235741dd9a6bSDavid Young.. table:: IPv4 VxLAN flow pattern example.
235841dd9a6bSDavid Young
235941dd9a6bSDavid Young   +-------+----------+
236041dd9a6bSDavid Young   | Index | Item     |
236141dd9a6bSDavid Young   +=======+==========+
236241dd9a6bSDavid Young   | 0     | Ethernet |
236341dd9a6bSDavid Young   +-------+----------+
236441dd9a6bSDavid Young   | 1     | IPv4     |
236541dd9a6bSDavid Young   +-------+----------+
236641dd9a6bSDavid Young   | 2     | UDP      |
236741dd9a6bSDavid Young   +-------+----------+
236841dd9a6bSDavid Young   | 3     | VXLAN    |
236941dd9a6bSDavid Young   +-------+----------+
237041dd9a6bSDavid Young   | 4     | END      |
237141dd9a6bSDavid Young   +-------+----------+
237241dd9a6bSDavid Young
237341dd9a6bSDavid YoungAction: ``VXLAN_DECAP``
237441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
237541dd9a6bSDavid Young
237641dd9a6bSDavid YoungPerforms a decapsulation action by stripping all headers of the VXLAN tunnel
237741dd9a6bSDavid Youngnetwork overlay from the matched flow.
237841dd9a6bSDavid Young
237941dd9a6bSDavid YoungThe flow items pattern defined for the flow rule with which a ``VXLAN_DECAP``
238041dd9a6bSDavid Youngaction is specified, must define a valid VXLAN tunnel as per RFC7348. If the
238141dd9a6bSDavid Youngflow pattern does not specify a valid VXLAN tunnel then a
238241dd9a6bSDavid YoungRTE_FLOW_ERROR_TYPE_ACTION error should be returned.
238341dd9a6bSDavid Young
238441dd9a6bSDavid YoungThis action modifies the payload of matched flows.
238541dd9a6bSDavid Young
238641dd9a6bSDavid YoungAction: ``NVGRE_ENCAP``
238741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
238841dd9a6bSDavid Young
238941dd9a6bSDavid YoungPerforms a NVGRE encapsulation action by encapsulating the matched flow in the
239041dd9a6bSDavid YoungNVGRE tunnel as defined in the``rte_flow_action_tunnel_encap`` flow item
239141dd9a6bSDavid Youngdefinition.
239241dd9a6bSDavid Young
239341dd9a6bSDavid YoungThis action modifies the payload of matched flows. The flow definition specified
239441dd9a6bSDavid Youngin the ``rte_flow_action_tunnel_encap`` action structure must defined a valid
239541dd9a6bSDavid YoungNVGRE network overlay which conforms with RFC 7637 (NVGRE: Network
239641dd9a6bSDavid YoungVirtualization Using Generic Routing Encapsulation). The pattern must be
239741dd9a6bSDavid Youngterminated with the RTE_FLOW_ITEM_TYPE_END item type.
239841dd9a6bSDavid Young
239941dd9a6bSDavid Young.. _table_rte_flow_action_nvgre_encap:
240041dd9a6bSDavid Young
240141dd9a6bSDavid Young.. table:: NVGRE_ENCAP
240241dd9a6bSDavid Young
240341dd9a6bSDavid Young   +----------------+-------------------------------------+
240441dd9a6bSDavid Young   | Field          | Value                               |
240541dd9a6bSDavid Young   +================+=====================================+
240641dd9a6bSDavid Young   | ``definition`` | NVGRE end-point overlay definition  |
240741dd9a6bSDavid Young   +----------------+-------------------------------------+
240841dd9a6bSDavid Young
240941dd9a6bSDavid Young.. _table_rte_flow_action_nvgre_encap_example:
241041dd9a6bSDavid Young
241141dd9a6bSDavid Young.. table:: IPv4 NVGRE flow pattern example.
241241dd9a6bSDavid Young
241341dd9a6bSDavid Young   +-------+----------+
241441dd9a6bSDavid Young   | Index | Item     |
241541dd9a6bSDavid Young   +=======+==========+
241641dd9a6bSDavid Young   | 0     | Ethernet |
241741dd9a6bSDavid Young   +-------+----------+
241841dd9a6bSDavid Young   | 1     | IPv4     |
241941dd9a6bSDavid Young   +-------+----------+
242041dd9a6bSDavid Young   | 2     | NVGRE    |
242141dd9a6bSDavid Young   +-------+----------+
242241dd9a6bSDavid Young   | 3     | END      |
242341dd9a6bSDavid Young   +-------+----------+
242441dd9a6bSDavid Young
242541dd9a6bSDavid YoungAction: ``NVGRE_DECAP``
242641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
242741dd9a6bSDavid Young
242841dd9a6bSDavid YoungPerforms a decapsulation action by stripping all headers of the NVGRE tunnel
242941dd9a6bSDavid Youngnetwork overlay from the matched flow.
243041dd9a6bSDavid Young
243141dd9a6bSDavid YoungThe flow items pattern defined for the flow rule with which a ``NVGRE_DECAP``
243241dd9a6bSDavid Youngaction is specified, must define a valid NVGRE tunnel as per RFC7637. If the
243341dd9a6bSDavid Youngflow pattern does not specify a valid NVGRE tunnel then a
243441dd9a6bSDavid YoungRTE_FLOW_ERROR_TYPE_ACTION error should be returned.
243541dd9a6bSDavid Young
243641dd9a6bSDavid YoungThis action modifies the payload of matched flows.
243741dd9a6bSDavid Young
243841dd9a6bSDavid YoungAction: ``RAW_ENCAP``
243941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^
244041dd9a6bSDavid Young
244141dd9a6bSDavid YoungAdds outer header whose template is provided in its data buffer,
244241dd9a6bSDavid Youngas defined in the ``rte_flow_action_raw_encap`` definition.
244341dd9a6bSDavid Young
244441dd9a6bSDavid YoungThis action modifies the payload of matched flows. The data supplied must
244541dd9a6bSDavid Youngbe a valid header, either holding layer 2 data in case of adding layer 2 after
244641dd9a6bSDavid Youngdecap layer 3 tunnel (for example MPLSoGRE) or complete tunnel definition
244741dd9a6bSDavid Youngstarting from layer 2 and moving to the tunnel item itself. When applied to
244841dd9a6bSDavid Youngthe original packet the resulting packet must be a valid packet.
244941dd9a6bSDavid Young
245041dd9a6bSDavid Young.. _table_rte_flow_action_raw_encap:
245141dd9a6bSDavid Young
245241dd9a6bSDavid Young.. table:: RAW_ENCAP
245341dd9a6bSDavid Young
245441dd9a6bSDavid Young   +----------------+----------------------------------------+
245541dd9a6bSDavid Young   | Field          | Value                                  |
245641dd9a6bSDavid Young   +================+========================================+
245741dd9a6bSDavid Young   | ``data``       | Encapsulation data                     |
245841dd9a6bSDavid Young   +----------------+----------------------------------------+
245941dd9a6bSDavid Young   | ``preserve``   | Bit-mask of data to preserve on output |
246041dd9a6bSDavid Young   +----------------+----------------------------------------+
246141dd9a6bSDavid Young   | ``size``       | Size of data and preserve              |
246241dd9a6bSDavid Young   +----------------+----------------------------------------+
246341dd9a6bSDavid Young
246441dd9a6bSDavid YoungAction: ``RAW_DECAP``
246541dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
246641dd9a6bSDavid Young
246741dd9a6bSDavid YoungRemove outer header whose template is provided in its data buffer,
246841dd9a6bSDavid Youngas defined in the ``rte_flow_action_raw_decap``
246941dd9a6bSDavid Young
247041dd9a6bSDavid YoungThis action modifies the payload of matched flows. The data supplied must
247141dd9a6bSDavid Youngbe a valid header, either holding layer 2 data in case of removing layer 2
247241dd9a6bSDavid Youngbefore encapsulation of layer 3 tunnel (for example MPLSoGRE) or complete
247341dd9a6bSDavid Youngtunnel definition starting from layer 2 and moving to the tunnel item itself.
247441dd9a6bSDavid YoungWhen applied to the original packet the resulting packet must be a
247541dd9a6bSDavid Youngvalid packet.
247641dd9a6bSDavid Young
247741dd9a6bSDavid Young.. _table_rte_flow_action_raw_decap:
247841dd9a6bSDavid Young
247941dd9a6bSDavid Young.. table:: RAW_DECAP
248041dd9a6bSDavid Young
248141dd9a6bSDavid Young   +----------------+----------------------------------------+
248241dd9a6bSDavid Young   | Field          | Value                                  |
248341dd9a6bSDavid Young   +================+========================================+
248441dd9a6bSDavid Young   | ``data``       | Decapsulation data                     |
248541dd9a6bSDavid Young   +----------------+----------------------------------------+
248641dd9a6bSDavid Young   | ``size``       | Size of data                           |
248741dd9a6bSDavid Young   +----------------+----------------------------------------+
248841dd9a6bSDavid Young
248941dd9a6bSDavid YoungAction: ``SET_IPV4_SRC``
249041dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^
249141dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
249241dd9a6bSDavid Young
249341dd9a6bSDavid YoungSet a new IPv4 source address in the outermost IPv4 header.
249441dd9a6bSDavid Young
249541dd9a6bSDavid YoungIt must be used with a valid RTE_FLOW_ITEM_TYPE_IPV4 flow pattern item.
249641dd9a6bSDavid YoungOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
249741dd9a6bSDavid Young
249841dd9a6bSDavid Young.. _table_rte_flow_action_set_ipv4_src:
249941dd9a6bSDavid Young
250041dd9a6bSDavid Young.. table:: SET_IPV4_SRC
250141dd9a6bSDavid Young
250241dd9a6bSDavid Young   +-----------------------------------------+
250341dd9a6bSDavid Young   | Field         | Value                   |
250441dd9a6bSDavid Young   +===============+=========================+
250541dd9a6bSDavid Young   | ``ipv4_addr`` | new IPv4 source address |
250641dd9a6bSDavid Young   +---------------+-------------------------+
250741dd9a6bSDavid Young
250841dd9a6bSDavid YoungAction: ``SET_IPV4_DST``
250941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^
251041dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
251141dd9a6bSDavid Young
251241dd9a6bSDavid YoungSet a new IPv4 destination address in the outermost IPv4 header.
251341dd9a6bSDavid Young
251441dd9a6bSDavid YoungIt must be used with a valid RTE_FLOW_ITEM_TYPE_IPV4 flow pattern item.
251541dd9a6bSDavid YoungOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
251641dd9a6bSDavid Young
251741dd9a6bSDavid Young.. _table_rte_flow_action_set_ipv4_dst:
251841dd9a6bSDavid Young
251941dd9a6bSDavid Young.. table:: SET_IPV4_DST
252041dd9a6bSDavid Young
252141dd9a6bSDavid Young   +---------------+------------------------------+
252241dd9a6bSDavid Young   | Field         | Value                        |
252341dd9a6bSDavid Young   +===============+==============================+
252441dd9a6bSDavid Young   | ``ipv4_addr`` | new IPv4 destination address |
252541dd9a6bSDavid Young   +---------------+------------------------------+
252641dd9a6bSDavid Young
252741dd9a6bSDavid YoungAction: ``SET_IPV6_SRC``
252841dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^
252941dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
253041dd9a6bSDavid Young
253141dd9a6bSDavid YoungSet a new IPv6 source address in the outermost IPv6 header.
253241dd9a6bSDavid Young
253341dd9a6bSDavid YoungIt must be used with a valid RTE_FLOW_ITEM_TYPE_IPV6 flow pattern item.
253441dd9a6bSDavid YoungOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
253541dd9a6bSDavid Young
253641dd9a6bSDavid Young.. _table_rte_flow_action_set_ipv6_src:
253741dd9a6bSDavid Young
253841dd9a6bSDavid Young.. table:: SET_IPV6_SRC
253941dd9a6bSDavid Young
254041dd9a6bSDavid Young   +---------------+-------------------------+
254141dd9a6bSDavid Young   | Field         | Value                   |
254241dd9a6bSDavid Young   +===============+=========================+
254341dd9a6bSDavid Young   | ``ipv6_addr`` | new IPv6 source address |
254441dd9a6bSDavid Young   +---------------+-------------------------+
254541dd9a6bSDavid Young
254641dd9a6bSDavid YoungAction: ``SET_IPV6_DST``
254741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^
254841dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
254941dd9a6bSDavid Young
255041dd9a6bSDavid YoungSet a new IPv6 destination address in the outermost IPv6 header.
255141dd9a6bSDavid Young
255241dd9a6bSDavid YoungIt must be used with a valid RTE_FLOW_ITEM_TYPE_IPV6 flow pattern item.
255341dd9a6bSDavid YoungOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
255441dd9a6bSDavid Young
255541dd9a6bSDavid Young.. _table_rte_flow_action_set_ipv6_dst:
255641dd9a6bSDavid Young
255741dd9a6bSDavid Young.. table:: SET_IPV6_DST
255841dd9a6bSDavid Young
255941dd9a6bSDavid Young   +---------------+------------------------------+
256041dd9a6bSDavid Young   | Field         | Value                        |
256141dd9a6bSDavid Young   +===============+==============================+
256241dd9a6bSDavid Young   | ``ipv6_addr`` | new IPv6 destination address |
256341dd9a6bSDavid Young   +---------------+------------------------------+
256441dd9a6bSDavid Young
256541dd9a6bSDavid YoungAction: ``IPV6_EXT_PUSH``
256641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^
256741dd9a6bSDavid Young
256841dd9a6bSDavid YoungAdd an IPv6 extension into IPv6 header.
256941dd9a6bSDavid YoungIts template is provided in its data buffer
257041dd9a6bSDavid Youngwith the specific type as defined in ``rte_flow_action_ipv6_ext_push``.
257141dd9a6bSDavid Young
257241dd9a6bSDavid YoungThis action modifies the payload of matched flows.
257341dd9a6bSDavid YoungThe data supplied must be a valid extension in the specified type,
257441dd9a6bSDavid Youngit should be added the last one if preceding extension existed.
257541dd9a6bSDavid YoungWhen applied to the original packet,
257641dd9a6bSDavid Youngthe resulting packet must be a valid packet.
257741dd9a6bSDavid Young
257841dd9a6bSDavid YoungAction: ``IPV6_EXT_REMOVE``
257941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^
258041dd9a6bSDavid Young
258141dd9a6bSDavid YoungRemove an IPv6 extension whose type is provided in
258241dd9a6bSDavid Young``rte_flow_action_ipv6_ext_remove``.
258341dd9a6bSDavid Young
258441dd9a6bSDavid YoungThis action modifies the payload of matched flow
258541dd9a6bSDavid Youngand the packet should be valid after removing.
258641dd9a6bSDavid Young
258741dd9a6bSDavid YoungAction: ``SET_TP_SRC``
258841dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^
258941dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
259041dd9a6bSDavid Young
259141dd9a6bSDavid YoungSet a new source port number in the outermost TCP/UDP header.
259241dd9a6bSDavid Young
259341dd9a6bSDavid YoungIt must be used with a valid RTE_FLOW_ITEM_TYPE_TCP or RTE_FLOW_ITEM_TYPE_UDP
259441dd9a6bSDavid Youngflow pattern item. Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
259541dd9a6bSDavid Young
259641dd9a6bSDavid Young.. _table_rte_flow_action_set_tp_src:
259741dd9a6bSDavid Young
259841dd9a6bSDavid Young.. table:: SET_TP_SRC
259941dd9a6bSDavid Young
260041dd9a6bSDavid Young   +----------+-------------------------+
260141dd9a6bSDavid Young   | Field    | Value                   |
260241dd9a6bSDavid Young   +==========+=========================+
260341dd9a6bSDavid Young   | ``port`` | new TCP/UDP source port |
260441dd9a6bSDavid Young   +---------------+--------------------+
260541dd9a6bSDavid Young
260641dd9a6bSDavid YoungAction: ``SET_TP_DST``
260741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^
260841dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
260941dd9a6bSDavid Young
261041dd9a6bSDavid YoungSet a new destination port number in the outermost TCP/UDP header.
261141dd9a6bSDavid Young
261241dd9a6bSDavid YoungIt must be used with a valid RTE_FLOW_ITEM_TYPE_TCP or RTE_FLOW_ITEM_TYPE_UDP
261341dd9a6bSDavid Youngflow pattern item. Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
261441dd9a6bSDavid Young
261541dd9a6bSDavid Young.. _table_rte_flow_action_set_tp_dst:
261641dd9a6bSDavid Young
261741dd9a6bSDavid Young.. table:: SET_TP_DST
261841dd9a6bSDavid Young
261941dd9a6bSDavid Young   +----------+------------------------------+
262041dd9a6bSDavid Young   | Field    | Value                        |
262141dd9a6bSDavid Young   +==========+==============================+
262241dd9a6bSDavid Young   | ``port`` | new TCP/UDP destination port |
262341dd9a6bSDavid Young   +---------------+-------------------------+
262441dd9a6bSDavid Young
262541dd9a6bSDavid YoungAction: ``MAC_SWAP``
262641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^
262741dd9a6bSDavid Young
262841dd9a6bSDavid YoungSwap the source and destination MAC addresses in the outermost Ethernet
262941dd9a6bSDavid Youngheader.
263041dd9a6bSDavid Young
263141dd9a6bSDavid YoungIt must be used with a valid RTE_FLOW_ITEM_TYPE_ETH flow pattern item.
263241dd9a6bSDavid YoungOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
263341dd9a6bSDavid Young
263441dd9a6bSDavid Young.. _table_rte_flow_action_mac_swap:
263541dd9a6bSDavid Young
263641dd9a6bSDavid Young.. table:: MAC_SWAP
263741dd9a6bSDavid Young
263841dd9a6bSDavid Young   +---------------+
263941dd9a6bSDavid Young   | Field         |
264041dd9a6bSDavid Young   +===============+
264141dd9a6bSDavid Young   | no properties |
264241dd9a6bSDavid Young   +---------------+
264341dd9a6bSDavid Young
264441dd9a6bSDavid YoungAction: ``DEC_TTL``
264541dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^
264641dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
264741dd9a6bSDavid Young
264841dd9a6bSDavid YoungDecrease TTL value.
264941dd9a6bSDavid Young
265041dd9a6bSDavid YoungIf there is no valid RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6
265141dd9a6bSDavid Youngin pattern, Some PMDs will reject rule because behavior will be undefined.
265241dd9a6bSDavid Young
265341dd9a6bSDavid Young.. _table_rte_flow_action_dec_ttl:
265441dd9a6bSDavid Young
265541dd9a6bSDavid Young.. table:: DEC_TTL
265641dd9a6bSDavid Young
265741dd9a6bSDavid Young   +---------------+
265841dd9a6bSDavid Young   | Field         |
265941dd9a6bSDavid Young   +===============+
266041dd9a6bSDavid Young   | no properties |
266141dd9a6bSDavid Young   +---------------+
266241dd9a6bSDavid Young
266341dd9a6bSDavid YoungAction: ``SET_TTL``
266441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^
266541dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
266641dd9a6bSDavid Young
266741dd9a6bSDavid YoungAssigns a new TTL value.
266841dd9a6bSDavid Young
266941dd9a6bSDavid YoungIf there is no valid RTE_FLOW_ITEM_TYPE_IPV4 or RTE_FLOW_ITEM_TYPE_IPV6
267041dd9a6bSDavid Youngin pattern, Some PMDs will reject rule because behavior will be undefined.
267141dd9a6bSDavid Young
267241dd9a6bSDavid Young.. _table_rte_flow_action_set_ttl:
267341dd9a6bSDavid Young
267441dd9a6bSDavid Young.. table:: SET_TTL
267541dd9a6bSDavid Young
267641dd9a6bSDavid Young   +---------------+--------------------+
267741dd9a6bSDavid Young   | Field         | Value              |
267841dd9a6bSDavid Young   +===============+====================+
267941dd9a6bSDavid Young   | ``ttl_value`` | new TTL value      |
268041dd9a6bSDavid Young   +---------------+--------------------+
268141dd9a6bSDavid Young
268241dd9a6bSDavid YoungAction: ``SET_MAC_SRC``
268341dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
268441dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
268541dd9a6bSDavid Young
268641dd9a6bSDavid YoungSet source MAC address.
268741dd9a6bSDavid Young
268841dd9a6bSDavid YoungIt must be used with a valid RTE_FLOW_ITEM_TYPE_ETH flow pattern item.
268941dd9a6bSDavid YoungOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
269041dd9a6bSDavid Young
269141dd9a6bSDavid Young.. _table_rte_flow_action_set_mac_src:
269241dd9a6bSDavid Young
269341dd9a6bSDavid Young.. table:: SET_MAC_SRC
269441dd9a6bSDavid Young
269541dd9a6bSDavid Young   +--------------+---------------+
269641dd9a6bSDavid Young   | Field        | Value         |
269741dd9a6bSDavid Young   +==============+===============+
269841dd9a6bSDavid Young   | ``mac_addr`` | MAC address   |
269941dd9a6bSDavid Young   +--------------+---------------+
270041dd9a6bSDavid Young
270141dd9a6bSDavid YoungAction: ``SET_MAC_DST``
270241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
270341dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
270441dd9a6bSDavid Young
270541dd9a6bSDavid YoungSet destination MAC address.
270641dd9a6bSDavid Young
270741dd9a6bSDavid YoungIt must be used with a valid RTE_FLOW_ITEM_TYPE_ETH flow pattern item.
270841dd9a6bSDavid YoungOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
270941dd9a6bSDavid Young
271041dd9a6bSDavid Young.. _table_rte_flow_action_set_mac_dst:
271141dd9a6bSDavid Young
271241dd9a6bSDavid Young.. table:: SET_MAC_DST
271341dd9a6bSDavid Young
271441dd9a6bSDavid Young   +--------------+---------------+
271541dd9a6bSDavid Young   | Field        | Value         |
271641dd9a6bSDavid Young   +==============+===============+
271741dd9a6bSDavid Young   | ``mac_addr`` | MAC address   |
271841dd9a6bSDavid Young   +--------------+---------------+
271941dd9a6bSDavid Young
272041dd9a6bSDavid YoungAction: ``INC_TCP_SEQ``
272141dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
272241dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
272341dd9a6bSDavid Young
272441dd9a6bSDavid YoungIncrease sequence number in the outermost TCP header.
272541dd9a6bSDavid YoungValue to increase TCP sequence number by is a big-endian 32 bit integer.
272641dd9a6bSDavid Young
272741dd9a6bSDavid YoungUsing this action on non-matching traffic will result in undefined behavior.
272841dd9a6bSDavid Young
272941dd9a6bSDavid YoungAction: ``DEC_TCP_SEQ``
273041dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
273141dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
273241dd9a6bSDavid Young
273341dd9a6bSDavid YoungDecrease sequence number in the outermost TCP header.
273441dd9a6bSDavid YoungValue to decrease TCP sequence number by is a big-endian 32 bit integer.
273541dd9a6bSDavid Young
273641dd9a6bSDavid YoungUsing this action on non-matching traffic will result in undefined behavior.
273741dd9a6bSDavid Young
273841dd9a6bSDavid YoungAction: ``INC_TCP_ACK``
273941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
274041dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
274141dd9a6bSDavid Young
274241dd9a6bSDavid YoungIncrease acknowledgment number in the outermost TCP header.
274341dd9a6bSDavid YoungValue to increase TCP acknowledgment number by is a big-endian 32 bit integer.
274441dd9a6bSDavid Young
274541dd9a6bSDavid YoungUsing this action on non-matching traffic will result in undefined behavior.
274641dd9a6bSDavid Young
274741dd9a6bSDavid YoungAction: ``DEC_TCP_ACK``
274841dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
274941dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
275041dd9a6bSDavid Young
275141dd9a6bSDavid YoungDecrease acknowledgment number in the outermost TCP header.
275241dd9a6bSDavid YoungValue to decrease TCP acknowledgment number by is a big-endian 32 bit integer.
275341dd9a6bSDavid Young
275441dd9a6bSDavid YoungUsing this action on non-matching traffic will result in undefined behavior.
275541dd9a6bSDavid Young
275641dd9a6bSDavid YoungAction: ``SET_TAG``
275741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^
275841dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
275941dd9a6bSDavid Young
276041dd9a6bSDavid YoungSet Tag.
276141dd9a6bSDavid Young
276241dd9a6bSDavid YoungTag is a transient data used during flow matching. This is not delivered to
276341dd9a6bSDavid Youngapplication. Multiple tags are supported by specifying index.
276441dd9a6bSDavid Young
276541dd9a6bSDavid Young.. _table_rte_flow_action_set_tag:
276641dd9a6bSDavid Young
276741dd9a6bSDavid Young.. table:: SET_TAG
276841dd9a6bSDavid Young
276941dd9a6bSDavid Young   +-----------+----------------------------+
277041dd9a6bSDavid Young   | Field     | Value                      |
277141dd9a6bSDavid Young   +===========+============================+
277241dd9a6bSDavid Young   | ``data``  | 32 bit tag value           |
277341dd9a6bSDavid Young   +-----------+----------------------------+
277441dd9a6bSDavid Young   | ``mask``  | bit-mask applies to "data" |
277541dd9a6bSDavid Young   +-----------+----------------------------+
277641dd9a6bSDavid Young   | ``index`` | index of tag to set        |
277741dd9a6bSDavid Young   +-----------+----------------------------+
277841dd9a6bSDavid Young
277941dd9a6bSDavid YoungAction: ``SET_META``
278041dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
278141dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
278241dd9a6bSDavid Young
278341dd9a6bSDavid YoungSet metadata. Item ``META`` matches metadata.
278441dd9a6bSDavid Young
278541dd9a6bSDavid YoungMetadata set by mbuf metadata field with RTE_MBUF_DYNFLAG_TX_METADATA flag on egress
278641dd9a6bSDavid Youngwill be overridden by this action. On ingress, the metadata will be carried by
278741dd9a6bSDavid Young``metadata`` dynamic field of ``rte_mbuf`` which can be accessed by
278841dd9a6bSDavid Young``RTE_FLOW_DYNF_METADATA()``. RTE_MBUF_DYNFLAG_RX_METADATA flag will be set along
278941dd9a6bSDavid Youngwith the data.
279041dd9a6bSDavid Young
279141dd9a6bSDavid YoungThe mbuf dynamic field must be registered by calling
279241dd9a6bSDavid Young``rte_flow_dynf_metadata_register()`` prior to use ``SET_META`` action.
279341dd9a6bSDavid Young
279441dd9a6bSDavid YoungAltering partial bits is supported with ``mask``. For bits which have never been
279541dd9a6bSDavid Youngset, unpredictable value will be seen depending on driver implementation. For
279641dd9a6bSDavid Youngloopback/hairpin packet, metadata set on Rx/Tx may or may not be propagated to
279741dd9a6bSDavid Youngthe other path depending on HW capability.
279841dd9a6bSDavid Young
279941dd9a6bSDavid YoungIn hairpin case with Tx explicit flow mode, metadata could (not mandatory) be
280041dd9a6bSDavid Youngused to connect the Rx and Tx flows if it can be propagated from Rx to Tx path.
280141dd9a6bSDavid Young
280241dd9a6bSDavid Young.. _table_rte_flow_action_set_meta:
280341dd9a6bSDavid Young
280441dd9a6bSDavid Young.. table:: SET_META
280541dd9a6bSDavid Young
280641dd9a6bSDavid Young   +----------+----------------------------+
280741dd9a6bSDavid Young   | Field    | Value                      |
280841dd9a6bSDavid Young   +==========+============================+
280941dd9a6bSDavid Young   | ``data`` | 32 bit metadata value      |
281041dd9a6bSDavid Young   +----------+----------------------------+
281141dd9a6bSDavid Young   | ``mask`` | bit-mask applies to "data" |
281241dd9a6bSDavid Young   +----------+----------------------------+
281341dd9a6bSDavid Young
281441dd9a6bSDavid YoungAction: ``SET_IPV4_DSCP``
281541dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^
281641dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
281741dd9a6bSDavid Young
281841dd9a6bSDavid YoungSet IPv4 DSCP.
281941dd9a6bSDavid Young
282041dd9a6bSDavid YoungModify DSCP in IPv4 header.
282141dd9a6bSDavid Young
282241dd9a6bSDavid YoungIt must be used with RTE_FLOW_ITEM_TYPE_IPV4 in pattern.
282341dd9a6bSDavid YoungOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
282441dd9a6bSDavid Young
282541dd9a6bSDavid Young.. _table_rte_flow_action_set_ipv4_dscp:
282641dd9a6bSDavid Young
282741dd9a6bSDavid Young.. table:: SET_IPV4_DSCP
282841dd9a6bSDavid Young
282941dd9a6bSDavid Young   +-----------+---------------------------------+
283041dd9a6bSDavid Young   | Field     | Value                           |
283141dd9a6bSDavid Young   +===========+=================================+
283241dd9a6bSDavid Young   | ``dscp``  | DSCP in low 6 bits, rest ignore |
283341dd9a6bSDavid Young   +-----------+---------------------------------+
283441dd9a6bSDavid Young
283541dd9a6bSDavid YoungAction: ``SET_IPV6_DSCP``
283641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^
283741dd9a6bSDavid YoungThis is a legacy action. Consider `Action: MODIFY_FIELD`_ as alternative.
283841dd9a6bSDavid Young
283941dd9a6bSDavid YoungSet IPv6 DSCP.
284041dd9a6bSDavid Young
284141dd9a6bSDavid YoungModify DSCP in IPv6 header.
284241dd9a6bSDavid Young
284341dd9a6bSDavid YoungIt must be used with RTE_FLOW_ITEM_TYPE_IPV6 in pattern.
284441dd9a6bSDavid YoungOtherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned.
284541dd9a6bSDavid Young
284641dd9a6bSDavid Young.. _table_rte_flow_action_set_ipv6_dscp:
284741dd9a6bSDavid Young
284841dd9a6bSDavid Young.. table:: SET_IPV6_DSCP
284941dd9a6bSDavid Young
285041dd9a6bSDavid Young   +-----------+---------------------------------+
285141dd9a6bSDavid Young   | Field     | Value                           |
285241dd9a6bSDavid Young   +===========+=================================+
285341dd9a6bSDavid Young   | ``dscp``  | DSCP in low 6 bits, rest ignore |
285441dd9a6bSDavid Young   +-----------+---------------------------------+
285541dd9a6bSDavid Young
285641dd9a6bSDavid YoungAction: ``NAT64``
285741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
285841dd9a6bSDavid Young
285941dd9a6bSDavid YoungThis action does header translation between IPv4 and IPv6.
286041dd9a6bSDavid YoungBesides converting the IP addresses,
286141dd9a6bSDavid Youngother fields in the IP header are handled as well.
286241dd9a6bSDavid YoungThe ``type`` field should be provided
286341dd9a6bSDavid Youngas defined in ``rte_flow_action_nat64`` when creating the action.
286441dd9a6bSDavid Young
286541dd9a6bSDavid YoungAction: ``AGE``
286641dd9a6bSDavid Young^^^^^^^^^^^^^^^
286741dd9a6bSDavid Young
286841dd9a6bSDavid YoungSet ageing timeout configuration to a flow.
286941dd9a6bSDavid Young
287041dd9a6bSDavid YoungEvent RTE_ETH_EVENT_FLOW_AGED will be reported if
287141dd9a6bSDavid Youngtimeout passed without any matching on the flow.
287241dd9a6bSDavid Young
287341dd9a6bSDavid Young.. _table_rte_flow_action_age:
287441dd9a6bSDavid Young
287541dd9a6bSDavid Young.. table:: AGE
287641dd9a6bSDavid Young
287741dd9a6bSDavid Young   +--------------+---------------------------------+
287841dd9a6bSDavid Young   | Field        | Value                           |
287941dd9a6bSDavid Young   +==============+=================================+
288041dd9a6bSDavid Young   | ``timeout``  | 24 bits timeout value           |
288141dd9a6bSDavid Young   +--------------+---------------------------------+
288241dd9a6bSDavid Young   | ``reserved`` | 8 bits reserved, must be zero   |
288341dd9a6bSDavid Young   +--------------+---------------------------------+
288441dd9a6bSDavid Young   | ``context``  | user input flow context         |
288541dd9a6bSDavid Young   +--------------+---------------------------------+
288641dd9a6bSDavid Young
288741dd9a6bSDavid YoungQuery structure to retrieve ageing status information of a
288841dd9a6bSDavid Youngshared AGE action, or a flow rule using the AGE action:
288941dd9a6bSDavid Young
289041dd9a6bSDavid Young.. _table_rte_flow_query_age:
289141dd9a6bSDavid Young
289241dd9a6bSDavid Young.. table:: AGE query
289341dd9a6bSDavid Young
289441dd9a6bSDavid Young   +------------------------------+-----+----------------------------------------+
289541dd9a6bSDavid Young   | Field                        | I/O | Value                                  |
289641dd9a6bSDavid Young   +==============================+=====+========================================+
289741dd9a6bSDavid Young   | ``aged``                     | out | Aging timeout expired                  |
289841dd9a6bSDavid Young   +------------------------------+-----+----------------------------------------+
289941dd9a6bSDavid Young   | ``sec_since_last_hit_valid`` | out | ``sec_since_last_hit`` value is valid  |
290041dd9a6bSDavid Young   +------------------------------+-----+----------------------------------------+
290141dd9a6bSDavid Young   | ``sec_since_last_hit``       | out | Seconds since last traffic hit         |
290241dd9a6bSDavid Young   +------------------------------+-----+----------------------------------------+
290341dd9a6bSDavid Young
290441dd9a6bSDavid YoungUpdate structure to modify the parameters of an indirect AGE action.
290541dd9a6bSDavid YoungThe update structure is used by ``rte_flow_action_handle_update()`` function.
290641dd9a6bSDavid Young
290741dd9a6bSDavid Young.. _table_rte_flow_update_age:
290841dd9a6bSDavid Young
290941dd9a6bSDavid Young.. table:: AGE update
291041dd9a6bSDavid Young
291141dd9a6bSDavid Young   +-------------------+--------------------------------------------------------------+
291241dd9a6bSDavid Young   | Field             | Value                                                        |
291341dd9a6bSDavid Young   +===================+==============================================================+
291441dd9a6bSDavid Young   | ``reserved``      | 6 bits reserved, must be zero                                |
291541dd9a6bSDavid Young   +-------------------+--------------------------------------------------------------+
291641dd9a6bSDavid Young   | ``timeout_valid`` | 1 bit, timeout value is valid                                |
291741dd9a6bSDavid Young   +-------------------+--------------------------------------------------------------+
291841dd9a6bSDavid Young   | ``timeout``       | 24 bits timeout value                                        |
291941dd9a6bSDavid Young   +-------------------+--------------------------------------------------------------+
292041dd9a6bSDavid Young   | ``touch``         | 1 bit, touch the AGE action to set ``sec_since_last_hit`` 0  |
292141dd9a6bSDavid Young   +-------------------+--------------------------------------------------------------+
292241dd9a6bSDavid Young
292341dd9a6bSDavid YoungAction: ``SAMPLE``
292441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^
292541dd9a6bSDavid Young
292641dd9a6bSDavid YoungAdds a sample action to a matched flow.
292741dd9a6bSDavid Young
292841dd9a6bSDavid YoungThe matching packets will be duplicated with the specified ``ratio`` and
292941dd9a6bSDavid Youngapplied with own set of actions with a fate action, the packets sampled
293041dd9a6bSDavid Youngequals is '1/ratio'. All the packets continue to the target destination.
293141dd9a6bSDavid Young
293241dd9a6bSDavid YoungWhen the ``ratio`` is set to 1 then the packets will be 100% mirrored.
293341dd9a6bSDavid Young``actions`` represent the different set of actions for the sampled or mirrored
293441dd9a6bSDavid Youngpackets, and must have a fate action.
293541dd9a6bSDavid Young
293641dd9a6bSDavid Young.. _table_rte_flow_action_sample:
293741dd9a6bSDavid Young
293841dd9a6bSDavid Young.. table:: SAMPLE
293941dd9a6bSDavid Young
294041dd9a6bSDavid Young   +--------------+---------------------------------+
294141dd9a6bSDavid Young   | Field        | Value                           |
294241dd9a6bSDavid Young   +==============+=================================+
294341dd9a6bSDavid Young   | ``ratio``    | 32 bits sample ratio value      |
294441dd9a6bSDavid Young   +--------------+---------------------------------+
294541dd9a6bSDavid Young   | ``actions``  | sub-action list for sampling    |
294641dd9a6bSDavid Young   +--------------+---------------------------------+
294741dd9a6bSDavid Young
294841dd9a6bSDavid YoungAction: ``INDIRECT``
294941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^
295041dd9a6bSDavid Young
295141dd9a6bSDavid YoungFlow utilize indirect action by handle as returned from
295241dd9a6bSDavid Young``rte_flow_action_handle_create()``.
295341dd9a6bSDavid Young
295441dd9a6bSDavid YoungThe behaviour of the indirect action defined by ``action`` argument of type
295541dd9a6bSDavid Young``struct rte_flow_action`` passed to ``rte_flow_action_handle_create()``.
295641dd9a6bSDavid Young
295741dd9a6bSDavid YoungThe indirect action can be used by a single flow or shared among multiple flows.
295841dd9a6bSDavid YoungThe indirect action can be in-place updated by ``rte_flow_action_handle_update()``
295941dd9a6bSDavid Youngwithout destroying flow and creating flow again. The fields that could be
296041dd9a6bSDavid Youngupdated depend on the type of the ``action`` and different for every type.
296141dd9a6bSDavid Young
296241dd9a6bSDavid YoungThe indirect action specified data (e.g. counter) can be queried by
296341dd9a6bSDavid Young``rte_flow_action_handle_query()``.
296441dd9a6bSDavid Young
296541dd9a6bSDavid Young.. warning::
296641dd9a6bSDavid Young
296741dd9a6bSDavid Young   The following description of indirect action persistence
296841dd9a6bSDavid Young   is an experimental behavior that may change without a prior notice.
296941dd9a6bSDavid Young
297041dd9a6bSDavid YoungIf ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is not advertised,
297141dd9a6bSDavid Youngindirect actions cannot be created until the device is started for the first time
297241dd9a6bSDavid Youngand cannot be kept when the device is stopped.
297341dd9a6bSDavid YoungHowever, PMD also does not flush them automatically on stop,
297441dd9a6bSDavid Youngso the application must call ``rte_flow_action_handle_destroy()``
297541dd9a6bSDavid Youngbefore stopping the device to ensure no indirect actions remain.
297641dd9a6bSDavid Young
297741dd9a6bSDavid YoungIf ``RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP`` is advertised,
297841dd9a6bSDavid Youngthis means that the PMD can keep at least some indirect actions
297941dd9a6bSDavid Youngacross device stop and start.
298041dd9a6bSDavid YoungHowever, ``rte_eth_dev_configure()`` may fail if any indirect actions remain,
298141dd9a6bSDavid Youngso the application must destroy them before attempting a reconfiguration.
298241dd9a6bSDavid YoungKeeping may be only supported for certain kinds of indirect actions.
298341dd9a6bSDavid YoungA kind is a combination of an action type and a value of its transfer bit.
298441dd9a6bSDavid YoungFor example: an indirect counter with the transfer bit reset.
298541dd9a6bSDavid YoungTo test if a particular kind of indirect actions is kept,
298641dd9a6bSDavid Youngthe application must try to create a valid indirect action of that kind
298741dd9a6bSDavid Youngwhen the device is not started (either before the first start of after a stop).
298841dd9a6bSDavid YoungIf it fails with an error of type ``RTE_FLOW_ERROR_TYPE_STATE``,
298941dd9a6bSDavid Youngapplication must destroy all indirect actions of this kind
299041dd9a6bSDavid Youngbefore stopping the device.
299141dd9a6bSDavid YoungIf it succeeds, all indirect actions of the same kind are kept
299241dd9a6bSDavid Youngwhen the device is stopped.
299341dd9a6bSDavid YoungIndirect actions of a kept kind that are created when the device is stopped,
299441dd9a6bSDavid Youngincluding the ones created for the test, will be kept after the device start.
299541dd9a6bSDavid Young
299641dd9a6bSDavid Young.. _table_rte_flow_action_handle:
299741dd9a6bSDavid Young
299841dd9a6bSDavid Young.. table:: INDIRECT
299941dd9a6bSDavid Young
300041dd9a6bSDavid Young   +---------------+
300141dd9a6bSDavid Young   | Field         |
300241dd9a6bSDavid Young   +===============+
300341dd9a6bSDavid Young   | no properties |
300441dd9a6bSDavid Young   +---------------+
300541dd9a6bSDavid Young
300641dd9a6bSDavid YoungAction: ``INDIRECT_LIST``
300741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^
300841dd9a6bSDavid Young
300941dd9a6bSDavid YoungIndirect API creates a shared flow action with unique action handle.
301041dd9a6bSDavid YoungFlow rules can access the shared flow action and resources related to
301141dd9a6bSDavid Youngthat action through the indirect action handle.
301241dd9a6bSDavid YoungIn addition, the API allows to update existing shared flow action configuration.
301341dd9a6bSDavid YoungAfter the update completes, new action configuration
301441dd9a6bSDavid Youngis available to all flows that reference that shared action.
301541dd9a6bSDavid Young
301641dd9a6bSDavid YoungIndirect actions list expands the indirect action API:
301741dd9a6bSDavid Young
301841dd9a6bSDavid Young- Indirect action list creates a handle for one or several
301941dd9a6bSDavid Young  flow actions, while legacy indirect action handle references
302041dd9a6bSDavid Young  single action only.
302141dd9a6bSDavid Young  Input flow actions arranged in END terminated list.
302241dd9a6bSDavid Young
302341dd9a6bSDavid Young- Flow rule can provide rule specific configuration parameters to
302441dd9a6bSDavid Young  existing shared handle.
302541dd9a6bSDavid Young  Updates of flow rule specific configuration will not change the base
302641dd9a6bSDavid Young  action configuration.
302741dd9a6bSDavid Young  Base action configuration was set during the action creation.
302841dd9a6bSDavid Young
302941dd9a6bSDavid YoungIndirect action list handle defines 2 types of resources:
303041dd9a6bSDavid Young
303141dd9a6bSDavid Young- Mutable handle resource can be changed during handle lifespan.
303241dd9a6bSDavid Young
303341dd9a6bSDavid Young- Immutable handle resource value is set during handle creation
303441dd9a6bSDavid Young  and cannot be changed.
303541dd9a6bSDavid Young
303641dd9a6bSDavid YoungThere are 2 types of mutable indirect handle contexts:
303741dd9a6bSDavid Young
303841dd9a6bSDavid Young- Action mutable context is always shared between all flows
303941dd9a6bSDavid Young  that referenced indirect actions list handle.
304041dd9a6bSDavid Young  Action mutable context can be changed by explicit invocation
304141dd9a6bSDavid Young  of indirect handle update function.
304241dd9a6bSDavid Young
304341dd9a6bSDavid Young- Flow mutable context is private to a flow.
304441dd9a6bSDavid Young  Flow mutable context can be updated by indirect list handle
304541dd9a6bSDavid Young  flow rule configuration.
304641dd9a6bSDavid Young
304741dd9a6bSDavid YoungIndirect action types - immutable, action / flow mutable, are mutually
304841dd9a6bSDavid Youngexclusive and depend on the action definition.
304941dd9a6bSDavid Young
305041dd9a6bSDavid YoungIf indirect list handle was created from a list of actions A1 / A2 ... An / END
305141dd9a6bSDavid Youngindirect list flow action can update Ai flow mutable context in the
305241dd9a6bSDavid Youngaction configuration parameter.
305341dd9a6bSDavid YoungIndirect list action configuration is and array [C1, C2,  .., Cn]
305441dd9a6bSDavid Youngwhere Ci corresponds to Ai in the action handle source.
305541dd9a6bSDavid YoungCi configuration element points Ai flow mutable update, or it's NULL
305641dd9a6bSDavid Youngif Ai has no flow mutable update.
305741dd9a6bSDavid YoungIndirect list action configuration is NULL if the action has no flow mutable updates.
305841dd9a6bSDavid YoungOtherwise it points to an array of n flow mutable configuration pointers.
305941dd9a6bSDavid Young
306041dd9a6bSDavid Young**Template API:**
306141dd9a6bSDavid Young
306241dd9a6bSDavid Young*Action template format:*
306341dd9a6bSDavid Young
306441dd9a6bSDavid Young``template .. indirect_list handle Htmpl conf Ctmpl ..``
306541dd9a6bSDavid Young
306641dd9a6bSDavid Young``mask     .. indirect_list handle Hmask conf Cmask ..``
306741dd9a6bSDavid Young
306841dd9a6bSDavid Young- If Htmpl was masked (Hmask != 0), it will be fixed in that template.
306941dd9a6bSDavid Young  Otherwise, indirect action value is set in a flow rule.
307041dd9a6bSDavid Young
307141dd9a6bSDavid Young- If Htmpl and Ctmpl[i] were masked (Hmask !=0 and Cmask[i] != 0),
307241dd9a6bSDavid Young  Htmpl's Ai action flow mutable context fill be updated to
307341dd9a6bSDavid Young  Ctmpl[i] values and will be fixed in that template.
307441dd9a6bSDavid Young
307541dd9a6bSDavid Young*Flow rule format:*
307641dd9a6bSDavid Young
307741dd9a6bSDavid Young``actions .. indirect_list handle Hflow conf Cflow ..``
307841dd9a6bSDavid Young
307941dd9a6bSDavid Young- If Htmpl was not masked in actions template, Hflow references an
308041dd9a6bSDavid Young  action of the same type as Htmpl.
308141dd9a6bSDavid Young
308241dd9a6bSDavid Young- Cflow[i] updates handle's Ai flow mutable configuration if
308341dd9a6bSDavid Young  the Ci was not masked in action template.
308441dd9a6bSDavid Young
308541dd9a6bSDavid Young.. _table_rte_flow_action_indirect_list:
308641dd9a6bSDavid Young
308741dd9a6bSDavid Young.. table:: INDIRECT_LIST
308841dd9a6bSDavid Young
308941dd9a6bSDavid Young   +------------------+----------------------------------+
309041dd9a6bSDavid Young   | Field            | Value                            |
309141dd9a6bSDavid Young   +==================+==================================+
309241dd9a6bSDavid Young   | ``handle``       | Indirect action list handle      |
309341dd9a6bSDavid Young   +------------------+----------------------------------+
309441dd9a6bSDavid Young   | ``conf``         | Flow mutable configuration array |
309541dd9a6bSDavid Young   +------------------+----------------------------------+
309641dd9a6bSDavid Young
309741dd9a6bSDavid Young.. code-block:: text
309841dd9a6bSDavid Young
309941dd9a6bSDavid Young   flow 1:
310041dd9a6bSDavid Young    / indirect handle H conf C1 /
310141dd9a6bSDavid Young                      |       |
310241dd9a6bSDavid Young                      |       |
310341dd9a6bSDavid Young                      |       |         flow 2:
310441dd9a6bSDavid Young                      |       |         / indirect handle H conf C2 /
310541dd9a6bSDavid Young                      |       |                           |      |
310641dd9a6bSDavid Young                      |       |                           |      |
310741dd9a6bSDavid Young                      |       |                           |      |
310841dd9a6bSDavid Young              =========================================================
310941dd9a6bSDavid Young              ^       |       |                           |      |
311041dd9a6bSDavid Young              |       |       V                           |      V
311141dd9a6bSDavid Young              |    ~~~~~~~~~~~~~~                      ~~~~~~~~~~~~~~~
311241dd9a6bSDavid Young              |     flow mutable                        flow mutable
311341dd9a6bSDavid Young              |     context 1                           context 2
311441dd9a6bSDavid Young              |    ~~~~~~~~~~~~~~                      ~~~~~~~~~~~~~~~
311541dd9a6bSDavid Young    indirect  |       |                                   |
311641dd9a6bSDavid Young    action    |       |                                   |
311741dd9a6bSDavid Young    context   |       V                                   V
311841dd9a6bSDavid Young              |   -----------------------------------------------------
311941dd9a6bSDavid Young              |                 action mutable context
312041dd9a6bSDavid Young              |   -----------------------------------------------------
312141dd9a6bSDavid Young              v                action immutable context
312241dd9a6bSDavid Young              =========================================================
312341dd9a6bSDavid Young
312441dd9a6bSDavid YoungAction: ``MODIFY_FIELD``
312541dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^
312641dd9a6bSDavid Young
312741dd9a6bSDavid YoungModify ``dst`` field according to ``op`` selected (set, addition,
312841dd9a6bSDavid Youngsubtraction) with ``width`` bits of data from ``src`` field.
312941dd9a6bSDavid Young
313041dd9a6bSDavid YoungAny arbitrary header field (as well as mark, metadata or tag values)
313141dd9a6bSDavid Youngcan be used as both source and destination fields as set by ``field``.
313241dd9a6bSDavid YoungThe immediate value ``RTE_FLOW_FIELD_VALUE`` (or a pointer to it
313341dd9a6bSDavid Young``RTE_FLOW_FIELD_POINTER``) is allowed as a source only.
313441dd9a6bSDavid Young``RTE_FLOW_FIELD_START`` is used to point to the beginning of a packet.
313541dd9a6bSDavid YoungSee ``enum rte_flow_field_id`` for the list of supported fields.
313641dd9a6bSDavid Young
313741dd9a6bSDavid Young``op`` selects the operation to perform on a destination field:
313841dd9a6bSDavid Young
313941dd9a6bSDavid Young- ``set`` copies the data from ``src`` field to ``dst`` field.
314041dd9a6bSDavid Young- ``add`` adds together ``dst`` and ``src`` and stores the result into ``dst``.
314141dd9a6bSDavid Young- ``sub`` subtracts ``src`` from ``dst`` and stores the result into ``dst``.
314241dd9a6bSDavid Young
314341dd9a6bSDavid Young``width`` defines a number of bits to use from ``src`` field.
314441dd9a6bSDavid Young
314541dd9a6bSDavid Young``level`` is used to access any packet field on any encapsulation level:
314641dd9a6bSDavid Young
314741dd9a6bSDavid Young- ``0`` means the default behaviour. Depending on the packet type,
314841dd9a6bSDavid Young  it can mean outermost, innermost or anything in between.
314941dd9a6bSDavid Young- ``1`` requests access to the outermost packet encapsulation level.
315041dd9a6bSDavid Young- ``2`` and subsequent values requests access to the specified packet
315141dd9a6bSDavid Young  encapsulation level, from outermost to innermost (lower to higher values).
315241dd9a6bSDavid Young
315341dd9a6bSDavid Young``tag_index`` is the index of the header inside encapsulation level.
315441dd9a6bSDavid YoungIt is used to modify either ``VLAN`` or ``MPLS`` or ``TAG`` headers
315541dd9a6bSDavid Youngwhich multiple of them might be supported in the same encapsulation level.
315641dd9a6bSDavid Young
315741dd9a6bSDavid Young.. note::
315841dd9a6bSDavid Young
315941dd9a6bSDavid Young   For ``RTE_FLOW_FIELD_TAG`` type, the tag array was provided in ``level``
316041dd9a6bSDavid Young   field and it is still supported for backwards compatibility.
316141dd9a6bSDavid Young   When ``tag_index`` is zero, the tag array is taken from ``level`` field.
316241dd9a6bSDavid Young
316341dd9a6bSDavid Young``type`` is used to specify (along with ``class_id``) the Geneve option
316441dd9a6bSDavid Youngwhich is being modified.
316541dd9a6bSDavid YoungThis field is relevant only for ``RTE_FLOW_FIELD_GENEVE_OPT_XXXX`` type.
316641dd9a6bSDavid Young
316741dd9a6bSDavid Young``class_id`` is used to specify (along with ``type``) the Geneve option
316841dd9a6bSDavid Youngwhich is being modified.
316941dd9a6bSDavid YoungThis field is relevant only for ``RTE_FLOW_FIELD_GENEVE_OPT_XXXX`` type.
317041dd9a6bSDavid Young
317141dd9a6bSDavid Young``flex_handle`` is used to specify the flex item pointer which is being
317241dd9a6bSDavid Youngmodified. ``flex_handle`` and ``level`` are mutually exclusive.
317341dd9a6bSDavid Young
317441dd9a6bSDavid Young``offset`` specifies the number of bits to skip from a field's start.
317541dd9a6bSDavid YoungThat allows performing a partial copy of the needed part or to divide a big
317641dd9a6bSDavid Youngpacket field into multiple smaller fields. Alternatively, ``offset`` allows
317741dd9a6bSDavid Younggoing past the specified packet field boundary to copy a field to an
317841dd9a6bSDavid Youngarbitrary place in a packet, essentially providing a way to copy any part of
317941dd9a6bSDavid Younga packet to any other part of it.
318041dd9a6bSDavid Young
318141dd9a6bSDavid Young``value`` sets an immediate value to be used as a source or points to a
318241dd9a6bSDavid Younglocation of the value in memory. It is used instead of ``level`` and ``offset``
318341dd9a6bSDavid Youngfor ``RTE_FLOW_FIELD_VALUE`` and ``RTE_FLOW_FIELD_POINTER`` respectively.
318441dd9a6bSDavid YoungThe data in memory should be presented exactly in the same byte order and
318541dd9a6bSDavid Younglength as in the relevant flow item, i.e. data for field with type
318641dd9a6bSDavid Young``RTE_FLOW_FIELD_MAC_DST`` should follow the conventions of ``dst`` field
318741dd9a6bSDavid Youngin ``rte_flow_item_eth`` structure, with type ``RTE_FLOW_FIELD_IPV6_SRC`` -
318841dd9a6bSDavid Young``rte_flow_item_ipv6`` conventions, and so on. If the field size is larger than
318941dd9a6bSDavid Young16 bytes the pattern can be provided as pointer only.
319041dd9a6bSDavid Young
319141dd9a6bSDavid YoungThe bitfield extracted from the memory being applied as second operation
319241dd9a6bSDavid Youngparameter is defined by action width and by the destination field offset.
319341dd9a6bSDavid YoungApplication should provide the data in immediate value memory (either as
319441dd9a6bSDavid Youngbuffer or by pointer) exactly as item field without any applied explicit offset,
319541dd9a6bSDavid Youngand destination packet field (with specified width and bit offset) will be
319641dd9a6bSDavid Youngreplaced by immediate source bits from the same bit offset. For example,
319741dd9a6bSDavid Youngto replace the third byte of MAC address with value 0x85, application should
319841dd9a6bSDavid Youngspecify destination width as 8, destination offset as 16, and provide immediate
319941dd9a6bSDavid Youngvalue as sequence of bytes {xxx, xxx, 0x85, xxx, xxx, xxx}.
320041dd9a6bSDavid Young
320141dd9a6bSDavid YoungThe ``RTE_FLOW_FIELD_GENEVE_OPT_DATA`` type supports modifying only one DW in
320241dd9a6bSDavid Youngsingle action and align to 32 bits.
320341dd9a6bSDavid YoungFor example, for modifying 16 bits start from offset 24,
320441dd9a6bSDavid Young2 different actions should be prepared.
320541dd9a6bSDavid YoungThe first one includes ``offset=24`` and ``width=8``,
320641dd9a6bSDavid Youngand the second one includes ``offset=32`` and ``width=8``.
320741dd9a6bSDavid YoungApplication should provide the data in immediate value memory only
320841dd9a6bSDavid Youngfor the single DW even though the offset is related to start of first DW.
320941dd9a6bSDavid YoungFor example, to replace the third byte of second DW in Geneve option data
321041dd9a6bSDavid Youngwith value ``0x85``, the application should specify destination width as ``8``,
321141dd9a6bSDavid Youngdestination offset as ``48``, and provide immediate value ``0xXXXX85XX``.
321241dd9a6bSDavid Young
321341dd9a6bSDavid Young.. _table_rte_flow_action_modify_field:
321441dd9a6bSDavid Young
321541dd9a6bSDavid Young.. table:: MODIFY_FIELD
321641dd9a6bSDavid Young
321741dd9a6bSDavid Young   +---------------+-------------------------+
321841dd9a6bSDavid Young   | Field         | Value                   |
321941dd9a6bSDavid Young   +===============+=========================+
322041dd9a6bSDavid Young   | ``op``        | operation to perform    |
322141dd9a6bSDavid Young   +---------------+-------------------------+
322241dd9a6bSDavid Young   | ``dst``       | destination field       |
322341dd9a6bSDavid Young   +---------------+-------------------------+
322441dd9a6bSDavid Young   | ``src``       | source field            |
322541dd9a6bSDavid Young   +---------------+-------------------------+
322641dd9a6bSDavid Young   | ``width``     | number of bits to use   |
322741dd9a6bSDavid Young   +---------------+-------------------------+
322841dd9a6bSDavid Young
322941dd9a6bSDavid Young.. _table_rte_flow_field_data:
323041dd9a6bSDavid Young
323141dd9a6bSDavid Young.. table:: destination/source field definition
323241dd9a6bSDavid Young
323341dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
323441dd9a6bSDavid Young   | Field           | Value                                                    |
323541dd9a6bSDavid Young   +=================+==========================================================+
323641dd9a6bSDavid Young   | ``field``       | ID: packet field, mark, meta, tag, immediate, pointer    |
323741dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
323841dd9a6bSDavid Young   | ``level``       | encapsulation level of a packet field                    |
323941dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
324041dd9a6bSDavid Young   | ``tag_index``   | tag index inside encapsulation level                     |
324141dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
324241dd9a6bSDavid Young   | ``type``        | Geneve option type                                       |
324341dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
324441dd9a6bSDavid Young   | ``class_id``    | Geneve option class ID                                   |
324541dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
324641dd9a6bSDavid Young   | ``flex_handle`` | flex item handle of a packet field                       |
324741dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
324841dd9a6bSDavid Young   | ``offset``      | number of bits to skip at the beginning                  |
324941dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
325041dd9a6bSDavid Young   | ``value``       | immediate value buffer (source field only, not           |
325141dd9a6bSDavid Young   |                 | applicable to destination) for RTE_FLOW_FIELD_VALUE      |
325241dd9a6bSDavid Young   |                 | field type                                               |
325341dd9a6bSDavid Young   |                 | This field is only 16 bytes, maybe not big enough for    |
325441dd9a6bSDavid Young   |                 | all NICs' flex item                                      |
325541dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
325641dd9a6bSDavid Young   | ``pvalue``      | pointer to immediate value data (source field only, not  |
325741dd9a6bSDavid Young   |                 | applicable to destination) for RTE_FLOW_FIELD_POINTER    |
325841dd9a6bSDavid Young   |                 | field type                                               |
325941dd9a6bSDavid Young   +-----------------+----------------------------------------------------------+
326041dd9a6bSDavid Young
326141dd9a6bSDavid YoungAction: ``CONNTRACK``
326241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^
326341dd9a6bSDavid Young
326441dd9a6bSDavid YoungCreate a conntrack (connection tracking) context with the provided information.
326541dd9a6bSDavid Young
326641dd9a6bSDavid YoungIn stateful session like TCP, the conntrack action provides the ability to
326741dd9a6bSDavid Youngexamine every packet of this connection and associate the state to every
326841dd9a6bSDavid Youngpacket. It will help to realize the stateful offload of connections with little
326941dd9a6bSDavid Youngsoftware participation. For example, the packets with invalid state may be
327041dd9a6bSDavid Younghandled by the software. The control packets could be handled in the hardware.
327141dd9a6bSDavid YoungThe software just need to query the state of a connection when needed, and then
327241dd9a6bSDavid Youngdecide how to handle the flow rules and conntrack context.
327341dd9a6bSDavid Young
327441dd9a6bSDavid YoungA conntrack context should be created via ``rte_flow_action_handle_create()``
327541dd9a6bSDavid Youngbefore using. Then the handle with ``INDIRECT`` type is used for a flow rule
327641dd9a6bSDavid Youngcreation. If a flow rule with an opposite direction needs to be created, the
327741dd9a6bSDavid Young``rte_flow_action_handle_update()`` should be used to modify the direction.
327841dd9a6bSDavid Young
327941dd9a6bSDavid YoungNot all the fields of the ``struct rte_flow_action_conntrack`` will be used
328041dd9a6bSDavid Youngfor a conntrack context creating, depending on the HW, and they should be
328141dd9a6bSDavid Youngin host byte order. PMD should convert them into network byte order when
328241dd9a6bSDavid Youngneeded by the HW.
328341dd9a6bSDavid Young
328441dd9a6bSDavid YoungThe ``struct rte_flow_modify_conntrack`` should be used for an updating.
328541dd9a6bSDavid Young
328641dd9a6bSDavid YoungThe current conntrack context information could be queried via the
328741dd9a6bSDavid Young``rte_flow_action_handle_query()`` interface.
328841dd9a6bSDavid Young
328941dd9a6bSDavid Young.. _table_rte_flow_action_conntrack:
329041dd9a6bSDavid Young
329141dd9a6bSDavid Young.. table:: CONNTRACK
329241dd9a6bSDavid Young
329341dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
329441dd9a6bSDavid Young   | Field                    | Value                                                       |
329541dd9a6bSDavid Young   +==========================+=============================================================+
329641dd9a6bSDavid Young   | ``peer_port``            | peer port number                                            |
329741dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
329841dd9a6bSDavid Young   | ``is_original_dir``      | direction of this connection for creating flow rule         |
329941dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
330041dd9a6bSDavid Young   | ``enable``               | enable the conntrack context                                |
330141dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
330241dd9a6bSDavid Young   | ``live_connection``      | one ack was seen for this connection                        |
330341dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
330441dd9a6bSDavid Young   | ``selective_ack``        | SACK enabled                                                |
330541dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
330641dd9a6bSDavid Young   | ``challenge_ack_passed`` | a challenge ack has passed                                  |
330741dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
330841dd9a6bSDavid Young   | ``last_direction``       | direction of the last passed packet                         |
330941dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
331041dd9a6bSDavid Young   | ``liberal_mode``         | only report state change                                    |
331141dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
331241dd9a6bSDavid Young   | ``state``                | current state                                               |
331341dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
331441dd9a6bSDavid Young   | ``max_ack_window``       | maximal window scaling factor                               |
331541dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
331641dd9a6bSDavid Young   | ``retransmission_limit`` | maximal retransmission times                                |
331741dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
331841dd9a6bSDavid Young   | ``original_dir``         | TCP parameters of the original direction                    |
331941dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
332041dd9a6bSDavid Young   | ``reply_dir``            | TCP parameters of the reply direction                       |
332141dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
332241dd9a6bSDavid Young   | ``last_window``          | window size of the last passed packet                       |
332341dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
332441dd9a6bSDavid Young   | ``last_seq``             | sequence number of the last passed packet                   |
332541dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
332641dd9a6bSDavid Young   | ``last_ack``             | acknowledgment number the last passed packet                |
332741dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
332841dd9a6bSDavid Young   | ``last_end``             | sum of ack number and length of the last passed packet      |
332941dd9a6bSDavid Young   +--------------------------+-------------------------------------------------------------+
333041dd9a6bSDavid Young
333141dd9a6bSDavid Young.. _table_rte_flow_tcp_dir_param:
333241dd9a6bSDavid Young
333341dd9a6bSDavid Young.. table:: configuration parameters for each direction
333441dd9a6bSDavid Young
333541dd9a6bSDavid Young   +---------------------+---------------------------------------------------------+
333641dd9a6bSDavid Young   | Field               | Value                                                   |
333741dd9a6bSDavid Young   +=====================+=========================================================+
333841dd9a6bSDavid Young   | ``scale``           | TCP window scaling factor                               |
333941dd9a6bSDavid Young   +---------------------+---------------------------------------------------------+
334041dd9a6bSDavid Young   | ``close_initiated`` | FIN sent from this direction                            |
334141dd9a6bSDavid Young   +---------------------+---------------------------------------------------------+
334241dd9a6bSDavid Young   | ``last_ack_seen``   | an ACK packet received                                  |
334341dd9a6bSDavid Young   +---------------------+---------------------------------------------------------+
334441dd9a6bSDavid Young   | ``data_unacked``    | unacknowledged data for packets from this direction     |
334541dd9a6bSDavid Young   +---------------------+---------------------------------------------------------+
334641dd9a6bSDavid Young   | ``sent_end``        | max{seq + len} seen in sent packets                     |
334741dd9a6bSDavid Young   +---------------------+---------------------------------------------------------+
334841dd9a6bSDavid Young   | ``reply_end``       | max{sack + max{win, 1}} seen in reply packets           |
334941dd9a6bSDavid Young   +---------------------+---------------------------------------------------------+
335041dd9a6bSDavid Young   | ``max_win``         | max{max{win, 1}} + {sack - ack} seen in sent packets    |
335141dd9a6bSDavid Young   +---------------------+---------------------------------------------------------+
335241dd9a6bSDavid Young   | ``max_ack``         | max{ack} + seen in sent packets                         |
335341dd9a6bSDavid Young   +---------------------+---------------------------------------------------------+
335441dd9a6bSDavid Young
335541dd9a6bSDavid Young.. _table_rte_flow_modify_conntrack:
335641dd9a6bSDavid Young
335741dd9a6bSDavid Young.. table:: update a conntrack context
335841dd9a6bSDavid Young
335941dd9a6bSDavid Young   +----------------+-------------------------------------------------+
336041dd9a6bSDavid Young   | Field          | Value                                           |
336141dd9a6bSDavid Young   +================+=================================================+
336241dd9a6bSDavid Young   | ``new_ct``     | new conntrack information                       |
336341dd9a6bSDavid Young   +----------------+-------------------------------------------------+
336441dd9a6bSDavid Young   | ``direction``  | direction will be updated                       |
336541dd9a6bSDavid Young   +----------------+-------------------------------------------------+
336641dd9a6bSDavid Young   | ``state``      | other fields except direction will be updated   |
336741dd9a6bSDavid Young   +----------------+-------------------------------------------------+
336841dd9a6bSDavid Young   | ``reserved``   | reserved bits                                   |
336941dd9a6bSDavid Young   +----------------+-------------------------------------------------+
337041dd9a6bSDavid Young
337141dd9a6bSDavid YoungAction: ``METER_COLOR``
337241dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^
337341dd9a6bSDavid Young
337441dd9a6bSDavid YoungColor the packet to reflect the meter color result.
337541dd9a6bSDavid Young
337641dd9a6bSDavid YoungThe meter action must be configured before meter color action.
337741dd9a6bSDavid YoungMeter color action is set to a color to reflect the meter color result.
337841dd9a6bSDavid YoungSet the meter color in the mbuf to the selected color.
337941dd9a6bSDavid YoungThe meter color action output color is the output color of the packet,
338041dd9a6bSDavid Youngwhich is set in the packet meta-data (i.e. struct ``rte_mbuf::sched::color``)
338141dd9a6bSDavid Young
338241dd9a6bSDavid Young.. _table_rte_flow_action_meter_color:
338341dd9a6bSDavid Young
338441dd9a6bSDavid Young.. table:: METER_COLOR
338541dd9a6bSDavid Young
338641dd9a6bSDavid Young   +-----------------+--------------+
338741dd9a6bSDavid Young   | Field           | Value        |
338841dd9a6bSDavid Young   +=================+==============+
338941dd9a6bSDavid Young   | ``meter_color`` | Packet color |
339041dd9a6bSDavid Young   +-----------------+--------------+
339141dd9a6bSDavid Young
339241dd9a6bSDavid YoungAction: ``PORT_REPRESENTOR``
339341dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^^
339441dd9a6bSDavid Young
339541dd9a6bSDavid YoungAt embedded switch level, send matching traffic to the given ethdev.
339641dd9a6bSDavid Young
339741dd9a6bSDavid YoungTerm **ethdev** and the concept of **port representor** are synonymous.
339841dd9a6bSDavid YoungThe **represented port** is an *entity* plugged to the embedded switch
339941dd9a6bSDavid Youngat the opposite end of the "wire" leading to the ethdev.
340041dd9a6bSDavid Young
340141dd9a6bSDavid Young::
340241dd9a6bSDavid Young
340341dd9a6bSDavid Young    .--------------------.
340441dd9a6bSDavid Young    |  PORT_REPRESENTOR  |  Ethdev (Application Port Referred to by its ID)
340541dd9a6bSDavid Young    '--------------------'
340641dd9a6bSDavid Young              /\
340741dd9a6bSDavid Young              ||
340841dd9a6bSDavid Young      .----------------.
340941dd9a6bSDavid Young      |  Logical Port  |
341041dd9a6bSDavid Young      '----------------'
341141dd9a6bSDavid Young              /\
341241dd9a6bSDavid Young              ||
341341dd9a6bSDavid Young              ||
341441dd9a6bSDavid Young              ||
341541dd9a6bSDavid Young         .----------.       .--------------------.
341641dd9a6bSDavid Young         |  Switch  |  <==  |  Matching Traffic  |
341741dd9a6bSDavid Young         '----------'       '--------------------'
341841dd9a6bSDavid Young              :
341941dd9a6bSDavid Young               :
342041dd9a6bSDavid Young              :
342141dd9a6bSDavid Young               :
342241dd9a6bSDavid Young      .----------------.
342341dd9a6bSDavid Young      |  Logical Port  |
342441dd9a6bSDavid Young      '----------------'
342541dd9a6bSDavid Young              :
342641dd9a6bSDavid Young               :
342741dd9a6bSDavid Young    .--------------------.
342841dd9a6bSDavid Young    |  REPRESENTED_PORT  |  Net / Guest / Another Ethdev (Same Application)
342941dd9a6bSDavid Young    '--------------------'
343041dd9a6bSDavid Young
343141dd9a6bSDavid Young
343241dd9a6bSDavid Young- Requires `Attribute: Transfer`_.
343341dd9a6bSDavid Young
343441dd9a6bSDavid Young.. _table_rte_flow_action_ethdev:
343541dd9a6bSDavid Young
343641dd9a6bSDavid Young.. table:: ``struct rte_flow_action_ethdev``
343741dd9a6bSDavid Young
343841dd9a6bSDavid Young   +-------------+----------------+
343941dd9a6bSDavid Young   | Field       | Value          |
344041dd9a6bSDavid Young   +=============+================+
344141dd9a6bSDavid Young   | ``port_id`` | ethdev port ID |
344241dd9a6bSDavid Young   +-------------+----------------+
344341dd9a6bSDavid Young
344441dd9a6bSDavid YoungSee also `Item: PORT_REPRESENTOR`_.
344541dd9a6bSDavid Young
344641dd9a6bSDavid YoungAction: ``REPRESENTED_PORT``
344741dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^^
344841dd9a6bSDavid Young
344941dd9a6bSDavid YoungAt embedded switch level, send matching traffic to
345041dd9a6bSDavid Youngthe entity represented by the given ethdev.
345141dd9a6bSDavid Young
345241dd9a6bSDavid YoungTerm **ethdev** and the concept of **port representor** are synonymous.
345341dd9a6bSDavid YoungThe **represented port** is an *entity* plugged to the embedded switch
345441dd9a6bSDavid Youngat the opposite end of the "wire" leading to the ethdev.
345541dd9a6bSDavid Young
345641dd9a6bSDavid Young::
345741dd9a6bSDavid Young
345841dd9a6bSDavid Young    .--------------------.
345941dd9a6bSDavid Young    |  PORT_REPRESENTOR  |  Ethdev (Application Port Referred to by its ID)
346041dd9a6bSDavid Young    '--------------------'
346141dd9a6bSDavid Young              :
346241dd9a6bSDavid Young               :
346341dd9a6bSDavid Young      .----------------.
346441dd9a6bSDavid Young      |  Logical Port  |
346541dd9a6bSDavid Young      '----------------'
346641dd9a6bSDavid Young              :
346741dd9a6bSDavid Young               :
346841dd9a6bSDavid Young              :
346941dd9a6bSDavid Young               :
347041dd9a6bSDavid Young         .----------.       .--------------------.
347141dd9a6bSDavid Young         |  Switch  |  <==  |  Matching Traffic  |
347241dd9a6bSDavid Young         '----------'       '--------------------'
347341dd9a6bSDavid Young              ||
347441dd9a6bSDavid Young              ||
347541dd9a6bSDavid Young              ||
347641dd9a6bSDavid Young              \/
347741dd9a6bSDavid Young      .----------------.
347841dd9a6bSDavid Young      |  Logical Port  |
347941dd9a6bSDavid Young      '----------------'
348041dd9a6bSDavid Young              ||
348141dd9a6bSDavid Young              \/
348241dd9a6bSDavid Young    .--------------------.
348341dd9a6bSDavid Young    |  REPRESENTED_PORT  |  Net / Guest / Another Ethdev (Same Application)
348441dd9a6bSDavid Young    '--------------------'
348541dd9a6bSDavid Young
348641dd9a6bSDavid Young
348741dd9a6bSDavid Young- Requires `Attribute: Transfer`_.
348841dd9a6bSDavid Young
348941dd9a6bSDavid YoungThis action is meant to use the same structure as `Action: PORT_REPRESENTOR`_.
349041dd9a6bSDavid Young
349141dd9a6bSDavid YoungSee also `Item: REPRESENTED_PORT`_.
349241dd9a6bSDavid Young
349341dd9a6bSDavid YoungAction: ``METER_MARK``
349441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^
349541dd9a6bSDavid Young
349641dd9a6bSDavid YoungMeters a packet stream and marks its packets with colors.
349741dd9a6bSDavid Young
349841dd9a6bSDavid YoungUnlike the ``METER`` action, policing is optional and may be
349941dd9a6bSDavid Youngperformed later with the help of the ``METER_COLOR`` item.
350041dd9a6bSDavid YoungThe profile and/or policy objects have to be created
350141dd9a6bSDavid Youngusing the rte_mtr_profile_add()/rte_mtr_policy_add() API.
350241dd9a6bSDavid YoungPointers to these objects are used as action parameters
350341dd9a6bSDavid Youngand need to be retrieved using the rte_mtr_profile_get() API
350441dd9a6bSDavid Youngand rte_mtr_policy_get() API respectively.
350541dd9a6bSDavid Young
350641dd9a6bSDavid Young.. _table_rte_flow_action_meter_mark:
350741dd9a6bSDavid Young
350841dd9a6bSDavid Young.. table:: METER_MARK
350941dd9a6bSDavid Young
351041dd9a6bSDavid Young   +------------------+----------------------+
351141dd9a6bSDavid Young   | Field            | Value                |
351241dd9a6bSDavid Young   +==================+======================+
351341dd9a6bSDavid Young   | ``profile``      | Meter profile object |
351441dd9a6bSDavid Young   +------------------+----------------------+
351541dd9a6bSDavid Young   | ``policy``       | Meter policy object  |
351641dd9a6bSDavid Young   +------------------+----------------------+
351741dd9a6bSDavid Young
351841dd9a6bSDavid YoungAction: ``QUOTA``
351941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
352041dd9a6bSDavid Young
352141dd9a6bSDavid YoungUpdate ``quota`` value and set packet quota state.
352241dd9a6bSDavid Young
352341dd9a6bSDavid YoungIf the ``quota`` value after update is non-negative,
352441dd9a6bSDavid Youngthe packet quota state is set to ``RTE_FLOW_QUOTA_STATE_PASS``.
352541dd9a6bSDavid YoungOtherwise, the packet quota state is set to ``RTE_FLOW_QUOTA_STATE_BLOCK``.
352641dd9a6bSDavid Young
352741dd9a6bSDavid YoungThe ``quota`` value is reduced according to ``mode`` setting.
352841dd9a6bSDavid Young
352941dd9a6bSDavid Young.. _table_rte_flow_action_quota:
353041dd9a6bSDavid Young
353141dd9a6bSDavid Young.. table:: QUOTA
353241dd9a6bSDavid Young
353341dd9a6bSDavid Young   +------------------+------------------------+
353441dd9a6bSDavid Young   | Field            | Value                  |
353541dd9a6bSDavid Young   +==================+========================+
353641dd9a6bSDavid Young   | ``mode``         | Quota operational mode |
353741dd9a6bSDavid Young   +------------------+------------------------+
353841dd9a6bSDavid Young   | ``quota``        | Quota value            |
353941dd9a6bSDavid Young   +------------------+------------------------+
354041dd9a6bSDavid Young
354141dd9a6bSDavid Young.. _rte_flow_quota_mode:
354241dd9a6bSDavid Young
354341dd9a6bSDavid Young.. table:: Quota update modes
354441dd9a6bSDavid Young
354541dd9a6bSDavid Young   +---------------------------------+-------------------------------------+
354641dd9a6bSDavid Young   | Value                           | Description                         |
354741dd9a6bSDavid Young   +=================================+=====================================+
354841dd9a6bSDavid Young   | ``RTE_FLOW_QUOTA_MODE_PACKET``  | Count packets                       |
354941dd9a6bSDavid Young   +---------------------------------+-------------------------------------+
355041dd9a6bSDavid Young   | ``RTE_FLOW_QUOTA_MODE_L2``      | Count packet bytes starting from L2 |
355141dd9a6bSDavid Young   +------------------+----------------------------------------------------+
355241dd9a6bSDavid Young   | ``RTE_FLOW_QUOTA_MODE_L3``      | Count packet bytes starting from L3 |
355341dd9a6bSDavid Young   +------------------+----------------------------------------------------+
355441dd9a6bSDavid Young
355541dd9a6bSDavid YoungAction: ``SEND_TO_KERNEL``
355641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^
355741dd9a6bSDavid Young
355841dd9a6bSDavid YoungSend packets to the kernel, without going to userspace at all.
355941dd9a6bSDavid Young
356041dd9a6bSDavid YoungThe packets will be received by the kernel driver sharing the same device
356141dd9a6bSDavid Youngas the DPDK port on which this action is configured.
356241dd9a6bSDavid Young
356341dd9a6bSDavid YoungNegative types
356441dd9a6bSDavid Young~~~~~~~~~~~~~~
356541dd9a6bSDavid Young
356641dd9a6bSDavid YoungAll specified pattern items (``enum rte_flow_item_type``) and actions
356741dd9a6bSDavid Young(``enum rte_flow_action_type``) use positive identifiers.
356841dd9a6bSDavid Young
356941dd9a6bSDavid YoungThe negative space is reserved for dynamic types generated by PMDs during
357041dd9a6bSDavid Youngrun-time. PMDs may encounter them as a result but must not accept negative
357141dd9a6bSDavid Youngidentifiers they are not aware of.
357241dd9a6bSDavid Young
357341dd9a6bSDavid YoungA method to generate them remains to be defined.
357441dd9a6bSDavid Young
357541dd9a6bSDavid YoungApplication may use PMD dynamic items or actions in flow rules. In that case
357641dd9a6bSDavid Youngsize of configuration object in dynamic element must be a pointer size.
357741dd9a6bSDavid Young
357841dd9a6bSDavid YoungRules management
357941dd9a6bSDavid Young----------------
358041dd9a6bSDavid Young
358141dd9a6bSDavid YoungA rather simple API with few functions is provided to fully manage flow
358241dd9a6bSDavid Youngrules.
358341dd9a6bSDavid Young
358441dd9a6bSDavid YoungEach created flow rule is associated with an opaque, PMD-specific handle
358541dd9a6bSDavid Youngpointer. The application is responsible for keeping it until the rule is
358641dd9a6bSDavid Youngdestroyed.
358741dd9a6bSDavid Young
358841dd9a6bSDavid YoungFlows rules are represented by ``struct rte_flow`` objects.
358941dd9a6bSDavid Young
359041dd9a6bSDavid YoungValidation
359141dd9a6bSDavid Young~~~~~~~~~~
359241dd9a6bSDavid Young
359341dd9a6bSDavid YoungGiven that expressing a definite set of device capabilities is not
359441dd9a6bSDavid Youngpractical, a dedicated function is provided to check if a flow rule is
359541dd9a6bSDavid Youngsupported and can be created.
359641dd9a6bSDavid Young
359741dd9a6bSDavid Young.. code-block:: c
359841dd9a6bSDavid Young
359941dd9a6bSDavid Young   int
360041dd9a6bSDavid Young   rte_flow_validate(uint16_t port_id,
360141dd9a6bSDavid Young                     const struct rte_flow_attr *attr,
360241dd9a6bSDavid Young                     const struct rte_flow_item pattern[],
360341dd9a6bSDavid Young                     const struct rte_flow_action actions[],
360441dd9a6bSDavid Young                     struct rte_flow_error *error);
360541dd9a6bSDavid Young
360641dd9a6bSDavid YoungThe flow rule is validated for correctness and whether it could be accepted
360741dd9a6bSDavid Youngby the device given sufficient resources. The rule is checked against the
360841dd9a6bSDavid Youngcurrent device mode and queue configuration. The flow rule may also
360941dd9a6bSDavid Youngoptionally be validated against existing flow rules and device resources.
361041dd9a6bSDavid YoungThis function has no effect on the target device.
361141dd9a6bSDavid Young
361241dd9a6bSDavid YoungThe returned value is guaranteed to remain valid only as long as no
361341dd9a6bSDavid Youngsuccessful calls to ``rte_flow_create()`` or ``rte_flow_destroy()`` are made
361441dd9a6bSDavid Youngin the meantime and no device parameter affecting flow rules in any way are
361541dd9a6bSDavid Youngmodified, due to possible collisions or resource limitations (although in
361641dd9a6bSDavid Youngsuch cases ``EINVAL`` should not be returned).
361741dd9a6bSDavid Young
361841dd9a6bSDavid YoungArguments:
361941dd9a6bSDavid Young
362041dd9a6bSDavid Young- ``port_id``: port identifier of Ethernet device.
362141dd9a6bSDavid Young- ``attr``: flow rule attributes.
362241dd9a6bSDavid Young- ``pattern``: pattern specification (list terminated by the END pattern
362341dd9a6bSDavid Young  item).
362441dd9a6bSDavid Young- ``actions``: associated actions (list terminated by the END action).
362541dd9a6bSDavid Young- ``error``: perform verbose error reporting if not NULL. PMDs initialize
362641dd9a6bSDavid Young  this structure in case of error only.
362741dd9a6bSDavid Young
362841dd9a6bSDavid YoungReturn values:
362941dd9a6bSDavid Young
363041dd9a6bSDavid Young- 0 if flow rule is valid and can be created. A negative errno value
363141dd9a6bSDavid Young  otherwise (``rte_errno`` is also set), the following errors are defined.
363241dd9a6bSDavid Young- ``-ENOSYS``: underlying device does not support this functionality.
363341dd9a6bSDavid Young- ``-EINVAL``: unknown or invalid rule specification.
363441dd9a6bSDavid Young- ``-ENOTSUP``: valid but unsupported rule specification (e.g. partial
363541dd9a6bSDavid Young  bit-masks are unsupported).
363641dd9a6bSDavid Young- ``EEXIST``: collision with an existing rule. Only returned if device
363741dd9a6bSDavid Young  supports flow rule collision checking and there was a flow rule
363841dd9a6bSDavid Young  collision. Not receiving this return code is no guarantee that creating
363941dd9a6bSDavid Young  the rule will not fail due to a collision.
364041dd9a6bSDavid Young- ``ENOMEM``: not enough memory to execute the function, or if the device
364141dd9a6bSDavid Young  supports resource validation, resource limitation on the device.
364241dd9a6bSDavid Young- ``-EBUSY``: action cannot be performed due to busy device resources, may
364341dd9a6bSDavid Young  succeed if the affected queues or even the entire port are in a stopped
364441dd9a6bSDavid Young  state (see ``rte_eth_dev_rx_queue_stop()`` and ``rte_eth_dev_stop()``).
364541dd9a6bSDavid Young
364641dd9a6bSDavid YoungCreation
364741dd9a6bSDavid Young~~~~~~~~
364841dd9a6bSDavid Young
364941dd9a6bSDavid YoungCreating a flow rule is similar to validating one, except the rule is
365041dd9a6bSDavid Youngactually created and a handle returned.
365141dd9a6bSDavid Young
365241dd9a6bSDavid Young.. code-block:: c
365341dd9a6bSDavid Young
365441dd9a6bSDavid Young   struct rte_flow *
365541dd9a6bSDavid Young   rte_flow_create(uint16_t port_id,
365641dd9a6bSDavid Young                   const struct rte_flow_attr *attr,
365741dd9a6bSDavid Young                   const struct rte_flow_item pattern[],
365841dd9a6bSDavid Young                   const struct rte_flow_action *actions[],
365941dd9a6bSDavid Young                   struct rte_flow_error *error);
366041dd9a6bSDavid Young
366141dd9a6bSDavid YoungArguments:
366241dd9a6bSDavid Young
366341dd9a6bSDavid Young- ``port_id``: port identifier of Ethernet device.
366441dd9a6bSDavid Young- ``attr``: flow rule attributes.
366541dd9a6bSDavid Young- ``pattern``: pattern specification (list terminated by the END pattern
366641dd9a6bSDavid Young  item).
366741dd9a6bSDavid Young- ``actions``: associated actions (list terminated by the END action).
366841dd9a6bSDavid Young- ``error``: perform verbose error reporting if not NULL. PMDs initialize
366941dd9a6bSDavid Young  this structure in case of error only.
367041dd9a6bSDavid Young
367141dd9a6bSDavid YoungReturn values:
367241dd9a6bSDavid Young
367341dd9a6bSDavid YoungA valid handle in case of success, NULL otherwise and ``rte_errno`` is set
367441dd9a6bSDavid Youngto the positive version of one of the error codes defined for
367541dd9a6bSDavid Young``rte_flow_validate()``.
367641dd9a6bSDavid Young
367741dd9a6bSDavid YoungDestruction
367841dd9a6bSDavid Young~~~~~~~~~~~
367941dd9a6bSDavid Young
368041dd9a6bSDavid YoungFlow rules destruction is not automatic, and a queue or a port should not be
368141dd9a6bSDavid Youngreleased if any are still attached to them. Applications must take care of
368241dd9a6bSDavid Youngperforming this step before releasing resources.
368341dd9a6bSDavid Young
368441dd9a6bSDavid Young.. code-block:: c
368541dd9a6bSDavid Young
368641dd9a6bSDavid Young   int
368741dd9a6bSDavid Young   rte_flow_destroy(uint16_t port_id,
368841dd9a6bSDavid Young                    struct rte_flow *flow,
368941dd9a6bSDavid Young                    struct rte_flow_error *error);
369041dd9a6bSDavid Young
369141dd9a6bSDavid Young
369241dd9a6bSDavid YoungFailure to destroy a flow rule handle may occur when other flow rules depend
369341dd9a6bSDavid Youngon it, and destroying it would result in an inconsistent state.
369441dd9a6bSDavid Young
369541dd9a6bSDavid YoungThis function is only guaranteed to succeed if handles are destroyed in
369641dd9a6bSDavid Youngreverse order of their creation.
369741dd9a6bSDavid Young
369841dd9a6bSDavid YoungArguments:
369941dd9a6bSDavid Young
370041dd9a6bSDavid Young- ``port_id``: port identifier of Ethernet device.
370141dd9a6bSDavid Young- ``flow``: flow rule handle to destroy.
370241dd9a6bSDavid Young- ``error``: perform verbose error reporting if not NULL. PMDs initialize
370341dd9a6bSDavid Young  this structure in case of error only.
370441dd9a6bSDavid Young
370541dd9a6bSDavid YoungReturn values:
370641dd9a6bSDavid Young
370741dd9a6bSDavid Young- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
370841dd9a6bSDavid Young
370941dd9a6bSDavid YoungUpdate
371041dd9a6bSDavid Young~~~~~~
371141dd9a6bSDavid Young
371241dd9a6bSDavid YoungUpdate an existing flow rule with a new set of actions.
371341dd9a6bSDavid Young
371441dd9a6bSDavid Young.. code-block:: c
371541dd9a6bSDavid Young
371641dd9a6bSDavid Young   struct rte_flow *
371741dd9a6bSDavid Young   rte_flow_actions_update(uint16_t port_id,
371841dd9a6bSDavid Young                           struct rte_flow *flow,
371941dd9a6bSDavid Young                           const struct rte_flow_action *actions[],
372041dd9a6bSDavid Young                           struct rte_flow_error *error);
372141dd9a6bSDavid Young
372241dd9a6bSDavid YoungArguments:
372341dd9a6bSDavid Young
372441dd9a6bSDavid Young- ``port_id``: port identifier of Ethernet device.
372541dd9a6bSDavid Young- ``flow``: flow rule handle to update.
372641dd9a6bSDavid Young- ``actions``: associated actions (list terminated by the END action).
372741dd9a6bSDavid Young- ``error``: perform verbose error reporting if not NULL. PMDs initialize
372841dd9a6bSDavid Young  this structure in case of error only.
372941dd9a6bSDavid Young
373041dd9a6bSDavid YoungReturn values:
373141dd9a6bSDavid Young
373241dd9a6bSDavid Young- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
373341dd9a6bSDavid Young
373441dd9a6bSDavid YoungFlush
373541dd9a6bSDavid Young~~~~~
373641dd9a6bSDavid Young
373741dd9a6bSDavid YoungConvenience function to destroy all flow rule handles associated with a
373841dd9a6bSDavid Youngport. They are released as with successive calls to ``rte_flow_destroy()``.
373941dd9a6bSDavid Young
374041dd9a6bSDavid Young.. code-block:: c
374141dd9a6bSDavid Young
374241dd9a6bSDavid Young   int
374341dd9a6bSDavid Young   rte_flow_flush(uint16_t port_id,
374441dd9a6bSDavid Young                  struct rte_flow_error *error);
374541dd9a6bSDavid Young
374641dd9a6bSDavid YoungIn the unlikely event of failure, handles are still considered destroyed and
374741dd9a6bSDavid Youngno longer valid but the port must be assumed to be in an inconsistent state.
374841dd9a6bSDavid Young
374941dd9a6bSDavid YoungArguments:
375041dd9a6bSDavid Young
375141dd9a6bSDavid Young- ``port_id``: port identifier of Ethernet device.
375241dd9a6bSDavid Young- ``error``: perform verbose error reporting if not NULL. PMDs initialize
375341dd9a6bSDavid Young  this structure in case of error only.
375441dd9a6bSDavid Young
375541dd9a6bSDavid YoungReturn values:
375641dd9a6bSDavid Young
375741dd9a6bSDavid Young- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
375841dd9a6bSDavid Young
375941dd9a6bSDavid YoungQuery
376041dd9a6bSDavid Young~~~~~
376141dd9a6bSDavid Young
376241dd9a6bSDavid YoungQuery an existing flow rule.
376341dd9a6bSDavid Young
376441dd9a6bSDavid YoungThis function allows retrieving flow-specific data such as counters. Data
376541dd9a6bSDavid Youngis gathered by special actions which must be present in the flow rule
376641dd9a6bSDavid Youngdefinition.
376741dd9a6bSDavid Young
376841dd9a6bSDavid Young.. code-block:: c
376941dd9a6bSDavid Young
377041dd9a6bSDavid Young   int
377141dd9a6bSDavid Young   rte_flow_query(uint16_t port_id,
377241dd9a6bSDavid Young                  struct rte_flow *flow,
377341dd9a6bSDavid Young                  const struct rte_flow_action *action,
377441dd9a6bSDavid Young                  void *data,
377541dd9a6bSDavid Young                  struct rte_flow_error *error);
377641dd9a6bSDavid Young
377741dd9a6bSDavid YoungArguments:
377841dd9a6bSDavid Young
377941dd9a6bSDavid Young- ``port_id``: port identifier of Ethernet device.
378041dd9a6bSDavid Young- ``flow``: flow rule handle to query.
378141dd9a6bSDavid Young- ``action``: action to query, this must match prototype from flow rule.
378241dd9a6bSDavid Young- ``data``: pointer to storage for the associated query data type.
378341dd9a6bSDavid Young- ``error``: perform verbose error reporting if not NULL. PMDs initialize
378441dd9a6bSDavid Young  this structure in case of error only.
378541dd9a6bSDavid Young
378641dd9a6bSDavid YoungReturn values:
378741dd9a6bSDavid Young
378841dd9a6bSDavid Young- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
378941dd9a6bSDavid Young
379041dd9a6bSDavid YoungFlow engine configuration
379141dd9a6bSDavid Young-------------------------
379241dd9a6bSDavid Young
379341dd9a6bSDavid YoungConfigure flow API management.
379441dd9a6bSDavid Young
379541dd9a6bSDavid YoungAn application may provide some parameters at the initialization phase about
379641dd9a6bSDavid Youngrules engine configuration and/or expected flow rules characteristics.
379741dd9a6bSDavid YoungThese parameters may be used by PMD to preallocate resources and configure NIC.
379841dd9a6bSDavid Young
379941dd9a6bSDavid YoungConfiguration
380041dd9a6bSDavid Young~~~~~~~~~~~~~
380141dd9a6bSDavid Young
380241dd9a6bSDavid YoungThis function performs the flow API engine configuration and allocates
380341dd9a6bSDavid Youngrequested resources beforehand to avoid costly allocations later.
380441dd9a6bSDavid YoungExpected number of resources in an application allows PMD to prepare
380541dd9a6bSDavid Youngand optimize NIC hardware configuration and memory layout in advance.
380641dd9a6bSDavid Young``rte_flow_configure()`` must be called before any flow rule is created,
380741dd9a6bSDavid Youngbut after an Ethernet device is configured.
380841dd9a6bSDavid YoungIt also creates flow queues for asynchronous flow rules operations via
380941dd9a6bSDavid Youngqueue-based API, see `Asynchronous operations`_ section.
381041dd9a6bSDavid Young
381141dd9a6bSDavid Young.. code-block:: c
381241dd9a6bSDavid Young
381341dd9a6bSDavid Young   int
381441dd9a6bSDavid Young   rte_flow_configure(uint16_t port_id,
381541dd9a6bSDavid Young                      const struct rte_flow_port_attr *port_attr,
381641dd9a6bSDavid Young                      uint16_t nb_queue,
381741dd9a6bSDavid Young                      const struct rte_flow_queue_attr *queue_attr[],
381841dd9a6bSDavid Young                      struct rte_flow_error *error);
381941dd9a6bSDavid Young
382041dd9a6bSDavid YoungInformation about the number of available resources can be retrieved via
382141dd9a6bSDavid Young``rte_flow_info_get()`` API.
382241dd9a6bSDavid Young
382341dd9a6bSDavid Young.. code-block:: c
382441dd9a6bSDavid Young
382541dd9a6bSDavid Young   int
382641dd9a6bSDavid Young   rte_flow_info_get(uint16_t port_id,
382741dd9a6bSDavid Young                     struct rte_flow_port_info *port_info,
382841dd9a6bSDavid Young                     struct rte_flow_queue_info *queue_info,
382941dd9a6bSDavid Young                     struct rte_flow_error *error);
383041dd9a6bSDavid Young
383141dd9a6bSDavid YoungGroup Miss Actions
383241dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~
383341dd9a6bSDavid Young
383441dd9a6bSDavid YoungIn an application, many flow rules share common group attributes, meaning they can be grouped and
383541dd9a6bSDavid Youngclassified together. A user can explicitly specify a set of actions performed on a packet when it
383641dd9a6bSDavid Youngdid not match any flows rules in a group using the following API:
383741dd9a6bSDavid Young
383841dd9a6bSDavid Young.. code-block:: c
383941dd9a6bSDavid Young
384041dd9a6bSDavid Young      int
384141dd9a6bSDavid Young      rte_flow_group_set_miss_actions(uint16_t port_id,
384241dd9a6bSDavid Young                                      uint32_t group_id,
384341dd9a6bSDavid Young                                      const struct rte_flow_group_attr *attr,
384441dd9a6bSDavid Young                                      const struct rte_flow_action actions[],
384541dd9a6bSDavid Young                                      struct rte_flow_error *error);
384641dd9a6bSDavid Young
384741dd9a6bSDavid YoungFor example, to configure a RTE_FLOW_TYPE_JUMP action as a miss action for ingress group 1:
384841dd9a6bSDavid Young
384941dd9a6bSDavid Young.. code-block:: c
385041dd9a6bSDavid Young
385141dd9a6bSDavid Young      struct rte_flow_group_attr attr = {.ingress = 1};
385241dd9a6bSDavid Young      struct rte_flow_action act[] = {
385341dd9a6bSDavid Young      /* Setting miss actions to jump to group 3 */
385441dd9a6bSDavid Young          [0] = {.type = RTE_FLOW_ACTION_TYPE_JUMP,
385541dd9a6bSDavid Young                 .conf = &(struct rte_flow_action_jump){.group = 3}},
385641dd9a6bSDavid Young          [1] = {.type = RTE_FLOW_ACTION_TYPE_END},
385741dd9a6bSDavid Young      };
385841dd9a6bSDavid Young      struct rte_flow_error err;
385941dd9a6bSDavid Young      rte_flow_group_set_miss_actions(port, 1, &attr, act, &err);
386041dd9a6bSDavid Young
3861*16158f34SShani Peretz.. _flow_templates:
3862*16158f34SShani Peretz
386341dd9a6bSDavid YoungFlow templates
386441dd9a6bSDavid Young~~~~~~~~~~~~~~
386541dd9a6bSDavid Young
386641dd9a6bSDavid YoungOftentimes in an application, many flow rules share a common structure
386741dd9a6bSDavid Young(the same pattern and/or action list) so they can be grouped and classified
386841dd9a6bSDavid Youngtogether. This knowledge may be used as a source of optimization by a PMD/HW.
386941dd9a6bSDavid YoungThe flow rule creation is done by selecting a table, a pattern template
387041dd9a6bSDavid Youngand an actions template (which are bound to the table), and setting unique
387141dd9a6bSDavid Youngvalues for the items and actions. This API is not thread-safe.
387241dd9a6bSDavid Young
387341dd9a6bSDavid YoungPattern templates
387441dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
387541dd9a6bSDavid Young
387641dd9a6bSDavid YoungThe pattern template defines a common pattern (the item mask) without values.
387741dd9a6bSDavid YoungThe mask value is used to select a field to match on, spec/last are ignored.
387841dd9a6bSDavid YoungThe pattern template may be used by multiple tables and must not be destroyed
387941dd9a6bSDavid Younguntil all these tables are destroyed first.
388041dd9a6bSDavid Young
388141dd9a6bSDavid Young.. code-block:: c
388241dd9a6bSDavid Young
388341dd9a6bSDavid Young   struct rte_flow_pattern_template *
388441dd9a6bSDavid Young   rte_flow_pattern_template_create(uint16_t port_id,
388541dd9a6bSDavid Young       const struct rte_flow_pattern_template_attr *template_attr,
388641dd9a6bSDavid Young       const struct rte_flow_item pattern[],
388741dd9a6bSDavid Young       struct rte_flow_error *error);
388841dd9a6bSDavid Young
388941dd9a6bSDavid YoungFor example, to create a pattern template to match on the destination MAC:
389041dd9a6bSDavid Young
389141dd9a6bSDavid Young.. code-block:: c
389241dd9a6bSDavid Young
389341dd9a6bSDavid Young   const struct rte_flow_pattern_template_attr attr = {.ingress = 1};
389441dd9a6bSDavid Young   struct rte_flow_item_eth eth_m = {
3895e0d947a1SFerruh Yigit       .dst.addr_bytes = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
389641dd9a6bSDavid Young   };
389741dd9a6bSDavid Young   struct rte_flow_item pattern[] = {
389841dd9a6bSDavid Young       [0] = {.type = RTE_FLOW_ITEM_TYPE_ETH,
389941dd9a6bSDavid Young              .mask = &eth_m},
390041dd9a6bSDavid Young       [1] = {.type = RTE_FLOW_ITEM_TYPE_END,},
390141dd9a6bSDavid Young   };
390241dd9a6bSDavid Young   struct rte_flow_error err;
390341dd9a6bSDavid Young
390441dd9a6bSDavid Young   struct rte_flow_pattern_template *pattern_template =
390541dd9a6bSDavid Young           rte_flow_pattern_template_create(port, &attr, &pattern, &err);
390641dd9a6bSDavid Young
390741dd9a6bSDavid YoungThe concrete value to match on will be provided at the rule creation.
390841dd9a6bSDavid Young
390941dd9a6bSDavid YoungActions templates
391041dd9a6bSDavid Young^^^^^^^^^^^^^^^^^
391141dd9a6bSDavid Young
391241dd9a6bSDavid YoungThe actions template holds a list of action types to be used in flow rules.
391341dd9a6bSDavid YoungThe mask parameter allows specifying a shared constant value for every rule.
391441dd9a6bSDavid YoungThe actions template may be used by multiple tables and must not be destroyed
391541dd9a6bSDavid Younguntil all these tables are destroyed first.
391641dd9a6bSDavid Young
391741dd9a6bSDavid Young.. code-block:: c
391841dd9a6bSDavid Young
391941dd9a6bSDavid Young   struct rte_flow_actions_template *
392041dd9a6bSDavid Young   rte_flow_actions_template_create(uint16_t port_id,
392141dd9a6bSDavid Young       const struct rte_flow_actions_template_attr *template_attr,
392241dd9a6bSDavid Young       const struct rte_flow_action actions[],
392341dd9a6bSDavid Young       const struct rte_flow_action masks[],
392441dd9a6bSDavid Young       struct rte_flow_error *error);
392541dd9a6bSDavid Young
392641dd9a6bSDavid YoungFor example, to create an actions template with the same Mark ID
392741dd9a6bSDavid Youngbut different Queue Index for every rule:
392841dd9a6bSDavid Young
392941dd9a6bSDavid Young.. code-block:: c
393041dd9a6bSDavid Young
393141dd9a6bSDavid Young   rte_flow_actions_template_attr attr = {.ingress = 1};
393241dd9a6bSDavid Young   struct rte_flow_action act[] = {
393341dd9a6bSDavid Young   /* Mark ID is 4 for every rule, Queue Index is unique */
393441dd9a6bSDavid Young       [0] = {.type = RTE_FLOW_ACTION_TYPE_MARK,
393541dd9a6bSDavid Young              .conf = &(struct rte_flow_action_mark){.id = 4}},
393641dd9a6bSDavid Young       [1] = {.type = RTE_FLOW_ACTION_TYPE_QUEUE},
393741dd9a6bSDavid Young       [2] = {.type = RTE_FLOW_ACTION_TYPE_END,},
393841dd9a6bSDavid Young   };
393941dd9a6bSDavid Young   struct rte_flow_action msk[] = {
394041dd9a6bSDavid Young   /* Assign to MARK mask any non-zero value to make it constant */
394141dd9a6bSDavid Young       [0] = {.type = RTE_FLOW_ACTION_TYPE_MARK,
394241dd9a6bSDavid Young              .conf = &(struct rte_flow_action_mark){.id = 1}},
394341dd9a6bSDavid Young       [1] = {.type = RTE_FLOW_ACTION_TYPE_QUEUE},
394441dd9a6bSDavid Young       [2] = {.type = RTE_FLOW_ACTION_TYPE_END,},
394541dd9a6bSDavid Young   };
394641dd9a6bSDavid Young   struct rte_flow_error err;
394741dd9a6bSDavid Young
394841dd9a6bSDavid Young   struct rte_flow_actions_template *actions_template =
394941dd9a6bSDavid Young           rte_flow_actions_template_create(port, &attr, &act, &msk, &err);
395041dd9a6bSDavid Young
395141dd9a6bSDavid YoungThe concrete value for Queue Index will be provided at the rule creation.
395241dd9a6bSDavid Young
395341dd9a6bSDavid YoungTemplate table
395441dd9a6bSDavid Young^^^^^^^^^^^^^^
395541dd9a6bSDavid Young
395641dd9a6bSDavid YoungA template table combines a number of pattern and actions templates along with
395741dd9a6bSDavid Youngshared flow rule attributes (group ID, priority and traffic direction).
395841dd9a6bSDavid YoungThis way a PMD/HW can prepare all the resources needed for efficient flow rules
395941dd9a6bSDavid Youngcreation in the datapath. To avoid any hiccups due to memory reallocation,
396041dd9a6bSDavid Youngthe maximum number of flow rules is defined at table creation time.
396141dd9a6bSDavid YoungAny flow rule creation beyond the maximum table size is rejected.
396241dd9a6bSDavid YoungApplication may create another table to accommodate more rules in this case.
396341dd9a6bSDavid Young
396441dd9a6bSDavid Young.. code-block:: c
396541dd9a6bSDavid Young
396641dd9a6bSDavid Young   struct rte_flow_template_table *
396741dd9a6bSDavid Young   rte_flow_template_table_create(uint16_t port_id,
396841dd9a6bSDavid Young       const struct rte_flow_template_table_attr *table_attr,
396941dd9a6bSDavid Young       struct rte_flow_pattern_template *pattern_templates[],
397041dd9a6bSDavid Young       uint8_t nb_pattern_templates,
397141dd9a6bSDavid Young       struct rte_flow_actions_template *actions_templates[],
397241dd9a6bSDavid Young       uint8_t nb_actions_templates,
397341dd9a6bSDavid Young       struct rte_flow_error *error);
397441dd9a6bSDavid Young
397541dd9a6bSDavid YoungA table can be created only after the Flow Rules management is configured
397641dd9a6bSDavid Youngand pattern and actions templates are created.
397741dd9a6bSDavid Young
397841dd9a6bSDavid Young.. code-block:: c
397941dd9a6bSDavid Young
398041dd9a6bSDavid Young   rte_flow_template_table_attr table_attr = {
398141dd9a6bSDavid Young       .flow_attr.ingress = 1,
398241dd9a6bSDavid Young       .nb_flows = 10000;
398341dd9a6bSDavid Young   };
398441dd9a6bSDavid Young   uint8_t nb_pattern_templ = 1;
398541dd9a6bSDavid Young   struct rte_flow_pattern_template *pattern_templates[nb_pattern_templ];
398641dd9a6bSDavid Young   pattern_templates[0] = pattern_template;
398741dd9a6bSDavid Young   uint8_t nb_actions_templ = 1;
398841dd9a6bSDavid Young   struct rte_flow_actions_template *actions_templates[nb_actions_templ];
398941dd9a6bSDavid Young   actions_templates[0] = actions_template;
399041dd9a6bSDavid Young   struct rte_flow_error error;
399141dd9a6bSDavid Young
399241dd9a6bSDavid Young   struct rte_flow_template_table *table =
399341dd9a6bSDavid Young           rte_flow_template_table_create(port, &table_attr,
399441dd9a6bSDavid Young                   &pattern_templates, nb_pattern_templ,
399541dd9a6bSDavid Young                   &actions_templates, nb_actions_templ,
399641dd9a6bSDavid Young                   &error);
399741dd9a6bSDavid Young
399841dd9a6bSDavid YoungTable Attribute: Specialize
399941dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^^^^^^^
400041dd9a6bSDavid Young
400141dd9a6bSDavid YoungApplication can help optimizing underlayer resources and insertion rate
400241dd9a6bSDavid Youngby specializing template table.
400341dd9a6bSDavid YoungSpecialization is done by providing hints
400441dd9a6bSDavid Youngin the template table attribute ``specialize``.
400541dd9a6bSDavid Young
400641dd9a6bSDavid YoungThis attribute is not mandatory for driver to implement.
400741dd9a6bSDavid YoungIf a hint is not supported, it will be silently ignored,
400841dd9a6bSDavid Youngand no special optimization is done.
400941dd9a6bSDavid Young
401041dd9a6bSDavid YoungIf a table is specialized, the application should make sure the rules
401141dd9a6bSDavid Youngcomply with the table attribute.
401241dd9a6bSDavid YoungThe application functionality must not rely on the hints,
401341dd9a6bSDavid Youngthey are not replacing the matching criteria of flow rules.
401441dd9a6bSDavid Young
401541dd9a6bSDavid YoungTemplate table resize
401641dd9a6bSDavid Young^^^^^^^^^^^^^^^^^^^^^
401741dd9a6bSDavid Young
401841dd9a6bSDavid YoungThe resizable template table API enables applications to dynamically adjust
401941dd9a6bSDavid Youngcapacity of template tables without disrupting the existing flow rules operation.
402041dd9a6bSDavid YoungThe resizable template table API allows applications to optimize
402141dd9a6bSDavid Youngthe memory usage and performance of template tables
402241dd9a6bSDavid Youngaccording to the traffic conditions and requirements.
402341dd9a6bSDavid Young
402441dd9a6bSDavid YoungA typical use case for the resizable template table API:
402541dd9a6bSDavid Young
402641dd9a6bSDavid Young  #. Create a resizable table with the initial capacity.
402741dd9a6bSDavid Young  #. Change the table flow rules capacity.
402841dd9a6bSDavid Young  #. Update table flow objects.
402941dd9a6bSDavid Young  #. Complete the table resize.
403041dd9a6bSDavid Young
403141dd9a6bSDavid YoungA resizable table can be either in normal or resizable state.
403241dd9a6bSDavid YoungWhen application begins to resize the table, its state is changed to resizable.
403341dd9a6bSDavid YoungThe table stays in resizable state until the application finishes resize procedure.
403441dd9a6bSDavid YoungThe application can resize a table in the normal state only.
403541dd9a6bSDavid Young
403641dd9a6bSDavid YoungThe application needs to set the ``RTE_FLOW_TABLE_SPECIALIZE_RESIZABLE`` bit in
403741dd9a6bSDavid Youngthe table attributes when creating a template table that can be resized,
403841dd9a6bSDavid Youngand the bit cannot be set or cleared later.
403941dd9a6bSDavid Young
404041dd9a6bSDavid YoungThe application triggers the table resize by calling
404141dd9a6bSDavid Youngthe ``rte_flow_template_table_resize()`` function.
404241dd9a6bSDavid YoungThe resize process updates the table configuration to fit the new flow rules capacity.
404341dd9a6bSDavid YoungTable resize does not change existing flow objects configuration.
404441dd9a6bSDavid YoungThe application can create new flow rules and modify or delete
404541dd9a6bSDavid Youngexisting flow rules while the table is resizing,
404641dd9a6bSDavid Youngbut the table performance might be slower than usual.
404741dd9a6bSDavid Young
404841dd9a6bSDavid YoungFlow rules that existed before table resize are fully functional after table resize.
404941dd9a6bSDavid YoungHowever, the application must update flow objects to match the new table configuration.
405041dd9a6bSDavid YoungThe application calls ``rte_flow_async_update_resized()`` to update flow object
405141dd9a6bSDavid Youngfor the new table configuration.
405241dd9a6bSDavid YoungIt should be called for flow rules created before table resize.
405341dd9a6bSDavid YoungIf called for flow rules created after table resize, the call should return success.
405441dd9a6bSDavid YoungThe application is free to call this API for all table flow rules.
405541dd9a6bSDavid Young
405641dd9a6bSDavid YoungThe application calls ``rte_flow_template_table_resize_complete()``
405741dd9a6bSDavid Youngto return a table to normal state after it completed flow objects update.
405841dd9a6bSDavid Young
405941dd9a6bSDavid YoungTestpmd commands (wrapped for clarity)::
406041dd9a6bSDavid Young
406141dd9a6bSDavid Young    # 1. Create resizable template table for 1 flow.
406241dd9a6bSDavid Young    testpmd> flow pattern_template 0 create ingress pattern_template_id 3
406341dd9a6bSDavid Young                  template eth / ipv4 / udp src mask 0xffff / end
406441dd9a6bSDavid Young    testpmd> flow actions_template 0 create ingress actions_template_id 7
406541dd9a6bSDavid Young                  template count  / rss / end
406641dd9a6bSDavid Young    testpmd> flow template_table 0 create table_id 101 resizable ingress
406741dd9a6bSDavid Young                  group 1 priority 0 rules_number 1
406841dd9a6bSDavid Young                  pattern_template 3 actions_template 7
406941dd9a6bSDavid Young
407041dd9a6bSDavid Young    # 2. Queue a flow rule.
407141dd9a6bSDavid Young    testpmd> flow queue 0 create 0 template_table 101
407241dd9a6bSDavid Young                  pattern_template 0 actions_template 0 postpone no
407341dd9a6bSDavid Young                  pattern eth / ipv4 / udp src spec 1 / end actions count / rss / end
407441dd9a6bSDavid Young
407541dd9a6bSDavid Young    # 3. Resize the template table
407641dd9a6bSDavid Young    #    The new table capacity is 32 rules
407741dd9a6bSDavid Young    testpmd> flow template_table 0 resize table_resize_id 101
407841dd9a6bSDavid Young                  table_resize_rules_num 32
407941dd9a6bSDavid Young
408041dd9a6bSDavid Young    # 4. Queue more flow rules.
408141dd9a6bSDavid Young    testpmd> flow queue 0 create 0 template_table 101
408241dd9a6bSDavid Young                  pattern_template 0 actions_template 0 postpone no
408341dd9a6bSDavid Young                  pattern eth / ipv4 / udp src spec 2 / end actions count / rss / end
408441dd9a6bSDavid Young    testpmd> flow queue 0 create 0 template_table 101
408541dd9a6bSDavid Young                  pattern_template 0 actions_template 0 postpone no
408641dd9a6bSDavid Young                  pattern eth / ipv4 / udp src spec 3 / end actions count / rss / end
408741dd9a6bSDavid Young    testpmd> flow queue 0 create 0 template_table 101
408841dd9a6bSDavid Young                  pattern_template 0 actions_template 0 postpone no
408941dd9a6bSDavid Young                  pattern eth / ipv4 / udp src spec 4 / end actions count / rss / end
409041dd9a6bSDavid Young
409141dd9a6bSDavid Young    # 5. Queue flow rules updates.
409241dd9a6bSDavid Young    # Rule 0 was created before table resize - must be updated.
409341dd9a6bSDavid Young    testpmd> flow queue 0 update_resized 0 rule 0
409441dd9a6bSDavid Young    # Rule 1 was created after table resize - flow pull returns success.
409541dd9a6bSDavid Young    testpmd> flow queue 0 update_resized 0 rule 1
409641dd9a6bSDavid Young
409741dd9a6bSDavid Young    # 6. Complete the table resize.
409841dd9a6bSDavid Young    testpmd> flow template_table 0 resize_complete table 101
409941dd9a6bSDavid Young
410041dd9a6bSDavid YoungAsynchronous operations
410141dd9a6bSDavid Young-----------------------
410241dd9a6bSDavid Young
410341dd9a6bSDavid YoungFlow rules management can be done via special lockless flow management queues.
410441dd9a6bSDavid Young
410541dd9a6bSDavid Young- Queue operations are asynchronous and not thread-safe.
410641dd9a6bSDavid Young
410741dd9a6bSDavid Young- Operations can thus be invoked by the app's datapath,
410841dd9a6bSDavid Young  packet processing can continue while queue operations are processed by NIC.
410941dd9a6bSDavid Young
411041dd9a6bSDavid Young- Number of flow queues is configured at initialization stage.
411141dd9a6bSDavid Young
411241dd9a6bSDavid Young- Available operation types: rule creation, rule destruction,
411341dd9a6bSDavid Young  indirect rule creation, indirect rule destruction, indirect rule update.
411441dd9a6bSDavid Young
411541dd9a6bSDavid Young- Operations may be reordered within a queue.
411641dd9a6bSDavid Young
411741dd9a6bSDavid Young- Operations can be postponed and pushed to NIC in batches.
411841dd9a6bSDavid Young
411941dd9a6bSDavid Young- Results pulling must be done on time to avoid queue overflows.
412041dd9a6bSDavid Young
412141dd9a6bSDavid Young- User data is returned as part of the result to identify an operation.
412241dd9a6bSDavid Young
412341dd9a6bSDavid Young- Flow handle is valid once the creation operation is enqueued and must be
412441dd9a6bSDavid Young  destroyed even if the operation is not successful and the rule is not inserted.
412541dd9a6bSDavid Young
412641dd9a6bSDavid Young- Application must wait for the creation operation result before enqueueing
412741dd9a6bSDavid Young  the deletion operation to make sure the creation is processed by NIC.
412841dd9a6bSDavid Young
412941dd9a6bSDavid YoungThe asynchronous flow rule insertion logic can be broken into two phases.
413041dd9a6bSDavid Young
413141dd9a6bSDavid Young#. Initialization stage as shown here:
413241dd9a6bSDavid Young
413341dd9a6bSDavid Young   .. _figure_rte_flow_async_init:
413441dd9a6bSDavid Young
413541dd9a6bSDavid Young   .. figure:: ../img/rte_flow_async_init.*
413641dd9a6bSDavid Young
413741dd9a6bSDavid Young#. Main loop as presented on a datapath application example:
413841dd9a6bSDavid Young
413941dd9a6bSDavid Young   .. _figure_rte_flow_async_usage:
414041dd9a6bSDavid Young
414141dd9a6bSDavid Young   .. figure:: ../img/rte_flow_async_usage.*
414241dd9a6bSDavid Young
414341dd9a6bSDavid YoungEnqueue creation operation
414441dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~
414541dd9a6bSDavid Young
414641dd9a6bSDavid YoungEnqueueing a flow rule creation operation is similar to simple creation.
414741dd9a6bSDavid Young
414841dd9a6bSDavid Young.. code-block:: c
414941dd9a6bSDavid Young
415041dd9a6bSDavid Young   struct rte_flow *
415141dd9a6bSDavid Young   rte_flow_async_create(uint16_t port_id,
415241dd9a6bSDavid Young                         uint32_t queue_id,
415341dd9a6bSDavid Young                         const struct rte_flow_op_attr *op_attr,
415441dd9a6bSDavid Young                         struct rte_flow_template_table *template_table,
415541dd9a6bSDavid Young                         const struct rte_flow_item pattern[],
415641dd9a6bSDavid Young                         uint8_t pattern_template_index,
415741dd9a6bSDavid Young                         const struct rte_flow_action actions[],
415841dd9a6bSDavid Young                         uint8_t actions_template_index,
415941dd9a6bSDavid Young                         void *user_data,
416041dd9a6bSDavid Young                         struct rte_flow_error *error);
416141dd9a6bSDavid Young
416241dd9a6bSDavid YoungA valid handle in case of success is returned. It must be destroyed later
416341dd9a6bSDavid Youngby calling ``rte_flow_async_destroy()`` even if the rule is rejected by HW.
416441dd9a6bSDavid Young
416541dd9a6bSDavid YoungEnqueue creation by index operation
416641dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
416741dd9a6bSDavid Young
416841dd9a6bSDavid YoungEnqueueing a flow rule creation operation to insert a rule at a table index.
416941dd9a6bSDavid Young
417041dd9a6bSDavid Young.. code-block:: c
417141dd9a6bSDavid Young
417241dd9a6bSDavid Young   struct rte_flow *
417341dd9a6bSDavid Young   rte_flow_async_create_by_index(uint16_t port_id,
417441dd9a6bSDavid Young                                  uint32_t queue_id,
417541dd9a6bSDavid Young                                  const struct rte_flow_op_attr *op_attr,
417641dd9a6bSDavid Young                                  struct rte_flow_template_table *template_table,
417741dd9a6bSDavid Young                                  uint32_t rule_index,
417841dd9a6bSDavid Young                                  const struct rte_flow_action actions[],
417941dd9a6bSDavid Young                                  uint8_t actions_template_index,
418041dd9a6bSDavid Young                                  void *user_data,
418141dd9a6bSDavid Young                                  struct rte_flow_error *error);
418241dd9a6bSDavid Young
418341dd9a6bSDavid YoungA valid handle in case of success is returned. It must be destroyed later
418441dd9a6bSDavid Youngby calling ``rte_flow_async_destroy()`` even if the rule is rejected by HW.
418541dd9a6bSDavid Young
4186933f18dbSAlexander KozyrevEnqueue creation by index with pattern
4187933f18dbSAlexander Kozyrev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4188933f18dbSAlexander Kozyrev
4189933f18dbSAlexander KozyrevEnqueueing a flow rule creation operation to insert a rule at a table index with pattern.
4190933f18dbSAlexander Kozyrev
4191933f18dbSAlexander Kozyrev.. code-block:: c
4192933f18dbSAlexander Kozyrev
4193933f18dbSAlexander Kozyrev   struct rte_flow *
4194933f18dbSAlexander Kozyrev   rte_flow_async_create_by_index_with_pattern(uint16_t port_id,
4195933f18dbSAlexander Kozyrev                                               uint32_t queue_id,
4196933f18dbSAlexander Kozyrev                                               const struct rte_flow_op_attr *op_attr,
4197933f18dbSAlexander Kozyrev                                               struct rte_flow_template_table *template_table,
4198933f18dbSAlexander Kozyrev                                               uint32_t rule_index,
4199933f18dbSAlexander Kozyrev                                               const struct rte_flow_item pattern[],
4200933f18dbSAlexander Kozyrev                                               uint8_t pattern_template_index,
4201933f18dbSAlexander Kozyrev                                               const struct rte_flow_action actions[],
4202933f18dbSAlexander Kozyrev                                               uint8_t actions_template_index,
4203933f18dbSAlexander Kozyrev                                               void *user_data,
4204933f18dbSAlexander Kozyrev                                               struct rte_flow_error *error);
4205933f18dbSAlexander Kozyrev
420641dd9a6bSDavid YoungEnqueue destruction operation
420741dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
420841dd9a6bSDavid Young
420941dd9a6bSDavid YoungEnqueueing a flow rule destruction operation is similar to simple destruction.
421041dd9a6bSDavid Young
421141dd9a6bSDavid Young.. code-block:: c
421241dd9a6bSDavid Young
421341dd9a6bSDavid Young   int
421441dd9a6bSDavid Young   rte_flow_async_destroy(uint16_t port_id,
421541dd9a6bSDavid Young                          uint32_t queue_id,
421641dd9a6bSDavid Young                          const struct rte_flow_op_attr *op_attr,
421741dd9a6bSDavid Young                          struct rte_flow *flow,
421841dd9a6bSDavid Young                          void *user_data,
421941dd9a6bSDavid Young                          struct rte_flow_error *error);
422041dd9a6bSDavid Young
422141dd9a6bSDavid YoungEnqueue update operation
422241dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~
422341dd9a6bSDavid Young
422441dd9a6bSDavid YoungEnqueueing a flow rule update operation to replace actions in the existing rule.
422541dd9a6bSDavid Young
422641dd9a6bSDavid Young.. code-block:: c
422741dd9a6bSDavid Young
422841dd9a6bSDavid Young   int
422941dd9a6bSDavid Young   rte_flow_async_actions_update(uint16_t port_id,
423041dd9a6bSDavid Young                                 uint32_t queue_id,
423141dd9a6bSDavid Young                                 const struct rte_flow_op_attr *op_attr,
423241dd9a6bSDavid Young                                 struct rte_flow *flow,
423341dd9a6bSDavid Young                                 const struct rte_flow_action actions[],
423441dd9a6bSDavid Young                                 uint8_t actions_template_index,
423541dd9a6bSDavid Young                                 void *user_data,
423641dd9a6bSDavid Young                                 struct rte_flow_error *error);
423741dd9a6bSDavid Young
423841dd9a6bSDavid YoungEnqueue indirect action creation operation
423941dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
424041dd9a6bSDavid Young
424141dd9a6bSDavid YoungAsynchronous version of indirect action creation API.
424241dd9a6bSDavid Young
424341dd9a6bSDavid Young.. code-block:: c
424441dd9a6bSDavid Young
424541dd9a6bSDavid Young   struct rte_flow_action_handle *
424641dd9a6bSDavid Young   rte_flow_async_action_handle_create(uint16_t port_id,
424741dd9a6bSDavid Young           uint32_t queue_id,
424841dd9a6bSDavid Young           const struct rte_flow_op_attr *q_ops_attr,
424941dd9a6bSDavid Young           const struct rte_flow_indir_action_conf *indir_action_conf,
425041dd9a6bSDavid Young           const struct rte_flow_action *action,
425141dd9a6bSDavid Young           void *user_data,
425241dd9a6bSDavid Young           struct rte_flow_error *error);
425341dd9a6bSDavid Young
425441dd9a6bSDavid YoungA valid handle in case of success is returned. It must be destroyed later by
425541dd9a6bSDavid Young``rte_flow_async_action_handle_destroy()`` even if the rule was rejected.
425641dd9a6bSDavid Young
425741dd9a6bSDavid YoungEnqueue indirect action destruction operation
425841dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
425941dd9a6bSDavid Young
426041dd9a6bSDavid YoungAsynchronous version of indirect action destruction API.
426141dd9a6bSDavid Young
426241dd9a6bSDavid Young.. code-block:: c
426341dd9a6bSDavid Young
426441dd9a6bSDavid Young   int
426541dd9a6bSDavid Young   rte_flow_async_action_handle_destroy(uint16_t port_id,
426641dd9a6bSDavid Young           uint32_t queue_id,
426741dd9a6bSDavid Young           const struct rte_flow_op_attr *q_ops_attr,
426841dd9a6bSDavid Young           struct rte_flow_action_handle *action_handle,
426941dd9a6bSDavid Young           void *user_data,
427041dd9a6bSDavid Young           struct rte_flow_error *error);
427141dd9a6bSDavid Young
427241dd9a6bSDavid YoungEnqueue indirect action update operation
427341dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
427441dd9a6bSDavid Young
427541dd9a6bSDavid YoungAsynchronous version of indirect action update API.
427641dd9a6bSDavid Young
427741dd9a6bSDavid Young.. code-block:: c
427841dd9a6bSDavid Young
427941dd9a6bSDavid Young   int
428041dd9a6bSDavid Young   rte_flow_async_action_handle_update(uint16_t port_id,
428141dd9a6bSDavid Young           uint32_t queue_id,
428241dd9a6bSDavid Young           const struct rte_flow_op_attr *q_ops_attr,
428341dd9a6bSDavid Young           struct rte_flow_action_handle *action_handle,
428441dd9a6bSDavid Young           const void *update,
428541dd9a6bSDavid Young           void *user_data,
428641dd9a6bSDavid Young           struct rte_flow_error *error);
428741dd9a6bSDavid Young
428841dd9a6bSDavid YoungEnqueue indirect action query operation
428941dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
429041dd9a6bSDavid Young
429141dd9a6bSDavid YoungAsynchronous version of indirect action query API.
429241dd9a6bSDavid Young
429341dd9a6bSDavid Young.. code-block:: c
429441dd9a6bSDavid Young
429541dd9a6bSDavid Young   int
429641dd9a6bSDavid Young   rte_flow_async_action_handle_query(uint16_t port_id,
429741dd9a6bSDavid Young           uint32_t queue_id,
429841dd9a6bSDavid Young           const struct rte_flow_op_attr *q_ops_attr,
429941dd9a6bSDavid Young           struct rte_flow_action_handle *action_handle,
430041dd9a6bSDavid Young           void *data,
430141dd9a6bSDavid Young           void *user_data,
430241dd9a6bSDavid Young           struct rte_flow_error *error);
430341dd9a6bSDavid Young
430441dd9a6bSDavid YoungPush enqueued operations
430541dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~
430641dd9a6bSDavid Young
430741dd9a6bSDavid YoungPushing all internally stored rules from a queue to the NIC.
430841dd9a6bSDavid Young
430941dd9a6bSDavid Young.. code-block:: c
431041dd9a6bSDavid Young
431141dd9a6bSDavid Young   int
431241dd9a6bSDavid Young   rte_flow_push(uint16_t port_id,
431341dd9a6bSDavid Young                 uint32_t queue_id,
431441dd9a6bSDavid Young                 struct rte_flow_error *error);
431541dd9a6bSDavid Young
431641dd9a6bSDavid YoungThere is the postpone attribute in the queue operation attributes.
431741dd9a6bSDavid YoungWhen it is set, multiple operations can be bulked together and not sent to HW
431841dd9a6bSDavid Youngright away to save SW/HW interactions and prioritize throughput over latency.
431941dd9a6bSDavid YoungThe application must invoke this function to actually push all outstanding
432041dd9a6bSDavid Youngoperations to HW in this case.
432141dd9a6bSDavid Young
432241dd9a6bSDavid YoungPull enqueued operations
432341dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~
432441dd9a6bSDavid Young
432541dd9a6bSDavid YoungPulling asynchronous operations results.
432641dd9a6bSDavid Young
432741dd9a6bSDavid YoungThe application must invoke this function in order to complete asynchronous
432841dd9a6bSDavid Youngflow rule operations and to receive flow rule operations statuses.
432941dd9a6bSDavid Young
433041dd9a6bSDavid Young.. code-block:: c
433141dd9a6bSDavid Young
433241dd9a6bSDavid Young   int
433341dd9a6bSDavid Young   rte_flow_pull(uint16_t port_id,
433441dd9a6bSDavid Young                 uint32_t queue_id,
433541dd9a6bSDavid Young                 struct rte_flow_op_result res[],
433641dd9a6bSDavid Young                 uint16_t n_res,
433741dd9a6bSDavid Young                 struct rte_flow_error *error);
433841dd9a6bSDavid Young
433941dd9a6bSDavid YoungMultiple outstanding operation results can be pulled simultaneously.
434041dd9a6bSDavid YoungUser data may be provided during a flow creation/destruction in order
434141dd9a6bSDavid Youngto distinguish between multiple operations. User data is returned as part
434241dd9a6bSDavid Youngof the result to provide a method to detect which operation is completed.
434341dd9a6bSDavid Young
434441dd9a6bSDavid YoungCalculate hash
434541dd9a6bSDavid Young~~~~~~~~~~~~~~
434641dd9a6bSDavid Young
434741dd9a6bSDavid YoungCalculating hash of a packet in SW as it would be calculated in HW.
434841dd9a6bSDavid Young
434941dd9a6bSDavid YoungThe application can use this function to calculate the hash of a given packet
435041dd9a6bSDavid Youngas it would be calculated in the HW.
435141dd9a6bSDavid Young
435241dd9a6bSDavid Young.. code-block:: c
435341dd9a6bSDavid Young
435441dd9a6bSDavid Young   int
435541dd9a6bSDavid Young   rte_flow_calc_table_hash(uint16_t port_id,
435641dd9a6bSDavid Young                            const struct rte_flow_template_table *table,
435741dd9a6bSDavid Young			                   const struct rte_flow_item pattern[],
435841dd9a6bSDavid Young                            uint8_t pattern_template_index,
435941dd9a6bSDavid Young			                   uint32_t *hash, struct rte_flow_error *error);
436041dd9a6bSDavid Young
436141dd9a6bSDavid YoungCalculate encapsulation hash
436241dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~~~~~
436341dd9a6bSDavid Young
436441dd9a6bSDavid YoungCalculating hash of a packet as it would be calculated by the HW, when encapsulating
436541dd9a6bSDavid Younga packet.
436641dd9a6bSDavid Young
436741dd9a6bSDavid YoungWhen the HW execute an encapsulation action, for example VXLAN tunnel,
436841dd9a6bSDavid Youngit may calculate an hash of the packet to be encapsulated.
436941dd9a6bSDavid YoungThis hash is stored in the outer header of the tunnel.
437041dd9a6bSDavid YoungThis allow better spreading of traffic.
437141dd9a6bSDavid Young
437241dd9a6bSDavid YoungThis function can be used for packets of a flow that are not offloaded and
437341dd9a6bSDavid Youngpass through the SW instead of the HW, for example, SYN/FIN packets.
437441dd9a6bSDavid Young
437541dd9a6bSDavid Young.. _flow_isolated_mode:
437641dd9a6bSDavid Young
437741dd9a6bSDavid YoungFlow isolated mode
437841dd9a6bSDavid Young------------------
437941dd9a6bSDavid Young
438041dd9a6bSDavid YoungThe general expectation for ingress traffic is that flow rules process it
438141dd9a6bSDavid Youngfirst; the remaining unmatched or pass-through traffic usually ends up in a
438241dd9a6bSDavid Youngqueue (with or without RSS, locally or in some sub-device instance)
438341dd9a6bSDavid Youngdepending on the global configuration settings of a port.
438441dd9a6bSDavid Young
438541dd9a6bSDavid YoungWhile fine from a compatibility standpoint, this approach makes drivers more
438641dd9a6bSDavid Youngcomplex as they have to check for possible side effects outside of this API
438741dd9a6bSDavid Youngwhen creating or destroying flow rules. It results in a more limited set of
438841dd9a6bSDavid Youngavailable rule types due to the way device resources are assigned (e.g. no
438941dd9a6bSDavid Youngsupport for the RSS action even on capable hardware).
439041dd9a6bSDavid Young
439141dd9a6bSDavid YoungGiven that nonspecific traffic can be handled by flow rules as well,
439241dd9a6bSDavid Youngisolated mode is a means for applications to tell a driver that ingress on
439341dd9a6bSDavid Youngthe underlying port must be injected from the defined flow rules only; that
439441dd9a6bSDavid Youngno default traffic is expected outside those rules.
439541dd9a6bSDavid Young
439641dd9a6bSDavid YoungThis has the following benefits:
439741dd9a6bSDavid Young
439841dd9a6bSDavid Young- Applications get finer-grained control over the kind of traffic they want
439941dd9a6bSDavid Young  to receive (no traffic by default).
440041dd9a6bSDavid Young
440141dd9a6bSDavid Young- More importantly they control at what point nonspecific traffic is handled
440241dd9a6bSDavid Young  relative to other flow rules, by adjusting priority levels.
440341dd9a6bSDavid Young
440441dd9a6bSDavid Young- Drivers can assign more hardware resources to flow rules and expand the
440541dd9a6bSDavid Young  set of supported rule types.
440641dd9a6bSDavid Young
440741dd9a6bSDavid YoungBecause toggling isolated mode may cause profound changes to the ingress
440841dd9a6bSDavid Youngprocessing path of a driver, it may not be possible to leave it once
440941dd9a6bSDavid Youngentered. Likewise, existing flow rules or global configuration settings may
441041dd9a6bSDavid Youngprevent a driver from entering isolated mode.
441141dd9a6bSDavid Young
441241dd9a6bSDavid YoungApplications relying on this mode are therefore encouraged to toggle it as
441341dd9a6bSDavid Youngsoon as possible after device initialization, ideally before the first call
441441dd9a6bSDavid Youngto ``rte_eth_dev_configure()`` to avoid possible failures due to conflicting
441541dd9a6bSDavid Youngsettings.
441641dd9a6bSDavid Young
441741dd9a6bSDavid YoungOnce effective, the following functionality has no effect on the underlying
441841dd9a6bSDavid Youngport and may return errors such as ``ENOTSUP`` ("not supported"):
441941dd9a6bSDavid Young
442041dd9a6bSDavid Young- Toggling promiscuous mode.
442141dd9a6bSDavid Young- Toggling allmulticast mode.
442241dd9a6bSDavid Young- Configuring MAC addresses.
442341dd9a6bSDavid Young- Configuring multicast addresses.
442441dd9a6bSDavid Young- Configuring VLAN filters.
442541dd9a6bSDavid Young- Configuring global RSS settings.
442641dd9a6bSDavid Young
442741dd9a6bSDavid Young.. code-block:: c
442841dd9a6bSDavid Young
442941dd9a6bSDavid Young   int
443041dd9a6bSDavid Young   rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
443141dd9a6bSDavid Young
443241dd9a6bSDavid YoungArguments:
443341dd9a6bSDavid Young
443441dd9a6bSDavid Young- ``port_id``: port identifier of Ethernet device.
443541dd9a6bSDavid Young- ``set``: nonzero to enter isolated mode, attempt to leave it otherwise.
443641dd9a6bSDavid Young- ``error``: perform verbose error reporting if not NULL. PMDs initialize
443741dd9a6bSDavid Young  this structure in case of error only.
443841dd9a6bSDavid Young
443941dd9a6bSDavid YoungReturn values:
444041dd9a6bSDavid Young
444141dd9a6bSDavid Young- 0 on success, a negative errno value otherwise and ``rte_errno`` is set.
444241dd9a6bSDavid Young
444341dd9a6bSDavid YoungVerbose error reporting
444441dd9a6bSDavid Young-----------------------
444541dd9a6bSDavid Young
444641dd9a6bSDavid YoungThe defined *errno* values may not be accurate enough for users or
444741dd9a6bSDavid Youngapplication developers who want to investigate issues related to flow rules
444841dd9a6bSDavid Youngmanagement. A dedicated error object is defined for this purpose:
444941dd9a6bSDavid Young
445041dd9a6bSDavid Young.. code-block:: c
445141dd9a6bSDavid Young
445241dd9a6bSDavid Young   enum rte_flow_error_type {
445341dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
445441dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
445541dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
445641dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
445741dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
445841dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< Ingress field. */
445941dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< Egress field. */
446041dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure. */
446141dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_ITEM_NUM, /**< Pattern length. */
446241dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_ITEM, /**< Specific pattern item. */
446341dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
446441dd9a6bSDavid Young       RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
446541dd9a6bSDavid Young   };
446641dd9a6bSDavid Young
446741dd9a6bSDavid Young   struct rte_flow_error {
446841dd9a6bSDavid Young       enum rte_flow_error_type type; /**< Cause field and error types. */
446941dd9a6bSDavid Young       const void *cause; /**< Object responsible for the error. */
447041dd9a6bSDavid Young       const char *message; /**< Human-readable error message. */
447141dd9a6bSDavid Young   };
447241dd9a6bSDavid Young
447341dd9a6bSDavid YoungError type ``RTE_FLOW_ERROR_TYPE_NONE`` stands for no error, in which case
447441dd9a6bSDavid Youngremaining fields can be ignored. Other error types describe the type of the
447541dd9a6bSDavid Youngobject pointed by ``cause``.
447641dd9a6bSDavid Young
447741dd9a6bSDavid YoungIf non-NULL, ``cause`` points to the object responsible for the error. For a
447841dd9a6bSDavid Youngflow rule, this may be a pattern item or an individual action.
447941dd9a6bSDavid Young
448041dd9a6bSDavid YoungIf non-NULL, ``message`` provides a human-readable error message.
448141dd9a6bSDavid Young
448241dd9a6bSDavid YoungThis object is normally allocated by applications and set by PMDs in case of
448341dd9a6bSDavid Youngerror, the message points to a constant string which does not need to be
448441dd9a6bSDavid Youngfreed by the application, however its pointer can be considered valid only
448541dd9a6bSDavid Youngas long as its associated DPDK port remains configured. Closing the
448641dd9a6bSDavid Youngunderlying device or unloading the PMD invalidates it.
448741dd9a6bSDavid Young
448841dd9a6bSDavid YoungHelpers
448941dd9a6bSDavid Young-------
449041dd9a6bSDavid Young
449141dd9a6bSDavid YoungError initializer
449241dd9a6bSDavid Young~~~~~~~~~~~~~~~~~
449341dd9a6bSDavid Young
449441dd9a6bSDavid Young.. code-block:: c
449541dd9a6bSDavid Young
449641dd9a6bSDavid Young   static inline int
449741dd9a6bSDavid Young   rte_flow_error_set(struct rte_flow_error *error,
449841dd9a6bSDavid Young                      int code,
449941dd9a6bSDavid Young                      enum rte_flow_error_type type,
450041dd9a6bSDavid Young                      const void *cause,
450141dd9a6bSDavid Young                      const char *message);
450241dd9a6bSDavid Young
450341dd9a6bSDavid YoungThis function initializes ``error`` (if non-NULL) with the provided
450441dd9a6bSDavid Youngparameters and sets ``rte_errno`` to ``code``. A negative error ``code`` is
450541dd9a6bSDavid Youngthen returned.
450641dd9a6bSDavid Young
450741dd9a6bSDavid YoungObject conversion
450841dd9a6bSDavid Young~~~~~~~~~~~~~~~~~
450941dd9a6bSDavid Young
451041dd9a6bSDavid Young.. code-block:: c
451141dd9a6bSDavid Young
451241dd9a6bSDavid Young   int
451341dd9a6bSDavid Young   rte_flow_conv(enum rte_flow_conv_op op,
451441dd9a6bSDavid Young                 void *dst,
451541dd9a6bSDavid Young                 size_t size,
451641dd9a6bSDavid Young                 const void *src,
451741dd9a6bSDavid Young                 struct rte_flow_error *error);
451841dd9a6bSDavid Young
451941dd9a6bSDavid YoungConvert ``src`` to ``dst`` according to operation ``op``. Possible
452041dd9a6bSDavid Youngoperations include:
452141dd9a6bSDavid Young
452241dd9a6bSDavid Young- Attributes, pattern item or action duplication.
452341dd9a6bSDavid Young- Duplication of an entire pattern or list of actions.
452441dd9a6bSDavid Young- Duplication of a complete flow rule description.
452541dd9a6bSDavid Young- Pattern item or action name retrieval.
452641dd9a6bSDavid Young
452741dd9a6bSDavid YoungTunneled traffic offload
452841dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~~
452941dd9a6bSDavid Young
453041dd9a6bSDavid Youngrte_flow API provides the building blocks for vendor-agnostic flow
453141dd9a6bSDavid Youngclassification offloads. The rte_flow "patterns" and "actions"
453241dd9a6bSDavid Youngprimitives are fine-grained, thus enabling DPDK applications the
453341dd9a6bSDavid Youngflexibility to offload network stacks and complex pipelines.
453441dd9a6bSDavid YoungApplications wishing to offload tunneled traffic are required to use
453541dd9a6bSDavid Youngthe rte_flow primitives, such as group, meta, mark, tag, and others to
453641dd9a6bSDavid Youngmodel their high-level objects.  The hardware model design for
453741dd9a6bSDavid Younghigh-level software objects is not trivial.  Furthermore, an optimal
453841dd9a6bSDavid Youngdesign is often vendor-specific.
453941dd9a6bSDavid Young
454041dd9a6bSDavid YoungWhen hardware offloads tunneled traffic in multi-group logic,
454141dd9a6bSDavid Youngpartially offloaded packets may arrive to the application after they
454241dd9a6bSDavid Youngwere modified in hardware. In this case, the application may need to
454341dd9a6bSDavid Youngrestore the original packet headers. Consider the following sequence:
454441dd9a6bSDavid YoungThe application decaps a packet in one group and jumps to a second
454541dd9a6bSDavid Younggroup where it tries to match on a 5-tuple, that will miss and send
454641dd9a6bSDavid Youngthe packet to the application. In this case, the application does not
454741dd9a6bSDavid Youngreceive the original packet but a modified one. Also, in this case,
454841dd9a6bSDavid Youngthe application cannot match on the outer header fields, such as VXLAN
454941dd9a6bSDavid Youngvni and 5-tuple.
455041dd9a6bSDavid Young
455141dd9a6bSDavid YoungThere are several possible ways to use rte_flow "patterns" and
455241dd9a6bSDavid Young"actions" to resolve the issues above. For example:
455341dd9a6bSDavid Young
455441dd9a6bSDavid Young1 Mapping headers to a hardware registers using the
455541dd9a6bSDavid Youngrte_flow_action_mark/rte_flow_action_tag/rte_flow_set_meta objects.
455641dd9a6bSDavid Young
455741dd9a6bSDavid Young2 Apply the decap only at the last offload stage after all the
455841dd9a6bSDavid Young"patterns" were matched and the packet will be fully offloaded.
455941dd9a6bSDavid Young
456041dd9a6bSDavid YoungEvery approach has its pros and cons and is highly dependent on the
456141dd9a6bSDavid Younghardware vendor.  For example, some hardware may have a limited number
456241dd9a6bSDavid Youngof registers while other hardware could not support inner actions and
456341dd9a6bSDavid Youngmust decap before accessing inner headers.
456441dd9a6bSDavid Young
456541dd9a6bSDavid YoungThe tunnel offload model resolves these issues. The model goals are:
456641dd9a6bSDavid Young
456741dd9a6bSDavid Young1 Provide a unified application API to offload tunneled traffic that
456841dd9a6bSDavid Youngis capable to match on outer headers after decap.
456941dd9a6bSDavid Young
457041dd9a6bSDavid Young2 Allow the application to restore the outer header of partially
457141dd9a6bSDavid Youngoffloaded packets.
457241dd9a6bSDavid Young
457341dd9a6bSDavid YoungThe tunnel offload model does not introduce new elements to the
457441dd9a6bSDavid Youngexisting RTE flow model and is implemented as a set of helper
457541dd9a6bSDavid Youngfunctions.
457641dd9a6bSDavid Young
457741dd9a6bSDavid YoungFor the application to work with the tunnel offload API it
457841dd9a6bSDavid Younghas to adjust flow rules in multi-table tunnel offload in the
457941dd9a6bSDavid Youngfollowing way:
458041dd9a6bSDavid Young
458141dd9a6bSDavid Young1 Remove explicit call to decap action and replace it with PMD actions
458241dd9a6bSDavid Youngobtained from rte_flow_tunnel_decap_and_set() helper.
458341dd9a6bSDavid Young
458441dd9a6bSDavid Young2 Add PMD items obtained from rte_flow_tunnel_match() helper to all
458541dd9a6bSDavid Youngother rules in the tunnel offload sequence.
458641dd9a6bSDavid Young
458741dd9a6bSDavid YoungThe model requirements:
458841dd9a6bSDavid Young
458941dd9a6bSDavid YoungSoftware application must initialize
459041dd9a6bSDavid Youngrte_tunnel object with tunnel parameters before calling
459141dd9a6bSDavid Youngrte_flow_tunnel_decap_set() & rte_flow_tunnel_match().
459241dd9a6bSDavid Young
459341dd9a6bSDavid YoungPMD actions array obtained in rte_flow_tunnel_decap_set() must be
459441dd9a6bSDavid Youngreleased by application with rte_flow_action_release() call.
459541dd9a6bSDavid Young
459641dd9a6bSDavid YoungPMD items array obtained with rte_flow_tunnel_match() must be released
459741dd9a6bSDavid Youngby application with rte_flow_item_release() call.  Application can
459841dd9a6bSDavid Youngrelease PMD items and actions after rule was created. However, if the
459941dd9a6bSDavid Youngapplication needs to create additional rule for the same tunnel it
460041dd9a6bSDavid Youngwill need to obtain PMD items again.
460141dd9a6bSDavid Young
460241dd9a6bSDavid YoungApplication cannot destroy rte_tunnel object before it releases all
460341dd9a6bSDavid YoungPMD actions & PMD items referencing that tunnel.
460441dd9a6bSDavid Young
460541dd9a6bSDavid YoungCaveats
460641dd9a6bSDavid Young-------
460741dd9a6bSDavid Young
460841dd9a6bSDavid Young- DPDK does not keep track of flow rules definitions or flow rule objects
460941dd9a6bSDavid Young  automatically. Applications may keep track of the former and must keep
461041dd9a6bSDavid Young  track of the latter. PMDs may also do it for internal needs, however this
461141dd9a6bSDavid Young  must not be relied on by applications.
461241dd9a6bSDavid Young
461341dd9a6bSDavid Young- Flow rules are not maintained between successive port initializations. An
461441dd9a6bSDavid Young  application exiting without releasing them and restarting must re-create
461541dd9a6bSDavid Young  them from scratch.
461641dd9a6bSDavid Young
461741dd9a6bSDavid Young- API operations are synchronous and blocking (``EAGAIN`` cannot be
461841dd9a6bSDavid Young  returned).
461941dd9a6bSDavid Young
462041dd9a6bSDavid Young- Stopping the data path (TX/RX) should not be necessary when managing flow
462141dd9a6bSDavid Young  rules. If this cannot be achieved naturally or with workarounds (such as
462241dd9a6bSDavid Young  temporarily replacing the burst function pointers), an appropriate error
462341dd9a6bSDavid Young  code must be returned (``EBUSY``).
462441dd9a6bSDavid Young
462541dd9a6bSDavid Young- Applications, not PMDs, are responsible for maintaining flow rules
462641dd9a6bSDavid Young  configuration when closing, stopping or restarting a port or performing other
462741dd9a6bSDavid Young  actions which may affect them.
462841dd9a6bSDavid Young  Applications must assume that after port close, stop or restart all flows
462941dd9a6bSDavid Young  related to that port are not valid, hardware rules are destroyed and relevant
463041dd9a6bSDavid Young  PMD resources are released.
463141dd9a6bSDavid Young
463241dd9a6bSDavid YoungFor devices exposing multiple ports sharing global settings affected by flow
463341dd9a6bSDavid Youngrules:
463441dd9a6bSDavid Young
463541dd9a6bSDavid Young- All ports under DPDK control must behave consistently, PMDs are
463641dd9a6bSDavid Young  responsible for making sure that existing flow rules on a port are not
463741dd9a6bSDavid Young  affected by other ports.
463841dd9a6bSDavid Young
463941dd9a6bSDavid Young- Ports not under DPDK control (unaffected or handled by other applications)
464041dd9a6bSDavid Young  are user's responsibility. They may affect existing flow rules and cause
464141dd9a6bSDavid Young  undefined behavior. PMDs aware of this may prevent flow rules creation
464241dd9a6bSDavid Young  altogether in such cases.
464341dd9a6bSDavid Young
464441dd9a6bSDavid YoungPMD interface
464541dd9a6bSDavid Young-------------
464641dd9a6bSDavid Young
464741dd9a6bSDavid YoungThe PMD interface is defined in ``rte_flow_driver.h``. It is not subject to
464841dd9a6bSDavid YoungAPI/ABI versioning constraints as it is not exposed to applications and may
464941dd9a6bSDavid Youngevolve independently.
465041dd9a6bSDavid Young
465141dd9a6bSDavid YoungThe PMD interface is based on callbacks pointed by the ``struct rte_flow_ops``.
465241dd9a6bSDavid Young
465341dd9a6bSDavid Young- PMD callbacks implement exactly the interface described in `Rules
465441dd9a6bSDavid Young  management`_, except for the port ID argument which has already been
465541dd9a6bSDavid Young  converted to a pointer to the underlying ``struct rte_eth_dev``.
465641dd9a6bSDavid Young
465741dd9a6bSDavid Young- Public API functions do not process flow rules definitions at all before
465841dd9a6bSDavid Young  calling PMD functions (no basic error checking, no validation
465941dd9a6bSDavid Young  whatsoever). They only make sure these callbacks are non-NULL or return
466041dd9a6bSDavid Young  the ``ENOSYS`` (function not supported) error.
466141dd9a6bSDavid Young
466241dd9a6bSDavid YoungThis interface additionally defines the following helper function:
466341dd9a6bSDavid Young
466441dd9a6bSDavid Young- ``rte_flow_ops_get()``: get generic flow operations structure from a
466541dd9a6bSDavid Young  port.
466641dd9a6bSDavid Young
466741dd9a6bSDavid YoungIf PMD interfaces don't support re-entrancy/multi-thread safety,
466841dd9a6bSDavid Youngthe rte_flow API functions will protect threads by mutex per port.
466941dd9a6bSDavid YoungThe application can check whether ``RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE``
467041dd9a6bSDavid Youngis set in ``dev_flags``, meaning the PMD is thread-safe regarding rte_flow,
467141dd9a6bSDavid Youngso the API level protection is disabled.
467241dd9a6bSDavid YoungPlease note that this API-level mutex protects only rte_flow functions,
467341dd9a6bSDavid Youngother control path functions are not in scope.
467441dd9a6bSDavid Young
467541dd9a6bSDavid YoungDevice compatibility
467641dd9a6bSDavid Young--------------------
467741dd9a6bSDavid Young
467841dd9a6bSDavid YoungNo known implementation supports all the described features.
467941dd9a6bSDavid Young
468041dd9a6bSDavid YoungUnsupported features or combinations are not expected to be fully emulated
468141dd9a6bSDavid Youngin software by PMDs for performance reasons. Partially supported features
468241dd9a6bSDavid Youngmay be completed in software as long as hardware performs most of the work
468341dd9a6bSDavid Young(such as queue redirection and packet recognition).
468441dd9a6bSDavid Young
468541dd9a6bSDavid YoungHowever PMDs are expected to do their best to satisfy application requests
468641dd9a6bSDavid Youngby working around hardware limitations as long as doing so does not affect
468741dd9a6bSDavid Youngthe behavior of existing flow rules.
468841dd9a6bSDavid Young
468941dd9a6bSDavid YoungThe following sections provide a few examples of such cases and describe how
469041dd9a6bSDavid YoungPMDs should handle them, they are based on limitations built into the
469141dd9a6bSDavid Youngprevious APIs.
469241dd9a6bSDavid Young
469341dd9a6bSDavid YoungGlobal bit-masks
469441dd9a6bSDavid Young~~~~~~~~~~~~~~~~
469541dd9a6bSDavid Young
469641dd9a6bSDavid YoungEach flow rule comes with its own, per-layer bit-masks, while hardware may
469741dd9a6bSDavid Youngsupport only a single, device-wide bit-mask for a given layer type, so that
469841dd9a6bSDavid Youngtwo IPv4 rules cannot use different bit-masks.
469941dd9a6bSDavid Young
470041dd9a6bSDavid YoungThe expected behavior in this case is that PMDs automatically configure
470141dd9a6bSDavid Youngglobal bit-masks according to the needs of the first flow rule created.
470241dd9a6bSDavid Young
470341dd9a6bSDavid YoungSubsequent rules are allowed only if their bit-masks match those, the
470441dd9a6bSDavid Young``EEXIST`` error code should be returned otherwise.
470541dd9a6bSDavid Young
470641dd9a6bSDavid YoungUnsupported layer types
470741dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~~~~
470841dd9a6bSDavid Young
470941dd9a6bSDavid YoungMany protocols can be simulated by crafting patterns with the `Item: RAW`_
471041dd9a6bSDavid Youngtype.
471141dd9a6bSDavid Young
471241dd9a6bSDavid YoungPMDs can rely on this capability to simulate support for protocols with
471341dd9a6bSDavid Youngheaders not directly recognized by hardware.
471441dd9a6bSDavid Young
471541dd9a6bSDavid Young``ANY`` pattern item
471641dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~~
471741dd9a6bSDavid Young
471841dd9a6bSDavid YoungThis pattern item stands for anything, which can be difficult to translate
471941dd9a6bSDavid Youngto something hardware would understand, particularly if followed by more
472041dd9a6bSDavid Youngspecific types.
472141dd9a6bSDavid Young
472241dd9a6bSDavid YoungConsider the following pattern:
472341dd9a6bSDavid Young
472441dd9a6bSDavid Young.. _table_rte_flow_unsupported_any:
472541dd9a6bSDavid Young
472641dd9a6bSDavid Young.. table:: Pattern with ANY as L3
472741dd9a6bSDavid Young
472841dd9a6bSDavid Young   +-------+-----------------------+
472941dd9a6bSDavid Young   | Index | Item                  |
473041dd9a6bSDavid Young   +=======+=======================+
473141dd9a6bSDavid Young   | 0     | ETHER                 |
473241dd9a6bSDavid Young   +-------+-----+---------+-------+
473341dd9a6bSDavid Young   | 1     | ANY | ``num`` | ``1`` |
473441dd9a6bSDavid Young   +-------+-----+---------+-------+
473541dd9a6bSDavid Young   | 2     | TCP                   |
473641dd9a6bSDavid Young   +-------+-----------------------+
473741dd9a6bSDavid Young   | 3     | END                   |
473841dd9a6bSDavid Young   +-------+-----------------------+
473941dd9a6bSDavid Young
474041dd9a6bSDavid YoungKnowing that TCP does not make sense with something other than IPv4 and IPv6
474141dd9a6bSDavid Youngas L3, such a pattern may be translated to two flow rules instead:
474241dd9a6bSDavid Young
474341dd9a6bSDavid Young.. _table_rte_flow_unsupported_any_ipv4:
474441dd9a6bSDavid Young
474541dd9a6bSDavid Young.. table:: ANY replaced with IPV4
474641dd9a6bSDavid Young
474741dd9a6bSDavid Young   +-------+--------------------+
474841dd9a6bSDavid Young   | Index | Item               |
474941dd9a6bSDavid Young   +=======+====================+
475041dd9a6bSDavid Young   | 0     | ETHER              |
475141dd9a6bSDavid Young   +-------+--------------------+
475241dd9a6bSDavid Young   | 1     | IPV4 (zeroed mask) |
475341dd9a6bSDavid Young   +-------+--------------------+
475441dd9a6bSDavid Young   | 2     | TCP                |
475541dd9a6bSDavid Young   +-------+--------------------+
475641dd9a6bSDavid Young   | 3     | END                |
475741dd9a6bSDavid Young   +-------+--------------------+
475841dd9a6bSDavid Young
475941dd9a6bSDavid Young|
476041dd9a6bSDavid Young
476141dd9a6bSDavid Young.. _table_rte_flow_unsupported_any_ipv6:
476241dd9a6bSDavid Young
476341dd9a6bSDavid Young.. table:: ANY replaced with IPV6
476441dd9a6bSDavid Young
476541dd9a6bSDavid Young   +-------+--------------------+
476641dd9a6bSDavid Young   | Index | Item               |
476741dd9a6bSDavid Young   +=======+====================+
476841dd9a6bSDavid Young   | 0     | ETHER              |
476941dd9a6bSDavid Young   +-------+--------------------+
477041dd9a6bSDavid Young   | 1     | IPV6 (zeroed mask) |
477141dd9a6bSDavid Young   +-------+--------------------+
477241dd9a6bSDavid Young   | 2     | TCP                |
477341dd9a6bSDavid Young   +-------+--------------------+
477441dd9a6bSDavid Young   | 3     | END                |
477541dd9a6bSDavid Young   +-------+--------------------+
477641dd9a6bSDavid Young
477741dd9a6bSDavid YoungNote that as soon as a ANY rule covers several layers, this approach may
477841dd9a6bSDavid Youngyield a large number of hidden flow rules. It is thus suggested to only
477941dd9a6bSDavid Youngsupport the most common scenarios (anything as L2 and/or L3).
478041dd9a6bSDavid Young
478141dd9a6bSDavid YoungUnsupported actions
478241dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~
478341dd9a6bSDavid Young
478441dd9a6bSDavid Young- When combined with `Action: QUEUE`_, packet counting (`Action: COUNT`_)
478541dd9a6bSDavid Young  and tagging (`Action: MARK`_ or `Action: FLAG`_) may be implemented in
478641dd9a6bSDavid Young  software as long as the target queue is used by a single rule.
478741dd9a6bSDavid Young
478841dd9a6bSDavid Young- When a single target queue is provided, `Action: RSS`_ can also be
478941dd9a6bSDavid Young  implemented through `Action: QUEUE`_.
479041dd9a6bSDavid Young
479141dd9a6bSDavid YoungFlow rules priority
479241dd9a6bSDavid Young~~~~~~~~~~~~~~~~~~~
479341dd9a6bSDavid Young
479441dd9a6bSDavid YoungWhile it would naturally make sense, flow rules cannot be assumed to be
479541dd9a6bSDavid Youngprocessed by hardware in the same order as their creation for several
479641dd9a6bSDavid Youngreasons:
479741dd9a6bSDavid Young
479841dd9a6bSDavid Young- They may be managed internally as a tree or a hash table instead of a
479941dd9a6bSDavid Young  list.
480041dd9a6bSDavid Young- Removing a flow rule before adding another one can either put the new rule
480141dd9a6bSDavid Young  at the end of the list or reuse a freed entry.
480241dd9a6bSDavid Young- Duplication may occur when packets are matched by several rules.
480341dd9a6bSDavid Young
480441dd9a6bSDavid YoungFor overlapping rules (particularly in order to use `Action: PASSTHRU`_)
480541dd9a6bSDavid Youngpredictable behavior is only guaranteed by using different priority levels.
480641dd9a6bSDavid Young
480741dd9a6bSDavid YoungPriority levels are not necessarily implemented in hardware, or may be
480841dd9a6bSDavid Youngseverely limited (e.g. a single priority bit).
480941dd9a6bSDavid Young
481041dd9a6bSDavid YoungFor these reasons, priority levels may be implemented purely in software by
481141dd9a6bSDavid YoungPMDs.
481241dd9a6bSDavid Young
481341dd9a6bSDavid Young- For devices expecting flow rules to be added in the correct order, PMDs
481441dd9a6bSDavid Young  may destroy and re-create existing rules after adding a new one with
481541dd9a6bSDavid Young  a higher priority.
481641dd9a6bSDavid Young
481741dd9a6bSDavid Young- A configurable number of dummy or empty rules can be created at
481841dd9a6bSDavid Young  initialization time to save high priority slots for later.
481941dd9a6bSDavid Young
482041dd9a6bSDavid Young- In order to save priority levels, PMDs may evaluate whether rules are
482141dd9a6bSDavid Young  likely to collide and adjust their priority accordingly.
482241dd9a6bSDavid Young
482341dd9a6bSDavid Young
482441dd9a6bSDavid Young.. _OpenFlow Switch Specification: https://www.opennetworking.org/software-defined-standards/specifications/
4825