AC_MSG_RESULT(no)
])
+ AC_MSG_CHECKING([if kernel has ktime_get_boot_ns])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/ktime.h>
+ ],[
+ unsigned long long ns;
+
+ ns = ktime_get_boot_ns();
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KTIME_GET_BOOT_NS, 1,
+ [ktime_get_boot_ns defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if timekeeping.h has ktime_get_real_ns])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/ktime.h>
+ #include <linux/timekeeping.h>
+ ],[
+ ktime_get_real_ns();
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_KTIME_GET_REAL_NS, 1,
+ [ktime_get_real_ns is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
AC_MSG_CHECKING([if svc_xprt_class has xcl_ident])
LB_LINUX_TRY_COMPILE([
#include <linux/sunrpc/xprt.h>
],[
enum pci_bus_speed speed = PCI_SPEED_UNKNOWN;
- return 0;
+ return speed;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PCI_BUS_SPEED, 1,
],[
AC_MSG_RESULT(no)
])
+
+ AC_MSG_CHECKING([if include/linux/irq_poll.h exists])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/irq_poll.h>
+ ],[
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IRQ_POLL_H, 1,
+ [include/linux/irq_poll.h exists])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if linux/dma-mapping.h has struct dma_attrs])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/dma-mapping.h>
+ ],[
+ struct dma_attrs *attrs;
+ int ret;
+
+ ret = dma_get_attr(DMA_ATTR_WRITE_BARRIER, attrs);
+
+ return ret;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_STRUCT_DMA_ATTRS, 1,
+ [struct dma_attrs is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if pci.h has pcie_get_minimum_link])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/pci.h>
+ ],[
+ int ret;
+ ret = pcie_get_minimum_link(NULL, NULL, NULL);
+
+ return ret;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PCIE_GET_MINIMUM_LINK, 1,
+ [pcie_get_minimum_link is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if netdevice.h has netdev_for_each_all_upper_dev_rcu])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/netdevice.h>
+ ],[
+ struct net_device *dev;
+ struct net_device *upper;
+ struct list_head *list;
+
+ netdev_for_each_all_upper_dev_rcu(dev, upper, list);
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NETDEV_FOR_EACH_ALL_UPPER_DEV_RCU, 1,
+ [netdev_master_upper_dev_get_rcu is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if netdevice.h has netdev_has_upper_dev])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/netdevice.h>
+ ],[
+ struct net_device *dev;
+ struct net_device *upper;
+ netdev_has_upper_dev(dev, upper);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NETDEV_HAS_UPPER_DEV, 1,
+ [netdev_has_upper_dev is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if ethtool.h has __ethtool_get_link_ksettings])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/ethtool.h>
+ ],[
+ __ethtool_get_link_ksettings(NULL, NULL);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE___ETHTOOL_GET_LINK_KSETTINGS, 1,
+ [__ethtool_get_link_ksettings is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if addrconf.h has addrconf_ifid_eui48])
+ LB_LINUX_TRY_COMPILE([
+ #include <net/addrconf.h>
+ ],[
+ int x = addrconf_ifid_eui48(NULL, NULL);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ADDRCONF_IFID_EUI48, 1,
+ [addrconf_ifid_eui48 is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if mm.h get_user_pages has 6 params])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+ ],[
+ get_user_pages(0, 0, 0, 0, NULL, NULL);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GET_USER_PAGES_6_PARAMS, 1,
+ [get_user_pages has 6 params])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if mm.h get_user_pages_remote])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+ ],[
+ get_user_pages_remote(NULL, NULL, 0, 0, 0, 0, NULL, NULL);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GET_USER_PAGES_REMOTE, 1,
+ [get_user_pages_remote exist])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if ip_fib.h fib_lookup has 4 params])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/ip_fib.h>
+ ],[
+ fib_lookup(NULL, NULL, NULL, 0);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_FIB_LOOKUP_4_PARAMS, 1,
+ [fib_lookup has 4 params])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if include/net/devlink.h exists])
+ LB_LINUX_TRY_COMPILE([
+ #include <net/devlink.h>
+ ],[
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NET_DEVLINK_H, 1,
+ [include/net/devlink.h exists])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if io_mapping_map_wc has 3 params])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/io-mapping.h>
+ ],[
+ io_mapping_map_wc(NULL, 0, 0);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IO_MAPPING_MAP_WC_3_PARAMS, 1,
+ [io_mapping_map_wc has 3 params])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if include/net/dcbnl.h struct dcbnl_rtnl_ops has *ieee_getqcn])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/netdevice.h>
+ #include <net/dcbnl.h>
+ ],[
+ struct dcbnl_rtnl_ops x = {
+ .ieee_getqcn = NULL,
+ };
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IEEE_GETQCN, 1,
+ [ieee_getqcn is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if dcbnl.h has struct ieee_qcn])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/netdevice.h>
+ #include <net/dcbnl.h>
+ ],[
+ struct ieee_qcn x;
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_STRUCT_IEEE_QCN, 1,
+ [ieee_qcn is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if netdevice.h has napi_consume_skb])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/skbuff.h>
+ ],[
+ napi_consume_skb(NULL, 0);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NAPI_CONSUME_SKB, 1,
+ [napi_consume_skb is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if include/linux/bpf.h exists])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/bpf.h>
+ ],[
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_LINUX_BPF_H, 1,
+ [include/linux/bpf.h exists])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if mm_types.h struct page has _count])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/mm.h>
+ #include <linux/mm_types.h>
+ ],[
+ struct page p;
+ p._count.counter = 0;
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_MM_PAGE__COUNT, 1,
+ [struct page has _count])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if include/linux/page_ref.h exists])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/page_ref.h>
+ ],[
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_LINUX_PAGE_REF_H, 1,
+ [include/linux/page_ref.h exists])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if linux/ethtool.h has ETHTOOL_xLINKSETTINGS API])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/ethtool.h>
+ ],[
+ enum ethtool_link_mode_bit_indices x = ETHTOOL_LINK_MODE_TP_BIT;
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ETHTOOL_xLINKSETTINGS, 1,
+ [ETHTOOL_xLINKSETTINGS API is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if linux/printk.h exists])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/printk.h>
+ ],[
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_LINUX_PRINTK_H, 1,
+ [linux/printk.h is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if printk.h has struct va_format])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/printk.h>
+ ],[
+ struct va_format x;
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_VA_FORMAT, 1,
+ [va_format is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if irq.h irq_data has member affinity])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/irq.h>
+ #include <linux/cpumask.h>
+ ],[
+ cpumask_var_t x;
+ struct irq_data y = {
+ .affinity = x,
+ };
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IRQ_DATA_AFFINITY, 1,
+ [irq_data member affinity is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if irq.h irq_data_get_affinity_mask])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/irq.h>
+ ],[
+ irq_data_get_affinity_mask(NULL);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IRQ_DATA_GET_AFFINITY_MASK, 1,
+ [irq_data_get_affinity_mask exist])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
])
#
# COMPAT_CONFIG_HEADERS
#endif
#include <linux/compat_autoconf.h>
#include <linux/init.h>
+#include <linux/module.h>
#include <linux/uidgid.h>
/*
#include <linux/compat-3.14.h>
#include <linux/compat-3.15.h>
#include <linux/compat-3.16.h>
+#include <linux/compat-3.17.h>
#endif /* LINUX_26_COMPAT_H */
#define LINUX_3_12_COMPAT_H
#include <linux/version.h>
+#include <../../compat/config.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0))
-#include <linux/pci.h>
-#include <linux/pci_hotplug.h>
#ifndef PTR_ERR_OR_ZERO
#define PTR_ERR_OR_ZERO(p) PTR_RET(p)
return f->f_dentry->d_inode;
}
+#include <linux/pci.h>
+
#ifndef HAVE_PCIE_LINK_WIDTH
/* These values come from the PCI Express Spec */
enum pcie_link_width {
extern const unsigned char pcie_link_speed[];
+#ifndef HAVE_PCIE_GET_MINIMUM_LINK
#define pcie_get_minimum_link LINUX_BACKPORT(pcie_get_minimum_link)
int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
enum pcie_link_width *width);
+#endif
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) */
#endif /* LINUX_3_12_COMPAT_H */
--- /dev/null
+#ifndef LINUX_3_17_COMPAT_H
+#define LINUX_3_17_COMPAT_H
+
+#include <linux/version.h>
+#include "../../compat/config.h"
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0))
+
+#ifndef HAVE_KTIME_GET_REAL_NS
+#include <linux/hrtimer.h>
+#include <linux/ktime.h>
+static inline u64 ktime_get_real_ns(void) {
+ return ktime_to_ns(ktime_get_real());
+}
+#endif /* HAVE_KTIME_GET_REAL_NS */
+
+#ifndef HAVE_KTIME_GET_BOOT_NS
+#include <linux/hrtimer.h>
+static inline u64 ktime_get_boot_ns(void)
+{
+ return ktime_to_ns(ktime_get_boottime());
+}
+#endif /* HAVE_KTIME_GET_BOOT_NS */
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,17,0)) */
+
+#endif /* LINUX_3_17_COMPAT_H */
--- /dev/null
+#ifndef _COMPAT_LINUX_IRQ_POLL_H
+#define _COMPAT_LINUX_IRQ_POLL_H 1
+
+#include "../../compat/config.h"
+
+#ifdef HAVE_IRQ_POLL_H
+#include_next <linux/irq_poll.h>
+#endif
+
+#endif /* _COMPAT_LINUX_IRQ_POLL_H */
--- /dev/null
+#ifndef _COMPAT_LINUX_MM_H
+#define _COMPAT_LINUX_MM_H 1
+
+#include "../../compat/config.h"
+#include_next <linux/mm.h>
+
+#ifdef HAVE_GET_USER_PAGES_6_PARAMS
+#define get_user_pages(p1, p2, p3, p4, p5, p6, p7, p8) \
+ get_user_pages(p3, p4, p5, p6, p7, p8)
+#endif
+
+#ifndef HAVE_GET_USER_PAGES_REMOTE
+#define get_user_pages_remote get_user_pages
+#endif
+
+#endif /* _COMPAT_LINUX_MM_H */
#define _COMPAT_LINUX_PRINTK_H 1
#include <linux/version.h>
+#include "../../compat/config.h"
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36))
+#ifdef HAVE_LINUX_PRINTK_H
#include_next <linux/printk.h>
-#else
+#else /* HAVE_LINUX_PRINTK_H */
#include <linux/kernel.h>
-#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)) */
+
+#define pr_emerg_once(fmt, ...) \
+ printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_alert_once(fmt, ...) \
+ printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_crit_once(fmt, ...) \
+ printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_err_once(fmt, ...) \
+ printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_warn_once(fmt, ...) \
+ printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_warn pr_warning
+#define pr_notice_once(fmt, ...) \
+ printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_info_once(fmt, ...) \
+ printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
+#define pr_cont_once(fmt, ...) \
+ printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
+#if defined(DEBUG)
+#define pr_debug_once(fmt, ...) \
+ printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#else
+#define pr_debug_once(fmt, ...) \
+ no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif
+
+/*
+ * ratelimited messages with local ratelimit_state,
+ * no local ratelimit_state used in the !PRINTK case
+ */
+#ifndef printk_ratelimited
+#ifdef CONFIG_PRINTK
+#define printk_ratelimited(fmt, ...) \
+({ \
+ static DEFINE_RATELIMIT_STATE(_rs, \
+ DEFAULT_RATELIMIT_INTERVAL, \
+ DEFAULT_RATELIMIT_BURST); \
+ \
+ if (__ratelimit(&_rs)) \
+ printk(fmt, ##__VA_ARGS__); \
+})
+#else
+#define printk_ratelimited(fmt, ...) \
+ no_printk(fmt, ##__VA_ARGS__)
+#endif
+#endif /* ifndef printk_ratelimited */
+
+#ifndef printk_once
+#define printk_once(fmt, ...) \
+({ \
+ static bool __print_once; \
+ \
+ if (!__print_once) { \
+ __print_once = true; \
+ printk(fmt, ##__VA_ARGS__); \
+ } \
+})
+#endif
+
+#endif /* HAVE_LINUX_PRINTK_H */
#endif /* _COMPAT_LINUX_PRINTK_H */
--- /dev/null
+#ifndef COMPAT_LINUX_TIMEKEEPING_H
+#define COMPAT_LINUX_TIMEKEEPING_H
+
+#include "../../compat/config.h"
+
+#include_next <linux/timekeeping.h>
+
+#ifndef HAVE_KTIME_GET_NS
+static inline u64 ktime_get_ns(void)
+{
+ return ktime_to_ns(ktime_get());
+}
+#endif /* HAVE_KTIME_TO_NS */
+
+#endif /* COMPAT_LINUX_TIMEKEEPING_H */
--- /dev/null
+#ifndef LINUX_ADDRCONF_H
+#define LINUX_ADDRCONF_H
+
+#include "../../compat/config.h"
+
+#include_next <net/addrconf.h>
+
+#ifndef HAVE_ADDRCONF_IFID_EUI48
+static inline int addrconf_ifid_eui48(u8 *eui, struct net_device *dev)
+{
+ if (dev->addr_len != ETH_ALEN)
+ return -1;
+ memcpy(eui, dev->dev_addr, 3);
+ memcpy(eui + 5, dev->dev_addr + 3, 3);
+
+ /*
+ * The zSeries OSA network cards can be shared among various
+ * OS instances, but the OSA cards have only one MAC address.
+ * This leads to duplicate address conflicts in conjunction
+ * with IPv6 if more than one instance uses the same card.
+ *
+ * The driver for these cards can deliver a unique 16-bit
+ * identifier for each instance sharing the same card. It is
+ * placed instead of 0xFFFE in the interface identifier. The
+ * "u" bit of the interface identifier is not inverted in this
+ * case. Hence the resulting interface identifier has local
+ * scope according to RFC2373.
+ */
+ if (dev->dev_id) {
+ eui[3] = (dev->dev_id >> 8) & 0xFF;
+ eui[4] = dev->dev_id & 0xFF;
+ } else {
+ eui[3] = 0xFF;
+ eui[4] = 0xFE;
+ eui[0] ^= 2;
+ }
+ return 0;
+}
+#endif
+
+#endif /* LINUX_ADDRCONF_H */
--- /dev/null
+#ifndef LINUX_BONDING_H
+#define LINUX_BONDING_H
+
+#include "../../compat/config.h"
+
+#ifdef HAVE_BONDING_H
+#include_next <net/bonding.h>
+
+#define MLX_USES_PRIMARY(mode) \
+ (((mode) == BOND_MODE_ACTIVEBACKUP) || \
+ ((mode) == BOND_MODE_TLB) || \
+ ((mode) == BOND_MODE_ALB))
+
+#define bond_option_active_slave_get_rcu LINUX_BACKPORT(bond_option_active_slave_get_rcu)
+static inline struct net_device *bond_option_active_slave_get_rcu(struct bonding
+ *bond)
+{
+ struct slave *slave = rcu_dereference(bond->curr_active_slave);
+
+ return MLX_USES_PRIMARY(bond->params.mode) && slave ? slave->dev : NULL;
+}
+#endif /* HAVE_BONDING_H */
+
+#endif /* LINUX_BONDING_H */
--- /dev/null
+#ifndef _COMPAT_NET_DEVLINK_H
+#define _COMPAT_NET_DEVLINK_H 1
+
+#include "../../compat/config.h"
+
+#ifdef HAVE_NET_DEVLINK_H
+#include_next <net/devlink.h>
+#endif
+
+#endif /* _COMPAT_NET_DEVLINK_H */