diff options
author | Rohit Vaswani <rvaswani@codeaurora.org> | 2016-02-17 13:55:51 -0800 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:09:36 -0700 |
commit | 7d052379ef29c8e49be215e249fdd6558ff116bb (patch) | |
tree | c752f2eddfea9365699494284488097a1b589609 /include/linux | |
parent | 2254e02d74045113cff8e2a269684b348d5dbb58 (diff) |
Revert "net, lib: kill arch_fast_hash library bits"
This reverts commit 0cb6c969ed9de43687abdfc63714b6fe4385d2fc.
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/hash.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/hash.h b/include/linux/hash.h index 1afde47e1528..d0494c399392 100644 --- a/include/linux/hash.h +++ b/include/linux/hash.h @@ -15,6 +15,7 @@ */ #include <asm/types.h> +#include <asm/hash.h> #include <linux/compiler.h> /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ @@ -83,4 +84,38 @@ static inline u32 hash32_ptr(const void *ptr) return (u32)val; } +struct fast_hash_ops { + u32 (*hash)(const void *data, u32 len, u32 seed); + u32 (*hash2)(const u32 *data, u32 len, u32 seed); +}; + +/** + * arch_fast_hash - Caclulates a hash over a given buffer that can have + * arbitrary size. This function will eventually use an + * architecture-optimized hashing implementation if + * available, and trades off distribution for speed. + * + * @data: buffer to hash + * @len: length of buffer in bytes + * @seed: start seed + * + * Returns 32bit hash. + */ +extern u32 arch_fast_hash(const void *data, u32 len, u32 seed); + +/** + * arch_fast_hash2 - Caclulates a hash over a given buffer that has a + * size that is of a multiple of 32bit words. This + * function will eventually use an architecture- + * optimized hashing implementation if available, + * and trades off distribution for speed. + * + * @data: buffer to hash (must be 32bit padded) + * @len: number of 32bit words + * @seed: start seed + * + * Returns 32bit hash. + */ +extern u32 arch_fast_hash2(const u32 *data, u32 len, u32 seed); + #endif /* _LINUX_HASH_H */ |