Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/59718/?format=api
http://patches.dpdk.org/api/patches/59718/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190925171329.63734-7-yong.liu@intel.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": "<20190925171329.63734-7-yong.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190925171329.63734-7-yong.liu@intel.com", "date": "2019-09-25T17:13:20", "name": "[v3,06/15] vhost: flush vhost enqueue shadow ring by batch", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "fbdfe88b1c961ddce3d9480d8f9a4c54ca41c236", "submitter": { "id": 17, "url": "http://patches.dpdk.org/api/people/17/?format=api", "name": "Marvin Liu", "email": "yong.liu@intel.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/20190925171329.63734-7-yong.liu@intel.com/mbox/", "series": [ { "id": 6522, "url": "http://patches.dpdk.org/api/series/6522/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6522", "date": "2019-09-25T17:13:14", "name": "vhost packed ring performance optimization", "version": 3, "mbox": "http://patches.dpdk.org/series/6522/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/59718/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/59718/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 629F91BEB2;\n\tWed, 25 Sep 2019 11:32:55 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 17C791B203\n\tfor <dev@dpdk.org>; Wed, 25 Sep 2019 11:32:37 +0200 (CEST)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Sep 2019 02:32:37 -0700", "from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142])\n\tby fmsmga004.fm.intel.com with ESMTP; 25 Sep 2019 02:32:36 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.64,547,1559545200\"; d=\"scan'208\";a=\"213986186\"", "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": "Thu, 26 Sep 2019 01:13:20 +0800", "Message-Id": "<20190925171329.63734-7-yong.liu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190925171329.63734-1-yong.liu@intel.com>", "References": "<20190919163643.24130-2-yong.liu@intel.com>\n\t<20190925171329.63734-1-yong.liu@intel.com>", "Subject": "[dpdk-dev] [PATCH v3 06/15] vhost: flush vhost enqueue shadow ring\n\tby batch", "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 vhost enqueue shadow ring update, flush shadow ring until\nbuffered descriptors number exceed one batch. Thus virtio can receive\npackets at a faster frequency.\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 e50e137ca..18a207fc6 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -163,6 +163,7 @@ struct vhost_virtqueue {\n \t\tstruct vring_used_elem_packed *shadow_used_packed;\n \t};\n \tuint16_t shadow_used_idx;\n+\tuint16_t\t\tenqueue_shadow_count;\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 2ff7329b2..f85619dc2 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -169,6 +169,24 @@ update_shadow_used_ring_packed(struct vhost_virtqueue *vq,\n \tvq->shadow_used_packed[i].count = count;\n }\n \n+static __rte_always_inline void\n+update_enqueue_shadow_used_ring_packed(struct vhost_virtqueue *vq,\n+\tuint16_t desc_idx, uint32_t len, uint16_t count)\n+{\n+\t/* enqueue shadow flush action aligned with batch num */\n+\tif (!vq->shadow_used_idx)\n+\t\tvq->enqueue_shadow_count = vq->last_used_idx &\n+\t\t\t\t\t\tPACKED_BATCH_MASK;\n+\n+\tuint16_t i = vq->shadow_used_idx++;\n+\n+\tvq->shadow_used_packed[i].id = desc_idx;\n+\tvq->shadow_used_packed[i].len = len;\n+\tvq->shadow_used_packed[i].count = count;\n+\n+\tvq->enqueue_shadow_count += count;\n+}\n+\n static inline void\n do_data_copy_enqueue(struct virtio_net *dev, struct vhost_virtqueue *vq)\n {\n@@ -198,6 +216,23 @@ do_data_copy_dequeue(struct vhost_virtqueue *vq)\n \tvq->batch_copy_nb_elems = 0;\n }\n \n+static __rte_always_inline void\n+flush_enqueue_packed(struct virtio_net *dev,\n+\tstruct vhost_virtqueue *vq, uint32_t len[], uint16_t id[],\n+\tuint16_t count[], uint16_t num_buffers)\n+{\n+\tint i;\n+\tfor (i = 0; i < num_buffers; i++) {\n+\t\tupdate_enqueue_shadow_used_ring_packed(vq, id[i], len[i],\n+\t\t\t\t\t\t count[i]);\n+\n+\t\tif (vq->enqueue_shadow_count >= PACKED_BATCH_SIZE) {\n+\t\t\tdo_data_copy_enqueue(dev, vq);\n+\t\t\tflush_shadow_used_ring_packed(dev, vq);\n+\t\t}\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@@ -786,6 +821,9 @@ vhost_enqueue_single_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tuint16_t desc_count;\n \tuint32_t size = pkt->pkt_len + dev->vhost_hlen;\n \tuint16_t num_buffers = 0;\n+\tuint32_t buffer_len[vq->size];\n+\tuint16_t buffer_buf_id[vq->size];\n+\tuint16_t buffer_desc_count[vq->size];\n \n \tif (rxvq_is_mergeable(dev))\n \t\tmax_tries = vq->size - 1;\n@@ -811,6 +849,9 @@ vhost_enqueue_single_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\tlen = RTE_MIN(len, size);\n \t\tsize -= len;\n \n+\t\tbuffer_len[num_buffers] = len;\n+\t\tbuffer_buf_id[num_buffers] = buf_id;\n+\t\tbuffer_desc_count[num_buffers] = desc_count;\n \t\tnum_buffers += 1;\n \n \t\t*nr_descs += desc_count;\n@@ -822,6 +863,8 @@ vhost_enqueue_single_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tif (copy_mbuf_to_desc(dev, vq, pkt, buf_vec, nr_vec, num_buffers) < 0)\n \t\treturn -1;\n \n+\tflush_enqueue_packed(dev, vq, buffer_len, buffer_buf_id,\n+\t\t\t buffer_desc_count, num_buffers);\n \treturn 0;\n }\n \n", "prefixes": [ "v3", "06/15" ] }{ "id": 59718, "url": "