get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 79782,
    "url": "http://patches.dpdk.org/api/patches/79782/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201006132905.46205-2-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": "<20201006132905.46205-2-honnappa.nagarahalli@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201006132905.46205-2-honnappa.nagarahalli@arm.com",
    "date": "2020-10-06T13:29:05",
    "name": "[RFC,v2,1/1] lib/ring: add scatter gather APIs",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b2a7c28831744a0aa4300c6df88f7a04be16de6e",
    "submitter": {
        "id": 1045,
        "url": "http://patches.dpdk.org/api/people/1045/?format=api",
        "name": "Honnappa Nagarahalli",
        "email": "honnappa.nagarahalli@arm.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20201006132905.46205-2-honnappa.nagarahalli@arm.com/mbox/",
    "series": [
        {
            "id": 12720,
            "url": "http://patches.dpdk.org/api/series/12720/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12720",
            "date": "2020-10-06T13:29:04",
            "name": "lib/ring: add scatter gather APIs",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/12720/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/79782/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/79782/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 A1988A04BB;\n\tTue,  6 Oct 2020 15:29:35 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8B02A1B3D9;\n\tTue,  6 Oct 2020 15:29:17 +0200 (CEST)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id AD27B2C6E\n for <dev@dpdk.org>; Tue,  6 Oct 2020 15:29:16 +0200 (CEST)",
            "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2EE7A1476;\n Tue,  6 Oct 2020 06:29:15 -0700 (PDT)",
            "from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com\n [10.118.12.27])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 16E6C3F71F;\n Tue,  6 Oct 2020 06:29:15 -0700 (PDT)"
        ],
        "From": "Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>",
        "To": "dev@dpdk.org, honnappa.nagarahalli@arm.com, konstantin.ananyev@intel.com",
        "Cc": "olivier.matz@6wind.com,\n\tdavid.marchand@redhat.com,\n\tnd@arm.com",
        "Date": "Tue,  6 Oct 2020 08:29:05 -0500",
        "Message-Id": "<20201006132905.46205-2-honnappa.nagarahalli@arm.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20201006132905.46205-1-honnappa.nagarahalli@arm.com>",
        "References": "<20200224203931.21256-1-honnappa.nagarahalli@arm.com>\n <20201006132905.46205-1-honnappa.nagarahalli@arm.com>",
        "Subject": "[dpdk-dev] [RFC v2 1/1] lib/ring: add scatter gather APIs",
        "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": "Add scatter gather APIs to avoid intermediate memcpy. Use cases\nthat involve copying large amount of data to/from the ring\ncan benefit from these APIs.\n\nSigned-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\n---\n lib/librte_ring/meson.build        |   3 +-\n lib/librte_ring/rte_ring_elem.h    |   1 +\n lib/librte_ring/rte_ring_peek_sg.h | 552 +++++++++++++++++++++++++++++\n 3 files changed, 555 insertions(+), 1 deletion(-)\n create mode 100644 lib/librte_ring/rte_ring_peek_sg.h",
    "diff": "diff --git a/lib/librte_ring/meson.build b/lib/librte_ring/meson.build\nindex 31c0b4649..377694713 100644\n--- a/lib/librte_ring/meson.build\n+++ b/lib/librte_ring/meson.build\n@@ -12,4 +12,5 @@ headers = files('rte_ring.h',\n \t\t'rte_ring_peek.h',\n \t\t'rte_ring_peek_c11_mem.h',\n \t\t'rte_ring_rts.h',\n-\t\t'rte_ring_rts_c11_mem.h')\n+\t\t'rte_ring_rts_c11_mem.h',\n+\t\t'rte_ring_peek_sg.h')\ndiff --git a/lib/librte_ring/rte_ring_elem.h b/lib/librte_ring/rte_ring_elem.h\nindex 938b398fc..7d3933f15 100644\n--- a/lib/librte_ring/rte_ring_elem.h\n+++ b/lib/librte_ring/rte_ring_elem.h\n@@ -1079,6 +1079,7 @@ rte_ring_dequeue_burst_elem(struct rte_ring *r, void *obj_table,\n \n #ifdef ALLOW_EXPERIMENTAL_API\n #include <rte_ring_peek.h>\n+#include <rte_ring_peek_sg.h>\n #endif\n \n #include <rte_ring.h>\ndiff --git a/lib/librte_ring/rte_ring_peek_sg.h b/lib/librte_ring/rte_ring_peek_sg.h\nnew file mode 100644\nindex 000000000..97d5764a6\n--- /dev/null\n+++ b/lib/librte_ring/rte_ring_peek_sg.h\n@@ -0,0 +1,552 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ *\n+ * Copyright (c) 2020 Arm\n+ * Copyright (c) 2007-2009 Kip Macy kmacy@freebsd.org\n+ * All rights reserved.\n+ * Derived from FreeBSD's bufring.h\n+ * Used as BSD-3 Licensed with permission from Kip Macy.\n+ */\n+\n+#ifndef _RTE_RING_PEEK_SG_H_\n+#define _RTE_RING_PEEK_SG_H_\n+\n+/**\n+ * @file\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ * It is not recommended to include this file directly.\n+ * Please include <rte_ring_elem.h> instead.\n+ *\n+ * Ring Peek Scatter Gather APIs\n+ * Introduction of rte_ring with scatter gather serialized producer/consumer\n+ * (HTS sync mode) makes it possible to split public enqueue/dequeue API\n+ * into 3 phases:\n+ * - enqueue/dequeue start\n+ * - copy data to/from the ring\n+ * - enqueue/dequeue finish\n+ * Along with the advantages of the peek APIs, these APIs provide the ability\n+ * to avoid copying of the data to temporary area.\n+ *\n+ * Note that right now this new API is available only for two sync modes:\n+ * 1) Single Producer/Single Consumer (RTE_RING_SYNC_ST)\n+ * 2) Serialized Producer/Serialized Consumer (RTE_RING_SYNC_MT_HTS).\n+ * It is a user responsibility to create/init ring with appropriate sync\n+ * modes selected.\n+ *\n+ * Example usage:\n+ * // read 1 elem from the ring:\n+ * n = rte_ring_enqueue_sg_bulk_start(ring, 32, &sgd, NULL);\n+ * if (n != 0) {\n+ *\t//Copy objects in the ring\n+ *\tmemcpy (sgd->ptr1, obj, sgd->n1 * sizeof(uintptr_t));\n+ *\tif (n != sgd->n1)\n+ *\t\t//Second memcpy because of wrapround\n+ *\t\tn2 = n - sgd->n1;\n+ *\t\tmemcpy (sgd->ptr2, obj[n2], n2 * sizeof(uintptr_t));\n+ *\trte_ring_dequeue_sg_finish(ring, n);\n+ * }\n+ *\n+ * Note that between _start_ and _finish_ none other thread can proceed\n+ * with enqueue(/dequeue) operation till _finish_ completes.\n+ */\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <rte_ring_peek_c11_mem.h>\n+\n+/* Rock that needs to be passed between reserve and commit APIs */\n+struct rte_ring_sg_data {\n+\t/* Pointer to the first space in the ring */\n+\tvoid **ptr1;\n+\t/* Pointer to the second space in the ring if there is wrap-around */\n+\tvoid **ptr2;\n+\t/* Number of elements in the first pointer. If this is equal to\n+\t * the number of elements requested, then ptr2 is NULL.\n+\t * Otherwise, subtracting n1 from number of elements requested\n+\t * will give the number of elements available at ptr2.\n+\t */\n+\tunsigned int n1;\n+};\n+\n+static __rte_always_inline void\n+__rte_ring_get_elem_addr_64(struct rte_ring *r, uint32_t head,\n+\tuint32_t num, void **dst1, uint32_t *n1, void **dst2)\n+{\n+\tuint32_t idx = head & r->mask;\n+\tuint64_t *ring = (uint64_t *)&r[1];\n+\n+\t*dst1 = ring + idx;\n+\t*n1 = num;\n+\n+\tif (idx + num > r->size) {\n+\t\t*n1 = num - (r->size - idx - 1);\n+\t\t*dst2 = ring;\n+\t}\n+}\n+\n+static __rte_always_inline void\n+__rte_ring_get_elem_addr_128(struct rte_ring *r, uint32_t head,\n+\tuint32_t num, void **dst1, uint32_t *n1, void **dst2)\n+{\n+\tuint32_t idx = head & r->mask;\n+\trte_int128_t *ring = (rte_int128_t *)&r[1];\n+\n+\t*dst1 = ring + idx;\n+\t*n1 = num;\n+\n+\tif (idx + num > r->size) {\n+\t\t*n1 = num - (r->size - idx - 1);\n+\t\t*dst2 = ring;\n+\t}\n+}\n+\n+static __rte_always_inline void\n+__rte_ring_get_elem_addr(struct rte_ring *r, uint32_t head,\n+\tuint32_t esize, uint32_t num, void **dst1, uint32_t *n1, void **dst2)\n+{\n+\tif (esize == 8)\n+\t\t__rte_ring_get_elem_addr_64(r, head,\n+\t\t\t\t\t\tnum, dst1, n1, dst2);\n+\telse if (esize == 16)\n+\t\t__rte_ring_get_elem_addr_128(r, head,\n+\t\t\t\t\t\tnum, dst1, n1, dst2);\n+\telse {\n+\t\tuint32_t idx, scale, nr_idx;\n+\t\tuint32_t *ring = (uint32_t *)&r[1];\n+\n+\t\t/* Normalize to uint32_t */\n+\t\tscale = esize / sizeof(uint32_t);\n+\t\tidx = head & r->mask;\n+\t\tnr_idx = idx * scale;\n+\n+\t\t*dst1 = ring + nr_idx;\n+\t\t*n1 = num;\n+\n+\t\tif (idx + num > r->size) {\n+\t\t\t*n1 = num - (r->size - idx - 1);\n+\t\t\t*dst2 = ring;\n+\t\t}\n+\t}\n+}\n+\n+/**\n+ * @internal This function moves prod head value.\n+ */\n+static __rte_always_inline unsigned int\n+__rte_ring_do_enqueue_sg_elem_start(struct rte_ring *r, unsigned int esize,\n+\t\tuint32_t n, enum rte_ring_queue_behavior behavior,\n+\t\tstruct rte_ring_sg_data *sgd, unsigned int *free_space)\n+{\n+\tuint32_t free, head, next;\n+\n+\tswitch (r->prod.sync_type) {\n+\tcase RTE_RING_SYNC_ST:\n+\t\tn = __rte_ring_move_prod_head(r, RTE_RING_SYNC_ST, n,\n+\t\t\tbehavior, &head, &next, &free);\n+\t\t__rte_ring_get_elem_addr(r, head, esize, n, (void **)&sgd->ptr1,\n+\t\t\t&sgd->n1, (void **)&sgd->ptr2);\n+\t\tbreak;\n+\tcase RTE_RING_SYNC_MT_HTS:\n+\t\tn = __rte_ring_hts_move_prod_head(r, n, behavior, &head, &free);\n+\t\t__rte_ring_get_elem_addr(r, head, esize, n, (void **)&sgd->ptr1,\n+\t\t\t&sgd->n1, (void **)&sgd->ptr2);\n+\t\tbreak;\n+\tcase RTE_RING_SYNC_MT:\n+\tcase RTE_RING_SYNC_MT_RTS:\n+\tdefault:\n+\t\t/* unsupported mode, shouldn't be here */\n+\t\tRTE_ASSERT(0);\n+\t\tn = 0;\n+\t\tfree = 0;\n+\t}\n+\n+\tif (free_space != NULL)\n+\t\t*free_space = free - n;\n+\treturn n;\n+}\n+\n+/**\n+ * Start to enqueue several objects on the ring.\n+ * Note that no actual objects are put in the queue by this function,\n+ * it just reserves space for the user on the ring.\n+ * User has to copy objects into the queue using the returned pointers.\n+ * User should call rte_ring_enqueue_sg_bulk_elem_finish to complete the\n+ * enqueue operation.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param esize\n+ *   The size of ring element, in bytes. It must be a multiple of 4.\n+ * @param n\n+ *   The number of objects to add in the ring.\n+ * @param sgd\n+ *   The scatter-gather data containing pointers for copying data.\n+ * @param free_space\n+ *   if non-NULL, returns the amount of space in the ring after the\n+ *   reservation operation has finished.\n+ * @return\n+ *   The number of objects that can be enqueued, either 0 or n\n+ */\n+__rte_experimental\n+static __rte_always_inline unsigned int\n+rte_ring_enqueue_sg_bulk_elem_start(struct rte_ring *r, unsigned int esize,\n+\tunsigned int n, struct rte_ring_sg_data *sgd, unsigned int *free_space)\n+{\n+\treturn __rte_ring_do_enqueue_sg_elem_start(r, esize, n,\n+\t\t\tRTE_RING_QUEUE_FIXED, sgd, free_space);\n+}\n+\n+/**\n+ * Start to enqueue several pointers to objects on the ring.\n+ * Note that no actual pointers are put in the queue by this function,\n+ * it just reserves space for the user on the ring.\n+ * User has to copy pointers to objects into the queue using the\n+ * returned pointers.\n+ * User should call rte_ring_enqueue_sg_bulk_finish to complete the\n+ * enqueue operation.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param n\n+ *   The number of objects to add in the ring.\n+ * @param sgd\n+ *   The scatter-gather data containing pointers for copying data.\n+ * @param free_space\n+ *   if non-NULL, returns the amount of space in the ring after the\n+ *   reservation operation has finished.\n+ * @return\n+ *   The number of objects that can be enqueued, either 0 or n\n+ */\n+__rte_experimental\n+static __rte_always_inline unsigned int\n+rte_ring_enqueue_sg_bulk_start(struct rte_ring *r, unsigned int n,\n+\tstruct rte_ring_sg_data *sgd, unsigned int *free_space)\n+{\n+\treturn rte_ring_enqueue_sg_bulk_elem_start(r, sizeof(uintptr_t), n,\n+\t\t\t\t\t\t\tsgd, free_space);\n+}\n+/**\n+ * Start to enqueue several objects on the ring.\n+ * Note that no actual objects are put in the queue by this function,\n+ * it just reserves space for the user on the ring.\n+ * User has to copy objects into the queue using the returned pointers.\n+ * User should call rte_ring_enqueue_sg_bulk_elem_finish to complete the\n+ * enqueue operation.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param esize\n+ *   The size of ring element, in bytes. It must be a multiple of 4.\n+ * @param n\n+ *   The number of objects to add in the ring.\n+ * @param sgd\n+ *   The scatter-gather data containing pointers for copying data.\n+ * @param free_space\n+ *   if non-NULL, returns the amount of space in the ring after the\n+ *   reservation operation has finished.\n+ * @return\n+ *   The number of objects that can be enqueued, either 0 or n\n+ */\n+__rte_experimental\n+static __rte_always_inline unsigned int\n+rte_ring_enqueue_sg_burst_elem_start(struct rte_ring *r, unsigned int esize,\n+\tunsigned int n, struct rte_ring_sg_data *sgd, unsigned int *free_space)\n+{\n+\treturn __rte_ring_do_enqueue_sg_elem_start(r, esize, n,\n+\t\t\tRTE_RING_QUEUE_VARIABLE, sgd, free_space);\n+}\n+\n+/**\n+ * Start to enqueue several pointers to objects on the ring.\n+ * Note that no actual pointers are put in the queue by this function,\n+ * it just reserves space for the user on the ring.\n+ * User has to copy pointers to objects into the queue using the\n+ * returned pointers.\n+ * User should call rte_ring_enqueue_sg_bulk_finish to complete the\n+ * enqueue operation.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param n\n+ *   The number of objects to add in the ring.\n+ * @param sgd\n+ *   The scatter-gather data containing pointers for copying data.\n+ * @param free_space\n+ *   if non-NULL, returns the amount of space in the ring after the\n+ *   reservation operation has finished.\n+ * @return\n+ *   The number of objects that can be enqueued, either 0 or n\n+ */\n+__rte_experimental\n+static __rte_always_inline unsigned int\n+rte_ring_enqueue_sg_burst_start(struct rte_ring *r, unsigned int n,\n+\tstruct rte_ring_sg_data *sgd, unsigned int *free_space)\n+{\n+\treturn rte_ring_enqueue_sg_burst_elem_start(r, sizeof(uintptr_t), n,\n+\t\t\t\t\t\t\tsgd, free_space);\n+}\n+\n+/**\n+ * Complete enqueuing several objects on the ring.\n+ * Note that number of objects to enqueue should not exceed previous\n+ * enqueue_start return value.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param n\n+ *   The number of objects to add to the ring.\n+ */\n+__rte_experimental\n+static __rte_always_inline void\n+rte_ring_enqueue_sg_elem_finish(struct rte_ring *r, unsigned int n)\n+{\n+\tuint32_t tail;\n+\n+\tswitch (r->prod.sync_type) {\n+\tcase RTE_RING_SYNC_ST:\n+\t\tn = __rte_ring_st_get_tail(&r->prod, &tail, n);\n+\t\t__rte_ring_st_set_head_tail(&r->prod, tail, n, 1);\n+\t\tbreak;\n+\tcase RTE_RING_SYNC_MT_HTS:\n+\t\tn = __rte_ring_hts_get_tail(&r->hts_prod, &tail, n);\n+\t\t__rte_ring_hts_set_head_tail(&r->hts_prod, tail, n, 1);\n+\t\tbreak;\n+\tcase RTE_RING_SYNC_MT:\n+\tcase RTE_RING_SYNC_MT_RTS:\n+\tdefault:\n+\t\t/* unsupported mode, shouldn't be here */\n+\t\tRTE_ASSERT(0);\n+\t}\n+}\n+\n+/**\n+ * Complete enqueuing several pointers to objects on the ring.\n+ * Note that number of objects to enqueue should not exceed previous\n+ * enqueue_start return value.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param n\n+ *   The number of pointers to objects to add to the ring.\n+ */\n+__rte_experimental\n+static __rte_always_inline void\n+rte_ring_enqueue_sg_finish(struct rte_ring *r, unsigned int n)\n+{\n+\trte_ring_enqueue_sg_elem_finish(r, n);\n+}\n+\n+/**\n+ * @internal This function moves cons head value and copies up to *n*\n+ * objects from the ring to the user provided obj_table.\n+ */\n+static __rte_always_inline unsigned int\n+__rte_ring_do_dequeue_sg_elem_start(struct rte_ring *r,\n+\tuint32_t esize, uint32_t n, enum rte_ring_queue_behavior behavior,\n+\tstruct rte_ring_sg_data *sgd, unsigned int *available)\n+{\n+\tuint32_t avail, head, next;\n+\n+\tswitch (r->cons.sync_type) {\n+\tcase RTE_RING_SYNC_ST:\n+\t\tn = __rte_ring_move_cons_head(r, RTE_RING_SYNC_ST, n,\n+\t\t\tbehavior, &head, &next, &avail);\n+\t\t__rte_ring_get_elem_addr(r, head, esize, n,\n+\t\t\t\t\tsgd->ptr1, &sgd->n1, sgd->ptr2);\n+\t\tbreak;\n+\tcase RTE_RING_SYNC_MT_HTS:\n+\t\tn = __rte_ring_hts_move_cons_head(r, n, behavior,\n+\t\t\t&head, &avail);\n+\t\t__rte_ring_get_elem_addr(r, head, esize, n,\n+\t\t\t\t\tsgd->ptr1, &sgd->n1, sgd->ptr2);\n+\t\tbreak;\n+\tcase RTE_RING_SYNC_MT:\n+\tcase RTE_RING_SYNC_MT_RTS:\n+\tdefault:\n+\t\t/* unsupported mode, shouldn't be here */\n+\t\tRTE_ASSERT(0);\n+\t\tn = 0;\n+\t\tavail = 0;\n+\t}\n+\n+\tif (available != NULL)\n+\t\t*available = avail - n;\n+\treturn n;\n+}\n+\n+/**\n+ * Start to dequeue several objects from the ring.\n+ * Note that no actual objects are copied from the queue by this function.\n+ * User has to copy objects from the queue using the returned pointers.\n+ * User should call rte_ring_dequeue_sg_bulk_elem_finish to complete the\n+ * dequeue operation.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param esize\n+ *   The size of ring element, in bytes. It must be a multiple of 4.\n+ * @param n\n+ *   The number of objects to remove from the ring.\n+ * @param sgd\n+ *   The scatter-gather data containing pointers for copying data.\n+ * @param available\n+ *   If non-NULL, returns the number of remaining ring entries after the\n+ *   dequeue has finished.\n+ * @return\n+ *   The number of objects that can be dequeued, either 0 or n\n+ */\n+__rte_experimental\n+static __rte_always_inline unsigned int\n+rte_ring_dequeue_sg_bulk_elem_start(struct rte_ring *r, unsigned int esize,\n+\tunsigned int n, struct rte_ring_sg_data *sgd, unsigned int *available)\n+{\n+\treturn __rte_ring_do_dequeue_sg_elem_start(r, esize, n,\n+\t\t\tRTE_RING_QUEUE_FIXED, sgd, available);\n+}\n+\n+/**\n+ * Start to dequeue several pointers to objects from the ring.\n+ * Note that no actual pointers are removed from the queue by this function.\n+ * User has to copy pointers to objects from the queue using the\n+ * returned pointers.\n+ * User should call rte_ring_dequeue_sg_bulk_finish to complete the\n+ * dequeue operation.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param n\n+ *   The number of objects to remove from the ring.\n+ * @param sgd\n+ *   The scatter-gather data containing pointers for copying data.\n+ * @param available\n+ *   If non-NULL, returns the number of remaining ring entries after the\n+ *   dequeue has finished.\n+ * @return\n+ *   The number of objects that can be dequeued, either 0 or n\n+ */\n+__rte_experimental\n+static __rte_always_inline unsigned int\n+rte_ring_dequeue_sg_bulk_start(struct rte_ring *r, unsigned int n,\n+\tstruct rte_ring_sg_data *sgd, unsigned int *available)\n+{\n+\treturn rte_ring_dequeue_sg_bulk_elem_start(r, sizeof(uintptr_t),\n+\t\tn, sgd, available);\n+}\n+\n+/**\n+ * Start to dequeue several objects from the ring.\n+ * Note that no actual objects are copied from the queue by this function.\n+ * User has to copy objects from the queue using the returned pointers.\n+ * User should call rte_ring_dequeue_sg_burst_elem_finish to complete the\n+ * dequeue operation.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param esize\n+ *   The size of ring element, in bytes. It must be a multiple of 4.\n+ *   This must be the same value used while creating the ring. Otherwise\n+ *   the results are undefined.\n+ * @param n\n+ *   The number of objects to dequeue from the ring.\n+ * @param sgd\n+ *   The scatter-gather data containing pointers for copying data.\n+ * @param available\n+ *   If non-NULL, returns the number of remaining ring entries after the\n+ *   dequeue has finished.\n+ * @return\n+ *   The number of objects that can be dequeued, either 0 or n\n+ */\n+__rte_experimental\n+static __rte_always_inline unsigned int\n+rte_ring_dequeue_sg_burst_elem_start(struct rte_ring *r, unsigned int esize,\n+\tunsigned int n, struct rte_ring_sg_data *sgd, unsigned int *available)\n+{\n+\treturn __rte_ring_do_dequeue_sg_elem_start(r, esize, n,\n+\t\t\tRTE_RING_QUEUE_VARIABLE, sgd, available);\n+}\n+\n+/**\n+ * Start to dequeue several pointers to objects from the ring.\n+ * Note that no actual pointers are removed from the queue by this function.\n+ * User has to copy pointers to objects from the queue using the\n+ * returned pointers.\n+ * User should call rte_ring_dequeue_sg_burst_finish to complete the\n+ * dequeue operation.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param n\n+ *   The number of objects to remove from the ring.\n+ * @param sgd\n+ *   The scatter-gather data containing pointers for copying data.\n+ * @param available\n+ *   If non-NULL, returns the number of remaining ring entries after the\n+ *   dequeue has finished.\n+ * @return\n+ *   The number of objects that can be dequeued, either 0 or n\n+ */\n+__rte_experimental\n+static __rte_always_inline unsigned int\n+rte_ring_dequeue_sg_burst_start(struct rte_ring *r, unsigned int n,\n+\t\tstruct rte_ring_sg_data *sgd, unsigned int *available)\n+{\n+\treturn rte_ring_dequeue_sg_burst_elem_start(r, sizeof(uintptr_t), n,\n+\t\t\tsgd, available);\n+}\n+\n+/**\n+ * Complete dequeuing several objects from the ring.\n+ * Note that number of objects to dequeued should not exceed previous\n+ * dequeue_start return value.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param n\n+ *   The number of objects to remove from the ring.\n+ */\n+__rte_experimental\n+static __rte_always_inline void\n+rte_ring_dequeue_sg_elem_finish(struct rte_ring *r, unsigned int n)\n+{\n+\tuint32_t tail;\n+\n+\tswitch (r->cons.sync_type) {\n+\tcase RTE_RING_SYNC_ST:\n+\t\tn = __rte_ring_st_get_tail(&r->cons, &tail, n);\n+\t\t__rte_ring_st_set_head_tail(&r->cons, tail, n, 0);\n+\t\tbreak;\n+\tcase RTE_RING_SYNC_MT_HTS:\n+\t\tn = __rte_ring_hts_get_tail(&r->hts_cons, &tail, n);\n+\t\t__rte_ring_hts_set_head_tail(&r->hts_cons, tail, n, 0);\n+\t\tbreak;\n+\tcase RTE_RING_SYNC_MT:\n+\tcase RTE_RING_SYNC_MT_RTS:\n+\tdefault:\n+\t\t/* unsupported mode, shouldn't be here */\n+\t\tRTE_ASSERT(0);\n+\t}\n+}\n+\n+/**\n+ * Complete dequeuing several objects from the ring.\n+ * Note that number of objects to dequeued should not exceed previous\n+ * dequeue_start return value.\n+ *\n+ * @param r\n+ *   A pointer to the ring structure.\n+ * @param n\n+ *   The number of objects to remove from the ring.\n+ */\n+__rte_experimental\n+static __rte_always_inline void\n+rte_ring_dequeue_sg_finish(struct rte_ring *r, unsigned int n)\n+{\n+\trte_ring_dequeue_elem_finish(r, n);\n+}\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_RING_PEEK_SG_H_ */\n",
    "prefixes": [
        "RFC",
        "v2",
        "1/1"
    ]
}