Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/100736/?format=api
https://patches.dpdk.org/api/patches/100736/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20211007220013.355530-13-maxime.coquelin@redhat.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": "<20211007220013.355530-13-maxime.coquelin@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20211007220013.355530-13-maxime.coquelin@redhat.com", "date": "2021-10-07T22:00:11", "name": "[RFC,12/14] vhost: prepare async for mbuf to desc refactoring", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "c2ae08131f9719b303ea09f94e3b3e9bc92a1ed5", "submitter": { "id": 512, "url": "https://patches.dpdk.org/api/people/512/?format=api", "name": "Maxime Coquelin", "email": "maxime.coquelin@redhat.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/20211007220013.355530-13-maxime.coquelin@redhat.com/mbox/", "series": [ { "id": 19439, "url": "https://patches.dpdk.org/api/series/19439/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=19439", "date": "2021-10-07T22:00:01", "name": "vhost: clean-up and simplify async implementation", "version": 1, "mbox": "https://patches.dpdk.org/series/19439/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/100736/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/100736/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id E1570A0C43;\n\tFri, 8 Oct 2021 00:14:31 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4FD9341447;\n\tFri, 8 Oct 2021 00:14:28 +0200 (CEST)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [216.205.24.124])\n by mails.dpdk.org (Postfix) with ESMTP id 3E64B41432\n for <dev@dpdk.org>; Fri, 8 Oct 2021 00:14:27 +0200 (CEST)", "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id\n us-mta-187-7IUZRQAnMCKFDChydVZ3_Q-1; Thu, 07 Oct 2021 18:14:16 -0400", "from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com\n [10.5.11.16])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFC208C3381;\n Thu, 7 Oct 2021 22:00:58 +0000 (UTC)", "from max-t490s.redhat.com (unknown [10.39.208.18])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 0F8695C1A3;\n Thu, 7 Oct 2021 22:00:56 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1633644866;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=8na/3MMAW6x8fopyGKOVbwWD8Cvi0NC7KDIyN/fZXN0=;\n b=BaD8o8krDbeWH7PyB6YYI0sJNvSThxri+VbkWHAc8mbqXa1iIfEnryIhQeYW8MgaAiP0lD\n Dkf0YMNHOmEWeNheQS0MWgCz+YeuQGLkPLjqL6h6hckbiwiUkTyHBlhca7MsKDvUxGh2Ya\n aQ70Oxe2jI19arrrbOyIwWEtFm1ntug=", "X-MC-Unique": "7IUZRQAnMCKFDChydVZ3_Q-1", "From": "Maxime Coquelin <maxime.coquelin@redhat.com>", "To": "dev@dpdk.org, chenbo.xia@intel.com, jiayu.hu@intel.com,\n yuanx.wang@intel.com, wenwux.ma@intel.com, bruce.richardson@intel.com,\n john.mcnamara@intel.com", "Cc": "Maxime Coquelin <maxime.coquelin@redhat.com>", "Date": "Fri, 8 Oct 2021 00:00:11 +0200", "Message-Id": "<20211007220013.355530-13-maxime.coquelin@redhat.com>", "In-Reply-To": "<20211007220013.355530-1-maxime.coquelin@redhat.com>", "References": "<20211007220013.355530-1-maxime.coquelin@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.16", "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain; charset=\"US-ASCII\"", "Subject": "[dpdk-dev] [RFC 12/14] vhost: prepare async for mbuf to desc\n refactoring", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patch extracts the IO vectors filling from\nasync_mbuf_to_desc() into a dedicated function as a\npreliminary step of merging copy_mubf_to_desc() and\nasync_mbuf_to_desc().\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/vhost/virtio_net.c | 205 ++++++++++++++++++++++-------------------\n 1 file changed, 111 insertions(+), 94 deletions(-)", "diff": "diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c\nindex 2aa06a958c..9d131e6df1 100644\n--- a/lib/vhost/virtio_net.c\n+++ b/lib/vhost/virtio_net.c\n@@ -791,6 +791,109 @@ copy_vnet_hdr_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t}\n }\n \n+\n+static __rte_always_inline int\n+async_iter_initialize(struct vhost_async *async)\n+{\n+\tstruct rte_vhost_iov_iter *iter;\n+\n+\tif (unlikely(async->iter_idx >= VHOST_MAX_ASYNC_IT)) {\n+\t\tVHOST_LOG_DATA(ERR, \"no more async iterators available\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tif (unlikely(async->iovec_idx >= VHOST_MAX_ASYNC_VEC)) {\n+\t\tVHOST_LOG_DATA(ERR, \"no more async iovec available\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\n+\titer = async->iov_iter + async->iter_idx;\n+\titer->iov = async->iovec + async->iovec_idx;\n+\titer->nr_segs = 0;\n+\n+\treturn 0;\n+}\n+\n+static __rte_always_inline int\n+async_iter_add_iovec(struct vhost_async *async, void *src, void *dst, size_t len)\n+{\n+\tstruct rte_vhost_iov_iter *iter;\n+\tstruct rte_vhost_iovec *iovec;\n+\n+\tif (unlikely(async->iovec_idx >= VHOST_MAX_ASYNC_VEC)) {\n+\t\tVHOST_LOG_DATA(ERR, \"no more async iovec available\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\titer = async->iov_iter + async->iter_idx;\n+\tiovec = async->iovec + async->iovec_idx;\n+\n+\tiovec->src_addr = src;\n+\tiovec->dst_addr = dst;\n+\tiovec->len = len;\n+\n+\titer->nr_segs++;\n+\n+\treturn 0;\n+}\n+\n+static __rte_always_inline void\n+async_iter_finalize(struct vhost_async *async)\n+{\n+\tasync->iter_idx++;\n+}\n+\n+static __rte_always_inline void\n+async_iter_cancel(struct vhost_async *async)\n+{\n+\tstruct rte_vhost_iov_iter *iter;\n+\n+\titer = async->iov_iter + async->iter_idx;\n+\tasync->iovec_idx -= iter->nr_segs;\n+\titer->nr_segs = 0;\n+\titer->iov = NULL;\n+}\n+\n+static __rte_always_inline void\n+async_iter_reset(struct vhost_async *async)\n+{\n+\tasync->iter_idx = 0;\n+\tasync->iovec_idx = 0;\n+}\n+\n+static __rte_always_inline int\n+async_mbuf_to_desc_seg(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\t\tstruct rte_mbuf *m, uint32_t mbuf_offset,\n+\t\tuint64_t buf_iova, uint32_t cpy_len)\n+{\n+\tstruct vhost_async *async = vq->async;\n+\tuint64_t mapped_len;\n+\tuint32_t buf_offset = 0;\n+\tvoid *hpa;\n+\n+\twhile (cpy_len) {\n+\t\thpa = (void *)(uintptr_t)gpa_to_first_hpa(dev,\n+\t\t\t\tbuf_iova + buf_offset, cpy_len, &mapped_len);\n+\t\tif (unlikely(!hpa)) {\n+\t\t\tVHOST_LOG_DATA(ERR, \"(%d) %s: failed to get hpa.\\n\", dev->vid, __func__);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tif (unlikely(async_iter_add_iovec(async,\n+\t\t\t\t\t\t(void *)(uintptr_t)rte_pktmbuf_iova_offset(m,\n+\t\t\t\t\t\t\tmbuf_offset),\n+\t\t\t\t\t\thpa, (size_t)mapped_len)))\n+\t\t\treturn -1;\n+\n+\t\tcpy_len -= (uint32_t)mapped_len;\n+\t\tmbuf_offset += (uint32_t)mapped_len;\n+\t\tbuf_offset += (uint32_t)mapped_len;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static __rte_always_inline int\n copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\t struct rte_mbuf *m, struct buf_vector *buf_vec,\n@@ -924,76 +1027,6 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \treturn error;\n }\n \n-static __rte_always_inline int\n-async_iter_initialize(struct vhost_async *async)\n-{\n-\tstruct rte_vhost_iov_iter *iter;\n-\n-\tif (unlikely(async->iter_idx >= VHOST_MAX_ASYNC_IT)) {\n-\t\tVHOST_LOG_DATA(ERR, \"no more async iterators available\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tif (unlikely(async->iovec_idx >= VHOST_MAX_ASYNC_VEC)) {\n-\t\tVHOST_LOG_DATA(ERR, \"no more async iovec available\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\n-\titer = async->iov_iter + async->iter_idx;\n-\titer->iov = async->iovec + async->iovec_idx;\n-\titer->nr_segs = 0;\n-\n-\treturn 0;\n-}\n-\n-static __rte_always_inline int\n-async_iter_add_iovec(struct vhost_async *async, void *src, void *dst, size_t len)\n-{\n-\tstruct rte_vhost_iov_iter *iter;\n-\tstruct rte_vhost_iovec *iovec;\n-\n-\tif (unlikely(async->iovec_idx >= VHOST_MAX_ASYNC_VEC)) {\n-\t\tVHOST_LOG_DATA(ERR, \"no more async iovec available\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\titer = async->iov_iter + async->iter_idx;\n-\tiovec = async->iovec + async->iovec_idx;\n-\n-\tiovec->src_addr = src;\n-\tiovec->dst_addr = dst;\n-\tiovec->len = len;\n-\n-\titer->nr_segs++;\n-\n-\treturn 0;\n-}\n-\n-static __rte_always_inline void\n-async_iter_finalize(struct vhost_async *async)\n-{\n-\tasync->iter_idx++;\n-}\n-\n-static __rte_always_inline void\n-async_iter_cancel(struct vhost_async *async)\n-{\n-\tstruct rte_vhost_iov_iter *iter;\n-\n-\titer = async->iov_iter + async->iter_idx;\n-\tasync->iovec_idx -= iter->nr_segs;\n-\titer->nr_segs = 0;\n-\titer->iov = NULL;\n-}\n-\n-static __rte_always_inline void\n-async_iter_reset(struct vhost_async *async)\n-{\n-\tasync->iter_idx = 0;\n-\tasync->iovec_idx = 0;\n-}\n-\n static __rte_always_inline int\n async_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \t\t\tstruct rte_mbuf *m, struct buf_vector *buf_vec,\n@@ -1004,14 +1037,11 @@ async_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct virtio_net_hdr_mrg_rxbuf tmp_hdr, *hdr = NULL;\n \tuint64_t buf_addr, buf_iova;\n \tuint64_t hdr_addr;\n-\tuint64_t mapped_len;\n \tuint32_t vec_idx = 0;\n \tuint32_t mbuf_offset, mbuf_avail;\n \tuint32_t buf_offset, buf_avail;\n \tuint32_t cpy_len, buf_len;\n \n-\tvoid *hpa;\n-\n \tif (unlikely(m == NULL))\n \t\treturn -1;\n \n@@ -1095,28 +1125,15 @@ async_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \n \t\tcpy_len = RTE_MIN(buf_avail, mbuf_avail);\n \n-\t\twhile (unlikely(cpy_len)) {\n-\t\t\thpa = (void *)(uintptr_t)gpa_to_first_hpa(dev,\n-\t\t\t\t\tbuf_iova + buf_offset,\n-\t\t\t\t\tcpy_len, &mapped_len);\n-\t\t\tif (unlikely(!hpa)) {\n-\t\t\t\tVHOST_LOG_DATA(ERR, \"(%d) %s: failed to get hpa.\\n\",\n-\t\t\t\tdev->vid, __func__);\n-\t\t\t\tgoto error;\n-\t\t\t}\n-\n-\t\t\tif (unlikely(async_iter_add_iovec(async,\n-\t\t\t\t\t(void *)(uintptr_t)rte_pktmbuf_iova_offset(m,\n-\t\t\t\t\t\tmbuf_offset),\n-\t\t\t\t\thpa, (size_t)mapped_len)))\n-\t\t\t\tgoto error;\n-\n-\t\t\tcpy_len -= (uint32_t)mapped_len;\n-\t\t\tmbuf_avail -= (uint32_t)mapped_len;\n-\t\t\tmbuf_offset += (uint32_t)mapped_len;\n-\t\t\tbuf_avail -= (uint32_t)mapped_len;\n-\t\t\tbuf_offset += (uint32_t)mapped_len;\n+\t\tif (async_mbuf_to_desc_seg(dev, vq, m, mbuf_offset,\n+\t\t\t\t\tbuf_iova + buf_offset, cpy_len) < 0) {\n+\t\t\tgoto error;\n \t\t}\n+\n+\t\tmbuf_avail -= cpy_len;\n+\t\tmbuf_offset += cpy_len;\n+\t\tbuf_avail -= cpy_len;\n+\t\tbuf_offset += cpy_len;\n \t}\n \n \tasync_iter_finalize(async);\n", "prefixes": [ "RFC", "12/14" ] }{ "id": 100736, "url": "