From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E9FEA046B for ; Thu, 27 Jun 2019 10:08:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 90A034CA6; Thu, 27 Jun 2019 10:08:07 +0200 (CEST) Received: from mail-vs1-f66.google.com (mail-vs1-f66.google.com [209.85.217.66]) by dpdk.org (Postfix) with ESMTP id BD9784C99 for ; Thu, 27 Jun 2019 10:08:05 +0200 (CEST) Received: by mail-vs1-f66.google.com with SMTP id v6so1041809vsq.4 for ; Thu, 27 Jun 2019 01:08:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aJEyZNFlHNG1lvOTull9eBgk7iHe8BcIQ2L42TGBBSA=; b=LEV6ArgIUaheAVw+9zs6MbPTljXqf0ie3TpLldkxPV6attoLdOpW/oJfEtXOid0Zve 3KPEG6r8l/zOlCcbDLBS32K6DuNHr8G8VFdjXqOMz6cZi59HPmXGgLWf61y4OxwI5TbJ DQTrxM32XqZXKSp5arU3nZKe99wMs7TRnTRmL7DjIVMytk4qA3JXAkeo+7W6n664sfZ7 YeO99NWlZjJbctGVtKmG79ETEaVcVjREUcgqSq8o19WwVDY8PGB+zrVm39QrPBh8xNyv IH7z+OELKF4ItEmrhxb85KnAFwtvpSdLljbb8+y5d98PX4u3ytO6aoSVRm2SJzQMKL6/ JRrg== X-Gm-Message-State: APjAAAUjG0m9gGcaz3K/eFtVqAVn8+e/LkVTxF3oB5Dx5zyDHOjDQXHm QsfW0sw6bPCMewpaSNBUDF+N8lUAgUAv6fMl2gy5zA== X-Google-Smtp-Source: APXvYqwF1nWCVfNdzXXokbrTEwiZCcURFkncKrmYiO/wD1VrN2jJdwXudTueFleCsTppnuu1ZspvtGRbeMutAoKmoRc= X-Received: by 2002:a67:2ec8:: with SMTP id u191mr1831378vsu.39.1561622885173; Thu, 27 Jun 2019 01:08:05 -0700 (PDT) MIME-Version: 1.0 References: <20190627032420.4730-1-honnappa.nagarahalli@arm.com> <20190627032420.4730-3-honnappa.nagarahalli@arm.com> In-Reply-To: <20190627032420.4730-3-honnappa.nagarahalli@arm.com> From: David Marchand Date: Thu, 27 Jun 2019 10:07:54 +0200 Message-ID: To: Honnappa Nagarahalli Cc: "Wang, Yipeng1" , "Gobriel, Sameh" , Bruce Richardson , Pablo de Lara , Dharmik Thakkar , dev , nd , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH 3/3] test/hash: init hash parameters in the correct function 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Jun 27, 2019 at 5:25 AM Honnappa Nagarahalli < honnappa.nagarahalli@arm.com> wrote: > Each test case initializes its hash parameters in the test case > function. To be consistent, generate keys function should initialize > hash parameters similarly. > > Fixes: c7eb0972e74b ("test/hash: add lock-free r/w concurrency") > Cc: stable@dpdk.org > > Signed-off-by: Honnappa Nagarahalli > Reviewed-by: Dharmik Thakkar > --- > app/test/test_hash_readwrite_lf.c | 98 +++++++++++++++---------------- > 1 file changed, 49 insertions(+), 49 deletions(-) > > diff --git a/app/test/test_hash_readwrite_lf.c > b/app/test/test_hash_readwrite_lf.c > index e92d1065b..efabb60ef 100644 > --- a/app/test/test_hash_readwrite_lf.c > +++ b/app/test/test_hash_readwrite_lf.c > @@ -141,6 +141,52 @@ get_enabled_cores_list(void) > return 0; > } > > +static int > +init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) > +{ > + struct rte_hash *handle; > + > + struct rte_hash_parameters hash_params = { > + .entries = TOTAL_ENTRY, > + .key_len = sizeof(uint32_t), > + .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 (rwc_lf) > + hash_params.extra_flag = > + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | > + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > + else if (htm) > + hash_params.extra_flag = > + RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | > + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > + else > + hash_params.extra_flag = > + RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > + RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > + > + if (ext_bkt) > + hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > + > + hash_params.name = "tests"; > + > + handle = rte_hash_create(&hash_params); > + if (handle == NULL) { > + printf("hash creation failed"); > + return -1; > + } > + > + tbl_rwc_test_param.h = handle; > + return 0; > +} > + > static inline int > check_bucket(uint32_t bkt_idx, uint32_t key) > { > @@ -215,6 +261,9 @@ generate_keys(void) > uint32_t count_keys_extbkt = 0; > uint32_t i; > > + if (init_params(0, 0, 0, 0) != 0) > + return -1; > + > /* > * keys will consist of a) keys whose addition to the hash table > * will result in shifting of the existing keys to their alternate > @@ -504,52 +553,6 @@ generate_keys(void) > return -1; > } > > -static int > -init_params(int rwc_lf, int use_jhash, int htm, int ext_bkt) > -{ > - struct rte_hash *handle; > - > - struct rte_hash_parameters hash_params = { > - .entries = TOTAL_ENTRY, > - .key_len = sizeof(uint32_t), > - .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 (rwc_lf) > - hash_params.extra_flag = > - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF | > - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > - else if (htm) > - hash_params.extra_flag = > - RTE_HASH_EXTRA_FLAGS_TRANS_MEM_SUPPORT | > - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > - else > - hash_params.extra_flag = > - RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY | > - RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD; > - > - if (ext_bkt) > - hash_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > - > - hash_params.name = "tests"; > - > - handle = rte_hash_create(&hash_params); > - if (handle == NULL) { > - printf("hash creation failed"); > - return -1; > - } > - > - tbl_rwc_test_param.h = handle; > - return 0; > -} > - > static int > test_rwc_reader(__attribute__((unused)) void *arg) > { > @@ -1254,7 +1257,6 @@ test_hash_readwrite_lf_main(void) > */ > int rwc_lf = 0; > int htm; > - int use_jhash = 0; > int ext_bkt = 0; > if (rte_lcore_count() == 1) { > printf("More than one lcore is required " > @@ -1272,8 +1274,6 @@ test_hash_readwrite_lf_main(void) > else > htm = 0; > > - if (init_params(rwc_lf, use_jhash, htm, ext_bkt) != 0) > - return -1; > if (generate_keys() != 0) > return -1; > if (get_enabled_cores_list() != 0) > -- > 2.17.1 > > This patch impacts the memory allocations, it should be placed before patch 2. -- David Marchand