Whamcloud - gitweb
LU-6215 lnet: split struct ib_send_wr
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
index 7d6c971..05b47db 100644 (file)
@@ -42,21 +42,6 @@ fi
 ]) # LN_CHECK_GCC_VERSION
 
 #
-# LN_FUNC_DEV_GET_BY_NAME_2ARG
-#
-AC_DEFUN([LN_FUNC_DEV_GET_BY_NAME_2ARG], [
-LB_CHECK_COMPILE([if 'dev_get_by_name' has two args],
-dev_get_by_name_2args, [
-       #include <linux/netdevice.h>
-],[
-       dev_get_by_name(NULL, NULL);
-],[
-       AC_DEFINE(HAVE_DEV_GET_BY_NAME_2ARG, 1,
-               [dev_get_by_name has 2 args])
-])
-]) # LN_FUNC_DEV_GET_BY_NAME_2ARG
-
-#
 # LN_CONFIG_AFFINITY
 #
 # check if cpu affinity is available/wanted
@@ -114,173 +99,87 @@ AS_IF([test "x$enable_backoff" = xyes], [
 ]) # LN_CONFIG_BACKOFF
 
 #
-# LN_CONFIG_USOCKLND
-#
-# configure support for userspace TCP/IP LND
+# LN_CONFIG_DLC
 #
-AC_DEFUN([LN_CONFIG_USOCKLND], [
-AC_MSG_CHECKING([whether to enable usocklnd])
-AC_ARG_ENABLE([usocklnd],
-       AC_HELP_STRING([--disable-usocklnd],
-               [disable usocklnd]),
-       [], [enable_usocklnd="yes"])
-AC_MSG_RESULT([$enable_usocklnd])
-USOCKLND=""
-AS_IF([test "x$enable_usocklnd" = xyes], [
-       AC_MSG_CHECKING([whether to build usocklnd])
-       AS_IF([test "$ENABLE_LIBPTHREAD" = yes], [
-               AC_MSG_RESULT([yes])
-               USOCKLND="usocklnd"
-       ], [
-               AC_MSG_RESULT([no (libpthread not present or disabled)])
-       ])
-])
-AC_SUBST(USOCKLND)
-]) # LN_CONFIG_USOCKLND
-
-#
-# LN_CONFIG_QUADRICS
-#
-# check if quadrics support is in this kernel
-#
-AC_DEFUN([LN_CONFIG_QUADRICS], [
-AC_MSG_CHECKING([for QsNet sources])
-AC_ARG_WITH([qsnet],
-       AC_HELP_STRING([--with-qsnet=path],
-               [set path to qsnet source (default=$LINUX)]),
-       [QSNET=$with_qsnet], [QSNET=$LINUX])
-AC_MSG_RESULT([$QSNET])
-
-QSWLND=""
-QSWCPPFLAGS=""
-AC_MSG_CHECKING([if quadrics kernel headers are present])
-AS_IF([test -d $QSNET/drivers/net/qsnet], [
-       AC_MSG_RESULT([yes])
-       QSWLND="qswlnd"
-       AC_MSG_CHECKING([for multirail EKC])
-       AS_IF([test -f $QSNET/include/elan/epcomms.h], [
-               AC_MSG_RESULT([supported])
-               QSNET=$(readlink --canonicalize $QSNET)
-               QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
-       ], [
-               AC_MSG_RESULT([not supported])
-               AC_MSG_ERROR([Need multirail EKC])
-       ])
-
-       AS_IF([test x$QSNET = x$LINUX], [
-               LB_CHECK_CONFIG([QSNET], [], [
-                       LB_CHECK_CONFIG([QSNET_MODULE], [], [
-                               AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
-                               QSWLND=""
-                               QSWCPPFLAGS=""
-                       ])
-               ])
-       ])
-], [
-       AC_MSG_RESULT([no])
-])
-AC_SUBST(QSWLND)
-AC_SUBST(QSWCPPFLAGS)
-]) # LN_CONFIG_QUADRICS
-
+# Configure dlc if enabled
 #
-# LN_CONFIG_MX
+# if libyaml is set (IE libyaml installed) and enable_dlc = yes then build
+# dlc other wise (IE if libyaml is not set or enable_dlc = no) then don't
+# build dlc.
 #
