All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask
@ 2020-10-03 23:20 Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 01/11] RDMA/cxgb4: Remove MW support Jason Gunthorpe
                   ` (12 more replies)
  0 siblings, 13 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dennis Dalessandro,
	Devesh Sharma, Doug Ledford, Faisal Latif, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Mike Marciniszyn,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Shiraz Saleem, Yossi Leybovich, Somnath Kotur,
	Sriharsha Basavapatna, Zhu Yanjun, Yishai Hadas

These have become increasingly redundant as the uverbs core layer has got
better at not invoking drivers in situations they are not supporting.

The remaining uses are only in rxe and rvt for kernel datapath commands
these drivers expose to userspace.

There are many, many weird and wrong things in the drivers related to
these masks. This closes a number of troublesome cases.

Jason Gunthorpe (11):
  RDMA/cxgb4: Remove MW support
  RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions
  RDMA: Remove elements in uverbs_cmd_mask that all drivers set
  RDMA: Move more uverbs_cmd_mask settings to the core
  RDMA: Check srq_type during create_srq
  RDMA: Check attr_mask during modify_qp
  RDMA: Check flags during create_cq
  RDMA: Check create_flags during create_qp
  RDMA/core Remove uverbs_ex_cmd_mask
  RDMA: Remove uverbs cmds from drivers that don't use them
  RDMA: Remove AH from uverbs_cmd_mask

 drivers/infiniband/core/device.c              | 33 ++++++++
 drivers/infiniband/core/uverbs_cmd.c          | 26 +++---
 drivers/infiniband/core/uverbs_uapi.c         |  5 +-
 drivers/infiniband/core/verbs.c               |  5 +-
 drivers/infiniband/hw/bnxt_re/ib_verbs.c      | 10 ++-
 drivers/infiniband/hw/bnxt_re/main.c          | 30 +------
 drivers/infiniband/hw/cxgb4/cq.c              |  2 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h        |  2 -
 drivers/infiniband/hw/cxgb4/mem.c             | 84 -------------------
 drivers/infiniband/hw/cxgb4/provider.c        | 24 ------
 drivers/infiniband/hw/cxgb4/qp.c              |  8 +-
 drivers/infiniband/hw/efa/efa_main.c          | 22 +----
 drivers/infiniband/hw/efa/efa_verbs.c         |  6 ++
 drivers/infiniband/hw/hns/hns_roce_cq.c       |  3 +
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c    |  9 +-
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c    |  3 +
 drivers/infiniband/hw/hns/hns_roce_main.c     | 35 +-------
 drivers/infiniband/hw/hns/hns_roce_qp.c       | 14 +---
 drivers/infiniband/hw/hns/hns_roce_srq.c      |  4 +
 drivers/infiniband/hw/i40iw/i40iw_verbs.c     | 29 ++-----
 drivers/infiniband/hw/mlx4/main.c             | 52 +-----------
 drivers/infiniband/hw/mlx4/qp.c               |  5 +-
 drivers/infiniband/hw/mlx4/srq.c              |  4 +
 drivers/infiniband/hw/mlx5/main.c             | 55 +-----------
 drivers/infiniband/hw/mlx5/qp.c               | 10 ++-
 drivers/infiniband/hw/mlx5/srq.c              |  5 ++
 drivers/infiniband/hw/mthca/mthca_provider.c  | 28 +------
 drivers/infiniband/hw/mthca/mthca_qp.c        |  3 +
 drivers/infiniband/hw/ocrdma/ocrdma_main.c    | 38 +--------
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c   | 11 ++-
 drivers/infiniband/hw/qedr/main.c             | 29 -------
 drivers/infiniband/hw/qedr/verbs.c            | 13 +++
 drivers/infiniband/hw/usnic/usnic_ib_main.c   | 19 -----
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c  |  7 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c  |  3 +
 .../infiniband/hw/vmw_pvrdma/pvrdma_main.c    | 28 -------
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c  |  5 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c |  2 +-
 drivers/infiniband/sw/rdmavt/ah.c             |  1 -
 drivers/infiniband/sw/rdmavt/cq.c             |  2 +-
 drivers/infiniband/sw/rdmavt/qp.c             | 10 ++-
 drivers/infiniband/sw/rdmavt/vt.c             | 28 +------
 drivers/infiniband/sw/rxe/rxe_verbs.c         | 45 +++-------
 drivers/infiniband/sw/siw/siw_main.c          | 24 ------
 drivers/infiniband/sw/siw/siw_verbs.c         | 12 +++
 include/rdma/ib_verbs.h                       |  5 +-
 include/uapi/rdma/ib_user_verbs.h             | 14 ----
 47 files changed, 206 insertions(+), 606 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 01/11] RDMA/cxgb4: Remove MW support
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-05  5:56   ` Leon Romanovsky
  2020-10-03 23:20 ` [PATCH 02/11] RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions Jason Gunthorpe
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Potnuri Bharat Teja, linux-rdma, Bob Pearson

This driver never enabled IB_USER_VERBS_CMD_ALLOC_MW so memory windows
were not usable from userspace. The kernel side was removed long ago. Drop
this dead code.

Fixes: feb7c1e38bcc ("IB: remove in-kernel support for memory windows")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h |  2 -
 drivers/infiniband/hw/cxgb4/mem.c      | 84 --------------------------
 drivers/infiniband/hw/cxgb4/provider.c |  2 -
 3 files changed, 88 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
index a27899402f59a5..f85477f3b037d2 100644
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -983,9 +983,7 @@ struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
 			    u32 max_num_sg);
 int c4iw_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,
 		   unsigned int *sg_offset);
-int c4iw_dealloc_mw(struct ib_mw *mw);
 void c4iw_dealloc(struct uld_ctx *ctx);
-int c4iw_alloc_mw(struct ib_mw *mw, struct ib_udata *udata);
 struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start,
 					   u64 length, u64 virt, int acc,
 					   struct ib_udata *udata);
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index 42234df896fb2c..a2c71a1d93d5a8 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -365,22 +365,6 @@ static int dereg_mem(struct c4iw_rdev *rdev, u32 stag, u32 pbl_size,
 			       pbl_size, pbl_addr, skb, wr_waitp);
 }
 
-static int allocate_window(struct c4iw_rdev *rdev, u32 *stag, u32 pdid,
-			   struct c4iw_wr_wait *wr_waitp)
-{
-	*stag = T4_STAG_UNSET;
-	return write_tpt_entry(rdev, 0, stag, 0, pdid, FW_RI_STAG_MW, 0, 0, 0,
-			       0UL, 0, 0, 0, 0, NULL, wr_waitp);
-}
-
-static int deallocate_window(struct c4iw_rdev *rdev, u32 stag,
-			     struct sk_buff *skb,
-			     struct c4iw_wr_wait *wr_waitp)
-{
-	return write_tpt_entry(rdev, 1, &stag, 0, 0, 0, 0, 0, 0, 0UL, 0, 0, 0,
-			       0, skb, wr_waitp);
-}
-
 static int allocate_stag(struct c4iw_rdev *rdev, u32 *stag, u32 pdid,
 			 u32 pbl_size, u32 pbl_addr,
 			 struct c4iw_wr_wait *wr_waitp)
@@ -611,74 +595,6 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 	return ERR_PTR(err);
 }
 
-int c4iw_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata)
-{
-	struct c4iw_mw *mhp = to_c4iw_mw(ibmw);
-	struct c4iw_dev *rhp;
-	struct c4iw_pd *php;
-	u32 mmid;
-	u32 stag = 0;
-	int ret;
-
-	if (ibmw->type != IB_MW_TYPE_1)
-		return -EINVAL;
-
-	php = to_c4iw_pd(ibmw->pd);
-	rhp = php->rhp;
-	mhp->wr_waitp = c4iw_alloc_wr_wait(GFP_KERNEL);
-	if (!mhp->wr_waitp)
-		return -ENOMEM;
-
-	mhp->dereg_skb = alloc_skb(SGE_MAX_WR_LEN, GFP_KERNEL);
-	if (!mhp->dereg_skb) {
-		ret = -ENOMEM;
-		goto free_wr_wait;
-	}
-
-	ret = allocate_window(&rhp->rdev, &stag, php->pdid, mhp->wr_waitp);
-	if (ret)
-		goto free_skb;
-
-	mhp->rhp = rhp;
-	mhp->attr.pdid = php->pdid;
-	mhp->attr.type = FW_RI_STAG_MW;
-	mhp->attr.stag = stag;
-	mmid = (stag) >> 8;
-	ibmw->rkey = stag;
-	if (xa_insert_irq(&rhp->mrs, mmid, mhp, GFP_KERNEL)) {
-		ret = -ENOMEM;
-		goto dealloc_win;
-	}
-	pr_debug("mmid 0x%x mhp %p stag 0x%x\n", mmid, mhp, stag);
-	return 0;
-
-dealloc_win:
-	deallocate_window(&rhp->rdev, mhp->attr.stag, mhp->dereg_skb,
-			  mhp->wr_waitp);
-free_skb:
-	kfree_skb(mhp->dereg_skb);
-free_wr_wait:
-	c4iw_put_wr_wait(mhp->wr_waitp);
-	return ret;
-}
-
-int c4iw_dealloc_mw(struct ib_mw *mw)
-{
-	struct c4iw_dev *rhp;
-	struct c4iw_mw *mhp;
-	u32 mmid;
-
-	mhp = to_c4iw_mw(mw);
-	rhp = mhp->rhp;
-	mmid = (mw->rkey) >> 8;
-	xa_erase_irq(&rhp->mrs, mmid);
-	deallocate_window(&rhp->rdev, mhp->attr.stag, mhp->dereg_skb,
-			  mhp->wr_waitp);
-	kfree_skb(mhp->dereg_skb);
-	c4iw_put_wr_wait(mhp->wr_waitp);
-	return 0;
-}
-
 struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
 			    u32 max_num_sg)
 {
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index 4b76f2f3f4e483..3bdcdce9def2da 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -456,13 +456,11 @@ static const struct ib_device_ops c4iw_dev_ops = {
 
 	.alloc_hw_stats = c4iw_alloc_stats,
 	.alloc_mr = c4iw_alloc_mr,
-	.alloc_mw = c4iw_alloc_mw,
 	.alloc_pd = c4iw_allocate_pd,
 	.alloc_ucontext = c4iw_alloc_ucontext,
 	.create_cq = c4iw_create_cq,
 	.create_qp = c4iw_create_qp,
 	.create_srq = c4iw_create_srq,
-	.dealloc_mw = c4iw_dealloc_mw,
 	.dealloc_pd = c4iw_deallocate_pd,
 	.dealloc_ucontext = c4iw_dealloc_ucontext,
 	.dereg_mr = c4iw_dereg_mr,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 02/11] RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 01/11] RDMA/cxgb4: Remove MW support Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-04 11:04   ` Gal Pressman
  2020-10-03 23:20 ` [PATCH 03/11] RDMA: Remove elements in uverbs_cmd_mask that all drivers set Jason Gunthorpe
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Doug Ledford, Gal Pressman, Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Lijun Ou, Bob Pearson,
	Yossi Leybovich, Yishai Hadas

Since a while now the uverbs layer checks if the driver implements a
function before allowing the ucmd to proceed. This largely obsoletes the
cmd_mask stuff, but there is some tricky bits in drivers preventing it
from being removed.

Remove the easy elements of uverbs_ex_cmd_mask by pre-setting them in the
core code. These are triggered soley based on the related ops function
pointer.

query_device_ex is not triggered based on an op, but all drivers already
implement something compatible with the extension, so enable it globally
too.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/core/device.c           | 11 +++++++++++
 drivers/infiniband/core/uverbs_cmd.c       |  2 +-
 drivers/infiniband/hw/efa/efa_main.c       |  3 ---
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c |  7 -------
 drivers/infiniband/hw/hns/hns_roce_main.c  |  2 --
 drivers/infiniband/hw/mlx4/main.c          | 14 +-------------
 drivers/infiniband/hw/mlx5/main.c          | 14 ++------------
 7 files changed, 15 insertions(+), 38 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index ec3becf85cac42..647abbfc9a9c60 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -600,6 +600,17 @@ struct ib_device *_ib_alloc_device(size_t size)
 	init_completion(&device->unreg_completion);
 	INIT_WORK(&device->unregistration_work, ib_unregister_work);
 
+	device->uverbs_ex_cmd_mask =
+		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_FLOW) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_WQ) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_FLOW) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_WQ) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_CQ) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_WQ) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_QUERY_DEVICE);
+
 	return device;
 }
 EXPORT_SYMBOL(_ib_alloc_device);
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 418d133a8fb080..2f3f9b87922e92 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3753,7 +3753,7 @@ const struct uapi_definition uverbs_def_write_intf[] = {
 			IB_USER_VERBS_EX_CMD_MODIFY_CQ,
 			ib_uverbs_ex_modify_cq,
 			UAPI_DEF_WRITE_I(struct ib_uverbs_ex_modify_cq),
-			UAPI_DEF_METHOD_NEEDS_FN(create_cq))),
+			UAPI_DEF_METHOD_NEEDS_FN(modify_cq))),
 
 	DECLARE_UVERBS_OBJECT(
 		UVERBS_OBJECT_DEVICE,
diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c
index 92d7011463203c..5cc746a6327ece 100644
--- a/drivers/infiniband/hw/efa/efa_main.c
+++ b/drivers/infiniband/hw/efa/efa_main.c
@@ -326,9 +326,6 @@ static int efa_ib_device_add(struct efa_dev *dev)
 		(1ull << IB_USER_VERBS_CMD_CREATE_AH) |
 		(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
 
-	dev->ibdev.uverbs_ex_cmd_mask =
-		(1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE);
-
 	ib_set_device_ops(&dev->ibdev, &efa_dev_ops);
 
 	err = ib_register_device(&dev->ibdev, "efa_%d");
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 5f4d8a32ed6d9d..b3d5ba8ef439a3 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -2062,11 +2062,6 @@ static void hns_roce_v1_write_cqc(struct hns_roce_dev *hr_dev,
 		       CQ_CONTEXT_CQC_BYTE_32_CQ_CONS_IDX_S, 0);
 }
 
-static int hns_roce_v1_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period)
-{
-	return -EOPNOTSUPP;
-}
-
 static int hns_roce_v1_req_notify_cq(struct ib_cq *ibcq,
 				     enum ib_cq_notify_flags flags)
 {
@@ -4347,7 +4342,6 @@ static void hns_roce_v1_cleanup_eq_table(struct hns_roce_dev *hr_dev)
 
 static const struct ib_device_ops hns_roce_v1_dev_ops = {
 	.destroy_qp = hns_roce_v1_destroy_qp,
-	.modify_cq = hns_roce_v1_modify_cq,
 	.poll_cq = hns_roce_v1_poll_cq,
 	.post_recv = hns_roce_v1_post_recv,
 	.post_send = hns_roce_v1_post_send,
@@ -4367,7 +4361,6 @@ static const struct hns_roce_hw hns_roce_hw_v1 = {
 	.set_mtu = hns_roce_v1_set_mtu,
 	.write_mtpt = hns_roce_v1_write_mtpt,
 	.write_cqc = hns_roce_v1_write_cqc,
-	.modify_cq = hns_roce_v1_modify_cq,
 	.clear_hem = hns_roce_v1_clear_hem,
 	.modify_qp = hns_roce_v1_modify_qp,
 	.query_qp = hns_roce_v1_query_qp,
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 467c829000190b..f3fe5aeaab8445 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -507,8 +507,6 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
 		(1ULL << IB_USER_VERBS_CMD_QUERY_QP) |
 		(1ULL << IB_USER_VERBS_CMD_DESTROY_QP);
 
-	ib_dev->uverbs_ex_cmd_mask |= (1ULL << IB_USER_VERBS_EX_CMD_MODIFY_CQ);
-
 	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_REREG_MR) {
 		ib_dev->uverbs_cmd_mask |= (1ULL << IB_USER_VERBS_CMD_REREG_MR);
 		ib_set_device_ops(ib_dev, &hns_roce_dev_mr_ops);
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 753c7040249887..37d31d239a22e0 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2685,8 +2685,6 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 
 	ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_ops);
 	ibdev->ib_dev.uverbs_ex_cmd_mask |=
-		(1ull << IB_USER_VERBS_EX_CMD_MODIFY_CQ) |
-		(1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE) |
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ) |
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP);
 
@@ -2694,15 +2692,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 	    ((mlx4_ib_port_link_layer(&ibdev->ib_dev, 1) ==
 	    IB_LINK_LAYER_ETHERNET) ||
 	    (mlx4_ib_port_link_layer(&ibdev->ib_dev, 2) ==
-	    IB_LINK_LAYER_ETHERNET))) {
-		ibdev->ib_dev.uverbs_ex_cmd_mask |=
-			(1ull << IB_USER_VERBS_EX_CMD_CREATE_WQ)	  |
-			(1ull << IB_USER_VERBS_EX_CMD_MODIFY_WQ)	  |
-			(1ull << IB_USER_VERBS_EX_CMD_DESTROY_WQ)	  |
-			(1ull << IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL) |
-			(1ull << IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL);
+	    IB_LINK_LAYER_ETHERNET)))
 		ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_wq_ops);
-	}
 
 	if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW ||
 	    dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN) {
@@ -2721,9 +2712,6 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 
 	if (check_flow_steering_support(dev)) {
 		ibdev->steering_support = MLX4_STEERING_MODE_DEVICE_MANAGED;
-		ibdev->ib_dev.uverbs_ex_cmd_mask	|=
-			(1ull << IB_USER_VERBS_EX_CMD_CREATE_FLOW) |
-			(1ull << IB_USER_VERBS_EX_CMD_DESTROY_FLOW);
 		ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_fs_ops);
 	}
 
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 7082172b5b61a1..09e5d9e7859dcd 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4166,14 +4166,10 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
 		(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ)		|
 		(1ull << IB_USER_VERBS_CMD_CREATE_XSRQ)		|
 		(1ull << IB_USER_VERBS_CMD_OPEN_QP);
-	dev->ib_dev.uverbs_ex_cmd_mask =
-		(1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE)	|
+	dev->ib_dev.uverbs_ex_cmd_mask |=
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ)	|
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP)	|
-		(1ull << IB_USER_VERBS_EX_CMD_MODIFY_QP)	|
-		(1ull << IB_USER_VERBS_EX_CMD_MODIFY_CQ)	|
-		(1ull << IB_USER_VERBS_EX_CMD_CREATE_FLOW)	|
-		(1ull << IB_USER_VERBS_EX_CMD_DESTROY_FLOW);
+		(1ull << IB_USER_VERBS_EX_CMD_MODIFY_QP);
 
 	if (MLX5_CAP_GEN(mdev, ipoib_enhanced_offloads) &&
 	    IS_ENABLED(CONFIG_MLX5_CORE_IPOIB))
@@ -4276,12 +4272,6 @@ static int mlx5_ib_roce_init(struct mlx5_ib_dev *dev)
 	ll = mlx5_port_type_cap_to_rdma_ll(port_type_cap);
 
 	if (ll == IB_LINK_LAYER_ETHERNET) {
-		dev->ib_dev.uverbs_ex_cmd_mask |=
-			(1ull << IB_USER_VERBS_EX_CMD_CREATE_WQ) |
-			(1ull << IB_USER_VERBS_EX_CMD_MODIFY_WQ) |
-			(1ull << IB_USER_VERBS_EX_CMD_DESTROY_WQ) |
-			(1ull << IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL) |
-			(1ull << IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL);
 		ib_set_device_ops(&dev->ib_dev, &mlx5_ib_dev_common_roce_ops);
 
 		port_num = mlx5_core_native_port_num(dev->mdev) - 1;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/11] RDMA: Remove elements in uverbs_cmd_mask that all drivers set
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 01/11] RDMA/cxgb4: Remove MW support Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 02/11] RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 04/11] RDMA: Move more uverbs_cmd_mask settings to the core Jason Gunthorpe
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dennis Dalessandro,
	Devesh Sharma, Doug Ledford, Faisal Latif, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Mike Marciniszyn,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Shiraz Saleem, Yossi Leybovich, Somnath Kotur,
	Sriharsha Basavapatna, Zhu Yanjun, Yishai Hadas

This is a step toward eliminating uverbs_cmd_mask. Preset this list in the
core code. Only the op reg_user_mr wasn't already being required from the
drivers.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/core/device.c               | 16 ++++++++++++++++
 drivers/infiniband/hw/bnxt_re/main.c           | 16 +---------------
 drivers/infiniband/hw/cxgb4/provider.c         | 16 +---------------
 drivers/infiniband/hw/efa/efa_main.c           | 16 +---------------
 drivers/infiniband/hw/hns/hns_roce_main.c      | 15 ---------------
 drivers/infiniband/hw/i40iw/i40iw_verbs.c      | 16 +---------------
 drivers/infiniband/hw/mlx4/main.c              | 16 +---------------
 drivers/infiniband/hw/mlx5/main.c              | 16 +---------------
 drivers/infiniband/hw/mthca/mthca_provider.c   | 16 +---------------
 drivers/infiniband/hw/ocrdma/ocrdma_main.c     | 16 +---------------
 drivers/infiniband/hw/qedr/main.c              | 15 +--------------
 drivers/infiniband/hw/usnic/usnic_ib_main.c    | 16 +---------------
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 16 +---------------
 drivers/infiniband/sw/rdmavt/vt.c              | 16 +---------------
 drivers/infiniband/sw/rxe/rxe_verbs.c          | 17 ++---------------
 drivers/infiniband/sw/siw/siw_main.c           | 16 +---------------
 16 files changed, 31 insertions(+), 224 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 647abbfc9a9c60..4b29c6b7aa6e7f 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -600,6 +600,22 @@ struct ib_device *_ib_alloc_device(size_t size)
 	init_completion(&device->unreg_completion);
 	INIT_WORK(&device->unregistration_work, ib_unregister_work);
 
+	device->uverbs_cmd_mask =
+		BIT_ULL(IB_USER_VERBS_CMD_ALLOC_PD) |
+		BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
+		BIT_ULL(IB_USER_VERBS_CMD_CREATE_CQ) |
+		BIT_ULL(IB_USER_VERBS_CMD_CREATE_QP) |
+		BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_PD) |
+		BIT_ULL(IB_USER_VERBS_CMD_DEREG_MR) |
+		BIT_ULL(IB_USER_VERBS_CMD_DESTROY_CQ) |
+		BIT_ULL(IB_USER_VERBS_CMD_DESTROY_QP) |
+		BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT) |
+		BIT_ULL(IB_USER_VERBS_CMD_MODIFY_QP) |
+		BIT_ULL(IB_USER_VERBS_CMD_QUERY_DEVICE) |
+		BIT_ULL(IB_USER_VERBS_CMD_QUERY_PORT) |
+		BIT_ULL(IB_USER_VERBS_CMD_QUERY_QP) |
+		BIT_ULL(IB_USER_VERBS_CMD_REG_MR);
+
 	device->uverbs_ex_cmd_mask =
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_FLOW) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL) |
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 53aee5a42ab850..6bb524102832e6 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -702,23 +702,9 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
 	ibdev->local_dma_lkey = BNXT_QPLIB_RSVD_LKEY;
 
 	/* User space */
-	ibdev->uverbs_cmd_mask =
-			(1ull << IB_USER_VERBS_CMD_GET_CONTEXT)		|
-			(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE)	|
-			(1ull << IB_USER_VERBS_CMD_QUERY_PORT)		|
-			(1ull << IB_USER_VERBS_CMD_ALLOC_PD)		|
-			(1ull << IB_USER_VERBS_CMD_DEALLOC_PD)		|
-			(1ull << IB_USER_VERBS_CMD_REG_MR)		|
+	ibdev->uverbs_cmd_mask |=
 			(1ull << IB_USER_VERBS_CMD_REREG_MR)		|
-			(1ull << IB_USER_VERBS_CMD_DEREG_MR)		|
-			(1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
-			(1ull << IB_USER_VERBS_CMD_CREATE_CQ)		|
 			(1ull << IB_USER_VERBS_CMD_RESIZE_CQ)		|
-			(1ull << IB_USER_VERBS_CMD_DESTROY_CQ)		|
-			(1ull << IB_USER_VERBS_CMD_CREATE_QP)		|
-			(1ull << IB_USER_VERBS_CMD_MODIFY_QP)		|
-			(1ull << IB_USER_VERBS_CMD_QUERY_QP)		|
-			(1ull << IB_USER_VERBS_CMD_DESTROY_QP)		|
 			(1ull << IB_USER_VERBS_CMD_CREATE_SRQ)		|
 			(1ull << IB_USER_VERBS_CMD_MODIFY_SRQ)		|
 			(1ull << IB_USER_VERBS_CMD_QUERY_SRQ)		|
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index 3bdcdce9def2da..58b578d40bf63c 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -531,23 +531,9 @@ void c4iw_register_device(struct work_struct *work)
 	if (fastreg_support)
 		dev->device_cap_flags |= IB_DEVICE_MEM_MGT_EXTENSIONS;
 	dev->ibdev.local_dma_lkey = 0;
-	dev->ibdev.uverbs_cmd_mask =
-	    (1ull << IB_USER_VERBS_CMD_GET_CONTEXT) |
-	    (1ull << IB_USER_VERBS_CMD_QUERY_DEVICE) |
-	    (1ull << IB_USER_VERBS_CMD_QUERY_PORT) |
-	    (1ull << IB_USER_VERBS_CMD_ALLOC_PD) |
-	    (1ull << IB_USER_VERBS_CMD_DEALLOC_PD) |
-	    (1ull << IB_USER_VERBS_CMD_REG_MR) |
-	    (1ull << IB_USER_VERBS_CMD_DEREG_MR) |
-	    (1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
-	    (1ull << IB_USER_VERBS_CMD_CREATE_CQ) |
-	    (1ull << IB_USER_VERBS_CMD_DESTROY_CQ) |
+	dev->ibdev.uverbs_cmd_mask |=
 	    (1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
-	    (1ull << IB_USER_VERBS_CMD_CREATE_QP) |
-	    (1ull << IB_USER_VERBS_CMD_MODIFY_QP) |
-	    (1ull << IB_USER_VERBS_CMD_QUERY_QP) |
 	    (1ull << IB_USER_VERBS_CMD_POLL_CQ) |
-	    (1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
 	    (1ull << IB_USER_VERBS_CMD_POST_SEND) |
 	    (1ull << IB_USER_VERBS_CMD_POST_RECV) |
 	    (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) |
diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c
index 5cc746a6327ece..ebc0f9475d0969 100644
--- a/drivers/infiniband/hw/efa/efa_main.c
+++ b/drivers/infiniband/hw/efa/efa_main.c
@@ -308,21 +308,7 @@ static int efa_ib_device_add(struct efa_dev *dev)
 	dev->ibdev.num_comp_vectors = 1;
 	dev->ibdev.dev.parent = &pdev->dev;
 
-	dev->ibdev.uverbs_cmd_mask =
-		(1ull << IB_USER_VERBS_CMD_GET_CONTEXT) |
-		(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE) |
-		(1ull << IB_USER_VERBS_CMD_QUERY_PORT) |
-		(1ull << IB_USER_VERBS_CMD_ALLOC_PD) |
-		(1ull << IB_USER_VERBS_CMD_DEALLOC_PD) |
-		(1ull << IB_USER_VERBS_CMD_REG_MR) |
-		(1ull << IB_USER_VERBS_CMD_DEREG_MR) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_CQ) |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_CQ) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_QP) |
-		(1ull << IB_USER_VERBS_CMD_MODIFY_QP) |
-		(1ull << IB_USER_VERBS_CMD_QUERY_QP) |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
+	dev->ibdev.uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_CREATE_AH) |
 		(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
 
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index f3fe5aeaab8445..d8083b320cf5a8 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -491,21 +491,6 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
 	ib_dev->phys_port_cnt = hr_dev->caps.num_ports;
 	ib_dev->local_dma_lkey = hr_dev->caps.reserved_lkey;
 	ib_dev->num_comp_vectors = hr_dev->caps.num_comp_vectors;
-	ib_dev->uverbs_cmd_mask =
-		(1ULL << IB_USER_VERBS_CMD_GET_CONTEXT) |
-		(1ULL << IB_USER_VERBS_CMD_QUERY_DEVICE) |
-		(1ULL << IB_USER_VERBS_CMD_QUERY_PORT) |
-		(1ULL << IB_USER_VERBS_CMD_ALLOC_PD) |
-		(1ULL << IB_USER_VERBS_CMD_DEALLOC_PD) |
-		(1ULL << IB_USER_VERBS_CMD_REG_MR) |
-		(1ULL << IB_USER_VERBS_CMD_DEREG_MR) |
-		(1ULL << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
-		(1ULL << IB_USER_VERBS_CMD_CREATE_CQ) |
-		(1ULL << IB_USER_VERBS_CMD_DESTROY_CQ) |
-		(1ULL << IB_USER_VERBS_CMD_CREATE_QP) |
-		(1ULL << IB_USER_VERBS_CMD_MODIFY_QP) |
-		(1ULL << IB_USER_VERBS_CMD_QUERY_QP) |
-		(1ULL << IB_USER_VERBS_CMD_DESTROY_QP);
 
 	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_REREG_MR) {
 		ib_dev->uverbs_cmd_mask |= (1ULL << IB_USER_VERBS_CMD_REREG_MR);
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 747b4de6faca00..be2bd843c58396 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -2684,25 +2684,11 @@ static struct i40iw_ib_device *i40iw_init_rdma_device(struct i40iw_device *iwdev
 	iwibdev->ibdev.node_type = RDMA_NODE_RNIC;
 	ether_addr_copy((u8 *)&iwibdev->ibdev.node_guid, netdev->dev_addr);
 
-	iwibdev->ibdev.uverbs_cmd_mask =
-	    (1ull << IB_USER_VERBS_CMD_GET_CONTEXT) |
-	    (1ull << IB_USER_VERBS_CMD_QUERY_DEVICE) |
-	    (1ull << IB_USER_VERBS_CMD_QUERY_PORT) |
-	    (1ull << IB_USER_VERBS_CMD_ALLOC_PD) |
-	    (1ull << IB_USER_VERBS_CMD_DEALLOC_PD) |
-	    (1ull << IB_USER_VERBS_CMD_REG_MR) |
-	    (1ull << IB_USER_VERBS_CMD_DEREG_MR) |
-	    (1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
-	    (1ull << IB_USER_VERBS_CMD_CREATE_CQ) |
-	    (1ull << IB_USER_VERBS_CMD_DESTROY_CQ) |
+	iwibdev->ibdev.uverbs_cmd_mask |=
 	    (1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
-	    (1ull << IB_USER_VERBS_CMD_CREATE_QP) |
-	    (1ull << IB_USER_VERBS_CMD_MODIFY_QP) |
-	    (1ull << IB_USER_VERBS_CMD_QUERY_QP) |
 	    (1ull << IB_USER_VERBS_CMD_POLL_CQ) |
 	    (1ull << IB_USER_VERBS_CMD_CREATE_AH) |
 	    (1ull << IB_USER_VERBS_CMD_DESTROY_AH) |
-	    (1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
 	    (1ull << IB_USER_VERBS_CMD_POST_RECV) |
 	    (1ull << IB_USER_VERBS_CMD_POST_SEND);
 	iwibdev->ibdev.phys_port_cnt = 1;
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 37d31d239a22e0..429f3c9b914c89 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2657,23 +2657,9 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 	ibdev->ib_dev.num_comp_vectors	= dev->caps.num_comp_vectors;
 	ibdev->ib_dev.dev.parent	= &dev->persist->pdev->dev;
 
-	ibdev->ib_dev.uverbs_cmd_mask	=
-		(1ull << IB_USER_VERBS_CMD_GET_CONTEXT)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE)	|
-		(1ull << IB_USER_VERBS_CMD_QUERY_PORT)		|
-		(1ull << IB_USER_VERBS_CMD_ALLOC_PD)		|
-		(1ull << IB_USER_VERBS_CMD_DEALLOC_PD)		|
-		(1ull << IB_USER_VERBS_CMD_REG_MR)		|
+	ibdev->ib_dev.uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_REREG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_DEREG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL)	|
-		(1ull << IB_USER_VERBS_CMD_CREATE_CQ)		|
 		(1ull << IB_USER_VERBS_CMD_RESIZE_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_QP)		|
-		(1ull << IB_USER_VERBS_CMD_MODIFY_QP)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_QP)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_QP)		|
 		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)	|
 		(1ull << IB_USER_VERBS_CMD_DETACH_MCAST)	|
 		(1ull << IB_USER_VERBS_CMD_CREATE_SRQ)		|
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 09e5d9e7859dcd..bcd6802e7eea54 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4139,25 +4139,11 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
 	struct mlx5_core_dev *mdev = dev->mdev;
 	int err;
 
-	dev->ib_dev.uverbs_cmd_mask	=
-		(1ull << IB_USER_VERBS_CMD_GET_CONTEXT)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE)	|
-		(1ull << IB_USER_VERBS_CMD_QUERY_PORT)		|
-		(1ull << IB_USER_VERBS_CMD_ALLOC_PD)		|
-		(1ull << IB_USER_VERBS_CMD_DEALLOC_PD)		|
+	dev->ib_dev.uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_CREATE_AH)		|
 		(1ull << IB_USER_VERBS_CMD_DESTROY_AH)		|
-		(1ull << IB_USER_VERBS_CMD_REG_MR)		|
 		(1ull << IB_USER_VERBS_CMD_REREG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_DEREG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL)	|
-		(1ull << IB_USER_VERBS_CMD_CREATE_CQ)		|
 		(1ull << IB_USER_VERBS_CMD_RESIZE_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_QP)		|
-		(1ull << IB_USER_VERBS_CMD_MODIFY_QP)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_QP)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_QP)		|
 		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)	|
 		(1ull << IB_USER_VERBS_CMD_DETACH_MCAST)	|
 		(1ull << IB_USER_VERBS_CMD_CREATE_SRQ)		|
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 31b558ff821852..ae03bc4afbc814 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -1158,22 +1158,8 @@ int mthca_register_device(struct mthca_dev *dev)
 	if (ret)
 		return ret;
 
-	dev->ib_dev.uverbs_cmd_mask	 =
-		(1ull << IB_USER_VERBS_CMD_GET_CONTEXT)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE)	|
-		(1ull << IB_USER_VERBS_CMD_QUERY_PORT)		|
-		(1ull << IB_USER_VERBS_CMD_ALLOC_PD)		|
-		(1ull << IB_USER_VERBS_CMD_DEALLOC_PD)		|
-		(1ull << IB_USER_VERBS_CMD_REG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_DEREG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL)	|
-		(1ull << IB_USER_VERBS_CMD_CREATE_CQ)		|
+	dev->ib_dev.uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_RESIZE_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_QP)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_QP)		|
-		(1ull << IB_USER_VERBS_CMD_MODIFY_QP)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_QP)		|
 		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)	|
 		(1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
 	dev->ib_dev.node_type            = RDMA_NODE_IB_CA;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index d8c47d24d6d66b..c9549ff1b24bc7 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -204,23 +204,9 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
 	BUILD_BUG_ON(sizeof(OCRDMA_NODE_DESC) > IB_DEVICE_NODE_DESC_MAX);
 	memcpy(dev->ibdev.node_desc, OCRDMA_NODE_DESC,
 	       sizeof(OCRDMA_NODE_DESC));
-	dev->ibdev.uverbs_cmd_mask =
-	    OCRDMA_UVERBS(GET_CONTEXT) |
-	    OCRDMA_UVERBS(QUERY_DEVICE) |
-	    OCRDMA_UVERBS(QUERY_PORT) |
-	    OCRDMA_UVERBS(ALLOC_PD) |
-	    OCRDMA_UVERBS(DEALLOC_PD) |
-	    OCRDMA_UVERBS(REG_MR) |
-	    OCRDMA_UVERBS(DEREG_MR) |
-	    OCRDMA_UVERBS(CREATE_COMP_CHANNEL) |
-	    OCRDMA_UVERBS(CREATE_CQ) |
+	dev->ibdev.uverbs_cmd_mask |=
 	    OCRDMA_UVERBS(RESIZE_CQ) |
-	    OCRDMA_UVERBS(DESTROY_CQ) |
 	    OCRDMA_UVERBS(REQ_NOTIFY_CQ) |
-	    OCRDMA_UVERBS(CREATE_QP) |
-	    OCRDMA_UVERBS(MODIFY_QP) |
-	    OCRDMA_UVERBS(QUERY_QP) |
-	    OCRDMA_UVERBS(DESTROY_QP) |
 	    OCRDMA_UVERBS(POLL_CQ) |
 	    OCRDMA_UVERBS(POST_SEND) |
 	    OCRDMA_UVERBS(POST_RECV);
diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index 7c0aac3e635bcb..f4afd6473eca4a 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -249,27 +249,14 @@ static int qedr_register_device(struct qedr_dev *dev)
 	dev->ibdev.node_guid = dev->attr.node_guid;
 	memcpy(dev->ibdev.node_desc, QEDR_NODE_DESC, sizeof(QEDR_NODE_DESC));
 
-	dev->ibdev.uverbs_cmd_mask = QEDR_UVERBS(GET_CONTEXT) |
-				     QEDR_UVERBS(QUERY_DEVICE) |
-				     QEDR_UVERBS(QUERY_PORT) |
-				     QEDR_UVERBS(ALLOC_PD) |
-				     QEDR_UVERBS(DEALLOC_PD) |
-				     QEDR_UVERBS(CREATE_COMP_CHANNEL) |
-				     QEDR_UVERBS(CREATE_CQ) |
+	dev->ibdev.uverbs_cmd_mask |=
 				     QEDR_UVERBS(RESIZE_CQ) |
-				     QEDR_UVERBS(DESTROY_CQ) |
 				     QEDR_UVERBS(REQ_NOTIFY_CQ) |
-				     QEDR_UVERBS(CREATE_QP) |
-				     QEDR_UVERBS(MODIFY_QP) |
-				     QEDR_UVERBS(QUERY_QP) |
-				     QEDR_UVERBS(DESTROY_QP) |
 				     QEDR_UVERBS(CREATE_SRQ) |
 				     QEDR_UVERBS(DESTROY_SRQ) |
 				     QEDR_UVERBS(QUERY_SRQ) |
 				     QEDR_UVERBS(MODIFY_SRQ) |
 				     QEDR_UVERBS(POST_SRQ_RECV) |
-				     QEDR_UVERBS(REG_MR) |
-				     QEDR_UVERBS(DEREG_MR) |
 				     QEDR_UVERBS(POLL_CQ) |
 				     QEDR_UVERBS(POST_SEND) |
 				     QEDR_UVERBS(POST_RECV);
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index 462ed71abf5318..5a75113af7ed80 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -398,21 +398,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
 	us_ibdev->ib_dev.num_comp_vectors = USNIC_IB_NUM_COMP_VECTORS;
 	us_ibdev->ib_dev.dev.parent = &dev->dev;
 
-	us_ibdev->ib_dev.uverbs_cmd_mask =
-		(1ull << IB_USER_VERBS_CMD_GET_CONTEXT) |
-		(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE) |
-		(1ull << IB_USER_VERBS_CMD_QUERY_PORT) |
-		(1ull << IB_USER_VERBS_CMD_ALLOC_PD) |
-		(1ull << IB_USER_VERBS_CMD_DEALLOC_PD) |
-		(1ull << IB_USER_VERBS_CMD_REG_MR) |
-		(1ull << IB_USER_VERBS_CMD_DEREG_MR) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_CQ) |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_CQ) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_QP) |
-		(1ull << IB_USER_VERBS_CMD_MODIFY_QP) |
-		(1ull << IB_USER_VERBS_CMD_QUERY_QP) |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
+	us_ibdev->ib_dev.uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) |
 		(1ull << IB_USER_VERBS_CMD_DETACH_MCAST) |
 		(1ull << IB_USER_VERBS_CMD_OPEN_QP);
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
index 780fd2dfc07eb0..eeb96fe95b4d93 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
@@ -205,23 +205,9 @@ static int pvrdma_register_device(struct pvrdma_dev *dev)
 	dev->flags = 0;
 	dev->ib_dev.num_comp_vectors = 1;
 	dev->ib_dev.dev.parent = &dev->pdev->dev;
-	dev->ib_dev.uverbs_cmd_mask =
-		(1ull << IB_USER_VERBS_CMD_GET_CONTEXT)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE)	|
-		(1ull << IB_USER_VERBS_CMD_QUERY_PORT)		|
-		(1ull << IB_USER_VERBS_CMD_ALLOC_PD)		|
-		(1ull << IB_USER_VERBS_CMD_DEALLOC_PD)		|
-		(1ull << IB_USER_VERBS_CMD_REG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_DEREG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL)	|
-		(1ull << IB_USER_VERBS_CMD_CREATE_CQ)		|
+	dev->ib_dev.uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_POLL_CQ)		|
 		(1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ)	|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_QP)		|
-		(1ull << IB_USER_VERBS_CMD_MODIFY_QP)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_QP)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_QP)		|
 		(1ull << IB_USER_VERBS_CMD_POST_SEND)		|
 		(1ull << IB_USER_VERBS_CMD_POST_RECV)		|
 		(1ull << IB_USER_VERBS_CMD_CREATE_AH)		|
diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c
index f904bb34477ae7..b6706125ec6610 100644
--- a/drivers/infiniband/sw/rdmavt/vt.c
+++ b/drivers/infiniband/sw/rdmavt/vt.c
@@ -593,28 +593,14 @@ int rvt_register_device(struct rvt_dev_info *rdi)
 	 * exactly which functions rdmavt supports, nor do they know the ABI
 	 * version, so we do all of this sort of stuff here.
 	 */
-	rdi->ibdev.uverbs_cmd_mask =
-		(1ull << IB_USER_VERBS_CMD_GET_CONTEXT)         |
-		(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE)        |
-		(1ull << IB_USER_VERBS_CMD_QUERY_PORT)          |
-		(1ull << IB_USER_VERBS_CMD_ALLOC_PD)            |
-		(1ull << IB_USER_VERBS_CMD_DEALLOC_PD)          |
+	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_REG_MR)              |
-		(1ull << IB_USER_VERBS_CMD_DEREG_MR)            |
-		(1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_CQ)           |
 		(1ull << IB_USER_VERBS_CMD_RESIZE_CQ)           |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_CQ)          |
 		(1ull << IB_USER_VERBS_CMD_POLL_CQ)             |
 		(1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ)       |
-		(1ull << IB_USER_VERBS_CMD_CREATE_QP)           |
-		(1ull << IB_USER_VERBS_CMD_QUERY_QP)            |
-		(1ull << IB_USER_VERBS_CMD_MODIFY_QP)           |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_QP)          |
 		(1ull << IB_USER_VERBS_CMD_POST_SEND)           |
 		(1ull << IB_USER_VERBS_CMD_POST_RECV)           |
 		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)        |
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index f368dc16281ab9..3aa83f4c47772b 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -1135,31 +1135,18 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
 	dma_coerce_mask_and_coherent(&dev->dev,
 				     dma_get_required_mask(&dev->dev));
 
-	dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT)
-	    | BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL)
-	    | BIT_ULL(IB_USER_VERBS_CMD_QUERY_DEVICE)
-	    | BIT_ULL(IB_USER_VERBS_CMD_QUERY_PORT)
-	    | BIT_ULL(IB_USER_VERBS_CMD_ALLOC_PD)
-	    | BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_PD)
-	    | BIT_ULL(IB_USER_VERBS_CMD_CREATE_SRQ)
+	dev->uverbs_cmd_mask |=
+	    BIT_ULL(IB_USER_VERBS_CMD_CREATE_SRQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_MODIFY_SRQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_QUERY_SRQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_DESTROY_SRQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_POST_SRQ_RECV)
-	    | BIT_ULL(IB_USER_VERBS_CMD_CREATE_QP)
-	    | BIT_ULL(IB_USER_VERBS_CMD_MODIFY_QP)
-	    | BIT_ULL(IB_USER_VERBS_CMD_QUERY_QP)
-	    | BIT_ULL(IB_USER_VERBS_CMD_DESTROY_QP)
 	    | BIT_ULL(IB_USER_VERBS_CMD_POST_SEND)
 	    | BIT_ULL(IB_USER_VERBS_CMD_POST_RECV)
-	    | BIT_ULL(IB_USER_VERBS_CMD_CREATE_CQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_RESIZE_CQ)
-	    | BIT_ULL(IB_USER_VERBS_CMD_DESTROY_CQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_POLL_CQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_PEEK_CQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ)
-	    | BIT_ULL(IB_USER_VERBS_CMD_REG_MR)
-	    | BIT_ULL(IB_USER_VERBS_CMD_DEREG_MR)
 	    | BIT_ULL(IB_USER_VERBS_CMD_CREATE_AH)
 	    | BIT_ULL(IB_USER_VERBS_CMD_MODIFY_AH)
 	    | BIT_ULL(IB_USER_VERBS_CMD_QUERY_AH)
diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c
index d862bec843766f..cf472118cb5364 100644
--- a/drivers/infiniband/sw/siw/siw_main.c
+++ b/drivers/infiniband/sw/siw/siw_main.c
@@ -346,23 +346,9 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
 		addrconf_addr_eui48((unsigned char *)&base_dev->node_guid,
 				    addr);
 	}
-	base_dev->uverbs_cmd_mask =
-		(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE) |
-		(1ull << IB_USER_VERBS_CMD_QUERY_PORT) |
-		(1ull << IB_USER_VERBS_CMD_GET_CONTEXT) |
-		(1ull << IB_USER_VERBS_CMD_ALLOC_PD) |
-		(1ull << IB_USER_VERBS_CMD_DEALLOC_PD) |
-		(1ull << IB_USER_VERBS_CMD_REG_MR) |
-		(1ull << IB_USER_VERBS_CMD_DEREG_MR) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_CQ) |
+	base_dev->uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_POLL_CQ) |
 		(1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_CQ) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_QP) |
-		(1ull << IB_USER_VERBS_CMD_QUERY_QP) |
-		(1ull << IB_USER_VERBS_CMD_MODIFY_QP) |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
 		(1ull << IB_USER_VERBS_CMD_POST_SEND) |
 		(1ull << IB_USER_VERBS_CMD_POST_RECV) |
 		(1ull << IB_USER_VERBS_CMD_CREATE_SRQ) |
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 04/11] RDMA: Move more uverbs_cmd_mask settings to the core
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (2 preceding siblings ...)
  2020-10-03 23:20 ` [PATCH 03/11] RDMA: Remove elements in uverbs_cmd_mask that all drivers set Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 05/11] RDMA: Check srq_type during create_srq Jason Gunthorpe
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dennis Dalessandro,
	Devesh Sharma, Doug Ledford, Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Mike Marciniszyn,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Somnath Kotur, Sriharsha Basavapatna, Zhu Yanjun, Yishai Hadas

