Commit 4db7b98e authored by Paul Blakey's avatar Paul Blakey Committed by Saeed Mahameed

net/mlx5: Define fdb tc levels per prio

Define FDB_TC_LEVELS_PER_PRIO instead of magic number 2.
This is the number of levels used by each tc prio table in the fdb.
Signed-off-by: default avatarPaul Blakey <paulb@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Acked-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 2cf2954b
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#define FDB_TC_MAX_CHAIN 3 #define FDB_TC_MAX_CHAIN 3
#define FDB_TC_SLOW_PATH_CHAIN (FDB_TC_MAX_CHAIN + 1) #define FDB_TC_SLOW_PATH_CHAIN (FDB_TC_MAX_CHAIN + 1)
#define FDB_TC_MAX_PRIO 16 #define FDB_TC_MAX_PRIO 16
#define FDB_TC_LEVELS_PER_PRIO 2
#ifdef CONFIG_MLX5_ESWITCH #ifdef CONFIG_MLX5_ESWITCH
...@@ -146,7 +147,6 @@ enum offloads_fdb_flags { ...@@ -146,7 +147,6 @@ enum offloads_fdb_flags {
extern const unsigned int ESW_POOLS[4]; extern const unsigned int ESW_POOLS[4];
#define PRIO_LEVELS 2
struct mlx5_eswitch_fdb { struct mlx5_eswitch_fdb {
union { union {
struct legacy_fdb { struct legacy_fdb {
...@@ -173,7 +173,7 @@ struct mlx5_eswitch_fdb { ...@@ -173,7 +173,7 @@ struct mlx5_eswitch_fdb {
struct { struct {
struct mlx5_flow_table *fdb; struct mlx5_flow_table *fdb;
u32 num_rules; u32 num_rules;
} fdb_prio[FDB_TC_MAX_CHAIN + 1][FDB_TC_MAX_PRIO + 1][PRIO_LEVELS]; } fdb_prio[FDB_TC_MAX_CHAIN + 1][FDB_TC_MAX_PRIO + 1][FDB_TC_LEVELS_PER_PRIO];
/* Protects fdb_prio table */ /* Protects fdb_prio table */
struct mutex fdb_prio_lock; struct mutex fdb_prio_lock;
......
...@@ -2576,7 +2576,8 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering) ...@@ -2576,7 +2576,8 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
goto out_err; goto out_err;
} }
levels = 2 * FDB_TC_MAX_PRIO * (FDB_TC_MAX_CHAIN + 1); levels = FDB_TC_LEVELS_PER_PRIO *
FDB_TC_MAX_PRIO * (FDB_TC_MAX_CHAIN + 1);
maj_prio = fs_create_prio_chained(&steering->fdb_root_ns->ns, maj_prio = fs_create_prio_chained(&steering->fdb_root_ns->ns,
FDB_FAST_PATH, FDB_FAST_PATH,
levels); levels);
...@@ -2593,7 +2594,8 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering) ...@@ -2593,7 +2594,8 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
} }
for (prio = 0; prio < FDB_TC_MAX_PRIO * (chain + 1); prio++) { for (prio = 0; prio < FDB_TC_MAX_PRIO * (chain + 1); prio++) {
min_prio = fs_create_prio(ns, prio, 2); min_prio = fs_create_prio(ns, prio,
FDB_TC_LEVELS_PER_PRIO);
if (IS_ERR(min_prio)) { if (IS_ERR(min_prio)) {
err = PTR_ERR(min_prio); err = PTR_ERR(min_prio);
goto out_err; goto out_err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment