Commit 676a80ad authored by Jason Gunthorpe's avatar Jason Gunthorpe

RDMA: Remove AH from uverbs_cmd_mask

Drivers that need a uverbs AH should instead set the create_user_ah() op
similar to reg_user_mr(). MODIFY_AH and QUERY_AH cmds were never
implemented so are just deleted.

Link: https://lore.kernel.org/r/11-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.comSigned-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 628c02bf
...@@ -606,6 +606,7 @@ struct ib_device *_ib_alloc_device(size_t size) ...@@ -606,6 +606,7 @@ struct ib_device *_ib_alloc_device(size_t size)
BIT_ULL(IB_USER_VERBS_CMD_ALLOC_PD) | BIT_ULL(IB_USER_VERBS_CMD_ALLOC_PD) |
BIT_ULL(IB_USER_VERBS_CMD_ATTACH_MCAST) | BIT_ULL(IB_USER_VERBS_CMD_ATTACH_MCAST) |
BIT_ULL(IB_USER_VERBS_CMD_CLOSE_XRCD) | BIT_ULL(IB_USER_VERBS_CMD_CLOSE_XRCD) |
BIT_ULL(IB_USER_VERBS_CMD_CREATE_AH) |
BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) | BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
BIT_ULL(IB_USER_VERBS_CMD_CREATE_CQ) | BIT_ULL(IB_USER_VERBS_CMD_CREATE_CQ) |
BIT_ULL(IB_USER_VERBS_CMD_CREATE_QP) | BIT_ULL(IB_USER_VERBS_CMD_CREATE_QP) |
...@@ -614,6 +615,7 @@ struct ib_device *_ib_alloc_device(size_t size) ...@@ -614,6 +615,7 @@ struct ib_device *_ib_alloc_device(size_t size)
BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_MW) | BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_MW) |
BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_PD) | BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_PD) |
BIT_ULL(IB_USER_VERBS_CMD_DEREG_MR) | BIT_ULL(IB_USER_VERBS_CMD_DEREG_MR) |
BIT_ULL(IB_USER_VERBS_CMD_DESTROY_AH) |
BIT_ULL(IB_USER_VERBS_CMD_DESTROY_CQ) | BIT_ULL(IB_USER_VERBS_CMD_DESTROY_CQ) |
BIT_ULL(IB_USER_VERBS_CMD_DESTROY_QP) | BIT_ULL(IB_USER_VERBS_CMD_DESTROY_QP) |
BIT_ULL(IB_USER_VERBS_CMD_DESTROY_SRQ) | BIT_ULL(IB_USER_VERBS_CMD_DESTROY_SRQ) |
...@@ -2606,6 +2608,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops) ...@@ -2606,6 +2608,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
SET_DEVICE_OP(dev_ops, create_qp); SET_DEVICE_OP(dev_ops, create_qp);
SET_DEVICE_OP(dev_ops, create_rwq_ind_table); SET_DEVICE_OP(dev_ops, create_rwq_ind_table);
SET_DEVICE_OP(dev_ops, create_srq); SET_DEVICE_OP(dev_ops, create_srq);
SET_DEVICE_OP(dev_ops, create_user_ah);
SET_DEVICE_OP(dev_ops, create_wq); SET_DEVICE_OP(dev_ops, create_wq);
SET_DEVICE_OP(dev_ops, dealloc_dm); SET_DEVICE_OP(dev_ops, dealloc_dm);
SET_DEVICE_OP(dev_ops, dealloc_driver); SET_DEVICE_OP(dev_ops, dealloc_driver);
......
...@@ -3689,13 +3689,13 @@ const struct uapi_definition uverbs_def_write_intf[] = { ...@@ -3689,13 +3689,13 @@ const struct uapi_definition uverbs_def_write_intf[] = {
ib_uverbs_create_ah, ib_uverbs_create_ah,
UAPI_DEF_WRITE_UDATA_IO( UAPI_DEF_WRITE_UDATA_IO(
struct ib_uverbs_create_ah, struct ib_uverbs_create_ah,
struct ib_uverbs_create_ah_resp), struct ib_uverbs_create_ah_resp)),
UAPI_DEF_METHOD_NEEDS_FN(create_ah)),
DECLARE_UVERBS_WRITE( DECLARE_UVERBS_WRITE(
IB_USER_VERBS_CMD_DESTROY_AH, IB_USER_VERBS_CMD_DESTROY_AH,
ib_uverbs_destroy_ah, ib_uverbs_destroy_ah,
UAPI_DEF_WRITE_I(struct ib_uverbs_destroy_ah), UAPI_DEF_WRITE_I(struct ib_uverbs_destroy_ah)),
UAPI_DEF_METHOD_NEEDS_FN(destroy_ah))), UAPI_DEF_OBJ_NEEDS_FN(create_user_ah),
UAPI_DEF_OBJ_NEEDS_FN(destroy_ah)),
DECLARE_UVERBS_OBJECT( DECLARE_UVERBS_OBJECT(
UVERBS_OBJECT_COMP_CHANNEL, UVERBS_OBJECT_COMP_CHANNEL,
......
...@@ -533,7 +533,10 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd, ...@@ -533,7 +533,10 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
init_attr.flags = flags; init_attr.flags = flags;
init_attr.xmit_slave = xmit_slave; init_attr.xmit_slave = xmit_slave;
ret = device->ops.create_ah(ah, &init_attr, udata); if (udata)
ret = device->ops.create_user_ah(ah, &init_attr, udata);
else
ret = device->ops.create_ah(ah, &init_attr, NULL);
if (ret) { if (ret) {
kfree(ah); kfree(ah);
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -646,6 +646,7 @@ static const struct ib_device_ops bnxt_re_dev_ops = { ...@@ -646,6 +646,7 @@ static const struct ib_device_ops bnxt_re_dev_ops = {
.create_cq = bnxt_re_create_cq, .create_cq = bnxt_re_create_cq,
.create_qp = bnxt_re_create_qp, .create_qp = bnxt_re_create_qp,
.create_srq = bnxt_re_create_srq, .create_srq = bnxt_re_create_srq,
.create_user_ah = bnxt_re_create_ah,
.dealloc_driver = bnxt_re_dealloc_driver, .dealloc_driver = bnxt_re_dealloc_driver,
.dealloc_pd = bnxt_re_dealloc_pd, .dealloc_pd = bnxt_re_dealloc_pd,
.dealloc_ucontext = bnxt_re_dealloc_ucontext, .dealloc_ucontext = bnxt_re_dealloc_ucontext,
...@@ -701,15 +702,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev) ...@@ -701,15 +702,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
ibdev->dev.parent = &rdev->en_dev->pdev->dev; ibdev->dev.parent = &rdev->en_dev->pdev->dev;
ibdev->local_dma_lkey = BNXT_QPLIB_RSVD_LKEY; ibdev->local_dma_lkey = BNXT_QPLIB_RSVD_LKEY;
/* User space */
ibdev->uverbs_cmd_mask |=
(1ull << IB_USER_VERBS_CMD_CREATE_AH) |
(1ull << IB_USER_VERBS_CMD_MODIFY_AH) |
(1ull << IB_USER_VERBS_CMD_QUERY_AH) |
(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
/* POLL_CQ and REQ_NOTIFY_CQ is directly handled in libbnxt_re */
rdma_set_device_sysfs_group(ibdev, &bnxt_re_dev_attr_group); rdma_set_device_sysfs_group(ibdev, &bnxt_re_dev_attr_group);
ib_set_device_ops(ibdev, &bnxt_re_dev_ops); ib_set_device_ops(ibdev, &bnxt_re_dev_ops);
ret = ib_device_set_netdev(&rdev->ibdev, rdev->netdev, 1); ret = ib_device_set_netdev(&rdev->ibdev, rdev->netdev, 1);
......
...@@ -248,6 +248,7 @@ static const struct ib_device_ops efa_dev_ops = { ...@@ -248,6 +248,7 @@ static const struct ib_device_ops efa_dev_ops = {
.create_ah = efa_create_ah, .create_ah = efa_create_ah,
.create_cq = efa_create_cq, .create_cq = efa_create_cq,
.create_qp = efa_create_qp, .create_qp = efa_create_qp,
.create_user_ah = efa_create_ah,
.dealloc_pd = efa_dealloc_pd, .dealloc_pd = efa_dealloc_pd,
.dealloc_ucontext = efa_dealloc_ucontext, .dealloc_ucontext = efa_dealloc_ucontext,
.dereg_mr = efa_dereg_mr, .dereg_mr = efa_dereg_mr,
...@@ -308,10 +309,6 @@ static int efa_ib_device_add(struct efa_dev *dev) ...@@ -308,10 +309,6 @@ static int efa_ib_device_add(struct efa_dev *dev)
dev->ibdev.num_comp_vectors = 1; dev->ibdev.num_comp_vectors = 1;
dev->ibdev.dev.parent = &pdev->dev; dev->ibdev.dev.parent = &pdev->dev;
dev->ibdev.uverbs_cmd_mask |=
(1ull << IB_USER_VERBS_CMD_CREATE_AH) |
(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
ib_set_device_ops(&dev->ibdev, &efa_dev_ops); ib_set_device_ops(&dev->ibdev, &efa_dev_ops);
err = ib_register_device(&dev->ibdev, "efa_%d", &pdev->dev); err = ib_register_device(&dev->ibdev, "efa_%d", &pdev->dev);
......
...@@ -4022,6 +4022,7 @@ static const struct ib_device_ops mlx5_ib_dev_ops = { ...@@ -4022,6 +4022,7 @@ static const struct ib_device_ops mlx5_ib_dev_ops = {
.create_cq = mlx5_ib_create_cq, .create_cq = mlx5_ib_create_cq,
.create_qp = mlx5_ib_create_qp, .create_qp = mlx5_ib_create_qp,
.create_srq = mlx5_ib_create_srq, .create_srq = mlx5_ib_create_srq,
.create_user_ah = mlx5_ib_create_ah,
.dealloc_pd = mlx5_ib_dealloc_pd, .dealloc_pd = mlx5_ib_dealloc_pd,
.dealloc_ucontext = mlx5_ib_dealloc_ucontext, .dealloc_ucontext = mlx5_ib_dealloc_ucontext,
.del_gid = mlx5_ib_del_gid, .del_gid = mlx5_ib_del_gid,
...@@ -4139,10 +4140,6 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev) ...@@ -4139,10 +4140,6 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
struct mlx5_core_dev *mdev = dev->mdev; struct mlx5_core_dev *mdev = dev->mdev;
int err; int err;
dev->ib_dev.uverbs_cmd_mask |=
(1ull << IB_USER_VERBS_CMD_CREATE_AH) |
(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
if (MLX5_CAP_GEN(mdev, ipoib_enhanced_offloads) && if (MLX5_CAP_GEN(mdev, ipoib_enhanced_offloads) &&
IS_ENABLED(CONFIG_MLX5_CORE_IPOIB)) IS_ENABLED(CONFIG_MLX5_CORE_IPOIB))
ib_set_device_ops(&dev->ib_dev, ib_set_device_ops(&dev->ib_dev,
......
...@@ -154,6 +154,7 @@ static const struct ib_device_ops ocrdma_dev_ops = { ...@@ -154,6 +154,7 @@ static const struct ib_device_ops ocrdma_dev_ops = {
.create_ah = ocrdma_create_ah, .create_ah = ocrdma_create_ah,
.create_cq = ocrdma_create_cq, .create_cq = ocrdma_create_cq,
.create_qp = ocrdma_create_qp, .create_qp = ocrdma_create_qp,
.create_user_ah = ocrdma_create_ah,
.dealloc_pd = ocrdma_dealloc_pd, .dealloc_pd = ocrdma_dealloc_pd,
.dealloc_ucontext = ocrdma_dealloc_ucontext, .dealloc_ucontext = ocrdma_dealloc_ucontext,
.dereg_mr = ocrdma_dereg_mr, .dereg_mr = ocrdma_dereg_mr,
...@@ -205,12 +206,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) ...@@ -205,12 +206,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
memcpy(dev->ibdev.node_desc, OCRDMA_NODE_DESC, memcpy(dev->ibdev.node_desc, OCRDMA_NODE_DESC,
sizeof(OCRDMA_NODE_DESC)); sizeof(OCRDMA_NODE_DESC));
dev->ibdev.uverbs_cmd_mask |=
OCRDMA_UVERBS(CREATE_AH) |
OCRDMA_UVERBS(MODIFY_AH) |
OCRDMA_UVERBS(QUERY_AH) |
OCRDMA_UVERBS(DESTROY_AH);
dev->ibdev.node_type = RDMA_NODE_IB_CA; dev->ibdev.node_type = RDMA_NODE_IB_CA;
dev->ibdev.phys_port_cnt = 1; dev->ibdev.phys_port_cnt = 1;
dev->ibdev.num_comp_vectors = dev->eq_cnt; dev->ibdev.num_comp_vectors = dev->eq_cnt;
......
...@@ -129,7 +129,6 @@ int rvt_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr, ...@@ -129,7 +129,6 @@ int rvt_create_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *init_attr,
* rvt_destory_ah - Destory an address handle * rvt_destory_ah - Destory an address handle
* @ibah: address handle * @ibah: address handle
* @destroy_flags: destroy address handle flags (see enum rdma_destroy_ah_flags) * @destroy_flags: destroy address handle flags (see enum rdma_destroy_ah_flags)
*
* Return: 0 on success * Return: 0 on success
*/ */
int rvt_destroy_ah(struct ib_ah *ibah, u32 destroy_flags) int rvt_destroy_ah(struct ib_ah *ibah, u32 destroy_flags)
......
...@@ -384,6 +384,7 @@ static const struct ib_device_ops rvt_dev_ops = { ...@@ -384,6 +384,7 @@ static const struct ib_device_ops rvt_dev_ops = {
.create_cq = rvt_create_cq, .create_cq = rvt_create_cq,
.create_qp = rvt_create_qp, .create_qp = rvt_create_qp,
.create_srq = rvt_create_srq, .create_srq = rvt_create_srq,
.create_user_ah = rvt_create_ah,
.dealloc_pd = rvt_dealloc_pd, .dealloc_pd = rvt_dealloc_pd,
.dealloc_ucontext = rvt_dealloc_ucontext, .dealloc_ucontext = rvt_dealloc_ucontext,
.dereg_mr = rvt_dereg_mr, .dereg_mr = rvt_dereg_mr,
...@@ -594,10 +595,6 @@ int rvt_register_device(struct rvt_dev_info *rdi) ...@@ -594,10 +595,6 @@ int rvt_register_device(struct rvt_dev_info *rdi)
* version, so we do all of this sort of stuff here. * version, so we do all of this sort of stuff here.
*/ */
rdi->ibdev.uverbs_cmd_mask |= rdi->ibdev.uverbs_cmd_mask |=
(1ull << IB_USER_VERBS_CMD_CREATE_AH) |
(1ull << IB_USER_VERBS_CMD_MODIFY_AH) |
(1ull << IB_USER_VERBS_CMD_QUERY_AH) |
(1ull << IB_USER_VERBS_CMD_DESTROY_AH) |
(1ull << IB_USER_VERBS_CMD_POLL_CQ) | (1ull << IB_USER_VERBS_CMD_POLL_CQ) |
(1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) | (1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
(1ull << IB_USER_VERBS_CMD_POST_SEND) | (1ull << IB_USER_VERBS_CMD_POST_SEND) |
......
...@@ -1079,6 +1079,7 @@ static const struct ib_device_ops rxe_dev_ops = { ...@@ -1079,6 +1079,7 @@ static const struct ib_device_ops rxe_dev_ops = {
.create_cq = rxe_create_cq, .create_cq = rxe_create_cq,
.create_qp = rxe_create_qp, .create_qp = rxe_create_qp,
.create_srq = rxe_create_srq, .create_srq = rxe_create_srq,
.create_user_ah = rxe_create_ah,
.dealloc_driver = rxe_dealloc, .dealloc_driver = rxe_dealloc,
.dealloc_pd = rxe_dealloc_pd, .dealloc_pd = rxe_dealloc_pd,
.dealloc_ucontext = rxe_dealloc_ucontext, .dealloc_ucontext = rxe_dealloc_ucontext,
...@@ -1141,13 +1142,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) ...@@ -1141,13 +1142,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
dma_set_max_seg_size(&dev->dev, UINT_MAX); dma_set_max_seg_size(&dev->dev, UINT_MAX);
dma_set_coherent_mask(&dev->dev, dma_get_required_mask(&dev->dev)); dma_set_coherent_mask(&dev->dev, dma_get_required_mask(&dev->dev));
dev->uverbs_cmd_mask |= dev->uverbs_cmd_mask |= BIT_ULL(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ);
BIT_ULL(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ)
| BIT_ULL(IB_USER_VERBS_CMD_CREATE_AH)
| BIT_ULL(IB_USER_VERBS_CMD_MODIFY_AH)
| BIT_ULL(IB_USER_VERBS_CMD_QUERY_AH)
| BIT_ULL(IB_USER_VERBS_CMD_DESTROY_AH)
;
ib_set_device_ops(dev, &rxe_dev_ops); ib_set_device_ops(dev, &rxe_dev_ops);
err = ib_device_set_netdev(&rxe->ib_dev, rxe->ndev, 1); err = ib_device_set_netdev(&rxe->ib_dev, rxe->ndev, 1);
......
...@@ -2403,6 +2403,8 @@ struct ib_device_ops { ...@@ -2403,6 +2403,8 @@ struct ib_device_ops {
int (*dealloc_pd)(struct ib_pd *pd, struct ib_udata *udata); int (*dealloc_pd)(struct ib_pd *pd, struct ib_udata *udata);
int (*create_ah)(struct ib_ah *ah, struct rdma_ah_init_attr *attr, int (*create_ah)(struct ib_ah *ah, struct rdma_ah_init_attr *attr,
struct ib_udata *udata); struct ib_udata *udata);
int (*create_user_ah)(struct ib_ah *ah, struct rdma_ah_init_attr *attr,
struct ib_udata *udata);
int (*modify_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr); int (*modify_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr);
int (*query_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr); int (*query_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr);
int (*destroy_ah)(struct ib_ah *ah, u32 flags); int (*destroy_ah)(struct ib_ah *ah, u32 flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment