From 36fd61cb80fcf07c20230face1a0f6e1505c8322 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Sun, 1 Mar 2015 09:46:18 +0100 Subject: batman-adv: Use common Jenkins Hash implementation An unoptimized version of the Jenkins one-at-a-time hash function is used and partially copied all over the code wherever an hashtable is used. Instead the optimized version shared between the whole kernel should be used to reduce code duplication and use better optimized code. Only the DAT code must use the old implementation because it is used as distributed hash function which has to be common for all nodes. Signed-off-by: Sven Eckelmann Signed-off-by: Marek Lindner --- net/batman-adv/network-coding.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'net/batman-adv/network-coding.c') diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c index b984bc49deaf..fb54319abff3 100644 --- a/net/batman-adv/network-coding.c +++ b/net/batman-adv/network-coding.c @@ -453,14 +453,8 @@ static uint32_t batadv_nc_hash_choose(const void *data, uint32_t size) const struct batadv_nc_path *nc_path = data; uint32_t hash = 0; - hash = batadv_hash_bytes(hash, &nc_path->prev_hop, - sizeof(nc_path->prev_hop)); - hash = batadv_hash_bytes(hash, &nc_path->next_hop, - sizeof(nc_path->next_hop)); - - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); + hash = jhash(&nc_path->prev_hop, sizeof(nc_path->prev_hop), hash); + hash = jhash(&nc_path->next_hop, sizeof(nc_path->next_hop), hash); return hash % size; } -- cgit v1.2.3