Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/5802/?format=api
http://patches.dpdk.org/api/patches/5802/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1435269919-7007-8-git-send-email-pablo.de.lara.guarch@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": "<1435269919-7007-8-git-send-email-pablo.de.lara.guarch@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1435269919-7007-8-git-send-email-pablo.de.lara.guarch@intel.com", "date": "2015-06-25T22:05:15", "name": "[dpdk-dev,v2,07/11] hash: add new function rte_hash_reset", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "8483e099eb5378ac916e77d4f24c3de798ddd783", "submitter": { "id": 9, "url": "http://patches.dpdk.org/api/people/9/?format=api", "name": "De Lara Guarch, Pablo", "email": "pablo.de.lara.guarch@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1435269919-7007-8-git-send-email-pablo.de.lara.guarch@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/5802/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/5802/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 91046C786;\n\tFri, 26 Jun 2015 00:08:37 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id D506DC762\n\tfor <dev@dpdk.org>; Fri, 26 Jun 2015 00:08:33 +0200 (CEST)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga101.jf.intel.com with ESMTP; 25 Jun 2015 15:08:31 -0700", "from msvmon001.ims.intel.com ([10.125.148.15])\n\tby fmsmga002.fm.intel.com with ESMTP; 25 Jun 2015 15:08:30 -0700", "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\n\t[10.237.217.46])\n\tby msvmon001.ims.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tt5PM8TWb028739; Fri, 26 Jun 2015 01:08:29 +0300", "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev02.ir.intel.com with ESMTP id t5PM5KOw007096;\n\tThu, 25 Jun 2015 23:05:20 +0100", "(from pdelarax@localhost)\n\tby sivswdev02.ir.intel.com with id t5PM5Kkd007092;\n\tThu, 25 Jun 2015 23:05:20 +0100" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.13,680,1427785200\"; d=\"scan'208\";a=\"750578485\"", "From": "Pablo de Lara <pablo.de.lara.guarch@intel.com>", "To": "dev@dpdk.org", "Date": "Thu, 25 Jun 2015 23:05:15 +0100", "Message-Id": "<1435269919-7007-8-git-send-email-pablo.de.lara.guarch@intel.com>", "X-Mailer": "git-send-email 1.7.4.1", "In-Reply-To": "<1435269919-7007-1-git-send-email-pablo.de.lara.guarch@intel.com>", "References": "<1433514804-7075-1-git-send-email-pablo.de.lara.guarch@intel.com>\n\t<1435269919-7007-1-git-send-email-pablo.de.lara.guarch@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 07/11] hash: add new function rte_hash_reset", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Added reset function to be able to empty the table,\nwithout having to destroy and create it again.\n\nSigned-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>\n---\n app/test/test_hash.c | 3 +--\n app/test/test_hash_perf.c | 11 +++--------\n lib/librte_hash/rte_cuckoo_hash.c | 21 +++++++++++++++++++++\n lib/librte_hash/rte_hash.h | 11 +++++++++--\n lib/librte_hash/rte_hash_version.map | 1 +\n 5 files changed, 35 insertions(+), 12 deletions(-)", "diff": "diff --git a/app/test/test_hash.c b/app/test/test_hash.c\nindex 52de1bd..b1ca939 100644\n--- a/app/test/test_hash.c\n+++ b/app/test/test_hash.c\n@@ -1156,8 +1156,7 @@ static int test_average_table_utilization(void)\n \t\tno_space = 0;\n \n \t\t/* Reset the table */\n-\t\trte_hash_free(handle);\n-\t\trte_hash_create(&ut_params);\n+\t\trte_hash_reset(handle);\n \t}\n \n \tconst unsigned average_keys_added = added_keys_until_no_space / ITERATIONS;\ndiff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c\nindex 469000e..db0c5e8 100644\n--- a/app/test/test_hash_perf.c\n+++ b/app/test/test_hash_perf.c\n@@ -352,14 +352,10 @@ free_table(unsigned table_index)\n \trte_hash_free(h[table_index]);\n }\n \n-static int\n+static void\n reset_table(unsigned table_index)\n {\n-\tfree_table(table_index);\n-\tif (create_table(table_index) != 0)\n-\t\treturn -1;\n-\n-\treturn 0;\n+\trte_hash_reset(h[table_index]);\n }\n \n static int\n@@ -396,8 +392,7 @@ run_all_tbl_perf_tests(void)\n \t\tif (timed_deletes(1, i) < 0)\n \t\t\treturn -1;\n \n-\t\tif (reset_table(i) < 0)\n-\t\t\treturn -1;\n+\t\treset_table(i);\n \n \t\tprintf(\"\\n ----- WITH JUST KEYS -----\\n\\n\");\n \ndiff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c\nindex f1b6df0..8e5b9a6 100644\n--- a/lib/librte_hash/rte_cuckoo_hash.c\n+++ b/lib/librte_hash/rte_cuckoo_hash.c\n@@ -356,6 +356,27 @@ rte_hash_secondary_hash(const hash_sig_t primary_hash)\n \treturn (primary_hash ^ ((tag + 1) * alt_bits_xor));\n }\n \n+void\n+rte_hash_reset(struct rte_hash *h)\n+{\n+\tvoid *ptr;\n+\tunsigned i;\n+\n+\tif (h == NULL)\n+\t\treturn;\n+\n+\tmemset(h->buckets, 0, h->num_buckets * sizeof(struct rte_hash_bucket));\n+\tmemset(h->key_store, 0, h->key_entry_size * h->entries);\n+\n+\t/* clear the free ring */\n+\twhile (rte_ring_dequeue(h->free_slots, &ptr) == 0)\n+\t\trte_pause();\n+\n+\t/* Repopulate the free slots ring. Entry zero is reserved for key misses */\n+\tfor (i = 1; i < h->entries + 1; i++)\n+\t\trte_ring_sp_enqueue(h->free_slots, (void *)((uintptr_t) i));\n+}\n+\n /*\n * Try to insert a new entry. If bucket has space, hash value and key index\n * to the key table are copied.\ndiff --git a/lib/librte_hash/rte_hash.h b/lib/librte_hash/rte_hash.h\nindex 7f7e75f..fa327c2 100644\n--- a/lib/librte_hash/rte_hash.h\n+++ b/lib/librte_hash/rte_hash.h\n@@ -132,8 +132,15 @@ void\n rte_hash_free(struct rte_hash *h);\n \n /**\n- * Add a key to an existing hash table.\n- * This operation is not multi-thread safe\n+ * Reset all hash structure, by zeroing all entries\n+ * @param h\n+ * Hash table to reset\n+ */\n+void\n+rte_hash_reset(struct rte_hash *h);\n+\n+/**\n+ * Add a key to an existing hash table. This operation is not multi-thread safe\n * and should only be called from one thread.\n *\n * @param h\ndiff --git a/lib/librte_hash/rte_hash_version.map b/lib/librte_hash/rte_hash_version.map\nindex fd92def..f011054 100644\n--- a/lib/librte_hash/rte_hash_version.map\n+++ b/lib/librte_hash/rte_hash_version.map\n@@ -22,6 +22,7 @@ DPDK_2.1 {\n \tglobal:\n \n \trte_hash_lookup_bulk_with_hash;\n+\trte_hash_reset;\n \n \tlocal: *;\n } DPDK_2.0;\n", "prefixes": [ "dpdk-dev", "v2", "07/11" ] }{ "id": 5802, "url": "