diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2018-11-12 22:59:53 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-11-22 11:57:32 -0700 |
commit | 36e235c8829935a59d4652c878cffb08229205c2 (patch) | |
tree | 46233905a4ce85bf2eb0a5411c261fd957fcaf10 /drivers/infiniband/hw/mlx5/main.c | |
parent | 6829c1c2b371674a05562a39d608b5cf48351bea (diff) | |
download | linux-36e235c8829935a59d4652c878cffb08229205c2.tar.bz2 |
RDMA/mlx5: Use the uapi disablement APIs instead of code
Rely on UAPI_DEF_IS_OBJ_SUPPORTED instead of manipulating the contents of
the driver's definition list.
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx5/main.c')
-rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 30a35a8ae0bb..0707ede7dcdd 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -5552,6 +5552,7 @@ ADD_UVERBS_ATTRIBUTES_SIMPLE( static const struct uapi_definition mlx5_ib_defs[] = { #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) + UAPI_DEF_CHAIN(mlx5_ib_devx_defs), UAPI_DEF_CHAIN(mlx5_ib_flow_defs), #endif @@ -5561,27 +5562,6 @@ static const struct uapi_definition mlx5_ib_defs[] = { {} }; -static int populate_specs_root(struct mlx5_ib_dev *dev) -{ - struct uapi_definition *defs = dev->driver_defs; - -#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) - if (MLX5_CAP_GEN_64(dev->mdev, general_obj_types) & - MLX5_GENERAL_OBJ_TYPES_CAP_UCTX) - *defs++ = (struct uapi_definition)UAPI_DEF_CHAIN( - mlx5_ib_devx_defs); -#endif - - *defs++ = (struct uapi_definition)UAPI_DEF_CHAIN(mlx5_ib_defs); - *defs++ = (struct uapi_definition){}; - WARN_ON(defs - dev->driver_defs >= ARRAY_SIZE(dev->driver_defs)); - - if (IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)) - dev->ib_dev.driver_def = dev->driver_defs; - - return 0; -} - static int mlx5_ib_read_counters(struct ib_counters *counters, struct ib_counters_read_attr *read_attr, struct uverbs_attr_bundle *attrs) @@ -5898,6 +5878,9 @@ int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev) dev->ib_dev.destroy_counters = mlx5_ib_destroy_counters; dev->ib_dev.read_counters = mlx5_ib_read_counters; + if (IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)) + dev->ib_dev.driver_def = mlx5_ib_defs; + err = init_node_data(dev); if (err) return err; @@ -6110,11 +6093,6 @@ void mlx5_ib_stage_bfrag_cleanup(struct mlx5_ib_dev *dev) mlx5_free_bfreg(dev->mdev, &dev->bfreg); } -static int mlx5_ib_stage_populate_specs(struct mlx5_ib_dev *dev) -{ - return populate_specs_root(dev); -} - int mlx5_ib_stage_ib_reg_init(struct mlx5_ib_dev *dev) { const char *name; @@ -6249,9 +6227,6 @@ static const struct mlx5_ib_profile pf_profile = { STAGE_CREATE(MLX5_IB_STAGE_PRE_IB_REG_UMR, NULL, mlx5_ib_stage_pre_ib_reg_umr_cleanup), - STAGE_CREATE(MLX5_IB_STAGE_SPECS, - mlx5_ib_stage_populate_specs, - NULL), STAGE_CREATE(MLX5_IB_STAGE_IB_REG, mlx5_ib_stage_ib_reg_init, mlx5_ib_stage_ib_reg_cleanup), @@ -6294,9 +6269,6 @@ static const struct mlx5_ib_profile nic_rep_profile = { STAGE_CREATE(MLX5_IB_STAGE_PRE_IB_REG_UMR, NULL, mlx5_ib_stage_pre_ib_reg_umr_cleanup), - STAGE_CREATE(MLX5_IB_STAGE_SPECS, - mlx5_ib_stage_populate_specs, - NULL), STAGE_CREATE(MLX5_IB_STAGE_IB_REG, mlx5_ib_stage_ib_reg_init, mlx5_ib_stage_ib_reg_cleanup), |