Hi Ivan, > -----Original Message----- > From: Ivan Malov <ivan.ma...@oktetlabs.ru> > Sent: Friday, March 12, 2021 11:32 AM > > 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 <ivan.ma...@oktetlabs.ru> > Reviewed-by: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru> > Reviewed-by: Andy Moreton <amore...@xilinx.com> > --- > lib/librte_ethdev/rte_flow.h | 22 ++++++++++++++++------ > 1 file changed, 16 insertions(+), 6 deletions(-) > > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index 96fd93ee1..b9b349669 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 > > -- > 2.20.1
Acked-by: Ori Kam <or...@nvidia.com> Best, Ori