* Copyright (c) 2000-2006, Ericsson AB
* Copyright (c) 2005-2006, Wind River Systems
* All rights reserved.
* Copyright (c) 2000-2006, Ericsson AB
* Copyright (c) 2005-2006, Wind River Systems
* All rights reserved.
INIT_LIST_HEAD(&n_ptr->nsub);
n_ptr->owner = c_ptr;
tipc_cltr_attach_node(c_ptr, n_ptr);
n_ptr->last_router = -1;
/* Insert node into ordered list */
INIT_LIST_HEAD(&n_ptr->nsub);
n_ptr->owner = c_ptr;
tipc_cltr_attach_node(c_ptr, n_ptr);
n_ptr->last_router = -1;
/* Insert node into ordered list */
curr_node = &(*curr_node)->next) {
if (addr < (*curr_node)->addr) {
n_ptr->next = *curr_node;
curr_node = &(*curr_node)->next) {
if (addr < (*curr_node)->addr) {
n_ptr->next = *curr_node;
info("Established link <%s> on network plane %c\n",
l_ptr->name, l_ptr->b_ptr->net_plane);
info("Established link <%s> on network plane %c\n",
l_ptr->name, l_ptr->b_ptr->net_plane);
if (!active[0]) {
dbg(" link %x into %x/%x\n", l_ptr, &active[0], &active[1]);
active[0] = active[1] = l_ptr;
node_established_contact(n_ptr);
return;
}
if (!active[0]) {
dbg(" link %x into %x/%x\n", l_ptr, &active[0], &active[1]);
active[0] = active[1] = l_ptr;
node_established_contact(n_ptr);
return;
}
info("New link <%s> becomes standby\n", l_ptr->name);
return;
}
tipc_link_send_duplicate(active[0], l_ptr);
info("New link <%s> becomes standby\n", l_ptr->name);
return;
}
tipc_link_send_duplicate(active[0], l_ptr);
if (!l_ptr || !tipc_link_is_up(l_ptr) ||
(l_ptr->priority < highest_prio))
continue;
if (l_ptr->priority > highest_prio) {
if (!l_ptr || !tipc_link_is_up(l_ptr) ||
(l_ptr->priority < highest_prio))
continue;
if (l_ptr->priority > highest_prio) {
- if (n_ptr->link_cnt >= 2) {
- char addr_string[16];
-
- err("Attempt to create third link to %s\n",
+ if (n_ptr->link_cnt >= 2) {
+ err("Attempt to create third link to %s\n",
- return NULL;
- }
-
- if (!n_ptr->links[bearer_id]) {
- n_ptr->links[bearer_id] = l_ptr;
- tipc_net.zones[tipc_zone(l_ptr->addr)]->links++;
- n_ptr->link_cnt++;
- return n_ptr;
- }
- err("Attempt to establish second link on <%s> to %s \n",
- l_ptr->b_ptr->publ.name,
+ return NULL;
+ }
+
+ if (!n_ptr->links[bearer_id]) {
+ n_ptr->links[bearer_id] = l_ptr;
+ tipc_net.zones[tipc_zone(l_ptr->addr)]->links++;
+ n_ptr->link_cnt++;
+ return n_ptr;
+ }
+ err("Attempt to establish second link on <%s> to %s \n",
+ l_ptr->b_ptr->publ.name,
* Routing table management - five cases to handle:
*
* 1: A link towards a zone/cluster external node comes up.
* Routing table management - five cases to handle:
*
* 1: A link towards a zone/cluster external node comes up.
- * => Send a multicast message updating routing tables of all
- * system nodes within own cluster that the new destination
- * can be reached via this node.
+ * => Send a multicast message updating routing tables of all
+ * system nodes within own cluster that the new destination
+ * can be reached via this node.
* (node.establishedContact()=>cluster.multicastNewRoute())
*
* 2: A link towards a slave node comes up.
* (node.establishedContact()=>cluster.multicastNewRoute())
*
* 2: A link towards a slave node comes up.
- * => Send a multicast message updating routing tables of all
- * system nodes within own cluster that the new destination
- * can be reached via this node.
+ * => Send a multicast message updating routing tables of all
+ * system nodes within own cluster that the new destination
+ * can be reached via this node.
* nodes which can be reached via this node.
* (node.establishedContact()==>network.sendExternalRoutes())
* (node.establishedContact()==>network.sendSlaveRoutes())
* nodes which can be reached via this node.
* (node.establishedContact()==>network.sendExternalRoutes())
* (node.establishedContact()==>network.sendSlaveRoutes())
* containing information about the existence of the new node
* (node.establishedContact()=>cluster.multicastNewRoute())
* containing information about the existence of the new node
* (node.establishedContact()=>cluster.multicastNewRoute())
* nodes within cluster that the new destination can not any
* longer be reached via this node.
* (node.lostAllLinks()=>cluster.bcastLostRoute())
* nodes within cluster that the new destination can not any
* longer be reached via this node.
* (node.lostAllLinks()=>cluster.bcastLostRoute())
* containing information about loss of the node
* (node.establishedContact()=>cluster.multicastLostRoute())
*
* containing information about loss of the node
* (node.establishedContact()=>cluster.multicastLostRoute())
*
- if (c_ptr)
- tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1,
+ if (c_ptr)
+ tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1,
- /* Clean up broadcast reception remains */
- n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0;
- while (n_ptr->bclink.deferred_head) {
- struct sk_buff* buf = n_ptr->bclink.deferred_head;
- n_ptr->bclink.deferred_head = buf->next;
- buf_discard(buf);
- }
- if (n_ptr->bclink.defragm) {
- buf_discard(n_ptr->bclink.defragm);
- n_ptr->bclink.defragm = NULL;
- }
- if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) {
- tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000));
- }
-
- /* Update routing tables */
+ /* Clean up broadcast reception remains */
+ n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0;
+ while (n_ptr->bclink.deferred_head) {
+ struct sk_buff* buf = n_ptr->bclink.deferred_head;
+ n_ptr->bclink.deferred_head = buf->next;
+ buf_discard(buf);
+ }
+ if (n_ptr->bclink.defragm) {
+ buf_discard(n_ptr->bclink.defragm);
+ n_ptr->bclink.defragm = NULL;
+ }
+ if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) {
+ tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000));
+ }
+
+ /* Update routing tables */
/* Case 4 (see above) */
c_ptr = tipc_cltr_find(tipc_own_addr);
tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1,
/* Case 4 (see above) */
c_ptr = tipc_cltr_find(tipc_own_addr);
tipc_cltr_bcast_lost_route(c_ptr, n_ptr->addr, 1,
addr_string_fill(addr_string, n_ptr->addr));
/* Abort link changeover */
for (i = 0; i < MAX_BEARERS; i++) {
struct link *l_ptr = n_ptr->links[i];
addr_string_fill(addr_string, n_ptr->addr));
/* Abort link changeover */
for (i = 0; i < MAX_BEARERS; i++) {
struct link *l_ptr = n_ptr->links[i];
/* Notify subscribers */
list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) {
/* Notify subscribers */
list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) {
list_del_init(&ns->nodesub_list);
tipc_k_signal((Handler)ns->handle_node_down,
(unsigned long)ns->usr_handle);
list_del_init(&ns->nodesub_list);
tipc_k_signal((Handler)ns->handle_node_down,
(unsigned long)ns->usr_handle);
/* Look for direct link to destination processsor */
n_ptr = tipc_node_find(addr);
if (n_ptr && tipc_node_has_active_links(n_ptr))
/* Look for direct link to destination processsor */
n_ptr = tipc_node_find(addr);
if (n_ptr && tipc_node_has_active_links(n_ptr))
/* Cluster local system nodes *must* have direct links */
if (!is_slave(addr) && in_own_cluster(addr))
/* Cluster local system nodes *must* have direct links */
if (!is_slave(addr) && in_own_cluster(addr))
/* Look for cluster local router with direct link to node */
router_addr = tipc_node_select_router(n_ptr, selector);
/* Look for cluster local router with direct link to node */
router_addr = tipc_node_select_router(n_ptr, selector);
addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
n_ptr = tipc_net_select_remote_node(addr, selector);
if (n_ptr && tipc_node_has_active_links(n_ptr))
addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
n_ptr = tipc_net_select_remote_node(addr, selector);
if (n_ptr && tipc_node_has_active_links(n_ptr))
/* Last resort -- look for any router to anywhere in remote zone */
router_addr = tipc_net_select_router(addr, selector);
/* Last resort -- look for any router to anywhere in remote zone */
router_addr = tipc_net_select_router(addr, selector);
n_ptr->routers[r_num / 32] =
((~(1 << (r_num % 32))) & (n_ptr->routers[r_num / 32]));
n_ptr->last_router = tipc_max_nodes / 32;
n_ptr->routers[r_num / 32] =
((~(1 << (r_num % 32))) & (n_ptr->routers[r_num / 32]));
n_ptr->last_router = tipc_max_nodes / 32;
tipc_printf(buf, "\n\n%s", str);
for (i = 0; i < MAX_BEARERS; i++) {
tipc_printf(buf, "\n\n%s", str);
for (i = 0; i < MAX_BEARERS; i++) {
continue;
tipc_printf(buf, "Links[%u]: %x, ", i, n_ptr->links[i]);
}
continue;
tipc_printf(buf, "Links[%u]: %x, ", i, n_ptr->links[i]);
}
(will need to modify this when slave nodes are supported */
payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1);
(will need to modify this when slave nodes are supported */
payload_size = TLV_SPACE(sizeof(node_info)) * (tipc_max_nodes - 1);
for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
if (!in_scope(domain, n_ptr->addr))
continue;
for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
if (!in_scope(domain, n_ptr->addr))
continue;
- node_info.addr = htonl(n_ptr->addr);
- node_info.up = htonl(tipc_node_is_up(n_ptr));
- tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO,
+ node_info.addr = htonl(n_ptr->addr);
+ node_info.up = htonl(tipc_node_is_up(n_ptr));
+ tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO,
- link_info.dest = htonl(tipc_own_addr & 0xfffff00);
- link_info.up = htonl(1);
- sprintf(link_info.str, tipc_bclink_name);
+ link_info.dest = htonl(tipc_own_addr & 0xfffff00);
+ link_info.up = htonl(1);
+ sprintf(link_info.str, tipc_bclink_name);
tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));
/* Add TLVs for any other links in scope */
for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));
/* Add TLVs for any other links in scope */
for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
- for (i = 0; i < MAX_BEARERS; i++) {
- if (!n_ptr->links[i])
- continue;
- link_info.dest = htonl(n_ptr->addr);
- link_info.up = htonl(tipc_link_is_up(n_ptr->links[i]));
- strcpy(link_info.str, n_ptr->links[i]->name);
- tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO,
+ for (i = 0; i < MAX_BEARERS; i++) {
+ if (!n_ptr->links[i])
+ continue;
+ link_info.dest = htonl(n_ptr->addr);
+ link_info.up = htonl(tipc_link_is_up(n_ptr->links[i]));
+ strcpy(link_info.str, n_ptr->links[i]->name);
+ tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO,