Lines Matching defs:nc_node
197 * batadv_nc_node_release() - release nc_node from lists and queue for free
199 * @ref: kref pointer of the nc_node
203 struct batadv_nc_node *nc_node;
205 nc_node = container_of(ref, struct batadv_nc_node, refcount);
207 batadv_orig_node_put(nc_node->orig_node);
208 kfree_rcu(nc_node, rcu);
212 * batadv_nc_node_put() - decrement the nc_node refcounter and possibly
214 * @nc_node: nc_node to be free'd
216 static void batadv_nc_node_put(struct batadv_nc_node *nc_node)
218 if (!nc_node)
221 kref_put(&nc_node->refcount, batadv_nc_node_release);
271 * @nc_node: the nc node to check
276 struct batadv_nc_node *nc_node)
281 return batadv_has_timed_out(nc_node->last_seen, BATADV_NC_NODE_TIMEOUT);
343 struct batadv_nc_node *nc_node, *nc_node_tmp;
345 /* For each nc_node in list */
347 list_for_each_entry_safe(nc_node, nc_node_tmp, list, list) {
351 if (to_purge && !to_purge(bat_priv, nc_node))
355 "Removing nc_node %pM -> %pM\n",
356 nc_node->addr, nc_node->orig_node->orig);
357 list_del_rcu(&nc_node->list);
358 batadv_nc_node_put(nc_node);
378 /* Check ingoing nc_node's of this orig_node */
383 /* Check outgoing nc_node's of this orig_node */
792 * Return: the nc_node if found, NULL otherwise.
799 struct batadv_nc_node *nc_node, *nc_node_out = NULL;
809 list_for_each_entry_rcu(nc_node, list, list) {
810 if (!batadv_compare_eth(nc_node->addr, orig_node->orig))
813 if (!kref_get_unless_zero(&nc_node->refcount))
817 nc_node_out = nc_node;
834 * Return: the nc_node if found or created, NULL in case of an error.
842 struct batadv_nc_node *nc_node;
857 /* Check if nc_node is already added */
858 nc_node = batadv_nc_find_nc_node(orig_node, orig_neigh_node, in_coding);
861 if (nc_node)
864 nc_node = kzalloc(sizeof(*nc_node), GFP_ATOMIC);
865 if (!nc_node)
868 /* Initialize nc_node */
869 INIT_LIST_HEAD(&nc_node->list);
870 kref_init(&nc_node->refcount);
871 ether_addr_copy(nc_node->addr, orig_node->orig);
873 nc_node->orig_node = orig_neigh_node;
875 batadv_dbg(BATADV_DBG_NC, bat_priv, "Adding nc_node %pM -> %pM\n",
876 nc_node->addr, nc_node->orig_node->orig);
878 /* Add nc_node to orig_node */
879 kref_get(&nc_node->refcount);
880 list_add_tail_rcu(&nc_node->list, list);
885 return nc_node;
1414 struct batadv_nc_node *nc_node;
1418 list_for_each_entry_rcu(nc_node, &orig_node->in_coding_list, list) {
1422 ethhdr->h_source, nc_node);