Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/59381/?format=api
https://patches.dpdk.org/api/patches/59381/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190919163643.24130-2-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": "<20190919163643.24130-2-yong.liu@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190919163643.24130-2-yong.liu@intel.com", "date": "2019-09-19T16:36:28", "name": "[v2,01/16] vhost: add single packet enqueue function", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "6a0df90523c7733c48493b9a8255982095d5ef93", "submitter": { "id": 17, "url": "https://patches.dpdk.org/api/people/17/?format=api", "name": "Marvin Liu", "email": "yong.liu@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190919163643.24130-2-yong.liu@intel.com/mbox/", "series": [ { "id": 6444, "url": "https://patches.dpdk.org/api/series/6444/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6444", "date": "2019-09-19T16:36:27", "name": "vhost packed ring performance optimization", "version": 2, "mbox": "https://patches.dpdk.org/series/6444/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/59381/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/59381/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 DDD431C1F3;\n\tThu, 19 Sep 2019 10:56:28 +0200 (CEST)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 5C0F81C1C6\n\tfor <dev@dpdk.org>; Thu, 19 Sep 2019 10:56:25 +0200 (CEST)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Sep 2019 01:56:24 -0700", "from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142])\n\tby orsmga001.jf.intel.com with ESMTP; 19 Sep 2019 01:56:23 -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,523,1559545200\"; d=\"scan'208\";a=\"271146076\"", "From": "Marvin Liu <yong.liu@intel.com>", "To": "maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com", "Cc": "dev@dpdk.org,\n\tMarvin Liu <yong.liu@intel.com>", "Date": "Fri, 20 Sep 2019 00:36:28 +0800", "Message-Id": "<20190919163643.24130-2-yong.liu@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190919163643.24130-1-yong.liu@intel.com>", "References": "<20190905161421.55981-2-yong.liu@intel.com>\n\t<20190919163643.24130-1-yong.liu@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 01/16] vhost: add single packet enqueue\n\tfunction", "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 enqueue function for single packet and meanwhile left space\nfor flush used ring function.\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>", "diff": "diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c\nindex 5b85b832d..2b5c47145 100644\n--- a/lib/librte_vhost/virtio_net.c\n+++ b/lib/librte_vhost/virtio_net.c\n@@ -774,6 +774,70 @@ copy_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \treturn error;\n }\n \n+/*\n+ * Returns -1 on fail, 0 on success\n+ */\n+static __rte_always_inline int\n+vhost_enqueue_single_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n+\tstruct rte_mbuf *pkt, struct buf_vector *buf_vec, uint16_t *nr_descs)\n+{\n+\tuint16_t nr_vec = 0;\n+\n+\tuint16_t avail_idx;\n+\tuint16_t max_tries, tries = 0;\n+\n+\tuint16_t buf_id = 0;\n+\tuint32_t len = 0;\n+\tuint16_t desc_count;\n+\n+\tuint32_t size = pkt->pkt_len + dev->vhost_hlen;\n+\tavail_idx = vq->last_avail_idx;\n+\n+\tif (rxvq_is_mergeable(dev))\n+\t\tmax_tries = vq->size - 1;\n+\telse\n+\t\tmax_tries = 1;\n+\n+\tuint16_t num_buffers = 0;\n+\n+\twhile (size > 0) {\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+\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, &nr_vec,\n+\t\t\t\t\t\t&buf_id, &len,\n+\t\t\t\t\t\tVHOST_ACCESS_RW) < 0)) {\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tlen = RTE_MIN(len, size);\n+\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\tnum_buffers += 1;\n+\t}\n+\n+\tif (copy_mbuf_to_desc(dev, vq, pkt,\n+\t\t\t\t\tbuf_vec, nr_vec,\n+\t\t\t\t\tnum_buffers) < 0) {\n+\t\treturn 0;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static __rte_noinline uint32_t\n virtio_dev_rx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct rte_mbuf **pkts, uint32_t count)\n@@ -831,6 +895,35 @@ virtio_dev_rx_split(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \treturn pkt_idx;\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+{\n+\tstruct buf_vector buf_vec[BUF_VECTOR_MAX];\n+\tuint16_t nr_descs = 0;\n+\n+\trte_smp_rmb();\n+\tif (unlikely(vhost_enqueue_single_packed(dev, vq, pkt, buf_vec,\n+\t\t\t\t\t\t &nr_descs) < 0)) {\n+\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\treturn -1;\n+\t}\n+\n+\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 + nr_descs);\n+\n+\tvq->last_avail_idx += nr_descs;\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+\treturn 0;\n+}\n+\n static __rte_noinline uint32_t\n virtio_dev_rx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq,\n \tstruct rte_mbuf **pkts, uint32_t count)\n", "prefixes": [ "v2", "01/16" ] }{ "id": 59381, "url": "