From patchwork Wed Jun 2 18:01:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 103845 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o52I68s8031889 for ; Wed, 2 Jun 2010 18:06:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932615Ab0FBSGE (ORCPT ); Wed, 2 Jun 2010 14:06:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13708 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932590Ab0FBSGD (ORCPT ); Wed, 2 Jun 2010 14:06:03 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o52I63XO018785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Jun 2010 14:06:03 -0400 Received: from redhat.com (vpn1-4-231.ams2.redhat.com [10.36.4.231]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o52I61kf026194 for ; Wed, 2 Jun 2010 14:06:02 -0400 Date: Wed, 2 Jun 2010 21:01:52 +0300 From: "Michael S. Tsirkin" To: kvm@vger.kernel.org Subject: [PATCHv2] virtio-net: stop vhost backend on vmstop Message-ID: <20100602180152.GA21861@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 02 Jun 2010 18:06:09 +0000 (UTC) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 28f26e1..67eebcf 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -877,12 +877,11 @@ static void virtio_net_set_status(struct VirtIODevice *vdev, uint8_t status) static void virtio_net_vmstate_change(void *opaque, int running, int reason) { VirtIONet *n = opaque; - if (!running) { - return; - } - /* This is called when vm is started, it will start vhost backend if - * appropriate e.g. after migration. */ - virtio_net_set_status(&n->vdev, n->vdev.status); + uint8_t status = running ? n->vdev.status : 0; + /* This is called when vm is started/stopped, + * it will start/stop vhost backend if appropriate + * e.g. after migration. */ + virtio_net_set_status(&n->vdev, status); } VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf)