Commit ff66c975 authored by Antonio Quartulli's avatar Antonio Quartulli Committed by Marek Lindner

batman-adv: pass a unique flag arg instead of a sequence of bool ones

now tt_local_event() takes a flags argument instead of a sequence of
boolean values which would grow up with the time.
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
parent 8698529d
...@@ -143,8 +143,8 @@ static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry) ...@@ -143,8 +143,8 @@ static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
kfree_rcu(tt_global_entry, rcu); kfree_rcu(tt_global_entry, rcu);
} }
static void tt_local_event(struct bat_priv *bat_priv, uint8_t op, static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
const uint8_t *addr, bool roaming) uint8_t flags)
{ {
struct tt_change_node *tt_change_node; struct tt_change_node *tt_change_node;
...@@ -153,10 +153,7 @@ static void tt_local_event(struct bat_priv *bat_priv, uint8_t op, ...@@ -153,10 +153,7 @@ static void tt_local_event(struct bat_priv *bat_priv, uint8_t op,
if (!tt_change_node) if (!tt_change_node)
return; return;
tt_change_node->change.flags = op; tt_change_node->change.flags = flags;
if (roaming)
tt_change_node->change.flags |= TT_CLIENT_ROAM;
memcpy(tt_change_node->change.addr, addr, ETH_ALEN); memcpy(tt_change_node->change.addr, addr, ETH_ALEN);
spin_lock_bh(&bat_priv->tt_changes_list_lock); spin_lock_bh(&bat_priv->tt_changes_list_lock);
...@@ -203,8 +200,6 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) ...@@ -203,8 +200,6 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr)
if (!tt_local_entry) if (!tt_local_entry)
goto out; goto out;
tt_local_event(bat_priv, NO_FLAGS, addr, false);
bat_dbg(DBG_TT, bat_priv, bat_dbg(DBG_TT, bat_priv,
"Creating new local tt entry: %pM (ttvn: %d)\n", addr, "Creating new local tt entry: %pM (ttvn: %d)\n", addr,
(uint8_t)atomic_read(&bat_priv->ttvn)); (uint8_t)atomic_read(&bat_priv->ttvn));
...@@ -218,6 +213,8 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) ...@@ -218,6 +213,8 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr)
if (compare_eth(addr, soft_iface->dev_addr)) if (compare_eth(addr, soft_iface->dev_addr))
tt_local_entry->flags |= TT_CLIENT_NOPURGE; tt_local_entry->flags |= TT_CLIENT_NOPURGE;
tt_local_event(bat_priv, addr, tt_local_entry->flags);
hash_add(bat_priv->tt_local_hash, compare_ltt, choose_orig, hash_add(bat_priv->tt_local_hash, compare_ltt, choose_orig,
tt_local_entry, &tt_local_entry->hash_entry); tt_local_entry, &tt_local_entry->hash_entry);
...@@ -386,7 +383,9 @@ void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr, ...@@ -386,7 +383,9 @@ void tt_local_remove(struct bat_priv *bat_priv, const uint8_t *addr,
if (!tt_local_entry) if (!tt_local_entry)
goto out; goto out;
tt_local_event(bat_priv, TT_CLIENT_DEL, tt_local_entry->addr, roaming); tt_local_event(bat_priv, tt_local_entry->addr,
tt_local_entry->flags | TT_CLIENT_DEL |
(roaming ? TT_CLIENT_ROAM : NO_FLAGS));
tt_local_del(bat_priv, tt_local_entry, message); tt_local_del(bat_priv, tt_local_entry, message);
out: out:
if (tt_local_entry) if (tt_local_entry)
...@@ -416,8 +415,8 @@ static void tt_local_purge(struct bat_priv *bat_priv) ...@@ -416,8 +415,8 @@ static void tt_local_purge(struct bat_priv *bat_priv)
TT_LOCAL_TIMEOUT * 1000)) TT_LOCAL_TIMEOUT * 1000))
continue; continue;
tt_local_event(bat_priv, TT_CLIENT_DEL, tt_local_event(bat_priv, tt_local_entry->addr,
tt_local_entry->addr, false); tt_local_entry->flags | TT_CLIENT_DEL);
atomic_dec(&bat_priv->num_local_tt); atomic_dec(&bat_priv->num_local_tt);
bat_dbg(DBG_TT, bat_priv, "Deleting local " bat_dbg(DBG_TT, bat_priv, "Deleting local "
"tt entry (%pM): timed out\n", "tt entry (%pM): timed out\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment