From: Uri Dar The slow path FDB send-to-vport and peer-miss groups are sized from the local eswitch total_vports, assuming every eswitch that may pair has the same number of vports. Per-PF VF configuration (e.g. PF_NUM_OF_VF set differently per port) breaks that assumption: the larger peer installs rules sized by its own total_vports into the smaller peer's groups, which cannot hold them, so pairing fails. In SW and HW steering the flow table is unbounded (max_fte is INT_MAX) and flow groups are backed by dynamically grown matchers, so size the peer dependent groups to the architectural vport maximum. FW steering, whose table is bounded by log_max_ft_size, keeps the current sizing. Signed-off-by: Uri Dar Reviewed-by: Moshe Shemesh Reviewed-by: Shay Drori Signed-off-by: Tariq Toukan --- .../mellanox/mlx5/core/eswitch_offloads.c | 17 +++++++++++++++-- include/linux/mlx5/eswitch.h | 2 ++ 2 files changed, 17 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 474784131091..20eca8b89b8f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -1744,6 +1744,17 @@ esw_chains_destroy(struct mlx5_eswitch *esw, struct mlx5_fs_chains *chains) #endif +/* SW and HW steering tables are unbounded, so they can be sized for any peer. + * FW steering is bounded by log_max_ft_size, so it uses local total_vports. + */ +static int esw_max_vports(const struct mlx5_eswitch *esw) +{ + if (esw->dev->priv.steering->mode == MLX5_FLOW_STEERING_MODE_DMFS) + return esw->total_vports; + + return MLX5_ESW_MAX_VPORT_ID; +} + static int esw_create_send_to_vport_group(struct mlx5_eswitch *esw, struct mlx5_flow_table *fdb, @@ -1771,7 +1782,9 @@ esw_create_send_to_vport_group(struct mlx5_eswitch *esw, } /* See comment at table_size calculation */ - count = MLX5_MAX_PORTS * (esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ); + count = MLX5_MAX_PORTS * + (esw_max_vports(esw) * MAX_SQ_NVPORTS + MAX_PF_SQ); + MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, 0); MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, *ix + count - 1); *ix += count; @@ -1841,7 +1854,7 @@ esw_create_peer_esw_miss_group(struct mlx5_eswitch *esw, u32 *flow_group_in, int *ix) { - int max_peer_ports = (esw->total_vports - 1) * (MLX5_MAX_PORTS - 1); + int max_peer_ports = (esw_max_vports(esw) - 1) * (MLX5_MAX_PORTS - 1); int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); struct mlx5_flow_group *g; void *match_criteria; diff --git a/include/linux/mlx5/eswitch.h b/include/linux/mlx5/eswitch.h index 03d3620141c8..cfc52d0697e4 100644 --- a/include/linux/mlx5/eswitch.h +++ b/include/linux/mlx5/eswitch.h @@ -103,6 +103,8 @@ bool mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw); #define ESW_REG_C0_USER_DATA_METADATA_BITS (32 - ESW_SOURCE_PORT_METADATA_BITS) #define ESW_REG_C0_USER_DATA_METADATA_MASK GENMASK(ESW_REG_C0_USER_DATA_METADATA_BITS - 1, 0) +#define MLX5_ESW_MAX_VPORT_ID ((1 << ESW_VPORT_BITS) - 1) + static inline u32 mlx5_eswitch_get_vport_metadata_mask(void) { return GENMASK(31, 32 - ESW_SOURCE_PORT_METADATA_BITS); base-commit: 7ccc5e05043b1bb84326b19a2b05938d8f7a2ae6 -- 2.44.0