From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 57EECA04F0; Tue, 10 Dec 2019 10:27:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A93B01B13C; Tue, 10 Dec 2019 10:27:46 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 53D4037A2 for ; Tue, 10 Dec 2019 10:27:45 +0100 (CET) From: Suanming Mou To: Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Cc: dev@dpdk.org, shahafs@mellanox.com, orika@mellanox.com, matan@mellanox.com, viacheslavo@mellanox.com Date: Tue, 10 Dec 2019 11:27:12 +0200 Message-Id: <1575970038-14448-1-git-send-email-suanmingm@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1575955386-6672-1-git-send-email-suanmingm@mellanox.com> References: <1575955386-6672-1-git-send-email-suanmingm@mellanox.com> Subject: [dpdk-dev] [RFC v2] ethdev: add IPv4/IPv6 DSCP rewrite action 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" For some overlay network, such as VXLAN, the DSCP field in the new outer IP header after VXLAN decapsulation may need to be updated accordingly. This commit introduce the DSCP modify action for IPv4 and IPv6. Signed-off-by: Suanming Mou Acked-by: Andrew Rybchenko --- v2: * Add space to IPv4/6 DSCP. * Fix typo. --- doc/guides/prog_guide/rte_flow.rst | 40 ++++++++++++++++++++++++++++++++++++++ lib/librte_ethdev/rte_flow.h | 31 +++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index a254c81..c0b6a15 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -2558,6 +2558,46 @@ the other path depending on HW capability. | ``mask`` | bit-mask applies to "data" | +----------+----------------------------+ +Action: ``SET_IPV4_DSCP`` +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Set IPv4 DSCP. + +Modify DSCP in IPv4 header. + +It must be used with RTE_FLOW_ITEM_TYPE_IPV4 in pattern. +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. + +.. _table_rte_flow_action_set_ipv4_dscp: + +.. table:: SET_IPV4_DSCP + + +-----------+---------------------------------+ + | Field | Value | + +===========+=================================+ + | ``dscp`` | DSCP in low 6 bits, rest ignore | + +-----------+---------------------------------+ + +Action: ``SET_IPV6_DSCP`` +^^^^^^^^^^^^^^^^^^^^^^^^ + +Set IPv6 DSCP. + +Modify DSCP in IPv6 header. + +It must be used with RTE_FLOW_ITEM_TYPE_IPV6 in pattern. +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. + +.. _table_rte_flow_action_set_ipv6_dscp: + +.. table:: SET_IPV6_DSCP + + +-----------+---------------------------------+ + | Field | Value | + +===========+=================================+ + | ``dscp`` | DSCP in low 6 bits, rest ignore | + +-----------+---------------------------------+ + Negative types ~~~~~~~~~~~~~~ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 452d359..76bf080 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -2004,6 +2004,26 @@ enum rte_flow_action_type { * See struct rte_flow_action_set_meta. */ RTE_FLOW_ACTION_TYPE_SET_META, + + /** + * Modify IPv4 DSCP in the outermost IP header. + * + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4, + * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error. + * + * See struct rte_flow_action_set_dscp. + */ + RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP, + + /** + * Modify IPv6 DSCP in the outermost IP header. + * + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6, + * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error. + * + * See struct rte_flow_action_set_dscp. + */ + RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP, }; /** @@ -2530,6 +2550,17 @@ struct rte_flow_action_set_meta { uint32_t mask; }; +/** + * RTE_FLOW_ACTION_TYPE_SET_IPV4_DSCP + * RTE_FLOW_ACTION_TYPE_SET_IPV6_DSCP + * + * Set the DSCP value for IPv4/IPv6 header. + * DSCP in low 6 bits, rest ignored. + */ +struct rte_flow_action_set_dscp { + uint8_t dscp; +}; + /* Mbuf dynamic field offset for metadata. */ extern int rte_flow_dynf_metadata_offs; -- 1.8.3.1