]> git.openfabrics.org - ~shefty/libibverbs.git/commitdiff
Add support for kernel ABI version 5
authorRoland Dreier <rolandd@cisco.com>
Thu, 16 Feb 2006 17:32:50 +0000 (17:32 +0000)
committerRoland Dreier <rolandd@cisco.com>
Thu, 9 Nov 2006 19:35:59 +0000 (11:35 -0800)
Add support for kernel ABI 5, which properly aligns struct ibv_create_qp_resp.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
ChangeLog
include/infiniband/kern-abi.h
src/cmd.c

index b6d3b1a99db78924c494c829154e004d11fc1f1f..01cd378c018d33434c2ab6a727637c7e83475539 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index ee9356191a62c19acdf97efa3e51b6ead7f5bba1..900cfbe49d0a316f6eacabc4220c72d1abedee3d 100644 (file)
@@ -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 */
index dc4d967982dc71c0bf1120a64ba70ac12773dade..89365d5a6f3c8f68602fbce23b8f6086b8e33402 100644 (file)
--- 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);