From patchwork Tue Feb 8 15:41:12 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: 82352 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 89002B70FF for ; Wed, 9 Feb 2011 02:42:25 +1100 (EST) Received: from localhost ([127.0.0.1]:53688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pmphu-0006NN-RS for incoming@patchwork.ozlabs.org; Tue, 08 Feb 2011 10:42:22 -0500 Received: from [140.186.70.92] (port=58079 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmphK-0006MR-Gy for qemu-devel@nongnu.org; Tue, 08 Feb 2011 10:41:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmphI-0006Vt-Ri for qemu-devel@nongnu.org; Tue, 08 Feb 2011 10:41:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmphI-0006Va-Ie for qemu-devel@nongnu.org; Tue, 08 Feb 2011 10:41:44 -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 p18FfeJj017654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Feb 2011 10:41:40 -0500 Received: from redhat.com (vpn-200-8.tlv.redhat.com [10.35.200.8]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id p18FfbhU003552; Tue, 8 Feb 2011 10:41:38 -0500 Date: Tue, 8 Feb 2011 17:41:12 +0200 From: "Michael S. Tsirkin" To: pradeep Message-ID: <20110208154112.GA4341@redhat.com> References: <20110207135001.GA23844@redhat.com> <20110208174058.71d73062@skywalker> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110208174058.71d73062@skywalker> 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: Juan Quintela , Jes.Sorensen@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org, Alex Williamson , Sridhar Samudrala Subject: [Qemu-devel] Re: [PATCH] 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 On Tue, Feb 08, 2011 at 05:40:58PM +0530, pradeep wrote: > On Mon, 7 Feb 2011 15:50:01 +0200 > "Michael S. Tsirkin" wrote: > > > qemu makes it possible to disable link at tap > > which is not communicated to the guest but > > causes all packets to be dropped. > > > > Handle this with vhost simply by moving to the userspace emulation. > > > > Note: it might be a good idea to make peer link status match > > tap in this case, so the guest gets an event > > and updates the carrier state. For now > > stay bug for bug compatible with what we used to have. > > > > Signed-off-by: Michael S. Tsirkin > > Reported-by: pradeep > > --- > > > > Untested. > > Pradeep, mind trying this patch out and reporting? > > Hi mst > > This patch works. Thanks Strange actually. Did you put the link down before guest booted? I went to test it with set link after guest is up, and it didn't work, I needed this on top - can you ack this in your setup as well pls? diff --git a/hw/virtio-net.c b/hw/virtio-net.c index fc2d6f5..3e3d73a 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -112,14 +112,11 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) return; } - if (n->nic->nc.peer->link_down) { - return; - } - 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) {