-AC_DEFUN([LN_CONFIG_MX], [
-# set default
-MXPATH="/opt/mx"
-AC_MSG_CHECKING([whether to enable Myrinet MX support])
-AC_ARG_WITH([mx],
-       AC_HELP_STRING([--with-mx=path],
-               [build mxlnd against path]),
-       [
-               case $with_mx in
-               yes) ENABLEMX=2 ;;
-               no)  ENABLEMX=0 ;;
-               *)   ENABLEMX=3; MXPATH=$with_mx ;;
-               esac
-       ],[
-               ENABLEMX=1
-       ])
-AS_IF([test $ENABLEMX -eq 0], [
-       AC_MSG_RESULT([disabled])
-], [test ! \( -f ${MXPATH}/include/myriexpress.h -a \
-             -f ${MXPATH}/include/mx_kernel_api.h -a \
-             -f ${MXPATH}/include/mx_pin.h \)], [
-       AC_MSG_RESULT([no])
-       case $ENABLEMX in
-       1) ;;
-       2) AC_MSG_ERROR([Myrinet MX kernel headers not present]) ;;
-       3) AC_MSG_ERROR([bad --with-mx path]) ;;
-       *) AC_MSG_ERROR([internal error]) ;;
-       esac
-], [
-       AC_MSG_RESULT([check])
-       MXPATH=$(readlink --canonicalize $MXPATH)
-       MXCPPFLAGS="-I$MXPATH/include"
-       MXLIBS="-L$MXPATH/lib"
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
-       LB_CHECK_COMPILE([if have Myrinet MX support],
-       myrinet_mx_support, [
-               #define MX_KERNEL 1
-               #include <mx_extensions.h>
-               #include <myriexpress.h>
-       ],[
-               mx_endpoint_t   end;
-               mx_status_t     status;
-               mx_request_t    request;
-               int             result;
-               mx_init();
-               mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
-               mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
-               mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
-               mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
-               return 0;
-       ],[
-               MXLND="mxlnd"
-       ],[
-               case $ENABLEMX in
-               1) ;;
-               2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]) ;;
-               3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]) ;;
-               *) AC_MSG_ERROR([internal error]) ;;
-               esac
-               MXCPPFLAGS=""
-               MXLIBS=""
-               MXLND=""
+AC_DEFUN([LN_CONFIG_DLC], [
+       AC_CHECK_LIB([yaml],  [yaml_parser_initialize],[
+               LIBYAML="libyaml"],[
+               LIBYAML=""],[-lm])
+       AC_MSG_CHECKING([whether to enable dlc])
+       AC_ARG_ENABLE([dlc],
+               AC_HELP_STRING([--disable-dlc],
+                       [disable building dlc]),
+                       [], [enable_dlc="yes"])
+       USE_DLC=""
+       AS_IF([test "x$enable_dlc" = xyes],
+               [AS_IF([test "x$LIBYAML" = xlibyaml], [
+                       USE_DLC="yes"
+                       AC_MSG_RESULT([yes])
+               ], [
+                       AC_MSG_RESULT([no (libyaml not present)])
+               ])
+       ], [
+               AC_MSG_RESULT([no])
        ])
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
+       AC_SUBST(USE_DLC)
 ])
-AC_SUBST(MXCPPFLAGS)
-AC_SUBST(MXLIBS)
-AC_SUBST(MXLND)
-]) # LN_CONFIG_MX
 
 #
 # LN_CONFIG_O2IB
 #
