Whamcloud - gitweb
LU-6215 o2iblnd: handle new struct ib_cq_init_attr 18/16118/2
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 27 Aug 2015 22:14:32 +0000 (18:14 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 2 Sep 2015 02:46:11 +0000 (02:46 +0000)
For linux kernel version 4.2 the infiniband layer
created a new structure ib_cq_init_attr to pass to
ib_create_cq(). This patch handles this new case.
See linux commit 8e37210b38fb7d6aa06aebde763316ee955d44c0

Change-Id: I0db25c8bf6a4fb11a120607a45f8f1e546c375d6
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/16118
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/autoconf/lustre-lnet.m4
lnet/klnds/o2iblnd/o2iblnd.c

index a03611c..40595d7 100644 (file)
@@ -328,6 +328,25 @@ AS_IF([test $ENABLEO2IB != "no"], [
                        [rdma_create_id wants 4 args])
        ])
 ])
+#
+# 4.2 introduced struct ib_cq_init_attr
+#
+AS_IF([test $ENABLEO2IB != "no"], [
+       LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' exist],
+       ib_cq_init_attr, [
+               #ifdef HAVE_COMPAT_RDMA
+               #include <linux/compat-2.6.h>
+               #endif
+               #include <rdma/ib_verbs.h>
+       ],[
+               struct ib_cq_init_attr cq_attr;
+
+               cq_attr.comp_vector = NULL;
+       ],[
+               AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
+                       [struct ib_cq_init_attr exist])
+       ])
+])
 ]) # LN_CONFIG_O2IB
 
 #
index 6986f2d..3adff1f 100644 (file)
@@ -718,6 +718,9 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
        kib_dev_t              *dev;
        struct ib_qp_init_attr *init_qp_attr;
        struct kib_sched_info   *sched;
+#ifdef HAVE_IB_CQ_INIT_ATTR
+       struct ib_cq_init_attr  cq_attr = {};
+#endif
        kib_conn_t              *conn;
        struct ib_cq            *cq;
        unsigned long           flags;
@@ -813,10 +816,18 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
 
        kiblnd_map_rx_descs(conn);
 
+#ifdef HAVE_IB_CQ_INIT_ATTR
+       cq_attr.cqe = IBLND_CQ_ENTRIES(version);
+       cq_attr.comp_vector = kiblnd_get_completion_vector(conn, cpt);
+       cq = ib_create_cq(cmid->device,
+                         kiblnd_cq_completion, kiblnd_cq_event, conn,
+                         &cq_attr);
+#else
        cq = ib_create_cq(cmid->device,
                          kiblnd_cq_completion, kiblnd_cq_event, conn,
                          IBLND_CQ_ENTRIES(version),
                          kiblnd_get_completion_vector(conn, cpt));
+#endif
         if (IS_ERR(cq)) {
                 CERROR("Can't create CQ: %ld, cqe: %d\n",
                        PTR_ERR(cq), IBLND_CQ_ENTRIES(version));