Blame SOURCES/0103-netdrv-net-mlx5-Accumulate-levels-for-chains-prio-na.patch

d8f823
From 147ff36227e0ae4feefbe51315598cf96f01e3d8 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Sun, 10 May 2020 15:04:24 -0400
d8f823
Subject: [PATCH 103/312] [netdrv] net/mlx5: Accumulate levels for chains prio
d8f823
 namespaces
d8f823
d8f823
Message-id: <20200510150452.10307-60-ahleihel@redhat.com>
d8f823
Patchwork-id: 306683
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789380 v2 59/87] net/mlx5: Accumulate levels for chains prio namespaces
d8f823
Bugzilla: 1789380
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789380
d8f823
Upstream: v5.5-rc1
d8f823
d8f823
commit 34b13cb3eaa5ad205f4497da6420262da4940b9e
d8f823
Author: Paul Blakey <paulb@mellanox.com>
d8f823
Date:   Tue Nov 12 00:34:27 2019 +0100
d8f823
d8f823
    net/mlx5: Accumulate levels for chains prio namespaces
d8f823
d8f823
    Tc chains are implemented by creating a chained prio steering type, and
d8f823
    inside it there is a namespace for each chain (FDB_TC_MAX_CHAINS). Each
d8f823
    of those has a list of priorities.
d8f823
d8f823
    Currently, all namespaces in a prio start at the parent prio level.
d8f823
    But since we can jump from chain (namespace) to another chain in the
d8f823
    same prio, we need the levels for higher chains to be higher as well.
d8f823
    So we created unused prios to account for levels in previous namespaces.
d8f823
d8f823
    Fix that by accumulating the namespaces levels if we are inside a chained
d8f823
    type prio, and removing the unused prios.
d8f823
d8f823
    Fixes: 328edb499f99 ('net/mlx5: Split FDB fast path prio to multiple namespaces')
d8f823
    Signed-off-by: Paul Blakey <paulb@mellanox.com>
d8f823
    Reviewed-by: Mark Bloch <markb@mellanox.com>
d8f823
    Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
d8f823
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
d8f823
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |  2 +-
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c          | 10 +++++++++-
d8f823
 2 files changed, 10 insertions(+), 2 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
d8f823
index 9e59fb7ad68f..0f0d8decb04c 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
d8f823
@@ -952,7 +952,7 @@ esw_get_prio_table(struct mlx5_eswitch *esw, u32 chain, u16 prio, int level)
d8f823
 		flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
d8f823
 			  MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
d8f823
 
d8f823
-	table_prio = (chain * FDB_TC_MAX_PRIO) + prio - 1;
d8f823
+	table_prio = prio - 1;
d8f823
 
d8f823
 	/* create earlier levels for correct fs_core lookup when
d8f823
 	 * connecting tables
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
d8f823
index ce4774560c56..9411b17cdeb5 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
d8f823
@@ -2403,9 +2403,17 @@ static void set_prio_attrs_in_prio(struct fs_prio *prio, int acc_level)
d8f823
 	int acc_level_ns = acc_level;
d8f823
 
d8f823
 	prio->start_level = acc_level;
d8f823
-	fs_for_each_ns(ns, prio)
d8f823
+	fs_for_each_ns(ns, prio) {
d8f823
 		/* This updates start_level and num_levels of ns's priority descendants */
d8f823
 		acc_level_ns = set_prio_attrs_in_ns(ns, acc_level);
d8f823
+
d8f823
+		/* If this a prio with chains, and we can jump from one chain
d8f823
+		 * (namepsace) to another, so we accumulate the levels
d8f823
+		 */
d8f823
+		if (prio->node.type == FS_TYPE_PRIO_CHAINS)
d8f823
+			acc_level = acc_level_ns;
d8f823
+	}
d8f823
+
d8f823
 	if (!prio->num_levels)
d8f823
 		prio->num_levels = acc_level_ns - prio->start_level;
d8f823
 	WARN_ON(prio->num_levels < acc_level_ns - prio->start_level);
d8f823
-- 
d8f823
2.13.6
d8f823