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 02C49A0032 for ; Wed, 16 Mar 2022 16:15:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D775A41143; Wed, 16 Mar 2022 16:15:47 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 9E9C540395 for ; Wed, 16 Mar 2022 16:15:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647443744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EL8LFpQXw47mKE2o1ob2Fy+4aLGBEdZ73DAK1cLwbh0=; b=a87cHff8OkYknHt+7/RHBf8y8RCXDM1p2z9ZvL+duPWEg7KPxBT2eGsmGlrjAAWGEXAyWV /u6nbXsuwI45PnVwC1MqNQMdConYbhF8/AKdOWYjUxlzwnPQzJXeaP2T6RRpkxPeQGrJNu GJZjrfNF72xjMZk3LTEmGpdoiCWXM2E= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-673-_oDMvj7iMmG_deqecLU5Uw-1; Wed, 16 Mar 2022 11:15:41 -0400 X-MC-Unique: _oDMvj7iMmG_deqecLU5Uw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CACF93C0D1AE; Wed, 16 Mar 2022 15:15:40 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.195.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8B934B8D43; Wed, 16 Mar 2022 15:15:39 +0000 (UTC) From: Kevin Traynor To: Jiawei Wang Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix implicit tag insertion with sample action' has been queued to stable release 21.11.1 Date: Wed, 16 Mar 2022 15:15:05 +0000 Message-Id: <20220316151524.1242199-4-ktraynor@redhat.com> In-Reply-To: <20220316151524.1242199-1-ktraynor@redhat.com> References: <20220316151524.1242199-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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 21.11.1 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/21/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/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/5b6b7475f27b00358cc548cb4b88f8bbd970322b Thanks. Kevin --- >From 5b6b7475f27b00358cc548cb4b88f8bbd970322b Mon Sep 17 00:00:00 2001 From: Jiawei Wang Date: Thu, 10 Mar 2022 06:00:10 +0200 Subject: [PATCH] net/mlx5: fix implicit tag insertion with sample action [ upstream commit 0f845cc7264a8b56225a28cb4584095cbbf88869 ] A flow rule with sample action was split into two sub-flows, and the implicit tag action with unique id was added in the prefix sub-flow, the suffix sub-flow used the tag item to match with that unique id, and the implicit set tag action was inserted next to the sample action. While there's either PUSH VLAN action or ENCAP action preceding the sample action, implicit set tag action was added after PUSH VLAN or ENCAP actions, causing flow creation failure due to rdma-core does not support this action order. This patch ensures the implicit set tag action is inserted before either PUSH VLAN or encap action (if any) in the prefix sub-flow. Fixes: 6a951567c159 ("net/mlx5: support E-Switch mirroring and jump in one flow") Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.c | 63 ++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a7c8c92ce4..10afd96fea 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -5612,6 +5612,7 @@ flow_sample_split_prep(struct rte_eth_dev *dev, struct rte_flow_action_jump *jump_action; uint32_t tag_id = 0; - int index; int append_index = 0; + int set_tag_idx = -1; + int index; int ret; @@ -5622,4 +5623,50 @@ flow_sample_split_prep(struct rte_eth_dev *dev, "action in list"); /* Prepare the actions for prefix and suffix flow. */ + if (add_tag) { + /* Update the new added tag action index preceding + * the PUSH_VLAN or ENCAP action. + */ + const struct rte_flow_action_raw_encap *raw_encap; + const struct rte_flow_action *action = actions; + int encap_idx; + int action_idx = 0; + int raw_decap_idx = -1; + int push_vlan_idx = -1; + for (; action->type != RTE_FLOW_ACTION_TYPE_END; action++) { + switch (action->type) { + case RTE_FLOW_ACTION_TYPE_RAW_DECAP: + raw_decap_idx = action_idx; + break; + case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: + raw_encap = action->conf; + if (raw_encap->size > + MLX5_ENCAPSULATION_DECISION_SIZE) { + encap_idx = raw_decap_idx != -1 ? + raw_decap_idx : action_idx; + if (encap_idx < sample_action_pos && + push_vlan_idx == -1) + set_tag_idx = encap_idx; + } + break; + case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: + case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: + encap_idx = action_idx; + if (encap_idx < sample_action_pos && + push_vlan_idx == -1) + set_tag_idx = encap_idx; + break; + case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: + case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: + push_vlan_idx = action_idx; + if (push_vlan_idx < sample_action_pos) + set_tag_idx = action_idx; + break; + default: + break; + } + action_idx++; + } + } + /* Prepare the actions for prefix and suffix flow. */ if (qrss_action_pos >= 0 && qrss_action_pos < sample_action_pos) { index = qrss_action_pos; @@ -5638,4 +5685,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev, sizeof(struct rte_flow_action)); actions_sfx++; + } else if (add_tag && set_tag_idx >= 0) { + if (set_tag_idx > 0) + memcpy(actions_pre, actions, + sizeof(struct rte_flow_action) * set_tag_idx); + memcpy(actions_pre + set_tag_idx + 1, actions + set_tag_idx, + sizeof(struct rte_flow_action) * + (sample_action_pos - set_tag_idx)); + index = sample_action_pos; } else { index = sample_action_pos; @@ -5685,5 +5740,6 @@ flow_sample_split_prep(struct rte_eth_dev *dev, }; /* Prepare the tag action in prefix subflow. */ - actions_pre[index++] = + set_tag_idx = (set_tag_idx == -1) ? index : set_tag_idx; + actions_pre[set_tag_idx] = (struct rte_flow_action){ .type = (enum rte_flow_action_type) @@ -5691,5 +5747,8 @@ flow_sample_split_prep(struct rte_eth_dev *dev, .conf = set_tag, }; + /* Update next sample position due to add one tag action */ + index += 1; } + /* Copy the sample action into prefix flow. */ memcpy(actions_pre + index, actions + sample_action_pos, sizeof(struct rte_flow_action)); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-03-16 15:14:12.260861396 +0000 +++ 0004-net-mlx5-fix-implicit-tag-insertion-with-sample-acti.patch 2022-03-16 15:14:12.098847571 +0000 @@ -1 +1 @@ -From 0f845cc7264a8b56225a28cb4584095cbbf88869 Mon Sep 17 00:00:00 2001 +From 5b6b7475f27b00358cc548cb4b88f8bbd970322b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0f845cc7264a8b56225a28cb4584095cbbf88869 ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org @@ -30 +31 @@ -index e2bc6ce8ad..cd55bdc2c0 100644 +index a7c8c92ce4..10afd96fea 100644 @@ -33 +34 @@ -@@ -5841,6 +5841,7 @@ flow_sample_split_prep(struct rte_eth_dev *dev, +@@ -5612,6 +5612,7 @@ flow_sample_split_prep(struct rte_eth_dev *dev, @@ -42 +43 @@ -@@ -5851,4 +5852,50 @@ flow_sample_split_prep(struct rte_eth_dev *dev, +@@ -5622,4 +5623,50 @@ flow_sample_split_prep(struct rte_eth_dev *dev, @@ -93 +94 @@ -@@ -5867,4 +5914,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev, +@@ -5638,4 +5685,12 @@ flow_sample_split_prep(struct rte_eth_dev *dev, @@ -106 +107 @@ -@@ -5914,5 +5969,6 @@ flow_sample_split_prep(struct rte_eth_dev *dev, +@@ -5685,5 +5740,6 @@ flow_sample_split_prep(struct rte_eth_dev *dev, @@ -114 +115 @@ -@@ -5920,5 +5976,8 @@ flow_sample_split_prep(struct rte_eth_dev *dev, +@@ -5691,5 +5747,8 @@ flow_sample_split_prep(struct rte_eth_dev *dev,