These functions all depend on the driver providing a specific op:

- REREG_MR is rereg_user_mr(). bnxt_re set this without providing the op
- ATTACH/DEATCH_MCAST is attach_mcast()/detach_mcast(). usnic set this
  without providing the op
- OPEN_QP doesn't involve the driver but requires a XRCD. qedr provides
  xrcd but forgot to set it, usnic doesn't provide XRCD but set it anyhow.
- OPEN/CLOSE_XRCD are the ops alloc_xrcd()/dealloc_xrcd()
- CREATE_SRQ/DESTROY_SRQ are the ops create_srq()/destroy_srq()
- QUERY/MODIFY_SRQ is op query_srq()/modify_srq(). hns sets this but
  sometimes supplies a NULL op.
- RESIZE_CQ is op resize_cq(). bnxt_re sets this boes doesn't supply an op
- ALLOC/DEALLOC_MW is alloc_mw()/dealloc_mw(). cxgb4 provided an
  (now deleted) implementation but no userspace

All drivers were checked that no drivers provide the op without also
setting uverbs_cmd_mask so this should have no functional change.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/core/device.c              | 16 ++++++++++++-
 drivers/infiniband/core/uverbs_cmd.c          |  8 +++----
 drivers/infiniband/hw/bnxt_re/main.c          |  6 -----
 drivers/infiniband/hw/cxgb4/provider.c        |  5 +---
 drivers/infiniband/hw/hns/hns_roce_main.c     | 14 ++---------
 drivers/infiniband/hw/mlx4/main.c             | 20 ++--------------
 drivers/infiniband/hw/mlx5/main.c             | 23 +++----------------
 drivers/infiniband/hw/mthca/mthca_provider.c  | 10 --------
 drivers/infiniband/hw/ocrdma/ocrdma_main.c    |  5 ----
 drivers/infiniband/hw/qedr/main.c             |  8 +------
 drivers/infiniband/hw/usnic/usnic_ib_main.c   |  5 ----
 .../infiniband/hw/vmw_pvrdma/pvrdma_main.c    |  4 ----
 drivers/infiniband/sw/rdmavt/vt.c             |  7 ------
 drivers/infiniband/sw/rxe/rxe_verbs.c         |  9 +-------
 drivers/infiniband/sw/siw/siw_main.c          |  6 +----
 15 files changed, 30 insertions(+), 116 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 4b29c6b7aa6e7f..7d70ecdc32cc2e 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -284,6 +284,7 @@ static void ib_device_check_mandatory(struct ib_device *device)
 		IB_MANDATORY_FUNC(poll_cq),
 		IB_MANDATORY_FUNC(req_notify_cq),
 		IB_MANDATORY_FUNC(get_dma_mr),
