From: Marek Lindner <lindner_marek@yahoo.de>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Antonio Quartulli <ordex@autistici.org>,
Marek Lindner <lindner_marek@yahoo.de>
Subject: [PATCH 3/6] batman-adv: pass a unique flag arg instead of a sequence of bool ones
Date: Tue, 5 Jul 2011 15:43:57 +0200 [thread overview]
Message-ID: <1309873440-11704-4-git-send-email-lindner_marek@yahoo.de> (raw)
In-Reply-To: <1309873440-11704-1-git-send-email-lindner_marek@yahoo.de>
From: Antonio Quartulli <ordex@autistici.org>
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: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
net/batman-adv/translation-table.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 4208dc7..06d361d 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -143,8 +143,8 @@ static void tt_global_entry_free_ref(struct tt_global_entry *tt_global_entry)
kfree_rcu(tt_global_entry, rcu);
}
-static void tt_local_event(struct bat_priv *bat_priv, uint8_t op,
- const uint8_t *addr, bool roaming)
+static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
+ uint8_t flags)
{
struct tt_change_node *tt_change_node;
@@ -153,10 +153,7 @@ static void tt_local_event(struct bat_priv *bat_priv, uint8_t op,
if (!tt_change_node)
return;
- tt_change_node->change.flags = op;
- if (roaming)
- tt_change_node->change.flags |= TT_CLIENT_ROAM;
-
+ tt_change_node->change.flags = flags;
memcpy(tt_change_node->change.addr, addr, ETH_ALEN);
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)
if (!tt_local_entry)
goto out;
- tt_local_event(bat_priv, NO_FLAGS, addr, false);
-
bat_dbg(DBG_TT, bat_priv,
"Creating new local tt entry: %pM (ttvn: %d)\n", addr,
(uint8_t)atomic_read(&bat_priv->ttvn));
@@ -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))
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,
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,
if (!tt_local_entry)
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);
out:
if (tt_local_entry)
@@ -416,8 +415,8 @@ static void tt_local_purge(struct bat_priv *bat_priv)
TT_LOCAL_TIMEOUT * 1000))
continue;
- tt_local_event(bat_priv, TT_CLIENT_DEL,
- tt_local_entry->addr, false);
+ tt_local_event(bat_priv, tt_local_entry->addr,
+ tt_local_entry->flags | TT_CLIENT_DEL);
atomic_dec(&bat_priv->num_local_tt);
bat_dbg(DBG_TT, bat_priv, "Deleting local "
"tt entry (%pM): timed out\n",
--
1.7.5.3
next prev parent reply other threads:[~2011-07-05 13:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-05 13:43 pull request: batman-adv 2011-07-05 Marek Lindner
[not found] ` <1309873440-11704-1-git-send-email-lindner_marek-LWAfsSFWpa4@public.gmane.org>
2011-07-05 13:43 ` [PATCH 1/6] batman-adv: unify flags for tt_change/tt_local_entry/tt_global_entry Marek Lindner
2011-07-05 13:43 ` [PATCH 2/6] batman-adv: add_bcast_packet_to_list() takes the sending delay as parameter Marek Lindner
2011-07-06 2:46 ` pull request: batman-adv 2011-07-05 David Miller
2011-07-05 13:43 ` Marek Lindner [this message]
2011-07-05 13:43 ` [PATCH 4/6] batman-adv: broadcast primary OGM on all active hard-interfaces Marek Lindner
2011-07-05 13:43 ` [PATCH 5/6] batman-adv: aggregation checks should use the primary_if pointer Marek Lindner
2011-07-05 13:44 ` [PATCH 6/6] batman-adv: Replace version info instead of appending them Marek Lindner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1309873440-11704-4-git-send-email-lindner_marek@yahoo.de \
--to=lindner_marek@yahoo.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ordex@autistici.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).