get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 95878,
    "url": "https://patches.dpdk.org/api/patches/95878/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210715095030.55454-1-cheng1.jiang@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": "<20210715095030.55454-1-cheng1.jiang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210715095030.55454-1-cheng1.jiang@intel.com",
    "date": "2021-07-15T09:50:30",
    "name": "[v2] vhost: fix index overflow for packed ring in async vhost",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "fdf195c1afbeffd8300f31734cb4a82d29c42db3",
    "submitter": {
        "id": 1530,
        "url": "https://patches.dpdk.org/api/people/1530/?format=api",
        "name": "Jiang, Cheng1",
        "email": "Cheng1.jiang@intel.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210715095030.55454-1-cheng1.jiang@intel.com/mbox/",
    "series": [
        {
            "id": 17835,
            "url": "https://patches.dpdk.org/api/series/17835/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17835",
            "date": "2021-07-15T09:50:30",
            "name": "[v2] vhost: fix index overflow for packed ring in async vhost",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/17835/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/95878/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/95878/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id BAE0FA0548;\n\tThu, 15 Jul 2021 12:06:58 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id A266F4014D;\n\tThu, 15 Jul 2021 12:06:58 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id 929A840143;\n Thu, 15 Jul 2021 12:06:56 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 15 Jul 2021 03:06:55 -0700",
            "from dpdk_jiangcheng.sh.intel.com ([10.67.119.149])\n by fmsmga008.fm.intel.com with ESMTP; 15 Jul 2021 03:06:52 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10045\"; a=\"232339820\"",
            "E=Sophos;i=\"5.84,240,1620716400\"; d=\"scan'208\";a=\"232339820\"",
            "E=Sophos;i=\"5.84,240,1620716400\"; d=\"scan'208\";a=\"466530269\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cheng Jiang <cheng1.jiang@intel.com>",
        "To": "maxime.coquelin@redhat.com,\n\tChenbo.Xia@intel.com",
        "Cc": "dev@dpdk.org, jiayu.hu@intel.com, yvonnex.yang@intel.com,\n Cheng Jiang <cheng1.jiang@intel.com>, stable@dpdk.org",
        "Date": "Thu, 15 Jul 2021 09:50:30 +0000",
        "Message-Id": "<20210715095030.55454-1-cheng1.jiang@intel.com>",
        "X-Mailer": "git-send-email 2.29.2",
        "In-Reply-To": "<20210708104432.46275-1-cheng1.jiang@intel.com>",
        "References": "<20210708104432.46275-1-cheng1.jiang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2] vhost: fix index overflow for packed ring in\n async vhost",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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": "We introduced some new indexes in packed ring of async vhost. They\nwill eventually overflow and lead to errors if the ring size is not\na power of 2. This patch is to check and keep these indexes within a\nreasonable range.\n\nFixes: 873e8dad6f49 (\"vhost: support packed ring in async datapath\")\nCc: stable@dpdk.org\n\nSigned-off-by: Cheng Jiang <cheng1.jiang@intel.com>\n---\n lib/vhost/virtio_net.c | 21 ++++++++++++++-------\n 1 file changed, 14 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c\nindex f4a2c88d8b..bfb2bf8fc4 100644\n--- a/lib/vhost/virtio_net.c\n+++ b/lib/vhost/virtio_net.c\n@@ -2036,7 +2036,7 @@ virtio_dev_rx_async_submit_packed(struct virtio_net *dev,\n \n \t\tslot_idx = (vq->async_pkts_idx + num_async_pkts) % vq->size;\n \t\tif (it_pool[it_idx].count) {\n-\t\t\tuint16_t from, to;\n+\t\t\tuint16_t from;\n \n \t\t\tasync_descs_idx += num_descs;\n \t\t\tasync_fill_desc(&tdes[pkt_burst_idx++],\n@@ -2055,11 +2055,13 @@ virtio_dev_rx_async_submit_packed(struct virtio_net *dev,\n \t\t\t * descriptors.\n \t\t\t */\n \t\t\tfrom = vq->shadow_used_idx - num_buffers;\n-\t\t\tto = vq->async_buffer_idx_packed % vq->size;\n \t\t\tstore_dma_desc_info_packed(vq->shadow_used_packed,\n-\t\t\t\t\tvq->async_buffers_packed, vq->size, from, to, num_buffers);\n+\t\t\t\t\tvq->async_buffers_packed, vq->size, from,\n+\t\t\t\t\tvq->async_buffer_idx_packed, num_buffers);\n \n \t\t\tvq->async_buffer_idx_packed += num_buffers;\n+\t\t\tif (vq->async_buffer_idx_packed >= vq->size)\n+\t\t\t\tvq->async_buffer_idx_packed -= vq->size;\n \t\t\tvq->shadow_used_idx -= num_buffers;\n \t\t} else {\n \t\t\tcomp_pkts[num_done_pkts++] = pkts[pkt_idx];\n@@ -2112,6 +2114,8 @@ virtio_dev_rx_async_submit_packed(struct virtio_net *dev,\n \t\tdma_error_handler_packed(vq, async_descs, async_descs_idx, slot_idx, pkt_err,\n \t\t\t\t\t&pkt_idx, &num_async_pkts, &num_done_pkts);\n \tvq->async_pkts_idx += num_async_pkts;\n+\tif (vq->async_pkts_idx >= vq->size)\n+\t\tvq->async_pkts_idx -= vq->size;\n \t*comp_count = num_done_pkts;\n \n \tif (likely(vq->shadow_used_idx)) {\n@@ -2160,7 +2164,7 @@ write_back_completed_descs_packed(struct vhost_virtqueue *vq,\n \tuint16_t from, to;\n \n \tdo {\n-\t\tfrom = vq->last_async_buffer_idx_packed % vq->size;\n+\t\tfrom = vq->last_async_buffer_idx_packed;\n \t\tto = (from + nr_left) % vq->size;\n \t\tif (to > from) {\n \t\t\tvhost_update_used_packed(vq, vq->async_buffers_packed + from, to - from);\n@@ -2169,7 +2173,7 @@ write_back_completed_descs_packed(struct vhost_virtqueue *vq,\n \t\t} else {\n \t\t\tvhost_update_used_packed(vq, vq->async_buffers_packed + from,\n \t\t\t\tvq->size - from);\n-\t\t\tvq->last_async_buffer_idx_packed += vq->size - from;\n+\t\t\tvq->last_async_buffer_idx_packed = 0;\n \t\t\tnr_left -= vq->size - from;\n \t\t}\n \t} while (nr_left > 0);\n@@ -2252,10 +2256,13 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,\n \t\t\tvhost_vring_call_split(dev, vq);\n \t\t}\n \t} else {\n-\t\tif (vq_is_packed(dev))\n+\t\tif (vq_is_packed(dev)) {\n \t\t\tvq->last_async_buffer_idx_packed += n_buffers;\n-\t\telse\n+\t\t\tif (vq->last_async_buffer_idx_packed >= vq->size)\n+\t\t\t\tvq->last_async_buffer_idx_packed -= vq->size;\n+\t\t} else {\n \t\t\tvq->last_async_desc_idx_split += n_descs;\n+\t\t}\n \t}\n \n done:\n",
    "prefixes": [
        "v2"
    ]
}