Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/59715/?format=api
http://patches.dpdk.org/api/patches/59715/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190925171329.63734-4-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-4-yong.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190925171329.63734-4-yong.liu@intel.com", "date": "2019-09-25T17:13:17", "name": "[v3,03/15] vhost: add batch enqueue function for packed ring", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "67483d752ffde5802b665382ac431551d93c1ace", "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-4-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/59715/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/59715/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 D11C61BE92;\n\tWed, 25 Sep 2019 11:32:45 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 768042BD5\n\tfor <dev@dpdk.org>; Wed, 25 Sep 2019 11:32:33 +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:33 -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:31 -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=\"213986154\"", "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:17 +0800", "Message-Id": "<20190925171329.63734-4-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 03/15] vhost: add batch enqueue function for\n\tpacked ring", "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": "Batch enqueue function will first check whether descriptors are cache\naligned. It will also check prerequisites in the beginning. Batch\nenqueue function not support chained mbufs, single packet enqueue\nfunction 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 4cba8c5ef..e241436c7 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -39,6 +39,10 @@\n \n #define VHOST_LOG_CACHE_NR 32\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)\n+\n #ifdef SUPPORT_GCC_UNROLL_PRAGMA\n #define UNROLL_PRAGMA_PARAM \"GCC unroll 4\"\n #endif\ndiff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 520c4c6a8..5e08f7d9b 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -883,6 +883,86 @@ virtio_dev_rx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \treturn pkt_idx;\n }\n \n+static __rte_unused int\n+virtio_dev_rx_batch_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\t struct rte_mbuf **pkts)\n+{\n+\tbool wrap_counter = vq->avail_wrap_counter;\n+\tstruct vring_packed_desc *descs = vq->desc_packed;\n+\tuint16_t avail_idx = vq->last_avail_idx;\n+\tuint64_t desc_addrs[PACKED_BATCH_SIZE];\n+\tstruct virtio_net_hdr_mrg_rxbuf *hdrs[PACKED_BATCH_SIZE];\n+\tuint32_t buf_offset = dev->vhost_hlen;\n+\tuint64_t lens[PACKED_BATCH_SIZE];\n+\tuint16_t i;\n+\n+\tif (unlikely(avail_idx & PACKED_BATCH_MASK))\n+\t\treturn -1;\n+\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(pkts[i]->next != NULL))\n+\t\t\treturn -1;\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}\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\tif (unlikely(pkts[i]->pkt_len > (lens[i] - buf_offset)))\n+\t\t\treturn -1;\n+\t}\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],\n+\t\t\t\t\t\t VHOST_ACCESS_RW);\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+\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\thdrs[i] = (struct virtio_net_hdr_mrg_rxbuf *)\n+\t\t\t\t\t(uintptr_t)desc_addrs[i];\n+\t\tlens[i] = pkts[i]->pkt_len + dev->vhost_hlen;\n+\t}\n+\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++)\n+\t\tvirtio_enqueue_offload(pkts[i], &hdrs[i]->hdr);\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+\n+\tUNROLL_PRAGMA(UNROLL_PRAGMA_PARAM)\n+\tfor (i = 0; i < PACKED_BATCH_SIZE; i++) {\n+\t\trte_memcpy((void *)(uintptr_t)(desc_addrs[i] + buf_offset),\n+\t\t\t rte_pktmbuf_mtod_offset(pkts[i], void *, 0),\n+\t\t\t pkts[i]->pkt_len);\n+\t}\n+\n+\treturn 0;\n+}\n+\n static __rte_unused int16_t\n virtio_dev_rx_single_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct rte_mbuf *pkt)\n", "prefixes": [ "v3", "03/15" ] }{ "id": 59715, "url": "