From patchwork Wed Feb 9 16:45:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 82500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 58AC4B70A9 for ; Thu, 10 Feb 2011 03:48:28 +1100 (EST) Received: from localhost ([127.0.0.1]:43147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnDDN-0002sE-6K for incoming@patchwork.ozlabs.org; Wed, 09 Feb 2011 11:48:25 -0500 Received: from [140.186.70.92] (port=34616 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnDAi-0002f1-Q0 for qemu-devel@nongnu.org; Wed, 09 Feb 2011 11:45:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnDAg-0000qv-GX for qemu-devel@nongnu.org; Wed, 09 Feb 2011 11:45:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnDAg-0000qp-7q for qemu-devel@nongnu.org; Wed, 09 Feb 2011 11:45:38 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p19GjbGX029211 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 9 Feb 2011 11:45:37 -0500 Received: from redhat.com (vpn-200-11.tlv.redhat.com [10.35.200.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p19GjXUu027030; Wed, 9 Feb 2011 11:45:34 -0500 Date: Wed, 9 Feb 2011 18:45:09 +0200 From: "Michael S. Tsirkin" To: armbru@redhat.com, alex.williamson@redhat.com, glommer@redhat.com, lcapitulino@redhat.com, jasowang@redhat.com, Amit Shah , qemu-devel@nongnu.org Message-ID: <0b4378b01430b620069407a3ffd8dce6ecbbe343.1297269881.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mutt-Fcc: =sent User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Subject: [Qemu-devel] [PATCHv3 2/2] vhost: disable on tap link down X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/virtio-net.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 671d952..20cf680 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) {