diff options
Diffstat (limited to 'net/tipc/core.c')
-rw-r--r-- | net/tipc/core.c | 101 |
1 files changed, 21 insertions, 80 deletions
diff --git a/net/tipc/core.c b/net/tipc/core.c index e2a09eb8efd4..e071579e0850 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c | |||
@@ -34,37 +34,17 @@ | |||
34 | * POSSIBILITY OF SUCH DAMAGE. | 34 | * POSSIBILITY OF SUCH DAMAGE. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <linux/init.h> | ||
38 | #include <linux/module.h> | ||
39 | #include <linux/kernel.h> | ||
40 | #include <linux/random.h> | ||
41 | |||
42 | #include "core.h" | 37 | #include "core.h" |
43 | #include "dbg.h" | ||
44 | #include "ref.h" | 38 | #include "ref.h" |
45 | #include "net.h" | ||
46 | #include "user_reg.h" | ||
47 | #include "name_table.h" | 39 | #include "name_table.h" |
48 | #include "subscr.h" | 40 | #include "subscr.h" |
49 | #include "config.h" | 41 | #include "config.h" |
50 | 42 | ||
51 | 43 | ||
52 | #ifndef CONFIG_TIPC_ZONES | ||
53 | #define CONFIG_TIPC_ZONES 3 | ||
54 | #endif | ||
55 | |||
56 | #ifndef CONFIG_TIPC_CLUSTERS | ||
57 | #define CONFIG_TIPC_CLUSTERS 1 | ||
58 | #endif | ||
59 | |||
60 | #ifndef CONFIG_TIPC_NODES | 44 | #ifndef CONFIG_TIPC_NODES |
61 | #define CONFIG_TIPC_NODES 255 | 45 | #define CONFIG_TIPC_NODES 255 |
62 | #endif | 46 | #endif |
63 | 47 | ||
64 | #ifndef CONFIG_TIPC_SLAVE_NODES | ||
65 | #define CONFIG_TIPC_SLAVE_NODES 0 | ||
66 | #endif | ||
67 | |||
68 | #ifndef CONFIG_TIPC_PORTS | 48 | #ifndef CONFIG_TIPC_PORTS |
69 | #define CONFIG_TIPC_PORTS 8191 | 49 | #define CONFIG_TIPC_PORTS 8191 |
70 | #endif | 50 | #endif |
@@ -85,10 +65,7 @@ const char tipc_alphabet[] = | |||
85 | /* configurable TIPC parameters */ | 65 | /* configurable TIPC parameters */ |
86 | 66 | ||
87 | u32 tipc_own_addr; | 67 | u32 tipc_own_addr; |
88 | int tipc_max_zones; | ||
89 | int tipc_max_clusters; | ||
90 | int tipc_max_nodes; | 68 | int tipc_max_nodes; |
91 | int tipc_max_slaves; | ||
92 | int tipc_max_ports; | 69 | int tipc_max_ports; |
93 | int tipc_max_subscriptions; | 70 | int tipc_max_subscriptions; |
94 | int tipc_max_publications; | 71 | int tipc_max_publications; |
@@ -138,10 +115,11 @@ int tipc_core_start_net(unsigned long addr) | |||
138 | { | 115 | { |
139 | int res; | 116 | int res; |
140 | 117 | ||
141 | if ((res = tipc_net_start(addr)) || | 118 | res = tipc_net_start(addr); |
142 | (res = tipc_eth_media_start())) { | 119 | if (!res) |
120 | res = tipc_eth_media_start(); | ||
121 | if (res) | ||
143 | tipc_core_stop_net(); | 122 | tipc_core_stop_net(); |
144 | } | ||
145 | return res; | 123 | return res; |
146 | } | 124 | } |
147 | 125 | ||
@@ -160,7 +138,6 @@ static void tipc_core_stop(void) | |||
160 | tipc_handler_stop(); | 138 | tipc_handler_stop(); |
161 | tipc_cfg_stop(); | 139 | tipc_cfg_stop(); |
162 | tipc_subscr_stop(); | 140 | tipc_subscr_stop(); |
163 | tipc_reg_stop(); | ||
164 | tipc_nametbl_stop(); | 141 | tipc_nametbl_stop(); |
165 | tipc_ref_table_stop(); | 142 | tipc_ref_table_stop(); |
166 | tipc_socket_stop(); | 143 | tipc_socket_stop(); |
@@ -181,16 +158,22 @@ static int tipc_core_start(void) | |||
181 | get_random_bytes(&tipc_random, sizeof(tipc_random)); | 158 | get_random_bytes(&tipc_random, sizeof(tipc_random)); |
182 | tipc_mode = TIPC_NODE_MODE; | 159 | tipc_mode = TIPC_NODE_MODE; |
183 | 160 | ||
184 | if ((res = tipc_handler_start()) || | 161 | res = tipc_handler_start(); |
185 | (res = tipc_ref_table_init(tipc_max_ports, tipc_random)) || | 162 | if (!res) |
186 | (res = tipc_reg_start()) || | 163 | res = tipc_ref_table_init(tipc_max_ports, tipc_random); |
187 | (res = tipc_nametbl_init()) || | 164 | if (!res) |
188 | (res = tipc_k_signal((Handler)tipc_subscr_start, 0)) || | 165 | res = tipc_nametbl_init(); |
189 | (res = tipc_k_signal((Handler)tipc_cfg_init, 0)) || | 166 | if (!res) |
190 | (res = tipc_netlink_start()) || | 167 | res = tipc_k_signal((Handler)tipc_subscr_start, 0); |
191 | (res = tipc_socket_init())) { | 168 | if (!res) |
169 | res = tipc_k_signal((Handler)tipc_cfg_init, 0); | ||
170 | if (!res) | ||
171 | res = tipc_netlink_start(); | ||
172 | if (!res) | ||
173 | res = tipc_socket_init(); | ||
174 | if (res) | ||
192 | tipc_core_stop(); | 175 | tipc_core_stop(); |
193 | } | 176 | |
194 | return res; | 177 | return res; |
195 | } | 178 | } |
196 | 179 | ||
@@ -210,13 +193,11 @@ static int __init tipc_init(void) | |||
210 | tipc_max_publications = 10000; | 193 | tipc_max_publications = 10000; |
211 | tipc_max_subscriptions = 2000; | 194 | tipc_max_subscriptions = 2000; |
212 | tipc_max_ports = CONFIG_TIPC_PORTS; | 195 | tipc_max_ports = CONFIG_TIPC_PORTS; |
213 | tipc_max_zones = CONFIG_TIPC_ZONES; | ||
214 | tipc_max_clusters = CONFIG_TIPC_CLUSTERS; | ||
215 | tipc_max_nodes = CONFIG_TIPC_NODES; | 196 | tipc_max_nodes = CONFIG_TIPC_NODES; |
216 | tipc_max_slaves = CONFIG_TIPC_SLAVE_NODES; | ||
217 | tipc_net_id = 4711; | 197 | tipc_net_id = 4711; |
218 | 198 | ||
219 | if ((res = tipc_core_start())) | 199 | res = tipc_core_start(); |
200 | if (res) | ||
220 | err("Unable to start in single node mode\n"); | 201 | err("Unable to start in single node mode\n"); |
221 | else | 202 | else |
222 | info("Started in single node mode\n"); | 203 | info("Started in single node mode\n"); |
@@ -236,43 +217,3 @@ module_exit(tipc_exit); | |||
236 | MODULE_DESCRIPTION("TIPC: Transparent Inter Process Communication"); | 217 | MODULE_DESCRIPTION("TIPC: Transparent Inter Process Communication"); |
237 | MODULE_LICENSE("Dual BSD/GPL"); | 218 | MODULE_LICENSE("Dual BSD/GPL"); |
238 | MODULE_VERSION(TIPC_MOD_VER); | 219 | MODULE_VERSION(TIPC_MOD_VER); |
239 | |||
240 | /* Native TIPC API for kernel-space applications (see tipc.h) */ | ||
241 | |||
242 | EXPORT_SYMBOL(tipc_attach); | ||
243 | EXPORT_SYMBOL(tipc_detach); | ||
244 | EXPORT_SYMBOL(tipc_createport); | ||
245 | EXPORT_SYMBOL(tipc_deleteport); | ||
246 | EXPORT_SYMBOL(tipc_ownidentity); | ||
247 | EXPORT_SYMBOL(tipc_portimportance); | ||
248 | EXPORT_SYMBOL(tipc_set_portimportance); | ||
249 | EXPORT_SYMBOL(tipc_portunreliable); | ||
250 | EXPORT_SYMBOL(tipc_set_portunreliable); | ||
251 | EXPORT_SYMBOL(tipc_portunreturnable); | ||
252 | EXPORT_SYMBOL(tipc_set_portunreturnable); | ||
253 | EXPORT_SYMBOL(tipc_publish); | ||
254 | EXPORT_SYMBOL(tipc_withdraw); | ||
255 | EXPORT_SYMBOL(tipc_connect2port); | ||
256 | EXPORT_SYMBOL(tipc_disconnect); | ||
257 | EXPORT_SYMBOL(tipc_shutdown); | ||
258 | EXPORT_SYMBOL(tipc_send); | ||
259 | EXPORT_SYMBOL(tipc_send2name); | ||
260 | EXPORT_SYMBOL(tipc_send2port); | ||
261 | EXPORT_SYMBOL(tipc_multicast); | ||
262 | |||
263 | /* TIPC API for external bearers (see tipc_bearer.h) */ | ||
264 | |||
265 | EXPORT_SYMBOL(tipc_block_bearer); | ||
266 | EXPORT_SYMBOL(tipc_continue); | ||
267 | EXPORT_SYMBOL(tipc_disable_bearer); | ||
268 | EXPORT_SYMBOL(tipc_enable_bearer); | ||
269 | EXPORT_SYMBOL(tipc_recv_msg); | ||
270 | EXPORT_SYMBOL(tipc_register_media); | ||
271 | |||
272 | /* TIPC API for external APIs (see tipc_port.h) */ | ||
273 | |||
274 | EXPORT_SYMBOL(tipc_createport_raw); | ||
275 | EXPORT_SYMBOL(tipc_reject_msg); | ||
276 | EXPORT_SYMBOL(tipc_send_buf_fast); | ||
277 | EXPORT_SYMBOL(tipc_acknowledge); | ||
278 | |||