get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 20713,
    "url": "https://patches.dpdk.org/api/patches/20713/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20170223172407.27664-15-bruce.richardson@intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20170223172407.27664-15-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20170223172407.27664-15-bruce.richardson@intel.com",
    "date": "2017-02-23T17:24:07",
    "name": "[dpdk-dev,v1,14/14] ring: make ring struct and enq/deq macros type agnostic",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ec0ffb031152a26f4b3f2bb910e4d889b2492827",
    "submitter": {
        "id": 20,
        "url": "https://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20170223172407.27664-15-bruce.richardson@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/20713/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/20713/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 99879F957;\n\tThu, 23 Feb 2017 18:25:49 +0100 (CET)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id 00D2A5911\n\tfor <dev@dpdk.org>; Thu, 23 Feb 2017 18:25:14 +0100 (CET)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga105.jf.intel.com with ESMTP; 23 Feb 2017 09:25:14 -0800",
            "from sivswdev01.ir.intel.com ([10.237.217.45])\n\tby FMSMGA003.fm.intel.com with ESMTP; 23 Feb 2017 09:25:13 -0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.35,198,1484035200\"; d=\"scan'208\";a=\"827713193\"",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "olivier.matz@6wind.com",
        "Cc": "dev@dpdk.org,\n\tBruce Richardson <bruce.richardson@intel.com>",
        "Date": "Thu, 23 Feb 2017 17:24:07 +0000",
        "Message-Id": "<20170223172407.27664-15-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20170223172407.27664-1-bruce.richardson@intel.com>",
        "References": "<20170223172407.27664-1-bruce.richardson@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v1 14/14] ring: make ring struct and enq/deq\n\tmacros type agnostic",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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": "Modify the enqueue and dequeue macros to support copying any type of\nobject by passing in the exact object type. Rather than using the \"ring\"\nstructure member of rte_ring, which is of type \"array of void *\", instead\nhave the macros take the start of the ring a a pointer value, thereby\nleaving the rte_ring structure as purely a header value. This allows it\nto be reused by other future ring types which can add on extra fields if\nthey want, or even to have the actual ring elements, of whatever type\nstored separate from the ring header.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n lib/librte_ring/rte_ring.h | 68 ++++++++++++++++++++++++----------------------\n 1 file changed, 36 insertions(+), 32 deletions(-)",
    "diff": "diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h\nindex 6b901b1..1b04db1 100644\n--- a/lib/librte_ring/rte_ring.h\n+++ b/lib/librte_ring/rte_ring.h\n@@ -154,11 +154,7 @@ struct rte_ring {\n \n \t/** Ring consumer status. */\n \tstruct rte_ring_ht_ptr cons __rte_aligned(RTE_CACHE_LINE_SIZE * 2);\n-\n-\tvoid *ring[] __rte_cache_aligned;   /**< Memory space of ring starts here.\n-\t                                     * not volatile so need to be careful\n-\t                                     * about compiler re-ordering */\n-};\n+} __rte_cache_aligned;\n \n #define RING_F_SP_ENQ 0x0001 /**< The default enqueue is \"single-producer\". */\n #define RING_F_SC_DEQ 0x0002 /**< The default dequeue is \"single-consumer\". */\n@@ -285,54 +281,62 @@ void rte_ring_dump(FILE *f, const struct rte_ring *r);\n /* the actual enqueue of pointers on the ring.\n  * Placed here since identical code needed in both\n  * single and multi producer enqueue functions */\n-#define ENQUEUE_PTRS() do { \\\n+#define ENQUEUE_PTRS(r, ring_start, prod_head, obj_table, n, obj_type) do { \\\n \tunsigned int i; \\\n-\tconst uint32_t size = r->size; \\\n-\tuint32_t idx = prod_head & r->mask; \\\n+\tconst uint32_t size = (r)->size; \\\n+\tuint32_t idx = prod_head & (r)->mask; \\\n+\tobj_type *ring = (void *)ring_start; \\\n \tif (likely(idx + n < size)) { \\\n \t\tfor (i = 0; i < (n & ((~(unsigned)0x3))); i+=4, idx+=4) { \\\n-\t\t\tr->ring[idx] = obj_table[i]; \\\n-\t\t\tr->ring[idx+1] = obj_table[i+1]; \\\n-\t\t\tr->ring[idx+2] = obj_table[i+2]; \\\n-\t\t\tr->ring[idx+3] = obj_table[i+3]; \\\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+\t\t\tring[idx+3] = obj_table[i+3]; \\\n \t\t} \\\n \t\tswitch (n & 0x3) { \\\n-\t\t\tcase 3: r->ring[idx++] = obj_table[i++]; \\\n-\t\t\tcase 2: r->ring[idx++] = obj_table[i++]; \\\n-\t\t\tcase 1: r->ring[idx++] = obj_table[i++]; \\\n+\t\tcase 3: \\\n+\t\t\tring[idx++] = obj_table[i++]; /* fallthrough */ \\\n+\t\tcase 2: \\\n+\t\t\tring[idx++] = obj_table[i++]; /* fallthrough */ \\\n+\t\tcase 1: \\\n+\t\t\tring[idx++] = obj_table[i++]; \\\n \t\t} \\\n \t} else { \\\n \t\tfor (i = 0; idx < size; i++, idx++)\\\n-\t\t\tr->ring[idx] = obj_table[i]; \\\n+\t\t\tring[idx] = obj_table[i]; \\\n \t\tfor (idx = 0; i < n; i++, idx++) \\\n-\t\t\tr->ring[idx] = obj_table[i]; \\\n+\t\t\tring[idx] = obj_table[i]; \\\n \t} \\\n-} while(0)\n+} while (0)\n \n /* the actual copy of pointers on the ring to obj_table.\n  * Placed here since identical code needed in both\n  * single and multi consumer dequeue functions */\n-#define DEQUEUE_PTRS() do { \\\n+#define DEQUEUE_PTRS(r, ring_start, cons_head, obj_table, n, obj_type) do { \\\n \tunsigned int i; \\\n-\tuint32_t idx = cons_head & r->mask; \\\n-\tconst uint32_t size = r->size; \\\n+\tuint32_t idx = cons_head & (r)->mask; \\\n+\tconst uint32_t size = (r)->size; \\\n+\tobj_type *ring = (void *)ring_start; \\\n \tif (likely(idx + n < size)) { \\\n \t\tfor (i = 0; i < (n & (~(unsigned)0x3)); i+=4, idx+=4) {\\\n-\t\t\tobj_table[i] = r->ring[idx]; \\\n-\t\t\tobj_table[i+1] = r->ring[idx+1]; \\\n-\t\t\tobj_table[i+2] = r->ring[idx+2]; \\\n-\t\t\tobj_table[i+3] = r->ring[idx+3]; \\\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+\t\t\tobj_table[i+3] = ring[idx+3]; \\\n \t\t} \\\n \t\tswitch (n & 0x3) { \\\n-\t\t\tcase 3: obj_table[i++] = r->ring[idx++]; \\\n-\t\t\tcase 2: obj_table[i++] = r->ring[idx++]; \\\n-\t\t\tcase 1: obj_table[i++] = r->ring[idx++]; \\\n+\t\tcase 3: \\\n+\t\t\tobj_table[i++] = ring[idx++]; /* fallthrough */ \\\n+\t\tcase 2: \\\n+\t\t\tobj_table[i++] = ring[idx++]; /* fallthrough */ \\\n+\t\tcase 1: \\\n+\t\t\tobj_table[i++] = ring[idx++]; \\\n \t\t} \\\n \t} else { \\\n \t\tfor (i = 0; idx < size; i++, idx++) \\\n-\t\t\tobj_table[i] = r->ring[idx]; \\\n+\t\t\tobj_table[i] = ring[idx]; \\\n \t\tfor (idx = 0; i < n; i++, idx++) \\\n-\t\t\tobj_table[i] = r->ring[idx]; \\\n+\t\t\tobj_table[i] = ring[idx]; \\\n \t} \\\n } while (0)\n \n@@ -445,7 +449,7 @@ __rte_ring_do_enqueue(struct rte_ring *r, void * const *obj_table,\n \tif (n == 0)\n \t\tgoto end;\n \n-\tENQUEUE_PTRS();\n+\tENQUEUE_PTRS(r, &r[1], prod_head, obj_table, n, void *);\n \trte_smp_wmb();\n \n \tupdate_tail(&r->prod, prod_head, prod_next);\n@@ -550,7 +554,7 @@ __rte_ring_do_dequeue(struct rte_ring *r, void **obj_table,\n \tif (n == 0)\n \t\tgoto end;\n \n-\tDEQUEUE_PTRS();\n+\tDEQUEUE_PTRS(r, &r[1], cons_head, obj_table, n, void *);\n \trte_smp_rmb();\n \n \tupdate_tail(&r->cons, cons_head, cons_next);\n",
    "prefixes": [
        "dpdk-dev",
        "v1",
        "14/14"
    ]
}