Lines Matching +full:interface +full:- +full:node

1 // SPDX-License-Identifier: GPL-2.0
33 #include "distributed-arp-table.h"
36 #include "hard-interface.h"
41 #include "network-coding.h"
43 #include "translation-table.h"
49 * batadv_orig_hash_find() - Find and return originator from orig_hash
50 * @bat_priv: the bat priv with all the mesh interface information
58 struct batadv_hashtable *hash = bat_priv->orig_hash; in batadv_orig_hash_find()
66 index = batadv_choose_orig(data, hash->size); in batadv_orig_hash_find()
67 head = &hash->table[index]; in batadv_orig_hash_find()
74 if (!kref_get_unless_zero(&orig_node->refcount)) in batadv_orig_hash_find()
88 * batadv_compare_orig() - comparing function used in the originator hash table
89 * @node: node in the local table
90 * @data2: second object to compare the node to
94 bool batadv_compare_orig(const struct hlist_node *node, const void *data2) in batadv_compare_orig() argument
96 const void *data1 = container_of(node, struct batadv_orig_node, in batadv_compare_orig()
103 * batadv_orig_node_vlan_get() - get an orig_node_vlan object
117 hlist_for_each_entry_rcu(tmp, &orig_node->vlan_list, list) { in batadv_orig_node_vlan_get()
118 if (tmp->vid != vid) in batadv_orig_node_vlan_get()
121 if (!kref_get_unless_zero(&tmp->refcount)) in batadv_orig_node_vlan_get()
134 * batadv_vlan_id_valid() - check if vlan id is in valid batman-adv encoding
157 * batadv_orig_node_vlan_new() - search and possibly create an orig_node_vlan
177 spin_lock_bh(&orig_node->vlan_list_lock); in batadv_orig_node_vlan_new()
188 kref_init(&vlan->refcount); in batadv_orig_node_vlan_new()
189 vlan->vid = vid; in batadv_orig_node_vlan_new()
191 kref_get(&vlan->refcount); in batadv_orig_node_vlan_new()
192 hlist_add_head_rcu(&vlan->list, &orig_node->vlan_list); in batadv_orig_node_vlan_new()
195 spin_unlock_bh(&orig_node->vlan_list_lock); in batadv_orig_node_vlan_new()
201 * batadv_orig_node_vlan_release() - release originator-vlan object from lists
203 * @ref: kref pointer of the originator-vlan object
215 * batadv_originator_init() - Initialize all originator structures
216 * @bat_priv: the bat priv with all the mesh interface information
222 if (bat_priv->orig_hash) in batadv_originator_init()
225 bat_priv->orig_hash = batadv_hash_new(1024); in batadv_originator_init()
227 if (!bat_priv->orig_hash) in batadv_originator_init()
230 batadv_hash_set_lock_class(bat_priv->orig_hash, in batadv_originator_init()
233 INIT_DELAYED_WORK(&bat_priv->orig_work, batadv_purge_orig); in batadv_originator_init()
235 &bat_priv->orig_work, in batadv_originator_init()
241 return -ENOMEM; in batadv_originator_init()
245 * batadv_neigh_ifinfo_release() - release neigh_ifinfo from lists and queue for
255 if (neigh_ifinfo->if_outgoing != BATADV_IF_DEFAULT) in batadv_neigh_ifinfo_release()
256 batadv_hardif_put(neigh_ifinfo->if_outgoing); in batadv_neigh_ifinfo_release()
262 * batadv_hardif_neigh_release() - release hardif neigh node from lists and
273 spin_lock_bh(&hardif_neigh->if_incoming->neigh_list_lock); in batadv_hardif_neigh_release()
274 hlist_del_init_rcu(&hardif_neigh->list); in batadv_hardif_neigh_release()
275 spin_unlock_bh(&hardif_neigh->if_incoming->neigh_list_lock); in batadv_hardif_neigh_release()
277 batadv_hardif_put(hardif_neigh->if_incoming); in batadv_hardif_neigh_release()
282 * batadv_neigh_node_release() - release neigh_node from lists and queue for
295 &neigh_node->ifinfo_list, list) { in batadv_neigh_node_release()
299 batadv_hardif_neigh_put(neigh_node->hardif_neigh); in batadv_neigh_node_release()
301 batadv_hardif_put(neigh_node->if_incoming); in batadv_neigh_node_release()
307 * batadv_orig_router_get() - router to the originator depending on iface
308 * @orig_node: the orig node for the router
309 * @if_outgoing: the interface where the payload packet has been received or
324 hlist_for_each_entry_rcu(orig_ifinfo, &orig_node->ifinfo_list, list) { in batadv_orig_router_get()
325 if (orig_ifinfo->if_outgoing != if_outgoing) in batadv_orig_router_get()
328 router = rcu_dereference(orig_ifinfo->router); in batadv_orig_router_get()
332 if (router && !kref_get_unless_zero(&router->refcount)) in batadv_orig_router_get()
340 * batadv_orig_to_router() - get next hop neighbor to an orig address
341 * @bat_priv: the bat priv with all the mesh interface information
343 * @if_outgoing: the interface where the payload packet has been received or
346 * Return: A neighbor node which is the best router towards the given originator
367 * batadv_orig_ifinfo_get() - find the ifinfo from an orig_node
368 * @orig_node: the orig node to be queried
369 * @if_outgoing: the interface for which the ifinfo should be acquired
382 hlist_for_each_entry_rcu(tmp, &orig_node->ifinfo_list, in batadv_orig_ifinfo_get()
384 if (tmp->if_outgoing != if_outgoing) in batadv_orig_ifinfo_get()
387 if (!kref_get_unless_zero(&tmp->refcount)) in batadv_orig_ifinfo_get()
399 * batadv_orig_ifinfo_new() - search and possibly create an orig_ifinfo object
400 * @orig_node: the orig node to be queried
401 * @if_outgoing: the interface for which the ifinfo should be acquired
404 * interface otherwise. The object is created and added to the list
416 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_orig_ifinfo_new()
427 kref_get(&if_outgoing->refcount); in batadv_orig_ifinfo_new()
429 reset_time = jiffies - 1; in batadv_orig_ifinfo_new()
430 reset_time -= msecs_to_jiffies(BATADV_RESET_PROTECTION_MS); in batadv_orig_ifinfo_new()
431 orig_ifinfo->batman_seqno_reset = reset_time; in batadv_orig_ifinfo_new()
432 orig_ifinfo->if_outgoing = if_outgoing; in batadv_orig_ifinfo_new()
433 INIT_HLIST_NODE(&orig_ifinfo->list); in batadv_orig_ifinfo_new()
434 kref_init(&orig_ifinfo->refcount); in batadv_orig_ifinfo_new()
436 kref_get(&orig_ifinfo->refcount); in batadv_orig_ifinfo_new()
437 hlist_add_head_rcu(&orig_ifinfo->list, in batadv_orig_ifinfo_new()
438 &orig_node->ifinfo_list); in batadv_orig_ifinfo_new()
440 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_orig_ifinfo_new()
445 * batadv_neigh_ifinfo_get() - find the ifinfo from an neigh_node
446 * @neigh: the neigh node to be queried
447 * @if_outgoing: the interface for which the ifinfo should be acquired
461 hlist_for_each_entry_rcu(tmp_neigh_ifinfo, &neigh->ifinfo_list, in batadv_neigh_ifinfo_get()
463 if (tmp_neigh_ifinfo->if_outgoing != if_outgoing) in batadv_neigh_ifinfo_get()
466 if (!kref_get_unless_zero(&tmp_neigh_ifinfo->refcount)) in batadv_neigh_ifinfo_get()
478 * batadv_neigh_ifinfo_new() - search and possibly create an neigh_ifinfo object
479 * @neigh: the neigh node to be queried
480 * @if_outgoing: the interface for which the ifinfo should be acquired
483 * if_outgoing interface otherwise. The object is created and added to the list
494 spin_lock_bh(&neigh->ifinfo_lock); in batadv_neigh_ifinfo_new()
505 kref_get(&if_outgoing->refcount); in batadv_neigh_ifinfo_new()
507 INIT_HLIST_NODE(&neigh_ifinfo->list); in batadv_neigh_ifinfo_new()
508 kref_init(&neigh_ifinfo->refcount); in batadv_neigh_ifinfo_new()
509 neigh_ifinfo->if_outgoing = if_outgoing; in batadv_neigh_ifinfo_new()
511 kref_get(&neigh_ifinfo->refcount); in batadv_neigh_ifinfo_new()
512 hlist_add_head_rcu(&neigh_ifinfo->list, &neigh->ifinfo_list); in batadv_neigh_ifinfo_new()
515 spin_unlock_bh(&neigh->ifinfo_lock); in batadv_neigh_ifinfo_new()
521 * batadv_neigh_node_get() - retrieve a neighbour from the list
523 * @hard_iface: the interface where this neighbour is connected to
527 * which is connected through the provided hard interface.
539 hlist_for_each_entry_rcu(tmp_neigh_node, &orig_node->neigh_list, list) { in batadv_neigh_node_get()
540 if (!batadv_compare_eth(tmp_neigh_node->addr, addr)) in batadv_neigh_node_get()
543 if (tmp_neigh_node->if_incoming != hard_iface) in batadv_neigh_node_get()
546 if (!kref_get_unless_zero(&tmp_neigh_node->refcount)) in batadv_neigh_node_get()
558 * batadv_hardif_neigh_create() - create a hardif neighbour node
559 * @hard_iface: the interface this neighbour is connected to
560 * @neigh_addr: the interface address of the neighbour to retrieve
563 * Return: the hardif neighbour node if found or created or NULL otherwise.
570 struct batadv_priv *bat_priv = netdev_priv(hard_iface->mesh_iface); in batadv_hardif_neigh_create()
573 spin_lock_bh(&hard_iface->neigh_list_lock); in batadv_hardif_neigh_create()
584 kref_get(&hard_iface->refcount); in batadv_hardif_neigh_create()
585 INIT_HLIST_NODE(&hardif_neigh->list); in batadv_hardif_neigh_create()
586 ether_addr_copy(hardif_neigh->addr, neigh_addr); in batadv_hardif_neigh_create()
587 ether_addr_copy(hardif_neigh->orig, orig_node->orig); in batadv_hardif_neigh_create()
588 hardif_neigh->if_incoming = hard_iface; in batadv_hardif_neigh_create()
589 hardif_neigh->last_seen = jiffies; in batadv_hardif_neigh_create()
591 kref_init(&hardif_neigh->refcount); in batadv_hardif_neigh_create()
593 if (bat_priv->algo_ops->neigh.hardif_init) in batadv_hardif_neigh_create()
594 bat_priv->algo_ops->neigh.hardif_init(hardif_neigh); in batadv_hardif_neigh_create()
596 hlist_add_head_rcu(&hardif_neigh->list, &hard_iface->neigh_list); in batadv_hardif_neigh_create()
599 spin_unlock_bh(&hard_iface->neigh_list_lock); in batadv_hardif_neigh_create()
604 * batadv_hardif_neigh_get_or_create() - retrieve or create a hardif neighbour
605 * node
606 * @hard_iface: the interface this neighbour is connected to
607 * @neigh_addr: the interface address of the neighbour to retrieve
610 * Return: the hardif neighbour node if found or created or NULL otherwise.
628 * batadv_hardif_neigh_get() - retrieve a hardif neighbour from the list
629 * @hard_iface: the interface where this neighbour is connected to
632 * Looks for and possibly returns a neighbour belonging to this hard interface.
644 &hard_iface->neigh_list, list) { in batadv_hardif_neigh_get()
645 if (!batadv_compare_eth(tmp_hardif_neigh->addr, neigh_addr)) in batadv_hardif_neigh_get()
648 if (!kref_get_unless_zero(&tmp_hardif_neigh->refcount)) in batadv_hardif_neigh_get()
660 * batadv_neigh_node_create() - create a neigh node object
662 * @hard_iface: the interface where the neighbour is connected to
663 * @neigh_addr: the mac address of the neighbour interface
667 * Return: the neighbour node if found or created or NULL otherwise.
677 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_neigh_node_create()
692 INIT_HLIST_NODE(&neigh_node->list); in batadv_neigh_node_create()
693 INIT_HLIST_HEAD(&neigh_node->ifinfo_list); in batadv_neigh_node_create()
694 spin_lock_init(&neigh_node->ifinfo_lock); in batadv_neigh_node_create()
696 kref_get(&hard_iface->refcount); in batadv_neigh_node_create()
697 ether_addr_copy(neigh_node->addr, neigh_addr); in batadv_neigh_node_create()
698 neigh_node->if_incoming = hard_iface; in batadv_neigh_node_create()
699 neigh_node->orig_node = orig_node; in batadv_neigh_node_create()
700 neigh_node->last_seen = jiffies; in batadv_neigh_node_create()
703 kref_get(&hardif_neigh->refcount); in batadv_neigh_node_create()
704 neigh_node->hardif_neigh = hardif_neigh; in batadv_neigh_node_create()
707 kref_init(&neigh_node->refcount); in batadv_neigh_node_create()
709 kref_get(&neigh_node->refcount); in batadv_neigh_node_create()
710 hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list); in batadv_neigh_node_create()
712 batadv_dbg(BATADV_DBG_BATMAN, orig_node->bat_priv, in batadv_neigh_node_create()
713 "Creating new neighbor %pM for orig_node %pM on interface %s\n", in batadv_neigh_node_create()
714 neigh_addr, orig_node->orig, hard_iface->net_dev->name); in batadv_neigh_node_create()
717 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_neigh_node_create()
724 * batadv_neigh_node_get_or_create() - retrieve or create a neigh node object
726 * @hard_iface: the interface where the neighbour is connected to
727 * @neigh_addr: the mac address of the neighbour interface
729 * Return: the neighbour node if found or created or NULL otherwise.
747 * batadv_hardif_neigh_dump() - Dump to netlink the neighbor infos for a
748 * specific outgoing interface
768 if (!primary_if || primary_if->if_status != BATADV_IF_ACTIVE) { in batadv_hardif_neigh_dump()
769 ret = -ENOENT; in batadv_hardif_neigh_dump()
774 if (IS_ERR(hard_iface) && PTR_ERR(hard_iface) != -ENONET) { in batadv_hardif_neigh_dump()
778 /* => PTR_ERR(hard_iface) == -ENONET in batadv_hardif_neigh_dump()
779 * => no hard-iface given, ok in batadv_hardif_neigh_dump()
784 if (!bat_priv->algo_ops->neigh.dump) { in batadv_hardif_neigh_dump()
785 ret = -EOPNOTSUPP; in batadv_hardif_neigh_dump()
789 bat_priv->algo_ops->neigh.dump(msg, cb, bat_priv, hard_iface); in batadv_hardif_neigh_dump()
791 ret = msg->len; in batadv_hardif_neigh_dump()
804 * batadv_orig_ifinfo_release() - release orig_ifinfo from lists and queue for
815 if (orig_ifinfo->if_outgoing != BATADV_IF_DEFAULT) in batadv_orig_ifinfo_release()
816 batadv_hardif_put(orig_ifinfo->if_outgoing); in batadv_orig_ifinfo_release()
819 router = rcu_dereference_protected(orig_ifinfo->router, true); in batadv_orig_ifinfo_release()
826 * batadv_orig_node_free_rcu() - free the orig_node
839 kfree(orig_node->tt_buff); in batadv_orig_node_free_rcu()
844 * batadv_orig_node_release() - release orig_node from lists and queue for
859 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_orig_node_release()
863 &orig_node->neigh_list, list) { in batadv_orig_node_release()
864 hlist_del_rcu(&neigh_node->list); in batadv_orig_node_release()
869 &orig_node->ifinfo_list, list) { in batadv_orig_node_release()
870 hlist_del_rcu(&orig_ifinfo->list); in batadv_orig_node_release()
874 last_candidate = orig_node->last_bonding_candidate; in batadv_orig_node_release()
875 orig_node->last_bonding_candidate = NULL; in batadv_orig_node_release()
876 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_orig_node_release()
880 spin_lock_bh(&orig_node->vlan_list_lock); in batadv_orig_node_release()
881 hlist_for_each_entry_safe(vlan, node_tmp, &orig_node->vlan_list, list) { in batadv_orig_node_release()
882 hlist_del_rcu(&vlan->list); in batadv_orig_node_release()
885 spin_unlock_bh(&orig_node->vlan_list_lock); in batadv_orig_node_release()
888 batadv_nc_purge_orig(orig_node->bat_priv, orig_node, NULL); in batadv_orig_node_release()
890 call_rcu(&orig_node->rcu, batadv_orig_node_free_rcu); in batadv_orig_node_release()
894 * batadv_originator_free() - Free all originator structures
895 * @bat_priv: the bat priv with all the mesh interface information
899 struct batadv_hashtable *hash = bat_priv->orig_hash; in batadv_originator_free()
909 cancel_delayed_work_sync(&bat_priv->orig_work); in batadv_originator_free()
911 bat_priv->orig_hash = NULL; in batadv_originator_free()
913 for (i = 0; i < hash->size; i++) { in batadv_originator_free()
914 head = &hash->table[i]; in batadv_originator_free()
915 list_lock = &hash->list_locks[i]; in batadv_originator_free()
920 hlist_del_rcu(&orig_node->hash_entry); in batadv_originator_free()
930 * batadv_orig_node_new() - creates a new orig_node
931 * @bat_priv: the bat priv with all the mesh interface information
954 INIT_HLIST_HEAD(&orig_node->neigh_list); in batadv_orig_node_new()
955 INIT_HLIST_HEAD(&orig_node->vlan_list); in batadv_orig_node_new()
956 INIT_HLIST_HEAD(&orig_node->ifinfo_list); in batadv_orig_node_new()
957 spin_lock_init(&orig_node->bcast_seqno_lock); in batadv_orig_node_new()
958 spin_lock_init(&orig_node->neigh_list_lock); in batadv_orig_node_new()
959 spin_lock_init(&orig_node->tt_buff_lock); in batadv_orig_node_new()
960 spin_lock_init(&orig_node->tt_lock); in batadv_orig_node_new()
961 spin_lock_init(&orig_node->vlan_list_lock); in batadv_orig_node_new()
966 kref_init(&orig_node->refcount); in batadv_orig_node_new()
968 orig_node->bat_priv = bat_priv; in batadv_orig_node_new()
969 ether_addr_copy(orig_node->orig, addr); in batadv_orig_node_new()
971 atomic_set(&orig_node->last_ttvn, 0); in batadv_orig_node_new()
972 orig_node->tt_buff = NULL; in batadv_orig_node_new()
973 orig_node->tt_buff_len = 0; in batadv_orig_node_new()
974 orig_node->last_seen = jiffies; in batadv_orig_node_new()
975 reset_time = jiffies - 1 - msecs_to_jiffies(BATADV_RESET_PROTECTION_MS); in batadv_orig_node_new()
976 orig_node->bcast_seqno_reset = reset_time; in batadv_orig_node_new()
979 orig_node->mcast_flags = BATADV_MCAST_WANT_NO_RTR4; in batadv_orig_node_new()
980 orig_node->mcast_flags |= BATADV_MCAST_WANT_NO_RTR6; in batadv_orig_node_new()
981 orig_node->mcast_flags |= BATADV_MCAST_HAVE_MC_PTYPE_CAPA; in batadv_orig_node_new()
982 INIT_HLIST_NODE(&orig_node->mcast_want_all_unsnoopables_node); in batadv_orig_node_new()
983 INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv4_node); in batadv_orig_node_new()
984 INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv6_node); in batadv_orig_node_new()
985 spin_lock_init(&orig_node->mcast_handler_lock); in batadv_orig_node_new()
999 INIT_HLIST_HEAD(&orig_node->fragments[i].fragment_list); in batadv_orig_node_new()
1000 spin_lock_init(&orig_node->fragments[i].lock); in batadv_orig_node_new()
1001 orig_node->fragments[i].size = 0; in batadv_orig_node_new()
1011 * batadv_purge_neigh_ifinfo() - purge obsolete ifinfo entries from neighbor
1012 * @bat_priv: the bat priv with all the mesh interface information
1013 * @neigh: orig node which is to be checked
1023 spin_lock_bh(&neigh->ifinfo_lock); in batadv_purge_neigh_ifinfo()
1027 &neigh->ifinfo_list, list) { in batadv_purge_neigh_ifinfo()
1028 if_outgoing = neigh_ifinfo->if_outgoing; in batadv_purge_neigh_ifinfo()
1030 /* always keep the default interface */ in batadv_purge_neigh_ifinfo()
1034 /* don't purge if the interface is not (going) down */ in batadv_purge_neigh_ifinfo()
1035 if (if_outgoing->if_status != BATADV_IF_INACTIVE && in batadv_purge_neigh_ifinfo()
1036 if_outgoing->if_status != BATADV_IF_NOT_IN_USE && in batadv_purge_neigh_ifinfo()
1037 if_outgoing->if_status != BATADV_IF_TO_BE_REMOVED) in batadv_purge_neigh_ifinfo()
1042 neigh->addr, if_outgoing->net_dev->name); in batadv_purge_neigh_ifinfo()
1044 hlist_del_rcu(&neigh_ifinfo->list); in batadv_purge_neigh_ifinfo()
1048 spin_unlock_bh(&neigh->ifinfo_lock); in batadv_purge_neigh_ifinfo()
1052 * batadv_purge_orig_ifinfo() - purge obsolete ifinfo entries from originator
1053 * @bat_priv: the bat priv with all the mesh interface information
1054 * @orig_node: orig node which is to be checked
1067 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_purge_orig_ifinfo()
1071 &orig_node->ifinfo_list, list) { in batadv_purge_orig_ifinfo()
1072 if_outgoing = orig_ifinfo->if_outgoing; in batadv_purge_orig_ifinfo()
1074 /* always keep the default interface */ in batadv_purge_orig_ifinfo()
1078 /* don't purge if the interface is not (going) down */ in batadv_purge_orig_ifinfo()
1079 if (if_outgoing->if_status != BATADV_IF_INACTIVE && in batadv_purge_orig_ifinfo()
1080 if_outgoing->if_status != BATADV_IF_NOT_IN_USE && in batadv_purge_orig_ifinfo()
1081 if_outgoing->if_status != BATADV_IF_TO_BE_REMOVED) in batadv_purge_orig_ifinfo()
1086 orig_node->orig, if_outgoing->net_dev->name); in batadv_purge_orig_ifinfo()
1090 hlist_del_rcu(&orig_ifinfo->list); in batadv_purge_orig_ifinfo()
1092 if (orig_node->last_bonding_candidate == orig_ifinfo) { in batadv_purge_orig_ifinfo()
1093 orig_node->last_bonding_candidate = NULL; in batadv_purge_orig_ifinfo()
1098 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_purge_orig_ifinfo()
1104 * batadv_purge_orig_neighbors() - purges neighbors from originator
1105 * @bat_priv: the bat priv with all the mesh interface information
1106 * @orig_node: orig node which is to be checked
1120 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_purge_orig_neighbors()
1124 &orig_node->neigh_list, list) { in batadv_purge_orig_neighbors()
1125 last_seen = neigh_node->last_seen; in batadv_purge_orig_neighbors()
1126 if_incoming = neigh_node->if_incoming; in batadv_purge_orig_neighbors()
1129 if_incoming->if_status == BATADV_IF_INACTIVE || in batadv_purge_orig_neighbors()
1130 if_incoming->if_status == BATADV_IF_NOT_IN_USE || in batadv_purge_orig_neighbors()
1131 if_incoming->if_status == BATADV_IF_TO_BE_REMOVED) { in batadv_purge_orig_neighbors()
1132 if (if_incoming->if_status == BATADV_IF_INACTIVE || in batadv_purge_orig_neighbors()
1133 if_incoming->if_status == BATADV_IF_NOT_IN_USE || in batadv_purge_orig_neighbors()
1134 if_incoming->if_status == BATADV_IF_TO_BE_REMOVED) in batadv_purge_orig_neighbors()
1137 orig_node->orig, neigh_node->addr, in batadv_purge_orig_neighbors()
1138 if_incoming->net_dev->name); in batadv_purge_orig_neighbors()
1142 orig_node->orig, neigh_node->addr, in batadv_purge_orig_neighbors()
1147 hlist_del_rcu(&neigh_node->list); in batadv_purge_orig_neighbors()
1151 * deleted, but some interface has been removed. in batadv_purge_orig_neighbors()
1157 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_purge_orig_neighbors()
1162 * batadv_find_best_neighbor() - finds the best neighbor after purging
1163 * @bat_priv: the bat priv with all the mesh interface information
1164 * @orig_node: orig node which is to be checked
1165 * @if_outgoing: the interface for which the metric should be compared
1175 struct batadv_algo_ops *bao = bat_priv->algo_ops; in batadv_find_best_neighbor()
1178 hlist_for_each_entry_rcu(neigh, &orig_node->neigh_list, list) { in batadv_find_best_neighbor()
1179 if (best && (bao->neigh.cmp(neigh, if_outgoing, best, in batadv_find_best_neighbor()
1183 if (!kref_get_unless_zero(&neigh->refcount)) in batadv_find_best_neighbor()
1196 * batadv_purge_orig_node() - purges obsolete information from an orig_node
1197 * @bat_priv: the bat priv with all the mesh interface information
1198 * @orig_node: orig node which is to be checked
1212 if (batadv_has_timed_out(orig_node->last_seen, in batadv_purge_orig_node()
1216 orig_node->orig, in batadv_purge_orig_node()
1217 jiffies_to_msecs(orig_node->last_seen)); in batadv_purge_orig_node()
1236 if (hard_iface->if_status != BATADV_IF_ACTIVE) in batadv_purge_orig_node()
1239 if (hard_iface->mesh_iface != bat_priv->mesh_iface) in batadv_purge_orig_node()
1242 if (!kref_get_unless_zero(&hard_iface->refcount)) in batadv_purge_orig_node()
1260 * batadv_purge_orig_ref() - Purge all outdated originators
1261 * @bat_priv: the bat priv with all the mesh interface information
1265 struct batadv_hashtable *hash = bat_priv->orig_hash; in batadv_purge_orig_ref()
1276 for (i = 0; i < hash->size; i++) { in batadv_purge_orig_ref()
1277 head = &hash->table[i]; in batadv_purge_orig_ref()
1280 list_lock = &hash->list_locks[i]; in batadv_purge_orig_ref()
1287 hlist_del_rcu(&orig_node->hash_entry); in batadv_purge_orig_ref()
1288 batadv_tt_global_del_orig(orig_node->bat_priv, in batadv_purge_orig_ref()
1289 orig_node, -1, in batadv_purge_orig_ref()
1313 &bat_priv->orig_work, in batadv_purge_orig()
1318 * batadv_orig_dump() - Dump to netlink the originator infos for a specific
1319 * outgoing interface
1339 if (!primary_if || primary_if->if_status != BATADV_IF_ACTIVE) { in batadv_orig_dump()
1340 ret = -ENOENT; in batadv_orig_dump()
1345 if (IS_ERR(hard_iface) && PTR_ERR(hard_iface) != -ENONET) { in batadv_orig_dump()
1349 /* => PTR_ERR(hard_iface) == -ENONET in batadv_orig_dump()
1350 * => no hard-iface given, ok in batadv_orig_dump()
1355 if (!bat_priv->algo_ops->orig.dump) { in batadv_orig_dump()
1356 ret = -EOPNOTSUPP; in batadv_orig_dump()
1360 bat_priv->algo_ops->orig.dump(msg, cb, bat_priv, hard_iface); in batadv_orig_dump()
1362 ret = msg->len; in batadv_orig_dump()