Whamcloud - gitweb
LU-6215 lnet: split struct ib_send_wr
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
index 0e86a56..05b47db 100644 (file)
@@ -329,8 +329,8 @@ AC_SUBST(O2IBLND)
 AC_SUBST(O2IBPATH)
 AC_SUBST(ENABLEO2IB)
 
-# In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
 AS_IF([test $ENABLEO2IB != "no"], [
+       # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
        LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
        rdma_create_id_4args, [
                #ifdef HAVE_COMPAT_RDMA
@@ -349,15 +349,32 @@ AS_IF([test $ENABLEO2IB != "no"], [
                AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
                        [rdma_create_id wants 4 args])
        ])
-])
-#
-# 4.2 introduced struct ib_cq_init_attr which is used
-# by ib_create_cq(). Note some OFED stacks only keep
-# their headers in sync with latest kernels but not
-# the functionality which means for infiniband testing
-# we need to always test functionality testings.
-#
-AS_IF([test $ENABLEO2IB != "no"], [
+
+       # 4.4 added network namespace parameter for rdma_create_id()
+       LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
+       rdma_create_id_5args, [
+               #ifdef HAVE_COMPAT_RDMA
+               #undef PACKAGE_NAME
+               #undef PACKAGE_TARNAME
+               #undef PACKAGE_VERSION
+               #undef PACKAGE_STRING
+               #undef PACKAGE_BUGREPORT
+               #undef PACKAGE_URL
+               #include <linux/compat-2.6.h>
+               #endif
+               #include <rdma/rdma_cm.h>
+       ],[
+               rdma_create_id(NULL, NULL, NULL, 0, 0);
+       ],[
+               AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
+                       [rdma_create_id wants 5 args])
+       ])
+
+       # 4.2 introduced struct ib_cq_init_attr which is used
+       # by ib_create_cq(). Note some OFED stacks only keep
+       # their headers in sync with latest kernels but not
+       # the functionality which means for infiniband testing
+       # we need to always test functionality testings.
        LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
        ib_cq_init_attr, [
                #ifdef HAVE_COMPAT_RDMA
@@ -378,10 +395,8 @@ AS_IF([test $ENABLEO2IB != "no"], [
                AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
                        [struct ib_cq_init_attr is used by ib_create_cq])
        ])
-])
 
-# 4.3 removed ib_alloc_fast_reg_mr()
-AS_IF([test $ENABLEO2IB != "no"], [
+       # 4.3 removed ib_alloc_fast_reg_mr()
        LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
        ib_alloc_fast_reg_mr, [
                #ifdef HAVE_COMPAT_RDMA
@@ -400,7 +415,52 @@ AS_IF([test $ENABLEO2IB != "no"], [
                AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
                        [ib_alloc_fast_reg_mr is defined])
        ])
-])
+
+       # In v4.4 Linux kernel,
+       # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
+       # split up struct ib_send_wr so that all non-trivial verbs
+       # use their own structure which embedds struct ib_send_wr.
+       LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
+       ib_rdma_wr, [
+               #ifdef HAVE_COMPAT_RDMA
+               #undef PACKAGE_NAME
+               #undef PACKAGE_TARNAME
+               #undef PACKAGE_VERSION
+               #undef PACKAGE_STRING
+               #undef PACKAGE_BUGREPORT
+               #undef PACKAGE_URL
+               #include <linux/compat-2.6.h>
+               #endif
+               #include <rdma/ib_verbs.h>
+       ],[
+               struct ib_rdma_wr *wr __attribute__ ((unused));
+
+               wr = rdma_wr(NULL);
+       ],[
+               AC_DEFINE(HAVE_IB_RDMA_WR, 1,
+                       [struct ib_rdma_wr is defined])
+       ])
+
+       # new fast registration API introduced in 4.4
+       LB_CHECK_COMPILE([if 'ib_map_mr_sg' exists],
+       ib_map_mr_sg, [
+               #ifdef HAVE_COMPAT_RDMA
+               #undef PACKAGE_NAME
+               #undef PACKAGE_TARNAME
+               #undef PACKAGE_VERSION
+               #undef PACKAGE_STRING
+               #undef PACKAGE_BUGREPORT
+               #undef PACKAGE_URL
+               #include <linux/compat-2.6.h>
+               #endif
+               #include <rdma/ib_verbs.h>
+       ],[
+               ib_map_mr_sg(NULL, NULL, 0, 0);
+       ],[
+               AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
+                       [ib_map_mr_sg exists])
+       ])
+]) # ENABLEO2IB != "no"
 ]) # LN_CONFIG_O2IB
 
 #