[shortcut-fe] support compiling with kernel 3.14.0
Change-Id: Ie1c078969e98edc32b1f1e0c106a647cae3bb180
Signed-off-by: Xiaoping Fan <xfan@codeaurora.org>
diff --git a/shortcut-fe/sfe_backport.h b/shortcut-fe/sfe_backport.h
new file mode 100644
index 0000000..72170bc
--- /dev/null
+++ b/shortcut-fe/sfe_backport.h
@@ -0,0 +1,35 @@
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)
+#define sfe_cm_ipv4_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \
+static unsigned int __sfe_cm_ipv4_post_routing_hook(const struct nf_hook_ops *OPS, \
+ struct sk_buff *SKB, \
+ const struct net_device *UNUSED, \
+ const struct net_device *OUT, \
+ int (*OKFN)(struct sk_buff *))
+#else
+#define sfe_cm_ipv4_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \
+static unsigned int __sfe_cm_ipv4_post_routing_hook(unsigned int HOOKNUM, \
+ struct sk_buff *SKB, \
+ const struct net_device *UNUSED, \
+ const struct net_device *OUT, \
+ int (*OKFN)(struct sk_buff *))
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
+#define SFE_DEV_MASTER(DEV) netdev_master_upper_dev_get(DEV);
+#else
+#define SFE_DEV_MASTER(DEV) (DEV)->master;
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)
+#define SFE_NF_CONN_ACCT(NM) struct nf_conn_acct *NM
+#else
+#define SFE_NF_CONN_ACCT(NM) struct nf_conn_counter *NM
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)
+#define SFE_ACCT_COUNTER(NM) (NM)->counter
+#else
+#define SFE_ACCT_COUNTER(NM) (NM)
+#endif