]> git.openfabrics.org - compat-rdma/compat.git/commitdiff
Provides backporting of qib driver for RHEL 6.5
authorVinit Agnihotri <vinit.abhay.agnihotri@intel.com>
Thu, 29 Jan 2015 07:09:41 +0000 (23:09 -0800)
committerMike Marciniszyn <mike.marciniszyn@intel.com>
Tue, 3 Mar 2015 14:01:41 +0000 (09:01 -0500)
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Vinit Agnihotri <vinit.abhay.agnihotri@intel.com>
config/rdma.m4
include/linux/percpu.h [new file with mode: 0644]

index 2c68652a495d2f2a05c19e9af6a6b42b7a8b983b..d03b5d38388ca260dc727d4ea5e9010addd48722 100644 (file)
@@ -441,6 +441,21 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if kernel has percpu variables])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/percpu.h>
+       ],[
+               static DEFINE_PER_CPU(unsigned int, x);
+               this_cpu_inc(x);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PERCPU_VARS, 1,
+                         [percpu variables are defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
 
        AC_MSG_CHECKING([if struct iscsi_transport has attr_is_visible])
        LB_LINUX_TRY_COMPILE([
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
new file mode 100644 (file)
index 0000000..b65e5d4
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef _COMPAT_LINUX_PERCPU_H
+#define _COMPAT_LINUX_PERCPU_H 1
+
+#include <linux/version.h>
+
+#include_next <linux/percpu.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
+
+#ifndef this_cpu_inc
+#define this_cpu_inc(pcp)                       \
+do {                                            \
+        unsigned long flags;                    \
+        raw_local_irq_save(flags);              \
+        *this_cpu_ptr(&(pcp)) += 1;         \
+        raw_local_irq_restore(flags);           \
+} while (0)
+#endif /* this_cpu_inc */
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) */
+
+#endif /* _COMPAT_LINUX_PERCPU_H */