]> Git Repo - qemu.git/commitdiff
vhost-user: Send VHOST_RESET_OWNER on vhost stop
authorLuke Gorrie <[email protected]>
Sun, 26 Apr 2015 13:00:49 +0000 (15:00 +0200)
committerMichael S. Tsirkin <[email protected]>
Mon, 27 Apr 2015 18:49:45 +0000 (20:49 +0200)
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 <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
hw/net/vhost_net.c

index cf23335ba227c86117db5025a6e1256d865b64b9..47f8b89d51cddd4c494471ac957906d23bb202b7 100644 (file)
@@ -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);
This page took 0.030137 seconds and 4 git commands to generate.