diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index df242b0517349aeec797cef60f9d300e40d2ca83..734d8023becd8905958eefa7403e445477e12ef5 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -460,6 +460,7 @@ if test $ENABLEO2IB -eq 0; then AC_MSG_RESULT([disabled]) else o2ib_found=false + for O2IBPATH in $O2IBPATHS; do if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \ -f ${O2IBPATH}/include/rdma/ib_cm.h -a \ @@ -469,6 +470,7 @@ else break fi done + if ! $o2ib_found; then AC_MSG_RESULT([no]) case $ENABLEO2IB in @@ -536,23 +538,41 @@ else fi fi - # version checking is a hack and isn't reliable, - # we need verify it with each new ofed release - - if grep -q ib_dma_map_single \ - ${O2IBPATH}/include/rdma/ib_verbs.h; then - if grep -q comp_vector \ - ${O2IBPATH}/include/rdma/ib_verbs.h; then - IBLND_OFED_VERSION="1025" - else - IBLND_OFED_VERSION="1020" - fi - else - IBLND_OFED_VERSION="1010" - fi - - AC_DEFINE_UNQUOTED(IBLND_OFED_VERSION, $IBLND_OFED_VERSION, - [OFED version]) + LB_LINUX_TRY_COMPILE([ + #include <linux/version.h> + #include <linux/pci.h> + #if !HAVE_GFP_T + typedef int gfp_t; + #endif + #include <rdma/ib_verbs.h> + ],[ + ib_dma_map_single(NULL, NULL, 0, 0); + return 0; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_OFED_IB_DMA_MAP, 1, + [ib_dma_map_single defined]) + ],[ + AC_MSG_RESULT(NO) + ]) + + LB_LINUX_TRY_COMPILE([ + #include <linux/version.h> + #include <linux/pci.h> + #if !HAVE_GFP_T + typedef int gfp_t; + #endif + #include <rdma/ib_verbs.h> + ],[ + ib_create_cq(NULL, NULL, NULL, NULL, 0, 0); + return 0; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_OFED_IB_COMP_VECTOR, 1, + [has completion vector]) + ],[ + AC_MSG_RESULT(NO) + ]) EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save" fi diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index 3aea97abb83661d3586298127b6d8f037f558635..9ca7c2828d98ba2a4718d96b7b2754a7df4744b1 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -739,7 +739,7 @@ kiblnd_create_conn (kib_peer_t *peer, struct rdma_cm_id *cmid, int state) } } -#if (IBLND_OFED_VERSION == 1025) +#ifdef HAVE_OFED_IB_COMP_VECTOR cq = ib_create_cq(cmid->device, kiblnd_cq_completion, kiblnd_cq_event, conn, IBLND_CQ_ENTRIES(), 0); diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h index 55d829d400499871bc6d511400082d821174bfc3..d83caaa3e6b0e2e40aa169ebc65d4eea7eb9083a 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.h +++ b/lnet/klnds/o2iblnd/o2iblnd.h @@ -613,7 +613,7 @@ kiblnd_rd_size (kib_rdma_desc_t *rd) } #endif -#if (IBLND_OFED_VERSION == 1020) || (IBLND_OFED_VERSION == 1025) +#ifdef HAVE_OFED_IB_DMA_MAP static inline __u64 kiblnd_dma_map_single(struct ib_device *dev, void *msg, size_t size, @@ -665,7 +665,7 @@ static inline unsigned int kiblnd_sg_dma_len(struct ib_device *dev, #define KIBLND_CONN_PARAM(e) ((e)->param.conn.private_data) #define KIBLND_CONN_PARAM_LEN(e) ((e)->param.conn.private_data_len) -#elif (IBLND_OFED_VERSION == 1010) +#else static inline dma_addr_t kiblnd_dma_map_single(struct ib_device *dev, void *msg, size_t size,