Whamcloud - gitweb
LU-1546 mdd: return nlink as zero for dead objects
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
index ddfce23..bb30405 100644 (file)
@@ -42,6 +42,23 @@ fi
 ])
 
 #
+# LN_FUNC_DEV_GET_BY_NAME_2ARG
+#
+AC_DEFUN([LN_FUNC_DEV_GET_BY_NAME_2ARG],
+[AC_MSG_CHECKING([if dev_get_by_name has two args])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/netdevice.h>
+],[
+        dev_get_by_name(NULL, NULL);
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_DEV_GET_BY_NAME_2ARG, 1, [dev_get_by_name has 2 args])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
 # LN_CONFIG_AFFINITY
 #
 # check if cpu affinity is available/wanted
@@ -100,11 +117,12 @@ PTLLNDCPPFLAGS=""
 if test $ENABLEPORTALS -eq 0; then
        AC_MSG_RESULT([no])
 elif test ! \( -f ${PORTALS}/include/portals/p30.h \); then
-        AC_MSG_RESULT([no])
+       AC_MSG_RESULT([no])
        AC_MSG_ERROR([bad --with-portals path])
 else
-        AC_MSG_RESULT([$PORTALS])
-        PTLLNDCPPFLAGS="-I${PORTALS}/include"
+       PORTALS=$(readlink --canonicalize $PORTALS)
+       AC_MSG_RESULT([$PORTALS])
+       PTLLNDCPPFLAGS="-I${PORTALS}/include"
 fi
 AC_SUBST(PTLLNDCPPFLAGS)
 ])
@@ -230,6 +248,7 @@ if test -d $QSNET/drivers/net/qsnet ; then
        QSWLND="qswlnd"
        AC_MSG_CHECKING([for multirail EKC])
        if test -f $QSNET/include/elan/epcomms.h; then
+               QSNET=$(readlink --canonicalize $QSNET)
                AC_MSG_RESULT([supported])
                QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
        else
@@ -255,106 +274,6 @@ AC_SUBST(QSWCPPFLAGS)
 AC_SUBST(QSWLND)
 ])
 
-#
-# LN_CONFIG_GM
-#
-# check if GM support is available
-#
-AC_DEFUN([LN_CONFIG_GM],[
-AC_MSG_CHECKING([whether to enable GM support])
-AC_ARG_WITH([gm],
-        AC_HELP_STRING([--with-gm=path-to-gm-source-tree],
-                      [build gmlnd against path]),
-       [
-               case $with_gm in
-                no)    ENABLE_GM=0
-                      ;;
-                *)     ENABLE_GM=1
-                       GM_SRC="$with_gm"
-                      ;;
-                esac
-        ],[
-                ENABLE_GM=0
-        ])
-AC_ARG_WITH([gm-install],
-        AC_HELP_STRING([--with-gm-install=path-to-gm-install-tree],
-                      [say where GM has been installed]),
-       [
-               GM_INSTALL=$with_gm_install
-        ],[
-                GM_INSTALL="/opt/gm"
-        ])
-if test $ENABLE_GM -eq 0; then
-        AC_MSG_RESULT([no])
-else
-        AC_MSG_RESULT([yes])
-
-       GMLND="gmlnd"
-        GMCPPFLAGS="-I$GM_SRC/include -I$GM_SRC/drivers -I$GM_SRC/drivers/linux/gm"
-
-       if test -f $GM_INSTALL/lib/libgm.a -o \
-                -f $GM_INSTALL/lib64/libgm.a; then
-               GMLIBS="-L$GM_INSTALL/lib -L$GM_INSTALL/lib64"
-        else
-               AC_MSG_ERROR([Cant find GM libraries under $GM_INSTALL])
-        fi
-
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$GMCPPFLAGS -DGM_KERNEL $EXTRA_KCFLAGS"
-
-        AC_MSG_CHECKING([that code using GM compiles with given path])
-       LB_LINUX_TRY_COMPILE([
-               #define GM_STRONG_TYPES 1
-               #ifdef VERSION
-               #undef VERSION
-               #endif
-               #include "gm.h"
-               #include "gm_internal.h"
-        ],[
-               struct gm_port *port = NULL;
-               gm_recv_event_t *rxevent = gm_blocking_receive_no_spin(port);
-                return 0;
-        ],[
-               AC_MSG_RESULT([yes])
-        ],[
-               AC_MSG_RESULT([no])
-               AC_MSG_ERROR([Bad --with-gm path])
-        ])
-
-       AC_MSG_CHECKING([that GM has gm_register_memory_ex_phys()])
-       LB_LINUX_TRY_COMPILE([
-               #define GM_STRONG_TYPES 1
-               #ifdef VERSION
-               #undef VERSION
-               #endif
-               #include "gm.h"
-               #include "gm_internal.h"
-       ],[
-               gm_status_t     gmrc;
-               struct gm_port *port = NULL;
-               gm_u64_t        phys = 0;
-               gm_up_t         pvma = 0;
-
-               gmrc = gm_register_memory_ex_phys(port, phys, 100, pvma);
-               return 0;
-       ],[
-               AC_MSG_RESULT([yes])
-       ],[
-               AC_MSG_RESULT([no.
-Please patch the GM sources as follows...
-    cd $GM_SRC
-    patch -p0 < $PWD/lnet/klnds/gmlnd/gm-reg-phys.patch
-...then rebuild and re-install them])
-                AC_MSG_ERROR([Can't build GM without gm_register_memory_ex_phys()])
-        ])
-
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
-AC_SUBST(GMCPPFLAGS)
-AC_SUBST(GMLIBS)
-AC_SUBST(GMLND)
-])
-
 
 #
 # LN_CONFIG_MX
