diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2018-12-10 11:19:49 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-12-11 14:38:16 -0700 |
commit | a1462351b590a4fa8eed6e5bf14245425635be0d (patch) | |
tree | e10d6a0c0b612aecd0614340db6ac3d9e11c2ad7 /drivers | |
parent | f94e02ddfd88a511ed64fb68905e35d727635fea (diff) | |
download | linux-a1462351b590a4fa8eed6e5bf14245425635be0d.tar.gz |
RDMA/mlx5: Fail early if user tries to create flows on IB representors
IB representors don't support creation of RAW ethernet QP flows. Disable
them by reusing existing RDMA/core support macros. We do it for both
creation and matcher because latter is not usable if no flow creation is
available.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/mlx5/flow.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx5/flow.c b/drivers/infiniband/hw/mlx5/flow.c index b73756bd38bd..b840d4eeba84 100644 --- a/drivers/infiniband/hw/mlx5/flow.c +++ b/drivers/infiniband/hw/mlx5/flow.c @@ -134,8 +134,6 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_CREATE_FLOW)( return -EINVAL; flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT; } - if (dev->rep) - return -ENOTSUPP; if (dest_type == MLX5_FLOW_DESTINATION_TYPE_TIR && fs_matcher->ns_type == MLX5_FLOW_NAMESPACE_EGRESS) @@ -623,9 +621,19 @@ DECLARE_UVERBS_NAMED_OBJECT(MLX5_IB_OBJECT_FLOW_MATCHER, &UVERBS_METHOD(MLX5_IB_METHOD_FLOW_MATCHER_CREATE), &UVERBS_METHOD(MLX5_IB_METHOD_FLOW_MATCHER_DESTROY)); +static bool flow_is_supported(struct ib_device *device) +{ + return !to_mdev(device)->rep; +} + const struct uapi_definition mlx5_ib_flow_defs[] = { - UAPI_DEF_CHAIN_OBJ_TREE_NAMED(MLX5_IB_OBJECT_FLOW_MATCHER), - UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW, &mlx5_ib_fs), + UAPI_DEF_CHAIN_OBJ_TREE_NAMED( + MLX5_IB_OBJECT_FLOW_MATCHER, + UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), + UAPI_DEF_CHAIN_OBJ_TREE( + UVERBS_OBJECT_FLOW, + &mlx5_ib_fs, + UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, &mlx5_ib_flow_actions), {}, |