Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/61555/?format=api
http://patches.dpdk.org/api/patches/61555/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191021154016.16274-12-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": "<20191021154016.16274-12-yong.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20191021154016.16274-12-yong.liu@intel.com", "date": "2019-10-21T15:40:14", "name": "[v7,11/13] vhost: add packed ring zcopy batch and single dequeue", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "f2b6e461f4c5cee0e3ed4bb0ab927668d1b367b4", "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/20191021154016.16274-12-yong.liu@intel.com/mbox/", "series": [ { "id": 6958, "url": "http://patches.dpdk.org/api/series/6958/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6958", "date": "2019-10-21T15:40:03", "name": "vhost packed ring performance optimization", "version": 7, "mbox": "http://patches.dpdk.org/series/6958/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/61555/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/61555/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 E7E121BE92;\n\tMon, 21 Oct 2019 10:00:44 +0200 (CEST)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 65A195B3A\n\tfor <dev@dpdk.org>; Mon, 21 Oct 2019 10:00:19 +0200 (CEST)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t21 Oct 2019 01:00:19 -0700", "from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142])\n\tby fmsmga002.fm.intel.com with ESMTP; 21 Oct 2019 01:00:17 -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,322,1566889200\"; d=\"scan'208\";a=\"227238088\"", "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": "Mon, 21 Oct 2019 23:40:14 +0800", "Message-Id": "<20191021154016.16274-12-yong.liu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20191021154016.16274-1-yong.liu@intel.com>", "References": "<20191015160739.51940-1-yong.liu@intel.com>\n\t<20191021154016.16274-1-yong.liu@intel.com>", "Subject": "[dpdk-dev] [PATCH v7 11/13] vhost: add packed ring zcopy batch and\n\tsingle 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 vhost packed ring zero copy batch and single dequeue functions like\nnormal dequeue path.\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>", "diff": "diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 2f90c3a7c..e053766f5 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -1978,6 +1978,126 @@ virtio_dev_tx_single_packed(struct virtio_net *dev,\n \treturn 0;\n }\n \n+static __rte_unused int\n+virtio_dev_tx_batch_packed_zmbuf(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+{\n+\tstruct zcopy_mbuf *zmbufs[PACKED_BATCH_SIZE];\n+\tuintptr_t desc_addrs[PACKED_BATCH_SIZE];\n+\tuint16_t ids[PACKED_BATCH_SIZE];\n+\tuint16_t i;\n+\n+\tuint16_t avail_idx = vq->last_avail_idx;\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\tzmbufs[i] = get_zmbuf(vq);\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\tif (!zmbufs[i])\n+\t\t\tgoto free_pkt;\n+\t}\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n+\t\tzmbufs[i]->mbuf = pkts[i];\n+\t\tzmbufs[i]->desc_idx = avail_idx + i;\n+\t\tzmbufs[i]->desc_count = 1;\n+\t}\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n+\t\trte_mbuf_refcnt_update(pkts[i], 1);\n+\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n+\t\tTAILQ_INSERT_TAIL(&vq->zmbuf_list, zmbufs[i], next);\n+\n+\tvq->nr_zmbuf += PACKED_BATCH_SIZE;\n+\tvq_inc_last_avail_packed(vq, PACKED_BATCH_SIZE);\n+\n+\treturn 0;\n+\n+free_pkt:\n+\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n+\t\trte_pktmbuf_free(pkts[i]);\n+\n+\treturn -1;\n+}\n+\n+static __rte_unused int\n+virtio_dev_tx_single_packed_zmbuf(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+{\n+\tuint16_t buf_id, desc_count;\n+\tstruct zcopy_mbuf *zmbuf;\n+\n+\tif (vhost_dequeue_single_packed(dev, vq, mbuf_pool, pkts, &buf_id,\n+\t\t\t\t\t&desc_count))\n+\t\treturn -1;\n+\n+\tzmbuf = get_zmbuf(vq);\n+\tif (!zmbuf) {\n+\t\trte_pktmbuf_free(*pkts);\n+\t\treturn -1;\n+\t}\n+\tzmbuf->mbuf = *pkts;\n+\tzmbuf->desc_idx = vq->last_avail_idx;\n+\tzmbuf->desc_count = desc_count;\n+\n+\trte_mbuf_refcnt_update(*pkts, 1);\n+\n+\tvq->nr_zmbuf += 1;\n+\tTAILQ_INSERT_TAIL(&vq->zmbuf_list, zmbuf, next);\n+\n+\tvq_inc_last_avail_packed(vq, desc_count);\n+\treturn 0;\n+}\n+\n+static __rte_always_inline void\n+free_zmbuf(struct vhost_virtqueue *vq)\n+{\n+\tstruct zcopy_mbuf *next = NULL;\n+\tstruct zcopy_mbuf *zmbuf;\n+\n+\tfor (zmbuf = TAILQ_FIRST(&vq->zmbuf_list);\n+\t zmbuf != NULL; zmbuf = next) {\n+\t\tnext = TAILQ_NEXT(zmbuf, next);\n+\n+\t\tuint16_t last_used_idx = vq->last_used_idx;\n+\n+\t\tif (mbuf_is_consumed(zmbuf->mbuf)) {\n+\t\t\tuint16_t flags;\n+\t\t\tflags = vq->desc_packed[last_used_idx].flags;\n+\t\t\tif (vq->used_wrap_counter) {\n+\t\t\t\tflags |= VRING_DESC_F_USED;\n+\t\t\t\tflags |= VRING_DESC_F_AVAIL;\n+\t\t\t} else {\n+\t\t\t\tflags &= ~VRING_DESC_F_USED;\n+\t\t\t\tflags &= ~VRING_DESC_F_AVAIL;\n+\t\t\t}\n+\n+\t\t\tvq->desc_packed[last_used_idx].id = zmbuf->desc_idx;\n+\t\t\tvq->desc_packed[last_used_idx].len = 0;\n+\n+\t\t\trte_smp_wmb();\n+\t\t\tvq->desc_packed[last_used_idx].flags = flags;\n+\n+\t\t\tvq_inc_last_used_packed(vq, zmbuf->desc_count);\n+\n+\t\t\tTAILQ_REMOVE(&vq->zmbuf_list, zmbuf, next);\n+\t\t\trestore_mbuf(zmbuf->mbuf);\n+\t\t\trte_pktmbuf_free(zmbuf->mbuf);\n+\t\t\tput_zmbuf(zmbuf);\n+\t\t\tvq->nr_zmbuf -= 1;\n+\t\t}\n+\t}\n+}\n+\n static __rte_noinline uint16_t\n virtio_dev_tx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count)\n", "prefixes": [ "v7", "11/13" ] }{ "id": 61555, "url": "