[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1344253917.26674.13.camel@edumazet-glaptop>
Date: Mon, 06 Aug 2012 13:51:57 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Pavel Emelyanov <xemul@...allels.com>
Cc: David Miller <davem@...emloft.net>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: [PATCH 1/5] net: Don't use ifindices in hash fns
On Mon, 2012-08-06 at 15:01 +0400, Pavel Emelyanov wrote:
> Damn :( You're right.
>
> > This returns 0 as is
>
> Well, on 64-bit no, but what it does is also not what it was supposed to.
>
Here, my L1_CACHE_BYTES is 64, but whatever
> > I would define a generic pointer hash mix instead of a 'net_device
> > thing'
> >
> > static inline u32 ptr_hash_mix(void *ptr)
> > {
> > #if BITS_PER_LONG==32
> > return (u32)(unsigned long)ptr;
> > #else
> > return (u32)((unsigned long)ptr >> L1_CACHE_SHIFT);
> > #endif
> > }
>
> OK. It will also obsolete the net_hash_mix then. Any suggestions where to put
> the new one?
Not obsolete net_hash_mix(), since this one can return 0 if
CONFIG_NET_NS is not set.
static inline unsigned int net_hash_mix(struct net *net)
{
#ifdef CONFIG_NET_NS
return ptr_hash_mix(net);
#else
return 0;
#endif
}
I dont know, you could add this to include/linux/hash.h
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists