From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnoYD-0007cn-9h for qemu-devel@nongnu.org; Wed, 26 Dec 2012 05:49:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TnoYA-0004f6-Sw for qemu-devel@nongnu.org; Wed, 26 Dec 2012 05:49:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TnoYA-0004ez-Lq for qemu-devel@nongnu.org; Wed, 26 Dec 2012 05:49:26 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBQAnQLt019868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 26 Dec 2012 05:49:26 -0500 Date: Wed, 26 Dec 2012 12:52:39 +0200 From: "Michael S. Tsirkin" Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] [PATCH 6/8] virtio-net: set/clear vhost_started in reverse order List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, asias@redhat.com, stefanha@redhat.com As vhost started is cleared last thing on stop, set it first things on start. This makes it possible to use vhost_started while start is in progress which is used by follow-up patches. Signed-off-by: Michael S. Tsirkin --- hw/virtio-net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 5d03b31..b756d57 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -126,12 +126,12 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) if (!vhost_net_query(tap_get_vhost_net(n->nic->nc.peer), &n->vdev)) { return; } + n->vhost_started = 1; r = vhost_net_start(tap_get_vhost_net(n->nic->nc.peer), &n->vdev); if (r < 0) { error_report("unable to start vhost net: %d: " "falling back on userspace virtio", -r); - } else { - n->vhost_started = 1; + n->vhost_started = 0; } } else { vhost_net_stop(tap_get_vhost_net(n->nic->nc.peer), &n->vdev); -- MST