From patchwork Fri Mar 12 09:31:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 88997 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 7431FA0547; Fri, 12 Mar 2021 10:31:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E44716084D; Fri, 12 Mar 2021 10:31:51 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 593A01607ED 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 0DC0D7F540; Fri, 12 Mar 2021 12:31:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 0DC0D7F540 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1615541509; bh=FamZGMlRHqddOq750auHdvKrK0nFyaJ91v6ar4PfG5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FO3mAx5PdHnKlleNux3a4UWkIeVSTJhiBql5ScjdM1kPvlacDWVeMaEtcS3VjJax3 Nws8qYCmTBP0gD+A11XzENv6klZ9dO/jnCwYrVHugxVYwO5eu0G4vkOqxCsI5oIPve cA8Mah7QgbiAhagsAXrdpdyH4Dk2O5KBsCI2+NKE= 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:35 +0300 Message-Id: <20210312093143.28186-2-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 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 Acked-by: Ori Kam --- 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