aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/core.c')
-rw-r--r--net/tipc/core.c101
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
87u32 tipc_own_addr; 67u32 tipc_own_addr;
88int tipc_max_zones;
89int tipc_max_clusters;
90int tipc_max_nodes; 68int tipc_max_nodes;
91int tipc_max_slaves;
92int tipc_max_ports; 69int tipc_max_ports;
93int tipc_max_subscriptions; 70int tipc_max_subscriptions;
94int tipc_max_publications; 71int 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);
236MODULE_DESCRIPTION("TIPC: Transparent Inter Process Communication"); 217MODULE_DESCRIPTION("TIPC: Transparent Inter Process Communication");
237MODULE_LICENSE("Dual BSD/GPL"); 218MODULE_LICENSE("Dual BSD/GPL");
238MODULE_VERSION(TIPC_MOD_VER); 219MODULE_VERSION(TIPC_MOD_VER);
239
240/* Native TIPC API for kernel-space applications (see tipc.h) */
241
242EXPORT_SYMBOL(tipc_attach);
243EXPORT_SYMBOL(tipc_detach);
244EXPORT_SYMBOL(tipc_createport);
245EXPORT_SYMBOL(tipc_deleteport);
246EXPORT_SYMBOL(tipc_ownidentity);
247EXPORT_SYMBOL(tipc_portimportance);
248EXPORT_SYMBOL(tipc_set_portimportance);
249EXPORT_SYMBOL(tipc_portunreliable);
250EXPORT_SYMBOL(tipc_set_portunreliable);
251EXPORT_SYMBOL(tipc_portunreturnable);
252EXPORT_SYMBOL(tipc_set_portunreturnable);
253EXPORT_SYMBOL(tipc_publish);
254EXPORT_SYMBOL(tipc_withdraw);
255EXPORT_SYMBOL(tipc_connect2port);
256EXPORT_SYMBOL(tipc_disconnect);
257EXPORT_SYMBOL(tipc_shutdown);
258EXPORT_SYMBOL(tipc_send);
259EXPORT_SYMBOL(tipc_send2name);
260EXPORT_SYMBOL(tipc_send2port);
261EXPORT_SYMBOL(tipc_multicast);
262
263/* TIPC API for external bearers (see tipc_bearer.h) */
264
265EXPORT_SYMBOL(tipc_block_bearer);
266EXPORT_SYMBOL(tipc_continue);
267EXPORT_SYMBOL(tipc_disable_bearer);
268EXPORT_SYMBOL(tipc_enable_bearer);
269EXPORT_SYMBOL(tipc_recv_msg);
270EXPORT_SYMBOL(tipc_register_media);
271
272/* TIPC API for external APIs (see tipc_port.h) */
273
274EXPORT_SYMBOL(tipc_createport_raw);
275EXPORT_SYMBOL(tipc_reject_msg);
276EXPORT_SYMBOL(tipc_send_buf_fast);
277EXPORT_SYMBOL(tipc_acknowledge);
278