Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/53326/?format=api
http://patches.dpdk.org/api/patches/53326/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190508165121.20471-2-dharmik.thakkar@arm.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": "<20190508165121.20471-2-dharmik.thakkar@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190508165121.20471-2-dharmik.thakkar@arm.com", "date": "2019-05-08T16:51:20", "name": "[1/2] hash: fix bugs in 'free key with position'", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "40b19836267f06364cfbccd6fd4bf5553d51f193", "submitter": { "id": 1108, "url": "http://patches.dpdk.org/api/people/1108/?format=api", "name": "Dharmik Thakkar", "email": "dharmik.thakkar@arm.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/20190508165121.20471-2-dharmik.thakkar@arm.com/mbox/", "series": [ { "id": 4600, "url": "http://patches.dpdk.org/api/series/4600/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4600", "date": "2019-05-08T16:51:19", "name": "hash: fix bugs in 'free key with position'", "version": 1, "mbox": "http://patches.dpdk.org/series/4600/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/53326/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/53326/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 6F449493D;\n\tWed, 8 May 2019 18:51:45 +0200 (CEST)", "from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70])\n\tby dpdk.org (Postfix) with ESMTP id 3570C2BD5;\n\tWed, 8 May 2019 18:51:41 +0200 (CEST)", "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9B27980D;\n\tWed, 8 May 2019 09:51:40 -0700 (PDT)", "from dp6132.austin.arm.com (dp6132.austin.arm.com [10.118.12.38])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id\n\t2C04E3F238; Wed, 8 May 2019 09:51:40 -0700 (PDT)" ], "From": "Dharmik Thakkar <dharmik.thakkar@arm.com>", "To": "Yipeng Wang <yipeng1.wang@intel.com>,\n\tSameh Gobriel <sameh.gobriel@intel.com>,\n\tBruce Richardson <bruce.richardson@intel.com>,\n\tPablo de Lara <pablo.de.lara.guarch@intel.com>", "Cc": "dev@dpdk.org, honnappa.nagarahalli@arm.com, zhongdahulinfan@163.com,\n\tDharmik Thakkar <dharmik.thakkar@arm.com>, stable@dpdk.org", "Date": "Wed, 8 May 2019 16:51:20 +0000", "Message-Id": "<20190508165121.20471-2-dharmik.thakkar@arm.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190508165121.20471-1-dharmik.thakkar@arm.com>", "References": "<20190508165121.20471-1-dharmik.thakkar@arm.com>", "Subject": "[dpdk-dev] [PATCH 1/2] hash: fix bugs in 'free key with position'", "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 patch fixes 2 bugs-\n1] Incorrect position returned to the free slots.\n2] Incorrect computation of total_entries\n\nBugzilla ID: 261\nFixes: 9d033dac7d7c (\"hash: support no free on delete\")\nCc: honnappa.nagarahalli@arm.com\nCc: stable@dpdk.org\n\nReported-by: Linfan <zhongdahulinfan@163.com>\nSuggested-by: Linfan <zhongdahulinfan@163.com>\nSigned-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>\n---\n lib/librte_hash/rte_cuckoo_hash.c | 14 +++++++++-----\n 1 file changed, 9 insertions(+), 5 deletions(-)", "diff": "diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c\nindex 261267b7fd3d..590895d72062 100644\n--- a/lib/librte_hash/rte_cuckoo_hash.c\n+++ b/lib/librte_hash/rte_cuckoo_hash.c\n@@ -1587,14 +1587,18 @@ int __rte_experimental\n rte_hash_free_key_with_position(const struct rte_hash *h,\n \t\t\t\tconst int32_t position)\n {\n-\tRETURN_IF_TRUE(((h == NULL) || (position == EMPTY_SLOT)), -EINVAL);\n+\t/* Key index where key is stored, adding the first dummy index*/\n+\tuint32_t key_idx = position + 1;\n+\n+\tRETURN_IF_TRUE(((h == NULL) || (key_idx == EMPTY_SLOT)), -EINVAL);\n \n \tunsigned int lcore_id, n_slots;\n \tstruct lcore_cache *cached_free_slots;\n-\tconst int32_t total_entries = h->num_buckets * RTE_HASH_BUCKET_ENTRIES;\n+\tconst uint32_t total_entries = h->use_local_cache ?\n+\t\th->entries + (RTE_MAX_LCORE - 1) * (LCORE_CACHE_SIZE - 1) + 1 : h->entries + 1;\n \n \t/* Out of bounds */\n-\tif (position >= total_entries)\n+\tif (key_idx >= total_entries)\n \t\treturn -EINVAL;\n \tif (h->ext_table_support && h->readwrite_concur_lf_support) {\n \t\tuint32_t index = h->ext_bkt_to_free[position];\n@@ -1619,11 +1623,11 @@ rte_hash_free_key_with_position(const struct rte_hash *h,\n \t\t}\n \t\t/* Put index of new free slot in cache. */\n \t\tcached_free_slots->objs[cached_free_slots->len] =\n-\t\t\t\t\t(void *)((uintptr_t)position);\n+\t\t\t\t\t(void *)((uintptr_t)key_idx);\n \t\tcached_free_slots->len++;\n \t} else {\n \t\trte_ring_sp_enqueue(h->free_slots,\n-\t\t\t\t(void *)((uintptr_t)position));\n+\t\t\t\t(void *)((uintptr_t)key_idx));\n \t}\n \n \treturn 0;\n", "prefixes": [ "1/2" ] }{ "id": 53326, "url": "