From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0073.outbound.protection.outlook.com [104.47.2.73]) by dpdk.org (Postfix) with ESMTP id 874AC58FA for ; Mon, 1 Oct 2018 21:53:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VIye2ff5L+tuJ+xokE9crhCO/N4GiytKBWTYocEvovk=; b=JDf+p/HChbanHx/r4Y3pVeA0XImo8cAIDnHuEVtpAE0iNDNVi29JUnwWi96GgzLLXSN/xXj8djosLGN7hb8/TS5ad0ylM94Iw+QbpNkbgFrynkcWFoB0qPXjHvrglh7nHTXEKpbHrhr2GYCD+Mc60Ee1SwYuI8a11UIarQY+duI= Received: from AM6PR08MB3672.eurprd08.prod.outlook.com (20.177.115.29) by AM6PR08MB3493.eurprd08.prod.outlook.com (20.177.114.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Mon, 1 Oct 2018 19:53:03 +0000 Received: from AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::f423:e46a:a03c:e928]) by AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::f423:e46a:a03c:e928%2]) with mapi id 15.20.1185.024; Mon, 1 Oct 2018 19:53:03 +0000 From: Honnappa Nagarahalli To: Yipeng Wang , "bruce.richardson@intel.com" CC: "konstantin.ananyev@intel.com" , "dev@dpdk.org" , "sameh.gobriel@intel.com" , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v4 3/4] test/hash: implement extendable bucket hash test Thread-Index: AQHUV4toGcpa96NV1keI9GjZSbjwZKUK0Vvg Date: Mon, 1 Oct 2018 19:53:02 +0000 Message-ID: References: <1537993618-92630-1-git-send-email-yipeng1.wang@intel.com> <1538155426-145177-1-git-send-email-yipeng1.wang@intel.com> <1538155426-145177-4-git-send-email-yipeng1.wang@intel.com> In-Reply-To: <1538155426-145177-4-git-send-email-yipeng1.wang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR08MB3493; 6:DUZUhsrZUeg11EPmnIYAry/ZfVZICxPTnTsQOP/ZhitieOYqS6ovP7eteOmh9GKwBpXOFIYRTbcuWDzPsUPj5yEZR7aeObGnQifxFXDleQx9fJHpZ2rJRzbG/ThlHezF0RfAi+w6Yyc46L9iT1UT09dc+PYdO4bKmmZC6Xor8oyMpFdN5nMrOKAZYtroOkdbHmcQqYglIkoya14SkpBLy3kCQvrZf90PGIWUFGt4eD4GFHTeJMqZQjVef7YyOphqeWZnAnL/7tSK3bBmSUXHdBYZZ72S0mfTZDH3P3vRZXD3dRF8V2VTmqrrX/YI1JzmGPlZJq4iDEHWTI5yGIayXfGd5tPpMJuQ4dX+2HMIwvTPgKj8+jhwQkyBusTfrbv+oin9+tHeii0zPI5+JT8KmAY6Gq/vQ7B9NJppyTCtyiPOMQXrxrc5jkqy1fMUIjgFJE0i7ee4aX+paz22mKpZkA==; 5:p1N8Ox3XwvYm2yJYWv3FMY2/nPiV/iciBSrtfyIX5+wG80wx1DAJryT+U+xHrA3Be2Jsa+4iViL5cMGTcIKst1HCmtCJ+ABjXfvTXlCqjyp8HYzMb4GGHCGSEIw0tEUepHFeSVQY0y47v7QRVstNHCgI/SMcakP91DQoctbrIMI=; 7:sJanvrnlrCZZa/j1xuZjNRJEimqCkV73mNUAGGrWXuv5rgkUJTOsYyAht7RNaDufFPNpffHB6pxh1Ybbqo4T1fHIC6n46Kjx4mSVaeYwNu51B0afxtzq6EtGzitqzblZ0QPUHCDKg1Q1Q6lpR7O/zE2M3vjXf/6uyBuDAuoMhq5cr7uFA7WaeZTd1B08Ad7HUhAVhumSZAbgEIoAwQ0vKDrYWJabPCiddeJz77DI3iGCllNQh0Ip5hQUECGyX8Gs x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: 8c2b533a-bf91-446c-e4f3-08d627d77f8c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR08MB3493; x-ms-traffictypediagnostic: AM6PR08MB3493: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699)(131327999870524)(180628864354917); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051); SRVR:AM6PR08MB3493; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3493; x-forefront-prvs: 0812095267 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(396003)(366004)(136003)(13464003)(199004)(189003)(11346002)(71200400001)(446003)(6506007)(72206003)(53546011)(8676002)(81156014)(81166006)(33656002)(476003)(486006)(478600001)(26005)(186003)(71190400001)(106356001)(14454004)(97736004)(105586002)(229853002)(2900100001)(316002)(6436002)(102836004)(74316002)(68736007)(25786009)(66066001)(53946003)(53936002)(55016002)(4326008)(6246003)(5660300001)(14444005)(305945005)(86362001)(99286004)(8936002)(7696005)(2501003)(3846002)(256004)(76176011)(2906002)(5250100002)(9686003)(7736002)(6116002)(54906003)(110136005)(4744004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB3493; H:AM6PR08MB3672.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 149Pgo4JOUKL49SDeEEK0moMtKvmnrouYakeSV6j561XoF7rmQBsME/xBATlRUJienJgNevt5dJhBZn0+NAcQ5L5lq8v9ro9nlFOEglLpsRfqxoIgZO8uikBuGQB6xCRkDXkr6is1plwAguczAXSNCmw/Xac5/m14444OIt75OGyOO3h9e/NlayV9DE3uXkNBixPrkGz+i0+JL74cS4TP9gCprv7mzdb4K+Gn2ULkR7y+1YFsvap3XSFmC62+PU+EU9+SRYn+G0nFNENxSeBJM8EpVMC/WRwhDBtDgXbP2rCUjTvpXMeBsZb/rYKWE53NT7ECu+f653hQEHCHI/LOvdSitlsl6v5jCpbCvF4VuI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c2b533a-bf91-446c-e4f3-08d627d77f8c X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Oct 2018 19:53:03.0114 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3493 Subject: Re: [dpdk-dev] [PATCH v4 3/4] test/hash: implement extendable bucket hash test 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: Mon, 01 Oct 2018 19:53:04 -0000 > -----Original Message----- > From: Yipeng Wang > Sent: Friday, September 28, 2018 12:24 PM > To: bruce.richardson@intel.com > Cc: konstantin.ananyev@intel.com; dev@dpdk.org; yipeng1.wang@intel.com; > Honnappa Nagarahalli ; > sameh.gobriel@intel.com > Subject: [PATCH v4 3/4] test/hash: implement extendable bucket hash test >=20 > This commit changes the current rte_hash unit test to test the extendable > table feature and performance. >=20 > Signed-off-by: Yipeng Wang > --- > test/test/test_hash.c | 159 > +++++++++++++++++++++++++++++++++++++++++++-- > test/test/test_hash_perf.c | 114 +++++++++++++++++++++++--------- > 2 files changed, 238 insertions(+), 35 deletions(-) >=20 > diff --git a/test/test/test_hash.c b/test/test/test_hash.c index > b3db9fd..815c734 100644 > --- a/test/test/test_hash.c > +++ b/test/test/test_hash.c > @@ -660,6 +660,116 @@ static int test_full_bucket(void) > return 0; > } >=20 > +/* > + * Similar to the test above (full bucket test), but for extendable buck= ets. > + */ > +static int test_extendable_bucket(void) { > + struct rte_hash_parameters params_pseudo_hash =3D { > + .name =3D "test5", > + .entries =3D 64, > + .key_len =3D sizeof(struct flow_key), /* 13 */ > + .hash_func =3D pseudo_hash, > + .hash_func_init_val =3D 0, > + .socket_id =3D 0, > + .extra_flag =3D RTE_HASH_EXTRA_FLAGS_EXT_TABLE > + }; > + struct rte_hash *handle; > + int pos[64]; > + int expected_pos[64]; > + unsigned int i; > + struct flow_key rand_keys[64]; > + > + for (i =3D 0; i < 64; i++) { > + rand_keys[i].port_dst =3D i; > + rand_keys[i].port_src =3D i+1; > + } > + > + handle =3D rte_hash_create(¶ms_pseudo_hash); > + RETURN_IF_ERROR(handle =3D=3D NULL, "hash creation failed"); > + > + /* Fill bucket */ > + for (i =3D 0; i < 64; i++) { > + pos[i] =3D rte_hash_add_key(handle, &rand_keys[i]); > + print_key_info("Add", &rand_keys[i], pos[i]); > + RETURN_IF_ERROR(pos[i] < 0, > + "failed to add key (pos[%u]=3D%d)", i, pos[i]); > + expected_pos[i] =3D pos[i]; > + } > + > + /* Lookup */ > + for (i =3D 0; i < 64; i++) { > + pos[i] =3D rte_hash_lookup(handle, &rand_keys[i]); > + print_key_info("Lkp", &rand_keys[i], pos[i]); > + RETURN_IF_ERROR(pos[i] !=3D expected_pos[i], > + "failed to find key (pos[%u]=3D%d)", i, pos[i]); > + } > + > + /* Add - update */ > + for (i =3D 0; i < 64; i++) { > + pos[i] =3D rte_hash_add_key(handle, &rand_keys[i]); > + print_key_info("Add", &rand_keys[i], pos[i]); > + RETURN_IF_ERROR(pos[i] !=3D expected_pos[i], > + "failed to add key (pos[%u]=3D%d)", i, pos[i]); > + } > + > + /* Lookup */ > + for (i =3D 0; i < 64; i++) { > + pos[i] =3D rte_hash_lookup(handle, &rand_keys[i]); > + print_key_info("Lkp", &rand_keys[i], pos[i]); > + RETURN_IF_ERROR(pos[i] !=3D expected_pos[i], > + "failed to find key (pos[%u]=3D%d)", i, pos[i]); > + } > + > + /* Delete 1 key, check other keys are still found */ > + pos[35] =3D rte_hash_del_key(handle, &rand_keys[35]); > + print_key_info("Del", &rand_keys[35], pos[35]); > + RETURN_IF_ERROR(pos[35] !=3D expected_pos[35], > + "failed to delete key (pos[1]=3D%d)", pos[35]); > + pos[20] =3D rte_hash_lookup(handle, &rand_keys[20]); > + print_key_info("Lkp", &rand_keys[20], pos[20]); > + RETURN_IF_ERROR(pos[20] !=3D expected_pos[20], > + "failed lookup after deleting key from same bucket " > + "(pos[20]=3D%d)", pos[20]); > + > + /* Go back to previous state */ > + pos[35] =3D rte_hash_add_key(handle, &rand_keys[35]); > + print_key_info("Add", &rand_keys[35], pos[35]); > + expected_pos[35] =3D pos[35]; > + RETURN_IF_ERROR(pos[35] < 0, "failed to add key (pos[1]=3D%d)", > +pos[35]); > + > + /* Delete */ > + for (i =3D 0; i < 64; i++) { > + pos[i] =3D rte_hash_del_key(handle, &rand_keys[i]); > + print_key_info("Del", &rand_keys[i], pos[i]); > + RETURN_IF_ERROR(pos[i] !=3D expected_pos[i], > + "failed to delete key (pos[%u]=3D%d)", i, pos[i]); > + } > + > + /* Lookup */ > + for (i =3D 0; i < 64; i++) { > + pos[i] =3D rte_hash_lookup(handle, &rand_keys[i]); > + print_key_info("Lkp", &rand_keys[i], pos[i]); > + RETURN_IF_ERROR(pos[i] !=3D -ENOENT, > + "fail: found non-existent key (pos[%u]=3D%d)", i, pos[i]); > + } > + > + /* Add again */ > + for (i =3D 0; i < 64; i++) { > + pos[i] =3D rte_hash_add_key(handle, &rand_keys[i]); > + print_key_info("Add", &rand_keys[i], pos[i]); > + RETURN_IF_ERROR(pos[i] < 0, > + "failed to add key (pos[%u]=3D%d)", i, pos[i]); > + expected_pos[i] =3D pos[i]; > + } > + > + rte_hash_free(handle); > + > + /* Cover the NULL case. */ > + rte_hash_free(0); > + return 0; > +} > + >=20 > /***************************************************************** > *************/ > static int > fbk_hash_unit_test(void) > @@ -1096,7 +1206,7 @@ test_hash_creation_with_good_parameters(void) > * Test to see the average table utilization (entries added/max entries) > * before hitting a random entry that cannot be added > */ > -static int test_average_table_utilization(void) > +static int test_average_table_utilization(uint32_t ext_table) > { > struct rte_hash *handle; > uint8_t simple_key[MAX_KEYSIZE]; > @@ -1107,12 +1217,23 @@ static int test_average_table_utilization(void) >=20 > printf("\n# Running test to determine average utilization" > "\n before adding elements begins to fail\n"); > + if (ext_table) > + printf("ext table is enabled\n"); > + else > + printf("ext table is disabled\n"); > + > printf("Measuring performance, please wait"); > fflush(stdout); > ut_params.entries =3D 1 << 16; > ut_params.name =3D "test_average_utilization"; > ut_params.hash_func =3D rte_jhash; > + if (ext_table) > + ut_params.extra_flag |=3D > RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > + else > + ut_params.extra_flag &=3D > ~RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > + > handle =3D rte_hash_create(&ut_params); > + > RETURN_IF_ERROR(handle =3D=3D NULL, "hash creation failed"); >=20 > for (j =3D 0; j < ITERATIONS; j++) { > @@ -1139,6 +1260,14 @@ static int test_average_table_utilization(void) > rte_hash_free(handle); > return -1; > } > + if (ext_table) { > + if (cnt !=3D ut_params.entries) { > + printf("rte_hash_count returned wrong value > " > + "%u, %u, %u\n", j, added_keys, cnt); > + rte_hash_free(handle); > + return -1; > + } > + } >=20 > average_keys_added +=3D added_keys; >=20 > @@ -1161,7 +1290,7 @@ static int test_average_table_utilization(void) > } >=20 > #define NUM_ENTRIES 256 > -static int test_hash_iteration(void) > +static int test_hash_iteration(uint32_t ext_table) > { > struct rte_hash *handle; > unsigned i; > @@ -1177,6 +1306,11 @@ static int test_hash_iteration(void) > ut_params.name =3D "test_hash_iteration"; > ut_params.hash_func =3D rte_jhash; > ut_params.key_len =3D 16; > + if (ext_table) > + ut_params.extra_flag |=3D > RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > + else > + ut_params.extra_flag &=3D > ~RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > + > handle =3D rte_hash_create(&ut_params); > RETURN_IF_ERROR(handle =3D=3D NULL, "hash creation failed"); >=20 > @@ -1186,8 +1320,13 @@ static int test_hash_iteration(void) > for (i =3D 0; i < ut_params.key_len; i++) > keys[added_keys][i] =3D rte_rand() % 255; > ret =3D rte_hash_add_key_data(handle, keys[added_keys], > data[added_keys]); > - if (ret < 0) > + if (ret < 0) { > + if (ext_table) { > + printf("Insertion failed for ext table\n"); > + goto err; > + } > break; > + } > } >=20 > /* Iterate through the hash table */ > @@ -1474,6 +1613,8 @@ test_hash(void) > return -1; > if (test_full_bucket() < 0) > return -1; > + if (test_extendable_bucket() < 0) > + return -1; >=20 > if (test_fbk_hash_find_existing() < 0) > return -1; > @@ -1483,9 +1624,17 @@ test_hash(void) > return -1; > if (test_hash_creation_with_good_parameters() < 0) > return -1; > - if (test_average_table_utilization() < 0) > + > + /* ext table disabled */ > + if (test_average_table_utilization(0) < 0) > + return -1; > + if (test_hash_iteration(0) < 0) > + return -1; > + > + /* ext table enabled */ > + if (test_average_table_utilization(1) < 0) > return -1; > - if (test_hash_iteration() < 0) > + if (test_hash_iteration(1) < 0) > return -1; >=20 > run_hash_func_tests(); > diff --git a/test/test/test_hash_perf.c b/test/test/test_hash_perf.c inde= x > 0d39e10..5252111 100644 > --- a/test/test/test_hash_perf.c > +++ b/test/test/test_hash_perf.c > @@ -18,7 +18,8 @@ > #include "test.h" >=20 > #define MAX_ENTRIES (1 << 19) > -#define KEYS_TO_ADD (MAX_ENTRIES * 3 / 4) /* 75% table utilization */ > +#define KEYS_TO_ADD (MAX_ENTRIES) > +#define ADD_PERCENT 0.75 /* 75% table utilization */ > #define NUM_LOOKUPS (KEYS_TO_ADD * 5) /* Loop among keys added, > several times */ > /* BUCKET_SIZE should be same as RTE_HASH_BUCKET_ENTRIES in rte_hash > library */ #define BUCKET_SIZE 8 @@ -78,7 +79,7 @@ static struct > rte_hash_parameters ut_params =3D { >=20 > static int > create_table(unsigned int with_data, unsigned int table_index, > - unsigned int with_locks) > + unsigned int with_locks, unsigned int ext) > { > char name[RTE_HASH_NAMESIZE]; >=20 > @@ -96,6 +97,9 @@ create_table(unsigned int with_data, unsigned int > table_index, > else > ut_params.extra_flag =3D 0; >=20 > + if (ext) > + ut_params.extra_flag |=3D > RTE_HASH_EXTRA_FLAGS_EXT_TABLE; > + > ut_params.name =3D name; > ut_params.key_len =3D hashtest_key_lens[table_index]; > ut_params.socket_id =3D rte_socket_id(); @@ -117,15 +121,21 @@ > create_table(unsigned int with_data, unsigned int table_index, >=20 > /* Shuffle the keys that have been added, so lookups will be totally ran= dom */ > static void -shuffle_input_keys(unsigned table_index) > +shuffle_input_keys(unsigned int table_index, unsigned int ext) > { > unsigned i; > uint32_t swap_idx; > uint8_t temp_key[MAX_KEYSIZE]; > hash_sig_t temp_signature; > int32_t temp_position; > + unsigned int keys_to_add; > + > + if (!ext) > + keys_to_add =3D KEYS_TO_ADD * ADD_PERCENT; > + else > + keys_to_add =3D KEYS_TO_ADD; >=20 > - for (i =3D KEYS_TO_ADD - 1; i > 0; i--) { > + for (i =3D keys_to_add - 1; i > 0; i--) { > swap_idx =3D rte_rand() % i; >=20 > memcpy(temp_key, keys[i], hashtest_key_lens[table_index]); > @@ -147,14 +157,20 @@ shuffle_input_keys(unsigned table_index) > * ALL can fit in hash table (no errors) > */ > static int > -get_input_keys(unsigned with_pushes, unsigned table_index) > +get_input_keys(unsigned int with_pushes, unsigned int table_index, > + unsigned int ext) > { > unsigned i, j; > unsigned bucket_idx, incr, success =3D 1; > uint8_t k =3D 0; > int32_t ret; > const uint32_t bucket_bitmask =3D NUM_BUCKETS - 1; > + unsigned int keys_to_add; >=20 > + if (!ext) > + keys_to_add =3D KEYS_TO_ADD * ADD_PERCENT; > + else > + keys_to_add =3D KEYS_TO_ADD; > /* Reset all arrays */ > for (i =3D 0; i < MAX_ENTRIES; i++) > slot_taken[i] =3D 0; > @@ -171,7 +187,7 @@ get_input_keys(unsigned with_pushes, unsigned > table_index) > * Regardless a key has been added correctly or not (success), > * the next one to try will be increased by 1. > */ > - for (i =3D 0; i < KEYS_TO_ADD;) { > + for (i =3D 0; i < keys_to_add;) { > incr =3D 0; > if (i !=3D 0) { > keys[i][0] =3D ++k; > @@ -235,14 +251,20 @@ get_input_keys(unsigned with_pushes, unsigned > table_index) } >=20 > static int > -timed_adds(unsigned with_hash, unsigned with_data, unsigned table_index) > +timed_adds(unsigned int with_hash, unsigned int with_data, > + unsigned int table_index, unsigned int ext) > { > unsigned i; > const uint64_t start_tsc =3D rte_rdtsc(); > void *data; > int32_t ret; > + unsigned int keys_to_add; > + if (!ext) > + keys_to_add =3D KEYS_TO_ADD * ADD_PERCENT; > + else > + keys_to_add =3D KEYS_TO_ADD; >=20 > - for (i =3D 0; i < KEYS_TO_ADD; i++) { > + for (i =3D 0; i < keys_to_add; i++) { > data =3D (void *) ((uintptr_t) signatures[i]); > if (with_hash && with_data) { > ret =3D > rte_hash_add_key_with_hash_data(h[table_index], > @@ -284,22 +306,31 @@ timed_adds(unsigned with_hash, unsigned > with_data, unsigned table_index) > const uint64_t end_tsc =3D rte_rdtsc(); > const uint64_t time_taken =3D end_tsc - start_tsc; >=20 > - cycles[table_index][ADD][with_hash][with_data] =3D > time_taken/KEYS_TO_ADD; > + cycles[table_index][ADD][with_hash][with_data] =3D > +time_taken/keys_to_add; >=20 > return 0; > } >=20 > static int > -timed_lookups(unsigned with_hash, unsigned with_data, unsigned > table_index) > +timed_lookups(unsigned int with_hash, unsigned int with_data, > + unsigned int table_index, unsigned int ext) > { > unsigned i, j; > const uint64_t start_tsc =3D rte_rdtsc(); > void *ret_data; > void *expected_data; > int32_t ret; > - > - for (i =3D 0; i < NUM_LOOKUPS/KEYS_TO_ADD; i++) { > - for (j =3D 0; j < KEYS_TO_ADD; j++) { > + unsigned int keys_to_add, num_lookups; > + > + if (!ext) { > + keys_to_add =3D KEYS_TO_ADD * ADD_PERCENT; > + num_lookups =3D NUM_LOOKUPS * ADD_PERCENT; > + } else { > + keys_to_add =3D KEYS_TO_ADD; > + num_lookups =3D NUM_LOOKUPS; > + } > + for (i =3D 0; i < num_lookups / keys_to_add; i++) { > + for (j =3D 0; j < keys_to_add; j++) { > if (with_hash && with_data) { > ret =3D > rte_hash_lookup_with_hash_data(h[table_index], > (const void *) keys[j], > @@ -352,13 +383,14 @@ timed_lookups(unsigned with_hash, unsigned > with_data, unsigned table_index) > const uint64_t end_tsc =3D rte_rdtsc(); > const uint64_t time_taken =3D end_tsc - start_tsc; >=20 > - cycles[table_index][LOOKUP][with_hash][with_data] =3D > time_taken/NUM_LOOKUPS; > + cycles[table_index][LOOKUP][with_hash][with_data] =3D > +time_taken/num_lookups; >=20 > return 0; > } >=20 > static int > -timed_lookups_multi(unsigned with_data, unsigned table_index) > +timed_lookups_multi(unsigned int with_data, unsigned int table_index, > + unsigned int ext) > { > unsigned i, j, k; > int32_t positions_burst[BURST_SIZE]; > @@ -367,11 +399,20 @@ timed_lookups_multi(unsigned with_data, > unsigned table_index) > void *ret_data[BURST_SIZE]; > uint64_t hit_mask; > int ret; > + unsigned int keys_to_add, num_lookups; > + > + if (!ext) { > + keys_to_add =3D KEYS_TO_ADD * ADD_PERCENT; > + num_lookups =3D NUM_LOOKUPS * ADD_PERCENT; > + } else { > + keys_to_add =3D KEYS_TO_ADD; > + num_lookups =3D NUM_LOOKUPS; > + } >=20 > const uint64_t start_tsc =3D rte_rdtsc(); >=20 > - for (i =3D 0; i < NUM_LOOKUPS/KEYS_TO_ADD; i++) { > - for (j =3D 0; j < KEYS_TO_ADD/BURST_SIZE; j++) { > + for (i =3D 0; i < num_lookups/keys_to_add; i++) { > + for (j =3D 0; j < keys_to_add/BURST_SIZE; j++) { > for (k =3D 0; k < BURST_SIZE; k++) > keys_burst[k] =3D keys[j * BURST_SIZE + k]; > if (with_data) { > @@ -419,19 +460,25 @@ timed_lookups_multi(unsigned with_data, > unsigned table_index) > const uint64_t end_tsc =3D rte_rdtsc(); > const uint64_t time_taken =3D end_tsc - start_tsc; >=20 > - cycles[table_index][LOOKUP_MULTI][0][with_data] =3D > time_taken/NUM_LOOKUPS; > + cycles[table_index][LOOKUP_MULTI][0][with_data] =3D > +time_taken/num_lookups; >=20 > return 0; > } >=20 > static int > -timed_deletes(unsigned with_hash, unsigned with_data, unsigned > table_index) > +timed_deletes(unsigned int with_hash, unsigned int with_data, > + unsigned int table_index, unsigned int ext) > { > unsigned i; > const uint64_t start_tsc =3D rte_rdtsc(); > int32_t ret; > + unsigned int keys_to_add; > + if (!ext) > + keys_to_add =3D KEYS_TO_ADD * ADD_PERCENT; > + else > + keys_to_add =3D KEYS_TO_ADD; >=20 > - for (i =3D 0; i < KEYS_TO_ADD; i++) { > + for (i =3D 0; i < keys_to_add; i++) { > /* There are no delete functions with data, so just call two > functions */ > if (with_hash) > ret =3D rte_hash_del_key_with_hash(h[table_index], > @@ -451,7 +498,7 @@ timed_deletes(unsigned with_hash, unsigned > with_data, unsigned table_index) > const uint64_t end_tsc =3D rte_rdtsc(); > const uint64_t time_taken =3D end_tsc - start_tsc; >=20 > - cycles[table_index][DELETE][with_hash][with_data] =3D > time_taken/KEYS_TO_ADD; > + cycles[table_index][DELETE][with_hash][with_data] =3D > +time_taken/keys_to_add; >=20 > return 0; > } > @@ -469,7 +516,8 @@ reset_table(unsigned table_index) } >=20 > static int > -run_all_tbl_perf_tests(unsigned int with_pushes, unsigned int with_locks= ) > +run_all_tbl_perf_tests(unsigned int with_pushes, unsigned int with_locks= , > + unsigned int ext) > { > unsigned i, j, with_data, with_hash; >=20 > @@ -478,25 +526,25 @@ run_all_tbl_perf_tests(unsigned int with_pushes, > unsigned int with_locks) >=20 > for (with_data =3D 0; with_data <=3D 1; with_data++) { > for (i =3D 0; i < NUM_KEYSIZES; i++) { > - if (create_table(with_data, i, with_locks) < 0) > + if (create_table(with_data, i, with_locks, ext) < 0) > return -1; >=20 > - if (get_input_keys(with_pushes, i) < 0) > + if (get_input_keys(with_pushes, i, ext) < 0) > return -1; > for (with_hash =3D 0; with_hash <=3D 1; with_hash++) { > - if (timed_adds(with_hash, with_data, i) < 0) > + if (timed_adds(with_hash, with_data, i, ext) < > 0) > return -1; >=20 > for (j =3D 0; j < NUM_SHUFFLES; j++) > - shuffle_input_keys(i); > + shuffle_input_keys(i, ext); >=20 > - if (timed_lookups(with_hash, with_data, i) < 0) > + if (timed_lookups(with_hash, with_data, i, ext) > < 0) > return -1; >=20 > - if (timed_lookups_multi(with_data, i) < 0) > + if (timed_lookups_multi(with_data, i, ext) < 0) > return -1; >=20 > - if (timed_deletes(with_hash, with_data, i) < 0) > + if (timed_deletes(with_hash, with_data, i, ext) > < 0) > return -1; >=20 > /* Print a dot to show progress on operations > */ @@ -632,10 +680,16 @@ test_hash_perf(void) > printf("\nALL ELEMENTS IN PRIMARY > LOCATION\n"); > else > printf("\nELEMENTS IN PRIMARY OR > SECONDARY LOCATION\n"); > - if (run_all_tbl_perf_tests(with_pushes, with_locks) < > 0) > + if (run_all_tbl_perf_tests(with_pushes, with_locks, 0) > < 0) > return -1; > } > } > + > + printf("\n EXTENDABLE BUCKETS PERFORMANCE\n"); > + > + if (run_all_tbl_perf_tests(1, 0, 1) < 0) > + return -1; > + > if (fbk_hash_perf_test() < 0) > return -1; >=20 > -- > 2.7.4 Reviewed-by: Honnappa Nagarahalli