[openib-general] [PATCH 1/4] ipath mmaped CQs, QPs, SRQs

Ralph Campbell ralphc at pathscale.com
Mon Jun 19 16:37:30 PDT 2006


Here is a set of patches which adds mmapped completion queues and
receive queues for the InfiniPath HCA.  This required changing
some of the core code in order to return HW specific data for
the ibv_resize_cq(), ibv_modify_qp(), and ibv_modify_srq().
I have included the minimal changes to mthca and ehca to match
the function signature changes and incorporated Roland's review
comments on the earlier code posted.

The first patch contains the core changes,
the second contains mthca and ehca specific changes,
the third contains libipathverbs changes,
the fourth contains ib_ipath changes.

Signed-off-by: Ralph Campbell <ralph.campbell at qlogic.com>

Index: src/userspace/libibverbs/include/infiniband/driver.h
===================================================================
--- src/userspace/libibverbs/include/infiniband/driver.h	(revision 8021)
+++ src/userspace/libibverbs/include/infiniband/driver.h	(working copy)
@@ -95,7 +95,8 @@
 int ibv_cmd_poll_cq(struct ibv_cq *cq, int ne, struct ibv_wc *wc);
 int ibv_cmd_req_notify_cq(struct ibv_cq *cq, int solicited_only);
 int ibv_cmd_resize_cq(struct ibv_cq *cq, int cqe,
-		      struct ibv_resize_cq *cmd, size_t cmd_size);
+		      struct ibv_resize_cq *cmd, size_t cmd_size,
+		      struct ibv_resize_cq_resp *resp, size_t resp_size);
 int ibv_cmd_destroy_cq(struct ibv_cq *cq);
 
 int ibv_cmd_create_srq(struct ibv_pd *pd,
Index: src/userspace/libibverbs/include/infiniband/kern-abi.h
===================================================================
--- src/userspace/libibverbs/include/infiniband/kern-abi.h	(revision 8021)
+++ src/userspace/libibverbs/include/infiniband/kern-abi.h	(working copy)
@@ -355,6 +355,8 @@
 
 struct ibv_resize_cq_resp {
 	__u32 cqe;
+	__u32 reserved;
+	__u64 driver_data[0];
 };
 
 struct ibv_destroy_cq {
Index: src/userspace/libibverbs/src/cmd.c
===================================================================
--- src/userspace/libibverbs/src/cmd.c	(revision 8021)
+++ src/userspace/libibverbs/src/cmd.c	(working copy)
@@ -368,18 +368,18 @@
 }
 
 int ibv_cmd_resize_cq(struct ibv_cq *cq, int cqe,
-		      struct ibv_resize_cq *cmd, size_t cmd_size)
+		      struct ibv_resize_cq *cmd, size_t cmd_size,
+		      struct ibv_resize_cq_resp *resp, size_t resp_size)
 {
-	struct ibv_resize_cq_resp resp;
 
-	IBV_INIT_CMD_RESP(cmd, cmd_size, RESIZE_CQ, &resp, sizeof resp);
+	IBV_INIT_CMD_RESP(cmd, cmd_size, RESIZE_CQ, resp, resp_size);
 	cmd->cq_handle = cq->handle;
 	cmd->cqe       = cqe;
 
 	if (write(cq->context->cmd_fd, cmd, cmd_size) != cmd_size)
 		return errno;
 
-	cq->cqe = resp.cqe;
+	cq->cqe = resp->cqe;
 
 	return 0;
 }
Index: src/linux-kernel/infiniband/include/rdma/ib_user_verbs.h
===================================================================
--- src/linux-kernel/infiniband/include/rdma/ib_user_verbs.h	(revision 8021)
+++ src/linux-kernel/infiniband/include/rdma/ib_user_verbs.h	(working copy)
@@ -275,6 +275,8 @@
 
 struct ib_uverbs_resize_cq_resp {
 	__u32 cqe;
+	__u32 reserved;
+	__u64 driver_data[0];
 };
 
 struct ib_uverbs_poll_cq {
Index: src/linux-kernel/infiniband/include/rdma/ib_verbs.h
===================================================================
--- src/linux-kernel/infiniband/include/rdma/ib_verbs.h	(revision 8021)
+++ src/linux-kernel/infiniband/include/rdma/ib_verbs.h	(working copy)
@@ -911,7 +911,8 @@
 						 struct ib_udata *udata);
 	int                        (*modify_srq)(struct ib_srq *srq,
 						 struct ib_srq_attr *srq_attr,
-						 enum ib_srq_attr_mask srq_attr_mask);
+						 enum ib_srq_attr_mask srq_attr_mask,
+						 struct ib_udata *udata);
 	int                        (*query_srq)(struct ib_srq *srq,
 						struct ib_srq_attr *srq_attr);
 	int                        (*destroy_srq)(struct ib_srq *srq);
