Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/7084/?format=api
https://patches.dpdk.org/api/patches/7084/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1442589061-19225-6-git-send-email-yuanhan.liu@linux.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": "<1442589061-19225-6-git-send-email-yuanhan.liu@linux.intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1442589061-19225-6-git-send-email-yuanhan.liu@linux.intel.com", "date": "2015-09-18T15:10:54", "name": "[dpdk-dev,v5,resend,05/12] vhost: add VHOST_USER_SET_VRING_ENABLE message", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "9041bf9b6e6d97c51fc31da5d404797a871d626a", "submitter": { "id": 307, "url": "https://patches.dpdk.org/api/people/307/?format=api", "name": "Yuanhan Liu", "email": "yuanhan.liu@linux.intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1442589061-19225-6-git-send-email-yuanhan.liu@linux.intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/7084/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/7084/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id AFA298E6E;\n\tFri, 18 Sep 2015 17:09:48 +0200 (CEST)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 4EBED8E6E\n\tfor <dev@dpdk.org>; Fri, 18 Sep 2015 17:09:46 +0200 (CEST)", "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga102.fm.intel.com with ESMTP; 18 Sep 2015 08:09:45 -0700", "from yliu-dev.sh.intel.com ([10.239.66.60])\n\tby fmsmga001.fm.intel.com with ESMTP; 18 Sep 2015 08:09:44 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.17,553,1437462000\"; d=\"scan'208\";a=\"792565846\"", "From": "Yuanhan Liu <yuanhan.liu@linux.intel.com>", "To": "dev@dpdk.org", "Date": "Fri, 18 Sep 2015 23:10:54 +0800", "Message-Id": "<1442589061-19225-6-git-send-email-yuanhan.liu@linux.intel.com>", "X-Mailer": "git-send-email 1.9.0", "In-Reply-To": "<1442589061-19225-1-git-send-email-yuanhan.liu@linux.intel.com>", "References": "<1442589061-19225-1-git-send-email-yuanhan.liu@linux.intel.com>", "Cc": "\"Michael S. Tsirkin\" <mst@redhat.com>", "Subject": "[dpdk-dev] [PATCH v5 resend 05/12] vhost: add\n\tVHOST_USER_SET_VRING_ENABLE message", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Changchun Ouyang <changchun.ouyang@intel.com>\n\nThis message is used to enable/disable a specific vring queue pair.\nThe first queue pair is enabled by default.\n\nSigned-off-by: Changchun Ouyang <changchun.ouyang@intel.com>\nSigned-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>\n---\n lib/librte_vhost/rte_virtio_net.h | 1 +\n lib/librte_vhost/vhost_rxtx.c | 10 ++++++++++\n lib/librte_vhost/vhost_user/vhost-net-user.c | 5 +++++\n lib/librte_vhost/vhost_user/vhost-net-user.h | 1 +\n lib/librte_vhost/vhost_user/virtio-net-user.c | 22 ++++++++++++++++++++++\n lib/librte_vhost/vhost_user/virtio-net-user.h | 3 +++\n lib/librte_vhost/virtio-net.c | 12 +++++++++---\n 7 files changed, 51 insertions(+), 3 deletions(-)", "diff": "diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h\nindex 5dd6493..08b69df 100644\n--- a/lib/librte_vhost/rte_virtio_net.h\n+++ b/lib/librte_vhost/rte_virtio_net.h\n@@ -89,6 +89,7 @@ struct vhost_virtqueue {\n \tvolatile uint16_t\tlast_used_idx_res;\t/**< Used for multiple devices reserving buffers. */\n \tint\t\t\tcallfd;\t\t\t/**< Used to notify the guest (trigger interrupt). */\n \tint\t\t\tkickfd;\t\t\t/**< Currently unused as polling mode is enabled. */\n+\tint\t\t\tenabled;\n \tstruct buf_vector\tbuf_vec[BUF_VECTOR_MAX];\t/**< for scatter RX. */\n } __rte_cache_aligned;\n \ndiff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c\nindex a4ab6ca..aa9ccda 100644\n--- a/lib/librte_vhost/vhost_rxtx.c\n+++ b/lib/librte_vhost/vhost_rxtx.c\n@@ -86,6 +86,9 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,\n \t}\n \n \tvq = dev->virtqueue[queue_id];\n+\tif (unlikely(vq->enabled == 0))\n+\t\treturn 0;\n+\n \tcount = (count > MAX_PKT_BURST) ? MAX_PKT_BURST : count;\n \n \t/*\n@@ -278,6 +281,7 @@ copy_from_mbuf_to_vring(struct virtio_net *dev, uint32_t queue_id,\n \t * (guest physical addr -> vhost virtual addr)\n \t */\n \tvq = dev->virtqueue[queue_id];\n+\n \tvb_addr = gpa_to_vva(dev, vq->buf_vec[vec_idx].buf_addr);\n \tvb_hdr_addr = vb_addr;\n \n@@ -485,6 +489,9 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id,\n \t}\n \n \tvq = dev->virtqueue[queue_id];\n+\tif (unlikely(vq->enabled == 0))\n+\t\treturn 0;\n+\n \tcount = RTE_MIN((uint32_t)MAX_PKT_BURST, count);\n \n \tif (count == 0)\n@@ -583,6 +590,9 @@ rte_vhost_dequeue_burst(struct virtio_net *dev, uint16_t queue_id,\n \t}\n \n \tvq = dev->virtqueue[queue_id];\n+\tif (unlikely(vq->enabled == 0))\n+\t\treturn 0;\n+\n \tavail_idx = *((volatile uint16_t *)&vq->avail->idx);\n \n \t/* If there are no available buffers then return. */\ndiff --git a/lib/librte_vhost/vhost_user/vhost-net-user.c b/lib/librte_vhost/vhost_user/vhost-net-user.c\nindex 8675cd4..f681676 100644\n--- a/lib/librte_vhost/vhost_user/vhost-net-user.c\n+++ b/lib/librte_vhost/vhost_user/vhost-net-user.c\n@@ -99,6 +99,7 @@ static const char *vhost_message_str[VHOST_USER_MAX] = {\n \t[VHOST_USER_GET_PROTOCOL_FEATURES] = \"VHOST_USER_GET_PROTOCOL_FEATURES\",\n \t[VHOST_USER_SET_PROTOCOL_FEATURES] = \"VHOST_USER_SET_PROTOCOL_FEATURES\",\n \t[VHOST_USER_GET_QUEUE_NUM] = \"VHOST_USER_GET_QUEUE_NUM\",\n+\t[VHOST_USER_SET_VRING_ENABLE] = \"VHOST_USER_SET_VRING_ENABLE\",\n };\n \n /**\n@@ -428,6 +429,10 @@ vserver_message_handler(int connfd, void *dat, int *remove)\n \t\tsend_vhost_message(connfd, &msg);\n \t\tbreak;\n \n+\tcase VHOST_USER_SET_VRING_ENABLE:\n+\t\tuser_set_vring_enable(ctx, &msg.payload.state);\n+\t\tbreak;\n+\n \tdefault:\n \t\tbreak;\n \ndiff --git a/lib/librte_vhost/vhost_user/vhost-net-user.h b/lib/librte_vhost/vhost_user/vhost-net-user.h\nindex 389d21d..38637cc 100644\n--- a/lib/librte_vhost/vhost_user/vhost-net-user.h\n+++ b/lib/librte_vhost/vhost_user/vhost-net-user.h\n@@ -66,6 +66,7 @@ typedef enum VhostUserRequest {\n \tVHOST_USER_GET_PROTOCOL_FEATURES = 15,\n \tVHOST_USER_SET_PROTOCOL_FEATURES = 16,\n \tVHOST_USER_GET_QUEUE_NUM = 17,\n+\tVHOST_USER_SET_VRING_ENABLE = 18,\n \tVHOST_USER_MAX\n } VhostUserRequest;\n \ndiff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c\nindex e83d279..9871f20 100644\n--- a/lib/librte_vhost/vhost_user/virtio-net-user.c\n+++ b/lib/librte_vhost/vhost_user/virtio-net-user.c\n@@ -306,6 +306,28 @@ user_get_vring_base(struct vhost_device_ctx ctx,\n \treturn 0;\n }\n \n+/*\n+ * when virtio queues are ready to work, qemu will send us to\n+ * enable the virtio queue pair.\n+ */\n+int\n+user_set_vring_enable(struct vhost_device_ctx ctx,\n+\t\t struct vhost_vring_state *state)\n+{\n+\tstruct virtio_net *dev = get_device(ctx);\n+\tuint32_t base_idx = state->index;\n+\tint enabled = (int)state->num;\n+\n+\tRTE_LOG(INFO, VHOST_CONFIG,\n+\t\t\"set queue enable: %d to qp idx: %d\\n\",\n+\t\tenabled, state->index);\n+\n+\tdev->virtqueue[base_idx + VIRTIO_RXQ]->enabled = enabled;\n+\tdev->virtqueue[base_idx + VIRTIO_TXQ]->enabled = enabled;\n+\n+\treturn 0;\n+}\n+\n void\n user_destroy_device(struct vhost_device_ctx ctx)\n {\ndiff --git a/lib/librte_vhost/vhost_user/virtio-net-user.h b/lib/librte_vhost/vhost_user/virtio-net-user.h\nindex e7a6ff4..d46057e 100644\n--- a/lib/librte_vhost/vhost_user/virtio-net-user.h\n+++ b/lib/librte_vhost/vhost_user/virtio-net-user.h\n@@ -50,5 +50,8 @@ void user_set_protocol_features(struct vhost_device_ctx ctx,\n \n int user_get_vring_base(struct vhost_device_ctx, struct vhost_vring_state *);\n \n+int user_set_vring_enable(struct vhost_device_ctx ctx,\n+\t\t\t struct vhost_vring_state *state);\n+\n void user_destroy_device(struct vhost_device_ctx);\n #endif\ndiff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c\nindex 643a92e..5fe1ad6 100644\n--- a/lib/librte_vhost/virtio-net.c\n+++ b/lib/librte_vhost/virtio-net.c\n@@ -254,7 +254,7 @@ rm_config_ll_entry(struct virtio_net_config_ll *ll_dev,\n }\n \n static void\n-init_vring_queue(struct vhost_virtqueue *vq)\n+init_vring_queue(struct vhost_virtqueue *vq, int qp_idx)\n {\n \tmemset(vq, 0, sizeof(struct vhost_virtqueue));\n \n@@ -263,13 +263,19 @@ init_vring_queue(struct vhost_virtqueue *vq)\n \n \t/* Backends are set to -1 indicating an inactive device. */\n \tvq->backend = -1;\n+\n+\t/* always set the default vq pair to enabled */\n+\tif (qp_idx == 0)\n+\t\tvq->enabled = 1;\n }\n \n static void\n init_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx)\n {\n-\tinit_vring_queue(dev->virtqueue[qp_idx * VIRTIO_QNUM + VIRTIO_RXQ]);\n-\tinit_vring_queue(dev->virtqueue[qp_idx * VIRTIO_QNUM + VIRTIO_TXQ]);\n+\tuint32_t base_idx = qp_idx * VIRTIO_QNUM;\n+\n+\tinit_vring_queue(dev->virtqueue[base_idx + VIRTIO_RXQ], qp_idx);\n+\tinit_vring_queue(dev->virtqueue[base_idx + VIRTIO_TXQ], qp_idx);\n }\n \n static int\n", "prefixes": [ "dpdk-dev", "v5", "resend", "05/12" ] }{ "id": 7084, "url": "