+# If current OFED installed (assume with "ofed_info") and devel
+# headers are not found, error because we assume OFED infiniband
+# driver needs to be used and we must configure/build with it.
+# Current OFED headers detection mechanism allow for non-standard
+# prefix but relies on "ofed_info" command and on "%prefix/openib"
+# link (both are ok for 1.5.x and 3.x versions), and should work
+# for both source and DKMS builds.
+#
 AC_DEFUN([LN_CONFIG_O2IB], [
 AC_MSG_CHECKING([whether to use Compat RDMA])
 AC_ARG_WITH([o2ib],
-       AC_HELP_STRING([--with-o2ib=path],
+       AC_HELP_STRING([--with-o2ib=[yes|no|<path>]],
                [build o2iblnd against path]),
-       [
-               case $with_o2ib in
-               yes)    O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
-                       ENABLEO2IB=2
-                       ;;
-               no)     ENABLEO2IB=0
-                       ;;
-               *)      O2IBPATHS=$with_o2ib
-                       ENABLEO2IB=3
-                       ;;
-               esac
-       ],[
-               O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
-               ENABLEO2IB=1
-       ])
-AS_IF([test $ENABLEO2IB -eq 0], [
+       [], [with_o2ib="yes"])
+
+case $with_o2ib in
+       yes)    AS_IF([which ofed_info 2>/dev/null], [
+                       O2IBPATHS=$(ofed_info | egrep -w 'compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs rpm -ql | grep '/openib$')
+                       AS_IF([test -z "$O2IBPATHS"], [
+                               AC_MSG_ERROR([
+You seem to have an OFED installed but have not installed it's devel package.
+If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM.
+Instead, if you want to build Lustre for your kernel's built-in I/B stack rather than your installed OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
+                                            ])
+                       ])
+                       AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [
+                               AC_MSG_ERROR([
+It appears that you have multiple OFED versions installed.
+If you still want to build Lustre for your OFED I/B stack, you need to install a single version with its devel headers RPM.
+Instead, if you want to build Lustre for your kernel's built-in I/B stack rather than your installed OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
+                                            ])
+                       ])
+                       OFED="yes"
+               ], [
+                       O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
+               ])
+               ENABLEO2IB="yes"
+               ;;
+       no)     ENABLEO2IB="no"
+               ;;
+       *)      O2IBPATHS=$with_o2ib
+               ENABLEO2IB="withpath"
+               OFED="yes"
+               ;;
+esac
+
+AS_IF([test $ENABLEO2IB = "no"], [
        AC_MSG_RESULT([no])
 ], [
        o2ib_found=false
@@ -289,16 +188,6 @@ AS_IF([test $ENABLEO2IB -eq 0], [
                           -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
                           -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
                           -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
-                       AS_IF([test \( -d ${O2IBPATH}/kernel_patches -a \
-                                  -f ${O2IBPATH}/Makefile \)], [
-                               AC_MSG_RESULT([no])
-                               AC_MSG_ERROR([
-
-you appear to be trying to use the OFED distribution's source
-directory (${O2IBPATH}) rather than the "development/headers"
-directory which is likely in ${O2IBPATH%-*}
-])
-                       ])
                        o2ib_found=true
                        break
                ])
@@ -306,17 +195,21 @@ directory which is likely in ${O2IBPATH%-*}
        if ! $o2ib_found; then
                AC_MSG_RESULT([no])
                case $ENABLEO2IB in
-                       1) ;;
-                       2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]) ;;
-                       3) AC_MSG_ERROR([bad --with-o2ib path]) ;;
+                       "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;;
+                       "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;;
                        *) AC_MSG_ERROR([internal error]) ;;
                esac
        else
+               COMPAT_AUTOCONF=""
                compatrdma_found=false
                if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
                        AC_MSG_RESULT([yes])
                        compatrdma_found=true
                        AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
+                       EXTRA_OFED_CONFIG="$EXTRA_OFED_CONFIG -include ${O2IBPATH}/include/linux/compat-2.6.h"
+                       if test -f "$O2IBPATH/include/linux/compat_autoconf.h"; then
+                               COMPAT_AUTOCONF="$O2IBPATH/include/linux/compat_autoconf.h"
+                       fi
                else
                        AC_MSG_RESULT([no])
                fi
@@ -326,19 +219,21 @@ directory which is likely in ${O2IBPATH%-*}
                        elif test -f "$O2IBPATH/ofed_patch.mk"; then
                                . "$O2IBPATH/ofed_patch.mk"
                        fi
-               else
+               elif test -z "$COMPAT_AUTOCONF"; then
+                       # Depreciated checks
                        if test "x$RHEL_KERNEL" = xyes; then
-                               case "$RHEL_KERNEL_VERSION" in
-                                       2.6.32-358*)
-                                               EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4" ;;
-                                       2.6.32-431*)
-                                               EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_5" ;;
-                               esac
+                               RHEL_MAJOR=$(awk '/ RHEL_MAJOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
+                               I=$(awk '/ RHEL_MINOR / { print [$]3 }' $LINUX_OBJ/include/$VERSION_HDIR/version.h)
+                               while test "$I" -ge 0; do
+                                       EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_${RHEL_MAJOR}_$I"
+                                       I=$(($I-1))
+                               done
                        elif test "x$SUSE_KERNEL" = xyes; then
                                SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
                                EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
                        fi
                fi
+
                AC_MSG_CHECKING([whether to use any OFED backport headers])
                if test -n "$BACKPORT_INCLUDES"; then
                        AC_MSG_RESULT([yes])
@@ -353,12 +248,18 @@ directory which is likely in ${O2IBPATH%-*}
                EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
                LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
                openib_gen2_support, [
-                       #include <linux/version.h>
-                       #include <linux/pci.h>
-                       #include <linux/gfp.h>
                        #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 <linux/version.h>
+                       #include <linux/pci.h>
+                       #include <linux/gfp.h>
                        #include <rdma/rdma_cm.h>
                        #include <rdma/ib_cm.h>
                        #include <rdma/ib_verbs.h>
@@ -375,15 +276,14 @@ directory which is likely in ${O2IBPATH%-*}
                        O2IBLND="o2iblnd"
                ],[
                        case $ENABLEO2IB in
-                       1) ;;
-                       2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]) ;;
-                       3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
+                       "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;;
+                       "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
                        *) AC_MSG_ERROR([internal error]) ;;
                        esac
                ])
                # we know at this point that the found OFED source is good
                O2IB_SYMVER=""
