get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42440,
    "url": "http://patches.dpdk.org/api/patches/42440/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180705210741.17974-13-maxime.coquelin@redhat.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": "<20180705210741.17974-13-maxime.coquelin@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180705210741.17974-13-maxime.coquelin@redhat.com",
    "date": "2018-07-05T21:07:38",
    "name": "[v8,12/15] vhost: add Rx support for packed ring",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "60e4471bd8e649d94513056b1e1321db2ae2a3ca",
    "submitter": {
        "id": 512,
        "url": "http://patches.dpdk.org/api/people/512/?format=api",
        "name": "Maxime Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180705210741.17974-13-maxime.coquelin@redhat.com/mbox/",
    "series": [
        {
            "id": 443,
            "url": "http://patches.dpdk.org/api/series/443/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=443",
            "date": "2018-07-05T21:07:26",
            "name": "Vhost: add support to packed ring layout",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/443/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42440/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42440/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Subject": "[dpdk-dev] [PATCH v8 12/15] vhost: add Rx support for packed ring",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Cc": "mst@redhat.com, jasowang@redhat.com, wexu@redhat.com,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "From": "Maxime Coquelin <maxime.coquelin@redhat.com>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.6",
        "Date": "Thu,  5 Jul 2018 23:07:38 +0200",
        "Precedence": "list",
        "In-Reply-To": "<20180705210741.17974-1-maxime.coquelin@redhat.com>",
        "X-Greylist": [
            "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.6]); Thu, 05 Jul 2018 21:08:09 +0000 (UTC)",
            "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.6]); \n\tThu, 05 Jul 2018 21:08:09 +0000 (UTC) for IP:'10.11.54.6'\n\tDOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:''"
        ],
        "X-Mailman-Version": "2.1.15",
        "Errors-To": "dev-bounces@dpdk.org",
        "References": "<20180705210741.17974-1-maxime.coquelin@redhat.com>",
        "Delivered-To": "patchwork@dpdk.org",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 991771BF88;\n\tThu,  5 Jul 2018 23:08:11 +0200 (CEST)",
            "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id 7ED451BF79\n\tfor <dev@dpdk.org>; Thu,  5 Jul 2018 23:08:09 +0200 (CEST)",
            "from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 1BC5E400ADE4;\n\tThu,  5 Jul 2018 21:08:09 +0000 (UTC)",
            "from localhost.localdomain (ovpn-112-37.ams2.redhat.com\n\t[10.36.112.37])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 5C4142156899;\n\tThu,  5 Jul 2018 21:08:07 +0000 (UTC)"
        ],
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Message-Id": "<20180705210741.17974-13-maxime.coquelin@redhat.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "To": "tiwei.bie@intel.com, zhihong.wang@intel.com, jfreimann@redhat.com,\n\tdev@dpdk.org"
    },
    "content": "Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/librte_vhost/virtio_net.c | 123 ++++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 119 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 68dba3081..ebf62071f 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -130,7 +130,7 @@ update_shadow_used_ring_split(struct vhost_virtqueue *vq,\n \tvq->shadow_used_split[i].len = len;\n }\n \n-static __rte_unused __rte_always_inline void\n+static __rte_always_inline void\n flush_shadow_used_ring_packed(struct virtio_net *dev,\n \t\t\tstruct vhost_virtqueue *vq)\n {\n@@ -184,7 +184,7 @@ flush_shadow_used_ring_packed(struct virtio_net *dev,\n \tvhost_log_cache_sync(dev, vq);\n }\n \n-static __rte_unused __rte_always_inline void\n+static __rte_always_inline void\n update_shadow_used_ring_packed(struct vhost_virtqueue *vq,\n \t\t\t uint16_t desc_idx, uint16_t len, uint16_t count)\n {\n@@ -506,7 +506,7 @@ fill_vec_buf_packed_indirect(struct virtio_net *dev,\n \treturn 0;\n }\n \n-static __rte_unused __rte_always_inline int\n+static __rte_always_inline int\n fill_vec_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\t\tuint16_t avail_idx, uint16_t *desc_count,\n \t\t\t\tstruct buf_vector *buf_vec, uint16_t *vec_idx,\n@@ -561,6 +561,65 @@ fill_vec_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \treturn 0;\n }\n \n+/*\n+ * Returns -1 on fail, 0 on success\n+ */\n+static inline int\n+reserve_avail_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\t\t\t\tuint32_t size, struct buf_vector *buf_vec,\n+\t\t\t\tuint16_t *nr_vec, uint16_t *num_buffers,\n+\t\t\t\tuint16_t *nr_descs)\n+{\n+\tuint16_t avail_idx;\n+\tuint16_t vec_idx = 0;\n+\tuint16_t max_tries, tries = 0;\n+\n+\tuint16_t buf_id = 0;\n+\tuint16_t len = 0;\n+\tuint16_t desc_count;\n+\n+\t*num_buffers = 0;\n+\tavail_idx = vq->last_avail_idx;\n+\n+\tif (rxvq_is_mergeable(dev))\n+\t\tmax_tries = vq->size;\n+\telse\n+\t\tmax_tries = 1;\n+\n+\twhile (size > 0) {\n+\t\tif (unlikely(fill_vec_buf_packed(dev, vq,\n+\t\t\t\t\t\tavail_idx, &desc_count,\n+\t\t\t\t\t\tbuf_vec, &vec_idx,\n+\t\t\t\t\t\t&buf_id, &len,\n+\t\t\t\t\t\tVHOST_ACCESS_RO) < 0))\n+\t\t\treturn -1;\n+\n+\t\tlen = RTE_MIN(len, size);\n+\t\tupdate_shadow_used_ring_packed(vq, buf_id, len, desc_count);\n+\t\tsize -= len;\n+\n+\t\tavail_idx += desc_count;\n+\t\tif (avail_idx >= vq->size)\n+\t\t\tavail_idx -= vq->size;\n+\n+\t\t*nr_descs += desc_count;\n+\t\ttries++;\n+\t\t*num_buffers += 1;\n+\n+\t\t/*\n+\t\t * if we tried all available ring items, and still\n+\t\t * can't get enough buf, it means something abnormal\n+\t\t * happened.\n+\t\t */\n+\t\tif (unlikely(tries > max_tries))\n+\t\t\treturn -1;\n+\t}\n+\n+\t*nr_vec = vec_idx;\n+\n+\treturn 0;\n+}\n+\n static __rte_always_inline int\n copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\t    struct rte_mbuf *m, struct buf_vector *buf_vec,\n@@ -773,6 +832,59 @@ virtio_dev_rx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \treturn pkt_idx;\n }\n \n+static __rte_always_inline uint32_t\n+virtio_dev_rx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\tstruct rte_mbuf **pkts, uint32_t count)\n+{\n+\tuint32_t pkt_idx = 0;\n+\tuint16_t num_buffers;\n+\tstruct buf_vector buf_vec[BUF_VECTOR_MAX];\n+\n+\tfor (pkt_idx = 0; pkt_idx < count; pkt_idx++) {\n+\t\tuint32_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen;\n+\t\tuint16_t nr_vec = 0;\n+\t\tuint16_t nr_descs = 0;\n+\n+\t\tif (unlikely(reserve_avail_buf_packed(dev, vq,\n+\t\t\t\t\t\tpkt_len, buf_vec, &nr_vec,\n+\t\t\t\t\t\t&num_buffers, &nr_descs) < 0)) {\n+\t\t\tVHOST_LOG_DEBUG(VHOST_DATA,\n+\t\t\t\t\"(%d) failed to get enough desc from vring\\n\",\n+\t\t\t\tdev->vid);\n+\t\t\tvq->shadow_used_idx -= num_buffers;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\trte_prefetch0((void *)(uintptr_t)buf_vec[0].buf_addr);\n+\n+\t\tVHOST_LOG_DEBUG(VHOST_DATA, \"(%d) current index %d | end index %d\\n\",\n+\t\t\tdev->vid, vq->last_avail_idx,\n+\t\t\tvq->last_avail_idx + num_buffers);\n+\n+\t\tif (copy_mbuf_to_desc(dev, vq, pkts[pkt_idx],\n+\t\t\t\t\t\tbuf_vec, nr_vec,\n+\t\t\t\t\t\tnum_buffers) < 0) {\n+\t\t\tvq->shadow_used_idx -= num_buffers;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tvq->last_avail_idx += nr_descs;\n+\t\tif (vq->last_avail_idx >= vq->size) {\n+\t\t\tvq->last_avail_idx -= vq->size;\n+\t\t\tvq->avail_wrap_counter ^= 1;\n+\t\t}\n+\t}\n+\n+\tdo_data_copy_enqueue(dev, vq);\n+\n+\tif (likely(vq->shadow_used_idx)) {\n+\t\tflush_shadow_used_ring_packed(dev, vq);\n+\t\tvhost_vring_call(dev, vq);\n+\t}\n+\n+\treturn pkt_idx;\n+}\n+\n static __rte_always_inline uint32_t\n virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,\n \tstruct rte_mbuf **pkts, uint32_t count)\n@@ -804,7 +916,10 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,\n \tif (count == 0)\n \t\tgoto out;\n \n-\tcount = virtio_dev_rx_split(dev, vq, pkts, count);\n+\tif (vq_is_packed(dev))\n+\t\tcount = virtio_dev_rx_packed(dev, vq, pkts, count);\n+\telse\n+\t\tcount = virtio_dev_rx_split(dev, vq, pkts, count);\n \n out:\n \tif (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))\n",
    "prefixes": [
        "v8",
        "12/15"
    ]
}