From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6C8E8A00BE for ; Tue, 15 Mar 2022 14:32:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5BEAE4068C; Tue, 15 Mar 2022 14:32:39 +0100 (CET) Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by mails.dpdk.org (Postfix) with ESMTP id 152B74068C for ; Tue, 15 Mar 2022 14:32:38 +0100 (CET) Received: by mail-ed1-f47.google.com with SMTP id t1so23996939edc.3 for ; Tue, 15 Mar 2022 06:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+//6DYT06jAbze3gU9yxPYWW3ENPqR5Q0cYxiRu+9OU=; b=lxXTU5snkqX/kEObVFcCO7eLVT7rzOWm4LETWSGvBmYSULq+bjlxK1kVRVfxNOIN6b XcDOmVPUOET/9FJgC9gqJHb5ZgD6dEJPHTBZyd2Q8y/1qrlUuDk2ppoQCNBrRDgOYFxd NWmm5mxwbwgrWRO22ObjG6iqwQ+pHRCnX6lsL2O8ZiGVTfB1WJhfyVlFFXi1EiTx7JI0 sDjUuZjOOgxM99ku7naM/IXD2jwa9hphDWgj++lecMGPIptGqL8y+oJOElelPJCuzJNF q6jq6lA5sB/GoGox78MXmVGAKjWn5i5xQk2Jla2yS7eEsoqaKKc01YUqovSn7r+WN5QJ VjbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+//6DYT06jAbze3gU9yxPYWW3ENPqR5Q0cYxiRu+9OU=; b=WFpS1tqTePfSLuMQwii0l/P9YMgXI2n8NIHCqS668auSXhoMWCw+Zn9Xed9pGUvLfM V+hACOSuKBLdeUM5E9hqIoYX6/3FMYrcadoULS/vRltyv+FLnyDuVleXmQmVV720tnXz gqk8/2e6bvxcznf4EaKnXSVJSEjwKPgdnoHeDtTYtOjhl+s1zUQeSD+dmLPw1NTT6V35 S+vXE5ZphZ4Cd+STL7eOFCtGc2+xcdiLCc7uZjmM+sewUR0EQMLYlFME2mWdSSpyZoj9 WTNquy+We7VDW/xrpUdr+dr/s4yRBxpIP/T3CMGeDM1j66l69tm3h8D4rSU5fWis6faM tN9w== X-Gm-Message-State: AOAM5338jBRdaitvPjD+Zkqk1SNCNDxc5qwHdwJHItFqhApc+QEShgx/ Feboj0n4OP3uqwVZqfIpbTo2epkWQ4o= X-Google-Smtp-Source: ABdhPJz24oEnDqR0PLtP9eXmsqZ6h/D2HBm7NxHT2AkW0th5OvySNyiFHpMGSa8XNSAwhw2tisyKlQ== X-Received: by 2002:aa7:c551:0:b0:415:a2d0:71a6 with SMTP id s17-20020aa7c551000000b00415a2d071a6mr25098268edr.143.1647351157694; Tue, 15 Mar 2022 06:32:37 -0700 (PDT) Received: from localhost ([2a01:4b00:f41a:3600:360b:9754:2e3a:c344]) by smtp.gmail.com with ESMTPSA id 20-20020a17090601d400b006caff964e30sm8268382ejj.19.2022.03.15.06.32.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Mar 2022 06:32:37 -0700 (PDT) From: luca.boccassi@gmail.com To: Jiawei Wang Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix sample flow action on trusted device' has been queued to stable release 20.11.5 Date: Tue, 15 Mar 2022 13:32:26 +0000 Message-Id: <20220315133233.635559-3-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220315133233.635559-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-1-luca.boccassi@gmail.com> <20220315133233.635559-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 20.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/17/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/63f156544d23447479047add796cd0e333e30924 Thanks. Luca Boccassi --- >From 63f156544d23447479047add796cd0e333e30924 Mon Sep 17 00:00:00 2001 From: Jiawei Wang Date: Wed, 9 Mar 2022 12:19:46 +0200 Subject: [PATCH] net/mlx5: fix sample flow action on trusted device [ upstream commit 9a726360dd3010a4c664e37682826b68a0a7f7fe ] A flow rule with sample action will be split into two sub flows, and a tag action was added implicitly in the sample prefix sub flow, the reserved metadata regC index was used for this tag action. The reserved metadata regC was shared with metering action, for ConnectX-5 trusted device (VF/SF), the reserved metadata regC was invalid since PF only supported the legacy metering. This patch adds the checking for the tag index and back to use the application tag if a failure happened. Fixes: a9b6ea45bed6 ("net/mlx5: fix tag ID conflict with sample action") Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko --- doc/guides/nics/mlx5.rst | 2 ++ drivers/net/mlx5/mlx5_flow.c | 6 ++++++ drivers/net/mlx5/mlx5_flow_dv.c | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index d76c3178dc..9322c5327a 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -325,6 +325,8 @@ Limitations - Supports ``RTE_FLOW_ACTION_TYPE_SAMPLE`` action only within NIC Rx and E-Switch steering domain. - The E-Switch Sample flow must have the eswitch_manager VPORT destination (PF or ECPF) and no additional actions. - For ConnectX-5, the ``RTE_FLOW_ACTION_TYPE_SAMPLE`` is typically used as first action in the E-Switch egress flow if with header modify or encapsulation actions. + - For ConnectX-5 trusted device, the application metadata with SET_TAG index 0 + is not supported before ``RTE_FLOW_ACTION_TYPE_SAMPLE`` action. - IPv6 header item 'proto' field, indicating the next header protocol, should not be set as extension header. diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 56db0217b9..bed853e726 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -4779,6 +4779,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev, /* Prepare the prefix tag action. */ set_tag = (void *)(actions_pre + actions_n + 1); ret = mlx5_flow_get_reg_id(dev, MLX5_SAMPLE_ID, 0, error); + /* Trust VF/SF on CX5 not supported meter so that the reserved + * metadata regC is REG_NON, back to use application tag + * index 0. + */ + if (unlikely(ret == REG_NON)) + ret = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, 0, error); if (ret < 0) return ret; set_tag->id = ret; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 44f975c9c9..2d0e239d4d 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -5335,6 +5335,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, .std_tbl_fix = true, }; const struct rte_eth_hairpin_conf *conf; + uint32_t tag_id = 0; if (items == NULL) return -1; @@ -5730,6 +5731,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, /* Count all modify-header actions as one action. */ if (!(action_flags & MLX5_FLOW_MODIFY_HDR_ACTIONS)) ++actions_n; + tag_id = ((const struct rte_flow_action_set_tag *) + actions->conf)->index; action_flags |= MLX5_FLOW_ACTION_SET_TAG; rw_act_num += MLX5_ACT_NUM_SET_TAG; break; @@ -6103,6 +6106,11 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; + if ((action_flags & MLX5_FLOW_ACTION_SET_TAG) && + tag_id == 0 && priv->mtr_color_reg == REG_NON) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, NULL, + "sample after tag action causes metadata tag index 0 corruption"); action_flags |= MLX5_FLOW_ACTION_SAMPLE; ++actions_n; break; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-15 12:13:39.171041049 +0000 +++ 0003-net-mlx5-fix-sample-flow-action-on-trusted-device.patch 2022-03-15 12:13:39.056180722 +0000 @@ -1 +1 @@ -From 9a726360dd3010a4c664e37682826b68a0a7f7fe Mon Sep 17 00:00:00 2001 +From 63f156544d23447479047add796cd0e333e30924 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 9a726360dd3010a4c664e37682826b68a0a7f7fe ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -29 +30 @@ -index a734d10d3f..ca7ebbe9cd 100644 +index d76c3178dc..9322c5327a 100644 @@ -32,4 +33,4 @@ -@@ -400,6 +400,8 @@ Limitations - sample actions list. - - For E-Switch mirroring flow, supports ``RAW ENCAP``, ``Port ID``, - ``VXLAN ENCAP``, ``NVGRE ENCAP`` in the sample actions list. +@@ -325,6 +325,8 @@ Limitations + - Supports ``RTE_FLOW_ACTION_TYPE_SAMPLE`` action only within NIC Rx and E-Switch steering domain. + - The E-Switch Sample flow must have the eswitch_manager VPORT destination (PF or ECPF) and no additional actions. + - For ConnectX-5, the ``RTE_FLOW_ACTION_TYPE_SAMPLE`` is typically used as first action in the E-Switch egress flow if with header modify or encapsulation actions. @@ -39,2 +40,2 @@ - - Modify Field flow: - + - IPv6 header item 'proto' field, indicating the next header protocol, should + not be set as extension header. @@ -42 +43 @@ -index ffcaef0baa..e2bc6ce8ad 100644 +index 56db0217b9..bed853e726 100644 @@ -45,3 +46,3 @@ -@@ -5881,6 +5881,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev, - append_index++; - set_tag = (void *)(actions_pre + actions_n + append_index); +@@ -4779,6 +4779,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev, + /* Prepare the prefix tag action. */ + set_tag = (void *)(actions_pre + actions_n + 1); @@ -57 +58 @@ - mlx5_ipool_malloc(priv->sh->ipool + set_tag->id = ret; @@ -59 +60 @@ -index 1746ef37bd..d553e9dee3 100644 +index 44f975c9c9..2d0e239d4d 100644 @@ -62,4 +63,4 @@ -@@ -6913,6 +6913,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - bool def_policy = false; - bool shared_count = false; - uint16_t udp_dport = 0; +@@ -5335,6 +5335,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, + .std_tbl_fix = true, + }; + const struct rte_eth_hairpin_conf *conf; @@ -70 +71,3 @@ -@@ -7389,6 +7390,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -5730,6 +5731,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, + /* Count all modify-header actions as one action. */ + if (!(action_flags & MLX5_FLOW_MODIFY_HDR_ACTIONS)) @@ -72,2 +74,0 @@ - if (action_flags & MLX5_FLOW_ACTION_SAMPLE) - modify_after_mirror = 1; @@ -79 +80 @@ -@@ -7823,6 +7826,11 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, +@@ -6103,6 +6106,11 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,