compat-$(CONFIG_COMPAT_KERNEL_3_16) += compat-3.16.o
compat-$(CONFIG_COMPAT_KERNEL_3_18) += compat-3.18.o
compat-$(CONFIG_COMPAT_KERNEL_4_0) += compat-4.0.o
+compat-$(CONFIG_COMPAT_KERNEL_4_1) += compat-4.1.o
compat-$(CONFIG_COMPAT_CORDIC) += cordic.o
compat-$(CONFIG_COMPAT_CRC8) += crc8.o
--- /dev/null
+#include <linux/slab.h>
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/cpumask.h>
+#include <linux/export.h>
+#include <linux/bootmem.h>
+
+/**
+ * cpumask_local_spread - select the i'th cpu with local numa cpu's first
+ * @i: index number
+ * @node: local numa_node
+ *
+ * This function selects an online CPU according to a numa aware policy;
+ * local cpus are returned first, followed by non-local ones, then it
+ * wraps around.
+ *
+ * It's not very efficient, but useful for setup.
+ */
+#define cpumask_local_spread LINUX_BACKPORT(cpumask_local_spread)
+unsigned int cpumask_local_spread(unsigned int i, int node)
+{
+ int cpu;
+
+ /* Wrap: we always want a cpu. */
+ i %= num_online_cpus();
+
+ if (node == -1) {
+ for_each_cpu(cpu, cpu_online_mask)
+ if (i-- == 0)
+ return cpu;
+ } else {
+ /* NUMA first. */
+ for_each_cpu_and(cpu, cpumask_of_node(node), cpu_online_mask)
+ if (i-- == 0)
+ return cpu;
+
+ for_each_cpu(cpu, cpu_online_mask) {
+ /* Skip NUMA nodes, done above. */
+ if (cpumask_test_cpu(cpu, cpumask_of_node(node)))
+ continue;
+
+ if (i-- == 0)
+ return cpu;
+ }
+ }
+ BUG();
+}
+EXPORT_SYMBOL(cpumask_local_spread);
])
# timecounter_adjtime can be in timecounter.h or clocksource.h
+ AC_MSG_CHECKING([if linux/clocksource.h has timecounter_adjtime])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/timecounter.h>
+ ],[
+ struct timecounter x;
+ s64 y = 0;
+ timecounter_adjtime(&x, y);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TIMECOUNTER_ADJTIME, 1,
+ [timecounter_adjtime is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
AC_MSG_CHECKING([if linux/clocksource.h has timecounter_adjtime])
LB_LINUX_TRY_COMPILE([
#include <linux/clocksource.h>
AC_MSG_RESULT(no)
])
+ AC_MSG_CHECKING([if netdevice.h has napi_schedule_irqoff])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/netdevice.h>
+ ],[
+ napi_schedule_irqoff(NULL);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NAPI_SCHEDULE_IRQOFF, 1,
+ [napi_schedule_irqoff is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if skbuff.h has dev_alloc_pages])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/skbuff.h>
+ ],[
+ dev_alloc_pages(0);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_DEV_ALLOC_PAGES, 1,
+ [dev_alloc_pages is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
+ AC_MSG_CHECKING([if skbuff.h has napi_alloc_skb])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/skbuff.h>
+ ],[
+ napi_alloc_skb(NULL, 0);
+
+ return 0;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NAPI_ALLOC_SKB, 1,
+ [napi_alloc_skb is defined])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
])
#
# COMPAT_CONFIG_HEADERS
--- /dev/null
+#ifndef LINUX_CLOCKSOURCE_H
+#define LINUX_CLOCKSOURCE_H
+
+#include <linux/version.h>
+#include "../../compat/config.h"
+
+#include_next <linux/clocksource.h>
+
+#ifndef HAVE_TIMECOUNTER_ADJTIME
+/**
+* timecounter_adjtime - Shifts the time of the clock.
+* @delta: Desired change in nanoseconds.
+*/
+static inline void timecounter_adjtime(struct timecounter *tc, s64 delta)
+{
+ tc->nsec += delta;
+}
+#endif /* HAVE_TIMECOUNTER_H */
+
+#endif /* LINUX_CLOCKSOURCE_H */
#include <linux/compat-3.16.h>
#include <linux/compat-3.17.h>
#include <linux/compat-4.0.h>
+#include <linux/compat-4.1.h>
#include <linux/compat-4.5.h>
#endif /* LINUX_26_COMPAT_H */
--- /dev/null
+#ifndef LINUX_4_1_COMPAT_H
+#define LINUX_4_1_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0))
+#include "../../compat/config.h"
+#include <linux/dma-mapping.h>
+
+#ifndef dma_rmb
+#define dma_rmb() rmb()
+#endif
+
+#ifndef dma_wmb
+#define dma_wmb() wmb()
+#endif
+
+#include <linux/cpumask.h>
+
+#define cpumask_local_spread LINUX_BACKPORT(cpumask_local_spread)
+
+#if NR_CPUS == 1
+static inline unsigned int cpumask_local_spread(unsigned int i, int node)
+{
+ return 0;
+}
+#else
+unsigned int cpumask_local_spread(unsigned int i, int node);
+#endif
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)) */
+
+#endif /* LINUX_4_1_COMPAT_H */
--- /dev/null
+#ifndef _COMPAT_LINUX_SKBUFF_H
+#define _COMPAT_LINUX_SKBUFF_H
+
+#include <linux/version.h>
+#include "../../compat/config.h"
+
+#include_next <linux/skbuff.h>
+
+#ifndef HAVE_DEV_ALLOC_PAGES
+static inline struct page *dev_alloc_pages(unsigned int order)
+{
+ gfp_t gfp_mask = GFP_ATOMIC | __GFP_NOWARN | __GFP_COLD | __GFP_COMP | __GFP_MEMALLOC;
+ return alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);
+}
+
+static inline struct page *dev_alloc_page(void)
+{
+ return dev_alloc_pages(0);
+}
+#endif
+#endif /* _COMPAT_LINUX_SKBUFF_H */