get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 58132,
    "url": "http://patches.dpdk.org/api/patches/58132/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190828144614.25284-6-honnappa.nagarahalli@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": "<20190828144614.25284-6-honnappa.nagarahalli@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190828144614.25284-6-honnappa.nagarahalli@arm.com",
    "date": "2019-08-28T14:46:14",
    "name": "[5/5] lib/hash: use ring with 32b element size to save memory",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ad83d94c9391205919a1afe5d3af54f42e9e1011",
    "submitter": {
        "id": 1045,
        "url": "http://patches.dpdk.org/api/people/1045/?format=api",
        "name": "Honnappa Nagarahalli",
        "email": "honnappa.nagarahalli@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/20190828144614.25284-6-honnappa.nagarahalli@arm.com/mbox/",
    "series": [
        {
            "id": 6155,
            "url": "http://patches.dpdk.org/api/series/6155/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6155",
            "date": "2019-08-28T14:46:09",
            "name": "lib/ring: templates to support custom element size",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/6155/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/58132/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/58132/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 D990B1C069;\n\tWed, 28 Aug 2019 16:46:46 +0200 (CEST)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n\tby dpdk.org (Postfix) with ESMTP id 72E211BEEE\n\tfor <dev@dpdk.org>; Wed, 28 Aug 2019 16:46:41 +0200 (CEST)",
            "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F3C4815AD;\n\tWed, 28 Aug 2019 07:46:40 -0700 (PDT)",
            "from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com\n\t[10.118.12.34])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id\n\tDEAA93F246; Wed, 28 Aug 2019 07:46:40 -0700 (PDT)"
        ],
        "From": "Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>",
        "To": "olivier.matz@6wind.com, yipeng1.wang@intel.com, sameh.gobriel@intel.com, \n\tbruce.richardson@intel.com, pablo.de.lara.guarch@intel.com,\n\thonnappa.nagarahalli@arm.com",
        "Cc": "dev@dpdk.org, dharmik.thakkar@arm.com, gavin.hu@arm.com,\n\truifeng.wang@arm.com, nd@arm.com",
        "Date": "Wed, 28 Aug 2019 09:46:14 -0500",
        "Message-Id": "<20190828144614.25284-6-honnappa.nagarahalli@arm.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20190828144614.25284-1-honnappa.nagarahalli@arm.com>",
        "References": "<20190828144614.25284-1-honnappa.nagarahalli@arm.com>",
        "Subject": "[dpdk-dev] [PATCH 5/5] lib/hash: use ring with 32b element size to\n\tsave memory",
        "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": "The freelist and external bucket indices are 32b. Using rings\nthat use 32b element sizes will save memory.\n\nSigned-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\nReviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>\nReviewed-by: Gavin Hu <gavin.hu@arm.com>\nReviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>\n---\n lib/librte_hash/rte_cuckoo_hash.c | 55 ++++++++++++++-----------------\n lib/librte_hash/rte_cuckoo_hash.h |  2 +-\n 2 files changed, 26 insertions(+), 31 deletions(-)",
    "diff": "diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c\nindex 87a4c01f2..a0cd3360a 100644\n--- a/lib/librte_hash/rte_cuckoo_hash.c\n+++ b/lib/librte_hash/rte_cuckoo_hash.c\n@@ -24,7 +24,7 @@\n #include <rte_cpuflags.h>\n #include <rte_rwlock.h>\n #include <rte_spinlock.h>\n-#include <rte_ring.h>\n+#include <rte_ring_32.h>\n #include <rte_compat.h>\n #include <rte_vect.h>\n #include <rte_tailq.h>\n@@ -213,7 +213,7 @@ rte_hash_create(const struct rte_hash_parameters *params)\n \n \tsnprintf(ring_name, sizeof(ring_name), \"HT_%s\", params->name);\n \t/* Create ring (Dummy slot index is not enqueued) */\n-\tr = rte_ring_create(ring_name, rte_align32pow2(num_key_slots),\n+\tr = rte_ring_create_32(ring_name, rte_align32pow2(num_key_slots),\n \t\t\tparams->socket_id, 0);\n \tif (r == NULL) {\n \t\tRTE_LOG(ERR, HASH, \"memory allocation failed\\n\");\n@@ -227,7 +227,7 @@ rte_hash_create(const struct rte_hash_parameters *params)\n \tif (ext_table_support) {\n \t\tsnprintf(ext_ring_name, sizeof(ext_ring_name), \"HT_EXT_%s\",\n \t\t\t\t\t\t\t\tparams->name);\n-\t\tr_ext = rte_ring_create(ext_ring_name,\n+\t\tr_ext = rte_ring_create_32(ext_ring_name,\n \t\t\t\trte_align32pow2(num_buckets + 1),\n \t\t\t\tparams->socket_id, 0);\n \n@@ -295,7 +295,7 @@ rte_hash_create(const struct rte_hash_parameters *params)\n \t\t * for next bucket\n \t\t */\n \t\tfor (i = 1; i <= num_buckets; i++)\n-\t\t\trte_ring_sp_enqueue(r_ext, (void *)((uintptr_t) i));\n+\t\t\trte_ring_sp_enqueue_32(r_ext, i);\n \n \t\tif (readwrite_concur_lf_support) {\n \t\t\text_bkt_to_free = rte_zmalloc(NULL, sizeof(uint32_t) *\n@@ -434,7 +434,7 @@ rte_hash_create(const struct rte_hash_parameters *params)\n \n \t/* Populate free slots ring. Entry zero is reserved for key misses. */\n \tfor (i = 1; i < num_key_slots; i++)\n-\t\trte_ring_sp_enqueue(r, (void *)((uintptr_t) i));\n+\t\trte_ring_sp_enqueue_32(r, i);\n \n \tte->data = (void *) h;\n \tTAILQ_INSERT_TAIL(hash_list, te, next);\n@@ -598,13 +598,12 @@ rte_hash_reset(struct rte_hash *h)\n \t\ttot_ring_cnt = h->entries;\n \n \tfor (i = 1; i < tot_ring_cnt + 1; i++)\n-\t\trte_ring_sp_enqueue(h->free_slots, (void *)((uintptr_t) i));\n+\t\trte_ring_sp_enqueue_32(h->free_slots, i);\n \n \t/* Repopulate the free ext bkt ring. */\n \tif (h->ext_table_support) {\n \t\tfor (i = 1; i <= h->num_buckets; i++)\n-\t\t\trte_ring_sp_enqueue(h->free_ext_bkts,\n-\t\t\t\t\t\t(void *)((uintptr_t) i));\n+\t\t\trte_ring_sp_enqueue_32(h->free_ext_bkts, i);\n \t}\n \n \tif (h->use_local_cache) {\n@@ -623,13 +622,13 @@ rte_hash_reset(struct rte_hash *h)\n static inline void\n enqueue_slot_back(const struct rte_hash *h,\n \t\tstruct lcore_cache *cached_free_slots,\n-\t\tvoid *slot_id)\n+\t\tuint32_t slot_id)\n {\n \tif (h->use_local_cache) {\n \t\tcached_free_slots->objs[cached_free_slots->len] = slot_id;\n \t\tcached_free_slots->len++;\n \t} else\n-\t\trte_ring_sp_enqueue(h->free_slots, slot_id);\n+\t\trte_ring_sp_enqueue_32(h->free_slots, slot_id);\n }\n \n /* Search a key from bucket and update its data.\n@@ -923,8 +922,8 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key,\n \tuint32_t prim_bucket_idx, sec_bucket_idx;\n \tstruct rte_hash_bucket *prim_bkt, *sec_bkt, *cur_bkt;\n \tstruct rte_hash_key *new_k, *keys = h->key_store;\n-\tvoid *slot_id = NULL;\n-\tvoid *ext_bkt_id = NULL;\n+\tuint32_t slot_id = 0;\n+\tuint32_t ext_bkt_id = 0;\n \tuint32_t new_idx, bkt_id;\n \tint ret;\n \tunsigned n_slots;\n@@ -968,7 +967,7 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key,\n \t\t/* Try to get a free slot from the local cache */\n \t\tif (cached_free_slots->len == 0) {\n \t\t\t/* Need to get another burst of free slots from global ring */\n-\t\t\tn_slots = rte_ring_mc_dequeue_burst(h->free_slots,\n+\t\t\tn_slots = rte_ring_mc_dequeue_burst_32(h->free_slots,\n \t\t\t\t\tcached_free_slots->objs,\n \t\t\t\t\tLCORE_CACHE_SIZE, NULL);\n \t\t\tif (n_slots == 0) {\n@@ -982,13 +981,12 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key,\n \t\tcached_free_slots->len--;\n \t\tslot_id = cached_free_slots->objs[cached_free_slots->len];\n \t} else {\n-\t\tif (rte_ring_sc_dequeue(h->free_slots, &slot_id) != 0) {\n+\t\tif (rte_ring_sc_dequeue_32(h->free_slots, &slot_id) != 0)\n \t\t\treturn -ENOSPC;\n-\t\t}\n \t}\n \n-\tnew_k = RTE_PTR_ADD(keys, (uintptr_t)slot_id * h->key_entry_size);\n-\tnew_idx = (uint32_t)((uintptr_t) slot_id);\n+\tnew_k = RTE_PTR_ADD(keys, slot_id * h->key_entry_size);\n+\tnew_idx = slot_id;\n \t/* The store to application data (by the application) at *data should\n \t * not leak after the store of pdata in the key store. i.e. pdata is\n \t * the guard variable. Release the application data to the readers.\n@@ -1078,12 +1076,12 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key,\n \t/* Failed to get an empty entry from extendable buckets. Link a new\n \t * extendable bucket. We first get a free bucket from ring.\n \t */\n-\tif (rte_ring_sc_dequeue(h->free_ext_bkts, &ext_bkt_id) != 0) {\n+\tif (rte_ring_sc_dequeue_32(h->free_ext_bkts, &ext_bkt_id) != 0) {\n \t\tret = -ENOSPC;\n \t\tgoto failure;\n \t}\n \n-\tbkt_id = (uint32_t)((uintptr_t)ext_bkt_id) - 1;\n+\tbkt_id = ext_bkt_id - 1;\n \t/* Use the first location of the new bucket */\n \t(h->buckets_ext[bkt_id]).sig_current[0] = short_sig;\n \t/* Store to signature and key should not leak after\n@@ -1373,7 +1371,7 @@ remove_entry(const struct rte_hash *h, struct rte_hash_bucket *bkt, unsigned i)\n \t\t/* Cache full, need to free it. */\n \t\tif (cached_free_slots->len == LCORE_CACHE_SIZE) {\n \t\t\t/* Need to enqueue the free slots in global ring. */\n-\t\t\tn_slots = rte_ring_mp_enqueue_burst(h->free_slots,\n+\t\t\tn_slots = rte_ring_mp_enqueue_burst_32(h->free_slots,\n \t\t\t\t\t\tcached_free_slots->objs,\n \t\t\t\t\t\tLCORE_CACHE_SIZE, NULL);\n \t\t\tERR_IF_TRUE((n_slots == 0),\n@@ -1383,11 +1381,10 @@ remove_entry(const struct rte_hash *h, struct rte_hash_bucket *bkt, unsigned i)\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(void *)((uintptr_t)bkt->key_idx[i]);\n+\t\t\t\tbkt->key_idx[i];\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)bkt->key_idx[i]));\n+\t\trte_ring_sp_enqueue_32(h->free_slots, bkt->key_idx[i]);\n \t}\n }\n \n@@ -1551,7 +1548,7 @@ __rte_hash_del_key_with_hash(const struct rte_hash *h, const void *key,\n \t\t\t */\n \t\t\th->ext_bkt_to_free[ret] = index;\n \t\telse\n-\t\t\trte_ring_sp_enqueue(h->free_ext_bkts, (void *)(uintptr_t)index);\n+\t\t\trte_ring_sp_enqueue_32(h->free_ext_bkts, index);\n \t}\n \t__hash_rw_writer_unlock(h);\n \treturn ret;\n@@ -1614,7 +1611,7 @@ rte_hash_free_key_with_position(const struct rte_hash *h,\n \t\tuint32_t index = h->ext_bkt_to_free[position];\n \t\tif (index) {\n \t\t\t/* Recycle empty ext bkt to free list. */\n-\t\t\trte_ring_sp_enqueue(h->free_ext_bkts, (void *)(uintptr_t)index);\n+\t\t\trte_ring_sp_enqueue_32(h->free_ext_bkts, index);\n \t\t\th->ext_bkt_to_free[position] = 0;\n \t\t}\n \t}\n@@ -1625,19 +1622,17 @@ rte_hash_free_key_with_position(const struct rte_hash *h,\n \t\t/* Cache full, need to free it. */\n \t\tif (cached_free_slots->len == LCORE_CACHE_SIZE) {\n \t\t\t/* Need to enqueue the free slots in global ring. */\n-\t\t\tn_slots = rte_ring_mp_enqueue_burst(h->free_slots,\n+\t\t\tn_slots = rte_ring_mp_enqueue_burst_32(h->free_slots,\n \t\t\t\t\t\tcached_free_slots->objs,\n \t\t\t\t\t\tLCORE_CACHE_SIZE, NULL);\n \t\t\tRETURN_IF_TRUE((n_slots == 0), -EFAULT);\n \t\t\tcached_free_slots->len -= n_slots;\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)key_idx);\n+\t\tcached_free_slots->objs[cached_free_slots->len] = 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)key_idx));\n+\t\trte_ring_sp_enqueue_32(h->free_slots, key_idx);\n \t}\n \n \treturn 0;\ndiff --git a/lib/librte_hash/rte_cuckoo_hash.h b/lib/librte_hash/rte_cuckoo_hash.h\nindex fb19bb27d..345de6bf9 100644\n--- a/lib/librte_hash/rte_cuckoo_hash.h\n+++ b/lib/librte_hash/rte_cuckoo_hash.h\n@@ -124,7 +124,7 @@ const rte_hash_cmp_eq_t cmp_jump_table[NUM_KEY_CMP_CASES] = {\n \n struct lcore_cache {\n \tunsigned len; /**< Cache len */\n-\tvoid *objs[LCORE_CACHE_SIZE]; /**< Cache objects */\n+\tuint32_t objs[LCORE_CACHE_SIZE]; /**< Cache objects */\n } __rte_cache_aligned;\n \n /* Structure that stores key-value pair */\n",
    "prefixes": [
        "5/5"
    ]
}