* [PATCH net-next] net/mlx5: E-Switch, Size FDB peer groups for asymmetric peers
@ 2026-11-16 21:09 Tariq Toukan
2026-11-16 21:17 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Tariq Toukan @ 2026-11-16 21:09 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
netdev, Paolo Abeni
Cc: Gal Pressman, Leon Romanovsky, open list, linux-rdma, Mark Bloch,
Moshe Shemesh, Saeed Mahameed, Shay Drori, Tariq Toukan, Uri Dar
From: Uri Dar <udar@nvidia.com>
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 <udar@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Shay Drori <shayd@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
.../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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net-next] net/mlx5: E-Switch, Size FDB peer groups for asymmetric peers
2026-11-16 21:09 [PATCH net-next] net/mlx5: E-Switch, Size FDB peer groups for asymmetric peers Tariq Toukan
@ 2026-11-16 21:17 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-16 21:17 UTC (permalink / raw)
To: Tariq Toukan; +Cc: linux-rdma
> From: Uri Dar <udar@nvidia.com>
>
> 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 <udar@nvidia.com>
> Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
> Reviewed-by: Shay Drori <shayd@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116210917.1297111-1-tariqt@nvidia.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-16 21:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 21:09 [PATCH net-next] net/mlx5: E-Switch, Size FDB peer groups for asymmetric peers Tariq Toukan
2026-11-16 21:17 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox