From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37785 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PmmPY-0001Ue-KR for qemu-devel@nongnu.org; Tue, 08 Feb 2011 07:11:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmmPX-00006z-HZ for qemu-devel@nongnu.org; Tue, 08 Feb 2011 07:11:12 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:43890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmmPX-00006m-CX for qemu-devel@nongnu.org; Tue, 08 Feb 2011 07:11:11 -0500 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by e35.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p18Buwcn020593 for ; Tue, 8 Feb 2011 04:56:58 -0700 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p18CB6ol116052 for ; Tue, 8 Feb 2011 05:11:06 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p18CB5ZY005062 for ; Tue, 8 Feb 2011 05:11:05 -0700 Date: Tue, 8 Feb 2011 17:40:58 +0530 From: pradeep Message-ID: <20110208174058.71d73062@skywalker> In-Reply-To: <20110207135001.GA23844@redhat.com> References: <20110207135001.GA23844@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] vhost: disable on tap link down List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Juan Quintela , Jes.Sorensen@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org, Alex Williamson , Sridhar Samudrala 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 --Pradeep > Thanks! > > hw/virtio-net.c | 4 ++++ > net.c | 7 +++++++ > 2 files changed, 11 insertions(+), 0 deletions(-) > > diff --git a/hw/virtio-net.c b/hw/virtio-net.c > index 671d952..fc2d6f5 100644 > --- a/hw/virtio-net.c > +++ b/hw/virtio-net.c > @@ -112,6 +112,10 @@ 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; > } > diff --git a/net.c b/net.c > index 9ba5be2..57ee997 100644 > --- a/net.c > +++ b/net.c > @@ -1324,6 +1324,13 @@ done: > if (vc->info->link_status_changed) { > vc->info->link_status_changed(vc); > } > + > + /* Notify peer. Don't update peer link status: this makes it > possible to > + * disconnect from host network without notifying the guest. > + * FIXME: is this useful? Could just be an artifact of vlan > support. */ > + if (vc->peer && vc->peer->info->link_status_changed) { > + vc->peer->info->link_status_changed(vc->peer); > + } > return 0; > } >