netdev
[Top] [All Lists]

Re: [INET] Optimise away a branch in IP_ECN_set_ce

To: herbert@xxxxxxxxxxxxxxxxxxx
Subject: Re: [INET] Optimise away a branch in IP_ECN_set_ce
From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@xxxxxxxxxxxxxx>
Date: Thu, 09 Sep 2004 09:24:28 +0900 (JST)
Cc: davem@xxxxxxxxxx, netdev@xxxxxxxxxxx, yoshfuji@xxxxxxxxxxxxxx
In-reply-to: <20040909000330.GA5581@xxxxxxxxxxxxxxxxxxx>
Organization: USAGI Project
References: <20040909000330.GA5581@xxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
In article <20040909000330.GA5581@xxxxxxxxxxxxxxxxxxx> (at Thu, 9 Sep 2004 
10:03:31 +1000), Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> 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.

And, I think 
  u16 ecn = (iph->tos + 1) & INET_ECN_MASK;
:
  check += (u32)htons(0xfffb) + (u32)htons(ecn);

or something like that?

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@xxxxxxxxxxxxxx>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

<Prev in Thread] Current Thread [Next in Thread>