+		IB_MANDATORY_FUNC(reg_user_mr),
 		IB_MANDATORY_FUNC(dereg_mr),
 		IB_MANDATORY_FUNC(get_port_immutable)
 	};
@@ -601,20 +602,33 @@ struct ib_device *_ib_alloc_device(size_t size)
 	INIT_WORK(&device->unregistration_work, ib_unregister_work);
 
 	device->uverbs_cmd_mask =
+		BIT_ULL(IB_USER_VERBS_CMD_ALLOC_MW) |
 		BIT_ULL(IB_USER_VERBS_CMD_ALLOC_PD) |
+		BIT_ULL(IB_USER_VERBS_CMD_ATTACH_MCAST) |
+		BIT_ULL(IB_USER_VERBS_CMD_CLOSE_XRCD) |
 		BIT_ULL(IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
 		BIT_ULL(IB_USER_VERBS_CMD_CREATE_CQ) |
 		BIT_ULL(IB_USER_VERBS_CMD_CREATE_QP) |
+		BIT_ULL(IB_USER_VERBS_CMD_CREATE_SRQ) |
+		BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_MW) |
 		BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_PD) |
 		BIT_ULL(IB_USER_VERBS_CMD_DEREG_MR) |
 		BIT_ULL(IB_USER_VERBS_CMD_DESTROY_CQ) |
 		BIT_ULL(IB_USER_VERBS_CMD_DESTROY_QP) |
+		BIT_ULL(IB_USER_VERBS_CMD_DESTROY_SRQ) |
+		BIT_ULL(IB_USER_VERBS_CMD_DETACH_MCAST) |
 		BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT) |
 		BIT_ULL(IB_USER_VERBS_CMD_MODIFY_QP) |
+		BIT_ULL(IB_USER_VERBS_CMD_MODIFY_SRQ) |
+		BIT_ULL(IB_USER_VERBS_CMD_OPEN_QP) |
+		BIT_ULL(IB_USER_VERBS_CMD_OPEN_XRCD) |
 		BIT_ULL(IB_USER_VERBS_CMD_QUERY_DEVICE) |
 		BIT_ULL(IB_USER_VERBS_CMD_QUERY_PORT) |
 		BIT_ULL(IB_USER_VERBS_CMD_QUERY_QP) |
-		BIT_ULL(IB_USER_VERBS_CMD_REG_MR);
+		BIT_ULL(IB_USER_VERBS_CMD_QUERY_SRQ) |
+		BIT_ULL(IB_USER_VERBS_CMD_REG_MR) |
+		BIT_ULL(IB_USER_VERBS_CMD_REREG_MR) |
+		BIT_ULL(IB_USER_VERBS_CMD_RESIZE_CQ);
 
 	device->uverbs_ex_cmd_mask =
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_FLOW) |
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 2f3f9b87922e92..f85a6117577296 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3999,8 +3999,7 @@ const struct uapi_definition uverbs_def_write_intf[] = {
 		DECLARE_UVERBS_WRITE(
 			IB_USER_VERBS_CMD_CLOSE_XRCD,
 			ib_uverbs_close_xrcd,
-			UAPI_DEF_WRITE_I(struct ib_uverbs_close_xrcd),
-			UAPI_DEF_METHOD_NEEDS_FN(dealloc_xrcd)),
+			UAPI_DEF_WRITE_I(struct ib_uverbs_close_xrcd)),
 		DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_OPEN_QP,
 				     ib_uverbs_open_qp,
 				     UAPI_DEF_WRITE_UDATA_IO(
@@ -4010,8 +4009,9 @@ const struct uapi_definition uverbs_def_write_intf[] = {
 				     ib_uverbs_open_xrcd,
 				     UAPI_DEF_WRITE_UDATA_IO(
 					     struct ib_uverbs_open_xrcd,
-					     struct ib_uverbs_open_xrcd_resp),
-				     UAPI_DEF_METHOD_NEEDS_FN(alloc_xrcd))),
+					     struct ib_uverbs_open_xrcd_resp)),
+		UAPI_DEF_OBJ_NEEDS_FN(alloc_xrcd),
+		UAPI_DEF_OBJ_NEEDS_FN(dealloc_xrcd)),
 
 	{},
 };
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 6bb524102832e6..2bee4ca6dcf5fe 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -703,12 +703,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
 
 	/* User space */
 	ibdev->uverbs_cmd_mask |=
-			(1ull << IB_USER_VERBS_CMD_REREG_MR)		|
-			(1ull << IB_USER_VERBS_CMD_RESIZE_CQ)		|
-			(1ull << IB_USER_VERBS_CMD_CREATE_SRQ)		|
-			(1ull << IB_USER_VERBS_CMD_MODIFY_SRQ)		|
-			(1ull << IB_USER_VERBS_CMD_QUERY_SRQ)		|
-			(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ)		|
 			(1ull << IB_USER_VERBS_CMD_CREATE_AH)		|
 			(1ull << IB_USER_VERBS_CMD_MODIFY_AH)		|
 			(1ull << IB_USER_VERBS_CMD_QUERY_AH)		|
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index 58b578d40bf63c..d3a84fdd2396f3 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -535,10 +535,7 @@ void c4iw_register_device(struct work_struct *work)
 	    (1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
 	    (1ull << IB_USER_VERBS_CMD_POLL_CQ) |
 	    (1ull << IB_USER_VERBS_CMD_POST_SEND) |
-	    (1ull << IB_USER_VERBS_CMD_POST_RECV) |
-	    (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) |
-	    (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) |
-	    (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ);
+	    (1ull << IB_USER_VERBS_CMD_POST_RECV);
 	dev->ibdev.node_type = RDMA_NODE_RNIC;
 	BUILD_BUG_ON(sizeof(C4IW_NODE_DESC) > IB_DEVICE_NODE_DESC_MAX);
 	memcpy(dev->ibdev.node_desc, C4IW_NODE_DESC, sizeof(C4IW_NODE_DESC));
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index d8083b320cf5a8..a75c09564447b3 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -492,18 +492,12 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
 	ib_dev->local_dma_lkey = hr_dev->caps.reserved_lkey;
 	ib_dev->num_comp_vectors = hr_dev->caps.num_comp_vectors;
 
-	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_REREG_MR) {
-		ib_dev->uverbs_cmd_mask |= (1ULL << IB_USER_VERBS_CMD_REREG_MR);
+	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_REREG_MR)
 		ib_set_device_ops(ib_dev, &hns_roce_dev_mr_ops);
-	}
 
 	/* MW */
-	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_MW) {
-		ib_dev->uverbs_cmd_mask |=
-					(1ULL << IB_USER_VERBS_CMD_ALLOC_MW) |
-					(1ULL << IB_USER_VERBS_CMD_DEALLOC_MW);
+	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_MW)
 		ib_set_device_ops(ib_dev, &hns_roce_dev_mw_ops);
-	}
 
 	/* FRMR */
 	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_FRMR)
@@ -512,10 +506,6 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
 	/* SRQ */
 	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) {
 		ib_dev->uverbs_cmd_mask |=
-				(1ULL << IB_USER_VERBS_CMD_CREATE_SRQ) |
-				(1ULL << IB_USER_VERBS_CMD_MODIFY_SRQ) |
-				(1ULL << IB_USER_VERBS_CMD_QUERY_SRQ) |
-				(1ULL << IB_USER_VERBS_CMD_DESTROY_SRQ) |
 				(1ULL << IB_USER_VERBS_CMD_POST_SRQ_RECV);
 		ib_set_device_ops(ib_dev, &hns_roce_dev_srq_ops);
 		ib_set_device_ops(ib_dev, hr_dev->hw->hns_roce_dev_srq_ops);
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 429f3c9b914c89..f251a57478f3e7 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2658,16 +2658,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 	ibdev->ib_dev.dev.parent	= &dev->persist->pdev->dev;
 
 	ibdev->ib_dev.uverbs_cmd_mask |=
-		(1ull << IB_USER_VERBS_CMD_REREG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_RESIZE_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)	|
-		(1ull << IB_USER_VERBS_CMD_DETACH_MCAST)	|
-		(1ull << IB_USER_VERBS_CMD_CREATE_SRQ)		|
-		(1ull << IB_USER_VERBS_CMD_MODIFY_SRQ)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_SRQ)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_XSRQ)		|
-		(1ull << IB_USER_VERBS_CMD_OPEN_QP);
+		(1ull << IB_USER_VERBS_CMD_CREATE_XSRQ);
 
 	ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_ops);
 	ibdev->ib_dev.uverbs_ex_cmd_mask |=
@@ -2682,17 +2673,10 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 		ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_wq_ops);
 
 	if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW ||
-	    dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN) {
-		ibdev->ib_dev.uverbs_cmd_mask |=
-			(1ull << IB_USER_VERBS_CMD_ALLOC_MW) |
-			(1ull << IB_USER_VERBS_CMD_DEALLOC_MW);
+	    dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN)
 		ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_mw_ops);
-	}
 
 	if (dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC) {
-		ibdev->ib_dev.uverbs_cmd_mask |=
-			(1ull << IB_USER_VERBS_CMD_OPEN_XRCD) |
-			(1ull << IB_USER_VERBS_CMD_CLOSE_XRCD);
 		ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_xrc_ops);
 	}
 
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index bcd6802e7eea54..83434d080023a8 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4142,16 +4142,7 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
 	dev->ib_dev.uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_CREATE_AH)		|
 		(1ull << IB_USER_VERBS_CMD_DESTROY_AH)		|
-		(1ull << IB_USER_VERBS_CMD_REREG_MR)		|
-		(1ull << IB_USER_VERBS_CMD_RESIZE_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)	|
-		(1ull << IB_USER_VERBS_CMD_DETACH_MCAST)	|
-		(1ull << IB_USER_VERBS_CMD_CREATE_SRQ)		|
-		(1ull << IB_USER_VERBS_CMD_MODIFY_SRQ)		|
-		(1ull << IB_USER_VERBS_CMD_QUERY_SRQ)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_XSRQ)		|
-		(1ull << IB_USER_VERBS_CMD_OPEN_QP);
+		(1ull << IB_USER_VERBS_CMD_CREATE_XSRQ);
 	dev->ib_dev.uverbs_ex_cmd_mask |=
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ)	|
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP)	|
@@ -4167,19 +4158,11 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
 
 	dev->umr_fence = mlx5_get_umr_fence(MLX5_CAP_GEN(mdev, umr_fence));
 
