Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * net/tipc/node.c: TIPC node management routines |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 3 | * |
Per Liden | 593a5f2 | 2006-01-11 19:14:19 +0100 | [diff] [blame] | 4 | * Copyright (c) 2000-2006, Ericsson AB |
Allan Stephens | 2d627b9 | 2011-01-07 13:00:11 -0500 | [diff] [blame] | 5 | * Copyright (c) 2005-2006, 2010-2011, Wind River Systems |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 6 | * All rights reserved. |
| 7 | * |
Per Liden | 9ea1fd3 | 2006-01-11 13:30:43 +0100 | [diff] [blame] | 8 | * Redistribution and use in source and binary forms, with or without |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 9 | * modification, are permitted provided that the following conditions are met: |
| 10 | * |
Per Liden | 9ea1fd3 | 2006-01-11 13:30:43 +0100 | [diff] [blame] | 11 | * 1. Redistributions of source code must retain the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer. |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in the |
| 15 | * documentation and/or other materials provided with the distribution. |
| 16 | * 3. Neither the names of the copyright holders nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 19 | * |
Per Liden | 9ea1fd3 | 2006-01-11 13:30:43 +0100 | [diff] [blame] | 20 | * Alternatively, this software may be distributed under the terms of the |
| 21 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 22 | * Software Foundation. |
| 23 | * |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 34 | * POSSIBILITY OF SUCH DAMAGE. |
| 35 | */ |
| 36 | |
| 37 | #include "core.h" |
| 38 | #include "config.h" |
| 39 | #include "node.h" |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 40 | #include "name_distr.h" |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 41 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 42 | static void node_lost_contact(struct tipc_node *n_ptr); |
| 43 | static void node_established_contact(struct tipc_node *n_ptr); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 44 | |
Allan Stephens | 2ecb092 | 2008-05-21 14:53:00 -0700 | [diff] [blame] | 45 | static DEFINE_SPINLOCK(node_create_lock); |
| 46 | |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 47 | static struct hlist_head node_htable[NODE_HTABLE_SIZE]; |
| 48 | LIST_HEAD(tipc_node_list); |
| 49 | static u32 tipc_num_nodes; |
Allan Stephens | e3ec9c7 | 2010-12-31 18:59:34 +0000 | [diff] [blame] | 50 | u32 tipc_own_tag; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 51 | |
Allan Stephens | 2ecb092 | 2008-05-21 14:53:00 -0700 | [diff] [blame] | 52 | /** |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 53 | * tipc_node_find - locate specified node object, if it exists |
| 54 | */ |
| 55 | |
| 56 | struct tipc_node *tipc_node_find(u32 addr) |
| 57 | { |
| 58 | struct tipc_node *node; |
| 59 | struct hlist_node *pos; |
| 60 | |
| 61 | if (unlikely(!in_own_cluster(addr))) |
| 62 | return NULL; |
| 63 | |
| 64 | hlist_for_each_entry(node, pos, &node_htable[tipc_hashfn(addr)], hash) { |
| 65 | if (node->addr == addr) |
| 66 | return node; |
| 67 | } |
| 68 | return NULL; |
| 69 | } |
| 70 | |
| 71 | /** |
Allan Stephens | 2ecb092 | 2008-05-21 14:53:00 -0700 | [diff] [blame] | 72 | * tipc_node_create - create neighboring node |
| 73 | * |
| 74 | * Currently, this routine is called by neighbor discovery code, which holds |
| 75 | * net_lock for reading only. We must take node_create_lock to ensure a node |
| 76 | * isn't created twice if two different bearers discover the node at the same |
| 77 | * time. (It would be preferable to switch to holding net_lock in write mode, |
| 78 | * but this is a non-trivial change.) |
| 79 | */ |
| 80 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 81 | struct tipc_node *tipc_node_create(u32 addr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 82 | { |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 83 | struct tipc_node *n_ptr, *temp_node; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 84 | |
Allan Stephens | 2ecb092 | 2008-05-21 14:53:00 -0700 | [diff] [blame] | 85 | spin_lock_bh(&node_create_lock); |
| 86 | |
Allan Stephens | 5af5479 | 2010-12-31 18:59:23 +0000 | [diff] [blame] | 87 | n_ptr = tipc_node_find(addr); |
| 88 | if (n_ptr) { |
| 89 | spin_unlock_bh(&node_create_lock); |
| 90 | return n_ptr; |
Allan Stephens | 2ecb092 | 2008-05-21 14:53:00 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Allan Stephens | 5af5479 | 2010-12-31 18:59:23 +0000 | [diff] [blame] | 93 | n_ptr = kzalloc(sizeof(*n_ptr), GFP_ATOMIC); |
Allan Stephens | a10bd92 | 2006-06-25 23:52:17 -0700 | [diff] [blame] | 94 | if (!n_ptr) { |
Allan Stephens | 2ecb092 | 2008-05-21 14:53:00 -0700 | [diff] [blame] | 95 | spin_unlock_bh(&node_create_lock); |
Allan Stephens | a10bd92 | 2006-06-25 23:52:17 -0700 | [diff] [blame] | 96 | warn("Node creation failed, no memory\n"); |
| 97 | return NULL; |
| 98 | } |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 99 | |
Allan Stephens | a10bd92 | 2006-06-25 23:52:17 -0700 | [diff] [blame] | 100 | n_ptr->addr = addr; |
Allan Stephens | 51a8e4d | 2010-12-31 18:59:18 +0000 | [diff] [blame] | 101 | spin_lock_init(&n_ptr->lock); |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 102 | INIT_HLIST_NODE(&n_ptr->hash); |
| 103 | INIT_LIST_HEAD(&n_ptr->list); |
Allan Stephens | a10bd92 | 2006-06-25 23:52:17 -0700 | [diff] [blame] | 104 | INIT_LIST_HEAD(&n_ptr->nsub); |
Allan Stephens | 8f92df6 | 2010-12-31 18:59:19 +0000 | [diff] [blame] | 105 | |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 106 | hlist_add_head(&n_ptr->hash, &node_htable[tipc_hashfn(addr)]); |
| 107 | |
| 108 | list_for_each_entry(temp_node, &tipc_node_list, list) { |
| 109 | if (n_ptr->addr < temp_node->addr) |
| 110 | break; |
| 111 | } |
| 112 | list_add_tail(&n_ptr->list, &temp_node->list); |
| 113 | |
| 114 | tipc_num_nodes++; |
Allan Stephens | a10bd92 | 2006-06-25 23:52:17 -0700 | [diff] [blame] | 115 | |
Allan Stephens | 2ecb092 | 2008-05-21 14:53:00 -0700 | [diff] [blame] | 116 | spin_unlock_bh(&node_create_lock); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 117 | return n_ptr; |
| 118 | } |
| 119 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 120 | void tipc_node_delete(struct tipc_node *n_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 121 | { |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 122 | list_del(&n_ptr->list); |
| 123 | hlist_del(&n_ptr->hash); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 124 | kfree(n_ptr); |
Allan Stephens | 8f92df6 | 2010-12-31 18:59:19 +0000 | [diff] [blame] | 125 | |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 126 | tipc_num_nodes--; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | |
| 130 | /** |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 131 | * tipc_node_link_up - handle addition of link |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 132 | * |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 133 | * Link becomes active (alone or shared) or standby, depending on its priority. |
| 134 | */ |
| 135 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 136 | void tipc_node_link_up(struct tipc_node *n_ptr, struct link *l_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 137 | { |
| 138 | struct link **active = &n_ptr->active_links[0]; |
| 139 | |
Allan Stephens | 5392d64 | 2006-06-25 23:52:50 -0700 | [diff] [blame] | 140 | n_ptr->working_links++; |
| 141 | |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 142 | info("Established link <%s> on network plane %c\n", |
| 143 | l_ptr->name, l_ptr->b_ptr->net_plane); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 144 | |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 145 | if (!active[0]) { |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 146 | active[0] = active[1] = l_ptr; |
| 147 | node_established_contact(n_ptr); |
| 148 | return; |
| 149 | } |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 150 | if (l_ptr->priority < active[0]->priority) { |
Allan Stephens | a10bd92 | 2006-06-25 23:52:17 -0700 | [diff] [blame] | 151 | info("New link <%s> becomes standby\n", l_ptr->name); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 152 | return; |
| 153 | } |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 154 | tipc_link_send_duplicate(active[0], l_ptr); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 155 | if (l_ptr->priority == active[0]->priority) { |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 156 | active[0] = l_ptr; |
| 157 | return; |
| 158 | } |
Allan Stephens | a10bd92 | 2006-06-25 23:52:17 -0700 | [diff] [blame] | 159 | info("Old link <%s> becomes standby\n", active[0]->name); |
| 160 | if (active[1] != active[0]) |
| 161 | info("Old link <%s> becomes standby\n", active[1]->name); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 162 | active[0] = active[1] = l_ptr; |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * node_select_active_links - select active link |
| 167 | */ |
| 168 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 169 | static void node_select_active_links(struct tipc_node *n_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 170 | { |
| 171 | struct link **active = &n_ptr->active_links[0]; |
| 172 | u32 i; |
| 173 | u32 highest_prio = 0; |
| 174 | |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 175 | active[0] = active[1] = NULL; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 176 | |
| 177 | for (i = 0; i < MAX_BEARERS; i++) { |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 178 | struct link *l_ptr = n_ptr->links[i]; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 179 | |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 180 | if (!l_ptr || !tipc_link_is_up(l_ptr) || |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 181 | (l_ptr->priority < highest_prio)) |
| 182 | continue; |
| 183 | |
| 184 | if (l_ptr->priority > highest_prio) { |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 185 | highest_prio = l_ptr->priority; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 186 | active[0] = active[1] = l_ptr; |
| 187 | } else { |
| 188 | active[1] = l_ptr; |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /** |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 194 | * tipc_node_link_down - handle loss of link |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 195 | */ |
| 196 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 197 | void tipc_node_link_down(struct tipc_node *n_ptr, struct link *l_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 198 | { |
| 199 | struct link **active; |
| 200 | |
Allan Stephens | 5392d64 | 2006-06-25 23:52:50 -0700 | [diff] [blame] | 201 | n_ptr->working_links--; |
| 202 | |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 203 | if (!tipc_link_is_active(l_ptr)) { |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 204 | info("Lost standby link <%s> on network plane %c\n", |
| 205 | l_ptr->name, l_ptr->b_ptr->net_plane); |
| 206 | return; |
| 207 | } |
| 208 | info("Lost link <%s> on network plane %c\n", |
| 209 | l_ptr->name, l_ptr->b_ptr->net_plane); |
| 210 | |
| 211 | active = &n_ptr->active_links[0]; |
| 212 | if (active[0] == l_ptr) |
| 213 | active[0] = active[1]; |
| 214 | if (active[1] == l_ptr) |
| 215 | active[1] = active[0]; |
| 216 | if (active[0] == l_ptr) |
| 217 | node_select_active_links(n_ptr); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 218 | if (tipc_node_is_up(n_ptr)) |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 219 | tipc_link_changeover(l_ptr); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 220 | else |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 221 | node_lost_contact(n_ptr); |
| 222 | } |
| 223 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 224 | int tipc_node_has_active_links(struct tipc_node *n_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 225 | { |
Allan Stephens | 76ae0d7 | 2010-08-17 11:00:12 +0000 | [diff] [blame] | 226 | return n_ptr->active_links[0] != NULL; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 227 | } |
| 228 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 229 | int tipc_node_has_redundant_links(struct tipc_node *n_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 230 | { |
Eric Dumazet | a02cec2 | 2010-09-22 20:43:57 +0000 | [diff] [blame] | 231 | return n_ptr->working_links > 1; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 232 | } |
| 233 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 234 | int tipc_node_is_up(struct tipc_node *n_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 235 | { |
Allan Stephens | 51a8e4d | 2010-12-31 18:59:18 +0000 | [diff] [blame] | 236 | return tipc_node_has_active_links(n_ptr); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 237 | } |
| 238 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 239 | struct tipc_node *tipc_node_attach_link(struct link *l_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 240 | { |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 241 | struct tipc_node *n_ptr = tipc_node_find(l_ptr->addr); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 242 | |
| 243 | if (!n_ptr) |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 244 | n_ptr = tipc_node_create(l_ptr->addr); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 245 | if (n_ptr) { |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 246 | u32 bearer_id = l_ptr->b_ptr->identity; |
| 247 | char addr_string[16]; |
| 248 | |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 249 | if (n_ptr->link_cnt >= 2) { |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 250 | err("Attempt to create third link to %s\n", |
Allan Stephens | c68ca7b | 2010-05-11 14:30:12 +0000 | [diff] [blame] | 251 | tipc_addr_string_fill(addr_string, n_ptr->addr)); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 252 | return NULL; |
| 253 | } |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 254 | |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 255 | if (!n_ptr->links[bearer_id]) { |
| 256 | n_ptr->links[bearer_id] = l_ptr; |
Allan Stephens | d1bcb11 | 2011-02-25 10:01:58 -0500 | [diff] [blame] | 257 | atomic_inc(&tipc_num_links); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 258 | n_ptr->link_cnt++; |
| 259 | return n_ptr; |
| 260 | } |
Frans Pop | a570f09 | 2010-03-24 07:57:29 +0000 | [diff] [blame] | 261 | err("Attempt to establish second link on <%s> to %s\n", |
Allan Stephens | 2d627b9 | 2011-01-07 13:00:11 -0500 | [diff] [blame] | 262 | l_ptr->b_ptr->name, |
Allan Stephens | c68ca7b | 2010-05-11 14:30:12 +0000 | [diff] [blame] | 263 | tipc_addr_string_fill(addr_string, l_ptr->addr)); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 264 | } |
Sam Ravnborg | 1fc54d8 | 2006-03-20 22:36:47 -0800 | [diff] [blame] | 265 | return NULL; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 266 | } |
| 267 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 268 | void tipc_node_detach_link(struct tipc_node *n_ptr, struct link *l_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 269 | { |
Sam Ravnborg | 1fc54d8 | 2006-03-20 22:36:47 -0800 | [diff] [blame] | 270 | n_ptr->links[l_ptr->b_ptr->identity] = NULL; |
Allan Stephens | d1bcb11 | 2011-02-25 10:01:58 -0500 | [diff] [blame] | 271 | atomic_dec(&tipc_num_links); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 272 | n_ptr->link_cnt--; |
| 273 | } |
| 274 | |
| 275 | /* |
| 276 | * Routing table management - five cases to handle: |
| 277 | * |
| 278 | * 1: A link towards a zone/cluster external node comes up. |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 279 | * => Send a multicast message updating routing tables of all |
| 280 | * system nodes within own cluster that the new destination |
| 281 | * can be reached via this node. |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 282 | * (node.establishedContact()=>cluster.multicastNewRoute()) |
| 283 | * |
| 284 | * 2: A link towards a slave node comes up. |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 285 | * => Send a multicast message updating routing tables of all |
| 286 | * system nodes within own cluster that the new destination |
| 287 | * can be reached via this node. |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 288 | * (node.establishedContact()=>cluster.multicastNewRoute()) |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 289 | * => Send a message to the slave node about existence |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 290 | * of all system nodes within cluster: |
| 291 | * (node.establishedContact()=>cluster.sendLocalRoutes()) |
| 292 | * |
| 293 | * 3: A new cluster local system node becomes available. |
| 294 | * => Send message(s) to this particular node containing |
| 295 | * information about all cluster external and slave |
| 296 | * nodes which can be reached via this node. |
| 297 | * (node.establishedContact()==>network.sendExternalRoutes()) |
| 298 | * (node.establishedContact()==>network.sendSlaveRoutes()) |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 299 | * => Send messages to all directly connected slave nodes |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 300 | * containing information about the existence of the new node |
| 301 | * (node.establishedContact()=>cluster.multicastNewRoute()) |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 302 | * |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 303 | * 4: The link towards a zone/cluster external node or slave |
| 304 | * node goes down. |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 305 | * => Send a multcast message updating routing tables of all |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 306 | * nodes within cluster that the new destination can not any |
| 307 | * longer be reached via this node. |
| 308 | * (node.lostAllLinks()=>cluster.bcastLostRoute()) |
| 309 | * |
| 310 | * 5: A cluster local system node becomes unavailable. |
| 311 | * => Remove all references to this node from the local |
| 312 | * routing tables. Note: This is a completely node |
| 313 | * local operation. |
| 314 | * (node.lostAllLinks()=>network.removeAsRouter()) |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 315 | * => Send messages to all directly connected slave nodes |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 316 | * containing information about loss of the node |
| 317 | * (node.establishedContact()=>cluster.multicastLostRoute()) |
| 318 | * |
| 319 | */ |
| 320 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 321 | static void node_established_contact(struct tipc_node *n_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 322 | { |
Allan Stephens | 51a8e4d | 2010-12-31 18:59:18 +0000 | [diff] [blame] | 323 | tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 324 | |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 325 | /* Syncronize broadcast acks */ |
| 326 | n_ptr->bclink.acked = tipc_bclink_get_last_sent(); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 327 | |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 328 | if (n_ptr->bclink.supported) { |
Allan Stephens | 8f92df6 | 2010-12-31 18:59:19 +0000 | [diff] [blame] | 329 | tipc_nmap_add(&tipc_bcast_nmap, n_ptr->addr); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 330 | if (n_ptr->addr < tipc_own_addr) |
| 331 | tipc_own_tag++; |
| 332 | } |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 333 | } |
| 334 | |
Allan Stephens | 5a68d5e | 2010-08-17 11:00:16 +0000 | [diff] [blame] | 335 | static void node_cleanup_finished(unsigned long node_addr) |
| 336 | { |
| 337 | struct tipc_node *n_ptr; |
| 338 | |
| 339 | read_lock_bh(&tipc_net_lock); |
| 340 | n_ptr = tipc_node_find(node_addr); |
| 341 | if (n_ptr) { |
| 342 | tipc_node_lock(n_ptr); |
| 343 | n_ptr->cleanup_required = 0; |
| 344 | tipc_node_unlock(n_ptr); |
| 345 | } |
| 346 | read_unlock_bh(&tipc_net_lock); |
| 347 | } |
| 348 | |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 349 | static void node_lost_contact(struct tipc_node *n_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 350 | { |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 351 | char addr_string[16]; |
| 352 | u32 i; |
| 353 | |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 354 | /* Clean up broadcast reception remains */ |
| 355 | n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0; |
| 356 | while (n_ptr->bclink.deferred_head) { |
Allan Stephens | 0e65967 | 2010-12-31 18:59:32 +0000 | [diff] [blame] | 357 | struct sk_buff *buf = n_ptr->bclink.deferred_head; |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 358 | n_ptr->bclink.deferred_head = buf->next; |
| 359 | buf_discard(buf); |
| 360 | } |
| 361 | if (n_ptr->bclink.defragm) { |
| 362 | buf_discard(n_ptr->bclink.defragm); |
| 363 | n_ptr->bclink.defragm = NULL; |
| 364 | } |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 365 | |
Allan Stephens | 51a8e4d | 2010-12-31 18:59:18 +0000 | [diff] [blame] | 366 | if (n_ptr->bclink.supported) { |
Allan Stephens | 8f92df6 | 2010-12-31 18:59:19 +0000 | [diff] [blame] | 367 | tipc_bclink_acknowledge(n_ptr, |
| 368 | mod(n_ptr->bclink.acked + 10000)); |
| 369 | tipc_nmap_remove(&tipc_bcast_nmap, n_ptr->addr); |
Allan Stephens | 51a8e4d | 2010-12-31 18:59:18 +0000 | [diff] [blame] | 370 | if (n_ptr->addr < tipc_own_addr) |
| 371 | tipc_own_tag--; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 372 | } |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 373 | |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 374 | info("Lost contact with %s\n", |
Allan Stephens | c68ca7b | 2010-05-11 14:30:12 +0000 | [diff] [blame] | 375 | tipc_addr_string_fill(addr_string, n_ptr->addr)); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 376 | |
| 377 | /* Abort link changeover */ |
| 378 | for (i = 0; i < MAX_BEARERS; i++) { |
| 379 | struct link *l_ptr = n_ptr->links[i]; |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 380 | if (!l_ptr) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 381 | continue; |
| 382 | l_ptr->reset_checkpoint = l_ptr->next_in_no; |
| 383 | l_ptr->exp_msg_count = 0; |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 384 | tipc_link_reset_fragments(l_ptr); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | /* Notify subscribers */ |
Allan Stephens | f137917 | 2011-02-23 14:13:41 -0500 | [diff] [blame] | 388 | tipc_nodesub_notify(n_ptr); |
Allan Stephens | 5a68d5e | 2010-08-17 11:00:16 +0000 | [diff] [blame] | 389 | |
| 390 | /* Prevent re-contact with node until all cleanup is done */ |
| 391 | |
| 392 | n_ptr->cleanup_required = 1; |
| 393 | tipc_k_signal((Handler)node_cleanup_finished, n_ptr->addr); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 394 | } |
| 395 | |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 396 | struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 397 | { |
| 398 | u32 domain; |
| 399 | struct sk_buff *buf; |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 400 | struct tipc_node *n_ptr; |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 401 | struct tipc_node_info node_info; |
Allan Stephens | ea13847 | 2006-06-29 12:33:20 -0700 | [diff] [blame] | 402 | u32 payload_size; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 403 | |
| 404 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 405 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 406 | |
Al Viro | 3e6c8cd | 2006-11-08 00:19:09 -0800 | [diff] [blame] | 407 | domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 408 | if (!tipc_addr_domain_valid(domain)) |
| 409 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 410 | " (network address)"); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 411 | |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 412 | read_lock_bh(&tipc_net_lock); |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 413 | if (!tipc_num_nodes) { |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 414 | read_unlock_bh(&tipc_net_lock); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 415 | return tipc_cfg_reply_none(); |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 416 | } |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 417 | |
Allan Stephens | 08c80e9 | 2010-12-31 18:59:17 +0000 | [diff] [blame] | 418 | /* For now, get space for all other nodes */ |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 419 | |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 420 | payload_size = TLV_SPACE(sizeof(node_info)) * tipc_num_nodes; |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 421 | if (payload_size > 32768u) { |
| 422 | read_unlock_bh(&tipc_net_lock); |
Allan Stephens | ea13847 | 2006-06-29 12:33:20 -0700 | [diff] [blame] | 423 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
| 424 | " (too many nodes)"); |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 425 | } |
Allan Stephens | ea13847 | 2006-06-29 12:33:20 -0700 | [diff] [blame] | 426 | buf = tipc_cfg_reply_alloc(payload_size); |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 427 | if (!buf) { |
| 428 | read_unlock_bh(&tipc_net_lock); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 429 | return NULL; |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 430 | } |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 431 | |
| 432 | /* Add TLVs for all nodes in scope */ |
| 433 | |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 434 | list_for_each_entry(n_ptr, &tipc_node_list, list) { |
| 435 | if (!tipc_in_scope(domain, n_ptr->addr)) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 436 | continue; |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 437 | node_info.addr = htonl(n_ptr->addr); |
| 438 | node_info.up = htonl(tipc_node_is_up(n_ptr)); |
| 439 | tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO, |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 440 | &node_info, sizeof(node_info)); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 441 | } |
| 442 | |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 443 | read_unlock_bh(&tipc_net_lock); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 444 | return buf; |
| 445 | } |
| 446 | |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 447 | struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 448 | { |
| 449 | u32 domain; |
| 450 | struct sk_buff *buf; |
David S. Miller | 6c00055 | 2008-09-02 23:38:32 -0700 | [diff] [blame] | 451 | struct tipc_node *n_ptr; |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 452 | struct tipc_link_info link_info; |
Allan Stephens | ea13847 | 2006-06-29 12:33:20 -0700 | [diff] [blame] | 453 | u32 payload_size; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 454 | |
| 455 | if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 456 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 457 | |
Al Viro | 3e6c8cd | 2006-11-08 00:19:09 -0800 | [diff] [blame] | 458 | domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 459 | if (!tipc_addr_domain_valid(domain)) |
| 460 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
| 461 | " (network address)"); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 462 | |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 463 | if (tipc_mode != TIPC_NET_MODE) |
| 464 | return tipc_cfg_reply_none(); |
| 465 | |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 466 | read_lock_bh(&tipc_net_lock); |
| 467 | |
Allan Stephens | ea13847 | 2006-06-29 12:33:20 -0700 | [diff] [blame] | 468 | /* Get space for all unicast links + multicast link */ |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 469 | |
Allan Stephens | 9df3b7e | 2011-02-24 13:20:20 -0500 | [diff] [blame] | 470 | payload_size = TLV_SPACE(sizeof(link_info)) * |
Allan Stephens | d1bcb11 | 2011-02-25 10:01:58 -0500 | [diff] [blame] | 471 | (atomic_read(&tipc_num_links) + 1); |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 472 | if (payload_size > 32768u) { |
| 473 | read_unlock_bh(&tipc_net_lock); |
Allan Stephens | ea13847 | 2006-06-29 12:33:20 -0700 | [diff] [blame] | 474 | return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED |
| 475 | " (too many links)"); |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 476 | } |
Allan Stephens | ea13847 | 2006-06-29 12:33:20 -0700 | [diff] [blame] | 477 | buf = tipc_cfg_reply_alloc(payload_size); |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 478 | if (!buf) { |
| 479 | read_unlock_bh(&tipc_net_lock); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 480 | return NULL; |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 481 | } |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 482 | |
| 483 | /* Add TLV for broadcast link */ |
| 484 | |
Allan Stephens | a3796f8 | 2011-02-23 11:44:49 -0500 | [diff] [blame] | 485 | link_info.dest = htonl(tipc_cluster_mask(tipc_own_addr)); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 486 | link_info.up = htonl(1); |
Stephen Hemminger | 4b704d5 | 2009-03-18 19:11:29 -0700 | [diff] [blame] | 487 | strlcpy(link_info.str, tipc_bclink_name, TIPC_MAX_LINK_NAME); |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 488 | tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 489 | |
| 490 | /* Add TLVs for any other links in scope */ |
| 491 | |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 492 | list_for_each_entry(n_ptr, &tipc_node_list, list) { |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 493 | u32 i; |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 494 | |
Allan Stephens | 672d99e | 2011-02-25 18:42:52 -0500 | [diff] [blame^] | 495 | if (!tipc_in_scope(domain, n_ptr->addr)) |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 496 | continue; |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 497 | tipc_node_lock(n_ptr); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 498 | for (i = 0; i < MAX_BEARERS; i++) { |
| 499 | if (!n_ptr->links[i]) |
| 500 | continue; |
| 501 | link_info.dest = htonl(n_ptr->addr); |
| 502 | link_info.up = htonl(tipc_link_is_up(n_ptr->links[i])); |
| 503 | strcpy(link_info.str, n_ptr->links[i]->name); |
| 504 | tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, |
Per Liden | 4323add | 2006-01-18 00:38:21 +0100 | [diff] [blame] | 505 | &link_info, sizeof(link_info)); |
YOSHIFUJI Hideaki | c430728 | 2007-02-09 23:25:21 +0900 | [diff] [blame] | 506 | } |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 507 | tipc_node_unlock(n_ptr); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 508 | } |
| 509 | |
Allan Stephens | 1aad72d | 2008-07-14 22:44:58 -0700 | [diff] [blame] | 510 | read_unlock_bh(&tipc_net_lock); |
Per Liden | b97bf3f | 2006-01-02 19:04:38 +0100 | [diff] [blame] | 511 | return buf; |
| 512 | } |