netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
Cc: herbert@gondor.apana.org.au, davem@redhat.com, netdev@oss.sgi.com
Subject: Re: [INET] Optimise away a branch in IP_ECN_set_ce
Date: Wed, 8 Sep 2004 21:53:18 -0300	[thread overview]
Message-ID: <200409082153.18678.acme@conectiva.com.br> (raw)
In-Reply-To: <20040909.093625.124940653.yoshfuji@linux-ipv6.org>

Em Qua 08 Set 2004 21:36, YOSHIFUJI Hideaki / 吉藤英明 escreveu:
> In article <200409082127.57827.acme@conectiva.com.br> (at Wed, 8 Sep 2004 
21:27:57 -0300), Arnaldo Carvalho de Melo <acme@conectiva.com.br> says:
> > Em Qua 08 Set 2004 21:24, YOSHIFUJI Hideaki / 吉藤英明 escreveu:
> > > In article <20040909000330.GA5581@gondor.apana.org.au> (at Thu, 9 Sep
> > > 2004
> >
> > 10:03:31 +1000), Herbert Xu <herbert@gondor.apana.org.au> says:
> > > > +       u32 ecn = (iph->tos + 1) & INET_ECN_MASK;
> > > >
> > > > + /*
> > > > +  * The following gives us:
> > > > +  * INET_ECN_ECT_1 => check += __constant_htons(0xFFFD)
> > > > +  * INET_ECN_ECT_0 => check += __constant_htons(0xFFFE)
> > > > +  */
> > > > + if (__constant_htons(1) != 1)
> > > > +  ecn <<= 8;
> > > > + check += __constant_htons(0xFFFB) + ecn;
> > > > +
> > > >   iph->check = check + (check>=0xFFFF);
> > > >   iph->tos |= INET_ECN_CE;
> > > >  }
> > >
> > > s/__constant_htons/htons/g here, please.
> >
> > For Herbert understanding: the generated code is the same in this case.
> > :)
>
> Yes, thanks.
> And, we don't use __const_{hton,ntoh}{s,l}() unless it is really required.
> e.g. variable initializer

Yes, that is the only case, like I learned in my early janitor days, using the
__constant_ variations is not needed and makes the code needlessly ugly :)

  reply	other threads:[~2004-09-09  0:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-09  0:03 [INET] Optimise away a branch in IP_ECN_set_ce Herbert Xu
2004-09-09  0:24 ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-09  0:27   ` Arnaldo Carvalho de Melo
2004-09-09  0:36     ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-09  0:53       ` Arnaldo Carvalho de Melo [this message]
2004-09-09  1:10   ` Herbert Xu
2004-09-09  1:27     ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-09  1:54       ` Herbert Xu
2004-09-09  1:58         ` YOSHIFUJI Hideaki / 吉藤英明
2004-09-09  4:35           ` David S. Miller

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=200409082153.18678.acme@conectiva.com.br \
    --to=acme@conectiva.com.br \
    --cc=davem@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@oss.sgi.com \
    --cc=yoshfuji@linux-ipv6.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).