42 #define NODE_HTABLE_SIZE 512
44 static void node_lost_contact(
struct tipc_node *n_ptr);
45 static void node_established_contact(
struct tipc_node *n_ptr);
51 static u32 tipc_num_nodes;
61 static unsigned int tipc_hashfn(
u32 addr)
74 if (
unlikely(!in_own_cluster_exact(addr)))
78 if (node->
addr == addr)
97 spin_lock_bh(&node_create_lock);
101 spin_unlock_bh(&node_create_lock);
107 spin_unlock_bh(&node_create_lock);
108 pr_warn(
"Node creation failed, no memory\n");
114 INIT_HLIST_NODE(&n_ptr->
hash);
115 INIT_LIST_HEAD(&n_ptr->
list);
116 INIT_LIST_HEAD(&n_ptr->
nsub);
118 hlist_add_head(&n_ptr->
hash, &node_htable[tipc_hashfn(addr)]);
130 spin_unlock_bh(&node_create_lock);
137 hlist_del(&n_ptr->
hash);
154 pr_info(
"Established link <%s> on network plane %c\n",
158 active[0] = active[1] = l_ptr;
159 node_established_contact(n_ptr);
163 pr_info(
"New link <%s> becomes standby\n", l_ptr->
name);
171 pr_info(
"Old link <%s> becomes standby\n", active[0]->
name);
172 if (active[1] != active[0])
173 pr_info(
"Old link <%s> becomes standby\n", active[1]->
name);
174 active[0] = active[1] = l_ptr;
180 static void node_select_active_links(
struct tipc_node *n_ptr)
184 u32 highest_prio = 0;
186 active[0] = active[1] =
NULL;
195 if (l_ptr->
priority > highest_prio) {
197 active[0] = active[1] = l_ptr;
214 pr_info(
"Lost standby link <%s> on network plane %c\n",
218 pr_info(
"Lost link <%s> on network plane %c\n",
222 if (active[0] == l_ptr)
223 active[0] = active[1];
224 if (active[1] == l_ptr)
225 active[1] = active[0];
226 if (active[0] == l_ptr)
227 node_select_active_links(n_ptr);
231 node_lost_contact(n_ptr);
263 static void node_established_contact(
struct tipc_node *n_ptr)
267 if (n_ptr->
bclink.supportable) {
270 n_ptr->
bclink.supported = 1;
274 static void node_name_purge_complete(
unsigned long node_addr)
281 tipc_node_lock(n_ptr);
283 tipc_node_unlock(n_ptr);
288 static void node_lost_contact(
struct tipc_node *n_ptr)
290 char addr_string[16];
293 pr_info(
"Lost contact with %s\n",
297 if (n_ptr->
bclink.supported) {
298 while (n_ptr->
bclink.deferred_head) {
303 n_ptr->
bclink.deferred_size = 0;
305 if (n_ptr->
bclink.defragm) {
313 n_ptr->
bclink.supported = 0;
348 " (network address)");
351 if (!tipc_num_nodes) {
353 return tipc_cfg_reply_none();
357 payload_size =
TLV_SPACE(
sizeof(node_info)) * tipc_num_nodes;
358 if (payload_size > 32768
u) {
361 " (too many nodes)");
376 &node_info,
sizeof(node_info));
397 " (network address)");
400 return tipc_cfg_reply_none();
405 payload_size =
TLV_SPACE(
sizeof(link_info)) *
407 if (payload_size > 32768
u) {
410 " (too many links)");
419 link_info.
dest =
htonl(tipc_cluster_mask(tipc_own_addr));
430 tipc_node_lock(n_ptr);
432 if (!n_ptr->
links[i])
438 &link_info,
sizeof(link_info));
440 tipc_node_unlock(n_ptr);