From patchwork Fri Mar 12 11:07: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: 89007 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 75343A0547; Fri, 12 Mar 2021 12:07:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0592016087A; Fri, 12 Mar 2021 12:07:50 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 9CF5D406FF for ; Fri, 12 Mar 2021 12:07:47 +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 408E27F578; Fri, 12 Mar 2021 14:07:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 408E27F578 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1615547267; bh=FamZGMlRHqddOq750auHdvKrK0nFyaJ91v6ar4PfG5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bXc8FYadjekjzYhjGqCaathGNGGhgeztaUX0vuzqNZ2faf3C/rbghfCUqB86CjJ3z sccO7EDy2aIJCapNYM6jLbyOzLk4AmBoLKZ0FFSRRbZY2KU/D1H3e8LtuqWAiTVstm yk7ZDdw8hmpqml/n+9vxd1hKKdfVZ+z02C9R6QoE= From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Andy Moreton , Ori Kam , Thomas Monjalon , Ferruh Yigit Date: Fri, 12 Mar 2021 14:07:37 +0300 Message-Id: <20210312110745.31721-2-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210312110745.31721-1-ivan.malov@oktetlabs.ru> References: <20210312093143.28186-1-ivan.malov@oktetlabs.ru> <20210312110745.31721-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 02/10] ethdev: reuse header definition in flow pattern item VLAN 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. 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 --- 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