Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/60738/?format=api
https://patches.dpdk.org/api/patches/60738/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20191009133849.69002-6-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": "<20191009133849.69002-6-yong.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20191009133849.69002-6-yong.liu@intel.com", "date": "2019-10-09T13:38:40", "name": "[v4,05/14] vhost: add batch dequeue function", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "226e5e7a6128c3f5564f57870049c3c0d9fd2133", "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/20191009133849.69002-6-yong.liu@intel.com/mbox/", "series": [ { "id": 6753, "url": "https://patches.dpdk.org/api/series/6753/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6753", "date": "2019-10-09T13:38:35", "name": "vhost packed ring performance optimization", "version": 4, "mbox": "https://patches.dpdk.org/series/6753/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/60738/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/60738/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 1973A1C139;\n\tWed, 9 Oct 2019 07:59:38 +0200 (CEST)", "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 4CD441C0C1\n\tfor <dev@dpdk.org>; Wed, 9 Oct 2019 07:59:32 +0200 (CEST)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Oct 2019 22:59:33 -0700", "from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142])\n\tby fmsmga002.fm.intel.com with ESMTP; 08 Oct 2019 22:59:30 -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,273,1566889200\"; d=\"scan'208\";a=\"223473389\"", "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": "Wed, 9 Oct 2019 21:38:40 +0800", "Message-Id": "<20191009133849.69002-6-yong.liu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20191009133849.69002-1-yong.liu@intel.com>", "References": "<20190925171329.63734-1-yong.liu@intel.com>\n\t<20191009133849.69002-1-yong.liu@intel.com>", "Subject": "[dpdk-dev] [PATCH v4 05/14] vhost: add batch dequeue function", "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>", "diff": "diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex e241436c7..e50e137ca 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -61,6 +61,8 @@\n #define UNROLL_PRAGMA(param) do {} while (0);\n #endif\n \n+#define PACKED_SINGLE_DEQUEUE_FLAG (VRING_DESC_F_NEXT | VRING_DESC_F_INDIRECT)\n+\n /**\n * Structure contains buffer address, length and descriptor index\n * from vring to do scatter RX.\ndiff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 17aabe8eb..2ff7329b2 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -1571,6 +1571,119 @@ 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_dequeue_batch_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\tstruct rte_mempool *mbuf_pool, struct rte_mbuf **pkts,\n+\tuint16_t avail_idx, uintptr_t *desc_addrs, uint16_t *ids)\n+{\n+\tbool wrap_counter = vq->avail_wrap_counter;\n+\tstruct vring_packed_desc *descs = vq->desc_packed;\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 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+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++) {\n+\t\tif (unlikely(!desc_is_avail(&descs[avail_idx + i],\n+\t\t\t\t\t wrap_counter)))\n+\t\t\treturn -1;\n+\t\tif (unlikely(descs[avail_idx + i].flags &\n+\t\t\t PACKED_SINGLE_DEQUEUE_FLAG))\n+\t\t\treturn -1;\n+\t}\n+\n+\trte_smp_rmb();\n+\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++)\n+\t\tlens[i] = descs[avail_idx + i].len;\n+\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++) {\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+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++) {\n+\t\tif (unlikely((lens[i] != descs[avail_idx + i].len)))\n+\t\t\treturn -1;\n+\t}\n+\n+\tif (rte_pktmbuf_alloc_bulk(mbuf_pool, pkts, PACKED_BATCH_SIZE))\n+\t\treturn -1;\n+\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++)\n+\t\tbuf_lens[i] = pkts[i]->buf_len - pkts[i]->data_off;\n+\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++) {\n+\t\tif (unlikely(buf_lens[i] < (lens[i] - buf_offset)))\n+\t\t\tgoto free_buf;\n+\t}\n+\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++) {\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+\treturn 0;\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, struct vhost_virtqueue *vq,\n+\tstruct rte_mempool *mbuf_pool, 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+\tstruct virtio_net_hdr *hdr;\n+\tuint16_t i;\n+\n+\tif (vhost_dequeue_batch_packed(dev, vq, mbuf_pool, pkts, avail_idx,\n+\t\t\t\t desc_addrs, ids))\n+\t\treturn -1;\n+\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++) {\n+\t\trte_prefetch0((void *)(uintptr_t)desc_addrs[i]);\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+\t}\n+\n+\tif (virtio_net_with_host_offload(dev)) {\n+\t\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\t\tfor (i = 0; i < PACKED_BATCH_SIZE; i++) {\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+\tvq->last_avail_idx += PACKED_BATCH_SIZE;\n+\tif (vq->last_avail_idx >= vq->size) {\n+\t\tvq->last_avail_idx -= vq->size;\n+\t\tvq->avail_wrap_counter ^= 1;\n+\t}\n+\treturn 0;\n+}\n+\n static __rte_always_inline int\n vhost_dequeue_single_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t *buf_id,\n", "prefixes": [ "v4", "05/14" ] }{ "id": 60738, "url": "