X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Fethdev%2Frte_flow.h;h=1031fb246b8bf0529633b1b9530542ac3a921f57;hb=6e858b4d9244cf53505589673755ab18ac2a4a83;hp=25e20f5048d7724cc0b0b35819d776cf12068350;hpb=b10a421a1f3bb88c0c4317304611c98e578f9257;p=dpdk.git diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index 25e20f5048..1031fb246b 100644 --- a/lib/ethdev/rte_flow.h +++ b/lib/ethdev/rte_flow.h @@ -30,8 +30,13 @@ #include #include #include +#include #include #include +#include +#include +#include +#include #ifdef __cplusplus extern "C" { @@ -64,7 +69,10 @@ extern "C" { * Note that support for more than a single group and priority level is not * guaranteed. * - * Flow rules can apply to inbound and/or outbound traffic (ingress/egress). + * At vNIC / ethdev level, flow rules can apply to inbound and / or outbound + * traffic (ingress / egress), with respect to the vNIC / ethdev in question. + * At embedded switch level, flow rules apply to all traffic seen by it + * unless fitting meta items are used to set concrete traffic source(s). * * Several pattern items and actions are valid and can be used in both * directions. Those valid for only one direction are described as such. @@ -72,13 +80,37 @@ extern "C" { * At least one direction must be specified. * * Specifying both directions at once for a given rule is not recommended - * but may be valid in a few cases (e.g. shared counter). + * but may be valid in a few cases. */ struct rte_flow_attr { uint32_t group; /**< Priority group. */ uint32_t priority; /**< Rule priority level within group. */ - uint32_t ingress:1; /**< Rule applies to ingress traffic. */ - uint32_t egress:1; /**< Rule applies to egress traffic. */ + /** + * The rule in question applies to ingress traffic (non-"transfer"). + * + * @deprecated + * It has been possible to combine this attribute with "transfer". + * Doing so has been assumed to restrict the scope of matching + * to traffic going from within the embedded switch toward the + * ethdev the flow rule being created through. This behaviour + * is deprecated. During the transition period, one may still + * rely on it, but PMDs and applications are encouraged to + * gradually move away from this approach. + */ + uint32_t ingress:1; + /** + * The rule in question applies to egress traffic (non-"transfer"). + * + * @deprecated + * It has been possible to combine this attribute with "transfer". + * Doing so has been assumed to restrict the scope of matching + * to traffic sent by the application by virtue of the ethdev + * the flow rule being created through. This behaviour is now + * deprecated. During the transition period, one may still + * rely on it, but PMDs and applications are encouraged to + * gradually move away from this approach. + */ + uint32_t egress:1; /** * Instead of simply matching the properties of traffic as it would * appear on a given DPDK port ID, enabling this attribute transfers @@ -90,12 +122,11 @@ struct rte_flow_attr { * from or addressed to different physical ports, VFs or * applications) at the device level. * - * It complements the behavior of some pattern items such as - * RTE_FLOW_ITEM_TYPE_PHY_PORT and is meaningless without them. + * The application should match traffic originating from precise + * locations. See items PORT_REPRESENTOR and REPRESENTED_PORT. * - * When transferring flow rules, ingress and egress attributes keep - * their original meaning, as if processing traffic emitted or - * received by the application. + * Managing "transfer" flows requires that the user communicate them + * through a suitable port. @see rte_flow_pick_transfer_proxy(). */ uint32_t transfer:1; uint32_t reserved:29; /**< Reserved, must be zero. */ @@ -157,6 +188,10 @@ enum rte_flow_item_type { RTE_FLOW_ITEM_TYPE_ANY, /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * [META] * * Matches traffic originating from (ingress) or going to (egress) @@ -167,6 +202,10 @@ enum rte_flow_item_type { RTE_FLOW_ITEM_TYPE_PF, /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * [META] * * Matches traffic originating from (ingress) or going to (egress) a @@ -177,6 +216,10 @@ enum rte_flow_item_type { RTE_FLOW_ITEM_TYPE_VF, /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * [META] * * Matches traffic originating from (ingress) or going to (egress) a @@ -187,6 +230,10 @@ enum rte_flow_item_type { RTE_FLOW_ITEM_TYPE_PHY_PORT, /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * [META] * * Matches traffic originating from (ingress) or going to (egress) a @@ -562,6 +609,57 @@ enum rte_flow_item_type { * @see struct rte_flow_item_integrity. */ RTE_FLOW_ITEM_TYPE_INTEGRITY, + + /** + * [META] + * + * Matches conntrack state. + * + * @see struct rte_flow_item_conntrack. + */ + RTE_FLOW_ITEM_TYPE_CONNTRACK, + + /** + * [META] + * + * Matches traffic entering the embedded switch from the given ethdev. + * + * @see struct rte_flow_item_ethdev + */ + RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR, + + /** + * [META] + * + * Matches traffic entering the embedded switch from + * the entity represented by the given ethdev. + * + * @see struct rte_flow_item_ethdev + */ + RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT, + + /** + * Matches a configured set of fields at runtime calculated offsets + * over the generic network header with variable length and + * flexible pattern + * + * @see struct rte_flow_item_flex. + */ + RTE_FLOW_ITEM_TYPE_FLEX, + + /** + * Matches L2TPv2 Header. + * + * See struct rte_flow_item_l2tpv2. + */ + RTE_FLOW_ITEM_TYPE_L2TPV2, + + /** + * Matches PPP Header. + * + * See struct rte_flow_item_ppp. + */ + RTE_FLOW_ITEM_TYPE_PPP, }; /** @@ -609,6 +707,10 @@ static const struct rte_flow_item_any rte_flow_item_any_mask = { #endif /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ITEM_TYPE_VF * * Matches traffic originating from (ingress) or going to (egress) a given @@ -638,6 +740,10 @@ static const struct rte_flow_item_vf rte_flow_item_vf_mask = { #endif /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ITEM_TYPE_PHY_PORT * * Matches traffic originating from (ingress) or going to (egress) a @@ -669,6 +775,10 @@ static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask = { #endif /** + * @deprecated + * @see RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ITEM_TYPE_PORT_ID * * Matches traffic originating from (ingress) or going to (egress) a given @@ -773,8 +883,8 @@ struct rte_flow_item_eth { /** Default mask for RTE_FLOW_ITEM_TYPE_ETH. */ #ifndef __cplusplus static const struct rte_flow_item_eth rte_flow_item_eth_mask = { - .hdr.d_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", - .hdr.s_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", + .hdr.dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", + .hdr.src_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", .hdr.ether_type = RTE_BE16(0x0000), }; #endif @@ -807,8 +917,8 @@ struct rte_flow_item_vlan { }; struct rte_vlan_hdr hdr; }; + /** Packet header contains at least one more VLAN, after this VLAN. */ uint32_t has_more_vlan:1; - /**< Packet header contains at least one more VLAN, after this VLAN. */ uint32_t reserved:31; /**< Reserved, must be zero. */ }; @@ -850,26 +960,26 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { */ struct rte_flow_item_ipv6 { struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */ + /** Header contains Hop-by-Hop Options extension header. */ uint32_t has_hop_ext:1; - /**< Header contains Hop-by-Hop Options extension header. */ + /** Header contains Routing extension header. */ uint32_t has_route_ext:1; - /**< Header contains Routing extension header. */ + /** Header contains Fragment extension header. */ uint32_t has_frag_ext:1; - /**< Header contains Fragment extension header. */ + /** Header contains Authentication extension header. */ uint32_t has_auth_ext:1; - /**< Header contains Authentication extension header. */ + /** Header contains Encapsulation Security Payload extension header. */ uint32_t has_esp_ext:1; - /**< Header contains Encapsulation Security Payload extension header. */ + /** Header contains Destination Options extension header. */ uint32_t has_dest_ext:1; - /**< Header contains Destination Options extension header. */ + /** Header contains Mobility extension header. */ uint32_t has_mobil_ext:1; - /**< Header contains Mobility extension header. */ + /** Header contains Host Identity Protocol extension header. */ uint32_t has_hip_ext:1; - /**< Header contains Host Identity Protocol extension header. */ + /** Header contains Shim6 Protocol extension header. */ uint32_t has_shim6_ext:1; - /**< Header contains Shim6 Protocol extension header. */ + /** Reserved for future extension headers, must be zero. */ uint32_t reserved:23; - /**< Reserved for future extension headers, must be zero. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ @@ -1410,11 +1520,12 @@ rte_flow_item_icmp6_nd_opt_tla_eth_mask = { * RTE_FLOW_ITEM_TYPE_META * * Matches a specified metadata value. On egress, metadata can be set - * either by mbuf dynamic metadata field with PKT_TX_DYNF_METADATA flag or - * RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META + * either by mbuf dynamic metadata field with RTE_MBUF_DYNFLAG_TX_METADATA flag + * or RTE_FLOW_ACTION_TYPE_SET_META. On ingress, RTE_FLOW_ACTION_TYPE_SET_META * sets metadata for a packet and the metadata will be reported via mbuf - * metadata dynamic field with PKT_RX_DYNF_METADATA flag. The dynamic mbuf - * field must be registered in advance by rte_flow_dynf_metadata_register(). + * metadata dynamic field with RTE_MBUF_DYNFLAG_RX_METADATA flag. The dynamic + * mbuf field must be registered in advance by + * rte_flow_dynf_metadata_register(). */ struct rte_flow_item_meta { uint32_t data; @@ -1433,15 +1544,14 @@ static const struct rte_flow_item_meta rte_flow_item_meta_mask = { * Matches a GTP PDU extension header with type 0x85. */ struct rte_flow_item_gtp_psc { - uint8_t pdu_type; /**< PDU type. */ - uint8_t qfi; /**< PPP, RQI, QoS flow identifier. */ + struct rte_gtp_psc_generic_hdr hdr; /**< gtp psc generic hdr. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */ #ifndef __cplusplus static const struct rte_flow_item_gtp_psc rte_flow_item_gtp_psc_mask = { - .qfi = 0xff, + .hdr.qfi = 0x3f, }; #endif @@ -1696,8 +1806,16 @@ rte_flow_item_geneve_opt_mask = { }; #endif +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_INTEGRITY + * + * Match on packet integrity check result. + */ struct rte_flow_item_integrity { - /**< Tunnel encapsulation level the item should apply to. + /** Tunnel encapsulation level the item should apply to. * @see rte_flow_action_rss */ uint32_t level; @@ -1705,21 +1823,21 @@ struct rte_flow_item_integrity { union { __extension__ struct { - /**< The packet is valid after passing all HW checks. */ + /** The packet is valid after passing all HW checks. */ uint64_t packet_ok:1; - /**< L2 layer is valid after passing all HW checks. */ + /** L2 layer is valid after passing all HW checks. */ uint64_t l2_ok:1; - /**< L3 layer is valid after passing all HW checks. */ + /** L3 layer is valid after passing all HW checks. */ uint64_t l3_ok:1; - /**< L4 layer is valid after passing all HW checks. */ + /** L4 layer is valid after passing all HW checks. */ uint64_t l4_ok:1; - /**< L2 layer CRC is valid. */ + /** L2 layer CRC is valid. */ uint64_t l2_crc_ok:1; - /**< IPv4 layer checksum is valid. */ + /** IPv4 layer checksum is valid. */ uint64_t ipv4_csum_ok:1; - /**< L4 layer checksum is valid. */ + /** L4 layer checksum is valid. */ uint64_t l4_csum_ok:1; - /**< The l3 length is smaller than the frame length. */ + /** L3 length is smaller than frame length. */ uint64_t l3_len_ok:1; uint64_t reserved:56; }; @@ -1735,6 +1853,121 @@ rte_flow_item_integrity_mask = { }; #endif +/** + * The packet is valid after conntrack checking. + */ +#define RTE_FLOW_CONNTRACK_PKT_STATE_VALID RTE_BIT32(0) +/** + * The state of the connection is changed. + */ +#define RTE_FLOW_CONNTRACK_PKT_STATE_CHANGED RTE_BIT32(1) +/** + * Error is detected on this packet for this connection and + * an invalid state is set. + */ +#define RTE_FLOW_CONNTRACK_PKT_STATE_INVALID RTE_BIT32(2) +/** + * The HW connection tracking module is disabled. + * It can be due to application command or an invalid state. + */ +#define RTE_FLOW_CONNTRACK_PKT_STATE_DISABLED RTE_BIT32(3) +/** + * The packet contains some bad field(s) and cannot continue + * with the conntrack module checking. + */ +#define RTE_FLOW_CONNTRACK_PKT_STATE_BAD RTE_BIT32(4) + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_CONNTRACK + * + * Matches the state of a packet after it passed the connection tracking + * examination. The state is a bitmap of one RTE_FLOW_CONNTRACK_PKT_STATE* + * or a reasonable combination of these bits. + */ +struct rte_flow_item_conntrack { + uint32_t flags; +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_CONNTRACK. */ +#ifndef __cplusplus +static const struct rte_flow_item_conntrack rte_flow_item_conntrack_mask = { + .flags = 0xffffffff, +}; +#endif + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * Provides an ethdev port ID for use with the following items: + * RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR, + * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT. + */ +struct rte_flow_item_ethdev { + uint16_t port_id; /**< ethdev port ID */ +}; + +/** Default mask for items based on struct rte_flow_item_ethdev */ +#ifndef __cplusplus +static const struct rte_flow_item_ethdev rte_flow_item_ethdev_mask = { + .port_id = 0xffff, +}; +#endif + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_L2TPV2 + * + * Matches L2TPv2 Header + */ +struct rte_flow_item_l2tpv2 { + struct rte_l2tpv2_combined_msg_hdr hdr; +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV2. */ +#ifndef __cplusplus +static const struct rte_flow_item_l2tpv2 rte_flow_item_l2tpv2_mask = { + /* + * flags and version bit mask + * 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 + * T L x x S x O P x x x x V V V V + */ + .hdr = { + .common = { + .flags_version = RTE_BE16(0xcb0f), + }, + }, +}; +#endif + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_PPP + * + * Matches PPP Header + */ +struct rte_flow_item_ppp { + struct rte_ppp_hdr hdr; +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_PPP. */ +#ifndef __cplusplus +static const struct rte_flow_item_ppp rte_flow_item_ppp_mask = { + .hdr = { + .addr = 0xff, + .ctrl = 0xff, + .proto_id = RTE_BE16(0xffff), + } +}; +#endif + /** * Matching pattern item definition. * @@ -1775,6 +2008,177 @@ struct rte_flow_item { const void *mask; /**< Bit-mask applied to spec and last. */ }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_FLEX + * + * Matches a specified set of fields within the network protocol + * header. Each field is presented as set of bits with specified width, and + * bit offset from the header beginning. + * + * The pattern is concatenation of bit fields configured at item creation + * by rte_flow_flex_item_create(). At configuration the fields are presented + * by sample_data array. + * + * This type does not support ranges (struct rte_flow_item.last). + */ +struct rte_flow_item_flex { + struct rte_flow_item_flex_handle *handle; /**< Opaque item handle. */ + uint32_t length; /**< Pattern length in bytes. */ + const uint8_t *pattern; /**< Combined bitfields pattern to match. */ +}; +/** + * Field bit offset calculation mode. + */ +enum rte_flow_item_flex_field_mode { + /** + * Dummy field, used for byte boundary alignment in pattern. + * Pattern mask and data are ignored in the match. All configuration + * parameters besides field size are ignored. + */ + FIELD_MODE_DUMMY = 0, + /** + * Fixed offset field. The bit offset from header beginning + * is permanent and defined by field_base parameter. + */ + FIELD_MODE_FIXED, + /** + * The field bit offset is extracted from other header field (indirect + * offset field). The resulting field offset to match is calculated as: + * + * field_base + (*offset_base & offset_mask) << offset_shift + */ + FIELD_MODE_OFFSET, + /** + * The field bit offset is extracted from other header field (indirect + * offset field), the latter is considered as bitmask containing some + * number of one bits, the resulting field offset to match is + * calculated as: + * + * field_base + bitcount(*offset_base & offset_mask) << offset_shift + */ + FIELD_MODE_BITMASK, +}; + +/** + * Flex item field tunnel mode + */ +enum rte_flow_item_flex_tunnel_mode { + /** + * The protocol header can be present in the packet only once. + * No multiple flex item flow inclusions (for inner/outer) are allowed. + * No any relations with tunnel protocols are imposed. The drivers + * can optimize hardware resource usage to handle match on single flex + * item of specific type. + */ + FLEX_TUNNEL_MODE_SINGLE = 0, + /** + * Flex item presents outer header only. + */ + FLEX_TUNNEL_MODE_OUTER, + /** + * Flex item presents inner header only. + */ + FLEX_TUNNEL_MODE_INNER, + /** + * Flex item presents either inner or outer header. The driver + * handles as many multiple inners as hardware supports. + */ + FLEX_TUNNEL_MODE_MULTI, + /** + * Flex item presents tunnel protocol header. + */ + FLEX_TUNNEL_MODE_TUNNEL, +}; + +/** + * + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + */ +__extension__ +struct rte_flow_item_flex_field { + /** Defines how match field offset is calculated over the packet. */ + enum rte_flow_item_flex_field_mode field_mode; + uint32_t field_size; /**< Field size in bits. */ + int32_t field_base; /**< Field offset in bits. */ + uint32_t offset_base; /**< Indirect offset field offset in bits. */ + uint32_t offset_mask; /**< Indirect offset field bit mask. */ + int32_t offset_shift; /**< Indirect offset multiply factor. */ + uint32_t field_id:16; /**< Device hint, for multiple items in flow. */ + uint32_t reserved:16; /**< Reserved field. */ +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + */ +struct rte_flow_item_flex_link { + /** + * Preceding/following header. The item type must be always provided. + * For preceding one item must specify the header value/mask to match + * for the link be taken and start the flex item header parsing. + */ + struct rte_flow_item item; + /** + * Next field value to match to continue with one of the configured + * next protocols. + */ + uint32_t next; +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + */ +struct rte_flow_item_flex_conf { + /** + * Specifies the flex item and tunnel relations and tells the PMD + * whether flex item can be used for inner, outer or both headers, + * or whether flex item presents the tunnel protocol itself. + */ + enum rte_flow_item_flex_tunnel_mode tunnel; + /** + * The next header offset, it presents the network header size covered + * by the flex item and can be obtained with all supported offset + * calculating methods (fixed, dedicated field, bitmask, etc). + */ + struct rte_flow_item_flex_field next_header; + /** + * Specifies the next protocol field to match with link next protocol + * values and continue packet parsing with matching link. + */ + struct rte_flow_item_flex_field next_protocol; + /** + * The fields will be sampled and presented for explicit match + * with pattern in the rte_flow_flex_item. There can be multiple + * fields descriptors, the number should be specified by nb_samples. + */ + struct rte_flow_item_flex_field *sample_data; + /** Number of field descriptors in the sample_data array. */ + uint32_t nb_samples; + /** + * Input link defines the flex item relation with preceding + * header. It specified the preceding item type and provides pattern + * to match. The flex item will continue parsing and will provide the + * data to flow match in case if there is the match with one of input + * links. + */ + struct rte_flow_item_flex_link *input_link; + /** Number of link descriptors in the input link array. */ + uint32_t nb_inputs; + /** + * Output link defines the next protocol field value to match and + * the following protocol header to continue packet parsing. Also + * defines the tunnel-related behaviour. + */ + struct rte_flow_item_flex_link *output_link; + /** Number of link descriptors in the output link array. */ + uint32_t nb_outputs; +}; + /** * Action types. * @@ -1836,18 +2240,26 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_JUMP, /** - * Attaches an integer value to packets and sets PKT_RX_FDIR and - * PKT_RX_FDIR_ID mbuf flags. + * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and + * RTE_MBUF_F_RX_FDIR_ID mbuf flags. * * See struct rte_flow_action_mark. + * + * One should negotiate mark delivery from the NIC to the PMD. + * @see rte_eth_rx_metadata_negotiate() + * @see RTE_ETH_RX_METADATA_USER_MARK */ RTE_FLOW_ACTION_TYPE_MARK, /** * Flags packets. Similar to MARK without a specific value; only - * sets the PKT_RX_FDIR mbuf flag. + * sets the RTE_MBUF_F_RX_FDIR mbuf flag. * * No associated configuration structure. + * + * One should negotiate flag delivery from the NIC to the PMD. + * @see rte_eth_rx_metadata_negotiate() + * @see RTE_ETH_RX_METADATA_USER_FLAG */ RTE_FLOW_ACTION_TYPE_FLAG, @@ -1888,6 +2300,10 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_RSS, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * Directs matching traffic to the physical function (PF) of the * current device. * @@ -1896,6 +2312,10 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_PF, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * Directs matching traffic to a given virtual function of the * current device. * @@ -1904,6 +2324,10 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_VF, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * Directs packets to a given physical port index of the underlying * device. * @@ -1912,6 +2336,10 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_PHY_PORT, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * Directs matching traffic to a given DPDK port ID. * * See struct rte_flow_action_port_id. @@ -1935,6 +2363,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SECURITY, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the * OpenFlow Switch Specification. * @@ -1943,6 +2374,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Implements OFPAT_DEC_MPLS_TTL ("decrement MPLS TTL") as defined * by the OpenFlow Switch Specification. * @@ -1951,6 +2385,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_OF_DEC_MPLS_TTL, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow * Switch Specification. * @@ -1959,6 +2396,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Implements OFPAT_DEC_NW_TTL ("decrement IP TTL") as defined by * the OpenFlow Switch Specification. * @@ -1967,6 +2407,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_OF_DEC_NW_TTL, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Implements OFPAT_COPY_TTL_OUT ("copy TTL "outwards" -- from * next-to-outermost to outermost") as defined by the OpenFlow * Switch Specification. @@ -1976,6 +2419,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_OF_COPY_TTL_OUT, /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Implements OFPAT_COPY_TTL_IN ("copy TTL "inwards" -- from * outermost to next-to-outermost") as defined by the OpenFlow * Switch Specification. @@ -2001,7 +2447,7 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN, /** - * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN id") as + * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as * defined by the OpenFlow Switch Specification. * * See struct rte_flow_action_of_set_vlan_vid. @@ -2081,6 +2527,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_RAW_DECAP, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Modify IPv4 source address in the outermost IPv4 header. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4, @@ -2091,6 +2540,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Modify IPv4 destination address in the outermost IPv4 header. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4, @@ -2101,6 +2553,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_IPV4_DST, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Modify IPv6 source address in the outermost IPv6 header. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6, @@ -2111,6 +2566,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Modify IPv6 destination address in the outermost IPv6 header. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6, @@ -2121,6 +2579,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_IPV6_DST, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Modify source port number in the outermost TCP/UDP header. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP @@ -2132,6 +2593,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_TP_SRC, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Modify destination port number in the outermost TCP/UDP header. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP @@ -2154,6 +2618,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_MAC_SWAP, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Decrease TTL value directly * * No associated configuration structure. @@ -2161,6 +2628,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_DEC_TTL, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Set TTL value * * See struct rte_flow_action_set_ttl @@ -2168,6 +2638,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_TTL, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Set source MAC address from matched flow. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH, @@ -2178,6 +2651,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_MAC_SRC, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Set destination MAC address from matched flow. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH, @@ -2188,6 +2664,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_MAC_DST, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Increase sequence number in the outermost TCP header. * * Action configuration specifies the value to increase @@ -2202,6 +2681,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Decrease sequence number in the outermost TCP header. * * Action configuration specifies the value to decrease @@ -2216,6 +2698,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Increase acknowledgment number in the outermost TCP header. * * Action configuration specifies the value to increase @@ -2230,6 +2715,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_INC_TCP_ACK, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Decrease acknowledgment number in the outermost TCP header. * * Action configuration specifies the value to decrease @@ -2244,6 +2732,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Set Tag. * * Tag is for internal flow usage only and @@ -2254,6 +2745,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_TAG, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Set metadata on ingress or egress path. * * See struct rte_flow_action_set_meta. @@ -2261,6 +2755,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_META, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Modify IPv4 DSCP in the outermost IP header. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4, @@ -2271,6 +2768,9 @@ enum rte_flow_action_type { RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP, /** + * @warning This is a legacy action. + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * Modify IPv6 DSCP in the outermost IP header. * * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6, @@ -2328,13 +2828,45 @@ enum rte_flow_action_type { * or different ethdev ports. */ RTE_FLOW_ACTION_TYPE_INDIRECT, + + /** + * [META] + * + * Enable tracking a TCP connection state. + * + * @see struct rte_flow_action_conntrack. + */ + RTE_FLOW_ACTION_TYPE_CONNTRACK, + + /** + * Color the packet to reflect the meter color result. + * Set the meter color in the mbuf to the selected color. + * + * See struct rte_flow_action_meter_color. + */ + RTE_FLOW_ACTION_TYPE_METER_COLOR, + + /** + * At embedded switch level, sends matching traffic to the given ethdev. + * + * @see struct rte_flow_action_ethdev + */ + RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR, + + /** + * At embedded switch level, send matching traffic to + * the entity represented by the given ethdev. + * + * @see struct rte_flow_action_ethdev + */ + RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT, }; /** * RTE_FLOW_ACTION_TYPE_MARK * - * Attaches an integer value to packets and sets PKT_RX_FDIR and - * PKT_RX_FDIR_ID mbuf flags. + * Attaches an integer value to packets and sets RTE_MBUF_F_RX_FDIR and + * RTE_MBUF_F_RX_FDIR_ID mbuf flags. * * This value is arbitrary and application-defined. Maximum allowed value * depends on the underlying implementation. It is returned in the @@ -2385,8 +2917,8 @@ struct rte_flow_action_queue { struct rte_flow_action_age { uint32_t timeout:24; /**< Time in seconds. */ uint32_t reserved:8; /**< Reserved, must be zero. */ + /** The user flow context, NULL means the rte_flow pointer. */ void *context; - /**< The user flow context, NULL means the rte_flow pointer. */ }; /** @@ -2398,8 +2930,8 @@ struct rte_flow_action_age { struct rte_flow_query_age { uint32_t reserved:6; /**< Reserved, must be zero. */ uint32_t aged:1; /**< 1 if aging timeout expired, 0 otherwise. */ + /** sec_since_last_hit value is valid. */ uint32_t sec_since_last_hit_valid:1; - /**< sec_since_last_hit value is valid. */ uint32_t sec_since_last_hit:24; /**< Seconds since last traffic hit. */ }; @@ -2412,29 +2944,15 @@ struct rte_flow_query_age { * Adds a counter action to a matched flow. * * If more than one count action is specified in a single flow rule, then each - * action must specify a unique id. + * action must specify a unique ID. * * Counters can be retrieved and reset through ``rte_flow_query()``, see * ``struct rte_flow_query_count``. * - * @deprecated Shared attribute is deprecated, use generic - * RTE_FLOW_ACTION_TYPE_INDIRECT action. - * - * The shared flag indicates whether the counter is unique to the flow rule the - * action is specified with, or whether it is a shared counter. - * - * For a count action with the shared flag set, then then a global device - * namespace is assumed for the counter id, so that any matched flow rules using - * a count action with the same counter id on the same port will contribute to - * that counter. - * - * For ports within the same switch domain then the counter id namespace extends + * For ports within the same switch domain then the counter ID namespace extends * to all ports within that switch domain. */ struct rte_flow_action_count { - /** @deprecated Share counter ID with other flow rules. */ - uint32_t shared:1; - uint32_t reserved:31; /**< Reserved, must be zero. */ uint32_t id; /**< Counter ID. */ }; @@ -2512,7 +3030,7 @@ struct rte_flow_action_rss { * through. */ uint32_t level; - uint64_t types; /**< Specific RSS hash types (see ETH_RSS_*). */ + uint64_t types; /**< Specific RSS hash types (see RTE_ETH_RSS_*). */ uint32_t key_len; /**< Hash key length in bytes. */ uint32_t queue_num; /**< Number of entries in @p queue. */ const uint8_t *key; /**< Hash key. */ @@ -2520,6 +3038,10 @@ struct rte_flow_action_rss { }; /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ACTION_TYPE_VF * * Directs matching traffic to a given virtual function of the current @@ -2538,6 +3060,10 @@ struct rte_flow_action_vf { }; /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ACTION_TYPE_PHY_PORT * * Directs packets to a given physical port index of the underlying @@ -2552,6 +3078,10 @@ struct rte_flow_action_phy_port { }; /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR + * @see RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT + * * RTE_FLOW_ACTION_TYPE_PORT_ID * * Directs matching traffic to a given DPDK port ID. @@ -2611,6 +3141,9 @@ struct rte_flow_action_security { }; /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * RTE_FLOW_ACTION_TYPE_OF_SET_MPLS_TTL * * Implements OFPAT_SET_MPLS_TTL ("MPLS TTL") as defined by the OpenFlow @@ -2621,6 +3154,9 @@ struct rte_flow_action_of_set_mpls_ttl { }; /** + * @deprecated + * @see RTE_FLOW_ACTION_TYPE_MODIFY_FIELD + * * RTE_FLOW_ACTION_TYPE_OF_SET_NW_TTL * * Implements OFPAT_SET_NW_TTL ("IP TTL") as defined by the OpenFlow Switch @@ -2643,11 +3179,11 @@ struct rte_flow_action_of_push_vlan { /** * RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID * - * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN id") as defined by + * Implements OFPAT_SET_VLAN_VID ("set the 802.1q VLAN ID") as defined by * the OpenFlow Switch Specification. */ struct rte_flow_action_of_set_vlan_vid { - rte_be16_t vlan_vid; /**< VLAN id. */ + rte_be16_t vlan_vid; /**< VLAN ID. */ }; /** @@ -2879,10 +3415,10 @@ struct rte_flow_action_set_tag { * RTE_FLOW_ACTION_TYPE_SET_META * * Set metadata. Metadata set by mbuf metadata dynamic field with - * PKT_TX_DYNF_DATA flag on egress will be overridden by this action. On - * ingress, the metadata will be carried by mbuf metadata dynamic field - * with PKT_RX_DYNF_METADATA flag if set. The dynamic mbuf field must be - * registered in advance by rte_flow_dynf_metadata_register(). + * RTE_MBUF_DYNFLAG_TX_METADATA flag on egress will be overridden by this + * action. On ingress, the metadata will be carried by mbuf metadata dynamic + * field with RTE_MBUF_DYNFLAG_RX_METADATA flag if set. The dynamic mbuf field + * must be registered in advance by rte_flow_dynf_metadata_register(). * * Altering partial bits is supported with mask. For bits which have never * been set, unpredictable value will be seen depending on driver @@ -2926,6 +3462,179 @@ struct rte_flow_action_set_dscp { */ struct rte_flow_action_handle; +/** + * The state of a TCP connection. + */ +enum rte_flow_conntrack_state { + /** SYN-ACK packet was seen. */ + RTE_FLOW_CONNTRACK_STATE_SYN_RECV, + /** 3-way handshake was done. */ + RTE_FLOW_CONNTRACK_STATE_ESTABLISHED, + /** First FIN packet was received to close the connection. */ + RTE_FLOW_CONNTRACK_STATE_FIN_WAIT, + /** First FIN was ACKed. */ + RTE_FLOW_CONNTRACK_STATE_CLOSE_WAIT, + /** Second FIN was received, waiting for the last ACK. */ + RTE_FLOW_CONNTRACK_STATE_LAST_ACK, + /** Second FIN was ACKed, connection was closed. */ + RTE_FLOW_CONNTRACK_STATE_TIME_WAIT, +}; + +/** + * The last passed TCP packet flags of a connection. + */ +enum rte_flow_conntrack_tcp_last_index { + RTE_FLOW_CONNTRACK_FLAG_NONE = 0, /**< No Flag. */ + RTE_FLOW_CONNTRACK_FLAG_SYN = RTE_BIT32(0), /**< With SYN flag. */ + RTE_FLOW_CONNTRACK_FLAG_SYNACK = RTE_BIT32(1), /**< With SYNACK flag. */ + RTE_FLOW_CONNTRACK_FLAG_FIN = RTE_BIT32(2), /**< With FIN flag. */ + RTE_FLOW_CONNTRACK_FLAG_ACK = RTE_BIT32(3), /**< With ACK flag. */ + RTE_FLOW_CONNTRACK_FLAG_RST = RTE_BIT32(4), /**< With RST flag. */ +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * Configuration parameters for each direction of a TCP connection. + * All fields should be in host byte order. + * If needed, driver should convert all fields to network byte order + * if HW needs them in that way. + */ +struct rte_flow_tcp_dir_param { + /** TCP window scaling factor, 0xF to disable. */ + uint32_t scale:4; + /** The FIN was sent by this direction. */ + uint32_t close_initiated:1; + /** An ACK packet has been received by this side. */ + uint32_t last_ack_seen:1; + /** + * If set, it indicates that there is unacknowledged data for the + * packets sent from this direction. + */ + uint32_t data_unacked:1; + /** + * Maximal value of sequence + payload length in sent + * packets (next ACK from the opposite direction). + */ + uint32_t sent_end; + /** + * Maximal value of (ACK + window size) in received packet + length + * over sent packet (maximal sequence could be sent). + */ + uint32_t reply_end; + /** Maximal value of actual window size in sent packets. */ + uint32_t max_win; + /** Maximal value of ACK in sent packets. */ + uint32_t max_ack; +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_CONNTRACK + * + * Configuration and initial state for the connection tracking module. + * This structure could be used for both setting and query. + * All fields should be in host byte order. + */ +struct rte_flow_action_conntrack { + /** The peer port number, can be the same port. */ + uint16_t peer_port; + /** + * Direction of this connection when creating a flow rule, the + * value only affects the creation of subsequent flow rules. + */ + uint32_t is_original_dir:1; + /** + * Enable / disable the conntrack HW module. When disabled, the + * result will always be RTE_FLOW_CONNTRACK_FLAG_DISABLED. + * In this state the HW will act as passthrough. + * It only affects this conntrack object in the HW without any effect + * to the other objects. + */ + uint32_t enable:1; + /** At least one ack was seen after the connection was established. */ + uint32_t live_connection:1; + /** Enable selective ACK on this connection. */ + uint32_t selective_ack:1; + /** A challenge ack has passed. */ + uint32_t challenge_ack_passed:1; + /** + * 1: The last packet is seen from the original direction. + * 0: The last packet is seen from the reply direction. + */ + uint32_t last_direction:1; + /** No TCP check will be done except the state change. */ + uint32_t liberal_mode:1; + /** The current state of this connection. */ + enum rte_flow_conntrack_state state; + /** Scaling factor for maximal allowed ACK window. */ + uint8_t max_ack_window; + /** Maximal allowed number of retransmission times. */ + uint8_t retransmission_limit; + /** TCP parameters of the original direction. */ + struct rte_flow_tcp_dir_param original_dir; + /** TCP parameters of the reply direction. */ + struct rte_flow_tcp_dir_param reply_dir; + /** The window value of the last packet passed this conntrack. */ + uint16_t last_window; + enum rte_flow_conntrack_tcp_last_index last_index; + /** The sequence of the last packet passed this conntrack. */ + uint32_t last_seq; + /** The acknowledgment of the last packet passed this conntrack. */ + uint32_t last_ack; + /** + * The total value ACK + payload length of the last packet + * passed this conntrack. + */ + uint32_t last_end; +}; + +/** + * RTE_FLOW_ACTION_TYPE_CONNTRACK + * + * Wrapper structure for the context update interface. + * Ports cannot support updating, and the only valid solution is to + * destroy the old context and create a new one instead. + */ +struct rte_flow_modify_conntrack { + /** New connection tracking parameters to be updated. */ + struct rte_flow_action_conntrack new_ct; + /** The direction field will be updated. */ + uint32_t direction:1; + /** All the other fields except direction will be updated. */ + uint32_t state:1; + /** Reserved bits for the future usage. */ + uint32_t reserved:30; +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_METER_COLOR + * + * The meter color should be set in the packet meta-data + * (i.e. struct rte_mbuf::sched::color). + */ +struct rte_flow_action_meter_color { + enum rte_color color; /**< Packet color. */ +}; + +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * Provides an ethdev port ID for use with the following actions: + * RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR, + * RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT. + */ +struct rte_flow_action_ethdev { + uint16_t port_id; /**< ethdev port ID */ +}; + /** * Field IDs for MODIFY_FIELD action. */ @@ -2962,6 +3671,9 @@ enum rte_flow_field_id { }; /** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * * Field description for MODIFY_FIELD action. */ struct rte_flow_action_modify_data { @@ -2969,16 +3681,24 @@ struct rte_flow_action_modify_data { RTE_STD_C11 union { struct { - /**< Encapsulation level or tag index. */ + /** Encapsulation level or tag index. */ uint32_t level; - /**< Number of bits to skip from a field. */ + /** Number of bits to skip from a field. */ uint32_t offset; }; /** - * Immediate value for RTE_FLOW_FIELD_VALUE or - * memory address for RTE_FLOW_FIELD_POINTER. + * Immediate value for RTE_FLOW_FIELD_VALUE, presented in the + * same byte order and length as in relevant rte_flow_item_xxx. + * The immediate source bitfield offset is inherited from + * the destination's one. */ - uint64_t value; + uint8_t value[16]; + /** + * Memory address for RTE_FLOW_FIELD_POINTER, memory layout + * should be the same as for relevant field in the + * rte_flow_item_xxx structure. + */ + void *pvalue; }; }; @@ -2998,7 +3718,7 @@ enum rte_flow_modify_op { * RTE_FLOW_ACTION_TYPE_MODIFY_FIELD * * Modify a destination header field according to the specified - * operation. Another packet field can be used as a source as well + * operation. Another field of the packet can be used as a source as well * as tag, mark, metadata, immediate value or a pointer to it. */ struct rte_flow_action_modify_field { @@ -3019,8 +3739,12 @@ extern uint64_t rte_flow_dynf_metadata_mask; RTE_MBUF_DYNFIELD((m), rte_flow_dynf_metadata_offs, uint32_t *) /* Mbuf dynamic flags for metadata. */ -#define PKT_RX_DYNF_METADATA (rte_flow_dynf_metadata_mask) -#define PKT_TX_DYNF_METADATA (rte_flow_dynf_metadata_mask) +#define RTE_MBUF_DYNFLAG_RX_METADATA (rte_flow_dynf_metadata_mask) +#define PKT_RX_DYNF_METADATA RTE_DEPRECATED(PKT_RX_DYNF_METADATA) \ + RTE_MBUF_DYNFLAG_RX_METADATA +#define RTE_MBUF_DYNFLAG_TX_METADATA (rte_flow_dynf_metadata_mask) +#define PKT_TX_DYNF_METADATA RTE_DEPRECATED(PKT_TX_DYNF_METADATA) \ + RTE_MBUF_DYNFLAG_TX_METADATA __rte_experimental static inline uint32_t @@ -3036,7 +3760,7 @@ rte_flow_dynf_metadata_set(struct rte_mbuf *m, uint32_t v) *RTE_FLOW_DYNF_METADATA(m) = v; } -/* +/** * Definition of a single action. * * A list of actions is terminated by a END action. @@ -3074,8 +3798,8 @@ struct rte_flow; */ struct rte_flow_action_sample { uint32_t ratio; /**< packets sampled equals to '1/ratio'. */ + /** sub-action list specific for the sampling hit cases. */ const struct rte_flow_action *actions; - /**< sub-action list specific for the sampling hit cases. */ }; /** @@ -3102,6 +3826,7 @@ enum rte_flow_error_type { RTE_FLOW_ERROR_TYPE_ACTION_NUM, /**< Number of actions. */ RTE_FLOW_ERROR_TYPE_ACTION_CONF, /**< Action configuration. */ RTE_FLOW_ERROR_TYPE_ACTION, /**< Specific action. */ + RTE_FLOW_ERROR_TYPE_STATE, /**< Current device state. */ }; /** @@ -3307,7 +4032,7 @@ enum rte_flow_conv_op { * Perform verbose error reporting if not NULL. PMDs initialize this * structure in case of error only. * @return - * 0 on success, a nagative value otherwise. + * 0 on success, a negative value otherwise. */ __rte_experimental int @@ -3669,7 +4394,7 @@ rte_flow_conv(enum rte_flow_conv_op op, * * RTE_ETH_EVENT_FLOW_AGED event will be triggered when at least one new aged * out flow was detected after the last call to rte_flow_get_aged_flows. - * This function can be called to get the aged flows usynchronously from the + * This function can be called to get the aged flows asynchronously from the * event callback or synchronously regardless the event. * This is not safe to call rte_flow_get_aged_flows function with other flow * functions from multiple threads simultaneously. @@ -3707,10 +4432,10 @@ struct rte_flow_indir_action_conf { * Action should be valid at least for one flow direction, * otherwise it is invalid for both ingress and egress rules. */ + /** Action valid for rules applied to ingress traffic. */ uint32_t ingress:1; - /**< Action valid for rules applied to ingress traffic. */ + /** Action valid for rules applied to egress traffic. */ uint32_t egress:1; - /**< Action valid for rules applied to egress traffic. */ /** * When set to 1, indicates that the action is valid for * transfer traffic; otherwise, for non-transfer traffic. @@ -3889,17 +4614,17 @@ struct rte_flow_tunnel { /** * Indicate that the packet has a tunnel. */ -#define RTE_FLOW_RESTORE_INFO_TUNNEL (1ULL << 0) +#define RTE_FLOW_RESTORE_INFO_TUNNEL RTE_BIT64(0) /** * Indicate that the packet has a non decapsulated tunnel header. */ -#define RTE_FLOW_RESTORE_INFO_ENCAPSULATED (1ULL << 1) +#define RTE_FLOW_RESTORE_INFO_ENCAPSULATED RTE_BIT64(1) /** * Indicate that the packet has a group_id. */ -#define RTE_FLOW_RESTORE_INFO_GROUP_ID (1ULL << 2) +#define RTE_FLOW_RESTORE_INFO_GROUP_ID RTE_BIT64(2) /** * Restore information structure to communicate the current packet processing @@ -3981,6 +4706,10 @@ rte_flow_tunnel_match(uint16_t port_id, /** * Populate the current packet processing state, if exists, for the given mbuf. * + * One should negotiate tunnel metadata delivery from the NIC to the HW. + * @see rte_eth_rx_metadata_negotiate() + * @see RTE_ETH_RX_METADATA_TUNNEL_ID + * * @param port_id * Port identifier of Ethernet device. * @param[in] m @@ -4046,6 +4775,84 @@ rte_flow_tunnel_item_release(uint16_t port_id, struct rte_flow_item *items, uint32_t num_of_items, struct rte_flow_error *error); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Get a proxy port to manage "transfer" flows. + * + * Managing "transfer" flows requires that the user communicate them + * via a port which has the privilege to control the embedded switch. + * For some vendors, all ports in a given switching domain have + * this privilege. For other vendors, it's only one port. + * + * This API indicates such a privileged port (a "proxy") + * for a given port in the same switching domain. + * + * @note + * If the PMD serving @p port_id doesn't have the corresponding method + * implemented, the API will return @p port_id via @p proxy_port_id. + * + * @param port_id + * Indicates the port to get a "proxy" for + * @param[out] proxy_port_id + * Indicates the "proxy" port + * @param[out] error + * If not NULL, allows the PMD to provide verbose report in case of error + * + * @return + * 0 on success, a negative error code otherwise + */ +__rte_experimental +int +rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id, + struct rte_flow_error *error); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Create the flex item with specified configuration over + * the Ethernet device. + * + * @param port_id + * Port identifier of Ethernet device. + * @param[in] conf + * Item configuration. + * @param[out] error + * Perform verbose error reporting if not NULL. PMDs initialize this + * structure in case of error only. + * + * @return + * Non-NULL opaque pointer on success, NULL otherwise and rte_errno is set. + */ +__rte_experimental +struct rte_flow_item_flex_handle * +rte_flow_flex_item_create(uint16_t port_id, + const struct rte_flow_item_flex_conf *conf, + struct rte_flow_error *error); + +/** + * Release the flex item on the specified Ethernet device. + * + * @param port_id + * Port identifier of Ethernet device. + * @param[in] handle + * Handle of the item existing on the specified device. + * @param[out] error + * Perform verbose error reporting if not NULL. PMDs initialize this + * structure in case of error only. + * + * @return + * 0 on success, a negative errno value otherwise and rte_errno is set. + */ +__rte_experimental +int +rte_flow_flex_item_release(uint16_t port_id, + const struct rte_flow_item_flex_handle *handle, + struct rte_flow_error *error); + #ifdef __cplusplus } #endif