diff mbox series

[rdma-core,3/8] mlx4: Delete comp_mask from verbs_srq

Message ID 1588758069-24464-4-git-send-email-yishaih@mellanox.com (mailing list archive)
State Not Applicable
Headers show
Series verbs: Enable asynchronous event FD per object | expand

Commit Message

Yishai Hadas May 6, 2020, 9:41 a.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

This is a hold over from when the driver.h was not tied to the rdma-core
version, delete it.

The only reader in mlx4 was using it to tell if the SRQ was XRC or not,
just test that directly.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 libibverbs/cmd.c       | 13 +++----------
 libibverbs/driver.h    | 19 -------------------
 providers/mlx4/mlx4.c  |  2 +-
 providers/mlx4/mlx4.h  |  1 +
 providers/mlx4/verbs.c | 11 +++++++++++
 5 files changed, 16 insertions(+), 30 deletions(-)
diff mbox series

Patch

diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
index 728d884..03d9143 100644
--- a/libibverbs/cmd.c
+++ b/libibverbs/cmd.c
@@ -577,21 +577,14 @@  int ibv_cmd_create_srq_ex(struct ibv_context *context,
 	 * If it is than all the others exist as well
 	 */
 	if (vext_field_avail(struct verbs_srq, srq_num, vsrq_sz)) {
-		srq->comp_mask = IBV_SRQ_INIT_ATTR_TYPE;
 		srq->srq_type = (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_TYPE) ?
 				attr_ex->srq_type : IBV_SRQT_BASIC;
-		if (srq->srq_type == IBV_SRQT_XRC) {
-			srq->comp_mask |= VERBS_SRQ_NUM;
+		if (srq->srq_type == IBV_SRQT_XRC)
 			srq->srq_num = resp->srqn;
-		}
-		if (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_XRCD) {
-			srq->comp_mask |= VERBS_SRQ_XRCD;
+		if (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_XRCD)
 			srq->xrcd = vxrcd;
-		}
-		if (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_CQ) {
-			srq->comp_mask |= VERBS_SRQ_CQ;
+		if (attr_ex->comp_mask & IBV_SRQ_INIT_ATTR_CQ)
 			srq->cq = attr_ex->cq;
-		}
 	}
 
 	attr_ex->attr.max_wr = resp->max_wr;
diff --git a/libibverbs/driver.h b/libibverbs/driver.h
index a0e6f89..9cb78a5 100644
--- a/libibverbs/driver.h
+++ b/libibverbs/driver.h
@@ -59,17 +59,8 @@  struct verbs_xrcd {
 	uint32_t		handle;
 };
 
-enum verbs_srq_mask {
-	VERBS_SRQ_TYPE		= 1 << 0,
-	VERBS_SRQ_XRCD		= 1 << 1,
-	VERBS_SRQ_CQ		= 1 << 2,
-	VERBS_SRQ_NUM		= 1 << 3,
-	VERBS_SRQ_RESERVED	= 1 << 4
-};
-
 struct verbs_srq {
 	struct ibv_srq		srq;
-	uint32_t		comp_mask;
 	enum ibv_srq_type	srq_type;
 	struct verbs_xrcd      *xrcd;
 	struct ibv_cq	       *cq;
@@ -633,16 +624,6 @@  int ibv_read_ibdev_sysfs_file(char *buf, size_t size,
 	__attribute__((format(printf, 4, 5)));
 int ibv_get_fw_ver(char *value, size_t len, struct verbs_sysfs_dev *sysfs_dev);
 
-static inline int verbs_get_srq_num(struct ibv_srq *srq, uint32_t *srq_num)
-{
-	struct verbs_srq *vsrq = container_of(srq, struct verbs_srq, srq);
-	if (vsrq->comp_mask & VERBS_SRQ_NUM) {
-		*srq_num = vsrq->srq_num;
-		return 0;
-	}
-	return EOPNOTSUPP;
-}
-
 static inline bool check_comp_mask(uint64_t input, uint64_t supported)
 {
 	return (input & ~supported) == 0;
diff --git a/providers/mlx4/mlx4.c b/providers/mlx4/mlx4.c
index 0842ff0..f04d346 100644
--- a/providers/mlx4/mlx4.c
+++ b/providers/mlx4/mlx4.c
@@ -126,7 +126,7 @@  static const struct verbs_context_ops mlx4_ctx_ops = {
 	.destroy_flow = mlx4_destroy_flow,
 	.destroy_rwq_ind_table = mlx4_destroy_rwq_ind_table,
 	.destroy_wq = mlx4_destroy_wq,
-	.get_srq_num = verbs_get_srq_num,
+	.get_srq_num = mlx4_get_srq_num,
 	.modify_cq = mlx4_modify_cq,
 	.modify_wq = mlx4_modify_wq,
 	.open_qp = mlx4_open_qp,
diff --git a/providers/mlx4/mlx4.h b/providers/mlx4/mlx4.h
index 3c161e8..16ed7d6 100644
--- a/providers/mlx4/mlx4.h
+++ b/providers/mlx4/mlx4.h
@@ -319,6 +319,7 @@  int mlx4_free_pd(struct ibv_pd *pd);
 struct ibv_xrcd *mlx4_open_xrcd(struct ibv_context *context,
 				struct ibv_xrcd_init_attr *attr);
 int mlx4_close_xrcd(struct ibv_xrcd *xrcd);
+int mlx4_get_srq_num(struct ibv_srq *srq, uint32_t *srq_num);
 
 struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
 			   uint64_t hca_va, int access);
diff --git a/providers/mlx4/verbs.c b/providers/mlx4/verbs.c
index 9f39ecd..010cd6c 100644
--- a/providers/mlx4/verbs.c
+++ b/providers/mlx4/verbs.c
@@ -274,6 +274,17 @@  int mlx4_close_xrcd(struct ibv_xrcd *ib_xrcd)
 	return 0;
 }
 
+int mlx4_get_srq_num(struct ibv_srq *srq, uint32_t *srq_num)
+{
+	struct mlx4_srq *msrq =
+		container_of(srq, struct mlx4_srq, verbs_srq.srq);
+
+	if (!msrq->verbs_srq.xrcd)
+		return EOPNOTSUPP;
+	*srq_num = msrq->verbs_srq.srq_num;
+	return 0;
+}
+
 struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
 			   uint64_t hca_va, int access)
 {