get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 61173,
    "url": "https://patches.dpdk.org/api/patches/61173/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20191015143014.1656-10-yong.liu@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": "<20191015143014.1656-10-yong.liu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191015143014.1656-10-yong.liu@intel.com",
    "date": "2019-10-15T14:30:10",
    "name": "[v5,09/13] vhost: buffer packed ring dequeue updates",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c271950475dd19c11397abf3f9a860448f15f2f7",
    "submitter": {
        "id": 17,
        "url": "https://patches.dpdk.org/api/people/17/?format=api",
        "name": "Marvin Liu",
        "email": "yong.liu@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/20191015143014.1656-10-yong.liu@intel.com/mbox/",
    "series": [
        {
            "id": 6845,
            "url": "https://patches.dpdk.org/api/series/6845/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6845",
            "date": "2019-10-15T14:30:01",
            "name": "vhost packed ring performance optimization",
            "version": 5,
            "mbox": "https://patches.dpdk.org/series/6845/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/61173/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/61173/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 EE3D51D416;\n\tTue, 15 Oct 2019 08:52:01 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id E0EBB1D171\n\tfor <dev@dpdk.org>; Tue, 15 Oct 2019 08:51:50 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t14 Oct 2019 23:51:49 -0700",
            "from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142])\n\tby orsmga001.jf.intel.com with ESMTP; 14 Oct 2019 23:51:44 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.67,298,1566889200\"; d=\"scan'208\";a=\"279098555\"",
        "From": "Marvin Liu <yong.liu@intel.com>",
        "To": "maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, \n\tstephen@networkplumber.org, gavin.hu@arm.com",
        "Cc": "dev@dpdk.org,\n\tMarvin Liu <yong.liu@intel.com>",
        "Date": "Tue, 15 Oct 2019 22:30:10 +0800",
        "Message-Id": "<20191015143014.1656-10-yong.liu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191015143014.1656-1-yong.liu@intel.com>",
        "References": "<20191009133849.69002-1-yong.liu@intel.com>\n\t<20191015143014.1656-1-yong.liu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 09/13] vhost: buffer packed ring dequeue\n\tupdates",
        "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": "Buffer used ring updates as many as possible in vhost dequeue function\nfor coordinating with virtio driver. For supporting buffer, shadow used\nring element should contain descriptor's flags. First shadowed ring\nindex was recorded for calculating buffered number.\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>",
    "diff": "diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex bf3c30f43..bc4d039df 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -42,6 +42,8 @@\n #define PACKED_DESC_ENQUEUE_USED_FLAG(w)\t\\\n \t((w) ? (VRING_DESC_F_AVAIL | VRING_DESC_F_USED | VRING_DESC_F_WRITE) : \\\n \t\tVRING_DESC_F_WRITE)\n+#define PACKED_DESC_DEQUEUE_USED_FLAG(w)\t\\\n+\t((w) ? (VRING_DESC_F_AVAIL | VRING_DESC_F_USED) : 0x0)\n #define PACKED_DESC_SINGLE_DEQUEUE_FLAG (VRING_DESC_F_NEXT | \\\n \t\t\t\t\t VRING_DESC_F_INDIRECT)\n \n@@ -114,6 +116,7 @@ struct log_cache_entry {\n \n struct vring_used_elem_packed {\n \tuint16_t id;\n+\tuint16_t flags;\n \tuint32_t len;\n \tuint32_t count;\n };\n@@ -171,6 +174,8 @@ struct vhost_virtqueue {\n \tuint16_t                shadow_used_idx;\n \t/* Record packed ring enqueue latest desc cache aligned index */\n \tuint16_t\t\tshadow_aligned_idx;\n+\t/* Record packed ring first dequeue desc index */\n+\tuint16_t\t\tshadow_last_used_idx;\n \tstruct vhost_vring_addr ring_addrs;\n \n \tstruct batch_copy_elem\t*batch_copy_elems;\ndiff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex ec17353da..750d16f50 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -154,6 +154,23 @@ vhost_flush_enqueue_shadow_packed(struct virtio_net *dev,\n \tvhost_log_cache_sync(dev, vq);\n }\n \n+static __rte_always_inline void\n+vhost_flush_dequeue_shadow_packed(struct virtio_net *dev,\n+\t\t\t\t  struct vhost_virtqueue *vq)\n+{\n+\tstruct vring_used_elem_packed *used_elem = &vq->shadow_used_packed[0];\n+\n+\tvq->desc_packed[vq->shadow_last_used_idx].id = used_elem->id;\n+\trte_smp_wmb();\n+\tvq->desc_packed[vq->shadow_last_used_idx].flags = used_elem->flags;\n+\n+\tvhost_log_cache_used_vring(dev, vq, vq->shadow_last_used_idx *\n+\t\t\t\t   sizeof(struct vring_packed_desc),\n+\t\t\t\t   sizeof(struct vring_packed_desc));\n+\tvq->shadow_used_idx = 0;\n+\tvhost_log_cache_sync(dev, vq);\n+}\n+\n static __rte_always_inline void\n vhost_flush_enqueue_batch_packed(struct virtio_net *dev,\n \t\t\t\t struct vhost_virtqueue *vq,\n@@ -247,6 +264,70 @@ flush_shadow_used_ring_packed(struct virtio_net *dev,\n \tvhost_log_cache_sync(dev, vq);\n }\n \n+static __rte_always_inline void\n+vhost_shadow_dequeue_batch_packed(struct virtio_net *dev,\n+\t\t\t\t  struct vhost_virtqueue *vq,\n+\t\t\t\t  uint16_t *ids)\n+{\n+\tuint16_t flags;\n+\tuint16_t i;\n+\tuint16_t begin;\n+\n+\tflags = PACKED_DESC_DEQUEUE_USED_FLAG(vq->used_wrap_counter);\n+\n+\tif (!vq->shadow_used_idx) {\n+\t\tvq->shadow_last_used_idx = vq->last_used_idx;\n+\t\tvq->shadow_used_packed[0].id  = ids[0];\n+\t\tvq->shadow_used_packed[0].len = 0;\n+\t\tvq->shadow_used_packed[0].count = 1;\n+\t\tvq->shadow_used_packed[0].flags = flags;\n+\t\tvq->shadow_used_idx++;\n+\t\tbegin = 1;\n+\t} else\n+\t\tbegin = 0;\n+\n+\tfor_each_try_unroll(i, begin, PACKED_BATCH_SIZE) {\n+\t\tvq->desc_packed[vq->last_used_idx + i].id = ids[i];\n+\t\tvq->desc_packed[vq->last_used_idx + i].len = 0;\n+\t}\n+\n+\trte_smp_wmb();\n+\tfor_each_try_unroll(i, begin, PACKED_BATCH_SIZE)\n+\t\tvq->desc_packed[vq->last_used_idx + i].flags = flags;\n+\n+\tvhost_log_cache_used_vring(dev, vq, vq->last_used_idx *\n+\t\t\t\t   sizeof(struct vring_packed_desc),\n+\t\t\t\t   sizeof(struct vring_packed_desc) *\n+\t\t\t\t   PACKED_BATCH_SIZE);\n+\tvhost_log_cache_sync(dev, vq);\n+\n+\tvq_inc_last_used_packed(vq, PACKED_BATCH_SIZE);\n+}\n+\n+static __rte_always_inline void\n+vhost_shadow_dequeue_single_packed(struct vhost_virtqueue *vq,\n+\t\t\t\t   uint16_t buf_id,\n+\t\t\t\t   uint16_t count)\n+{\n+\tif (!vq->shadow_used_idx) {\n+\t\tvq->shadow_last_used_idx = vq->last_used_idx;\n+\n+\t\tvq->shadow_used_packed[0].id  = buf_id;\n+\t\tvq->shadow_used_packed[0].len = 0;\n+\t\tvq->shadow_used_packed[0].count = count;\n+\t\tvq->shadow_used_packed[0].flags =\n+\t\t\tPACKED_DESC_DEQUEUE_USED_FLAG(vq->used_wrap_counter);\n+\t\tvq->shadow_used_idx++;\n+\t} else {\n+\t\tvq->desc_packed[vq->last_used_idx].id = buf_id;\n+\t\tvq->desc_packed[vq->last_used_idx].len = 0;\n+\t\tvq->desc_packed[vq->last_used_idx].flags =\n+\t\t\tPACKED_DESC_DEQUEUE_USED_FLAG(vq->used_wrap_counter);\n+\t}\n+\n+\tvq_inc_last_used_packed(vq, count);\n+}\n+\n static __rte_always_inline void\n update_shadow_used_ring_packed(struct vhost_virtqueue *vq,\n \t\t\t uint16_t desc_idx, uint32_t len, uint16_t count)\n@@ -314,6 +395,26 @@ vhost_shadow_enqueue_single_packed(struct virtio_net *dev,\n \t}\n }\n \n+static __rte_unused void\n+vhost_flush_dequeue_packed(struct virtio_net *dev,\n+\t\t\t   struct vhost_virtqueue *vq)\n+{\n+\tint shadow_count;\n+\tif (!vq->shadow_used_idx)\n+\t\treturn;\n+\n+\tshadow_count = vq->last_used_idx - vq->shadow_last_used_idx;\n+\tif (shadow_count <= 0)\n+\t\tshadow_count += vq->size;\n+\n+\t/* buffer used descs as many as possible when doing dequeue */\n+\tif ((uint32_t)shadow_count >= (vq->size - MAX_PKT_BURST)) {\n+\t\tdo_data_copy_dequeue(vq);\n+\t\tvhost_flush_dequeue_shadow_packed(dev, vq);\n+\t\tvhost_vring_call_packed(dev, vq);\n+\t}\n+}\n+\n /* avoid write operation when necessary, to lessen cache issues */\n #define ASSIGN_UNLESS_EQUAL(var, val) do {\t\\\n \tif ((var) != (val))\t\t\t\\\n@@ -1788,6 +1889,8 @@ virtio_dev_tx_batch_packed(struct virtio_net *dev,\n \t\t\t   pkts[i]->pkt_len);\n \t}\n \n+\tvhost_shadow_dequeue_batch_packed(dev, vq, ids);\n+\n \tvq_inc_last_avail_packed(vq, PACKED_BATCH_SIZE);\n \n \treturn 0;\n@@ -1843,6 +1946,8 @@ virtio_dev_tx_single_packed(struct virtio_net *dev,\n \t\t\t\t\t&desc_count))\n \t\treturn -1;\n \n+\tvhost_shadow_dequeue_single_packed(vq, buf_id, desc_count);\n+\n \tvq_inc_last_avail_packed(vq, desc_count);\n \n \treturn 0;\n",
    "prefixes": [
        "v5",
        "09/13"
    ]
}