@@ -392,6 +311,7 @@ elif test ! \( -f ${MXPATH}/include/myriexpress.h -a \
        *) AC_MSG_ERROR([internal error]);;
        esac
 else
+       MXPATH=$(readlink --canonicalize $MXPATH)
        MXCPPFLAGS="-I$MXPATH/include"
        EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
        EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
@@ -439,6 +359,7 @@ AC_SUBST(MXLND)
 # LN_CONFIG_O2IB
 #
 AC_DEFUN([LN_CONFIG_O2IB],[
+
 AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
 # set default
 AC_ARG_WITH([o2ib],
@@ -468,6 +389,11 @@ else
                           -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
                           -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
                           -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
+                       if test \( -d ${O2IBPATH}/kernel_patches -a \
+                                  -f ${O2IBPATH}/Makefile \); then
+                               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%-*}])
+                       fi
                        o2ib_found=true
                        break
                fi
@@ -481,6 +407,7 @@ else
                        *) AC_MSG_ERROR([internal error]);;
                esac
        else
+               O2IBPATH=$(readlink --canonicalize $O2IBPATH)
                O2IBCPPFLAGS="-I$O2IBPATH/include"
                EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
                EXTRA_KCFLAGS="$EXTRA_KCFLAGS $O2IBCPPFLAGS"
@@ -489,23 +416,20 @@ else
                LB_LINUX_TRY_COMPILE([
                        #include <linux/version.h>
                        #include <linux/pci.h>
-                       #if !HAVE_GFP_T
-                       typedef int gfp_t;
-                       #endif
+                       #include <linux/gfp.h>
                        #include <rdma/rdma_cm.h>
                        #include <rdma/ib_cm.h>
                        #include <rdma/ib_verbs.h>
                        #include <rdma/ib_fmr_pool.h>
                ],[
-                       struct rdma_cm_id          *cm_id;
-                       struct rdma_conn_param      conn_param;
-                       struct ib_device_attr       device_attr;
-                       struct ib_qp_attr           qp_attr;
-                       struct ib_pool_fmr          pool_fmr;
-                       enum   ib_cm_rej_reason     rej_reason;
-
-                       cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP);
-                       return PTR_ERR(cm_id);
+                       struct rdma_cm_id      *cm_idi __attribute__ ((unused));
+                       struct rdma_conn_param  conn_param __attribute__ ((unused));
+                       struct ib_device_attr   device_attr __attribute__ ((unused));
+                       struct ib_qp_attr       qp_attr __attribute__ ((unused));
+                       struct ib_pool_fmr      pool_fmr __attribute__ ((unused));
+                       enum   ib_cm_rej_reason rej_reason __attribute__ ((unused));
+
+                       rdma_destroy_id(NULL);
                ],[
                        AC_MSG_RESULT([yes])
                        O2IBLND="o2iblnd"
@@ -553,313 +477,22 @@ fi
 AC_SUBST(EXTRA_LNET_INCLUDE)
 AC_SUBST(O2IBCPPFLAGS)
 AC_SUBST(O2IBLND)
-])
 
