Commit a2cfd45b authored by Allan Stephens's avatar Allan Stephens Committed by Paul Gortmaker

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: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent 9cf6ace5
...@@ -489,6 +489,21 @@ int tipc_cfg_init(void) ...@@ -489,6 +489,21 @@ int tipc_cfg_init(void)
return res; return res;
} }
void tipc_cfg_reinit(void)
{
struct tipc_name_seq seq;
int res;
seq.type = TIPC_CFG_SRV;
seq.lower = seq.upper = 0;
tipc_withdraw(config_port_ref, TIPC_ZONE_SCOPE, &seq);
seq.lower = seq.upper = tipc_own_addr;
res = tipc_publish(config_port_ref, TIPC_ZONE_SCOPE, &seq);
if (res)
err("Unable to reinitialize configuration service\n");
}
void tipc_cfg_stop(void) void tipc_cfg_stop(void)
{ {
if (config_port_ref) { if (config_port_ref) {
......
...@@ -66,6 +66,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, ...@@ -66,6 +66,7 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd,
int headroom); int headroom);
int tipc_cfg_init(void); int tipc_cfg_init(void);
void tipc_cfg_reinit(void);
void tipc_cfg_stop(void); void tipc_cfg_stop(void);
#endif #endif
...@@ -176,7 +176,6 @@ int tipc_net_start(u32 addr) ...@@ -176,7 +176,6 @@ int tipc_net_start(u32 addr)
char addr_string[16]; char addr_string[16];
tipc_subscr_stop(); tipc_subscr_stop();
tipc_cfg_stop();
write_lock_bh(&tipc_net_lock); write_lock_bh(&tipc_net_lock);
tipc_own_addr = addr; tipc_own_addr = addr;
...@@ -186,7 +185,7 @@ int tipc_net_start(u32 addr) ...@@ -186,7 +185,7 @@ int tipc_net_start(u32 addr)
write_unlock_bh(&tipc_net_lock); write_unlock_bh(&tipc_net_lock);
tipc_k_signal((Handler)tipc_subscr_start, 0); tipc_k_signal((Handler)tipc_subscr_start, 0);
tipc_k_signal((Handler)tipc_cfg_init, 0); tipc_cfg_reinit();
info("Started in network mode\n"); info("Started in network mode\n");
info("Own node address %s, network identity %u\n", info("Own node address %s, network identity %u\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment