From: James Simmons Date: Thu, 27 Aug 2015 22:14:32 +0000 (-0400) Subject: LU-6215 o2iblnd: handle new struct ib_cq_init_attr X-Git-Tag: 2.7.60~52 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=d9aa04c7b18d194c5bc1e851dd5d1b89e9cfb45a LU-6215 o2iblnd: handle new struct ib_cq_init_attr 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 Reviewed-on: http://review.whamcloud.com/16118 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: frank zago Reviewed-by: Oleg Drokin --- diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index a03611c..40595d7 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -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 + #endif + #include + ],[ + 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 # diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index 6986f2d..3adff1f 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -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));