On Mon, 30 Apr 2007 19:56:04 +0900 (JST)
YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]> (at Mon, 30 Apr 2007 00:26:43 -0700 (PDT)),
> David Miller <[EMAIL PROTECTED]> says:
>
> > > Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]>
> >
> > Eric, I've applied this, thanks again.
> >
> > Could I trouble you to cook up an ipv6 version of this patch?
>
> Here's my tentative version. Not tested.
> Dave, Eric, could you double-check this, please?
Hi Yoshifuji
Your patch seems good, thank you.
I have two minor comments about udp6_hash_port_and_addr()
Compiler knows that const 'struct in6_addr *addr' is NULL when we call
udp6_hash_port_and_addr(..., NULL)
But not when we pass saddr : udp6_hash_port_and_addr(port, saddr)
So to avoid one conditional branch, you could use udp6_hash_port_and_addr()
only once, with addr not NULL :
Also, I am not sure we need to use all 128 bits of IPV6 address, maybe the 64
low order bits are enough ?
static inline unsigned int udp6_hash_port_and_addr(__u16 port,
const struct in6_addr *addr)
{
u32 hash = (__force u32) addr->s6_addr32[2] ^
(__force u32) addr->s6_addr32[3];
hash ^= hash >> 16;
hash ^= hash >> 8;
return port ^ hash;
}
static inline unsigned int udp6_hash_wildcard(__u16 port,
const struct in6_addr *addr)
{
return port;
}
...
hash = udp6_hash_port_and_addr(ntohs(dport), saddr);
hashwild = udp6_hash_wildcard(ntohs(dport), saddr);
Eric
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html