diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-13 21:49:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-13 21:49:11 -0400 |
commit | 27b61ae2d73936554fcd07e77c3cc13bc88c41a9 (patch) | |
tree | 12f589c6a4671bf7f08045bb11059514f47bb924 /net/tipc/net.c | |
parent | 46af31800b6916c92fffa529dc3c357008da957d (diff) | |
parent | 633d2bdedc3b81f202bda8fdad17aeb08809b7df (diff) |
Merge branch 'tipc-Mar13-2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/net-next-2.6
Diffstat (limited to 'net/tipc/net.c')
-rw-r--r-- | net/tipc/net.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/net/tipc/net.c b/net/tipc/net.c index 9bacfd00b91e..8fbc7e6ae3df 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * net/tipc/net.c: TIPC network routing code | 2 | * net/tipc/net.c: TIPC network routing code |
3 | * | 3 | * |
4 | * Copyright (c) 1995-2006, Ericsson AB | 4 | * Copyright (c) 1995-2006, Ericsson AB |
5 | * Copyright (c) 2005, Wind River Systems | 5 | * Copyright (c) 2005, 2010-2011, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -39,6 +39,7 @@ | |||
39 | #include "name_distr.h" | 39 | #include "name_distr.h" |
40 | #include "subscr.h" | 40 | #include "subscr.h" |
41 | #include "port.h" | 41 | #include "port.h" |
42 | #include "node.h" | ||
42 | #include "config.h" | 43 | #include "config.h" |
43 | 44 | ||
44 | /* | 45 | /* |
@@ -108,26 +109,6 @@ | |||
108 | */ | 109 | */ |
109 | 110 | ||
110 | DEFINE_RWLOCK(tipc_net_lock); | 111 | DEFINE_RWLOCK(tipc_net_lock); |
111 | struct network tipc_net; | ||
112 | |||
113 | static int net_start(void) | ||
114 | { | ||
115 | tipc_net.nodes = kcalloc(tipc_max_nodes + 1, | ||
116 | sizeof(*tipc_net.nodes), GFP_ATOMIC); | ||
117 | tipc_net.highest_node = 0; | ||
118 | |||
119 | return tipc_net.nodes ? 0 : -ENOMEM; | ||
120 | } | ||
121 | |||
122 | static void net_stop(void) | ||
123 | { | ||
124 | u32 n_num; | ||
125 | |||
126 | for (n_num = 1; n_num <= tipc_net.highest_node; n_num++) | ||
127 | tipc_node_delete(tipc_net.nodes[n_num]); | ||
128 | kfree(tipc_net.nodes); | ||
129 | tipc_net.nodes = NULL; | ||
130 | } | ||
131 | 112 | ||
132 | static void net_route_named_msg(struct sk_buff *buf) | 113 | static void net_route_named_msg(struct sk_buff *buf) |
133 | { | 114 | { |
@@ -217,9 +198,6 @@ int tipc_net_start(u32 addr) | |||
217 | tipc_named_reinit(); | 198 | tipc_named_reinit(); |
218 | tipc_port_reinit(); | 199 | tipc_port_reinit(); |
219 | 200 | ||
220 | res = net_start(); | ||
221 | if (res) | ||
222 | return res; | ||
223 | res = tipc_bclink_init(); | 201 | res = tipc_bclink_init(); |
224 | if (res) | 202 | if (res) |
225 | return res; | 203 | return res; |
@@ -235,14 +213,16 @@ int tipc_net_start(u32 addr) | |||
235 | 213 | ||
236 | void tipc_net_stop(void) | 214 | void tipc_net_stop(void) |
237 | { | 215 | { |
216 | struct tipc_node *node, *t_node; | ||
217 | |||
238 | if (tipc_mode != TIPC_NET_MODE) | 218 | if (tipc_mode != TIPC_NET_MODE) |
239 | return; | 219 | return; |
240 | write_lock_bh(&tipc_net_lock); | 220 | write_lock_bh(&tipc_net_lock); |
241 | tipc_bearer_stop(); | 221 | tipc_bearer_stop(); |
242 | tipc_mode = TIPC_NODE_MODE; | 222 | tipc_mode = TIPC_NODE_MODE; |
243 | tipc_bclink_stop(); | 223 | tipc_bclink_stop(); |
244 | net_stop(); | 224 | list_for_each_entry_safe(node, t_node, &tipc_node_list, list); |
225 | tipc_node_delete(node); | ||
245 | write_unlock_bh(&tipc_net_lock); | 226 | write_unlock_bh(&tipc_net_lock); |
246 | info("Left network mode\n"); | 227 | info("Left network mode\n"); |
247 | } | 228 | } |
248 | |||