Added HAVE_NETDEV_REG_STATE
authorVladimir Sokolovsky <vlad@mellanox.com>
Thu, 26 Jul 2018 20:57:49 +0000 (15:57 -0500)
committerVladimir Sokolovsky <vlad@mellanox.com>
Thu, 26 Jul 2018 20:57:49 +0000 (15:57 -0500)
This is to avoid redefinition of netdev_reg_state on SLES15

Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
config/rdma.m4
include/linux/netdevice.h

index 75d1a8a..d5ae5cc 100644 (file)
@@ -6304,6 +6304,21 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if netdevice.h has netdev_reg_state])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               netdev_reg_state(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NETDEV_REG_STATE, 1,
+                         [netdev_reg_state is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
        LB_CHECK_SYMBOL_EXPORT([bpf_prog_inc],
                [kernel/bpf/syscall.c],
                [AC_DEFINE(HAVE_BPF_PROG_INC_EXPORTED, 1,
index 332fb2b..c747ef6 100644 (file)
@@ -25,6 +25,8 @@
 #endif
 
 #ifndef netdev_WARN_ONCE
+
+#ifndef HAVE_NETDEV_REG_STATE
 static inline const char *netdev_reg_state(const struct net_device *dev)
 {
        switch (dev->reg_state) {
@@ -39,6 +41,7 @@ static inline const char *netdev_reg_state(const struct net_device *dev)
        WARN_ONCE(1, "%s: unknown reg_state %d\n", dev->name, dev->reg_state);
        return " (unknown)";
 }
+#endif
 
 
 #define netdev_level_once(level, dev, fmt, ...)                        \