* [Qemu-devel] [PATCH] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK
@ 2019-09-03 19:25 Johannes Berg
2019-09-12 11:09 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2019-09-03 19:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
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.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
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 4b36e35a82f8..010ddb9c0f42 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -1164,7 +1164,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;
@@ -1546,13 +1547,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;
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK
2019-09-03 19:25 [Qemu-devel] [PATCH] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK Johannes Berg
@ 2019-09-12 11:09 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2019-09-12 11:09 UTC (permalink / raw)
To: Johannes Berg; +Cc: Marc-André Lureau, qemu-devel, Johannes Berg
[-- Attachment #1: Type: text/plain, Size: 696 bytes --]
On Tue, Sep 03, 2019 at 10:25:05PM +0300, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> 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.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> contrib/libvhost-user/libvhost-user.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-12 11:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 19:25 [Qemu-devel] [PATCH] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK Johannes Berg
2019-09-12 11:09 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).