blob: 58e44774bbb63c7b599f27c4bcf03d1685fb1a3f [file] [log] [blame]
Xiaoping Fan45f4f2c2015-05-22 16:13:00 -07001/*
2 * sfe_backport.h
3 * Shortcut forwarding engine compatible header file.
4 *
5 * Copyright (c) 2014-2015 Qualcomm Atheros, Inc.
6 *
7 * All Rights Reserved.
8 * Qualcomm Atheros Confidential and Proprietary.
9 */
10
Xiaoping Fan3f1fe512014-11-05 12:14:57 -080011#include <linux/version.h>
12
Xiaoping Fan59176422015-05-22 15:58:10 -070013#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
Xiaoping Fan3f1fe512014-11-05 12:14:57 -080014#define sfe_cm_ipv4_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \
15static unsigned int __sfe_cm_ipv4_post_routing_hook(const struct nf_hook_ops *OPS, \
16 struct sk_buff *SKB, \
17 const struct net_device *UNUSED, \
18 const struct net_device *OUT, \
19 int (*OKFN)(struct sk_buff *))
Xiaoping Fan978b3772015-05-27 14:15:18 -070020
21#define sfe_cm_ipv6_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \
22static unsigned int __sfe_cm_ipv6_post_routing_hook(const struct nf_hook_ops *OPS, \
23 struct sk_buff *SKB, \
24 const struct net_device *UNUSED, \
25 const struct net_device *OUT, \
26 int (*OKFN)(struct sk_buff *))
Xiaoping Fan3f1fe512014-11-05 12:14:57 -080027#else
28#define sfe_cm_ipv4_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \
29static unsigned int __sfe_cm_ipv4_post_routing_hook(unsigned int HOOKNUM, \
30 struct sk_buff *SKB, \
31 const struct net_device *UNUSED, \
32 const struct net_device *OUT, \
33 int (*OKFN)(struct sk_buff *))
Xiaoping Fan978b3772015-05-27 14:15:18 -070034
35#define sfe_cm_ipv6_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \
36static unsigned int __sfe_cm_ipv6_post_routing_hook(unsigned int HOOKNUM, \
37 struct sk_buff *SKB, \
38 const struct net_device *UNUSED, \
39 const struct net_device *OUT, \
40 int (*OKFN)(struct sk_buff *))
Xiaoping Fan3f1fe512014-11-05 12:14:57 -080041#endif
42
Xiaoping Fan59176422015-05-22 15:58:10 -070043#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
44#define SFE_DEV_MASTER(DEV) netdev_master_upper_dev_get(DEV)
Xiaoping Fan3f1fe512014-11-05 12:14:57 -080045#else
Xiaoping Fan59176422015-05-22 15:58:10 -070046#define SFE_DEV_MASTER(DEV) ((DEV)->master)
Xiaoping Fan3f1fe512014-11-05 12:14:57 -080047#endif
48
Xiaoping Fan59176422015-05-22 15:58:10 -070049#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
Xiaoping Fan3f1fe512014-11-05 12:14:57 -080050#define SFE_NF_CONN_ACCT(NM) struct nf_conn_acct *NM
51#else
52#define SFE_NF_CONN_ACCT(NM) struct nf_conn_counter *NM
53#endif
54
Xiaoping Fan59176422015-05-22 15:58:10 -070055#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
56#define SFE_ACCT_COUNTER(NM) ((NM)->counter)
Xiaoping Fan3f1fe512014-11-05 12:14:57 -080057#else
58#define SFE_ACCT_COUNTER(NM) (NM)
59#endif