diff options
author | Michal Marek <mmarek@suse.cz> | 2010-08-04 07:59:13 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-08-04 07:59:13 -0400 |
commit | 772320e84588dcbe1600ffb83e5f328f2209ac2a (patch) | |
tree | a7de21b79340aeaa17c58126f6b801b82c77b53a /net/tipc/net.c | |
parent | 1ce53adf13a54375d2a5c7cdbe341b2558389615 (diff) | |
parent | 9fe6206f400646a2322096b56c59891d530e8d51 (diff) |
Merge commit 'v2.6.35' into kbuild/kbuild
Conflicts:
arch/powerpc/Makefile
Diffstat (limited to 'net/tipc/net.c')
-rw-r--r-- | net/tipc/net.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/net/tipc/net.c b/net/tipc/net.c index 7906608bf510..f61b7694138b 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -116,7 +116,8 @@ | |||
116 | */ | 116 | */ |
117 | 117 | ||
118 | DEFINE_RWLOCK(tipc_net_lock); | 118 | DEFINE_RWLOCK(tipc_net_lock); |
119 | struct network tipc_net = { NULL }; | 119 | static struct _zone *tipc_zones[256] = { NULL, }; |
120 | struct network tipc_net = { tipc_zones }; | ||
120 | 121 | ||
121 | struct tipc_node *tipc_net_select_remote_node(u32 addr, u32 ref) | 122 | struct tipc_node *tipc_net_select_remote_node(u32 addr, u32 ref) |
122 | { | 123 | { |
@@ -158,28 +159,12 @@ void tipc_net_send_external_routes(u32 dest) | |||
158 | } | 159 | } |
159 | } | 160 | } |
160 | 161 | ||
161 | static int net_init(void) | ||
162 | { | ||
163 | memset(&tipc_net, 0, sizeof(tipc_net)); | ||
164 | tipc_net.zones = kcalloc(tipc_max_zones + 1, sizeof(struct _zone *), GFP_ATOMIC); | ||
165 | if (!tipc_net.zones) { | ||
166 | return -ENOMEM; | ||
167 | } | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static void net_stop(void) | 162 | static void net_stop(void) |
172 | { | 163 | { |
173 | u32 z_num; | 164 | u32 z_num; |
174 | 165 | ||
175 | if (!tipc_net.zones) | 166 | for (z_num = 1; z_num <= tipc_max_zones; z_num++) |
176 | return; | ||
177 | |||
178 | for (z_num = 1; z_num <= tipc_max_zones; z_num++) { | ||
179 | tipc_zone_delete(tipc_net.zones[z_num]); | 167 | tipc_zone_delete(tipc_net.zones[z_num]); |
180 | } | ||
181 | kfree(tipc_net.zones); | ||
182 | tipc_net.zones = NULL; | ||
183 | } | 168 | } |
184 | 169 | ||
185 | static void net_route_named_msg(struct sk_buff *buf) | 170 | static void net_route_named_msg(struct sk_buff *buf) |
@@ -234,7 +219,7 @@ void tipc_net_route_msg(struct sk_buff *buf) | |||
234 | 219 | ||
235 | /* Handle message for this node */ | 220 | /* Handle message for this node */ |
236 | dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg); | 221 | dnode = msg_short(msg) ? tipc_own_addr : msg_destnode(msg); |
237 | if (in_scope(dnode, tipc_own_addr)) { | 222 | if (tipc_in_scope(dnode, tipc_own_addr)) { |
238 | if (msg_isdata(msg)) { | 223 | if (msg_isdata(msg)) { |
239 | if (msg_mcast(msg)) | 224 | if (msg_mcast(msg)) |
240 | tipc_port_recv_mcast(buf, NULL); | 225 | tipc_port_recv_mcast(buf, NULL); |
@@ -282,9 +267,7 @@ int tipc_net_start(u32 addr) | |||
282 | tipc_named_reinit(); | 267 | tipc_named_reinit(); |
283 | tipc_port_reinit(); | 268 | tipc_port_reinit(); |
284 | 269 | ||
285 | if ((res = tipc_bearer_init()) || | 270 | if ((res = tipc_cltr_init()) || |
286 | (res = net_init()) || | ||
287 | (res = tipc_cltr_init()) || | ||
288 | (res = tipc_bclink_init())) { | 271 | (res = tipc_bclink_init())) { |
289 | return res; | 272 | return res; |
290 | } | 273 | } |
@@ -294,7 +277,7 @@ int tipc_net_start(u32 addr) | |||
294 | 277 | ||
295 | info("Started in network mode\n"); | 278 | info("Started in network mode\n"); |
296 | info("Own node address %s, network identity %u\n", | 279 | info("Own node address %s, network identity %u\n", |
297 | addr_string_fill(addr_string, tipc_own_addr), tipc_net_id); | 280 | tipc_addr_string_fill(addr_string, tipc_own_addr), tipc_net_id); |
298 | return 0; | 281 | return 0; |
299 | } | 282 | } |
300 | 283 | ||
@@ -308,6 +291,6 @@ void tipc_net_stop(void) | |||
308 | tipc_bclink_stop(); | 291 | tipc_bclink_stop(); |
309 | net_stop(); | 292 | net_stop(); |
310 | write_unlock_bh(&tipc_net_lock); | 293 | write_unlock_bh(&tipc_net_lock); |
311 | info("Left network mode \n"); | 294 | info("Left network mode\n"); |
312 | } | 295 | } |
313 | 296 | ||