From: Andrew Lunn <andrew@lunn.ch>
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.] [PATCHv2 3/4] batman-adv: improved roaming mechanism
Date: Wed, 4 May 2011 15:52:23 +0200 [thread overview]
Message-ID: <20110504135223.GB1528@lunn.ch> (raw)
In-Reply-To: <20110504133637.GB6519@ritirata.org>
On Wed, May 04, 2011 at 03:36:37PM +0200, Antonio Quartulli wrote:
> On Wed, May 04, 2011 at 01:22:34PM +0200, Andrew Lunn wrote:
> > > +struct roam_adv_packet {
> > > + uint8_t packet_type;
> > > + uint8_t version;
> > > + uint8_t dst[6];
> > > + uint8_t ttl;
> > > + uint8_t src[6];
> > > + uint8_t client[6];
> > > +} __packed;
> > > +
> >
> > Maybe put ttl at the end, to help with alignment?
>
> As I did for the tt_query packet, the initial four fields are the same as the
> unicast_packet so that I can exploit route_unicast_packet() instead of writing
> routing function.
>
> Is that a major issue?
No. It just that gcc might optimize accesses to src and client as a
word read + 1/2 word read, if they where 1/2 word aligned. With ttl
where it is, src and client are in strange alignments, so gcc will
have to do byte access. But this is not the fast path, so it does not
matter much.
> > > + tt_global_add(bat_priv, orig_node, roam_adv_packet->client,
> > > + atomic_read(&orig_node->last_ttvn) + 1, true);
> > > +
> > > + /* Roaming phase starts: I have a new information but the ttvn has been
> > > + * incremented yet. This flag will make me check all the incoming
> > > + * packets for the correct destination. */
> >
> > The grammar in that comment could be better:
> >
> > /* Roaming phase starts: I have new information but the ttvn has not
> > * been incremented yet. This flag will make me check all the incoming
> > * packets for the correct destination. */
> >
>
> Thanks and sorry for my poor grammar :)
Actually, it is mostly very good....
> Ok..I got the point. Maybe I will not be so drastic but I will follow
> your suggestion
Lots of small functions is my style. However, the Linux coding style
documentation says something similar:
Chapter 6: Functions
Functions should be short and sweet, and do just one thing. They should
fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24,
as we all know), and do one thing and do that well.
It is well worth reading Documentation/CodingStyle
Andrew
next prev parent reply other threads:[~2011-05-04 13:52 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-27 21:35 [B.A.T.M.A.N.] [PATCH] New translation table announcement mechanism patchset Antonio Quartulli
2011-04-27 21:35 ` [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: rename everything from *hna* into *tt* (translation table) Antonio Quartulli
2011-04-27 21:35 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: improved client announcement mechanism Antonio Quartulli
2011-04-28 16:10 ` Andrew Lunn
2011-04-28 16:14 ` Sven Eckelmann
2011-04-28 17:34 ` Marek Lindner
2011-04-28 17:45 ` Antonio Quartulli
2011-04-28 17:46 ` Gioacchino Mazzurco
2011-04-30 8:42 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: improved client announcement mechanismy Andrew Lunn
2011-04-30 16:00 ` Antonio Quartulli
2011-04-30 17:48 ` Andrew Lunn
2011-05-01 11:35 ` Antonio Quartulli
2011-05-01 13:10 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: improved client announcement mechanism Andrew Lunn
2011-05-03 15:50 ` [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: improved client announcement mechanismy Antonio Quartulli
2011-05-03 15:56 ` Marek Lindner
2011-05-03 17:07 ` Antonio Quartulli
2011-04-27 21:35 ` [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: improved roaming mechanism Antonio Quartulli
2011-04-27 21:35 ` [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: protect the local and the global trans-tables with rcu Antonio Quartulli
2011-05-03 15:54 ` [B.A.T.M.A.N.] New translation table announcement mechanism patchset v2 Antonio Quartulli
2011-05-03 15:54 ` [B.A.T.M.A.N.] [PATCHv2 1/4] batman-adv: rename everything from *hna* into *tt* (translation table) Antonio Quartulli
2011-05-05 6:42 ` [B.A.T.M.A.N.] [PATCHv3] " Antonio Quartulli
2011-05-07 17:46 ` Marek Lindner
2011-05-03 15:54 ` [B.A.T.M.A.N.] [PATCHv2 2/4] batman-adv: improved client announcement mechanism Antonio Quartulli
2011-05-03 15:54 ` [B.A.T.M.A.N.] [PATCHv2 3/4] batman-adv: improved roaming mechanism Antonio Quartulli
2011-05-04 11:22 ` Andrew Lunn
2011-05-04 13:36 ` Antonio Quartulli
2011-05-04 13:52 ` Andrew Lunn [this message]
2011-05-04 13:59 ` Antonio Quartulli
2011-05-03 15:54 ` [B.A.T.M.A.N.] [PATCHv2 4/4] batman-adv: protect the local and the global trans-tables with rcu Antonio Quartulli
2011-05-09 9:49 ` [B.A.T.M.A.N.] [PATCHv3 1/3] batman-adv: improved client announcement mechanism Antonio Quartulli
2011-05-09 9:49 ` [B.A.T.M.A.N.] [PATCHv3 2/3] batman-adv: improved roaming mechanism Antonio Quartulli
2011-05-09 9:49 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: protect the local and the global trans-tables with rcu Antonio Quartulli
2011-05-09 9:50 ` [B.A.T.M.A.N.] [PATCHv3 " Antonio Quartulli
2011-05-10 13:02 ` [B.A.T.M.A.N.] [PATCHv4 1/3] batman-adv: improved client announcement mechanism Antonio Quartulli
2011-05-17 18:53 ` Simon Wunderlich
2011-05-17 19:09 ` Sven Eckelmann
2011-05-17 19:22 ` Sven Eckelmann
2011-05-10 13:02 ` [B.A.T.M.A.N.] [PATCHv4 2/3] batman-adv: improved roaming mechanism Antonio Quartulli
2011-05-10 13:02 ` [B.A.T.M.A.N.] [PATCHv4 3/3] batman-adv: protect the local and the global trans-tables with rcu Antonio Quartulli
2011-05-21 21:25 ` [B.A.T.M.A.N.] [PATCHv5 0/3] New translation table announcement mechanism patchset v5 Antonio Quartulli
2011-05-21 21:25 ` [B.A.T.M.A.N.] [PATCHv5 1/3] batman-adv: improved client announcement mechanism Antonio Quartulli
2011-05-22 11:01 ` Sven Eckelmann
2011-05-23 13:23 ` Antonio Quartulli
2011-05-21 21:25 ` [B.A.T.M.A.N.] [PATCHv2 2/3] batman-adv: improved roaming mechanism Antonio Quartulli
2011-05-22 11:01 ` Sven Eckelmann
2011-05-22 11:44 ` Sven Eckelmann
2011-05-21 21:25 ` [B.A.T.M.A.N.] [PATCHv5 3/3] batman-adv: protect the local and the global trans-tables with rcu Antonio Quartulli
2011-05-28 17:29 ` [B.A.T.M.A.N.] [PATCH] New translation table announcement mechanism patchset 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=20110504135223.GB1528@lunn.ch \
--to=andrew@lunn.ch \
--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 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).