Added support for IPoIB on RHEL7.6
authorVladimir Sokolovsky <vlad@mellanox.com>
Wed, 28 Aug 2019 16:35:12 +0000 (11:35 -0500)
committerVladimir Sokolovsky <vlad@mellanox.com>
Wed, 28 Aug 2019 16:35:12 +0000 (11:35 -0500)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
config/rdma.m4
include/linux/mm.h

index 6721825..d5b15d3 100644 (file)
@@ -9578,6 +9578,71 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if netdevice.h dev_change_flags has 3 parameters])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               dev_change_flags(NULL, 0, NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEV_CHANGE_FLAGS_HAS_3_PARAMS, 1,
+                         [dev_change_flags has 3 parameters])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct net_device has close_list])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               struct net_device *dev = NULL;
+               struct list_head xlist;
+
+               dev->close_list = xlist;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NET_DEVICE_HAS_CLOSE_LIST, 1,
+                         [net_device close_list is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct net_device has needs_free_netdev])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               struct net_device *dev = NULL;
+
+               dev->needs_free_netdev = true;
+               dev->priv_destructor = NULL;
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NET_DEVICE_NEEDS_FREE_NETDEV, 1,
+                         [net_device needs_free_netdev is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if mm.h has kvcalloc])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/mm.h>
+       ],[
+               kvcalloc(0, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_KVCALLOC, 1,
+                       [kvcalloc is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
 ])
 #
 # COMPAT_CONFIG_HEADERS
index 6793737..d148574 100644 (file)
@@ -60,6 +60,16 @@ static inline void *kvzalloc_node(size_t size, gfp_t flags, int node)
 }
 #endif
 
+#ifndef HAVE_KVCALLOC
+#include <linux/vmalloc.h>
+#include <linux/slab.h>
+
+static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
+{
+       return kvmalloc_array(n, size, flags | __GFP_ZERO);
+}
+#endif
+
 #ifndef HAVE_WANT_INIT_ON_ALLOC
 static inline bool want_init_on_alloc(gfp_t flags)
 {