From patchwork Fri Mar 12 09:31:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 88999 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A0114A0547; Fri, 12 Mar 2021 10:32:10 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 049FE160867; Fri, 12 Mar 2021 10:31:54 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id CB8CB1607ED for ; Fri, 12 Mar 2021 10:31:49 +0100 (CET) Received: from localhost.localdomain (unknown [188.242.7.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 89E007F589; Fri, 12 Mar 2021 12:31:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 89E007F589 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1615541509; bh=eYwOpT2ykv6yFIDdbERLa5d1DceF+zGU4Rd9V88f1Jw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GZyLCZU92GApMki9h109NgELEXnMpx30mVyH6R3MqIiKArah/9tGpaSrOrU8ACBsQ a76Wgn9G89oEVExy3XZxALJPTBnjeJXF4oRHsdYGziUj8F4UwU53jj1IsZsFf+AIF/ ZxCua5baeGCgLVJ+6T4U1dU3gGn4iE0iBf/AQqHU= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Andy Moreton , Ori Kam , Thomas Monjalon , Ferruh Yigit Date: Fri, 12 Mar 2021 12:31:37 +0300 Message-Id: <20210312093143.28186-4-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210312093143.28186-1-ivan.malov@oktetlabs.ru> References: <20210312093143.28186-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 04/10] ethdev: reuse header definition in flow pattern item VXLAN X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" One ought to reuse existing header structs in flow items. Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- lib/librte_ethdev/rte_flow.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index b9b349669..56c97829c 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 @@ -954,18 +955,31 @@ static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = { * RTE_FLOW_ITEM_TYPE_VXLAN. * * Matches a VXLAN header (RFC 7348). + * + * Fields @p flags, @p rsvd0, @p vni and @rsvd1 are left here for compatibility. + * Consumers of this item definition are encouraged to use field @p hdr instead. */ +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