[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 22/30] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 22/30] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK |
Date: |
Wed, 26 Feb 2020 04:07:24 -0500 |
From: Johannes Berg <address@hidden>
This is really simple, since we know whether a response is
already requested or not, so we can just send a (successful)
response when there isn't one already.
Given that, it's not all _that_ useful but the master can at
least be sure the message was processed, and we can exercise
more code paths using the example code.
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Johannes Berg <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
contrib/libvhost-user/libvhost-user.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/contrib/libvhost-user/libvhost-user.c
b/contrib/libvhost-user/libvhost-user.c
index b89bf18501..533d55d82a 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -1199,7 +1199,8 @@ vu_get_protocol_features_exec(VuDev *dev, VhostUserMsg
*vmsg)
1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD |
1ULL << VHOST_USER_PROTOCOL_F_SLAVE_REQ |
1ULL << VHOST_USER_PROTOCOL_F_HOST_NOTIFIER |
- 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD;
+ 1ULL << VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD |
+ 1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK;
if (have_userfault()) {
features |= 1ULL << VHOST_USER_PROTOCOL_F_PAGEFAULT;
@@ -1581,13 +1582,20 @@ vu_dispatch(VuDev *dev)
{
VhostUserMsg vmsg = { 0, };
int reply_requested;
- bool success = false;
+ bool need_reply, success = false;
if (!vu_message_read(dev, dev->sock, &vmsg)) {
goto end;
}
+ need_reply = vmsg.flags & VHOST_USER_NEED_REPLY_MASK;
+
reply_requested = vu_process_message(dev, &vmsg);
+ if (!reply_requested && need_reply) {
+ vmsg_set_reply_u64(&vmsg, 0);
+ reply_requested = 1;
+ }
+
if (!reply_requested) {
success = true;
goto end;
--
MST
- [PULL v2 13/30] virtio-iommu: Decode the command payload, (continued)
- [PULL v2 13/30] virtio-iommu: Decode the command payload, Michael S. Tsirkin, 2020/02/26
- [PULL v2 12/30] virtio-iommu: Add skeleton, Michael S. Tsirkin, 2020/02/26
- [PULL v2 14/30] virtio-iommu: Implement attach/detach command, Michael S. Tsirkin, 2020/02/26
- [PULL v2 15/30] virtio-iommu: Implement map/unmap, Michael S. Tsirkin, 2020/02/26
- [PULL v2 16/30] virtio-iommu: Implement translate, Michael S. Tsirkin, 2020/02/26
- [PULL v2 17/30] virtio-iommu: Implement fault reporting, Michael S. Tsirkin, 2020/02/26
- [PULL v2 18/30] virtio-iommu: Support migration, Michael S. Tsirkin, 2020/02/26
- [PULL v2 19/30] virtio-iommu-pci: Add virtio iommu pci support, Michael S. Tsirkin, 2020/02/26
- [PULL v2 20/30] hw/arm/virt: Add the virtio-iommu device tree mappings, Michael S. Tsirkin, 2020/02/26
- [PULL v2 21/30] MAINTAINERS: add virtio-iommu related files, Michael S. Tsirkin, 2020/02/26
- [PULL v2 22/30] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK,
Michael S. Tsirkin <=
- [PULL v2 23/30] libvhost-user-glib: fix VugDev main fd cleanup, Michael S. Tsirkin, 2020/02/26
- [PULL v2 24/30] libvhost-user-glib: use g_main_context_get_thread_default(), Michael S. Tsirkin, 2020/02/26
- [PULL v2 25/30] libvhost-user: handle NOFD flag in call/kick/err better, Michael S. Tsirkin, 2020/02/26
- [PULL v2 26/30] docs: vhost-user: add in-band kick/call messages, Michael S. Tsirkin, 2020/02/26
- [PULL v2 27/30] libvhost-user: implement in-band notifications, Michael S. Tsirkin, 2020/02/26
- [PULL v2 28/30] acpi: cpuhp: document CPHP_GET_CPU_ID_CMD command, Michael S. Tsirkin, 2020/02/26
- [PULL v2 29/30] vhost-user: only set slave channel for first vq, Michael S. Tsirkin, 2020/02/26
- [PULL v2 30/30] Fixed assert in vhost_user_set_mem_table_postcopy, Michael S. Tsirkin, 2020/02/26
- Re: [PULL v2 00/30] virtio, pc: fixes, features, Michael S. Tsirkin, 2020/02/27