2 * Minimal wrappers to allow compiling kni on older kernels.
5 #ifndef RHEL_RELEASE_VERSION
6 #define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
9 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && \
10 (!(defined(RHEL_RELEASE_CODE) && \
11 RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)))
13 #define kstrtoul strict_strtoul
17 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
18 #define HAVE_SIMPLIFIED_PERNET_OPERATIONS
21 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
22 #define sk_sleep(s) (s)->sk_sleep
25 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
26 #define HAVE_CHANGE_CARRIER_CB
29 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
30 #define HAVE_IOV_ITER_MSGHDR
33 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)
34 #define HAVE_KIOCB_MSG_PARAM
35 #define HAVE_REBUILD_HEADER
38 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
39 #define HAVE_TRANS_START_HELPER
43 * KNI uses NET_NAME_UNKNOWN macro to select correct version of alloc_netdev()
44 * For old kernels just backported the commit that enables the macro
45 * (685343fc3ba6) but still uses old API, it is required to undefine macro to
46 * select correct version of API, this is safe since KNI doesn't use the value.
47 * This fix is specific to RedHat/CentOS kernels.
49 #if (defined(RHEL_RELEASE_CODE) && \
50 (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 8)) && \
51 (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)))
52 #undef NET_NAME_UNKNOWN