Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Allan Stephens and committed by
Paul Gortmaker
a2cfd45b 9cf6ace5

+17 -2
+15
net/tipc/config.c
··· 489 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 507 void tipc_cfg_stop(void) 493 508 { 494 509 if (config_port_ref) {
+1
net/tipc/config.h
··· 66 66 int headroom); 67 67 68 68 int tipc_cfg_init(void); 69 + void tipc_cfg_reinit(void); 69 70 void tipc_cfg_stop(void); 70 71 71 72 #endif
+1 -2
net/tipc/net.c
··· 176 176 char addr_string[16]; 177 177 178 178 tipc_subscr_stop(); 179 - tipc_cfg_stop(); 180 179 181 180 write_lock_bh(&tipc_net_lock); 182 181 tipc_own_addr = addr; ··· 185 186 write_unlock_bh(&tipc_net_lock); 186 187 187 188 tipc_k_signal((Handler)tipc_subscr_start, 0); 188 - tipc_k_signal((Handler)tipc_cfg_init, 0); 189 + tipc_cfg_reinit(); 189 190 190 191 info("Started in network mode\n"); 191 192 info("Own node address %s, network identity %u\n",