Skip to content

Commit 264d7bf

Browse files
ogerlitzSaeed Mahameed
authored andcommitted
net/mlx5: E-Switch, Enlarge the FDB size for the switchdev mode
The E-Switch FDB size was hard coded to 8k. Change it to be min(max eswitch table size, max flow counters * num flow groups) where the max values are read from the firmware and the number of flow groups is hard-coded as before this change. We don't know upfront the division of flows to group. This setup allows each group to be of size up to the where we want to support (we mandate pairing of flows with counters for offloading). Thus, we don't expect multiple occurences for a group which in turn adds steering hops. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Tested-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent ce99f6b commit 264d7bf

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,19 +402,18 @@ static int esw_add_fdb_miss_rule(struct mlx5_eswitch *esw)
402402
}
403403

404404
#define MAX_PF_SQ 256
405-
#define ESW_OFFLOADS_NUM_ENTRIES (1 << 13) /* 8K */
406405
#define ESW_OFFLOADS_NUM_GROUPS 4
407406

408407
static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports)
409408
{
410409
int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
410+
int table_size, ix, esw_size, err = 0;
411411
struct mlx5_core_dev *dev = esw->dev;
412412
struct mlx5_flow_namespace *root_ns;
413413
struct mlx5_flow_table *fdb = NULL;
414414
struct mlx5_flow_group *g;
415415
u32 *flow_group_in;
416416
void *match_criteria;
417-
int table_size, ix, err = 0;
418417
u32 flags = 0;
419418

420419
flow_group_in = mlx5_vzalloc(inlen);
@@ -427,15 +426,19 @@ static int esw_create_offloads_fdb_table(struct mlx5_eswitch *esw, int nvports)
427426
goto ns_err;
428427
}
429428

430-
esw_debug(dev, "Create offloads FDB table, log_max_size(%d)\n",
431-
MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size));
429+
esw_debug(dev, "Create offloads FDB table, min (max esw size(2^%d), max counters(%d)*groups(%d))\n",
430+
MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size),
431+
MLX5_CAP_GEN(dev, max_flow_counter), ESW_OFFLOADS_NUM_GROUPS);
432+
433+
esw_size = min_t(int, MLX5_CAP_GEN(dev, max_flow_counter) * ESW_OFFLOADS_NUM_GROUPS,
434+
1 << MLX5_CAP_ESW_FLOWTABLE_FDB(dev, log_max_ft_size));
432435

433436
if (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, encap) &&
434437
MLX5_CAP_ESW_FLOWTABLE_FDB(dev, decap))
435438
flags |= MLX5_FLOW_TABLE_TUNNEL_EN;
436439

437440
fdb = mlx5_create_auto_grouped_flow_table(root_ns, FDB_FAST_PATH,
438-
ESW_OFFLOADS_NUM_ENTRIES,
441+
esw_size,
439442
ESW_OFFLOADS_NUM_GROUPS, 0,
440443
flags);
441444
if (IS_ERR(fdb)) {

0 commit comments

Comments
 (0)