From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pdelarax@ecsmtp.ir.intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 967D4377A
 for <dev@dpdk.org>; Fri, 24 Apr 2015 13:23:14 +0200 (CEST)
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by orsmga102.jf.intel.com with ESMTP; 24 Apr 2015 04:23:15 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.11,639,1422950400"; d="scan'208";a="718629246"
Received: from irvmail001.ir.intel.com ([163.33.26.43])
 by orsmga002.jf.intel.com with ESMTP; 24 Apr 2015 04:23:13 -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
 t3OBNCPH001094; Fri, 24 Apr 2015 12:23:12 +0100
Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1])
 by sivswdev02.ir.intel.com with ESMTP id t3OBNCeB018776;
 Fri, 24 Apr 2015 12:23:12 +0100
Received: (from pdelarax@localhost)
 by sivswdev02.ir.intel.com with  id t3OBNCTZ018772;
 Fri, 24 Apr 2015 12:23:12 +0100
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: dev@dpdk.org
Date: Fri, 24 Apr 2015 12:23:07 +0100
Message-Id: <1429874587-17939-7-git-send-email-pablo.de.lara.guarch@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <1429874587-17939-1-git-send-email-pablo.de.lara.guarch@intel.com>
References: <1429190819-27402-1-git-send-email-pablo.de.lara.guarch@intel.com>
 <1429874587-17939-1-git-send-email-pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH v2 6/6] 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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 24 Apr 2015 11:23:15 -0000

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     |   18 +++++++++++++++---
 3 files changed, 18 insertions(+), 6 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/lib/librte_hash/rte_jhash.h b/lib/librte_hash/rte_jhash.h
index 9f5b833..549e95c 100644
--- a/lib/librte_hash/rte_jhash.h
+++ b/lib/librte_hash/rte_jhash.h
@@ -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,15 +321,25 @@ rte_jhash(const void *key, uint32_t length, uint32_t initval)
  *   Calculated hash value.
  */
 static inline uint32_t
-rte_jhash2(const uint32_t *k, uint32_t length, uint32_t initval)
+rte_jhash_32b(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;
 }
 
+static inline uint32_t
+rte_jhash2(const uint32_t *k, uint32_t length, uint32_t initval)
+{
+	uint32_t initval2 = 0;
+
+	RTE_LOG(WARNING, HASH, "rte_jhash2 is deprecated\n");
+	rte_jhash_32b_2hashes(k, length, &initval, &initval2);
+
+	return initval;
+}
 /**
  * A special ultra-optimized versions that knows it is hashing exactly
  * 3 words.
-- 
1.7.4.1