59 batadv_start_purge_timer(bat_priv);
95 neigh_node = kzalloc(
sizeof(*neigh_node),
GFP_ATOMIC);
99 INIT_HLIST_NODE(&neigh_node->
list);
108 "Creating new neighbor %pM, initial seqno %d\n",
115 static void batadv_orig_node_free_rcu(
struct rcu_head *
rcu)
135 hlist_del_rcu(&neigh_node->
list);
143 "originator timed out");
154 call_rcu(&orig_node->
rcu, batadv_orig_node_free_rcu);
173 for (i = 0; i < hash->
size; i++) {
177 spin_lock_bh(list_lock);
184 spin_unlock_bh(list_lock);
199 unsigned long reset_time;
201 orig_node = batadv_orig_hash_find(bat_priv, addr);
206 "Creating new originator: %pM\n", addr);
208 orig_node = kzalloc(
sizeof(*orig_node),
GFP_ATOMIC);
253 hash_added = batadv_hash_add(bat_priv->
orig_hash, batadv_compare_orig,
254 batadv_choose_orig, orig_node,
257 goto free_bcast_own_sum;
270 batadv_purge_orig_neighbors(
struct batadv_priv *bat_priv,
276 bool neigh_purged =
false;
280 *best_neigh_node =
NULL;
300 "neighbor purge: originator %pM, neighbor: %pM, iface: %s\n",
305 "neighbor timeout: originator %pM, neighbor: %pM, last_seen: %u\n",
311 hlist_del_rcu(&neigh_node->
list);
315 if ((!*best_neigh_node) ||
316 (neigh_node->
tq_avg > (*best_neigh_node)->tq_avg))
317 *best_neigh_node = neigh_node;
325 static bool batadv_purge_orig_node(
struct batadv_priv *bat_priv,
330 if (batadv_has_timed_out(orig_node->
last_seen,
333 "Originator timeout: originator %pM, last_seen %u\n",
338 if (batadv_purge_orig_neighbors(bat_priv, orig_node,
347 static void _batadv_purge_orig(
struct batadv_priv *bat_priv)
360 for (i = 0; i < hash->
size; i++) {
364 spin_lock_bh(list_lock);
367 if (batadv_purge_orig_node(bat_priv, orig_node)) {
380 spin_unlock_bh(list_lock);
392 delayed_work =
container_of(work,
struct delayed_work, work);
394 _batadv_purge_orig(bat_priv);
395 batadv_start_purge_timer(bat_priv);
400 _batadv_purge_orig(bat_priv);
406 struct batadv_priv *bat_priv = netdev_priv(net_dev);
413 int batman_count = 0;
416 unsigned long last_seen_jiffies;
420 primary_if = batadv_primary_if_get_selected(bat_priv);
424 "BATMAN mesh %s disabled - please specify interfaces to enable it\n",
431 "BATMAN mesh %s disabled - primary interface not active\n",
436 seq_printf(seq,
"[B.A.T.M.A.N. adv %s, MainIF/MAC: %s/%pM (%s)]\n",
439 seq_printf(seq,
" %-15s %s (%s/%i) %17s [%10s]: %20s ...\n",
441 "Nexthop",
"outgoingIF",
"Potential nexthops");
443 for (i = 0; i < hash->
size; i++) {
447 hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
452 if (neigh_node->
tq_avg == 0)
457 last_seen_secs = last_seen_msecs / 1000;
458 last_seen_msecs = last_seen_msecs % 1000;
460 seq_printf(seq,
"%pM %4i.%03is (%3i) %pM [%10s]:",
461 orig_node->
orig, last_seen_secs,
462 last_seen_msecs, neigh_node->
tq_avg,
466 hlist_for_each_entry_rcu(neigh_node_tmp, node_tmp,
469 neigh_node_tmp->
addr,
482 if (batman_count == 0)
483 seq_printf(seq,
"No batman nodes in range ...\n");
487 batadv_hardif_free_ref(primary_if);
512 (max_if_num - 1) *
sizeof(
uint8_t));
533 for (i = 0; i < hash->
size; i++) {
537 hlist_for_each_entry_rcu(orig_node, node, head,
hash_entry) {
539 ret = batadv_orig_node_add_if(orig_node, max_if_num);
556 int max_if_num,
int del_if_num)
558 void *data_ptr =
NULL;
574 memcpy((
char *)data_ptr + del_if_num * chunk_size,
575 orig_node->
bcast_own + ((del_if_num + 1) * chunk_size),
576 (max_if_num - del_if_num) * chunk_size);
594 (max_if_num - del_if_num) *
sizeof(
uint8_t));
618 for (i = 0; i < hash->
size; i++) {
622 hlist_for_each_entry_rcu(orig_node, node, head,
hash_entry) {
624 ret = batadv_orig_node_del_if(orig_node, max_if_num,
640 if (hard_iface == hard_iface_tmp)