Searched refs:nr_node (Results 1 - 2 of 2) sorted by relevance
/linux-4.1.27/net/netrom/ |
H A D | nr_route.c | 48 static struct nr_node *nr_node_get(ax25_address *callsign) nr_node_get() 50 struct nr_node *found = NULL; nr_node_get() 51 struct nr_node *nr_node; nr_node_get() local 54 nr_node_for_each(nr_node, &nr_node_list) nr_node_get() 55 if (ax25cmp(callsign, &nr_node->callsign) == 0) { nr_node_get() 56 nr_node_hold(nr_node); nr_node_get() 57 found = nr_node; nr_node_get() 92 struct nr_node *nr_node; nr_add_node() local 103 nr_node = nr_node_get(nr); nr_add_node() 114 struct nr_node *nr_nodet; nr_add_node() 131 if (quality == 0 && nr_neigh != NULL && nr_node != NULL) { nr_add_node() 133 nr_node_put(nr_node); nr_add_node() 139 if (nr_node) nr_add_node() 140 nr_node_put(nr_node); nr_add_node() 161 if (nr_node) nr_add_node() 162 nr_node_put(nr_node); nr_add_node() 176 if (nr_node == NULL) { nr_add_node() 177 if ((nr_node = kmalloc(sizeof(*nr_node), GFP_ATOMIC)) == NULL) { nr_add_node() 183 nr_node->callsign = *nr; nr_add_node() 184 strcpy(nr_node->mnemonic, mnemonic); nr_add_node() 186 nr_node->which = 0; nr_add_node() 187 nr_node->count = 1; nr_add_node() 188 atomic_set(&nr_node->refcount, 1); nr_add_node() 189 spin_lock_init(&nr_node->node_lock); nr_add_node() 191 nr_node->routes[0].quality = quality; nr_add_node() 192 nr_node->routes[0].obs_count = obs_count; nr_add_node() 193 nr_node->routes[0].neighbour = nr_neigh; nr_add_node() 199 hlist_add_head(&nr_node->node_node, &nr_node_list); nr_add_node() 205 nr_node_lock(nr_node); nr_add_node() 208 strcpy(nr_node->mnemonic, mnemonic); nr_add_node() 210 for (found = 0, i = 0; i < nr_node->count; i++) { nr_add_node() 211 if (nr_node->routes[i].neighbour == nr_neigh) { nr_add_node() 212 nr_node->routes[i].quality = quality; nr_add_node() 213 nr_node->routes[i].obs_count = obs_count; nr_add_node() 221 if (nr_node->count < 3) { nr_add_node() 222 nr_node->routes[2] = nr_node->routes[1]; nr_add_node() 223 nr_node->routes[1] = nr_node->routes[0]; nr_add_node() 225 nr_node->routes[0].quality = quality; nr_add_node() 226 nr_node->routes[0].obs_count = obs_count; nr_add_node() 227 nr_node->routes[0].neighbour = nr_neigh; nr_add_node() 229 nr_node->which++; nr_add_node() 230 nr_node->count++; nr_add_node() 235 if (quality > nr_node->routes[2].quality) { nr_add_node() 236 nr_node->routes[2].neighbour->count--; nr_add_node() 237 nr_neigh_put(nr_node->routes[2].neighbour); nr_add_node() 239 if (nr_node->routes[2].neighbour->count == 0 && !nr_node->routes[2].neighbour->locked) nr_add_node() 240 nr_remove_neigh(nr_node->routes[2].neighbour); nr_add_node() 242 nr_node->routes[2].quality = quality; nr_add_node() 243 nr_node->routes[2].obs_count = obs_count; nr_add_node() 244 nr_node->routes[2].neighbour = nr_neigh; nr_add_node() 253 switch (nr_node->count) { nr_add_node() 255 if (nr_node->routes[1].quality > nr_node->routes[0].quality) { nr_add_node() 256 switch (nr_node->which) { nr_add_node() 258 nr_node->which = 1; nr_add_node() 261 nr_node->which = 0; nr_add_node() 264 nr_route = nr_node->routes[0]; nr_add_node() 265 nr_node->routes[0] = nr_node->routes[1]; nr_add_node() 266 nr_node->routes[1] = nr_route; nr_add_node() 268 if (nr_node->routes[2].quality > nr_node->routes[1].quality) { nr_add_node() 269 switch (nr_node->which) { nr_add_node() 270 case 1: nr_node->which = 2; nr_add_node() 273 case 2: nr_node->which = 1; nr_add_node() 279 nr_route = nr_node->routes[1]; nr_add_node() 280 nr_node->routes[1] = nr_node->routes[2]; nr_add_node() 281 nr_node->routes[2] = nr_route; nr_add_node() 284 if (nr_node->routes[1].quality > nr_node->routes[0].quality) { nr_add_node() 285 switch (nr_node->which) { nr_add_node() 286 case 0: nr_node->which = 1; nr_add_node() 289 case 1: nr_node->which = 0; nr_add_node() 294 nr_route = nr_node->routes[0]; nr_add_node() 295 nr_node->routes[0] = nr_node->routes[1]; nr_add_node() 296 nr_node->routes[1] = nr_route; nr_add_node() 302 for (i = 0; i < nr_node->count; i++) { nr_add_node() 303 if (nr_node->routes[i].neighbour == nr_neigh) { nr_add_node() 304 if (i < nr_node->which) nr_add_node() 305 nr_node->which = i; nr_add_node() 311 nr_node_unlock(nr_node); nr_add_node() 312 nr_node_put(nr_node); nr_add_node() 316 static inline void __nr_remove_node(struct nr_node *nr_node) __nr_remove_node() argument 318 hlist_del_init(&nr_node->node_node); __nr_remove_node() 319 nr_node_put(nr_node); __nr_remove_node() 325 static void nr_remove_node(struct nr_node *nr_node) nr_remove_node() argument 328 __nr_remove_node(nr_node); nr_remove_node() 354 struct nr_node *nr_node; nr_del_node() local 358 nr_node = nr_node_get(callsign); nr_del_node() 360 if (nr_node == NULL) nr_del_node() 366 nr_node_put(nr_node); nr_del_node() 370 nr_node_lock(nr_node); nr_del_node() 371 for (i = 0; i < nr_node->count; i++) { nr_del_node() 372 if (nr_node->routes[i].neighbour == nr_neigh) { nr_del_node() 380 nr_node->count--; nr_del_node() 382 if (nr_node->count == 0) { nr_del_node() 383 nr_remove_node(nr_node); nr_del_node() 387 nr_node->routes[0] = nr_node->routes[1]; nr_del_node() 389 nr_node->routes[1] = nr_node->routes[2]; nr_del_node() 393 nr_node_put(nr_node); nr_del_node() 395 nr_node_unlock(nr_node); nr_del_node() 401 nr_node_unlock(nr_node); nr_del_node() 402 nr_node_put(nr_node); nr_del_node() 484 struct nr_node *s; nr_dec_obs() 541 struct nr_node *t; nr_rt_device_down() 737 struct nr_node *nr_node = NULL; nr_link_failed() local 760 nr_node_for_each(nr_node, &nr_node_list) { nr_link_failed() 761 nr_node_lock(nr_node); nr_link_failed() 762 if (nr_node->which < nr_node->count && nr_link_failed() 763 nr_node->routes[nr_node->which].neighbour == nr_neigh) nr_link_failed() 764 nr_node->which++; nr_link_failed() 765 nr_node_unlock(nr_node); nr_link_failed() 779 struct nr_node *nr_node; nr_route_frame() local 815 nr_node = nr_node_get(nr_dest); nr_route_frame() 816 if (nr_node == NULL) nr_route_frame() 818 nr_node_lock(nr_node); nr_route_frame() 820 if (nr_node->which >= nr_node->count) { nr_route_frame() 821 nr_node_unlock(nr_node); nr_route_frame() 822 nr_node_put(nr_node); nr_route_frame() 826 nr_neigh = nr_node->routes[nr_node->which].neighbour; nr_route_frame() 829 nr_node_unlock(nr_node); nr_route_frame() 830 nr_node_put(nr_node); nr_route_frame() 838 nr_node_unlock(nr_node); nr_route_frame() 839 nr_node_put(nr_node); nr_route_frame() 860 nr_node_unlock(nr_node); nr_route_frame() 861 nr_node_put(nr_node); nr_route_frame() 893 struct nr_node *nr_node = hlist_entry(v, struct nr_node, nr_node_show() local 896 nr_node_lock(nr_node); nr_node_show() 898 ax2asc(buf, &nr_node->callsign), nr_node_show() 899 (nr_node->mnemonic[0] == '\0') ? "*" : nr_node->mnemonic, nr_node_show() 900 nr_node->which + 1, nr_node_show() 901 nr_node->count); nr_node_show() 903 for (i = 0; i < nr_node->count; i++) { nr_node_show() 905 nr_node->routes[i].quality, nr_node_show() 906 nr_node->routes[i].obs_count, nr_node_show() 907 nr_node->routes[i].neighbour->number); nr_node_show() 909 nr_node_unlock(nr_node); nr_node_show() 1011 struct nr_node *t = NULL; nr_rt_free()
|
/linux-4.1.27/include/net/ |
H A D | netrom.h | 105 struct nr_node { struct 117 * nr_node & nr_neigh lists, refcounting and locking 123 static __inline__ void nr_node_put(struct nr_node *nr_node) nr_node_put() argument 125 if (atomic_dec_and_test(&nr_node->refcount)) { nr_node_put() 126 kfree(nr_node); nr_node_put() 145 static __inline__ void nr_node_lock(struct nr_node *nr_node) nr_node_lock() argument 147 nr_node_hold(nr_node); nr_node_lock() 148 spin_lock_bh(&nr_node->node_lock); nr_node_lock() 151 static __inline__ void nr_node_unlock(struct nr_node *nr_node) nr_node_unlock() argument 153 spin_unlock_bh(&nr_node->node_lock); nr_node_unlock() 154 nr_node_put(nr_node); nr_node_unlock()
|
Completed in 98 milliseconds