2015-02-24 1:07 GMT+03:00 Johannes Berg <johannes@xxxxxxxxxxxxxxxx>: > 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. > Nice catch! -- Sergey -- 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