diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2012-04-26 16:46:29 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-04-26 17:19:07 -0400 |
commit | a2cfd45b52006893fc0d0e850d187d30f86a39dc (patch) | |
tree | 37021cbc2fc95db7d3e4c6bc19b5f70f3b5ba598 /net/tipc | |
parent | 9cf6ace5f5c7981f5df76af3e1b90d77cc3cdece (diff) |
tipc: Optimize re-initialization of configuration service
Streamlines the job of re-initializing TIPC's configuration service
when a node's network address is first assigned. Rather than destroying
the configuration server port and then recreating it, TIPC now simply
withdraws the existing {0,<0.0.0>} name publication and creates a new
{0,<Z.C.N>} name publication that identifies the node's network address
to interested subscribers.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/config.c | 15 | ||||
-rw-r--r-- | net/tipc/config.h | 1 | ||||
-rw-r--r-- | net/tipc/net.c | 3 |
3 files changed, 17 insertions, 2 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c index f5458eddd7bc..a4988cdbde6d 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -489,6 +489,21 @@ failed: | |||
489 | return res; | 489 | return res; |
490 | } | 490 | } |
491 | 491 | ||
492 | void tipc_cfg_reinit(void) | ||
493 | { | ||
494 | struct tipc_name_seq seq; | ||
495 | int res; | ||
496 | |||
497 | seq.type = TIPC_CFG_SRV; | ||
498 | seq.lower = seq.upper = 0; | ||
499 | tipc_withdraw(config_port_ref, TIPC_ZONE_SCOPE, &seq); | ||
500 | |||
501 | seq.lower = seq.upper = tipc_own_addr; | ||
502 | res = tipc_publish(config_port_ref, TIPC_ZONE_SCOPE, &seq); | ||
503 | if (res) | ||
504 | err("Unable to reinitialize configuration service\n"); | ||
505 | } | ||
506 | |||
492 | void tipc_cfg_stop(void) | 507 | void tipc_cfg_stop(void) |
493 | { | 508 | { |
494 | if (config_port_ref) { | 509 | if (config_port_ref) { |
diff --git a/net/tipc/config.h b/net/tipc/config.h index 80da6ebc2785..1f252f3fa058 100644 --- a/net/tipc/config.h +++ b/net/tipc/config.h | |||
@@ -66,6 +66,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, | |||
66 | int headroom); | 66 | int headroom); |
67 | 67 | ||
68 | int tipc_cfg_init(void); | 68 | int tipc_cfg_init(void); |
69 | void tipc_cfg_reinit(void); | ||
69 | void tipc_cfg_stop(void); | 70 | void tipc_cfg_stop(void); |
70 | 71 | ||
71 | #endif | 72 | #endif |
diff --git a/net/tipc/net.c b/net/tipc/net.c index 5fab4ff24a94..f4a490b0cf4c 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -176,7 +176,6 @@ int tipc_net_start(u32 addr) | |||
176 | char addr_string[16]; | 176 | char addr_string[16]; |
177 | 177 | ||
178 | tipc_subscr_stop(); | 178 | tipc_subscr_stop(); |
179 | tipc_cfg_stop(); | ||
180 | 179 | ||
181 | write_lock_bh(&tipc_net_lock); | 180 | write_lock_bh(&tipc_net_lock); |
182 | tipc_own_addr = addr; | 181 | tipc_own_addr = addr; |
@@ -186,7 +185,7 @@ int tipc_net_start(u32 addr) | |||
186 | write_unlock_bh(&tipc_net_lock); | 185 | write_unlock_bh(&tipc_net_lock); |
187 | 186 | ||
188 | tipc_k_signal((Handler)tipc_subscr_start, 0); | 187 | tipc_k_signal((Handler)tipc_subscr_start, 0); |
189 | tipc_k_signal((Handler)tipc_cfg_init, 0); | 188 | tipc_cfg_reinit(); |
190 | 189 | ||
191 | info("Started in network mode\n"); | 190 | info("Started in network mode\n"); |
192 | info("Own node address %s, network identity %u\n", | 191 | info("Own node address %s, network identity %u\n", |