From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 1C81B4CC3 for ; Thu, 25 Oct 2018 11:32:56 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2018 02:32:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,423,1534834800"; d="scan'208";a="98505767" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.107]) by fmsmga002.fm.intel.com with SMTP; 25 Oct 2018 02:32:53 -0700 Received: by (sSMTP sendmail emulation); Thu, 25 Oct 2018 10:32:53 +0100 Date: Thu, 25 Oct 2018 10:32:52 +0100 From: Bruce Richardson To: Yipeng Wang Cc: stephen@networkplumber.org, dev@dpdk.org, honnappa.nagarahalli@arm.com, sameh.gobriel@intel.com Message-ID: <20181025093252.GB12056@bricha3-MOBL.ger.corp.intel.com> References: <1540404570-102126-1-git-send-email-yipeng1.wang@intel.com> <1540404570-102126-3-git-send-email-yipeng1.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1540404570-102126-3-git-send-email-yipeng1.wang@intel.com> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v2 2/4] 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, 25 Oct 2018 09:32:57 -0000 On Wed, Oct 24, 2018 at 11:09:28AM -0700, Yipeng Wang wrote: > 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 | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/test/test/test_hash_multiwriter.c b/test/test/test_hash_multiwriter.c > index 6a3eb10..456bc5f 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" > > @@ -31,6 +32,9 @@ > > #define RTE_APP_TEST_HASH_MULTIWRITER_FAILED 0 > > +/* Use jhash or crc hash */ > +#define USE_JHASH 1 > + > struct { > uint32_t *keys; > uint32_t *found; > @@ -108,10 +112,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 > -- As I commented on v1, rather than having a macro at the top hard-coded to jhash, why not just do a straight replacement of crc to jhash in the structure definition. Since changing the hash function will involve editing the source code anyway, I see little point in using the macro at the top - especially since there is no indication to the user what effect removing it or changing it to zero has. /Bruce