Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/41411/?format=api
http://patchwork.dpdk.org/api/patches/41411/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20180622134327.18973-13-maxime.coquelin@redhat.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20180622134327.18973-13-maxime.coquelin@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20180622134327.18973-13-maxime.coquelin@redhat.com", "date": "2018-06-22T13:43:24", "name": "[v5,12/15] vhost: add Rx support for packed ring", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "d9e0b9be1fee4ccc82fc44020d61d9c689235ad8", "submitter": { "id": 512, "url": "http://patchwork.dpdk.org/api/people/512/?format=api", "name": "Maxime Coquelin", "email": "maxime.coquelin@redhat.com" }, "delegate": { "id": 2642, "url": "http://patchwork.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20180622134327.18973-13-maxime.coquelin@redhat.com/mbox/", "series": [ { "id": 210, "url": "http://patchwork.dpdk.org/api/series/210/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=210", "date": "2018-06-22T13:43:12", "name": "Vhost: add support to packed ring layout", "version": 5, "mbox": "http://patchwork.dpdk.org/series/210/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/41411/comments/", "check": "fail", "checks": "http://patchwork.dpdk.org/api/patches/41411/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 966AE1BDED;\n\tFri, 22 Jun 2018 15:44:10 +0200 (CEST)", "from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73])\n\tby dpdk.org (Postfix) with ESMTP id 635081BDDA\n\tfor <dev@dpdk.org>; Fri, 22 Jun 2018 15:44:06 +0200 (CEST)", "from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 046A9212D3;\n\tFri, 22 Jun 2018 13:44:06 +0000 (UTC)", "from localhost.localdomain (ovpn-112-42.ams2.redhat.com\n\t[10.36.112.42])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 53DB62026D6B;\n\tFri, 22 Jun 2018 13:44:04 +0000 (UTC)" ], "From": "Maxime Coquelin <maxime.coquelin@redhat.com>", "To": "tiwei.bie@intel.com, zhihong.wang@intel.com, jfreimann@redhat.com,\n\tdev@dpdk.org", "Cc": "mst@redhat.com, jasowang@redhat.com, wexu@redhat.com,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>", "Date": "Fri, 22 Jun 2018 15:43:24 +0200", "Message-Id": "<20180622134327.18973-13-maxime.coquelin@redhat.com>", "In-Reply-To": "<20180622134327.18973-1-maxime.coquelin@redhat.com>", "References": "<20180622134327.18973-1-maxime.coquelin@redhat.com>", "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.4", "X-Greylist": [ "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.2]); Fri, 22 Jun 2018 13:44:06 +0000 (UTC)", "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.2]); \n\tFri, 22 Jun 2018 13:44:06 +0000 (UTC) for IP:'10.11.54.4'\n\tDOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:''" ], "Subject": "[dpdk-dev] [PATCH v5 12/15] vhost: add Rx support for packed 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": "Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/librte_vhost/virtio_net.c | 117 +++++++++++++++++++++++++++++++++++++++++-\n 1 file changed, 116 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 28b0cb566..e094357be 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -557,6 +557,65 @@ fill_vec_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \treturn 0;\n }\n \n+/*\n+ * Returns -1 on fail, 0 on success\n+ */\n+static inline int\n+reserve_avail_buf_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\t\t\t\tuint32_t size, struct buf_vector *buf_vec,\n+\t\t\t\tuint16_t *nr_vec, uint16_t *num_buffers,\n+\t\t\t\tuint16_t *nr_descs)\n+{\n+\tuint16_t avail_idx;\n+\tuint16_t vec_idx = 0;\n+\tuint16_t max_tries, tries = 0;\n+\n+\tuint16_t buf_id = 0;\n+\tuint16_t len = 0;\n+\tuint16_t desc_count;\n+\n+\t*num_buffers = 0;\n+\tavail_idx = vq->last_avail_idx;\n+\n+\tif (rxvq_is_mergeable(dev))\n+\t\tmax_tries = vq->size;\n+\telse\n+\t\tmax_tries = 1;\n+\n+\twhile (size > 0) {\n+\t\tif (unlikely(fill_vec_buf_packed(dev, vq,\n+\t\t\t\t\t\tavail_idx, &desc_count,\n+\t\t\t\t\t\tbuf_vec, &vec_idx,\n+\t\t\t\t\t\t&buf_id, &len,\n+\t\t\t\t\t\tVHOST_ACCESS_RO) < 0))\n+\t\t\treturn -1;\n+\n+\t\tlen = RTE_MIN(len, size);\n+\t\tupdate_shadow_used_ring_packed(vq, buf_id, len, desc_count);\n+\t\tsize -= len;\n+\n+\t\tavail_idx += desc_count;\n+\t\tif (avail_idx >= vq->size)\n+\t\t\tavail_idx -= vq->size;\n+\n+\t\t*nr_descs += desc_count;\n+\t\ttries++;\n+\t\t*num_buffers += 1;\n+\n+\t\t/*\n+\t\t * if we tried all available ring items, and still\n+\t\t * can't get enough buf, it means something abnormal\n+\t\t * happened.\n+\t\t */\n+\t\tif (unlikely(tries > max_tries))\n+\t\t\treturn -1;\n+\t}\n+\n+\t*nr_vec = vec_idx;\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@@ -769,6 +828,59 @@ virtio_dev_rx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \treturn pkt_idx;\n }\n \n+static __rte_always_inline uint32_t\n+virtio_dev_rx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\tstruct rte_mbuf **pkts, uint32_t count)\n+{\n+\tuint32_t pkt_idx = 0;\n+\tuint16_t num_buffers;\n+\tstruct buf_vector buf_vec[BUF_VECTOR_MAX];\n+\n+\tfor (pkt_idx = 0; pkt_idx < count; pkt_idx++) {\n+\t\tuint32_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen;\n+\t\tuint16_t nr_vec = 0;\n+\t\tuint16_t nr_descs = 0;\n+\n+\t\tif (unlikely(reserve_avail_buf_packed(dev, vq,\n+\t\t\t\t\t\tpkt_len, buf_vec, &nr_vec,\n+\t\t\t\t\t\t&num_buffers, &nr_descs) < 0)) {\n+\t\t\tVHOST_LOG_DEBUG(VHOST_DATA,\n+\t\t\t\t\"(%d) failed to get enough desc from vring\\n\",\n+\t\t\t\tdev->vid);\n+\t\t\tvq->shadow_used_idx -= num_buffers;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\trte_prefetch0((void *)(uintptr_t)buf_vec[0].buf_addr);\n+\n+\t\tVHOST_LOG_DEBUG(VHOST_DATA, \"(%d) current index %d | end index %d\\n\",\n+\t\t\tdev->vid, vq->last_avail_idx,\n+\t\t\tvq->last_avail_idx + num_buffers);\n+\n+\t\tif (copy_mbuf_to_desc(dev, vq, pkts[pkt_idx],\n+\t\t\t\t\t\tbuf_vec, nr_vec,\n+\t\t\t\t\t\tnum_buffers) < 0) {\n+\t\t\tvq->shadow_used_idx -= num_buffers;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tvq->last_avail_idx += nr_descs;\n+\t\tif (vq->last_avail_idx >= vq->size) {\n+\t\t\tvq->last_avail_idx -= vq->size;\n+\t\t\tvq->avail_wrap_counter ^= 1;\n+\t\t}\n+\t}\n+\n+\tdo_data_copy_enqueue(dev, vq);\n+\n+\tif (likely(vq->shadow_used_idx)) {\n+\t\tflush_shadow_used_ring_packed(dev, vq);\n+\t\tvhost_vring_call(dev, vq);\n+\t}\n+\n+\treturn pkt_idx;\n+}\n+\n static __rte_always_inline uint32_t\n virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,\n \tstruct rte_mbuf **pkts, uint32_t count)\n@@ -800,7 +912,10 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,\n \tif (count == 0)\n \t\tgoto out;\n \n-\tcount = virtio_dev_rx_split(dev, vq, pkts, count);\n+\tif (vq_is_packed(dev))\n+\t\tcount = virtio_dev_rx_packed(dev, vq, pkts, count);\n+\telse\n+\t\tcount = virtio_dev_rx_split(dev, vq, pkts, count);\n \n out:\n \tif (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))\n", "prefixes": [ "v5", "12/15" ] }{ "id": 41411, "url": "