]> git.openfabrics.org - ~tnikolova/compat/.git/commitdiff
compat: Added RHEL6.8 support
authorVladimir Sokolovsky <vlad@mellanox.com>
Wed, 4 Jan 2017 13:45:04 +0000 (15:45 +0200)
committerVladimir Sokolovsky <vlad@mellanox.com>
Wed, 4 Jan 2017 13:45:04 +0000 (15:45 +0200)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
config/rdma.m4
include/linux/printk.h
include/net/flow_keys.h

index 901d4ea8c738bcd99ff741177afeaddddfe571fb..19e8f126eb7feba642f7dd4dbeaf9aa244623461 100644 (file)
@@ -2411,6 +2411,33 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
        ],[
                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 net/flow_keys.h exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/skbuff.h>
+               #include <net/flow_keys.h>
+       ],[
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NET_FLOW_KEYS_H, 1,
+                         [net/flow_keys.h exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
 ])
 #
 # COMPAT_CONFIG_HEADERS
index c0822ac488cad013a43e6fc06c8de8db2339440a..dc8f99e6249a017dfb37c05f5b6944053a3e87c5 100644 (file)
@@ -2,11 +2,71 @@
 #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 */
index a875ee6eeb3bdc62d858686dc6e1f1a5a940aef6..2acb1172b76d0eca33b2dac96be9b7ca47a20a99 100644 (file)
@@ -1,9 +1,11 @@
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
-#include_next <net/flow_keys.h>
-#else
+#ifndef COMPAT_LINUX_FLOW_KEYS_H
+#define COMPAT_LINUX_FLOW_KEYS_H
+
+#include "../../compat/config.h"
 
-#ifndef _NET_FLOW_KEYS_H
-#define _NET_FLOW_KEYS_H
+#ifdef HAVE_NET_FLOW_KEYS_H
+#include_next <net/flow_keys.h>
+#else /* HAVE_NET_FLOW_KEYS_H */
 
 struct flow_keys {
        /* (src,dst) must be grouped, in the same way than in IP header */
@@ -16,6 +18,9 @@ struct flow_keys {
        u8 ip_proto;
 };
 
+#define skb_flow_dissect LINUX_BACKPORT(skb_flow_dissect)
 extern bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
-#endif
-#endif
+
+#endif /* HAVE_NET_FLOW_KEYS_H */
+
+#endif /* COMPAT_LINUX_FLOW_KEYS_H */