[dpdk-dev,v3,6/6] hash: rename rte_jhash2 to rte_jhash_32b
Commit Message
From: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
Changed name to something more meaningful,
and mark rte_jhash2 as deprecated.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
app/test/test_func_reentrancy.c | 2 +-
app/test/test_hash.c | 4 ++--
lib/librte_hash/rte_jhash.h | 17 +++++++++++++++--
3 files changed, 18 insertions(+), 5 deletions(-)
@@ -228,7 +228,7 @@ hash_create_free(__attribute__((unused)) void *arg)
.entries = 16,
.bucket_entries = 4,
.key_len = 4,
- .hash_func = (rte_hash_function)rte_jhash2,
+ .hash_func = (rte_hash_function)rte_jhash_32b,
.hash_func_init_val = 0,
.socket_id = 0,
};
@@ -1177,7 +1177,7 @@ test_hash_add_delete_jhash2(void)
hash_params_ex.name = "hash_test_jhash2";
hash_params_ex.key_len = 4;
- hash_params_ex.hash_func = (rte_hash_function)rte_jhash2;
+ hash_params_ex.hash_func = (rte_hash_function)rte_jhash_32b;
handle = rte_hash_create(&hash_params_ex);
if (handle == NULL) {
@@ -1216,7 +1216,7 @@ test_hash_add_delete_2_jhash2(void)
hash_params_ex.name = "hash_test_2_jhash2";
hash_params_ex.key_len = 8;
- hash_params_ex.hash_func = (rte_hash_function)rte_jhash2;
+ hash_params_ex.hash_func = (rte_hash_function)rte_jhash_32b;
handle = rte_hash_create(&hash_params_ex);
if (handle == NULL)
@@ -46,6 +46,8 @@ extern "C" {
#include <stdint.h>
#include <string.h>
+
+#include <rte_log.h>
#include <rte_byteorder.h>
/* jhash.h: Jenkins hash support.
@@ -276,7 +278,7 @@ rte_jhash_2hashes(const void *key, uint32_t length, uint32_t *pc, uint32_t *pb)
* IN: second seed OUT: secondary hash value.
*/
static inline void
-rte_jhash2_2hashes(const uint32_t *k, uint32_t length, uint32_t *pc, uint32_t *pb)
+rte_jhash_32b_2hashes(const uint32_t *k, uint32_t length, uint32_t *pc, uint32_t *pb)
{
__rte_jhash_2hashes((const void *) k, (length << 2), pc, pb, 0);
}
@@ -319,11 +321,22 @@ rte_jhash(const void *key, uint32_t length, uint32_t initval)
* Calculated hash value.
*/
static inline uint32_t
+rte_jhash_32b(const uint32_t *k, uint32_t length, uint32_t initval)
+{
+ uint32_t initval2 = 0;
+
+ rte_jhash_32b_2hashes(k, length, &initval, &initval2);
+
+ return initval;
+}
+
+static inline uint32_t
rte_jhash2(const uint32_t *k, uint32_t length, uint32_t initval)
{
uint32_t initval2 = 0;
- rte_jhash2_2hashes(k, length, &initval, &initval2);
+ RTE_LOG(WARNING, HASH, "rte_jhash2 is deprecated\n");
+ rte_jhash_32b_2hashes(k, length, &initval, &initval2);
return initval;
}