Whamcloud - gitweb
LU-15888 build: Debian dkms-debs requires ed and libkeyutils
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
index 909cc7e..90b7700 100644 (file)
@@ -1,53 +1,3 @@
-#
-# LN_CHECK_GCC_VERSION
-#
-# Check compiler version
-#
-AC_DEFUN([LN_CHECK_GCC_VERSION], [
-AC_MSG_CHECKING([compiler version])
-PTL_CC_VERSION=`$CC --version | awk '/^gcc/{print $ 3}'`
-PTL_MIN_CC_VERSION="3.2.2"
-v2n() {
-       awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
-}
-if test -z "$PTL_CC_VERSION" -o \
-       $(echo $PTL_CC_VERSION | v2n) -ge $(echo $PTL_MIN_CC_VERSION | v2n); then
-       AC_MSG_RESULT([ok])
-else
-       AC_MSG_RESULT([Buggy compiler found])
-       AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
-fi
-]) # LN_CHECK_GCC_VERSION
-
-#
-# LN_CONFIG_AFFINITY
-#
-# check if cpu affinity is available/wanted
-#
-AC_DEFUN([LN_CONFIG_AFFINITY], [
-AC_MSG_CHECKING([whether to enable CPU affinity support])
-AC_ARG_ENABLE([affinity],
-       AC_HELP_STRING([--disable-affinity],
-               [disable process/irq affinity]),
-       [], [enable_affinity="yes"])
-AC_MSG_RESULT([$enable_affinity])
-AS_IF([test "x$enable_affinity" = xyes], [
-       LB_CHECK_COMPILE([if Linux kernel has cpu affinity support],
-       set_cpus_allowed_ptr, [
-               #include <linux/sched.h>
-       ],[
-               struct task_struct *t = NULL;
-               cpumask_t m = { };
-
-               set_cpus_allowed_ptr(t, &m);
-       ],[
-               AC_DEFINE(CPU_AFFINITY, 1,
-                       [kernel has cpu affinity support])
-       ])
-])
-]) # LN_CONFIG_AFFINITY
-
-#
 # LN_CONFIG_BACKOFF
 #
 # check if tunable tcp backoff is available/wanted
