From: Ivan Malov Date: Fri, 12 Mar 2021 11:07:37 +0000 (+0300) Subject: ethdev: reuse VLAN header definition in flow item X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a56a262e3408;p=dpdk.git ethdev: reuse VLAN header definition in flow item One ought to reuse existing header structs in flow items. This particular item contains non-header fields, so it's important to keep the header fields in a separate struct. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko Reviewed-by: Andy Moreton Reviewed-by: Ferruh Yigit --- diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 96fd93ee10..b9b349669d 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -778,13 +778,23 @@ static const struct rte_flow_item_eth rte_flow_item_eth_mask = { * If a @p VLAN item is present in the pattern, then only tagged packets will * match the pattern. * The field @p has_more_vlan can be used to match any type of tagged packets, - * instead of using the @p inner_type field. - * If the @p inner_type and @p has_more_vlan fields are not specified, + * instead of using the @p eth_proto field of @p hdr. + * If the @p eth_proto of @p hdr and @p has_more_vlan fields are not specified, * then any tagged packets will match the pattern. */ +RTE_STD_C11 struct rte_flow_item_vlan { - rte_be16_t tci; /**< Tag control information. */ - rte_be16_t inner_type; /**< Inner EtherType or TPID. */ + union { + struct { + /* + * These fields are retained for compatibility. + * Please switch to the new header field below. + */ + rte_be16_t tci; /**< Tag control information. */ + rte_be16_t inner_type; /**< Inner EtherType or TPID. */ + }; + struct rte_vlan_hdr hdr; + }; 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. */ @@ -793,8 +803,8 @@ struct rte_flow_item_vlan { /** Default mask for RTE_FLOW_ITEM_TYPE_VLAN. */ #ifndef __cplusplus static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { - .tci = RTE_BE16(0x0fff), - .inner_type = RTE_BE16(0x0000), + .hdr.vlan_tci = RTE_BE16(0x0fff), + .hdr.eth_proto = RTE_BE16(0x0000), }; #endif