-#
-# LN_CONFIG_OPENIB
-#
-# check for OpenIB in the kernel
-AC_DEFUN([LN_CONFIG_OPENIB],[
-AC_MSG_CHECKING([whether to enable OpenIB support])
-# set default
-OPENIBPATH="$LINUX/drivers/infiniband"
-AC_ARG_WITH([openib],
-       AC_HELP_STRING([--with-openib=path],
-                      [build openiblnd against path]),
-       [
-               case $with_openib in
-               yes)    ENABLEOPENIB=2
-                       ;;
-               no)     ENABLEOPENIB=0
-                       ;;
-               *)      OPENIBPATH="$with_openib"
-                       ENABLEOPENIB=3
-                       ;;
-               esac
-       ],[
-               ENABLEOPENIB=1
-       ])
-if test $ENABLEOPENIB -eq 0; then
-       AC_MSG_RESULT([disabled])
-elif test ! \( -f ${OPENIBPATH}/include/ts_ib_core.h -a \
-               -f ${OPENIBPATH}/include/ts_ib_cm.h -a \
-              -f ${OPENIBPATH}/include/ts_ib_sa_client.h \); then
-       AC_MSG_RESULT([no])
-       case $ENABLEOPENIB in
-       1) ;;
-       2) AC_MSG_ERROR([kernel OpenIB headers not present]);;
-       3) AC_MSG_ERROR([bad --with-openib path]);;
-       *) AC_MSG_ERROR([internal error]);;
-       esac
-else
-       case $ENABLEOPENIB in
-       1|2) OPENIBCPPFLAGS="-I$OPENIBPATH/include -DIN_TREE_BUILD";;
-       3)   OPENIBCPPFLAGS="-I$OPENIBPATH/include";;
-       *)   AC_MSG_RESULT([no])
-            AC_MSG_ERROR([internal error]);;
-       esac
-       OPENIBCPPFLAGS="$OPENIBCPPFLAGS -DIB_NTXRXPARAMS=4"
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
+# In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
+if test $ENABLEO2IB -ne 0; then
+       AC_MSG_CHECKING([if rdma_create_id wants four args])
        LB_LINUX_TRY_COMPILE([
-               #include <ts_ib_core.h>
-               #include <ts_ib_cm.h>
-               #include <ts_ib_sa_client.h>
+               #include <rdma/rdma_cm.h>
        ],[
-               struct ib_device_properties dev_props;
-               struct ib_cm_active_param   cm_active_params;
-               tTS_IB_CLIENT_QUERY_TID     tid;
-               int                         enum1 = IB_QP_ATTRIBUTE_STATE;
-               int                         enum2 = IB_ACCESS_LOCAL_WRITE;
-               int                         enum3 = IB_CQ_CALLBACK_INTERRUPT;
-               int                         enum4 = IB_CQ_PROVIDER_REARM;
-               return 0;
+               rdma_create_id(NULL, NULL, 0, 0);
        ],[
                AC_MSG_RESULT([yes])
-               OPENIBLND="openiblnd"
-       ],[
-               AC_MSG_RESULT([no])
-               case $ENABLEOPENIB in
-               1) ;;
-               2) AC_MSG_ERROR([can't compile with kernel OpenIB headers]);;
-               3) AC_MSG_ERROR([can't compile with OpenIB headers under $OPENIBPATH]);;
-               *) AC_MSG_ERROR([internal error]);;
-               esac
-               OPENIBLND=""
-               OPENIBCPPFLAGS=""
-       ])
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
-AC_SUBST(OPENIBCPPFLAGS)
-AC_SUBST(OPENIBLND)
-])
-
-#
-# LN_CONFIG_CIBLND
-#
-AC_DEFUN([LN_CONFIG_CIB],[
-AC_MSG_CHECKING([whether to enable Cisco/TopSpin IB support])
-# set default
-CIBPATH=""
-CIBLND=""
-AC_ARG_WITH([cib],
-       AC_HELP_STRING([--with-cib=path],
-                      [build ciblnd against path]),
-       [
-               case $with_cib in
-               no)     AC_MSG_RESULT([no]);;
-               *)      CIBPATH="$with_cib"
-                       if test -d "$CIBPATH"; then
-                               AC_MSG_RESULT([yes])
-                        else
-                               AC_MSG_RESULT([no])
-                               AC_MSG_ERROR([No directory $CIBPATH])
-                       fi;;
-               esac
+               AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
+                       [rdma_create_id wants 4 args])
        ],[
                AC_MSG_RESULT([no])
        ])
-if test -n "$CIBPATH"; then
-       CIBCPPFLAGS="-I${CIBPATH}/ib/ts_api_ng/include -I${CIBPATH}/all/kernel_services/include -DUSING_TSAPI"
-       CIBCPPFLAGS="$CIBCPPFLAGS -DIB_NTXRXPARAMS=3"
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $CIBCPPFLAGS"
-       LB_LINUX_TRY_COMPILE([
-               #include <ts_ib_core.h>
-               #include <ts_ib_cm.h>
-               #include <ts_ib_sa_client.h>
-       ],[
-               struct ib_device_properties dev_props;
-               struct ib_cm_active_param   cm_active_params;
-               tTS_IB_CLIENT_QUERY_TID     tid;
-               int                         enum1 = TS_IB_QP_ATTRIBUTE_STATE;
-               int                         enum2 = TS_IB_ACCESS_LOCAL_WRITE;
-               int                         enum3 = TS_IB_CQ_CALLBACK_INTERRUPT;
-               int                         enum4 = TS_IB_CQ_PROVIDER_REARM;
-               return 0;
-       ],[
-               CIBLND="ciblnd"
-       ],[
-               AC_MSG_ERROR([can't compile ciblnd with given path])
-               CIBCPPFLAGS=""
-       ])
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
 fi
-AC_SUBST(CIBCPPFLAGS)
-AC_SUBST(CIBLND)
-])
-
-#
-# LN_CONFIG_IIB
-#
-# check for infinicon infiniband support
-#
-AC_DEFUN([LN_CONFIG_IIB],[
-AC_MSG_CHECKING([whether to enable Infinicon support])
-# set default
-IIBPATH="/usr/include"
-AC_ARG_WITH([iib],
-       AC_HELP_STRING([--with-iib=path],
-                      [build iiblnd against path]),
-       [
-               case $with_iib in
-               yes)    ENABLEIIB=2
-                       ;;
-               no)     ENABLEIIB=0
-                       ;;
-               *)      IIBPATH="${with_iib}/include"
-                       ENABLEIIB=3
-                       ;;
-               esac
-       ],[
-               ENABLEIIB=1
-       ])
-if test $ENABLEIIB -eq 0; then
-       AC_MSG_RESULT([disabled])
-elif test ! \( -f ${IIBPATH}/linux/iba/ibt.h \); then
-       AC_MSG_RESULT([no])
-       case $ENABLEIIB in
-       1) ;;
-       2) AC_MSG_ERROR([default Infinicon headers not present]);;
-       3) AC_MSG_ERROR([bad --with-iib path]);;
-       *) AC_MSG_ERROR([internal error]);;
-       esac
-else
-       IIBCPPFLAGS="-I$IIBPATH"
-       if test $IIBPATH != "/usr/include"; then
-               # we need /usr/include come what may
-               IIBCPPFLAGS="$IIBCPPFLAGS -I/usr/include"
-        fi
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/iba/ibt.h>
-       ],[
-               IBT_INTERFACE_UNION interfaces;
-               FSTATUS             rc;
-
-                rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
-                                              &interfaces);
-
-               return rc == FSUCCESS ? 0 : 1;
-       ],[
-               AC_MSG_RESULT([yes])
-               IIBLND="iiblnd"
-       ],[
-               AC_MSG_RESULT([no])
-               case $ENABLEIIB in
-               1) ;;
-               2) AC_MSG_ERROR([can't compile with default Infinicon headers]);;
-               3) AC_MSG_ERROR([can't compile with Infinicon headers under $IIBPATH]);;
-               *) AC_MSG_ERROR([internal error]);;
-               esac
-               IIBLND=""
-               IIBCPPFLAGS=""
-       ])
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
-AC_SUBST(IIBCPPFLAGS)
-AC_SUBST(IIBLND)
-])
-
-#
-# LN_CONFIG_VIB
-#
-# check for Voltaire infiniband support
-#
-AC_DEFUN([LN_CONFIG_VIB],
-[AC_MSG_CHECKING([whether to enable Voltaire IB support])
-VIBPATH=""
-AC_ARG_WITH([vib],
-       AC_HELP_STRING([--with-vib=path],
-                      [build viblnd against path]),
-       [
-               case $with_vib in
-               no)     AC_MSG_RESULT([no]);;
-               *)      VIBPATH="${with_vib}/src/nvigor/ib-code"
-                       if test -d "$with_vib" -a -d "$VIBPATH"; then
-                               AC_MSG_RESULT([yes])
-                       else
-                               AC_MSG_RESULT([no])
-                               AC_MSG_ERROR([No directory $VIBPATH])
-                        fi;;
-               esac
-       ],[
-               AC_MSG_RESULT([no])
-       ])
-if test -z "$VIBPATH"; then
-       VIBLND=""
-else
-       VIBCPPFLAGS="-I${VIBPATH}/include -I${VIBPATH}/cm"
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/list.h>
-               #include <asm/byteorder.h>
-               #ifdef __BIG_ENDIAN
-               # define CPU_BE 1
-                # define CPU_LE 0
-               #endif
-               #ifdef __LITTLE_ENDIAN
-               # define CPU_BE 0
-               # define CPU_LE 1
-               #endif
-               #include <vverbs.h>
-               #include <ib-cm.h>
-               #include <ibat.h>
-       ],[
-               vv_hca_h_t       kib_hca;
-               vv_return_t      vvrc;
-               cm_cep_handle_t  cep;
-               ibat_arp_data_t  arp_data;
-               ibat_stat_t      ibatrc;
-
-               vvrc = vv_hca_open("ANY_HCA", NULL, &kib_hca);
-               cep = cm_create_cep(cm_cep_transp_rc);
-               ibatrc = ibat_get_ib_data((uint32_t)0, (uint32_t)0,
-                                          ibat_paths_primary, &arp_data,
-                                         (ibat_get_ib_data_reply_fn_t)NULL,
-                                          NULL, 0);
-               return 0;
-       ],[
-               VIBLND="viblnd"
-       ],[
-               AC_MSG_ERROR([can't compile viblnd with given path])
-       ])
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
-if test -n "$VIBLND"; then
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
-       AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/list.h>
-               #include <asm/byteorder.h>
-               #ifdef __BIG_ENDIAN
-               # define CPU_BE 1
-                # define CPU_LE 0
-               #endif
-               #ifdef __LITTLE_ENDIAN
-               # define CPU_BE 0
-               # define CPU_LE 1
-               #endif
-               #include <vverbs.h>
-               #include <ib-cm.h>
-               #include <ibat.h>
-       ],[
-               vv_scatgat_t  sg;
-
-               return &sg.v_address[3] == NULL;
-       ],[
-               AC_MSG_RESULT([yes])
-               VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_VOIDSTAR_SGADDR=1"
-       ],[
-               AC_MSG_RESULT([no])
-       ])
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
-AC_SUBST(VIBCPPFLAGS)
-AC_SUBST(VIBLND)
 ])
 
 #
