From: "Martin Hundebøll" <martin@hundeboll.net>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: clear ADD+DEL (and viceversa) events in the same orig-interval
Date: Wed, 18 Apr 2012 10:33:34 +0200 [thread overview]
Message-ID: <4F8E7C5E.9010301@hundeboll.net> (raw)
In-Reply-To: <1334701645-25862-3-git-send-email-ordex@autistici.org>
Hi Antonio,
On 04/18/2012 12:27 AM, Antonio Quartulli wrote:
> During an OGM-interval (time between two different OGM sendings) the same client
> could roam away and then roam back to us. In this case the node would add two
> events to the events list (that is going to be sent appended to the next OGM). A
> DEL one and an ADD one. Obviously they will only increase the overhead (either in
> the air and on the receiver side) and eventually trigger wrong states/events
> without producing any real effect.
>
> For this reason we can safely delete any ADD event with its related DEL one.
>
> Signed-off-by: Antonio Quartulli<ordex@autistici.org>
> ---
> translation-table.c | 35 ++++++++++++++++++++++++++++++-----
> 1 file changed, 30 insertions(+), 5 deletions(-)
>
> diff --git a/translation-table.c b/translation-table.c
> index 88e4c8e..e02fa90 100644
> --- a/translation-table.c
> +++ b/translation-table.c
> @@ -154,23 +154,48 @@ static void tt_orig_list_entry_free_ref(struct tt_orig_list_entry *orig_entry)
> static void tt_local_event(struct bat_priv *bat_priv, const uint8_t *addr,
> uint8_t flags)
> {
> - struct tt_change_node *tt_change_node;
> + struct tt_change_node *tt_change_node, *entry, *safe;
> + bool event_removed = false;
>
> tt_change_node = kmalloc(sizeof(*tt_change_node), GFP_ATOMIC);
> -
> if (!tt_change_node)
> return;
> -
> tt_change_node->change.flags = flags;
> memcpy(tt_change_node->change.addr, addr, ETH_ALEN);
>
> + /* check for ADD+DEL or DEL+ADD events */
> spin_lock_bh(&bat_priv->tt_changes_list_lock);
> + list_for_each_entry_safe(entry, safe,&bat_priv->tt_changes_list,
> + list) {
> + if (!compare_eth(entry->change.addr, addr))
> + continue;
Please add an empty line here.
> + if (!(!(flags& TT_CLIENT_DEL)&& /* ADD op */
> + entry->change.flags& TT_CLIENT_DEL)&&
> + !(flags& TT_CLIENT_DEL&&
> + !(entry->change.flags& TT_CLIENT_DEL))) /* ADD op */
> + continue;
This is messy and hard to unerstand. Couldn't you use some tmp vars like this:
int local_del = (flags & TT_CLIENT_DEL) == TT_CLIENT_DEL;
int change_del = (entry->change.flags & TT_CLIENT_DEL) == TT_CLIENT_DEL;
if (local_del == change_del)
continue;
I'm not 100% sure I understood the original if correctly, but that just proofs the need to rework it :)
> + /* DEL+ADD in the same orig interval have no effect and can be
> + * removed to avoid silly behaviour on the receiver side. The
> + * other way around (ADD+DEL) can happen in case of roaming of
> + * a client still in the NEW state. Roaming of NEW clients is
> + * now possible due to automatically recognition of "temporary"
> + * clients */
Remember newline for */ :)
--
Kind Regards
Martin Hundebøll
Frederiks Allé 99A, 1.th
8000 Aarhus C
Denmark
+45 61 65 54 61
martin@hundeboll.net
next prev parent reply other threads:[~2012-04-18 8:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-17 22:27 [B.A.T.M.A.N.] [PATCH 0/5] Preparation for SPEEDY_JOIN/ROAM Antonio Quartulli
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 1/5] batman-adv: don't delay OGM information announcement Antonio Quartulli
2012-04-18 8:12 ` Martin Hundebøll
2012-04-18 8:31 ` Antonio Quartulli
2012-04-18 8:35 ` Martin Hundebøll
2012-04-18 8:37 ` Antonio Quartulli
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: clear ADD+DEL (and viceversa) events in the same orig-interval Antonio Quartulli
2012-04-18 8:33 ` Martin Hundebøll [this message]
2012-04-18 8:37 ` Antonio Quartulli
2012-04-18 8:40 ` Martin Hundebøll
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: let tt_global_entry_has_orig() return the orig_entry or NULL instead of 1 or 0 only Antonio Quartulli
2012-04-18 8:44 ` Martin Hundebøll
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: update ttvn in case of client reannouncement Antonio Quartulli
2012-04-18 8:46 ` Martin Hundebøll
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 5/5] batman-adv: beautify tt_global_add() argument list Antonio Quartulli
2012-04-18 8:52 ` Martin Hundebøll
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=4F8E7C5E.9010301@hundeboll.net \
--to=martin@hundeboll.net \
--cc=b.a.t.m.a.n@lists.open-mesh.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.