qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luke Gorrie <luke@snabb.co>
To: qemu-devel@nongnu.org
Cc: Luke Gorrie <luke@snabb.co>,
	n.nikolaev@virtualopensystems.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH] vhost-user: Send VHOST_RESET_OWNER on vhost stop
Date: Sun, 26 Apr 2015 15:00:49 +0200	[thread overview]
Message-ID: <1430053249-31553-2-git-send-email-luke@snabb.co> (raw)
In-Reply-To: <1430053249-31553-1-git-send-email-luke@snabb.co>

Ensure that the vhost-user slave knows when the vrings are valid and
when they are invalid, for example during a guest reboot.

The vhost-user protocol says this of VHOST_RESET_OWNER:

      Issued when a new connection is about to be closed. The Master
      will no longer own this connection (and will usually close it).

Send this message to tell the vhost-user slave that the vhost session
has ended and that session state (e.g. vrings) is no longer valid.

Signed-off-by: Luke Gorrie <luke@snabb.co>
---
 hw/net/vhost_net.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index cf23335..47f8b89 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -263,6 +263,13 @@ static void vhost_net_stop_one(struct vhost_net *net,
                                           &file);
             assert(r >= 0);
         }
+    } else if (net->nc->info->type == NET_CLIENT_OPTIONS_KIND_VHOST_USER) {
+        for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
+            const VhostOps *vhost_ops = net->dev.vhost_ops;
+            int r = vhost_ops->vhost_call(&net->dev, VHOST_RESET_OWNER,
+                                          NULL);
+            assert(r >= 0);
+        }
     }
     if (net->nc->info->poll) {
         net->nc->info->poll(net->nc, true);
-- 
2.1.4

      reply	other threads:[~2015-04-26 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-26 13:00 [Qemu-devel] [PATCH] vhost-user: Send VHOST_RESET_OWNER on vhost stop Luke Gorrie
2015-04-26 13:00 ` Luke Gorrie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430053249-31553-2-git-send-email-luke@snabb.co \
    --to=luke@snabb.co \
    --cc=mst@redhat.com \
    --cc=n.nikolaev@virtualopensystems.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).