public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
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.] [RFC 02/11] batman-adv: add basic bridge loop avoidance code
Date: Wed, 2 Nov 2011 12:01:12 +0100	[thread overview]
Message-ID: <20111102110112.GA6355@pandem0nium> (raw)
In-Reply-To: <201111011152.46222.lindner_marek@yahoo.de>

[-- Attachment #1: Type: text/plain, Size: 3683 bytes --]

Hi,

On Tue, Nov 01, 2011 at 11:52:45AM +0100, Marek Lindner wrote:
> On Sunday, October 30, 2011 23:51:03 Simon Wunderlich wrote:
> > +static const uint8_t announce_mac[6] = {0x43, 0x05, 0x43, 0x05, 0x00,
> > 0x00};
> 
> All we ever use are 4 bytes - we could make this shorter. Otherwise please use 
> ETH_ALEN. Please use ETH_ALEN throughout the code instead of 6.
> 

OK, that's right, i'll change it to 4 and use ETH_ALEN at the other place where i missed it.
 
> > +       bat_dbg(DBG_BLA, bat_priv,
> > +               "handle_announce(): ANNOUNCE vid %d (sent "
> > +               "by %pM)... CRC = %04x (nw order)\n",
> > +               vid, backbone_gw->orig, crc);
> 
> It is not network byte order anymore ..
> 

OK

> +       /* TODO: we could cal something like tt_local_del() here. */
> 
> Why should we ?
> 
> 

Because when someone claims the adress, the the client has roamed to the mesh.

Usually this is handled by the tt roaming code, this will only fail in a limited
horizon scenario where a node does not know the other node the client roamed to.
In this case, the tt will time out after a long while.

This is just an idea/optimization to add the tt_local_del(). :)

> > @@ -634,7 +640,7 @@ static int batman_skb_recv(struct sk_buff *skb, struct
> > net_device *dev, case BAT_TT_QUERY:
> >                 ret = recv_tt_query(skb, hard_iface);
> >                 break;
> > -               /* Roaming advertisement */
> > +               /* bridge roop avoidance query */
> >         case BAT_ROAM_ADV:
> >                 ret = recv_roam_adv(skb, hard_iface);
> >                 break;
> 
> Small typo here but why are you even changing the comment ?
> 

Oh thanks, this is wrong. This comes from an earlier version of the BLA table
changes where I used a special packet type. 

The comment should not be changed.

> >         atomic_t gw_reselect;
> >         struct hard_iface __rcu *primary_if;  /* rcu protected pointer */
> >         struct vis_info *my_vis_info;
> > +       uint8_t own_orig[6];            /* cache primary hardifs address */
> >  };
> 
> I'd call this "primary_addr" instead of "own_orig" to be consistent with 
> "primary_if". Furthermore ETH_ALEN should be used for the length.
> 

OK.

> > +struct backbone_gw {
> > +       uint8_t orig[ETH_ALEN];
> > +       short vid;              /* used VLAN ID */
> > +       struct hlist_node hash_entry;
> > +       struct bat_priv *bat_priv;
> > +       unsigned long lasttime; /* last time we heard of this backbone gw */
> > +       atomic_t request_sent;
> > +       atomic_t refcount;
> > +       struct rcu_head rcu;
> > +       uint16_t crc;           /* crc checksum over all claims */
> > +} __packed;
> > +
> > +struct claim {
> > +       uint8_t addr[ETH_ALEN];
> > +       short vid;
> > +       struct backbone_gw *backbone_gw;
> > +       unsigned long lasttime; /* last time we heard of claim (locals only)
> > */
> > +       struct rcu_head rcu;
> > +       atomic_t refcount;
> > +       struct hlist_node hash_entry;
> > +} __packed;
> 
> Why are these structs packed ?

For similar reasons as the tt_global/local_entry issue: The hash functions both
access orig and vid from these structures.

However, as there are not that many sharing function I'll split it into
choose_claim()/choose_backbone_gw() and remove the __packed attribute.

In this case, it should be a little bit shorter and cleaner than using a common
structure (no container_of() stuff).

Thanks for the comments, you'll find the changed stuff as patches in my blaII_dirty repo.

Cheers,
	Simon

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-11-02 11:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-30 22:51 [B.A.T.M.A.N.] [RFC 00/11] bridge loop avoidance II Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 01/11] batman-adv: remove old bridge loop avoidance code Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 02/11] batman-adv: add basic " Simon Wunderlich
2011-10-30 23:20   ` Marek Lindner
2011-10-31  0:00     ` Simon Wunderlich
2011-11-01 10:52   ` Marek Lindner
2011-11-02 11:01     ` Simon Wunderlich [this message]
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 03/11] batman-adv: make bridge loop avoidance switchable Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 04/11] batman-adv: export claim tables through debugfs Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 05/11] batman-adv: allow multiple entries in tt_global_entries Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 06/11] batman-adv: don't let backbone gateways exchange tt entries Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 07/11] batman-adv: add broadcast duplicate check Simon Wunderlich
2011-11-01 10:47   ` Marek Lindner
2011-11-02 11:07     ` Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 08/11] batman-adv: drop STP over batman Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 09/11] batman-adv: form groups in the bridge loop avoidance Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 10/11] batman-adv: Update README and sysfs description Simon Wunderlich
2011-10-30 22:51 ` [B.A.T.M.A.N.] [RFC 11/11] [RFC] batman-adv: get primaries address through bat_priv->own_orig Simon Wunderlich
2011-11-01 10:08   ` Marek Lindner
2011-11-04 15:17     ` Simon Wunderlich
2011-10-31  0:52 ` [B.A.T.M.A.N.] [RFC 00/11] bridge loop avoidance II Simon Wunderlich

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=20111102110112.GA6355@pandem0nium \
    --to=simon.wunderlich@s2003.tu-chemnitz.de \
    --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