@@ -923,7 +924,8 @@
 						struct ib_udata *udata);
 	int                        (*modify_qp)(struct ib_qp *qp,
 						struct ib_qp_attr *qp_attr,
-						int qp_attr_mask);
+						int qp_attr_mask,
+						struct ib_udata *udata);
 	int                        (*query_qp)(struct ib_qp *qp,
 					       struct ib_qp_attr *qp_attr,
 					       int qp_attr_mask,
Index: src/linux-kernel/infiniband/core/verbs.c
===================================================================
--- src/linux-kernel/infiniband/core/verbs.c	(revision 8021)
+++ src/linux-kernel/infiniband/core/verbs.c	(working copy)
@@ -231,7 +231,7 @@
 		  struct ib_srq_attr *srq_attr,
 		  enum ib_srq_attr_mask srq_attr_mask)
 {
-	return srq->device->modify_srq(srq, srq_attr, srq_attr_mask);
+	return srq->device->modify_srq(srq, srq_attr, srq_attr_mask, NULL);
 }
 EXPORT_SYMBOL(ib_modify_srq);
 
@@ -547,7 +547,7 @@
 		 struct ib_qp_attr *qp_attr,
 		 int qp_attr_mask)
 {
-	return qp->device->modify_qp(qp, qp_attr, qp_attr_mask);
+	return qp->device->modify_qp(qp, qp_attr, qp_attr_mask, NULL);
 }
 EXPORT_SYMBOL(ib_modify_qp);
Index: src/linux-kernel/infiniband/core/uverbs_cmd.c
===================================================================
--- src/linux-kernel/infiniband/core/uverbs_cmd.c	(revision 8021)
+++ src/linux-kernel/infiniband/core/uverbs_cmd.c	(working copy)
@@ -1258,6 +1258,7 @@
 			    int out_len)
 {
 	struct ib_uverbs_modify_qp cmd;
+	struct ib_udata            udata;
 	struct ib_qp              *qp;
 	struct ib_qp_attr         *attr;
 	int                        ret;
@@ -1265,6 +1266,9 @@
 	if (copy_from_user(&cmd, buf, sizeof cmd))
 		return -EFAULT;
 
+	INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
+		   out_len);
+
 	attr = kmalloc(sizeof *attr, GFP_KERNEL);
 	if (!attr)
 		return -ENOMEM;
@@ -1321,7 +1325,7 @@
 	attr->alt_ah_attr.ah_flags 	    = cmd.alt_dest.is_global ? IB_AH_GRH : 0;
 	attr->alt_ah_attr.port_num 	    = cmd.alt_dest.port_num;
 
-	ret = ib_modify_qp(qp, attr, cmd.attr_mask);
+	ret = qp->device->modify_qp(qp, attr, cmd.attr_mask, &udata);
 
 	put_qp_read(qp);
 
@@ -1773,6 +1777,7 @@
 	}
 
 	ah->uobject = uobj;
+	uobj->object = ah;
 	ret = idr_add_uobj(&ib_uverbs_ah_idr, uobj);
 	if (ret)
 		goto err_destroy;
@@ -2031,6 +2036,7 @@
 			     int out_len)
 {
 	struct ib_uverbs_modify_srq cmd;
+	struct ib_udata             udata;
 	struct ib_srq              *srq;
 	struct ib_srq_attr          attr;
 	int                         ret;
@@ -2038,6 +2044,9 @@
 	if (copy_from_user(&cmd, buf, sizeof cmd))
 		return -EFAULT;
 
+	INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
+		   out_len);
+
 	srq = idr_read_srq(cmd.srq_handle, file->ucontext);
 	if (!srq)
 		return -EINVAL;
@@ -2045,7 +2054,7 @@
 	attr.max_wr    = cmd.max_wr;
 	attr.srq_limit = cmd.srq_limit;
 
-	ret = ib_modify_srq(srq, &attr, cmd.attr_mask);
+	ret = srq->device->modify_srq(srq, &attr, cmd.attr_mask, &udata);
 
 	put_srq_read(srq);
 

-- 
Ralph Campbell <ralphc at pathscale.com>





More information about the general mailing list