From: Antonio Quartulli <ordex@autistici.org>
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 2/9] batman-adv: make struct batadv_orig_node algorithm agnostic
Date: Mon, 12 Aug 2013 19:48:20 +0200 [thread overview]
Message-ID: <20130812174820.GJ849@ritirata.org> (raw)
In-Reply-To: <20130812142812.GA18832@pandem0nium>
[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]
On Mon, Aug 12, 2013 at 04:28:12PM +0200, Simon Wunderlich wrote:
> > diff --git a/routing.c b/routing.c
> > index d4f512d..5b8f087 100644
> > --- a/routing.c
> > +++ b/routing.c
> > @@ -1091,6 +1091,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
> > int hdr_size = sizeof(*bcast_packet);
> > int ret = NET_RX_DROP;
> > int32_t seq_diff;
> > + uint32_t seqno;
> >
> > /* drop packet if it has not necessary minimum size */
> > if (unlikely(!pskb_may_pull(skb, hdr_size)))
> > @@ -1126,12 +1127,13 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
> >
> > spin_lock_bh(&orig_node->bcast_seqno_lock);
> >
> > + seqno = ntohl(bcast_packet->seqno);
> > /* check whether the packet is a duplicate */
> > if (batadv_test_bit(orig_node->bcast_bits, orig_node->last_bcast_seqno,
> > - ntohl(bcast_packet->seqno)))
> > + seqno))
> > goto spin_unlock;
> >
> > - seq_diff = ntohl(bcast_packet->seqno) - orig_node->last_bcast_seqno;
> > + seq_diff = seqno - orig_node->last_bcast_seqno;
> >
> > /* check whether the packet is old and the host just restarted. */
> > if (batadv_window_protected(bat_priv, seq_diff,
> > @@ -1142,7 +1144,7 @@ int batadv_recv_bcast_packet(struct sk_buff *skb,
> > * if required.
> > */
> > if (batadv_bit_get_packet(bat_priv, orig_node->bcast_bits, seq_diff, 1))
> > - orig_node->last_bcast_seqno = ntohl(bcast_packet->seqno);
> > + orig_node->last_bcast_seqno = seqno;
> >
> > spin_unlock_bh(&orig_node->bcast_seqno_lock);
>
> Why are you changing this seqno stuff? Although this might be a valid
> (micro-)optimization, I don't think this should be in this patch ... or
> at least I don't understand it. :)
I must introduce a seqno variable to shorten a line that is following.
Since I could choose, I decided to use seqno to store the value received within
the packet so that I could reduce the number of ntohs.
So I had to do that change and I did it in a good way :)
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-08-12 17:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-11 12:33 [B.A.T.M.A.N.] [PATCHv2 0/9] Improving the routing protocol abstraction Antonio Quartulli
2013-08-11 12:33 ` [B.A.T.M.A.N.] [PATCHv2 1/9] batman-adv: make struct batadv_neigh_node algorithm agnostic Antonio Quartulli
2013-08-11 12:33 ` [B.A.T.M.A.N.] [PATCHv2 2/9] batman-adv: make struct batadv_orig_node " Antonio Quartulli
2013-08-12 14:28 ` Simon Wunderlich
2013-08-12 17:48 ` Antonio Quartulli [this message]
2013-08-11 12:33 ` [B.A.T.M.A.N.] [PATCHv2 3/9] batman-adv: add bat_orig_print function API Antonio Quartulli
2013-08-11 12:33 ` [B.A.T.M.A.N.] [PATCHv2 4/9] batman-adv: add bat_metric_get API function Antonio Quartulli
2013-08-11 12:33 ` [B.A.T.M.A.N.] [PATCHv2 5/9] batman-adv: add bat_metric_is_equiv_or_better " Antonio Quartulli
2013-08-11 12:33 ` [B.A.T.M.A.N.] [PATCHv2 6/9] batman-adv: adapt bonding to use the new API functions Antonio Quartulli
2013-08-11 12:33 ` [B.A.T.M.A.N.] [PATCHv2 7/9] batman-adv: adapt the neighbor purging routine " Antonio Quartulli
2013-08-12 14:31 ` Simon Wunderlich
2013-08-12 17:51 ` Antonio Quartulli
2013-08-12 21:25 ` Antonio Quartulli
2013-08-13 6:08 ` Simon Wunderlich
2013-08-11 12:33 ` [B.A.T.M.A.N.] [PATCHv2 8/9] batman-adv: provide orig_node routing API Antonio Quartulli
2013-08-11 12:33 ` [B.A.T.M.A.N.] [PATCHv2 9/9] batman-adv: adapt the TT component to use the new API functions Antonio Quartulli
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=20130812174820.GJ849@ritirata.org \
--to=ordex@autistici.org \
--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