-               if test $ENABLEO2IB -eq 3 ; then
+               if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
                        # OFED default rpm not handle sles10 Modules.symvers name
                        for name in Module.symvers Modules.symvers; do
                                if test -f $O2IBPATH/$name; then
@@ -392,31 +292,54 @@ directory which is likely in ${O2IBPATH%-*}
                                fi
                        done
                        if test -n "$O2IB_SYMVER"; then
-                               AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
-                               # strip out the existing symbols versions first
-                               if test -f $PWD/$SYMVERFILE; then
-                               egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
-                               else
-                                       touch $PWD/$SYMVERFILE.old
-                               fi
-                               cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
-                               rm $PWD/$SYMVERFILE.old
+                               AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to Symbol Path])
+                               EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IBPATH/$O2IB_SYMVER"
+                               AC_SUBST(EXTRA_SYMBOLS)
                        else
-                               AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
+                               AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
                        fi
                fi
 
-               LN_CONFIG_OFED_SPEC
+               LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
+               linux_kthread_worker, [
+                       #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 <linux/kthread.h>
+               ],[
+                       struct kthread_work     *kth_wrk __attribute__ ((unused));
+                       flush_kthread_work(kth_wrk);
+               ],[
+                       AC_DEFINE(HAVE_KTHREAD_WORK, 1, [kthread_worker found])
+                       if test -z "$COMPAT_AUTOCONF"; then
+                               EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_IS_KTHREAD"
+                       fi
+               ])
        fi
 ])
+AC_SUBST(EXTRA_OFED_CONFIG)
 AC_SUBST(EXTRA_OFED_INCLUDE)
 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 -ne 0], [
+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
+               #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>
@@ -426,37 +349,119 @@ AS_IF([test $ENABLEO2IB -ne 0], [
                AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
                        [rdma_create_id wants 4 args])
        ])
-])
-]) # LN_CONFIG_O2IB
 
-#
-# LN_CONFIG_RALND
-#
-# check whether to use the RapidArray lnd
-#
-AC_DEFUN([LN_CONFIG_RALND], [
-RALND=""
-RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
-EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
-LB_CHECK_COMPILE([if 'RapidArray' kernel headers are present],
-RapkGetDeviceByIndex, [
-       #include <linux/types.h>
-       #include <rapl.h>
-],[
-       RAP_RETURN rc;
-       RAP_PVOID  dev_handle;
-       rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
-       return rc == RAP_SUCCESS ? 0 : 1;
-],[
-       RALND="ralnd"
-],[
-       RACPPFLAGS=""
-])
-EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-AC_SUBST(RACPPFLAGS)
-AC_SUBST(RALND)
-]) # LN_CONFIG_RALND
+       # 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
+               #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_cq_init_attr cq_attr;
+
+               ib_create_cq(NULL, NULL, NULL, NULL, &cq_attr);
+       ],[
+               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()
+       LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
+       ib_alloc_fast_reg_mr, [
+               #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_alloc_fast_reg_mr(NULL, 0);
+       ],[
+               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
 
 #
 # LN_CONFIG_GNILND
@@ -511,23 +516,38 @@ AS_IF([test "x$enable_gni" = xyes], [
                return rrc;
        ],[
                GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
-               GNILNDRCA="gnilndrca"
        ])
        EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
 ])
 AC_SUBST(GNICPPFLAGS)
-AC_SUBST(GNILNDRCA)
 AC_SUBST(GNILND)
 ]) # LN_CONFIG_GNILND
 
 #
-# LN_CONFIG_USERSPACE
+# LN_CONFIG_SK_SLEEP
 #
-# This is defined but empty because it is called from
-# build/autconf/lustre-build.m4 which is shared by all branches.
+# 2.6.35 kernel has sk_sleep function
 #
