Added compat headers required by Mellanox drivers and IPoIB
authorVladimir Sokolovsky <vlad@mellanox.com>
Fri, 8 Jun 2018 14:37:56 +0000 (09:37 -0500)
committerVladimir Sokolovsky <vlad@mellanox.com>
Fri, 8 Jun 2018 22:12:11 +0000 (17:12 -0500)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
config/rdma.m4
include/linux/netdevice.h [new file with mode: 0644]
include/net/dst.h [new file with mode: 0644]
include/uapi/linux/ethtool.h [new file with mode: 0644]

index 2fcbead..f265652 100644 (file)
@@ -5718,6 +5718,89 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
        ],[
                AC_MSG_RESULT(no)
        ])
+
+       AC_MSG_CHECKING([if route.h has ip4_dst_hoplimit])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/route.h>
+       ],[
+               ip4_dst_hoplimit(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IP4_DST_HOPLIMIT, 1,
+               [ip4_dst_hoplimit is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       LB_CHECK_SYMBOL_EXPORT([irq_to_desc],
+               [kernel/irq/irqdesc.c],
+               [AC_DEFINE(HAVE_IRQ_TO_DESC_EXPORTED, 1,
+                       [irq_to_desc is exported by the kernel])],
+       [])
+
+       AC_MSG_CHECKING([if struct net_device_ops_extended has ndo_xdp])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               struct net_device_ops_extended netdev_ops_extended = {
+                       .ndo_xdp = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NDO_XDP_EXTENDED, 1,
+                         [extended ndo_xdp is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netdev_features.h has NETIF_F_RXALL])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdev_features.h>
+       ],[
+               netdev_features_t rxfcs = NETIF_F_RXALL;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NETIF_F_RXALL, 1,
+                       [NETIF_F_RXALL is defined in netdev_features.h])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netdev_features.h has NETIF_F_RXFCS])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdev_features.h>
+       ],[
+               netdev_features_t rxfcs = NETIF_F_RXFCS;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NETIF_F_RXFCS, 1,
+                       [NETIF_F_RXFCS is defined in netdev_features.h])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if vxlan.h has vxlan_features_check])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/vxlan.h>
+       ],[
+               vxlan_features_check(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_VXLAN_FEATURES_CHECK, 1,
+                         [vxlan_features_check is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
 ])
 #
 # COMPAT_CONFIG_HEADERS
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
new file mode 100644 (file)
index 0000000..6332329
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef _COMPAT_LINUX_NETDEVICE_H
+#define _COMPAT_LINUX_NETDEVICE_H 1
+
+#include "../../compat/config.h"
+#include <linux/kconfig.h>
+
+#include_next <linux/netdevice.h>
+
+
+#if IS_ENABLED(CONFIG_VXLAN) && (defined(HAVE_NDO_ADD_VXLAN_PORT) || defined(HAVE_NDO_UDP_TUNNEL_ADD))
+#define HAVE_KERNEL_WITH_VXLAN_SUPPORT_ON
+#endif
+#ifdef HAVE_NETDEV_XDP
+#define HAVE_NETDEV_BPF 1
+#define netdev_bpf     netdev_xdp
+#define ndo_bpf                ndo_xdp
+#endif
+
+#ifndef HAVE_TC_SETUP_QDISC_MQPRIO
+#define TC_SETUP_QDISC_MQPRIO TC_SETUP_MQPRIO
+
+#ifndef netdev_WARN_ONCE
+
+#define netdev_level_once(level, dev, fmt, ...)                        \
+do {                                                           \
+       static bool __print_once __read_mostly;                 \
+                                                               \
+       if (!__print_once) {                                    \
+               __print_once = true;                            \
+               netdev_printk(level, dev, fmt, ##__VA_ARGS__);  \
+       }                                                       \
+} while (0)
+
+#define netdev_emerg_once(dev, fmt, ...) \
+       netdev_level_once(KERN_EMERG, dev, fmt, ##__VA_ARGS__)
+#define netdev_alert_once(dev, fmt, ...) \
+       netdev_level_once(KERN_ALERT, dev, fmt, ##__VA_ARGS__)
+#define netdev_crit_once(dev, fmt, ...) \
+       netdev_level_once(KERN_CRIT, dev, fmt, ##__VA_ARGS__)
+#define netdev_err_once(dev, fmt, ...) \
+       netdev_level_once(KERN_ERR, dev, fmt, ##__VA_ARGS__)
+#define netdev_warn_once(dev, fmt, ...) \
+       netdev_level_once(KERN_WARNING, dev, fmt, ##__VA_ARGS__)
+#define netdev_notice_once(dev, fmt, ...) \
+       netdev_level_once(KERN_NOTICE, dev, fmt, ##__VA_ARGS__)
+#define netdev_info_once(dev, fmt, ...) \
+       netdev_level_once(KERN_INFO, dev, fmt, ##__VA_ARGS__)
+
+
+#define netdev_WARN_ONCE(dev, condition, format, arg...)               \
+       WARN_ONCE(1, "netdevice: %s%s\n" format, netdev_name(dev)       \
+                 netdev_reg_state(dev), ##args)
+#endif /* netdev_WARN_ONCE */
+#endif
+
+#endif /* _COMPAT_LINUX_NETDEVICE_H */
diff --git a/include/net/dst.h b/include/net/dst.h
new file mode 100644 (file)
index 0000000..4289086
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef _COMPAT_NET_DST_H
+#define _COMPAT_NET_DST_H 1
+
+#include "../../compat/config.h"
+
+#include_next <net/dst.h>
+
+#ifndef HAVE_SKB_DST_UPDATE_PMTU
+#define skb_dst_update_pmtu LINUX_BACKPORT(skb_dst_update_pmtu)
+static inline void skb_dst_update_pmtu(struct sk_buff *skb, u32 mtu)
+{
+       struct dst_entry *dst = skb_dst(skb);
+
+       if (dst && dst->ops->update_pmtu)
+#if defined HAVE_UPDATE_PMTU_4_PARAMS
+               dst->ops->update_pmtu(dst, NULL, skb, mtu);
+#else
+               dst->ops->update_pmtu(dst, mtu);
+#endif
+}
+#endif
+
+#endif /* _COMPAT_NET_DST_H */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
new file mode 100644 (file)
index 0000000..63e03ac
--- /dev/null
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ * ethtool.h: Defines for Linux ethtool.
+ *
+ * Copyright (C) 1998 David S. Miller (davem@redhat.com)
+ * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
+ * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
+ * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
+ *                                christopher.leech@intel.com,
+ *                                scott.feldman@intel.com)
+ * Portions Copyright (C) Sun Microsystems 2008
+ */
+
+#ifndef __BACKPORT_UAPI_LINUX_ETHTOOL_H
+#define __BACKPORT_UAPI_LINUX_ETHTOOL_H
+
+#include_next <uapi/linux/ethtool.h>
+
+#ifndef PFC_STORM_PREVENTION_AUTO
+#define PFC_STORM_PREVENTION_AUTO      0xffff
+#endif
+#endif /* __BACKPORT_UAPI_LINUX_ETHTOOL_H */