-	if (MLX5_CAP_GEN(mdev, imaicl)) {
-		dev->ib_dev.uverbs_cmd_mask |=
-			(1ull << IB_USER_VERBS_CMD_ALLOC_MW)	|
-			(1ull << IB_USER_VERBS_CMD_DEALLOC_MW);
+	if (MLX5_CAP_GEN(mdev, imaicl))
 		ib_set_device_ops(&dev->ib_dev, &mlx5_ib_dev_mw_ops);
-	}
 
-	if (MLX5_CAP_GEN(mdev, xrc)) {
-		dev->ib_dev.uverbs_cmd_mask |=
-			(1ull << IB_USER_VERBS_CMD_OPEN_XRCD) |
-			(1ull << IB_USER_VERBS_CMD_CLOSE_XRCD);
+	if (MLX5_CAP_GEN(mdev, xrc))
 		ib_set_device_ops(&dev->ib_dev, &mlx5_ib_dev_xrc_ops);
-	}
 
 	if (MLX5_CAP_DEV_MEM(mdev, memic) ||
 	    MLX5_CAP_GEN_64(dev->mdev, general_obj_types) &
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index ae03bc4afbc814..a01898ac99e224 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -1158,22 +1158,12 @@ int mthca_register_device(struct mthca_dev *dev)
 	if (ret)
 		return ret;
 
-	dev->ib_dev.uverbs_cmd_mask |=
-		(1ull << IB_USER_VERBS_CMD_RESIZE_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)	|
-		(1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
 	dev->ib_dev.node_type            = RDMA_NODE_IB_CA;
 	dev->ib_dev.phys_port_cnt        = dev->limits.num_ports;
 	dev->ib_dev.num_comp_vectors     = 1;
 	dev->ib_dev.dev.parent           = &dev->pdev->dev;
 
 	if (dev->mthca_flags & MTHCA_FLAG_SRQ) {
-		dev->ib_dev.uverbs_cmd_mask	|=
-			(1ull << IB_USER_VERBS_CMD_CREATE_SRQ)		|
-			(1ull << IB_USER_VERBS_CMD_MODIFY_SRQ)		|
-			(1ull << IB_USER_VERBS_CMD_QUERY_SRQ)		|
-			(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ);
-
 		if (mthca_is_memfree(dev))
 			ib_set_device_ops(&dev->ib_dev,
 					  &mthca_dev_arbel_srq_ops);
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index c9549ff1b24bc7..40ed7a42f1e1ca 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -205,7 +205,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
 	memcpy(dev->ibdev.node_desc, OCRDMA_NODE_DESC,
 	       sizeof(OCRDMA_NODE_DESC));
 	dev->ibdev.uverbs_cmd_mask |=
-	    OCRDMA_UVERBS(RESIZE_CQ) |
 	    OCRDMA_UVERBS(REQ_NOTIFY_CQ) |
 	    OCRDMA_UVERBS(POLL_CQ) |
 	    OCRDMA_UVERBS(POST_SEND) |
@@ -228,10 +227,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
 
 	if (ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R) {
 		dev->ibdev.uverbs_cmd_mask |=
-		     OCRDMA_UVERBS(CREATE_SRQ) |
-		     OCRDMA_UVERBS(MODIFY_SRQ) |
-		     OCRDMA_UVERBS(QUERY_SRQ) |
-		     OCRDMA_UVERBS(DESTROY_SRQ) |
 		     OCRDMA_UVERBS(POST_SRQ_RECV);
 
 		ib_set_device_ops(&dev->ibdev, &ocrdma_dev_srq_ops);
diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index f4afd6473eca4a..81d7d64fabc98f 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -189,8 +189,7 @@ static void qedr_roce_register_device(struct qedr_dev *dev)
 
 	ib_set_device_ops(&dev->ibdev, &qedr_roce_dev_ops);
 
-	dev->ibdev.uverbs_cmd_mask |= QEDR_UVERBS(OPEN_XRCD) |
-		QEDR_UVERBS(CLOSE_XRCD) |
+	dev->ibdev.uverbs_cmd_mask |=
 		QEDR_UVERBS(CREATE_XSRQ);
 }
 
@@ -250,12 +249,7 @@ static int qedr_register_device(struct qedr_dev *dev)
 	memcpy(dev->ibdev.node_desc, QEDR_NODE_DESC, sizeof(QEDR_NODE_DESC));
 
 	dev->ibdev.uverbs_cmd_mask |=
-				     QEDR_UVERBS(RESIZE_CQ) |
 				     QEDR_UVERBS(REQ_NOTIFY_CQ) |
-				     QEDR_UVERBS(CREATE_SRQ) |
-				     QEDR_UVERBS(DESTROY_SRQ) |
-				     QEDR_UVERBS(QUERY_SRQ) |
-				     QEDR_UVERBS(MODIFY_SRQ) |
 				     QEDR_UVERBS(POST_SRQ_RECV) |
 				     QEDR_UVERBS(POLL_CQ) |
 				     QEDR_UVERBS(POST_SEND) |
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c
index 5a75113af7ed80..4b820a0eefeac5 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_main.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c
@@ -398,11 +398,6 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
 	us_ibdev->ib_dev.num_comp_vectors = USNIC_IB_NUM_COMP_VECTORS;
 	us_ibdev->ib_dev.dev.parent = &dev->dev;
 
-	us_ibdev->ib_dev.uverbs_cmd_mask |=
-		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) |
-		(1ull << IB_USER_VERBS_CMD_DETACH_MCAST) |
-		(1ull << IB_USER_VERBS_CMD_OPEN_QP);
-
 	ib_set_device_ops(&us_ibdev->ib_dev, &usnic_dev_ops);
 
 	rdma_set_device_sysfs_group(&us_ibdev->ib_dev, &usnic_attr_group);
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
index eeb96fe95b4d93..41836811a71d55 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
@@ -236,10 +236,6 @@ static int pvrdma_register_device(struct pvrdma_dev *dev)
 	/* Check if SRQ is supported by backend */
 	if (dev->dsr->caps.max_srq) {
 		dev->ib_dev.uverbs_cmd_mask |=
-			(1ull << IB_USER_VERBS_CMD_CREATE_SRQ)	|
-			(1ull << IB_USER_VERBS_CMD_MODIFY_SRQ)	|
-			(1ull << IB_USER_VERBS_CMD_QUERY_SRQ)	|
-			(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ)	|
 			(1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV);
 
 		ib_set_device_ops(&dev->ib_dev, &pvrdma_dev_srq_ops);
diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c
index b6706125ec6610..a0cb567cfc512b 100644
--- a/drivers/infiniband/sw/rdmavt/vt.c
+++ b/drivers/infiniband/sw/rdmavt/vt.c
@@ -598,17 +598,10 @@ int rvt_register_device(struct rvt_dev_info *rdi)
 		(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_RESIZE_CQ)           |
 		(1ull << IB_USER_VERBS_CMD_POLL_CQ)             |
 		(1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ)       |
 		(1ull << IB_USER_VERBS_CMD_POST_SEND)           |
 		(1ull << IB_USER_VERBS_CMD_POST_RECV)           |
-		(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST)        |
-		(1ull << IB_USER_VERBS_CMD_DETACH_MCAST)        |
-		(1ull << IB_USER_VERBS_CMD_CREATE_SRQ)          |
-		(1ull << IB_USER_VERBS_CMD_MODIFY_SRQ)          |
-		(1ull << IB_USER_VERBS_CMD_QUERY_SRQ)           |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ)         |
 		(1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV);
 	rdi->ibdev.node_type = RDMA_NODE_IB_CA;
 	if (!rdi->ibdev.num_comp_vectors)
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 3aa83f4c47772b..5f47f21c2958d3 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -1136,14 +1136,9 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
 				     dma_get_required_mask(&dev->dev));
 
 	dev->uverbs_cmd_mask |=
-	    BIT_ULL(IB_USER_VERBS_CMD_CREATE_SRQ)
-	    | BIT_ULL(IB_USER_VERBS_CMD_MODIFY_SRQ)
-	    | BIT_ULL(IB_USER_VERBS_CMD_QUERY_SRQ)
-	    | BIT_ULL(IB_USER_VERBS_CMD_DESTROY_SRQ)
-	    | BIT_ULL(IB_USER_VERBS_CMD_POST_SRQ_RECV)
+	    BIT_ULL(IB_USER_VERBS_CMD_POST_SRQ_RECV)
 	    | BIT_ULL(IB_USER_VERBS_CMD_POST_SEND)
 	    | BIT_ULL(IB_USER_VERBS_CMD_POST_RECV)
-	    | BIT_ULL(IB_USER_VERBS_CMD_RESIZE_CQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_POLL_CQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_PEEK_CQ)
 	    | BIT_ULL(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ)
@@ -1151,8 +1146,6 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
 	    | BIT_ULL(IB_USER_VERBS_CMD_MODIFY_AH)
 	    | BIT_ULL(IB_USER_VERBS_CMD_QUERY_AH)
 	    | BIT_ULL(IB_USER_VERBS_CMD_DESTROY_AH)
-	    | BIT_ULL(IB_USER_VERBS_CMD_ATTACH_MCAST)
-	    | BIT_ULL(IB_USER_VERBS_CMD_DETACH_MCAST)
 	    ;
 
 	ib_set_device_ops(dev, &rxe_dev_ops);
diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c
index cf472118cb5364..faef91ba031ca7 100644
--- a/drivers/infiniband/sw/siw/siw_main.c
+++ b/drivers/infiniband/sw/siw/siw_main.c
@@ -351,11 +351,7 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
 		(1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
 		(1ull << IB_USER_VERBS_CMD_POST_SEND) |
 		(1ull << IB_USER_VERBS_CMD_POST_RECV) |
-		(1ull << IB_USER_VERBS_CMD_CREATE_SRQ) |
-		(1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV) |
-		(1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) |
-		(1ull << IB_USER_VERBS_CMD_QUERY_SRQ) |
-		(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ);
+		(1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV);
 
 	base_dev->node_type = RDMA_NODE_RNIC;
 	memcpy(base_dev->node_desc, SIW_NODE_DESC_COMMON,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 05/11] RDMA: Check srq_type during create_srq
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (3 preceding siblings ...)
  2020-10-03 23:20 ` [PATCH 04/11] RDMA: Move more uverbs_cmd_mask settings to the core Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 06/11] RDMA: Check attr_mask during modify_qp Jason Gunthorpe
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Adit Ranadive, Ariel Elior, Potnuri Bharat Teja, Bernard Metzler,
	Devesh Sharma, Doug Ledford, Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Michal Kalderon,
	Lijun Ou, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Zhu Yanjun, Yishai Hadas

uverbs was blocking srq_types the driver doesn't support based on the
CREATE_XSRQ cmd_mask. Fix all drivers to check for supported srq_types
during create_srq and move CREATE_XSRQ to the core code.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/core/device.c              | 1 +
 drivers/infiniband/hw/cxgb4/qp.c              | 3 +++
 drivers/infiniband/hw/hns/hns_roce_srq.c      | 4 ++++
 drivers/infiniband/hw/mlx4/main.c             | 3 ---
 drivers/infiniband/hw/mlx4/srq.c              | 4 ++++
 drivers/infiniband/hw/mlx5/main.c             | 3 +--
 drivers/infiniband/hw/mlx5/srq.c              | 5 +++++
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c   | 3 +++
 drivers/infiniband/hw/qedr/main.c             | 3 ---
 drivers/infiniband/hw/qedr/verbs.c            | 4 ++++
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c | 2 +-
 drivers/infiniband/sw/rxe/rxe_verbs.c         | 3 +++
 drivers/infiniband/sw/siw/siw_verbs.c         | 3 +++
 13 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 7d70ecdc32cc2e..75e6e68688c6d0 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -610,6 +610,7 @@ struct ib_device *_ib_alloc_device(size_t size)
 		BIT_ULL(IB_USER_VERBS_CMD_CREATE_CQ) |
 		BIT_ULL(IB_USER_VERBS_CMD_CREATE_QP) |
 		BIT_ULL(IB_USER_VERBS_CMD_CREATE_SRQ) |
+		BIT_ULL(IB_USER_VERBS_CMD_CREATE_XSRQ) |
 		BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_MW) |
 		BIT_ULL(IB_USER_VERBS_CMD_DEALLOC_PD) |
 		BIT_ULL(IB_USER_VERBS_CMD_DEREG_MR) |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index f20379e4e2ec22..d2b46c5c1645e4 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -2680,6 +2680,9 @@ int c4iw_create_srq(struct ib_srq *ib_srq, struct ib_srq_init_attr *attrs,
 	int ret;
 	int wr_len;
 
+	if (attrs->srq_type != IB_SRQT_BASIC)
+		return -EOPNOTSUPP;
+
 	pr_debug("%s ib_pd %p\n", __func__, pd);
 
 	php = to_c4iw_pd(pd);
diff --git a/drivers/infiniband/hw/hns/hns_roce_srq.c b/drivers/infiniband/hw/hns/hns_roce_srq.c
index 8caf74e44efd96..27646b9e35dfd2 100644
--- a/drivers/infiniband/hw/hns/hns_roce_srq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_srq.c
@@ -288,6 +288,10 @@ int hns_roce_create_srq(struct ib_srq *ib_srq,
 	int ret;
 	u32 cqn;
 
+	if (init_attr->srq_type != IB_SRQT_BASIC &&
+	    init_attr->srq_type != IB_SRQT_XRC)
+		return -EOPNOTSUPP;
+
 	/* Check the actual SRQ wqe and SRQ sge num */
 	if (init_attr->attr.max_wr >= hr_dev->caps.max_srq_wrs ||
 	    init_attr->attr.max_sge > hr_dev->caps.max_srq_sges)
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index f251a57478f3e7..6216dfe6e9c79c 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2657,9 +2657,6 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 	ibdev->ib_dev.num_comp_vectors	= dev->caps.num_comp_vectors;
 	ibdev->ib_dev.dev.parent	= &dev->persist->pdev->dev;
 
-	ibdev->ib_dev.uverbs_cmd_mask |=
-		(1ull << IB_USER_VERBS_CMD_CREATE_XSRQ);
-
 	ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_ops);
 	ibdev->ib_dev.uverbs_ex_cmd_mask |=
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ) |
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
index bf618529e734d2..6a381751c0d8ee 100644
--- a/drivers/infiniband/hw/mlx4/srq.c
+++ b/drivers/infiniband/hw/mlx4/srq.c
@@ -86,6 +86,10 @@ int mlx4_ib_create_srq(struct ib_srq *ib_srq,
 	int err;
 	int i;
 
+	if (init_attr->srq_type != IB_SRQT_BASIC &&
+	    init_attr->srq_type != IB_SRQT_XRC)
+		return -EOPNOTSUPP;
+
 	/* Sanity check SRQ size before proceeding */
 	if (init_attr->attr.max_wr  >= dev->dev->caps.max_srq_wqes ||
 	    init_attr->attr.max_sge >  dev->dev->caps.max_srq_sge)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 83434d080023a8..7f03ffabddbe87 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4141,8 +4141,7 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
 
 	dev->ib_dev.uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_CREATE_AH)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_AH)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_XSRQ);
+		(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
 	dev->ib_dev.uverbs_ex_cmd_mask |=
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ)	|
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP)	|
diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c
index e2f720eec1e18b..12d485872e7716 100644
--- a/drivers/infiniband/hw/mlx5/srq.c
+++ b/drivers/infiniband/hw/mlx5/srq.c
@@ -226,6 +226,11 @@ int mlx5_ib_create_srq(struct ib_srq *ib_srq,
 	struct mlx5_srq_attr in = {};
 	__u32 max_srq_wqes = 1 << MLX5_CAP_GEN(dev->mdev, log_max_srq_sz);
 
+	if (init_attr->srq_type != IB_SRQT_BASIC &&
+	    init_attr->srq_type != IB_SRQT_XRC &&
+	    init_attr->srq_type != IB_SRQT_TM)
+		return -EOPNOTSUPP;
+
 	/* Sanity check SRQ size before proceeding */
 	if (init_attr->attr.max_wr >= max_srq_wqes) {
 		mlx5_ib_dbg(dev, "max_wr %d, cap %d\n",
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 7350fe16f164d3..b392e15d7592b6 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1770,6 +1770,9 @@ int ocrdma_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init_attr,
 	struct ocrdma_dev *dev = get_ocrdma_dev(ibsrq->device);
 	struct ocrdma_srq *srq = get_ocrdma_srq(ibsrq);
 
+	if (init_attr->srq_type != IB_SRQT_BASIC)
+		return -EOPNOTSUPP;
+
 	if (init_attr->attr.max_sge > dev->attr.max_recv_sge)
 		return -EINVAL;
 	if (init_attr->attr.max_wr > dev->attr.max_rqe)
diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index 81d7d64fabc98f..d50ee9eacd463d 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -188,9 +188,6 @@ static void qedr_roce_register_device(struct qedr_dev *dev)
 	dev->ibdev.node_type = RDMA_NODE_IB_CA;
 
 	ib_set_device_ops(&dev->ibdev, &qedr_roce_dev_ops);
-
-	dev->ibdev.uverbs_cmd_mask |=
-		QEDR_UVERBS(CREATE_XSRQ);
 }
 
 static const struct ib_device_ops qedr_dev_ops = {
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 019642ff24a704..29a96ff6fc66b6 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -1546,6 +1546,10 @@ int qedr_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init_attr,
 		 "create SRQ called from %s (pd %p)\n",
 		 (udata) ? "User lib" : "kernel", pd);
 
+	if (init_attr->srq_type != IB_SRQT_BASIC &&
+	    init_attr->srq_type != IB_SRQT_XRC)
+		return -EOPNOTSUPP;
+
 	rc = qedr_check_srq_params(dev, init_attr, udata);
 	if (rc)
 		return -EINVAL;
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
index 082208f9aa9006..bdc2703532c6cc 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
@@ -121,7 +121,7 @@ int pvrdma_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init_attr,
 		dev_warn(&dev->pdev->dev,
 			 "shared receive queue type %d not supported\n",
 			 init_attr->srq_type);
-		return -EINVAL;
+		return -EOPNOTSUPP;
 	}
 
 	if (init_attr->attr.max_wr  > dev->dsr->caps.max_srq_wr ||
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 5f47f21c2958d3..38e603260cfc43 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -265,6 +265,9 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init,
 	struct rxe_srq *srq = to_rsrq(ibsrq);
 	struct rxe_create_srq_resp __user *uresp = NULL;
 
+	if (init->srq_type != IB_SRQT_BASIC)
+		return -EOPNOTSUPP;
+
 	if (udata) {
 		if (udata->outlen < sizeof(*uresp))
 			return -EINVAL;
diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index 7cf3242ffb41f9..1c469f967ab9b2 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -1555,6 +1555,9 @@ int siw_create_srq(struct ib_srq *base_srq,
 					  base_ucontext);
 	int rv;
 
+	if (init_attrs->srq_type != IB_SRQT_BASIC)
+		return -EOPNOTSUPP;
+
 	if (atomic_inc_return(&sdev->num_srq) > SIW_MAX_SRQ) {
 		siw_dbg_pd(base_srq->pd, "too many SRQ's\n");
 		rv = -ENOMEM;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 06/11] RDMA: Check attr_mask during modify_qp
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (4 preceding siblings ...)
  2020-10-03 23:20 ` [PATCH 05/11] RDMA: Check srq_type during create_srq Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-04 11:02   ` Gal Pressman
  2020-10-03 23:20 ` [PATCH 07/11] RDMA: Check flags during create_cq Jason Gunthorpe
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dennis Dalessandro,
	Devesh Sharma, Doug Ledford, Faisal Latif, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Mike Marciniszyn,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Shiraz Saleem, Yossi Leybovich, Somnath Kotur,
	Sriharsha Basavapatna, Zhu Yanjun, Yishai Hadas

Each driver should check that it can support the provided attr_mask during
modify_qp. IB_USER_VERBS_EX_CMD_MODIFY_QP was being used to block
modify_qp_ex because the driver didn't check RATE_LIMIT.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/core/device.c             |  1 +
 drivers/infiniband/core/uverbs_cmd.c         |  8 ++------
 drivers/infiniband/hw/bnxt_re/ib_verbs.c     |  3 +++
 drivers/infiniband/hw/cxgb4/qp.c             |  3 +++
 drivers/infiniband/hw/efa/efa_verbs.c        |  3 +++
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c   |  2 ++
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c   |  3 +++
 drivers/infiniband/hw/i40iw/i40iw_verbs.c    |  3 +++
 drivers/infiniband/hw/mlx4/qp.c              |  3 +++
 drivers/infiniband/hw/mlx5/main.c            |  3 +--
 drivers/infiniband/hw/mlx5/qp.c              |  3 +++
 drivers/infiniband/hw/mthca/mthca_qp.c       |  3 +++
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  3 +++
 drivers/infiniband/hw/qedr/verbs.c           |  3 +++
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  3 +++
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c |  3 +++
 drivers/infiniband/sw/rdmavt/qp.c            |  3 +++
 drivers/infiniband/sw/rxe/rxe_verbs.c        |  3 +++
 drivers/infiniband/sw/siw/siw_verbs.c        |  3 +++
 include/rdma/ib_verbs.h                      |  2 ++
 include/uapi/rdma/ib_user_verbs.h            | 14 --------------
 21 files changed, 53 insertions(+), 22 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 75e6e68688c6d0..44c3c3ecb9d6a6 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -639,6 +639,7 @@ struct ib_device *_ib_alloc_device(size_t size)
 		BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_WQ) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_CQ) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_QP) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_WQ) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_QUERY_DEVICE);
 
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index f85a6117577296..54c3eb463da85d 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1906,8 +1906,7 @@ static int ib_uverbs_modify_qp(struct uverbs_attr_bundle *attrs)
 	if (ret)
 		return ret;
 