-AC_DEFUN([LN_CONFIG_USERSPACE], [
-]) # LN_CONFIG_USERSPACE
+AC_DEFUN([LN_CONFIG_SK_SLEEP], [
+LB_CHECK_COMPILE([if Linux kernel has 'sk_sleep'],
+sk_sleep, [
+       #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 <net/sock.h>
+],[
+       sk_sleep(NULL);
+],[
+       AC_DEFINE(HAVE_SK_SLEEP, 1,
+                 [kernel has sk_sleep])
+])
+]) # LN_CONFIG_SK_SLEEP
 
 #
 # LN_CONFIG_TCP_SENDPAGE
@@ -539,6 +559,15 @@ tmp_flags="$EXTRA_KCFLAGS"
 EXTRA_KCFLAGS="-Werror"
 LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
 tcp_sendpage_socket, [
+       #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 <linux/net.h>
        #include <net/tcp.h>
 ],[
@@ -551,6 +580,63 @@ EXTRA_KCFLAGS="$tmp_flags"
 ]) # LN_CONFIG_TCP_SENDPAGE
 
 #
+# LN_CONFIG_SK_DATA_READY
+#
+# 3.15 for struct sock the *sk_data_ready() field only takes one argument now
+#
+AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
+sk_data_ready, [
+       #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 <linux/net.h>
+       #include <net/sock.h>
+],[
+       ((struct sock *)0)->sk_data_ready(NULL);
+],[
+       AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
+               [sk_data_ready uses only one argument])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_CONFIG_SK_DATA_READY
+
+#
+# LN_CONFIG_IB_INC_RKEY
+#
+AC_DEFUN([LN_CONFIG_IB_INC_RKEY], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
+ib_inc_rkey, [
+       #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>
+],[
+       (void)ib_inc_rkey(0);
+],[
+       AC_DEFINE(HAVE_IB_INC_RKEY, 1,
+                 [function ib_inc_rkey exist])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_CONFIG_IB_INC_RKEY
+
+#
 # LN_PROG_LINUX
 #
 # LNet linux kernel checks
@@ -559,28 +645,20 @@ AC_DEFUN([LN_PROG_LINUX], [
 AC_MSG_NOTICE([LNet kernel checks
 ==============================================================================])
 
-LN_FUNC_DEV_GET_BY_NAME_2ARG
 LN_CONFIG_AFFINITY
 LN_CONFIG_BACKOFF
-LN_CONFIG_QUADRICS
 LN_CONFIG_O2IB
-LN_CONFIG_RALND
 LN_CONFIG_GNILND
-LN_CONFIG_MX
+LN_CONFIG_IB_INC_RKEY
+# 2.6.35
+LN_CONFIG_SK_SLEEP
 # 2.6.36
 LN_CONFIG_TCP_SENDPAGE
+# 3.15
+LN_CONFIG_SK_DATA_READY
 ]) # LN_PROG_LINUX
 
 #
-# LN_PROG_DARWIN
-#
-# Darwin checks
-#
-AC_DEFUN([LN_PROG_DARWIN], [
-LB_DARWIN_CHECK_FUNCS([get_preemption_level])
-]) # LN_PROG_DARWIN
-
-#
 # LN_PATH_DEFAULTS
 #
 # default paths for installed files
@@ -598,76 +676,42 @@ AC_MSG_NOTICE([LNet core checks
 ==============================================================================])
 
 # lnet/utils/portals.c
-AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
-AC_CHECK_FUNCS([gethostbyname socket connect])
-
-# lnet/utils/debug.c
-AC_CHECK_HEADERS([linux/version.h])
+AC_CHECK_HEADERS([netdb.h])
+AC_CHECK_FUNCS([gethostbyname])
 
 # lnet/utils/wirecheck.c
 AC_CHECK_FUNCS([strnlen])
 
 # --------  Check for required packages  --------------
 
-#
-# LC_CONFIG_READLINE
-#
-# Build with readline
-#
-AC_MSG_CHECKING([whether to enable readline support])
-AC_ARG_ENABLE(readline,
-       AC_HELP_STRING([--disable-readline],
-               [disable readline support]),
-       [], [enable_readline="yes"])
-AC_MSG_RESULT([$enable_readline])
-
-# -------- check for readline if enabled ----
-
-LIBREADLINE=""
-AS_IF([test "x$enable_readline" = xyes], [
-       AC_CHECK_LIB([readline], [readline], [
-               LIBREADLINE="-lreadline"
-               AC_DEFINE(HAVE_LIBREADLINE, 1,
-                       [readline library is available])])
-])
-AC_SUBST(LIBREADLINE)
-
-# -------- enable acceptor libwrap (TCP wrappers) support? -------
-
-AC_MSG_CHECKING([if libwrap support is requested])
-AC_ARG_ENABLE([libwrap],
-       AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
-       [case "${enableval}" in
-               yes) enable_libwrap="yes" ;;
-               no)  enable_libwrap="no" ;;
-               *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
-       esac], [enable_libwrap="no"])
-AC_MSG_RESULT([$enable_libwrap])
-LIBWRAP=""
-AS_IF([test "x$enable_libwrap" = xyes], [
-       LIBWRAP="-lwrap"
-       AC_DEFINE(HAVE_LIBWRAP, 1,
-               [libwrap support is requested])
+AC_MSG_CHECKING([whether to enable 'efence' debugging support])
+AC_ARG_ENABLE(efence,
+       AC_HELP_STRING([--enable-efence],
+               [use efence library]),
+       [], [enable_efence="no"])
+AC_MSG_RESULT([$enable_efence])
+
+LIBEFENCE=""
+AS_IF([test "$enable_efence" = yes], [
+       LIBEFENCE="-lefence"
+       AC_DEFINE(HAVE_LIBEFENCE, 1,
+               [libefence support is requested])
 ])
-AC_SUBST(LIBWRAP)
+AC_SUBST(LIBEFENCE)
 
 LN_CONFIG_MAX_PAYLOAD
-LN_CONFIG_USOCKLND
+LN_CONFIG_DLC
 ]) # LN_CONFIGURE
 
 #
 # LN_CONDITIONALS
 #