@@ -55,7 +5,7 @@ AS_IF([test "x$enable_affinity" = xyes], [
 AC_DEFUN([LN_CONFIG_BACKOFF], [
 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
 AC_ARG_ENABLE([backoff],
-       AC_HELP_STRING([--disable-backoff],
+       AS_HELP_STRING([--disable-backoff],
                [disable socknal tunable backoff]),
        [], [enable_backoff="yes"])
 AC_MSG_RESULT([$enable_backoff])
@@ -81,10 +31,12 @@ AS_IF([test "x$enable_backoff" = xyes], [
 # fail to build if libyaml is not installed
 #
 AC_DEFUN([LN_CONFIG_DLC], [
-       AC_CHECK_LIB([yaml], [yaml_parser_initialize],
-                    [LIBYAML="libyaml"],
-                    [AC_MSG_ERROR([YAML development libraries not not installed])],
-                    [-lm])
+       AS_IF([test "x$enable_dist" = xno], [
+               AC_CHECK_LIB([yaml], [yaml_parser_initialize],
+                            [LIBYAML="libyaml"],
+                            [AC_MSG_ERROR([YAML development libraries not not installed])],
+                            [-lm])
+       ])
 ])
 
 #
@@ -101,7 +53,7 @@ AC_DEFUN([LN_CONFIG_DLC], [
 AC_DEFUN([LN_CONFIG_O2IB], [
 AC_MSG_CHECKING([whether to use Compat RDMA])
 AC_ARG_WITH([o2ib],
-       AC_HELP_STRING([--with-o2ib=[yes|no|<path>]],
+       AS_HELP_STRING([--with-o2ib=[yes|no|<path>]],
                [build o2iblnd against path]),
        [], [with_o2ib="yes"])
 
@@ -114,7 +66,9 @@ case $with_o2ib in
                                OFED_INFO="ofed_info"
                                LSPKG="rpm -ql"
                        ])
-                       O2IBPATHS=$(eval $OFED_INFO | egrep -w 'mlnx-ofed-kernel-dkms|mlnx-ofa_kernel-devel|compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs $LSPKG | grep '\(/openib\|/ofa_kernel/default\)$' | head -n1)
+                       O2IBPATHS=$(eval $OFED_INFO |
+                                   egrep -w 'mlnx-ofed-kernel-dkms|mlnx-ofa_kernel-devel|compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' |
+                                   xargs $LSPKG | grep -v 'ofa_kernel-' | grep rdma_cm.h | sed 's/\/include\/rdma\/rdma_cm.h//')
                        AS_IF([test -z "$O2IBPATHS"], [
                                AC_MSG_ERROR([
 You seem to have an OFED installed but have not installed it's devel package.
@@ -126,9 +80,14 @@ Instead, if you want to build Lustre for your kernel's built-in I/B stack rather
                                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.
+Instead, if you want to build Lustre for your in-kernel I/B stack rather than your installed external OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
                                             ])
                        ])
+                       if test -e $O2IBPATHS/${LINUXRELEASE}; then
+                           O2IBPATHS=$O2IBPATHS/${LINUXRELEASE}
+                       elif test -e $O2IBPATHS/default; then
+                           O2IBPATHS=$O2IBPATHS/default
+                       fi
                        OFED="yes"
                ], [
                        O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
@@ -145,13 +104,14 @@ esac
 
 AS_IF([test $ENABLEO2IB = "no"], [
        AC_MSG_RESULT([no])
+       AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
+       AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
 ], [
        o2ib_found=false
        for O2IBPATH in $O2IBPATHS; do
                AS_IF([test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
                           -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
-                          -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
-                          -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [
+                          -f ${O2IBPATH}/include/rdma/ib_verbs.h \)], [
                        o2ib_found=true
                        break
                ])
@@ -228,13 +188,11 @@ AS_IF([test $ENABLEO2IB = "no"], [
                        #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_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);
                ],[
@@ -248,21 +206,20 @@ AS_IF([test $ENABLEO2IB = "no"], [
                ])
                # we know at this point that the found OFED source is good
                O2IB_SYMVER=""
-               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
-                                       O2IB_SYMVER=$name;
-                                       break;
-                               fi
-                       done
-                       if test -n "$O2IB_SYMVER"; then
-                               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, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
-                       fi
+               if test -f $O2IBPATH/Module.symvers; then
+                       O2IB_SYMVER=$O2IBPATH/Module.symvers
+               elif test "x$SUSE_KERNEL" = "xyes"; then
+                       O2IB_SYMVER=$(find ${O2IBPATH}* -name Module.symvers)
+               elif test -f $LINUX_OBJ/Module.symvers; then
+                       # Debian symvers is in the arch tree
+                       O2IB_SYMVER=$LINUX_OBJ/Module.symvers
+               fi
+               if test -n "$O2IB_SYMVER"; then
+                       AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
+                       EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
+                       AC_SUBST(EXTRA_SYMBOLS)
+               else
+                       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
 
                LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
@@ -297,6 +254,7 @@ AC_SUBST(ENABLEO2IB)
 
 AS_IF([test $ENABLEO2IB != "no"], [
        EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
+       KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers"
 
        # 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],
@@ -535,7 +493,101 @@ AS_IF([test $ENABLEO2IB != "no"], [
                          [function ib_inc_rkey exist])
        ])
 
+       # In MOFED 4.6, the second and third parameters for
+       # ib_post_send() and ib_post_recv() are declared with
+       # 'const'.
+       tmp_flags="$EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="-Werror"
+       LB_CHECK_COMPILE([if 'ib_post_send() and ib_post_recv()' have const parameters],
+       ib_post_send_recv_const, [
+               #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_post_send(NULL, (const struct ib_send_wr *)NULL,
+                            (const struct ib_send_wr **)NULL);
+       ],[
+               AC_DEFINE(HAVE_IB_POST_SEND_RECV_CONST, 1,
+                       [ib_post_send and ib_post_recv have const parameters])
+       ])
+       EXTRA_KCFLAGS="$tmp_flags"
+
+       # 5.0
+       LN_IB_DEVICE_OPS_EXISTS
+       # 5.1
+       LN_IB_SG_DMA_ADDRESS_EXISTS
+
+       # A reason argument was added to rdma_reject() in Linux 5.8,
+       # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
+       LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
+       rdma_reject, [
+               #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>
+               #include <rdma/ib_cm.h>
+               #include <rdma/rdma_cm.h>
+       ],[
+               rdma_reject(NULL, NULL, 0, 0);
+       ],[
+               AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
+                       [rdma_reject has 4 arguments])
+       ])
+
+       # The FMR pool API was removed in Linux 5.8,
+       # commit 4e373d5417ecbb4f438a8500f0379a2fc29c2643
+       LB_CHECK_COMPILE([if FMR pools API available],
+       ib_fmr, [
+               #include <rdma/ib_verbs.h>
+       ],[
+               struct ib_fmr fmr = {};
+       ],[
+               AC_DEFINE(HAVE_FMR_POOL_API, 1,
+                       [FMR pool API is available])
+       ])
+
+       # rdma_connect_locked() was added in Linux 5.10,
+       # commit 071ba4cc559de47160761b9500b72e8fa09d923d
+       # and in MOFED-5.2-2. rdma_connect_locked() must
+       # be called instead of rdma_connect() in
+       # RDMA_CM_EVENT_ROUTE_RESOLVED handler.
+       LB_CHECK_COMPILE([if 'rdma_connect_locked' exists],
+       rdma_connect_locked, [
+               #include <rdma/rdma_cm.h>
+       ],[
+               rdma_connect_locked(NULL, NULL);
+       ],[
+               AC_DEFINE(HAVE_RDMA_CONNECT_LOCKED, 1,
+                       [rdma_connect_locked is defined])
+       ])
+
+       # ethtool_link_settings was added in Linux 4.6
+       LB_CHECK_COMPILE([if 'ethtool_link_settings' exists],
+       ethtool_link_settings, [
+               #include <linux/ethtool.h>
+       ],[
+               struct ethtool_link_ksettings cmd;
+       ],[
+               AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
+                       [ethtool_link_settings is defined])
+       ])
+
        EXTRA_CHECK_INCLUDE=""
+       AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
+       AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
 ]) # ENABLEO2IB != "no"
 ]) # LN_CONFIG_O2IB
 
@@ -547,7 +599,7 @@ AS_IF([test $ENABLEO2IB != "no"], [
 AC_DEFUN([LN_CONFIG_GNILND], [
 AC_MSG_CHECKING([whether to enable GNI lnd])
 AC_ARG_ENABLE([gni],
-       AC_HELP_STRING([--enable-gni],
+       AS_HELP_STRING([--enable-gni],
                [enable GNI lnd]),
        [], [enable_gni="no"])
 AC_MSG_RESULT([$enable_gni])
@@ -570,7 +622,7 @@ AS_IF([test "x$enable_gni" = xyes], [
        ],[
                GNILND="gnilnd"
        ],[
-               AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
+               AC_MSG_ERROR([cannot compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
        ])
        # at this point, we have gnilnd basic support,
        # now check for extra features
@@ -599,44 +651,24 @@ AC_SUBST(GNICPPFLAGS)
 AC_SUBST(GNILND)
 ]) # LN_CONFIG_GNILND
 
+# LN_CONFIG_STRSCPY_EXISTS
 #
-# LN_CONFIG_SK_SLEEP
-#
-# 2.6.35 kernel has sk_sleep function
-#
-AC_DEFUN([LN_CONFIG_SK_SLEEP], [
-LB_CHECK_COMPILE([if Linux kernel has 'sk_sleep'],
-sk_sleep, [
-       #include <net/sock.h>
-],[
-       sk_sleep(NULL);
-],[
-       AC_DEFINE(HAVE_SK_SLEEP, 1,
-                 [kernel has sk_sleep])
-])
-]) # LN_CONFIG_SK_SLEEP
-
+# If strscpy exists, prefer it over strlcpy
 #
-# LN_CONFIG_TCP_SENDPAGE
-#
-# 2.6.36 tcp_sendpage() first parameter is 'struct sock'
-# instead of 'struct socket'.
-#
-AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
+AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
 tmp_flags="$EXTRA_KCFLAGS"
 EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
-tcp_sendpage_socket, [
-       #include <linux/net.h>
-       #include <net/tcp.h>
+LB_CHECK_COMPILE([kernel strscpy is available],
+strscpy_exists, [
+       #include <linux/string.h>
 ],[
-       tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
+       strscpy((char *)NULL, (const char *)NULL, 0);
 ],[
-       AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
-               [tcp_sendpage use socket as first parameter])
+       AC_DEFINE(HAVE_STRSCPY, 1,
+               [kernel strscpy is available])
 ])
 EXTRA_KCFLAGS="$tmp_flags"
-]) # LN_CONFIG_TCP_SENDPAGE
+]) # LN_CONFIG_STRSCPY_EXISTS
 
 # LN_CONFIG_SOCK_CREATE_KERN
 #
@@ -692,25 +724,165 @@ LB_CHECK_EXPORT([kmap_to_page], [mm/highmem.c],
 ]) # LN_EXPORT_KMAP_TO_PAG
 
 #
-# LN_CONFIG_SOCK_ACCEPT
+# LN_HAVE_HYPERVISOR_IS_TYPE
 #
-# 4.11 commit cdfbabfb2f0ce983fdaa42f20e5f7842178fc01e added a flag
-# to handle a possible lockdep condition kernel socket accept.
+# 4.14 commit 79cc74155218316b9a5d28577c7077b2adba8e58
+# x86/paravirt: Provide a way to check for hypervisors
 #
-AC_DEFUN([LN_CONFIG_SOCK_ACCEPT], [
+AC_DEFUN([LN_HAVE_HYPERVISOR_IS_TYPE], [
 tmp_flags="$EXTRA_KCFLAGS"
 EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'struct sock' accept function requires a bool argument],
-kern_sock_flag, [
+LB_CHECK_COMPILE([if hypervisor_is_type function is available],
+hypervisor_is_type_exists, [
+       #include <asm/hypervisor.h>
+],[
+       (void)hypervisor_is_type(X86_HYPER_NATIVE);
+],[
+       AC_DEFINE(HAVE_HYPERVISOR_IS_TYPE, 1,
+               [hypervisor_is_type function exists])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_HAVE_HYPERVISOR_IS_TYPE
+
+#
+# LN_HAVE_ORACLE_OFED_EXTENSIONS
+#
+# Oracle UEK 5
+#
+AC_DEFUN([LN_HAVE_ORACLE_OFED_EXTENSIONS], [
+LB_CHECK_COMPILE([if Oracle OFED Extensions are enabled],
+oracle_ofed_ext, [
+       #include <rdma/ib_fmr_pool.h>
+],[
+       struct ib_fmr_pool_param param = {
+               .relaxed           = 0
+       };
+       (void)param;
+],[
+       AC_DEFINE(HAVE_ORACLE_OFED_EXTENSIONS, 1,
+               [if Oracle OFED Extensions are enabled])
+])
+]) # LN_HAVE_ORACLE_OFED_EXTENSIONS
+
+#
+# LN_CONFIG_SOCK_GETNAME
+#
+# 4.17 commit 9b2c45d479d0fb8647c9e83359df69162b5fbe5f getname()
+# does not take the length *int argument and returns the length
+#
+AC_DEFUN([LN_CONFIG_SOCK_GETNAME], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'getname' has two args],
+kern_sock_getname_2args, [
        #include <linux/net.h>
 ],[
-       ((struct socket *)0)->ops->accept(NULL, NULL, O_NONBLOCK, false);
+       kernel_getsockname(NULL, NULL);
 ],[
-       AC_DEFINE(HAVE_KERN_SOCK_ACCEPT_FLAG_ARG, 1,
-               ['struct sock' accept function requires bool argument])
+       AC_DEFINE(HAVE_KERN_SOCK_GETNAME_2ARGS, 1,
+               ['getname' has two args])
 ])
 EXTRA_KCFLAGS="$tmp_flags"
-]) # LN_CONFIG_SOCK_ACCEPT
+]) # LN_CONFIG_SOCK_GETNAME
+
+#
+# LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
+#
+# kernel 5.3 commit ef11db3310e272d3d8dbe8739e0770820dd20e52
+# and kernel 4.18.0-193.el8:
+# added in_dev_for_each_ifa_rtnl and in_dev_for_each_ifa_rcu
+# and removed for_ifa and endfor_ifa.
+# Use the _rntl variant as the current locking is rtnl.
+#
+AC_DEFUN([LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'in_dev_for_each_ifa_rtnl' is defined],
+in_dev_for_each_ifa_rtnl_test, [
+       #include <linux/inetdevice.h>
+],[
+       const struct in_ifaddr *ifa = NULL;
+       struct in_device *in_dev = NULL;
+
+       in_dev_for_each_ifa_rtnl(ifa, in_dev) {}
+],[
+       AC_DEFINE(HAVE_IN_DEV_FOR_EACH_IFA_RTNL, 1,
+               ['in_dev_for_each_ifa_rtnl' is defined])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
+
+#
+# LN_IB_DEVICE_OPS_EXISTS
+#
+# kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
+# RDMA/core: Introduce ib_device_ops
+# ... introduces the ib_device_ops structure that defines all the
+# InfiniBand device operations in one place ...
+#
+AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if struct ib_device_ops is defined],
+ib_device_ops_test, [
+       #include <rdma/ib_verbs.h>
+],[
+       int x = offsetof(struct ib_device_ops, unmap_fmr);
+       x = x;
+       (void)x;
+],[
+       AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
+               [if struct ib_device_ops is defined])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_IB_DEVICE_OPS_EXISTS
+
+#
+# LN_IB_SG_DMA_ADDRESS_EXISTS
+#
+# kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
+# IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
+# ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
+#
+AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
+ib_sg_dma_address_test, [
+       #include <rdma/ib_verbs.h>
+],[
+       u64 x = ib_sg_dma_address(NULL, NULL);
+       x = x;
+       (void)x;
+],[
+       AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
+               [if ib_sg_dma_address wrapper exists])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_IB_SG_DMA_ADDRESS_EXISTS
+
+#
+# LN_USR_RDMA
+#
+#
+AC_DEFUN([LN_USR_RDMA], [
+AC_MSG_CHECKING([if RDMA_PS_TCP exists])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+       #include <rdma/rdma_user_cm.h>
+
+       int main(void) {
+               int x = (int)RDMA_PS_TCP;
+               return x;
+       }
+])],[
+       AC_DEFINE(HAVE_USRSPC_RDMA_PS_TCP, 1,
+               [RDMA_PS_TCP exists])
+])
+]) # LN_USR_RDMA
+
+
+AC_DEFUN([LN_PROG_LINUX_SRC], [])
+AC_DEFUN([LN_PROG_LINUX_RESULTS], [])
 
 #
 # LN_PROG_LINUX
@@ -721,22 +893,23 @@ AC_DEFUN([LN_PROG_LINUX], [
 AC_MSG_NOTICE([LNet kernel checks
 ==============================================================================])
 
-LN_CONFIG_AFFINITY
 LN_CONFIG_BACKOFF
 LN_CONFIG_O2IB
 LN_CONFIG_GNILND
-# 2.6.35
-LN_CONFIG_SK_SLEEP
-# 2.6.36
-LN_CONFIG_TCP_SENDPAGE
+LN_CONFIG_STRSCPY_EXISTS
 # 3.10
 LN_EXPORT_KMAP_TO_PAGE
 # 3.15
 LN_CONFIG_SK_DATA_READY
 # 4.x
 LN_CONFIG_SOCK_CREATE_KERN
-# 4.11
-LN_CONFIG_SOCK_ACCEPT
+# 4.14
+LN_HAVE_HYPERVISOR_IS_TYPE
+LN_HAVE_ORACLE_OFED_EXTENSIONS
+# 4.17
+LN_CONFIG_SOCK_GETNAME
+# 5.3 and 4.18.0-193.el8
+LN_HAVE_IN_DEV_FOR_EACH_IFA_RTNL
 ]) # LN_PROG_LINUX
 
 #
@@ -756,6 +929,78 @@ AC_DEFUN([LN_CONFIGURE], [
 AC_MSG_NOTICE([LNet core checks
 ==============================================================================])
 
+AC_ARG_WITH([cuda],
+       AS_HELP_STRING([--with-cuda=path],
+                       [Use a CUDA sources.]),
+       [LB_ARG_CANON_PATH([cuda], [CUDA_PATH])],
+       [CUDA_PATH=`ls -d1 /usr/src/nvidia-*/nvidia/ | tail -1`]
+)
+
+AC_ARG_WITH([gds],
+       AS_HELP_STRING([--with-gds=path],
+                       [Use a gds sources.]),
+       [LB_ARG_CANON_PATH([gds], [GDS_PATH])],
+       [GDS_PATH=`ls -d1 /usr/src/nvidia-fs* | tail -1`]
+)
+
+AS_IF([test -n "${CUDA_PATH}" && test -n "${GDS_PATH}"],[
+LB_CHECK_FILE([$CUDA_PATH/nv-p2p.h],
+       [
+       AC_MSG_RESULT([CUDA path is $CUDA_PATH])
+       AC_SUBST(CUDA_PATH)
+       ],
+       [AC_MSG_ERROR([CUDA sources don't found. nv-p2p.h don't exit])]
+)
+
+LB_CHECK_FILE([$GDS_PATH/nvfs-dma.h],
+       [
+       LB_CHECK_FILE([$GDS_PATH/config-host.h], [
+       AC_MSG_RESULT([GDS path is $GDS_PATH])
+       AC_SUBST(GDS_PATH)
+       AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
+       ], [])
+       ],
+       [])
+],[
+       AC_MSG_WARN([CUDA or GDS sources not found. GDS support disabled])
+]
+)
+
+# lnet/utils/lnetconfig/liblnetconfig_netlink.c
+AS_IF([test "x$enable_dist" = xno], [
+       PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
+])
+
+AC_CHECK_LIB([nl-3], [nla_get_s32], [
+       AC_DEFINE(HAVE_NLA_GET_S32, 1,
+               [libnl3 supports nla_get_s32])
+       ], [
+])
+
+AC_CHECK_LIB([nl-3], [nla_get_s64], [
+       AC_DEFINE(HAVE_NLA_GET_S64, 1,
+               [libnl3 supports nla_get_s64])
+       ], [
+])
+
+#
+# LN_USR_NLMSGERR
+#
+AC_DEFUN([LN_USR_NLMSGERR], [
+AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+       #include <linux/netlink.h>
+
+       int main(void) {
+               int x = (int)NLMSGERR_ATTR_MAX;
+               return x;
+       }
+])],[
+       AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
+               ['enum nlmsgerr_attrs' exists])
+])
+]) # LN_USR_NLMGSERR
+
 # lnet/utils/portals.c
 AC_CHECK_HEADERS([netdb.h])
 AC_CHECK_FUNCS([gethostbyname])
@@ -767,7 +1012,7 @@ AC_CHECK_FUNCS([strnlen])
 
 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
 AC_ARG_ENABLE(efence,
-       AC_HELP_STRING([--enable-efence],
+       AS_HELP_STRING([--enable-efence],
                [use efence library]),
        [], [enable_efence="no"])
 AC_MSG_RESULT([$enable_efence])
@@ -781,6 +1026,8 @@ AS_IF([test "$enable_efence" = yes], [
 AC_SUBST(LIBEFENCE)
 
 LN_CONFIG_DLC
+LN_USR_RDMA
+LN_USR_NLMSGERR
 ]) # LN_CONFIGURE
 
 #