@@ -897,61 +530,160 @@ AC_SUBST(RACPPFLAGS)
 AC_SUBST(RALND)
 ])
 
-
 #
-# LN_FUNC_DUMP_TRACE
+# LN_CONFIG_GNILND
 #
-# 2.6.23 exports dump_trace() so we can dump_stack() on any task
-# 2.6.24 has stacktrace_ops.address with "reliable" parameter
+# check whether to use the Gemini Network Interface lnd
 #
-AC_DEFUN([LN_FUNC_DUMP_TRACE],
-[LB_CHECK_SYMBOL_EXPORT([dump_trace],
-[kernel/ksyms.c arch/${LINUX_ARCH%_64}/kernel/traps_64.c],[
-       AC_DEFINE(HAVE_DUMP_TRACE, 1, [dump_trace is exported])
-       AC_MSG_CHECKING([whether print_trace_address has reliable argument])
-       tmp_flags="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="-Werror"
+AC_DEFUN([LN_CONFIG_GNILND],
+[#### Gemini Network Interface
+AC_MSG_CHECKING([whether to enable GNI lnd])
+AC_ARG_ENABLE([gni],
+       AC_HELP_STRING([--enable-gni],
+                       [enable GNI lnd]),
+       [],[enable_gni='no'])
+AC_MSG_RESULT([$enable_gni])
+
+if test x$enable_gni = xyes ; then
+       AC_MSG_CHECKING([if GNI kernel headers are present])
+       # placeholder
+       # GNICPPFLAGS was set in spec file
+       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
        LB_LINUX_TRY_COMPILE([
-               struct task_struct;
-               struct pt_regs;
-               void print_addr(void *data, unsigned long addr, int reliable);
-               #include <asm/stacktrace.h>
+               #include <linux/types.h>
+               #include <gni_pub.h>
        ],[
-               struct stacktrace_ops ops;
+               gni_cdm_handle_t        kgni_domain;
+               gni_return_t            rc;
+               int                     rrc;
+
+               rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
+
+               rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
 
-               ops.address = print_addr;
+               return rrc;
+       ],[
+               AC_MSG_RESULT([yes])
+               GNILND="gnilnd"
+       ],[
+               AC_MSG_RESULT([no])
+               AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
+       ])
+       # at this point, we have gnilnd basic support, now check for extra features
+       AC_MSG_CHECKING([to use RCA in gnilnd])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/types.h>
+               #include <gni_pub.h>
+               #include <krca_lib.h>
        ],[
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_TRACE_ADDRESS_RELIABLE, 1,
-                         [print_trace_address has reliable argument])
+               gni_cdm_handle_t        kgni_domain;
+               gni_return_t            rc;
+               krca_ticket_t           ticket = KRCA_NULL_TICKET;
+               int                     rrc;
+               __u32                   nid = 0, nic_addr;
+
+               rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
+
+               rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
+
+               rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
+
+               rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
+
+               return rrc;
        ],[
-               AC_MSG_RESULT(no)
+               AC_MSG_RESULT([yes])
+               GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
+               GNILNDRCA="gnilndrca"
        ],[
+               AC_MSG_RESULT([no])
        ])
-EXTRA_KCFLAGS="$tmp_flags"
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
+fi
+AC_SUBST(GNICPPFLAGS)
+AC_SUBST(GNILNDRCA)
+AC_SUBST(GNILND)
+])
+
+
+#
+#
+# LN_CONFIG_USERSPACE
+#
+# This is defined but empty because it is called from
+# build/autconf/lustre-build.m4 which is shared by all branches.
+#
+AC_DEFUN([LN_CONFIG_USERSPACE],
+[
+])
+
+# See if sysctl proc_handler wants only 5 arguments (since 2.6.32)
+AC_DEFUN([LN_5ARGS_SYSCTL_PROC_HANDLER],
+[AC_MSG_CHECKING([if sysctl proc_handler wants 5 args])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/sysctl.h>
+],[
+        struct ctl_table *table = NULL;
+        int write = 1;
+        void __user *buffer = NULL;
+        size_t *lenp = NULL;
+        loff_t *ppos = NULL;
+
+        proc_handler *proc_handler = NULL;
+        proc_handler(table, write, buffer, lenp, ppos);
+
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_5ARGS_SYSCTL_PROC_HANDLER, 1,
+                  [sysctl proc_handler wants 5 args])
+],[
+        AC_MSG_RESULT(no)
 ])
 ])
 
 #
