Bottom: 43e1e5eb917de0dfa94871196e9df5d34951d652
-Top: 4a3eb780fa1fd1bd833f6f5172d77115ddcd3f00
+Top: 03993c9af52032749622b0ff5124f0e5a6babd9c
Author: Sean Hefty <sean.hefty@intel.com>
Date: 2012-09-19 09:19:59 -0700
---
diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h
-index 97557b5..2b928c2 100644
+index 97557b5..fe77ac4 100644
--- a/include/infiniband/driver.h
+++ b/include/infiniband/driver.h
@@ -164,6 +164,10 @@ int ibv_cmd_create_qp_ex(struct verbs_context *context,
struct verbs_qp *qp, struct ibv_qp_init_attr_ex *attr_ex,
struct ibv_create_qp *cmd, size_t cmd_size,
struct ibv_create_qp_resp *resp, size_t resp_size);
-+int ibv_cmd_open_qp(struct verbs_xrcd *xrcd,
++int ibv_cmd_open_qp(struct verbs_context *context,
+ struct verbs_qp *qp, struct ibv_qp_open_attr *attr,
+ struct ibv_open_qp *cmd, size_t cmd_size,
+ struct ibv_create_qp_resp *resp, size_t resp_size);
struct ibv_destroy_cq_v1 {
diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
-index 56c5db0..1f3f806 100644
+index 56c5db0..a91662c 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
-@@ -486,6 +486,20 @@ struct ibv_qp_init_attr_ex {
+@@ -486,6 +486,22 @@ struct ibv_qp_init_attr_ex {
struct ibv_xrcd *xrcd;
};
+enum ibv_qp_open_attr_mask {
-+ IBV_QP_OPEN_ATTR_CONTEXT = 1 << 0,
-+ IBV_QP_OPEN_ATTR_NUM = 1 << 1,
-+ IBV_QP_OPEN_ATTR_TYPE = 1 << 2,
-+ IBV_QP_OPEN_ATTR_RESERVED = 1 << 3
++ IBV_QP_OPEN_ATTR_NUM = 1 << 0,
++ IBV_QP_OPEN_ATTR_CONTEXT = 1 << 1,
++ IBV_QP_OPEN_ATTR_XRCD = 1 << 2,
++ IBV_QP_OPEN_ATTR_TYPE = 1 << 3,
++ IBV_QP_OPEN_ATTR_RESERVED = 1 << 4
+ };
+
+struct ibv_qp_open_attr {
+ uint32_t comp_mask;
+ uint32_t qp_num;
++ struct ibv_xrcd *xrcd;
+ void *qp_context;
+ enum ibv_qp_type qp_type;
+};
enum ibv_qp_attr_mask {
IBV_QP_STATE = 1 << 0,
IBV_QP_CUR_STATE = 1 << 1,
-@@ -517,7 +531,8 @@ enum ibv_qp_state {
+@@ -517,7 +533,8 @@ enum ibv_qp_state {
IBV_QPS_RTS,
IBV_QPS_SQD,
IBV_QPS_SQE,
};
enum ibv_mig_state {
-@@ -789,6 +804,8 @@ struct verbs_context {
+@@ -789,6 +806,8 @@ struct verbs_context {
int (*drv_new_func1) (); new corresponding provider call of func1
int (*lib_new_func1) (); New library call func1
*/
-+ struct ibv_qp * (*open_qp)(struct ibv_xrcd *xrcd,
++ struct ibv_qp * (*open_qp)(struct ibv_context *context,
+ struct ibv_qp_open_attr *attr);
struct ibv_qp * (*create_qp_ex)(struct ibv_context *context,
struct ibv_qp_init_attr_ex *qp_init_attr_ex);
uint32_t (*get_srq_num)(struct ibv_srq *srq);
-@@ -1163,6 +1180,20 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini
+@@ -1163,6 +1182,20 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini
}
/**
*/
int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
diff --git a/src/cmd.c b/src/cmd.c
-index 0b75df2..704d52e 100644
+index 0b75df2..7f65516 100644
--- a/src/cmd.c
+++ b/src/cmd.c
-@@ -800,6 +800,41 @@ int ibv_cmd_create_qp(struct ibv_pd *pd,
+@@ -800,6 +800,49 @@ int ibv_cmd_create_qp(struct ibv_pd *pd,
return 0;
}
-+int ibv_cmd_open_qp(struct verbs_xrcd *xrcd, struct verbs_qp *qp,
++int ibv_cmd_open_qp(struct verbs_context *context, struct verbs_qp *qp,
+ struct ibv_qp_open_attr *attr,
+ struct ibv_open_qp *cmd, size_t cmd_size,
+ struct ibv_create_qp_resp *resp, size_t resp_size)
+{
+ IBV_INIT_CMD_RESP(cmd, cmd_size, OPEN_QP, resp, resp_size);
+
++ if (attr->comp_mask >= IBV_QP_OPEN_ATTR_RESERVED)
++ return ENOSYS;
++
++ if (!(attr->comp_mask & IBV_QP_OPEN_ATTR_XRCD) ||
++ !(attr->comp_mask & IBV_QP_OPEN_ATTR_NUM) ||
++ !(attr->comp_mask & IBV_QP_OPEN_ATTR_TYPE))
++ return EINAL;
++
+ cmd->user_handle = (uintptr_t) qp;
-+ cmd->pd_handle = xrcd->handle;
++ cmd->pd_handle = attr->xrcd->handle;
+ cmd->qpn = attr->qp_num;
+ cmd->qp_type = attr->qp_type;
+
-+ if (write(xrcd->xrcd.context->cmd_fd, cmd, cmd_size) != cmd_size)
++ if (write(context->context.cmd_fd, cmd, cmd_size) != cmd_size)
+ return errno;
+
+ VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+
+ qp->qp.handle = resp->qp_handle;
-+ qp->qp.context = xrcd->xrcd.context;
++ qp->qp.context = &context->context;
+ qp->qp.qp_context = attr->qp_context;
+ qp->qp.pd = NULL;
+ qp->qp.send_cq = qp->qp.recv_cq = NULL;
+ pthread_mutex_init(&qp->qp.mutex, NULL);
+ pthread_cond_init(&qp->qp.cond, NULL);
+ qp->comp_mask = VERBS_QP_XRCD;
-+ qp->xrcd = xrcd;
++ qp->xrcd = attr->xrcd;
+
+ return 0;
+}
+++ /dev/null
-Bottom: 4a3eb780fa1fd1bd833f6f5172d77115ddcd3f00
-Top: 03993c9af52032749622b0ff5124f0e5a6babd9c
-Author: Sean Hefty <sean.hefty@intel.com>
-Date: 2012-09-27 11:24:23 -0700
-
-Refresh of open_qp
-
----
-
-diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h
-index 2b928c2..fe77ac4 100644
---- a/include/infiniband/driver.h
-+++ b/include/infiniband/driver.h
-@@ -164,7 +164,7 @@ int ibv_cmd_create_qp_ex(struct verbs_context *context,
- struct verbs_qp *qp, struct ibv_qp_init_attr_ex *attr_ex,
- struct ibv_create_qp *cmd, size_t cmd_size,
- struct ibv_create_qp_resp *resp, size_t resp_size);
--int ibv_cmd_open_qp(struct verbs_xrcd *xrcd,
-+int ibv_cmd_open_qp(struct verbs_context *context,
- struct verbs_qp *qp, struct ibv_qp_open_attr *attr,
- struct ibv_open_qp *cmd, size_t cmd_size,
- struct ibv_create_qp_resp *resp, size_t resp_size);
-diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
-index 1f3f806..a91662c 100644
---- a/include/infiniband/verbs.h
-+++ b/include/infiniband/verbs.h
-@@ -487,15 +487,17 @@ struct ibv_qp_init_attr_ex {
- };
-
- enum ibv_qp_open_attr_mask {
-- IBV_QP_OPEN_ATTR_CONTEXT = 1 << 0,
-- IBV_QP_OPEN_ATTR_NUM = 1 << 1,
-- IBV_QP_OPEN_ATTR_TYPE = 1 << 2,
-- IBV_QP_OPEN_ATTR_RESERVED = 1 << 3
-+ IBV_QP_OPEN_ATTR_NUM = 1 << 0,
-+ IBV_QP_OPEN_ATTR_CONTEXT = 1 << 1,
-+ IBV_QP_OPEN_ATTR_XRCD = 1 << 2,
-+ IBV_QP_OPEN_ATTR_TYPE = 1 << 3,
-+ IBV_QP_OPEN_ATTR_RESERVED = 1 << 4
- };
-
- struct ibv_qp_open_attr {
- uint32_t comp_mask;
- uint32_t qp_num;
-+ struct ibv_xrcd *xrcd;
- void *qp_context;
- enum ibv_qp_type qp_type;
- };
-@@ -804,7 +806,7 @@ struct verbs_context {
- int (*drv_new_func1) (); new corresponding provider call of func1
- int (*lib_new_func1) (); New library call func1
- */
-- struct ibv_qp * (*open_qp)(struct ibv_xrcd *xrcd,
-+ struct ibv_qp * (*open_qp)(struct ibv_context *context,
- struct ibv_qp_open_attr *attr);
- struct ibv_qp * (*create_qp_ex)(struct ibv_context *context,
- struct ibv_qp_init_attr_ex *qp_init_attr_ex);
-diff --git a/src/cmd.c b/src/cmd.c
-index 704d52e..7f65516 100644
---- a/src/cmd.c
-+++ b/src/cmd.c
-@@ -800,25 +800,33 @@ int ibv_cmd_create_qp(struct ibv_pd *pd,
- return 0;
- }
-
--int ibv_cmd_open_qp(struct verbs_xrcd *xrcd, struct verbs_qp *qp,
-+int ibv_cmd_open_qp(struct verbs_context *context, struct verbs_qp *qp,
- struct ibv_qp_open_attr *attr,
- struct ibv_open_qp *cmd, size_t cmd_size,
- struct ibv_create_qp_resp *resp, size_t resp_size)
- {
- IBV_INIT_CMD_RESP(cmd, cmd_size, OPEN_QP, resp, resp_size);
-
-+ if (attr->comp_mask >= IBV_QP_OPEN_ATTR_RESERVED)
-+ return ENOSYS;
-+
-+ if (!(attr->comp_mask & IBV_QP_OPEN_ATTR_XRCD) ||
-+ !(attr->comp_mask & IBV_QP_OPEN_ATTR_NUM) ||
-+ !(attr->comp_mask & IBV_QP_OPEN_ATTR_TYPE))
-+ return EINAL;
-+
- cmd->user_handle = (uintptr_t) qp;
-- cmd->pd_handle = xrcd->handle;
-+ cmd->pd_handle = attr->xrcd->handle;
- cmd->qpn = attr->qp_num;
- cmd->qp_type = attr->qp_type;
-
-- if (write(xrcd->xrcd.context->cmd_fd, cmd, cmd_size) != cmd_size)
-+ if (write(context->context.cmd_fd, cmd, cmd_size) != cmd_size)
- return errno;
-
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
-
- qp->qp.handle = resp->qp_handle;
-- qp->qp.context = xrcd->xrcd.context;
-+ qp->qp.context = &context->context;
- qp->qp.qp_context = attr->qp_context;
- qp->qp.pd = NULL;
- qp->qp.send_cq = qp->qp.recv_cq = NULL;
-@@ -830,7 +838,7 @@ int ibv_cmd_open_qp(struct verbs_xrcd *xrcd, struct verbs_qp *qp,
- pthread_mutex_init(&qp->qp.mutex, NULL);
- pthread_cond_init(&qp->qp.cond, NULL);
- qp->comp_mask = VERBS_QP_XRCD;
-- qp->xrcd = xrcd;
-+ qp->xrcd = attr->xrcd;
-
- return 0;
- }