Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 1 | /* |
| 2 | ************************************************************************** |
Gareth Williams | d5618a8 | 2015-05-20 11:13:32 +0100 | [diff] [blame] | 3 | * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all copies. |
| 7 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 8 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 9 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 10 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 11 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 12 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
| 13 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 14 | ************************************************************************** |
| 15 | */ |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 16 | #include <linux/version.h> |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 17 | #include <linux/module.h> |
Murat Sezgin | f2b9453 | 2014-12-05 14:53:53 -0800 | [diff] [blame] | 18 | #include <linux/of.h> |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 19 | #include <linux/debugfs.h> |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 20 | #include <linux/inet.h> |
| 21 | #include <linux/etherdevice.h> |
| 22 | #include <net/netfilter/nf_conntrack.h> |
| 23 | #include <net/ip.h> |
| 24 | #include <net/ipv6.h> |
| 25 | /* |
| 26 | * Debug output levels |
| 27 | * 0 = OFF |
| 28 | * 1 = ASSERTS / ERRORS |
| 29 | * 2 = 1 + WARN |
| 30 | * 3 = 2 + INFO |
| 31 | * 4 = 3 + TRACE |
| 32 | */ |
| 33 | #define DEBUG_LEVEL ECM_INIT_DEBUG_LEVEL |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 34 | |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 35 | #include "ecm_types.h" |
| 36 | #include "ecm_db_types.h" |
| 37 | #include "ecm_state.h" |
| 38 | #include "ecm_tracker.h" |
| 39 | #include "ecm_classifier.h" |
| 40 | #include "ecm_front_end_types.h" |
Tushar Mathur | d38cacd | 2015-07-28 12:19:10 +0530 | [diff] [blame] | 41 | #include "ecm_db.h" |
Murat Sezgin | 8d916a1 | 2015-03-18 15:56:50 -0700 | [diff] [blame] | 42 | #include "ecm_front_end_ipv4.h" |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 43 | #ifdef ECM_IPV6_ENABLE |
| 44 | #include "ecm_front_end_ipv6.h" |
| 45 | #endif |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 46 | #include "ecm_front_end_common.h" |
Murat Sezgin | 8d916a1 | 2015-03-18 15:56:50 -0700 | [diff] [blame] | 47 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 48 | struct dentry *ecm_dentry; /* Dentry object for top level ecm debugfs directory */ |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 49 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 50 | extern int ecm_db_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 51 | extern void ecm_db_connection_defunct_all(void); |
| 52 | extern void ecm_db_exit(void); |
| 53 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 54 | extern int ecm_classifier_default_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 55 | extern void ecm_classifier_default_exit(void); |
| 56 | |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 57 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 58 | extern int ecm_classifier_nl_rules_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 59 | extern void ecm_classifier_nl_rules_exit(void); |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 60 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 61 | |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 62 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 63 | extern int ecm_classifier_hyfi_rules_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 64 | extern void ecm_classifier_hyfi_rules_exit(void); |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 65 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 66 | |
| 67 | extern int ecm_interface_init(void); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 68 | extern void ecm_interface_exit(void); |
| 69 | |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 70 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 71 | extern int ecm_classifier_dscp_init(struct dentry *dentry); |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 72 | extern void ecm_classifier_dscp_exit(void); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 73 | #endif |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 74 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 75 | #ifdef ECM_STATE_OUTPUT_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 76 | extern int ecm_state_init(struct dentry *dentry); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 77 | extern void ecm_state_exit(void); |
| 78 | #endif |
| 79 | |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 80 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
| 81 | extern int ecm_classifier_pcc_init(struct dentry *dentry); |
| 82 | extern void ecm_classifier_pcc_exit(void); |
| 83 | #endif |
| 84 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 85 | /* |
| 86 | * ecm_init() |
| 87 | */ |
| 88 | static int __init ecm_init(void) |
| 89 | { |
| 90 | int ret; |
Murat Sezgin | f2b9453 | 2014-12-05 14:53:53 -0800 | [diff] [blame] | 91 | |
| 92 | /* |
| 93 | * Run only for IPQ8064 platform, if the device tree is used. |
| 94 | */ |
| 95 | #ifdef CONFIG_OF |
| 96 | if (!of_machine_is_compatible("qcom,ipq8064")) { |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 97 | DEBUG_WARN("Not compatible platform for ECM\n"); |
Murat Sezgin | f2b9453 | 2014-12-05 14:53:53 -0800 | [diff] [blame] | 98 | return 0; |
| 99 | } |
| 100 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 101 | printk(KERN_INFO "ECM init\n"); |
| 102 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 103 | ecm_dentry = debugfs_create_dir("ecm", NULL); |
| 104 | if (!ecm_dentry) { |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 105 | DEBUG_ERROR("Failed to create ecm directory in debugfs\n"); |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 106 | return -1; |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 107 | } |
| 108 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 109 | ret = ecm_db_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 110 | if (0 != ret) { |
| 111 | goto err_db; |
| 112 | } |
| 113 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 114 | ret = ecm_classifier_default_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 115 | if (0 != ret) { |
| 116 | goto err_cls_default; |
| 117 | } |
| 118 | |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 119 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 120 | ret = ecm_classifier_nl_rules_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 121 | if (0 != ret) { |
| 122 | goto err_cls_nl; |
| 123 | } |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 124 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 125 | |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 126 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 127 | ret = ecm_classifier_hyfi_rules_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 128 | if (0 != ret) { |
| 129 | goto err_cls_hyfi; |
| 130 | } |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 131 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 132 | |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 133 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 134 | ret = ecm_classifier_dscp_init(ecm_dentry); |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 135 | if (0 != ret) { |
| 136 | goto err_cls_dscp; |
| 137 | } |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 138 | #endif |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 139 | |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 140 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
| 141 | ret = ecm_classifier_pcc_init(ecm_dentry); |
| 142 | if (0 != ret) { |
| 143 | goto err_cls_pcc; |
| 144 | } |
| 145 | #endif |
| 146 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 147 | ret = ecm_interface_init(); |
| 148 | if (0 != ret) { |
| 149 | goto err_iface; |
| 150 | } |
| 151 | |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 152 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 153 | ret = ecm_front_end_bond_notifier_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 154 | if (0 != ret) { |
| 155 | goto err_bond; |
| 156 | } |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 157 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 158 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 159 | ret = ecm_front_end_ipv4_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 160 | if (0 != ret) { |
| 161 | goto err_fe_ipv4; |
| 162 | } |
| 163 | |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 164 | #ifdef ECM_IPV6_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 165 | ret = ecm_front_end_ipv6_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 166 | if (0 != ret) { |
| 167 | goto err_fe_ipv6; |
| 168 | } |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 169 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 170 | |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 171 | ret = ecm_front_end_conntrack_notifier_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 172 | if (0 != ret) { |
| 173 | goto err_ct; |
| 174 | } |
| 175 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 176 | #ifdef ECM_STATE_OUTPUT_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 177 | ret = ecm_state_init(ecm_dentry); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 178 | if (0 != ret) { |
| 179 | goto err_state; |
| 180 | } |
| 181 | #endif |
| 182 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 183 | printk(KERN_INFO "ECM init complete\n"); |
| 184 | return 0; |
| 185 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 186 | #ifdef ECM_STATE_OUTPUT_ENABLE |
| 187 | err_state: |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 188 | ecm_front_end_conntrack_notifier_exit(); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 189 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 190 | err_ct: |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 191 | #ifdef ECM_IPV6_ENABLE |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 192 | ecm_front_end_ipv6_exit(); |
| 193 | err_fe_ipv6: |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 194 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 195 | ecm_front_end_ipv4_exit(); |
| 196 | err_fe_ipv4: |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 197 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 198 | ecm_front_end_bond_notifier_exit(); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 199 | err_bond: |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 200 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 201 | ecm_interface_exit(); |
| 202 | err_iface: |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 203 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
| 204 | ecm_classifier_pcc_exit(); |
| 205 | err_cls_pcc: |
| 206 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 207 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 208 | ecm_classifier_dscp_exit(); |
| 209 | err_cls_dscp: |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 210 | #endif |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 211 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 212 | ecm_classifier_hyfi_rules_exit(); |
| 213 | err_cls_hyfi: |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 214 | #endif |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 215 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 216 | ecm_classifier_nl_rules_exit(); |
| 217 | err_cls_nl: |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 218 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 219 | ecm_classifier_default_exit(); |
| 220 | err_cls_default: |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 221 | ecm_db_exit(); |
| 222 | err_db: |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 223 | debugfs_remove_recursive(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 224 | |
| 225 | printk(KERN_INFO "ECM init failed: %d\n", ret); |
| 226 | return ret; |
| 227 | } |
| 228 | |
| 229 | /* |
| 230 | * ecm_exit() |
| 231 | */ |
| 232 | static void __exit ecm_exit(void) |
| 233 | { |
| 234 | printk(KERN_INFO "ECM exit\n"); |
| 235 | |
Murat Sezgin | f2b9453 | 2014-12-05 14:53:53 -0800 | [diff] [blame] | 236 | /* |
| 237 | * If the platform is not IPQ8064 and device tree is enabled, |
| 238 | * this means ECM started but none of the features are used. |
| 239 | * So, just return here. |
| 240 | */ |
| 241 | #ifdef CONFIG_OF |
| 242 | if (!of_machine_is_compatible("qcom,ipq8064")) { |
| 243 | return; |
| 244 | } |
| 245 | #endif |
| 246 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 247 | /* call stop on anything that requires a prepare-to-exit signal */ |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 248 | DEBUG_INFO("stop conntrack notifier\n"); |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 249 | ecm_front_end_conntrack_notifier_stop(1); |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 250 | DEBUG_INFO("stop front_end_ipv4\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 251 | ecm_front_end_ipv4_stop(1); |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 252 | #ifdef ECM_IPV6_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 253 | DEBUG_INFO("stop front_end_ipv6\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 254 | ecm_front_end_ipv6_stop(1); |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 255 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 256 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 257 | DEBUG_INFO("stop bond notifier\n"); |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 258 | ecm_front_end_bond_notifier_stop(1); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 259 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 260 | DEBUG_INFO("defunct all db connections\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 261 | ecm_db_connection_defunct_all(); |
| 262 | |
| 263 | /* now call exit on each module */ |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 264 | #ifdef ECM_STATE_OUTPUT_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 265 | DEBUG_INFO("stop state\n"); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 266 | ecm_state_exit(); |
| 267 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 268 | DEBUG_INFO("exit conntrack notifier\n"); |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 269 | ecm_front_end_conntrack_notifier_exit(); |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 270 | DEBUG_INFO("exit front_end_ipv4\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 271 | ecm_front_end_ipv4_exit(); |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 272 | #ifdef ECM_IPV6_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 273 | DEBUG_INFO("exit front_end_ipv6\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 274 | ecm_front_end_ipv6_exit(); |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 275 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 276 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 277 | DEBUG_INFO("exit bond notifier\n"); |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 278 | ecm_front_end_bond_notifier_exit(); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 279 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 280 | DEBUG_INFO("exit interface\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 281 | ecm_interface_exit(); |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 282 | |
| 283 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 284 | DEBUG_INFO("exit pcc classifier\n"); |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 285 | ecm_classifier_pcc_exit(); |
| 286 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 287 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 288 | DEBUG_INFO("exit dscp classifier\n"); |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 289 | ecm_classifier_dscp_exit(); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 290 | #endif |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 291 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 292 | DEBUG_INFO("exit hyfi classifier\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 293 | ecm_classifier_hyfi_rules_exit(); |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 294 | #endif |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 295 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 296 | DEBUG_INFO("exit nl classifier\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 297 | ecm_classifier_nl_rules_exit(); |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 298 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 299 | DEBUG_INFO("exit default classifier\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 300 | ecm_classifier_default_exit(); |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 301 | DEBUG_INFO("exit db\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 302 | ecm_db_exit(); |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 303 | |
| 304 | if (ecm_dentry != NULL) { |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 305 | DEBUG_INFO("remove ecm debugfs\n"); |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 306 | debugfs_remove_recursive(ecm_dentry); |
| 307 | } |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 308 | |
| 309 | printk(KERN_INFO "ECM exit complete\n"); |
| 310 | } |
| 311 | |
| 312 | module_init(ecm_init) |
| 313 | module_exit(ecm_exit) |
| 314 | |
| 315 | MODULE_AUTHOR("Qualcomm Atheros, Inc."); |
| 316 | MODULE_DESCRIPTION("ECM Core"); |
| 317 | #ifdef MODULE_LICENSE |
| 318 | MODULE_LICENSE("Dual BSD/GPL"); |
| 319 | #endif |
| 320 | |