Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/73232/?format=api
https://patches.dpdk.org/api/patches/73232/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200706112452.1474533-6-amorenoz@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": "<20200706112452.1474533-6-amorenoz@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200706112452.1474533-6-amorenoz@redhat.com", "date": "2020-07-06T11:24:49", "name": "[v3,5/8] vhost: add support for virtio status", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "ed4eaa44f9c0de479502fb3e849a3b916c54d598", "submitter": { "id": 1397, "url": "https://patches.dpdk.org/api/people/1397/?format=api", "name": "Adrian Moreno", "email": "amorenoz@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/20200706112452.1474533-6-amorenoz@redhat.com/mbox/", "series": [ { "id": 10810, "url": "https://patches.dpdk.org/api/series/10810/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10810", "date": "2020-07-06T11:24:45", "name": "vhost: improve Vhost/vDPA device init", "version": 3, "mbox": "https://patches.dpdk.org/series/10810/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/73232/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/73232/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 61ADEA00C5;\n\tMon, 6 Jul 2020 13:26:02 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id EAA691DA92;\n\tMon, 6 Jul 2020 13:25:36 +0200 (CEST)", "from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com\n [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 154E21D93E\n for <dev@dpdk.org>; Mon, 6 Jul 2020 13:25:34 +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-256-YPRctqThN-W0HKFzw03ymA-1; Mon, 06 Jul 2020 07:25:30 -0400", "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com\n [10.5.11.12])\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 1A7931B18BC1;\n Mon, 6 Jul 2020 11:25:29 +0000 (UTC)", "from amorenoz.users.ipa.redhat.com (ovpn-112-91.ams2.redhat.com\n [10.36.112.91])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 13BBD60C87;\n Mon, 6 Jul 2020 11:25:26 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1594034734;\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=f2MRSdMV3LTQT3/GlTDZ3CS/VDaQxAsc8f9aLbEgonY=;\n b=Qn9sjx635jFkevakZ/umK2XusPOxiZ2/rwnD5Qpmrt6sKY+p3dhy6WcUg+3rez6kotVlRx\n 1kWwXmgcwNjULZCDby9ba0JNSJ+vQZOIUyjAt8h0LWC57YsCUqL97+lkkC+QE6LcXqib70\n /rN1kXOrZ1pmVk/31e8XDz95G+OQgSA=", "X-MC-Unique": "YPRctqThN-W0HKFzw03ymA-1", "From": "Adrian Moreno <amorenoz@redhat.com>", "To": "dev@dpdk.org, chenbo.xia@intel.com, xiaolong.ye@intel.com,\n shahafs@mellanox.com, matan@mellanox.com, maxime.coquelin@redhat.com,\n xiao.w.wang@intel.com, viacheslavo@mellanox.com", "Cc": "jasowang@redhat.com,\n\tlulu@redhat.com", "Date": "Mon, 6 Jul 2020 13:24:49 +0200", "Message-Id": "<20200706112452.1474533-6-amorenoz@redhat.com>", "In-Reply-To": "<20200706112452.1474533-1-amorenoz@redhat.com>", "References": "<20200706112452.1474533-1-amorenoz@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "Authentication-Results": "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@redhat.com", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain; charset=US-ASCII", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v3 5/8] vhost: add support for virtio status", "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 <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": "From: Maxime Coquelin <maxime.coquelin@redhat.com>\n\nThis patch adds support to the new Virtio device status\nVhost-user protocol feature.\n\nGetting such information in the backend helps to know\nwhen the driver is done with the device configuration\nand so makes the initialization phase more robust.\n\nSigned-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>\n---\n lib/librte_vhost/rte_vhost.h | 4 ++++\n lib/librte_vhost/vhost.h | 9 +++++++\n lib/librte_vhost/vhost_user.c | 45 ++++++++++++++++++++++++++++++++++-\n lib/librte_vhost/vhost_user.h | 6 +++--\n 4 files changed, 61 insertions(+), 3 deletions(-)", "diff": "diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h\nindex 8a5c332c8..104e2e869 100644\n--- a/lib/librte_vhost/rte_vhost.h\n+++ b/lib/librte_vhost/rte_vhost.h\n@@ -102,6 +102,10 @@ extern \"C\" {\n #define VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD 12\n #endif\n \n+#ifndef VHOST_USER_PROTOCOL_F_STATUS\n+#define VHOST_USER_PROTOCOL_F_STATUS 16\n+#endif\n+\n /** Indicate whether protocol features negotiation is supported. */\n #ifndef VHOST_USER_F_PROTOCOL_FEATURES\n #define VHOST_USER_F_PROTOCOL_FEATURES\t30\ndiff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h\nindex 034463699..25d31c71b 100644\n--- a/lib/librte_vhost/vhost.h\n+++ b/lib/librte_vhost/vhost.h\n@@ -204,6 +204,14 @@ struct vhost_virtqueue {\n \tTAILQ_HEAD(, vhost_iotlb_entry) iotlb_pending_list;\n } __rte_cache_aligned;\n \n+/* Virtio device status as per Virtio specification */\n+#define VIRTIO_DEVICE_STATUS_ACK\t\t0x01\n+#define VIRTIO_DEVICE_STATUS_DRIVER\t\t0x02\n+#define VIRTIO_DEVICE_STATUS_DRIVER_OK\t\t0x04\n+#define VIRTIO_DEVICE_STATUS_FEATURES_OK\t0x08\n+#define VIRTIO_DEVICE_STATUS_DEV_NEED_RESET\t0x40\n+#define VIRTIO_DEVICE_STATUS_FAILED\t\t0x80\n+\n #define VHOST_MAX_VRING\t\t\t0x100\n #define VHOST_MAX_QUEUE_PAIRS\t\t0x80\n \n@@ -349,6 +357,7 @@ struct virtio_net {\n \tuint64_t\t\tlog_addr;\n \tstruct rte_ether_addr\tmac;\n \tuint16_t\t\tmtu;\n+\tuint8_t\t\t\tstatus;\n \n \tstruct vhost_device_ops const *notify_ops;\n \ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex bf079c914..8d3d13913 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -87,6 +87,7 @@ static const char *vhost_message_str[VHOST_USER_MAX] = {\n \t[VHOST_USER_POSTCOPY_END] = \"VHOST_USER_POSTCOPY_END\",\n \t[VHOST_USER_GET_INFLIGHT_FD] = \"VHOST_USER_GET_INFLIGHT_FD\",\n \t[VHOST_USER_SET_INFLIGHT_FD] = \"VHOST_USER_SET_INFLIGHT_FD\",\n+\t[VHOST_USER_SET_STATUS] = \"VHOST_USER_SET_STATUS\",\n };\n \n static int send_vhost_reply(int sockfd, struct VhostUserMsg *msg);\n@@ -1350,6 +1351,11 @@ virtio_is_ready(struct virtio_net *dev)\n \t\t\treturn 0;\n \t}\n \n+\t/* If supported, ensure the frontend is really done with config */\n+\tif (dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_STATUS))\n+\t\tif (!(dev->status & VIRTIO_DEVICE_STATUS_DRIVER_OK))\n+\t\t\treturn 0;\n+\n \tdev->flags |= VIRTIO_DEV_READY;\n \n \tif (!(dev->flags & VIRTIO_DEV_RUNNING))\n@@ -2452,6 +2458,42 @@ vhost_user_postcopy_end(struct virtio_net **pdev, struct VhostUserMsg *msg,\n \treturn RTE_VHOST_MSG_RESULT_REPLY;\n }\n \n+static int\n+vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg,\n+\t\t\tint main_fd __rte_unused)\n+{\n+\tstruct virtio_net *dev = *pdev;\n+\n+\tif (validate_msg_fds(msg, 0) != 0)\n+\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n+\n+\t/* As per Virtio specification, the device status is 8bits long */\n+\tif (msg->payload.u64 > UINT8_MAX) {\n+\t\tVHOST_LOG_CONFIG(ERR, \"Invalid VHOST_USER_SET_STATUS payload 0x%\" PRIx64 \"\\n\",\n+\t\t\t\tmsg->payload.u64);\n+\t\treturn RTE_VHOST_MSG_RESULT_ERR;\n+\t}\n+\n+\tdev->status = msg->payload.u64;\n+\n+\tVHOST_LOG_CONFIG(INFO, \"New device status(0x%08x):\\n\"\n+\t\t\t\"\\t-ACKNOWLEDGE: %u\\n\"\n+\t\t\t\"\\t-DRIVER: %u\\n\"\n+\t\t\t\"\\t-FEATURES_OK: %u\\n\"\n+\t\t\t\"\\t-DRIVER_OK: %u\\n\"\n+\t\t\t\"\\t-DEVICE_NEED_RESET: %u\\n\"\n+\t\t\t\"\\t-FAILED: %u\\n\",\n+\t\t\tdev->status,\n+\t\t\t!!(dev->status & VIRTIO_DEVICE_STATUS_ACK),\n+\t\t\t!!(dev->status & VIRTIO_DEVICE_STATUS_DRIVER),\n+\t\t\t!!(dev->status & VIRTIO_DEVICE_STATUS_FEATURES_OK),\n+\t\t\t!!(dev->status & VIRTIO_DEVICE_STATUS_DRIVER_OK),\n+\t\t\t!!(dev->status & VIRTIO_DEVICE_STATUS_DEV_NEED_RESET),\n+\t\t\t!!(dev->status & VIRTIO_DEVICE_STATUS_FAILED));\n+\n+\treturn RTE_VHOST_MSG_RESULT_OK;\n+}\n+\n typedef int (*vhost_message_handler_t)(struct virtio_net **pdev,\n \t\t\t\t\tstruct VhostUserMsg *msg,\n \t\t\t\t\tint main_fd);\n@@ -2484,6 +2526,7 @@ static vhost_message_handler_t vhost_message_handlers[VHOST_USER_MAX] = {\n \t[VHOST_USER_POSTCOPY_END] = vhost_user_postcopy_end,\n \t[VHOST_USER_GET_INFLIGHT_FD] = vhost_user_get_inflight_fd,\n \t[VHOST_USER_SET_INFLIGHT_FD] = vhost_user_set_inflight_fd,\n+\t[VHOST_USER_SET_STATUS] = vhost_user_set_status,\n };\n \n /* return bytes# of read on success or negative val on failure. */\n@@ -2851,7 +2894,7 @@ vhost_user_msg_handler(int vid, int fd)\n \tif (!(dev->flags & VIRTIO_DEV_VDPA_CONFIGURED)) {\n \t\tif (vdpa_dev->ops->dev_conf(dev->vid))\n \t\t\tVHOST_LOG_CONFIG(ERR,\n-\t\t\t\t\t \"Failed to configure vDPA device\\n\")\n+\t\t\t\t\t \"Failed to configure vDPA device\\n\");\n \t\telse\n \t\t\tdev->flags |= VIRTIO_DEV_VDPA_CONFIGURED;\n \t}\ndiff --git a/lib/librte_vhost/vhost_user.h b/lib/librte_vhost/vhost_user.h\nindex 1f65efa4a..82885ab5e 100644\n--- a/lib/librte_vhost/vhost_user.h\n+++ b/lib/librte_vhost/vhost_user.h\n@@ -23,7 +23,8 @@\n \t\t\t\t\t (1ULL << VHOST_USER_PROTOCOL_F_CRYPTO_SESSION) | \\\n \t\t\t\t\t (1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) | \\\n \t\t\t\t\t (1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER) | \\\n-\t\t\t\t\t (1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT))\n+\t\t\t\t\t (1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT) | \\\n+\t\t\t\t\t (1ULL << VHOST_USER_PROTOCOL_F_STATUS))\n \n typedef enum VhostUserRequest {\n \tVHOST_USER_NONE = 0,\n@@ -56,7 +57,8 @@ typedef enum VhostUserRequest {\n \tVHOST_USER_POSTCOPY_END = 30,\n \tVHOST_USER_GET_INFLIGHT_FD = 31,\n \tVHOST_USER_SET_INFLIGHT_FD = 32,\n-\tVHOST_USER_MAX = 33\n+\tVHOST_USER_SET_STATUS = 39,\n+\tVHOST_USER_MAX = 41\n } VhostUserRequest;\n \n typedef enum VhostUserSlaveRequest {\n", "prefixes": [ "v3", "5/8" ] }{ "id": 73232, "url": "