Version: 1
-Previous: 1d51392653e506de70949331ee750614e9fd7816
-Head: 878e9888af2b9323fa7cc61973b6aa0b0290ee80
+Previous: 123ac4f70f9c7b659b7ef2de7364265f7ee94ded
+Head: c5fee3d4706c13375b5aab3edd138e0f1e4ff29b
Applied:
verbs-ext: b3d744f488bc97442df7e6cef8536d3b0352a786
xrcd: 07cc711dd4091666de3c99545c64578ce6472da7
srq_ex: 9698473fabcdee089e866558fb1bfc9dbc867609
xrc_qp: db63132ca115254044900ae234e123e8c963e8ee
- open_qp: edf8b90af5bbbaa20e5cf254acd842ad75463d0c
- refresh-temp: 878e9888af2b9323fa7cc61973b6aa0b0290ee80
+ open_qp: c5fee3d4706c13375b5aab3edd138e0f1e4ff29b
Unapplied:
compat-ex: 81b9e1927e19f096b0c34a461b5a0f102b672d43
open_qp_man: 6cf6dc5761417ce54613251a1f16131b443da5ca
Bottom: b66e97fee148aae0ef83ec03c25a6d56d444f6ea
-Top: b66e97fee148aae0ef83ec03c25a6d56d444f6ea
+Top: 6959e49c2b6f7ac0f35d98c0dccbcba4838f0d5d
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 6afd93b..b47a510 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 ibv_xrcd *xrcd,
++ struct ibv_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);
+ int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *qp_attr,
+ int attr_mask,
+ struct ibv_qp_init_attr *qp_init_attr,
+diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h
+index b6d5ce9..e24fa4f 100644
+--- a/include/infiniband/kern-abi.h
++++ b/include/infiniband/kern-abi.h
+@@ -88,7 +88,8 @@ enum {
+ IB_USER_VERBS_CMD_POST_SRQ_RECV,
+ IB_USER_VERBS_CMD_OPEN_XRCD,
+ IB_USER_VERBS_CMD_CLOSE_XRCD,
+- IB_USER_VERBS_CMD_CREATE_XSRQ
++ IB_USER_VERBS_CMD_CREATE_XSRQ,
++ IB_USER_VERBS_CMD_OPEN_QP
+ };
+
+ /*
+@@ -476,6 +477,20 @@ struct ibv_create_qp {
+ __u64 driver_data[0];
+ };
+
++struct ibv_open_qp {
++ __u32 command;
++ __u16 in_words;
++ __u16 out_words;
++ __u64 response;
++ __u64 user_handle;
++ __u32 pd_handle;
++ __u32 qpn;
++ __u8 qp_type;
++ __u8 reserved[7];
++ __u64 driver_data[0];
++};
++
++/* also used for open response */
+ struct ibv_create_qp_resp {
+ __u32 qp_handle;
+ __u32 qpn;
+@@ -852,7 +867,8 @@ enum {
+ IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL_V2 = -1,
+ IB_USER_VERBS_CMD_OPEN_XRCD_V2 = -1,
+ IB_USER_VERBS_CMD_CLOSE_XRCD_V2 = -1,
+- IB_USER_VERBS_CMD_CREATE_XSRQ_V2 = -1
++ IB_USER_VERBS_CMD_CREATE_XSRQ_V2 = -1,
++ IB_USER_VERBS_CMD_OPEN_QP_V2 = -1
+ };
+
+ struct ibv_destroy_cq_v1 {
+diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
+index 799822d..3c4cbe8 100644
+--- a/include/infiniband/verbs.h
++++ b/include/infiniband/verbs.h
+@@ -484,6 +484,20 @@ 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
++ };
++
++struct ibv_qp_open_attr {
++ uint32_t comp_mask;
++ uint32_t qp_num;
++ 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,
+@@ -515,7 +529,8 @@ enum ibv_qp_state {
+ IBV_QPS_RTS,
+ IBV_QPS_SQD,
+ IBV_QPS_SQE,
+- IBV_QPS_ERR
++ IBV_QPS_ERR,
++ IBV_QPS_UNKNOWN
+ };
+
+ enum ibv_mig_state {
+@@ -787,6 +802,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_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);
+@@ -1160,6 +1177,12 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini
+ }
+
+ /**
++ * ibv_open_qp - Open a shareable queue pair.
++ */
++struct ibv_qp *ibv_open_qp(struct ibv_xrcd *xrcd,
++ struct ibv_qp_open_attr *qp_open_attr);
++
++/**
+ * ibv_modify_qp - Modify a queue pair.
+ */
+ int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
+diff --git a/src/cmd.c b/src/cmd.c
+index 3bde238..75afdc2 100644
+--- a/src/cmd.c
++++ b/src/cmd.c
+@@ -797,6 +797,28 @@ int ibv_cmd_create_qp(struct ibv_pd *pd,
+ return 0;
+ }
+
++int ibv_cmd_open_qp(struct ibv_xrcd *xrcd, struct ibv_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);
++
++ cmd->user_handle = (uintptr_t) qp;
++ cmd->pd_handle = xrcd->handle;
++ cmd->qpn = attr->qp_num;
++ cmd->qp_type = attr->qp_type;
++
++ if (write(xrcd->context->cmd_fd, cmd, cmd_size) != cmd_size)
++ return errno;
++
++ VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
++
++ qp->handle = resp->qp_handle;
++
++ return 0;
++}
++
+ int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
+ int attr_mask,
+ struct ibv_qp_init_attr *init_attr,
+diff --git a/src/libibverbs.map b/src/libibverbs.map
+index 4249793..c9b29c6 100644
+--- a/src/libibverbs.map
++++ b/src/libibverbs.map
+@@ -102,5 +102,7 @@ IBVERBS_1.1 {
+ ibv_cmd_close_xrcd;
+ ibv_cmd_create_srq_ex;
+ ibv_cmd_create_qp_ex;
++ ibv_open_qp;
++ ibv_cmd_open_qp;
+
+ } IBVERBS_1.0;
+diff --git a/src/verbs.c b/src/verbs.c
+index b5938f2..dbb2210 100644
+--- a/src/verbs.c
++++ b/src/verbs.c
+@@ -418,6 +418,42 @@ struct ibv_qp *__ibv_create_qp(struct ibv_pd *pd,
+ }
+ default_symver(__ibv_create_qp, ibv_create_qp);
+
++struct ibv_qp *__ibv_open_qp(struct ibv_xrcd *xrcd,
++ struct ibv_qp_open_attr *qp_open_attr)
++{
++ struct verbs_context *context_ex;
++ struct ibv_qp *qp;
++
++ context_ex = verbs_get_ctx(xrcd->context);
++ if (!context_ex->open_qp ||
++ qp_open_attr->comp_mask >= IBV_QP_OPEN_ATTR_RESERVED) {
++ errno = ENOSYS;
++ return NULL;
++ }
++
++ qp = context_ex->open_qp(xrcd, qp_open_attr);
++ if (qp) {
++ qp->context = xrcd->context;
++ qp->qp_context = qp_open_attr->qp_context;
++
++ qp->pd = NULL;
++ qp->send_cq = qp->recv_cq = NULL;
++ qp->srq = NULL;
++ qp->comp_mask |= IBV_QP_XRCD;
++ qp->xrcd = xrcd;
++
++ qp->qp_num = qp_open_attr->qp_num;
++ qp->qp_type = qp_open_attr->qp_type;
++ qp->state = IBV_QPS_UNKNOWN;
++ qp->events_completed = 0;
++ pthread_mutex_init(&qp->mutex, NULL);
++ pthread_cond_init(&qp->cond, NULL);
++ }
++
++ return qp;
++}
++default_symver(__ibv_open_qp, ibv_open_qp);
++
+ int __ibv_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
+ int attr_mask,
+ struct ibv_qp_init_attr *init_attr)
+++ /dev/null
-Bottom: b66e97fee148aae0ef83ec03c25a6d56d444f6ea
-Top: 6959e49c2b6f7ac0f35d98c0dccbcba4838f0d5d
-Author: Sean Hefty <sean.hefty@intel.com>
-Date: 2012-09-26 14:06:18 -0700
-
-Refresh of open_qp
-
----
-
-diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h
-index 6afd93b..b47a510 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 ibv_xrcd *xrcd,
-+ struct ibv_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);
- int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *qp_attr,
- int attr_mask,
- struct ibv_qp_init_attr *qp_init_attr,
-diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h
-index b6d5ce9..e24fa4f 100644
---- a/include/infiniband/kern-abi.h
-+++ b/include/infiniband/kern-abi.h
-@@ -88,7 +88,8 @@ enum {
- IB_USER_VERBS_CMD_POST_SRQ_RECV,
- IB_USER_VERBS_CMD_OPEN_XRCD,
- IB_USER_VERBS_CMD_CLOSE_XRCD,
-- IB_USER_VERBS_CMD_CREATE_XSRQ
-+ IB_USER_VERBS_CMD_CREATE_XSRQ,
-+ IB_USER_VERBS_CMD_OPEN_QP
- };
-
- /*
-@@ -476,6 +477,20 @@ struct ibv_create_qp {
- __u64 driver_data[0];
- };
-
-+struct ibv_open_qp {
-+ __u32 command;
-+ __u16 in_words;
-+ __u16 out_words;
-+ __u64 response;
-+ __u64 user_handle;
-+ __u32 pd_handle;
-+ __u32 qpn;
-+ __u8 qp_type;
-+ __u8 reserved[7];
-+ __u64 driver_data[0];
-+};
-+
-+/* also used for open response */
- struct ibv_create_qp_resp {
- __u32 qp_handle;
- __u32 qpn;
-@@ -852,7 +867,8 @@ enum {
- IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL_V2 = -1,
- IB_USER_VERBS_CMD_OPEN_XRCD_V2 = -1,
- IB_USER_VERBS_CMD_CLOSE_XRCD_V2 = -1,
-- IB_USER_VERBS_CMD_CREATE_XSRQ_V2 = -1
-+ IB_USER_VERBS_CMD_CREATE_XSRQ_V2 = -1,
-+ IB_USER_VERBS_CMD_OPEN_QP_V2 = -1
- };
-
- struct ibv_destroy_cq_v1 {
-diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
-index 799822d..3c4cbe8 100644
---- a/include/infiniband/verbs.h
-+++ b/include/infiniband/verbs.h
-@@ -484,6 +484,20 @@ 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
-+ };
-+
-+struct ibv_qp_open_attr {
-+ uint32_t comp_mask;
-+ uint32_t qp_num;
-+ 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,
-@@ -515,7 +529,8 @@ enum ibv_qp_state {
- IBV_QPS_RTS,
- IBV_QPS_SQD,
- IBV_QPS_SQE,
-- IBV_QPS_ERR
-+ IBV_QPS_ERR,
-+ IBV_QPS_UNKNOWN
- };
-
- enum ibv_mig_state {
-@@ -787,6 +802,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_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);
-@@ -1160,6 +1177,12 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini
- }
-
- /**
-+ * ibv_open_qp - Open a shareable queue pair.
-+ */
-+struct ibv_qp *ibv_open_qp(struct ibv_xrcd *xrcd,
-+ struct ibv_qp_open_attr *qp_open_attr);
-+
-+/**
- * ibv_modify_qp - Modify a queue pair.
- */
- int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-diff --git a/src/cmd.c b/src/cmd.c
-index 3bde238..75afdc2 100644
---- a/src/cmd.c
-+++ b/src/cmd.c
-@@ -797,6 +797,28 @@ int ibv_cmd_create_qp(struct ibv_pd *pd,
- return 0;
- }
-
-+int ibv_cmd_open_qp(struct ibv_xrcd *xrcd, struct ibv_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);
-+
-+ cmd->user_handle = (uintptr_t) qp;
-+ cmd->pd_handle = xrcd->handle;
-+ cmd->qpn = attr->qp_num;
-+ cmd->qp_type = attr->qp_type;
-+
-+ if (write(xrcd->context->cmd_fd, cmd, cmd_size) != cmd_size)
-+ return errno;
-+
-+ VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
-+
-+ qp->handle = resp->qp_handle;
-+
-+ return 0;
-+}
-+
- int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
- int attr_mask,
- struct ibv_qp_init_attr *init_attr,
-diff --git a/src/libibverbs.map b/src/libibverbs.map
-index 4249793..c9b29c6 100644
---- a/src/libibverbs.map
-+++ b/src/libibverbs.map
-@@ -102,5 +102,7 @@ IBVERBS_1.1 {
- ibv_cmd_close_xrcd;
- ibv_cmd_create_srq_ex;
- ibv_cmd_create_qp_ex;
-+ ibv_open_qp;
-+ ibv_cmd_open_qp;
-
- } IBVERBS_1.0;
-diff --git a/src/verbs.c b/src/verbs.c
-index b5938f2..dbb2210 100644
---- a/src/verbs.c
-+++ b/src/verbs.c
-@@ -418,6 +418,42 @@ struct ibv_qp *__ibv_create_qp(struct ibv_pd *pd,
- }
- default_symver(__ibv_create_qp, ibv_create_qp);
-
-+struct ibv_qp *__ibv_open_qp(struct ibv_xrcd *xrcd,
-+ struct ibv_qp_open_attr *qp_open_attr)
-+{
-+ struct verbs_context *context_ex;
-+ struct ibv_qp *qp;
-+
-+ context_ex = verbs_get_ctx(xrcd->context);
-+ if (!context_ex->open_qp ||
-+ qp_open_attr->comp_mask >= IBV_QP_OPEN_ATTR_RESERVED) {
-+ errno = ENOSYS;
-+ return NULL;
-+ }
-+
-+ qp = context_ex->open_qp(xrcd, qp_open_attr);
-+ if (qp) {
-+ qp->context = xrcd->context;
-+ qp->qp_context = qp_open_attr->qp_context;
-+
-+ qp->pd = NULL;
-+ qp->send_cq = qp->recv_cq = NULL;
-+ qp->srq = NULL;
-+ qp->comp_mask |= IBV_QP_XRCD;
-+ qp->xrcd = xrcd;
-+
-+ qp->qp_num = qp_open_attr->qp_num;
-+ qp->qp_type = qp_open_attr->qp_type;
-+ qp->state = IBV_QPS_UNKNOWN;
-+ qp->events_completed = 0;
-+ pthread_mutex_init(&qp->mutex, NULL);
-+ pthread_cond_init(&qp->cond, NULL);
-+ }
-+
-+ return qp;
-+}
-+default_symver(__ibv_open_qp, ibv_open_qp);
-+
- int __ibv_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
- int attr_mask,
- struct ibv_qp_init_attr *init_attr)