xref: /dpdk/lib/ethdev/rte_flow.h (revision 13cd6d5c)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright 2016 6WIND S.A.
399a2dd95SBruce Richardson  * Copyright 2016 Mellanox Technologies, Ltd
499a2dd95SBruce Richardson  */
599a2dd95SBruce Richardson 
699a2dd95SBruce Richardson #ifndef RTE_FLOW_H_
799a2dd95SBruce Richardson #define RTE_FLOW_H_
899a2dd95SBruce Richardson 
999a2dd95SBruce Richardson /**
1099a2dd95SBruce Richardson  * @file
1199a2dd95SBruce Richardson  * RTE generic flow API
1299a2dd95SBruce Richardson  *
1399a2dd95SBruce Richardson  * This interface provides the ability to program packet matching and
1499a2dd95SBruce Richardson  * associated actions in hardware through flow rules.
1599a2dd95SBruce Richardson  */
1699a2dd95SBruce Richardson 
1799a2dd95SBruce Richardson #include <stddef.h>
1899a2dd95SBruce Richardson #include <stdint.h>
1999a2dd95SBruce Richardson 
2099a2dd95SBruce Richardson #include <rte_arp.h>
2199a2dd95SBruce Richardson #include <rte_common.h>
2299a2dd95SBruce Richardson #include <rte_ether.h>
2399a2dd95SBruce Richardson #include <rte_icmp.h>
2499a2dd95SBruce Richardson #include <rte_ip.h>
2599a2dd95SBruce Richardson #include <rte_sctp.h>
2699a2dd95SBruce Richardson #include <rte_tcp.h>
2799a2dd95SBruce Richardson #include <rte_udp.h>
2899a2dd95SBruce Richardson #include <rte_vxlan.h>
2999a2dd95SBruce Richardson #include <rte_byteorder.h>
3099a2dd95SBruce Richardson #include <rte_esp.h>
3199a2dd95SBruce Richardson #include <rte_higig.h>
3299a2dd95SBruce Richardson #include <rte_ecpri.h>
339847fd12SBing Zhao #include <rte_bitops.h>
3499a2dd95SBruce Richardson #include <rte_mbuf.h>
3599a2dd95SBruce Richardson #include <rte_mbuf_dyn.h>
365f0d54f3SLi Zhang #include <rte_meter.h>
3716b8e92dSRaslan Darawsheh #include <rte_gtp.h>
383a929df1SJie Wang #include <rte_l2tpv2.h>
393a929df1SJie Wang #include <rte_ppp.h>
40f61490bdSSean Zhang #include <rte_gre.h>
4199a2dd95SBruce Richardson 
4299a2dd95SBruce Richardson #ifdef __cplusplus
4399a2dd95SBruce Richardson extern "C" {
4499a2dd95SBruce Richardson #endif
4599a2dd95SBruce Richardson 
464ff58b73SAlexander Kozyrev #define RTE_FLOW_LOG(level, ...) \
474ff58b73SAlexander Kozyrev 	rte_log(RTE_LOG_ ## level, rte_eth_dev_logtype, "" __VA_ARGS__)
484ff58b73SAlexander Kozyrev 
4999a2dd95SBruce Richardson /**
5099a2dd95SBruce Richardson  * Flow rule attributes.
5199a2dd95SBruce Richardson  *
5299a2dd95SBruce Richardson  * Priorities are set on a per rule based within groups.
5399a2dd95SBruce Richardson  *
5499a2dd95SBruce Richardson  * Lower values denote higher priority, the highest priority for a flow rule
5599a2dd95SBruce Richardson  * is 0, so that a flow that matches for than one rule, the rule with the
5699a2dd95SBruce Richardson  * lowest priority value will always be matched.
5799a2dd95SBruce Richardson  *
5899a2dd95SBruce Richardson  * Although optional, applications are encouraged to group similar rules as
5999a2dd95SBruce Richardson  * much as possible to fully take advantage of hardware capabilities
6099a2dd95SBruce Richardson  * (e.g. optimized matching) and work around limitations (e.g. a single
6199a2dd95SBruce Richardson  * pattern type possibly allowed in a given group). Applications should be
6299a2dd95SBruce Richardson  * aware that groups are not linked by default, and that they must be
6399a2dd95SBruce Richardson  * explicitly linked by the application using the JUMP action.
6499a2dd95SBruce Richardson  *
6599a2dd95SBruce Richardson  * Priority levels are arbitrary and up to the application, they
6699a2dd95SBruce Richardson  * do not need to be contiguous nor start from 0, however the maximum number
6799a2dd95SBruce Richardson  * varies between devices and may be affected by existing flow rules.
6899a2dd95SBruce Richardson  *
6999a2dd95SBruce Richardson  * If a packet is matched by several rules of a given group for a given
7099a2dd95SBruce Richardson  * priority level, the outcome is undefined. It can take any path, may be
7199a2dd95SBruce Richardson  * duplicated or even cause unrecoverable errors.
7299a2dd95SBruce Richardson  *
7399a2dd95SBruce Richardson  * Note that support for more than a single group and priority level is not
7499a2dd95SBruce Richardson  * guaranteed.
7599a2dd95SBruce Richardson  *
769d2a349bSIvan Malov  * At vNIC / ethdev level, flow rules can apply to inbound and / or outbound
779d2a349bSIvan Malov  * traffic (ingress / egress), with respect to the vNIC / ethdev in question.
789d2a349bSIvan Malov  * At embedded switch level, flow rules apply to all traffic seen by it
799d2a349bSIvan Malov  * unless fitting meta items are used to set concrete traffic source(s).
8099a2dd95SBruce Richardson  *
8199a2dd95SBruce Richardson  * Several pattern items and actions are valid and can be used in both
8299a2dd95SBruce Richardson  * directions. Those valid for only one direction are described as such.
8399a2dd95SBruce Richardson  *
8499a2dd95SBruce Richardson  * At least one direction must be specified.
8599a2dd95SBruce Richardson  *
8699a2dd95SBruce Richardson  * Specifying both directions at once for a given rule is not recommended
8792ef4b8fSAndrew Rybchenko  * but may be valid in a few cases.
8899a2dd95SBruce Richardson  */
8999a2dd95SBruce Richardson struct rte_flow_attr {
9099a2dd95SBruce Richardson 	uint32_t group; /**< Priority group. */
9199a2dd95SBruce Richardson 	uint32_t priority; /**< Rule priority level within group. */
929d2a349bSIvan Malov 	/**
939d2a349bSIvan Malov 	 * The rule in question applies to ingress traffic (non-"transfer").
949d2a349bSIvan Malov 	 *
959d2a349bSIvan Malov 	 * @deprecated
969d2a349bSIvan Malov 	 * It has been possible to combine this attribute with "transfer".
979d2a349bSIvan Malov 	 * Doing so has been assumed to restrict the scope of matching
989d2a349bSIvan Malov 	 * to traffic going from within the embedded switch toward the
999d2a349bSIvan Malov 	 * ethdev the flow rule being created through. This behaviour
1009d2a349bSIvan Malov 	 * is deprecated. During the transition period, one may still
1019d2a349bSIvan Malov 	 * rely on it, but PMDs and applications are encouraged to
1029d2a349bSIvan Malov 	 * gradually move away from this approach.
1039d2a349bSIvan Malov 	 */
1049d2a349bSIvan Malov 	uint32_t ingress:1;
1059d2a349bSIvan Malov 	/**
1069d2a349bSIvan Malov 	 * The rule in question applies to egress traffic (non-"transfer").
1079d2a349bSIvan Malov 	 *
1089d2a349bSIvan Malov 	 * @deprecated
1099d2a349bSIvan Malov 	 * It has been possible to combine this attribute with "transfer".
1109d2a349bSIvan Malov 	 * Doing so has been assumed to restrict the scope of matching
1119d2a349bSIvan Malov 	 * to traffic sent by the application by virtue of the ethdev
1129d2a349bSIvan Malov 	 * the flow rule being created through. This behaviour is now
1139d2a349bSIvan Malov 	 * deprecated. During the transition period, one may still
1149d2a349bSIvan Malov 	 * rely on it, but PMDs and applications are encouraged to
1159d2a349bSIvan Malov 	 * gradually move away from this approach.
1169d2a349bSIvan Malov 	 */
1179d2a349bSIvan Malov 	uint32_t egress:1;
11899a2dd95SBruce Richardson 	/**
11999a2dd95SBruce Richardson 	 * Instead of simply matching the properties of traffic as it would
12099a2dd95SBruce Richardson 	 * appear on a given DPDK port ID, enabling this attribute transfers
12199a2dd95SBruce Richardson 	 * a flow rule to the lowest possible level of any device endpoints
12299a2dd95SBruce Richardson 	 * found in the pattern.
12399a2dd95SBruce Richardson 	 *
12499a2dd95SBruce Richardson 	 * When supported, this effectively enables an application to
12599a2dd95SBruce Richardson 	 * re-route traffic not necessarily intended for it (e.g. coming
12699a2dd95SBruce Richardson 	 * from or addressed to different physical ports, VFs or
12799a2dd95SBruce Richardson 	 * applications) at the device level.
12899a2dd95SBruce Richardson 	 *
1299d2a349bSIvan Malov 	 * The application should match traffic originating from precise
1309d2a349bSIvan Malov 	 * locations. See items PORT_REPRESENTOR and REPRESENTED_PORT.
1311179f05cSIvan Malov 	 *
1321179f05cSIvan Malov 	 * Managing "transfer" flows requires that the user communicate them
1331179f05cSIvan Malov 	 * through a suitable port. @see rte_flow_pick_transfer_proxy().
13499a2dd95SBruce Richardson 	 */
13599a2dd95SBruce Richardson 	uint32_t transfer:1;
13699a2dd95SBruce Richardson 	uint32_t reserved:29; /**< Reserved, must be zero. */
13799a2dd95SBruce Richardson };
13899a2dd95SBruce Richardson 
13999a2dd95SBruce Richardson /**
14099a2dd95SBruce Richardson  * Matching pattern item types.
14199a2dd95SBruce Richardson  *
14299a2dd95SBruce Richardson  * Pattern items fall in two categories:
14399a2dd95SBruce Richardson  *
14499a2dd95SBruce Richardson  * - Matching protocol headers and packet data, usually associated with a
14599a2dd95SBruce Richardson  *   specification structure. These must be stacked in the same order as the
14699a2dd95SBruce Richardson  *   protocol layers to match inside packets, starting from the lowest.
14799a2dd95SBruce Richardson  *
14899a2dd95SBruce Richardson  * - Matching meta-data or affecting pattern processing, often without a
14999a2dd95SBruce Richardson  *   specification structure. Since they do not match packet contents, their
15099a2dd95SBruce Richardson  *   position in the list is usually not relevant.
15199a2dd95SBruce Richardson  *
15299a2dd95SBruce Richardson  * See the description of individual types for more information. Those
15399a2dd95SBruce Richardson  * marked with [META] fall into the second category.
15499a2dd95SBruce Richardson  */
15599a2dd95SBruce Richardson enum rte_flow_item_type {
15699a2dd95SBruce Richardson 	/**
15799a2dd95SBruce Richardson 	 * [META]
15899a2dd95SBruce Richardson 	 *
15999a2dd95SBruce Richardson 	 * End marker for item lists. Prevents further processing of items,
16099a2dd95SBruce Richardson 	 * thereby ending the pattern.
16199a2dd95SBruce Richardson 	 *
16299a2dd95SBruce Richardson 	 * No associated specification structure.
16399a2dd95SBruce Richardson 	 */
16499a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_END,
16599a2dd95SBruce Richardson 
16699a2dd95SBruce Richardson 	/**
16799a2dd95SBruce Richardson 	 * [META]
16899a2dd95SBruce Richardson 	 *
16999a2dd95SBruce Richardson 	 * Used as a placeholder for convenience. It is ignored and simply
17099a2dd95SBruce Richardson 	 * discarded by PMDs.
17199a2dd95SBruce Richardson 	 *
17299a2dd95SBruce Richardson 	 * No associated specification structure.
17399a2dd95SBruce Richardson 	 */
17499a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_VOID,
17599a2dd95SBruce Richardson 
17699a2dd95SBruce Richardson 	/**
17799a2dd95SBruce Richardson 	 * [META]
17899a2dd95SBruce Richardson 	 *
17999a2dd95SBruce Richardson 	 * Inverted matching, i.e. process packets that do not match the
18099a2dd95SBruce Richardson 	 * pattern.
18199a2dd95SBruce Richardson 	 *
18299a2dd95SBruce Richardson 	 * No associated specification structure.
18399a2dd95SBruce Richardson 	 */
18499a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_INVERT,
18599a2dd95SBruce Richardson 
18699a2dd95SBruce Richardson 	/**
18799a2dd95SBruce Richardson 	 * Matches any protocol in place of the current layer, a single ANY
18899a2dd95SBruce Richardson 	 * may also stand for several protocol layers.
18999a2dd95SBruce Richardson 	 *
19099a2dd95SBruce Richardson 	 * See struct rte_flow_item_any.
19199a2dd95SBruce Richardson 	 */
19299a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ANY,
19399a2dd95SBruce Richardson 
19499a2dd95SBruce Richardson 	/**
1955da44faaSIvan Malov 	 * @deprecated
1965da44faaSIvan Malov 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
1975da44faaSIvan Malov 	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
1985da44faaSIvan Malov 	 *
19999a2dd95SBruce Richardson 	 * [META]
20099a2dd95SBruce Richardson 	 *
20199a2dd95SBruce Richardson 	 * Matches traffic originating from (ingress) or going to (egress)
20299a2dd95SBruce Richardson 	 * the physical function of the current device.
20399a2dd95SBruce Richardson 	 *
20499a2dd95SBruce Richardson 	 * No associated specification structure.
20599a2dd95SBruce Richardson 	 */
20699a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_PF,
20799a2dd95SBruce Richardson 
20899a2dd95SBruce Richardson 	/**
2095da44faaSIvan Malov 	 * @deprecated
2105da44faaSIvan Malov 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
2115da44faaSIvan Malov 	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
2125da44faaSIvan Malov 	 *
21399a2dd95SBruce Richardson 	 * [META]
21499a2dd95SBruce Richardson 	 *
21599a2dd95SBruce Richardson 	 * Matches traffic originating from (ingress) or going to (egress) a
21699a2dd95SBruce Richardson 	 * given virtual function of the current device.
21799a2dd95SBruce Richardson 	 *
21899a2dd95SBruce Richardson 	 * See struct rte_flow_item_vf.
21999a2dd95SBruce Richardson 	 */
22099a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_VF,
22199a2dd95SBruce Richardson 
22299a2dd95SBruce Richardson 	/**
2235da44faaSIvan Malov 	 * @deprecated
2245da44faaSIvan Malov 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
2255da44faaSIvan Malov 	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
2265da44faaSIvan Malov 	 *
22799a2dd95SBruce Richardson 	 * [META]
22899a2dd95SBruce Richardson 	 *
22999a2dd95SBruce Richardson 	 * Matches traffic originating from (ingress) or going to (egress) a
23099a2dd95SBruce Richardson 	 * physical port of the underlying device.
23199a2dd95SBruce Richardson 	 *
23299a2dd95SBruce Richardson 	 * See struct rte_flow_item_phy_port.
23399a2dd95SBruce Richardson 	 */
23499a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_PHY_PORT,
23599a2dd95SBruce Richardson 
23699a2dd95SBruce Richardson 	/**
2375da44faaSIvan Malov 	 * @deprecated
2385da44faaSIvan Malov 	 * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
2395da44faaSIvan Malov 	 * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
2405da44faaSIvan Malov 	 *
24199a2dd95SBruce Richardson 	 * [META]
24299a2dd95SBruce Richardson 	 *
24399a2dd95SBruce Richardson 	 * Matches traffic originating from (ingress) or going to (egress) a
24499a2dd95SBruce Richardson 	 * given DPDK port ID.
24599a2dd95SBruce Richardson 	 *
24699a2dd95SBruce Richardson 	 * See struct rte_flow_item_port_id.
24799a2dd95SBruce Richardson 	 */
24899a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_PORT_ID,
24999a2dd95SBruce Richardson 
25099a2dd95SBruce Richardson 	/**
25199a2dd95SBruce Richardson 	 * Matches a byte string of a given length at a given offset.
25299a2dd95SBruce Richardson 	 *
25399a2dd95SBruce Richardson 	 * See struct rte_flow_item_raw.
25499a2dd95SBruce Richardson 	 */
25599a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_RAW,
25699a2dd95SBruce Richardson 
25799a2dd95SBruce Richardson 	/**
25899a2dd95SBruce Richardson 	 * Matches an Ethernet header.
25999a2dd95SBruce Richardson 	 *
26099a2dd95SBruce Richardson 	 * See struct rte_flow_item_eth.
26199a2dd95SBruce Richardson 	 */
26299a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ETH,
26399a2dd95SBruce Richardson 
26499a2dd95SBruce Richardson 	/**
26599a2dd95SBruce Richardson 	 * Matches an 802.1Q/ad VLAN tag.
26699a2dd95SBruce Richardson 	 *
26799a2dd95SBruce Richardson 	 * See struct rte_flow_item_vlan.
26899a2dd95SBruce Richardson 	 */
26999a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_VLAN,
27099a2dd95SBruce Richardson 
27199a2dd95SBruce Richardson 	/**
27299a2dd95SBruce Richardson 	 * Matches an IPv4 header.
27399a2dd95SBruce Richardson 	 *
27499a2dd95SBruce Richardson 	 * See struct rte_flow_item_ipv4.
27599a2dd95SBruce Richardson 	 */
27699a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_IPV4,
27799a2dd95SBruce Richardson 
27899a2dd95SBruce Richardson 	/**
27999a2dd95SBruce Richardson 	 * Matches an IPv6 header.
28099a2dd95SBruce Richardson 	 *
28199a2dd95SBruce Richardson 	 * See struct rte_flow_item_ipv6.
28299a2dd95SBruce Richardson 	 */
28399a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_IPV6,
28499a2dd95SBruce Richardson 
28599a2dd95SBruce Richardson 	/**
28699a2dd95SBruce Richardson 	 * Matches an ICMP header.
28799a2dd95SBruce Richardson 	 *
28899a2dd95SBruce Richardson 	 * See struct rte_flow_item_icmp.
28999a2dd95SBruce Richardson 	 */
29099a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ICMP,
29199a2dd95SBruce Richardson 
29299a2dd95SBruce Richardson 	/**
29399a2dd95SBruce Richardson 	 * Matches a UDP header.
29499a2dd95SBruce Richardson 	 *
29599a2dd95SBruce Richardson 	 * See struct rte_flow_item_udp.
29699a2dd95SBruce Richardson 	 */
29799a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_UDP,
29899a2dd95SBruce Richardson 
29999a2dd95SBruce Richardson 	/**
30099a2dd95SBruce Richardson 	 * Matches a TCP header.
30199a2dd95SBruce Richardson 	 *
30299a2dd95SBruce Richardson 	 * See struct rte_flow_item_tcp.
30399a2dd95SBruce Richardson 	 */
30499a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_TCP,
30599a2dd95SBruce Richardson 
30699a2dd95SBruce Richardson 	/**
30799a2dd95SBruce Richardson 	 * Matches a SCTP header.
30899a2dd95SBruce Richardson 	 *
30999a2dd95SBruce Richardson 	 * See struct rte_flow_item_sctp.
31099a2dd95SBruce Richardson 	 */
31199a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_SCTP,
31299a2dd95SBruce Richardson 
31399a2dd95SBruce Richardson 	/**
31499a2dd95SBruce Richardson 	 * Matches a VXLAN header.
31599a2dd95SBruce Richardson 	 *
31699a2dd95SBruce Richardson 	 * See struct rte_flow_item_vxlan.
31799a2dd95SBruce Richardson 	 */
31899a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_VXLAN,
31999a2dd95SBruce Richardson 
32099a2dd95SBruce Richardson 	/**
32199a2dd95SBruce Richardson 	 * Matches a E_TAG header.
32299a2dd95SBruce Richardson 	 *
32399a2dd95SBruce Richardson 	 * See struct rte_flow_item_e_tag.
32499a2dd95SBruce Richardson 	 */
32599a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_E_TAG,
32699a2dd95SBruce Richardson 
32799a2dd95SBruce Richardson 	/**
32899a2dd95SBruce Richardson 	 * Matches a NVGRE header.
32999a2dd95SBruce Richardson 	 *
33099a2dd95SBruce Richardson 	 * See struct rte_flow_item_nvgre.
33199a2dd95SBruce Richardson 	 */
33299a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_NVGRE,
33399a2dd95SBruce Richardson 
33499a2dd95SBruce Richardson 	/**
33599a2dd95SBruce Richardson 	 * Matches a MPLS header.
33699a2dd95SBruce Richardson 	 *
33799a2dd95SBruce Richardson 	 * See struct rte_flow_item_mpls.
33899a2dd95SBruce Richardson 	 */
33999a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_MPLS,
34099a2dd95SBruce Richardson 
34199a2dd95SBruce Richardson 	/**
34299a2dd95SBruce Richardson 	 * Matches a GRE header.
34399a2dd95SBruce Richardson 	 *
34499a2dd95SBruce Richardson 	 * See struct rte_flow_item_gre.
34599a2dd95SBruce Richardson 	 */
34699a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_GRE,
34799a2dd95SBruce Richardson 
34899a2dd95SBruce Richardson 	/**
34999a2dd95SBruce Richardson 	 * [META]
35099a2dd95SBruce Richardson 	 *
35199a2dd95SBruce Richardson 	 * Fuzzy pattern match, expect faster than default.
35299a2dd95SBruce Richardson 	 *
35399a2dd95SBruce Richardson 	 * This is for device that support fuzzy matching option.
35499a2dd95SBruce Richardson 	 * Usually a fuzzy matching is fast but the cost is accuracy.
35599a2dd95SBruce Richardson 	 *
35699a2dd95SBruce Richardson 	 * See struct rte_flow_item_fuzzy.
35799a2dd95SBruce Richardson 	 */
35899a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_FUZZY,
35999a2dd95SBruce Richardson 
36099a2dd95SBruce Richardson 	/**
36199a2dd95SBruce Richardson 	 * Matches a GTP header.
36299a2dd95SBruce Richardson 	 *
36399a2dd95SBruce Richardson 	 * Configure flow for GTP packets.
36499a2dd95SBruce Richardson 	 *
36599a2dd95SBruce Richardson 	 * See struct rte_flow_item_gtp.
36699a2dd95SBruce Richardson 	 */
36799a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_GTP,
36899a2dd95SBruce Richardson 
36999a2dd95SBruce Richardson 	/**
37099a2dd95SBruce Richardson 	 * Matches a GTP header.
37199a2dd95SBruce Richardson 	 *
37299a2dd95SBruce Richardson 	 * Configure flow for GTP-C packets.
37399a2dd95SBruce Richardson 	 *
37499a2dd95SBruce Richardson 	 * See struct rte_flow_item_gtp.
37599a2dd95SBruce Richardson 	 */
37699a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_GTPC,
37799a2dd95SBruce Richardson 
37899a2dd95SBruce Richardson 	/**
37999a2dd95SBruce Richardson 	 * Matches a GTP header.
38099a2dd95SBruce Richardson 	 *
38199a2dd95SBruce Richardson 	 * Configure flow for GTP-U packets.
38299a2dd95SBruce Richardson 	 *
38399a2dd95SBruce Richardson 	 * See struct rte_flow_item_gtp.
38499a2dd95SBruce Richardson 	 */
38599a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_GTPU,
38699a2dd95SBruce Richardson 
38799a2dd95SBruce Richardson 	/**
38899a2dd95SBruce Richardson 	 * Matches a ESP header.
38999a2dd95SBruce Richardson 	 *
39099a2dd95SBruce Richardson 	 * See struct rte_flow_item_esp.
39199a2dd95SBruce Richardson 	 */
39299a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ESP,
39399a2dd95SBruce Richardson 
39499a2dd95SBruce Richardson 	/**
39599a2dd95SBruce Richardson 	 * Matches a GENEVE header.
39699a2dd95SBruce Richardson 	 *
39799a2dd95SBruce Richardson 	 * See struct rte_flow_item_geneve.
39899a2dd95SBruce Richardson 	 */
39999a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_GENEVE,
40099a2dd95SBruce Richardson 
40199a2dd95SBruce Richardson 	/**
40299a2dd95SBruce Richardson 	 * Matches a VXLAN-GPE header.
40399a2dd95SBruce Richardson 	 *
40499a2dd95SBruce Richardson 	 * See struct rte_flow_item_vxlan_gpe.
40599a2dd95SBruce Richardson 	 */
40699a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
40799a2dd95SBruce Richardson 
40899a2dd95SBruce Richardson 	/**
40999a2dd95SBruce Richardson 	 * Matches an ARP header for Ethernet/IPv4.
41099a2dd95SBruce Richardson 	 *
41199a2dd95SBruce Richardson 	 * See struct rte_flow_item_arp_eth_ipv4.
41299a2dd95SBruce Richardson 	 */
41399a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4,
41499a2dd95SBruce Richardson 
41599a2dd95SBruce Richardson 	/**
41699a2dd95SBruce Richardson 	 * Matches the presence of any IPv6 extension header.
41799a2dd95SBruce Richardson 	 *
41899a2dd95SBruce Richardson 	 * See struct rte_flow_item_ipv6_ext.
41999a2dd95SBruce Richardson 	 */
42099a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_IPV6_EXT,
42199a2dd95SBruce Richardson 
42299a2dd95SBruce Richardson 	/**
42399a2dd95SBruce Richardson 	 * Matches any ICMPv6 header.
42499a2dd95SBruce Richardson 	 *
42599a2dd95SBruce Richardson 	 * See struct rte_flow_item_icmp6.
42699a2dd95SBruce Richardson 	 */
42799a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ICMP6,
42899a2dd95SBruce Richardson 
42999a2dd95SBruce Richardson 	/**
43099a2dd95SBruce Richardson 	 * Matches an ICMPv6 neighbor discovery solicitation.
43199a2dd95SBruce Richardson 	 *
43299a2dd95SBruce Richardson 	 * See struct rte_flow_item_icmp6_nd_ns.
43399a2dd95SBruce Richardson 	 */
43499a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS,
43599a2dd95SBruce Richardson 
43699a2dd95SBruce Richardson 	/**
43799a2dd95SBruce Richardson 	 * Matches an ICMPv6 neighbor discovery advertisement.
43899a2dd95SBruce Richardson 	 *
43999a2dd95SBruce Richardson 	 * See struct rte_flow_item_icmp6_nd_na.
44099a2dd95SBruce Richardson 	 */
44199a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA,
44299a2dd95SBruce Richardson 
44399a2dd95SBruce Richardson 	/**
44499a2dd95SBruce Richardson 	 * Matches the presence of any ICMPv6 neighbor discovery option.
44599a2dd95SBruce Richardson 	 *
44699a2dd95SBruce Richardson 	 * See struct rte_flow_item_icmp6_nd_opt.
44799a2dd95SBruce Richardson 	 */
44899a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT,
44999a2dd95SBruce Richardson 
45099a2dd95SBruce Richardson 	/**
45199a2dd95SBruce Richardson 	 * Matches an ICMPv6 neighbor discovery source Ethernet link-layer
45299a2dd95SBruce Richardson 	 * address option.
45399a2dd95SBruce Richardson 	 *
45499a2dd95SBruce Richardson 	 * See struct rte_flow_item_icmp6_nd_opt_sla_eth.
45599a2dd95SBruce Richardson 	 */
45699a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH,
45799a2dd95SBruce Richardson 
45899a2dd95SBruce Richardson 	/**
45999a2dd95SBruce Richardson 	 * Matches an ICMPv6 neighbor discovery target Ethernet link-layer
46099a2dd95SBruce Richardson 	 * address option.
46199a2dd95SBruce Richardson 	 *
46299a2dd95SBruce Richardson 	 * See struct rte_flow_item_icmp6_nd_opt_tla_eth.
46399a2dd95SBruce Richardson 	 */
46499a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH,
46599a2dd95SBruce Richardson 
46699a2dd95SBruce Richardson 	/**
46799a2dd95SBruce Richardson 	 * Matches specified mark field.
46899a2dd95SBruce Richardson 	 *
46999a2dd95SBruce Richardson 	 * See struct rte_flow_item_mark.
47099a2dd95SBruce Richardson 	 */
47199a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_MARK,
47299a2dd95SBruce Richardson 
47399a2dd95SBruce Richardson 	/**
47499a2dd95SBruce Richardson 	 * [META]
47599a2dd95SBruce Richardson 	 *
47699a2dd95SBruce Richardson 	 * Matches a metadata value.
47799a2dd95SBruce Richardson 	 *
47899a2dd95SBruce Richardson 	 * See struct rte_flow_item_meta.
47999a2dd95SBruce Richardson 	 */
48099a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_META,
48199a2dd95SBruce Richardson 
48299a2dd95SBruce Richardson 	/**
48399a2dd95SBruce Richardson 	 * Matches a GRE optional key field.
48499a2dd95SBruce Richardson 	 *
48599a2dd95SBruce Richardson 	 * The value should a big-endian 32bit integer.
48699a2dd95SBruce Richardson 	 *
48799a2dd95SBruce Richardson 	 * When this item present the K bit is implicitly matched as "1"
48899a2dd95SBruce Richardson 	 * in the default mask.
48999a2dd95SBruce Richardson 	 *
49099a2dd95SBruce Richardson 	 * @p spec/mask type:
49199a2dd95SBruce Richardson 	 * @code rte_be32_t * @endcode
49299a2dd95SBruce Richardson 	 */
49399a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_GRE_KEY,
49499a2dd95SBruce Richardson 
49599a2dd95SBruce Richardson 	/**
49699a2dd95SBruce Richardson 	 * Matches a GTP extension header: PDU session container.
49799a2dd95SBruce Richardson 	 *
49899a2dd95SBruce Richardson 	 * Configure flow for GTP packets with extension header type 0x85.
49999a2dd95SBruce Richardson 	 *
50099a2dd95SBruce Richardson 	 * See struct rte_flow_item_gtp_psc.
50199a2dd95SBruce Richardson 	 */
50299a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_GTP_PSC,
50399a2dd95SBruce Richardson 
50499a2dd95SBruce Richardson 	/**
50599a2dd95SBruce Richardson 	 * Matches a PPPoE header.
50699a2dd95SBruce Richardson 	 *
50799a2dd95SBruce Richardson 	 * Configure flow for PPPoE session packets.
50899a2dd95SBruce Richardson 	 *
50999a2dd95SBruce Richardson 	 * See struct rte_flow_item_pppoe.
51099a2dd95SBruce Richardson 	 */
51199a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_PPPOES,
51299a2dd95SBruce Richardson 
51399a2dd95SBruce Richardson 	/**
51499a2dd95SBruce Richardson 	 * Matches a PPPoE header.
51599a2dd95SBruce Richardson 	 *
51699a2dd95SBruce Richardson 	 * Configure flow for PPPoE discovery packets.
51799a2dd95SBruce Richardson 	 *
51899a2dd95SBruce Richardson 	 * See struct rte_flow_item_pppoe.
51999a2dd95SBruce Richardson 	 */
52099a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_PPPOED,
52199a2dd95SBruce Richardson 
52299a2dd95SBruce Richardson 	/**
52399a2dd95SBruce Richardson 	 * Matches a PPPoE optional proto_id field.
52499a2dd95SBruce Richardson 	 *
52599a2dd95SBruce Richardson 	 * It only applies to PPPoE session packets.
52699a2dd95SBruce Richardson 	 *
52799a2dd95SBruce Richardson 	 * See struct rte_flow_item_pppoe_proto_id.
52899a2dd95SBruce Richardson 	 */
52999a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID,
53099a2dd95SBruce Richardson 
53199a2dd95SBruce Richardson 	/**
53299a2dd95SBruce Richardson 	 * Matches Network service header (NSH).
53399a2dd95SBruce Richardson 	 * See struct rte_flow_item_nsh.
53499a2dd95SBruce Richardson 	 *
53599a2dd95SBruce Richardson 	 */
53699a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_NSH,
53799a2dd95SBruce Richardson 
53899a2dd95SBruce Richardson 	/**
53999a2dd95SBruce Richardson 	 * Matches Internet Group Management Protocol (IGMP).
54099a2dd95SBruce Richardson 	 * See struct rte_flow_item_igmp.
54199a2dd95SBruce Richardson 	 *
54299a2dd95SBruce Richardson 	 */
54399a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_IGMP,
54499a2dd95SBruce Richardson 
54599a2dd95SBruce Richardson 	/**
54699a2dd95SBruce Richardson 	 * Matches IP Authentication Header (AH).
54799a2dd95SBruce Richardson 	 * See struct rte_flow_item_ah.
54899a2dd95SBruce Richardson 	 *
54999a2dd95SBruce Richardson 	 */
55099a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_AH,
55199a2dd95SBruce Richardson 
55299a2dd95SBruce Richardson 	/**
55399a2dd95SBruce Richardson 	 * Matches a HIGIG header.
55499a2dd95SBruce Richardson 	 * see struct rte_flow_item_higig2_hdr.
55599a2dd95SBruce Richardson 	 */
55699a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_HIGIG2,
55799a2dd95SBruce Richardson 
55899a2dd95SBruce Richardson 	/**
55999a2dd95SBruce Richardson 	 * [META]
56099a2dd95SBruce Richardson 	 *
56199a2dd95SBruce Richardson 	 * Matches a tag value.
56299a2dd95SBruce Richardson 	 *
56399a2dd95SBruce Richardson 	 * See struct rte_flow_item_tag.
56499a2dd95SBruce Richardson 	 */
56599a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_TAG,
56699a2dd95SBruce Richardson 
56799a2dd95SBruce Richardson 	/**
56899a2dd95SBruce Richardson 	 * Matches a L2TPv3 over IP header.
56999a2dd95SBruce Richardson 	 *
57099a2dd95SBruce Richardson 	 * Configure flow for L2TPv3 over IP packets.
57199a2dd95SBruce Richardson 	 *
57299a2dd95SBruce Richardson 	 * See struct rte_flow_item_l2tpv3oip.
57399a2dd95SBruce Richardson 	 */
57499a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
57599a2dd95SBruce Richardson 
57699a2dd95SBruce Richardson 	/**
57799a2dd95SBruce Richardson 	 * Matches PFCP Header.
57899a2dd95SBruce Richardson 	 * See struct rte_flow_item_pfcp.
57999a2dd95SBruce Richardson 	 *
58099a2dd95SBruce Richardson 	 */
58199a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_PFCP,
58299a2dd95SBruce Richardson 
58399a2dd95SBruce Richardson 	/**
58499a2dd95SBruce Richardson 	 * Matches eCPRI Header.
58599a2dd95SBruce Richardson 	 *
58699a2dd95SBruce Richardson 	 * Configure flow for eCPRI over ETH or UDP packets.
58799a2dd95SBruce Richardson 	 *
58899a2dd95SBruce Richardson 	 * See struct rte_flow_item_ecpri.
58999a2dd95SBruce Richardson 	 */
59099a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_ECPRI,
59199a2dd95SBruce Richardson 
59299a2dd95SBruce Richardson 	/**
59399a2dd95SBruce Richardson 	 * Matches the presence of IPv6 fragment extension header.
59499a2dd95SBruce Richardson 	 *
59599a2dd95SBruce Richardson 	 * See struct rte_flow_item_ipv6_frag_ext.
59699a2dd95SBruce Richardson 	 */
59799a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
59899a2dd95SBruce Richardson 
59999a2dd95SBruce Richardson 	/**
60099a2dd95SBruce Richardson 	 * Matches Geneve Variable Length Option
60199a2dd95SBruce Richardson 	 *
60299a2dd95SBruce Richardson 	 * See struct rte_flow_item_geneve_opt
60399a2dd95SBruce Richardson 	 */
60499a2dd95SBruce Richardson 	RTE_FLOW_ITEM_TYPE_GENEVE_OPT,
605b10a421aSOri Kam 
606b10a421aSOri Kam 	/**
607b10a421aSOri Kam 	 * [META]
608b10a421aSOri Kam 	 *
609b10a421aSOri Kam 	 * Matches on packet integrity.
610b10a421aSOri Kam 	 * For some devices application needs to enable integration checks in HW
611b10a421aSOri Kam 	 * before using this item.
612b10a421aSOri Kam 	 *
613b10a421aSOri Kam 	 * @see struct rte_flow_item_integrity.
614b10a421aSOri Kam 	 */
615b10a421aSOri Kam 	RTE_FLOW_ITEM_TYPE_INTEGRITY,
6169847fd12SBing Zhao 
6179847fd12SBing Zhao 	/**
6189847fd12SBing Zhao 	 * [META]
6199847fd12SBing Zhao 	 *
6209847fd12SBing Zhao 	 * Matches conntrack state.
6219847fd12SBing Zhao 	 *
6229847fd12SBing Zhao 	 * @see struct rte_flow_item_conntrack.
6239847fd12SBing Zhao 	 */
6249847fd12SBing Zhao 	RTE_FLOW_ITEM_TYPE_CONNTRACK,
625081e42daSIvan Malov 
626081e42daSIvan Malov 	/**
627081e42daSIvan Malov 	 * [META]
628081e42daSIvan Malov 	 *
629081e42daSIvan Malov 	 * Matches traffic entering the embedded switch from the given ethdev.
630081e42daSIvan Malov 	 *
631081e42daSIvan Malov 	 * @see struct rte_flow_item_ethdev
632081e42daSIvan Malov 	 */
633081e42daSIvan Malov 	RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
63449863ae2SIvan Malov 
63549863ae2SIvan Malov 	/**
63649863ae2SIvan Malov 	 * [META]
63749863ae2SIvan Malov 	 *
63849863ae2SIvan Malov 	 * Matches traffic entering the embedded switch from
63949863ae2SIvan Malov 	 * the entity represented by the given ethdev.
64049863ae2SIvan Malov 	 *
64149863ae2SIvan Malov 	 * @see struct rte_flow_item_ethdev
64249863ae2SIvan Malov 	 */
64349863ae2SIvan Malov 	RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT,
644dc4d860eSViacheslav Ovsiienko 
645dc4d860eSViacheslav Ovsiienko 	/**
646dc4d860eSViacheslav Ovsiienko 	 * Matches a configured set of fields at runtime calculated offsets
647dc4d860eSViacheslav Ovsiienko 	 * over the generic network header with variable length and
648dc4d860eSViacheslav Ovsiienko 	 * flexible pattern
649dc4d860eSViacheslav Ovsiienko 	 *
650dc4d860eSViacheslav Ovsiienko 	 * @see struct rte_flow_item_flex.
651dc4d860eSViacheslav Ovsiienko 	 */
652dc4d860eSViacheslav Ovsiienko 	RTE_FLOW_ITEM_TYPE_FLEX,
6533a929df1SJie Wang 
6543a929df1SJie Wang 	/**
6553a929df1SJie Wang 	 * Matches L2TPv2 Header.
6563a929df1SJie Wang 	 *
6573a929df1SJie Wang 	 * See struct rte_flow_item_l2tpv2.
6583a929df1SJie Wang 	 */
6593a929df1SJie Wang 	RTE_FLOW_ITEM_TYPE_L2TPV2,
6603a929df1SJie Wang 
6613a929df1SJie Wang 	/**
6623a929df1SJie Wang 	 * Matches PPP Header.
6633a929df1SJie Wang 	 *
6643a929df1SJie Wang 	 * See struct rte_flow_item_ppp.
6653a929df1SJie Wang 	 */
6663a929df1SJie Wang 	RTE_FLOW_ITEM_TYPE_PPP,
667f61490bdSSean Zhang 
668f61490bdSSean Zhang 	/**
669f61490bdSSean Zhang 	 * Matches GRE optional fields.
670f61490bdSSean Zhang 	 *
671f61490bdSSean Zhang 	 * See struct rte_flow_item_gre_opt.
672f61490bdSSean Zhang 	 */
673f61490bdSSean Zhang 	RTE_FLOW_ITEM_TYPE_GRE_OPTION,
67499a2dd95SBruce Richardson };
67599a2dd95SBruce Richardson 
67699a2dd95SBruce Richardson /**
67799a2dd95SBruce Richardson  *
67899a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_HIGIG2
67999a2dd95SBruce Richardson  * Matches higig2 header
68099a2dd95SBruce Richardson  */
68199a2dd95SBruce Richardson RTE_STD_C11
68299a2dd95SBruce Richardson struct rte_flow_item_higig2_hdr {
68399a2dd95SBruce Richardson 	struct rte_higig2_hdr hdr;
68499a2dd95SBruce Richardson };
68599a2dd95SBruce Richardson 
68699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_HIGIG2. */
68799a2dd95SBruce Richardson #ifndef __cplusplus
68899a2dd95SBruce Richardson static const struct rte_flow_item_higig2_hdr rte_flow_item_higig2_hdr_mask = {
68999a2dd95SBruce Richardson 	.hdr = {
69099a2dd95SBruce Richardson 		.ppt1 = {
69199a2dd95SBruce Richardson 			.classification = 0xffff,
69299a2dd95SBruce Richardson 			.vid = 0xfff,
69399a2dd95SBruce Richardson 		},
69499a2dd95SBruce Richardson 	},
69599a2dd95SBruce Richardson };
69699a2dd95SBruce Richardson #endif
69799a2dd95SBruce Richardson 
69899a2dd95SBruce Richardson /**
69999a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ANY
70099a2dd95SBruce Richardson  *
70199a2dd95SBruce Richardson  * Matches any protocol in place of the current layer, a single ANY may also
70299a2dd95SBruce Richardson  * stand for several protocol layers.
70399a2dd95SBruce Richardson  *
70499a2dd95SBruce Richardson  * This is usually specified as the first pattern item when looking for a
70599a2dd95SBruce Richardson  * protocol anywhere in a packet.
70699a2dd95SBruce Richardson  *
70799a2dd95SBruce Richardson  * A zeroed mask stands for any number of layers.
70899a2dd95SBruce Richardson  */
70999a2dd95SBruce Richardson struct rte_flow_item_any {
71099a2dd95SBruce Richardson 	uint32_t num; /**< Number of layers covered. */
71199a2dd95SBruce Richardson };
71299a2dd95SBruce Richardson 
71399a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ANY. */
71499a2dd95SBruce Richardson #ifndef __cplusplus
71599a2dd95SBruce Richardson static const struct rte_flow_item_any rte_flow_item_any_mask = {
71699a2dd95SBruce Richardson 	.num = 0x00000000,
71799a2dd95SBruce Richardson };
71899a2dd95SBruce Richardson #endif
71999a2dd95SBruce Richardson 
72099a2dd95SBruce Richardson /**
7215da44faaSIvan Malov  * @deprecated
7225da44faaSIvan Malov  * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
7235da44faaSIvan Malov  * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
7245da44faaSIvan Malov  *
72599a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_VF
72699a2dd95SBruce Richardson  *
72799a2dd95SBruce Richardson  * Matches traffic originating from (ingress) or going to (egress) a given
72899a2dd95SBruce Richardson  * virtual function of the current device.
72999a2dd95SBruce Richardson  *
73099a2dd95SBruce Richardson  * If supported, should work even if the virtual function is not managed by
73199a2dd95SBruce Richardson  * the application and thus not associated with a DPDK port ID.
73299a2dd95SBruce Richardson  *
73399a2dd95SBruce Richardson  * Note this pattern item does not match VF representors traffic which, as
73499a2dd95SBruce Richardson  * separate entities, should be addressed through their own DPDK port IDs.
73599a2dd95SBruce Richardson  *
73699a2dd95SBruce Richardson  * - Can be specified multiple times to match traffic addressed to several
73799a2dd95SBruce Richardson  *   VF IDs.
73899a2dd95SBruce Richardson  * - Can be combined with a PF item to match both PF and VF traffic.
73999a2dd95SBruce Richardson  *
74099a2dd95SBruce Richardson  * A zeroed mask can be used to match any VF ID.
74199a2dd95SBruce Richardson  */
74299a2dd95SBruce Richardson struct rte_flow_item_vf {
74399a2dd95SBruce Richardson 	uint32_t id; /**< VF ID. */
74499a2dd95SBruce Richardson };
74599a2dd95SBruce Richardson 
74699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_VF. */
74799a2dd95SBruce Richardson #ifndef __cplusplus
74899a2dd95SBruce Richardson static const struct rte_flow_item_vf rte_flow_item_vf_mask = {
74999a2dd95SBruce Richardson 	.id = 0x00000000,
75099a2dd95SBruce Richardson };
75199a2dd95SBruce Richardson #endif
75299a2dd95SBruce Richardson 
75399a2dd95SBruce Richardson /**
7545da44faaSIvan Malov  * @deprecated
7555da44faaSIvan Malov  * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
7565da44faaSIvan Malov  * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
7575da44faaSIvan Malov  *
75899a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_PHY_PORT
75999a2dd95SBruce Richardson  *
76099a2dd95SBruce Richardson  * Matches traffic originating from (ingress) or going to (egress) a
76199a2dd95SBruce Richardson  * physical port of the underlying device.
76299a2dd95SBruce Richardson  *
76399a2dd95SBruce Richardson  * The first PHY_PORT item overrides the physical port normally associated
76499a2dd95SBruce Richardson  * with the specified DPDK input port (port_id). This item can be provided
76599a2dd95SBruce Richardson  * several times to match additional physical ports.
76699a2dd95SBruce Richardson  *
76799a2dd95SBruce Richardson  * Note that physical ports are not necessarily tied to DPDK input ports
76899a2dd95SBruce Richardson  * (port_id) when those are not under DPDK control. Possible values are
76999a2dd95SBruce Richardson  * specific to each device, they are not necessarily indexed from zero and
77099a2dd95SBruce Richardson  * may not be contiguous.
77199a2dd95SBruce Richardson  *
77299a2dd95SBruce Richardson  * As a device property, the list of allowed values as well as the value
77399a2dd95SBruce Richardson  * associated with a port_id should be retrieved by other means.
77499a2dd95SBruce Richardson  *
77599a2dd95SBruce Richardson  * A zeroed mask can be used to match any port index.
77699a2dd95SBruce Richardson  */
77799a2dd95SBruce Richardson struct rte_flow_item_phy_port {
77899a2dd95SBruce Richardson 	uint32_t index; /**< Physical port index. */
77999a2dd95SBruce Richardson };
78099a2dd95SBruce Richardson 
78199a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_PHY_PORT. */
78299a2dd95SBruce Richardson #ifndef __cplusplus
78399a2dd95SBruce Richardson static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask = {
78499a2dd95SBruce Richardson 	.index = 0x00000000,
78599a2dd95SBruce Richardson };
78699a2dd95SBruce Richardson #endif
78799a2dd95SBruce Richardson 
78899a2dd95SBruce Richardson /**
7895da44faaSIvan Malov  * @deprecated
7905da44faaSIvan Malov  * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR
7915da44faaSIvan Malov  * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT
7925da44faaSIvan Malov  *
79399a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_PORT_ID
79499a2dd95SBruce Richardson  *
79599a2dd95SBruce Richardson  * Matches traffic originating from (ingress) or going to (egress) a given
79699a2dd95SBruce Richardson  * DPDK port ID.
79799a2dd95SBruce Richardson  *
79899a2dd95SBruce Richardson  * Normally only supported if the port ID in question is known by the
79999a2dd95SBruce Richardson  * underlying PMD and related to the device the flow rule is created
80099a2dd95SBruce Richardson  * against.
80199a2dd95SBruce Richardson  *
80299a2dd95SBruce Richardson  * This must not be confused with @p PHY_PORT which refers to the physical
80399a2dd95SBruce Richardson  * port of a device, whereas @p PORT_ID refers to a struct rte_eth_dev
80499a2dd95SBruce Richardson  * object on the application side (also known as "port representor"
80599a2dd95SBruce Richardson  * depending on the kind of underlying device).
80699a2dd95SBruce Richardson  */
80799a2dd95SBruce Richardson struct rte_flow_item_port_id {
80899a2dd95SBruce Richardson 	uint32_t id; /**< DPDK port ID. */
80999a2dd95SBruce Richardson };
81099a2dd95SBruce Richardson 
81199a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_PORT_ID. */
81299a2dd95SBruce Richardson #ifndef __cplusplus
81399a2dd95SBruce Richardson static const struct rte_flow_item_port_id rte_flow_item_port_id_mask = {
81499a2dd95SBruce Richardson 	.id = 0xffffffff,
81599a2dd95SBruce Richardson };
81699a2dd95SBruce Richardson #endif
81799a2dd95SBruce Richardson 
81899a2dd95SBruce Richardson /**
81999a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_RAW
82099a2dd95SBruce Richardson  *
82199a2dd95SBruce Richardson  * Matches a byte string of a given length at a given offset.
82299a2dd95SBruce Richardson  *
82399a2dd95SBruce Richardson  * Offset is either absolute (using the start of the packet) or relative to
82499a2dd95SBruce Richardson  * the end of the previous matched item in the stack, in which case negative
82599a2dd95SBruce Richardson  * values are allowed.
82699a2dd95SBruce Richardson  *
82799a2dd95SBruce Richardson  * If search is enabled, offset is used as the starting point. The search
82899a2dd95SBruce Richardson  * area can be delimited by setting limit to a nonzero value, which is the
82999a2dd95SBruce Richardson  * maximum number of bytes after offset where the pattern may start.
83099a2dd95SBruce Richardson  *
83199a2dd95SBruce Richardson  * Matching a zero-length pattern is allowed, doing so resets the relative
83299a2dd95SBruce Richardson  * offset for subsequent items.
83399a2dd95SBruce Richardson  *
83499a2dd95SBruce Richardson  * This type does not support ranges (struct rte_flow_item.last).
83599a2dd95SBruce Richardson  */
83699a2dd95SBruce Richardson struct rte_flow_item_raw {
83799a2dd95SBruce Richardson 	uint32_t relative:1; /**< Look for pattern after the previous item. */
83899a2dd95SBruce Richardson 	uint32_t search:1; /**< Search pattern from offset (see also limit). */
83999a2dd95SBruce Richardson 	uint32_t reserved:30; /**< Reserved, must be set to zero. */
84099a2dd95SBruce Richardson 	int32_t offset; /**< Absolute or relative offset for pattern. */
84199a2dd95SBruce Richardson 	uint16_t limit; /**< Search area limit for start of pattern. */
84299a2dd95SBruce Richardson 	uint16_t length; /**< Pattern length. */
84399a2dd95SBruce Richardson 	const uint8_t *pattern; /**< Byte string to look for. */
84499a2dd95SBruce Richardson };
84599a2dd95SBruce Richardson 
84699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_RAW. */
84799a2dd95SBruce Richardson #ifndef __cplusplus
84899a2dd95SBruce Richardson static const struct rte_flow_item_raw rte_flow_item_raw_mask = {
84999a2dd95SBruce Richardson 	.relative = 1,
85099a2dd95SBruce Richardson 	.search = 1,
85199a2dd95SBruce Richardson 	.reserved = 0x3fffffff,
85299a2dd95SBruce Richardson 	.offset = 0xffffffff,
85399a2dd95SBruce Richardson 	.limit = 0xffff,
85499a2dd95SBruce Richardson 	.length = 0xffff,
85599a2dd95SBruce Richardson 	.pattern = NULL,
85699a2dd95SBruce Richardson };
85799a2dd95SBruce Richardson #endif
85899a2dd95SBruce Richardson 
85999a2dd95SBruce Richardson /**
86099a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ETH
86199a2dd95SBruce Richardson  *
86299a2dd95SBruce Richardson  * Matches an Ethernet header.
86399a2dd95SBruce Richardson  *
86499a2dd95SBruce Richardson  * Inside @p hdr field, the sub-field @p ether_type stands either for EtherType
86599a2dd95SBruce Richardson  * or TPID, depending on whether the item is followed by a VLAN item or not. If
86699a2dd95SBruce Richardson  * two VLAN items follow, the sub-field refers to the outer one, which, in turn,
86799a2dd95SBruce Richardson  * contains the inner TPID in the similar header field. The innermost VLAN item
86899a2dd95SBruce Richardson  * contains a layer-3 EtherType. All of that follows the order seen on the wire.
86999a2dd95SBruce Richardson  *
87099a2dd95SBruce Richardson  * If the field in question contains a TPID value, only tagged packets with the
87199a2dd95SBruce Richardson  * specified TPID will match the pattern. Alternatively, it's possible to match
87299a2dd95SBruce Richardson  * any type of tagged packets by means of the field @p has_vlan rather than use
87399a2dd95SBruce Richardson  * the EtherType/TPID field. Also, it's possible to leave the two fields unused.
87499a2dd95SBruce Richardson  * If this is the case, both tagged and untagged packets will match the pattern.
87599a2dd95SBruce Richardson  */
87699a2dd95SBruce Richardson RTE_STD_C11
87799a2dd95SBruce Richardson struct rte_flow_item_eth {
87899a2dd95SBruce Richardson 	union {
87999a2dd95SBruce Richardson 		struct {
88099a2dd95SBruce Richardson 			/*
88199a2dd95SBruce Richardson 			 * These fields are retained for compatibility.
88299a2dd95SBruce Richardson 			 * Please switch to the new header field below.
88399a2dd95SBruce Richardson 			 */
88499a2dd95SBruce Richardson 			struct rte_ether_addr dst; /**< Destination MAC. */
88599a2dd95SBruce Richardson 			struct rte_ether_addr src; /**< Source MAC. */
88699a2dd95SBruce Richardson 			rte_be16_t type; /**< EtherType or TPID. */
88799a2dd95SBruce Richardson 		};
88899a2dd95SBruce Richardson 		struct rte_ether_hdr hdr;
88999a2dd95SBruce Richardson 	};
89099a2dd95SBruce Richardson 	uint32_t has_vlan:1; /**< Packet header contains at least one VLAN. */
89199a2dd95SBruce Richardson 	uint32_t reserved:31; /**< Reserved, must be zero. */
89299a2dd95SBruce Richardson };
89399a2dd95SBruce Richardson 
89499a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */
89599a2dd95SBruce Richardson #ifndef __cplusplus
89699a2dd95SBruce Richardson static const struct rte_flow_item_eth rte_flow_item_eth_mask = {
89704d43857SDmitry Kozlyuk 	.hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
89804d43857SDmitry Kozlyuk 	.hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff",
89999a2dd95SBruce Richardson 	.hdr.ether_type = RTE_BE16(0x0000),
90099a2dd95SBruce Richardson };
90199a2dd95SBruce Richardson #endif
90299a2dd95SBruce Richardson 
90399a2dd95SBruce Richardson /**
90499a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_VLAN
90599a2dd95SBruce Richardson  *
90699a2dd95SBruce Richardson  * Matches an 802.1Q/ad VLAN tag.
90799a2dd95SBruce Richardson  *
90899a2dd95SBruce Richardson  * The corresponding standard outer EtherType (TPID) values are
90999a2dd95SBruce Richardson  * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by
91099a2dd95SBruce Richardson  * the preceding pattern item.
91199a2dd95SBruce Richardson  * If a @p VLAN item is present in the pattern, then only tagged packets will
91299a2dd95SBruce Richardson  * match the pattern.
91399a2dd95SBruce Richardson  * The field @p has_more_vlan can be used to match any type of tagged packets,
91499a2dd95SBruce Richardson  * instead of using the @p eth_proto field of @p hdr.
91599a2dd95SBruce Richardson  * If the @p eth_proto of @p hdr and @p has_more_vlan fields are not specified,
91699a2dd95SBruce Richardson  * then any tagged packets will match the pattern.
91799a2dd95SBruce Richardson  */
91899a2dd95SBruce Richardson RTE_STD_C11
91999a2dd95SBruce Richardson struct rte_flow_item_vlan {
92099a2dd95SBruce Richardson 	union {
92199a2dd95SBruce Richardson 		struct {
92299a2dd95SBruce Richardson 			/*
92399a2dd95SBruce Richardson 			 * These fields are retained for compatibility.
92499a2dd95SBruce Richardson 			 * Please switch to the new header field below.
92599a2dd95SBruce Richardson 			 */
92699a2dd95SBruce Richardson 			rte_be16_t tci; /**< Tag control information. */
92799a2dd95SBruce Richardson 			rte_be16_t inner_type; /**< Inner EtherType or TPID. */
92899a2dd95SBruce Richardson 		};
92999a2dd95SBruce Richardson 		struct rte_vlan_hdr hdr;
93099a2dd95SBruce Richardson 	};
9313c2ca0a9SAndrew Rybchenko 	/** Packet header contains at least one more VLAN, after this VLAN. */
93299a2dd95SBruce Richardson 	uint32_t has_more_vlan:1;
93399a2dd95SBruce Richardson 	uint32_t reserved:31; /**< Reserved, must be zero. */
93499a2dd95SBruce Richardson };
93599a2dd95SBruce Richardson 
93699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */
93799a2dd95SBruce Richardson #ifndef __cplusplus
93899a2dd95SBruce Richardson static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = {
93999a2dd95SBruce Richardson 	.hdr.vlan_tci = RTE_BE16(0x0fff),
94099a2dd95SBruce Richardson 	.hdr.eth_proto = RTE_BE16(0x0000),
94199a2dd95SBruce Richardson };
94299a2dd95SBruce Richardson #endif
94399a2dd95SBruce Richardson 
94499a2dd95SBruce Richardson /**
94599a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_IPV4
94699a2dd95SBruce Richardson  *
94799a2dd95SBruce Richardson  * Matches an IPv4 header.
94899a2dd95SBruce Richardson  *
94999a2dd95SBruce Richardson  * Note: IPv4 options are handled by dedicated pattern items.
95099a2dd95SBruce Richardson  */
95199a2dd95SBruce Richardson struct rte_flow_item_ipv4 {
95299a2dd95SBruce Richardson 	struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */
95399a2dd95SBruce Richardson };
95499a2dd95SBruce Richardson 
95599a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */
95699a2dd95SBruce Richardson #ifndef __cplusplus
95799a2dd95SBruce Richardson static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = {
95899a2dd95SBruce Richardson 	.hdr = {
95999a2dd95SBruce Richardson 		.src_addr = RTE_BE32(0xffffffff),
96099a2dd95SBruce Richardson 		.dst_addr = RTE_BE32(0xffffffff),
96199a2dd95SBruce Richardson 	},
96299a2dd95SBruce Richardson };
96399a2dd95SBruce Richardson #endif
96499a2dd95SBruce Richardson 
96599a2dd95SBruce Richardson /**
96699a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_IPV6.
96799a2dd95SBruce Richardson  *
96899a2dd95SBruce Richardson  * Matches an IPv6 header.
96999a2dd95SBruce Richardson  *
97099a2dd95SBruce Richardson  * Dedicated flags indicate if header contains specific extension headers.
97199a2dd95SBruce Richardson  */
97299a2dd95SBruce Richardson struct rte_flow_item_ipv6 {
97399a2dd95SBruce Richardson 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
9743c2ca0a9SAndrew Rybchenko 	/** Header contains Hop-by-Hop Options extension header. */
97599a2dd95SBruce Richardson 	uint32_t has_hop_ext:1;
9763c2ca0a9SAndrew Rybchenko 	/** Header contains Routing extension header. */
97799a2dd95SBruce Richardson 	uint32_t has_route_ext:1;
9783c2ca0a9SAndrew Rybchenko 	/** Header contains Fragment extension header. */
97999a2dd95SBruce Richardson 	uint32_t has_frag_ext:1;
9803c2ca0a9SAndrew Rybchenko 	/** Header contains Authentication extension header. */
98199a2dd95SBruce Richardson 	uint32_t has_auth_ext:1;
9823c2ca0a9SAndrew Rybchenko 	/** Header contains Encapsulation Security Payload extension header. */
98399a2dd95SBruce Richardson 	uint32_t has_esp_ext:1;
9843c2ca0a9SAndrew Rybchenko 	/** Header contains Destination Options extension header. */
98599a2dd95SBruce Richardson 	uint32_t has_dest_ext:1;
9863c2ca0a9SAndrew Rybchenko 	/** Header contains Mobility extension header. */
98799a2dd95SBruce Richardson 	uint32_t has_mobil_ext:1;
9883c2ca0a9SAndrew Rybchenko 	/** Header contains Host Identity Protocol extension header. */
98999a2dd95SBruce Richardson 	uint32_t has_hip_ext:1;
9903c2ca0a9SAndrew Rybchenko 	/** Header contains Shim6 Protocol extension header. */
99199a2dd95SBruce Richardson 	uint32_t has_shim6_ext:1;
9923c2ca0a9SAndrew Rybchenko 	/** Reserved for future extension headers, must be zero. */
99399a2dd95SBruce Richardson 	uint32_t reserved:23;
99499a2dd95SBruce Richardson };
99599a2dd95SBruce Richardson 
99699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
99799a2dd95SBruce Richardson #ifndef __cplusplus
99899a2dd95SBruce Richardson static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = {
99999a2dd95SBruce Richardson 	.hdr = {
100099a2dd95SBruce Richardson 		.src_addr =
100199a2dd95SBruce Richardson 			"\xff\xff\xff\xff\xff\xff\xff\xff"
100299a2dd95SBruce Richardson 			"\xff\xff\xff\xff\xff\xff\xff\xff",
100399a2dd95SBruce Richardson 		.dst_addr =
100499a2dd95SBruce Richardson 			"\xff\xff\xff\xff\xff\xff\xff\xff"
100599a2dd95SBruce Richardson 			"\xff\xff\xff\xff\xff\xff\xff\xff",
100699a2dd95SBruce Richardson 	},
100799a2dd95SBruce Richardson };
100899a2dd95SBruce Richardson #endif
100999a2dd95SBruce Richardson 
101099a2dd95SBruce Richardson /**
101199a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ICMP.
101299a2dd95SBruce Richardson  *
101399a2dd95SBruce Richardson  * Matches an ICMP header.
101499a2dd95SBruce Richardson  */
101599a2dd95SBruce Richardson struct rte_flow_item_icmp {
101699a2dd95SBruce Richardson 	struct rte_icmp_hdr hdr; /**< ICMP header definition. */
101799a2dd95SBruce Richardson };
101899a2dd95SBruce Richardson 
101999a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */
102099a2dd95SBruce Richardson #ifndef __cplusplus
102199a2dd95SBruce Richardson static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
102299a2dd95SBruce Richardson 	.hdr = {
102399a2dd95SBruce Richardson 		.icmp_type = 0xff,
102499a2dd95SBruce Richardson 		.icmp_code = 0xff,
102599a2dd95SBruce Richardson 	},
102699a2dd95SBruce Richardson };
102799a2dd95SBruce Richardson #endif
102899a2dd95SBruce Richardson 
102999a2dd95SBruce Richardson /**
103099a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_UDP.
103199a2dd95SBruce Richardson  *
103299a2dd95SBruce Richardson  * Matches a UDP header.
103399a2dd95SBruce Richardson  */
103499a2dd95SBruce Richardson struct rte_flow_item_udp {
103599a2dd95SBruce Richardson 	struct rte_udp_hdr hdr; /**< UDP header definition. */
103699a2dd95SBruce Richardson };
103799a2dd95SBruce Richardson 
103899a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
103999a2dd95SBruce Richardson #ifndef __cplusplus
104099a2dd95SBruce Richardson static const struct rte_flow_item_udp rte_flow_item_udp_mask = {
104199a2dd95SBruce Richardson 	.hdr = {
104299a2dd95SBruce Richardson 		.src_port = RTE_BE16(0xffff),
104399a2dd95SBruce Richardson 		.dst_port = RTE_BE16(0xffff),
104499a2dd95SBruce Richardson 	},
104599a2dd95SBruce Richardson };
104699a2dd95SBruce Richardson #endif
104799a2dd95SBruce Richardson 
104899a2dd95SBruce Richardson /**
104999a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_TCP.
105099a2dd95SBruce Richardson  *
105199a2dd95SBruce Richardson  * Matches a TCP header.
105299a2dd95SBruce Richardson  */
105399a2dd95SBruce Richardson struct rte_flow_item_tcp {
105499a2dd95SBruce Richardson 	struct rte_tcp_hdr hdr; /**< TCP header definition. */
105599a2dd95SBruce Richardson };
105699a2dd95SBruce Richardson 
105799a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */
105899a2dd95SBruce Richardson #ifndef __cplusplus
105999a2dd95SBruce Richardson static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = {
106099a2dd95SBruce Richardson 	.hdr = {
106199a2dd95SBruce Richardson 		.src_port = RTE_BE16(0xffff),
106299a2dd95SBruce Richardson 		.dst_port = RTE_BE16(0xffff),
106399a2dd95SBruce Richardson 	},
106499a2dd95SBruce Richardson };
106599a2dd95SBruce Richardson #endif
106699a2dd95SBruce Richardson 
106799a2dd95SBruce Richardson /**
106899a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_SCTP.
106999a2dd95SBruce Richardson  *
107099a2dd95SBruce Richardson  * Matches a SCTP header.
107199a2dd95SBruce Richardson  */
107299a2dd95SBruce Richardson struct rte_flow_item_sctp {
107399a2dd95SBruce Richardson 	struct rte_sctp_hdr hdr; /**< SCTP header definition. */
107499a2dd95SBruce Richardson };
107599a2dd95SBruce Richardson 
107699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */
107799a2dd95SBruce Richardson #ifndef __cplusplus
107899a2dd95SBruce Richardson static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
107999a2dd95SBruce Richardson 	.hdr = {
108099a2dd95SBruce Richardson 		.src_port = RTE_BE16(0xffff),
108199a2dd95SBruce Richardson 		.dst_port = RTE_BE16(0xffff),
108299a2dd95SBruce Richardson 	},
108399a2dd95SBruce Richardson };
108499a2dd95SBruce Richardson #endif
108599a2dd95SBruce Richardson 
108699a2dd95SBruce Richardson /**
108799a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_VXLAN.
108899a2dd95SBruce Richardson  *
108999a2dd95SBruce Richardson  * Matches a VXLAN header (RFC 7348).
109099a2dd95SBruce Richardson  */
109199a2dd95SBruce Richardson RTE_STD_C11
109299a2dd95SBruce Richardson struct rte_flow_item_vxlan {
109399a2dd95SBruce Richardson 	union {
109499a2dd95SBruce Richardson 		struct {
109599a2dd95SBruce Richardson 			/*
109699a2dd95SBruce Richardson 			 * These fields are retained for compatibility.
109799a2dd95SBruce Richardson 			 * Please switch to the new header field below.
109899a2dd95SBruce Richardson 			 */
109999a2dd95SBruce Richardson 			uint8_t flags; /**< Normally 0x08 (I flag). */
110099a2dd95SBruce Richardson 			uint8_t rsvd0[3]; /**< Reserved, normally 0x000000. */
110199a2dd95SBruce Richardson 			uint8_t vni[3]; /**< VXLAN identifier. */
110299a2dd95SBruce Richardson 			uint8_t rsvd1; /**< Reserved, normally 0x00. */
110399a2dd95SBruce Richardson 		};
110499a2dd95SBruce Richardson 		struct rte_vxlan_hdr hdr;
110599a2dd95SBruce Richardson 	};
110699a2dd95SBruce Richardson };
110799a2dd95SBruce Richardson 
110899a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */
110999a2dd95SBruce Richardson #ifndef __cplusplus
111099a2dd95SBruce Richardson static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
111199a2dd95SBruce Richardson 	.hdr.vx_vni = RTE_BE32(0xffffff00), /* (0xffffff << 8) */
111299a2dd95SBruce Richardson };
111399a2dd95SBruce Richardson #endif
111499a2dd95SBruce Richardson 
111599a2dd95SBruce Richardson /**
111699a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_E_TAG.
111799a2dd95SBruce Richardson  *
111899a2dd95SBruce Richardson  * Matches a E-tag header.
111999a2dd95SBruce Richardson  *
112099a2dd95SBruce Richardson  * The corresponding standard outer EtherType (TPID) value is
112199a2dd95SBruce Richardson  * RTE_ETHER_TYPE_ETAG. It can be overridden by the preceding pattern item.
112299a2dd95SBruce Richardson  */
112399a2dd95SBruce Richardson struct rte_flow_item_e_tag {
112499a2dd95SBruce Richardson 	/**
112599a2dd95SBruce Richardson 	 * E-Tag control information (E-TCI).
112699a2dd95SBruce Richardson 	 * E-PCP (3b), E-DEI (1b), ingress E-CID base (12b).
112799a2dd95SBruce Richardson 	 */
112899a2dd95SBruce Richardson 	rte_be16_t epcp_edei_in_ecid_b;
112999a2dd95SBruce Richardson 	/** Reserved (2b), GRP (2b), E-CID base (12b). */
113099a2dd95SBruce Richardson 	rte_be16_t rsvd_grp_ecid_b;
113199a2dd95SBruce Richardson 	uint8_t in_ecid_e; /**< Ingress E-CID ext. */
113299a2dd95SBruce Richardson 	uint8_t ecid_e; /**< E-CID ext. */
113399a2dd95SBruce Richardson 	rte_be16_t inner_type; /**< Inner EtherType or TPID. */
113499a2dd95SBruce Richardson };
113599a2dd95SBruce Richardson 
113699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */
113799a2dd95SBruce Richardson #ifndef __cplusplus
113899a2dd95SBruce Richardson static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = {
113999a2dd95SBruce Richardson 	.rsvd_grp_ecid_b = RTE_BE16(0x3fff),
114099a2dd95SBruce Richardson };
114199a2dd95SBruce Richardson #endif
114299a2dd95SBruce Richardson 
114399a2dd95SBruce Richardson /**
114499a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_NVGRE.
114599a2dd95SBruce Richardson  *
114699a2dd95SBruce Richardson  * Matches a NVGRE header.
114799a2dd95SBruce Richardson  */
114899a2dd95SBruce Richardson struct rte_flow_item_nvgre {
114999a2dd95SBruce Richardson 	/**
115099a2dd95SBruce Richardson 	 * Checksum (1b), undefined (1b), key bit (1b), sequence number (1b),
115199a2dd95SBruce Richardson 	 * reserved 0 (9b), version (3b).
115299a2dd95SBruce Richardson 	 *
115399a2dd95SBruce Richardson 	 * c_k_s_rsvd0_ver must have value 0x2000 according to RFC 7637.
115499a2dd95SBruce Richardson 	 */
115599a2dd95SBruce Richardson 	rte_be16_t c_k_s_rsvd0_ver;
115699a2dd95SBruce Richardson 	rte_be16_t protocol; /**< Protocol type (0x6558). */
115799a2dd95SBruce Richardson 	uint8_t tni[3]; /**< Virtual subnet ID. */
115899a2dd95SBruce Richardson 	uint8_t flow_id; /**< Flow ID. */
115999a2dd95SBruce Richardson };
116099a2dd95SBruce Richardson 
116199a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */
116299a2dd95SBruce Richardson #ifndef __cplusplus
116399a2dd95SBruce Richardson static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = {
116499a2dd95SBruce Richardson 	.tni = "\xff\xff\xff",
116599a2dd95SBruce Richardson };
116699a2dd95SBruce Richardson #endif
116799a2dd95SBruce Richardson 
116899a2dd95SBruce Richardson /**
116999a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_MPLS.
117099a2dd95SBruce Richardson  *
117199a2dd95SBruce Richardson  * Matches a MPLS header.
117299a2dd95SBruce Richardson  */
117399a2dd95SBruce Richardson struct rte_flow_item_mpls {
117499a2dd95SBruce Richardson 	/**
117599a2dd95SBruce Richardson 	 * Label (20b), TC (3b), Bottom of Stack (1b).
117699a2dd95SBruce Richardson 	 */
117799a2dd95SBruce Richardson 	uint8_t label_tc_s[3];
117899a2dd95SBruce Richardson 	uint8_t ttl; /** Time-to-Live. */
117999a2dd95SBruce Richardson };
118099a2dd95SBruce Richardson 
118199a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_MPLS. */
118299a2dd95SBruce Richardson #ifndef __cplusplus
118399a2dd95SBruce Richardson static const struct rte_flow_item_mpls rte_flow_item_mpls_mask = {
118499a2dd95SBruce Richardson 	.label_tc_s = "\xff\xff\xf0",
118599a2dd95SBruce Richardson };
118699a2dd95SBruce Richardson #endif
118799a2dd95SBruce Richardson 
118899a2dd95SBruce Richardson /**
118999a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_GRE.
119099a2dd95SBruce Richardson  *
119199a2dd95SBruce Richardson  * Matches a GRE header.
119299a2dd95SBruce Richardson  */
119399a2dd95SBruce Richardson struct rte_flow_item_gre {
119499a2dd95SBruce Richardson 	/**
119599a2dd95SBruce Richardson 	 * Checksum (1b), reserved 0 (12b), version (3b).
119699a2dd95SBruce Richardson 	 * Refer to RFC 2784.
119799a2dd95SBruce Richardson 	 */
119899a2dd95SBruce Richardson 	rte_be16_t c_rsvd0_ver;
119999a2dd95SBruce Richardson 	rte_be16_t protocol; /**< Protocol type. */
120099a2dd95SBruce Richardson };
120199a2dd95SBruce Richardson 
120299a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_GRE. */
120399a2dd95SBruce Richardson #ifndef __cplusplus
120499a2dd95SBruce Richardson static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
120599a2dd95SBruce Richardson 	.protocol = RTE_BE16(0xffff),
120699a2dd95SBruce Richardson };
120799a2dd95SBruce Richardson #endif
120899a2dd95SBruce Richardson 
120999a2dd95SBruce Richardson /**
1210f61490bdSSean Zhang  * RTE_FLOW_ITEM_TYPE_GRE_OPTION.
1211f61490bdSSean Zhang  *
1212f61490bdSSean Zhang  * Matches GRE optional fields in header.
1213f61490bdSSean Zhang  */
1214f61490bdSSean Zhang struct rte_flow_item_gre_opt {
1215f61490bdSSean Zhang 	struct rte_gre_hdr_opt_checksum_rsvd checksum_rsvd;
1216f61490bdSSean Zhang 	struct rte_gre_hdr_opt_key key;
1217f61490bdSSean Zhang 	struct rte_gre_hdr_opt_sequence sequence;
1218f61490bdSSean Zhang };
1219f61490bdSSean Zhang 
1220f61490bdSSean Zhang /**
122199a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_FUZZY
122299a2dd95SBruce Richardson  *
122399a2dd95SBruce Richardson  * Fuzzy pattern match, expect faster than default.
122499a2dd95SBruce Richardson  *
122599a2dd95SBruce Richardson  * This is for device that support fuzzy match option.
122699a2dd95SBruce Richardson  * Usually a fuzzy match is fast but the cost is accuracy.
122799a2dd95SBruce Richardson  * i.e. Signature Match only match pattern's hash value, but it is
122899a2dd95SBruce Richardson  * possible two different patterns have the same hash value.
122999a2dd95SBruce Richardson  *
123099a2dd95SBruce Richardson  * Matching accuracy level can be configure by threshold.
123199a2dd95SBruce Richardson  * Driver can divide the range of threshold and map to different
123299a2dd95SBruce Richardson  * accuracy levels that device support.
123399a2dd95SBruce Richardson  *
123499a2dd95SBruce Richardson  * Threshold 0 means perfect match (no fuzziness), while threshold
123599a2dd95SBruce Richardson  * 0xffffffff means fuzziest match.
123699a2dd95SBruce Richardson  */
123799a2dd95SBruce Richardson struct rte_flow_item_fuzzy {
123899a2dd95SBruce Richardson 	uint32_t thresh; /**< Accuracy threshold. */
123999a2dd95SBruce Richardson };
124099a2dd95SBruce Richardson 
124199a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_FUZZY. */
124299a2dd95SBruce Richardson #ifndef __cplusplus
124399a2dd95SBruce Richardson static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask = {
124499a2dd95SBruce Richardson 	.thresh = 0xffffffff,
124599a2dd95SBruce Richardson };
124699a2dd95SBruce Richardson #endif
124799a2dd95SBruce Richardson 
124899a2dd95SBruce Richardson /**
124999a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_GTP.
125099a2dd95SBruce Richardson  *
125199a2dd95SBruce Richardson  * Matches a GTPv1 header.
125299a2dd95SBruce Richardson  */
125399a2dd95SBruce Richardson struct rte_flow_item_gtp {
125499a2dd95SBruce Richardson 	/**
125599a2dd95SBruce Richardson 	 * Version (3b), protocol type (1b), reserved (1b),
125699a2dd95SBruce Richardson 	 * Extension header flag (1b),
125799a2dd95SBruce Richardson 	 * Sequence number flag (1b),
125899a2dd95SBruce Richardson 	 * N-PDU number flag (1b).
125999a2dd95SBruce Richardson 	 */
126099a2dd95SBruce Richardson 	uint8_t v_pt_rsv_flags;
126199a2dd95SBruce Richardson 	uint8_t msg_type; /**< Message type. */
126299a2dd95SBruce Richardson 	rte_be16_t msg_len; /**< Message length. */
126399a2dd95SBruce Richardson 	rte_be32_t teid; /**< Tunnel endpoint identifier. */
126499a2dd95SBruce Richardson };
126599a2dd95SBruce Richardson 
126699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_GTP. */
126799a2dd95SBruce Richardson #ifndef __cplusplus
126899a2dd95SBruce Richardson static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = {
126999a2dd95SBruce Richardson 	.teid = RTE_BE32(0xffffffff),
127099a2dd95SBruce Richardson };
127199a2dd95SBruce Richardson #endif
127299a2dd95SBruce Richardson 
127399a2dd95SBruce Richardson /**
127499a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ESP
127599a2dd95SBruce Richardson  *
127699a2dd95SBruce Richardson  * Matches an ESP header.
127799a2dd95SBruce Richardson  */
127899a2dd95SBruce Richardson struct rte_flow_item_esp {
127999a2dd95SBruce Richardson 	struct rte_esp_hdr hdr; /**< ESP header definition. */
128099a2dd95SBruce Richardson };
128199a2dd95SBruce Richardson 
128299a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */
128399a2dd95SBruce Richardson #ifndef __cplusplus
128499a2dd95SBruce Richardson static const struct rte_flow_item_esp rte_flow_item_esp_mask = {
128599a2dd95SBruce Richardson 	.hdr = {
128699a2dd95SBruce Richardson 		.spi = RTE_BE32(0xffffffff),
128799a2dd95SBruce Richardson 	},
128899a2dd95SBruce Richardson };
128999a2dd95SBruce Richardson #endif
129099a2dd95SBruce Richardson 
129199a2dd95SBruce Richardson /**
129299a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_GENEVE.
129399a2dd95SBruce Richardson  *
129499a2dd95SBruce Richardson  * Matches a GENEVE header.
129599a2dd95SBruce Richardson  */
129699a2dd95SBruce Richardson struct rte_flow_item_geneve {
129799a2dd95SBruce Richardson 	/**
129899a2dd95SBruce Richardson 	 * Version (2b), length of the options fields (6b), OAM packet (1b),
129999a2dd95SBruce Richardson 	 * critical options present (1b), reserved 0 (6b).
130099a2dd95SBruce Richardson 	 */
130199a2dd95SBruce Richardson 	rte_be16_t ver_opt_len_o_c_rsvd0;
130299a2dd95SBruce Richardson 	rte_be16_t protocol; /**< Protocol type. */
130399a2dd95SBruce Richardson 	uint8_t vni[3]; /**< Virtual Network Identifier. */
130499a2dd95SBruce Richardson 	uint8_t rsvd1; /**< Reserved, normally 0x00. */
130599a2dd95SBruce Richardson };
130699a2dd95SBruce Richardson 
130799a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */
130899a2dd95SBruce Richardson #ifndef __cplusplus
130999a2dd95SBruce Richardson static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
131099a2dd95SBruce Richardson 	.vni = "\xff\xff\xff",
131199a2dd95SBruce Richardson };
131299a2dd95SBruce Richardson #endif
131399a2dd95SBruce Richardson 
131499a2dd95SBruce Richardson /**
131599a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05).
131699a2dd95SBruce Richardson  *
131799a2dd95SBruce Richardson  * Matches a VXLAN-GPE header.
131899a2dd95SBruce Richardson  */
131999a2dd95SBruce Richardson struct rte_flow_item_vxlan_gpe {
132099a2dd95SBruce Richardson 	uint8_t flags; /**< Normally 0x0c (I and P flags). */
132199a2dd95SBruce Richardson 	uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */
132299a2dd95SBruce Richardson 	uint8_t protocol; /**< Protocol type. */
132399a2dd95SBruce Richardson 	uint8_t vni[3]; /**< VXLAN identifier. */
132499a2dd95SBruce Richardson 	uint8_t rsvd1; /**< Reserved, normally 0x00. */
132599a2dd95SBruce Richardson };
132699a2dd95SBruce Richardson 
132799a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
132899a2dd95SBruce Richardson #ifndef __cplusplus
132999a2dd95SBruce Richardson static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
133099a2dd95SBruce Richardson 	.vni = "\xff\xff\xff",
133199a2dd95SBruce Richardson };
133299a2dd95SBruce Richardson #endif
133399a2dd95SBruce Richardson 
133499a2dd95SBruce Richardson /**
133599a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4
133699a2dd95SBruce Richardson  *
133799a2dd95SBruce Richardson  * Matches an ARP header for Ethernet/IPv4.
133899a2dd95SBruce Richardson  */
133999a2dd95SBruce Richardson struct rte_flow_item_arp_eth_ipv4 {
134099a2dd95SBruce Richardson 	rte_be16_t hrd; /**< Hardware type, normally 1. */
134199a2dd95SBruce Richardson 	rte_be16_t pro; /**< Protocol type, normally 0x0800. */
134299a2dd95SBruce Richardson 	uint8_t hln; /**< Hardware address length, normally 6. */
134399a2dd95SBruce Richardson 	uint8_t pln; /**< Protocol address length, normally 4. */
134499a2dd95SBruce Richardson 	rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */
134599a2dd95SBruce Richardson 	struct rte_ether_addr sha; /**< Sender hardware address. */
134699a2dd95SBruce Richardson 	rte_be32_t spa; /**< Sender IPv4 address. */
134799a2dd95SBruce Richardson 	struct rte_ether_addr tha; /**< Target hardware address. */
134899a2dd95SBruce Richardson 	rte_be32_t tpa; /**< Target IPv4 address. */
134999a2dd95SBruce Richardson };
135099a2dd95SBruce Richardson 
135199a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4. */
135299a2dd95SBruce Richardson #ifndef __cplusplus
135399a2dd95SBruce Richardson static const struct rte_flow_item_arp_eth_ipv4
135499a2dd95SBruce Richardson rte_flow_item_arp_eth_ipv4_mask = {
135599a2dd95SBruce Richardson 	.sha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
135699a2dd95SBruce Richardson 	.spa = RTE_BE32(0xffffffff),
135799a2dd95SBruce Richardson 	.tha.addr_bytes = "\xff\xff\xff\xff\xff\xff",
135899a2dd95SBruce Richardson 	.tpa = RTE_BE32(0xffffffff),
135999a2dd95SBruce Richardson };
136099a2dd95SBruce Richardson #endif
136199a2dd95SBruce Richardson 
136299a2dd95SBruce Richardson /**
136399a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_IPV6_EXT
136499a2dd95SBruce Richardson  *
136599a2dd95SBruce Richardson  * Matches the presence of any IPv6 extension header.
136699a2dd95SBruce Richardson  *
136799a2dd95SBruce Richardson  * Normally preceded by any of:
136899a2dd95SBruce Richardson  *
136999a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_IPV6
137099a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
137199a2dd95SBruce Richardson  */
137299a2dd95SBruce Richardson struct rte_flow_item_ipv6_ext {
137399a2dd95SBruce Richardson 	uint8_t next_hdr; /**< Next header. */
137499a2dd95SBruce Richardson };
137599a2dd95SBruce Richardson 
137699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6_EXT. */
137799a2dd95SBruce Richardson #ifndef __cplusplus
137899a2dd95SBruce Richardson static const
137999a2dd95SBruce Richardson struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
138099a2dd95SBruce Richardson 	.next_hdr = 0xff,
138199a2dd95SBruce Richardson };
138299a2dd95SBruce Richardson #endif
138399a2dd95SBruce Richardson 
138499a2dd95SBruce Richardson /**
138599a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
138699a2dd95SBruce Richardson  *
138799a2dd95SBruce Richardson  * Matches the presence of IPv6 fragment extension header.
138899a2dd95SBruce Richardson  *
138999a2dd95SBruce Richardson  * Preceded by any of:
139099a2dd95SBruce Richardson  *
139199a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_IPV6
139299a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
139399a2dd95SBruce Richardson  */
139499a2dd95SBruce Richardson struct rte_flow_item_ipv6_frag_ext {
139599a2dd95SBruce Richardson 	struct rte_ipv6_fragment_ext hdr;
139699a2dd95SBruce Richardson };
139799a2dd95SBruce Richardson 
139899a2dd95SBruce Richardson /**
139999a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ICMP6
140099a2dd95SBruce Richardson  *
140199a2dd95SBruce Richardson  * Matches any ICMPv6 header.
140299a2dd95SBruce Richardson  */
140399a2dd95SBruce Richardson struct rte_flow_item_icmp6 {
140499a2dd95SBruce Richardson 	uint8_t type; /**< ICMPv6 type. */
140599a2dd95SBruce Richardson 	uint8_t code; /**< ICMPv6 code. */
140699a2dd95SBruce Richardson 	uint16_t checksum; /**< ICMPv6 checksum. */
140799a2dd95SBruce Richardson };
140899a2dd95SBruce Richardson 
140999a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6. */
141099a2dd95SBruce Richardson #ifndef __cplusplus
141199a2dd95SBruce Richardson static const struct rte_flow_item_icmp6 rte_flow_item_icmp6_mask = {
141299a2dd95SBruce Richardson 	.type = 0xff,
141399a2dd95SBruce Richardson 	.code = 0xff,
141499a2dd95SBruce Richardson };
141599a2dd95SBruce Richardson #endif
141699a2dd95SBruce Richardson 
141799a2dd95SBruce Richardson /**
141899a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
141999a2dd95SBruce Richardson  *
142099a2dd95SBruce Richardson  * Matches an ICMPv6 neighbor discovery solicitation.
142199a2dd95SBruce Richardson  */
142299a2dd95SBruce Richardson struct rte_flow_item_icmp6_nd_ns {
142399a2dd95SBruce Richardson 	uint8_t type; /**< ICMPv6 type, normally 135. */
142499a2dd95SBruce Richardson 	uint8_t code; /**< ICMPv6 code, normally 0. */
142599a2dd95SBruce Richardson 	rte_be16_t checksum; /**< ICMPv6 checksum. */
142699a2dd95SBruce Richardson 	rte_be32_t reserved; /**< Reserved, normally 0. */
142799a2dd95SBruce Richardson 	uint8_t target_addr[16]; /**< Target address. */
142899a2dd95SBruce Richardson };
142999a2dd95SBruce Richardson 
143099a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS. */
143199a2dd95SBruce Richardson #ifndef __cplusplus
143299a2dd95SBruce Richardson static const
143399a2dd95SBruce Richardson struct rte_flow_item_icmp6_nd_ns rte_flow_item_icmp6_nd_ns_mask = {
143499a2dd95SBruce Richardson 	.target_addr =
143599a2dd95SBruce Richardson 		"\xff\xff\xff\xff\xff\xff\xff\xff"
143699a2dd95SBruce Richardson 		"\xff\xff\xff\xff\xff\xff\xff\xff",
143799a2dd95SBruce Richardson };
143899a2dd95SBruce Richardson #endif
143999a2dd95SBruce Richardson 
144099a2dd95SBruce Richardson /**
144199a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
144299a2dd95SBruce Richardson  *
144399a2dd95SBruce Richardson  * Matches an ICMPv6 neighbor discovery advertisement.
144499a2dd95SBruce Richardson  */
144599a2dd95SBruce Richardson struct rte_flow_item_icmp6_nd_na {
144699a2dd95SBruce Richardson 	uint8_t type; /**< ICMPv6 type, normally 136. */
144799a2dd95SBruce Richardson 	uint8_t code; /**< ICMPv6 code, normally 0. */
144899a2dd95SBruce Richardson 	rte_be16_t checksum; /**< ICMPv6 checksum. */
144999a2dd95SBruce Richardson 	/**
145099a2dd95SBruce Richardson 	 * Route flag (1b), solicited flag (1b), override flag (1b),
145199a2dd95SBruce Richardson 	 * reserved (29b).
145299a2dd95SBruce Richardson 	 */
145399a2dd95SBruce Richardson 	rte_be32_t rso_reserved;
145499a2dd95SBruce Richardson 	uint8_t target_addr[16]; /**< Target address. */
145599a2dd95SBruce Richardson };
145699a2dd95SBruce Richardson 
145799a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA. */
145899a2dd95SBruce Richardson #ifndef __cplusplus
145999a2dd95SBruce Richardson static const
146099a2dd95SBruce Richardson struct rte_flow_item_icmp6_nd_na rte_flow_item_icmp6_nd_na_mask = {
146199a2dd95SBruce Richardson 	.target_addr =
146299a2dd95SBruce Richardson 		"\xff\xff\xff\xff\xff\xff\xff\xff"
146399a2dd95SBruce Richardson 		"\xff\xff\xff\xff\xff\xff\xff\xff",
146499a2dd95SBruce Richardson };
146599a2dd95SBruce Richardson #endif
146699a2dd95SBruce Richardson 
146799a2dd95SBruce Richardson /**
146899a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
146999a2dd95SBruce Richardson  *
147099a2dd95SBruce Richardson  * Matches the presence of any ICMPv6 neighbor discovery option.
147199a2dd95SBruce Richardson  *
147299a2dd95SBruce Richardson  * Normally preceded by any of:
147399a2dd95SBruce Richardson  *
147499a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
147599a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
147699a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
147799a2dd95SBruce Richardson  */
147899a2dd95SBruce Richardson struct rte_flow_item_icmp6_nd_opt {
147999a2dd95SBruce Richardson 	uint8_t type; /**< ND option type. */
148099a2dd95SBruce Richardson 	uint8_t length; /**< ND option length. */
148199a2dd95SBruce Richardson };
148299a2dd95SBruce Richardson 
148399a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT. */
148499a2dd95SBruce Richardson #ifndef __cplusplus
148599a2dd95SBruce Richardson static const struct rte_flow_item_icmp6_nd_opt
148699a2dd95SBruce Richardson rte_flow_item_icmp6_nd_opt_mask = {
148799a2dd95SBruce Richardson 	.type = 0xff,
148899a2dd95SBruce Richardson };
148999a2dd95SBruce Richardson #endif
149099a2dd95SBruce Richardson 
149199a2dd95SBruce Richardson /**
149299a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH
149399a2dd95SBruce Richardson  *
149499a2dd95SBruce Richardson  * Matches an ICMPv6 neighbor discovery source Ethernet link-layer address
149599a2dd95SBruce Richardson  * option.
149699a2dd95SBruce Richardson  *
149799a2dd95SBruce Richardson  * Normally preceded by any of:
149899a2dd95SBruce Richardson  *
149999a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NA
150099a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
150199a2dd95SBruce Richardson  */
150299a2dd95SBruce Richardson struct rte_flow_item_icmp6_nd_opt_sla_eth {
150399a2dd95SBruce Richardson 	uint8_t type; /**< ND option type, normally 1. */
150499a2dd95SBruce Richardson 	uint8_t length; /**< ND option length, normally 1. */
150599a2dd95SBruce Richardson 	struct rte_ether_addr sla; /**< Source Ethernet LLA. */
150699a2dd95SBruce Richardson };
150799a2dd95SBruce Richardson 
150899a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */
150999a2dd95SBruce Richardson #ifndef __cplusplus
151099a2dd95SBruce Richardson static const struct rte_flow_item_icmp6_nd_opt_sla_eth
151199a2dd95SBruce Richardson rte_flow_item_icmp6_nd_opt_sla_eth_mask = {
151299a2dd95SBruce Richardson 	.sla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
151399a2dd95SBruce Richardson };
151499a2dd95SBruce Richardson #endif
151599a2dd95SBruce Richardson 
151699a2dd95SBruce Richardson /**
151799a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH
151899a2dd95SBruce Richardson  *
151999a2dd95SBruce Richardson  * Matches an ICMPv6 neighbor discovery target Ethernet link-layer address
152099a2dd95SBruce Richardson  * option.
152199a2dd95SBruce Richardson  *
152299a2dd95SBruce Richardson  * Normally preceded by any of:
152399a2dd95SBruce Richardson  *
152499a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_NS
152599a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT
152699a2dd95SBruce Richardson  */
152799a2dd95SBruce Richardson struct rte_flow_item_icmp6_nd_opt_tla_eth {
152899a2dd95SBruce Richardson 	uint8_t type; /**< ND option type, normally 2. */
152999a2dd95SBruce Richardson 	uint8_t length; /**< ND option length, normally 1. */
153099a2dd95SBruce Richardson 	struct rte_ether_addr tla; /**< Target Ethernet LLA. */
153199a2dd95SBruce Richardson };
153299a2dd95SBruce Richardson 
153399a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */
153499a2dd95SBruce Richardson #ifndef __cplusplus
153599a2dd95SBruce Richardson static const struct rte_flow_item_icmp6_nd_opt_tla_eth
153699a2dd95SBruce Richardson rte_flow_item_icmp6_nd_opt_tla_eth_mask = {
153799a2dd95SBruce Richardson 	.tla.addr_bytes = "\xff\xff\xff\xff\xff\xff",
153899a2dd95SBruce Richardson };
153999a2dd95SBruce Richardson #endif
154099a2dd95SBruce Richardson 
154199a2dd95SBruce Richardson /**
154299a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_META
154399a2dd95SBruce Richardson  *
154499a2dd95SBruce Richardson  * Matches a specified metadata value. On egress, metadata can be set
1545daa02b5cSOlivier Matz  * either by mbuf dynamic metadata field with RTE_MBUF_DYNFLAG_TX_METADATA flag
1546daa02b5cSOlivier Matz  * or RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META
154799a2dd95SBruce Richardson  * sets metadata for a packet and the metadata will be reported via mbuf
1548daa02b5cSOlivier Matz  * metadata dynamic field with RTE_MBUF_DYNFLAG_RX_METADATA flag. The dynamic
1549daa02b5cSOlivier Matz  * mbuf field must be registered in advance by
1550daa02b5cSOlivier Matz  * rte_flow_dynf_metadata_register().
155199a2dd95SBruce Richardson  */
155299a2dd95SBruce Richardson struct rte_flow_item_meta {
155399a2dd95SBruce Richardson 	uint32_t data;
155499a2dd95SBruce Richardson };
155599a2dd95SBruce Richardson 
155699a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_META. */
155799a2dd95SBruce Richardson #ifndef __cplusplus
155899a2dd95SBruce Richardson static const struct rte_flow_item_meta rte_flow_item_meta_mask = {
155999a2dd95SBruce Richardson 	.data = UINT32_MAX,
156099a2dd95SBruce Richardson };
156199a2dd95SBruce Richardson #endif
156299a2dd95SBruce Richardson 
156399a2dd95SBruce Richardson /**
156499a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_GTP_PSC.
156599a2dd95SBruce Richardson  *
156699a2dd95SBruce Richardson  * Matches a GTP PDU extension header with type 0x85.
156799a2dd95SBruce Richardson  */
156899a2dd95SBruce Richardson struct rte_flow_item_gtp_psc {
156916b8e92dSRaslan Darawsheh 	struct rte_gtp_psc_generic_hdr hdr; /**< gtp psc generic hdr. */
157099a2dd95SBruce Richardson };
157199a2dd95SBruce Richardson 
157299a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */
157399a2dd95SBruce Richardson #ifndef __cplusplus
157499a2dd95SBruce Richardson static const struct rte_flow_item_gtp_psc
157599a2dd95SBruce Richardson rte_flow_item_gtp_psc_mask = {
157616b8e92dSRaslan Darawsheh 	.hdr.qfi = 0x3f,
157799a2dd95SBruce Richardson };
157899a2dd95SBruce Richardson #endif
157999a2dd95SBruce Richardson 
158099a2dd95SBruce Richardson /**
158199a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_PPPOE.
158299a2dd95SBruce Richardson  *
158399a2dd95SBruce Richardson  * Matches a PPPoE header.
158499a2dd95SBruce Richardson  */
158599a2dd95SBruce Richardson struct rte_flow_item_pppoe {
158699a2dd95SBruce Richardson 	/**
158799a2dd95SBruce Richardson 	 * Version (4b), type (4b).
158899a2dd95SBruce Richardson 	 */
158999a2dd95SBruce Richardson 	uint8_t version_type;
159099a2dd95SBruce Richardson 	uint8_t code; /**< Message type. */
159199a2dd95SBruce Richardson 	rte_be16_t session_id; /**< Session identifier. */
159299a2dd95SBruce Richardson 	rte_be16_t length; /**< Payload length. */
159399a2dd95SBruce Richardson };
159499a2dd95SBruce Richardson 
159599a2dd95SBruce Richardson /**
159699a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID.
159799a2dd95SBruce Richardson  *
159899a2dd95SBruce Richardson  * Matches a PPPoE optional proto_id field.
159999a2dd95SBruce Richardson  *
160099a2dd95SBruce Richardson  * It only applies to PPPoE session packets.
160199a2dd95SBruce Richardson  *
160299a2dd95SBruce Richardson  * Normally preceded by any of:
160399a2dd95SBruce Richardson  *
160499a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_PPPOE
160599a2dd95SBruce Richardson  * - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID
160699a2dd95SBruce Richardson  */
160799a2dd95SBruce Richardson struct rte_flow_item_pppoe_proto_id {
160899a2dd95SBruce Richardson 	rte_be16_t proto_id; /**< PPP protocol identifier. */
160999a2dd95SBruce Richardson };
161099a2dd95SBruce Richardson 
161199a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. */
161299a2dd95SBruce Richardson #ifndef __cplusplus
161399a2dd95SBruce Richardson static const struct rte_flow_item_pppoe_proto_id
161499a2dd95SBruce Richardson rte_flow_item_pppoe_proto_id_mask = {
161599a2dd95SBruce Richardson 	.proto_id = RTE_BE16(0xffff),
161699a2dd95SBruce Richardson };
161799a2dd95SBruce Richardson #endif
161899a2dd95SBruce Richardson 
161999a2dd95SBruce Richardson /**
162099a2dd95SBruce Richardson  * @warning
162199a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
162299a2dd95SBruce Richardson  *
162399a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_TAG
162499a2dd95SBruce Richardson  *
162599a2dd95SBruce Richardson  * Matches a specified tag value at the specified index.
162699a2dd95SBruce Richardson  */
162799a2dd95SBruce Richardson struct rte_flow_item_tag {
162899a2dd95SBruce Richardson 	uint32_t data;
162999a2dd95SBruce Richardson 	uint8_t index;
163099a2dd95SBruce Richardson };
163199a2dd95SBruce Richardson 
163299a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_TAG. */
163399a2dd95SBruce Richardson #ifndef __cplusplus
163499a2dd95SBruce Richardson static const struct rte_flow_item_tag rte_flow_item_tag_mask = {
163599a2dd95SBruce Richardson 	.data = 0xffffffff,
163699a2dd95SBruce Richardson 	.index = 0xff,
163799a2dd95SBruce Richardson };
163899a2dd95SBruce Richardson #endif
163999a2dd95SBruce Richardson 
164099a2dd95SBruce Richardson /**
164199a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_L2TPV3OIP.
164299a2dd95SBruce Richardson  *
164399a2dd95SBruce Richardson  * Matches a L2TPv3 over IP header.
164499a2dd95SBruce Richardson  */
164599a2dd95SBruce Richardson struct rte_flow_item_l2tpv3oip {
164699a2dd95SBruce Richardson 	rte_be32_t session_id; /**< Session ID. */
164799a2dd95SBruce Richardson };
164899a2dd95SBruce Richardson 
164999a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3OIP. */
165099a2dd95SBruce Richardson #ifndef __cplusplus
165199a2dd95SBruce Richardson static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask = {
165299a2dd95SBruce Richardson 	.session_id = RTE_BE32(UINT32_MAX),
165399a2dd95SBruce Richardson };
165499a2dd95SBruce Richardson #endif
165599a2dd95SBruce Richardson 
165699a2dd95SBruce Richardson 
165799a2dd95SBruce Richardson /**
165899a2dd95SBruce Richardson  * @warning
165999a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
166099a2dd95SBruce Richardson  *
166199a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_MARK
166299a2dd95SBruce Richardson  *
166399a2dd95SBruce Richardson  * Matches an arbitrary integer value which was set using the ``MARK`` action
166499a2dd95SBruce Richardson  * in a previously matched rule.
166599a2dd95SBruce Richardson  *
166699a2dd95SBruce Richardson  * This item can only be specified once as a match criteria as the ``MARK``
166799a2dd95SBruce Richardson  * action can only be specified once in a flow action.
166899a2dd95SBruce Richardson  *
166999a2dd95SBruce Richardson  * This value is arbitrary and application-defined. Maximum allowed value
167099a2dd95SBruce Richardson  * depends on the underlying implementation.
167199a2dd95SBruce Richardson  *
167299a2dd95SBruce Richardson  * Depending on the underlying implementation the MARK item may be supported on
167399a2dd95SBruce Richardson  * the physical device, with virtual groups in the PMD or not at all.
167499a2dd95SBruce Richardson  */
167599a2dd95SBruce Richardson struct rte_flow_item_mark {
167699a2dd95SBruce Richardson 	uint32_t id; /**< Integer value to match against. */
167799a2dd95SBruce Richardson };
167899a2dd95SBruce Richardson 
167999a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_MARK. */
168099a2dd95SBruce Richardson #ifndef __cplusplus
168199a2dd95SBruce Richardson static const struct rte_flow_item_mark rte_flow_item_mark_mask = {
168299a2dd95SBruce Richardson 	.id = 0xffffffff,
168399a2dd95SBruce Richardson };
168499a2dd95SBruce Richardson #endif
168599a2dd95SBruce Richardson 
168699a2dd95SBruce Richardson /**
168799a2dd95SBruce Richardson  * @warning
168899a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
168999a2dd95SBruce Richardson  *
169099a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_NSH
169199a2dd95SBruce Richardson  *
169299a2dd95SBruce Richardson  * Match network service header (NSH), RFC 8300
169399a2dd95SBruce Richardson  *
169499a2dd95SBruce Richardson  */
169599a2dd95SBruce Richardson struct rte_flow_item_nsh {
169699a2dd95SBruce Richardson 	uint32_t version:2;
169799a2dd95SBruce Richardson 	uint32_t oam_pkt:1;
169899a2dd95SBruce Richardson 	uint32_t reserved:1;
169999a2dd95SBruce Richardson 	uint32_t ttl:6;
170099a2dd95SBruce Richardson 	uint32_t length:6;
170199a2dd95SBruce Richardson 	uint32_t reserved1:4;
170299a2dd95SBruce Richardson 	uint32_t mdtype:4;
170399a2dd95SBruce Richardson 	uint32_t next_proto:8;
170499a2dd95SBruce Richardson 	uint32_t spi:24;
170599a2dd95SBruce Richardson 	uint32_t sindex:8;
170699a2dd95SBruce Richardson };
170799a2dd95SBruce Richardson 
170899a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_NSH. */
170999a2dd95SBruce Richardson #ifndef __cplusplus
171099a2dd95SBruce Richardson static const struct rte_flow_item_nsh rte_flow_item_nsh_mask = {
171199a2dd95SBruce Richardson 	.mdtype = 0xf,
171299a2dd95SBruce Richardson 	.next_proto = 0xff,
171399a2dd95SBruce Richardson 	.spi = 0xffffff,
171499a2dd95SBruce Richardson 	.sindex = 0xff,
171599a2dd95SBruce Richardson };
171699a2dd95SBruce Richardson #endif
171799a2dd95SBruce Richardson 
171899a2dd95SBruce Richardson /**
171999a2dd95SBruce Richardson  * @warning
172099a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
172199a2dd95SBruce Richardson  *
172299a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_IGMP
172399a2dd95SBruce Richardson  *
172499a2dd95SBruce Richardson  * Match Internet Group Management Protocol (IGMP), RFC 2236
172599a2dd95SBruce Richardson  *
172699a2dd95SBruce Richardson  */
172799a2dd95SBruce Richardson struct rte_flow_item_igmp {
172899a2dd95SBruce Richardson 	uint32_t type:8;
172999a2dd95SBruce Richardson 	uint32_t max_resp_time:8;
173099a2dd95SBruce Richardson 	uint32_t checksum:16;
173199a2dd95SBruce Richardson 	uint32_t group_addr;
173299a2dd95SBruce Richardson };
173399a2dd95SBruce Richardson 
173499a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_IGMP. */
173599a2dd95SBruce Richardson #ifndef __cplusplus
173699a2dd95SBruce Richardson static const struct rte_flow_item_igmp rte_flow_item_igmp_mask = {
173799a2dd95SBruce Richardson 	.group_addr = 0xffffffff,
173899a2dd95SBruce Richardson };
173999a2dd95SBruce Richardson #endif
174099a2dd95SBruce Richardson 
174199a2dd95SBruce Richardson /**
174299a2dd95SBruce Richardson  * @warning
174399a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
174499a2dd95SBruce Richardson  *
174599a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_AH
174699a2dd95SBruce Richardson  *
174799a2dd95SBruce Richardson  * Match IP Authentication Header (AH), RFC 4302
174899a2dd95SBruce Richardson  *
174999a2dd95SBruce Richardson  */
175099a2dd95SBruce Richardson struct rte_flow_item_ah {
175199a2dd95SBruce Richardson 	uint32_t next_hdr:8;
175299a2dd95SBruce Richardson 	uint32_t payload_len:8;
175399a2dd95SBruce Richardson 	uint32_t reserved:16;
175499a2dd95SBruce Richardson 	uint32_t spi;
175599a2dd95SBruce Richardson 	uint32_t seq_num;
175699a2dd95SBruce Richardson };
175799a2dd95SBruce Richardson 
175899a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_AH. */
175999a2dd95SBruce Richardson #ifndef __cplusplus
176099a2dd95SBruce Richardson static const struct rte_flow_item_ah rte_flow_item_ah_mask = {
176199a2dd95SBruce Richardson 	.spi = 0xffffffff,
176299a2dd95SBruce Richardson };
176399a2dd95SBruce Richardson #endif
176499a2dd95SBruce Richardson 
176599a2dd95SBruce Richardson /**
176699a2dd95SBruce Richardson  * @warning
176799a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
176899a2dd95SBruce Richardson  *
176999a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_PFCP
177099a2dd95SBruce Richardson  *
177199a2dd95SBruce Richardson  * Match PFCP Header
177299a2dd95SBruce Richardson  */
177399a2dd95SBruce Richardson struct rte_flow_item_pfcp {
177499a2dd95SBruce Richardson 	uint8_t s_field;
177599a2dd95SBruce Richardson 	uint8_t msg_type;
177699a2dd95SBruce Richardson 	rte_be16_t msg_len;
177799a2dd95SBruce Richardson 	rte_be64_t seid;
177899a2dd95SBruce Richardson };
177999a2dd95SBruce Richardson 
178099a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */
178199a2dd95SBruce Richardson #ifndef __cplusplus
178299a2dd95SBruce Richardson static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask = {
178399a2dd95SBruce Richardson 	.s_field = 0x01,
178499a2dd95SBruce Richardson 	.seid = RTE_BE64(UINT64_C(0xffffffffffffffff)),
178599a2dd95SBruce Richardson };
178699a2dd95SBruce Richardson #endif
178799a2dd95SBruce Richardson 
178899a2dd95SBruce Richardson /**
178999a2dd95SBruce Richardson  * @warning
179099a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
179199a2dd95SBruce Richardson  *
179299a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_ECPRI
179399a2dd95SBruce Richardson  *
179499a2dd95SBruce Richardson  * Match eCPRI Header
179599a2dd95SBruce Richardson  */
179699a2dd95SBruce Richardson struct rte_flow_item_ecpri {
179799a2dd95SBruce Richardson 	struct rte_ecpri_combined_msg_hdr hdr;
179899a2dd95SBruce Richardson };
179999a2dd95SBruce Richardson 
180099a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_ECPRI. */
180199a2dd95SBruce Richardson #ifndef __cplusplus
180299a2dd95SBruce Richardson static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask = {
180399a2dd95SBruce Richardson 	.hdr = {
180499a2dd95SBruce Richardson 		.common = {
180599a2dd95SBruce Richardson 			.u32 = 0x0,
180699a2dd95SBruce Richardson 		},
180799a2dd95SBruce Richardson 	},
180899a2dd95SBruce Richardson };
180999a2dd95SBruce Richardson #endif
181099a2dd95SBruce Richardson 
181199a2dd95SBruce Richardson /**
181299a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_GENEVE_OPT
181399a2dd95SBruce Richardson  *
181499a2dd95SBruce Richardson  * Matches a GENEVE Variable Length Option
181599a2dd95SBruce Richardson  */
181699a2dd95SBruce Richardson struct rte_flow_item_geneve_opt {
181799a2dd95SBruce Richardson 	rte_be16_t option_class;
181899a2dd95SBruce Richardson 	uint8_t option_type;
181999a2dd95SBruce Richardson 	uint8_t option_len;
182099a2dd95SBruce Richardson 	uint32_t *data;
182199a2dd95SBruce Richardson };
182299a2dd95SBruce Richardson 
182399a2dd95SBruce Richardson /** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE_OPT. */
182499a2dd95SBruce Richardson #ifndef __cplusplus
182599a2dd95SBruce Richardson static const struct rte_flow_item_geneve_opt
182699a2dd95SBruce Richardson rte_flow_item_geneve_opt_mask = {
182799a2dd95SBruce Richardson 	.option_type = 0xff,
182899a2dd95SBruce Richardson };
182999a2dd95SBruce Richardson #endif
183099a2dd95SBruce Richardson 
18310d025f01SThomas Monjalon /**
18320d025f01SThomas Monjalon  * @warning
18330d025f01SThomas Monjalon  * @b EXPERIMENTAL: this structure may change without prior notice
18340d025f01SThomas Monjalon  *
18350d025f01SThomas Monjalon  * RTE_FLOW_ITEM_TYPE_INTEGRITY
18360d025f01SThomas Monjalon  *
18370d025f01SThomas Monjalon  * Match on packet integrity check result.
18380d025f01SThomas Monjalon  */
1839b10a421aSOri Kam struct rte_flow_item_integrity {
18400d025f01SThomas Monjalon 	/** Tunnel encapsulation level the item should apply to.
1841b10a421aSOri Kam 	 * @see rte_flow_action_rss
1842b10a421aSOri Kam 	 */
1843b10a421aSOri Kam 	uint32_t level;
1844b10a421aSOri Kam 	RTE_STD_C11
1845b10a421aSOri Kam 	union {
1846b10a421aSOri Kam 		__extension__
1847b10a421aSOri Kam 		struct {
18480d025f01SThomas Monjalon 			/** The packet is valid after passing all HW checks. */
1849b10a421aSOri Kam 			uint64_t packet_ok:1;
18500d025f01SThomas Monjalon 			/** L2 layer is valid after passing all HW checks. */
1851b10a421aSOri Kam 			uint64_t l2_ok:1;
18520d025f01SThomas Monjalon 			/** L3 layer is valid after passing all HW checks. */
1853b10a421aSOri Kam 			uint64_t l3_ok:1;
18540d025f01SThomas Monjalon 			/** L4 layer is valid after passing all HW checks. */
1855b10a421aSOri Kam 			uint64_t l4_ok:1;
18560d025f01SThomas Monjalon 			/** L2 layer CRC is valid. */
1857b10a421aSOri Kam 			uint64_t l2_crc_ok:1;
18580d025f01SThomas Monjalon 			/** IPv4 layer checksum is valid. */
1859b10a421aSOri Kam 			uint64_t ipv4_csum_ok:1;
18600d025f01SThomas Monjalon 			/** L4 layer checksum is valid. */
1861b10a421aSOri Kam 			uint64_t l4_csum_ok:1;
18620d025f01SThomas Monjalon 			/** L3 length is smaller than frame length. */
1863b10a421aSOri Kam 			uint64_t l3_len_ok:1;
1864b10a421aSOri Kam 			uint64_t reserved:56;
1865b10a421aSOri Kam 		};
1866b10a421aSOri Kam 		uint64_t value;
1867b10a421aSOri Kam 	};
1868b10a421aSOri Kam };
1869b10a421aSOri Kam 
1870b10a421aSOri Kam #ifndef __cplusplus
1871b10a421aSOri Kam static const struct rte_flow_item_integrity
1872b10a421aSOri Kam rte_flow_item_integrity_mask = {
1873b10a421aSOri Kam 	.level = 0,
1874b10a421aSOri Kam 	.value = 0,
1875b10a421aSOri Kam };
1876b10a421aSOri Kam #endif
1877b10a421aSOri Kam 
187899a2dd95SBruce Richardson /**
18799847fd12SBing Zhao  * The packet is valid after conntrack checking.
18809847fd12SBing Zhao  */
18819847fd12SBing Zhao #define RTE_FLOW_CONNTRACK_PKT_STATE_VALID RTE_BIT32(0)
18829847fd12SBing Zhao /**
18839847fd12SBing Zhao  * The state of the connection is changed.
18849847fd12SBing Zhao  */
18859847fd12SBing Zhao #define RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED RTE_BIT32(1)
18869847fd12SBing Zhao /**
18879847fd12SBing Zhao  * Error is detected on this packet for this connection and
18889847fd12SBing Zhao  * an invalid state is set.
18899847fd12SBing Zhao  */
18909847fd12SBing Zhao #define RTE_FLOW_CONNTRACK_PKT_STATE_INVALID RTE_BIT32(2)
18919847fd12SBing Zhao /**
18929847fd12SBing Zhao  * The HW connection tracking module is disabled.
18939847fd12SBing Zhao  * It can be due to application command or an invalid state.
18949847fd12SBing Zhao  */
18959847fd12SBing Zhao #define RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED RTE_BIT32(3)
18969847fd12SBing Zhao /**
18979847fd12SBing Zhao  * The packet contains some bad field(s) and cannot continue
18989847fd12SBing Zhao  * with the conntrack module checking.
18999847fd12SBing Zhao  */
19009847fd12SBing Zhao #define RTE_FLOW_CONNTRACK_PKT_STATE_BAD RTE_BIT32(4)
19019847fd12SBing Zhao 
19029847fd12SBing Zhao /**
19039847fd12SBing Zhao  * @warning
19049847fd12SBing Zhao  * @b EXPERIMENTAL: this structure may change without prior notice
19059847fd12SBing Zhao  *
19069847fd12SBing Zhao  * RTE_FLOW_ITEM_TYPE_CONNTRACK
19079847fd12SBing Zhao  *
19089847fd12SBing Zhao  * Matches the state of a packet after it passed the connection tracking
19099847fd12SBing Zhao  * examination. The state is a bitmap of one RTE_FLOW_CONNTRACK_PKT_STATE*
19109847fd12SBing Zhao  * or a reasonable combination of these bits.
19119847fd12SBing Zhao  */
19129847fd12SBing Zhao struct rte_flow_item_conntrack {
19139847fd12SBing Zhao 	uint32_t flags;
19149847fd12SBing Zhao };
19159847fd12SBing Zhao 
19169847fd12SBing Zhao /** Default mask for RTE_FLOW_ITEM_TYPE_CONNTRACK. */
19179847fd12SBing Zhao #ifndef __cplusplus
19189847fd12SBing Zhao static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = {
19199847fd12SBing Zhao 	.flags = 0xffffffff,
19209847fd12SBing Zhao };
19219847fd12SBing Zhao #endif
19229847fd12SBing Zhao 
19239847fd12SBing Zhao /**
1924081e42daSIvan Malov  * @warning
1925081e42daSIvan Malov  * @b EXPERIMENTAL: this structure may change without prior notice
1926081e42daSIvan Malov  *
1927081e42daSIvan Malov  * Provides an ethdev port ID for use with the following items:
192849863ae2SIvan Malov  * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR,
192949863ae2SIvan Malov  * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT.
1930081e42daSIvan Malov  */
1931081e42daSIvan Malov struct rte_flow_item_ethdev {
1932081e42daSIvan Malov 	uint16_t port_id; /**< ethdev port ID */
1933081e42daSIvan Malov };
1934081e42daSIvan Malov 
1935081e42daSIvan Malov /** Default mask for items based on struct rte_flow_item_ethdev */
1936081e42daSIvan Malov #ifndef __cplusplus
1937081e42daSIvan Malov static const struct rte_flow_item_ethdev rte_flow_item_ethdev_mask = {
1938081e42daSIvan Malov 	.port_id = 0xffff,
1939081e42daSIvan Malov };
1940081e42daSIvan Malov #endif
1941081e42daSIvan Malov 
1942081e42daSIvan Malov /**
19433a929df1SJie Wang  * @warning
19443a929df1SJie Wang  * @b EXPERIMENTAL: this structure may change without prior notice
19453a929df1SJie Wang  *
19463a929df1SJie Wang  * RTE_FLOW_ITEM_TYPE_L2TPV2
19473a929df1SJie Wang  *
19483a929df1SJie Wang  * Matches L2TPv2 Header
19493a929df1SJie Wang  */
19503a929df1SJie Wang struct rte_flow_item_l2tpv2 {
19513a929df1SJie Wang 	struct rte_l2tpv2_combined_msg_hdr hdr;
19523a929df1SJie Wang };
19533a929df1SJie Wang 
19543a929df1SJie Wang /** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV2. */
19553a929df1SJie Wang #ifndef __cplusplus
19563a929df1SJie Wang static const struct rte_flow_item_l2tpv2 rte_flow_item_l2tpv2_mask = {
19573a929df1SJie Wang 	/*
19583a929df1SJie Wang 	 * flags and version bit mask
19593a929df1SJie Wang 	 * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
19603a929df1SJie Wang 	 * T L x x S x O P x x x x V V V V
19613a929df1SJie Wang 	 */
19623a929df1SJie Wang 	.hdr = {
19633a929df1SJie Wang 		.common = {
19643a929df1SJie Wang 			.flags_version = RTE_BE16(0xcb0f),
19653a929df1SJie Wang 		},
19663a929df1SJie Wang 	},
19673a929df1SJie Wang };
19683a929df1SJie Wang #endif
19693a929df1SJie Wang 
19703a929df1SJie Wang /**
19713a929df1SJie Wang  * @warning
19723a929df1SJie Wang  * @b EXPERIMENTAL: this structure may change without prior notice
19733a929df1SJie Wang  *
19743a929df1SJie Wang  * RTE_FLOW_ITEM_TYPE_PPP
19753a929df1SJie Wang  *
19763a929df1SJie Wang  * Matches PPP Header
19773a929df1SJie Wang  */
19783a929df1SJie Wang struct rte_flow_item_ppp {
19793a929df1SJie Wang 	struct rte_ppp_hdr hdr;
19803a929df1SJie Wang };
19813a929df1SJie Wang 
19823a929df1SJie Wang /** Default mask for RTE_FLOW_ITEM_TYPE_PPP. */
19833a929df1SJie Wang #ifndef __cplusplus
19843a929df1SJie Wang static const struct rte_flow_item_ppp rte_flow_item_ppp_mask = {
19853a929df1SJie Wang 	.hdr = {
19863a929df1SJie Wang 		.addr = 0xff,
19873a929df1SJie Wang 		.ctrl = 0xff,
19883a929df1SJie Wang 		.proto_id = RTE_BE16(0xffff),
19893a929df1SJie Wang 	}
19903a929df1SJie Wang };
19913a929df1SJie Wang #endif
19923a929df1SJie Wang 
19933a929df1SJie Wang /**
199499a2dd95SBruce Richardson  * Matching pattern item definition.
199599a2dd95SBruce Richardson  *
199699a2dd95SBruce Richardson  * A pattern is formed by stacking items starting from the lowest protocol
199799a2dd95SBruce Richardson  * layer to match. This stacking restriction does not apply to meta items
199899a2dd95SBruce Richardson  * which can be placed anywhere in the stack without affecting the meaning
199999a2dd95SBruce Richardson  * of the resulting pattern.
200099a2dd95SBruce Richardson  *
200199a2dd95SBruce Richardson  * Patterns are terminated by END items.
200299a2dd95SBruce Richardson  *
200399a2dd95SBruce Richardson  * The spec field should be a valid pointer to a structure of the related
200499a2dd95SBruce Richardson  * item type. It may remain unspecified (NULL) in many cases to request
200599a2dd95SBruce Richardson  * broad (nonspecific) matching. In such cases, last and mask must also be
200699a2dd95SBruce Richardson  * set to NULL.
200799a2dd95SBruce Richardson  *
200899a2dd95SBruce Richardson  * Optionally, last can point to a structure of the same type to define an
200999a2dd95SBruce Richardson  * inclusive range. This is mostly supported by integer and address fields,
201099a2dd95SBruce Richardson  * may cause errors otherwise. Fields that do not support ranges must be set
201199a2dd95SBruce Richardson  * to 0 or to the same value as the corresponding fields in spec.
201299a2dd95SBruce Richardson  *
201399a2dd95SBruce Richardson  * Only the fields defined to nonzero values in the default masks (see
201499a2dd95SBruce Richardson  * rte_flow_item_{name}_mask constants) are considered relevant by
201599a2dd95SBruce Richardson  * default. This can be overridden by providing a mask structure of the
201699a2dd95SBruce Richardson  * same type with applicable bits set to one. It can also be used to
201799a2dd95SBruce Richardson  * partially filter out specific fields (e.g. as an alternate mean to match
201899a2dd95SBruce Richardson  * ranges of IP addresses).
201999a2dd95SBruce Richardson  *
202099a2dd95SBruce Richardson  * Mask is a simple bit-mask applied before interpreting the contents of
202199a2dd95SBruce Richardson  * spec and last, which may yield unexpected results if not used
202299a2dd95SBruce Richardson  * carefully. For example, if for an IPv4 address field, spec provides
202399a2dd95SBruce Richardson  * 10.1.2.3, last provides 10.3.4.5 and mask provides 255.255.0.0, the
202499a2dd95SBruce Richardson  * effective range becomes 10.1.0.0 to 10.3.255.255.
202599a2dd95SBruce Richardson  */
202699a2dd95SBruce Richardson struct rte_flow_item {
202799a2dd95SBruce Richardson 	enum rte_flow_item_type type; /**< Item type. */
202899a2dd95SBruce Richardson 	const void *spec; /**< Pointer to item specification structure. */
202999a2dd95SBruce Richardson 	const void *last; /**< Defines an inclusive range (spec to last). */
203099a2dd95SBruce Richardson 	const void *mask; /**< Bit-mask applied to spec and last. */
203199a2dd95SBruce Richardson };
203299a2dd95SBruce Richardson 
203399a2dd95SBruce Richardson /**
2034dc4d860eSViacheslav Ovsiienko  * @warning
2035dc4d860eSViacheslav Ovsiienko  * @b EXPERIMENTAL: this structure may change without prior notice
2036dc4d860eSViacheslav Ovsiienko  *
2037dc4d860eSViacheslav Ovsiienko  * RTE_FLOW_ITEM_TYPE_FLEX
2038dc4d860eSViacheslav Ovsiienko  *
2039dc4d860eSViacheslav Ovsiienko  * Matches a specified set of fields within the network protocol
2040dc4d860eSViacheslav Ovsiienko  * header. Each field is presented as set of bits with specified width, and
2041dc4d860eSViacheslav Ovsiienko  * bit offset from the header beginning.
2042dc4d860eSViacheslav Ovsiienko  *
2043dc4d860eSViacheslav Ovsiienko  * The pattern is concatenation of bit fields configured at item creation
2044dc4d860eSViacheslav Ovsiienko  * by rte_flow_flex_item_create(). At configuration the fields are presented
2045dc4d860eSViacheslav Ovsiienko  * by sample_data array.
2046dc4d860eSViacheslav Ovsiienko  *
2047dc4d860eSViacheslav Ovsiienko  * This type does not support ranges (struct rte_flow_item.last).
2048dc4d860eSViacheslav Ovsiienko  */
2049dc4d860eSViacheslav Ovsiienko struct rte_flow_item_flex {
2050dc4d860eSViacheslav Ovsiienko 	struct rte_flow_item_flex_handle *handle; /**< Opaque item handle. */
2051dc4d860eSViacheslav Ovsiienko 	uint32_t length; /**< Pattern length in bytes. */
2052dc4d860eSViacheslav Ovsiienko 	const uint8_t *pattern; /**< Combined bitfields pattern to match. */
2053dc4d860eSViacheslav Ovsiienko };
2054dc4d860eSViacheslav Ovsiienko /**
2055dc4d860eSViacheslav Ovsiienko  * Field bit offset calculation mode.
2056dc4d860eSViacheslav Ovsiienko  */
2057dc4d860eSViacheslav Ovsiienko enum rte_flow_item_flex_field_mode {
2058dc4d860eSViacheslav Ovsiienko 	/**
2059dc4d860eSViacheslav Ovsiienko 	 * Dummy field, used for byte boundary alignment in pattern.
2060dc4d860eSViacheslav Ovsiienko 	 * Pattern mask and data are ignored in the match. All configuration
2061dc4d860eSViacheslav Ovsiienko 	 * parameters besides field size are ignored.
2062dc4d860eSViacheslav Ovsiienko 	 */
2063dc4d860eSViacheslav Ovsiienko 	FIELD_MODE_DUMMY = 0,
2064dc4d860eSViacheslav Ovsiienko 	/**
2065dc4d860eSViacheslav Ovsiienko 	 * Fixed offset field. The bit offset from header beginning
2066dc4d860eSViacheslav Ovsiienko 	 * is permanent and defined by field_base parameter.
2067dc4d860eSViacheslav Ovsiienko 	 */
2068dc4d860eSViacheslav Ovsiienko 	FIELD_MODE_FIXED,
2069dc4d860eSViacheslav Ovsiienko 	/**
2070dc4d860eSViacheslav Ovsiienko 	 * The field bit offset is extracted from other header field (indirect
2071dc4d860eSViacheslav Ovsiienko 	 * offset field). The resulting field offset to match is calculated as:
2072dc4d860eSViacheslav Ovsiienko 	 *
2073dc4d860eSViacheslav Ovsiienko 	 *    field_base + (*offset_base & offset_mask) << offset_shift
2074dc4d860eSViacheslav Ovsiienko 	 */
2075dc4d860eSViacheslav Ovsiienko 	FIELD_MODE_OFFSET,
2076dc4d860eSViacheslav Ovsiienko 	/**
2077dc4d860eSViacheslav Ovsiienko 	 * The field bit offset is extracted from other header field (indirect
2078dc4d860eSViacheslav Ovsiienko 	 * offset field), the latter is considered as bitmask containing some
2079dc4d860eSViacheslav Ovsiienko 	 * number of one bits, the resulting field offset to match is
2080dc4d860eSViacheslav Ovsiienko 	 * calculated as:
2081dc4d860eSViacheslav Ovsiienko 	 *
2082dc4d860eSViacheslav Ovsiienko 	 *    field_base + bitcount(*offset_base & offset_mask) << offset_shift
2083dc4d860eSViacheslav Ovsiienko 	 */
2084dc4d860eSViacheslav Ovsiienko 	FIELD_MODE_BITMASK,
2085dc4d860eSViacheslav Ovsiienko };
2086dc4d860eSViacheslav Ovsiienko 
2087dc4d860eSViacheslav Ovsiienko /**
2088dc4d860eSViacheslav Ovsiienko  * Flex item field tunnel mode
2089dc4d860eSViacheslav Ovsiienko  */
2090dc4d860eSViacheslav Ovsiienko enum rte_flow_item_flex_tunnel_mode {
2091dc4d860eSViacheslav Ovsiienko 	/**
2092dc4d860eSViacheslav Ovsiienko 	 * The protocol header can be present in the packet only once.
2093dc4d860eSViacheslav Ovsiienko 	 * No multiple flex item flow inclusions (for inner/outer) are allowed.
2094dc4d860eSViacheslav Ovsiienko 	 * No any relations with tunnel protocols are imposed. The drivers
2095dc4d860eSViacheslav Ovsiienko 	 * can optimize hardware resource usage to handle match on single flex
2096dc4d860eSViacheslav Ovsiienko 	 * item of specific type.
2097dc4d860eSViacheslav Ovsiienko 	 */
2098dc4d860eSViacheslav Ovsiienko 	FLEX_TUNNEL_MODE_SINGLE = 0,
2099dc4d860eSViacheslav Ovsiienko 	/**
2100dc4d860eSViacheslav Ovsiienko 	 * Flex item presents outer header only.
2101dc4d860eSViacheslav Ovsiienko 	 */
2102dc4d860eSViacheslav Ovsiienko 	FLEX_TUNNEL_MODE_OUTER,
2103dc4d860eSViacheslav Ovsiienko 	/**
2104dc4d860eSViacheslav Ovsiienko 	 * Flex item presents inner header only.
2105dc4d860eSViacheslav Ovsiienko 	 */
2106dc4d860eSViacheslav Ovsiienko 	FLEX_TUNNEL_MODE_INNER,
2107dc4d860eSViacheslav Ovsiienko 	/**
2108dc4d860eSViacheslav Ovsiienko 	 * Flex item presents either inner or outer header. The driver
2109dc4d860eSViacheslav Ovsiienko 	 * handles as many multiple inners as hardware supports.
2110dc4d860eSViacheslav Ovsiienko 	 */
2111dc4d860eSViacheslav Ovsiienko 	FLEX_TUNNEL_MODE_MULTI,
2112dc4d860eSViacheslav Ovsiienko 	/**
2113dc4d860eSViacheslav Ovsiienko 	 * Flex item presents tunnel protocol header.
2114dc4d860eSViacheslav Ovsiienko 	 */
2115dc4d860eSViacheslav Ovsiienko 	FLEX_TUNNEL_MODE_TUNNEL,
2116dc4d860eSViacheslav Ovsiienko };
2117dc4d860eSViacheslav Ovsiienko 
2118dc4d860eSViacheslav Ovsiienko /**
2119dc4d860eSViacheslav Ovsiienko  *
2120dc4d860eSViacheslav Ovsiienko  * @warning
2121dc4d860eSViacheslav Ovsiienko  * @b EXPERIMENTAL: this structure may change without prior notice
2122dc4d860eSViacheslav Ovsiienko  */
2123dc4d860eSViacheslav Ovsiienko __extension__
2124dc4d860eSViacheslav Ovsiienko struct rte_flow_item_flex_field {
2125dc4d860eSViacheslav Ovsiienko 	/** Defines how match field offset is calculated over the packet. */
2126dc4d860eSViacheslav Ovsiienko 	enum rte_flow_item_flex_field_mode field_mode;
2127dc4d860eSViacheslav Ovsiienko 	uint32_t field_size; /**< Field size in bits. */
2128dc4d860eSViacheslav Ovsiienko 	int32_t field_base; /**< Field offset in bits. */
2129dc4d860eSViacheslav Ovsiienko 	uint32_t offset_base; /**< Indirect offset field offset in bits. */
2130dc4d860eSViacheslav Ovsiienko 	uint32_t offset_mask; /**< Indirect offset field bit mask. */
2131dc4d860eSViacheslav Ovsiienko 	int32_t offset_shift; /**< Indirect offset multiply factor. */
2132dc4d860eSViacheslav Ovsiienko 	uint32_t field_id:16; /**< Device hint, for multiple items in flow. */
2133dc4d860eSViacheslav Ovsiienko 	uint32_t reserved:16; /**< Reserved field. */
2134dc4d860eSViacheslav Ovsiienko };
2135dc4d860eSViacheslav Ovsiienko 
2136dc4d860eSViacheslav Ovsiienko /**
2137dc4d860eSViacheslav Ovsiienko  * @warning
2138dc4d860eSViacheslav Ovsiienko  * @b EXPERIMENTAL: this structure may change without prior notice
2139dc4d860eSViacheslav Ovsiienko  */
2140dc4d860eSViacheslav Ovsiienko struct rte_flow_item_flex_link {
2141dc4d860eSViacheslav Ovsiienko 	/**
2142dc4d860eSViacheslav Ovsiienko 	 * Preceding/following header. The item type must be always provided.
2143dc4d860eSViacheslav Ovsiienko 	 * For preceding one item must specify the header value/mask to match
2144dc4d860eSViacheslav Ovsiienko 	 * for the link be taken and start the flex item header parsing.
2145dc4d860eSViacheslav Ovsiienko 	 */
2146dc4d860eSViacheslav Ovsiienko 	struct rte_flow_item item;
2147dc4d860eSViacheslav Ovsiienko 	/**
2148dc4d860eSViacheslav Ovsiienko 	 * Next field value to match to continue with one of the configured
2149dc4d860eSViacheslav Ovsiienko 	 * next protocols.
2150dc4d860eSViacheslav Ovsiienko 	 */
2151dc4d860eSViacheslav Ovsiienko 	uint32_t next;
2152dc4d860eSViacheslav Ovsiienko };
2153dc4d860eSViacheslav Ovsiienko 
2154dc4d860eSViacheslav Ovsiienko /**
2155dc4d860eSViacheslav Ovsiienko  * @warning
2156dc4d860eSViacheslav Ovsiienko  * @b EXPERIMENTAL: this structure may change without prior notice
2157dc4d860eSViacheslav Ovsiienko  */
2158dc4d860eSViacheslav Ovsiienko struct rte_flow_item_flex_conf {
2159dc4d860eSViacheslav Ovsiienko 	/**
2160dc4d860eSViacheslav Ovsiienko 	 * Specifies the flex item and tunnel relations and tells the PMD
2161dc4d860eSViacheslav Ovsiienko 	 * whether flex item can be used for inner, outer or both headers,
2162dc4d860eSViacheslav Ovsiienko 	 * or whether flex item presents the tunnel protocol itself.
2163dc4d860eSViacheslav Ovsiienko 	 */
2164dc4d860eSViacheslav Ovsiienko 	enum rte_flow_item_flex_tunnel_mode tunnel;
2165dc4d860eSViacheslav Ovsiienko 	/**
2166dc4d860eSViacheslav Ovsiienko 	 * The next header offset, it presents the network header size covered
2167dc4d860eSViacheslav Ovsiienko 	 * by the flex item and can be obtained with all supported offset
2168dc4d860eSViacheslav Ovsiienko 	 * calculating methods (fixed, dedicated field, bitmask, etc).
2169dc4d860eSViacheslav Ovsiienko 	 */
2170dc4d860eSViacheslav Ovsiienko 	struct rte_flow_item_flex_field next_header;
2171dc4d860eSViacheslav Ovsiienko 	/**
2172dc4d860eSViacheslav Ovsiienko 	 * Specifies the next protocol field to match with link next protocol
2173dc4d860eSViacheslav Ovsiienko 	 * values and continue packet parsing with matching link.
2174dc4d860eSViacheslav Ovsiienko 	 */
2175dc4d860eSViacheslav Ovsiienko 	struct rte_flow_item_flex_field next_protocol;
2176dc4d860eSViacheslav Ovsiienko 	/**
2177dc4d860eSViacheslav Ovsiienko 	 * The fields will be sampled and presented for explicit match
2178dc4d860eSViacheslav Ovsiienko 	 * with pattern in the rte_flow_flex_item. There can be multiple
2179dc4d860eSViacheslav Ovsiienko 	 * fields descriptors, the number should be specified by nb_samples.
2180dc4d860eSViacheslav Ovsiienko 	 */
2181dc4d860eSViacheslav Ovsiienko 	struct rte_flow_item_flex_field *sample_data;
2182dc4d860eSViacheslav Ovsiienko 	/** Number of field descriptors in the sample_data array. */
2183dc4d860eSViacheslav Ovsiienko 	uint32_t nb_samples;
2184dc4d860eSViacheslav Ovsiienko 	/**
2185dc4d860eSViacheslav Ovsiienko 	 * Input link defines the flex item relation with preceding
2186dc4d860eSViacheslav Ovsiienko 	 * header. It specified the preceding item type and provides pattern
2187dc4d860eSViacheslav Ovsiienko 	 * to match. The flex item will continue parsing and will provide the
2188dc4d860eSViacheslav Ovsiienko 	 * data to flow match in case if there is the match with one of input
2189dc4d860eSViacheslav Ovsiienko 	 * links.
2190dc4d860eSViacheslav Ovsiienko 	 */
2191dc4d860eSViacheslav Ovsiienko 	struct rte_flow_item_flex_link *input_link;
2192dc4d860eSViacheslav Ovsiienko 	/** Number of link descriptors in the input link array. */
2193dc4d860eSViacheslav Ovsiienko 	uint32_t nb_inputs;
2194dc4d860eSViacheslav Ovsiienko 	/**
2195dc4d860eSViacheslav Ovsiienko 	 * Output link defines the next protocol field value to match and
2196dc4d860eSViacheslav Ovsiienko 	 * the following protocol header to continue packet parsing. Also
2197dc4d860eSViacheslav Ovsiienko 	 * defines the tunnel-related behaviour.
2198dc4d860eSViacheslav Ovsiienko 	 */
2199dc4d860eSViacheslav Ovsiienko 	struct rte_flow_item_flex_link *output_link;
2200dc4d860eSViacheslav Ovsiienko 	/** Number of link descriptors in the output link array. */
2201dc4d860eSViacheslav Ovsiienko 	uint32_t nb_outputs;
2202dc4d860eSViacheslav Ovsiienko };
2203dc4d860eSViacheslav Ovsiienko 
2204dc4d860eSViacheslav Ovsiienko /**
220599a2dd95SBruce Richardson  * Action types.
220699a2dd95SBruce Richardson  *
220799a2dd95SBruce Richardson  * Each possible action is represented by a type.
220899a2dd95SBruce Richardson  * An action can have an associated configuration object.
220999a2dd95SBruce Richardson  * Several actions combined in a list can be assigned
221099a2dd95SBruce Richardson  * to a flow rule and are performed in order.
221199a2dd95SBruce Richardson  *
221299a2dd95SBruce Richardson  * They fall in three categories:
221399a2dd95SBruce Richardson  *
221499a2dd95SBruce Richardson  * - Actions that modify the fate of matching traffic, for instance by
221599a2dd95SBruce Richardson  *   dropping or assigning it a specific destination.
221699a2dd95SBruce Richardson  *
221799a2dd95SBruce Richardson  * - Actions that modify matching traffic contents or its properties. This
221899a2dd95SBruce Richardson  *   includes adding/removing encapsulation, encryption, compression and
221999a2dd95SBruce Richardson  *   marks.
222099a2dd95SBruce Richardson  *
222199a2dd95SBruce Richardson  * - Actions related to the flow rule itself, such as updating counters or
222299a2dd95SBruce Richardson  *   making it non-terminating.
222399a2dd95SBruce Richardson  *
222499a2dd95SBruce Richardson  * Flow rules being terminating by default, not specifying any action of the
222599a2dd95SBruce Richardson  * fate kind results in undefined behavior. This applies to both ingress and
222699a2dd95SBruce Richardson  * egress.
222799a2dd95SBruce Richardson  *
222899a2dd95SBruce Richardson  * PASSTHRU, when supported, makes a flow rule non-terminating.
222999a2dd95SBruce Richardson  */
223099a2dd95SBruce Richardson enum rte_flow_action_type {
223199a2dd95SBruce Richardson 	/**
223299a2dd95SBruce Richardson 	 * End marker for action lists. Prevents further processing of
223399a2dd95SBruce Richardson 	 * actions, thereby ending the list.
223499a2dd95SBruce Richardson 	 *
223599a2dd95SBruce Richardson 	 * No associated configuration structure.
223699a2dd95SBruce Richardson 	 */
223799a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_END,
223899a2dd95SBruce Richardson 
223999a2dd95SBruce Richardson 	/**
224099a2dd95SBruce Richardson 	 * Used as a placeholder for convenience. It is ignored and simply
224199a2dd95SBruce Richardson 	 * discarded by PMDs.
224299a2dd95SBruce Richardson 	 *
224399a2dd95SBruce Richardson 	 * No associated configuration structure.
224499a2dd95SBruce Richardson 	 */
224599a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_VOID,
224699a2dd95SBruce Richardson 
224799a2dd95SBruce Richardson 	/**
224899a2dd95SBruce Richardson 	 * Leaves traffic up for additional processing by subsequent flow
224999a2dd95SBruce Richardson 	 * rules; makes a flow rule non-terminating.
225099a2dd95SBruce Richardson 	 *
225199a2dd95SBruce Richardson 	 * No associated configuration structure.
225299a2dd95SBruce Richardson 	 */
225399a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_PASSTHRU,
225499a2dd95SBruce Richardson 
225599a2dd95SBruce Richardson 	/**
225699a2dd95SBruce Richardson 	 * RTE_FLOW_ACTION_TYPE_JUMP
225799a2dd95SBruce Richardson 	 *
225899a2dd95SBruce Richardson 	 * Redirects packets to a group on the current device.
225999a2dd95SBruce Richardson 	 *
226099a2dd95SBruce Richardson 	 * See struct rte_flow_action_jump.
226199a2dd95SBruce Richardson 	 */
226299a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_JUMP,
226399a2dd95SBruce Richardson 
226499a2dd95SBruce Richardson 	/**
2265daa02b5cSOlivier Matz 	 * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
2266daa02b5cSOlivier Matz 	 * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
226799a2dd95SBruce Richardson 	 *
226899a2dd95SBruce Richardson 	 * See struct rte_flow_action_mark.
2269f6d8a6d3SIvan Malov 	 *
2270f6d8a6d3SIvan Malov 	 * One should negotiate mark delivery from the NIC to the PMD.
2271f6d8a6d3SIvan Malov 	 * @see rte_eth_rx_metadata_negotiate()
2272f6d8a6d3SIvan Malov 	 * @see RTE_ETH_RX_METADATA_USER_MARK
227399a2dd95SBruce Richardson 	 */
227499a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_MARK,
227599a2dd95SBruce Richardson 
227699a2dd95SBruce Richardson 	/**
227799a2dd95SBruce Richardson 	 * Flags packets. Similar to MARK without a specific value; only
2278daa02b5cSOlivier Matz 	 * sets the RTE_MBUF_F_RX_FDIR mbuf flag.
227999a2dd95SBruce Richardson 	 *
228099a2dd95SBruce Richardson 	 * No associated configuration structure.
2281f6d8a6d3SIvan Malov 	 *
2282f6d8a6d3SIvan Malov 	 * One should negotiate flag delivery from the NIC to the PMD.
2283f6d8a6d3SIvan Malov 	 * @see rte_eth_rx_metadata_negotiate()
2284f6d8a6d3SIvan Malov 	 * @see RTE_ETH_RX_METADATA_USER_FLAG
228599a2dd95SBruce Richardson 	 */
228699a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_FLAG,
228799a2dd95SBruce Richardson 
228899a2dd95SBruce Richardson 	/**
228999a2dd95SBruce Richardson 	 * Assigns packets to a given queue index.
229099a2dd95SBruce Richardson 	 *
229199a2dd95SBruce Richardson 	 * See struct rte_flow_action_queue.
229299a2dd95SBruce Richardson 	 */
229399a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_QUEUE,
229499a2dd95SBruce Richardson 
229599a2dd95SBruce Richardson 	/**
229699a2dd95SBruce Richardson 	 * Drops packets.
229799a2dd95SBruce Richardson 	 *
229899a2dd95SBruce Richardson 	 * PASSTHRU overrides this action if both are specified.
229999a2dd95SBruce Richardson 	 *
230099a2dd95SBruce Richardson 	 * No associated configuration structure.
230199a2dd95SBruce Richardson 	 */
230299a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_DROP,
230399a2dd95SBruce Richardson 
230499a2dd95SBruce Richardson 	/**
230599a2dd95SBruce Richardson 	 * Enables counters for this flow rule.
230699a2dd95SBruce Richardson 	 *
230799a2dd95SBruce Richardson 	 * These counters can be retrieved and reset through rte_flow_query() or
23084b61b877SBing Zhao 	 * rte_flow_action_handle_query() if the action provided via handle,
230999a2dd95SBruce Richardson 	 * see struct rte_flow_query_count.
231099a2dd95SBruce Richardson 	 *
231199a2dd95SBruce Richardson 	 * See struct rte_flow_action_count.
231299a2dd95SBruce Richardson 	 */
231399a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_COUNT,
231499a2dd95SBruce Richardson 
231599a2dd95SBruce Richardson 	/**
231699a2dd95SBruce Richardson 	 * Similar to QUEUE, except RSS is additionally performed on packets
231799a2dd95SBruce Richardson 	 * to spread them among several queues according to the provided
231899a2dd95SBruce Richardson 	 * parameters.
231999a2dd95SBruce Richardson 	 *
232099a2dd95SBruce Richardson 	 * See struct rte_flow_action_rss.
232199a2dd95SBruce Richardson 	 */
232299a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_RSS,
232399a2dd95SBruce Richardson 
232499a2dd95SBruce Richardson 	/**
23255da44faaSIvan Malov 	 * @deprecated
23265da44faaSIvan Malov 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
23275da44faaSIvan Malov 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
23285da44faaSIvan Malov 	 *
232999a2dd95SBruce Richardson 	 * Directs matching traffic to the physical function (PF) of the
233099a2dd95SBruce Richardson 	 * current device.
233199a2dd95SBruce Richardson 	 *
233299a2dd95SBruce Richardson 	 * No associated configuration structure.
233399a2dd95SBruce Richardson 	 */
233499a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_PF,
233599a2dd95SBruce Richardson 
233699a2dd95SBruce Richardson 	/**
23375da44faaSIvan Malov 	 * @deprecated
23385da44faaSIvan Malov 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
23395da44faaSIvan Malov 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
23405da44faaSIvan Malov 	 *
234199a2dd95SBruce Richardson 	 * Directs matching traffic to a given virtual function of the
234299a2dd95SBruce Richardson 	 * current device.
234399a2dd95SBruce Richardson 	 *
234499a2dd95SBruce Richardson 	 * See struct rte_flow_action_vf.
234599a2dd95SBruce Richardson 	 */
234699a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_VF,
234799a2dd95SBruce Richardson 
234899a2dd95SBruce Richardson 	/**
23495da44faaSIvan Malov 	 * @deprecated
23505da44faaSIvan Malov 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
23515da44faaSIvan Malov 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
23525da44faaSIvan Malov 	 *
235399a2dd95SBruce Richardson 	 * Directs packets to a given physical port index of the underlying
235499a2dd95SBruce Richardson 	 * device.
235599a2dd95SBruce Richardson 	 *
235699a2dd95SBruce Richardson 	 * See struct rte_flow_action_phy_port.
235799a2dd95SBruce Richardson 	 */
235899a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_PHY_PORT,
235999a2dd95SBruce Richardson 
236099a2dd95SBruce Richardson 	/**
23615da44faaSIvan Malov 	 * @deprecated
23625da44faaSIvan Malov 	 * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
23635da44faaSIvan Malov 	 * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
23645da44faaSIvan Malov 	 *
236599a2dd95SBruce Richardson 	 * Directs matching traffic to a given DPDK port ID.
236699a2dd95SBruce Richardson 	 *
236799a2dd95SBruce Richardson 	 * See struct rte_flow_action_port_id.
236899a2dd95SBruce Richardson 	 */
236999a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_PORT_ID,
237099a2dd95SBruce Richardson 
237199a2dd95SBruce Richardson 	/**
237299a2dd95SBruce Richardson 	 * Traffic metering and policing (MTR).
237399a2dd95SBruce Richardson 	 *
237499a2dd95SBruce Richardson 	 * See struct rte_flow_action_meter.
237599a2dd95SBruce Richardson 	 * See file rte_mtr.h for MTR object configuration.
237699a2dd95SBruce Richardson 	 */
237799a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_METER,
237899a2dd95SBruce Richardson 
237999a2dd95SBruce Richardson 	/**
238099a2dd95SBruce Richardson 	 * Redirects packets to security engine of current device for security
238199a2dd95SBruce Richardson 	 * processing as specified by security session.
238299a2dd95SBruce Richardson 	 *
238399a2dd95SBruce Richardson 	 * See struct rte_flow_action_security.
238499a2dd95SBruce Richardson 	 */
238599a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SECURITY,
238699a2dd95SBruce Richardson 
238799a2dd95SBruce Richardson 	/**
2388bef7c9ffSViacheslav Ovsiienko 	 * @deprecated
2389bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2390bef7c9ffSViacheslav Ovsiienko 	 *
239199a2dd95SBruce Richardson 	 * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the
239299a2dd95SBruce Richardson 	 * OpenFlow Switch Specification.
239399a2dd95SBruce Richardson 	 *
239499a2dd95SBruce Richardson 	 * See struct rte_flow_action_of_set_mpls_ttl.
239599a2dd95SBruce Richardson 	 */
239699a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL,
239799a2dd95SBruce Richardson 
239899a2dd95SBruce Richardson 	/**
2399bef7c9ffSViacheslav Ovsiienko 	 * @deprecated
2400bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2401bef7c9ffSViacheslav Ovsiienko 	 *
240299a2dd95SBruce Richardson 	 * Implements OFPAT_DEC_MPLS_TTL ("decrement MPLS TTL") as defined
240399a2dd95SBruce Richardson 	 * by the OpenFlow Switch Specification.
240499a2dd95SBruce Richardson 	 *
240599a2dd95SBruce Richardson 	 * No associated configuration structure.
240699a2dd95SBruce Richardson 	 */
240799a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL,
240899a2dd95SBruce Richardson 
240999a2dd95SBruce Richardson 	/**
2410bef7c9ffSViacheslav Ovsiienko 	 * @deprecated
2411bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2412bef7c9ffSViacheslav Ovsiienko 	 *
241399a2dd95SBruce Richardson 	 * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow
241499a2dd95SBruce Richardson 	 * Switch Specification.
241599a2dd95SBruce Richardson 	 *
241699a2dd95SBruce Richardson 	 * See struct rte_flow_action_of_set_nw_ttl.
241799a2dd95SBruce Richardson 	 */
241899a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL,
241999a2dd95SBruce Richardson 
242099a2dd95SBruce Richardson 	/**
2421bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2422bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2423bef7c9ffSViacheslav Ovsiienko 	 *
242499a2dd95SBruce Richardson 	 * Implements OFPAT_DEC_NW_TTL ("decrement IP TTL") as defined by
242599a2dd95SBruce Richardson 	 * the OpenFlow Switch Specification.
242699a2dd95SBruce Richardson 	 *
242799a2dd95SBruce Richardson 	 * No associated configuration structure.
242899a2dd95SBruce Richardson 	 */
242999a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL,
243099a2dd95SBruce Richardson 
243199a2dd95SBruce Richardson 	/**
2432bef7c9ffSViacheslav Ovsiienko 	 * @deprecated
2433bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2434bef7c9ffSViacheslav Ovsiienko 	 *
243599a2dd95SBruce Richardson 	 * Implements OFPAT_COPY_TTL_OUT ("copy TTL "outwards" -- from
243699a2dd95SBruce Richardson 	 * next-to-outermost to outermost") as defined by the OpenFlow
243799a2dd95SBruce Richardson 	 * Switch Specification.
243899a2dd95SBruce Richardson 	 *
243999a2dd95SBruce Richardson 	 * No associated configuration structure.
244099a2dd95SBruce Richardson 	 */
244199a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_OUT,
244299a2dd95SBruce Richardson 
244399a2dd95SBruce Richardson 	/**
2444bef7c9ffSViacheslav Ovsiienko 	 * @deprecated
2445bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2446bef7c9ffSViacheslav Ovsiienko 	 *
244799a2dd95SBruce Richardson 	 * Implements OFPAT_COPY_TTL_IN ("copy TTL "inwards" -- from
244899a2dd95SBruce Richardson 	 * outermost to next-to-outermost") as defined by the OpenFlow
244999a2dd95SBruce Richardson 	 * Switch Specification.
245099a2dd95SBruce Richardson 	 *
245199a2dd95SBruce Richardson 	 * No associated configuration structure.
245299a2dd95SBruce Richardson 	 */
245399a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_IN,
245499a2dd95SBruce Richardson 
245599a2dd95SBruce Richardson 	/**
245699a2dd95SBruce Richardson 	 * Implements OFPAT_POP_VLAN ("pop the outer VLAN tag") as defined
245799a2dd95SBruce Richardson 	 * by the OpenFlow Switch Specification.
245899a2dd95SBruce Richardson 	 *
245999a2dd95SBruce Richardson 	 * No associated configuration structure.
246099a2dd95SBruce Richardson 	 */
246199a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_POP_VLAN,
246299a2dd95SBruce Richardson 
246399a2dd95SBruce Richardson 	/**
246499a2dd95SBruce Richardson 	 * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by
246599a2dd95SBruce Richardson 	 * the OpenFlow Switch Specification.
246699a2dd95SBruce Richardson 	 *
246799a2dd95SBruce Richardson 	 * See struct rte_flow_action_of_push_vlan.
246899a2dd95SBruce Richardson 	 */
246999a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN,
247099a2dd95SBruce Richardson 
247199a2dd95SBruce Richardson 	/**
24725b49ba65SAndrew Rybchenko 	 * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as
247399a2dd95SBruce Richardson 	 * defined by the OpenFlow Switch Specification.
247499a2dd95SBruce Richardson 	 *
247599a2dd95SBruce Richardson 	 * See struct rte_flow_action_of_set_vlan_vid.
247699a2dd95SBruce Richardson 	 */
247799a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID,
247899a2dd95SBruce Richardson 
247999a2dd95SBruce Richardson 	/**
248099a2dd95SBruce Richardson 	 * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as
248199a2dd95SBruce Richardson 	 * defined by the OpenFlow Switch Specification.
248299a2dd95SBruce Richardson 	 *
248399a2dd95SBruce Richardson 	 * See struct rte_flow_action_of_set_vlan_pcp.
248499a2dd95SBruce Richardson 	 */
248599a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP,
248699a2dd95SBruce Richardson 
248799a2dd95SBruce Richardson 	/**
248899a2dd95SBruce Richardson 	 * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined
248999a2dd95SBruce Richardson 	 * by the OpenFlow Switch Specification.
249099a2dd95SBruce Richardson 	 *
249199a2dd95SBruce Richardson 	 * See struct rte_flow_action_of_pop_mpls.
249299a2dd95SBruce Richardson 	 */
249399a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_POP_MPLS,
249499a2dd95SBruce Richardson 
249599a2dd95SBruce Richardson 	/**
249699a2dd95SBruce Richardson 	 * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by
249799a2dd95SBruce Richardson 	 * the OpenFlow Switch Specification.
249899a2dd95SBruce Richardson 	 *
249999a2dd95SBruce Richardson 	 * See struct rte_flow_action_of_push_mpls.
250099a2dd95SBruce Richardson 	 */
250199a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS,
250299a2dd95SBruce Richardson 
250399a2dd95SBruce Richardson 	/**
250499a2dd95SBruce Richardson 	 * Encapsulate flow in VXLAN tunnel as defined in
250599a2dd95SBruce Richardson 	 * rte_flow_action_vxlan_encap action structure.
250699a2dd95SBruce Richardson 	 *
250799a2dd95SBruce Richardson 	 * See struct rte_flow_action_vxlan_encap.
250899a2dd95SBruce Richardson 	 */
250999a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP,
251099a2dd95SBruce Richardson 
251199a2dd95SBruce Richardson 	/**
251299a2dd95SBruce Richardson 	 * Decapsulate outer most VXLAN tunnel from matched flow.
251399a2dd95SBruce Richardson 	 *
251499a2dd95SBruce Richardson 	 * If flow pattern does not define a valid VXLAN tunnel (as specified by
251599a2dd95SBruce Richardson 	 * RFC7348) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
251699a2dd95SBruce Richardson 	 * error.
251799a2dd95SBruce Richardson 	 */
251899a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
251999a2dd95SBruce Richardson 
252099a2dd95SBruce Richardson 	/**
252199a2dd95SBruce Richardson 	 * Encapsulate flow in NVGRE tunnel defined in the
252299a2dd95SBruce Richardson 	 * rte_flow_action_nvgre_encap action structure.
252399a2dd95SBruce Richardson 	 *
252499a2dd95SBruce Richardson 	 * See struct rte_flow_action_nvgre_encap.
252599a2dd95SBruce Richardson 	 */
252699a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP,
252799a2dd95SBruce Richardson 
252899a2dd95SBruce Richardson 	/**
252999a2dd95SBruce Richardson 	 * Decapsulate outer most NVGRE tunnel from matched flow.
253099a2dd95SBruce Richardson 	 *
253199a2dd95SBruce Richardson 	 * If flow pattern does not define a valid NVGRE tunnel (as specified by
253299a2dd95SBruce Richardson 	 * RFC7637) then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION
253399a2dd95SBruce Richardson 	 * error.
253499a2dd95SBruce Richardson 	 */
253599a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
253699a2dd95SBruce Richardson 
253799a2dd95SBruce Richardson 	/**
253899a2dd95SBruce Richardson 	 * Add outer header whose template is provided in its data buffer
253999a2dd95SBruce Richardson 	 *
254099a2dd95SBruce Richardson 	 * See struct rte_flow_action_raw_encap.
254199a2dd95SBruce Richardson 	 */
254299a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_RAW_ENCAP,
254399a2dd95SBruce Richardson 
254499a2dd95SBruce Richardson 	/**
254599a2dd95SBruce Richardson 	 * Remove outer header whose template is provided in its data buffer.
254699a2dd95SBruce Richardson 	 *
254799a2dd95SBruce Richardson 	 * See struct rte_flow_action_raw_decap
254899a2dd95SBruce Richardson 	 */
254999a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_RAW_DECAP,
255099a2dd95SBruce Richardson 
255199a2dd95SBruce Richardson 	/**
2552bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2553bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2554bef7c9ffSViacheslav Ovsiienko 	 *
255599a2dd95SBruce Richardson 	 * Modify IPv4 source address in the outermost IPv4 header.
255699a2dd95SBruce Richardson 	 *
255799a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
255899a2dd95SBruce Richardson 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
255999a2dd95SBruce Richardson 	 *
256099a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_ipv4.
256199a2dd95SBruce Richardson 	 */
256299a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC,
256399a2dd95SBruce Richardson 
256499a2dd95SBruce Richardson 	/**
2565bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2566bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2567bef7c9ffSViacheslav Ovsiienko 	 *
256899a2dd95SBruce Richardson 	 * Modify IPv4 destination address in the outermost IPv4 header.
256999a2dd95SBruce Richardson 	 *
257099a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
257199a2dd95SBruce Richardson 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
257299a2dd95SBruce Richardson 	 *
257399a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_ipv4.
257499a2dd95SBruce Richardson 	 */
257599a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,
257699a2dd95SBruce Richardson 
257799a2dd95SBruce Richardson 	/**
2578bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2579bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2580bef7c9ffSViacheslav Ovsiienko 	 *
258199a2dd95SBruce Richardson 	 * Modify IPv6 source address in the outermost IPv6 header.
258299a2dd95SBruce Richardson 	 *
258399a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
258499a2dd95SBruce Richardson 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
258599a2dd95SBruce Richardson 	 *
258699a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_ipv6.
258799a2dd95SBruce Richardson 	 */
258899a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC,
258999a2dd95SBruce Richardson 
259099a2dd95SBruce Richardson 	/**
2591bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2592bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2593bef7c9ffSViacheslav Ovsiienko 	 *
259499a2dd95SBruce Richardson 	 * Modify IPv6 destination address in the outermost IPv6 header.
259599a2dd95SBruce Richardson 	 *
259699a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
259799a2dd95SBruce Richardson 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
259899a2dd95SBruce Richardson 	 *
259999a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_ipv6.
260099a2dd95SBruce Richardson 	 */
260199a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_IPV6_DST,
260299a2dd95SBruce Richardson 
260399a2dd95SBruce Richardson 	/**
2604bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2605bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2606bef7c9ffSViacheslav Ovsiienko 	 *
260799a2dd95SBruce Richardson 	 * Modify source port number in the outermost TCP/UDP header.
260899a2dd95SBruce Richardson 	 *
260999a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
261099a2dd95SBruce Richardson 	 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
261199a2dd95SBruce Richardson 	 * RTE_FLOW_ERROR_TYPE_ACTION error.
261299a2dd95SBruce Richardson 	 *
261399a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_tp.
261499a2dd95SBruce Richardson 	 */
261599a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_TP_SRC,
261699a2dd95SBruce Richardson 
261799a2dd95SBruce Richardson 	/**
2618bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2619bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2620bef7c9ffSViacheslav Ovsiienko 	 *
262199a2dd95SBruce Richardson 	 * Modify destination port number in the outermost TCP/UDP header.
262299a2dd95SBruce Richardson 	 *
262399a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
262499a2dd95SBruce Richardson 	 * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
262599a2dd95SBruce Richardson 	 * RTE_FLOW_ERROR_TYPE_ACTION error.
262699a2dd95SBruce Richardson 	 *
262799a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_tp.
262899a2dd95SBruce Richardson 	 */
262999a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_TP_DST,
263099a2dd95SBruce Richardson 
263199a2dd95SBruce Richardson 	/**
263299a2dd95SBruce Richardson 	 * Swap the source and destination MAC addresses in the outermost
263399a2dd95SBruce Richardson 	 * Ethernet header.
263499a2dd95SBruce Richardson 	 *
263599a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
263699a2dd95SBruce Richardson 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
263799a2dd95SBruce Richardson 	 *
263899a2dd95SBruce Richardson 	 * No associated configuration structure.
263999a2dd95SBruce Richardson 	 */
264099a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_MAC_SWAP,
264199a2dd95SBruce Richardson 
264299a2dd95SBruce Richardson 	/**
2643bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2644bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2645bef7c9ffSViacheslav Ovsiienko 	 *
264699a2dd95SBruce Richardson 	 * Decrease TTL value directly
264799a2dd95SBruce Richardson 	 *
264899a2dd95SBruce Richardson 	 * No associated configuration structure.
264999a2dd95SBruce Richardson 	 */
265099a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_DEC_TTL,
265199a2dd95SBruce Richardson 
265299a2dd95SBruce Richardson 	/**
2653bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2654bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2655bef7c9ffSViacheslav Ovsiienko 	 *
265699a2dd95SBruce Richardson 	 * Set TTL value
265799a2dd95SBruce Richardson 	 *
265899a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_ttl
265999a2dd95SBruce Richardson 	 */
266099a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_TTL,
266199a2dd95SBruce Richardson 
266299a2dd95SBruce Richardson 	/**
2663bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2664bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2665bef7c9ffSViacheslav Ovsiienko 	 *
266699a2dd95SBruce Richardson 	 * Set source MAC address from matched flow.
266799a2dd95SBruce Richardson 	 *
266899a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
266999a2dd95SBruce Richardson 	 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
267099a2dd95SBruce Richardson 	 *
267199a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_mac.
267299a2dd95SBruce Richardson 	 */
267399a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
267499a2dd95SBruce Richardson 
267599a2dd95SBruce Richardson 	/**
2676bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2677bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2678bef7c9ffSViacheslav Ovsiienko 	 *
267999a2dd95SBruce Richardson 	 * Set destination MAC address from matched flow.
268099a2dd95SBruce Richardson 	 *
268199a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
268299a2dd95SBruce Richardson 	 * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
268399a2dd95SBruce Richardson 	 *
268499a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_mac.
268599a2dd95SBruce Richardson 	 */
268699a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
268799a2dd95SBruce Richardson 
268899a2dd95SBruce Richardson 	/**
2689bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2690bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2691bef7c9ffSViacheslav Ovsiienko 	 *
269299a2dd95SBruce Richardson 	 * Increase sequence number in the outermost TCP header.
269399a2dd95SBruce Richardson 	 *
269499a2dd95SBruce Richardson 	 * Action configuration specifies the value to increase
269599a2dd95SBruce Richardson 	 * TCP sequence number as a big-endian 32 bit integer.
269699a2dd95SBruce Richardson 	 *
269799a2dd95SBruce Richardson 	 * @p conf type:
269899a2dd95SBruce Richardson 	 * @code rte_be32_t * @endcode
269999a2dd95SBruce Richardson 	 *
270099a2dd95SBruce Richardson 	 * Using this action on non-matching traffic will result in
270199a2dd95SBruce Richardson 	 * undefined behavior.
270299a2dd95SBruce Richardson 	 */
270399a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ,
270499a2dd95SBruce Richardson 
270599a2dd95SBruce Richardson 	/**
2706bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2707bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2708bef7c9ffSViacheslav Ovsiienko 	 *
270999a2dd95SBruce Richardson 	 * Decrease sequence number in the outermost TCP header.
271099a2dd95SBruce Richardson 	 *
271199a2dd95SBruce Richardson 	 * Action configuration specifies the value to decrease
271299a2dd95SBruce Richardson 	 * TCP sequence number as a big-endian 32 bit integer.
271399a2dd95SBruce Richardson 	 *
271499a2dd95SBruce Richardson 	 * @p conf type:
271599a2dd95SBruce Richardson 	 * @code rte_be32_t * @endcode
271699a2dd95SBruce Richardson 	 *
271799a2dd95SBruce Richardson 	 * Using this action on non-matching traffic will result in
271899a2dd95SBruce Richardson 	 * undefined behavior.
271999a2dd95SBruce Richardson 	 */
272099a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ,
272199a2dd95SBruce Richardson 
272299a2dd95SBruce Richardson 	/**
2723bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2724bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2725bef7c9ffSViacheslav Ovsiienko 	 *
272699a2dd95SBruce Richardson 	 * Increase acknowledgment number in the outermost TCP header.
272799a2dd95SBruce Richardson 	 *
272899a2dd95SBruce Richardson 	 * Action configuration specifies the value to increase
272999a2dd95SBruce Richardson 	 * TCP acknowledgment number as a big-endian 32 bit integer.
273099a2dd95SBruce Richardson 	 *
273199a2dd95SBruce Richardson 	 * @p conf type:
273299a2dd95SBruce Richardson 	 * @code rte_be32_t * @endcode
273399a2dd95SBruce Richardson 
273499a2dd95SBruce Richardson 	 * Using this action on non-matching traffic will result in
273599a2dd95SBruce Richardson 	 * undefined behavior.
273699a2dd95SBruce Richardson 	 */
273799a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_INC_TCP_ACK,
273899a2dd95SBruce Richardson 
273999a2dd95SBruce Richardson 	/**
2740bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2741bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2742bef7c9ffSViacheslav Ovsiienko 	 *
274399a2dd95SBruce Richardson 	 * Decrease acknowledgment number in the outermost TCP header.
274499a2dd95SBruce Richardson 	 *
274599a2dd95SBruce Richardson 	 * Action configuration specifies the value to decrease
274699a2dd95SBruce Richardson 	 * TCP acknowledgment number as a big-endian 32 bit integer.
274799a2dd95SBruce Richardson 	 *
274899a2dd95SBruce Richardson 	 * @p conf type:
274999a2dd95SBruce Richardson 	 * @code rte_be32_t * @endcode
275099a2dd95SBruce Richardson 	 *
275199a2dd95SBruce Richardson 	 * Using this action on non-matching traffic will result in
275299a2dd95SBruce Richardson 	 * undefined behavior.
275399a2dd95SBruce Richardson 	 */
275499a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK,
275599a2dd95SBruce Richardson 
275699a2dd95SBruce Richardson 	/**
2757bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2758bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2759bef7c9ffSViacheslav Ovsiienko 	 *
276099a2dd95SBruce Richardson 	 * Set Tag.
276199a2dd95SBruce Richardson 	 *
276299a2dd95SBruce Richardson 	 * Tag is for internal flow usage only and
276399a2dd95SBruce Richardson 	 * is not delivered to the application.
276499a2dd95SBruce Richardson 	 *
276599a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_tag.
276699a2dd95SBruce Richardson 	 */
276799a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_TAG,
276899a2dd95SBruce Richardson 
276999a2dd95SBruce Richardson 	/**
2770bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2771bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2772bef7c9ffSViacheslav Ovsiienko 	 *
277399a2dd95SBruce Richardson 	 * Set metadata on ingress or egress path.
277499a2dd95SBruce Richardson 	 *
277599a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_meta.
277699a2dd95SBruce Richardson 	 */
277799a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_META,
277899a2dd95SBruce Richardson 
277999a2dd95SBruce Richardson 	/**
2780bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2781bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2782bef7c9ffSViacheslav Ovsiienko 	 *
278399a2dd95SBruce Richardson 	 * Modify IPv4 DSCP in the outermost IP header.
278499a2dd95SBruce Richardson 	 *
278599a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
278699a2dd95SBruce Richardson 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
278799a2dd95SBruce Richardson 	 *
278899a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_dscp.
278999a2dd95SBruce Richardson 	 */
279099a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP,
279199a2dd95SBruce Richardson 
279299a2dd95SBruce Richardson 	/**
2793bef7c9ffSViacheslav Ovsiienko 	 * @warning This is a legacy action.
2794bef7c9ffSViacheslav Ovsiienko 	 * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
2795bef7c9ffSViacheslav Ovsiienko 	 *
279699a2dd95SBruce Richardson 	 * Modify IPv6 DSCP in the outermost IP header.
279799a2dd95SBruce Richardson 	 *
279899a2dd95SBruce Richardson 	 * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
279999a2dd95SBruce Richardson 	 * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
280099a2dd95SBruce Richardson 	 *
280199a2dd95SBruce Richardson 	 * See struct rte_flow_action_set_dscp.
280299a2dd95SBruce Richardson 	 */
280399a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP,
280499a2dd95SBruce Richardson 
280599a2dd95SBruce Richardson 	/**
280699a2dd95SBruce Richardson 	 * Report as aged flow if timeout passed without any matching on the
280799a2dd95SBruce Richardson 	 * flow.
280899a2dd95SBruce Richardson 	 *
280999a2dd95SBruce Richardson 	 * See struct rte_flow_action_age.
281099a2dd95SBruce Richardson 	 * See function rte_flow_get_aged_flows
281199a2dd95SBruce Richardson 	 * see enum RTE_ETH_EVENT_FLOW_AGED
281299a2dd95SBruce Richardson 	 * See struct rte_flow_query_age
281399a2dd95SBruce Richardson 	 */
281499a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_AGE,
281599a2dd95SBruce Richardson 
281699a2dd95SBruce Richardson 	/**
281799a2dd95SBruce Richardson 	 * The matching packets will be duplicated with specified ratio and
281899a2dd95SBruce Richardson 	 * applied with own set of actions with a fate action.
281999a2dd95SBruce Richardson 	 *
282099a2dd95SBruce Richardson 	 * See struct rte_flow_action_sample.
282199a2dd95SBruce Richardson 	 */
282299a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SAMPLE,
282399a2dd95SBruce Richardson 
282499a2dd95SBruce Richardson 	/**
28254b61b877SBing Zhao 	 * @deprecated
28264b61b877SBing Zhao 	 * @see RTE_FLOW_ACTION_TYPE_INDIRECT
28274b61b877SBing Zhao 	 *
282899a2dd95SBruce Richardson 	 * Describe action shared across multiple flow rules.
282999a2dd95SBruce Richardson 	 *
283099a2dd95SBruce Richardson 	 * Allow multiple rules reference the same action by handle (see
283199a2dd95SBruce Richardson 	 * struct rte_flow_shared_action).
283299a2dd95SBruce Richardson 	 */
283399a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_SHARED,
283499a2dd95SBruce Richardson 
283599a2dd95SBruce Richardson 	/**
283699a2dd95SBruce Richardson 	 * Modify a packet header field, tag, mark or metadata.
283799a2dd95SBruce Richardson 	 *
283899a2dd95SBruce Richardson 	 * Allow the modification of an arbitrary header field via
283999a2dd95SBruce Richardson 	 * set, add and sub operations or copying its content into
284099a2dd95SBruce Richardson 	 * tag, meta or mark for future processing.
284199a2dd95SBruce Richardson 	 *
284299a2dd95SBruce Richardson 	 * See struct rte_flow_action_modify_field.
284399a2dd95SBruce Richardson 	 */
284499a2dd95SBruce Richardson 	RTE_FLOW_ACTION_TYPE_MODIFY_FIELD,
28454b61b877SBing Zhao 
28464b61b877SBing Zhao 	/**
28474b61b877SBing Zhao 	 * An action handle is referenced in a rule through an indirect action.
28484b61b877SBing Zhao 	 *
28494b61b877SBing Zhao 	 * The same action handle may be used in multiple rules for the same
28504b61b877SBing Zhao 	 * or different ethdev ports.
28514b61b877SBing Zhao 	 */
28524b61b877SBing Zhao 	RTE_FLOW_ACTION_TYPE_INDIRECT,
28539847fd12SBing Zhao 
28549847fd12SBing Zhao 	/**
28559847fd12SBing Zhao 	 * [META]
28569847fd12SBing Zhao 	 *
28579847fd12SBing Zhao 	 * Enable tracking a TCP connection state.
28589847fd12SBing Zhao 	 *
28599847fd12SBing Zhao 	 * @see struct rte_flow_action_conntrack.
28609847fd12SBing Zhao 	 */
28619847fd12SBing Zhao 	RTE_FLOW_ACTION_TYPE_CONNTRACK,
28625f0d54f3SLi Zhang 
28635f0d54f3SLi Zhang 	/**
28645f0d54f3SLi Zhang 	 * Color the packet to reflect the meter color result.
28655f0d54f3SLi Zhang 	 * Set the meter color in the mbuf to the selected color.
28665f0d54f3SLi Zhang 	 *
28675f0d54f3SLi Zhang 	 * See struct rte_flow_action_meter_color.
28685f0d54f3SLi Zhang 	 */
28695f0d54f3SLi Zhang 	RTE_FLOW_ACTION_TYPE_METER_COLOR,
28708edb6bc0SIvan Malov 
28718edb6bc0SIvan Malov 	/**
28728edb6bc0SIvan Malov 	 * At embedded switch level, sends matching traffic to the given ethdev.
28738edb6bc0SIvan Malov 	 *
28748edb6bc0SIvan Malov 	 * @see struct rte_flow_action_ethdev
28758edb6bc0SIvan Malov 	 */
28768edb6bc0SIvan Malov 	RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
287788caad25SIvan Malov 
287888caad25SIvan Malov 	/**
287988caad25SIvan Malov 	 * At embedded switch level, send matching traffic to
288088caad25SIvan Malov 	 * the entity represented by the given ethdev.
288188caad25SIvan Malov 	 *
288288caad25SIvan Malov 	 * @see struct rte_flow_action_ethdev
288388caad25SIvan Malov 	 */
288488caad25SIvan Malov 	RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,
288599a2dd95SBruce Richardson };
288699a2dd95SBruce Richardson 
288799a2dd95SBruce Richardson /**
288899a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_MARK
288999a2dd95SBruce Richardson  *
2890daa02b5cSOlivier Matz  * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and
2891daa02b5cSOlivier Matz  * RTE_MBUF_F_RX_FDIR_ID mbuf flags.
289299a2dd95SBruce Richardson  *
289399a2dd95SBruce Richardson  * This value is arbitrary and application-defined. Maximum allowed value
289499a2dd95SBruce Richardson  * depends on the underlying implementation. It is returned in the
289599a2dd95SBruce Richardson  * hash.fdir.hi mbuf field.
289699a2dd95SBruce Richardson  */
289799a2dd95SBruce Richardson struct rte_flow_action_mark {
289899a2dd95SBruce Richardson 	uint32_t id; /**< Integer value to return with packets. */
289999a2dd95SBruce Richardson };
290099a2dd95SBruce Richardson 
290199a2dd95SBruce Richardson /**
290299a2dd95SBruce Richardson  * @warning
290399a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
290499a2dd95SBruce Richardson  *
290599a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_JUMP
290699a2dd95SBruce Richardson  *
290799a2dd95SBruce Richardson  * Redirects packets to a group on the current device.
290899a2dd95SBruce Richardson  *
290999a2dd95SBruce Richardson  * In a hierarchy of groups, which can be used to represent physical or logical
291099a2dd95SBruce Richardson  * flow tables on the device, this action allows the action to be a redirect to
291199a2dd95SBruce Richardson  * a group on that device.
291299a2dd95SBruce Richardson  */
291399a2dd95SBruce Richardson struct rte_flow_action_jump {
291499a2dd95SBruce Richardson 	uint32_t group;
291599a2dd95SBruce Richardson };
291699a2dd95SBruce Richardson 
291799a2dd95SBruce Richardson /**
291899a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_QUEUE
291999a2dd95SBruce Richardson  *
292099a2dd95SBruce Richardson  * Assign packets to a given queue index.
292199a2dd95SBruce Richardson  */
292299a2dd95SBruce Richardson struct rte_flow_action_queue {
292399a2dd95SBruce Richardson 	uint16_t index; /**< Queue index to use. */
292499a2dd95SBruce Richardson };
292599a2dd95SBruce Richardson 
292699a2dd95SBruce Richardson /**
292799a2dd95SBruce Richardson  * @warning
292899a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
292999a2dd95SBruce Richardson  *
293099a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_AGE
293199a2dd95SBruce Richardson  *
293299a2dd95SBruce Richardson  * Report flow as aged-out if timeout passed without any matching
293399a2dd95SBruce Richardson  * on the flow. RTE_ETH_EVENT_FLOW_AGED event is triggered when a
293499a2dd95SBruce Richardson  * port detects new aged-out flows.
293599a2dd95SBruce Richardson  *
293699a2dd95SBruce Richardson  * The flow context and the flow handle will be reported by the
293799a2dd95SBruce Richardson  * rte_flow_get_aged_flows API.
293899a2dd95SBruce Richardson  */
293999a2dd95SBruce Richardson struct rte_flow_action_age {
294099a2dd95SBruce Richardson 	uint32_t timeout:24; /**< Time in seconds. */
294199a2dd95SBruce Richardson 	uint32_t reserved:8; /**< Reserved, must be zero. */
29423c2ca0a9SAndrew Rybchenko 	/** The user flow context, NULL means the rte_flow pointer. */
294399a2dd95SBruce Richardson 	void *context;
294499a2dd95SBruce Richardson };
294599a2dd95SBruce Richardson 
294699a2dd95SBruce Richardson /**
294799a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_AGE (query)
294899a2dd95SBruce Richardson  *
294999a2dd95SBruce Richardson  * Query structure to retrieve the aging status information of a
295099a2dd95SBruce Richardson  * shared AGE action, or a flow rule using the AGE action.
295199a2dd95SBruce Richardson  */
295299a2dd95SBruce Richardson struct rte_flow_query_age {
295399a2dd95SBruce Richardson 	uint32_t reserved:6; /**< Reserved, must be zero. */
295499a2dd95SBruce Richardson 	uint32_t aged:1; /**< 1 if aging timeout expired, 0 otherwise. */
29553c2ca0a9SAndrew Rybchenko 	/** sec_since_last_hit value is valid. */
295699a2dd95SBruce Richardson 	uint32_t sec_since_last_hit_valid:1;
295799a2dd95SBruce Richardson 	uint32_t sec_since_last_hit:24; /**< Seconds since last traffic hit. */
295899a2dd95SBruce Richardson };
295999a2dd95SBruce Richardson 
296099a2dd95SBruce Richardson /**
296199a2dd95SBruce Richardson  * @warning
296299a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
296399a2dd95SBruce Richardson  *
296499a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_COUNT
296599a2dd95SBruce Richardson  *
296699a2dd95SBruce Richardson  * Adds a counter action to a matched flow.
296799a2dd95SBruce Richardson  *
296899a2dd95SBruce Richardson  * If more than one count action is specified in a single flow rule, then each
29695906be5aSAndrew Rybchenko  * action must specify a unique ID.
297099a2dd95SBruce Richardson  *
297199a2dd95SBruce Richardson  * Counters can be retrieved and reset through ``rte_flow_query()``, see
297299a2dd95SBruce Richardson  * ``struct rte_flow_query_count``.
297399a2dd95SBruce Richardson  *
29745906be5aSAndrew Rybchenko  * For ports within the same switch domain then the counter ID namespace extends
297599a2dd95SBruce Richardson  * to all ports within that switch domain.
297699a2dd95SBruce Richardson  */
297799a2dd95SBruce Richardson struct rte_flow_action_count {
297899a2dd95SBruce Richardson 	uint32_t id; /**< Counter ID. */
297999a2dd95SBruce Richardson };
298099a2dd95SBruce Richardson 
298199a2dd95SBruce Richardson /**
298299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_COUNT (query)
298399a2dd95SBruce Richardson  *
298499a2dd95SBruce Richardson  * Query structure to retrieve and reset flow rule counters.
298599a2dd95SBruce Richardson  */
298699a2dd95SBruce Richardson struct rte_flow_query_count {
298799a2dd95SBruce Richardson 	uint32_t reset:1; /**< Reset counters after query [in]. */
298899a2dd95SBruce Richardson 	uint32_t hits_set:1; /**< hits field is set [out]. */
298999a2dd95SBruce Richardson 	uint32_t bytes_set:1; /**< bytes field is set [out]. */
299099a2dd95SBruce Richardson 	uint32_t reserved:29; /**< Reserved, must be zero [in, out]. */
299199a2dd95SBruce Richardson 	uint64_t hits; /**< Number of hits for this rule [out]. */
299299a2dd95SBruce Richardson 	uint64_t bytes; /**< Number of bytes through this rule [out]. */
299399a2dd95SBruce Richardson };
299499a2dd95SBruce Richardson 
299599a2dd95SBruce Richardson /**
299699a2dd95SBruce Richardson  * Hash function types.
299799a2dd95SBruce Richardson  */
299899a2dd95SBruce Richardson enum rte_eth_hash_function {
299999a2dd95SBruce Richardson 	RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
300099a2dd95SBruce Richardson 	RTE_ETH_HASH_FUNCTION_TOEPLITZ, /**< Toeplitz */
300199a2dd95SBruce Richardson 	RTE_ETH_HASH_FUNCTION_SIMPLE_XOR, /**< Simple XOR */
300299a2dd95SBruce Richardson 	/**
300399a2dd95SBruce Richardson 	 * Symmetric Toeplitz: src, dst will be replaced by
300499a2dd95SBruce Richardson 	 * xor(src, dst). For the case with src/dst only,
300599a2dd95SBruce Richardson 	 * src or dst address will xor with zero pair.
300699a2dd95SBruce Richardson 	 */
300799a2dd95SBruce Richardson 	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
300899a2dd95SBruce Richardson 	RTE_ETH_HASH_FUNCTION_MAX,
300999a2dd95SBruce Richardson };
301099a2dd95SBruce Richardson 
301199a2dd95SBruce Richardson /**
301299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_RSS
301399a2dd95SBruce Richardson  *
301499a2dd95SBruce Richardson  * Similar to QUEUE, except RSS is additionally performed on packets to
301599a2dd95SBruce Richardson  * spread them among several queues according to the provided parameters.
301699a2dd95SBruce Richardson  *
301799a2dd95SBruce Richardson  * Unlike global RSS settings used by other DPDK APIs, unsetting the
301899a2dd95SBruce Richardson  * @p types field does not disable RSS in a flow rule. Doing so instead
301999a2dd95SBruce Richardson  * requests safe unspecified "best-effort" settings from the underlying PMD,
302099a2dd95SBruce Richardson  * which depending on the flow rule, may result in anything ranging from
302199a2dd95SBruce Richardson  * empty (single queue) to all-inclusive RSS.
302299a2dd95SBruce Richardson  *
302399a2dd95SBruce Richardson  * Note: RSS hash result is stored in the hash.rss mbuf field which overlaps
302499a2dd95SBruce Richardson  * hash.fdir.lo. Since the MARK action sets the hash.fdir.hi field only,
302599a2dd95SBruce Richardson  * both can be requested simultaneously.
302699a2dd95SBruce Richardson  */
302799a2dd95SBruce Richardson struct rte_flow_action_rss {
302899a2dd95SBruce Richardson 	enum rte_eth_hash_function func; /**< RSS hash function to apply. */
302999a2dd95SBruce Richardson 	/**
303099a2dd95SBruce Richardson 	 * Packet encapsulation level RSS hash @p types apply to.
303199a2dd95SBruce Richardson 	 *
303299a2dd95SBruce Richardson 	 * - @p 0 requests the default behavior. Depending on the packet
303399a2dd95SBruce Richardson 	 *   type, it can mean outermost, innermost, anything in between or
303499a2dd95SBruce Richardson 	 *   even no RSS.
303599a2dd95SBruce Richardson 	 *
303699a2dd95SBruce Richardson 	 *   It basically stands for the innermost encapsulation level RSS
303799a2dd95SBruce Richardson 	 *   can be performed on according to PMD and device capabilities.
303899a2dd95SBruce Richardson 	 *
303999a2dd95SBruce Richardson 	 * - @p 1 requests RSS to be performed on the outermost packet
304099a2dd95SBruce Richardson 	 *   encapsulation level.
304199a2dd95SBruce Richardson 	 *
304299a2dd95SBruce Richardson 	 * - @p 2 and subsequent values request RSS to be performed on the
304399a2dd95SBruce Richardson 	 *   specified inner packet encapsulation level, from outermost to
304499a2dd95SBruce Richardson 	 *   innermost (lower to higher values).
304599a2dd95SBruce Richardson 	 *
304699a2dd95SBruce Richardson 	 * Values other than @p 0 are not necessarily supported.
304799a2dd95SBruce Richardson 	 *
304899a2dd95SBruce Richardson 	 * Requesting a specific RSS level on unrecognized traffic results
304999a2dd95SBruce Richardson 	 * in undefined behavior. For predictable results, it is recommended
305099a2dd95SBruce Richardson 	 * to make the flow rule pattern match packet headers up to the
305199a2dd95SBruce Richardson 	 * requested encapsulation level so that only matching traffic goes
305299a2dd95SBruce Richardson 	 * through.
305399a2dd95SBruce Richardson 	 */
305499a2dd95SBruce Richardson 	uint32_t level;
3055295968d1SFerruh Yigit 	uint64_t types; /**< Specific RSS hash types (see RTE_ETH_RSS_*). */
305699a2dd95SBruce Richardson 	uint32_t key_len; /**< Hash key length in bytes. */
305799a2dd95SBruce Richardson 	uint32_t queue_num; /**< Number of entries in @p queue. */
305899a2dd95SBruce Richardson 	const uint8_t *key; /**< Hash key. */
305999a2dd95SBruce Richardson 	const uint16_t *queue; /**< Queue indices to use. */
306099a2dd95SBruce Richardson };
306199a2dd95SBruce Richardson 
306299a2dd95SBruce Richardson /**
30635da44faaSIvan Malov  * @deprecated
30645da44faaSIvan Malov  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
30655da44faaSIvan Malov  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
30665da44faaSIvan Malov  *
306799a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_VF
306899a2dd95SBruce Richardson  *
306999a2dd95SBruce Richardson  * Directs matching traffic to a given virtual function of the current
307099a2dd95SBruce Richardson  * device.
307199a2dd95SBruce Richardson  *
307299a2dd95SBruce Richardson  * Packets matched by a VF pattern item can be redirected to their original
307399a2dd95SBruce Richardson  * VF ID instead of the specified one. This parameter may not be available
307499a2dd95SBruce Richardson  * and is not guaranteed to work properly if the VF part is matched by a
307599a2dd95SBruce Richardson  * prior flow rule or if packets are not addressed to a VF in the first
307699a2dd95SBruce Richardson  * place.
307799a2dd95SBruce Richardson  */
307899a2dd95SBruce Richardson struct rte_flow_action_vf {
307999a2dd95SBruce Richardson 	uint32_t original:1; /**< Use original VF ID if possible. */
308099a2dd95SBruce Richardson 	uint32_t reserved:31; /**< Reserved, must be zero. */
308199a2dd95SBruce Richardson 	uint32_t id; /**< VF ID. */
308299a2dd95SBruce Richardson };
308399a2dd95SBruce Richardson 
308499a2dd95SBruce Richardson /**
30855da44faaSIvan Malov  * @deprecated
30865da44faaSIvan Malov  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
30875da44faaSIvan Malov  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
30885da44faaSIvan Malov  *
308999a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_PHY_PORT
309099a2dd95SBruce Richardson  *
309199a2dd95SBruce Richardson  * Directs packets to a given physical port index of the underlying
309299a2dd95SBruce Richardson  * device.
309399a2dd95SBruce Richardson  *
309499a2dd95SBruce Richardson  * @see RTE_FLOW_ITEM_TYPE_PHY_PORT
309599a2dd95SBruce Richardson  */
309699a2dd95SBruce Richardson struct rte_flow_action_phy_port {
309799a2dd95SBruce Richardson 	uint32_t original:1; /**< Use original port index if possible. */
309899a2dd95SBruce Richardson 	uint32_t reserved:31; /**< Reserved, must be zero. */
309999a2dd95SBruce Richardson 	uint32_t index; /**< Physical port index. */
310099a2dd95SBruce Richardson };
310199a2dd95SBruce Richardson 
310299a2dd95SBruce Richardson /**
31035da44faaSIvan Malov  * @deprecated
31045da44faaSIvan Malov  * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR
31055da44faaSIvan Malov  * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT
31065da44faaSIvan Malov  *
310799a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_PORT_ID
310899a2dd95SBruce Richardson  *
310999a2dd95SBruce Richardson  * Directs matching traffic to a given DPDK port ID.
311099a2dd95SBruce Richardson  *
311199a2dd95SBruce Richardson  * @see RTE_FLOW_ITEM_TYPE_PORT_ID
311299a2dd95SBruce Richardson  */
311399a2dd95SBruce Richardson struct rte_flow_action_port_id {
311499a2dd95SBruce Richardson 	uint32_t original:1; /**< Use original DPDK port ID if possible. */
311599a2dd95SBruce Richardson 	uint32_t reserved:31; /**< Reserved, must be zero. */
311699a2dd95SBruce Richardson 	uint32_t id; /**< DPDK port ID. */
311799a2dd95SBruce Richardson };
311899a2dd95SBruce Richardson 
311999a2dd95SBruce Richardson /**
312099a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_METER
312199a2dd95SBruce Richardson  *
312299a2dd95SBruce Richardson  * Traffic metering and policing (MTR).
312399a2dd95SBruce Richardson  *
312499a2dd95SBruce Richardson  * Packets matched by items of this type can be either dropped or passed to the
312599a2dd95SBruce Richardson  * next item with their color set by the MTR object.
312699a2dd95SBruce Richardson  */
312799a2dd95SBruce Richardson struct rte_flow_action_meter {
312899a2dd95SBruce Richardson 	uint32_t mtr_id; /**< MTR object ID created with rte_mtr_create(). */
312999a2dd95SBruce Richardson };
313099a2dd95SBruce Richardson 
313199a2dd95SBruce Richardson /**
313299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SECURITY
313399a2dd95SBruce Richardson  *
313499a2dd95SBruce Richardson  * Perform the security action on flows matched by the pattern items
313599a2dd95SBruce Richardson  * according to the configuration of the security session.
313699a2dd95SBruce Richardson  *
313799a2dd95SBruce Richardson  * This action modifies the payload of matched flows. For INLINE_CRYPTO, the
313899a2dd95SBruce Richardson  * security protocol headers and IV are fully provided by the application as
313999a2dd95SBruce Richardson  * specified in the flow pattern. The payload of matching packets is
314099a2dd95SBruce Richardson  * encrypted on egress, and decrypted and authenticated on ingress.
314199a2dd95SBruce Richardson  * For INLINE_PROTOCOL, the security protocol is fully offloaded to HW,
314299a2dd95SBruce Richardson  * providing full encapsulation and decapsulation of packets in security
314399a2dd95SBruce Richardson  * protocols. The flow pattern specifies both the outer security header fields
314499a2dd95SBruce Richardson  * and the inner packet fields. The security session specified in the action
314599a2dd95SBruce Richardson  * must match the pattern parameters.
314699a2dd95SBruce Richardson  *
314799a2dd95SBruce Richardson  * The security session specified in the action must be created on the same
314899a2dd95SBruce Richardson  * port as the flow action that is being specified.
314999a2dd95SBruce Richardson  *
315099a2dd95SBruce Richardson  * The ingress/egress flow attribute should match that specified in the
315199a2dd95SBruce Richardson  * security session if the security session supports the definition of the
315299a2dd95SBruce Richardson  * direction.
315399a2dd95SBruce Richardson  *
315499a2dd95SBruce Richardson  * Multiple flows can be configured to use the same security session.
315599a2dd95SBruce Richardson  *
315699a2dd95SBruce Richardson  * The NULL value is allowed for security session. If security session is NULL,
315799a2dd95SBruce Richardson  * then SPI field in ESP flow item and IP addresses in flow items 'IPv4' and
315899a2dd95SBruce Richardson  * 'IPv6' will be allowed to be a range. The rule thus created can enable
315999a2dd95SBruce Richardson  * security processing on multiple flows.
316099a2dd95SBruce Richardson  */
316199a2dd95SBruce Richardson struct rte_flow_action_security {
316299a2dd95SBruce Richardson 	void *security_session; /**< Pointer to security session structure. */
316399a2dd95SBruce Richardson };
316499a2dd95SBruce Richardson 
316599a2dd95SBruce Richardson /**
3166bef7c9ffSViacheslav Ovsiienko  * @deprecated
3167bef7c9ffSViacheslav Ovsiienko  * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3168bef7c9ffSViacheslav Ovsiienko  *
316999a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL
317099a2dd95SBruce Richardson  *
317199a2dd95SBruce Richardson  * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the OpenFlow
317299a2dd95SBruce Richardson  * Switch Specification.
317399a2dd95SBruce Richardson  */
317499a2dd95SBruce Richardson struct rte_flow_action_of_set_mpls_ttl {
317599a2dd95SBruce Richardson 	uint8_t mpls_ttl; /**< MPLS TTL. */
317699a2dd95SBruce Richardson };
317799a2dd95SBruce Richardson 
317899a2dd95SBruce Richardson /**
3179bef7c9ffSViacheslav Ovsiienko  * @deprecated
3180bef7c9ffSViacheslav Ovsiienko  * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
3181bef7c9ffSViacheslav Ovsiienko  *
318299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL
318399a2dd95SBruce Richardson  *
318499a2dd95SBruce Richardson  * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow Switch
318599a2dd95SBruce Richardson  * Specification.
318699a2dd95SBruce Richardson  */
318799a2dd95SBruce Richardson struct rte_flow_action_of_set_nw_ttl {
318899a2dd95SBruce Richardson 	uint8_t nw_ttl; /**< IP TTL. */
318999a2dd95SBruce Richardson };
319099a2dd95SBruce Richardson 
319199a2dd95SBruce Richardson /**
319299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN
319399a2dd95SBruce Richardson  *
319499a2dd95SBruce Richardson  * Implements OFPAT_PUSH_VLAN ("push a new VLAN tag") as defined by the
319599a2dd95SBruce Richardson  * OpenFlow Switch Specification.
319699a2dd95SBruce Richardson  */
319799a2dd95SBruce Richardson struct rte_flow_action_of_push_vlan {
319899a2dd95SBruce Richardson 	rte_be16_t ethertype; /**< EtherType. */
319999a2dd95SBruce Richardson };
320099a2dd95SBruce Richardson 
320199a2dd95SBruce Richardson /**
320299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID
320399a2dd95SBruce Richardson  *
32045b49ba65SAndrew Rybchenko  * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as defined by
320599a2dd95SBruce Richardson  * the OpenFlow Switch Specification.
320699a2dd95SBruce Richardson  */
320799a2dd95SBruce Richardson struct rte_flow_action_of_set_vlan_vid {
32085b49ba65SAndrew Rybchenko 	rte_be16_t vlan_vid; /**< VLAN ID. */
320999a2dd95SBruce Richardson };
321099a2dd95SBruce Richardson 
321199a2dd95SBruce Richardson /**
321299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP
321399a2dd95SBruce Richardson  *
321499a2dd95SBruce Richardson  * Implements OFPAT_SET_LAN_PCP ("set the 802.1q priority") as defined by
321599a2dd95SBruce Richardson  * the OpenFlow Switch Specification.
321699a2dd95SBruce Richardson  */
321799a2dd95SBruce Richardson struct rte_flow_action_of_set_vlan_pcp {
321899a2dd95SBruce Richardson 	uint8_t vlan_pcp; /**< VLAN priority. */
321999a2dd95SBruce Richardson };
322099a2dd95SBruce Richardson 
322199a2dd95SBruce Richardson /**
322299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_OF_POP_MPLS
322399a2dd95SBruce Richardson  *
322499a2dd95SBruce Richardson  * Implements OFPAT_POP_MPLS ("pop the outer MPLS tag") as defined by the
322599a2dd95SBruce Richardson  * OpenFlow Switch Specification.
322699a2dd95SBruce Richardson  */
322799a2dd95SBruce Richardson struct rte_flow_action_of_pop_mpls {
322899a2dd95SBruce Richardson 	rte_be16_t ethertype; /**< EtherType. */
322999a2dd95SBruce Richardson };
323099a2dd95SBruce Richardson 
323199a2dd95SBruce Richardson /**
323299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_OF_PUSH_MPLS
323399a2dd95SBruce Richardson  *
323499a2dd95SBruce Richardson  * Implements OFPAT_PUSH_MPLS ("push a new MPLS tag") as defined by the
323599a2dd95SBruce Richardson  * OpenFlow Switch Specification.
323699a2dd95SBruce Richardson  */
323799a2dd95SBruce Richardson struct rte_flow_action_of_push_mpls {
323899a2dd95SBruce Richardson 	rte_be16_t ethertype; /**< EtherType. */
323999a2dd95SBruce Richardson };
324099a2dd95SBruce Richardson 
324199a2dd95SBruce Richardson /**
324299a2dd95SBruce Richardson  * @warning
324399a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
324499a2dd95SBruce Richardson  *
324599a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP
324699a2dd95SBruce Richardson  *
324799a2dd95SBruce Richardson  * VXLAN tunnel end-point encapsulation data definition
324899a2dd95SBruce Richardson  *
324999a2dd95SBruce Richardson  * The tunnel definition is provided through the flow item pattern, the
325099a2dd95SBruce Richardson  * provided pattern must conform to RFC7348 for the tunnel specified. The flow
325199a2dd95SBruce Richardson  * definition must be provided in order from the RTE_FLOW_ITEM_TYPE_ETH
325299a2dd95SBruce Richardson  * definition up the end item which is specified by RTE_FLOW_ITEM_TYPE_END.
325399a2dd95SBruce Richardson  *
325499a2dd95SBruce Richardson  * The mask field allows user to specify which fields in the flow item
325599a2dd95SBruce Richardson  * definitions can be ignored and which have valid data and can be used
325699a2dd95SBruce Richardson  * verbatim.
325799a2dd95SBruce Richardson  *
325899a2dd95SBruce Richardson  * Note: the last field is not used in the definition of a tunnel and can be
325999a2dd95SBruce Richardson  * ignored.
326099a2dd95SBruce Richardson  *
326199a2dd95SBruce Richardson  * Valid flow definition for RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP include:
326299a2dd95SBruce Richardson  *
326399a2dd95SBruce Richardson  * - ETH / IPV4 / UDP / VXLAN / END
326499a2dd95SBruce Richardson  * - ETH / IPV6 / UDP / VXLAN / END
326599a2dd95SBruce Richardson  * - ETH / VLAN / IPV4 / UDP / VXLAN / END
326699a2dd95SBruce Richardson  *
326799a2dd95SBruce Richardson  */
326899a2dd95SBruce Richardson struct rte_flow_action_vxlan_encap {
326999a2dd95SBruce Richardson 	/**
327099a2dd95SBruce Richardson 	 * Encapsulating vxlan tunnel definition
327199a2dd95SBruce Richardson 	 * (terminated by the END pattern item).
327299a2dd95SBruce Richardson 	 */
327399a2dd95SBruce Richardson 	struct rte_flow_item *definition;
327499a2dd95SBruce Richardson };
327599a2dd95SBruce Richardson 
327699a2dd95SBruce Richardson /**
327799a2dd95SBruce Richardson  * @warning
327899a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
327999a2dd95SBruce Richardson  *
328099a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP
328199a2dd95SBruce Richardson  *
328299a2dd95SBruce Richardson  * NVGRE tunnel end-point encapsulation data definition
328399a2dd95SBruce Richardson  *
328499a2dd95SBruce Richardson  * The tunnel definition is provided through the flow item pattern  the
328599a2dd95SBruce Richardson  * provided pattern must conform with RFC7637. The flow definition must be
328699a2dd95SBruce Richardson  * provided in order from the RTE_FLOW_ITEM_TYPE_ETH definition up the end item
328799a2dd95SBruce Richardson  * which is specified by RTE_FLOW_ITEM_TYPE_END.
328899a2dd95SBruce Richardson  *
328999a2dd95SBruce Richardson  * The mask field allows user to specify which fields in the flow item
329099a2dd95SBruce Richardson  * definitions can be ignored and which have valid data and can be used
329199a2dd95SBruce Richardson  * verbatim.
329299a2dd95SBruce Richardson  *
329399a2dd95SBruce Richardson  * Note: the last field is not used in the definition of a tunnel and can be
329499a2dd95SBruce Richardson  * ignored.
329599a2dd95SBruce Richardson  *
329699a2dd95SBruce Richardson  * Valid flow definition for RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP include:
329799a2dd95SBruce Richardson  *
329899a2dd95SBruce Richardson  * - ETH / IPV4 / NVGRE / END
329999a2dd95SBruce Richardson  * - ETH / VLAN / IPV6 / NVGRE / END
330099a2dd95SBruce Richardson  *
330199a2dd95SBruce Richardson  */
330299a2dd95SBruce Richardson struct rte_flow_action_nvgre_encap {
330399a2dd95SBruce Richardson 	/**
330499a2dd95SBruce Richardson 	 * Encapsulating vxlan tunnel definition
330599a2dd95SBruce Richardson 	 * (terminated by the END pattern item).
330699a2dd95SBruce Richardson 	 */
330799a2dd95SBruce Richardson 	struct rte_flow_item *definition;
330899a2dd95SBruce Richardson };
330999a2dd95SBruce Richardson 
331099a2dd95SBruce Richardson /**
331199a2dd95SBruce Richardson  * @warning
331299a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
331399a2dd95SBruce Richardson  *
331499a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_RAW_ENCAP
331599a2dd95SBruce Richardson  *
331699a2dd95SBruce Richardson  * Raw tunnel end-point encapsulation data definition.
331799a2dd95SBruce Richardson  *
331899a2dd95SBruce Richardson  * The data holds the headers definitions to be applied on the packet.
331999a2dd95SBruce Richardson  * The data must start with ETH header up to the tunnel item header itself.
332099a2dd95SBruce Richardson  * When used right after RAW_DECAP (for decapsulating L3 tunnel type for
332199a2dd95SBruce Richardson  * example MPLSoGRE) the data will just hold layer 2 header.
332299a2dd95SBruce Richardson  *
332399a2dd95SBruce Richardson  * The preserve parameter holds which bits in the packet the PMD is not allowed
332499a2dd95SBruce Richardson  * to change, this parameter can also be NULL and then the PMD is allowed
332599a2dd95SBruce Richardson  * to update any field.
332699a2dd95SBruce Richardson  *
332799a2dd95SBruce Richardson  * size holds the number of bytes in @p data and @p preserve.
332899a2dd95SBruce Richardson  */
332999a2dd95SBruce Richardson struct rte_flow_action_raw_encap {
333099a2dd95SBruce Richardson 	uint8_t *data; /**< Encapsulation data. */
333199a2dd95SBruce Richardson 	uint8_t *preserve; /**< Bit-mask of @p data to preserve on output. */
333299a2dd95SBruce Richardson 	size_t size; /**< Size of @p data and @p preserve. */
333399a2dd95SBruce Richardson };
333499a2dd95SBruce Richardson 
333599a2dd95SBruce Richardson /**
333699a2dd95SBruce Richardson  * @warning
333799a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
333899a2dd95SBruce Richardson  *
333999a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_RAW_DECAP
334099a2dd95SBruce Richardson  *
334199a2dd95SBruce Richardson  * Raw tunnel end-point decapsulation data definition.
334299a2dd95SBruce Richardson  *
334399a2dd95SBruce Richardson  * The data holds the headers definitions to be removed from the packet.
334499a2dd95SBruce Richardson  * The data must start with ETH header up to the tunnel item header itself.
334599a2dd95SBruce Richardson  * When used right before RAW_DECAP (for encapsulating L3 tunnel type for
334699a2dd95SBruce Richardson  * example MPLSoGRE) the data will just hold layer 2 header.
334799a2dd95SBruce Richardson  *
334899a2dd95SBruce Richardson  * size holds the number of bytes in @p data.
334999a2dd95SBruce Richardson  */
335099a2dd95SBruce Richardson struct rte_flow_action_raw_decap {
335199a2dd95SBruce Richardson 	uint8_t *data; /**< Encapsulation data. */
335299a2dd95SBruce Richardson 	size_t size; /**< Size of @p data and @p preserve. */
335399a2dd95SBruce Richardson };
335499a2dd95SBruce Richardson 
335599a2dd95SBruce Richardson /**
335699a2dd95SBruce Richardson  * @warning
335799a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
335899a2dd95SBruce Richardson  *
335999a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
336099a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
336199a2dd95SBruce Richardson  *
336299a2dd95SBruce Richardson  * Allows modification of IPv4 source (RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC)
336399a2dd95SBruce Richardson  * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) in the
336499a2dd95SBruce Richardson  * specified outermost IPv4 header.
336599a2dd95SBruce Richardson  */
336699a2dd95SBruce Richardson struct rte_flow_action_set_ipv4 {
336799a2dd95SBruce Richardson 	rte_be32_t ipv4_addr;
336899a2dd95SBruce Richardson };
336999a2dd95SBruce Richardson 
337099a2dd95SBruce Richardson /**
337199a2dd95SBruce Richardson  * @warning
337299a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
337399a2dd95SBruce Richardson  *
337499a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
337599a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
337699a2dd95SBruce Richardson  *
337799a2dd95SBruce Richardson  * Allows modification of IPv6 source (RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC)
337899a2dd95SBruce Richardson  * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) in the
337999a2dd95SBruce Richardson  * specified outermost IPv6 header.
338099a2dd95SBruce Richardson  */
338199a2dd95SBruce Richardson struct rte_flow_action_set_ipv6 {
338299a2dd95SBruce Richardson 	uint8_t ipv6_addr[16];
338399a2dd95SBruce Richardson };
338499a2dd95SBruce Richardson 
338599a2dd95SBruce Richardson /**
338699a2dd95SBruce Richardson  * @warning
338799a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
338899a2dd95SBruce Richardson  *
338999a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_TP_SRC
339099a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_TP_DST
339199a2dd95SBruce Richardson  *
339299a2dd95SBruce Richardson  * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC)
339399a2dd95SBruce Richardson  * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers
339499a2dd95SBruce Richardson  * in the specified outermost TCP/UDP header.
339599a2dd95SBruce Richardson  */
339699a2dd95SBruce Richardson struct rte_flow_action_set_tp {
339799a2dd95SBruce Richardson 	rte_be16_t port;
339899a2dd95SBruce Richardson };
339999a2dd95SBruce Richardson 
340099a2dd95SBruce Richardson /**
340199a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_TTL
340299a2dd95SBruce Richardson  *
340399a2dd95SBruce Richardson  * Set the TTL value directly for IPv4 or IPv6
340499a2dd95SBruce Richardson  */
340599a2dd95SBruce Richardson struct rte_flow_action_set_ttl {
340699a2dd95SBruce Richardson 	uint8_t ttl_value;
340799a2dd95SBruce Richardson };
340899a2dd95SBruce Richardson 
340999a2dd95SBruce Richardson /**
341099a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_MAC
341199a2dd95SBruce Richardson  *
341299a2dd95SBruce Richardson  * Set MAC address from the matched flow
341399a2dd95SBruce Richardson  */
341499a2dd95SBruce Richardson struct rte_flow_action_set_mac {
341599a2dd95SBruce Richardson 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
341699a2dd95SBruce Richardson };
341799a2dd95SBruce Richardson 
341899a2dd95SBruce Richardson /**
341999a2dd95SBruce Richardson  * @warning
342099a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
342199a2dd95SBruce Richardson  *
342299a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_TAG
342399a2dd95SBruce Richardson  *
342499a2dd95SBruce Richardson  * Set a tag which is a transient data used during flow matching. This is not
342599a2dd95SBruce Richardson  * delivered to application. Multiple tags are supported by specifying index.
342699a2dd95SBruce Richardson  */
342799a2dd95SBruce Richardson struct rte_flow_action_set_tag {
342899a2dd95SBruce Richardson 	uint32_t data;
342999a2dd95SBruce Richardson 	uint32_t mask;
343099a2dd95SBruce Richardson 	uint8_t index;
343199a2dd95SBruce Richardson };
343299a2dd95SBruce Richardson 
343399a2dd95SBruce Richardson /**
343499a2dd95SBruce Richardson  * @warning
343599a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
343699a2dd95SBruce Richardson  *
343799a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_META
343899a2dd95SBruce Richardson  *
343999a2dd95SBruce Richardson  * Set metadata. Metadata set by mbuf metadata dynamic field with
3440daa02b5cSOlivier Matz  * RTE_MBUF_DYNFLAG_TX_METADATA flag on egress will be overridden by this
3441daa02b5cSOlivier Matz  * action. On ingress, the metadata will be carried by mbuf metadata dynamic
3442daa02b5cSOlivier Matz  * field with RTE_MBUF_DYNFLAG_RX_METADATA flag if set.  The dynamic mbuf field
3443daa02b5cSOlivier Matz  * must be registered in advance by rte_flow_dynf_metadata_register().
344499a2dd95SBruce Richardson  *
344599a2dd95SBruce Richardson  * Altering partial bits is supported with mask. For bits which have never
344699a2dd95SBruce Richardson  * been set, unpredictable value will be seen depending on driver
344799a2dd95SBruce Richardson  * implementation. For loopback/hairpin packet, metadata set on Rx/Tx may
344899a2dd95SBruce Richardson  * or may not be propagated to the other path depending on HW capability.
344999a2dd95SBruce Richardson  *
345099a2dd95SBruce Richardson  * RTE_FLOW_ITEM_TYPE_META matches metadata.
345199a2dd95SBruce Richardson  */
345299a2dd95SBruce Richardson struct rte_flow_action_set_meta {
345399a2dd95SBruce Richardson 	uint32_t data;
345499a2dd95SBruce Richardson 	uint32_t mask;
345599a2dd95SBruce Richardson };
345699a2dd95SBruce Richardson 
345799a2dd95SBruce Richardson /**
345899a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP
345999a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP
346099a2dd95SBruce Richardson  *
346199a2dd95SBruce Richardson  * Set the DSCP value for IPv4/IPv6 header.
346299a2dd95SBruce Richardson  * DSCP in low 6 bits, rest ignored.
346399a2dd95SBruce Richardson  */
346499a2dd95SBruce Richardson struct rte_flow_action_set_dscp {
346599a2dd95SBruce Richardson 	uint8_t dscp;
346699a2dd95SBruce Richardson };
346799a2dd95SBruce Richardson 
346899a2dd95SBruce Richardson /**
34694b61b877SBing Zhao  * @warning
34704b61b877SBing Zhao  * @b EXPERIMENTAL: this structure may change without prior notice
347199a2dd95SBruce Richardson  *
34724b61b877SBing Zhao  * RTE_FLOW_ACTION_TYPE_INDIRECT
347399a2dd95SBruce Richardson  *
34744b61b877SBing Zhao  * Opaque type returned after successfully creating an indirect action object.
34754b61b877SBing Zhao  * The definition of the object handle is different per driver or
34764b61b877SBing Zhao  * per direct action type.
34774b61b877SBing Zhao  *
34784b61b877SBing Zhao  * This handle can be used to manage and query the related direct action:
34794b61b877SBing Zhao  * - referenced in single flow rule or across multiple flow rules
34804b61b877SBing Zhao  *   over multiple ports
34814b61b877SBing Zhao  * - update action object configuration
34824b61b877SBing Zhao  * - query action object data
34834b61b877SBing Zhao  * - destroy action object
348499a2dd95SBruce Richardson  */
34854b61b877SBing Zhao struct rte_flow_action_handle;
348699a2dd95SBruce Richardson 
348799a2dd95SBruce Richardson /**
34889847fd12SBing Zhao  * The state of a TCP connection.
34899847fd12SBing Zhao  */
34909847fd12SBing Zhao enum rte_flow_conntrack_state {
34919847fd12SBing Zhao 	/** SYN-ACK packet was seen. */
34929847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_STATE_SYN_RECV,
34939847fd12SBing Zhao 	/** 3-way handshake was done. */
34949847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_STATE_ESTABLISHED,
34959847fd12SBing Zhao 	/** First FIN packet was received to close the connection. */
34969847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_STATE_FIN_WAIT,
34979847fd12SBing Zhao 	/** First FIN was ACKed. */
34989847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_STATE_CLOSE_WAIT,
34999847fd12SBing Zhao 	/** Second FIN was received, waiting for the last ACK. */
35009847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_STATE_LAST_ACK,
35019847fd12SBing Zhao 	/** Second FIN was ACKed, connection was closed. */
35029847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_STATE_TIME_WAIT,
35039847fd12SBing Zhao };
35049847fd12SBing Zhao 
35059847fd12SBing Zhao /**
35069847fd12SBing Zhao  * The last passed TCP packet flags of a connection.
35079847fd12SBing Zhao  */
35089847fd12SBing Zhao enum rte_flow_conntrack_tcp_last_index {
35099847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_FLAG_NONE = 0, /**< No Flag. */
35109847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_FLAG_SYN = RTE_BIT32(0), /**< With SYN flag. */
35119847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_FLAG_SYNACK = RTE_BIT32(1), /**< With SYNACK flag. */
35129847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_FLAG_FIN = RTE_BIT32(2), /**< With FIN flag. */
35139847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_FLAG_ACK = RTE_BIT32(3), /**< With ACK flag. */
35149847fd12SBing Zhao 	RTE_FLOW_CONNTRACK_FLAG_RST = RTE_BIT32(4), /**< With RST flag. */
35159847fd12SBing Zhao };
35169847fd12SBing Zhao 
35179847fd12SBing Zhao /**
35189847fd12SBing Zhao  * @warning
35199847fd12SBing Zhao  * @b EXPERIMENTAL: this structure may change without prior notice
35209847fd12SBing Zhao  *
35219847fd12SBing Zhao  * Configuration parameters for each direction of a TCP connection.
35229847fd12SBing Zhao  * All fields should be in host byte order.
35239847fd12SBing Zhao  * If needed, driver should convert all fields to network byte order
35249847fd12SBing Zhao  * if HW needs them in that way.
35259847fd12SBing Zhao  */
35269847fd12SBing Zhao struct rte_flow_tcp_dir_param {
35279847fd12SBing Zhao 	/** TCP window scaling factor, 0xF to disable. */
35289847fd12SBing Zhao 	uint32_t scale:4;
35299847fd12SBing Zhao 	/** The FIN was sent by this direction. */
35309847fd12SBing Zhao 	uint32_t close_initiated:1;
35319847fd12SBing Zhao 	/** An ACK packet has been received by this side. */
35329847fd12SBing Zhao 	uint32_t last_ack_seen:1;
35339847fd12SBing Zhao 	/**
35349847fd12SBing Zhao 	 * If set, it indicates that there is unacknowledged data for the
35359847fd12SBing Zhao 	 * packets sent from this direction.
35369847fd12SBing Zhao 	 */
35379847fd12SBing Zhao 	uint32_t data_unacked:1;
35389847fd12SBing Zhao 	/**
35399847fd12SBing Zhao 	 * Maximal value of sequence + payload length in sent
35409847fd12SBing Zhao 	 * packets (next ACK from the opposite direction).
35419847fd12SBing Zhao 	 */
35429847fd12SBing Zhao 	uint32_t sent_end;
35439847fd12SBing Zhao 	/**
35449847fd12SBing Zhao 	 * Maximal value of (ACK + window size) in received packet + length
35459847fd12SBing Zhao 	 * over sent packet (maximal sequence could be sent).
35469847fd12SBing Zhao 	 */
35479847fd12SBing Zhao 	uint32_t reply_end;
35489847fd12SBing Zhao 	/** Maximal value of actual window size in sent packets. */
35499847fd12SBing Zhao 	uint32_t max_win;
35509847fd12SBing Zhao 	/** Maximal value of ACK in sent packets. */
35519847fd12SBing Zhao 	uint32_t max_ack;
35529847fd12SBing Zhao };
35539847fd12SBing Zhao 
35549847fd12SBing Zhao /**
35559847fd12SBing Zhao  * @warning
35569847fd12SBing Zhao  * @b EXPERIMENTAL: this structure may change without prior notice
35579847fd12SBing Zhao  *
35589847fd12SBing Zhao  * RTE_FLOW_ACTION_TYPE_CONNTRACK
35599847fd12SBing Zhao  *
35609847fd12SBing Zhao  * Configuration and initial state for the connection tracking module.
35619847fd12SBing Zhao  * This structure could be used for both setting and query.
35629847fd12SBing Zhao  * All fields should be in host byte order.
35639847fd12SBing Zhao  */
35649847fd12SBing Zhao struct rte_flow_action_conntrack {
35659847fd12SBing Zhao 	/** The peer port number, can be the same port. */
35669847fd12SBing Zhao 	uint16_t peer_port;
35679847fd12SBing Zhao 	/**
35689847fd12SBing Zhao 	 * Direction of this connection when creating a flow rule, the
35699847fd12SBing Zhao 	 * value only affects the creation of subsequent flow rules.
35709847fd12SBing Zhao 	 */
35719847fd12SBing Zhao 	uint32_t is_original_dir:1;
35729847fd12SBing Zhao 	/**
35739847fd12SBing Zhao 	 * Enable / disable the conntrack HW module. When disabled, the
35749847fd12SBing Zhao 	 * result will always be RTE_FLOW_CONNTRACK_FLAG_DISABLED.
35759847fd12SBing Zhao 	 * In this state the HW will act as passthrough.
35769847fd12SBing Zhao 	 * It only affects this conntrack object in the HW without any effect
35779847fd12SBing Zhao 	 * to the other objects.
35789847fd12SBing Zhao 	 */
35799847fd12SBing Zhao 	uint32_t enable:1;
35809847fd12SBing Zhao 	/** At least one ack was seen after the connection was established. */
35819847fd12SBing Zhao 	uint32_t live_connection:1;
35829847fd12SBing Zhao 	/** Enable selective ACK on this connection. */
35839847fd12SBing Zhao 	uint32_t selective_ack:1;
35849847fd12SBing Zhao 	/** A challenge ack has passed. */
35859847fd12SBing Zhao 	uint32_t challenge_ack_passed:1;
35869847fd12SBing Zhao 	/**
35879847fd12SBing Zhao 	 * 1: The last packet is seen from the original direction.
35889847fd12SBing Zhao 	 * 0: The last packet is seen from the reply direction.
35899847fd12SBing Zhao 	 */
35909847fd12SBing Zhao 	uint32_t last_direction:1;
35919847fd12SBing Zhao 	/** No TCP check will be done except the state change. */
35929847fd12SBing Zhao 	uint32_t liberal_mode:1;
35933c2ca0a9SAndrew Rybchenko 	/** The current state of this connection. */
35949847fd12SBing Zhao 	enum rte_flow_conntrack_state state;
35959847fd12SBing Zhao 	/** Scaling factor for maximal allowed ACK window. */
35969847fd12SBing Zhao 	uint8_t max_ack_window;
35979847fd12SBing Zhao 	/** Maximal allowed number of retransmission times. */
35989847fd12SBing Zhao 	uint8_t retransmission_limit;
35999847fd12SBing Zhao 	/** TCP parameters of the original direction. */
36009847fd12SBing Zhao 	struct rte_flow_tcp_dir_param original_dir;
36019847fd12SBing Zhao 	/** TCP parameters of the reply direction. */
36029847fd12SBing Zhao 	struct rte_flow_tcp_dir_param reply_dir;
36039847fd12SBing Zhao 	/** The window value of the last packet passed this conntrack. */
36049847fd12SBing Zhao 	uint16_t last_window;
36059847fd12SBing Zhao 	enum rte_flow_conntrack_tcp_last_index last_index;
36069847fd12SBing Zhao 	/** The sequence of the last packet passed this conntrack. */
36079847fd12SBing Zhao 	uint32_t last_seq;
36089847fd12SBing Zhao 	/** The acknowledgment of the last packet passed this conntrack. */
36099847fd12SBing Zhao 	uint32_t last_ack;
36109847fd12SBing Zhao 	/**
36119847fd12SBing Zhao 	 * The total value ACK + payload length of the last packet
36129847fd12SBing Zhao 	 * passed this conntrack.
36139847fd12SBing Zhao 	 */
36149847fd12SBing Zhao 	uint32_t last_end;
36159847fd12SBing Zhao };
36169847fd12SBing Zhao 
36179847fd12SBing Zhao /**
36189847fd12SBing Zhao  * RTE_FLOW_ACTION_TYPE_CONNTRACK
36199847fd12SBing Zhao  *
36209847fd12SBing Zhao  * Wrapper structure for the context update interface.
36219847fd12SBing Zhao  * Ports cannot support updating, and the only valid solution is to
36229847fd12SBing Zhao  * destroy the old context and create a new one instead.
36239847fd12SBing Zhao  */
36249847fd12SBing Zhao struct rte_flow_modify_conntrack {
36259847fd12SBing Zhao 	/** New connection tracking parameters to be updated. */
36269847fd12SBing Zhao 	struct rte_flow_action_conntrack new_ct;
36279847fd12SBing Zhao 	/** The direction field will be updated. */
36289847fd12SBing Zhao 	uint32_t direction:1;
36299847fd12SBing Zhao 	/** All the other fields except direction will be updated. */
36309847fd12SBing Zhao 	uint32_t state:1;
36319847fd12SBing Zhao 	/** Reserved bits for the future usage. */
36329847fd12SBing Zhao 	uint32_t reserved:30;
36339847fd12SBing Zhao };
36349847fd12SBing Zhao 
36359847fd12SBing Zhao /**
36365f0d54f3SLi Zhang  * @warning
36375f0d54f3SLi Zhang  * @b EXPERIMENTAL: this structure may change without prior notice
36385f0d54f3SLi Zhang  *
36395f0d54f3SLi Zhang  * RTE_FLOW_ACTION_TYPE_METER_COLOR
36405f0d54f3SLi Zhang  *
36415f0d54f3SLi Zhang  * The meter color should be set in the packet meta-data
36425f0d54f3SLi Zhang  * (i.e. struct rte_mbuf::sched::color).
36435f0d54f3SLi Zhang  */
36445f0d54f3SLi Zhang struct rte_flow_action_meter_color {
36455f0d54f3SLi Zhang 	enum rte_color color; /**< Packet color. */
36465f0d54f3SLi Zhang };
36475f0d54f3SLi Zhang 
36485f0d54f3SLi Zhang /**
36498edb6bc0SIvan Malov  * @warning
36508edb6bc0SIvan Malov  * @b EXPERIMENTAL: this structure may change without prior notice
36518edb6bc0SIvan Malov  *
36528edb6bc0SIvan Malov  * Provides an ethdev port ID for use with the following actions:
365388caad25SIvan Malov  * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,
365488caad25SIvan Malov  * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT.
36558edb6bc0SIvan Malov  */
36568edb6bc0SIvan Malov struct rte_flow_action_ethdev {
36578edb6bc0SIvan Malov 	uint16_t port_id; /**< ethdev port ID */
36588edb6bc0SIvan Malov };
36598edb6bc0SIvan Malov 
36608edb6bc0SIvan Malov /**
366199a2dd95SBruce Richardson  * Field IDs for MODIFY_FIELD action.
366299a2dd95SBruce Richardson  */
366399a2dd95SBruce Richardson enum rte_flow_field_id {
366499a2dd95SBruce Richardson 	RTE_FLOW_FIELD_START = 0,	/**< Start of a packet. */
366599a2dd95SBruce Richardson 	RTE_FLOW_FIELD_MAC_DST,		/**< Destination MAC Address. */
366699a2dd95SBruce Richardson 	RTE_FLOW_FIELD_MAC_SRC,		/**< Source MAC Address. */
366799a2dd95SBruce Richardson 	RTE_FLOW_FIELD_VLAN_TYPE,	/**< 802.1Q Tag Identifier. */
366899a2dd95SBruce Richardson 	RTE_FLOW_FIELD_VLAN_ID,		/**< 802.1Q VLAN Identifier. */
366999a2dd95SBruce Richardson 	RTE_FLOW_FIELD_MAC_TYPE,	/**< EtherType. */
367099a2dd95SBruce Richardson 	RTE_FLOW_FIELD_IPV4_DSCP,	/**< IPv4 DSCP. */
367199a2dd95SBruce Richardson 	RTE_FLOW_FIELD_IPV4_TTL,	/**< IPv4 Time To Live. */
367299a2dd95SBruce Richardson 	RTE_FLOW_FIELD_IPV4_SRC,	/**< IPv4 Source Address. */
367399a2dd95SBruce Richardson 	RTE_FLOW_FIELD_IPV4_DST,	/**< IPv4 Destination Address. */
367499a2dd95SBruce Richardson 	RTE_FLOW_FIELD_IPV6_DSCP,	/**< IPv6 DSCP. */
367599a2dd95SBruce Richardson 	RTE_FLOW_FIELD_IPV6_HOPLIMIT,	/**< IPv6 Hop Limit. */
367699a2dd95SBruce Richardson 	RTE_FLOW_FIELD_IPV6_SRC,	/**< IPv6 Source Address. */
367799a2dd95SBruce Richardson 	RTE_FLOW_FIELD_IPV6_DST,	/**< IPv6 Destination Address. */
367899a2dd95SBruce Richardson 	RTE_FLOW_FIELD_TCP_PORT_SRC,	/**< TCP Source Port Number. */
367999a2dd95SBruce Richardson 	RTE_FLOW_FIELD_TCP_PORT_DST,	/**< TCP Destination Port Number. */
368099a2dd95SBruce Richardson 	RTE_FLOW_FIELD_TCP_SEQ_NUM,	/**< TCP Sequence Number. */
368199a2dd95SBruce Richardson 	RTE_FLOW_FIELD_TCP_ACK_NUM,	/**< TCP Acknowledgment Number. */
368299a2dd95SBruce Richardson 	RTE_FLOW_FIELD_TCP_FLAGS,	/**< TCP Flags. */
368399a2dd95SBruce Richardson 	RTE_FLOW_FIELD_UDP_PORT_SRC,	/**< UDP Source Port Number. */
368499a2dd95SBruce Richardson 	RTE_FLOW_FIELD_UDP_PORT_DST,	/**< UDP Destination Port Number. */
368599a2dd95SBruce Richardson 	RTE_FLOW_FIELD_VXLAN_VNI,	/**< VXLAN Network Identifier. */
368699a2dd95SBruce Richardson 	RTE_FLOW_FIELD_GENEVE_VNI,	/**< GENEVE Network Identifier. */
368799a2dd95SBruce Richardson 	RTE_FLOW_FIELD_GTP_TEID,	/**< GTP Tunnel Endpoint Identifier. */
368899a2dd95SBruce Richardson 	RTE_FLOW_FIELD_TAG,		/**< Tag value. */
368999a2dd95SBruce Richardson 	RTE_FLOW_FIELD_MARK,		/**< Mark value. */
369099a2dd95SBruce Richardson 	RTE_FLOW_FIELD_META,		/**< Metadata value. */
369199a2dd95SBruce Richardson 	RTE_FLOW_FIELD_POINTER,		/**< Memory pointer. */
369299a2dd95SBruce Richardson 	RTE_FLOW_FIELD_VALUE,		/**< Immediate value. */
369399a2dd95SBruce Richardson };
369499a2dd95SBruce Richardson 
369599a2dd95SBruce Richardson /**
369650cd0391SViacheslav Ovsiienko  * @warning
369750cd0391SViacheslav Ovsiienko  * @b EXPERIMENTAL: this structure may change without prior notice
369850cd0391SViacheslav Ovsiienko  *
369999a2dd95SBruce Richardson  * Field description for MODIFY_FIELD action.
370099a2dd95SBruce Richardson  */
370199a2dd95SBruce Richardson struct rte_flow_action_modify_data {
370299a2dd95SBruce Richardson 	enum rte_flow_field_id field; /**< Field or memory type ID. */
370399a2dd95SBruce Richardson 	RTE_STD_C11
370499a2dd95SBruce Richardson 	union {
370599a2dd95SBruce Richardson 		struct {
37063c2ca0a9SAndrew Rybchenko 			/** Encapsulation level or tag index. */
370799a2dd95SBruce Richardson 			uint32_t level;
37083c2ca0a9SAndrew Rybchenko 			/** Number of bits to skip from a field. */
370999a2dd95SBruce Richardson 			uint32_t offset;
371099a2dd95SBruce Richardson 		};
371199a2dd95SBruce Richardson 		/**
371214fc81aeSViacheslav Ovsiienko 		 * Immediate value for RTE_FLOW_FIELD_VALUE, presented in the
371314fc81aeSViacheslav Ovsiienko 		 * same byte order and length as in relevant rte_flow_item_xxx.
371414fc81aeSViacheslav Ovsiienko 		 * The immediate source bitfield offset is inherited from
371514fc81aeSViacheslav Ovsiienko 		 * the destination's one.
371699a2dd95SBruce Richardson 		 */
371714fc81aeSViacheslav Ovsiienko 		uint8_t value[16];
371814fc81aeSViacheslav Ovsiienko 		/**
371914fc81aeSViacheslav Ovsiienko 		 * Memory address for RTE_FLOW_FIELD_POINTER, memory layout
372014fc81aeSViacheslav Ovsiienko 		 * should be the same as for relevant field in the
372114fc81aeSViacheslav Ovsiienko 		 * rte_flow_item_xxx structure.
372214fc81aeSViacheslav Ovsiienko 		 */
372314fc81aeSViacheslav Ovsiienko 		void *pvalue;
372499a2dd95SBruce Richardson 	};
372599a2dd95SBruce Richardson };
372699a2dd95SBruce Richardson 
372799a2dd95SBruce Richardson /**
372899a2dd95SBruce Richardson  * Operation types for MODIFY_FIELD action.
372999a2dd95SBruce Richardson  */
373099a2dd95SBruce Richardson enum rte_flow_modify_op {
373199a2dd95SBruce Richardson 	RTE_FLOW_MODIFY_SET = 0, /**< Set a new value. */
373299a2dd95SBruce Richardson 	RTE_FLOW_MODIFY_ADD,     /**< Add a value to a field.  */
373399a2dd95SBruce Richardson 	RTE_FLOW_MODIFY_SUB,     /**< Subtract a value from a field. */
373499a2dd95SBruce Richardson };
373599a2dd95SBruce Richardson 
373699a2dd95SBruce Richardson /**
373799a2dd95SBruce Richardson  * @warning
373899a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
373999a2dd95SBruce Richardson  *
374099a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_MODIFY_FIELD
374199a2dd95SBruce Richardson  *
374299a2dd95SBruce Richardson  * Modify a destination header field according to the specified
374314fc81aeSViacheslav Ovsiienko  * operation. Another field of the packet can be used as a source as well
374499a2dd95SBruce Richardson  * as tag, mark, metadata, immediate value or a pointer to it.
374599a2dd95SBruce Richardson  */
374699a2dd95SBruce Richardson struct rte_flow_action_modify_field {
374799a2dd95SBruce Richardson 	enum rte_flow_modify_op operation; /**< Operation to perform. */
374899a2dd95SBruce Richardson 	struct rte_flow_action_modify_data dst; /**< Destination field. */
374999a2dd95SBruce Richardson 	struct rte_flow_action_modify_data src; /**< Source field. */
375099a2dd95SBruce Richardson 	uint32_t width; /**< Number of bits to use from a source field. */
375199a2dd95SBruce Richardson };
375299a2dd95SBruce Richardson 
375399a2dd95SBruce Richardson /* Mbuf dynamic field offset for metadata. */
375499a2dd95SBruce Richardson extern int32_t rte_flow_dynf_metadata_offs;
375599a2dd95SBruce Richardson 
375699a2dd95SBruce Richardson /* Mbuf dynamic field flag mask for metadata. */
375799a2dd95SBruce Richardson extern uint64_t rte_flow_dynf_metadata_mask;
375899a2dd95SBruce Richardson 
375999a2dd95SBruce Richardson /* Mbuf dynamic field pointer for metadata. */
376099a2dd95SBruce Richardson #define RTE_FLOW_DYNF_METADATA(m) \
376199a2dd95SBruce Richardson 	RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *)
376299a2dd95SBruce Richardson 
376399a2dd95SBruce Richardson /* Mbuf dynamic flags for metadata. */
3764daa02b5cSOlivier Matz #define RTE_MBUF_DYNFLAG_RX_METADATA (rte_flow_dynf_metadata_mask)
3765daa02b5cSOlivier Matz #define PKT_RX_DYNF_METADATA RTE_DEPRECATED(PKT_RX_DYNF_METADATA) \
3766daa02b5cSOlivier Matz 		RTE_MBUF_DYNFLAG_RX_METADATA
3767daa02b5cSOlivier Matz #define RTE_MBUF_DYNFLAG_TX_METADATA (rte_flow_dynf_metadata_mask)
3768daa02b5cSOlivier Matz #define PKT_TX_DYNF_METADATA RTE_DEPRECATED(PKT_TX_DYNF_METADATA) \
3769daa02b5cSOlivier Matz 		RTE_MBUF_DYNFLAG_TX_METADATA
377099a2dd95SBruce Richardson 
377199a2dd95SBruce Richardson __rte_experimental
377299a2dd95SBruce Richardson static inline uint32_t
rte_flow_dynf_metadata_get(struct rte_mbuf * m)377399a2dd95SBruce Richardson rte_flow_dynf_metadata_get(struct rte_mbuf *m)
377499a2dd95SBruce Richardson {
377599a2dd95SBruce Richardson 	return *RTE_FLOW_DYNF_METADATA(m);
377699a2dd95SBruce Richardson }
377799a2dd95SBruce Richardson 
377899a2dd95SBruce Richardson __rte_experimental
377999a2dd95SBruce Richardson static inline void
rte_flow_dynf_metadata_set(struct rte_mbuf * m,uint32_t v)378099a2dd95SBruce Richardson rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v)
378199a2dd95SBruce Richardson {
378299a2dd95SBruce Richardson 	*RTE_FLOW_DYNF_METADATA(m) = v;
378399a2dd95SBruce Richardson }
378499a2dd95SBruce Richardson 
378556912ddeSJan Viktorin /**
378699a2dd95SBruce Richardson  * Definition of a single action.
378799a2dd95SBruce Richardson  *
378899a2dd95SBruce Richardson  * A list of actions is terminated by a END action.
378999a2dd95SBruce Richardson  *
379099a2dd95SBruce Richardson  * For simple actions without a configuration object, conf remains NULL.
379199a2dd95SBruce Richardson  */
379299a2dd95SBruce Richardson struct rte_flow_action {
379399a2dd95SBruce Richardson 	enum rte_flow_action_type type; /**< Action type. */
379499a2dd95SBruce Richardson 	const void *conf; /**< Pointer to action configuration object. */
379599a2dd95SBruce Richardson };
379699a2dd95SBruce Richardson 
379799a2dd95SBruce Richardson /**
379899a2dd95SBruce Richardson  * Opaque type returned after successfully creating a flow.
379999a2dd95SBruce Richardson  *
380099a2dd95SBruce Richardson  * This handle can be used to manage and query the related flow (e.g. to
380199a2dd95SBruce Richardson  * destroy it or retrieve counters).
380299a2dd95SBruce Richardson  */
380399a2dd95SBruce Richardson struct rte_flow;
380499a2dd95SBruce Richardson 
380599a2dd95SBruce Richardson /**
380699a2dd95SBruce Richardson  * @warning
380799a2dd95SBruce Richardson  * @b EXPERIMENTAL: this structure may change without prior notice
380899a2dd95SBruce Richardson  *
380999a2dd95SBruce Richardson  * RTE_FLOW_ACTION_TYPE_SAMPLE
381099a2dd95SBruce Richardson  *
381199a2dd95SBruce Richardson  * Adds a sample action to a matched flow.
381299a2dd95SBruce Richardson  *
381399a2dd95SBruce Richardson  * The matching packets will be duplicated with specified ratio and applied
381499a2dd95SBruce Richardson  * with own set of actions with a fate action, the sampled packet could be
381599a2dd95SBruce Richardson  * redirected to queue or port. All the packets continue processing on the
381699a2dd95SBruce Richardson  * default flow path.
381799a2dd95SBruce Richardson  *
381899a2dd95SBruce Richardson  * When the sample ratio is set to 1 then the packets will be 100% mirrored.
381999a2dd95SBruce Richardson  * Additional action list be supported to add for sampled or mirrored packets.
382099a2dd95SBruce Richardson  */
382199a2dd95SBruce Richardson struct rte_flow_action_sample {
382299a2dd95SBruce Richardson 	uint32_t ratio; /**< packets sampled equals to '1/ratio'. */
38233c2ca0a9SAndrew Rybchenko 	/** sub-action list specific for the sampling hit cases. */
382499a2dd95SBruce Richardson 	const struct rte_flow_action *actions;
382599a2dd95SBruce Richardson };
382699a2dd95SBruce Richardson 
382799a2dd95SBruce Richardson /**
382899a2dd95SBruce Richardson  * Verbose error types.
382999a2dd95SBruce Richardson  *
383099a2dd95SBruce Richardson  * Most of them provide the type of the object referenced by struct
383199a2dd95SBruce Richardson  * rte_flow_error.cause.
383299a2dd95SBruce Richardson  */
383399a2dd95SBruce Richardson enum rte_flow_error_type {
383499a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_NONE, /**< No error. */
383599a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
383699a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_HANDLE, /**< Flow rule (handle). */
383799a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ATTR_GROUP, /**< Group field. */
383899a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, /**< Priority field. */
383999a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, /**< Ingress field. */
384099a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, /**< Egress field. */
384199a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, /**< Transfer field. */
384299a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ATTR, /**< Attributes structure. */
384399a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ITEM_NUM, /**< Pattern length. */
384499a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ITEM_SPEC, /**< Item specification. */
384599a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ITEM_LAST, /**< Item specification range. */
384699a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ITEM_MASK, /**< Item specification mask. */
384799a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ITEM, /**< Specific pattern item. */
384899a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */
384999a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */
385099a2dd95SBruce Richardson 	RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */
38511d5a3d68SDmitry Kozlyuk 	RTE_FLOW_ERROR_TYPE_STATE, /**< Current device state. */
385299a2dd95SBruce Richardson };
385399a2dd95SBruce Richardson 
385499a2dd95SBruce Richardson /**
385599a2dd95SBruce Richardson  * Verbose error structure definition.
385699a2dd95SBruce Richardson  *
385799a2dd95SBruce Richardson  * This object is normally allocated by applications and set by PMDs, the
385899a2dd95SBruce Richardson  * message points to a constant string which does not need to be freed by
385999a2dd95SBruce Richardson  * the application, however its pointer can be considered valid only as long
386099a2dd95SBruce Richardson  * as its associated DPDK port remains configured. Closing the underlying
386199a2dd95SBruce Richardson  * device or unloading the PMD invalidates it.
386299a2dd95SBruce Richardson  *
386399a2dd95SBruce Richardson  * Both cause and message may be NULL regardless of the error type.
386499a2dd95SBruce Richardson  */
386599a2dd95SBruce Richardson struct rte_flow_error {
386699a2dd95SBruce Richardson 	enum rte_flow_error_type type; /**< Cause field and error types. */
386799a2dd95SBruce Richardson 	const void *cause; /**< Object responsible for the error. */
386899a2dd95SBruce Richardson 	const char *message; /**< Human-readable error message. */
386999a2dd95SBruce Richardson };
387099a2dd95SBruce Richardson 
387199a2dd95SBruce Richardson /**
387299a2dd95SBruce Richardson  * Complete flow rule description.
387399a2dd95SBruce Richardson  *
387499a2dd95SBruce Richardson  * This object type is used when converting a flow rule description.
387599a2dd95SBruce Richardson  *
387699a2dd95SBruce Richardson  * @see RTE_FLOW_CONV_OP_RULE
387799a2dd95SBruce Richardson  * @see rte_flow_conv()
387899a2dd95SBruce Richardson  */
387999a2dd95SBruce Richardson RTE_STD_C11
388099a2dd95SBruce Richardson struct rte_flow_conv_rule {
388199a2dd95SBruce Richardson 	union {
388299a2dd95SBruce Richardson 		const struct rte_flow_attr *attr_ro; /**< RO attributes. */
388399a2dd95SBruce Richardson 		struct rte_flow_attr *attr; /**< Attributes. */
388499a2dd95SBruce Richardson 	};
388599a2dd95SBruce Richardson 	union {
388699a2dd95SBruce Richardson 		const struct rte_flow_item *pattern_ro; /**< RO pattern. */
388799a2dd95SBruce Richardson 		struct rte_flow_item *pattern; /**< Pattern items. */
388899a2dd95SBruce Richardson 	};
388999a2dd95SBruce Richardson 	union {
389099a2dd95SBruce Richardson 		const struct rte_flow_action *actions_ro; /**< RO actions. */
389199a2dd95SBruce Richardson 		struct rte_flow_action *actions; /**< List of actions. */
389299a2dd95SBruce Richardson 	};
389399a2dd95SBruce Richardson };
389499a2dd95SBruce Richardson 
389599a2dd95SBruce Richardson /**
389699a2dd95SBruce Richardson  * Conversion operations for flow API objects.
389799a2dd95SBruce Richardson  *
389899a2dd95SBruce Richardson  * @see rte_flow_conv()
389999a2dd95SBruce Richardson  */
390099a2dd95SBruce Richardson enum rte_flow_conv_op {
390199a2dd95SBruce Richardson 	/**
390299a2dd95SBruce Richardson 	 * No operation to perform.
390399a2dd95SBruce Richardson 	 *
390499a2dd95SBruce Richardson 	 * rte_flow_conv() simply returns 0.
390599a2dd95SBruce Richardson 	 */
390699a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_NONE,
390799a2dd95SBruce Richardson 
390899a2dd95SBruce Richardson 	/**
390999a2dd95SBruce Richardson 	 * Convert attributes structure.
391099a2dd95SBruce Richardson 	 *
391199a2dd95SBruce Richardson 	 * This is a basic copy of an attributes structure.
391299a2dd95SBruce Richardson 	 *
391399a2dd95SBruce Richardson 	 * - @p src type:
391499a2dd95SBruce Richardson 	 *   @code const struct rte_flow_attr * @endcode
391599a2dd95SBruce Richardson 	 * - @p dst type:
391699a2dd95SBruce Richardson 	 *   @code struct rte_flow_attr * @endcode
391799a2dd95SBruce Richardson 	 */
391899a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_ATTR,
391999a2dd95SBruce Richardson 
392099a2dd95SBruce Richardson 	/**
392199a2dd95SBruce Richardson 	 * Convert a single item.
392299a2dd95SBruce Richardson 	 *
392399a2dd95SBruce Richardson 	 * Duplicates @p spec, @p last and @p mask but not outside objects.
392499a2dd95SBruce Richardson 	 *
392599a2dd95SBruce Richardson 	 * - @p src type:
392699a2dd95SBruce Richardson 	 *   @code const struct rte_flow_item * @endcode
392799a2dd95SBruce Richardson 	 * - @p dst type:
392899a2dd95SBruce Richardson 	 *   @code struct rte_flow_item * @endcode
392999a2dd95SBruce Richardson 	 */
393099a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_ITEM,
393199a2dd95SBruce Richardson 
393299a2dd95SBruce Richardson 	/**
393399a2dd95SBruce Richardson 	 * Convert a single action.
393499a2dd95SBruce Richardson 	 *
393599a2dd95SBruce Richardson 	 * Duplicates @p conf but not outside objects.
393699a2dd95SBruce Richardson 	 *
393799a2dd95SBruce Richardson 	 * - @p src type:
393899a2dd95SBruce Richardson 	 *   @code const struct rte_flow_action * @endcode
393999a2dd95SBruce Richardson 	 * - @p dst type:
394099a2dd95SBruce Richardson 	 *   @code struct rte_flow_action * @endcode
394199a2dd95SBruce Richardson 	 */
394299a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_ACTION,
394399a2dd95SBruce Richardson 
394499a2dd95SBruce Richardson 	/**
394599a2dd95SBruce Richardson 	 * Convert an entire pattern.
394699a2dd95SBruce Richardson 	 *
394799a2dd95SBruce Richardson 	 * Duplicates all pattern items at once with the same constraints as
394899a2dd95SBruce Richardson 	 * RTE_FLOW_CONV_OP_ITEM.
394999a2dd95SBruce Richardson 	 *
395099a2dd95SBruce Richardson 	 * - @p src type:
395199a2dd95SBruce Richardson 	 *   @code const struct rte_flow_item * @endcode
395299a2dd95SBruce Richardson 	 * - @p dst type:
395399a2dd95SBruce Richardson 	 *   @code struct rte_flow_item * @endcode
395499a2dd95SBruce Richardson 	 */
395599a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_PATTERN,
395699a2dd95SBruce Richardson 
395799a2dd95SBruce Richardson 	/**
395899a2dd95SBruce Richardson 	 * Convert a list of actions.
395999a2dd95SBruce Richardson 	 *
396099a2dd95SBruce Richardson 	 * Duplicates the entire list of actions at once with the same
396199a2dd95SBruce Richardson 	 * constraints as RTE_FLOW_CONV_OP_ACTION.
396299a2dd95SBruce Richardson 	 *
396399a2dd95SBruce Richardson 	 * - @p src type:
396499a2dd95SBruce Richardson 	 *   @code const struct rte_flow_action * @endcode
396599a2dd95SBruce Richardson 	 * - @p dst type:
396699a2dd95SBruce Richardson 	 *   @code struct rte_flow_action * @endcode
396799a2dd95SBruce Richardson 	 */
396899a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_ACTIONS,
396999a2dd95SBruce Richardson 
397099a2dd95SBruce Richardson 	/**
397199a2dd95SBruce Richardson 	 * Convert a complete flow rule description.
397299a2dd95SBruce Richardson 	 *
397399a2dd95SBruce Richardson 	 * Comprises attributes, pattern and actions together at once with
397499a2dd95SBruce Richardson 	 * the usual constraints.
397599a2dd95SBruce Richardson 	 *
397699a2dd95SBruce Richardson 	 * - @p src type:
397799a2dd95SBruce Richardson 	 *   @code const struct rte_flow_conv_rule * @endcode
397899a2dd95SBruce Richardson 	 * - @p dst type:
397999a2dd95SBruce Richardson 	 *   @code struct rte_flow_conv_rule * @endcode
398099a2dd95SBruce Richardson 	 */
398199a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_RULE,
398299a2dd95SBruce Richardson 
398399a2dd95SBruce Richardson 	/**
398499a2dd95SBruce Richardson 	 * Convert item type to its name string.
398599a2dd95SBruce Richardson 	 *
398699a2dd95SBruce Richardson 	 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
398799a2dd95SBruce Richardson 	 * returned value excludes the terminator which is always written
398899a2dd95SBruce Richardson 	 * nonetheless.
398999a2dd95SBruce Richardson 	 *
399099a2dd95SBruce Richardson 	 * - @p src type:
399199a2dd95SBruce Richardson 	 *   @code (const void *)enum rte_flow_item_type @endcode
399299a2dd95SBruce Richardson 	 * - @p dst type:
399399a2dd95SBruce Richardson 	 *   @code char * @endcode
399499a2dd95SBruce Richardson 	 **/
399599a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_ITEM_NAME,
399699a2dd95SBruce Richardson 
399799a2dd95SBruce Richardson 	/**
399899a2dd95SBruce Richardson 	 * Convert action type to its name string.
399999a2dd95SBruce Richardson 	 *
400099a2dd95SBruce Richardson 	 * Writes a NUL-terminated string to @p dst. Like snprintf(), the
400199a2dd95SBruce Richardson 	 * returned value excludes the terminator which is always written
400299a2dd95SBruce Richardson 	 * nonetheless.
400399a2dd95SBruce Richardson 	 *
400499a2dd95SBruce Richardson 	 * - @p src type:
400599a2dd95SBruce Richardson 	 *   @code (const void *)enum rte_flow_action_type @endcode
400699a2dd95SBruce Richardson 	 * - @p dst type:
400799a2dd95SBruce Richardson 	 *   @code char * @endcode
400899a2dd95SBruce Richardson 	 **/
400999a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_ACTION_NAME,
401099a2dd95SBruce Richardson 
401199a2dd95SBruce Richardson 	/**
401299a2dd95SBruce Richardson 	 * Convert item type to pointer to item name.
401399a2dd95SBruce Richardson 	 *
401499a2dd95SBruce Richardson 	 * Retrieves item name pointer from its type. The string itself is
401599a2dd95SBruce Richardson 	 * not copied; instead, a unique pointer to an internal static
401699a2dd95SBruce Richardson 	 * constant storage is written to @p dst.
401799a2dd95SBruce Richardson 	 *
401899a2dd95SBruce Richardson 	 * - @p src type:
401999a2dd95SBruce Richardson 	 *   @code (const void *)enum rte_flow_item_type @endcode
402099a2dd95SBruce Richardson 	 * - @p dst type:
402199a2dd95SBruce Richardson 	 *   @code const char ** @endcode
402299a2dd95SBruce Richardson 	 */
402399a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_ITEM_NAME_PTR,
402499a2dd95SBruce Richardson 
402599a2dd95SBruce Richardson 	/**
402699a2dd95SBruce Richardson 	 * Convert action type to pointer to action name.
402799a2dd95SBruce Richardson 	 *
402899a2dd95SBruce Richardson 	 * Retrieves action name pointer from its type. The string itself is
402999a2dd95SBruce Richardson 	 * not copied; instead, a unique pointer to an internal static
403099a2dd95SBruce Richardson 	 * constant storage is written to @p dst.
403199a2dd95SBruce Richardson 	 *
403299a2dd95SBruce Richardson 	 * - @p src type:
403399a2dd95SBruce Richardson 	 *   @code (const void *)enum rte_flow_action_type @endcode
403499a2dd95SBruce Richardson 	 * - @p dst type:
403599a2dd95SBruce Richardson 	 *   @code const char ** @endcode
403699a2dd95SBruce Richardson 	 */
403799a2dd95SBruce Richardson 	RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
403899a2dd95SBruce Richardson };
403999a2dd95SBruce Richardson 
404099a2dd95SBruce Richardson /**
404199a2dd95SBruce Richardson  * @warning
404299a2dd95SBruce Richardson  * @b EXPERIMENTAL: this API may change without prior notice.
404399a2dd95SBruce Richardson  *
404499a2dd95SBruce Richardson  * Dump hardware internal representation information of
404599a2dd95SBruce Richardson  * rte flow to file.
404699a2dd95SBruce Richardson  *
404799a2dd95SBruce Richardson  * @param[in] port_id
404899a2dd95SBruce Richardson  *    The port identifier of the Ethernet device.
404999a2dd95SBruce Richardson  * @param[in] flow
405099a2dd95SBruce Richardson  *   The pointer of flow rule to dump. Dump all rules if NULL.
405199a2dd95SBruce Richardson  * @param[in] file
405299a2dd95SBruce Richardson  *   A pointer to a file for output.
405399a2dd95SBruce Richardson  * @param[out] error
405499a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
405599a2dd95SBruce Richardson  *   structure in case of error only.
405699a2dd95SBruce Richardson  * @return
405751395027SFerruh Yigit  *   0 on success, a negative value otherwise.
405899a2dd95SBruce Richardson  */
405999a2dd95SBruce Richardson __rte_experimental
406099a2dd95SBruce Richardson int
406199a2dd95SBruce Richardson rte_flow_dev_dump(uint16_t port_id, struct rte_flow *flow,
406299a2dd95SBruce Richardson 		FILE *file, struct rte_flow_error *error);
406399a2dd95SBruce Richardson 
406499a2dd95SBruce Richardson /**
406599a2dd95SBruce Richardson  * Check if mbuf dynamic field for metadata is registered.
406699a2dd95SBruce Richardson  *
406799a2dd95SBruce Richardson  * @return
406899a2dd95SBruce Richardson  *   True if registered, false otherwise.
406999a2dd95SBruce Richardson  */
407099a2dd95SBruce Richardson __rte_experimental
407199a2dd95SBruce Richardson static inline int
rte_flow_dynf_metadata_avail(void)407299a2dd95SBruce Richardson rte_flow_dynf_metadata_avail(void)
407399a2dd95SBruce Richardson {
407499a2dd95SBruce Richardson 	return !!rte_flow_dynf_metadata_mask;
407599a2dd95SBruce Richardson }
407699a2dd95SBruce Richardson 
407799a2dd95SBruce Richardson /**
407899a2dd95SBruce Richardson  * Register mbuf dynamic field and flag for metadata.
407999a2dd95SBruce Richardson  *
408099a2dd95SBruce Richardson  * This function must be called prior to use SET_META action in order to
408199a2dd95SBruce Richardson  * register the dynamic mbuf field. Otherwise, the data cannot be delivered to
408299a2dd95SBruce Richardson  * application.
408399a2dd95SBruce Richardson  *
408499a2dd95SBruce Richardson  * @return
408599a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
408699a2dd95SBruce Richardson  */
408799a2dd95SBruce Richardson __rte_experimental
408899a2dd95SBruce Richardson int
408999a2dd95SBruce Richardson rte_flow_dynf_metadata_register(void);
409099a2dd95SBruce Richardson 
409199a2dd95SBruce Richardson /**
409299a2dd95SBruce Richardson  * Check whether a flow rule can be created on a given port.
409399a2dd95SBruce Richardson  *
409499a2dd95SBruce Richardson  * The flow rule is validated for correctness and whether it could be accepted
409599a2dd95SBruce Richardson  * by the device given sufficient resources. The rule is checked against the
409699a2dd95SBruce Richardson  * current device mode and queue configuration. The flow rule may also
409799a2dd95SBruce Richardson  * optionally be validated against existing flow rules and device resources.
409899a2dd95SBruce Richardson  * This function has no effect on the target device.
409999a2dd95SBruce Richardson  *
410099a2dd95SBruce Richardson  * The returned value is guaranteed to remain valid only as long as no
410199a2dd95SBruce Richardson  * successful calls to rte_flow_create() or rte_flow_destroy() are made in
410299a2dd95SBruce Richardson  * the meantime and no device parameter affecting flow rules in any way are
410399a2dd95SBruce Richardson  * modified, due to possible collisions or resource limitations (although in
410499a2dd95SBruce Richardson  * such cases EINVAL should not be returned).
410599a2dd95SBruce Richardson  *
410699a2dd95SBruce Richardson  * @param port_id
410799a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
410899a2dd95SBruce Richardson  * @param[in] attr
410999a2dd95SBruce Richardson  *   Flow rule attributes.
411099a2dd95SBruce Richardson  * @param[in] pattern
411199a2dd95SBruce Richardson  *   Pattern specification (list terminated by the END pattern item).
411299a2dd95SBruce Richardson  * @param[in] actions
411399a2dd95SBruce Richardson  *   Associated actions (list terminated by the END action).
411499a2dd95SBruce Richardson  * @param[out] error
411599a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
411699a2dd95SBruce Richardson  *   structure in case of error only.
411799a2dd95SBruce Richardson  *
411899a2dd95SBruce Richardson  * @return
411999a2dd95SBruce Richardson  *   0 if flow rule is valid and can be created. A negative errno value
412099a2dd95SBruce Richardson  *   otherwise (rte_errno is also set), the following errors are defined:
412199a2dd95SBruce Richardson  *
412299a2dd95SBruce Richardson  *   -ENOSYS: underlying device does not support this functionality.
412399a2dd95SBruce Richardson  *
412499a2dd95SBruce Richardson  *   -EIO: underlying device is removed.
412599a2dd95SBruce Richardson  *
412699a2dd95SBruce Richardson  *   -EINVAL: unknown or invalid rule specification.
412799a2dd95SBruce Richardson  *
412899a2dd95SBruce Richardson  *   -ENOTSUP: valid but unsupported rule specification (e.g. partial
412999a2dd95SBruce Richardson  *   bit-masks are unsupported).
413099a2dd95SBruce Richardson  *
413199a2dd95SBruce Richardson  *   -EEXIST: collision with an existing rule. Only returned if device
413299a2dd95SBruce Richardson  *   supports flow rule collision checking and there was a flow rule
413399a2dd95SBruce Richardson  *   collision. Not receiving this return code is no guarantee that creating
413499a2dd95SBruce Richardson  *   the rule will not fail due to a collision.
413599a2dd95SBruce Richardson  *
413699a2dd95SBruce Richardson  *   -ENOMEM: not enough memory to execute the function, or if the device
413799a2dd95SBruce Richardson  *   supports resource validation, resource limitation on the device.
413899a2dd95SBruce Richardson  *
413999a2dd95SBruce Richardson  *   -EBUSY: action cannot be performed due to busy device resources, may
414099a2dd95SBruce Richardson  *   succeed if the affected queues or even the entire port are in a stopped
414199a2dd95SBruce Richardson  *   state (see rte_eth_dev_rx_queue_stop() and rte_eth_dev_stop()).
414299a2dd95SBruce Richardson  */
414399a2dd95SBruce Richardson int
414499a2dd95SBruce Richardson rte_flow_validate(uint16_t port_id,
414599a2dd95SBruce Richardson 		  const struct rte_flow_attr *attr,
414699a2dd95SBruce Richardson 		  const struct rte_flow_item pattern[],
414799a2dd95SBruce Richardson 		  const struct rte_flow_action actions[],
414899a2dd95SBruce Richardson 		  struct rte_flow_error *error);
414999a2dd95SBruce Richardson 
415099a2dd95SBruce Richardson /**
415199a2dd95SBruce Richardson  * Create a flow rule on a given port.
415299a2dd95SBruce Richardson  *
415399a2dd95SBruce Richardson  * @param port_id
415499a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
415599a2dd95SBruce Richardson  * @param[in] attr
415699a2dd95SBruce Richardson  *   Flow rule attributes.
415799a2dd95SBruce Richardson  * @param[in] pattern
415899a2dd95SBruce Richardson  *   Pattern specification (list terminated by the END pattern item).
415999a2dd95SBruce Richardson  * @param[in] actions
416099a2dd95SBruce Richardson  *   Associated actions (list terminated by the END action).
416199a2dd95SBruce Richardson  * @param[out] error
416299a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
416399a2dd95SBruce Richardson  *   structure in case of error only.
416499a2dd95SBruce Richardson  *
416599a2dd95SBruce Richardson  * @return
416699a2dd95SBruce Richardson  *   A valid handle in case of success, NULL otherwise and rte_errno is set
416799a2dd95SBruce Richardson  *   to the positive version of one of the error codes defined for
416899a2dd95SBruce Richardson  *   rte_flow_validate().
416999a2dd95SBruce Richardson  */
417099a2dd95SBruce Richardson struct rte_flow *
417199a2dd95SBruce Richardson rte_flow_create(uint16_t port_id,
417299a2dd95SBruce Richardson 		const struct rte_flow_attr *attr,
417399a2dd95SBruce Richardson 		const struct rte_flow_item pattern[],
417499a2dd95SBruce Richardson 		const struct rte_flow_action actions[],
417599a2dd95SBruce Richardson 		struct rte_flow_error *error);
417699a2dd95SBruce Richardson 
417799a2dd95SBruce Richardson /**
417899a2dd95SBruce Richardson  * Destroy a flow rule on a given port.
417999a2dd95SBruce Richardson  *
418099a2dd95SBruce Richardson  * Failure to destroy a flow rule handle may occur when other flow rules
418199a2dd95SBruce Richardson  * depend on it, and destroying it would result in an inconsistent state.
418299a2dd95SBruce Richardson  *
418399a2dd95SBruce Richardson  * This function is only guaranteed to succeed if handles are destroyed in
418499a2dd95SBruce Richardson  * reverse order of their creation.
418599a2dd95SBruce Richardson  *
418699a2dd95SBruce Richardson  * @param port_id
418799a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
418899a2dd95SBruce Richardson  * @param flow
418999a2dd95SBruce Richardson  *   Flow rule handle to destroy.
419099a2dd95SBruce Richardson  * @param[out] error
419199a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
419299a2dd95SBruce Richardson  *   structure in case of error only.
419399a2dd95SBruce Richardson  *
419499a2dd95SBruce Richardson  * @return
419599a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
419699a2dd95SBruce Richardson  */
419799a2dd95SBruce Richardson int
419899a2dd95SBruce Richardson rte_flow_destroy(uint16_t port_id,
419999a2dd95SBruce Richardson 		 struct rte_flow *flow,
420099a2dd95SBruce Richardson 		 struct rte_flow_error *error);
420199a2dd95SBruce Richardson 
420299a2dd95SBruce Richardson /**
420399a2dd95SBruce Richardson  * Destroy all flow rules associated with a port.
420499a2dd95SBruce Richardson  *
420599a2dd95SBruce Richardson  * In the unlikely event of failure, handles are still considered destroyed
420699a2dd95SBruce Richardson  * and no longer valid but the port must be assumed to be in an inconsistent
420799a2dd95SBruce Richardson  * state.
420899a2dd95SBruce Richardson  *
420999a2dd95SBruce Richardson  * @param port_id
421099a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
421199a2dd95SBruce Richardson  * @param[out] error
421299a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
421399a2dd95SBruce Richardson  *   structure in case of error only.
421499a2dd95SBruce Richardson  *
421599a2dd95SBruce Richardson  * @return
421699a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
421799a2dd95SBruce Richardson  */
421899a2dd95SBruce Richardson int
421999a2dd95SBruce Richardson rte_flow_flush(uint16_t port_id,
422099a2dd95SBruce Richardson 	       struct rte_flow_error *error);
422199a2dd95SBruce Richardson 
422299a2dd95SBruce Richardson /**
422399a2dd95SBruce Richardson  * Query an existing flow rule.
422499a2dd95SBruce Richardson  *
422599a2dd95SBruce Richardson  * This function allows retrieving flow-specific data such as counters.
422699a2dd95SBruce Richardson  * Data is gathered by special actions which must be present in the flow
422799a2dd95SBruce Richardson  * rule definition.
422899a2dd95SBruce Richardson  *
422999a2dd95SBruce Richardson  * \see RTE_FLOW_ACTION_TYPE_COUNT
423099a2dd95SBruce Richardson  *
423199a2dd95SBruce Richardson  * @param port_id
423299a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
423399a2dd95SBruce Richardson  * @param flow
423499a2dd95SBruce Richardson  *   Flow rule handle to query.
423599a2dd95SBruce Richardson  * @param action
423699a2dd95SBruce Richardson  *   Action definition as defined in original flow rule.
423799a2dd95SBruce Richardson  * @param[in, out] data
423899a2dd95SBruce Richardson  *   Pointer to storage for the associated query data type.
423999a2dd95SBruce Richardson  * @param[out] error
424099a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
424199a2dd95SBruce Richardson  *   structure in case of error only.
424299a2dd95SBruce Richardson  *
424399a2dd95SBruce Richardson  * @return
424499a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
424599a2dd95SBruce Richardson  */
424699a2dd95SBruce Richardson int
424799a2dd95SBruce Richardson rte_flow_query(uint16_t port_id,
424899a2dd95SBruce Richardson 	       struct rte_flow *flow,
424999a2dd95SBruce Richardson 	       const struct rte_flow_action *action,
425099a2dd95SBruce Richardson 	       void *data,
425199a2dd95SBruce Richardson 	       struct rte_flow_error *error);
425299a2dd95SBruce Richardson 
425399a2dd95SBruce Richardson /**
425499a2dd95SBruce Richardson  * Restrict ingress traffic to the defined flow rules.
425599a2dd95SBruce Richardson  *
425699a2dd95SBruce Richardson  * Isolated mode guarantees that all ingress traffic comes from defined flow
425799a2dd95SBruce Richardson  * rules only (current and future).
425899a2dd95SBruce Richardson  *
425999a2dd95SBruce Richardson  * Besides making ingress more deterministic, it allows PMDs to safely reuse
426099a2dd95SBruce Richardson  * resources otherwise assigned to handle the remaining traffic, such as
426199a2dd95SBruce Richardson  * global RSS configuration settings, VLAN filters, MAC address entries,
426299a2dd95SBruce Richardson  * legacy filter API rules and so on in order to expand the set of possible
426399a2dd95SBruce Richardson  * flow rule types.
426499a2dd95SBruce Richardson  *
426599a2dd95SBruce Richardson  * Calling this function as soon as possible after device initialization,
426699a2dd95SBruce Richardson  * ideally before the first call to rte_eth_dev_configure(), is recommended
426799a2dd95SBruce Richardson  * to avoid possible failures due to conflicting settings.
426899a2dd95SBruce Richardson  *
426999a2dd95SBruce Richardson  * Once effective, leaving isolated mode may not be possible depending on
427099a2dd95SBruce Richardson  * PMD implementation.
427199a2dd95SBruce Richardson  *
427299a2dd95SBruce Richardson  * Additionally, the following functionality has no effect on the underlying
427399a2dd95SBruce Richardson  * port and may return errors such as ENOTSUP ("not supported"):
427499a2dd95SBruce Richardson  *
427599a2dd95SBruce Richardson  * - Toggling promiscuous mode.
427699a2dd95SBruce Richardson  * - Toggling allmulticast mode.
427799a2dd95SBruce Richardson  * - Configuring MAC addresses.
427899a2dd95SBruce Richardson  * - Configuring multicast addresses.
427999a2dd95SBruce Richardson  * - Configuring VLAN filters.
428099a2dd95SBruce Richardson  * - Configuring Rx filters through the legacy API (e.g. FDIR).
428199a2dd95SBruce Richardson  * - Configuring global RSS settings.
428299a2dd95SBruce Richardson  *
428399a2dd95SBruce Richardson  * @param port_id
428499a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
428599a2dd95SBruce Richardson  * @param set
428699a2dd95SBruce Richardson  *   Nonzero to enter isolated mode, attempt to leave it otherwise.
428799a2dd95SBruce Richardson  * @param[out] error
428899a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
428999a2dd95SBruce Richardson  *   structure in case of error only.
429099a2dd95SBruce Richardson  *
429199a2dd95SBruce Richardson  * @return
429299a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
429399a2dd95SBruce Richardson  */
429499a2dd95SBruce Richardson int
429599a2dd95SBruce Richardson rte_flow_isolate(uint16_t port_id, int set, struct rte_flow_error *error);
429699a2dd95SBruce Richardson 
429799a2dd95SBruce Richardson /**
429899a2dd95SBruce Richardson  * Initialize flow error structure.
429999a2dd95SBruce Richardson  *
430099a2dd95SBruce Richardson  * @param[out] error
430199a2dd95SBruce Richardson  *   Pointer to flow error structure (may be NULL).
430299a2dd95SBruce Richardson  * @param code
430399a2dd95SBruce Richardson  *   Related error code (rte_errno).
430499a2dd95SBruce Richardson  * @param type
430599a2dd95SBruce Richardson  *   Cause field and error types.
430699a2dd95SBruce Richardson  * @param cause
430799a2dd95SBruce Richardson  *   Object responsible for the error.
430899a2dd95SBruce Richardson  * @param message
430999a2dd95SBruce Richardson  *   Human-readable error message.
431099a2dd95SBruce Richardson  *
431199a2dd95SBruce Richardson  * @return
431299a2dd95SBruce Richardson  *   Negative error code (errno value) and rte_errno is set.
431399a2dd95SBruce Richardson  */
431499a2dd95SBruce Richardson int
431599a2dd95SBruce Richardson rte_flow_error_set(struct rte_flow_error *error,
431699a2dd95SBruce Richardson 		   int code,
431799a2dd95SBruce Richardson 		   enum rte_flow_error_type type,
431899a2dd95SBruce Richardson 		   const void *cause,
431999a2dd95SBruce Richardson 		   const char *message);
432099a2dd95SBruce Richardson 
432199a2dd95SBruce Richardson /**
432299a2dd95SBruce Richardson  * @deprecated
432399a2dd95SBruce Richardson  * @see rte_flow_copy()
432499a2dd95SBruce Richardson  */
432599a2dd95SBruce Richardson struct rte_flow_desc {
432699a2dd95SBruce Richardson 	size_t size; /**< Allocated space including data[]. */
432799a2dd95SBruce Richardson 	struct rte_flow_attr attr; /**< Attributes. */
432899a2dd95SBruce Richardson 	struct rte_flow_item *items; /**< Items. */
432999a2dd95SBruce Richardson 	struct rte_flow_action *actions; /**< Actions. */
433099a2dd95SBruce Richardson 	uint8_t data[]; /**< Storage for items/actions. */
433199a2dd95SBruce Richardson };
433299a2dd95SBruce Richardson 
433399a2dd95SBruce Richardson /**
433499a2dd95SBruce Richardson  * @deprecated
433599a2dd95SBruce Richardson  * Copy an rte_flow rule description.
433699a2dd95SBruce Richardson  *
433799a2dd95SBruce Richardson  * This interface is kept for compatibility with older applications but is
433899a2dd95SBruce Richardson  * implemented as a wrapper to rte_flow_conv(). It is deprecated due to its
433999a2dd95SBruce Richardson  * lack of flexibility and reliance on a type unusable with C++ programs
434099a2dd95SBruce Richardson  * (struct rte_flow_desc).
434199a2dd95SBruce Richardson  *
434299a2dd95SBruce Richardson  * @param[in] fd
434399a2dd95SBruce Richardson  *   Flow rule description.
434499a2dd95SBruce Richardson  * @param[in] len
434599a2dd95SBruce Richardson  *   Total size of allocated data for the flow description.
434699a2dd95SBruce Richardson  * @param[in] attr
434799a2dd95SBruce Richardson  *   Flow rule attributes.
434899a2dd95SBruce Richardson  * @param[in] items
434999a2dd95SBruce Richardson  *   Pattern specification (list terminated by the END pattern item).
435099a2dd95SBruce Richardson  * @param[in] actions
435199a2dd95SBruce Richardson  *   Associated actions (list terminated by the END action).
435299a2dd95SBruce Richardson  *
435399a2dd95SBruce Richardson  * @return
435499a2dd95SBruce Richardson  *   If len is greater or equal to the size of the flow, the total size of the
435599a2dd95SBruce Richardson  *   flow description and its data.
435699a2dd95SBruce Richardson  *   If len is lower than the size of the flow, the number of bytes that would
435799a2dd95SBruce Richardson  *   have been written to desc had it been sufficient. Nothing is written.
435899a2dd95SBruce Richardson  */
435999a2dd95SBruce Richardson __rte_deprecated
436099a2dd95SBruce Richardson size_t
436199a2dd95SBruce Richardson rte_flow_copy(struct rte_flow_desc *fd, size_t len,
436299a2dd95SBruce Richardson 	      const struct rte_flow_attr *attr,
436399a2dd95SBruce Richardson 	      const struct rte_flow_item *items,
436499a2dd95SBruce Richardson 	      const struct rte_flow_action *actions);
436599a2dd95SBruce Richardson 
436699a2dd95SBruce Richardson /**
436799a2dd95SBruce Richardson  * Flow object conversion helper.
436899a2dd95SBruce Richardson  *
436999a2dd95SBruce Richardson  * This function performs conversion of various flow API objects to a
437099a2dd95SBruce Richardson  * pre-allocated destination buffer. See enum rte_flow_conv_op for possible
437199a2dd95SBruce Richardson  * operations and details about each of them.
437299a2dd95SBruce Richardson  *
437399a2dd95SBruce Richardson  * Since destination buffer must be large enough, it works in a manner
437499a2dd95SBruce Richardson  * reminiscent of snprintf():
437599a2dd95SBruce Richardson  *
437699a2dd95SBruce Richardson  * - If @p size is 0, @p dst may be a NULL pointer, otherwise @p dst must be
437799a2dd95SBruce Richardson  *   non-NULL.
437899a2dd95SBruce Richardson  * - If positive, the returned value represents the number of bytes needed
437999a2dd95SBruce Richardson  *   to store the conversion of @p src to @p dst according to @p op
438099a2dd95SBruce Richardson  *   regardless of the @p size parameter.
438199a2dd95SBruce Richardson  * - Since no more than @p size bytes can be written to @p dst, output is
438299a2dd95SBruce Richardson  *   truncated and may be inconsistent when the returned value is larger
438399a2dd95SBruce Richardson  *   than that.
438499a2dd95SBruce Richardson  * - In case of conversion error, a negative error code is returned and
438599a2dd95SBruce Richardson  *   @p dst contents are unspecified.
438699a2dd95SBruce Richardson  *
438799a2dd95SBruce Richardson  * @param op
438899a2dd95SBruce Richardson  *   Operation to perform, related to the object type of @p dst.
438999a2dd95SBruce Richardson  * @param[out] dst
439099a2dd95SBruce Richardson  *   Destination buffer address. Must be suitably aligned by the caller.
439199a2dd95SBruce Richardson  * @param size
439299a2dd95SBruce Richardson  *   Destination buffer size in bytes.
439399a2dd95SBruce Richardson  * @param[in] src
439499a2dd95SBruce Richardson  *   Source object to copy. Depending on @p op, its type may differ from
439599a2dd95SBruce Richardson  *   that of @p dst.
439699a2dd95SBruce Richardson  * @param[out] error
439799a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. Initialized in case of
439899a2dd95SBruce Richardson  *   error only.
439999a2dd95SBruce Richardson  *
440099a2dd95SBruce Richardson  * @return
440199a2dd95SBruce Richardson  *   The number of bytes required to convert @p src to @p dst on success, a
440299a2dd95SBruce Richardson  *   negative errno value otherwise and rte_errno is set.
440399a2dd95SBruce Richardson  *
440499a2dd95SBruce Richardson  * @see rte_flow_conv_op
440599a2dd95SBruce Richardson  */
440699a2dd95SBruce Richardson __rte_experimental
440799a2dd95SBruce Richardson int
440899a2dd95SBruce Richardson rte_flow_conv(enum rte_flow_conv_op op,
440999a2dd95SBruce Richardson 	      void *dst,
441099a2dd95SBruce Richardson 	      size_t size,
441199a2dd95SBruce Richardson 	      const void *src,
441299a2dd95SBruce Richardson 	      struct rte_flow_error *error);
441399a2dd95SBruce Richardson 
441499a2dd95SBruce Richardson /**
441599a2dd95SBruce Richardson  * Get aged-out flows of a given port.
441699a2dd95SBruce Richardson  *
441799a2dd95SBruce Richardson  * RTE_ETH_EVENT_FLOW_AGED event will be triggered when at least one new aged
441899a2dd95SBruce Richardson  * out flow was detected after the last call to rte_flow_get_aged_flows.
441951395027SFerruh Yigit  * This function can be called to get the aged flows asynchronously from the
442099a2dd95SBruce Richardson  * event callback or synchronously regardless the event.
442199a2dd95SBruce Richardson  * This is not safe to call rte_flow_get_aged_flows function with other flow
442299a2dd95SBruce Richardson  * functions from multiple threads simultaneously.
442399a2dd95SBruce Richardson  *
442499a2dd95SBruce Richardson  * @param port_id
442599a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
442699a2dd95SBruce Richardson  * @param[in, out] contexts
442799a2dd95SBruce Richardson  *   The address of an array of pointers to the aged-out flows contexts.
442899a2dd95SBruce Richardson  * @param[in] nb_contexts
442999a2dd95SBruce Richardson  *   The length of context array pointers.
443099a2dd95SBruce Richardson  * @param[out] error
443199a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. Initialized in case of
443299a2dd95SBruce Richardson  *   error only.
443399a2dd95SBruce Richardson  *
443499a2dd95SBruce Richardson  * @return
443599a2dd95SBruce Richardson  *   if nb_contexts is 0, return the amount of all aged contexts.
443699a2dd95SBruce Richardson  *   if nb_contexts is not 0 , return the amount of aged flows reported
443799a2dd95SBruce Richardson  *   in the context array, otherwise negative errno value.
443899a2dd95SBruce Richardson  *
443999a2dd95SBruce Richardson  * @see rte_flow_action_age
444099a2dd95SBruce Richardson  * @see RTE_ETH_EVENT_FLOW_AGED
444199a2dd95SBruce Richardson  */
444299a2dd95SBruce Richardson __rte_experimental
444399a2dd95SBruce Richardson int
444499a2dd95SBruce Richardson rte_flow_get_aged_flows(uint16_t port_id, void **contexts,
444599a2dd95SBruce Richardson 			uint32_t nb_contexts, struct rte_flow_error *error);
444699a2dd95SBruce Richardson 
444799a2dd95SBruce Richardson /**
44484b61b877SBing Zhao  * Specify indirect action object configuration
444999a2dd95SBruce Richardson  */
44504b61b877SBing Zhao struct rte_flow_indir_action_conf {
445199a2dd95SBruce Richardson 	/**
44524b61b877SBing Zhao 	 * Flow direction for the indirect action configuration.
445399a2dd95SBruce Richardson 	 *
44544b61b877SBing Zhao 	 * Action should be valid at least for one flow direction,
445599a2dd95SBruce Richardson 	 * otherwise it is invalid for both ingress and egress rules.
445699a2dd95SBruce Richardson 	 */
44573c2ca0a9SAndrew Rybchenko 	/** Action valid for rules applied to ingress traffic. */
445899a2dd95SBruce Richardson 	uint32_t ingress:1;
44593c2ca0a9SAndrew Rybchenko 	/** Action valid for rules applied to egress traffic. */
446099a2dd95SBruce Richardson 	uint32_t egress:1;
446199a2dd95SBruce Richardson 	/**
446299a2dd95SBruce Richardson 	 * When set to 1, indicates that the action is valid for
446399a2dd95SBruce Richardson 	 * transfer traffic; otherwise, for non-transfer traffic.
446499a2dd95SBruce Richardson 	 */
446599a2dd95SBruce Richardson 	uint32_t transfer:1;
446699a2dd95SBruce Richardson };
446799a2dd95SBruce Richardson 
446899a2dd95SBruce Richardson /**
446999a2dd95SBruce Richardson  * @warning
447099a2dd95SBruce Richardson  * @b EXPERIMENTAL: this API may change without prior notice.
447199a2dd95SBruce Richardson  *
44724b61b877SBing Zhao  * Create an indirect action object that can be used in flow rules
44734b61b877SBing Zhao  * via its handle.
44744b61b877SBing Zhao  * The created object handle has single state and configuration
44754b61b877SBing Zhao  * across all the flow rules using it.
447699a2dd95SBruce Richardson  *
447799a2dd95SBruce Richardson  * @param[in] port_id
447899a2dd95SBruce Richardson  *    The port identifier of the Ethernet device.
447999a2dd95SBruce Richardson  * @param[in] conf
44804b61b877SBing Zhao  *   Action configuration for the indirect action object creation.
448199a2dd95SBruce Richardson  * @param[in] action
44824b61b877SBing Zhao  *   Specific configuration of the indirect action object.
448399a2dd95SBruce Richardson  * @param[out] error
448499a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
448599a2dd95SBruce Richardson  *   structure in case of error only.
448699a2dd95SBruce Richardson  * @return
448799a2dd95SBruce Richardson  *   A valid handle in case of success, NULL otherwise and rte_errno is set
448899a2dd95SBruce Richardson  *   to one of the error codes defined:
448999a2dd95SBruce Richardson  *   - (ENODEV) if *port_id* invalid.
449099a2dd95SBruce Richardson  *   - (ENOSYS) if underlying device does not support this functionality.
449199a2dd95SBruce Richardson  *   - (EIO) if underlying device is removed.
449299a2dd95SBruce Richardson  *   - (EINVAL) if *action* invalid.
449399a2dd95SBruce Richardson  *   - (ENOTSUP) if *action* valid but unsupported.
449499a2dd95SBruce Richardson  */
449599a2dd95SBruce Richardson __rte_experimental
44964b61b877SBing Zhao struct rte_flow_action_handle *
44974b61b877SBing Zhao rte_flow_action_handle_create(uint16_t port_id,
44984b61b877SBing Zhao 			      const struct rte_flow_indir_action_conf *conf,
449999a2dd95SBruce Richardson 			      const struct rte_flow_action *action,
450099a2dd95SBruce Richardson 			      struct rte_flow_error *error);
450199a2dd95SBruce Richardson 
450299a2dd95SBruce Richardson /**
450399a2dd95SBruce Richardson  * @warning
450499a2dd95SBruce Richardson  * @b EXPERIMENTAL: this API may change without prior notice.
450599a2dd95SBruce Richardson  *
45064b61b877SBing Zhao  * Destroy indirect action by handle.
450799a2dd95SBruce Richardson  *
450899a2dd95SBruce Richardson  * @param[in] port_id
450999a2dd95SBruce Richardson  *    The port identifier of the Ethernet device.
45104b61b877SBing Zhao  * @param[in] handle
45114b61b877SBing Zhao  *   Handle for the indirect action object to be destroyed.
451299a2dd95SBruce Richardson  * @param[out] error
451399a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
451499a2dd95SBruce Richardson  *   structure in case of error only.
451599a2dd95SBruce Richardson  * @return
451699a2dd95SBruce Richardson  *   - (0) if success.
451799a2dd95SBruce Richardson  *   - (-ENODEV) if *port_id* invalid.
451899a2dd95SBruce Richardson  *   - (-ENOSYS) if underlying device does not support this functionality.
451999a2dd95SBruce Richardson  *   - (-EIO) if underlying device is removed.
452099a2dd95SBruce Richardson  *   - (-ENOENT) if action pointed by *action* handle was not found.
452199a2dd95SBruce Richardson  *   - (-EBUSY) if action pointed by *action* handle still used by some rules
452299a2dd95SBruce Richardson  *   rte_errno is also set.
452399a2dd95SBruce Richardson  */
452499a2dd95SBruce Richardson __rte_experimental
452599a2dd95SBruce Richardson int
45264b61b877SBing Zhao rte_flow_action_handle_destroy(uint16_t port_id,
45274b61b877SBing Zhao 			       struct rte_flow_action_handle *handle,
452899a2dd95SBruce Richardson 			       struct rte_flow_error *error);
452999a2dd95SBruce Richardson 
453099a2dd95SBruce Richardson /**
453199a2dd95SBruce Richardson  * @warning
453299a2dd95SBruce Richardson  * @b EXPERIMENTAL: this API may change without prior notice.
453399a2dd95SBruce Richardson  *
45344b61b877SBing Zhao  * Update in-place the action configuration and / or state pointed
45354b61b877SBing Zhao  * by action *handle* with the configuration provided as *update* argument.
45364b61b877SBing Zhao  * The update of the action configuration effects all flow rules reusing
45374b61b877SBing Zhao  * the action via *handle*.
45384b61b877SBing Zhao  * The update general pointer provides the ability of partial updating.
453999a2dd95SBruce Richardson  *
454099a2dd95SBruce Richardson  * @param[in] port_id
454199a2dd95SBruce Richardson  *    The port identifier of the Ethernet device.
45424b61b877SBing Zhao  * @param[in] handle
45434b61b877SBing Zhao  *   Handle for the indirect action object to be updated.
454499a2dd95SBruce Richardson  * @param[in] update
45454b61b877SBing Zhao  *   Update profile specification used to modify the action pointed by handle.
45464b61b877SBing Zhao  *   *update* could be with the same type of the immediate action corresponding
45474b61b877SBing Zhao  *   to the *handle* argument when creating, or a wrapper structure includes
45484b61b877SBing Zhao  *   action configuration to be updated and bit fields to indicate the member
45494b61b877SBing Zhao  *   of fields inside the action to update.
455099a2dd95SBruce Richardson  * @param[out] error
455199a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
455299a2dd95SBruce Richardson  *   structure in case of error only.
455399a2dd95SBruce Richardson  * @return
455499a2dd95SBruce Richardson  *   - (0) if success.
455599a2dd95SBruce Richardson  *   - (-ENODEV) if *port_id* invalid.
455699a2dd95SBruce Richardson  *   - (-ENOSYS) if underlying device does not support this functionality.
455799a2dd95SBruce Richardson  *   - (-EIO) if underlying device is removed.
455899a2dd95SBruce Richardson  *   - (-EINVAL) if *update* invalid.
455999a2dd95SBruce Richardson  *   - (-ENOTSUP) if *update* valid but unsupported.
45604b61b877SBing Zhao  *   - (-ENOENT) if indirect action object pointed by *handle* was not found.
456199a2dd95SBruce Richardson  *   rte_errno is also set.
456299a2dd95SBruce Richardson  */
456399a2dd95SBruce Richardson __rte_experimental
456499a2dd95SBruce Richardson int
45654b61b877SBing Zhao rte_flow_action_handle_update(uint16_t port_id,
45664b61b877SBing Zhao 			      struct rte_flow_action_handle *handle,
45674b61b877SBing Zhao 			      const void *update,
456899a2dd95SBruce Richardson 			      struct rte_flow_error *error);
456999a2dd95SBruce Richardson 
457099a2dd95SBruce Richardson /**
457199a2dd95SBruce Richardson  * @warning
457299a2dd95SBruce Richardson  * @b EXPERIMENTAL: this API may change without prior notice.
457399a2dd95SBruce Richardson  *
45744b61b877SBing Zhao  * Query the direct action by corresponding indirect action object handle.
457599a2dd95SBruce Richardson  *
457699a2dd95SBruce Richardson  * Retrieve action-specific data such as counters.
457799a2dd95SBruce Richardson  * Data is gathered by special action which may be present/referenced in
457899a2dd95SBruce Richardson  * more than one flow rule definition.
457999a2dd95SBruce Richardson  *
45804b61b877SBing Zhao  * @see RTE_FLOW_ACTION_TYPE_COUNT
458199a2dd95SBruce Richardson  *
458299a2dd95SBruce Richardson  * @param port_id
458399a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
45844b61b877SBing Zhao  * @param[in] handle
45854b61b877SBing Zhao  *   Handle for the action object to query.
458699a2dd95SBruce Richardson  * @param[in, out] data
458799a2dd95SBruce Richardson  *   Pointer to storage for the associated query data type.
458899a2dd95SBruce Richardson  * @param[out] error
458999a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
459099a2dd95SBruce Richardson  *   structure in case of error only.
459199a2dd95SBruce Richardson  *
459299a2dd95SBruce Richardson  * @return
459399a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
459499a2dd95SBruce Richardson  */
459599a2dd95SBruce Richardson __rte_experimental
459699a2dd95SBruce Richardson int
45974b61b877SBing Zhao rte_flow_action_handle_query(uint16_t port_id,
45984b61b877SBing Zhao 			     const struct rte_flow_action_handle *handle,
45994b61b877SBing Zhao 			     void *data, struct rte_flow_error *error);
460099a2dd95SBruce Richardson 
460199a2dd95SBruce Richardson /* Tunnel has a type and the key information. */
460299a2dd95SBruce Richardson struct rte_flow_tunnel {
460399a2dd95SBruce Richardson 	/**
460499a2dd95SBruce Richardson 	 * Tunnel type, for example RTE_FLOW_ITEM_TYPE_VXLAN,
460599a2dd95SBruce Richardson 	 * RTE_FLOW_ITEM_TYPE_NVGRE etc.
460699a2dd95SBruce Richardson 	 */
460799a2dd95SBruce Richardson 	enum rte_flow_item_type	type;
460899a2dd95SBruce Richardson 	uint64_t tun_id; /**< Tunnel identification. */
460999a2dd95SBruce Richardson 
461099a2dd95SBruce Richardson 	RTE_STD_C11
461199a2dd95SBruce Richardson 	union {
461299a2dd95SBruce Richardson 		struct {
461399a2dd95SBruce Richardson 			rte_be32_t src_addr; /**< IPv4 source address. */
461499a2dd95SBruce Richardson 			rte_be32_t dst_addr; /**< IPv4 destination address. */
461599a2dd95SBruce Richardson 		} ipv4;
461699a2dd95SBruce Richardson 		struct {
461799a2dd95SBruce Richardson 			uint8_t src_addr[16]; /**< IPv6 source address. */
461899a2dd95SBruce Richardson 			uint8_t dst_addr[16]; /**< IPv6 destination address. */
461999a2dd95SBruce Richardson 		} ipv6;
462099a2dd95SBruce Richardson 	};
462199a2dd95SBruce Richardson 	rte_be16_t tp_src; /**< Tunnel port source. */
462299a2dd95SBruce Richardson 	rte_be16_t tp_dst; /**< Tunnel port destination. */
462399a2dd95SBruce Richardson 	uint16_t   tun_flags; /**< Tunnel flags. */
462499a2dd95SBruce Richardson 
462599a2dd95SBruce Richardson 	bool       is_ipv6; /**< True for valid IPv6 fields. Otherwise IPv4. */
462699a2dd95SBruce Richardson 
462799a2dd95SBruce Richardson 	/**
462899a2dd95SBruce Richardson 	 * the following members are required to restore packet
462999a2dd95SBruce Richardson 	 * after miss
463099a2dd95SBruce Richardson 	 */
463199a2dd95SBruce Richardson 	uint8_t    tos; /**< TOS for IPv4, TC for IPv6. */
463299a2dd95SBruce Richardson 	uint8_t    ttl; /**< TTL for IPv4, HL for IPv6. */
463399a2dd95SBruce Richardson 	uint32_t label; /**< Flow Label for IPv6. */
463499a2dd95SBruce Richardson };
463599a2dd95SBruce Richardson 
463699a2dd95SBruce Richardson /**
463799a2dd95SBruce Richardson  * Indicate that the packet has a tunnel.
463899a2dd95SBruce Richardson  */
4639e1823e08SThomas Monjalon #define RTE_FLOW_RESTORE_INFO_TUNNEL RTE_BIT64(0)
464099a2dd95SBruce Richardson 
464199a2dd95SBruce Richardson /**
464299a2dd95SBruce Richardson  * Indicate that the packet has a non decapsulated tunnel header.
464399a2dd95SBruce Richardson  */
4644e1823e08SThomas Monjalon #define RTE_FLOW_RESTORE_INFO_ENCAPSULATED RTE_BIT64(1)
464599a2dd95SBruce Richardson 
464699a2dd95SBruce Richardson /**
464799a2dd95SBruce Richardson  * Indicate that the packet has a group_id.
464899a2dd95SBruce Richardson  */
4649e1823e08SThomas Monjalon #define RTE_FLOW_RESTORE_INFO_GROUP_ID RTE_BIT64(2)
465099a2dd95SBruce Richardson 
465199a2dd95SBruce Richardson /**
465299a2dd95SBruce Richardson  * Restore information structure to communicate the current packet processing
465399a2dd95SBruce Richardson  * state when some of the processing pipeline is done in hardware and should
465499a2dd95SBruce Richardson  * continue in software.
465599a2dd95SBruce Richardson  */
465699a2dd95SBruce Richardson struct rte_flow_restore_info {
465799a2dd95SBruce Richardson 	/**
465899a2dd95SBruce Richardson 	 * Bitwise flags (RTE_FLOW_RESTORE_INFO_*) to indicate validation of
465999a2dd95SBruce Richardson 	 * other fields in struct rte_flow_restore_info.
466099a2dd95SBruce Richardson 	 */
466199a2dd95SBruce Richardson 	uint64_t flags;
466299a2dd95SBruce Richardson 	uint32_t group_id; /**< Group ID where packed missed */
466399a2dd95SBruce Richardson 	struct rte_flow_tunnel tunnel; /**< Tunnel information. */
466499a2dd95SBruce Richardson };
466599a2dd95SBruce Richardson 
466699a2dd95SBruce Richardson /**
466799a2dd95SBruce Richardson  * Allocate an array of actions to be used in rte_flow_create, to implement
466899a2dd95SBruce Richardson  * tunnel-decap-set for the given tunnel.
466999a2dd95SBruce Richardson  * Sample usage:
467099a2dd95SBruce Richardson  *   actions vxlan_decap / tunnel-decap-set(tunnel properties) /
467199a2dd95SBruce Richardson  *            jump group 0 / end
467299a2dd95SBruce Richardson  *
467399a2dd95SBruce Richardson  * @param port_id
467499a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
467599a2dd95SBruce Richardson  * @param[in] tunnel
467699a2dd95SBruce Richardson  *   Tunnel properties.
467799a2dd95SBruce Richardson  * @param[out] actions
467899a2dd95SBruce Richardson  *   Array of actions to be allocated by the PMD. This array should be
467999a2dd95SBruce Richardson  *   concatenated with the actions array provided to rte_flow_create.
468099a2dd95SBruce Richardson  * @param[out] num_of_actions
468199a2dd95SBruce Richardson  *   Number of actions allocated.
468299a2dd95SBruce Richardson  * @param[out] error
468399a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
468499a2dd95SBruce Richardson  *   structure in case of error only.
468599a2dd95SBruce Richardson  *
468699a2dd95SBruce Richardson  * @return
468799a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
468899a2dd95SBruce Richardson  */
468999a2dd95SBruce Richardson __rte_experimental
469099a2dd95SBruce Richardson int
469199a2dd95SBruce Richardson rte_flow_tunnel_decap_set(uint16_t port_id,
469299a2dd95SBruce Richardson 			  struct rte_flow_tunnel *tunnel,
469399a2dd95SBruce Richardson 			  struct rte_flow_action **actions,
469499a2dd95SBruce Richardson 			  uint32_t *num_of_actions,
469599a2dd95SBruce Richardson 			  struct rte_flow_error *error);
469699a2dd95SBruce Richardson 
469799a2dd95SBruce Richardson /**
469899a2dd95SBruce Richardson  * Allocate an array of items to be used in rte_flow_create, to implement
469999a2dd95SBruce Richardson  * tunnel-match for the given tunnel.
470099a2dd95SBruce Richardson  * Sample usage:
470199a2dd95SBruce Richardson  *   pattern tunnel-match(tunnel properties) / outer-header-matches /
470299a2dd95SBruce Richardson  *           inner-header-matches / end
470399a2dd95SBruce Richardson  *
470499a2dd95SBruce Richardson  * @param port_id
470599a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
470699a2dd95SBruce Richardson  * @param[in] tunnel
470799a2dd95SBruce Richardson  *   Tunnel properties.
470899a2dd95SBruce Richardson  * @param[out] items
470999a2dd95SBruce Richardson  *   Array of items to be allocated by the PMD. This array should be
471099a2dd95SBruce Richardson  *   concatenated with the items array provided to rte_flow_create.
471199a2dd95SBruce Richardson  * @param[out] num_of_items
471299a2dd95SBruce Richardson  *   Number of items allocated.
471399a2dd95SBruce Richardson  * @param[out] error
471499a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
471599a2dd95SBruce Richardson  *   structure in case of error only.
471699a2dd95SBruce Richardson  *
471799a2dd95SBruce Richardson  * @return
471899a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
471999a2dd95SBruce Richardson  */
472099a2dd95SBruce Richardson __rte_experimental
472199a2dd95SBruce Richardson int
472299a2dd95SBruce Richardson rte_flow_tunnel_match(uint16_t port_id,
472399a2dd95SBruce Richardson 		      struct rte_flow_tunnel *tunnel,
472499a2dd95SBruce Richardson 		      struct rte_flow_item **items,
472599a2dd95SBruce Richardson 		      uint32_t *num_of_items,
472699a2dd95SBruce Richardson 		      struct rte_flow_error *error);
472799a2dd95SBruce Richardson 
472899a2dd95SBruce Richardson /**
472999a2dd95SBruce Richardson  * Populate the current packet processing state, if exists, for the given mbuf.
473099a2dd95SBruce Richardson  *
4731f6d8a6d3SIvan Malov  * One should negotiate tunnel metadata delivery from the NIC to the HW.
4732f6d8a6d3SIvan Malov  * @see rte_eth_rx_metadata_negotiate()
4733f6d8a6d3SIvan Malov  * @see RTE_ETH_RX_METADATA_TUNNEL_ID
4734f6d8a6d3SIvan Malov  *
473599a2dd95SBruce Richardson  * @param port_id
473699a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
473799a2dd95SBruce Richardson  * @param[in] m
473899a2dd95SBruce Richardson  *   Mbuf struct.
473999a2dd95SBruce Richardson  * @param[out] info
474099a2dd95SBruce Richardson  *   Restore information. Upon success contains the HW state.
474199a2dd95SBruce Richardson  * @param[out] error
474299a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
474399a2dd95SBruce Richardson  *   structure in case of error only.
474499a2dd95SBruce Richardson  *
474599a2dd95SBruce Richardson  * @return
474699a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
474799a2dd95SBruce Richardson  */
474899a2dd95SBruce Richardson __rte_experimental
474999a2dd95SBruce Richardson int
475099a2dd95SBruce Richardson rte_flow_get_restore_info(uint16_t port_id,
475199a2dd95SBruce Richardson 			  struct rte_mbuf *m,
475299a2dd95SBruce Richardson 			  struct rte_flow_restore_info *info,
475399a2dd95SBruce Richardson 			  struct rte_flow_error *error);
475499a2dd95SBruce Richardson 
475599a2dd95SBruce Richardson /**
475699a2dd95SBruce Richardson  * Release the action array as allocated by rte_flow_tunnel_decap_set.
475799a2dd95SBruce Richardson  *
475899a2dd95SBruce Richardson  * @param port_id
475999a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
476099a2dd95SBruce Richardson  * @param[in] actions
476199a2dd95SBruce Richardson  *   Array of actions to be released.
476299a2dd95SBruce Richardson  * @param[in] num_of_actions
476399a2dd95SBruce Richardson  *   Number of elements in actions array.
476499a2dd95SBruce Richardson  * @param[out] error
476599a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
476699a2dd95SBruce Richardson  *   structure in case of error only.
476799a2dd95SBruce Richardson  *
476899a2dd95SBruce Richardson  * @return
476999a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
477099a2dd95SBruce Richardson  */
477199a2dd95SBruce Richardson __rte_experimental
477299a2dd95SBruce Richardson int
477399a2dd95SBruce Richardson rte_flow_tunnel_action_decap_release(uint16_t port_id,
477499a2dd95SBruce Richardson 				     struct rte_flow_action *actions,
477599a2dd95SBruce Richardson 				     uint32_t num_of_actions,
477699a2dd95SBruce Richardson 				     struct rte_flow_error *error);
477799a2dd95SBruce Richardson 
477899a2dd95SBruce Richardson /**
477999a2dd95SBruce Richardson  * Release the item array as allocated by rte_flow_tunnel_match.
478099a2dd95SBruce Richardson  *
478199a2dd95SBruce Richardson  * @param port_id
478299a2dd95SBruce Richardson  *   Port identifier of Ethernet device.
478399a2dd95SBruce Richardson  * @param[in] items
478499a2dd95SBruce Richardson  *   Array of items to be released.
478599a2dd95SBruce Richardson  * @param[in] num_of_items
478699a2dd95SBruce Richardson  *   Number of elements in item array.
478799a2dd95SBruce Richardson  * @param[out] error
478899a2dd95SBruce Richardson  *   Perform verbose error reporting if not NULL. PMDs initialize this
478999a2dd95SBruce Richardson  *   structure in case of error only.
479099a2dd95SBruce Richardson  *
479199a2dd95SBruce Richardson  * @return
479299a2dd95SBruce Richardson  *   0 on success, a negative errno value otherwise and rte_errno is set.
479399a2dd95SBruce Richardson  */
479499a2dd95SBruce Richardson __rte_experimental
479599a2dd95SBruce Richardson int
479699a2dd95SBruce Richardson rte_flow_tunnel_item_release(uint16_t port_id,
479799a2dd95SBruce Richardson 			     struct rte_flow_item *items,
479899a2dd95SBruce Richardson 			     uint32_t num_of_items,
479999a2dd95SBruce Richardson 			     struct rte_flow_error *error);
48001179f05cSIvan Malov 
48011179f05cSIvan Malov /**
48021179f05cSIvan Malov  * @warning
48031179f05cSIvan Malov  * @b EXPERIMENTAL: this API may change without prior notice.
48041179f05cSIvan Malov  *
48051179f05cSIvan Malov  * Get a proxy port to manage "transfer" flows.
48061179f05cSIvan Malov  *
48071179f05cSIvan Malov  * Managing "transfer" flows requires that the user communicate them
48081179f05cSIvan Malov  * via a port which has the privilege to control the embedded switch.
48091179f05cSIvan Malov  * For some vendors, all ports in a given switching domain have
48101179f05cSIvan Malov  * this privilege. For other vendors, it's only one port.
48111179f05cSIvan Malov  *
48121179f05cSIvan Malov  * This API indicates such a privileged port (a "proxy")
48131179f05cSIvan Malov  * for a given port in the same switching domain.
48141179f05cSIvan Malov  *
48151179f05cSIvan Malov  * @note
48161179f05cSIvan Malov  *   If the PMD serving @p port_id doesn't have the corresponding method
48171179f05cSIvan Malov  *   implemented, the API will return @p port_id via @p proxy_port_id.
48181179f05cSIvan Malov  *
48191179f05cSIvan Malov  * @param port_id
48201179f05cSIvan Malov  *   Indicates the port to get a "proxy" for
48211179f05cSIvan Malov  * @param[out] proxy_port_id
48221179f05cSIvan Malov  *   Indicates the "proxy" port
48231179f05cSIvan Malov  * @param[out] error
48241179f05cSIvan Malov  *   If not NULL, allows the PMD to provide verbose report in case of error
48251179f05cSIvan Malov  *
48261179f05cSIvan Malov  * @return
48271179f05cSIvan Malov  *   0 on success, a negative error code otherwise
48281179f05cSIvan Malov  */
48291179f05cSIvan Malov __rte_experimental
48301179f05cSIvan Malov int
48311179f05cSIvan Malov rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id,
48321179f05cSIvan Malov 			     struct rte_flow_error *error);
4833dc4d860eSViacheslav Ovsiienko 
4834dc4d860eSViacheslav Ovsiienko /**
4835dc4d860eSViacheslav Ovsiienko  * @warning
4836dc4d860eSViacheslav Ovsiienko  * @b EXPERIMENTAL: this API may change without prior notice.
4837dc4d860eSViacheslav Ovsiienko  *
4838dc4d860eSViacheslav Ovsiienko  * Create the flex item with specified configuration over
4839dc4d860eSViacheslav Ovsiienko  * the Ethernet device.
4840dc4d860eSViacheslav Ovsiienko  *
4841dc4d860eSViacheslav Ovsiienko  * @param port_id
4842dc4d860eSViacheslav Ovsiienko  *   Port identifier of Ethernet device.
4843dc4d860eSViacheslav Ovsiienko  * @param[in] conf
4844dc4d860eSViacheslav Ovsiienko  *   Item configuration.
4845dc4d860eSViacheslav Ovsiienko  * @param[out] error
4846dc4d860eSViacheslav Ovsiienko  *   Perform verbose error reporting if not NULL. PMDs initialize this
4847dc4d860eSViacheslav Ovsiienko  *   structure in case of error only.
4848dc4d860eSViacheslav Ovsiienko  *
4849dc4d860eSViacheslav Ovsiienko  * @return
4850dc4d860eSViacheslav Ovsiienko  *   Non-NULL opaque pointer on success, NULL otherwise and rte_errno is set.
4851dc4d860eSViacheslav Ovsiienko  */
4852dc4d860eSViacheslav Ovsiienko __rte_experimental
4853dc4d860eSViacheslav Ovsiienko struct rte_flow_item_flex_handle *
4854dc4d860eSViacheslav Ovsiienko rte_flow_flex_item_create(uint16_t port_id,
4855dc4d860eSViacheslav Ovsiienko 			  const struct rte_flow_item_flex_conf *conf,
4856dc4d860eSViacheslav Ovsiienko 			  struct rte_flow_error *error);
4857dc4d860eSViacheslav Ovsiienko 
4858dc4d860eSViacheslav Ovsiienko /**
4859dc4d860eSViacheslav Ovsiienko  * Release the flex item on the specified Ethernet device.
4860dc4d860eSViacheslav Ovsiienko  *
4861dc4d860eSViacheslav Ovsiienko  * @param port_id
4862dc4d860eSViacheslav Ovsiienko  *   Port identifier of Ethernet device.
4863dc4d860eSViacheslav Ovsiienko  * @param[in] handle
4864dc4d860eSViacheslav Ovsiienko  *   Handle of the item existing on the specified device.
4865dc4d860eSViacheslav Ovsiienko  * @param[out] error
4866dc4d860eSViacheslav Ovsiienko  *   Perform verbose error reporting if not NULL. PMDs initialize this
4867dc4d860eSViacheslav Ovsiienko  *   structure in case of error only.
4868dc4d860eSViacheslav Ovsiienko  *
4869dc4d860eSViacheslav Ovsiienko  * @return
4870dc4d860eSViacheslav Ovsiienko  *   0 on success, a negative errno value otherwise and rte_errno is set.
4871dc4d860eSViacheslav Ovsiienko  */
4872dc4d860eSViacheslav Ovsiienko __rte_experimental
4873dc4d860eSViacheslav Ovsiienko int
4874dc4d860eSViacheslav Ovsiienko rte_flow_flex_item_release(uint16_t port_id,
4875dc4d860eSViacheslav Ovsiienko 			   const struct rte_flow_item_flex_handle *handle,
4876dc4d860eSViacheslav Ovsiienko 			   struct rte_flow_error *error);
4877dc4d860eSViacheslav Ovsiienko 
48784ff58b73SAlexander Kozyrev /**
48794ff58b73SAlexander Kozyrev  * @warning
48804ff58b73SAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
48814ff58b73SAlexander Kozyrev  *
48824ff58b73SAlexander Kozyrev  * Information about flow engine resources.
48834ff58b73SAlexander Kozyrev  * The zero value means a resource is not supported.
48844ff58b73SAlexander Kozyrev  *
48854ff58b73SAlexander Kozyrev  */
48864ff58b73SAlexander Kozyrev struct rte_flow_port_info {
48874ff58b73SAlexander Kozyrev 	/**
4888197e820cSAlexander Kozyrev 	 * Maximum number of queues for asynchronous operations.
4889197e820cSAlexander Kozyrev 	 */
4890197e820cSAlexander Kozyrev 	uint32_t max_nb_queues;
4891197e820cSAlexander Kozyrev 	/**
48924ff58b73SAlexander Kozyrev 	 * Maximum number of counters.
48934ff58b73SAlexander Kozyrev 	 * @see RTE_FLOW_ACTION_TYPE_COUNT
48944ff58b73SAlexander Kozyrev 	 */
48954ff58b73SAlexander Kozyrev 	uint32_t max_nb_counters;
48964ff58b73SAlexander Kozyrev 	/**
48974ff58b73SAlexander Kozyrev 	 * Maximum number of aging objects.
48984ff58b73SAlexander Kozyrev 	 * @see RTE_FLOW_ACTION_TYPE_AGE
48994ff58b73SAlexander Kozyrev 	 */
49004ff58b73SAlexander Kozyrev 	uint32_t max_nb_aging_objects;
49014ff58b73SAlexander Kozyrev 	/**
49024ff58b73SAlexander Kozyrev 	 * Maximum number traffic meters.
49034ff58b73SAlexander Kozyrev 	 * @see RTE_FLOW_ACTION_TYPE_METER
49044ff58b73SAlexander Kozyrev 	 */
49054ff58b73SAlexander Kozyrev 	uint32_t max_nb_meters;
49064ff58b73SAlexander Kozyrev };
49074ff58b73SAlexander Kozyrev 
49084ff58b73SAlexander Kozyrev /**
49094ff58b73SAlexander Kozyrev  * @warning
49104ff58b73SAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
49114ff58b73SAlexander Kozyrev  *
4912197e820cSAlexander Kozyrev  * Information about flow engine asynchronous queues.
4913197e820cSAlexander Kozyrev  * The value only valid if @p port_attr.max_nb_queues is not zero.
4914197e820cSAlexander Kozyrev  *
4915197e820cSAlexander Kozyrev  */
4916197e820cSAlexander Kozyrev struct rte_flow_queue_info {
4917197e820cSAlexander Kozyrev 	/**
4918197e820cSAlexander Kozyrev 	 * Maximum number of operations a queue can hold.
4919197e820cSAlexander Kozyrev 	 */
4920197e820cSAlexander Kozyrev 	uint32_t max_size;
4921197e820cSAlexander Kozyrev };
4922197e820cSAlexander Kozyrev 
4923197e820cSAlexander Kozyrev /**
4924197e820cSAlexander Kozyrev  * @warning
4925197e820cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
4926197e820cSAlexander Kozyrev  *
49274ff58b73SAlexander Kozyrev  * Get information about flow engine resources.
49284ff58b73SAlexander Kozyrev  *
49294ff58b73SAlexander Kozyrev  * @param port_id
49304ff58b73SAlexander Kozyrev  *   Port identifier of Ethernet device.
49314ff58b73SAlexander Kozyrev  * @param[out] port_info
49324ff58b73SAlexander Kozyrev  *   A pointer to a structure of type *rte_flow_port_info*
49334ff58b73SAlexander Kozyrev  *   to be filled with the resources information of the port.
4934197e820cSAlexander Kozyrev  * @param[out] queue_info
4935197e820cSAlexander Kozyrev  *   A pointer to a structure of type *rte_flow_queue_info*
4936197e820cSAlexander Kozyrev  *   to be filled with the asynchronous queues information.
49374ff58b73SAlexander Kozyrev  * @param[out] error
49384ff58b73SAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
49394ff58b73SAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
49404ff58b73SAlexander Kozyrev  *
49414ff58b73SAlexander Kozyrev  * @return
49424ff58b73SAlexander Kozyrev  *   0 on success, a negative errno value otherwise and rte_errno is set.
49434ff58b73SAlexander Kozyrev  */
49444ff58b73SAlexander Kozyrev __rte_experimental
49454ff58b73SAlexander Kozyrev int
49464ff58b73SAlexander Kozyrev rte_flow_info_get(uint16_t port_id,
49474ff58b73SAlexander Kozyrev 		  struct rte_flow_port_info *port_info,
4948197e820cSAlexander Kozyrev 		  struct rte_flow_queue_info *queue_info,
49494ff58b73SAlexander Kozyrev 		  struct rte_flow_error *error);
49504ff58b73SAlexander Kozyrev 
49514ff58b73SAlexander Kozyrev /**
49524ff58b73SAlexander Kozyrev  * @warning
49534ff58b73SAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
49544ff58b73SAlexander Kozyrev  *
49554ff58b73SAlexander Kozyrev  * Flow engine resources settings.
49564ff58b73SAlexander Kozyrev  * The zero value means on demand resource allocations only.
49574ff58b73SAlexander Kozyrev  *
49584ff58b73SAlexander Kozyrev  */
49594ff58b73SAlexander Kozyrev struct rte_flow_port_attr {
49604ff58b73SAlexander Kozyrev 	/**
49614ff58b73SAlexander Kozyrev 	 * Number of counters to configure.
49624ff58b73SAlexander Kozyrev 	 * @see RTE_FLOW_ACTION_TYPE_COUNT
49634ff58b73SAlexander Kozyrev 	 */
49644ff58b73SAlexander Kozyrev 	uint32_t nb_counters;
49654ff58b73SAlexander Kozyrev 	/**
49664ff58b73SAlexander Kozyrev 	 * Number of aging objects to configure.
49674ff58b73SAlexander Kozyrev 	 * @see RTE_FLOW_ACTION_TYPE_AGE
49684ff58b73SAlexander Kozyrev 	 */
49694ff58b73SAlexander Kozyrev 	uint32_t nb_aging_objects;
49704ff58b73SAlexander Kozyrev 	/**
49714ff58b73SAlexander Kozyrev 	 * Number of traffic meters to configure.
49724ff58b73SAlexander Kozyrev 	 * @see RTE_FLOW_ACTION_TYPE_METER
49734ff58b73SAlexander Kozyrev 	 */
49744ff58b73SAlexander Kozyrev 	uint32_t nb_meters;
49754ff58b73SAlexander Kozyrev };
49764ff58b73SAlexander Kozyrev 
49774ff58b73SAlexander Kozyrev /**
49784ff58b73SAlexander Kozyrev  * @warning
49794ff58b73SAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
49804ff58b73SAlexander Kozyrev  *
4981197e820cSAlexander Kozyrev  * Flow engine asynchronous queues settings.
4982197e820cSAlexander Kozyrev  * The value means default value picked by PMD.
4983197e820cSAlexander Kozyrev  *
4984197e820cSAlexander Kozyrev  */
4985197e820cSAlexander Kozyrev struct rte_flow_queue_attr {
4986197e820cSAlexander Kozyrev 	/**
4987197e820cSAlexander Kozyrev 	 * Number of flow rule operations a queue can hold.
4988197e820cSAlexander Kozyrev 	 */
4989197e820cSAlexander Kozyrev 	uint32_t size;
4990197e820cSAlexander Kozyrev };
4991197e820cSAlexander Kozyrev 
4992197e820cSAlexander Kozyrev /**
4993197e820cSAlexander Kozyrev  * @warning
4994197e820cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
4995197e820cSAlexander Kozyrev  *
49964ff58b73SAlexander Kozyrev  * Configure the port's flow API engine.
49974ff58b73SAlexander Kozyrev  *
49984ff58b73SAlexander Kozyrev  * This API can only be invoked before the application
49994ff58b73SAlexander Kozyrev  * starts using the rest of the flow library functions.
50004ff58b73SAlexander Kozyrev  *
50014ff58b73SAlexander Kozyrev  * The API can be invoked multiple times to change the settings.
50024ff58b73SAlexander Kozyrev  * The port, however, may reject changes and keep the old config.
50034ff58b73SAlexander Kozyrev  *
50044ff58b73SAlexander Kozyrev  * Parameters in configuration attributes must not exceed
50054ff58b73SAlexander Kozyrev  * numbers of resources returned by the rte_flow_info_get API.
50064ff58b73SAlexander Kozyrev  *
50074ff58b73SAlexander Kozyrev  * @param port_id
50084ff58b73SAlexander Kozyrev  *   Port identifier of Ethernet device.
50094ff58b73SAlexander Kozyrev  * @param[in] port_attr
50104ff58b73SAlexander Kozyrev  *   Port configuration attributes.
5011197e820cSAlexander Kozyrev  * @param[in] nb_queue
5012197e820cSAlexander Kozyrev  *   Number of flow queues to be configured.
5013197e820cSAlexander Kozyrev  * @param[in] queue_attr
5014197e820cSAlexander Kozyrev  *   Array that holds attributes for each flow queue.
5015197e820cSAlexander Kozyrev  *   Number of elements is set in @p port_attr.nb_queues.
50164ff58b73SAlexander Kozyrev  * @param[out] error
50174ff58b73SAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
50184ff58b73SAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
50194ff58b73SAlexander Kozyrev  *
50204ff58b73SAlexander Kozyrev  * @return
50214ff58b73SAlexander Kozyrev  *   0 on success, a negative errno value otherwise and rte_errno is set.
50224ff58b73SAlexander Kozyrev  */
50234ff58b73SAlexander Kozyrev __rte_experimental
50244ff58b73SAlexander Kozyrev int
50254ff58b73SAlexander Kozyrev rte_flow_configure(uint16_t port_id,
50264ff58b73SAlexander Kozyrev 		   const struct rte_flow_port_attr *port_attr,
5027197e820cSAlexander Kozyrev 		   uint16_t nb_queue,
5028197e820cSAlexander Kozyrev 		   const struct rte_flow_queue_attr *queue_attr[],
50294ff58b73SAlexander Kozyrev 		   struct rte_flow_error *error);
50304ff58b73SAlexander Kozyrev 
5031f076bcfbSAlexander Kozyrev /**
5032f076bcfbSAlexander Kozyrev  * Opaque type returned after successful creation of pattern template.
5033f076bcfbSAlexander Kozyrev  * This handle can be used to manage the created pattern template.
5034f076bcfbSAlexander Kozyrev  */
5035f076bcfbSAlexander Kozyrev struct rte_flow_pattern_template;
5036f076bcfbSAlexander Kozyrev 
5037f076bcfbSAlexander Kozyrev /**
5038f076bcfbSAlexander Kozyrev  * @warning
5039f076bcfbSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5040f076bcfbSAlexander Kozyrev  *
5041f076bcfbSAlexander Kozyrev  * Flow pattern template attributes.
5042f076bcfbSAlexander Kozyrev  */
5043f076bcfbSAlexander Kozyrev __extension__
5044f076bcfbSAlexander Kozyrev struct rte_flow_pattern_template_attr {
5045f076bcfbSAlexander Kozyrev 	/**
5046f076bcfbSAlexander Kozyrev 	 * Relaxed matching policy.
5047f076bcfbSAlexander Kozyrev 	 * - If 1, matching is performed only on items with the mask member set
5048f076bcfbSAlexander Kozyrev 	 * and matching on protocol layers specified without any masks is skipped.
5049f076bcfbSAlexander Kozyrev 	 * - If 0, matching on protocol layers specified without any masks is done
5050f076bcfbSAlexander Kozyrev 	 * as well. This is the standard behaviour of Flow API now.
5051f076bcfbSAlexander Kozyrev 	 */
5052f076bcfbSAlexander Kozyrev 	uint32_t relaxed_matching:1;
5053f076bcfbSAlexander Kozyrev 	/**
5054f076bcfbSAlexander Kozyrev 	 * Flow direction for the pattern template.
5055f076bcfbSAlexander Kozyrev 	 * At least one direction must be specified.
5056f076bcfbSAlexander Kozyrev 	 */
5057f076bcfbSAlexander Kozyrev 	/** Pattern valid for rules applied to ingress traffic. */
5058f076bcfbSAlexander Kozyrev 	uint32_t ingress:1;
5059f076bcfbSAlexander Kozyrev 	/** Pattern valid for rules applied to egress traffic. */
5060f076bcfbSAlexander Kozyrev 	uint32_t egress:1;
5061f076bcfbSAlexander Kozyrev 	/** Pattern valid for rules applied to transfer traffic. */
5062f076bcfbSAlexander Kozyrev 	uint32_t transfer:1;
5063f076bcfbSAlexander Kozyrev };
5064f076bcfbSAlexander Kozyrev 
5065f076bcfbSAlexander Kozyrev /**
5066f076bcfbSAlexander Kozyrev  * @warning
5067f076bcfbSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5068f076bcfbSAlexander Kozyrev  *
5069f076bcfbSAlexander Kozyrev  * Create flow pattern template.
5070f076bcfbSAlexander Kozyrev  *
5071f076bcfbSAlexander Kozyrev  * The pattern template defines common matching fields without values.
5072f076bcfbSAlexander Kozyrev  * For example, matching on 5 tuple TCP flow, the template will be
5073f076bcfbSAlexander Kozyrev  * eth(null) + IPv4(source + dest) + TCP(s_port + d_port),
5074f076bcfbSAlexander Kozyrev  * while values for each rule will be set during the flow rule creation.
5075f076bcfbSAlexander Kozyrev  * The number and order of items in the template must be the same
5076f076bcfbSAlexander Kozyrev  * at the rule creation.
5077f076bcfbSAlexander Kozyrev  *
5078f076bcfbSAlexander Kozyrev  * @param port_id
5079f076bcfbSAlexander Kozyrev  *   Port identifier of Ethernet device.
5080f076bcfbSAlexander Kozyrev  * @param[in] template_attr
5081f076bcfbSAlexander Kozyrev  *   Pattern template attributes.
5082f076bcfbSAlexander Kozyrev  * @param[in] pattern
5083f076bcfbSAlexander Kozyrev  *   Pattern specification (list terminated by the END pattern item).
5084f076bcfbSAlexander Kozyrev  *   The spec member of an item is not used unless the end member is used.
5085f076bcfbSAlexander Kozyrev  * @param[out] error
5086f076bcfbSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5087f076bcfbSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5088f076bcfbSAlexander Kozyrev  *
5089f076bcfbSAlexander Kozyrev  * @return
5090f076bcfbSAlexander Kozyrev  *   Handle on success, NULL otherwise and rte_errno is set.
5091f076bcfbSAlexander Kozyrev  */
5092f076bcfbSAlexander Kozyrev __rte_experimental
5093f076bcfbSAlexander Kozyrev struct rte_flow_pattern_template *
5094f076bcfbSAlexander Kozyrev rte_flow_pattern_template_create(uint16_t port_id,
5095f076bcfbSAlexander Kozyrev 		const struct rte_flow_pattern_template_attr *template_attr,
5096f076bcfbSAlexander Kozyrev 		const struct rte_flow_item pattern[],
5097f076bcfbSAlexander Kozyrev 		struct rte_flow_error *error);
5098f076bcfbSAlexander Kozyrev 
5099f076bcfbSAlexander Kozyrev /**
5100f076bcfbSAlexander Kozyrev  * @warning
5101f076bcfbSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5102f076bcfbSAlexander Kozyrev  *
5103f076bcfbSAlexander Kozyrev  * Destroy flow pattern template.
5104f076bcfbSAlexander Kozyrev  *
5105f076bcfbSAlexander Kozyrev  * This function may be called only when
5106f076bcfbSAlexander Kozyrev  * there are no more tables referencing this template.
5107f076bcfbSAlexander Kozyrev  *
5108f076bcfbSAlexander Kozyrev  * @param port_id
5109f076bcfbSAlexander Kozyrev  *   Port identifier of Ethernet device.
5110f076bcfbSAlexander Kozyrev  * @param[in] pattern_template
5111f076bcfbSAlexander Kozyrev  *   Handle of the template to be destroyed.
5112f076bcfbSAlexander Kozyrev  * @param[out] error
5113f076bcfbSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5114f076bcfbSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5115f076bcfbSAlexander Kozyrev  *
5116f076bcfbSAlexander Kozyrev  * @return
5117f076bcfbSAlexander Kozyrev  *   0 on success, a negative errno value otherwise and rte_errno is set.
5118f076bcfbSAlexander Kozyrev  */
5119f076bcfbSAlexander Kozyrev __rte_experimental
5120f076bcfbSAlexander Kozyrev int
5121f076bcfbSAlexander Kozyrev rte_flow_pattern_template_destroy(uint16_t port_id,
5122f076bcfbSAlexander Kozyrev 		struct rte_flow_pattern_template *pattern_template,
5123f076bcfbSAlexander Kozyrev 		struct rte_flow_error *error);
5124f076bcfbSAlexander Kozyrev 
5125f076bcfbSAlexander Kozyrev /**
5126f076bcfbSAlexander Kozyrev  * Opaque type returned after successful creation of actions template.
5127f076bcfbSAlexander Kozyrev  * This handle can be used to manage the created actions template.
5128f076bcfbSAlexander Kozyrev  */
5129f076bcfbSAlexander Kozyrev struct rte_flow_actions_template;
5130f076bcfbSAlexander Kozyrev 
5131f076bcfbSAlexander Kozyrev /**
5132f076bcfbSAlexander Kozyrev  * @warning
5133f076bcfbSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5134f076bcfbSAlexander Kozyrev  *
5135f076bcfbSAlexander Kozyrev  * Flow actions template attributes.
5136f076bcfbSAlexander Kozyrev  */
5137f076bcfbSAlexander Kozyrev __extension__
5138f076bcfbSAlexander Kozyrev struct rte_flow_actions_template_attr {
5139f076bcfbSAlexander Kozyrev 	/**
5140f076bcfbSAlexander Kozyrev 	 * Flow direction for the actions template.
5141f076bcfbSAlexander Kozyrev 	 * At least one direction must be specified.
5142f076bcfbSAlexander Kozyrev 	 */
5143f076bcfbSAlexander Kozyrev 	/** Action valid for rules applied to ingress traffic. */
5144f076bcfbSAlexander Kozyrev 	uint32_t ingress:1;
5145f076bcfbSAlexander Kozyrev 	/** Action valid for rules applied to egress traffic. */
5146f076bcfbSAlexander Kozyrev 	uint32_t egress:1;
5147f076bcfbSAlexander Kozyrev 	/** Action valid for rules applied to transfer traffic. */
5148f076bcfbSAlexander Kozyrev 	uint32_t transfer:1;
5149f076bcfbSAlexander Kozyrev };
5150f076bcfbSAlexander Kozyrev 
5151f076bcfbSAlexander Kozyrev /**
5152f076bcfbSAlexander Kozyrev  * @warning
5153f076bcfbSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5154f076bcfbSAlexander Kozyrev  *
5155f076bcfbSAlexander Kozyrev  * Create flow actions template.
5156f076bcfbSAlexander Kozyrev  *
5157f076bcfbSAlexander Kozyrev  * The actions template holds a list of action types without values.
5158f076bcfbSAlexander Kozyrev  * For example, the template to change TCP ports is TCP(s_port + d_port),
5159f076bcfbSAlexander Kozyrev  * while values for each rule will be set during the flow rule creation.
5160f076bcfbSAlexander Kozyrev  * The number and order of actions in the template must be the same
5161f076bcfbSAlexander Kozyrev  * at the rule creation.
5162f076bcfbSAlexander Kozyrev  *
5163f076bcfbSAlexander Kozyrev  * @param port_id
5164f076bcfbSAlexander Kozyrev  *   Port identifier of Ethernet device.
5165f076bcfbSAlexander Kozyrev  * @param[in] template_attr
5166f076bcfbSAlexander Kozyrev  *   Template attributes.
5167f076bcfbSAlexander Kozyrev  * @param[in] actions
5168f076bcfbSAlexander Kozyrev  *   Associated actions (list terminated by the END action).
5169f076bcfbSAlexander Kozyrev  *   The spec member is only used if @p masks spec is non-zero.
5170f076bcfbSAlexander Kozyrev  * @param[in] masks
5171f076bcfbSAlexander Kozyrev  *   List of actions that marks which of the action's member is constant.
5172f076bcfbSAlexander Kozyrev  *   A mask has the same format as the corresponding action.
5173f076bcfbSAlexander Kozyrev  *   If the action field in @p masks is not 0,
5174f076bcfbSAlexander Kozyrev  *   the corresponding value in an action from @p actions will be the part
5175f076bcfbSAlexander Kozyrev  *   of the template and used in all flow rules.
5176f076bcfbSAlexander Kozyrev  *   The order of actions in @p masks is the same as in @p actions.
5177f076bcfbSAlexander Kozyrev  *   In case of indirect actions present in @p actions,
5178f076bcfbSAlexander Kozyrev  *   the actual action type should be present in @p mask.
5179f076bcfbSAlexander Kozyrev  * @param[out] error
5180f076bcfbSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5181f076bcfbSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5182f076bcfbSAlexander Kozyrev  *
5183f076bcfbSAlexander Kozyrev  * @return
5184f076bcfbSAlexander Kozyrev  *   Handle on success, NULL otherwise and rte_errno is set.
5185f076bcfbSAlexander Kozyrev  */
5186f076bcfbSAlexander Kozyrev __rte_experimental
5187f076bcfbSAlexander Kozyrev struct rte_flow_actions_template *
5188f076bcfbSAlexander Kozyrev rte_flow_actions_template_create(uint16_t port_id,
5189f076bcfbSAlexander Kozyrev 		const struct rte_flow_actions_template_attr *template_attr,
5190f076bcfbSAlexander Kozyrev 		const struct rte_flow_action actions[],
5191f076bcfbSAlexander Kozyrev 		const struct rte_flow_action masks[],
5192f076bcfbSAlexander Kozyrev 		struct rte_flow_error *error);
5193f076bcfbSAlexander Kozyrev 
5194f076bcfbSAlexander Kozyrev /**
5195f076bcfbSAlexander Kozyrev  * @warning
5196f076bcfbSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5197f076bcfbSAlexander Kozyrev  *
5198f076bcfbSAlexander Kozyrev  * Destroy flow actions template.
5199f076bcfbSAlexander Kozyrev  *
5200f076bcfbSAlexander Kozyrev  * This function may be called only when
5201f076bcfbSAlexander Kozyrev  * there are no more tables referencing this template.
5202f076bcfbSAlexander Kozyrev  *
5203f076bcfbSAlexander Kozyrev  * @param port_id
5204f076bcfbSAlexander Kozyrev  *   Port identifier of Ethernet device.
5205f076bcfbSAlexander Kozyrev  * @param[in] actions_template
5206f076bcfbSAlexander Kozyrev  *   Handle to the template to be destroyed.
5207f076bcfbSAlexander Kozyrev  * @param[out] error
5208f076bcfbSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5209f076bcfbSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5210f076bcfbSAlexander Kozyrev  *
5211f076bcfbSAlexander Kozyrev  * @return
5212f076bcfbSAlexander Kozyrev  *   0 on success, a negative errno value otherwise and rte_errno is set.
5213f076bcfbSAlexander Kozyrev  */
5214f076bcfbSAlexander Kozyrev __rte_experimental
5215f076bcfbSAlexander Kozyrev int
5216f076bcfbSAlexander Kozyrev rte_flow_actions_template_destroy(uint16_t port_id,
5217f076bcfbSAlexander Kozyrev 		struct rte_flow_actions_template *actions_template,
5218f076bcfbSAlexander Kozyrev 		struct rte_flow_error *error);
5219f076bcfbSAlexander Kozyrev 
5220f076bcfbSAlexander Kozyrev /**
5221f076bcfbSAlexander Kozyrev  * Opaque type returned after successful creation of a template table.
5222f076bcfbSAlexander Kozyrev  * This handle can be used to manage the created template table.
5223f076bcfbSAlexander Kozyrev  */
5224f076bcfbSAlexander Kozyrev struct rte_flow_template_table;
5225f076bcfbSAlexander Kozyrev 
5226f076bcfbSAlexander Kozyrev /**
5227f076bcfbSAlexander Kozyrev  * @warning
5228f076bcfbSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5229f076bcfbSAlexander Kozyrev  *
5230f076bcfbSAlexander Kozyrev  * Table attributes.
5231f076bcfbSAlexander Kozyrev  */
5232f076bcfbSAlexander Kozyrev struct rte_flow_template_table_attr {
5233f076bcfbSAlexander Kozyrev 	/**
5234f076bcfbSAlexander Kozyrev 	 * Flow attributes to be used in each rule generated from this table.
5235f076bcfbSAlexander Kozyrev 	 */
5236f076bcfbSAlexander Kozyrev 	struct rte_flow_attr flow_attr;
5237f076bcfbSAlexander Kozyrev 	/**
5238f076bcfbSAlexander Kozyrev 	 * Maximum number of flow rules that this table holds.
5239f076bcfbSAlexander Kozyrev 	 */
5240f076bcfbSAlexander Kozyrev 	uint32_t nb_flows;
5241f076bcfbSAlexander Kozyrev };
5242f076bcfbSAlexander Kozyrev 
5243f076bcfbSAlexander Kozyrev /**
5244f076bcfbSAlexander Kozyrev  * @warning
5245f076bcfbSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5246f076bcfbSAlexander Kozyrev  *
5247f076bcfbSAlexander Kozyrev  * Create flow template table.
5248f076bcfbSAlexander Kozyrev  *
5249f076bcfbSAlexander Kozyrev  * A template table consists of multiple pattern templates and actions
5250f076bcfbSAlexander Kozyrev  * templates associated with a single set of rule attributes (group ID,
5251f076bcfbSAlexander Kozyrev  * priority and traffic direction).
5252f076bcfbSAlexander Kozyrev  *
5253f076bcfbSAlexander Kozyrev  * Each rule is free to use any combination of pattern and actions templates
5254f076bcfbSAlexander Kozyrev  * and specify particular values for items and actions it would like to change.
5255f076bcfbSAlexander Kozyrev  *
5256f076bcfbSAlexander Kozyrev  * @param port_id
5257f076bcfbSAlexander Kozyrev  *   Port identifier of Ethernet device.
5258f076bcfbSAlexander Kozyrev  * @param[in] table_attr
5259f076bcfbSAlexander Kozyrev  *   Template table attributes.
5260f076bcfbSAlexander Kozyrev  * @param[in] pattern_templates
5261f076bcfbSAlexander Kozyrev  *   Array of pattern templates to be used in this table.
5262f076bcfbSAlexander Kozyrev  * @param[in] nb_pattern_templates
5263f076bcfbSAlexander Kozyrev  *   The number of pattern templates in the pattern_templates array.
5264f076bcfbSAlexander Kozyrev  * @param[in] actions_templates
5265f076bcfbSAlexander Kozyrev  *   Array of actions templates to be used in this table.
5266f076bcfbSAlexander Kozyrev  * @param[in] nb_actions_templates
5267f076bcfbSAlexander Kozyrev  *   The number of actions templates in the actions_templates array.
5268f076bcfbSAlexander Kozyrev  * @param[out] error
5269f076bcfbSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5270f076bcfbSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5271f076bcfbSAlexander Kozyrev  *
5272f076bcfbSAlexander Kozyrev  * @return
5273f076bcfbSAlexander Kozyrev  *   Handle on success, NULL otherwise and rte_errno is set.
5274f076bcfbSAlexander Kozyrev  */
5275f076bcfbSAlexander Kozyrev __rte_experimental
5276f076bcfbSAlexander Kozyrev struct rte_flow_template_table *
5277f076bcfbSAlexander Kozyrev rte_flow_template_table_create(uint16_t port_id,
5278f076bcfbSAlexander Kozyrev 		const struct rte_flow_template_table_attr *table_attr,
5279f076bcfbSAlexander Kozyrev 		struct rte_flow_pattern_template *pattern_templates[],
5280f076bcfbSAlexander Kozyrev 		uint8_t nb_pattern_templates,
5281f076bcfbSAlexander Kozyrev 		struct rte_flow_actions_template *actions_templates[],
5282f076bcfbSAlexander Kozyrev 		uint8_t nb_actions_templates,
5283f076bcfbSAlexander Kozyrev 		struct rte_flow_error *error);
5284f076bcfbSAlexander Kozyrev 
5285f076bcfbSAlexander Kozyrev /**
5286f076bcfbSAlexander Kozyrev  * @warning
5287f076bcfbSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5288f076bcfbSAlexander Kozyrev  *
5289f076bcfbSAlexander Kozyrev  * Destroy flow template table.
5290f076bcfbSAlexander Kozyrev  *
5291f076bcfbSAlexander Kozyrev  * This function may be called only when
5292f076bcfbSAlexander Kozyrev  * there are no more flow rules referencing this table.
5293f076bcfbSAlexander Kozyrev  *
5294f076bcfbSAlexander Kozyrev  * @param port_id
5295f076bcfbSAlexander Kozyrev  *   Port identifier of Ethernet device.
5296f076bcfbSAlexander Kozyrev  * @param[in] template_table
5297f076bcfbSAlexander Kozyrev  *   Handle to the table to be destroyed.
5298f076bcfbSAlexander Kozyrev  * @param[out] error
5299f076bcfbSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5300f076bcfbSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5301f076bcfbSAlexander Kozyrev  *
5302f076bcfbSAlexander Kozyrev  * @return
5303f076bcfbSAlexander Kozyrev  *   0 on success, a negative errno value otherwise and rte_errno is set.
5304f076bcfbSAlexander Kozyrev  */
5305f076bcfbSAlexander Kozyrev __rte_experimental
5306f076bcfbSAlexander Kozyrev int
5307f076bcfbSAlexander Kozyrev rte_flow_template_table_destroy(uint16_t port_id,
5308f076bcfbSAlexander Kozyrev 		struct rte_flow_template_table *template_table,
5309f076bcfbSAlexander Kozyrev 		struct rte_flow_error *error);
5310f076bcfbSAlexander Kozyrev 
5311197e820cSAlexander Kozyrev /**
5312197e820cSAlexander Kozyrev  * @warning
5313197e820cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5314197e820cSAlexander Kozyrev  *
5315197e820cSAlexander Kozyrev  * Asynchronous operation attributes.
5316197e820cSAlexander Kozyrev  */
5317197e820cSAlexander Kozyrev __extension__
5318197e820cSAlexander Kozyrev struct rte_flow_op_attr {
5319197e820cSAlexander Kozyrev 	 /**
5320197e820cSAlexander Kozyrev 	  * When set, the requested action will not be sent to the HW immediately.
5321197e820cSAlexander Kozyrev 	  * The application must call the rte_flow_queue_push to actually send it.
5322197e820cSAlexander Kozyrev 	  */
5323197e820cSAlexander Kozyrev 	uint32_t postpone:1;
5324197e820cSAlexander Kozyrev };
5325197e820cSAlexander Kozyrev 
5326197e820cSAlexander Kozyrev /**
5327197e820cSAlexander Kozyrev  * @warning
5328197e820cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5329197e820cSAlexander Kozyrev  *
5330197e820cSAlexander Kozyrev  * Enqueue rule creation operation.
5331197e820cSAlexander Kozyrev  *
5332197e820cSAlexander Kozyrev  * @param port_id
5333197e820cSAlexander Kozyrev  *   Port identifier of Ethernet device.
5334197e820cSAlexander Kozyrev  * @param queue_id
5335197e820cSAlexander Kozyrev  *   Flow queue used to insert the rule.
5336197e820cSAlexander Kozyrev  * @param[in] op_attr
5337197e820cSAlexander Kozyrev  *   Rule creation operation attributes.
5338197e820cSAlexander Kozyrev  * @param[in] template_table
5339197e820cSAlexander Kozyrev  *   Template table to select templates from.
5340197e820cSAlexander Kozyrev  * @param[in] pattern
5341197e820cSAlexander Kozyrev  *   List of pattern items to be used.
5342197e820cSAlexander Kozyrev  *   The list order should match the order in the pattern template.
5343197e820cSAlexander Kozyrev  *   The spec is the only relevant member of the item that is being used.
5344197e820cSAlexander Kozyrev  * @param[in] pattern_template_index
5345197e820cSAlexander Kozyrev  *   Pattern template index in the table.
5346197e820cSAlexander Kozyrev  * @param[in] actions
5347197e820cSAlexander Kozyrev  *   List of actions to be used.
5348197e820cSAlexander Kozyrev  *   The list order should match the order in the actions template.
5349197e820cSAlexander Kozyrev  * @param[in] actions_template_index
5350197e820cSAlexander Kozyrev  *   Actions template index in the table.
5351197e820cSAlexander Kozyrev  * @param[in] user_data
5352197e820cSAlexander Kozyrev  *   The user data that will be returned on the completion events.
5353197e820cSAlexander Kozyrev  * @param[out] error
5354197e820cSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5355197e820cSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5356197e820cSAlexander Kozyrev  *
5357197e820cSAlexander Kozyrev  * @return
5358197e820cSAlexander Kozyrev  *   Handle on success, NULL otherwise and rte_errno is set.
5359197e820cSAlexander Kozyrev  *   The rule handle doesn't mean that the rule has been populated.
5360197e820cSAlexander Kozyrev  *   Only completion result indicates that if there was success or failure.
5361197e820cSAlexander Kozyrev  */
5362197e820cSAlexander Kozyrev __rte_experimental
5363197e820cSAlexander Kozyrev struct rte_flow *
5364197e820cSAlexander Kozyrev rte_flow_async_create(uint16_t port_id,
5365197e820cSAlexander Kozyrev 		      uint32_t queue_id,
5366197e820cSAlexander Kozyrev 		      const struct rte_flow_op_attr *op_attr,
5367197e820cSAlexander Kozyrev 		      struct rte_flow_template_table *template_table,
5368197e820cSAlexander Kozyrev 		      const struct rte_flow_item pattern[],
5369197e820cSAlexander Kozyrev 		      uint8_t pattern_template_index,
5370197e820cSAlexander Kozyrev 		      const struct rte_flow_action actions[],
5371197e820cSAlexander Kozyrev 		      uint8_t actions_template_index,
5372197e820cSAlexander Kozyrev 		      void *user_data,
5373197e820cSAlexander Kozyrev 		      struct rte_flow_error *error);
5374197e820cSAlexander Kozyrev 
5375197e820cSAlexander Kozyrev /**
5376197e820cSAlexander Kozyrev  * @warning
5377197e820cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5378197e820cSAlexander Kozyrev  *
5379197e820cSAlexander Kozyrev  * Enqueue rule destruction operation.
5380197e820cSAlexander Kozyrev  *
5381197e820cSAlexander Kozyrev  * This function enqueues a destruction operation on the queue.
5382197e820cSAlexander Kozyrev  * Application should assume that after calling this function
5383197e820cSAlexander Kozyrev  * the rule handle is not valid anymore.
5384197e820cSAlexander Kozyrev  * Completion indicates the full removal of the rule from the HW.
5385197e820cSAlexander Kozyrev  *
5386197e820cSAlexander Kozyrev  * @param port_id
5387197e820cSAlexander Kozyrev  *   Port identifier of Ethernet device.
5388197e820cSAlexander Kozyrev  * @param queue_id
5389197e820cSAlexander Kozyrev  *   Flow queue which is used to destroy the rule.
5390197e820cSAlexander Kozyrev  *   This must match the queue on which the rule was created.
5391197e820cSAlexander Kozyrev  * @param[in] op_attr
5392197e820cSAlexander Kozyrev  *   Rule destruction operation attributes.
5393197e820cSAlexander Kozyrev  * @param[in] flow
5394197e820cSAlexander Kozyrev  *   Flow handle to be destroyed.
5395197e820cSAlexander Kozyrev  * @param[in] user_data
5396197e820cSAlexander Kozyrev  *   The user data that will be returned on the completion events.
5397197e820cSAlexander Kozyrev  * @param[out] error
5398197e820cSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5399197e820cSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5400197e820cSAlexander Kozyrev  *
5401197e820cSAlexander Kozyrev  * @return
5402197e820cSAlexander Kozyrev  *   0 on success, a negative errno value otherwise and rte_errno is set.
5403197e820cSAlexander Kozyrev  */
5404197e820cSAlexander Kozyrev __rte_experimental
5405197e820cSAlexander Kozyrev int
5406197e820cSAlexander Kozyrev rte_flow_async_destroy(uint16_t port_id,
5407197e820cSAlexander Kozyrev 		       uint32_t queue_id,
5408197e820cSAlexander Kozyrev 		       const struct rte_flow_op_attr *op_attr,
5409197e820cSAlexander Kozyrev 		       struct rte_flow *flow,
5410197e820cSAlexander Kozyrev 		       void *user_data,
5411197e820cSAlexander Kozyrev 		       struct rte_flow_error *error);
5412197e820cSAlexander Kozyrev 
5413197e820cSAlexander Kozyrev /**
5414197e820cSAlexander Kozyrev  * @warning
5415197e820cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5416197e820cSAlexander Kozyrev  *
5417197e820cSAlexander Kozyrev  * Push all internally stored rules to the HW.
5418197e820cSAlexander Kozyrev  * Postponed rules are rules that were inserted with the postpone flag set.
5419197e820cSAlexander Kozyrev  * Can be used to notify the HW about batch of rules prepared by the SW to
5420197e820cSAlexander Kozyrev  * reduce the number of communications between the HW and SW.
5421197e820cSAlexander Kozyrev  *
5422197e820cSAlexander Kozyrev  * @param port_id
5423197e820cSAlexander Kozyrev  *   Port identifier of Ethernet device.
5424197e820cSAlexander Kozyrev  * @param queue_id
5425197e820cSAlexander Kozyrev  *   Flow queue to be pushed.
5426197e820cSAlexander Kozyrev  * @param[out] error
5427197e820cSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5428197e820cSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5429197e820cSAlexander Kozyrev  *
5430197e820cSAlexander Kozyrev  * @return
5431197e820cSAlexander Kozyrev  *   0 on success, a negative errno value otherwise and rte_errno is set.
5432197e820cSAlexander Kozyrev  */
5433197e820cSAlexander Kozyrev __rte_experimental
5434197e820cSAlexander Kozyrev int
5435197e820cSAlexander Kozyrev rte_flow_push(uint16_t port_id,
5436197e820cSAlexander Kozyrev 	      uint32_t queue_id,
5437197e820cSAlexander Kozyrev 	      struct rte_flow_error *error);
5438197e820cSAlexander Kozyrev 
5439197e820cSAlexander Kozyrev /**
5440197e820cSAlexander Kozyrev  * @warning
5441197e820cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5442197e820cSAlexander Kozyrev  *
5443197e820cSAlexander Kozyrev  * Asynchronous operation status.
5444197e820cSAlexander Kozyrev  */
5445197e820cSAlexander Kozyrev enum rte_flow_op_status {
5446197e820cSAlexander Kozyrev 	/**
5447197e820cSAlexander Kozyrev 	 * The operation was completed successfully.
5448197e820cSAlexander Kozyrev 	 */
5449197e820cSAlexander Kozyrev 	RTE_FLOW_OP_SUCCESS,
5450197e820cSAlexander Kozyrev 	/**
5451197e820cSAlexander Kozyrev 	 * The operation was not completed successfully.
5452197e820cSAlexander Kozyrev 	 */
5453197e820cSAlexander Kozyrev 	RTE_FLOW_OP_ERROR,
5454197e820cSAlexander Kozyrev };
5455197e820cSAlexander Kozyrev 
5456197e820cSAlexander Kozyrev /**
5457197e820cSAlexander Kozyrev  * @warning
5458197e820cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5459197e820cSAlexander Kozyrev  *
5460197e820cSAlexander Kozyrev  * Asynchronous operation result.
5461197e820cSAlexander Kozyrev  */
5462197e820cSAlexander Kozyrev __extension__
5463197e820cSAlexander Kozyrev struct rte_flow_op_result {
5464197e820cSAlexander Kozyrev 	/**
5465197e820cSAlexander Kozyrev 	 * Returns the status of the operation that this completion signals.
5466197e820cSAlexander Kozyrev 	 */
5467197e820cSAlexander Kozyrev 	enum rte_flow_op_status status;
5468197e820cSAlexander Kozyrev 	/**
5469197e820cSAlexander Kozyrev 	 * The user data that will be returned on the completion events.
5470197e820cSAlexander Kozyrev 	 */
5471197e820cSAlexander Kozyrev 	void *user_data;
5472197e820cSAlexander Kozyrev };
5473197e820cSAlexander Kozyrev 
5474197e820cSAlexander Kozyrev /**
5475197e820cSAlexander Kozyrev  * @warning
5476197e820cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5477197e820cSAlexander Kozyrev  *
5478197e820cSAlexander Kozyrev  * Pull a rte flow operation.
5479197e820cSAlexander Kozyrev  * The application must invoke this function in order to complete
5480197e820cSAlexander Kozyrev  * the flow rule offloading and to retrieve the flow rule operation status.
5481197e820cSAlexander Kozyrev  *
5482197e820cSAlexander Kozyrev  * @param port_id
5483197e820cSAlexander Kozyrev  *   Port identifier of Ethernet device.
5484197e820cSAlexander Kozyrev  * @param queue_id
5485197e820cSAlexander Kozyrev  *   Flow queue which is used to pull the operation.
5486197e820cSAlexander Kozyrev  * @param[out] res
5487197e820cSAlexander Kozyrev  *   Array of results that will be set.
5488197e820cSAlexander Kozyrev  * @param[in] n_res
5489197e820cSAlexander Kozyrev  *   Maximum number of results that can be returned.
5490197e820cSAlexander Kozyrev  *   This value is equal to the size of the res array.
5491197e820cSAlexander Kozyrev  * @param[out] error
5492197e820cSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5493197e820cSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5494197e820cSAlexander Kozyrev  *
5495197e820cSAlexander Kozyrev  * @return
5496197e820cSAlexander Kozyrev  *   Number of results that were pulled,
5497197e820cSAlexander Kozyrev  *   a negative errno value otherwise and rte_errno is set.
5498197e820cSAlexander Kozyrev  */
5499197e820cSAlexander Kozyrev __rte_experimental
5500197e820cSAlexander Kozyrev int
5501197e820cSAlexander Kozyrev rte_flow_pull(uint16_t port_id,
5502197e820cSAlexander Kozyrev 	      uint32_t queue_id,
5503197e820cSAlexander Kozyrev 	      struct rte_flow_op_result res[],
5504197e820cSAlexander Kozyrev 	      uint16_t n_res,
5505197e820cSAlexander Kozyrev 	      struct rte_flow_error *error);
5506197e820cSAlexander Kozyrev 
5507*13cd6d5cSAlexander Kozyrev /**
5508*13cd6d5cSAlexander Kozyrev  * @warning
5509*13cd6d5cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5510*13cd6d5cSAlexander Kozyrev  *
5511*13cd6d5cSAlexander Kozyrev  * Enqueue indirect action creation operation.
5512*13cd6d5cSAlexander Kozyrev  * @see rte_flow_action_handle_create
5513*13cd6d5cSAlexander Kozyrev  *
5514*13cd6d5cSAlexander Kozyrev  * @param[in] port_id
5515*13cd6d5cSAlexander Kozyrev  *   Port identifier of Ethernet device.
5516*13cd6d5cSAlexander Kozyrev  * @param[in] queue_id
5517*13cd6d5cSAlexander Kozyrev  *   Flow queue which is used to create the rule.
5518*13cd6d5cSAlexander Kozyrev  * @param[in] op_attr
5519*13cd6d5cSAlexander Kozyrev  *   Indirect action creation operation attributes.
5520*13cd6d5cSAlexander Kozyrev  * @param[in] indir_action_conf
5521*13cd6d5cSAlexander Kozyrev  *   Action configuration for the indirect action object creation.
5522*13cd6d5cSAlexander Kozyrev  * @param[in] action
5523*13cd6d5cSAlexander Kozyrev  *   Specific configuration of the indirect action object.
5524*13cd6d5cSAlexander Kozyrev  * @param[in] user_data
5525*13cd6d5cSAlexander Kozyrev  *   The user data that will be returned on the completion events.
5526*13cd6d5cSAlexander Kozyrev  * @param[out] error
5527*13cd6d5cSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5528*13cd6d5cSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5529*13cd6d5cSAlexander Kozyrev  *
5530*13cd6d5cSAlexander Kozyrev  * @return
5531*13cd6d5cSAlexander Kozyrev  *   A valid handle in case of success, NULL otherwise and rte_errno is set.
5532*13cd6d5cSAlexander Kozyrev  */
5533*13cd6d5cSAlexander Kozyrev __rte_experimental
5534*13cd6d5cSAlexander Kozyrev struct rte_flow_action_handle *
5535*13cd6d5cSAlexander Kozyrev rte_flow_async_action_handle_create(uint16_t port_id,
5536*13cd6d5cSAlexander Kozyrev 		uint32_t queue_id,
5537*13cd6d5cSAlexander Kozyrev 		const struct rte_flow_op_attr *op_attr,
5538*13cd6d5cSAlexander Kozyrev 		const struct rte_flow_indir_action_conf *indir_action_conf,
5539*13cd6d5cSAlexander Kozyrev 		const struct rte_flow_action *action,
5540*13cd6d5cSAlexander Kozyrev 		void *user_data,
5541*13cd6d5cSAlexander Kozyrev 		struct rte_flow_error *error);
5542*13cd6d5cSAlexander Kozyrev 
5543*13cd6d5cSAlexander Kozyrev /**
5544*13cd6d5cSAlexander Kozyrev  * @warning
5545*13cd6d5cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5546*13cd6d5cSAlexander Kozyrev  *
5547*13cd6d5cSAlexander Kozyrev  * Enqueue indirect action destruction operation.
5548*13cd6d5cSAlexander Kozyrev  * The destroy queue must be the same
5549*13cd6d5cSAlexander Kozyrev  * as the queue on which the action was created.
5550*13cd6d5cSAlexander Kozyrev  *
5551*13cd6d5cSAlexander Kozyrev  * @param[in] port_id
5552*13cd6d5cSAlexander Kozyrev  *   Port identifier of Ethernet device.
5553*13cd6d5cSAlexander Kozyrev  * @param[in] queue_id
5554*13cd6d5cSAlexander Kozyrev  *   Flow queue which is used to destroy the rule.
5555*13cd6d5cSAlexander Kozyrev  * @param[in] op_attr
5556*13cd6d5cSAlexander Kozyrev  *   Indirect action destruction operation attributes.
5557*13cd6d5cSAlexander Kozyrev  * @param[in] action_handle
5558*13cd6d5cSAlexander Kozyrev  *   Handle for the indirect action object to be destroyed.
5559*13cd6d5cSAlexander Kozyrev  * @param[in] user_data
5560*13cd6d5cSAlexander Kozyrev  *   The user data that will be returned on the completion events.
5561*13cd6d5cSAlexander Kozyrev  * @param[out] error
5562*13cd6d5cSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5563*13cd6d5cSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5564*13cd6d5cSAlexander Kozyrev  *
5565*13cd6d5cSAlexander Kozyrev  * @return
5566*13cd6d5cSAlexander Kozyrev  *   0 on success, a negative errno value otherwise and rte_errno is set.
5567*13cd6d5cSAlexander Kozyrev  */
5568*13cd6d5cSAlexander Kozyrev __rte_experimental
5569*13cd6d5cSAlexander Kozyrev int
5570*13cd6d5cSAlexander Kozyrev rte_flow_async_action_handle_destroy(uint16_t port_id,
5571*13cd6d5cSAlexander Kozyrev 		uint32_t queue_id,
5572*13cd6d5cSAlexander Kozyrev 		const struct rte_flow_op_attr *op_attr,
5573*13cd6d5cSAlexander Kozyrev 		struct rte_flow_action_handle *action_handle,
5574*13cd6d5cSAlexander Kozyrev 		void *user_data,
5575*13cd6d5cSAlexander Kozyrev 		struct rte_flow_error *error);
5576*13cd6d5cSAlexander Kozyrev 
5577*13cd6d5cSAlexander Kozyrev /**
5578*13cd6d5cSAlexander Kozyrev  * @warning
5579*13cd6d5cSAlexander Kozyrev  * @b EXPERIMENTAL: this API may change without prior notice.
5580*13cd6d5cSAlexander Kozyrev  *
5581*13cd6d5cSAlexander Kozyrev  * Enqueue indirect action update operation.
5582*13cd6d5cSAlexander Kozyrev  * @see rte_flow_action_handle_create
5583*13cd6d5cSAlexander Kozyrev  *
5584*13cd6d5cSAlexander Kozyrev  * @param[in] port_id
5585*13cd6d5cSAlexander Kozyrev  *   Port identifier of Ethernet device.
5586*13cd6d5cSAlexander Kozyrev  * @param[in] queue_id
5587*13cd6d5cSAlexander Kozyrev  *   Flow queue which is used to update the rule.
5588*13cd6d5cSAlexander Kozyrev  * @param[in] op_attr
5589*13cd6d5cSAlexander Kozyrev  *   Indirect action update operation attributes.
5590*13cd6d5cSAlexander Kozyrev  * @param[in] action_handle
5591*13cd6d5cSAlexander Kozyrev  *   Handle for the indirect action object to be updated.
5592*13cd6d5cSAlexander Kozyrev  * @param[in] update
5593*13cd6d5cSAlexander Kozyrev  *   Update profile specification used to modify the action pointed by handle.
5594*13cd6d5cSAlexander Kozyrev  *   *update* could be with the same type of the immediate action corresponding
5595*13cd6d5cSAlexander Kozyrev  *   to the *handle* argument when creating, or a wrapper structure includes
5596*13cd6d5cSAlexander Kozyrev  *   action configuration to be updated and bit fields to indicate the member
5597*13cd6d5cSAlexander Kozyrev  *   of fields inside the action to update.
5598*13cd6d5cSAlexander Kozyrev  * @param[in] user_data
5599*13cd6d5cSAlexander Kozyrev  *   The user data that will be returned on the completion events.
5600*13cd6d5cSAlexander Kozyrev  * @param[out] error
5601*13cd6d5cSAlexander Kozyrev  *   Perform verbose error reporting if not NULL.
5602*13cd6d5cSAlexander Kozyrev  *   PMDs initialize this structure in case of error only.
5603*13cd6d5cSAlexander Kozyrev  *
5604*13cd6d5cSAlexander Kozyrev  * @return
5605*13cd6d5cSAlexander Kozyrev  *   0 on success, a negative errno value otherwise and rte_errno is set.
5606*13cd6d5cSAlexander Kozyrev  */
5607*13cd6d5cSAlexander Kozyrev __rte_experimental
5608*13cd6d5cSAlexander Kozyrev int
5609*13cd6d5cSAlexander Kozyrev rte_flow_async_action_handle_update(uint16_t port_id,
5610*13cd6d5cSAlexander Kozyrev 		uint32_t queue_id,
5611*13cd6d5cSAlexander Kozyrev 		const struct rte_flow_op_attr *op_attr,
5612*13cd6d5cSAlexander Kozyrev 		struct rte_flow_action_handle *action_handle,
5613*13cd6d5cSAlexander Kozyrev 		const void *update,
5614*13cd6d5cSAlexander Kozyrev 		void *user_data,
5615*13cd6d5cSAlexander Kozyrev 		struct rte_flow_error *error);
561699a2dd95SBruce Richardson #ifdef __cplusplus
561799a2dd95SBruce Richardson }
561899a2dd95SBruce Richardson #endif
561999a2dd95SBruce Richardson 
562099a2dd95SBruce Richardson #endif /* RTE_FLOW_H_ */
5621