From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOpgQ-0006vG-GT for qemu-devel@nongnu.org; Tue, 02 Sep 2014 11:07:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOpgK-00011M-5l for qemu-devel@nongnu.org; Tue, 02 Sep 2014 11:07:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOpgJ-000101-NJ for qemu-devel@nongnu.org; Tue, 02 Sep 2014 11:07:39 -0400 Date: Tue, 2 Sep 2014 18:07:33 +0300 From: "Michael S. Tsirkin" Message-ID: <1409670380-22943-10-git-send-email-mst@redhat.com> References: <1409670380-22943-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1409670380-22943-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 09/13] vhost_net: cleanup start/stop condition List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Amos Kong , Anthony Liguori Checking vhost device internal state in vhost_net looks like a layering violation since vhost_net does not set this flag: it is set and tested by vhost.c. There seems to be no reason to check this: caller in virtio net uses its own flag, vhost_started, to ensure vhost is started/stopped as appropriate. Signed-off-by: Michael S. Tsirkin Reviewed-by: Amos Kong --- hw/net/vhost_net.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index f87c798..9bbf2ee 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -195,10 +195,6 @@ static int vhost_net_start_one(struct vhost_net *net, struct vhost_vring_file file = { }; int r; - if (net->dev.started) { - return 0; - } - net->dev.nvqs = 2; net->dev.vqs = net->vqs; net->dev.vq_index = vq_index; @@ -256,10 +252,6 @@ static void vhost_net_stop_one(struct vhost_net *net, { struct vhost_vring_file file = { .fd = -1 }; - if (!net->dev.started) { - return; - } - if (net->nc->info->type == NET_CLIENT_OPTIONS_KIND_TAP) { for (file.index = 0; file.index < net->dev.nvqs; ++file.index) { const VhostOps *vhost_ops = net->dev.vhost_ops; -- MST