diff options
Diffstat (limited to 'net/tipc/node.c')
| -rw-r--r-- | net/tipc/node.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index 5b44c3041be4..f7069299943f 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
| @@ -1,7 +1,7 @@ | |||
| 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, 2012 Ericsson AB | 4 | * Copyright (c) 2000-2006, 2012-2014, Ericsson AB |
| 5 | * Copyright (c) 2005-2006, 2010-2014, Wind River Systems | 5 | * Copyright (c) 2005-2006, 2010-2014, Wind River Systems |
| 6 | * All rights reserved. | 6 | * All rights reserved. |
| 7 | * | 7 | * |
| @@ -155,21 +155,25 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | |||
| 155 | if (!active[0]) { | 155 | if (!active[0]) { |
| 156 | active[0] = active[1] = l_ptr; | 156 | active[0] = active[1] = l_ptr; |
| 157 | node_established_contact(n_ptr); | 157 | node_established_contact(n_ptr); |
| 158 | return; | 158 | goto exit; |
| 159 | } | 159 | } |
| 160 | if (l_ptr->priority < active[0]->priority) { | 160 | if (l_ptr->priority < active[0]->priority) { |
| 161 | pr_info("New link <%s> becomes standby\n", l_ptr->name); | 161 | pr_info("New link <%s> becomes standby\n", l_ptr->name); |
| 162 | return; | 162 | goto exit; |
| 163 | } | 163 | } |
| 164 | tipc_link_dup_queue_xmit(active[0], l_ptr); | 164 | tipc_link_dup_queue_xmit(active[0], l_ptr); |
| 165 | if (l_ptr->priority == active[0]->priority) { | 165 | if (l_ptr->priority == active[0]->priority) { |
| 166 | active[0] = l_ptr; | 166 | active[0] = l_ptr; |
| 167 | return; | 167 | goto exit; |
| 168 | } | 168 | } |
| 169 | pr_info("Old link <%s> becomes standby\n", active[0]->name); | 169 | pr_info("Old link <%s> becomes standby\n", active[0]->name); |
| 170 | if (active[1] != active[0]) | 170 | if (active[1] != active[0]) |
| 171 | pr_info("Old link <%s> becomes standby\n", active[1]->name); | 171 | pr_info("Old link <%s> becomes standby\n", active[1]->name); |
| 172 | active[0] = active[1] = l_ptr; | 172 | active[0] = active[1] = l_ptr; |
| 173 | exit: | ||
| 174 | /* Leave room for changeover header when returning 'mtu' to users: */ | ||
| 175 | n_ptr->act_mtus[0] = active[0]->max_pkt - INT_H_SIZE; | ||
| 176 | n_ptr->act_mtus[1] = active[1]->max_pkt - INT_H_SIZE; | ||
| 173 | } | 177 | } |
| 174 | 178 | ||
| 175 | /** | 179 | /** |
| @@ -229,6 +233,19 @@ void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | |||
| 229 | tipc_link_failover_send_queue(l_ptr); | 233 | tipc_link_failover_send_queue(l_ptr); |
| 230 | else | 234 | else |
| 231 | node_lost_contact(n_ptr); | 235 | node_lost_contact(n_ptr); |
| 236 | |||
| 237 | /* Leave room for changeover header when returning 'mtu' to users: */ | ||
| 238 | if (active[0]) { | ||
| 239 | n_ptr->act_mtus[0] = active[0]->max_pkt - INT_H_SIZE; | ||
| 240 | n_ptr->act_mtus[1] = active[1]->max_pkt - INT_H_SIZE; | ||
| 241 | return; | ||
| 242 | } | ||
| 243 | |||
| 244 | /* Loopback link went down? No fragmentation needed from now on. */ | ||
| 245 | if (n_ptr->addr == tipc_own_addr) { | ||
| 246 | n_ptr->act_mtus[0] = MAX_MSG_SIZE; | ||
| 247 | n_ptr->act_mtus[1] = MAX_MSG_SIZE; | ||
| 248 | } | ||
| 232 | } | 249 | } |
| 233 | 250 | ||
| 234 | int tipc_node_active_links(struct tipc_node *n_ptr) | 251 | int tipc_node_active_links(struct tipc_node *n_ptr) |
| @@ -457,8 +474,6 @@ int tipc_node_get_linkname(u32 bearer_id, u32 addr, char *linkname, size_t len) | |||
| 457 | void tipc_node_unlock(struct tipc_node *node) | 474 | void tipc_node_unlock(struct tipc_node *node) |
| 458 | { | 475 | { |
| 459 | LIST_HEAD(nsub_list); | 476 | LIST_HEAD(nsub_list); |
| 460 | struct tipc_link *link; | ||
| 461 | int pkt_sz = 0; | ||
| 462 | u32 addr = 0; | 477 | u32 addr = 0; |
| 463 | 478 | ||
| 464 | if (likely(!node->action_flags)) { | 479 | if (likely(!node->action_flags)) { |
| @@ -471,18 +486,13 @@ void tipc_node_unlock(struct tipc_node *node) | |||
| 471 | node->action_flags &= ~TIPC_NOTIFY_NODE_DOWN; | 486 | node->action_flags &= ~TIPC_NOTIFY_NODE_DOWN; |
| 472 | } | 487 | } |
| 473 | if (node->action_flags & TIPC_NOTIFY_NODE_UP) { | 488 | if (node->action_flags & TIPC_NOTIFY_NODE_UP) { |
| 474 | link = node->active_links[0]; | ||
| 475 | node->action_flags &= ~TIPC_NOTIFY_NODE_UP; | 489 | node->action_flags &= ~TIPC_NOTIFY_NODE_UP; |
| 476 | if (link) { | 490 | addr = node->addr; |
| 477 | pkt_sz = ((link->max_pkt - INT_H_SIZE) / ITEM_SIZE) * | ||
| 478 | ITEM_SIZE; | ||
| 479 | addr = node->addr; | ||
| 480 | } | ||
| 481 | } | 491 | } |
| 482 | spin_unlock_bh(&node->lock); | 492 | spin_unlock_bh(&node->lock); |
| 483 | 493 | ||
| 484 | if (!list_empty(&nsub_list)) | 494 | if (!list_empty(&nsub_list)) |
| 485 | tipc_nodesub_notify(&nsub_list); | 495 | tipc_nodesub_notify(&nsub_list); |
| 486 | if (pkt_sz) | 496 | if (addr) |
| 487 | tipc_named_node_up(pkt_sz, addr); | 497 | tipc_named_node_up(addr); |
| 488 | } | 498 | } |
