Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/61845/?format=api
http://patches.dpdk.org/api/patches/61845/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191024160832.14543-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": "<20191024160832.14543-7-yong.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20191024160832.14543-7-yong.liu@intel.com", "date": "2019-10-24T16:08:25", "name": "[v9,06/13] vhost: add packed ring batch dequeue", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "b6f1ed6bbeaa9c9d56def3d410eb62901ecd2b7c", "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/20191024160832.14543-7-yong.liu@intel.com/mbox/", "series": [ { "id": 7033, "url": "http://patches.dpdk.org/api/series/7033/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7033", "date": "2019-10-24T16:08:19", "name": "vhost packed ring performance optimization", "version": 9, "mbox": "http://patches.dpdk.org/series/7033/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/61845/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/61845/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 5198B1E870;\n\tThu, 24 Oct 2019 10:29:03 +0200 (CEST)", "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id 1981B1E54F\n\tfor <dev@dpdk.org>; Thu, 24 Oct 2019 10:28:45 +0200 (CEST)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Oct 2019 01:28:45 -0700", "from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142])\n\tby fmsmga002.fm.intel.com with ESMTP; 24 Oct 2019 01:28: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.68,224,1569308400\"; d=\"scan'208\";a=\"228431091\"", "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": "Fri, 25 Oct 2019 00:08:25 +0800", "Message-Id": "<20191024160832.14543-7-yong.liu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20191024160832.14543-1-yong.liu@intel.com>", "References": "<20191021220813.55236-1-yong.liu@intel.com>\n\t<20191024160832.14543-1-yong.liu@intel.com>", "Subject": "[dpdk-dev] [PATCH v9 06/13] vhost: add packed ring batch dequeue", "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": "Add batch dequeue function like enqueue function for packed ring, batch\ndequeue function will not support chained descritpors, single packet\ndequeue function will handle it.\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/librte_vhost/vhost.h | 3 +\n lib/librte_vhost/virtio_net.c | 111 ++++++++++++++++++++++++++++++++++\n 2 files changed, 114 insertions(+)", "diff": "diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex a2b9221e0..67724c342 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -39,6 +39,9 @@\n \n #define VHOST_LOG_CACHE_NR 32\n \n+#define PACKED_DESC_SINGLE_DEQUEUE_FLAG (VRING_DESC_F_NEXT | \\\n+\t\t\t\t\t VRING_DESC_F_INDIRECT)\n+\n #define PACKED_BATCH_SIZE (RTE_CACHE_LINE_SIZE / \\\n \t\t\t sizeof(struct vring_packed_desc))\n #define PACKED_BATCH_MASK (PACKED_BATCH_SIZE - 1)\ndiff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 87f2ae49e..76435204f 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -1635,6 +1635,117 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \treturn i;\n }\n \n+static __rte_always_inline int\n+vhost_reserve_avail_batch_packed(struct virtio_net *dev,\n+\t\t\t\t struct vhost_virtqueue *vq,\n+\t\t\t\t struct rte_mempool *mbuf_pool,\n+\t\t\t\t struct rte_mbuf **pkts,\n+\t\t\t\t uint16_t avail_idx,\n+\t\t\t\t uintptr_t *desc_addrs,\n+\t\t\t\t uint16_t *ids)\n+{\n+\tbool wrap = vq->avail_wrap_counter;\n+\tstruct vring_packed_desc *descs = vq->desc_packed;\n+\tstruct virtio_net_hdr *hdr;\n+\tuint64_t lens[PACKED_BATCH_SIZE];\n+\tuint64_t buf_lens[PACKED_BATCH_SIZE];\n+\tuint32_t buf_offset = dev->vhost_hlen;\n+\tuint16_t flags, i;\n+\n+\tif (unlikely(avail_idx & PACKED_BATCH_MASK))\n+\t\treturn -1;\n+\tif (unlikely((avail_idx + PACKED_BATCH_SIZE) > vq->size))\n+\t\treturn -1;\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\tflags = descs[avail_idx + i].flags;\n+\t\tif (unlikely((wrap != !!(flags & VRING_DESC_F_AVAIL)) ||\n+\t\t\t (wrap == !!(flags & VRING_DESC_F_USED)) ||\n+\t\t\t (flags & PACKED_DESC_SINGLE_DEQUEUE_FLAG)))\n+\t\t\treturn -1;\n+\t}\n+\n+\trte_smp_rmb();\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n+\t\tlens[i] = descs[avail_idx + i].len;\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\tdesc_addrs[i] = vhost_iova_to_vva(dev, vq,\n+\t\t\t\t\t\t descs[avail_idx + i].addr,\n+\t\t\t\t\t\t &lens[i], VHOST_ACCESS_RW);\n+\t}\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\tif (unlikely((lens[i] != descs[avail_idx + i].len)))\n+\t\t\treturn -1;\n+\t}\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\tpkts[i] = virtio_dev_pktmbuf_alloc(dev, mbuf_pool, lens[i]);\n+\t\tif (!pkts[i])\n+\t\t\tgoto free_buf;\n+\t}\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n+\t\tbuf_lens[i] = pkts[i]->buf_len - pkts[i]->data_off;\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\tif (unlikely(buf_lens[i] < (lens[i] - buf_offset)))\n+\t\t\tgoto free_buf;\n+\t}\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\tpkts[i]->pkt_len = descs[avail_idx + i].len - buf_offset;\n+\t\tpkts[i]->data_len = pkts[i]->pkt_len;\n+\t\tids[i] = descs[avail_idx + i].id;\n+\t}\n+\n+\tif (virtio_net_with_host_offload(dev)) {\n+\t\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\t\thdr = (struct virtio_net_hdr *)(desc_addrs[i]);\n+\t\t\tvhost_dequeue_offload(hdr, pkts[i]);\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+\n+free_buf:\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++)\n+\t\trte_pktmbuf_free(pkts[i]);\n+\n+\treturn -1;\n+}\n+\n+static __rte_unused int\n+virtio_dev_tx_batch_packed(struct virtio_net *dev,\n+\t\t\t struct vhost_virtqueue *vq,\n+\t\t\t struct rte_mempool *mbuf_pool,\n+\t\t\t struct rte_mbuf **pkts)\n+{\n+\tuint16_t avail_idx = vq->last_avail_idx;\n+\tuint32_t buf_offset = dev->vhost_hlen;\n+\tuintptr_t desc_addrs[PACKED_BATCH_SIZE];\n+\tuint16_t ids[PACKED_BATCH_SIZE];\n+\tuint16_t i;\n+\n+\tif (vhost_reserve_avail_batch_packed(dev, vq, mbuf_pool, pkts,\n+\t\t\t\t\t avail_idx, desc_addrs, ids))\n+\t\treturn -1;\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n+\t\trte_prefetch0((void *)(uintptr_t)desc_addrs[i]);\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n+\t\trte_memcpy(rte_pktmbuf_mtod_offset(pkts[i], void *, 0),\n+\t\t\t (void *)(uintptr_t)(desc_addrs[i] + buf_offset),\n+\t\t\t pkts[i]->pkt_len);\n+\n+\tvq_inc_last_avail_packed(vq, PACKED_BATCH_SIZE);\n+\n+\treturn 0;\n+}\n+\n static __rte_always_inline int\n vhost_dequeue_single_packed(struct virtio_net *dev,\n \t\t\t struct vhost_virtqueue *vq,\n", "prefixes": [ "v9", "06/13" ] }{ "id": 61845, "url": "