From: Amos Kong <akong@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] vhost_net: cleanup start/stop condition
Date: Tue, 5 Aug 2014 10:28:20 +0800 [thread overview]
Message-ID: <20140805022820.GB12435@z.redhat.com> (raw)
In-Reply-To: <1407154111-13155-1-git-send-email-mst@redhat.com>
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 <akong@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 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.
prev parent reply other threads:[~2014-08-05 2:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 12:12 [Qemu-devel] [PATCH] vhost_net: cleanup start/stop condition Michael S. Tsirkin
2014-08-05 2:28 ` Amos Kong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140805022820.GB12435@z.redhat.com \
--to=akong@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).