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 7E0BEA00C4 for ; Fri, 18 Nov 2022 00:09:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 76ABF4067B; Fri, 18 Nov 2022 00:09:52 +0100 (CET) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by mails.dpdk.org (Postfix) with ESMTP id 9F8DB4021F for ; Fri, 18 Nov 2022 00:09:50 +0100 (CET) Received: by mail-wr1-f45.google.com with SMTP id l14so6422447wrw.2 for ; Thu, 17 Nov 2022 15:09:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UKOig0/85/3xpo7BxuguSUGctUdq7gQPxRMSxCXKDGs=; b=ja4a5WNZTUAWQ6lqiNjhKvT+PKhgQYsCQHpVngVZIwmsZDYN6G0aUmv1J3yx7VJGle Lu4Etna/ejZhZB6bgIJL3SJLRj7j/7+QEsJa4uc88QzlrwsXO1harb1BEvz3TFXuUscR hWefityCmgk0X3wSrXAkjKwURK0pzK46CNsG9DvucTarB7fAWpAaQiCIxuldT7jJDT4L jttGbZ6lOhKXZ72I0kSkkZJMZ6maGMfQrezh1RuwqKykiHLdY2MnNu1PX0uWgHwrDJhU Y8rPu9H+9VkGLKEBeCGe5tPVwtacLRWiDKkjbJzuCEUjr4pAJ0/yyPFlUNWM9+Wf8GxA 5tAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UKOig0/85/3xpo7BxuguSUGctUdq7gQPxRMSxCXKDGs=; b=XkktV1zkpPLHXm24ReS8Kfuo9xQCNelq/jVVO6nlIltQowsngKIc/DoU5QeKlnQTV3 Cnhe7VtahrbIqY/32TJs9S0tD4+DPqR2qPMJ1mh7j7rHx+bYOapqa1/QmCF+bd0mpTNo OL7z4Ydgbdx/usoxSZQrNDf2ovVxa72nMzVMpc/HCSZfYngJzTb+MxWImIeXDKxBDYRa h1t35W6bczYfVYZi59ArSh5qE9/Evt3rRTWqbuE8h5Cm0D9Ty5eQ0LJQ0EOWIt+Yp4cl fWLx2kE51uuF2FgKGKVTtcda+gw7HQj+NbtWzP2psRCnlio0rJwicfSPDN/fS+u9rLjP 07xg== X-Gm-Message-State: ANoB5pnos9v6/6dT9elS2DikfJK1sL5XAC/3f9IDLjKnwWwiv8Y2MEQn X+1l+4TCdfIeXSY/xnPlXDL/phVc06Q= X-Google-Smtp-Source: AA0mqf4PlvRg+ETvuAdavPk0T6tAFeNjixLmFK11c6M7Xh5HcrmyJT+M+QmPUSoTZGJkdNqwU1313g== X-Received: by 2002:a05:6000:124c:b0:236:2314:6d4b with SMTP id j12-20020a056000124c00b0023623146d4bmr2758534wrx.112.1668726590368; Thu, 17 Nov 2022 15:09:50 -0800 (PST) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id q14-20020a05600c46ce00b003c5571c27a1sm3282914wmo.32.2022.11.17.15.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 15:09:43 -0800 (PST) From: luca.boccassi@gmail.com 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 20.11.7 Date: Thu, 17 Nov 2022 23:08:37 +0000 Message-Id: <20221117230859.611465-13-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221117230859.611465-1-luca.boccassi@gmail.com> References: <20221105171146.1520039-47-luca.boccassi@gmail.com> <20221117230859.611465-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.7 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/19/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/981419d628ed4c8541faa279819a9607e99246ca Thanks. Luca Boccassi --- >From 981419d628ed4c8541faa279819a9607e99246ca 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 f0c90a314b..87d55fc6be 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -3729,6 +3729,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, int queue_action = 0; 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; const struct rte_flow_action_raw_encap *raw_encap; @@ -3737,6 +3738,8 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, if (!attr->ingress) 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: queue = actions->conf; @@ -3761,11 +3764,15 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, 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: 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; if (raw_encap->size > MLX5_ENCAPSULATION_DECISION_SIZE) @@ -4177,19 +4184,32 @@ flow_hairpin_split(struct rte_eth_dev *dev, struct mlx5_rte_flow_item_tag *tag_item; 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, sizeof(struct rte_flow_action)); 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) { rte_memcpy(actions_tx, actions, -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-17 23:07:56.070938141 +0000 +++ 0013-net-mlx5-fix-hairpin-split-with-set-VLAN-VID-action.patch 2022-11-17 23:07:55.480330097 +0000 @@ -1 +1 @@ -From 5615d27b7a1bda7cc58ef07c2e77c6f9a7792c1d Mon Sep 17 00:00:00 2001 +From 981419d628ed4c8541faa279819a9607e99246ca 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 f0c90a314b..87d55fc6be 100644 @@ -50 +51 @@ -@@ -4591,6 +4591,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, +@@ -3729,6 +3729,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, @@ -58 +59 @@ -@@ -4599,6 +4600,8 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, +@@ -3737,6 +3738,8 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, @@ -67 +68 @@ -@@ -4623,11 +4626,15 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, +@@ -3761,11 +3764,15 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, @@ -84 +85 @@ -@@ -5088,19 +5095,32 @@ flow_hairpin_split(struct rte_eth_dev *dev, +@@ -4177,19 +4184,32 @@ flow_hairpin_split(struct rte_eth_dev *dev,