From: Pablo Neira Ayuso <pablo@netfilter.org>
To: saeedm@mellanox.com
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
netdev@vger.kernel.org
Subject: [PATCH mlx5-next 4/7] net/mlx5: Accumulate levels for chains prio namespaces
Date: Tue, 12 Nov 2019 00:34:27 +0100 [thread overview]
Message-ID: <20191111233430.25120-5-pablo@netfilter.org> (raw)
In-Reply-To: <20191111233430.25120-1-pablo@netfilter.org>
From: Paul Blakey <paulb@mellanox.com>
Tc chains are implemented by creating a chained prio steering type, and
inside it there is a namespace for each chain (FDB_TC_MAX_CHAINS). Each
of those has a list of priorities.
Currently, all namespaces in a prio start at the parent prio level.
But since we can jump from chain (namespace) to another chain in the
same prio, we need the levels for higher chains to be higher as well.
So we created unused prios to account for levels in previous namespaces.
Fix that by accumulating the namespaces levels if we are inside a chained
type prio, and removing the unused prios.
Issue: 1929510
Change-Id: I73e106aeb81d8b534c6d17572d7148f26fc8aaf6
Fixes: 328edb499f99 ('net/mlx5: Split FDB fast path prio to multiple namespaces')
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index e22366ecdf6c..2e69f7989747 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -952,7 +952,7 @@ esw_get_prio_table(struct mlx5_eswitch *esw, u32 chain, u16 prio, int level)
flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
- table_prio = (chain * FDB_TC_MAX_PRIO) + prio - 1;
+ table_prio = prio - 1;
/* create earlier levels for correct fs_core lookup when
* connecting tables
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 881fe85934b1..0da932b6bae9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -2400,9 +2400,17 @@ static void set_prio_attrs_in_prio(struct fs_prio *prio, int acc_level)
int acc_level_ns = acc_level;
prio->start_level = acc_level;
- fs_for_each_ns(ns, prio)
+ fs_for_each_ns(ns, prio) {
/* This updates start_level and num_levels of ns's priority descendants */
acc_level_ns = set_prio_attrs_in_ns(ns, acc_level);
+
+ /* If this a prio with chains, and we can jump from one chain
+ * (namepsace) to another, so we accumulate the levels
+ */
+ if (prio->node.type == FS_TYPE_PRIO_CHAINS)
+ acc_level = acc_level_ns;
+ }
+
if (!prio->num_levels)
prio->num_levels = acc_level_ns - prio->start_level;
WARN_ON(prio->num_levels < acc_level_ns - prio->start_level);
--
2.11.0
next prev parent reply other threads:[~2019-11-11 23:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 23:34 [PATCH mlx5-next 0/7] netfilter flowtable hardware offload support Pablo Neira Ayuso
2019-11-11 23:34 ` [PATCH mlx5-next 1/7] net/mlx5: Simplify fdb chain and prio eswitch defines Pablo Neira Ayuso
2019-11-11 23:34 ` [PATCH mlx5-next 2/7] net/mlx5: Rename FDB_* tc related defines to FDB_TC_* defines Pablo Neira Ayuso
2019-11-11 23:34 ` [PATCH mlx5-next 3/7] net/mlx5: Define fdb tc levels per prio Pablo Neira Ayuso
2019-11-11 23:34 ` Pablo Neira Ayuso [this message]
2019-11-11 23:34 ` [PATCH mlx5-next 5/7] net/mlx5: Refactor creating fast path prio chains Pablo Neira Ayuso
2019-11-11 23:34 ` [PATCH mlx5-next 6/7] net/mlx5: Add new chain for netfilter flow table offload Pablo Neira Ayuso
2019-11-11 23:34 ` [PATCH mlx5-next 7/7] net/mlx5: TC: Offload flow table rules Pablo Neira Ayuso
2019-11-12 0:37 ` Saeed Mahameed
2019-11-12 20:32 ` Pablo Neira Ayuso
2019-11-13 22:01 ` [PATCH mlx5-next 0/7] netfilter flowtable hardware offload support Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191111233430.25120-5-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=saeedm@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).