From 3299369856db73a02c68869cb03fd1e24238eb9b Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 9 Feb 2011 18:45:09 +0200 Subject: [PATCH] vhost: disable on tap link down qemu makes it possible to disable link at tap which is not communicated to the guest but causes all packets to be dropped. When vhost-net is enabled, vhost needs to be aware of both the virtio link_down and the peer link_down. we switch to userspace emulation when either is down. Signed-off-by: Michael S. Tsirkin Reported-by: pradeep Acked-by: Alex Williamson Acked-by: Jason Wang Signed-off-by: Aurelien Jarno --- hw/virtio-net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 671d952921..20cf680e6b 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -115,7 +115,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) if (!tap_get_vhost_net(n->nic->nc.peer)) { return; } - if (!!n->vhost_started == virtio_net_started(n, status)) { + if (!!n->vhost_started == virtio_net_started(n, status) && + !n->nic->nc.peer->link_down) { return; } if (!n->vhost_started) {