From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEUUT-0006Js-9F for qemu-devel@nongnu.org; Mon, 04 Aug 2014 22:28:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEUUG-0000Xu-Pl for qemu-devel@nongnu.org; Mon, 04 Aug 2014 22:28:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8861) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEUUG-0000Xk-I7 for qemu-devel@nongnu.org; Mon, 04 Aug 2014 22:28:28 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s752SNeK000878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 4 Aug 2014 22:28:26 -0400 Date: Tue, 5 Aug 2014 10:28:20 +0800 From: Amos Kong Message-ID: <20140805022820.GB12435@z.redhat.com> References: <1407154111-13155-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1407154111-13155-1-git-send-email-mst@redhat.com> Subject: Re: [Qemu-devel] [PATCH] vhost_net: cleanup start/stop condition List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Jason Wang , qemu-devel@nongnu.org On Mon, Aug 04, 2014 at 02:12:39PM +0200, Michael S. Tsirkin wrote: > 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. Reasonable, we already checked n->vhost_started flag in virtio-net.c when vhost_net_start() is called. Reviewed-by: Amos Kong > Signed-off-by: Michael S. Tsirkin > --- > hw/net/vhost_net.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c > index f87c798..d9423d1 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; > @@ -251,15 +247,11 @@ fail_notifiers: > return r; > } > > static void vhost_net_stop_one(struct vhost_net *net, > VirtIODevice *dev) > { > 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 -- Amos.