From 34e8b6921cc9208cf38112b57e70036f79b0f20f Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Thu, 16 Feb 2006 17:32:50 +0000 Subject: [PATCH] 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 --- ChangeLog | 5 +++++ include/infiniband/kern-abi.h | 13 ++++++++++++- src/cmd.c | 18 +++++++++++++----- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b6d3b1a..01cd378 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-02-16 Roland Dreier + + * 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 * 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 */ diff --git a/src/cmd.c b/src/cmd.c index dc4d967..89365d5 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -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); -- 2.41.0