get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 61442,
    "url": "http://patchwork.dpdk.org/api/patches/61442/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20191017200807.20772-4-honnappa.nagarahalli@arm.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20191017200807.20772-4-honnappa.nagarahalli@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191017200807.20772-4-honnappa.nagarahalli@arm.com",
    "date": "2019-10-17T20:08:07",
    "name": "[v5,3/3] lib/ring: copy ring elements using memcpy partially",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "80c09609728baf9d39d409884ea43502a2a3416b",
    "submitter": {
        "id": 1045,
        "url": "http://patchwork.dpdk.org/api/people/1045/?format=api",
        "name": "Honnappa Nagarahalli",
        "email": "honnappa.nagarahalli@arm.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patchwork.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20191017200807.20772-4-honnappa.nagarahalli@arm.com/mbox/",
    "series": [
        {
            "id": 6922,
            "url": "http://patchwork.dpdk.org/api/series/6922/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=6922",
            "date": "2019-10-17T20:08:04",
            "name": "lib/ring: APIs to support custom element size",
            "version": 5,
            "mbox": "http://patchwork.dpdk.org/series/6922/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/61442/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/61442/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 DE4FB1E9DA;\n\tThu, 17 Oct 2019 22:08:46 +0200 (CEST)",
            "from foss.arm.com (unknown [217.140.110.172])\n\tby dpdk.org (Postfix) with ESMTP id 1C2001D50B\n\tfor <dev@dpdk.org>; Thu, 17 Oct 2019 22:08: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 DE713332;\n\tThu, 17 Oct 2019 13:08:31 -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\tC8ADB3F68E; Thu, 17 Oct 2019 13:08:31 -0700 (PDT)"
        ],
        "From": "Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>",
        "To": "olivier.matz@6wind.com, sthemmin@microsoft.com, jerinj@marvell.com,\n\tbruce.richardson@intel.com, david.marchand@redhat.com,\n\tpbhagavatula@marvell.com, konstantin.ananyev@intel.com,\n\tdrc@linux.vnet.ibm.com, hemant.agrawal@nxp.com,\n\thonnappa.nagarahalli@arm.com",
        "Cc": "dev@dpdk.org, dharmik.thakkar@arm.com, ruifeng.wang@arm.com,\n\tgavin.hu@arm.com",
        "Date": "Thu, 17 Oct 2019 15:08:07 -0500",
        "Message-Id": "<20191017200807.20772-4-honnappa.nagarahalli@arm.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191017200807.20772-1-honnappa.nagarahalli@arm.com>",
        "References": "<20190906190510.11146-1-honnappa.nagarahalli@arm.com>\n\t<20191017200807.20772-1-honnappa.nagarahalli@arm.com>",
        "Subject": "[dpdk-dev] [PATCH v5 3/3] lib/ring: copy ring elements using memcpy\n\tpartially",
        "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": "Copy of ring elements uses memcpy for 32B chunks. The remaining\nbytes are copied using assignments.\n\nSigned-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\n---\n lib/librte_ring/rte_ring_elem.h | 163 +++-----------------------------\n 1 file changed, 11 insertions(+), 152 deletions(-)",
    "diff": "diff --git a/lib/librte_ring/rte_ring_elem.h b/lib/librte_ring/rte_ring_elem.h\nindex 860f059ad..92e92f150 100644\n--- a/lib/librte_ring/rte_ring_elem.h\n+++ b/lib/librte_ring/rte_ring_elem.h\n@@ -24,6 +24,7 @@ extern \"C\" {\n #include <stdint.h>\n #include <sys/queue.h>\n #include <errno.h>\n+#include <string.h>\n #include <rte_common.h>\n #include <rte_config.h>\n #include <rte_memory.h>\n@@ -108,35 +109,16 @@ __rte_experimental\n struct rte_ring *rte_ring_create_elem(const char *name, unsigned count,\n \t\t\t\tunsigned esize, int socket_id, unsigned flags);\n \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- */\n-#define ENQUEUE_PTRS_ELEM(r, ring_start, prod_head, obj_table, esize, n) do { \\\n-\tif (esize == 4) \\\n-\t\tENQUEUE_PTRS_32(r, ring_start, prod_head, obj_table, n); \\\n-\telse if (esize == 8) \\\n-\t\tENQUEUE_PTRS_64(r, ring_start, prod_head, obj_table, n); \\\n-\telse if (esize == 16) \\\n-\t\tENQUEUE_PTRS_128(r, ring_start, prod_head, obj_table, n); \\\n-} while (0)\n-\n-#define ENQUEUE_PTRS_32(r, ring_start, prod_head, obj_table, n) do { \\\n+#define ENQUEUE_PTRS_GEN(r, ring_start, prod_head, obj_table, esize, n) do { \\\n \tunsigned int i; \\\n \tconst uint32_t size = (r)->size; \\\n \tuint32_t idx = prod_head & (r)->mask; \\\n \tuint32_t *ring = (uint32_t *)ring_start; \\\n \tuint32_t *obj = (uint32_t *)obj_table; \\\n+\tuint32_t sz = n * (esize / sizeof(uint32_t)); \\\n \tif (likely(idx + n < size)) { \\\n-\t\tfor (i = 0; i < (n & ((~(unsigned)0x7))); i += 8, idx += 8) { \\\n-\t\t\tring[idx] = obj[i]; \\\n-\t\t\tring[idx + 1] = obj[i + 1]; \\\n-\t\t\tring[idx + 2] = obj[i + 2]; \\\n-\t\t\tring[idx + 3] = obj[i + 3]; \\\n-\t\t\tring[idx + 4] = obj[i + 4]; \\\n-\t\t\tring[idx + 5] = obj[i + 5]; \\\n-\t\t\tring[idx + 6] = obj[i + 6]; \\\n-\t\t\tring[idx + 7] = obj[i + 7]; \\\n+\t\tfor (i = 0; i < (sz & ((~(unsigned)0x7))); i += 8, idx += 8) { \\\n+\t\t\tmemcpy (ring + i, obj + i, 8 * sizeof (uint32_t)); \\\n \t\t} \\\n \t\tswitch (n & 0x7) { \\\n \t\tcase 7: \\\n@@ -162,87 +144,16 @@ struct rte_ring *rte_ring_create_elem(const char *name, unsigned count,\n \t} \\\n } while (0)\n \n-#define ENQUEUE_PTRS_64(r, ring_start, prod_head, obj_table, n) do { \\\n-\tunsigned int i; \\\n-\tconst uint32_t size = (r)->size; \\\n-\tuint32_t idx = prod_head & (r)->mask; \\\n-\tuint64_t *ring = (uint64_t *)ring_start; \\\n-\tuint64_t *obj = (uint64_t *)obj_table; \\\n-\tif (likely(idx + n < size)) { \\\n-\t\tfor (i = 0; i < (n & ((~(unsigned)0x3))); i += 4, idx += 4) { \\\n-\t\t\tring[idx] = obj[i]; \\\n-\t\t\tring[idx + 1] = obj[i + 1]; \\\n-\t\t\tring[idx + 2] = obj[i + 2]; \\\n-\t\t\tring[idx + 3] = obj[i + 3]; \\\n-\t\t} \\\n-\t\tswitch (n & 0x3) { \\\n-\t\tcase 3: \\\n-\t\t\tring[idx++] = obj[i++]; /* fallthrough */ \\\n-\t\tcase 2: \\\n-\t\t\tring[idx++] = obj[i++]; /* fallthrough */ \\\n-\t\tcase 1: \\\n-\t\t\tring[idx++] = obj[i++]; \\\n-\t\t} \\\n-\t} else { \\\n-\t\tfor (i = 0; idx < size; i++, idx++)\\\n-\t\t\tring[idx] = obj[i]; \\\n-\t\tfor (idx = 0; i < n; i++, idx++) \\\n-\t\t\tring[idx] = obj[i]; \\\n-\t} \\\n-} while (0)\n-\n-#define ENQUEUE_PTRS_128(r, ring_start, prod_head, obj_table, n) do { \\\n-\tunsigned int i; \\\n-\tconst uint32_t size = (r)->size; \\\n-\tuint32_t idx = prod_head & (r)->mask; \\\n-\t__uint128_t *ring = (__uint128_t *)ring_start; \\\n-\t__uint128_t *obj = (__uint128_t *)obj_table; \\\n-\tif (likely(idx + n < size)) { \\\n-\t\tfor (i = 0; i < (n >> 1); i += 2, idx += 2) { \\\n-\t\t\tring[idx] = obj[i]; \\\n-\t\t\tring[idx + 1] = obj[i + 1]; \\\n-\t\t} \\\n-\t\tswitch (n & 0x1) { \\\n-\t\tcase 1: \\\n-\t\t\tring[idx++] = obj[i++]; \\\n-\t\t} \\\n-\t} else { \\\n-\t\tfor (i = 0; idx < size; i++, idx++)\\\n-\t\t\tring[idx] = obj[i]; \\\n-\t\tfor (idx = 0; i < n; i++, idx++) \\\n-\t\t\tring[idx] = obj[i]; \\\n-\t} \\\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- */\n-#define DEQUEUE_PTRS_ELEM(r, ring_start, cons_head, obj_table, esize, n) do { \\\n-\tif (esize == 4) \\\n-\t\tDEQUEUE_PTRS_32(r, ring_start, cons_head, obj_table, n); \\\n-\telse if (esize == 8) \\\n-\t\tDEQUEUE_PTRS_64(r, ring_start, cons_head, obj_table, n); \\\n-\telse if (esize == 16) \\\n-\t\tDEQUEUE_PTRS_128(r, ring_start, cons_head, obj_table, n); \\\n-} while (0)\n-\n-#define DEQUEUE_PTRS_32(r, ring_start, cons_head, obj_table, n) do { \\\n+#define DEQUEUE_PTRS_GEN(r, ring_start, cons_head, obj_table, esize, n) do { \\\n \tunsigned int i; \\\n \tuint32_t idx = cons_head & (r)->mask; \\\n \tconst uint32_t size = (r)->size; \\\n \tuint32_t *ring = (uint32_t *)ring_start; \\\n \tuint32_t *obj = (uint32_t *)obj_table; \\\n+\tuint32_t sz = n * (esize / sizeof(uint32_t)); \\\n \tif (likely(idx + n < size)) { \\\n-\t\tfor (i = 0; i < (n & (~(unsigned)0x7)); i += 8, idx += 8) {\\\n-\t\t\tobj[i] = ring[idx]; \\\n-\t\t\tobj[i + 1] = ring[idx + 1]; \\\n-\t\t\tobj[i + 2] = ring[idx + 2]; \\\n-\t\t\tobj[i + 3] = ring[idx + 3]; \\\n-\t\t\tobj[i + 4] = ring[idx + 4]; \\\n-\t\t\tobj[i + 5] = ring[idx + 5]; \\\n-\t\t\tobj[i + 6] = ring[idx + 6]; \\\n-\t\t\tobj[i + 7] = ring[idx + 7]; \\\n+\t\tfor (i = 0; i < (sz & ((~(unsigned)0x7))); i += 8, idx += 8) { \\\n+\t\t\tmemcpy (obj + i, ring + i, 8 * sizeof (uint32_t)); \\\n \t\t} \\\n \t\tswitch (n & 0x7) { \\\n \t\tcase 7: \\\n@@ -268,58 +179,6 @@ struct rte_ring *rte_ring_create_elem(const char *name, unsigned count,\n \t} \\\n } while (0)\n \n-#define DEQUEUE_PTRS_64(r, ring_start, cons_head, obj_table, n) do { \\\n-\tunsigned int i; \\\n-\tuint32_t idx = cons_head & (r)->mask; \\\n-\tconst uint32_t size = (r)->size; \\\n-\tuint64_t *ring = (uint64_t *)ring_start; \\\n-\tuint64_t *obj = (uint64_t *)obj_table; \\\n-\tif (likely(idx + n < size)) { \\\n-\t\tfor (i = 0; i < (n & (~(unsigned)0x3)); i += 4, idx += 4) {\\\n-\t\t\tobj[i] = ring[idx]; \\\n-\t\t\tobj[i + 1] = ring[idx + 1]; \\\n-\t\t\tobj[i + 2] = ring[idx + 2]; \\\n-\t\t\tobj[i + 3] = ring[idx + 3]; \\\n-\t\t} \\\n-\t\tswitch (n & 0x3) { \\\n-\t\tcase 3: \\\n-\t\t\tobj[i++] = ring[idx++]; /* fallthrough */ \\\n-\t\tcase 2: \\\n-\t\t\tobj[i++] = ring[idx++]; /* fallthrough */ \\\n-\t\tcase 1: \\\n-\t\t\tobj[i++] = ring[idx++]; \\\n-\t\t} \\\n-\t} else { \\\n-\t\tfor (i = 0; idx < size; i++, idx++) \\\n-\t\t\tobj[i] = ring[idx]; \\\n-\t\tfor (idx = 0; i < n; i++, idx++) \\\n-\t\t\tobj[i] = ring[idx]; \\\n-\t} \\\n-} while (0)\n-\n-#define DEQUEUE_PTRS_128(r, ring_start, cons_head, obj_table, n) do { \\\n-\tunsigned int i; \\\n-\tuint32_t idx = cons_head & (r)->mask; \\\n-\tconst uint32_t size = (r)->size; \\\n-\t__uint128_t *ring = (__uint128_t *)ring_start; \\\n-\t__uint128_t *obj = (__uint128_t *)obj_table; \\\n-\tif (likely(idx + n < size)) { \\\n-\t\tfor (i = 0; i < (n >> 1); i += 2, idx += 2) { \\\n-\t\t\tobj[i] = ring[idx]; \\\n-\t\t\tobj[i + 1] = ring[idx + 1]; \\\n-\t\t} \\\n-\t\tswitch (n & 0x1) { \\\n-\t\tcase 1: \\\n-\t\t\tobj[i++] = ring[idx++]; /* fallthrough */ \\\n-\t\t} \\\n-\t} else { \\\n-\t\tfor (i = 0; idx < size; i++, idx++) \\\n-\t\t\tobj[i] = ring[idx]; \\\n-\t\tfor (idx = 0; i < n; i++, idx++) \\\n-\t\t\tobj[i] = ring[idx]; \\\n-\t} \\\n-} while (0)\n-\n /* Between load and load. there might be cpu reorder in weak model\n  * (powerpc/arm).\n  * There are 2 choices for the users\n@@ -373,7 +232,7 @@ __rte_ring_do_enqueue_elem(struct rte_ring *r, void * const obj_table,\n \tif (n == 0)\n \t\tgoto end;\n \n-\tENQUEUE_PTRS_ELEM(r, &r[1], prod_head, obj_table, esize, n);\n+\tENQUEUE_PTRS_GEN(r, &r[1], prod_head, obj_table, esize, n);\n \n \tupdate_tail(&r->prod, prod_head, prod_next, is_sp, 1);\n end:\n@@ -420,7 +279,7 @@ __rte_ring_do_dequeue_elem(struct rte_ring *r, void *obj_table,\n \tif (n == 0)\n \t\tgoto end;\n \n-\tDEQUEUE_PTRS_ELEM(r, &r[1], cons_head, obj_table, esize, n);\n+\tDEQUEUE_PTRS_GEN(r, &r[1], cons_head, obj_table, esize, n);\n \n \tupdate_tail(&r->cons, cons_head, cons_next, is_sc, 0);\n \n",
    "prefixes": [
        "v5",
        "3/3"
    ]
}