From a06f7e85e99ef362657ea7ad53cee373efa8e38e Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Fri, 28 Sep 2012 14:07:35 -0700 Subject: [PATCH] refresh --- meta | 7 +- patches/open_qp | 197 ++++++++++++++++++++++++++++++++++++++++- patches/refresh-temp | 203 ------------------------------------------- 3 files changed, 198 insertions(+), 209 deletions(-) delete mode 100644 patches/refresh-temp diff --git a/meta b/meta index 3714631..5254edc 100644 --- a/meta +++ b/meta @@ -1,13 +1,12 @@ Version: 1 -Previous: cbcc1124b671f9a7ff1461368d8551e0b0618bbd -Head: 44c181ddaf1c20c5179787e93cda39177d18b4f4 +Previous: ba4840a877645149570e6b3e5c7d3ef4750d2feb +Head: cd573b748ea037b19b9f1aa93bcd8062e26cda12 Applied: verbs-ext: e3d312ae562579568c8941c4a9851a8b210eb70f xrcd2: 46318924283ba96f16863a0c77ad677e8d43e907 srq_ex: 959402295181378f53384eb318dd3f73f107e2ec xrc_qp: 14ea92a7e8682895d304ee36713d2dc5d29ef3e8 - open_qp: b5795ab10bfd4f8f29fdb593366be3f3e75ff14f - refresh-temp: 44c181ddaf1c20c5179787e93cda39177d18b4f4 + open_qp: cd573b748ea037b19b9f1aa93bcd8062e26cda12 Unapplied: xrcd: 1d5c0ac8e56de2b18c46f67ae528c92510f80f81 open_qp_man: 3ba2056186d67520b8302137c5906a0083891d7f diff --git a/patches/open_qp b/patches/open_qp index 1f59014..9e3cb8d 100644 --- a/patches/open_qp +++ b/patches/open_qp @@ -1,5 +1,5 @@ Bottom: 9357fd948fa031daf80ab93c90735c2e5dc059df -Top: 9357fd948fa031daf80ab93c90735c2e5dc059df +Top: bc10a5552903d53e7301c370f1e89b08399af4b1 Author: Sean Hefty Date: 2012-09-19 09:19:59 -0700 @@ -16,4 +16,197 @@ Signed-off-by: Sean Hefty --- - +diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h +index d43ae07..a63d1e9 100644 +--- a/include/infiniband/driver.h ++++ b/include/infiniband/driver.h +@@ -166,6 +166,10 @@ int ibv_cmd_create_qp_ex(struct ibv_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_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); + 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 f321866..a662ab4 100644 +--- a/include/infiniband/verbs.h ++++ b/include/infiniband/verbs.h +@@ -498,6 +498,22 @@ struct ibv_qp_init_attr_ex { + struct ibv_xrcd *xrcd; + }; + ++enum ibv_qp_open_attr_mask { ++ 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, +@@ -529,7 +545,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 { +@@ -805,6 +822,8 @@ enum verbs_context_mask { + + struct verbs_context { + /* "grows up" - new fields go here */ ++ 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); +@@ -1192,6 +1211,20 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini + } + + /** ++ * ibv_open_qp - Open a shareable queue pair. ++ */ ++static inline struct ibv_qp * ++ibv_open_qp(struct ibv_context *context, struct ibv_qp_open_attr *qp_open_attr) ++{ ++ struct verbs_context *vctx = verbs_get_ctx_op(context, open_qp); ++ if (!vctx) { ++ errno = ENOSYS; ++ return NULL; ++ } ++ return vctx->open_qp(context, 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 87ac062..da0d733 100644 +--- a/src/cmd.c ++++ b/src/cmd.c +@@ -816,6 +816,51 @@ int ibv_cmd_create_qp(struct ibv_pd *pd, + return 0; + } + ++int ibv_cmd_open_qp(struct ibv_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 verbs_xrcd *xrcd; ++ 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 EINVAL; ++ ++ xrcd = container_of(attr->xrcd, struct verbs_xrcd, xrcd); ++ cmd->user_handle = (uintptr_t) qp; ++ cmd->pd_handle = xrcd->handle; ++ cmd->qpn = attr->qp_num; ++ cmd->qp_type = attr->qp_type; ++ ++ if (write(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 = context; ++ qp->qp.qp_context = attr->qp_context; ++ qp->qp.pd = NULL; ++ qp->qp.send_cq = qp->qp.recv_cq = NULL; ++ qp->qp.srq = NULL; ++ qp->qp.qp_num = attr->qp_num; ++ qp->qp.qp_type = attr->qp_type; ++ qp->qp.state = IBV_QPS_UNKNOWN; ++ qp->qp.events_completed = 0; ++ pthread_mutex_init(&qp->qp.mutex, NULL); ++ pthread_cond_init(&qp->qp.cond, NULL); ++ qp->comp_mask = VERBS_QP_XRCD; ++ qp->xrcd = xrcd; ++ ++ 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..5ad8312 100644 +--- a/src/libibverbs.map ++++ b/src/libibverbs.map +@@ -102,5 +102,6 @@ IBVERBS_1.1 { + ibv_cmd_close_xrcd; + ibv_cmd_create_srq_ex; + ibv_cmd_create_qp_ex; ++ ibv_cmd_open_qp; + + } IBVERBS_1.0; diff --git a/patches/refresh-temp b/patches/refresh-temp deleted file mode 100644 index 8b5714a..0000000 --- a/patches/refresh-temp +++ /dev/null @@ -1,203 +0,0 @@ -Bottom: 9357fd948fa031daf80ab93c90735c2e5dc059df -Top: bc10a5552903d53e7301c370f1e89b08399af4b1 -Author: Sean Hefty -Date: 2012-09-28 14:07:35 -0700 - -Refresh of open_qp - ---- - -diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h -index d43ae07..a63d1e9 100644 ---- a/include/infiniband/driver.h -+++ b/include/infiniband/driver.h -@@ -166,6 +166,10 @@ int ibv_cmd_create_qp_ex(struct ibv_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_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); - 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 f321866..a662ab4 100644 ---- a/include/infiniband/verbs.h -+++ b/include/infiniband/verbs.h -@@ -498,6 +498,22 @@ struct ibv_qp_init_attr_ex { - struct ibv_xrcd *xrcd; - }; - -+enum ibv_qp_open_attr_mask { -+ 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, -@@ -529,7 +545,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 { -@@ -805,6 +822,8 @@ enum verbs_context_mask { - - struct verbs_context { - /* "grows up" - new fields go here */ -+ 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); -@@ -1192,6 +1211,20 @@ ibv_create_qp_ex(struct ibv_context *context, struct ibv_qp_init_attr_ex *qp_ini - } - - /** -+ * ibv_open_qp - Open a shareable queue pair. -+ */ -+static inline struct ibv_qp * -+ibv_open_qp(struct ibv_context *context, struct ibv_qp_open_attr *qp_open_attr) -+{ -+ struct verbs_context *vctx = verbs_get_ctx_op(context, open_qp); -+ if (!vctx) { -+ errno = ENOSYS; -+ return NULL; -+ } -+ return vctx->open_qp(context, 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 87ac062..da0d733 100644 ---- a/src/cmd.c -+++ b/src/cmd.c -@@ -816,6 +816,51 @@ int ibv_cmd_create_qp(struct ibv_pd *pd, - return 0; - } - -+int ibv_cmd_open_qp(struct ibv_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 verbs_xrcd *xrcd; -+ 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 EINVAL; -+ -+ xrcd = container_of(attr->xrcd, struct verbs_xrcd, xrcd); -+ cmd->user_handle = (uintptr_t) qp; -+ cmd->pd_handle = xrcd->handle; -+ cmd->qpn = attr->qp_num; -+ cmd->qp_type = attr->qp_type; -+ -+ if (write(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 = context; -+ qp->qp.qp_context = attr->qp_context; -+ qp->qp.pd = NULL; -+ qp->qp.send_cq = qp->qp.recv_cq = NULL; -+ qp->qp.srq = NULL; -+ qp->qp.qp_num = attr->qp_num; -+ qp->qp.qp_type = attr->qp_type; -+ qp->qp.state = IBV_QPS_UNKNOWN; -+ qp->qp.events_completed = 0; -+ pthread_mutex_init(&qp->qp.mutex, NULL); -+ pthread_cond_init(&qp->qp.cond, NULL); -+ qp->comp_mask = VERBS_QP_XRCD; -+ qp->xrcd = xrcd; -+ -+ 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..5ad8312 100644 ---- a/src/libibverbs.map -+++ b/src/libibverbs.map -@@ -102,5 +102,6 @@ IBVERBS_1.1 { - ibv_cmd_close_xrcd; - ibv_cmd_create_srq_ex; - ibv_cmd_create_qp_ex; -+ ibv_cmd_open_qp; - - } IBVERBS_1.0; -- 2.46.0