-# AM_CONDITOINAL defines for lnet
+# AM_CONDITIONAL defines for lnet
 #
 AC_DEFUN([LN_CONDITIONALS], [
-AM_CONDITIONAL(BUILD_QSWLND,     test x$QSWLND = "xqswlnd")
-AM_CONDITIONAL(BUILD_MXLND,      test x$MXLND = "xmxlnd")
 AM_CONDITIONAL(BUILD_O2IBLND,    test x$O2IBLND = "xo2iblnd")
-AM_CONDITIONAL(BUILD_RALND,      test x$RALND = "xralnd")
-AM_CONDITIONAL(BUILD_GNILND,     test x$GNILND = "xgnilnd")
-AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
-AM_CONDITIONAL(BUILD_USOCKLND,   test x$USOCKLND = "xusocklnd")
+AM_CONDITIONAL(BUILD_GNILND,     test x$GNILND  = "xgnilnd")
+AM_CONDITIONAL(BUILD_DLC,        test x$USE_DLC = "xyes")
 ]) # LN_CONDITIONALS
 
 #
@@ -677,24 +721,16 @@ AM_CONDITIONAL(BUILD_USOCKLND,   test x$USOCKLND = "xusocklnd")
 #
 AC_DEFUN([LN_CONFIG_FILES], [
 AC_CONFIG_FILES([
-lnet/Kernelenv
 lnet/Makefile
 lnet/autoMakefile
 lnet/autoconf/Makefile
 lnet/doc/Makefile
 lnet/include/Makefile
 lnet/include/lnet/Makefile
-lnet/include/lnet/linux/Makefile
 lnet/klnds/Makefile
 lnet/klnds/autoMakefile
-lnet/klnds/mxlnd/autoMakefile
-lnet/klnds/mxlnd/Makefile
 lnet/klnds/o2iblnd/Makefile
 lnet/klnds/o2iblnd/autoMakefile
-lnet/klnds/qswlnd/Makefile
-lnet/klnds/qswlnd/autoMakefile
-lnet/klnds/ralnd/Makefile
-lnet/klnds/ralnd/autoMakefile
 lnet/klnds/gnilnd/Makefile
 lnet/klnds/gnilnd/autoMakefile
 lnet/klnds/socklnd/Makefile
@@ -703,10 +739,7 @@ lnet/lnet/Makefile
 lnet/lnet/autoMakefile
 lnet/selftest/Makefile
 lnet/selftest/autoMakefile
-lnet/ulnds/Makefile
-lnet/ulnds/autoMakefile
-lnet/ulnds/socklnd/Makefile
 lnet/utils/Makefile
-lnet/include/lnet/darwin/Makefile
+lnet/utils/lnetconfig/Makefile
 ])
 ]) # LN_CONFIG_FILES