aboutsummaryrefslogtreecommitdiff
path: root/hw/net
diff options
context:
space:
mode:
authorYajun Wu <yajunw@nvidia.com>2022-10-17 14:44:51 +0800
committerMichael S. Tsirkin <mst@redhat.com>2022-11-07 14:08:17 -0500
commit8b67fe00652b2640f3f841a7b102f6bcf82483a3 (patch)
tree9b720b78f7cd6309fe47e9eedc6cfd33b593db1a /hw/net
parent1b2b12376c8a513a0c7b5e3b8ea702038d3d7db5 (diff)
downloadqemu-8b67fe00652b2640f3f841a7b102f6bcf82483a3.zip
qemu-8b67fe00652b2640f3f841a7b102f6bcf82483a3.tar.gz
qemu-8b67fe00652b2640f3f841a7b102f6bcf82483a3.tar.bz2
vhost: Change the sequence of device start
This patch is part of adding vhost-user vhost_dev_start support. The motivation is to improve backend configuration speed and reduce live migration VM downtime. Moving the device start routines after finishing all the necessary device and VQ configuration, further aligning to the virtio specification for "device initialization sequence". Following patch will add vhost-user vhost_dev_start support. Signed-off-by: Yajun Wu <yajunw@nvidia.com> Acked-by: Parav Pandit <parav@nvidia.com> Message-Id: <20221017064452.1226514-2-yajunw@nvidia.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/net')
-rw-r--r--hw/net/vhost_net.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 53b2fac..feda448 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -389,21 +389,20 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
} else {
peer = qemu_get_peer(ncs, n->max_queue_pairs);
}
- r = vhost_net_start_one(get_vhost_net(peer), dev);
-
- if (r < 0) {
- goto err_start;
- }
if (peer->vring_enable) {
/* restore vring enable state */
r = vhost_set_vring_enable(peer, peer->vring_enable);
if (r < 0) {
- vhost_net_stop_one(get_vhost_net(peer), dev);
goto err_start;
}
}
+
+ r = vhost_net_start_one(get_vhost_net(peer), dev);
+ if (r < 0) {
+ goto err_start;
+ }
}
return 0;