diff options
author | Sven Eckelmann <sven@narfation.org> | 2015-03-01 09:46:18 +0100 |
---|---|---|
committer | Antonio Quartulli <antonio@meshcoding.com> | 2015-06-07 17:07:17 +0200 |
commit | 36fd61cb80fcf07c20230face1a0f6e1505c8322 (patch) | |
tree | ce2d9f8cf7520b14bfd302248420f3069f232299 /net/batman-adv/originator.h | |
parent | d691f9e8d4405c334aa10d556e73c8bf44cb0e01 (diff) | |
download | linux-36fd61cb80fcf07c20230face1a0f6e1505c8322.tar.gz linux-36fd61cb80fcf07c20230face1a0f6e1505c8322.tar.bz2 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/originator.h')
-rw-r--r-- | net/batman-adv/originator.h | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/net/batman-adv/originator.h b/net/batman-adv/originator.h index 91339143a2f7..0b716fe1db99 100644 --- a/net/batman-adv/originator.h +++ b/net/batman-adv/originator.h @@ -75,20 +75,9 @@ void batadv_orig_node_vlan_free_ref(struct batadv_orig_node_vlan *orig_vlan); */ static inline uint32_t batadv_choose_orig(const void *data, uint32_t size) { - const unsigned char *key = data; uint32_t hash = 0; - size_t i; - - for (i = 0; i < 6; i++) { - hash += key[i]; - hash += (hash << 10); - hash ^= (hash >> 6); - } - - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); + hash = jhash(data, ETH_ALEN, hash); return hash % size; } |