diff options
author | Roland Dreier <rolandd@cisco.com> | 2006-02-16 17:32:50 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 11:35:59 -0800 |
commit | 34e8b6921cc9208cf38112b57e70036f79b0f20f (patch) | |
tree | 6f6e0459e4cf919948bcd22dba532a595a89ea98 | |
parent | b44b10b44225a55e8d025f5ef82151fb442d0d59 (diff) | |
download | libibverbs-34e8b6921cc9208cf38112b57e70036f79b0f20f.tar.gz |
Add support for kernel ABI version 5
Add support for kernel ABI 5, which properly aligns struct ibv_create_qp_resp.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | include/infiniband/kern-abi.h | 13 | ||||
-rw-r--r-- | src/cmd.c | 18 |
3 files changed, 30 insertions, 6 deletions
@@ -1,3 +1,8 @@ +2006-02-16 Roland Dreier <rdreier@cisco.com> + + * src/cmd.c (ibv_cmd_create_qp): Add support for kernel ABI + version 5 (properly aligned struct ibv_create_qp_resp). + 2006-02-15 Roland Dreier <rdreier@cisco.com> * src/cmd.c (ibv_cmd_create_qp): Allow userspace device-specific diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h index ee93561..900cfbe 100644 --- a/include/infiniband/kern-abi.h +++ b/include/infiniband/kern-abi.h @@ -48,7 +48,7 @@ * The minimum and maximum kernel ABI that we can handle. */ #define IB_USER_VERBS_MIN_ABI_VERSION 1 -#define IB_USER_VERBS_MAX_ABI_VERSION 4 +#define IB_USER_VERBS_MAX_ABI_VERSION 5 enum { IB_USER_VERBS_CMD_GET_CONTEXT, @@ -459,6 +459,7 @@ struct ibv_create_qp_resp { __u32 max_send_sge; __u32 max_recv_sge; __u32 max_inline_data; + __u32 reserved; }; struct ibv_qp_dest { @@ -860,4 +861,14 @@ struct ibv_create_qp_resp_v3 { __u32 qpn; }; +struct ibv_create_qp_resp_v4 { + __u32 qp_handle; + __u32 qpn; + __u32 max_send_wr; + __u32 max_recv_wr; + __u32 max_send_sge; + __u32 max_recv_sge; + __u32 max_inline_data; +}; + #endif /* KERN_ABI_H */ @@ -565,20 +565,28 @@ int ibv_cmd_create_qp(struct ibv_pd *pd, if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size) return errno; + qp->handle = resp->qp_handle; + qp->qp_num = resp->qpn; + if (abi_ver > 3) { - 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 { + } + + if (abi_ver == 4) { + struct ibv_create_qp_resp_v4 *resp_v4 = + (struct ibv_create_qp_resp_v4 *) resp; + + memmove((void *) resp + sizeof *resp, + (void *) resp_v4 + sizeof *resp_v4, + resp_size - sizeof *resp); + } else if (abi_ver <= 3) { 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); |