-	if (cmd.base.attr_mask &
-	    ~((IB_USER_LEGACY_LAST_QP_ATTR_MASK << 1) - 1))
+	if (cmd.base.attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
 		return -EOPNOTSUPP;
 
 	return modify_qp(attrs, &cmd);
@@ -1929,10 +1928,7 @@ static int ib_uverbs_ex_modify_qp(struct uverbs_attr_bundle *attrs)
 	 * Last bit is reserved for extending the attr_mask by
 	 * using another field.
 	 */
-	BUILD_BUG_ON(IB_USER_LAST_QP_ATTR_MASK == (1ULL << 31));
-
-	if (cmd.base.attr_mask &
-	    ~((IB_USER_LAST_QP_ATTR_MASK << 1) - 1))
+	if (cmd.base.attr_mask & ~(IB_QP_ATTR_STANDARD_BITS | IB_QP_RATE_LIMIT))
 		return -EOPNOTSUPP;
 
 	ret = modify_qp(attrs, &cmd);
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index a0e8d93595d8e8..580cf541e225dc 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -1836,6 +1836,9 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
 	unsigned int flags;
 	u8 nw_type;
 
+	if (qp_attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	qp->qplib_qp.modify_flags = 0;
 	if (qp_attr_mask & IB_QP_STATE) {
 		curr_qp_state = __to_ib_qp_state(qp->qplib_qp.cur_qp_state);
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index d2b46c5c1645e4..79e69d449b0748 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -2374,6 +2374,9 @@ int c4iw_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 
 	pr_debug("ib_qp %p\n", ibqp);
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	/* iwarp does not support the RTR state */
 	if ((attr_mask & IB_QP_STATE) && (attr->qp_state == IB_QPS_RTR))
 		attr_mask &= ~IB_QP_STATE;
diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
index 191e0843f090c8..e3d9a5a5f4d992 100644
--- a/drivers/infiniband/hw/efa/efa_verbs.c
+++ b/drivers/infiniband/hw/efa/efa_verbs.c
@@ -917,6 +917,9 @@ int efa_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
 	enum ib_qp_state new_state;
 	int err;
 
+	if (qp_attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	if (udata->inlen &&
 	    !ib_is_udata_cleared(udata, 0, udata->inlen)) {
 		ibdev_dbg(&dev->ibdev,
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index b3d5ba8ef439a3..f18380f827dd87 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -3256,6 +3256,8 @@ static int hns_roce_v1_modify_qp(struct ib_qp *ibqp,
 				 enum ib_qp_state cur_state,
 				 enum ib_qp_state new_state)
 {
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
 
 	if (ibqp->qp_type == IB_QPT_GSI || ibqp->qp_type == IB_QPT_SMI)
 		return hns_roce_v1_m_sqp(ibqp, attr, attr_mask, cur_state,
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 6d30850696c518..a0b679254a8e56 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -4757,6 +4757,9 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
 	unsigned long rq_flag = 0;
 	int ret;
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	/*
 	 * In v2 engine, software pass context and context mask to hardware
 	 * when modifying qp. If software need modify some fields in context,
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index be2bd843c58396..26a61af2d3977f 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -855,6 +855,9 @@ int i40iw_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	u32 err;
 	unsigned long flags;
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	memset(&info, 0, sizeof(info));
 	ctx_info = &iwqp->ctx_info;
 	iwarp_info = &iwqp->iwarp_info;
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 5cb8e602294ca9..8834629615bc6d 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -2787,6 +2787,9 @@ int mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	struct mlx4_ib_qp *mqp = to_mqp(ibqp);
 	int ret;
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	ret = _mlx4_ib_modify_qp(ibqp, attr, attr_mask, udata);
 
 	if (mqp->mlx4_ib_qp_type == MLX4_IB_QPT_GSI) {
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 7f03ffabddbe87..39950d5230c0af 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4144,8 +4144,7 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
 		(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
 	dev->ib_dev.uverbs_ex_cmd_mask |=
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ)	|
-		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP)	|
-		(1ull << IB_USER_VERBS_EX_CMD_MODIFY_QP);
+		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP);
 
 	if (MLX5_CAP_GEN(mdev, ipoib_enhanced_offloads) &&
 	    IS_ENABLED(CONFIG_MLX5_CORE_IPOIB))
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 600e056798c0a1..19361132336cb9 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -4247,6 +4247,9 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	int err = -EINVAL;
 	int port;
 
+	if (attr_mask & ~(IB_QP_ATTR_STANDARD_BITS | IB_QP_RATE_LIMIT))
+		return -EOPNOTSUPP;
+
 	if (ibqp->rwq_ind_tbl)
 		return -ENOSYS;
 
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 08a2a7afafd3d2..07cfc0934b17d5 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -863,6 +863,9 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
 	enum ib_qp_state cur_state, new_state;
 	int err = -EINVAL;
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	mutex_lock(&qp->mutex);
 	if (attr_mask & IB_QP_CUR_STATE) {
 		cur_state = attr->cur_qp_state;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index b392e15d7592b6..244dd22d53efa7 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1391,6 +1391,9 @@ int ocrdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	struct ocrdma_dev *dev;
 	enum ib_qp_state old_qps, new_qps;
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	qp = get_ocrdma_qp(ibqp);
 	dev = get_ocrdma_dev(ibqp->device);
 
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 29a96ff6fc66b6..34c07a18c2c218 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -2472,6 +2472,9 @@ int qedr_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 		 "modify qp: qp %p attr_mask=0x%x, state=%d", qp, attr_mask,
 		 attr->qp_state);
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	old_qp_state = qedr_get_ibqp_state(qp->state);
 	if (attr_mask & IB_QP_STATE)
 		new_qp_state = attr->qp_state;
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index 9e961f8ffa10de..a89d5816685af6 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -557,6 +557,9 @@ int usnic_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	int status;
 	usnic_dbg("\n");
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	qp_grp = to_uqp_grp(ibqp);
 
 	mutex_lock(&qp_grp->vf->pf->usdev_lock);
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
index 428256c5506571..9fdec5b9553c4e 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
@@ -544,6 +544,9 @@ int pvrdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	enum ib_qp_state cur_state, next_state;
 	int ret;
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	/* Sanity checking. Should need lock here */
 	mutex_lock(&qp->mutex);
 	cur_state = (attr_mask & IB_QP_CUR_STATE) ? attr->cur_qp_state :
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index ee48befc897861..7b93e7bb0072a2 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -1469,6 +1469,9 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	int pmtu = 0; /* for gcc warning only */
 	int opa_ah;
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	spin_lock_irq(&qp->r_lock);
 	spin_lock(&qp->s_hlock);
 	spin_lock(&qp->s_lock);
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 38e603260cfc43..fa4a0dd2e08c00 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -436,6 +436,9 @@ static int rxe_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	struct rxe_dev *rxe = to_rdev(ibqp->device);
 	struct rxe_qp *qp = to_rqp(ibqp);
 
+	if (mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	err = rxe_qp_chk_attr(rxe, qp, attr, mask);
 	if (err)
 		goto err1;
diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index 1c469f967ab9b2..947b8b1cbe9af6 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -544,6 +544,9 @@ int siw_verbs_modify_qp(struct ib_qp *base_qp, struct ib_qp_attr *attr,
 	if (!attr_mask)
 		return 0;
 
+	if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
+		return -EOPNOTSUPP;
+
 	memset(&new_attrs, 0, sizeof(new_attrs));
 
 	if (attr_mask & IB_QP_ACCESS_FLAGS) {
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index ce935d70fdc879..ddcd0478c00dc3 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1234,6 +1234,8 @@ enum ib_qp_attr_mask {
 	IB_QP_RESERVED3			= (1<<23),
 	IB_QP_RESERVED4			= (1<<24),
 	IB_QP_RATE_LIMIT		= (1<<25),
+
+	IB_QP_ATTR_STANDARD_BITS = GENMASK(20, 0),
 };
 
 enum ib_qp_state {
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 456438c18c2c35..7ee73a0652f1af 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -596,20 +596,6 @@ enum {
 	IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE,
 };
 
-enum {
-	/*
-	 * This value is equal to IB_QP_DEST_QPN.
-	 */
-	IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20,
-};
-
-enum {
-	/*
-	 * This value is equal to IB_QP_RATE_LIMIT.
-	 */
-	IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25,
-};
-
 struct ib_uverbs_ex_create_qp {
 	__aligned_u64 user_handle;
 	__u32 pd_handle;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/11] RDMA: Check flags during create_cq
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (5 preceding siblings ...)
  2020-10-03 23:20 ` [PATCH 06/11] RDMA: Check attr_mask during modify_qp Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-06 18:04   ` Saleem, Shiraz
  2020-10-03 23:20 ` [PATCH 08/11] RDMA: Check create_flags during create_qp Jason Gunthorpe
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dennis Dalessandro,
	Devesh Sharma, Doug Ledford, Faisal Latif, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Mike Marciniszyn,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Shiraz Saleem, Yossi Leybovich, Somnath Kotur,
	Sriharsha Basavapatna, Zhu Yanjun, Yishai Hadas

Each driver should check that the CQ attrs is supported. Unfortuantely
when flags was added to the CQ attrs the drivers were not updated,
uverbs_ex_cmd_mask was used to block it. This was missed when create CQ
was converted to ioctl, so non-zero flags could have been passed into
drivers.

Check that flags is zero in all drivers that don't use it, remove
IB_USER_VERBS_EX_CMD_CREATE_CQ from uverbs_ex_cmd_mask.

Fixes: 41b2a71fc848 ("IB/uverbs: Move ioctl path of create_cq and destroy_cq to a new file")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/core/device.c             | 1 +
 drivers/infiniband/hw/bnxt_re/ib_verbs.c     | 3 +++
 drivers/infiniband/hw/cxgb4/cq.c             | 2 +-
 drivers/infiniband/hw/efa/efa_verbs.c        | 3 +++
 drivers/infiniband/hw/hns/hns_roce_cq.c      | 3 +++
 drivers/infiniband/hw/i40iw/i40iw_verbs.c    | 3 +++
 drivers/infiniband/hw/mlx4/main.c            | 1 -
 drivers/infiniband/hw/mlx5/main.c            | 1 -
 drivers/infiniband/hw/mthca/mthca_provider.c | 2 +-
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  | 2 +-
 drivers/infiniband/hw/qedr/verbs.c           | 3 +++
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 2 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c | 3 +++
 drivers/infiniband/sw/rdmavt/cq.c            | 2 +-
 drivers/infiniband/sw/rxe/rxe_verbs.c        | 2 +-
 drivers/infiniband/sw/siw/siw_verbs.c        | 3 +++
 16 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 44c3c3ecb9d6a6..0a888574674281 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -632,6 +632,7 @@ struct ib_device *_ib_alloc_device(size_t size)
 		BIT_ULL(IB_USER_VERBS_CMD_RESIZE_CQ);
 
 	device->uverbs_ex_cmd_mask =
+		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_CQ) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_FLOW) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_WQ) |
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 580cf541e225dc..6263885ff61d57 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -2837,6 +2837,9 @@ int bnxt_re_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 	struct bnxt_qplib_nq *nq = NULL;
 	unsigned int nq_alloc_cnt;
 
+	if (attr->flags)
+		return -EOPNOTSUPP;
+
 	/* Validate CQ fields */
 	if (cqe < 1 || cqe > dev_attr->max_cq_wqes) {
 		ibdev_err(&rdev->ibdev, "Failed to create CQ -max exceeded");
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index 28349ed5088540..2cb65be24770f1 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -1006,7 +1006,7 @@ int c4iw_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 
 	pr_debug("ib_dev %p entries %d\n", ibdev, entries);
 	if (attr->flags)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	if (vector >= rhp->rdev.lldi.nciq)
 		return -EINVAL;
diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
index e3d9a5a5f4d992..2fe5708b2d9d8c 100644
--- a/drivers/infiniband/hw/efa/efa_verbs.c
+++ b/drivers/infiniband/hw/efa/efa_verbs.c
@@ -1032,6 +1032,9 @@ int efa_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 
 	ibdev_dbg(ibdev, "create_cq entries %d\n", entries);
 
+	if (attr->flags)
+		return -EOPNOTSUPP;
+
 	if (entries < 1 || entries > dev->dev_attr.max_cq_depth) {
 		ibdev_dbg(ibdev,
 			  "cq: requested entries[%u] non-positive or greater than max[%u]\n",
diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c
index 809b22aa5056c4..68f355fba425b5 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cq.c
@@ -251,6 +251,9 @@ int hns_roce_create_cq(struct ib_cq *ib_cq, const struct ib_cq_init_attr *attr,
 	u32 cq_entries = attr->cqe;
 	int ret;
 
+	if (attr->flags)
+		return -EOPNOTSUPP;
+
 	if (cq_entries < 1 || cq_entries > hr_dev->caps.max_cqes) {
 		ibdev_err(ibdev, "Failed to check CQ count %d max=%d\n",
 			  cq_entries, hr_dev->caps.max_cqes);
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 26a61af2d3977f..4aade66ad2aea8 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -1107,6 +1107,9 @@ static int i40iw_create_cq(struct ib_cq *ibcq,
 	int err_code;
 	int entries = attr->cqe;
 
+	if (attr->flags)
+		return -EOPNOTSUPP;
+
 	if (iwdev->closing)
 		return -ENODEV;
 
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 6216dfe6e9c79c..a6ae21721b124a 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2659,7 +2659,6 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 
 	ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_ops);
 	ibdev->ib_dev.uverbs_ex_cmd_mask |=
-		(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ) |
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP);
 
 	if ((dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS) &&
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 39950d5230c0af..9e2f6a7967a61b 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4143,7 +4143,6 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
 		(1ull << IB_USER_VERBS_CMD_CREATE_AH)		|
 		(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
 	dev->ib_dev.uverbs_ex_cmd_mask |=
-		(1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ)	|
 		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP);
 
 	if (MLX5_CAP_GEN(mdev, ipoib_enhanced_offloads) &&
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index a01898ac99e224..5e798a6f75d715 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -612,7 +612,7 @@ static int mthca_create_cq(struct ib_cq *ibcq,
 		udata, struct mthca_ucontext, ibucontext);
 
 	if (attr->flags)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	if (entries < 1 || entries > to_mdev(ibdev)->limits.max_cqes)
 		return -EINVAL;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 244dd22d53efa7..29ec0a808a19d8 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -974,7 +974,7 @@ int ocrdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 	struct ocrdma_create_cq_ureq ureq;
 
 	if (attr->flags)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	if (udata) {
 		if (ib_copy_from_udata(&ureq, udata, sizeof(ureq)))
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 34c07a18c2c218..80373170ce51f5 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -928,6 +928,9 @@ int qedr_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 		 "create_cq: called from %s. entries=%d, vector=%d\n",
 		 udata ? "User Lib" : "Kernel", entries, vector);
 
+	if (attr->flags)
+		return -EOPNOTSUPP;
+
 	if (entries > QEDR_MAX_CQES) {
 		DP_ERR(dev,
 		       "create cq: the number of entries %d is too high. Must be equal or below %d.\n",
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index a89d5816685af6..d6708d1db73af2 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -584,7 +584,7 @@ int usnic_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 		       struct ib_udata *udata)
 {
 	if (attr->flags)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	return 0;
 }
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
index 319546a39a0d5c..a119ac3e103c8d 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
@@ -119,6 +119,9 @@ int pvrdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 
 	BUILD_BUG_ON(sizeof(struct pvrdma_cqe) != 64);
 
+	if (attr->flags)
+		return -EOPNOTSUPP;
+
 	entries = roundup_pow_of_two(entries);
 	if (entries < 1 || entries > dev->dsr->caps.max_cqe)
 		return -EINVAL;
diff --git a/drivers/infiniband/sw/rdmavt/cq.c b/drivers/infiniband/sw/rdmavt/cq.c
index 19248be1409335..20cc0799ac4bc4 100644
--- a/drivers/infiniband/sw/rdmavt/cq.c
+++ b/drivers/infiniband/sw/rdmavt/cq.c
@@ -211,7 +211,7 @@ int rvt_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 	int err;
 
 	if (attr->flags)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	if (entries < 1 || entries > rdi->dparms.props.max_cqe)
 		return -EINVAL;
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index fa4a0dd2e08c00..7baa8f5cba813e 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -771,7 +771,7 @@ static int rxe_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 	}
 
 	if (attr->flags)
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	err = rxe_cq_chk_attr(rxe, NULL, attr->cqe, attr->comp_vector);
 	if (err)
diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index 947b8b1cbe9af6..bcea5c5ace2b6b 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -1097,6 +1097,9 @@ int siw_create_cq(struct ib_cq *base_cq, const struct ib_cq_init_attr *attr,
 	struct siw_cq *cq = to_siw_cq(base_cq);
 	int rv, size = attr->cqe;
 
+	if (attr->flags)
+		return -EOPNOTSUPP;
+
 	if (atomic_inc_return(&sdev->num_cq) > SIW_MAX_CQ) {
 		siw_dbg(base_cq->device, "too many CQ's\n");
 		rv = -ENOMEM;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 08/11] RDMA: Check create_flags during create_qp
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (6 preceding siblings ...)
  2020-10-03 23:20 ` [PATCH 07/11] RDMA: Check flags during create_cq Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 09/11] RDMA/core Remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dennis Dalessandro,
	Devesh Sharma, Doug Ledford, Faisal Latif, Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Mike Marciniszyn,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Shiraz Saleem, Somnath Kotur, Sriharsha Basavapatna, Zhu Yanjun,
	Yishai Hadas

Each driver should check that the QP attrs create_flags is supported.
Unfortuantely when create_flags was added to the QP attrs the drivers were
not updated. uverbs_ex_cmd_mask was used to block it - even though kernel
drivers use these flags too.

Check that flags is zero in all drivers that don't use it, remove
IB_USER_VERBS_EX_CMD_CREATE_QP from uverbs_ex_cmd_mask. Fix the error code
to be EOPNOTSUPP.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/core/device.c             |  1 +
 drivers/infiniband/hw/bnxt_re/ib_verbs.c     |  4 +++-
 drivers/infiniband/hw/cxgb4/qp.c             |  2 +-
 drivers/infiniband/hw/hns/hns_roce_qp.c      | 14 +++-----------
 drivers/infiniband/hw/i40iw/i40iw_verbs.c    |  2 +-
 drivers/infiniband/hw/mlx4/main.c            |  2 --
 drivers/infiniband/hw/mlx4/qp.c              |  2 +-
 drivers/infiniband/hw/mlx5/main.c            |  2 --
 drivers/infiniband/hw/mlx5/qp.c              |  7 ++++---
 drivers/infiniband/hw/mthca/mthca_provider.c |  2 +-
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |  3 +++
 drivers/infiniband/hw/qedr/verbs.c           |  3 +++
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  2 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c |  2 +-
 drivers/infiniband/sw/rdmavt/qp.c            |  7 ++++---
 drivers/infiniband/sw/rxe/rxe_verbs.c        |  3 +++
 drivers/infiniband/sw/siw/siw_verbs.c        |  3 +++
 17 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 0a888574674281..4b808827ffcae5 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -634,6 +634,7 @@ struct ib_device *_ib_alloc_device(size_t size)
 	device->uverbs_ex_cmd_mask =
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_CQ) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_FLOW) |
+		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_QP) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_WQ) |
 		BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_FLOW) |
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 6263885ff61d57..335ba485cd3be7 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -1276,10 +1276,12 @@ static int bnxt_re_init_qp_attr(struct bnxt_re_qp *qp, struct bnxt_re_pd *pd,
 	}
 	qplqp->mtu = ib_mtu_enum_to_int(iboe_get_mtu(rdev->netdev->mtu));
 	qplqp->dpi = &rdev->dpi_privileged; /* Doorbell page */
-	if (init_attr->create_flags)
+	if (init_attr->create_flags) {
 		ibdev_dbg(&rdev->ibdev,
 			  "QP create flags 0x%x not supported",
 			  init_attr->create_flags);
+		return -EOPNOTSUPP;
+	}
 
 	/* Setup CQs */
 	if (init_attr->send_cq) {
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 79e69d449b0748..a7401398cb344a 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -2126,7 +2126,7 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
 
 	pr_debug("ib_pd %p\n", pd);
 
-	if (attrs->qp_type != IB_QPT_RC)
+	if (attrs->qp_type != IB_QPT_RC || attrs->create_flags)
 		return ERR_PTR(-EOPNOTSUPP);
 
 	php = to_c4iw_pd(pd);
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 6c081dd985fc94..04a70681bea1bd 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -869,17 +869,6 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
 		if (ret)
 			ibdev_err(ibdev, "Failed to set user SQ size\n");
 	} else {
-		if (init_attr->create_flags &
-		    IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) {
-			ibdev_err(ibdev, "Failed to check multicast loopback\n");
-			return -EINVAL;
-		}
-
-		if (init_attr->create_flags & IB_QP_CREATE_IPOIB_UD_LSO) {
-			ibdev_err(ibdev, "Failed to check ipoib ud lso\n");
-			return -EINVAL;
-		}
-
 		ret = set_kernel_sq_size(hr_dev, &init_attr->cap, hr_qp);
 		if (ret)
 			ibdev_err(ibdev, "Failed to set kernel SQ size\n");
@@ -906,6 +895,9 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev,
 	hr_qp->state = IB_QPS_RESET;
 	hr_qp->flush_flag = 0;
 
+	if (init_attr->create_flags)
+		return -EOPNOTSUPP;
+
 	ret = set_qp_param(hr_dev, hr_qp, init_attr, udata, &ucmd);
 	if (ret) {
 		ibdev_err(ibdev, "Failed to set QP param\n");
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 4aade66ad2aea8..65c9e010d4d5b1 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -556,7 +556,7 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd,
 		return ERR_PTR(-ENODEV);
 
 	if (init_attr->create_flags)
-		return ERR_PTR(-EINVAL);
+		return ERR_PTR(-EOPNOTSUPP);
 	if (init_attr->cap.max_inline_data > I40IW_MAX_INLINE_DATA_SIZE)
 		init_attr->cap.max_inline_data = I40IW_MAX_INLINE_DATA_SIZE;
 
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index a6ae21721b124a..15508036c83b18 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2658,8 +2658,6 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 	ibdev->ib_dev.dev.parent	= &dev->persist->pdev->dev;
 
 	ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_ops);
-	ibdev->ib_dev.uverbs_ex_cmd_mask |=
-		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP);
 
 	if ((dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS) &&
 	    ((mlx4_ib_port_link_layer(&ibdev->ib_dev, 1) ==
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 8834629615bc6d..47b9ed5599b396 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1493,7 +1493,7 @@ static int _mlx4_ib_create_qp(struct ib_pd *pd, struct mlx4_ib_qp *qp,
 					MLX4_IB_SRIOV_SQP |
 					MLX4_IB_QP_NETIF |
 					MLX4_IB_QP_CREATE_ROCE_V2_GSI))
-		return -EINVAL;
+		return -EOPNOTSUPP;
 
 	if (init_attr->create_flags & IB_QP_CREATE_NETIF_QP) {
 		if (init_attr->qp_type != IB_QPT_UD)
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 9e2f6a7967a61b..9cdc87fd99618c 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4142,8 +4142,6 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
 	dev->ib_dev.uverbs_cmd_mask |=
 		(1ull << IB_USER_VERBS_CMD_CREATE_AH)		|
 		(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
-	dev->ib_dev.uverbs_ex_cmd_mask |=
-		(1ull << IB_USER_VERBS_EX_CMD_CREATE_QP);
 
 	if (MLX5_CAP_GEN(mdev, ipoib_enhanced_offloads) &&
 	    IS_ENABLED(CONFIG_MLX5_CORE_IPOIB))
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 19361132336cb9..251421dd6f1d5e 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -2712,11 +2712,12 @@ static int process_create_flags(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
 	process_create_flag(dev, &create_flags, MLX5_IB_QP_CREATE_SQPN_QP1,
 			    true, qp);
 
-	if (create_flags)
+	if (create_flags) {
 		mlx5_ib_dbg(dev, "Create QP has unsupported flags 0x%X\n",
 			    create_flags);
-
-	return (create_flags) ? -EINVAL : 0;
+		return -EOPNOTSUPP;
+	}
+	return 0;
 }
 
 static int process_udata_size(struct mlx5_ib_dev *dev,
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 5e798a6f75d715..a4a0ac3a25a06a 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -470,7 +470,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
 	int err;
 
 	if (init_attr->create_flags)
-		return ERR_PTR(-EINVAL);
+		return ERR_PTR(-EOPNOTSUPP);
 
 	switch (init_attr->qp_type) {
 	case IB_QPT_RC:
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 29ec0a808a19d8..bc98bd950d99fa 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1299,6 +1299,9 @@ struct ib_qp *ocrdma_create_qp(struct ib_pd *ibpd,
 	struct ocrdma_create_qp_ureq ureq;
 	u16 dpp_credit_lmt, dpp_offset;
 
+	if (attrs->create_flags)
+		return ERR_PTR(-EOPNOTSUPP);
+
 	status = ocrdma_check_qp_params(ibpd, dev, attrs, udata);
 	if (status)
 		goto gen_err;
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 80373170ce51f5..2e85bb5104cb68 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -2239,6 +2239,9 @@ struct ib_qp *qedr_create_qp(struct ib_pd *ibpd,
 	struct ib_qp *ibqp;
 	int rc = 0;
 
+	if (attrs->create_flags)
+		return ERR_PTR(-EOPNOTSUPP);
+
 	if (attrs->qp_type == IB_QPT_XRC_TGT) {
 		xrcd = get_qedr_xrcd(attrs->xrcd);
 		dev = get_qedr_dev(xrcd->ibxrcd.device);
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index d6708d1db73af2..38a37770c01627 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -474,7 +474,7 @@ struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd,
 	us_ibdev = to_usdev(pd->device);
 
 	if (init_attr->create_flags)
-		return ERR_PTR(-EINVAL);
+		return ERR_PTR(-EOPNOTSUPP);
 
 	err = ib_copy_from_udata(&cmd, udata, sizeof(cmd));
 	if (err) {
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
index 9fdec5b9553c4e..1d3bdd7bb51d96 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
@@ -209,7 +209,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
 		dev_warn(&dev->pdev->dev,
 			 "invalid create queuepair flags %#x\n",
 			 init_attr->create_flags);
-		return ERR_PTR(-EINVAL);
+		return ERR_PTR(-EOPNOTSUPP);
 	}
 
 	if (init_attr->qp_type != IB_QPT_RC &&
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 7b93e7bb0072a2..e9db6bf106186f 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -1083,10 +1083,11 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
 	if (!rdi)
 		return ERR_PTR(-EINVAL);
 
+	if (init_attr->create_flags & ~IB_QP_CREATE_NETDEV_USE)
+		return ERR_PTR(-EOPNOTSUPP);
+
 	if (init_attr->cap.max_send_sge > rdi->dparms.props.max_send_sge ||
-	    init_attr->cap.max_send_wr > rdi->dparms.props.max_qp_wr ||
-	    (init_attr->create_flags &&
-	     init_attr->create_flags != IB_QP_CREATE_NETDEV_USE))
+	    init_attr->cap.max_send_wr > rdi->dparms.props.max_qp_wr)
 		return ERR_PTR(-EINVAL);
 
 	/* Check receive queue parameters if no SRQ is specified. */
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 7baa8f5cba813e..9100a39f9cb9fe 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -395,6 +395,9 @@ static struct ib_qp *rxe_create_qp(struct ib_pd *ibpd,
 		uresp = udata->outbuf;
 	}
 
+	if (init->create_flags)
+		return ERR_PTR(-EOPNOTSUPP);
+
 	err = rxe_qp_chk_init(rxe, init);
 	if (err)
 		goto err1;
diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c
index bcea5c5ace2b6b..68fd053fc7748a 100644
--- a/drivers/infiniband/sw/siw/siw_verbs.c
+++ b/drivers/infiniband/sw/siw/siw_verbs.c
@@ -307,6 +307,9 @@ struct ib_qp *siw_create_qp(struct ib_pd *pd,
 
 	siw_dbg(base_dev, "create new QP\n");
 
+	if (attrs->create_flags)
+		return ERR_PTR(-EOPNOTSUPP);
+
 	if (atomic_inc_return(&sdev->num_qp) > SIW_MAX_QP) {
 		siw_dbg(base_dev, "too many QP's\n");
 		rv = -ENOMEM;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 09/11] RDMA/core Remove uverbs_ex_cmd_mask
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (7 preceding siblings ...)
  2020-10-03 23:20 ` [PATCH 08/11] RDMA: Check create_flags during create_qp Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 10/11] RDMA: Remove uverbs cmds from drivers that don't use them Jason Gunthorpe
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Doug Ledford, linux-rdma, Bob Pearson

No driver sets it, and the core code sets a maximum mask, simply remove
it.

Disabled operations are now handled either by having a NULL ops pointer,
or by having the common driver callbacks check for unsupported extended
attributes.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/core/device.c      | 15 ---------------
 drivers/infiniband/core/uverbs_uapi.c |  5 +----
 include/rdma/ib_verbs.h               |  1 -
 3 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 4b808827ffcae5..b2325e7a7f2db3 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -630,21 +630,6 @@ struct ib_device *_ib_alloc_device(size_t size)
 		BIT_ULL(IB_USER_VERBS_CMD_REG_MR) |
 		BIT_ULL(IB_USER_VERBS_CMD_REREG_MR) |
 		BIT_ULL(IB_USER_VERBS_CMD_RESIZE_CQ);
-
-	device->uverbs_ex_cmd_mask =
-		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_CQ) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_FLOW) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_QP) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_CREATE_WQ) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_FLOW) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_WQ) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_CQ) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_QP) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_WQ) |
-		BIT_ULL(IB_USER_VERBS_EX_CMD_QUERY_DEVICE);
-
 	return device;
 }
 EXPORT_SYMBOL(_ib_alloc_device);
diff --git a/drivers/infiniband/core/uverbs_uapi.c b/drivers/infiniband/core/uverbs_uapi.c
index 5addc8fae3f3bd..62f5bcb712cf17 100644
--- a/drivers/infiniband/core/uverbs_uapi.c
+++ b/drivers/infiniband/core/uverbs_uapi.c
@@ -79,10 +79,7 @@ static int uapi_create_write(struct uverbs_api *uapi,
 
 	method_elm->is_ex = def->write.is_ex;
 	method_elm->handler = def->func_write;
-	if (def->write.is_ex)
-		method_elm->disabled = !(ibdev->uverbs_ex_cmd_mask &
-					 BIT_ULL(def->write.command_num));
-	else
+	if (!def->write.is_ex)
 		method_elm->disabled = !(ibdev->uverbs_cmd_mask &
 					 BIT_ULL(def->write.command_num));
 
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index ddcd0478c00dc3..437508290bc9bf 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2667,7 +2667,6 @@ struct ib_device {
 	const struct attribute_group	*groups[3];
 
 	u64			     uverbs_cmd_mask;
-	u64			     uverbs_ex_cmd_mask;
 
 	char			     node_desc[IB_DEVICE_NODE_DESC_MAX];
 	__be64			     node_guid;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/11] RDMA: Remove uverbs cmds from drivers that don't use them
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (8 preceding siblings ...)
  2020-10-03 23:20 ` [PATCH 09/11] RDMA/core Remove uverbs_ex_cmd_mask Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-03 23:20 ` [PATCH 11/11] RDMA: Remove AH from uverbs_cmd_mask Jason Gunthorpe
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Adit Ranadive, Ariel Elior, Potnuri Bharat Teja, Bernard Metzler,
	Devesh Sharma, Doug Ledford, Faisal Latif, Wei Hu(Xavier),
	linux-rdma, Weihang Li, Michal Kalderon, Lijun Ou,
	VMware PV-Drivers, Bob Pearson, Selvin Xavier, Shiraz Saleem,
	Zhu Yanjun

Allowing userspace to invoke these commands is probably going to crash
these drivers as they are not tested and not expecting to use them on a
user object.

For example pvrdma touches cq->ring_state which is not initialized for
user QPs.

These commands are effected:

- IB_USER_VERBS_CMD_REQ_NOTIFY_CQ is ibv_cmd_req_notify_cq() in
  rdma-core, only hfi1, ipath and rxe calls it.

- IB_USER_VERBS_CMD_POLL_CQ is ibv_cmd_poll_cq() in rdma-core, only
  ipath and hfi1 calls it.

- IB_USER_VERBS_CMD_POST_SEND/RECV is ibv_cmd_post_send/recv() in
  rdma-core, only ipath and hfi1 call them.

- IB_USER_VERBS_CMD_POST_SRQ_RECV is ibv_cmd_post_srq_recv() in
  rdma-core, only ipath and hfi1 calls it.

- IB_USER_VERBS_CMD_PEEK_CQ isn't even implemented anywhere

- IB_USER_VERBS_CMD_CREATE/DESTROY_AH is ibv_cmd_create/destroy_ah() in
  rdma-core, only bnxt_re, efa, hfi1, ipath, mlx5, orcrdma, and rxe call
  it.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/hw/cxgb4/provider.c         |  5 -----
 drivers/infiniband/hw/hns/hns_roce_main.c      |  2 --
 drivers/infiniband/hw/i40iw/i40iw_verbs.c      |  7 -------
 drivers/infiniband/hw/ocrdma/ocrdma_main.c     | 12 ++----------
 drivers/infiniband/hw/qedr/main.c              |  7 -------
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 10 ----------
 drivers/infiniband/sw/rxe/rxe_verbs.c          |  7 +------
 drivers/infiniband/sw/siw/siw_main.c           |  6 ------
 8 files changed, 3 insertions(+), 53 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index d3a84fdd2396f3..2591ecead3d82a 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -531,11 +531,6 @@ void c4iw_register_device(struct work_struct *work)
 	if (fastreg_support)
 		dev->device_cap_flags |= IB_DEVICE_MEM_MGT_EXTENSIONS;
 	dev->ibdev.local_dma_lkey = 0;
-	dev->ibdev.uverbs_cmd_mask |=
-	    (1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
-	    (1ull << IB_USER_VERBS_CMD_POLL_CQ) |
-	    (1ull << IB_USER_VERBS_CMD_POST_SEND) |
-	    (1ull << IB_USER_VERBS_CMD_POST_RECV);
 	dev->ibdev.node_type = RDMA_NODE_RNIC;
 	BUILD_BUG_ON(sizeof(C4IW_NODE_DESC) > IB_DEVICE_NODE_DESC_MAX);
 	memcpy(dev->ibdev.node_desc, C4IW_NODE_DESC, sizeof(C4IW_NODE_DESC));
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index a75c09564447b3..25c727d1ac8a6e 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -505,8 +505,6 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
 
 	/* SRQ */
 	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) {
-		ib_dev->uverbs_cmd_mask |=
-				(1ULL << IB_USER_VERBS_CMD_POST_SRQ_RECV);
 		ib_set_device_ops(ib_dev, &hns_roce_dev_srq_ops);
 		ib_set_device_ops(ib_dev, hr_dev->hw->hns_roce_dev_srq_ops);
 	}
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 65c9e010d4d5b1..ce60c5ef88261f 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -2690,13 +2690,6 @@ static struct i40iw_ib_device *i40iw_init_rdma_device(struct i40iw_device *iwdev
 	iwibdev->ibdev.node_type = RDMA_NODE_RNIC;
 	ether_addr_copy((u8 *)&iwibdev->ibdev.node_guid, netdev->dev_addr);
 
-	iwibdev->ibdev.uverbs_cmd_mask |=
-	    (1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
-	    (1ull << IB_USER_VERBS_CMD_POLL_CQ) |
-	    (1ull << IB_USER_VERBS_CMD_CREATE_AH) |
-	    (1ull << IB_USER_VERBS_CMD_DESTROY_AH) |
-	    (1ull << IB_USER_VERBS_CMD_POST_RECV) |
-	    (1ull << IB_USER_VERBS_CMD_POST_SEND);
 	iwibdev->ibdev.phys_port_cnt = 1;
 	iwibdev->ibdev.num_comp_vectors = iwdev->ceqs_count;
 	iwibdev->ibdev.dev.parent = &pcidev->dev;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 40ed7a42f1e1ca..d7dc7a76f9854c 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -204,11 +204,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
 	BUILD_BUG_ON(sizeof(OCRDMA_NODE_DESC) > IB_DEVICE_NODE_DESC_MAX);
 	memcpy(dev->ibdev.node_desc, OCRDMA_NODE_DESC,
 	       sizeof(OCRDMA_NODE_DESC));
-	dev->ibdev.uverbs_cmd_mask |=
-	    OCRDMA_UVERBS(REQ_NOTIFY_CQ) |
-	    OCRDMA_UVERBS(POLL_CQ) |
-	    OCRDMA_UVERBS(POST_SEND) |
-	    OCRDMA_UVERBS(POST_RECV);
 
 	dev->ibdev.uverbs_cmd_mask |=
 	    OCRDMA_UVERBS(CREATE_AH) |
@@ -225,12 +220,9 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
 
 	ib_set_device_ops(&dev->ibdev, &ocrdma_dev_ops);
 
-	if (ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R) {
-		dev->ibdev.uverbs_cmd_mask |=
-		     OCRDMA_UVERBS(POST_SRQ_RECV);
-
+	if (ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R)
 		ib_set_device_ops(&dev->ibdev, &ocrdma_dev_srq_ops);
-	}
+
 	rdma_set_device_sysfs_group(&dev->ibdev, &ocrdma_attr_group);
 	ret = ib_device_set_netdev(&dev->ibdev, dev->nic_info.netdev, 1);
 	if (ret)
diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index d50ee9eacd463d..ee674648208daa 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -245,13 +245,6 @@ static int qedr_register_device(struct qedr_dev *dev)
 	dev->ibdev.node_guid = dev->attr.node_guid;
 	memcpy(dev->ibdev.node_desc, QEDR_NODE_DESC, sizeof(QEDR_NODE_DESC));
 
-	dev->ibdev.uverbs_cmd_mask |=
-				     QEDR_UVERBS(REQ_NOTIFY_CQ) |
-				     QEDR_UVERBS(POST_SRQ_RECV) |
-				     QEDR_UVERBS(POLL_CQ) |
-				     QEDR_UVERBS(POST_SEND) |
-				     QEDR_UVERBS(POST_RECV);
-
 	if (IS_IWARP(dev)) {
 		rc = qedr_iw_register_device(dev);
 		if (rc)
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
index 41836811a71d55..aa18ab53c6f149 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
@@ -205,13 +205,6 @@ static int pvrdma_register_device(struct pvrdma_dev *dev)
 	dev->flags = 0;
 	dev->ib_dev.num_comp_vectors = 1;
 	dev->ib_dev.dev.parent = &dev->pdev->dev;
-	dev->ib_dev.uverbs_cmd_mask |=
-		(1ull << IB_USER_VERBS_CMD_POLL_CQ)		|
-		(1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ)	|
-		(1ull << IB_USER_VERBS_CMD_POST_SEND)		|
-		(1ull << IB_USER_VERBS_CMD_POST_RECV)		|
-		(1ull << IB_USER_VERBS_CMD_CREATE_AH)		|
-		(1ull << IB_USER_VERBS_CMD_DESTROY_AH);
 
 	dev->ib_dev.node_type = RDMA_NODE_IB_CA;
 	dev->ib_dev.phys_port_cnt = dev->dsr->caps.phys_port_cnt;
@@ -235,9 +228,6 @@ static int pvrdma_register_device(struct pvrdma_dev *dev)
 
 	/* Check if SRQ is supported by backend */
 	if (dev->dsr->caps.max_srq) {
-		dev->ib_dev.uverbs_cmd_mask |=
-			(1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV);
-
 		ib_set_device_ops(&dev->ib_dev, &pvrdma_dev_srq_ops);
 
 		dev->srq_tbl = kcalloc(dev->dsr->caps.max_srq,
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 9100a39f9cb9fe..12dfaab1549f1e 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -1145,12 +1145,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
 				     dma_get_required_mask(&dev->dev));
 
 	dev->uverbs_cmd_mask |=
-	    BIT_ULL(IB_USER_VERBS_CMD_POST_SRQ_RECV)
-	    | BIT_ULL(IB_USER_VERBS_CMD_POST_SEND)
-	    | BIT_ULL(IB_USER_VERBS_CMD_POST_RECV)
-	    | BIT_ULL(IB_USER_VERBS_CMD_POLL_CQ)
-	    | BIT_ULL(IB_USER_VERBS_CMD_PEEK_CQ)
-	    | 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)
diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c
index faef91ba031ca7..c08f9a2877992b 100644
--- a/drivers/infiniband/sw/siw/siw_main.c
+++ b/drivers/infiniband/sw/siw/siw_main.c
@@ -346,12 +346,6 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
 		addrconf_addr_eui48((unsigned char *)&base_dev->node_guid,
 				    addr);
 	}
-	base_dev->uverbs_cmd_mask |=
-		(1ull << IB_USER_VERBS_CMD_POLL_CQ) |
-		(1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
-		(1ull << IB_USER_VERBS_CMD_POST_SEND) |
-		(1ull << IB_USER_VERBS_CMD_POST_RECV) |
-		(1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV);
 
 	base_dev->node_type = RDMA_NODE_RNIC;
 	memcpy(base_dev->node_desc, SIW_NODE_DESC_COMMON,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 11/11] RDMA: Remove AH from uverbs_cmd_mask
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (9 preceding siblings ...)
  2020-10-03 23:20 ` [PATCH 10/11] RDMA: Remove uverbs cmds from drivers that don't use them Jason Gunthorpe
@ 2020-10-03 23:20 ` Jason Gunthorpe
  2020-10-06 18:32 ` [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Saleem, Shiraz
  2020-10-26 22:39 ` Jason Gunthorpe
  12 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-03 23:20 UTC (permalink / raw)
  To: Dennis Dalessandro, Devesh Sharma, Doug Ledford, Gal Pressman,
	Leon Romanovsky, linux-rdma, Mike Marciniszyn, Naresh Kumar PBS,
	Bob Pearson, Selvin Xavier, Yossi Leybovich, Somnath Kotur,
	Sriharsha Basavapatna, Zhu Yanjun

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.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/infiniband/core/device.c           |  3 +++
 drivers/infiniband/core/uverbs_cmd.c       |  8 ++++----
 drivers/infiniband/core/verbs.c            |  5 ++++-
 drivers/infiniband/hw/bnxt_re/main.c       | 10 +---------
 drivers/infiniband/hw/efa/efa_main.c       |  5 +----
 drivers/infiniband/hw/mlx5/main.c          |  5 +----
 drivers/infiniband/hw/ocrdma/ocrdma_main.c |  7 +------
 drivers/infiniband/sw/rdmavt/ah.c          |  1 -
 drivers/infiniband/sw/rdmavt/vt.c          |  5 +----
 drivers/infiniband/sw/rxe/rxe_verbs.c      |  9 ++-------
 include/rdma/ib_verbs.h                    |  2 ++
 11 files changed, 20 insertions(+), 40 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index b2325e7a7f2db3..63e97fcfb80b91 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -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_ATTACH_MCAST) |
 		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_CQ) |
 		BIT_ULL(IB_USER_VERBS_CMD_CREATE_QP) |
@@ -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_PD) |
 		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_QP) |
 		BIT_ULL(IB_USER_VERBS_CMD_DESTROY_SRQ) |
@@ -2635,6 +2637,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_rwq_ind_table);
 	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, dealloc_dm);
 	SET_DEVICE_OP(dev_ops, dealloc_driver);
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 54c3eb463da85d..72b209ca77c734 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3689,13 +3689,13 @@ const struct uapi_definition uverbs_def_write_intf[] = {
 				     ib_uverbs_create_ah,
 				     UAPI_DEF_WRITE_UDATA_IO(
 					     struct ib_uverbs_create_ah,
-					     struct ib_uverbs_create_ah_resp),
-				     UAPI_DEF_METHOD_NEEDS_FN(create_ah)),
+					     struct ib_uverbs_create_ah_resp)),
 		DECLARE_UVERBS_WRITE(
 			IB_USER_VERBS_CMD_DESTROY_AH,
 			ib_uverbs_destroy_ah,
-			UAPI_DEF_WRITE_I(struct ib_uverbs_destroy_ah),
-			UAPI_DEF_METHOD_NEEDS_FN(destroy_ah))),
+			UAPI_DEF_WRITE_I(struct ib_uverbs_destroy_ah)),
+		UAPI_DEF_OBJ_NEEDS_FN(create_user_ah),
+		UAPI_DEF_OBJ_NEEDS_FN(destroy_ah)),
 
 	DECLARE_UVERBS_OBJECT(
 		UVERBS_OBJECT_COMP_CHANNEL,
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 740f8454b6b461..cfcfa3ae32cf21 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -533,7 +533,10 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
 	init_attr.flags = flags;
 	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) {
 		kfree(ah);
 		return ERR_PTR(ret);
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 2bee4ca6dcf5fe..eff4af28fd0c38 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -646,6 +646,7 @@ static const struct ib_device_ops bnxt_re_dev_ops = {
 	.create_cq = bnxt_re_create_cq,
 	.create_qp = bnxt_re_create_qp,
 	.create_srq = bnxt_re_create_srq,
+	.create_user_ah = bnxt_re_create_ah,
 	.dealloc_driver = bnxt_re_dealloc_driver,
 	.dealloc_pd = bnxt_re_dealloc_pd,
 	.dealloc_ucontext = bnxt_re_dealloc_ucontext,
@@ -701,15 +702,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
 	ibdev->dev.parent = &rdev->en_dev->pdev->dev;
 	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);
 	ib_set_device_ops(ibdev, &bnxt_re_dev_ops);
 	ret = ib_device_set_netdev(&rdev->ibdev, rdev->netdev, 1);
diff --git a/drivers/infiniband/hw/efa/efa_main.c b/drivers/infiniband/hw/efa/efa_main.c
index ebc0f9475d0969..43bfa912deda89 100644
--- a/drivers/infiniband/hw/efa/efa_main.c
+++ b/drivers/infiniband/hw/efa/efa_main.c
@@ -248,6 +248,7 @@ static const struct ib_device_ops efa_dev_ops = {
 	.create_ah = efa_create_ah,
 	.create_cq = efa_create_cq,
 	.create_qp = efa_create_qp,
+	.create_user_ah = efa_create_ah,
 	.dealloc_pd = efa_dealloc_pd,
 	.dealloc_ucontext = efa_dealloc_ucontext,
 	.dereg_mr = efa_dereg_mr,
@@ -308,10 +309,6 @@ static int efa_ib_device_add(struct efa_dev *dev)
 	dev->ibdev.num_comp_vectors = 1;
 	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);
 
 	err = ib_register_device(&dev->ibdev, "efa_%d");
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 9cdc87fd99618c..932b0c24dddced 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -4022,6 +4022,7 @@ static const struct ib_device_ops mlx5_ib_dev_ops = {
 	.create_cq = mlx5_ib_create_cq,
 	.create_qp = mlx5_ib_create_qp,
 	.create_srq = mlx5_ib_create_srq,
+	.create_user_ah = mlx5_ib_create_ah,
 	.dealloc_pd = mlx5_ib_dealloc_pd,
 	.dealloc_ucontext = mlx5_ib_dealloc_ucontext,
 	.del_gid = mlx5_ib_del_gid,
@@ -4139,10 +4140,6 @@ static int mlx5_ib_stage_caps_init(struct mlx5_ib_dev *dev)
 	struct mlx5_core_dev *mdev = dev->mdev;
 	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) &&
 	    IS_ENABLED(CONFIG_MLX5_CORE_IPOIB))
 		ib_set_device_ops(&dev->ib_dev,
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index d7dc7a76f9854c..ef072f08f18aa1 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -154,6 +154,7 @@ static const struct ib_device_ops ocrdma_dev_ops = {
 	.create_ah = ocrdma_create_ah,
 	.create_cq = ocrdma_create_cq,
 	.create_qp = ocrdma_create_qp,
+	.create_user_ah = ocrdma_create_ah,
 	.dealloc_pd = ocrdma_dealloc_pd,
 	.dealloc_ucontext = ocrdma_dealloc_ucontext,
 	.dereg_mr = ocrdma_dereg_mr,
@@ -205,12 +206,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
 	memcpy(dev->ibdev.node_desc, 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.phys_port_cnt = 1;
 	dev->ibdev.num_comp_vectors = dev->eq_cnt;
diff --git a/drivers/infiniband/sw/rdmavt/ah.c b/drivers/infiniband/sw/rdmavt/ah.c
index b938c4ffa99aa3..f9754dcd250b77 100644
--- a/drivers/infiniband/sw/rdmavt/ah.c
+++ b/drivers/infiniband/sw/rdmavt/ah.c
@@ -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
  * @ibah: address handle
  * @destroy_flags: destroy address handle flags (see enum rdma_destroy_ah_flags)
- *
  * Return: 0 on success
  */
 int rvt_destroy_ah(struct ib_ah *ibah, u32 destroy_flags)
diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c
index a0cb567cfc512b..3119540f906530 100644
--- a/drivers/infiniband/sw/rdmavt/vt.c
+++ b/drivers/infiniband/sw/rdmavt/vt.c
@@ -386,6 +386,7 @@ static const struct ib_device_ops rvt_dev_ops = {
 	.create_cq = rvt_create_cq,
 	.create_qp = rvt_create_qp,
 	.create_srq = rvt_create_srq,
+	.create_user_ah = rvt_create_ah,
 	.dealloc_pd = rvt_dealloc_pd,
 	.dealloc_ucontext = rvt_dealloc_ucontext,
 	.dereg_mr = rvt_dereg_mr,
@@ -594,10 +595,6 @@ int rvt_register_device(struct rvt_dev_info *rdi)
 	 * version, so we do all of this sort of stuff here.
 	 */
 	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_REQ_NOTIFY_CQ)       |
 		(1ull << IB_USER_VERBS_CMD_POST_SEND)           |
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 12dfaab1549f1e..bae8931424c3db 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -1079,6 +1079,7 @@ static const struct ib_device_ops rxe_dev_ops = {
 	.create_cq = rxe_create_cq,
 	.create_qp = rxe_create_qp,
 	.create_srq = rxe_create_srq,
+	.create_user_ah = rxe_create_ah,
 	.dealloc_driver = rxe_dealloc,
 	.dealloc_pd = rxe_dealloc_pd,
 	.dealloc_ucontext = rxe_dealloc_ucontext,
@@ -1144,13 +1145,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name)
 	dma_coerce_mask_and_coherent(&dev->dev,
 				     dma_get_required_mask(&dev->dev));
 
-	dev->uverbs_cmd_mask |=
-	    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)
-	    ;
+	dev->uverbs_cmd_mask |= BIT_ULL(IB_USER_VERBS_CMD_REQ_NOTIFY_CQ);
 
 	ib_set_device_ops(dev, &rxe_dev_ops);
 	err = ib_device_set_netdev(&rxe->ib_dev, rxe->ndev, 1);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 437508290bc9bf..6c52eac6293c5f 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2403,6 +2403,8 @@ struct ib_device_ops {
 	int (*dealloc_pd)(struct ib_pd *pd, struct ib_udata *udata);
 	int (*create_ah)(struct ib_ah *ah, struct rdma_ah_init_attr *attr,
 			 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 (*query_ah)(struct ib_ah *ah, struct rdma_ah_attr *ah_attr);
 	int (*destroy_ah)(struct ib_ah *ah, u32 flags);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 06/11] RDMA: Check attr_mask during modify_qp
  2020-10-03 23:20 ` [PATCH 06/11] RDMA: Check attr_mask during modify_qp Jason Gunthorpe
@ 2020-10-04 11:02   ` Gal Pressman
  2020-10-05 16:19     ` Jason Gunthorpe
  0 siblings, 1 reply; 25+ messages in thread
From: Gal Pressman @ 2020-10-04 11:02 UTC (permalink / raw)
  To: Jason Gunthorpe, Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dennis Dalessandro,
	Devesh Sharma, Doug Ledford, Faisal Latif, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Mike Marciniszyn,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Shiraz Saleem, Yossi Leybovich, Somnath Kotur,
	Sriharsha Basavapatna, Zhu Yanjun, Yishai Hadas

On 04/10/2020 2:20, Jason Gunthorpe wrote:
> diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
> index 191e0843f090c8..e3d9a5a5f4d992 100644
> --- a/drivers/infiniband/hw/efa/efa_verbs.c
> +++ b/drivers/infiniband/hw/efa/efa_verbs.c
> @@ -917,6 +917,9 @@ int efa_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
>  	enum ib_qp_state new_state;
>  	int err;
>  
> +	if (qp_attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
> +		return -EOPNOTSUPP;

This is kinda redundant, we have a more strict check in efa_modify_qp_validate.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 02/11] RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions
  2020-10-03 23:20 ` [PATCH 02/11] RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions Jason Gunthorpe
@ 2020-10-04 11:04   ` Gal Pressman
  2020-10-05 16:20     ` Jason Gunthorpe
  0 siblings, 1 reply; 25+ messages in thread
From: Gal Pressman @ 2020-10-04 11:04 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford, Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Lijun Ou, Bob Pearson,
	Yossi Leybovich, Yishai Hadas

On 04/10/2020 2:20, Jason Gunthorpe wrote:
> diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> index 418d133a8fb080..2f3f9b87922e92 100644
> --- a/drivers/infiniband/core/uverbs_cmd.c
> +++ b/drivers/infiniband/core/uverbs_cmd.c
> @@ -3753,7 +3753,7 @@ const struct uapi_definition uverbs_def_write_intf[] = {
>  			IB_USER_VERBS_EX_CMD_MODIFY_CQ,
>  			ib_uverbs_ex_modify_cq,
>  			UAPI_DEF_WRITE_I(struct ib_uverbs_ex_modify_cq),
> -			UAPI_DEF_METHOD_NEEDS_FN(create_cq))),
> +			UAPI_DEF_METHOD_NEEDS_FN(modify_cq))),

Good catch, but is it related to this patch?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/11] RDMA/cxgb4: Remove MW support
  2020-10-03 23:20 ` [PATCH 01/11] RDMA/cxgb4: Remove MW support Jason Gunthorpe
@ 2020-10-05  5:56   ` Leon Romanovsky
  2020-10-05 16:17     ` Jason Gunthorpe
  0 siblings, 1 reply; 25+ messages in thread
From: Leon Romanovsky @ 2020-10-05  5:56 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Potnuri Bharat Teja, linux-rdma, Bob Pearson

On Sat, Oct 03, 2020 at 08:20:01PM -0300, Jason Gunthorpe wrote:
> This driver never enabled IB_USER_VERBS_CMD_ALLOC_MW so memory windows
> were not usable from userspace. The kernel side was removed long ago. Drop
> this dead code.
>
> Fixes: feb7c1e38bcc ("IB: remove in-kernel support for memory windows")
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/infiniband/hw/cxgb4/iw_cxgb4.h |  2 -
>  drivers/infiniband/hw/cxgb4/mem.c      | 84 --------------------------
>  drivers/infiniband/hw/cxgb4/provider.c |  2 -
>  3 files changed, 88 deletions(-)
>
> diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
> index a27899402f59a5..f85477f3b037d2 100644
> --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
> +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
> @@ -983,9 +983,7 @@ struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
>  			    u32 max_num_sg);
>  int c4iw_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,
>  		   unsigned int *sg_offset);
> -int c4iw_dealloc_mw(struct ib_mw *mw);
>  void c4iw_dealloc(struct uld_ctx *ctx);
> -int c4iw_alloc_mw(struct ib_mw *mw, struct ib_udata *udata);
>  struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start,
>  					   u64 length, u64 virt, int acc,
>  					   struct ib_udata *udata);
> diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
> index 42234df896fb2c..a2c71a1d93d5a8 100644
> --- a/drivers/infiniband/hw/cxgb4/mem.c
> +++ b/drivers/infiniband/hw/cxgb4/mem.c
> @@ -365,22 +365,6 @@ static int dereg_mem(struct c4iw_rdev *rdev, u32 stag, u32 pbl_size,
>  			       pbl_size, pbl_addr, skb, wr_waitp);
>  }
>
> -static int allocate_window(struct c4iw_rdev *rdev, u32 *stag, u32 pdid,
> -			   struct c4iw_wr_wait *wr_waitp)
> -{
> -	*stag = T4_STAG_UNSET;
> -	return write_tpt_entry(rdev, 0, stag, 0, pdid, FW_RI_STAG_MW, 0, 0, 0,
> -			       0UL, 0, 0, 0, 0, NULL, wr_waitp);
> -}
> -
> -static int deallocate_window(struct c4iw_rdev *rdev, u32 stag,
> -			     struct sk_buff *skb,
> -			     struct c4iw_wr_wait *wr_waitp)
> -{
> -	return write_tpt_entry(rdev, 1, &stag, 0, 0, 0, 0, 0, 0, 0UL, 0, 0, 0,
> -			       0, skb, wr_waitp);
> -}
> -
>  static int allocate_stag(struct c4iw_rdev *rdev, u32 *stag, u32 pdid,
>  			 u32 pbl_size, u32 pbl_addr,
>  			 struct c4iw_wr_wait *wr_waitp)
> @@ -611,74 +595,6 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
>  	return ERR_PTR(err);
>  }
>
> -int c4iw_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata)
> -{
> -	struct c4iw_mw *mhp = to_c4iw_mw(ibmw);
> -	struct c4iw_dev *rhp;
> -	struct c4iw_pd *php;
> -	u32 mmid;
> -	u32 stag = 0;
> -	int ret;
> -
> -	if (ibmw->type != IB_MW_TYPE_1)
> -		return -EINVAL;
> -
> -	php = to_c4iw_pd(ibmw->pd);
> -	rhp = php->rhp;
> -	mhp->wr_waitp = c4iw_alloc_wr_wait(GFP_KERNEL);
> -	if (!mhp->wr_waitp)
> -		return -ENOMEM;
> -
> -	mhp->dereg_skb = alloc_skb(SGE_MAX_WR_LEN, GFP_KERNEL);
> -	if (!mhp->dereg_skb) {
> -		ret = -ENOMEM;
> -		goto free_wr_wait;
> -	}
> -
> -	ret = allocate_window(&rhp->rdev, &stag, php->pdid, mhp->wr_waitp);
> -	if (ret)
> -		goto free_skb;
> -
> -	mhp->rhp = rhp;
> -	mhp->attr.pdid = php->pdid;
> -	mhp->attr.type = FW_RI_STAG_MW;

75% of "enum fw_ri_stag_type" can be removed too.

Thanks

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/11] RDMA/cxgb4: Remove MW support
  2020-10-05  5:56   ` Leon Romanovsky
@ 2020-10-05 16:17     ` Jason Gunthorpe
  2020-10-09 16:40       ` Potnuri Bharat Teja
  0 siblings, 1 reply; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-05 16:17 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Potnuri Bharat Teja, linux-rdma, Bob Pearson

On Mon, Oct 05, 2020 at 08:56:52AM +0300, Leon Romanovsky wrote:

> > -	mhp->rhp = rhp;
> > -	mhp->attr.pdid = php->pdid;
> > -	mhp->attr.type = FW_RI_STAG_MW;
> 
> 75% of "enum fw_ri_stag_type" can be removed too.

I think that is the code-gen'd HW API for this driver, I don't mind
leaving it. It seems the HW supports MW, just nobody plumbed it
through to rdma-core

Jason

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 06/11] RDMA: Check attr_mask during modify_qp
  2020-10-04 11:02   ` Gal Pressman
@ 2020-10-05 16:19     ` Jason Gunthorpe
  0 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-05 16:19 UTC (permalink / raw)
  To: Gal Pressman
  Cc: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dennis Dalessandro,
	Devesh Sharma, Doug Ledford, Faisal Latif, Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Mike Marciniszyn,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Shiraz Saleem, Yossi Leybovich, Somnath Kotur,
	Sriharsha Basavapatna, Zhu Yanjun, Yishai Hadas

On Sun, Oct 04, 2020 at 02:02:52PM +0300, Gal Pressman wrote:
> On 04/10/2020 2:20, Jason Gunthorpe wrote:
> > diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
> > index 191e0843f090c8..e3d9a5a5f4d992 100644
> > +++ b/drivers/infiniband/hw/efa/efa_verbs.c
> > @@ -917,6 +917,9 @@ int efa_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
> >  	enum ib_qp_state new_state;
> >  	int err;
> >  
> > +	if (qp_attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
> > +		return -EOPNOTSUPP;
> 
> This is kinda redundant, we have a more strict check in efa_modify_qp_validate.

Okay

Thanks,
Jason

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 02/11] RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions
  2020-10-04 11:04   ` Gal Pressman
@ 2020-10-05 16:20     ` Jason Gunthorpe
  0 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-05 16:20 UTC (permalink / raw)
  To: Gal Pressman
  Cc: Doug Ledford, Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Lijun Ou, Bob Pearson,
	Yossi Leybovich, Yishai Hadas

On Sun, Oct 04, 2020 at 02:04:17PM +0300, Gal Pressman wrote:
> On 04/10/2020 2:20, Jason Gunthorpe wrote:
> > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> > index 418d133a8fb080..2f3f9b87922e92 100644
> > +++ b/drivers/infiniband/core/uverbs_cmd.c
> > @@ -3753,7 +3753,7 @@ const struct uapi_definition uverbs_def_write_intf[] = {
> >  			IB_USER_VERBS_EX_CMD_MODIFY_CQ,
> >  			ib_uverbs_ex_modify_cq,
> >  			UAPI_DEF_WRITE_I(struct ib_uverbs_ex_modify_cq),
> > -			UAPI_DEF_METHOD_NEEDS_FN(create_cq))),
> > +			UAPI_DEF_METHOD_NEEDS_FN(modify_cq))),
> 
> Good catch, but is it related to this patch?

Yes, previously the uverbs_ex_cmd_mask of
IB_USER_VERBS_EX_CMD_MODIFY_CQ prevented this typo from mattering as
no driver set both the bit and a null ops.

This patch has drivers setting null ops with the bit set, so it must
be fixed now.

Jason

^ permalink raw reply	[flat|nested] 25+ messages in thread

* RE: [PATCH 07/11] RDMA: Check flags during create_cq
  2020-10-03 23:20 ` [PATCH 07/11] RDMA: Check flags during create_cq Jason Gunthorpe
@ 2020-10-06 18:04   ` Saleem, Shiraz
  2020-10-06 18:13     ` Jason Gunthorpe
  0 siblings, 1 reply; 25+ messages in thread
From: Saleem, Shiraz @ 2020-10-06 18:04 UTC (permalink / raw)
  To: Jason Gunthorpe, Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dalessandro, Dennis,
	Devesh Sharma, Doug Ledford, Latif, Faisal, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Marciniszyn, Mike,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Yossi Leybovich, Somnath Kotur, Sriharsha Basavapatna,
	Zhu Yanjun, Yishai Hadas

> Subject: [PATCH 07/11] RDMA: Check flags during create_cq
> 
> Each driver should check that the CQ attrs is supported. Unfortuantely when flags
> was added to the CQ attrs the drivers were not updated, uverbs_ex_cmd_mask
> was used to block it. This was missed when create CQ was converted to ioctl, so
> non-zero flags could have been passed into drivers.
> 
> Check that flags is zero in all drivers that don't use it, remove
> IB_USER_VERBS_EX_CMD_CREATE_CQ from uverbs_ex_cmd_mask.
> 
> Fixes: 41b2a71fc848 ("IB/uverbs: Move ioctl path of create_cq and destroy_cq to
> a new file")
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  drivers/infiniband/core/device.c             | 1 +
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c     | 3 +++
>  drivers/infiniband/hw/cxgb4/cq.c             | 2 +-
>  drivers/infiniband/hw/efa/efa_verbs.c        | 3 +++
>  drivers/infiniband/hw/hns/hns_roce_cq.c      | 3 +++
>  drivers/infiniband/hw/i40iw/i40iw_verbs.c    | 3 +++
>  drivers/infiniband/hw/mlx4/main.c            | 1 -
>  drivers/infiniband/hw/mlx5/main.c            | 1 -
>  drivers/infiniband/hw/mthca/mthca_provider.c | 2 +-
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  | 2 +-
>  drivers/infiniband/hw/qedr/verbs.c           | 3 +++
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 2 +-
> drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c | 3 +++
>  drivers/infiniband/sw/rdmavt/cq.c            | 2 +-
>  drivers/infiniband/sw/rxe/rxe_verbs.c        | 2 +-
>  drivers/infiniband/sw/siw/siw_verbs.c        | 3 +++
>  16 files changed, 28 insertions(+), 8 deletions(-)
> 

[...]

> a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> index 26a61af2d3977f..4aade66ad2aea8 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> @@ -1107,6 +1107,9 @@ static int i40iw_create_cq(struct ib_cq *ibcq,
>  	int err_code;
>  	int entries = attr->cqe;
> 
> +	if (attr->flags)
> +		return -EOPNOTSUPP;
> +

I am slightly confused.
So these flags are set for drivers that support the extended create CQ API?

Shiraz

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 07/11] RDMA: Check flags during create_cq
  2020-10-06 18:04   ` Saleem, Shiraz
@ 2020-10-06 18:13     ` Jason Gunthorpe
  2020-10-06 18:23       ` Saleem, Shiraz
  0 siblings, 1 reply; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-06 18:13 UTC (permalink / raw)
  To: Saleem, Shiraz
  Cc: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dalessandro, Dennis,
	Devesh Sharma, Doug Ledford, Latif, Faisal, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Marciniszyn, Mike,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Yossi Leybovich, Somnath Kotur, Sriharsha Basavapatna,
	Zhu Yanjun, Yishai Hadas

On Tue, Oct 06, 2020 at 06:04:29PM +0000, Saleem, Shiraz wrote:
> > a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> > b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> > index 26a61af2d3977f..4aade66ad2aea8 100644
> > +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> > @@ -1107,6 +1107,9 @@ static int i40iw_create_cq(struct ib_cq *ibcq,
> >  	int err_code;
> >  	int entries = attr->cqe;
> > 
> > +	if (attr->flags)
> > +		return -EOPNOTSUPP;
> > +
> 
> I am slightly confused.
> So these flags are set for drivers that support the extended create CQ API?

No, the flags can be set by any user or kernel program creating a
CQ. The driver must ensure it supports all requested flags.

Omitting the flags check was always a mistake because an in-kernel ULP
could attempt to use them - luckily none due today.

Jason

^ permalink raw reply	[flat|nested] 25+ messages in thread

* RE: [PATCH 07/11] RDMA: Check flags during create_cq
  2020-10-06 18:13     ` Jason Gunthorpe
@ 2020-10-06 18:23       ` Saleem, Shiraz
  0 siblings, 0 replies; 25+ messages in thread
From: Saleem, Shiraz @ 2020-10-06 18:23 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dalessandro, Dennis,
	Devesh Sharma, Doug Ledford, Latif, Faisal, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Marciniszyn, Mike,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Yossi Leybovich, Somnath Kotur, Sriharsha Basavapatna,
	Zhu Yanjun, Yishai Hadas

> Subject: Re: [PATCH 07/11] RDMA: Check flags during create_cq
> 
> On Tue, Oct 06, 2020 at 06:04:29PM +0000, Saleem, Shiraz wrote:
> > > a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> > > b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> > > index 26a61af2d3977f..4aade66ad2aea8 100644
> > > +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> > > @@ -1107,6 +1107,9 @@ static int i40iw_create_cq(struct ib_cq *ibcq,
> > >  	int err_code;
> > >  	int entries = attr->cqe;
> > >
> > > +	if (attr->flags)
> > > +		return -EOPNOTSUPP;
> > > +
> >
> > I am slightly confused.
> > So these flags are set for drivers that support the extended create CQ API?
> 
> No, the flags can be set by any user or kernel program creating a CQ. The driver
> must ensure it supports all requested flags.
> 
> Omitting the flags check was always a mistake because an in-kernel ULP could
> attempt to use them - luckily none due today.
> 
OK. Makes sense now. Thanks!

^ permalink raw reply	[flat|nested] 25+ messages in thread

* RE: [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (10 preceding siblings ...)
  2020-10-03 23:20 ` [PATCH 11/11] RDMA: Remove AH from uverbs_cmd_mask Jason Gunthorpe
@ 2020-10-06 18:32 ` Saleem, Shiraz
  2020-10-26 22:39 ` Jason Gunthorpe
  12 siblings, 0 replies; 25+ messages in thread
From: Saleem, Shiraz @ 2020-10-06 18:32 UTC (permalink / raw)
  To: Jason Gunthorpe, Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dalessandro, Dennis,
	Devesh Sharma, Doug Ledford, Latif, Faisal, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Marciniszyn, Mike,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Yossi Leybovich, Somnath Kotur, Sriharsha Basavapatna,
	Zhu Yanjun, Yishai Hadas

> Subject: [PATCH 00/11] Reduce uverbs_cmd_mask and remove
> uverbs_ex_cmd_mask
> 
> These have become increasingly redundant as the uverbs core layer has got better
> at not invoking drivers in situations they are not supporting.
> 
> The remaining uses are only in rxe and rvt for kernel datapath commands these
> drivers expose to userspace.
> 
> There are many, many weird and wrong things in the drivers related to these
> masks. This closes a number of troublesome cases.
> 
> Jason Gunthorpe (11):
>   RDMA/cxgb4: Remove MW support
>   RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions
>   RDMA: Remove elements in uverbs_cmd_mask that all drivers set
>   RDMA: Move more uverbs_cmd_mask settings to the core
>   RDMA: Check srq_type during create_srq
>   RDMA: Check attr_mask during modify_qp
>   RDMA: Check flags during create_cq
>   RDMA: Check create_flags during create_qp
>   RDMA/core Remove uverbs_ex_cmd_mask
>   RDMA: Remove uverbs cmds from drivers that don't use them
>   RDMA: Remove AH from uverbs_cmd_mask
> 
>  drivers/infiniband/core/device.c              | 33 ++++++++
>  drivers/infiniband/core/uverbs_cmd.c          | 26 +++---
>  drivers/infiniband/core/uverbs_uapi.c         |  5 +-
>  drivers/infiniband/core/verbs.c               |  5 +-
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c      | 10 ++-
>  drivers/infiniband/hw/bnxt_re/main.c          | 30 +------
>  drivers/infiniband/hw/cxgb4/cq.c              |  2 +-
>  drivers/infiniband/hw/cxgb4/iw_cxgb4.h        |  2 -
>  drivers/infiniband/hw/cxgb4/mem.c             | 84 -------------------
>  drivers/infiniband/hw/cxgb4/provider.c        | 24 ------
>  drivers/infiniband/hw/cxgb4/qp.c              |  8 +-
>  drivers/infiniband/hw/efa/efa_main.c          | 22 +----
>  drivers/infiniband/hw/efa/efa_verbs.c         |  6 ++
>  drivers/infiniband/hw/hns/hns_roce_cq.c       |  3 +
>  drivers/infiniband/hw/hns/hns_roce_hw_v1.c    |  9 +-
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c    |  3 +
>  drivers/infiniband/hw/hns/hns_roce_main.c     | 35 +-------
>  drivers/infiniband/hw/hns/hns_roce_qp.c       | 14 +---
>  drivers/infiniband/hw/hns/hns_roce_srq.c      |  4 +
>  drivers/infiniband/hw/i40iw/i40iw_verbs.c     | 29 ++-----

i40iw bit looks ok to me.
Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/11] RDMA/cxgb4: Remove MW support
  2020-10-05 16:17     ` Jason Gunthorpe
@ 2020-10-09 16:40       ` Potnuri Bharat Teja
  2020-10-14 23:27         ` Jason Gunthorpe
  0 siblings, 1 reply; 25+ messages in thread
From: Potnuri Bharat Teja @ 2020-10-09 16:40 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: Leon Romanovsky, linux-rdma, Bob Pearson

On Monday, October 10/05/20, 2020 at 21:47:26 +0530, Jason Gunthorpe wrote:
> On Mon, Oct 05, 2020 at 08:56:52AM +0300, Leon Romanovsky wrote:
> 
> > > -	mhp->rhp = rhp;
> > > -	mhp->attr.pdid = php->pdid;
> > > -	mhp->attr.type = FW_RI_STAG_MW;
> > 
> > 75% of "enum fw_ri_stag_type" can be removed too.
> 
> I think that is the code-gen'd HW API for this driver, I don't mind
> leaving it. It seems the HW supports MW, just nobody plumbed it
> through to rdma-core
> 
Hi Jason,
Agreed its dead code as is but Chelsio HW suports MW and we are yet to decide on
requirements, we may probably add userspace support for MW in future.

Thanks,
Bharat

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/11] RDMA/cxgb4: Remove MW support
  2020-10-09 16:40       ` Potnuri Bharat Teja
@ 2020-10-14 23:27         ` Jason Gunthorpe
  0 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-14 23:27 UTC (permalink / raw)
  To: Potnuri Bharat Teja; +Cc: Leon Romanovsky, linux-rdma, Bob Pearson

On Fri, Oct 09, 2020 at 10:10:06PM +0530, Potnuri Bharat Teja wrote:
> On Monday, October 10/05/20, 2020 at 21:47:26 +0530, Jason Gunthorpe wrote:
> > On Mon, Oct 05, 2020 at 08:56:52AM +0300, Leon Romanovsky wrote:
> > 
> > > > -	mhp->rhp = rhp;
> > > > -	mhp->attr.pdid = php->pdid;
> > > > -	mhp->attr.type = FW_RI_STAG_MW;
> > > 
> > > 75% of "enum fw_ri_stag_type" can be removed too.
> > 
> > I think that is the code-gen'd HW API for this driver, I don't mind
> > leaving it. It seems the HW supports MW, just nobody plumbed it
> > through to rdma-core
> > 
> Hi Jason,
> Agreed its dead code as is but Chelsio HW suports MW and we are yet to decide on
> requirements, we may probably add userspace support for MW in future.

You can't add userspace support without modifying the kernel since the
ucmd_mask was never, set. So when/if you get everything working send a
kernel series bringing these functions back.

Jason

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask
  2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
                   ` (11 preceding siblings ...)
  2020-10-06 18:32 ` [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Saleem, Shiraz
@ 2020-10-26 22:39 ` Jason Gunthorpe
  12 siblings, 0 replies; 25+ messages in thread
From: Jason Gunthorpe @ 2020-10-26 22:39 UTC (permalink / raw)
  To: Adit Ranadive, Ariel Elior, Christian Benvenuti,
	Potnuri Bharat Teja, Bernard Metzler, Dennis Dalessandro,
	Devesh Sharma, Doug Ledford, Faisal Latif, Gal Pressman,
	Wei Hu(Xavier),
	Leon Romanovsky, linux-rdma, Weihang Li, Mike Marciniszyn,
	Michal Kalderon, Naresh Kumar PBS, Nelson Escobar, Lijun Ou,
	Parvi Kaustubhi, VMware PV-Drivers, Bob Pearson, Selvin Xavier,
	Shiraz Saleem, Yossi Leybovich, Somnath Kotur,
	Sriharsha Basavapatna, Zhu Yanjun, Yishai Hadas

On Sat, Oct 03, 2020 at 08:20:00PM -0300, Jason Gunthorpe wrote:
> These have become increasingly redundant as the uverbs core layer has got
> better at not invoking drivers in situations they are not supporting.
> 
> The remaining uses are only in rxe and rvt for kernel datapath commands
> these drivers expose to userspace.
> 
> There are many, many weird and wrong things in the drivers related to
> these masks. This closes a number of troublesome cases.
> 
> Jason Gunthorpe (11):
>   RDMA/cxgb4: Remove MW support
>   RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions
>   RDMA: Remove elements in uverbs_cmd_mask that all drivers set
>   RDMA: Move more uverbs_cmd_mask settings to the core
>   RDMA: Check srq_type during create_srq
>   RDMA: Check attr_mask during modify_qp
>   RDMA: Check flags during create_cq
>   RDMA: Check create_flags during create_qp
>   RDMA/core Remove uverbs_ex_cmd_mask
>   RDMA: Remove uverbs cmds from drivers that don't use them
>   RDMA: Remove AH from uverbs_cmd_mask

Applied to for-next

Jason

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2020-10-26 22:40 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-03 23:20 [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 01/11] RDMA/cxgb4: Remove MW support Jason Gunthorpe
2020-10-05  5:56   ` Leon Romanovsky
2020-10-05 16:17     ` Jason Gunthorpe
2020-10-09 16:40       ` Potnuri Bharat Teja
2020-10-14 23:27         ` Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 02/11] RDMA: Remove uverbs_ex_cmd_mask values that are linked to functions Jason Gunthorpe
2020-10-04 11:04   ` Gal Pressman
2020-10-05 16:20     ` Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 03/11] RDMA: Remove elements in uverbs_cmd_mask that all drivers set Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 04/11] RDMA: Move more uverbs_cmd_mask settings to the core Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 05/11] RDMA: Check srq_type during create_srq Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 06/11] RDMA: Check attr_mask during modify_qp Jason Gunthorpe
2020-10-04 11:02   ` Gal Pressman
2020-10-05 16:19     ` Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 07/11] RDMA: Check flags during create_cq Jason Gunthorpe
2020-10-06 18:04   ` Saleem, Shiraz
2020-10-06 18:13     ` Jason Gunthorpe
2020-10-06 18:23       ` Saleem, Shiraz
2020-10-03 23:20 ` [PATCH 08/11] RDMA: Check create_flags during create_qp Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 09/11] RDMA/core Remove uverbs_ex_cmd_mask Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 10/11] RDMA: Remove uverbs cmds from drivers that don't use them Jason Gunthorpe
2020-10-03 23:20 ` [PATCH 11/11] RDMA: Remove AH from uverbs_cmd_mask Jason Gunthorpe
2020-10-06 18:32 ` [PATCH 00/11] Reduce uverbs_cmd_mask and remove uverbs_ex_cmd_mask Saleem, Shiraz
2020-10-26 22:39 ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.