From aed9b33d57be990ac7982c82be050a055d7e72ef Mon Sep 17 00:00:00 2001 From: Vinit Agnihotri Date: Wed, 28 Jan 2015 23:09:41 -0800 Subject: [PATCH] Provides backporting of qib driver for RHEL 6.5 Reviewed-by: Mike Marciniszyn Signed-off-by: Vinit Agnihotri --- config/rdma.m4 | 15 +++++++++++++++ include/linux/percpu.h | 21 +++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 include/linux/percpu.h diff --git a/config/rdma.m4 b/config/rdma.m4 index 2c68652..d03b5d3 100644 --- a/config/rdma.m4 +++ b/config/rdma.m4 @@ -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 + ],[ + 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 index 0000000..b65e5d4 --- /dev/null +++ b/include/linux/percpu.h @@ -0,0 +1,21 @@ +#ifndef _COMPAT_LINUX_PERCPU_H +#define _COMPAT_LINUX_PERCPU_H 1 + +#include + +#include_next + +#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 */ -- 2.46.0