+# 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
+#
+AC_DEFUN([LN_CONFIG_TCP_SENDPAGE],
+[AC_MSG_CHECKING([if tcp_sendpage first parameter is socket])
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_LINUX_TRY_COMPILE([
+        #include <linux/net.h>
+        #include <net/tcp.h>
+],[
+        tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
+                  [tcp_sendpage use socket as first parameter])
+],[
+        AC_MSG_RESULT(no)
+])
+EXTRA_KCFLAGS="$tmp_flags"
+])
+
+#
 # LN_PROG_LINUX
 #
 # LNet linux kernel checks
 #
 AC_DEFUN([LN_PROG_LINUX],
 [
+LN_FUNC_DEV_GET_BY_NAME_2ARG
 LN_CONFIG_AFFINITY
 LN_CONFIG_BACKOFF
 LN_CONFIG_QUADRICS
-LN_CONFIG_GM
-LN_CONFIG_OPENIB
-LN_CONFIG_CIB
-LN_CONFIG_VIB
-LN_CONFIG_IIB
 LN_CONFIG_O2IB
 LN_CONFIG_RALND
+LN_CONFIG_GNILND
 LN_CONFIG_PTLLND
 LN_CONFIG_MX
-LN_FUNC_DUMP_TRACE
+# 2.6.32
+LN_5ARGS_SYSCTL_PROC_HANDLER
+# 2.6.36
+LN_CONFIG_TCP_SENDPAGE
 ])
 
 #
