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 0BB02A0557 for ; Wed, 16 Nov 2022 11:40:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 084D342D18; Wed, 16 Nov 2022 11:40:41 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id B08FF40E03 for ; Wed, 16 Nov 2022 11:40:39 +0100 (CET) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 88E2F3F0A2 for ; Wed, 16 Nov 2022 10:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1668595239; bh=DSUI38BuiUS1pIPTJ+16+xuiMRWsPbwpIQRjqVCgF9Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fEeGUSvcmTMraQ8CQh4cJJpoBqxOAKMfbXJOzMn9LTNCT2bK1PdZQ1h460TTw76/e 7OtESN6FebWEChc84nOVKqECG0Qf88w9pQprl6SpMlI/gjJ1IV0imgCV6SPFbLuTaM M2cssTxnCXNsC5eBZH02GXEAIRftzJ1Dd3uuMMxRWadZMotc4niUiLj4TQVzOXY+bg oisQwqJnEL8+AAc/tPe9Ly/Gma0c3nJRqzX1QkArY4CfuCPiCnGfNcMeEHOLs4jkCr WSJiZmzjT+XnxSRbdGYIrccItmwKtPJc4uueJqCC0zDtVRMK3I1STocjo1cqFy6SYc NHIs4/iZNVPMQ== Received: by mail-wr1-f70.google.com with SMTP id c18-20020adfa312000000b002364fabf2ceso3529743wrb.2 for ; Wed, 16 Nov 2022 02:40:39 -0800 (PST) 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=DSUI38BuiUS1pIPTJ+16+xuiMRWsPbwpIQRjqVCgF9Q=; b=VkIeLj7wVNRe/V1jPXfnIyGAW6hZBzFtM/K7rRJHKvmD5wNBVs4O4uGw34LRmaD724 bXPIn+75OEmpjdW1MLTQjAqsJGImDAjCP/7SVnioZwuzXQ93czvecVJJrMqc+GTkJWrZ Gh4UfZirXrD0vBMaxP9Q93FOkeRtytnkayVj4L2arEpdB3XjnS2nAdwOvPY279gYpKUB TYmsVkg8VPOnMv8uexl89dpPggky7XYJwbE6fxNYgg/+/PqCHm/XNCdicaVG33WOGGoj /BReL25ctmvHKJOrIx9Kj2kPVbKGexdNn273u8L2LZQHETB9gFSpDichIzguuT7IQt/+ TshQ== X-Gm-Message-State: ANoB5pm13MRSOEq7WDaGU+xg6HO2BPw0e16uiSOHJQe1Iy3pYqQGK5GL oFtU1A9EuPNPtA/F+rUrIrP7h7rmPwOKS/zallMhha7j7zj0KrCFgVsi95Tn+rm0KBHWxs404xQ 6HkrqGKMp/ejVWlpNg24QyiNM X-Received: by 2002:a7b:c4d4:0:b0:3c6:c0e7:88b9 with SMTP id g20-20020a7bc4d4000000b003c6c0e788b9mr1702262wmk.47.1668595239151; Wed, 16 Nov 2022 02:40:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XRoxLnPpHZK/kMwGQKtAnW5C+P6ohPA/+FhR/1jmVoBK4o2g0bdZ+v4HWhOFvjZx2QD9sNQ== X-Received: by 2002:a7b:c4d4:0:b0:3c6:c0e7:88b9 with SMTP id g20-20020a7bc4d4000000b003c6c0e788b9mr1702250wmk.47.1668595238917; Wed, 16 Nov 2022 02:40:38 -0800 (PST) Received: from localhost.localdomain ([2a02:6d40:39e5:dd00:975:f38b:96af:696f]) by smtp.gmail.com with ESMTPSA id bt14-20020a056000080e00b002417e7f0685sm14359743wrb.9.2022.11.16.02.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 02:40:38 -0800 (PST) From: christian.ehrhardt@canonical.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 19.11.14 Date: Wed, 16 Nov 2022 11:40:03 +0100 Message-Id: <20221116104012.2975036-8-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221116104012.2975036-1-christian.ehrhardt@canonical.com> References: <20221116104012.2975036-1-christian.ehrhardt@canonical.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 19.11.14 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/23/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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/359adae4e7dd24e780de03b1eaee02d124704fcb Thanks. Christian Ehrhardt --- >From 359adae4e7dd24e780de03b1eaee02d124704fcb 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 4d13bbb06c..6931ec50c6 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2870,6 +2870,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; @@ -2877,6 +2878,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; @@ -2901,11 +2904,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 > @@ -3364,20 +3371,33 @@ 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; mlx5_flow_id_get(priv->sh->flow_id_pool, flow_id); 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.38.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-16 11:36:50.717468320 +0100 +++ 0008-net-mlx5-fix-hairpin-split-with-set-VLAN-VID-action.patch 2022-11-16 11:36:50.412775451 +0100 @@ -1 +1 @@ -From 5615d27b7a1bda7cc58ef07c2e77c6f9a7792c1d Mon Sep 17 00:00:00 2001 +From 359adae4e7dd24e780de03b1eaee02d124704fcb 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 4d13bbb06c..6931ec50c6 100644 @@ -50 +51 @@ -@@ -4591,6 +4591,7 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, +@@ -2870,6 +2870,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, +@@ -2877,6 +2878,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, +@@ -2901,11 +2904,15 @@ flow_check_hairpin_split(struct rte_eth_dev *dev, @@ -83,2 +84,2 @@ - if (raw_encap->size > MLX5_ENCAPSULATION_DECISION_SIZE) -@@ -5088,19 +5095,32 @@ flow_hairpin_split(struct rte_eth_dev *dev, + if (raw_encap->size > +@@ -3364,20 +3371,33 @@ flow_hairpin_split(struct rte_eth_dev *dev, @@ -90,0 +92 @@ + mlx5_flow_id_get(priv->sh->flow_id_pool, flow_id);