aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r--net/tipc/node.c220
1 files changed, 110 insertions, 110 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 4111a31def79..e2e452a62ba1 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * net/tipc/node.c: TIPC node management routines 2 * net/tipc/node.c: TIPC node management routines
3 * 3 *
4 * Copyright (c) 2000-2006, Ericsson AB 4 * Copyright (c) 2000-2006, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
@@ -58,7 +58,7 @@ struct node *tipc_node_create(u32 addr)
58{ 58{
59 struct cluster *c_ptr; 59 struct cluster *c_ptr;
60 struct node *n_ptr; 60 struct node *n_ptr;
61 struct node **curr_node; 61 struct node **curr_node;
62 62
63 n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC); 63 n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC);
64 if (!n_ptr) { 64 if (!n_ptr) {
@@ -74,16 +74,16 @@ struct node *tipc_node_create(u32 addr)
74 kfree(n_ptr); 74 kfree(n_ptr);
75 return NULL; 75 return NULL;
76 } 76 }
77 77
78 n_ptr->addr = addr; 78 n_ptr->addr = addr;
79 spin_lock_init(&n_ptr->lock); 79 spin_lock_init(&n_ptr->lock);
80 INIT_LIST_HEAD(&n_ptr->nsub); 80 INIT_LIST_HEAD(&n_ptr->nsub);
81 n_ptr->owner = c_ptr; 81 n_ptr->owner = c_ptr;
82 tipc_cltr_attach_node(c_ptr, n_ptr); 82 tipc_cltr_attach_node(c_ptr, n_ptr);
83 n_ptr->last_router = -1; 83 n_ptr->last_router = -1;
84 84
85 /* Insert node into ordered list */ 85 /* Insert node into ordered list */
86 for (curr_node = &tipc_nodes; *curr_node; 86 for (curr_node = &tipc_nodes; *curr_node;
87 curr_node = &(*curr_node)->next) { 87 curr_node = &(*curr_node)->next) {
88 if (addr < (*curr_node)->addr) { 88 if (addr < (*curr_node)->addr) {
89 n_ptr->next = *curr_node; 89 n_ptr->next = *curr_node;
@@ -116,7 +116,7 @@ void tipc_node_delete(struct node *n_ptr)
116 116
117/** 117/**
118 * tipc_node_link_up - handle addition of link 118 * tipc_node_link_up - handle addition of link
119 * 119 *
120 * Link becomes active (alone or shared) or standby, depending on its priority. 120 * Link becomes active (alone or shared) or standby, depending on its priority.
121 */ 121 */
122 122
@@ -128,19 +128,19 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr)
128 128
129 info("Established link <%s> on network plane %c\n", 129 info("Established link <%s> on network plane %c\n",
130 l_ptr->name, l_ptr->b_ptr->net_plane); 130 l_ptr->name, l_ptr->b_ptr->net_plane);
131 131
132 if (!active[0]) { 132 if (!active[0]) {
133 dbg(" link %x into %x/%x\n", l_ptr, &active[0], &active[1]); 133 dbg(" link %x into %x/%x\n", l_ptr, &active[0], &active[1]);
134 active[0] = active[1] = l_ptr; 134 active[0] = active[1] = l_ptr;
135 node_established_contact(n_ptr); 135 node_established_contact(n_ptr);
136 return; 136 return;
137 } 137 }
138 if (l_ptr->priority < active[0]->priority) { 138 if (l_ptr->priority < active[0]->priority) {
139 info("New link <%s> becomes standby\n", l_ptr->name); 139 info("New link <%s> becomes standby\n", l_ptr->name);
140 return; 140 return;
141 } 141 }
142 tipc_link_send_duplicate(active[0], l_ptr); 142 tipc_link_send_duplicate(active[0], l_ptr);
143 if (l_ptr->priority == active[0]->priority) { 143 if (l_ptr->priority == active[0]->priority) {
144 active[0] = l_ptr; 144 active[0] = l_ptr;
145 return; 145 return;
146 } 146 }
@@ -160,17 +160,17 @@ static void node_select_active_links(struct node *n_ptr)
160 u32 i; 160 u32 i;
161 u32 highest_prio = 0; 161 u32 highest_prio = 0;
162 162
163 active[0] = active[1] = NULL; 163 active[0] = active[1] = NULL;
164 164
165 for (i = 0; i < MAX_BEARERS; i++) { 165 for (i = 0; i < MAX_BEARERS; i++) {
166 struct link *l_ptr = n_ptr->links[i]; 166 struct link *l_ptr = n_ptr->links[i];
167 167
168 if (!l_ptr || !tipc_link_is_up(l_ptr) || 168 if (!l_ptr || !tipc_link_is_up(l_ptr) ||
169 (l_ptr->priority < highest_prio)) 169 (l_ptr->priority < highest_prio))
170 continue; 170 continue;
171 171
172 if (l_ptr->priority > highest_prio) { 172 if (l_ptr->priority > highest_prio) {
173 highest_prio = l_ptr->priority; 173 highest_prio = l_ptr->priority;
174 active[0] = active[1] = l_ptr; 174 active[0] = active[1] = l_ptr;
175 } else { 175 } else {
176 active[1] = l_ptr; 176 active[1] = l_ptr;
@@ -203,15 +203,15 @@ void tipc_node_link_down(struct node *n_ptr, struct link *l_ptr)
203 active[1] = active[0]; 203 active[1] = active[0];
204 if (active[0] == l_ptr) 204 if (active[0] == l_ptr)
205 node_select_active_links(n_ptr); 205 node_select_active_links(n_ptr);
206 if (tipc_node_is_up(n_ptr)) 206 if (tipc_node_is_up(n_ptr))
207 tipc_link_changeover(l_ptr); 207 tipc_link_changeover(l_ptr);
208 else 208 else
209 node_lost_contact(n_ptr); 209 node_lost_contact(n_ptr);
210} 210}
211 211
212int tipc_node_has_active_links(struct node *n_ptr) 212int tipc_node_has_active_links(struct node *n_ptr)
213{ 213{
214 return (n_ptr && 214 return (n_ptr &&
215 ((n_ptr->active_links[0]) || (n_ptr->active_links[1]))); 215 ((n_ptr->active_links[0]) || (n_ptr->active_links[1])));
216} 216}
217 217
@@ -236,28 +236,28 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
236 236
237 if (!n_ptr) 237 if (!n_ptr)
238 n_ptr = tipc_node_create(l_ptr->addr); 238 n_ptr = tipc_node_create(l_ptr->addr);
239 if (n_ptr) { 239 if (n_ptr) {
240 u32 bearer_id = l_ptr->b_ptr->identity; 240 u32 bearer_id = l_ptr->b_ptr->identity;
241 char addr_string[16]; 241 char addr_string[16];
242 242
243 if (n_ptr->link_cnt >= 2) { 243 if (n_ptr->link_cnt >= 2) {
244 char addr_string[16]; 244 char addr_string[16];
245 245
246 err("Attempt to create third link to %s\n", 246 err("Attempt to create third link to %s\n",
247 addr_string_fill(addr_string, n_ptr->addr)); 247 addr_string_fill(addr_string, n_ptr->addr));
248 return NULL; 248 return NULL;
249 } 249 }
250 250
251 if (!n_ptr->links[bearer_id]) { 251 if (!n_ptr->links[bearer_id]) {
252 n_ptr->links[bearer_id] = l_ptr; 252 n_ptr->links[bearer_id] = l_ptr;
253 tipc_net.zones[tipc_zone(l_ptr->addr)]->links++; 253 tipc_net.zones[tipc_zone(l_ptr->addr)]->links++;
254 n_ptr->link_cnt++; 254 n_ptr->link_cnt++;
255 return n_ptr; 255 return n_ptr;
256 } 256 }
257 err("Attempt to establish second link on <%s> to %s \n", 257 err("Attempt to establish second link on <%s> to %s \n",
258 l_ptr->b_ptr->publ.name, 258 l_ptr->b_ptr->publ.name,
259 addr_string_fill(addr_string, l_ptr->addr)); 259 addr_string_fill(addr_string, l_ptr->addr));
260 } 260 }
261 return NULL; 261 return NULL;
262} 262}
263 263
@@ -272,17 +272,17 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr)
272 * Routing table management - five cases to handle: 272 * Routing table management - five cases to handle:
273 * 273 *
274 * 1: A link towards a zone/cluster external node comes up. 274 * 1: A link towards a zone/cluster external node comes up.
275 * => Send a multicast message updating routing tables of all 275 * => Send a multicast message updating routing tables of all
276 * system nodes within own cluster that the new destination 276 * system nodes within own cluster that the new destination
277 * can be reached via this node. 277 * can be reached via this node.
278 * (node.establishedContact()=>cluster.multicastNewRoute()) 278 * (node.establishedContact()=>cluster.multicastNewRoute())
279 * 279 *
280 * 2: A link towards a slave node comes up. 280 * 2: A link towards a slave node comes up.
281 * => Send a multicast message updating routing tables of all 281 * => Send a multicast message updating routing tables of all
282 * system nodes within own cluster that the new destination 282 * system nodes within own cluster that the new destination
283 * can be reached via this node. 283 * can be reached via this node.
284 * (node.establishedContact()=>cluster.multicastNewRoute()) 284 * (node.establishedContact()=>cluster.multicastNewRoute())
285 * => Send a message to the slave node about existence 285 * => Send a message to the slave node about existence
286 * of all system nodes within cluster: 286 * of all system nodes within cluster:
287 * (node.establishedContact()=>cluster.sendLocalRoutes()) 287 * (node.establishedContact()=>cluster.sendLocalRoutes())
288 * 288 *
@@ -292,13 +292,13 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr)
292 * nodes which can be reached via this node. 292 * nodes which can be reached via this node.
293 * (node.establishedContact()==>network.sendExternalRoutes()) 293 * (node.establishedContact()==>network.sendExternalRoutes())
294 * (node.establishedContact()==>network.sendSlaveRoutes()) 294 * (node.establishedContact()==>network.sendSlaveRoutes())
295 * => Send messages to all directly connected slave nodes 295 * => Send messages to all directly connected slave nodes
296 * containing information about the existence of the new node 296 * containing information about the existence of the new node
297 * (node.establishedContact()=>cluster.multicastNewRoute()) 297 * (node.establishedContact()=>cluster.multicastNewRoute())
298 * 298 *
299 * 4: The link towards a zone/cluster external node or slave 299 * 4: The link towards a zone/cluster external node or slave
300 * node goes down. 300 * node goes down.
301 * => Send a multcast message updating routing tables of all 301 * => Send a multcast message updating routing tables of all
302 * nodes within cluster that the new destination can not any 302 * nodes within cluster that the new destination can not any
303 * longer be reached via this node. 303 * longer be reached via this node.
304 * (node.lostAllLinks()=>cluster.bcastLostRoute()) 304 * (node.lostAllLinks()=>cluster.bcastLostRoute())
@@ -308,7 +308,7 @@ void tipc_node_detach_link(struct node *n_ptr, struct link *l_ptr)
308 * routing tables. Note: This is a completely node 308 * routing tables. Note: This is a completely node
309 * local operation. 309 * local operation.
310 * (node.lostAllLinks()=>network.removeAsRouter()) 310 * (node.lostAllLinks()=>network.removeAsRouter())
311 * => Send messages to all directly connected slave nodes 311 * => Send messages to all directly connected slave nodes
312 * containing information about loss of the node 312 * containing information about loss of the node
313 * (node.establishedContact()=>cluster.multicastLostRoute()) 313 * (node.establishedContact()=>cluster.multicastLostRoute())
314 * 314 *
@@ -319,12 +319,12 @@ static void node_established_contact(struct node *n_ptr)
319 struct cluster *c_ptr; 319 struct cluster *c_ptr;
320 320
321 dbg("node_established_contact:-> %x\n", n_ptr->addr); 321 dbg("node_established_contact:-> %x\n", n_ptr->addr);
322 if (!tipc_node_has_active_routes(n_ptr) && in_own_cluster(n_ptr->addr)) { 322 if (!tipc_node_has_active_routes(n_ptr) && in_own_cluster(n_ptr->addr)) {
323 tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr); 323 tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr);
324 } 324 }
325 325
326 /* Syncronize broadcast acks */ 326 /* Syncronize broadcast acks */
327 n_ptr->bclink.acked = tipc_bclink_get_last_sent(); 327 n_ptr->bclink.acked = tipc_bclink_get_last_sent();
328 328
329 if (is_slave(tipc_own_addr)) 329 if (is_slave(tipc_own_addr))
330 return; 330 return;
@@ -333,11 +333,11 @@ static void node_established_contact(struct node *n_ptr)
333 c_ptr = tipc_cltr_find(tipc_own_addr); 333 c_ptr = tipc_cltr_find(tipc_own_addr);
334 if (!c_ptr) 334 if (!c_ptr)
335 c_ptr = tipc_cltr_create(tipc_own_addr); 335 c_ptr = tipc_cltr_create(tipc_own_addr);
336 if (c_ptr) 336 if (c_ptr)
337 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1, 337 tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1,
338 tipc_max_nodes); 338 tipc_max_nodes);
339 return; 339 return;
340 } 340 }
341 341
342 c_ptr = n_ptr->owner; 342 c_ptr = n_ptr->owner;
343 if (is_slave(n_ptr->addr)) { 343 if (is_slave(n_ptr->addr)) {
@@ -367,26 +367,26 @@ static void node_lost_contact(struct node *n_ptr)
367 char addr_string[16]; 367 char addr_string[16];
368 u32 i; 368 u32 i;
369 369
370 /* Clean up broadcast reception remains */ 370 /* Clean up broadcast reception remains */
371 n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0; 371 n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0;
372 while (n_ptr->bclink.deferred_head) { 372 while (n_ptr->bclink.deferred_head) {
373 struct sk_buff* buf = n_ptr->bclink.deferred_head; 373 struct sk_buff* buf = n_ptr->bclink.deferred_head;
374 n_ptr->bclink.deferred_head = buf->next; 374 n_ptr->bclink.deferred_head = buf->next;
375 buf_discard(buf); 375 buf_discard(buf);
376 } 376 }
377 if (n_ptr->bclink.defragm) { 377 if (n_ptr->bclink.defragm) {
378 buf_discard(n_ptr->bclink.defragm); 378 buf_discard(n_ptr->bclink.defragm);
379 n_ptr->bclink.defragm = NULL; 379 n_ptr->bclink.defragm = NULL;
380 } 380 }
381 if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) { 381 if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) {
382 tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000)); 382 tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000));
383 } 383 }
384 384
385 /* Update routing tables */ 385 /* Update routing tables */
386 if (is_slave(tipc_own_addr)) { 386 if (is_slave(tipc_own_addr)) {
387 tipc_net_remove_as_router(n_ptr->addr); 387 tipc_net_remove_as_router(n_ptr->addr);
388 } else { 388 } else {
389 if (!in_own_cluster(n_ptr->addr)) { 389 if (!in_own_cluster(n_ptr->addr)) {
390 /* Case 4 (see above) */ 390 /* Case 4 (see above) */
391 c_ptr = tipc_cltr_find(tipc_own_addr); 391 c_ptr = tipc_cltr_find(tipc_own_addr);
392 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1, 392 tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1,
@@ -399,7 +399,7 @@ static void node_lost_contact(struct node *n_ptr)
399 tipc_max_nodes); 399 tipc_max_nodes);
400 } else { 400 } else {
401 if (n_ptr->bclink.supported) { 401 if (n_ptr->bclink.supported) {
402 tipc_nmap_remove(&tipc_cltr_bcast_nodes, 402 tipc_nmap_remove(&tipc_cltr_bcast_nodes,
403 n_ptr->addr); 403 n_ptr->addr);
404 if (n_ptr->addr < tipc_own_addr) 404 if (n_ptr->addr < tipc_own_addr)
405 tipc_own_tag--; 405 tipc_own_tag--;
@@ -414,13 +414,13 @@ static void node_lost_contact(struct node *n_ptr)
414 if (tipc_node_has_active_routes(n_ptr)) 414 if (tipc_node_has_active_routes(n_ptr))
415 return; 415 return;
416 416
417 info("Lost contact with %s\n", 417 info("Lost contact with %s\n",
418 addr_string_fill(addr_string, n_ptr->addr)); 418 addr_string_fill(addr_string, n_ptr->addr));
419 419
420 /* Abort link changeover */ 420 /* Abort link changeover */
421 for (i = 0; i < MAX_BEARERS; i++) { 421 for (i = 0; i < MAX_BEARERS; i++) {
422 struct link *l_ptr = n_ptr->links[i]; 422 struct link *l_ptr = n_ptr->links[i];
423 if (!l_ptr) 423 if (!l_ptr)
424 continue; 424 continue;
425 l_ptr->reset_checkpoint = l_ptr->next_in_no; 425 l_ptr->reset_checkpoint = l_ptr->next_in_no;
426 l_ptr->exp_msg_count = 0; 426 l_ptr->exp_msg_count = 0;
@@ -429,7 +429,7 @@ static void node_lost_contact(struct node *n_ptr)
429 429
430 /* Notify subscribers */ 430 /* Notify subscribers */
431 list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) { 431 list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) {
432 ns->node = NULL; 432 ns->node = NULL;
433 list_del_init(&ns->nodesub_list); 433 list_del_init(&ns->nodesub_list);
434 tipc_k_signal((Handler)ns->handle_node_down, 434 tipc_k_signal((Handler)ns->handle_node_down,
435 (unsigned long)ns->usr_handle); 435 (unsigned long)ns->usr_handle);
@@ -438,7 +438,7 @@ static void node_lost_contact(struct node *n_ptr)
438 438
439/** 439/**
440 * tipc_node_select_next_hop - find the next-hop node for a message 440 * tipc_node_select_next_hop - find the next-hop node for a message
441 * 441 *
442 * Called by when cluster local lookup has failed. 442 * Called by when cluster local lookup has failed.
443 */ 443 */
444 444
@@ -447,13 +447,13 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
447 struct node *n_ptr; 447 struct node *n_ptr;
448 u32 router_addr; 448 u32 router_addr;
449 449
450 if (!tipc_addr_domain_valid(addr)) 450 if (!tipc_addr_domain_valid(addr))
451 return NULL; 451 return NULL;
452 452
453 /* Look for direct link to destination processsor */ 453 /* Look for direct link to destination processsor */
454 n_ptr = tipc_node_find(addr); 454 n_ptr = tipc_node_find(addr);
455 if (n_ptr && tipc_node_has_active_links(n_ptr)) 455 if (n_ptr && tipc_node_has_active_links(n_ptr))
456 return n_ptr; 456 return n_ptr;
457 457
458 /* Cluster local system nodes *must* have direct links */ 458 /* Cluster local system nodes *must* have direct links */
459 if (!is_slave(addr) && in_own_cluster(addr)) 459 if (!is_slave(addr) && in_own_cluster(addr))
@@ -461,10 +461,10 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
461 461
462 /* Look for cluster local router with direct link to node */ 462 /* Look for cluster local router with direct link to node */
463 router_addr = tipc_node_select_router(n_ptr, selector); 463 router_addr = tipc_node_select_router(n_ptr, selector);
464 if (router_addr) 464 if (router_addr)
465 return tipc_node_select(router_addr, selector); 465 return tipc_node_select(router_addr, selector);
466 466
467 /* Slave nodes can only be accessed within own cluster via a 467 /* Slave nodes can only be accessed within own cluster via a
468 known router with direct link -- if no router was found,give up */ 468 known router with direct link -- if no router was found,give up */
469 if (is_slave(addr)) 469 if (is_slave(addr))
470 return NULL; 470 return NULL;
@@ -473,20 +473,20 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
473 addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); 473 addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
474 n_ptr = tipc_net_select_remote_node(addr, selector); 474 n_ptr = tipc_net_select_remote_node(addr, selector);
475 if (n_ptr && tipc_node_has_active_links(n_ptr)) 475 if (n_ptr && tipc_node_has_active_links(n_ptr))
476 return n_ptr; 476 return n_ptr;
477 477
478 /* Last resort -- look for any router to anywhere in remote zone */ 478 /* Last resort -- look for any router to anywhere in remote zone */
479 router_addr = tipc_net_select_router(addr, selector); 479 router_addr = tipc_net_select_router(addr, selector);
480 if (router_addr) 480 if (router_addr)
481 return tipc_node_select(router_addr, selector); 481 return tipc_node_select(router_addr, selector);
482 482
483 return NULL; 483 return NULL;
484} 484}
485 485
486/** 486/**
487 * tipc_node_select_router - select router to reach specified node 487 * tipc_node_select_router - select router to reach specified node
488 * 488 *
489 * Uses a deterministic and fair algorithm for selecting router node. 489 * Uses a deterministic and fair algorithm for selecting router node.
490 */ 490 */
491 491
492u32 tipc_node_select_router(struct node *n_ptr, u32 ref) 492u32 tipc_node_select_router(struct node *n_ptr, u32 ref)
@@ -496,8 +496,8 @@ u32 tipc_node_select_router(struct node *n_ptr, u32 ref)
496 u32 start; 496 u32 start;
497 u32 r; 497 u32 r;
498 498
499 if (!n_ptr) 499 if (!n_ptr)
500 return 0; 500 return 0;
501 501
502 if (n_ptr->last_router < 0) 502 if (n_ptr->last_router < 0)
503 return 0; 503 return 0;
@@ -531,10 +531,10 @@ void tipc_node_add_router(struct node *n_ptr, u32 router)
531{ 531{
532 u32 r_num = tipc_node(router); 532 u32 r_num = tipc_node(router);
533 533
534 n_ptr->routers[r_num / 32] = 534 n_ptr->routers[r_num / 32] =
535 ((1 << (r_num % 32)) | n_ptr->routers[r_num / 32]); 535 ((1 << (r_num % 32)) | n_ptr->routers[r_num / 32]);
536 n_ptr->last_router = tipc_max_nodes / 32; 536 n_ptr->last_router = tipc_max_nodes / 32;
537 while ((--n_ptr->last_router >= 0) && 537 while ((--n_ptr->last_router >= 0) &&
538 !n_ptr->routers[n_ptr->last_router]); 538 !n_ptr->routers[n_ptr->last_router]);
539} 539}
540 540
@@ -548,7 +548,7 @@ void tipc_node_remove_router(struct node *n_ptr, u32 router)
548 n_ptr->routers[r_num / 32] = 548 n_ptr->routers[r_num / 32] =
549 ((~(1 << (r_num % 32))) & (n_ptr->routers[r_num / 32])); 549 ((~(1 << (r_num % 32))) & (n_ptr->routers[r_num / 32]));
550 n_ptr->last_router = tipc_max_nodes / 32; 550 n_ptr->last_router = tipc_max_nodes / 32;
551 while ((--n_ptr->last_router >= 0) && 551 while ((--n_ptr->last_router >= 0) &&
552 !n_ptr->routers[n_ptr->last_router]); 552 !n_ptr->routers[n_ptr->last_router]);
553 553
554 if (!tipc_node_is_up(n_ptr)) 554 if (!tipc_node_is_up(n_ptr))
@@ -562,7 +562,7 @@ void node_print(struct print_buf *buf, struct node *n_ptr, char *str)
562 562
563 tipc_printf(buf, "\n\n%s", str); 563 tipc_printf(buf, "\n\n%s", str);
564 for (i = 0; i < MAX_BEARERS; i++) { 564 for (i = 0; i < MAX_BEARERS; i++) {
565 if (!n_ptr->links[i]) 565 if (!n_ptr->links[i])
566 continue; 566 continue;
567 tipc_printf(buf, "Links[%u]: %x, ", i, n_ptr->links[i]); 567 tipc_printf(buf, "Links[%u]: %x, ", i, n_ptr->links[i]);
568 } 568 }
@@ -590,7 +590,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
590 u32 domain; 590 u32 domain;
591 struct sk_buff *buf; 591 struct sk_buff *buf;
592 struct node *n_ptr; 592 struct node *n_ptr;
593 struct tipc_node_info node_info; 593 struct tipc_node_info node_info;
594 u32 payload_size; 594 u32 payload_size;
595 595
596 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 596 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
@@ -601,10 +601,10 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
601 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 601 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
602 " (network address)"); 602 " (network address)");
603 603
604 if (!tipc_nodes) 604 if (!tipc_nodes)
605 return tipc_cfg_reply_none(); 605 return tipc_cfg_reply_none();
606 606
607 /* For now, get space for all other nodes 607 /* For now, get space for all other nodes
608 (will need to modify this when slave nodes are supported */ 608 (will need to modify this when slave nodes are supported */
609 609
610 payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1); 610 payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1);
@@ -620,9 +620,9 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
620 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { 620 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
621 if (!in_scope(domain, n_ptr->addr)) 621 if (!in_scope(domain, n_ptr->addr))
622 continue; 622 continue;
623 node_info.addr = htonl(n_ptr->addr); 623 node_info.addr = htonl(n_ptr->addr);
624 node_info.up = htonl(tipc_node_is_up(n_ptr)); 624 node_info.up = htonl(tipc_node_is_up(n_ptr));
625 tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, 625 tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO,
626 &node_info, sizeof(node_info)); 626 &node_info, sizeof(node_info));
627 } 627 }
628 628
@@ -634,7 +634,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
634 u32 domain; 634 u32 domain;
635 struct sk_buff *buf; 635 struct sk_buff *buf;
636 struct node *n_ptr; 636 struct node *n_ptr;
637 struct tipc_link_info link_info; 637 struct tipc_link_info link_info;
638 u32 payload_size; 638 u32 payload_size;
639 639
640 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 640 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
@@ -645,9 +645,9 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
645 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 645 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
646 " (network address)"); 646 " (network address)");
647 647
648 if (tipc_mode != TIPC_NET_MODE) 648 if (tipc_mode != TIPC_NET_MODE)
649 return tipc_cfg_reply_none(); 649 return tipc_cfg_reply_none();
650 650
651 /* Get space for all unicast links + multicast link */ 651 /* Get space for all unicast links + multicast link */
652 652
653 payload_size = TLV_SPACE(sizeof(link_info)) * 653 payload_size = TLV_SPACE(sizeof(link_info)) *
@@ -661,27 +661,27 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
661 661
662 /* Add TLV for broadcast link */ 662 /* Add TLV for broadcast link */
663 663
664 link_info.dest = htonl(tipc_own_addr & 0xfffff00); 664 link_info.dest = htonl(tipc_own_addr & 0xfffff00);
665 link_info.up = htonl(1); 665 link_info.up = htonl(1);
666 sprintf(link_info.str, tipc_bclink_name); 666 sprintf(link_info.str, tipc_bclink_name);
667 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); 667 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));
668 668
669 /* Add TLVs for any other links in scope */ 669 /* Add TLVs for any other links in scope */
670 670
671 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) { 671 for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
672 u32 i; 672 u32 i;
673 673
674 if (!in_scope(domain, n_ptr->addr)) 674 if (!in_scope(domain, n_ptr->addr))
675 continue; 675 continue;
676 for (i = 0; i < MAX_BEARERS; i++) { 676 for (i = 0; i < MAX_BEARERS; i++) {
677 if (!n_ptr->links[i]) 677 if (!n_ptr->links[i])
678 continue; 678 continue;
679 link_info.dest = htonl(n_ptr->addr); 679 link_info.dest = htonl(n_ptr->addr);
680 link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); 680 link_info.up = htonl(tipc_link_is_up(n_ptr->links[i]));
681 strcpy(link_info.str, n_ptr->links[i]->name); 681 strcpy(link_info.str, n_ptr->links[i]->name);
682 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, 682 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO,
683 &link_info, sizeof(link_info)); 683 &link_info, sizeof(link_info));
684 } 684 }
685 } 685 }
686 686
687 return buf; 687 return buf;