diff options
author | Roland Dreier <rolandd@cisco.com> | 2006-02-15 22:48:01 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 11:35:59 -0800 |
commit | b44b10b44225a55e8d025f5ef82151fb442d0d59 (patch) | |
tree | f505344259893e0421b83d6cfd836bd336493952 | |
parent | c9da74e838634bca14841eee888b3f89f609ffab (diff) | |
download | libibverbs-b44b10b44225a55e8d025f5ef82151fb442d0d59.tar.gz |
Add response handling to ibv_cmd_create_qp()
Add resp and resp_size parameters to libibverbs's ibv_cmd_create_qp()
function so that kernel low-level drivers can return private data to
userspace device drivers.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | include/infiniband/driver.h | 3 | ||||
-rw-r--r-- | src/cmd.c | 38 |
3 files changed, 29 insertions, 20 deletions
@@ -1,3 +1,11 @@ +2006-02-15 Roland Dreier <rdreier@cisco.com> + + * src/cmd.c (ibv_cmd_create_qp): Allow userspace device-specific + driver to pass in a response buffer, so that the low-level driver + in the kernel can pass back device-specific information. This + changes the userspace driver API, since the signature of + ibv_cmd_create_qp() is changed. + 2006-02-14 Roland Dreier <rdreier@cisco.com> * Release version 1.0-rc6. diff --git a/include/infiniband/driver.h b/include/infiniband/driver.h index ca00b3c..8d2f6e4 100644 --- a/include/infiniband/driver.h +++ b/include/infiniband/driver.h @@ -114,7 +114,8 @@ int ibv_cmd_destroy_srq(struct ibv_srq *srq); int ibv_cmd_create_qp(struct ibv_pd *pd, struct ibv_qp *qp, struct ibv_qp_init_attr *attr, - struct ibv_create_qp *cmd, size_t cmd_size); + struct ibv_create_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, enum ibv_qp_attr_mask attr_mask, struct ibv_qp_init_attr *qp_init_attr, @@ -543,17 +543,11 @@ int ibv_cmd_destroy_srq(struct ibv_srq *srq) int ibv_cmd_create_qp(struct ibv_pd *pd, struct ibv_qp *qp, struct ibv_qp_init_attr *attr, - struct ibv_create_qp *cmd, size_t cmd_size) + struct ibv_create_qp *cmd, size_t cmd_size, + struct ibv_create_qp_resp *resp, size_t resp_size) { - union { - struct ibv_create_qp_resp resp; - struct ibv_create_qp_resp_v3 resp_v3; - } r; - - if (abi_ver > 3) - IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_QP, &r.resp, sizeof r.resp); - else - IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_QP, &r.resp_v3, sizeof r.resp_v3); + IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_QP, resp, resp_size); + cmd->user_handle = (uintptr_t) qp; cmd->pd_handle = pd->handle; cmd->send_cq_handle = attr->send_cq->handle; @@ -572,16 +566,22 @@ int ibv_cmd_create_qp(struct ibv_pd *pd, return errno; if (abi_ver > 3) { - qp->handle = r.resp.qp_handle; - qp->qp_num = r.resp.qpn; - attr->cap.max_recv_sge = r.resp.max_recv_sge; - attr->cap.max_send_sge = r.resp.max_send_sge; - attr->cap.max_recv_wr = r.resp.max_recv_wr; - attr->cap.max_send_wr = r.resp.max_send_wr; - attr->cap.max_inline_data = r.resp.max_inline_data; + qp->handle = resp->qp_handle; + qp->qp_num = resp->qpn; + attr->cap.max_recv_sge = resp->max_recv_sge; + attr->cap.max_send_sge = resp->max_send_sge; + attr->cap.max_recv_wr = resp->max_recv_wr; + attr->cap.max_send_wr = resp->max_send_wr; + attr->cap.max_inline_data = resp->max_inline_data; } else { - qp->handle = r.resp_v3.qp_handle; - qp->qp_num = r.resp_v3.qpn; + struct ibv_create_qp_resp_v3 *resp_v3 = + (struct ibv_create_qp_resp_v3 *) resp; + + qp->handle = resp_v3->qp_handle; + qp->qp_num = resp_v3->qpn; + memmove((void *) resp + sizeof *resp, + (void *) resp_v3 + sizeof *resp_v3, + resp_size - sizeof *resp); } return 0; |