diff options
author | Yishai Hadas <yishaih@mellanox.com> | 2018-07-23 15:25:12 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-07-24 14:33:52 -0600 |
commit | cb80fb189270e7b2c32fa470d40e951852614eb2 (patch) | |
tree | 0a538622315d2a159938a85d4632dc84946bc97e | |
parent | 6346f0bfa07b3a4ed55b8630cf20b6f43d277b51 (diff) | |
download | linux-stable-cb80fb189270e7b2c32fa470d40e951852614eb2.tar.gz linux-stable-cb80fb189270e7b2c32fa470d40e951852614eb2.tar.bz2 linux-stable-cb80fb189270e7b2c32fa470d40e951852614eb2.zip |
IB/mlx5: Enable driver uapi commands for flow steering
Expose the mlx5 flow steering parsing trees, exposing the functionality to
user space.
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r-- | drivers/infiniband/hw/mlx5/flow.c | 10 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx5/mlx5_ib.h | 12 |
3 files changed, 19 insertions, 7 deletions
diff --git a/drivers/infiniband/hw/mlx5/flow.c b/drivers/infiniband/hw/mlx5/flow.c index b4422e4def17..ee398a9b5f26 100644 --- a/drivers/infiniband/hw/mlx5/flow.c +++ b/drivers/infiniband/hw/mlx5/flow.c @@ -242,3 +242,13 @@ DECLARE_UVERBS_NAMED_OBJECT(MLX5_IB_OBJECT_FLOW_MATCHER, DECLARE_UVERBS_OBJECT_TREE(flow_objects, &UVERBS_OBJECT(MLX5_IB_OBJECT_FLOW_MATCHER)); + +int mlx5_ib_get_flow_trees(const struct uverbs_object_tree_def **root) +{ + int i = 0; + + root[i++] = &flow_objects; + root[i++] = &mlx5_ib_fs; + + return i; +} diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 11ed9416db48..a26ab69f3741 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -5535,7 +5535,7 @@ ADD_UVERBS_ATTRIBUTES_SIMPLE( UVERBS_ATTR_TYPE(u64), UA_MANDATORY)); -#define NUM_TREES 3 +#define NUM_TREES 5 static int populate_specs_root(struct mlx5_ib_dev *dev) { const struct uverbs_object_tree_def *default_root[NUM_TREES + 1] = { @@ -5555,6 +5555,8 @@ static int populate_specs_root(struct mlx5_ib_dev *dev) !WARN_ON(num_trees >= ARRAY_SIZE(default_root))) default_root[num_trees++] = mlx5_ib_get_devx_tree(); + num_trees += mlx5_ib_get_flow_trees(default_root + num_trees); + dev->ib_dev.driver_specs_root = uverbs_alloc_spec_tree(num_trees, default_root); diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index 33948b547894..462505c8fa25 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h @@ -1236,6 +1236,7 @@ struct mlx5_ib_flow_handler *mlx5_ib_raw_fs_rule_add( struct mlx5_ib_dev *dev, struct mlx5_ib_flow_matcher *fs_matcher, void *cmd_in, int inlen, int dest_id, int dest_type); bool mlx5_ib_devx_is_flow_dest(void *obj, int *dest_id, int *dest_type); +int mlx5_ib_get_flow_trees(const struct uverbs_object_tree_def **root); #else static inline int mlx5_ib_devx_create(struct mlx5_ib_dev *dev, @@ -1244,17 +1245,16 @@ static inline void mlx5_ib_devx_destroy(struct mlx5_ib_dev *dev, struct mlx5_ib_ucontext *context) {} static inline const struct uverbs_object_tree_def * mlx5_ib_get_devx_tree(void) { return NULL; } -static inline struct mlx5_ib_flow_handler *mlx5_ib_raw_fs_rule_add( - struct mlx5_ib_dev *dev, struct mlx5_ib_flow_matcher *fs_matcher, - void *cmd_in, int inlen, int dest_id, int dest_type) -{ - return ERR_PTR(-EOPNOTSUPP); -} static inline bool mlx5_ib_devx_is_flow_dest(void *obj, int *dest_id, int *dest_type) { return false; } +static inline int +mlx5_ib_get_flow_trees(const struct uverbs_object_tree_def **root) +{ + return 0; +} #endif static inline void init_query_mad(struct ib_smp *mad) { |