get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 103702,
    "url": "http://patchwork.dpdk.org/api/patches/103702/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1636021170-230805-1-git-send-email-jiayu.hu@intel.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": "<1636021170-230805-1-git-send-email-jiayu.hu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1636021170-230805-1-git-send-email-jiayu.hu@intel.com",
    "date": "2021-11-04T10:19:30",
    "name": "vhost: fix packed ring descriptor update in async enqueue",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "af82f24c3d8b5555c42c700c59b57dadef76020e",
    "submitter": {
        "id": 539,
        "url": "http://patchwork.dpdk.org/api/people/539/?format=api",
        "name": "Hu, Jiayu",
        "email": "jiayu.hu@intel.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patchwork.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1636021170-230805-1-git-send-email-jiayu.hu@intel.com/mbox/",
    "series": [
        {
            "id": 20292,
            "url": "http://patchwork.dpdk.org/api/series/20292/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=20292",
            "date": "2021-11-04T10:19:30",
            "name": "vhost: fix packed ring descriptor update in async enqueue",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/20292/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/103702/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/103702/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 1EAA0A0548;\n\tThu,  4 Nov 2021 04:55:21 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D382740E5A;\n\tThu,  4 Nov 2021 04:55:20 +0100 (CET)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n by mails.dpdk.org (Postfix) with ESMTP id 9734840DFD;\n Thu,  4 Nov 2021 04:55:19 +0100 (CET)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 03 Nov 2021 20:55:17 -0700",
            "from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.118.210])\n by orsmga006.jf.intel.com with ESMTP; 03 Nov 2021 20:55:14 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10157\"; a=\"317847252\"",
            "E=Sophos;i=\"5.87,207,1631602800\"; d=\"scan'208\";a=\"317847252\"",
            "E=Sophos;i=\"5.87,207,1631602800\"; d=\"scan'208\";a=\"450063355\""
        ],
        "X-ExtLoop1": "1",
        "From": "Jiayu Hu <jiayu.hu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "maxime.coquelin@redhat.com, chenbo.xia@intel.com, cheng1.jiang@intel.com,\n xingguang.he@intel.com, Jiayu Hu <jiayu.hu@intel.com>, stable@dpdk.org",
        "Date": "Thu,  4 Nov 2021 06:19:30 -0400",
        "Message-Id": "<1636021170-230805-1-git-send-email-jiayu.hu@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "Subject": "[dpdk-dev] [PATCH] vhost: fix packed ring descriptor update in\n async enqueue",
        "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": "For the packet using multiple descriptors, the flag of first\ndescriptor cannot be updated until finishing updating the flag\nof remaining descriptors. However, if the packet's descriptor\nindex is wrapped, the first descriptor's flag is updated earlier\nthan the others.\n\nFixes: 873e8dad6f49 (\"vhost: support packed ring in async datapath\")\nCc: stable@dpdk.org\n\nSigned-off-by: Jiayu Hu <jiayu.hu@intel.com>\n---\n lib/vhost/virtio_net.c | 122 ++++++++++++++++++-----------------------\n 1 file changed, 54 insertions(+), 68 deletions(-)",
    "diff": "diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c\nindex cef4bcf15c..b3d954aab4 100644\n--- a/lib/vhost/virtio_net.c\n+++ b/lib/vhost/virtio_net.c\n@@ -1549,60 +1549,6 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev,\n \treturn pkt_idx;\n }\n \n-static __rte_always_inline void\n-vhost_update_used_packed(struct vhost_virtqueue *vq,\n-\t\t\tstruct vring_used_elem_packed *shadow_ring,\n-\t\t\tuint16_t count)\n-{\n-\tint i;\n-\tuint16_t used_idx = vq->last_used_idx;\n-\tuint16_t head_idx = vq->last_used_idx;\n-\tuint16_t head_flags = 0;\n-\n-\tif (count == 0)\n-\t\treturn;\n-\n-\t/* Split loop in two to save memory barriers */\n-\tfor (i = 0; i < count; i++) {\n-\t\tvq->desc_packed[used_idx].id = shadow_ring[i].id;\n-\t\tvq->desc_packed[used_idx].len = shadow_ring[i].len;\n-\n-\t\tused_idx += shadow_ring[i].count;\n-\t\tif (used_idx >= vq->size)\n-\t\t\tused_idx -= vq->size;\n-\t}\n-\n-\t/* The ordering for storing desc flags needs to be enforced. */\n-\trte_atomic_thread_fence(__ATOMIC_RELEASE);\n-\n-\tfor (i = 0; i < count; i++) {\n-\t\tuint16_t flags;\n-\n-\t\tif (vq->shadow_used_packed[i].len)\n-\t\t\tflags = VRING_DESC_F_WRITE;\n-\t\telse\n-\t\t\tflags = 0;\n-\n-\t\tif (vq->used_wrap_counter) {\n-\t\t\tflags |= VRING_DESC_F_USED;\n-\t\t\tflags |= VRING_DESC_F_AVAIL;\n-\t\t} else {\n-\t\t\tflags &= ~VRING_DESC_F_USED;\n-\t\t\tflags &= ~VRING_DESC_F_AVAIL;\n-\t\t}\n-\n-\t\tif (i > 0) {\n-\t\t\tvq->desc_packed[vq->last_used_idx].flags = flags;\n-\t\t} else {\n-\t\t\thead_idx = vq->last_used_idx;\n-\t\t\thead_flags = flags;\n-\t\t}\n-\n-\t\tvq_inc_last_used_packed(vq, shadow_ring[i].count);\n-\t}\n-\n-\tvq->desc_packed[head_idx].flags = head_flags;\n-}\n \n static __rte_always_inline int\n vhost_enqueue_async_packed(struct virtio_net *dev,\n@@ -1819,23 +1765,63 @@ write_back_completed_descs_packed(struct vhost_virtqueue *vq,\n \t\t\t\tuint16_t n_buffers)\n {\n \tstruct vhost_async *async = vq->async;\n-\tuint16_t nr_left = n_buffers;\n-\tuint16_t from, to;\n+\tuint16_t from = async->last_buffer_idx_packed;\n+\tuint16_t used_idx = vq->last_used_idx;\n+\tuint16_t head_idx = vq->last_used_idx;\n+\tuint16_t head_flags = 0;\n+\tuint16_t i;\n \n-\tdo {\n-\t\tfrom = async->last_buffer_idx_packed;\n-\t\tto = (from + nr_left) % vq->size;\n-\t\tif (to > from) {\n-\t\t\tvhost_update_used_packed(vq, async->buffers_packed + from, to - from);\n-\t\t\tasync->last_buffer_idx_packed += nr_left;\n-\t\t\tnr_left = 0;\n+\t/* Split loop in two to save memory barriers */\n+\tfor (i = 0; i < n_buffers; i++) {\n+\t\tvq->desc_packed[used_idx].id = async->buffers_packed[from].id;\n+\t\tvq->desc_packed[used_idx].len = async->buffers_packed[from].len;\n+\n+\t\tused_idx += async->buffers_packed[from].count;\n+\t\tif (used_idx >= vq->size)\n+\t\t\tused_idx -= vq->size;\n+\n+\t\tfrom++;\n+\t\tif (from >= vq->size)\n+\t\t\tfrom = 0;\n+\t}\n+\n+\t/* The ordering for storing desc flags needs to be enforced. */\n+\trte_atomic_thread_fence(__ATOMIC_RELEASE);\n+\n+\tfrom = async->last_buffer_idx_packed;\n+\n+\tfor (i = 0; i < n_buffers; i++) {\n+\t\tuint16_t flags;\n+\n+\t\tif (async->buffers_packed[from].len)\n+\t\t\tflags = VRING_DESC_F_WRITE;\n+\t\telse\n+\t\t\tflags = 0;\n+\n+\t\tif (vq->used_wrap_counter) {\n+\t\t\tflags |= VRING_DESC_F_USED;\n+\t\t\tflags |= VRING_DESC_F_AVAIL;\n \t\t} else {\n-\t\t\tvhost_update_used_packed(vq, async->buffers_packed + from,\n-\t\t\t\tvq->size - from);\n-\t\t\tasync->last_buffer_idx_packed = 0;\n-\t\t\tnr_left -= vq->size - from;\n+\t\t\tflags &= ~VRING_DESC_F_USED;\n+\t\t\tflags &= ~VRING_DESC_F_AVAIL;\n \t\t}\n-\t} while (nr_left > 0);\n+\n+\t\tif (i > 0) {\n+\t\t\tvq->desc_packed[vq->last_used_idx].flags = flags;\n+\t\t} else {\n+\t\t\thead_idx = vq->last_used_idx;\n+\t\t\thead_flags = flags;\n+\t\t}\n+\n+\t\tvq_inc_last_used_packed(vq, async->buffers_packed[from].count);\n+\n+\t\tfrom++;\n+\t\tif (from == vq->size)\n+\t\t\tfrom = 0;\n+\t}\n+\n+\tvq->desc_packed[head_idx].flags = head_flags;\n+\tasync->last_buffer_idx_packed = from;\n }\n \n static __rte_always_inline uint16_t\n",
    "prefixes": []
}