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 "soft-interface.h"
44 #include "translation-table.h"
50 * batadv_orig_hash_find() - Find and return originator from orig_hash
51 * @bat_priv: the bat priv with all the soft interface information
59 struct batadv_hashtable *hash = bat_priv->orig_hash; in batadv_orig_hash_find()
67 index = batadv_choose_orig(data, hash->size); in batadv_orig_hash_find()
68 head = &hash->table[index]; in batadv_orig_hash_find()
75 if (!kref_get_unless_zero(&orig_node->refcount)) in batadv_orig_hash_find()
89 * batadv_compare_orig() - comparing function used in the originator hash table
90 * @node: node in the local table
91 * @data2: second object to compare the node to
95 bool batadv_compare_orig(const struct hlist_node *node, const void *data2) in batadv_compare_orig() argument
97 const void *data1 = container_of(node, struct batadv_orig_node, in batadv_compare_orig()
104 * batadv_orig_node_vlan_get() - get an orig_node_vlan object
118 hlist_for_each_entry_rcu(tmp, &orig_node->vlan_list, list) { in batadv_orig_node_vlan_get()
119 if (tmp->vid != vid) in batadv_orig_node_vlan_get()
122 if (!kref_get_unless_zero(&tmp->refcount)) in batadv_orig_node_vlan_get()
135 * batadv_orig_node_vlan_new() - search and possibly create an orig_node_vlan
152 spin_lock_bh(&orig_node->vlan_list_lock); in batadv_orig_node_vlan_new()
163 kref_init(&vlan->refcount); in batadv_orig_node_vlan_new()
164 vlan->vid = vid; in batadv_orig_node_vlan_new()
166 kref_get(&vlan->refcount); in batadv_orig_node_vlan_new()
167 hlist_add_head_rcu(&vlan->list, &orig_node->vlan_list); in batadv_orig_node_vlan_new()
170 spin_unlock_bh(&orig_node->vlan_list_lock); in batadv_orig_node_vlan_new()
176 * batadv_orig_node_vlan_release() - release originator-vlan object from lists
178 * @ref: kref pointer of the originator-vlan object
190 * batadv_originator_init() - Initialize all originator structures
191 * @bat_priv: the bat priv with all the soft interface information
197 if (bat_priv->orig_hash) in batadv_originator_init()
200 bat_priv->orig_hash = batadv_hash_new(1024); in batadv_originator_init()
202 if (!bat_priv->orig_hash) in batadv_originator_init()
205 batadv_hash_set_lock_class(bat_priv->orig_hash, in batadv_originator_init()
208 INIT_DELAYED_WORK(&bat_priv->orig_work, batadv_purge_orig); in batadv_originator_init()
210 &bat_priv->orig_work, in batadv_originator_init()
216 return -ENOMEM; in batadv_originator_init()
220 * batadv_neigh_ifinfo_release() - release neigh_ifinfo from lists and queue for
230 if (neigh_ifinfo->if_outgoing != BATADV_IF_DEFAULT) in batadv_neigh_ifinfo_release()
231 batadv_hardif_put(neigh_ifinfo->if_outgoing); in batadv_neigh_ifinfo_release()
237 * batadv_hardif_neigh_release() - release hardif neigh node from lists and
248 spin_lock_bh(&hardif_neigh->if_incoming->neigh_list_lock); in batadv_hardif_neigh_release()
249 hlist_del_init_rcu(&hardif_neigh->list); in batadv_hardif_neigh_release()
250 spin_unlock_bh(&hardif_neigh->if_incoming->neigh_list_lock); in batadv_hardif_neigh_release()
252 batadv_hardif_put(hardif_neigh->if_incoming); in batadv_hardif_neigh_release()
257 * batadv_neigh_node_release() - release neigh_node from lists and queue for
270 &neigh_node->ifinfo_list, list) { in batadv_neigh_node_release()
274 batadv_hardif_neigh_put(neigh_node->hardif_neigh); in batadv_neigh_node_release()
276 batadv_hardif_put(neigh_node->if_incoming); in batadv_neigh_node_release()
282 * batadv_orig_router_get() - router to the originator depending on iface
283 * @orig_node: the orig node for the router
284 * @if_outgoing: the interface where the payload packet has been received or
299 hlist_for_each_entry_rcu(orig_ifinfo, &orig_node->ifinfo_list, list) { in batadv_orig_router_get()
300 if (orig_ifinfo->if_outgoing != if_outgoing) in batadv_orig_router_get()
303 router = rcu_dereference(orig_ifinfo->router); in batadv_orig_router_get()
307 if (router && !kref_get_unless_zero(&router->refcount)) in batadv_orig_router_get()
315 * batadv_orig_ifinfo_get() - find the ifinfo from an orig_node
316 * @orig_node: the orig node to be queried
317 * @if_outgoing: the interface for which the ifinfo should be acquired
330 hlist_for_each_entry_rcu(tmp, &orig_node->ifinfo_list, in batadv_orig_ifinfo_get()
332 if (tmp->if_outgoing != if_outgoing) in batadv_orig_ifinfo_get()
335 if (!kref_get_unless_zero(&tmp->refcount)) in batadv_orig_ifinfo_get()
347 * batadv_orig_ifinfo_new() - search and possibly create an orig_ifinfo object
348 * @orig_node: the orig node to be queried
349 * @if_outgoing: the interface for which the ifinfo should be acquired
352 * interface otherwise. The object is created and added to the list
364 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_orig_ifinfo_new()
375 kref_get(&if_outgoing->refcount); in batadv_orig_ifinfo_new()
377 reset_time = jiffies - 1; in batadv_orig_ifinfo_new()
378 reset_time -= msecs_to_jiffies(BATADV_RESET_PROTECTION_MS); in batadv_orig_ifinfo_new()
379 orig_ifinfo->batman_seqno_reset = reset_time; in batadv_orig_ifinfo_new()
380 orig_ifinfo->if_outgoing = if_outgoing; in batadv_orig_ifinfo_new()
381 INIT_HLIST_NODE(&orig_ifinfo->list); in batadv_orig_ifinfo_new()
382 kref_init(&orig_ifinfo->refcount); in batadv_orig_ifinfo_new()
384 kref_get(&orig_ifinfo->refcount); in batadv_orig_ifinfo_new()
385 hlist_add_head_rcu(&orig_ifinfo->list, in batadv_orig_ifinfo_new()
386 &orig_node->ifinfo_list); in batadv_orig_ifinfo_new()
388 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_orig_ifinfo_new()
393 * batadv_neigh_ifinfo_get() - find the ifinfo from an neigh_node
394 * @neigh: the neigh node to be queried
395 * @if_outgoing: the interface for which the ifinfo should be acquired
409 hlist_for_each_entry_rcu(tmp_neigh_ifinfo, &neigh->ifinfo_list, in batadv_neigh_ifinfo_get()
411 if (tmp_neigh_ifinfo->if_outgoing != if_outgoing) in batadv_neigh_ifinfo_get()
414 if (!kref_get_unless_zero(&tmp_neigh_ifinfo->refcount)) in batadv_neigh_ifinfo_get()
426 * batadv_neigh_ifinfo_new() - search and possibly create an neigh_ifinfo object
427 * @neigh: the neigh node to be queried
428 * @if_outgoing: the interface for which the ifinfo should be acquired
431 * if_outgoing interface otherwise. The object is created and added to the list
442 spin_lock_bh(&neigh->ifinfo_lock); in batadv_neigh_ifinfo_new()
453 kref_get(&if_outgoing->refcount); in batadv_neigh_ifinfo_new()
455 INIT_HLIST_NODE(&neigh_ifinfo->list); in batadv_neigh_ifinfo_new()
456 kref_init(&neigh_ifinfo->refcount); in batadv_neigh_ifinfo_new()
457 neigh_ifinfo->if_outgoing = if_outgoing; in batadv_neigh_ifinfo_new()
459 kref_get(&neigh_ifinfo->refcount); in batadv_neigh_ifinfo_new()
460 hlist_add_head_rcu(&neigh_ifinfo->list, &neigh->ifinfo_list); in batadv_neigh_ifinfo_new()
463 spin_unlock_bh(&neigh->ifinfo_lock); in batadv_neigh_ifinfo_new()
469 * batadv_neigh_node_get() - retrieve a neighbour from the list
471 * @hard_iface: the interface where this neighbour is connected to
475 * which is connected through the provided hard interface.
487 hlist_for_each_entry_rcu(tmp_neigh_node, &orig_node->neigh_list, list) { in batadv_neigh_node_get()
488 if (!batadv_compare_eth(tmp_neigh_node->addr, addr)) in batadv_neigh_node_get()
491 if (tmp_neigh_node->if_incoming != hard_iface) in batadv_neigh_node_get()
494 if (!kref_get_unless_zero(&tmp_neigh_node->refcount)) in batadv_neigh_node_get()
506 * batadv_hardif_neigh_create() - create a hardif neighbour node
507 * @hard_iface: the interface this neighbour is connected to
508 * @neigh_addr: the interface address of the neighbour to retrieve
511 * Return: the hardif neighbour node if found or created or NULL otherwise.
518 struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface); in batadv_hardif_neigh_create()
521 spin_lock_bh(&hard_iface->neigh_list_lock); in batadv_hardif_neigh_create()
532 kref_get(&hard_iface->refcount); in batadv_hardif_neigh_create()
533 INIT_HLIST_NODE(&hardif_neigh->list); in batadv_hardif_neigh_create()
534 ether_addr_copy(hardif_neigh->addr, neigh_addr); in batadv_hardif_neigh_create()
535 ether_addr_copy(hardif_neigh->orig, orig_node->orig); in batadv_hardif_neigh_create()
536 hardif_neigh->if_incoming = hard_iface; in batadv_hardif_neigh_create()
537 hardif_neigh->last_seen = jiffies; in batadv_hardif_neigh_create()
539 kref_init(&hardif_neigh->refcount); in batadv_hardif_neigh_create()
541 if (bat_priv->algo_ops->neigh.hardif_init) in batadv_hardif_neigh_create()
542 bat_priv->algo_ops->neigh.hardif_init(hardif_neigh); in batadv_hardif_neigh_create()
544 hlist_add_head_rcu(&hardif_neigh->list, &hard_iface->neigh_list); in batadv_hardif_neigh_create()
547 spin_unlock_bh(&hard_iface->neigh_list_lock); in batadv_hardif_neigh_create()
552 * batadv_hardif_neigh_get_or_create() - retrieve or create a hardif neighbour
553 * node
554 * @hard_iface: the interface this neighbour is connected to
555 * @neigh_addr: the interface address of the neighbour to retrieve
558 * Return: the hardif neighbour node if found or created or NULL otherwise.
576 * batadv_hardif_neigh_get() - retrieve a hardif neighbour from the list
577 * @hard_iface: the interface where this neighbour is connected to
580 * Looks for and possibly returns a neighbour belonging to this hard interface.
592 &hard_iface->neigh_list, list) { in batadv_hardif_neigh_get()
593 if (!batadv_compare_eth(tmp_hardif_neigh->addr, neigh_addr)) in batadv_hardif_neigh_get()
596 if (!kref_get_unless_zero(&tmp_hardif_neigh->refcount)) in batadv_hardif_neigh_get()
608 * batadv_neigh_node_create() - create a neigh node object
610 * @hard_iface: the interface where the neighbour is connected to
611 * @neigh_addr: the mac address of the neighbour interface
615 * Return: the neighbour node if found or created or NULL otherwise.
625 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_neigh_node_create()
640 INIT_HLIST_NODE(&neigh_node->list); in batadv_neigh_node_create()
641 INIT_HLIST_HEAD(&neigh_node->ifinfo_list); in batadv_neigh_node_create()
642 spin_lock_init(&neigh_node->ifinfo_lock); in batadv_neigh_node_create()
644 kref_get(&hard_iface->refcount); in batadv_neigh_node_create()
645 ether_addr_copy(neigh_node->addr, neigh_addr); in batadv_neigh_node_create()
646 neigh_node->if_incoming = hard_iface; in batadv_neigh_node_create()
647 neigh_node->orig_node = orig_node; in batadv_neigh_node_create()
648 neigh_node->last_seen = jiffies; in batadv_neigh_node_create()
651 kref_get(&hardif_neigh->refcount); in batadv_neigh_node_create()
652 neigh_node->hardif_neigh = hardif_neigh; in batadv_neigh_node_create()
655 kref_init(&neigh_node->refcount); in batadv_neigh_node_create()
657 kref_get(&neigh_node->refcount); in batadv_neigh_node_create()
658 hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list); in batadv_neigh_node_create()
660 batadv_dbg(BATADV_DBG_BATMAN, orig_node->bat_priv, in batadv_neigh_node_create()
661 "Creating new neighbor %pM for orig_node %pM on interface %s\n", in batadv_neigh_node_create()
662 neigh_addr, orig_node->orig, hard_iface->net_dev->name); in batadv_neigh_node_create()
665 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_neigh_node_create()
672 * batadv_neigh_node_get_or_create() - retrieve or create a neigh node object
674 * @hard_iface: the interface where the neighbour is connected to
675 * @neigh_addr: the mac address of the neighbour interface
677 * Return: the neighbour node if found or created or NULL otherwise.
695 * batadv_hardif_neigh_dump() - Dump to netlink the neighbor infos for a
696 * specific outgoing interface
704 struct net *net = sock_net(cb->skb->sk); in batadv_hardif_neigh_dump()
713 ifindex = batadv_netlink_get_ifindex(cb->nlh, BATADV_ATTR_MESH_IFINDEX); in batadv_hardif_neigh_dump()
715 return -EINVAL; in batadv_hardif_neigh_dump()
719 ret = -ENODEV; in batadv_hardif_neigh_dump()
726 if (!primary_if || primary_if->if_status != BATADV_IF_ACTIVE) { in batadv_hardif_neigh_dump()
727 ret = -ENOENT; in batadv_hardif_neigh_dump()
731 hard_ifindex = batadv_netlink_get_ifindex(cb->nlh, in batadv_hardif_neigh_dump()
739 ret = -ENODEV; in batadv_hardif_neigh_dump()
743 if (hardif->soft_iface != soft_iface) { in batadv_hardif_neigh_dump()
744 ret = -ENOENT; in batadv_hardif_neigh_dump()
749 if (!bat_priv->algo_ops->neigh.dump) { in batadv_hardif_neigh_dump()
750 ret = -EOPNOTSUPP; in batadv_hardif_neigh_dump()
754 bat_priv->algo_ops->neigh.dump(msg, cb, bat_priv, hardif); in batadv_hardif_neigh_dump()
756 ret = msg->len; in batadv_hardif_neigh_dump()
768 * batadv_orig_ifinfo_release() - release orig_ifinfo from lists and queue for
779 if (orig_ifinfo->if_outgoing != BATADV_IF_DEFAULT) in batadv_orig_ifinfo_release()
780 batadv_hardif_put(orig_ifinfo->if_outgoing); in batadv_orig_ifinfo_release()
783 router = rcu_dereference_protected(orig_ifinfo->router, true); in batadv_orig_ifinfo_release()
790 * batadv_orig_node_free_rcu() - free the orig_node
803 kfree(orig_node->tt_buff); in batadv_orig_node_free_rcu()
808 * batadv_orig_node_release() - release orig_node from lists and queue for
823 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_orig_node_release()
827 &orig_node->neigh_list, list) { in batadv_orig_node_release()
828 hlist_del_rcu(&neigh_node->list); in batadv_orig_node_release()
833 &orig_node->ifinfo_list, list) { in batadv_orig_node_release()
834 hlist_del_rcu(&orig_ifinfo->list); in batadv_orig_node_release()
838 last_candidate = orig_node->last_bonding_candidate; in batadv_orig_node_release()
839 orig_node->last_bonding_candidate = NULL; in batadv_orig_node_release()
840 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_orig_node_release()
844 spin_lock_bh(&orig_node->vlan_list_lock); in batadv_orig_node_release()
845 hlist_for_each_entry_safe(vlan, node_tmp, &orig_node->vlan_list, list) { in batadv_orig_node_release()
846 hlist_del_rcu(&vlan->list); in batadv_orig_node_release()
849 spin_unlock_bh(&orig_node->vlan_list_lock); in batadv_orig_node_release()
852 batadv_nc_purge_orig(orig_node->bat_priv, orig_node, NULL); in batadv_orig_node_release()
854 call_rcu(&orig_node->rcu, batadv_orig_node_free_rcu); in batadv_orig_node_release()
858 * batadv_originator_free() - Free all originator structures
859 * @bat_priv: the bat priv with all the soft interface information
863 struct batadv_hashtable *hash = bat_priv->orig_hash; in batadv_originator_free()
873 cancel_delayed_work_sync(&bat_priv->orig_work); in batadv_originator_free()
875 bat_priv->orig_hash = NULL; in batadv_originator_free()
877 for (i = 0; i < hash->size; i++) { in batadv_originator_free()
878 head = &hash->table[i]; in batadv_originator_free()
879 list_lock = &hash->list_locks[i]; in batadv_originator_free()
884 hlist_del_rcu(&orig_node->hash_entry); in batadv_originator_free()
894 * batadv_orig_node_new() - creates a new orig_node
895 * @bat_priv: the bat priv with all the soft interface information
918 INIT_HLIST_HEAD(&orig_node->neigh_list); in batadv_orig_node_new()
919 INIT_HLIST_HEAD(&orig_node->vlan_list); in batadv_orig_node_new()
920 INIT_HLIST_HEAD(&orig_node->ifinfo_list); in batadv_orig_node_new()
921 spin_lock_init(&orig_node->bcast_seqno_lock); in batadv_orig_node_new()
922 spin_lock_init(&orig_node->neigh_list_lock); in batadv_orig_node_new()
923 spin_lock_init(&orig_node->tt_buff_lock); in batadv_orig_node_new()
924 spin_lock_init(&orig_node->tt_lock); in batadv_orig_node_new()
925 spin_lock_init(&orig_node->vlan_list_lock); in batadv_orig_node_new()
930 kref_init(&orig_node->refcount); in batadv_orig_node_new()
932 orig_node->bat_priv = bat_priv; in batadv_orig_node_new()
933 ether_addr_copy(orig_node->orig, addr); in batadv_orig_node_new()
935 atomic_set(&orig_node->last_ttvn, 0); in batadv_orig_node_new()
936 orig_node->tt_buff = NULL; in batadv_orig_node_new()
937 orig_node->tt_buff_len = 0; in batadv_orig_node_new()
938 orig_node->last_seen = jiffies; in batadv_orig_node_new()
939 reset_time = jiffies - 1 - msecs_to_jiffies(BATADV_RESET_PROTECTION_MS); in batadv_orig_node_new()
940 orig_node->bcast_seqno_reset = reset_time; in batadv_orig_node_new()
943 orig_node->mcast_flags = BATADV_MCAST_WANT_NO_RTR4; in batadv_orig_node_new()
944 orig_node->mcast_flags |= BATADV_MCAST_WANT_NO_RTR6; in batadv_orig_node_new()
945 INIT_HLIST_NODE(&orig_node->mcast_want_all_unsnoopables_node); in batadv_orig_node_new()
946 INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv4_node); in batadv_orig_node_new()
947 INIT_HLIST_NODE(&orig_node->mcast_want_all_ipv6_node); in batadv_orig_node_new()
948 spin_lock_init(&orig_node->mcast_handler_lock); in batadv_orig_node_new()
962 INIT_HLIST_HEAD(&orig_node->fragments[i].fragment_list); in batadv_orig_node_new()
963 spin_lock_init(&orig_node->fragments[i].lock); in batadv_orig_node_new()
964 orig_node->fragments[i].size = 0; in batadv_orig_node_new()
974 * batadv_purge_neigh_ifinfo() - purge obsolete ifinfo entries from neighbor
975 * @bat_priv: the bat priv with all the soft interface information
976 * @neigh: orig node which is to be checked
986 spin_lock_bh(&neigh->ifinfo_lock); in batadv_purge_neigh_ifinfo()
990 &neigh->ifinfo_list, list) { in batadv_purge_neigh_ifinfo()
991 if_outgoing = neigh_ifinfo->if_outgoing; in batadv_purge_neigh_ifinfo()
993 /* always keep the default interface */ in batadv_purge_neigh_ifinfo()
997 /* don't purge if the interface is not (going) down */ in batadv_purge_neigh_ifinfo()
998 if (if_outgoing->if_status != BATADV_IF_INACTIVE && in batadv_purge_neigh_ifinfo()
999 if_outgoing->if_status != BATADV_IF_NOT_IN_USE && in batadv_purge_neigh_ifinfo()
1000 if_outgoing->if_status != BATADV_IF_TO_BE_REMOVED) in batadv_purge_neigh_ifinfo()
1005 neigh->addr, if_outgoing->net_dev->name); in batadv_purge_neigh_ifinfo()
1007 hlist_del_rcu(&neigh_ifinfo->list); in batadv_purge_neigh_ifinfo()
1011 spin_unlock_bh(&neigh->ifinfo_lock); in batadv_purge_neigh_ifinfo()
1015 * batadv_purge_orig_ifinfo() - purge obsolete ifinfo entries from originator
1016 * @bat_priv: the bat priv with all the soft interface information
1017 * @orig_node: orig node which is to be checked
1030 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_purge_orig_ifinfo()
1034 &orig_node->ifinfo_list, list) { in batadv_purge_orig_ifinfo()
1035 if_outgoing = orig_ifinfo->if_outgoing; in batadv_purge_orig_ifinfo()
1037 /* always keep the default interface */ in batadv_purge_orig_ifinfo()
1041 /* don't purge if the interface is not (going) down */ in batadv_purge_orig_ifinfo()
1042 if (if_outgoing->if_status != BATADV_IF_INACTIVE && in batadv_purge_orig_ifinfo()
1043 if_outgoing->if_status != BATADV_IF_NOT_IN_USE && in batadv_purge_orig_ifinfo()
1044 if_outgoing->if_status != BATADV_IF_TO_BE_REMOVED) in batadv_purge_orig_ifinfo()
1049 orig_node->orig, if_outgoing->net_dev->name); in batadv_purge_orig_ifinfo()
1053 hlist_del_rcu(&orig_ifinfo->list); in batadv_purge_orig_ifinfo()
1055 if (orig_node->last_bonding_candidate == orig_ifinfo) { in batadv_purge_orig_ifinfo()
1056 orig_node->last_bonding_candidate = NULL; in batadv_purge_orig_ifinfo()
1061 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_purge_orig_ifinfo()
1067 * batadv_purge_orig_neighbors() - purges neighbors from originator
1068 * @bat_priv: the bat priv with all the soft interface information
1069 * @orig_node: orig node which is to be checked
1083 spin_lock_bh(&orig_node->neigh_list_lock); in batadv_purge_orig_neighbors()
1087 &orig_node->neigh_list, list) { in batadv_purge_orig_neighbors()
1088 last_seen = neigh_node->last_seen; in batadv_purge_orig_neighbors()
1089 if_incoming = neigh_node->if_incoming; in batadv_purge_orig_neighbors()
1092 if_incoming->if_status == BATADV_IF_INACTIVE || in batadv_purge_orig_neighbors()
1093 if_incoming->if_status == BATADV_IF_NOT_IN_USE || in batadv_purge_orig_neighbors()
1094 if_incoming->if_status == BATADV_IF_TO_BE_REMOVED) { in batadv_purge_orig_neighbors()
1095 if (if_incoming->if_status == BATADV_IF_INACTIVE || in batadv_purge_orig_neighbors()
1096 if_incoming->if_status == BATADV_IF_NOT_IN_USE || in batadv_purge_orig_neighbors()
1097 if_incoming->if_status == BATADV_IF_TO_BE_REMOVED) in batadv_purge_orig_neighbors()
1100 orig_node->orig, neigh_node->addr, in batadv_purge_orig_neighbors()
1101 if_incoming->net_dev->name); in batadv_purge_orig_neighbors()
1105 orig_node->orig, neigh_node->addr, in batadv_purge_orig_neighbors()
1110 hlist_del_rcu(&neigh_node->list); in batadv_purge_orig_neighbors()
1114 * deleted, but some interface has been removed. in batadv_purge_orig_neighbors()
1120 spin_unlock_bh(&orig_node->neigh_list_lock); in batadv_purge_orig_neighbors()
1125 * batadv_find_best_neighbor() - finds the best neighbor after purging
1126 * @bat_priv: the bat priv with all the soft interface information
1127 * @orig_node: orig node which is to be checked
1128 * @if_outgoing: the interface for which the metric should be compared
1138 struct batadv_algo_ops *bao = bat_priv->algo_ops; in batadv_find_best_neighbor()
1141 hlist_for_each_entry_rcu(neigh, &orig_node->neigh_list, list) { in batadv_find_best_neighbor()
1142 if (best && (bao->neigh.cmp(neigh, if_outgoing, best, in batadv_find_best_neighbor()
1146 if (!kref_get_unless_zero(&neigh->refcount)) in batadv_find_best_neighbor()
1159 * batadv_purge_orig_node() - purges obsolete information from an orig_node
1160 * @bat_priv: the bat priv with all the soft interface information
1161 * @orig_node: orig node which is to be checked
1175 if (batadv_has_timed_out(orig_node->last_seen, in batadv_purge_orig_node()
1179 orig_node->orig, in batadv_purge_orig_node()
1180 jiffies_to_msecs(orig_node->last_seen)); in batadv_purge_orig_node()
1199 if (hard_iface->if_status != BATADV_IF_ACTIVE) in batadv_purge_orig_node()
1202 if (hard_iface->soft_iface != bat_priv->soft_iface) in batadv_purge_orig_node()
1205 if (!kref_get_unless_zero(&hard_iface->refcount)) in batadv_purge_orig_node()
1223 * batadv_purge_orig_ref() - Purge all outdated originators
1224 * @bat_priv: the bat priv with all the soft interface information
1228 struct batadv_hashtable *hash = bat_priv->orig_hash; in batadv_purge_orig_ref()
1239 for (i = 0; i < hash->size; i++) { in batadv_purge_orig_ref()
1240 head = &hash->table[i]; in batadv_purge_orig_ref()
1241 list_lock = &hash->list_locks[i]; in batadv_purge_orig_ref()
1248 hlist_del_rcu(&orig_node->hash_entry); in batadv_purge_orig_ref()
1249 batadv_tt_global_del_orig(orig_node->bat_priv, in batadv_purge_orig_ref()
1250 orig_node, -1, in batadv_purge_orig_ref()
1274 &bat_priv->orig_work, in batadv_purge_orig()
1279 * batadv_orig_dump() - Dump to netlink the originator infos for a specific
1280 * outgoing interface
1288 struct net *net = sock_net(cb->skb->sk); in batadv_orig_dump()
1297 ifindex = batadv_netlink_get_ifindex(cb->nlh, BATADV_ATTR_MESH_IFINDEX); in batadv_orig_dump()
1299 return -EINVAL; in batadv_orig_dump()
1303 ret = -ENODEV; in batadv_orig_dump()
1310 if (!primary_if || primary_if->if_status != BATADV_IF_ACTIVE) { in batadv_orig_dump()
1311 ret = -ENOENT; in batadv_orig_dump()
1315 hard_ifindex = batadv_netlink_get_ifindex(cb->nlh, in batadv_orig_dump()
1323 ret = -ENODEV; in batadv_orig_dump()
1327 if (hardif->soft_iface != soft_iface) { in batadv_orig_dump()
1328 ret = -ENOENT; in batadv_orig_dump()
1333 if (!bat_priv->algo_ops->orig.dump) { in batadv_orig_dump()
1334 ret = -EOPNOTSUPP; in batadv_orig_dump()
1338 bat_priv->algo_ops->orig.dump(msg, cb, bat_priv, hardif); in batadv_orig_dump()
1340 ret = msg->len; in batadv_orig_dump()