Searched refs:nr_neigh (Results 1 - 3 of 3) sorted by relevance

/linux-4.1.27/net/netrom/
H A Dnr_route.c64 static struct nr_neigh *nr_neigh_get_dev(ax25_address *callsign, nr_neigh_get_dev()
67 struct nr_neigh *found = NULL; nr_neigh_get_dev()
68 struct nr_neigh *nr_neigh; nr_neigh_get_dev() local
71 nr_neigh_for_each(nr_neigh, &nr_neigh_list) nr_neigh_get_dev()
72 if (ax25cmp(callsign, &nr_neigh->callsign) == 0 && nr_neigh_get_dev()
73 nr_neigh->dev == dev) { nr_neigh_get_dev()
74 nr_neigh_hold(nr_neigh); nr_neigh_get_dev()
75 found = nr_neigh; nr_neigh_get_dev()
82 static void nr_remove_neigh(struct nr_neigh *);
93 struct nr_neigh *nr_neigh; nr_add_node() local
105 nr_neigh = nr_neigh_get_dev(ax25, dev); nr_add_node()
113 if (nr_neigh != NULL && nr_neigh->failed != 0 && quality == 0) { nr_add_node()
120 if (nr_nodet->routes[i].neighbour == nr_neigh) nr_add_node()
128 if (nr_neigh != NULL) nr_add_node()
129 nr_neigh->failed = 0; nr_add_node()
131 if (quality == 0 && nr_neigh != NULL && nr_node != NULL) { nr_add_node()
132 nr_neigh_put(nr_neigh); nr_add_node()
137 if (nr_neigh == NULL) { nr_add_node()
138 if ((nr_neigh = kmalloc(sizeof(*nr_neigh), GFP_ATOMIC)) == NULL) { nr_add_node()
144 nr_neigh->callsign = *ax25; nr_add_node()
145 nr_neigh->digipeat = NULL; nr_add_node()
146 nr_neigh->ax25 = NULL; nr_add_node()
147 nr_neigh->dev = dev; nr_add_node()
148 nr_neigh->quality = sysctl_netrom_default_path_quality; nr_add_node()
149 nr_neigh->locked = 0; nr_add_node()
150 nr_neigh->count = 0; nr_add_node()
151 nr_neigh->number = nr_neigh_no++; nr_add_node()
152 nr_neigh->failed = 0; nr_add_node()
153 atomic_set(&nr_neigh->refcount, 1); nr_add_node()
156 nr_neigh->digipeat = kmemdup(ax25_digi, nr_add_node()
159 if (nr_neigh->digipeat == NULL) { nr_add_node()
160 kfree(nr_neigh); nr_add_node()
168 hlist_add_head(&nr_neigh->neigh_node, &nr_neigh_list); nr_add_node()
169 nr_neigh_hold(nr_neigh); nr_add_node()
173 if (quality != 0 && ax25cmp(nr, ax25) == 0 && !nr_neigh->locked) nr_add_node()
174 nr_neigh->quality = quality; nr_add_node()
178 if (nr_neigh) nr_add_node()
179 nr_neigh_put(nr_neigh); nr_add_node()
193 nr_node->routes[0].neighbour = nr_neigh; nr_add_node()
195 nr_neigh_hold(nr_neigh); nr_add_node()
196 nr_neigh->count++; nr_add_node()
211 if (nr_node->routes[i].neighbour == nr_neigh) { nr_add_node()
227 nr_node->routes[0].neighbour = nr_neigh; nr_add_node()
231 nr_neigh_hold(nr_neigh); nr_add_node()
232 nr_neigh->count++; nr_add_node()
244 nr_node->routes[2].neighbour = nr_neigh; nr_add_node()
246 nr_neigh_hold(nr_neigh); nr_add_node()
247 nr_neigh->count++; nr_add_node()
303 if (nr_node->routes[i].neighbour == nr_neigh) { nr_add_node()
310 nr_neigh_put(nr_neigh); nr_add_node()
332 static inline void __nr_remove_neigh(struct nr_neigh *nr_neigh) __nr_remove_neigh() argument
334 hlist_del_init(&nr_neigh->neigh_node); __nr_remove_neigh()
335 nr_neigh_put(nr_neigh); __nr_remove_neigh()
341 static void nr_remove_neigh(struct nr_neigh *nr_neigh) nr_remove_neigh() argument
344 __nr_remove_neigh(nr_neigh); nr_remove_neigh()
355 struct nr_neigh *nr_neigh; nr_del_node() local
363 nr_neigh = nr_neigh_get_dev(neighbour, dev); nr_del_node()
365 if (nr_neigh == NULL) { nr_del_node()
372 if (nr_node->routes[i].neighbour == nr_neigh) { nr_del_node()
373 nr_neigh->count--; nr_del_node()
374 nr_neigh_put(nr_neigh); nr_del_node()
376 if (nr_neigh->count == 0 && !nr_neigh->locked) nr_del_node()
377 nr_remove_neigh(nr_neigh); nr_del_node()
378 nr_neigh_put(nr_neigh); nr_del_node()
400 nr_neigh_put(nr_neigh); nr_del_node()
413 struct nr_neigh *nr_neigh; nr_add_neigh() local
415 nr_neigh = nr_neigh_get_dev(callsign, dev); nr_add_neigh()
416 if (nr_neigh) { nr_add_neigh()
417 nr_neigh->quality = quality; nr_add_neigh()
418 nr_neigh->locked = 1; nr_add_neigh()
419 nr_neigh_put(nr_neigh); nr_add_neigh()
423 if ((nr_neigh = kmalloc(sizeof(*nr_neigh), GFP_ATOMIC)) == NULL) nr_add_neigh()
426 nr_neigh->callsign = *callsign; nr_add_neigh()
427 nr_neigh->digipeat = NULL; nr_add_neigh()
428 nr_neigh->ax25 = NULL; nr_add_neigh()
429 nr_neigh->dev = dev; nr_add_neigh()
430 nr_neigh->quality = quality; nr_add_neigh()
431 nr_neigh->locked = 1; nr_add_neigh()
432 nr_neigh->count = 0; nr_add_neigh()
433 nr_neigh->number = nr_neigh_no++; nr_add_neigh()
434 nr_neigh->failed = 0; nr_add_neigh()
435 atomic_set(&nr_neigh->refcount, 1); nr_add_neigh()
438 nr_neigh->digipeat = kmemdup(ax25_digi, sizeof(*ax25_digi), nr_add_neigh()
440 if (nr_neigh->digipeat == NULL) { nr_add_neigh()
441 kfree(nr_neigh); nr_add_neigh()
447 hlist_add_head(&nr_neigh->neigh_node, &nr_neigh_list); nr_add_neigh()
460 struct nr_neigh *nr_neigh; nr_del_neigh() local
462 nr_neigh = nr_neigh_get_dev(callsign, dev); nr_del_neigh()
464 if (nr_neigh == NULL) return -EINVAL; nr_del_neigh()
466 nr_neigh->quality = quality; nr_del_neigh()
467 nr_neigh->locked = 0; nr_del_neigh()
469 if (nr_neigh->count == 0) nr_del_neigh()
470 nr_remove_neigh(nr_neigh); nr_del_neigh()
471 nr_neigh_put(nr_neigh); nr_del_neigh()
483 struct nr_neigh *nr_neigh; nr_dec_obs() local
497 nr_neigh = s->routes[i].neighbour; nr_dec_obs()
499 nr_neigh->count--; nr_dec_obs()
500 nr_neigh_put(nr_neigh); nr_dec_obs()
502 if (nr_neigh->count == 0 && !nr_neigh->locked) nr_dec_obs()
503 nr_remove_neigh(nr_neigh); nr_dec_obs()
539 struct nr_neigh *s; nr_rt_device_down()
736 struct nr_neigh *s, *nr_neigh = NULL; nr_link_failed() local
743 nr_neigh = s; nr_link_failed()
749 if (nr_neigh == NULL) nr_link_failed()
752 nr_neigh->ax25 = NULL; nr_link_failed()
755 if (++nr_neigh->failed < sysctl_netrom_link_fails_count) { nr_link_failed()
756 nr_neigh_put(nr_neigh); nr_link_failed()
763 nr_node->routes[nr_node->which].neighbour == nr_neigh) nr_link_failed()
768 nr_neigh_put(nr_neigh); nr_link_failed()
778 struct nr_neigh *nr_neigh; nr_route_frame() local
826 nr_neigh = nr_node->routes[nr_node->which].neighbour; nr_route_frame()
850 ax25s = nr_neigh->ax25; nr_route_frame()
851 nr_neigh->ax25 = ax25_send_frame(skb, 256, nr_route_frame()
853 &nr_neigh->callsign, nr_route_frame()
854 nr_neigh->digipeat, nr_neigh->dev); nr_route_frame()
859 ret = (nr_neigh->ax25 != NULL); nr_route_frame()
960 struct nr_neigh *nr_neigh; nr_neigh_show() local
962 nr_neigh = hlist_entry(v, struct nr_neigh, neigh_node); nr_neigh_show()
964 nr_neigh->number, nr_neigh_show()
965 ax2asc(buf, &nr_neigh->callsign), nr_neigh_show()
966 nr_neigh->dev ? nr_neigh->dev->name : "???", nr_neigh_show()
967 nr_neigh->quality, nr_neigh_show()
968 nr_neigh->locked, nr_neigh_show()
969 nr_neigh->count, nr_neigh_show()
970 nr_neigh->failed); nr_neigh_show()
972 if (nr_neigh->digipeat != NULL) { nr_neigh_show()
973 for (i = 0; i < nr_neigh->digipeat->ndigi; i++) nr_neigh_show()
975 ax2asc(buf, &nr_neigh->digipeat->calls[i])); nr_neigh_show()
1010 struct nr_neigh *s = NULL; nr_rt_free()
H A Daf_netrom.c1453 proc_create("nr_neigh", S_IRUGO, init_net.proc_net, &nr_neigh_fops); nr_proto_init()
1483 remove_proc_entry("nr_neigh", init_net.proc_net); nr_exit()
/linux-4.1.27/include/net/
H A Dnetrom.h85 struct nr_neigh { struct
102 struct nr_neigh *neighbour;
117 * nr_node & nr_neigh lists, refcounting and locking
133 static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh) nr_neigh_put() argument
135 if (atomic_dec_and_test(&nr_neigh->refcount)) { nr_neigh_put()
136 if (nr_neigh->ax25) nr_neigh_put()
137 ax25_cb_put(nr_neigh->ax25); nr_neigh_put()
138 kfree(nr_neigh->digipeat); nr_neigh_put()
139 kfree(nr_neigh); nr_neigh_put()

Completed in 87 milliseconds