Lines Matching refs:nc_path

231 	struct batadv_nc_path *nc_path;  in batadv_nc_path_release()  local
233 nc_path = container_of(ref, struct batadv_nc_path, refcount); in batadv_nc_path_release()
235 kfree_rcu(nc_path, rcu); in batadv_nc_path_release()
243 static void batadv_nc_path_put(struct batadv_nc_path *nc_path) in batadv_nc_path_put() argument
245 if (!nc_path) in batadv_nc_path_put()
248 kref_put(&nc_path->refcount, batadv_nc_path_release); in batadv_nc_path_put()
264 batadv_nc_path_put(nc_packet->nc_path); in batadv_nc_packet_free()
292 struct batadv_nc_path *nc_path) in batadv_nc_to_purge_nc_path_coding() argument
300 return batadv_has_timed_out(nc_path->last_valid, in batadv_nc_to_purge_nc_path_coding()
313 struct batadv_nc_path *nc_path) in batadv_nc_to_purge_nc_path_decoding() argument
321 return batadv_has_timed_out(nc_path->last_valid, in batadv_nc_to_purge_nc_path_decoding()
433 struct batadv_nc_path *nc_path; in batadv_nc_purge_paths() local
443 hlist_for_each_entry_safe(nc_path, node_tmp, head, hash_entry) { in batadv_nc_purge_paths()
447 if (to_purge && !to_purge(bat_priv, nc_path)) in batadv_nc_purge_paths()
455 if (!unlikely(list_empty(&nc_path->packet_list))) { in batadv_nc_purge_paths()
459 nc_path->prev_hop, in batadv_nc_purge_paths()
460 nc_path->next_hop); in batadv_nc_purge_paths()
467 nc_path->prev_hop, nc_path->next_hop); in batadv_nc_purge_paths()
468 hlist_del_rcu(&nc_path->hash_entry); in batadv_nc_purge_paths()
469 batadv_nc_path_put(nc_path); in batadv_nc_purge_paths()
497 const struct batadv_nc_path *nc_path = data; in batadv_nc_hash_choose() local
500 hash = jhash(&nc_path->prev_hop, sizeof(nc_path->prev_hop), hash); in batadv_nc_hash_choose()
501 hash = jhash(&nc_path->next_hop, sizeof(nc_path->next_hop), hash); in batadv_nc_hash_choose()
544 struct batadv_nc_path *nc_path, *nc_path_tmp = NULL; in batadv_nc_hash_find() local
554 hlist_for_each_entry_rcu(nc_path, head, hash_entry) { in batadv_nc_hash_find()
555 if (!batadv_nc_hash_compare(&nc_path->hash_entry, data)) in batadv_nc_hash_find()
558 if (!kref_get_unless_zero(&nc_path->refcount)) in batadv_nc_hash_find()
561 nc_path_tmp = nc_path; in batadv_nc_hash_find()
594 struct batadv_nc_path *nc_path, in batadv_nc_sniffed_purge() argument
600 lockdep_assert_held(&nc_path->packet_list_lock); in batadv_nc_sniffed_purge()
633 struct batadv_nc_path *nc_path, in batadv_nc_fwd_flush() argument
638 lockdep_assert_held(&nc_path->packet_list_lock); in batadv_nc_fwd_flush()
675 struct batadv_nc_path *nc_path; in batadv_nc_process_nc_paths() local
688 hlist_for_each_entry_rcu(nc_path, head, hash_entry) { in batadv_nc_process_nc_paths()
690 spin_lock_bh(&nc_path->packet_list_lock); in batadv_nc_process_nc_paths()
692 &nc_path->packet_list, list) { in batadv_nc_process_nc_paths()
693 ret = process_fn(bat_priv, nc_path, nc_packet); in batadv_nc_process_nc_paths()
697 spin_unlock_bh(&nc_path->packet_list_lock); in batadv_nc_process_nc_paths()
957 struct batadv_nc_path *nc_path, nc_path_key; in batadv_nc_get_path() local
962 nc_path = batadv_nc_hash_find(hash, (void *)&nc_path_key); in batadv_nc_get_path()
964 if (nc_path) { in batadv_nc_get_path()
966 nc_path->last_valid = jiffies; in batadv_nc_get_path()
967 return nc_path; in batadv_nc_get_path()
971 nc_path = kzalloc(sizeof(*nc_path), GFP_ATOMIC); in batadv_nc_get_path()
973 if (!nc_path) in batadv_nc_get_path()
977 INIT_LIST_HEAD(&nc_path->packet_list); in batadv_nc_get_path()
978 spin_lock_init(&nc_path->packet_list_lock); in batadv_nc_get_path()
979 kref_init(&nc_path->refcount); in batadv_nc_get_path()
980 nc_path->last_valid = jiffies; in batadv_nc_get_path()
981 ether_addr_copy(nc_path->next_hop, dst); in batadv_nc_get_path()
982 ether_addr_copy(nc_path->prev_hop, src); in batadv_nc_get_path()
985 nc_path->prev_hop, in batadv_nc_get_path()
986 nc_path->next_hop); in batadv_nc_get_path()
989 kref_get(&nc_path->refcount); in batadv_nc_get_path()
992 &nc_path->hash_entry); in batadv_nc_get_path()
995 kfree(nc_path); in batadv_nc_get_path()
999 return nc_path; in batadv_nc_get_path()
1102 first_source = nc_packet->nc_path->prev_hop; in batadv_nc_code_packets()
1115 second_source = nc_packet->nc_path->prev_hop; in batadv_nc_code_packets()
1263 struct batadv_nc_path *nc_path, nc_path_key; in batadv_nc_path_search() local
1279 hlist_for_each_entry_rcu(nc_path, &hash->table[idx], hash_entry) { in batadv_nc_path_search()
1280 if (!batadv_compare_eth(nc_path->prev_hop, in_nc_node->addr)) in batadv_nc_path_search()
1283 if (!batadv_compare_eth(nc_path->next_hop, out_nc_node->addr)) in batadv_nc_path_search()
1286 spin_lock_bh(&nc_path->packet_list_lock); in batadv_nc_path_search()
1287 if (list_empty(&nc_path->packet_list)) { in batadv_nc_path_search()
1288 spin_unlock_bh(&nc_path->packet_list_lock); in batadv_nc_path_search()
1293 &nc_path->packet_list, list) { in batadv_nc_path_search()
1305 spin_unlock_bh(&nc_path->packet_list_lock); in batadv_nc_path_search()
1462 struct batadv_nc_path *nc_path, in batadv_nc_skb_add_to_path() argument
1477 nc_packet->nc_path = nc_path; in batadv_nc_skb_add_to_path()
1480 spin_lock_bh(&nc_path->packet_list_lock); in batadv_nc_skb_add_to_path()
1481 list_add_tail(&nc_packet->list, &nc_path->packet_list); in batadv_nc_skb_add_to_path()
1482 spin_unlock_bh(&nc_path->packet_list_lock); in batadv_nc_skb_add_to_path()
1501 struct batadv_nc_path *nc_path; in batadv_nc_skb_forward() local
1521 nc_path = batadv_nc_get_path(bat_priv, in batadv_nc_skb_forward()
1526 if (!nc_path) in batadv_nc_skb_forward()
1531 if (!batadv_nc_skb_add_to_path(skb, nc_path, neigh_node, packet_id)) in batadv_nc_skb_forward()
1538 batadv_nc_path_put(nc_path); in batadv_nc_skb_forward()
1554 struct batadv_nc_path *nc_path; in batadv_nc_skb_store_for_decoding() local
1570 nc_path = batadv_nc_get_path(bat_priv, in batadv_nc_skb_store_for_decoding()
1575 if (!nc_path) in batadv_nc_skb_store_for_decoding()
1591 if (!batadv_nc_skb_add_to_path(skb, nc_path, NULL, packet_id)) in batadv_nc_skb_store_for_decoding()
1600 batadv_nc_path_put(nc_path); in batadv_nc_skb_store_for_decoding()
1735 struct batadv_nc_path *nc_path, nc_path_key; in batadv_nc_find_decoding_packet() local
1758 hlist_for_each_entry_rcu(nc_path, &hash->table[index], hash_entry) { in batadv_nc_find_decoding_packet()
1760 spin_lock_bh(&nc_path->packet_list_lock); in batadv_nc_find_decoding_packet()
1762 &nc_path->packet_list, list) { in batadv_nc_find_decoding_packet()
1770 spin_unlock_bh(&nc_path->packet_list_lock); in batadv_nc_find_decoding_packet()