get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/45622/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 45622,
    "url": "http://patches.dpdk.org/api/patches/45622/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1538155426-145177-4-git-send-email-yipeng1.wang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1538155426-145177-4-git-send-email-yipeng1.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1538155426-145177-4-git-send-email-yipeng1.wang@intel.com",
    "date": "2018-09-28T17:23:45",
    "name": "[v4,3/4] test/hash: implement extendable bucket hash test",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "99dc6c9450c8b19c3c0c0ebce2d8a0a9d060acbf",
    "submitter": {
        "id": 754,
        "url": "http://patches.dpdk.org/api/people/754/?format=api",
        "name": "Wang, Yipeng1",
        "email": "yipeng1.wang@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1538155426-145177-4-git-send-email-yipeng1.wang@intel.com/mbox/",
    "series": [
        {
            "id": 1589,
            "url": "http://patches.dpdk.org/api/series/1589/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1589",
            "date": "2018-09-28T17:23:42",
            "name": "hash: add extendable bucket and partial key hashing",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/1589/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/45622/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/45622/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 91B151B143;\n\tSat, 29 Sep 2018 02:29:01 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id B259B1B10C\n\tfor <dev@dpdk.org>; Sat, 29 Sep 2018 02:28:50 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Sep 2018 17:28:48 -0700",
            "from skx-yipeng.jf.intel.com ([10.54.81.175])\n\tby orsmga008.jf.intel.com with ESMTP; 28 Sep 2018 17:28:46 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.54,317,1534834800\"; d=\"scan'208\";a=\"77286781\"",
        "From": "Yipeng Wang <yipeng1.wang@intel.com>",
        "To": "bruce.richardson@intel.com",
        "Cc": "konstantin.ananyev@intel.com, dev@dpdk.org, yipeng1.wang@intel.com,\n\thonnappa.nagarahalli@arm.com, sameh.gobriel@intel.com",
        "Date": "Fri, 28 Sep 2018 10:23:45 -0700",
        "Message-Id": "<1538155426-145177-4-git-send-email-yipeng1.wang@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1538155426-145177-1-git-send-email-yipeng1.wang@intel.com>",
        "References": "<1537993618-92630-1-git-send-email-yipeng1.wang@intel.com>\n\t<1538155426-145177-1-git-send-email-yipeng1.wang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4 3/4] test/hash: implement extendable bucket\n\thash test",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This commit changes the current rte_hash unit test to\ntest the extendable table feature and performance.\n\nSigned-off-by: Yipeng Wang <yipeng1.wang@intel.com>\n---\n test/test/test_hash.c      | 159 +++++++++++++++++++++++++++++++++++++++++++--\n test/test/test_hash_perf.c | 114 +++++++++++++++++++++++---------\n 2 files changed, 238 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/test/test/test_hash.c b/test/test/test_hash.c\nindex b3db9fd..815c734 100644\n--- a/test/test/test_hash.c\n+++ b/test/test/test_hash.c\n@@ -660,6 +660,116 @@ static int test_full_bucket(void)\n \treturn 0;\n }\n \n+/*\n+ * Similar to the test above (full bucket test), but for extendable buckets.\n+ */\n+static int test_extendable_bucket(void)\n+{\n+\tstruct rte_hash_parameters params_pseudo_hash = {\n+\t\t.name = \"test5\",\n+\t\t.entries = 64,\n+\t\t.key_len = sizeof(struct flow_key), /* 13 */\n+\t\t.hash_func = pseudo_hash,\n+\t\t.hash_func_init_val = 0,\n+\t\t.socket_id = 0,\n+\t\t.extra_flag = RTE_HASH_EXTRA_FLAGS_EXT_TABLE\n+\t};\n+\tstruct rte_hash *handle;\n+\tint pos[64];\n+\tint expected_pos[64];\n+\tunsigned int i;\n+\tstruct flow_key rand_keys[64];\n+\n+\tfor (i = 0; i < 64; i++) {\n+\t\trand_keys[i].port_dst = i;\n+\t\trand_keys[i].port_src = i+1;\n+\t}\n+\n+\thandle = rte_hash_create(&params_pseudo_hash);\n+\tRETURN_IF_ERROR(handle == NULL, \"hash creation failed\");\n+\n+\t/* Fill bucket */\n+\tfor (i = 0; i < 64; i++) {\n+\t\tpos[i] = rte_hash_add_key(handle, &rand_keys[i]);\n+\t\tprint_key_info(\"Add\", &rand_keys[i], pos[i]);\n+\t\tRETURN_IF_ERROR(pos[i] < 0,\n+\t\t\t\"failed to add key (pos[%u]=%d)\", i, pos[i]);\n+\t\texpected_pos[i] = pos[i];\n+\t}\n+\n+\t/* Lookup */\n+\tfor (i = 0; i < 64; i++) {\n+\t\tpos[i] = rte_hash_lookup(handle, &rand_keys[i]);\n+\t\tprint_key_info(\"Lkp\", &rand_keys[i], pos[i]);\n+\t\tRETURN_IF_ERROR(pos[i] != expected_pos[i],\n+\t\t\t\"failed to find key (pos[%u]=%d)\", i, pos[i]);\n+\t}\n+\n+\t/* Add - update */\n+\tfor (i = 0; i < 64; i++) {\n+\t\tpos[i] = rte_hash_add_key(handle, &rand_keys[i]);\n+\t\tprint_key_info(\"Add\", &rand_keys[i], pos[i]);\n+\t\tRETURN_IF_ERROR(pos[i] != expected_pos[i],\n+\t\t\t\"failed to add key (pos[%u]=%d)\", i, pos[i]);\n+\t}\n+\n+\t/* Lookup */\n+\tfor (i = 0; i < 64; i++) {\n+\t\tpos[i] = rte_hash_lookup(handle, &rand_keys[i]);\n+\t\tprint_key_info(\"Lkp\", &rand_keys[i], pos[i]);\n+\t\tRETURN_IF_ERROR(pos[i] != expected_pos[i],\n+\t\t\t\"failed to find key (pos[%u]=%d)\", i, pos[i]);\n+\t}\n+\n+\t/* Delete 1 key, check other keys are still found */\n+\tpos[35] = rte_hash_del_key(handle, &rand_keys[35]);\n+\tprint_key_info(\"Del\", &rand_keys[35], pos[35]);\n+\tRETURN_IF_ERROR(pos[35] != expected_pos[35],\n+\t\t\t\"failed to delete key (pos[1]=%d)\", pos[35]);\n+\tpos[20] = rte_hash_lookup(handle, &rand_keys[20]);\n+\tprint_key_info(\"Lkp\", &rand_keys[20], pos[20]);\n+\tRETURN_IF_ERROR(pos[20] != expected_pos[20],\n+\t\t\t\"failed lookup after deleting key from same bucket \"\n+\t\t\t\"(pos[20]=%d)\", pos[20]);\n+\n+\t/* Go back to previous state */\n+\tpos[35] = rte_hash_add_key(handle, &rand_keys[35]);\n+\tprint_key_info(\"Add\", &rand_keys[35], pos[35]);\n+\texpected_pos[35] = pos[35];\n+\tRETURN_IF_ERROR(pos[35] < 0, \"failed to add key (pos[1]=%d)\", pos[35]);\n+\n+\t/* Delete */\n+\tfor (i = 0; i < 64; i++) {\n+\t\tpos[i] = rte_hash_del_key(handle, &rand_keys[i]);\n+\t\tprint_key_info(\"Del\", &rand_keys[i], pos[i]);\n+\t\tRETURN_IF_ERROR(pos[i] != expected_pos[i],\n+\t\t\t\"failed to delete key (pos[%u]=%d)\", i, pos[i]);\n+\t}\n+\n+\t/* Lookup */\n+\tfor (i = 0; i < 64; i++) {\n+\t\tpos[i] = rte_hash_lookup(handle, &rand_keys[i]);\n+\t\tprint_key_info(\"Lkp\", &rand_keys[i], pos[i]);\n+\t\tRETURN_IF_ERROR(pos[i] != -ENOENT,\n+\t\t\t\"fail: found non-existent key (pos[%u]=%d)\", i, pos[i]);\n+\t}\n+\n+\t/* Add again */\n+\tfor (i = 0; i < 64; i++) {\n+\t\tpos[i] = rte_hash_add_key(handle, &rand_keys[i]);\n+\t\tprint_key_info(\"Add\", &rand_keys[i], pos[i]);\n+\t\tRETURN_IF_ERROR(pos[i] < 0,\n+\t\t\t\"failed to add key (pos[%u]=%d)\", i, pos[i]);\n+\t\texpected_pos[i] = pos[i];\n+\t}\n+\n+\trte_hash_free(handle);\n+\n+\t/* Cover the NULL case. */\n+\trte_hash_free(0);\n+\treturn 0;\n+}\n+\n /******************************************************************************/\n static int\n fbk_hash_unit_test(void)\n@@ -1096,7 +1206,7 @@ test_hash_creation_with_good_parameters(void)\n  * Test to see the average table utilization (entries added/max entries)\n  * before hitting a random entry that cannot be added\n  */\n-static int test_average_table_utilization(void)\n+static int test_average_table_utilization(uint32_t ext_table)\n {\n \tstruct rte_hash *handle;\n \tuint8_t simple_key[MAX_KEYSIZE];\n@@ -1107,12 +1217,23 @@ static int test_average_table_utilization(void)\n \n \tprintf(\"\\n# Running test to determine average utilization\"\n \t       \"\\n  before adding elements begins to fail\\n\");\n+\tif (ext_table)\n+\t\tprintf(\"ext table is enabled\\n\");\n+\telse\n+\t\tprintf(\"ext table is disabled\\n\");\n+\n \tprintf(\"Measuring performance, please wait\");\n \tfflush(stdout);\n \tut_params.entries = 1 << 16;\n \tut_params.name = \"test_average_utilization\";\n \tut_params.hash_func = rte_jhash;\n+\tif (ext_table)\n+\t\tut_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE;\n+\telse\n+\t\tut_params.extra_flag &= ~RTE_HASH_EXTRA_FLAGS_EXT_TABLE;\n+\n \thandle = rte_hash_create(&ut_params);\n+\n \tRETURN_IF_ERROR(handle == NULL, \"hash creation failed\");\n \n \tfor (j = 0; j < ITERATIONS; j++) {\n@@ -1139,6 +1260,14 @@ static int test_average_table_utilization(void)\n \t\t\trte_hash_free(handle);\n \t\t\treturn -1;\n \t\t}\n+\t\tif (ext_table) {\n+\t\t\tif (cnt != ut_params.entries) {\n+\t\t\t\tprintf(\"rte_hash_count returned wrong value \"\n+\t\t\t\t\t\"%u, %u, %u\\n\", j, added_keys, cnt);\n+\t\t\t\trte_hash_free(handle);\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n \n \t\taverage_keys_added += added_keys;\n \n@@ -1161,7 +1290,7 @@ static int test_average_table_utilization(void)\n }\n \n #define NUM_ENTRIES 256\n-static int test_hash_iteration(void)\n+static int test_hash_iteration(uint32_t ext_table)\n {\n \tstruct rte_hash *handle;\n \tunsigned i;\n@@ -1177,6 +1306,11 @@ static int test_hash_iteration(void)\n \tut_params.name = \"test_hash_iteration\";\n \tut_params.hash_func = rte_jhash;\n \tut_params.key_len = 16;\n+\tif (ext_table)\n+\t\tut_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE;\n+\telse\n+\t\tut_params.extra_flag &= ~RTE_HASH_EXTRA_FLAGS_EXT_TABLE;\n+\n \thandle = rte_hash_create(&ut_params);\n \tRETURN_IF_ERROR(handle == NULL, \"hash creation failed\");\n \n@@ -1186,8 +1320,13 @@ static int test_hash_iteration(void)\n \t\tfor (i = 0; i < ut_params.key_len; i++)\n \t\t\tkeys[added_keys][i] = rte_rand() % 255;\n \t\tret = rte_hash_add_key_data(handle, keys[added_keys], data[added_keys]);\n-\t\tif (ret < 0)\n+\t\tif (ret < 0) {\n+\t\t\tif (ext_table) {\n+\t\t\t\tprintf(\"Insertion failed for ext table\\n\");\n+\t\t\t\tgoto err;\n+\t\t\t}\n \t\t\tbreak;\n+\t\t}\n \t}\n \n \t/* Iterate through the hash table */\n@@ -1474,6 +1613,8 @@ test_hash(void)\n \t\treturn -1;\n \tif (test_full_bucket() < 0)\n \t\treturn -1;\n+\tif (test_extendable_bucket() < 0)\n+\t\treturn -1;\n \n \tif (test_fbk_hash_find_existing() < 0)\n \t\treturn -1;\n@@ -1483,9 +1624,17 @@ test_hash(void)\n \t\treturn -1;\n \tif (test_hash_creation_with_good_parameters() < 0)\n \t\treturn -1;\n-\tif (test_average_table_utilization() < 0)\n+\n+\t/* ext table disabled */\n+\tif (test_average_table_utilization(0) < 0)\n+\t\treturn -1;\n+\tif (test_hash_iteration(0) < 0)\n+\t\treturn -1;\n+\n+\t/* ext table enabled */\n+\tif (test_average_table_utilization(1) < 0)\n \t\treturn -1;\n-\tif (test_hash_iteration() < 0)\n+\tif (test_hash_iteration(1) < 0)\n \t\treturn -1;\n \n \trun_hash_func_tests();\ndiff --git a/test/test/test_hash_perf.c b/test/test/test_hash_perf.c\nindex 0d39e10..5252111 100644\n--- a/test/test/test_hash_perf.c\n+++ b/test/test/test_hash_perf.c\n@@ -18,7 +18,8 @@\n #include \"test.h\"\n \n #define MAX_ENTRIES (1 << 19)\n-#define KEYS_TO_ADD (MAX_ENTRIES * 3 / 4) /* 75% table utilization */\n+#define KEYS_TO_ADD (MAX_ENTRIES)\n+#define ADD_PERCENT 0.75 /* 75% table utilization */\n #define NUM_LOOKUPS (KEYS_TO_ADD * 5) /* Loop among keys added, several times */\n /* BUCKET_SIZE should be same as RTE_HASH_BUCKET_ENTRIES in rte_hash library */\n #define BUCKET_SIZE 8\n@@ -78,7 +79,7 @@ static struct rte_hash_parameters ut_params = {\n \n static int\n create_table(unsigned int with_data, unsigned int table_index,\n-\t\tunsigned int with_locks)\n+\t\tunsigned int with_locks, unsigned int ext)\n {\n \tchar name[RTE_HASH_NAMESIZE];\n \n@@ -96,6 +97,9 @@ create_table(unsigned int with_data, unsigned int table_index,\n \telse\n \t\tut_params.extra_flag = 0;\n \n+\tif (ext)\n+\t\tut_params.extra_flag |= RTE_HASH_EXTRA_FLAGS_EXT_TABLE;\n+\n \tut_params.name = name;\n \tut_params.key_len = hashtest_key_lens[table_index];\n \tut_params.socket_id = rte_socket_id();\n@@ -117,15 +121,21 @@ create_table(unsigned int with_data, unsigned int table_index,\n \n /* Shuffle the keys that have been added, so lookups will be totally random */\n static void\n-shuffle_input_keys(unsigned table_index)\n+shuffle_input_keys(unsigned int table_index, unsigned int ext)\n {\n \tunsigned i;\n \tuint32_t swap_idx;\n \tuint8_t temp_key[MAX_KEYSIZE];\n \thash_sig_t temp_signature;\n \tint32_t temp_position;\n+\tunsigned int keys_to_add;\n+\n+\tif (!ext)\n+\t\tkeys_to_add = KEYS_TO_ADD * ADD_PERCENT;\n+\telse\n+\t\tkeys_to_add = KEYS_TO_ADD;\n \n-\tfor (i = KEYS_TO_ADD - 1; i > 0; i--) {\n+\tfor (i = keys_to_add - 1; i > 0; i--) {\n \t\tswap_idx = rte_rand() % i;\n \n \t\tmemcpy(temp_key, keys[i], hashtest_key_lens[table_index]);\n@@ -147,14 +157,20 @@ shuffle_input_keys(unsigned table_index)\n  * ALL can fit in hash table (no errors)\n  */\n static int\n-get_input_keys(unsigned with_pushes, unsigned table_index)\n+get_input_keys(unsigned int with_pushes, unsigned int table_index,\n+\t\t\t\t\t\t\tunsigned int ext)\n {\n \tunsigned i, j;\n \tunsigned bucket_idx, incr, success = 1;\n \tuint8_t k = 0;\n \tint32_t ret;\n \tconst uint32_t bucket_bitmask = NUM_BUCKETS - 1;\n+\tunsigned int keys_to_add;\n \n+\tif (!ext)\n+\t\tkeys_to_add = KEYS_TO_ADD * ADD_PERCENT;\n+\telse\n+\t\tkeys_to_add = KEYS_TO_ADD;\n \t/* Reset all arrays */\n \tfor (i = 0; i < MAX_ENTRIES; i++)\n \t\tslot_taken[i] = 0;\n@@ -171,7 +187,7 @@ get_input_keys(unsigned with_pushes, unsigned table_index)\n \t * Regardless a key has been added correctly or not (success),\n \t * the next one to try will be increased by 1.\n \t */\n-\tfor (i = 0; i < KEYS_TO_ADD;) {\n+\tfor (i = 0; i < keys_to_add;) {\n \t\tincr = 0;\n \t\tif (i != 0) {\n \t\t\tkeys[i][0] = ++k;\n@@ -235,14 +251,20 @@ get_input_keys(unsigned with_pushes, unsigned table_index)\n }\n \n static int\n-timed_adds(unsigned with_hash, unsigned with_data, unsigned table_index)\n+timed_adds(unsigned int with_hash, unsigned int with_data,\n+\t\t\t\tunsigned int table_index, unsigned int ext)\n {\n \tunsigned i;\n \tconst uint64_t start_tsc = rte_rdtsc();\n \tvoid *data;\n \tint32_t ret;\n+\tunsigned int keys_to_add;\n+\tif (!ext)\n+\t\tkeys_to_add = KEYS_TO_ADD * ADD_PERCENT;\n+\telse\n+\t\tkeys_to_add = KEYS_TO_ADD;\n \n-\tfor (i = 0; i < KEYS_TO_ADD; i++) {\n+\tfor (i = 0; i < keys_to_add; i++) {\n \t\tdata = (void *) ((uintptr_t) signatures[i]);\n \t\tif (with_hash && with_data) {\n \t\t\tret = rte_hash_add_key_with_hash_data(h[table_index],\n@@ -284,22 +306,31 @@ timed_adds(unsigned with_hash, unsigned with_data, unsigned table_index)\n \tconst uint64_t end_tsc = rte_rdtsc();\n \tconst uint64_t time_taken = end_tsc - start_tsc;\n \n-\tcycles[table_index][ADD][with_hash][with_data] = time_taken/KEYS_TO_ADD;\n+\tcycles[table_index][ADD][with_hash][with_data] = time_taken/keys_to_add;\n \n \treturn 0;\n }\n \n static int\n-timed_lookups(unsigned with_hash, unsigned with_data, unsigned table_index)\n+timed_lookups(unsigned int with_hash, unsigned int with_data,\n+\t\t\t\tunsigned int table_index, unsigned int ext)\n {\n \tunsigned i, j;\n \tconst uint64_t start_tsc = rte_rdtsc();\n \tvoid *ret_data;\n \tvoid *expected_data;\n \tint32_t ret;\n-\n-\tfor (i = 0; i < NUM_LOOKUPS/KEYS_TO_ADD; i++) {\n-\t\tfor (j = 0; j < KEYS_TO_ADD; j++) {\n+\tunsigned int keys_to_add, num_lookups;\n+\n+\tif (!ext) {\n+\t\tkeys_to_add = KEYS_TO_ADD * ADD_PERCENT;\n+\t\tnum_lookups = NUM_LOOKUPS * ADD_PERCENT;\n+\t} else {\n+\t\tkeys_to_add = KEYS_TO_ADD;\n+\t\tnum_lookups = NUM_LOOKUPS;\n+\t}\n+\tfor (i = 0; i < num_lookups / keys_to_add; i++) {\n+\t\tfor (j = 0; j < keys_to_add; j++) {\n \t\t\tif (with_hash && with_data) {\n \t\t\t\tret = rte_hash_lookup_with_hash_data(h[table_index],\n \t\t\t\t\t\t\t(const void *) keys[j],\n@@ -352,13 +383,14 @@ timed_lookups(unsigned with_hash, unsigned with_data, unsigned table_index)\n \tconst uint64_t end_tsc = rte_rdtsc();\n \tconst uint64_t time_taken = end_tsc - start_tsc;\n \n-\tcycles[table_index][LOOKUP][with_hash][with_data] = time_taken/NUM_LOOKUPS;\n+\tcycles[table_index][LOOKUP][with_hash][with_data] = time_taken/num_lookups;\n \n \treturn 0;\n }\n \n static int\n-timed_lookups_multi(unsigned with_data, unsigned table_index)\n+timed_lookups_multi(unsigned int with_data, unsigned int table_index,\n+\t\t\t\t\t\t\tunsigned int ext)\n {\n \tunsigned i, j, k;\n \tint32_t positions_burst[BURST_SIZE];\n@@ -367,11 +399,20 @@ timed_lookups_multi(unsigned with_data, unsigned table_index)\n \tvoid *ret_data[BURST_SIZE];\n \tuint64_t hit_mask;\n \tint ret;\n+\tunsigned int keys_to_add, num_lookups;\n+\n+\tif (!ext) {\n+\t\tkeys_to_add = KEYS_TO_ADD * ADD_PERCENT;\n+\t\tnum_lookups = NUM_LOOKUPS * ADD_PERCENT;\n+\t} else {\n+\t\tkeys_to_add = KEYS_TO_ADD;\n+\t\tnum_lookups = NUM_LOOKUPS;\n+\t}\n \n \tconst uint64_t start_tsc = rte_rdtsc();\n \n-\tfor (i = 0; i < NUM_LOOKUPS/KEYS_TO_ADD; i++) {\n-\t\tfor (j = 0; j < KEYS_TO_ADD/BURST_SIZE; j++) {\n+\tfor (i = 0; i < num_lookups/keys_to_add; i++) {\n+\t\tfor (j = 0; j < keys_to_add/BURST_SIZE; j++) {\n \t\t\tfor (k = 0; k < BURST_SIZE; k++)\n \t\t\t\tkeys_burst[k] = keys[j * BURST_SIZE + k];\n \t\t\tif (with_data) {\n@@ -419,19 +460,25 @@ timed_lookups_multi(unsigned with_data, unsigned table_index)\n \tconst uint64_t end_tsc = rte_rdtsc();\n \tconst uint64_t time_taken = end_tsc - start_tsc;\n \n-\tcycles[table_index][LOOKUP_MULTI][0][with_data] = time_taken/NUM_LOOKUPS;\n+\tcycles[table_index][LOOKUP_MULTI][0][with_data] = time_taken/num_lookups;\n \n \treturn 0;\n }\n \n static int\n-timed_deletes(unsigned with_hash, unsigned with_data, unsigned table_index)\n+timed_deletes(unsigned int with_hash, unsigned int with_data,\n+\t\t\t\tunsigned int table_index, unsigned int ext)\n {\n \tunsigned i;\n \tconst uint64_t start_tsc = rte_rdtsc();\n \tint32_t ret;\n+\tunsigned int keys_to_add;\n+\tif (!ext)\n+\t\tkeys_to_add = KEYS_TO_ADD * ADD_PERCENT;\n+\telse\n+\t\tkeys_to_add = KEYS_TO_ADD;\n \n-\tfor (i = 0; i < KEYS_TO_ADD; i++) {\n+\tfor (i = 0; i < keys_to_add; i++) {\n \t\t/* There are no delete functions with data, so just call two functions */\n \t\tif (with_hash)\n \t\t\tret = rte_hash_del_key_with_hash(h[table_index],\n@@ -451,7 +498,7 @@ timed_deletes(unsigned with_hash, unsigned with_data, unsigned table_index)\n \tconst uint64_t end_tsc = rte_rdtsc();\n \tconst uint64_t time_taken = end_tsc - start_tsc;\n \n-\tcycles[table_index][DELETE][with_hash][with_data] = time_taken/KEYS_TO_ADD;\n+\tcycles[table_index][DELETE][with_hash][with_data] = time_taken/keys_to_add;\n \n \treturn 0;\n }\n@@ -469,7 +516,8 @@ reset_table(unsigned table_index)\n }\n \n static int\n-run_all_tbl_perf_tests(unsigned int with_pushes, unsigned int with_locks)\n+run_all_tbl_perf_tests(unsigned int with_pushes, unsigned int with_locks,\n+\t\t\t\t\t\tunsigned int ext)\n {\n \tunsigned i, j, with_data, with_hash;\n \n@@ -478,25 +526,25 @@ run_all_tbl_perf_tests(unsigned int with_pushes, unsigned int with_locks)\n \n \tfor (with_data = 0; with_data <= 1; with_data++) {\n \t\tfor (i = 0; i < NUM_KEYSIZES; i++) {\n-\t\t\tif (create_table(with_data, i, with_locks) < 0)\n+\t\t\tif (create_table(with_data, i, with_locks, ext) < 0)\n \t\t\t\treturn -1;\n \n-\t\t\tif (get_input_keys(with_pushes, i) < 0)\n+\t\t\tif (get_input_keys(with_pushes, i, ext) < 0)\n \t\t\t\treturn -1;\n \t\t\tfor (with_hash = 0; with_hash <= 1; with_hash++) {\n-\t\t\t\tif (timed_adds(with_hash, with_data, i) < 0)\n+\t\t\t\tif (timed_adds(with_hash, with_data, i, ext) < 0)\n \t\t\t\t\treturn -1;\n \n \t\t\t\tfor (j = 0; j < NUM_SHUFFLES; j++)\n-\t\t\t\t\tshuffle_input_keys(i);\n+\t\t\t\t\tshuffle_input_keys(i, ext);\n \n-\t\t\t\tif (timed_lookups(with_hash, with_data, i) < 0)\n+\t\t\t\tif (timed_lookups(with_hash, with_data, i, ext) < 0)\n \t\t\t\t\treturn -1;\n \n-\t\t\t\tif (timed_lookups_multi(with_data, i) < 0)\n+\t\t\t\tif (timed_lookups_multi(with_data, i, ext) < 0)\n \t\t\t\t\treturn -1;\n \n-\t\t\t\tif (timed_deletes(with_hash, with_data, i) < 0)\n+\t\t\t\tif (timed_deletes(with_hash, with_data, i, ext) < 0)\n \t\t\t\t\treturn -1;\n \n \t\t\t\t/* Print a dot to show progress on operations */\n@@ -632,10 +680,16 @@ test_hash_perf(void)\n \t\t\t\tprintf(\"\\nALL ELEMENTS IN PRIMARY LOCATION\\n\");\n \t\t\telse\n \t\t\t\tprintf(\"\\nELEMENTS IN PRIMARY OR SECONDARY LOCATION\\n\");\n-\t\t\tif (run_all_tbl_perf_tests(with_pushes, with_locks) < 0)\n+\t\t\tif (run_all_tbl_perf_tests(with_pushes, with_locks, 0) < 0)\n \t\t\t\treturn -1;\n \t\t}\n \t}\n+\n+\tprintf(\"\\n EXTENDABLE BUCKETS PERFORMANCE\\n\");\n+\n+\tif (run_all_tbl_perf_tests(1, 0, 1) < 0)\n+\t\treturn -1;\n+\n \tif (fbk_hash_perf_test() < 0)\n \t\treturn -1;\n \n",
    "prefixes": [
        "v4",
        "3/4"
    ]
}