diff options
author | Jarno Rajahalme <jrajahalme@nicira.com> | 2014-07-04 07:57:18 -0700 |
---|---|---|
committer | Jarno Rajahalme <jrajahalme@nicira.com> | 2014-07-04 07:57:18 -0700 |
commit | 33c6a1b9d4584afc0ac89b25edf666000ad938a7 (patch) | |
tree | 557ed4144028f5f2fc34b05c3c8220855cd8c406 /lib/classifier.c | |
parent | 9f361d6b29fb88080e203be3a41b6abbc4351612 (diff) | |
download | openvswitch-33c6a1b9d4584afc0ac89b25edf666000ad938a7.tar.gz |
lib/hash: Abstract hash interface.
Use generic names hash_add() and hash_finish() instead of mhash_*
equivalents. This makes future changes to hash implentations more
localized.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/classifier.c')
-rw-r--r-- | lib/classifier.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/classifier.c b/lib/classifier.c index 8001e383f..a50e89778 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -214,10 +214,10 @@ flow_hash_in_minimask(const struct flow *flow, const struct minimask *mask, hash = basis; for (map = mask->masks.map; map; map = zero_rightmost_1bit(map)) { - hash = mhash_add(hash, flow_u32[raw_ctz(map)] & *p++); + hash = hash_add(hash, flow_u32[raw_ctz(map)] & *p++); } - return mhash_finish(hash, (p - mask_values) * 4); + return hash_finish(hash, (p - mask_values) * 4); } /* Returns a hash value for the bits of 'flow' where there are 1-bits in @@ -235,10 +235,10 @@ miniflow_hash_in_minimask(const struct miniflow *flow, uint32_t flow_u32; MINIFLOW_FOR_EACH_IN_MAP(flow_u32, flow, mask->masks.map) { - hash = mhash_add(hash, flow_u32 & *p++); + hash = hash_add(hash, flow_u32 & *p++); } - return mhash_finish(hash, (p - mask_values) * 4); + return hash_finish(hash, (p - mask_values) * 4); } /* Returns a hash value for the bits of range [start, end) in 'flow', @@ -260,11 +260,11 @@ flow_hash_in_minimask_range(const struct flow *flow, uint32_t hash = *basis; for (; map; map = zero_rightmost_1bit(map)) { - hash = mhash_add(hash, flow_u32[raw_ctz(map)] & *p++); + hash = hash_add(hash, flow_u32[raw_ctz(map)] & *p++); } *basis = hash; /* Allow continuation from the unfinished value. */ - return mhash_finish(hash, (p - mask_values) * 4); + return hash_finish(hash, (p - mask_values) * 4); } /* Fold minimask 'mask''s wildcard mask into 'wc's wildcard mask. */ @@ -305,15 +305,15 @@ miniflow_hash(const struct miniflow *flow, uint32_t basis) for (map = flow->map; map; map = zero_rightmost_1bit(map)) { if (*p) { - hash = mhash_add(hash, *p); + hash = hash_add(hash, *p); hash_map |= rightmost_1bit(map); } p++; } - hash = mhash_add(hash, hash_map); - hash = mhash_add(hash, hash_map >> 32); + hash = hash_add(hash, hash_map); + hash = hash_add(hash, hash_map >> 32); - return mhash_finish(hash, p - values); + return hash_finish(hash, p - values); } /* Returns a hash value for 'mask', given 'basis'. */ @@ -350,10 +350,10 @@ minimatch_hash_range(const struct minimatch *match, uint8_t start, uint8_t end, p = miniflow_get_u32_values(&match->flow) + offset; for (i = 0; i < n; i++) { - hash = mhash_add(hash, p[i] & q[i]); + hash = hash_add(hash, p[i] & q[i]); } *basis = hash; /* Allow continuation from the unfinished value. */ - return mhash_finish(hash, (offset + n) * 4); + return hash_finish(hash, (offset + n) * 4); } |