@@ -985,11 +717,6 @@ AC_CHECK_FUNCS([gethostbyname socket connect])
 # lnet/utils/debug.c
 AC_CHECK_HEADERS([linux/version.h])
 
-AC_CHECK_TYPE([spinlock_t],
-       [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
-       [],
-       [#include <linux/spinlock.h>])
-
 # lnet/utils/wirecheck.c
 AC_CHECK_FUNCS([strnlen])
 
@@ -1090,16 +817,12 @@ LN_CONFIG_USOCKLND
 #
 AC_DEFUN([LN_CONDITIONALS],
 [AM_CONDITIONAL(BUILD_QSWLND, test x$QSWLND = "xqswlnd")
-AM_CONDITIONAL(BUILD_GMLND, test x$GMLND = "xgmlnd")
 AM_CONDITIONAL(BUILD_MXLND, test x$MXLND = "xmxlnd")
 AM_CONDITIONAL(BUILD_O2IBLND, test x$O2IBLND = "xo2iblnd")
-AM_CONDITIONAL(BUILD_OPENIBLND, test x$OPENIBLND = "xopeniblnd")
-AM_CONDITIONAL(BUILD_CIBLND, test x$CIBLND = "xciblnd")
-AM_CONDITIONAL(BUILD_IIBLND, test x$IIBLND = "xiiblnd")
-AM_CONDITIONAL(BUILD_VIBLND, test x$VIBLND = "xviblnd")
 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_PTLLND, test x$PTLLND = "xptllnd")
-AM_CONDITIONAL(BUILD_UPTLLND, test x$UPTLLND = "xptllnd")
 AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
 ])
 
@@ -1120,24 +843,16 @@ lnet/include/lnet/Makefile
 lnet/include/lnet/linux/Makefile
 lnet/klnds/Makefile
 lnet/klnds/autoMakefile
-lnet/klnds/gmlnd/Makefile
 lnet/klnds/mxlnd/autoMakefile
 lnet/klnds/mxlnd/Makefile
-lnet/klnds/gmlnd/autoMakefile
-lnet/klnds/openiblnd/Makefile
-lnet/klnds/openiblnd/autoMakefile
 lnet/klnds/o2iblnd/Makefile
 lnet/klnds/o2iblnd/autoMakefile
-lnet/klnds/ciblnd/Makefile
-lnet/klnds/ciblnd/autoMakefile
-lnet/klnds/iiblnd/Makefile
-lnet/klnds/iiblnd/autoMakefile
-lnet/klnds/viblnd/Makefile
-lnet/klnds/viblnd/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
 lnet/klnds/socklnd/autoMakefile
 lnet/klnds/ptllnd/Makefile
@@ -1149,14 +864,7 @@ lnet/selftest/autoMakefile
 lnet/ulnds/Makefile
 lnet/ulnds/autoMakefile
 lnet/ulnds/socklnd/Makefile
-lnet/ulnds/ptllnd/Makefile
 lnet/utils/Makefile
-])
-case $lb_target_os in
-       darwin)
-               AC_CONFIG_FILES([
 lnet/include/lnet/darwin/Makefile
 ])
-               ;;
-esac
 ])