From: Ivan Malov Date: Fri, 12 Mar 2021 11:07:39 +0000 (+0300) Subject: ethdev: reuse VXLAN header definition in flow item X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=43af98e687cf;p=dpdk.git ethdev: reuse VXLAN header definition in flow item One ought to reuse existing header structs in flow items. 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 b9b349669d..6cc57136ac 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -955,17 +956,27 @@ static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = { * * Matches a VXLAN header (RFC 7348). */ +RTE_STD_C11 struct rte_flow_item_vxlan { - uint8_t flags; /**< Normally 0x08 (I flag). */ - uint8_t rsvd0[3]; /**< Reserved, normally 0x000000. */ - uint8_t vni[3]; /**< VXLAN identifier. */ - uint8_t rsvd1; /**< Reserved, normally 0x00. */ + union { + struct { + /* + * These fields are retained for compatibility. + * Please switch to the new header field below. + */ + uint8_t flags; /**< Normally 0x08 (I flag). */ + uint8_t rsvd0[3]; /**< Reserved, normally 0x000000. */ + uint8_t vni[3]; /**< VXLAN identifier. */ + uint8_t rsvd1; /**< Reserved, normally 0x00. */ + }; + struct rte_vxlan_hdr hdr; + }; }; /** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN. */ #ifndef __cplusplus static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = { - .vni = "\xff\xff\xff", + .hdr.vx_vni = RTE_BE32(__builtin_constant_p(0xffffff << 8)), }; #endif