summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/translation-table.c
diff options
context:
space:
mode:
authorSven Eckelmann2015-03-01 09:46:18 +0100
committerAntonio Quartulli2015-06-07 17:07:17 +0200
commit36fd61cb80fcf07c20230face1a0f6e1505c8322 (patch)
treece2d9f8cf7520b14bfd302248420f3069f232299 /net/batman-adv/translation-table.c
parentbpf: allow programs to write to certain skb fields (diff)
downloadkernel-qcow2-linux-36fd61cb80fcf07c20230face1a0f6e1505c8322.tar.gz
kernel-qcow2-linux-36fd61cb80fcf07c20230face1a0f6e1505c8322.tar.xz
kernel-qcow2-linux-36fd61cb80fcf07c20230face1a0f6e1505c8322.zip
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 <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r--net/batman-adv/translation-table.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index b098e53edded..fe9f8244ac0a 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -67,12 +67,8 @@ static inline uint32_t batadv_choose_tt(const void *data, uint32_t size)
uint32_t hash = 0;
tt = (struct batadv_tt_common_entry *)data;
- hash = batadv_hash_bytes(hash, &tt->addr, ETH_ALEN);
- hash = batadv_hash_bytes(hash, &tt->vid, sizeof(tt->vid));
-
- hash += (hash << 3);
- hash ^= (hash >> 11);
- hash += (hash << 15);
+ hash = jhash(&tt->addr, ETH_ALEN, hash);
+ hash = jhash(&tt->vid, sizeof(tt->vid), hash);
return hash % size;
}