get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43390,
    "url": "https://patches.dpdk.org/api/patches/43390/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180726013721.30200-1-tiwei.bie@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": "<20180726013721.30200-1-tiwei.bie@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180726013721.30200-1-tiwei.bie@intel.com",
    "date": "2018-07-26T01:37:20",
    "name": "[1/2] vhost: fix overflow on shadow used ring",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "a6c4ddad6b39307af8dc709b3f613fed79ed9b1c",
    "submitter": {
        "id": 617,
        "url": "https://patches.dpdk.org/api/people/617/?format=api",
        "name": "Tiwei Bie",
        "email": "tiwei.bie@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180726013721.30200-1-tiwei.bie@intel.com/mbox/",
    "series": [
        {
            "id": 781,
            "url": "https://patches.dpdk.org/api/series/781/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=781",
            "date": "2018-07-26T01:37:20",
            "name": "[1/2] vhost: fix overflow on shadow used ring",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/781/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/43390/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/43390/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 89DB825D9;\n\tThu, 26 Jul 2018 03:38:22 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 065DF1C01\n\tfor <dev@dpdk.org>; Thu, 26 Jul 2018 03:38:20 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Jul 2018 18:38:19 -0700",
            "from debian.sh.intel.com ([10.67.104.228])\n\tby FMSMGA003.fm.intel.com with ESMTP; 25 Jul 2018 18:38:02 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,403,1526367600\"; d=\"scan'208\";a=\"67576599\"",
        "From": "Tiwei Bie <tiwei.bie@intel.com>",
        "To": "maxime.coquelin@redhat.com,\n\tzhihong.wang@intel.com,\n\tdev@dpdk.org",
        "Cc": "lei.a.yao@intel.com",
        "Date": "Thu, 26 Jul 2018 09:37:20 +0800",
        "Message-Id": "<20180726013721.30200-1-tiwei.bie@intel.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "Subject": "[dpdk-dev] [PATCH 1/2] vhost: fix overflow on shadow used ring",
        "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": "The shadow used ring's size is the same as the vq's size,\nso we shouldn't try more than \"vq size\" times. Besides,\nthe element pointed by avail->idx isn't available to the\ndevice, so we will return error when try \"vq size\" times.\n\nFixes: 24e4844048e1 (\"vhost: unify Rx mergeable and non-mergeable paths\")\nFixes: a922401f35cc (\"vhost: add Rx support for packed ring\")\n\nSigned-off-by: Tiwei Bie <tiwei.bie@intel.com>\n---\n lib/librte_vhost/virtio_net.c | 37 ++++++++++++++++-------------------\n 1 file changed, 17 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 5d4b97587..3b11b353c 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -415,13 +415,20 @@ reserve_avail_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tcur_idx  = vq->last_avail_idx;\n \n \tif (rxvq_is_mergeable(dev))\n-\t\tmax_tries = vq->size;\n+\t\tmax_tries = vq->size - 1;\n \telse\n \t\tmax_tries = 1;\n \n \twhile (size > 0) {\n \t\tif (unlikely(cur_idx == avail_head))\n \t\t\treturn -1;\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 \n \t\tif (unlikely(fill_vec_buf_split(dev, vq, cur_idx,\n \t\t\t\t\t\t&vec_idx, buf_vec,\n@@ -433,16 +440,7 @@ reserve_avail_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\tsize -= len;\n \n \t\tcur_idx++;\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@@ -582,11 +580,19 @@ reserve_avail_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tavail_idx = vq->last_avail_idx;\n \n \tif (rxvq_is_mergeable(dev))\n-\t\tmax_tries = vq->size;\n+\t\tmax_tries = vq->size - 1;\n \telse\n \t\tmax_tries = 1;\n \n \twhile (size > 0) {\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+\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@@ -603,16 +609,7 @@ reserve_avail_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\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",
    "prefixes": [
        "1/2"
    ]
}