From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 2C1B41B183 for ; Thu, 11 Oct 2018 06:52:57 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Oct 2018 21:52:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,367,1534834800"; d="scan'208";a="77895193" Received: from skx-yipeng.jf.intel.com ([10.54.81.175]) by fmsmga008.fm.intel.com with ESMTP; 10 Oct 2018 21:52:54 -0700 From: Yipeng Wang To: bruce.richardson@intel.com Cc: stephen@networkplumber.org, dev@dpdk.org, yipeng1.wang@intel.com, honnappa.nagarahalli@arm.com, sameh.gobriel@intel.com Date: Wed, 10 Oct 2018 14:48:04 -0700 Message-Id: <1539208085-30756-3-git-send-email-yipeng1.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539208085-30756-1-git-send-email-yipeng1.wang@intel.com> References: <1539208085-30756-1-git-send-email-yipeng1.wang@intel.com> Subject: [dpdk-dev] [PATCH v1 2/3] test/hash: change multiwriter test to use jhash X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2018 04:52:57 -0000 With sequential key, the test will cover more corner cases with jhash instead of crc hash, since jhash generates more random hash pattern on sequential key. It is useful for functional verification. Signed-off-by: Yipeng Wang --- test/test/test_hash_multiwriter.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/test/test_hash_multiwriter.c b/test/test/test_hash_multiwriter.c index 6a3eb10..7f2deae 100644 --- a/test/test/test_hash_multiwriter.c +++ b/test/test/test_hash_multiwriter.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "test.h" @@ -95,7 +96,7 @@ test_hash_multiwriter_worker(void *arg) static int -test_hash_multiwriter(void) +test_hash_multiwriter(int use_jhash) { unsigned int i, rounded_nb_total_tsx_insertion; static unsigned calledCount = 1; @@ -108,10 +109,14 @@ test_hash_multiwriter(void) struct rte_hash_parameters hash_params = { .entries = nb_entries, .key_len = sizeof(uint32_t), - .hash_func = rte_hash_crc, .hash_func_init_val = 0, .socket_id = rte_socket_id(), }; + if (use_jhash) + hash_params.hash_func = rte_jhash; + else + hash_params.hash_func = rte_hash_crc; + if (use_htm) hash_params.extra_flag = RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT @@ -259,6 +264,8 @@ test_hash_multiwriter(void) static int test_hash_multiwriter_main(void) { + int use_jhash = 1; + if (rte_lcore_count() == 1) { printf("More than one lcore is required to do multiwriter test\n"); return 0; @@ -278,13 +285,13 @@ test_hash_multiwriter_main(void) printf("Test multi-writer with Hardware transactional memory\n"); use_htm = 1; - if (test_hash_multiwriter() < 0) + if (test_hash_multiwriter(use_jhash) < 0) return -1; } printf("Test multi-writer without Hardware transactional memory\n"); use_htm = 0; - if (test_hash_multiwriter() < 0) + if (test_hash_multiwriter(use_jhash) < 0) return -1; return 0; -- 2.7.4