From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 21CF3A0096 for ; Mon, 3 Jun 2019 23:32:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BFAD31B9B8; Mon, 3 Jun 2019 23:32:51 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 59A1F1B9B1 for ; Mon, 3 Jun 2019 23:32:50 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 4 Jun 2019 00:32:49 +0300 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x53LWeDF020818; Tue, 4 Jun 2019 00:32:47 +0300 From: Yongseok Koh To: shahafs@mellanox.com, thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com, adrien.mazarguil@6wind.com, olivier.matz@6wind.com Cc: dev@dpdk.org Date: Mon, 3 Jun 2019 14:32:31 -0700 Message-Id: <20190603213231.27020-3-yskoh@mellanox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190603213231.27020-1-yskoh@mellanox.com> References: <20190603213231.27020-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC 3/3] ethdev: add flow tag X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" A tag is a transient data which can be used during flow match. This can be used to store match result from a previous table so that the same pattern need not be matched again on the next table. Even if outer header is decapsulated on the previous match, the match result can be kept. Some device expose internal registers of its flow processing pipeline and those registers are quite useful for stateful connection tracking as it keeps status of flow matching. Multiple tags are supported by specifying index. Example testpmd commands are: flow create 0 ingress pattern ... / end actions set_tag index 2 value 0xaa00bb mask 0xffff00ff / set_tag index 3 value 0x123456 mask 0xffffff / vxlan_decap / jump group 1 / end flow create 0 ingress pattern ... / end actions set_tag index 2 value 0xcc00 mask 0xff00 / set_tag index 3 value 0x123456 mask 0xffffff / vxlan_decap / jump group 1 / end flow create 0 ingress group 1 pattern tag index is 2 value spec 0xaa00bb value mask 0xffff00ff / eth ... / end actions ... jump group 2 / end flow create 0 ingress group 1 pattern tag index is 2 value spec 0xcc00 value mask 0xff00 / tag index is 3 value spec 0x123456 value mask 0xffffff / eth ... / end actions ... / end flow create 0 ingress group 2 pattern tag index is 3 value spec 0x123456 value mask 0xffffff / eth ... / end actions ... / end Signed-off-by: Yongseok Koh --- doc/guides/prog_guide/rte_flow.rst | 50 +++++++++++++++++++++++++++ lib/librte_ethdev/rte_flow.h | 54 ++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 2907edfff4..f6ef4305b4 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -684,6 +684,34 @@ field with PKT_RX_METADATA flag. | ``mask`` | ``data`` | bit-mask applies to "spec" and "last" | +----------+----------+---------------------------------------+ +Item: ``TAG`` +^^^^^^^^^^^^^ + +Matches tag item set by other flows. Multiple tags are supported by specifying +``index``. + +- Default ``mask`` matches the specified tag value and index. + +.. _table_rte_flow_item_tag: + +.. table:: TAG + + +----------+----------+----------------------------------------+ + | Field | Subfield | Value | + +==========+===========+=======================================+ + | ``spec`` | ``data`` | 32 bit flow tag value | + | +-----------+---------------------------------------+ + | | ``index`` | index of flow tag | + +----------+-----------+---------------------------------------+ + | ``last`` | ``data`` | upper range value | + | +-----------+ | + | | ``index`` | | + +----------+-----------+---------------------------------------+ + | ``mask`` | ``data`` | bit-mask applies to "spec" and "last" | + | +-----------+ | + | | ``index`` | | + +----------+-----------+---------------------------------------+ + Data matching item types ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2397,6 +2425,28 @@ the other path depending on HW capability. | ``mask`` | bit-mask applies to "data" | +----------+----------------------------+ +Action: ``SET_TAG`` +^^^^^^^^^^^^^^^^^^^ + +Set Tag. + +Tag is a transient data used during flow matching. This is not delivered to +application. Multiple tags are supported by specifying index. + +.. _table_rte_flow_action_set_tag: + +.. table:: SET_TAG + + +-----------+----------------------------+ + | Field | Value | + +===========+============================+ + | ``data`` | 32 bit tag value | + +-----------+----------------------------+ + | ``mask`` | bit-mask applies to "data" | + +-----------+----------------------------+ + | ``index`` | index of tag to set | + +-----------+----------------------------+ + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index d811f8a06e..5ee2bc95c6 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -422,6 +422,15 @@ enum rte_flow_item_type { * See struct rte_flow_item_meta. */ RTE_FLOW_ITEM_TYPE_META, + + /** + * [META] + * + * Matches a tag value. + * + * See struct rte_flow_item_tag. + */ + RTE_FLOW_ITEM_TYPE_TAG, }; /** @@ -1187,6 +1196,27 @@ static const struct rte_flow_item_meta rte_flow_item_meta_mask = { }; #endif +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ITEM_TYPE_TAG + * + * Matches a specified tag value at the specified index. + */ +struct rte_flow_item_tag { + uint32_t data; + uint8_t index; +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_TAG. */ +#ifndef __cplusplus +static const struct rte_flow_item_tag rte_flow_item_rx_meta_mask = { + .data = 0xffffffff, + .index = 0xff, +}; +#endif + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice @@ -1672,6 +1702,15 @@ enum rte_flow_action_type { * See struct rte_flow_action_set_meta. */ RTE_FLOW_ACTION_TYPE_SET_META, + + /** + * Set Tag. + * + * Tag is not delivered to application. + * + * See struct rte_flow_action_set_tag. + */ + RTE_FLOW_ACTION_TYPE_SET_TAG, }; /** @@ -2192,6 +2231,21 @@ struct rte_flow_action_set_meta { rte_be32_t mask; }; +/** + * @warning + * @b EXPERIMENTAL: this structure may change without prior notice + * + * RTE_FLOW_ACTION_TYPE_SET_TAG + * + * Set a tag which is a transient data used during flow matching. This is not + * delivered to application. Multiple tags are supported by specifying index. + */ +struct rte_flow_action_set_tag { + uint32_t data; + uint32_t mask; + uint8_t index; +}; + /* * Definition of a single action. * -- 2.21.0