Commit 27bddffc authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[BRIDGE]: Use Jenkins hash

Replace the existing mac hash in the bridge code with the nice
inline jenkins hash. This should provide better distribution across
hash buckets and compiles to code that is similar in complexity.
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3e7ae4c1
......@@ -19,6 +19,7 @@
#include <linux/times.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/jhash.h>
#include <asm/atomic.h>
#include "br_private.h"
......@@ -57,18 +58,7 @@ static __inline__ int has_expired(const struct net_bridge *br,
static __inline__ int br_mac_hash(const unsigned char *mac)
{
unsigned long x;
x = mac[0];
x = (x << 2) ^ mac[1];
x = (x << 2) ^ mac[2];
x = (x << 2) ^ mac[3];
x = (x << 2) ^ mac[4];
x = (x << 2) ^ mac[5];
x ^= x >> 8;
return x & (BR_HASH_SIZE - 1);
return jhash(mac, ETH_ALEN, 0) & (BR_HASH_SIZE - 1);
}
static __inline__ void fdb_delete(struct net_bridge_fdb_entry *f)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment