From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 7D3D1A0C4C
	for <public@inbox.dpdk.org>; Mon, 12 Jul 2021 15:12:04 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 729594069D;
	Mon, 12 Jul 2021 15:12:04 +0200 (CEST)
Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com
 [209.85.221.46]) by mails.dpdk.org (Postfix) with ESMTP id 4E05D4069D
 for <stable@dpdk.org>; Mon, 12 Jul 2021 15:12:03 +0200 (CEST)
Received: by mail-wr1-f46.google.com with SMTP id a13so25533047wrf.10
 for <stable@dpdk.org>; Mon, 12 Jul 2021 06:12:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=03MP+CIEdN4fsYVcfG4c5Z7RwfdJTk67nDQALo6CWus=;
 b=bp0sDFkr2qdD2x5gG7Qa2zwggMYdBnYRjO777Z9Mj2HYo59zbnPwP2RPyjGOaIMOvv
 YEPa/arrZWmGTmyXnjJuQeutTB/8SoU84ZDCfdZ3kZiQgZk0/fg0TyAjlV1Q+IbgaxKf
 DWIbSfV2ICaQODFcrKgFCKZuqT1ozmCUJtWpJ9uKNAAxTXNyrWZhufIPvqsM279uTeKG
 D3KkDjf+Nk+O46FAAXSJyj2SFmDZcupiGBNL96JlOBhPm1cpXhXmBOpxcII22lKEJhj9
 +8/JG1fGk0eHJeePd6wssaTf93YI5iXq/aGbneGoceK+/fYrlPJrxAEeMlpLjGaFZ0Dx
 yYOQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=03MP+CIEdN4fsYVcfG4c5Z7RwfdJTk67nDQALo6CWus=;
 b=AuzBQ5X86KzWeVxeqXvBjpc+XqPMGDYLsfdmr73/f2jk2Nh1uO59R/bDgNgrJQ7Jbg
 fHIICm/wXNVEOqmUMgSWR+nRLo797cS1ZJ7PlX68E5qn5ewh+73Jpz/innrHbQ1/gRft
 ZQVK2yUw8EG/iEKvhAv1qZ5EJs/TZI781sZLaQO9CYi4Djz0AuiDqOhqQafptZiknqGg
 OEfjBXQe/01hFxtWFf9t7OpUafKX6LGcO6ZWM0hpuG7/yxY+IHzne7/3Abtv195yXo4a
 r5gfAGPkl8k3pEQZRTdvfGDk8DdqpD0WxVMhud9AzW14oCdmPO+XkZoo/VWe0IVCsqld
 M2QA==
X-Gm-Message-State: AOAM533EacBBJY/BW/D8gCmeuxOeGU+HX98F5VHyVBh0mbPpL17V0Ewp
 qyWad0LlQC1FPjeS2e3xFo8=
X-Google-Smtp-Source: ABdhPJxmVRvpi7jBXXnaXSlV6KpbR1IN4LMxMiLLCNarG6xir+d81mcQEkjcn1gTU2y7MJZDjSBLHQ==
X-Received: by 2002:a05:6000:1a87:: with SMTP id
 f7mr58231481wry.172.1626095523044; 
 Mon, 12 Jul 2021 06:12:03 -0700 (PDT)
Received: from localhost ([137.220.125.106])
 by smtp.gmail.com with ESMTPSA id s1sm19771699wmj.8.2021.07.12.06.12.02
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 12 Jul 2021 06:12:02 -0700 (PDT)
From: luca.boccassi@gmail.com
To: Gregory Etelson <getelson@nvidia.com>
Cc: Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
 dpdk stable <stable@dpdk.org>
Date: Mon, 12 Jul 2021 14:04:32 +0100
Message-Id: <20210712130551.2462159-37-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20210712130551.2462159-1-luca.boccassi@gmail.com>
References: <20210712130551.2462159-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-stable] patch 'net/mlx5: fix RSS pattern expansion' has been
 queued to stable release 20.11.3
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi,

FYI, your patch has been queued to stable release 20.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 07/14/21. 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/b63f84156e889bcc9b8cd48f59b5920849af903f

Thanks.

Luca Boccassi

---
>From b63f84156e889bcc9b8cd48f59b5920849af903f Mon Sep 17 00:00:00 2001
From: Gregory Etelson <getelson@nvidia.com>
Date: Thu, 27 May 2021 18:20:24 +0300
Subject: [PATCH] net/mlx5: fix RSS pattern expansion

[ upstream commit d91093b9a2af5378734b301bd2fc75d44e18d269 ]

Flow rule pattern may be implicitly expanded by the PMD if the rule
has RSS flow action. The expansion adds network headers to the
original pattern. The new pattern lists all network levels that
participate in the rule RSS action.

The patch fixes expanded pattern for cases when original pattern
included meta items like MARK, TAG, META.

Fixes: c7870bfe09dc ("ethdev: move RSS expansion code to mlx5 driver")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 53 ++++++++++++++++++++++++++++++++++--
 1 file changed, 51 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index ee0716ffd1..c5fc1ee6b4 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -114,6 +114,30 @@ struct mlx5_flow_expand_rss {
 	} entry[];
 };
 
+static void
+mlx5_dbg__print_pattern(const struct rte_flow_item *item);
+
+static bool
+mlx5_flow_is_rss_expandable_item(const struct rte_flow_item *item)
+{
+	switch (item->type) {
+	case RTE_FLOW_ITEM_TYPE_ETH:
+	case RTE_FLOW_ITEM_TYPE_VLAN:
+	case RTE_FLOW_ITEM_TYPE_IPV4:
+	case RTE_FLOW_ITEM_TYPE_IPV6:
+	case RTE_FLOW_ITEM_TYPE_UDP:
+	case RTE_FLOW_ITEM_TYPE_TCP:
+	case RTE_FLOW_ITEM_TYPE_VXLAN:
+	case RTE_FLOW_ITEM_TYPE_NVGRE:
+	case RTE_FLOW_ITEM_TYPE_GRE:
+	case RTE_FLOW_ITEM_TYPE_GENEVE:
+		return true;
+	default:
+		break;
+	}
+	return false;
+}
+
 static enum rte_flow_item_type
 mlx5_flow_expand_rss_item_complete(const struct rte_flow_item *item)
 {
@@ -273,8 +297,11 @@ mlx5_flow_expand_rss(struct mlx5_flow_expand_rss *buf, size_t size,
 		addr = buf->entry[0].pattern;
 	}
 	for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
-		if (item->type != RTE_FLOW_ITEM_TYPE_VOID)
-			last_item = item;
+		if (!mlx5_flow_is_rss_expandable_item(item)) {
+			user_pattern_size += sizeof(*item);
+			continue;
+		}
+		last_item = item;
 		for (i = 0; node->next && node->next[i]; ++i) {
 			next = &graph[node->next[i]];
 			if (next->type == item->type)
@@ -5370,6 +5397,10 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
 					   mlx5_support_expansion, graph_root);
 		MLX5_ASSERT(ret > 0 &&
 		       (unsigned int)ret < sizeof(expand_buffer.buffer));
+		if (rte_log_can_log(mlx5_logtype, RTE_LOG_DEBUG)) {
+			for (i = 0; i < buf->entries; ++i)
+				mlx5_dbg__print_pattern(buf->entry[i].pattern);
+		}
 	} else {
 		buf->entries = 1;
 		buf->entry[0].pattern = (void *)(uintptr_t)items;
@@ -7987,3 +8018,21 @@ mlx5_release_tunnel_hub(__rte_unused struct mlx5_dev_ctx_shared *sh,
 }
 #endif /* HAVE_IBV_FLOW_DV_SUPPORT */
 
+static void
+mlx5_dbg__print_pattern(const struct rte_flow_item *item)
+{
+	int ret;
+	struct rte_flow_error error;
+
+	for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
+		char *item_name;
+		ret = rte_flow_conv(RTE_FLOW_CONV_OP_ITEM_NAME_PTR, &item_name,
+				    sizeof(item_name),
+				    (void *)(uintptr_t)item->type, &error);
+		if (ret > 0)
+			printf("%s ", item_name);
+		else
+			printf("%d\n", (int)item->type);
+	}
+	printf("END\n");
+}
-- 
2.30.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-07-12 13:41:38.599939160 +0100
+++ 0037-net-mlx5-fix-RSS-pattern-expansion.patch	2021-07-12 13:41:36.310118861 +0100
@@ -1 +1 @@
-From d91093b9a2af5378734b301bd2fc75d44e18d269 Mon Sep 17 00:00:00 2001
+From b63f84156e889bcc9b8cd48f59b5920849af903f Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d91093b9a2af5378734b301bd2fc75d44e18d269 ]
+
@@ -15 +16,0 @@
-Cc: stable@dpdk.org
@@ -20,2 +21,2 @@
- drivers/net/mlx5/mlx5_flow.c | 54 ++++++++++++++++++++++++++++++++++--
- 1 file changed, 52 insertions(+), 2 deletions(-)
+ drivers/net/mlx5/mlx5_flow.c | 53 ++++++++++++++++++++++++++++++++++--
+ 1 file changed, 51 insertions(+), 2 deletions(-)
@@ -24 +25 @@
-index dbeca571b6..e5e062d09a 100644
+index ee0716ffd1..c5fc1ee6b4 100644
@@ -72 +73 @@
-@@ -6174,6 +6201,10 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
+@@ -5370,6 +5397,10 @@ flow_list_create(struct rte_eth_dev *dev, uint32_t *list,
@@ -83,2 +84 @@
-@@ -8990,3 +9021,22 @@ mlx5_release_tunnel_hub(__rte_unused struct mlx5_dev_ctx_shared *sh,
- {
+@@ -7987,3 +8018,21 @@ mlx5_release_tunnel_hub(__rte_unused struct mlx5_dev_ctx_shared *sh,
@@ -87 +87 @@
-+
+