Skip to content

Commit 4db7b98

Browse files
Paul BlakeySaeed Mahameed
authored andcommitted
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: Paul Blakey <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Acked-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 2cf2954 commit 4db7b98

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

drivers/net/ethernet/mellanox/mlx5/core/eswitch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#define FDB_TC_MAX_CHAIN 3
4747
#define FDB_TC_SLOW_PATH_CHAIN (FDB_TC_MAX_CHAIN + 1)
4848
#define FDB_TC_MAX_PRIO 16
49+
#define FDB_TC_LEVELS_PER_PRIO 2
4950

5051
#ifdef CONFIG_MLX5_ESWITCH
5152

@@ -146,7 +147,6 @@ enum offloads_fdb_flags {
146147

147148
extern const unsigned int ESW_POOLS[4];
148149

149-
#define PRIO_LEVELS 2
150150
struct mlx5_eswitch_fdb {
151151
union {
152152
struct legacy_fdb {
@@ -173,7 +173,7 @@ struct mlx5_eswitch_fdb {
173173
struct {
174174
struct mlx5_flow_table *fdb;
175175
u32 num_rules;
176-
} fdb_prio[FDB_TC_MAX_CHAIN + 1][FDB_TC_MAX_PRIO + 1][PRIO_LEVELS];
176+
} fdb_prio[FDB_TC_MAX_CHAIN + 1][FDB_TC_MAX_PRIO + 1][FDB_TC_LEVELS_PER_PRIO];
177177
/* Protects fdb_prio table */
178178
struct mutex fdb_prio_lock;
179179

drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2576,7 +2576,8 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
25762576
goto out_err;
25772577
}
25782578

2579-
levels = 2 * FDB_TC_MAX_PRIO * (FDB_TC_MAX_CHAIN + 1);
2579+
levels = FDB_TC_LEVELS_PER_PRIO *
2580+
FDB_TC_MAX_PRIO * (FDB_TC_MAX_CHAIN + 1);
25802581
maj_prio = fs_create_prio_chained(&steering->fdb_root_ns->ns,
25812582
FDB_FAST_PATH,
25822583
levels);
@@ -2593,7 +2594,8 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering)
25932594
}
25942595

25952596
for (prio = 0; prio < FDB_TC_MAX_PRIO * (chain + 1); prio++) {
2596-
min_prio = fs_create_prio(ns, prio, 2);
2597+
min_prio = fs_create_prio(ns, prio,
2598+
FDB_TC_LEVELS_PER_PRIO);
25972599
if (IS_ERR(min_prio)) {
25982600
err = PTR_ERR(min_prio);
25992601
goto out_err;

0 commit comments

Comments
 (0)