Skip to content

Commit edc0b0b

Browse files
mark-blochjgunthorpe
authored andcommitted
RDMA/mlx5: Block FDB rules when not in switchdev mode
Allow creating FDB steering rules only when in switchdev mode. The only software model where a userspace application can manipulate FDB entries is when it manages the eswitch. This is only possible in switchdev mode where we expose a single RDMA device with representors for all the vports that are connected to the eswitch. Fixes: 52438be ("RDMA/mlx5: Allow inserting a steering rule to the FDB") Link: https://lore.kernel.org/r/e928ae7c58d07f104716a2a8d730963d1bd01204.1623052923.git.leonro@nvidia.com Reviewed-by: Maor Gottlieb <[email protected]> Signed-off-by: Mark Bloch <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 404e5a1 commit edc0b0b

File tree

1 file changed

+6
-0
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+6
-0
lines changed

drivers/infiniband/hw/mlx5/fs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,6 +2134,12 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_FLOW_MATCHER_CREATE)(
21342134
if (err)
21352135
goto end;
21362136

2137+
if (obj->ns_type == MLX5_FLOW_NAMESPACE_FDB &&
2138+
mlx5_eswitch_mode(dev->mdev) != MLX5_ESWITCH_OFFLOADS) {
2139+
err = -EINVAL;
2140+
goto end;
2141+
}
2142+
21372143
uobj->object = obj;
21382144
obj->mdev = dev->mdev;
21392145
atomic_set(&obj->usecnt, 0);

0 commit comments

Comments
 (0)