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 68D19A00C2 for ; Wed, 23 Nov 2022 19:04:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6522942DA3; Wed, 23 Nov 2022 19:04:51 +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 149CD40E5A for ; Wed, 23 Nov 2022 19:04:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669226687; 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=189GN2D2kKeKjcsg2PdWFOj68aSS6pX7Luyg8+Z4A6I=; b=jGPk6xFODaTf1swaBrGi/TgHeNCEt8eEVk5CuSZm93nTPvk51alfqQG4ur56/qedqLOrwo qAdM9ZqmmaehxyxD6Z+GuY86SZbqITJtRRPAyZBHKmIg8KsmsEwEEJOoDOdo8yAlygxOvd aKw52L0XVn1K6p3OzvqJPoL/m0DqEgY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-329-BtR0RJnTOt-cNwvG8kVf2w-1; Wed, 23 Nov 2022 13:04:44 -0500 X-MC-Unique: BtR0RJnTOt-cNwvG8kVf2w-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 00124185A78B; Wed, 23 Nov 2022 18:04:44 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EBBF492B07; Wed, 23 Nov 2022 18:04:43 +0000 (UTC) From: Kevin Traynor To: Dariusz Sosnowski Cc: Viacheslav Ovsiienko , dpdk stable Subject: patch 'net/mlx5: fix hairpin split with set VLAN VID action' has been queued to stable release 21.11.3 Date: Wed, 23 Nov 2022 18:03:28 +0000 Message-Id: <20221123180413.733554-15-ktraynor@redhat.com> In-Reply-To: <20221123180413.733554-1-ktraynor@redhat.com> References: <20221123180413.733554-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/28/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/b4524bef61097f77c0296fba02f0025d7016b501 Thanks. Kevin --- >From b4524bef61097f77c0296fba02f0025d7016b501 Mon Sep 17 00:00:00 2001 From: Dariusz Sosnowski Date: Mon, 7 Nov 2022 10:28:52 +0000 Subject: [PATCH] net/mlx5: fix hairpin split with set VLAN VID action [ upstream commit 5615d27b7a1bda7cc58ef07c2e77c6f9a7792c1d ] Before this patch any flow rule which works on hairpin queues and which has OF_SET_VLAN_VID action was split into 2 flow rules: - one subflow for Rx, - one subflow for Tx. OF_SET_VLAN_VID action was always placed in the Tx subflow. Assuming a flow rule which matches VLAN traffic and has both OF_SET_VLAN_VID action, and MODIFY_FIELD action on VLAN VID, but no OF_PUSH_VLAN action, the following happened: - MODIFY_FIELD action was placed in Rx subflow, - OF_SET_VLAN_VID action was placed in Tx subflow, - OF_SET_VLAN_VID action is internally compiled to a header modify command. This caused the following issues: 1. Since OF_SET_VLAN_VID was placed in Tx subflow, 2 header modify actions were allocated. One for Rx and one for Tx. 2. If OF_SET_VLAN_VID action was placed before MODIFY_FIELD on VLAN VID, the flow rule executed header modifications in reverse order. MODIFY_FIELD actions were executed first in the Rx subflow and OF_SET_VLAN_VID was executed second in Tx subflow. This patch fixes this behavior by not splitting hairpin flow rules if OF_SET_VLAN_VID action is used without OF_PUSH_VLAN. On top of that, if flow rule is split, the OF_SET_VLAN_VID action is not moved to Tx subflow (for flow rules mentioned above). Fixes: 210008309b45 ("net/mlx5: fix VLAN push action on hairpin queue") Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index ba0983ddf0..df3a132ee4 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -4219,4 +4219,5 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, int action_n = 0; int split = 0; + int push_vlan = 0; const struct rte_flow_action_queue *queue; const struct rte_flow_action_rss *rss; @@ -4227,4 +4228,6 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, return 0; for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { + if (actions->type == RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN) + push_vlan = 1; switch (actions->type) { case RTE_FLOW_ACTION_TYPE_QUEUE: @@ -4251,9 +4254,13 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: - case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: split++; action_n++; break; + case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: + if (push_vlan) + split++; + action_n++; + break; case RTE_FLOW_ACTION_TYPE_RAW_ENCAP: raw_encap = actions->conf; @@ -4716,12 +4723,14 @@ flow_hairpin_split(struct rte_eth_dev *dev, struct rte_flow_item *item; char *addr; + int push_vlan = 0; int encap = 0; for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { + if (actions->type == RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN) + push_vlan = 1; switch (actions->type) { case RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP: case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: - case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: rte_memcpy(actions_tx, actions, @@ -4729,4 +4738,15 @@ flow_hairpin_split(struct rte_eth_dev *dev, actions_tx++; break; + case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: + if (push_vlan) { + rte_memcpy(actions_tx, actions, + sizeof(struct rte_flow_action)); + actions_tx++; + } else { + rte_memcpy(actions_rx, actions, + sizeof(struct rte_flow_action)); + actions_rx++; + } + break; case RTE_FLOW_ACTION_TYPE_COUNT: if (encap) { -- 2.38.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-23 09:55:57.457112769 +0000 +++ 0015-net-mlx5-fix-hairpin-split-with-set-VLAN-VID-action.patch 2022-11-23 09:55:57.029149206 +0000 @@ -1 +1 @@ -From 5615d27b7a1bda7cc58ef07c2e77c6f9a7792c1d Mon Sep 17 00:00:00 2001 +From b4524bef61097f77c0296fba02f0025d7016b501 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5615d27b7a1bda7cc58ef07c2e77c6f9a7792c1d ] + @@ -38 +39,0 @@ -Cc: stable@dpdk.org @@ -47 +48 @@ -index 65af1b4dd5..ea88882b88 100644 +index ba0983ddf0..df3a132ee4 100644 @@ -50 +51 @@ -@@ -4592,4 +4592,5 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, +@@ -4219,4 +4219,5 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, @@ -56 +57 @@ -@@ -4600,4 +4601,6 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, +@@ -4227,4 +4228,6 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, @@ -63 +64 @@ -@@ -4624,9 +4627,13 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, +@@ -4251,9 +4254,13 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, @@ -78 +79 @@ -@@ -5089,12 +5096,14 @@ flow_hairpin_split(struct rte_eth_dev *dev, +@@ -4716,12 +4723,14 @@ flow_hairpin_split(struct rte_eth_dev *dev, @@ -94 +95 @@ -@@ -5102,4 +5111,15 @@ flow_hairpin_split(struct rte_eth_dev *dev, +@@ -4729,4 +4738,15 @@ flow_hairpin_split(struct rte_eth_dev *dev,