datapath: Add support for RHEL-7 / CentOS-7 kernel.
[cascardo/ovs.git] / datapath / linux / compat / include / linux / hash.h
1 #ifndef _LINUX_HASH_WRAPPER_H
2 #define _LINUX_HASH_WRAPPER_H
3
4 #include_next <linux/hash.h>
5 #include <asm/hash.h>
6
7 #ifndef HAVE_FAST_HASH_OPS
8
9 struct fast_hash_ops {
10         u32 (*hash)(const void *data, u32 len, u32 seed);
11         u32 (*hash2)(const u32 *data, u32 len, u32 seed);
12 };
13
14 /**
15  *      arch_fast_hash - Caclulates a hash over a given buffer that can have
16  *                       arbitrary size. This function will eventually use an
17  *                       architecture-optimized hashing implementation if
18  *                       available, and trades off distribution for speed.
19  *
20  *      @data: buffer to hash
21  *      @len: length of buffer in bytes
22  *      @seed: start seed
23  *
24  *      Returns 32bit hash.
25  */
26 extern u32 arch_fast_hash(const void *data, u32 len, u32 seed);
27
28 /**
29  *      arch_fast_hash2 - Caclulates a hash over a given buffer that has a
30  *                        size that is of a multiple of 32bit words. This
31  *                        function will eventually use an architecture-
32  *                        optimized hashing implementation if available,
33  *                        and trades off distribution for speed.
34  *
35  *      @data: buffer to hash (must be 32bit padded)
36  *      @len: number of 32bit words
37  *      @seed: start seed
38  *
39  *      Returns 32bit hash.
40  */
41 extern u32 arch_fast_hash2(const u32 *data, u32 len, u32 seed);
42 #endif /* !HASH_FAST_HASH_OPS */
43
44 #endif /* _LINUX_HASH_WRAPPER_H */