Xiaoping Fan | 45f4f2c | 2015-05-22 16:13:00 -0700 | [diff] [blame] | 1 | /* |
| 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 Fan | 3f1fe51 | 2014-11-05 12:14:57 -0800 | [diff] [blame] | 11 | #include <linux/version.h> |
| 12 | |
Xiaoping Fan | 5917642 | 2015-05-22 15:58:10 -0700 | [diff] [blame] | 13 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) |
Xiaoping Fan | 3f1fe51 | 2014-11-05 12:14:57 -0800 | [diff] [blame] | 14 | #define sfe_cm_ipv4_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \ |
| 15 | static 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 Fan | 978b377 | 2015-05-27 14:15:18 -0700 | [diff] [blame] | 20 | |
| 21 | #define sfe_cm_ipv6_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \ |
| 22 | static 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 Fan | 3f1fe51 | 2014-11-05 12:14:57 -0800 | [diff] [blame] | 27 | #else |
| 28 | #define sfe_cm_ipv4_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \ |
| 29 | static 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 Fan | 978b377 | 2015-05-27 14:15:18 -0700 | [diff] [blame] | 34 | |
| 35 | #define sfe_cm_ipv6_post_routing_hook(HOOKNUM, OPS, SKB, UNUSED, OUT, OKFN) \ |
| 36 | static 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 Fan | 3f1fe51 | 2014-11-05 12:14:57 -0800 | [diff] [blame] | 41 | #endif |
| 42 | |
Xiaoping Fan | 5917642 | 2015-05-22 15:58:10 -0700 | [diff] [blame] | 43 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) |
| 44 | #define SFE_DEV_MASTER(DEV) netdev_master_upper_dev_get(DEV) |
Xiaoping Fan | 3f1fe51 | 2014-11-05 12:14:57 -0800 | [diff] [blame] | 45 | #else |
Xiaoping Fan | 5917642 | 2015-05-22 15:58:10 -0700 | [diff] [blame] | 46 | #define SFE_DEV_MASTER(DEV) ((DEV)->master) |
Xiaoping Fan | 3f1fe51 | 2014-11-05 12:14:57 -0800 | [diff] [blame] | 47 | #endif |
| 48 | |
Xiaoping Fan | 5917642 | 2015-05-22 15:58:10 -0700 | [diff] [blame] | 49 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) |
Xiaoping Fan | 3f1fe51 | 2014-11-05 12:14:57 -0800 | [diff] [blame] | 50 | #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 Fan | 5917642 | 2015-05-22 15:58:10 -0700 | [diff] [blame] | 55 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) |
| 56 | #define SFE_ACCT_COUNTER(NM) ((NM)->counter) |
Xiaoping Fan | 3f1fe51 | 2014-11-05 12:14:57 -0800 | [diff] [blame] | 57 | #else |
| 58 | #define SFE_ACCT_COUNTER(NM) (NM) |
| 59 | #endif |