From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7EEAA09FF; Tue, 5 Jan 2021 23:16:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 45239160831; Tue, 5 Jan 2021 23:16:44 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id 4785516081E for ; Tue, 5 Jan 2021 23:16:42 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id E533F5C010F; Tue, 5 Jan 2021 17:16:40 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 05 Jan 2021 17:16:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm3; bh= gYC0kdefmy6RD+byq3F+JxW/cxClagL16k2QIfpKKYg=; b=enDIRHXCZOynC8aQ Ahww6ArhmkfxlNDJcbTSFM6ycBI0BL03zrOnLcWxO96cqcAKfvcfRxVo2IiEkuJX bXYKH/Yyl36x1iURhYr/P0rhxSS/h1pnE4tkM0Qb0jAu113NSeQVjTCLqDmzdZmM Eyapsmr7dhPdl3CkE03a4VOO1JDYydvqOHaU4Q7Eg7iJhL6xbAnH6QNRwNuURX8D +yyq36rQUpBqtQVC1Azz0RMqIgQzsWT9YkXoOzDQ4JBIbfdIO5UOb6pdhGtimAh+ kq/v/LG5foZoVRQYPxt+oq0OssK5wZVxpu4Xi58EgCcAYfigkVtQ+LxC/hVK9ITl AL790g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=gYC0kdefmy6RD+byq3F+JxW/cxClagL16k2QIfpKK Yg=; b=eTHEK84Mi9aWb/D2lLkqwdNoUXJKevGjZ+SNGInYRNKLeLf1WfGc34xC3 JUBhJlosHyQ+Si5UQLFKI0xUwNhlG34MqQiK1xT+fL5uRsTJLofEbnbbBuQqUUlq 6NrPRLem6XU8nVXsUoyVhqqv4ey3MqxLMfbAN9+0legAptN+49cYlLqJLBdOp/3N hMZIpbWWk+4btca3NXt54HROtuL70FXsYnvu6RGmNTRMl1lzvmUNV5D6OeDRP+KS ZkiPs0xGXaa41Z+edsJhhwnl4WcKwRYw50pdF5aLJJmLOZNqv09Fkv6a9mnFKNSp NsVBoXXWpzLxua/ke5Dhb8aGnLxVg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdefjedguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdej ueeiiedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 6B7D5240057; Tue, 5 Jan 2021 17:16:39 -0500 (EST) From: Thomas Monjalon To: Alexander Kozyrev Cc: dev@dpdk.org, viacheslavo@nvidia.com, orika@nvidia.com, ferruh.yigit@intel.com, andrew.rybchenko@oktetlabs.ru Date: Tue, 05 Jan 2021 23:16:38 +0100 Message-ID: <69996023.yYu3UIiVKq@thomas> In-Reply-To: <20201218013129.25186-1-akozyrev@nvidia.com> References: <20201218013129.25186-1-akozyrev@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [RFC] ethdev: introduce copy_field rte flow action 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" 18/12/2020 02:31, Alexander Kozyrev: > RTE Flows API lacks the ability to save an arbitrary header field in > order to use it later for advanced packet manipulations. Examples > include the usage of VxLAN ID after the packet is decapsulated or > storing this ID inside the packet payload itself or swapping an > arbitrary inner and outer packet fields. > > The idea is to allow a copy of a specified number of bits form any > packet header field into another header field: > RTE_FLOW_ACTION_TYPE_COPY_FIELD with the structure defined below. > > struct rte_flow_action_copy_field { > struct rte_flow_action_copy_data dest; > struct rte_flow_action_copy_data src; > uint16_t width; > }; > > Arbitrary header field (as well as mark, metadata or tag values) can be > used as both source and destination fields. This way we can save an > arbitrary header field by copying its value to a tag/mark/metadata or > copy it into another header field directly. tag/mark/metadata can also > be used as a value to be stored in an arbitrary packet header field. > > struct rte_flow_action_copy_data { > enum rte_flow_field_id field; > uint16_t index; > uint16_t offset; > }; > > The rte_flow_field_id specifies the particular packet field (or > tag/mark/metadata) to be used as a copy source or destination. > The index gives access to inner packet headers or elements in the tags > array. The offset allows to copy a packet field value into the payload. So index is in reality the layer? How is it numbered exactly? What is the field id if an offset is given? Can we say that a field id can always be replaced by an offset? > It is proposed to implement the "set copy_field" command to store all You are talking about testpmd here? It looks unrelated to this patch and not sure it helps understanding. > the required parameters and then to use this template by specifying the > index of the needed copy action. For example, to modify the GTP tunnel > ID after the packet is encapsulated following testpmd rules are used: > > set copy_field width 32 src field tag index 1 offset 0 > dst field teid index 0 offset 0 > flow create 0 ingress pattern ... / end > raw_decap index 1 / raw_encap index 2 / > copy_field index 1 / end > > A more generic mechanism to overwrite an arbitrary header field may be > introduced to the RTE flows implementation later: > RTE_FLOW_ACTION_TYPE_SET_FIELD with the structure defined below. > > struct rte_flow_action_copy_field { > struct rte_flow_action_copy_data dest; > uint8_t *data; > uint16_t width; > }; > > This way we can have the generic way to specify an immediate value and > use it as data for any packet header field instead of having separate > RTE Flow action for each of the packet fields. Deprecation notice may > be issued to RTE_FLOW_ACTION_TYPE_SET_XXX actions after the unified > method of setting a value to any packet field is implemented. Yes having a single action for setting any field looks to be a good idea. > Signed-off-by: Alexander Kozyrev > --- > lib/librte_ethdev/rte_flow.c | 1 + We are very close to the -rc1 date and implemention is missing. Please update. > lib/librte_ethdev/rte_flow.h | 59 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 60 insertions(+) [...] > +enum rte_flow_field_id { > + RTE_FLOW_FIELD_NONE = 0, > + RTE_FLOW_FIELD_MAC_DST, > + RTE_FLOW_FIELD_MAC_SRC, > + RTE_FLOW_FIELD_VLAN_TYPE, > + RTE_FLOW_FIELD_VLAN_ID, > + RTE_FLOW_FIELD_MAC_TYPE, > + RTE_FLOW_FIELD_IPV4_DSCP, > + RTE_FLOW_FIELD_IPV4_TTL, > + RTE_FLOW_FIELD_IPV4_SRC, > + RTE_FLOW_FIELD_IPV4_DST, > + RTE_FLOW_FIELD_IPV6_HOPLIMIT, > + RTE_FLOW_FIELD_IPV6_SRC, > + RTE_FLOW_FIELD_IPV6_DST, > + RTE_FLOW_FIELD_TCP_PORT_SRC, > + RTE_FLOW_FIELD_TCP_PORT_DST, > + RTE_FLOW_FIELD_TCP_SEQ_NUM, > + RTE_FLOW_FIELD_TCP_ACK_NUM, > + RTE_FLOW_FIELD_TCP_FLAGS, > + RTE_FLOW_FIELD_UDP_PORT_SRC, > + RTE_FLOW_FIELD_UDP_PORT_DST, > + RTE_FLOW_FIELD_VXLAN_VNI, > + RTE_FLOW_FIELD_GENEVE_VNI, > + RTE_FLOW_FIELD_GTP_TEID, > + RTE_FLOW_FIELD_TAG, > + RTE_FLOW_FIELD_MARK, > + RTE_FLOW_FIELD_META, > +}; I don't really like having to list all fields of the world, but it's probably better than the current situation of creating a new action for each field.