Search Linux Wireless

Re: [RFC] mac80211: use rhashtable for station table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2015-02-23 at 23:01 +0100, Johannes Berg wrote:
> On Mon, 2015-02-23 at 22:52 +0100, Johannes Berg wrote:
> 
> > We also can't rely on 4-byte alignment though, so perhaps we should do
> > something like
> > 
> > u32 sta_info_hash(void *addr, u32 len, u32 seed)
> > {
> > 	u16 *a = addr;
> > 
> > 	return jhash_3words(a[0], a[1], a[2], seed);
> > }
> 
> Or better do
> 
> 	return jhash_2words(addr[0], (addr[1] << 16) | addr[2], seed);
> 
> since I have no idea how the missing high 16 bits would behave.
> (we can rely on 2-byte alignment, but not 4-byte)

Actually, we cannot rely on alignment, so we need to do this:

static u32 sta_addr_hash(const void *key, u32 length, u32 seed)
{
        return jhash(key, ETH_ALEN, seed);
}
 
which still generates better code since the compiler can optimise based
on the fixed length.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux