Dave Hudson | dcd08fb | 2013-11-22 09:25:16 -0600 | [diff] [blame] | 1 | /* |
| 2 | * sfe.h |
| 3 | * Shortcut forwarding engine. |
| 4 | * |
Matthew McClintock | a322194 | 2014-01-16 11:44:26 -0600 | [diff] [blame] | 5 | * Copyright (c) 2013 Qualcomm Atheros, Inc. |
| 6 | * |
| 7 | * All Rights Reserved. |
| 8 | * Qualcomm Atheros Confidential and Proprietary. |
Dave Hudson | dcd08fb | 2013-11-22 09:25:16 -0600 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | /* |
| 12 | * Select whether we "hook" in below or above the Ethernet bridge layer. |
| 13 | * |
| 14 | * XXX - note that hooking below the bridge (set this value to 0) will |
| 15 | * not currently work completely cleanly within Linux. In order to make |
| 16 | * this work properly we need to resync stats to Linux. Arguably if we |
| 17 | * want to do this we also need to validate that the source MAC address |
| 18 | * of any packets is actually correct too. Right now we're relying on |
| 19 | * the bridge layer to do this sort of thing for us. |
| 20 | */ |
| 21 | #define SFE_HOOK_ABOVE_BRIDGE 1 |
| 22 | |
| 23 | /* |
| 24 | * Debug output verbosity level. |
| 25 | */ |
| 26 | #define DEBUG_LEVEL 2 |
| 27 | |
| 28 | #if (DEBUG_LEVEL < 1) |
| 29 | #define DEBUG_ERROR(s, ...) |
| 30 | #else |
| 31 | #define DEBUG_ERROR(s, ...) \ |
| 32 | printk("%s[%u]: ERROR:", __FILE__, __LINE__); \ |
| 33 | printk(s, ##__VA_ARGS__) |
| 34 | #endif |
| 35 | |
| 36 | #if (DEBUG_LEVEL < 2) |
| 37 | #define DEBUG_WARN(s, ...) |
| 38 | #else |
| 39 | #define DEBUG_WARN(s, ...) \ |
| 40 | printk("%s[%u]: WARN:", __FILE__, __LINE__); \ |
| 41 | printk(s, ##__VA_ARGS__); |
| 42 | #endif |
| 43 | |
| 44 | #if (DEBUG_LEVEL < 3) |
| 45 | #define DEBUG_INFO(s, ...) |
| 46 | #else |
| 47 | #define DEBUG_INFO(s, ...) \ |
| 48 | printk("%s[%u]: INFO:", __FILE__, __LINE__); \ |
| 49 | printk(s, ##__VA_ARGS__); |
| 50 | #endif |
| 51 | |
| 52 | #if (DEBUG_LEVEL < 4) |
| 53 | #define DEBUG_TRACE(s, ...) |
| 54 | #else |
| 55 | #define DEBUG_TRACE(s, ...) \ |
| 56 | printk("%s[%u]: TRACE:", __FILE__, __LINE__); \ |
| 57 | printk(s, ##__VA_ARGS__); |
| 58 | #endif |
| 59 | |
Xiaoping Fan | d1dc7b2 | 2015-01-23 00:43:56 -0800 | [diff] [blame^] | 60 | #ifdef CONFIG_NF_FLOW_COOKIE |
| 61 | typedef int (*flow_cookie_set_func_t)(u32 protocol, __be32 src_ip, __be16 src_port, |
| 62 | __be32 dst_ip, __be16 dst_port, u16 flow_cookie); |
| 63 | /* |
| 64 | * sfe_register_flow_cookie_cb |
| 65 | * register a function in SFE to let SFE use this function to configure flow cookie for a flow |
| 66 | * |
| 67 | * Hardware driver which support flow cookie should register a callback function in SFE. Then SFE |
| 68 | * can use this function to configure flow cookie for a flow. |
| 69 | * return: 0, success; !=0, fail |
| 70 | */ |
| 71 | int sfe_register_flow_cookie_cb(flow_cookie_set_func_t cb); |
Dave Hudson | dcd08fb | 2013-11-22 09:25:16 -0600 | [diff] [blame] | 72 | |
Xiaoping Fan | d1dc7b2 | 2015-01-23 00:43:56 -0800 | [diff] [blame^] | 73 | /* |
| 74 | * sfe_unregister_flow_cookie_cb |
| 75 | * unregister function which is used to configure flow cookie for a flow |
| 76 | * |
| 77 | * return: 0, success; !=0, fail |
| 78 | */ |
| 79 | int sfe_unregister_flow_cookie_cb(flow_cookie_set_func_t cb); |
| 80 | #endif /*CONFIG_NF_FLOW_COOKIE*/ |