From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 659E85AA0 for ; Wed, 10 Jun 2015 17:25:31 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 10 Jun 2015 08:25:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,588,1427785200"; d="scan'208";a="744353008" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 10 Jun 2015 08:25:31 -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 t5AFPS59024245; Wed, 10 Jun 2015 16:25:28 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t5AFPS1V014869; Wed, 10 Jun 2015 16:25:28 +0100 Received: (from pdelarax@localhost) by sivswdev02.ir.intel.com with id t5AFPSkL014865; Wed, 10 Jun 2015 16:25:28 +0100 From: Pablo de Lara To: dev@dpdk.org Date: Wed, 10 Jun 2015 16:25:26 +0100 Message-Id: <1433949927-14767-10-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1433949927-14767-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1432289771-12799-1-git-send-email-pablo.de.lara.guarch@intel.com> <1433949927-14767-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v6 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: Wed, 10 Jun 2015 15:25:34 -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 c6cdccf..8af8601 100644 --- a/app/test/test_hash_functions.c +++ b/app/test/test_hash_functions.c @@ -204,7 +204,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) @@ -223,12 +223,12 @@ verify_jhash_32bits(void) 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, + 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 dd19ce0..649d7c7 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. @@ -279,7 +281,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); } @@ -322,11 +324,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 +__attribute__ ((deprecated)) rte_jhash2(const uint32_t *k, uint32_t length, uint32_t initval) { uint32_t initval2 = 0; - rte_jhash2_2hashes(k, length, &initval, &initval2); + rte_jhash_32b_2hashes(k, length, &initval, &initval2); return initval; } -- 2.4.2