get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 70189,
    "url": "http://patches.dpdk.org/api/patches/70189/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200513153111.37063-1-mb@smartsharesystems.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": "<20200513153111.37063-1-mb@smartsharesystems.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200513153111.37063-1-mb@smartsharesystems.com",
    "date": "2020-05-13T15:31:11",
    "name": "ring: empty and count optimizations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a9b5cbb02f5b727255daa7408039b09a15cb6eff",
    "submitter": {
        "id": 591,
        "url": "http://patches.dpdk.org/api/people/591/?format=api",
        "name": "Morten Brørup",
        "email": "mb@smartsharesystems.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200513153111.37063-1-mb@smartsharesystems.com/mbox/",
    "series": [
        {
            "id": 10036,
            "url": "http://patches.dpdk.org/api/series/10036/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=10036",
            "date": "2020-05-13T15:31:11",
            "name": "ring: empty and count optimizations",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/10036/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/70189/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/70189/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 71EFFA034F;\n\tWed, 13 May 2020 17:31:25 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 4E81B1D648;\n\tWed, 13 May 2020 17:31:25 +0200 (CEST)",
            "from smartserver.smartsharesystems.com\n (smartserver.smartsharesystems.com [77.243.40.215])\n by dpdk.org (Postfix) with ESMTP id 62EC61D643\n for <dev@dpdk.org>; Wed, 13 May 2020 17:31:24 +0200 (CEST)",
            "from dkrd2.smartsharesys.local ([192.168.4.12]) by\n smartserver.smartsharesystems.com with Microsoft SMTPSVC(6.0.3790.4675);\n Wed, 13 May 2020 17:31:22 +0200"
        ],
        "From": "=?utf-8?q?Morten_Br=C3=B8rup?= <mb@smartsharesystems.com>",
        "To": "olivier.matz@6wind.com, konstantin.ananyev@intel.com,\n Honnappa.Nagarahalli@arm.com, nd@arm.com",
        "Cc": "dev@dpdk.org, =?utf-8?q?Morten_Br=C3=B8rup?= <mb@smartsharesystems.com>",
        "Date": "Wed, 13 May 2020 15:31:11 +0000",
        "Message-Id": "<20200513153111.37063-1-mb@smartsharesystems.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-OriginalArrivalTime": "13 May 2020 15:31:22.0928 (UTC)\n FILETIME=[8EC7DB00:01D6293B]",
        "Subject": "[dpdk-dev] [PATCH] ring: empty and count optimizations",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Testing if the ring is empty is as simple as comparing the producer and\\nconsumer pointers.\\nIn theory, this optimization reduces the number of potential cache misses\\nfrom 3 to 2 by not having to read r->mask in rte_ring_count().\\n\\nIt is not possible to enqueue more elements than the capacity of a ring,\\nso the capacity comparison is a safeguard for observer threads only.\\nInstead of completely removing the comparison, I have reorganized it to\\nresemble the other trigrahps in the ring library and added a likely().\\n\\nThe modification of these two functions were discussed in the RFC here:\\nhttps://mails.dpdk.org/archives/dev/2020-April/165752.html\n\nSigned-off-by: Morten Brørup <mb@smartsharesystems.com>\n---\n lib/librte_ring/rte_ring.h | 36 +++++++++++++++++++-----------------\n 1 file changed, 19 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h\nindex 86faede81..74a8fcdc8 100644\n--- a/lib/librte_ring/rte_ring.h\n+++ b/lib/librte_ring/rte_ring.h\n@@ -55,7 +55,7 @@ extern \"C\" {\n  *   - The memory size needed for the ring on success.\n  *   - -EINVAL if count is not a power of 2.\n  */\n-ssize_t rte_ring_get_memsize(unsigned count);\n+ssize_t rte_ring_get_memsize(unsigned int count);\n \n /**\n  * Initialize a ring structure.\n@@ -109,8 +109,8 @@ ssize_t rte_ring_get_memsize(unsigned count);\n  * @return\n  *   0 on success, or a negative value on error.\n  */\n-int rte_ring_init(struct rte_ring *r, const char *name, unsigned count,\n-\tunsigned flags);\n+int rte_ring_init(struct rte_ring *r, const char *name, unsigned int count,\n+\tunsigned int flags);\n \n /**\n  * Create a new ring named *name* in memory.\n@@ -169,8 +169,8 @@ int rte_ring_init(struct rte_ring *r, const char *name, unsigned count,\n  *    - EEXIST - a memzone with the same name already exists\n  *    - ENOMEM - no appropriate memory area found in which to create memzone\n  */\n-struct rte_ring *rte_ring_create(const char *name, unsigned count,\n-\t\t\t\t int socket_id, unsigned flags);\n+struct rte_ring *rte_ring_create(const char *name, unsigned int count,\n+\t\t\t\t int socket_id, unsigned int flags);\n \n /**\n  * De-allocate all memory used by the ring.\n@@ -199,7 +199,7 @@ void rte_ring_dump(FILE *f, const struct rte_ring *r);\n \tuint32_t idx = prod_head & (r)->mask; \\\n \tobj_type *ring = (obj_type *)ring_start; \\\n \tif (likely(idx + n < size)) { \\\n-\t\tfor (i = 0; i < (n & ((~(unsigned)0x3))); i+=4, idx+=4) { \\\n+\t\tfor (i = 0; i < (n & ((~(unsigned int)0x3))); i+=4, idx+=4) { \\\n \t\t\tring[idx] = obj_table[i]; \\\n \t\t\tring[idx+1] = obj_table[i+1]; \\\n \t\t\tring[idx+2] = obj_table[i+2]; \\\n@@ -230,7 +230,7 @@ void rte_ring_dump(FILE *f, const struct rte_ring *r);\n \tconst uint32_t size = (r)->size; \\\n \tobj_type *ring = (obj_type *)ring_start; \\\n \tif (likely(idx + n < size)) { \\\n-\t\tfor (i = 0; i < (n & (~(unsigned)0x3)); i+=4, idx+=4) {\\\n+\t\tfor (i = 0; i < (n & (~(unsigned int)0x3)); i+=4, idx+=4) {\\\n \t\t\tobj_table[i] = ring[idx]; \\\n \t\t\tobj_table[i+1] = ring[idx+1]; \\\n \t\t\tobj_table[i+2] = ring[idx+2]; \\\n@@ -683,13 +683,13 @@ rte_ring_reset(struct rte_ring *r);\n  * @return\n  *   The number of entries in the ring.\n  */\n-static inline unsigned\n+static inline unsigned int\n rte_ring_count(const struct rte_ring *r)\n {\n \tuint32_t prod_tail = r->prod.tail;\n \tuint32_t cons_tail = r->cons.tail;\n \tuint32_t count = (prod_tail - cons_tail) & r->mask;\n-\treturn (count > r->capacity) ? r->capacity : count;\n+\treturn likely(count <= r->capacity) ? count : r->capacity;\n }\n \n /**\n@@ -700,7 +700,7 @@ rte_ring_count(const struct rte_ring *r)\n  * @return\n  *   The number of free entries in the ring.\n  */\n-static inline unsigned\n+static inline unsigned int\n rte_ring_free_count(const struct rte_ring *r)\n {\n \treturn r->capacity - rte_ring_count(r);\n@@ -733,7 +733,9 @@ rte_ring_full(const struct rte_ring *r)\n static inline int\n rte_ring_empty(const struct rte_ring *r)\n {\n-\treturn rte_ring_count(r) == 0;\n+\tuint32_t prod_tail = r->prod.tail;\n+\tuint32_t cons_tail = r->cons.tail;\n+\treturn cons_tail == prod_tail;\n }\n \n /**\n@@ -860,7 +862,7 @@ struct rte_ring *rte_ring_lookup(const char *name);\n  * @return\n  *   - n: Actual number of objects enqueued.\n  */\n-static __rte_always_inline unsigned\n+static __rte_always_inline unsigned int\n rte_ring_mp_enqueue_burst(struct rte_ring *r, void * const *obj_table,\n \t\t\t unsigned int n, unsigned int *free_space)\n {\n@@ -883,7 +885,7 @@ rte_ring_mp_enqueue_burst(struct rte_ring *r, void * const *obj_table,\n  * @return\n  *   - n: Actual number of objects enqueued.\n  */\n-static __rte_always_inline unsigned\n+static __rte_always_inline unsigned int\n rte_ring_sp_enqueue_burst(struct rte_ring *r, void * const *obj_table,\n \t\t\t unsigned int n, unsigned int *free_space)\n {\n@@ -910,7 +912,7 @@ rte_ring_sp_enqueue_burst(struct rte_ring *r, void * const *obj_table,\n  * @return\n  *   - n: Actual number of objects enqueued.\n  */\n-static __rte_always_inline unsigned\n+static __rte_always_inline unsigned int\n rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table,\n \t\t      unsigned int n, unsigned int *free_space)\n {\n@@ -954,7 +956,7 @@ rte_ring_enqueue_burst(struct rte_ring *r, void * const *obj_table,\n  * @return\n  *   - n: Actual number of objects dequeued, 0 if ring is empty\n  */\n-static __rte_always_inline unsigned\n+static __rte_always_inline unsigned int\n rte_ring_mc_dequeue_burst(struct rte_ring *r, void **obj_table,\n \t\tunsigned int n, unsigned int *available)\n {\n@@ -979,7 +981,7 @@ rte_ring_mc_dequeue_burst(struct rte_ring *r, void **obj_table,\n  * @return\n  *   - n: Actual number of objects dequeued, 0 if ring is empty\n  */\n-static __rte_always_inline unsigned\n+static __rte_always_inline unsigned int\n rte_ring_sc_dequeue_burst(struct rte_ring *r, void **obj_table,\n \t\tunsigned int n, unsigned int *available)\n {\n@@ -1006,7 +1008,7 @@ rte_ring_sc_dequeue_burst(struct rte_ring *r, void **obj_table,\n  * @return\n  *   - Number of objects dequeued\n  */\n-static __rte_always_inline unsigned\n+static __rte_always_inline unsigned int\n rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table,\n \t\tunsigned int n, unsigned int *available)\n {\n",
    "prefixes": []
}