From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id F24755A41 for ; Fri, 22 May 2015 12:16:17 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 22 May 2015 03:16:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,474,1427785200"; d="scan'208";a="730138316" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 22 May 2015 03:16:16 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t4MAGFRv008119; Fri, 22 May 2015 11:16:15 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t4MAGFMY013117; Fri, 22 May 2015 11:16:15 +0100 Received: (from pdelarax@localhost) by sivswdev02.ir.intel.com with id t4MAGFgu013113; Fri, 22 May 2015 11:16:15 +0100 From: Pablo de Lara To: dev@dpdk.org Date: Fri, 22 May 2015 11:16:10 +0100 Message-Id: <1432289771-12799-10-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1432289771-12799-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1431428560-25426-1-git-send-email-pablo.de.lara.guarch@intel.com> <1432289771-12799-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v5 09/10] hash: rename rte_jhash2 to rte_jhash_32b X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2015 10:16:19 -0000 Changed name to something more meaningful, and mark rte_jhash2 as deprecated. Signed-off-by: Pablo de Lara --- app/test/test_func_reentrancy.c | 2 +- app/test/test_hash.c | 4 ++-- app/test/test_hash_functions.c | 6 +++--- lib/librte_hash/rte_jhash.h | 17 +++++++++++++++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c index dc070af..85504c0 100644 --- a/app/test/test_func_reentrancy.c +++ b/app/test/test_func_reentrancy.c @@ -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, }; diff --git a/app/test/test_hash.c b/app/test/test_hash.c index 1da27c5..4ecb11b 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -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) diff --git a/app/test/test_hash_functions.c b/app/test/test_hash_functions.c index 976dd95..04b2862 100644 --- a/app/test/test_hash_functions.c +++ b/app/test/test_hash_functions.c @@ -208,7 +208,7 @@ verify_precalculated_hash_func_tests(void) } /* - * Verify that rte_jhash and rte_jhash2 return the same + * Verify that rte_jhash and rte_jhash_32b return the same */ static int verify_jhash_32bits(void) @@ -226,10 +226,10 @@ verify_jhash_32bits(void) if ((hashtest_key_lens[i] & 0x3) == 0) { hash = rte_jhash(key, hashtest_key_lens[i], hashtest_initvals[j]); /* Divide key length by 4 in rte_jhash for 32 bits */ - hash32 = rte_jhash2((const uint32_t *)key, hashtest_key_lens[i] >> 2, hashtest_initvals[j]); + hash32 = rte_jhash_32b((const uint32_t *)key, hashtest_key_lens[i] >> 2, hashtest_initvals[j]); if (hash != hash32) { printf("rte_jhash returns different value (0x%x)" - "than rte_jhash2 (0x%x)\n", + "than rte_jhash_32b (0x%x)\n", hash, hash32); return -1; } diff --git a/lib/librte_hash/rte_jhash.h b/lib/librte_hash/rte_jhash.h index aa5bb2d..01b1795 100644 --- a/lib/librte_hash/rte_jhash.h +++ b/lib/librte_hash/rte_jhash.h @@ -46,6 +46,8 @@ extern "C" { #include #include + +#include #include /* jhash.h: Jenkins hash support. @@ -278,7 +280,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); } @@ -321,11 +323,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; } -- 1.7.4.1