Skip to content

Commit

Permalink
vhost_net: cleanup start/stop condition
Browse files Browse the repository at this point in the history
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 <mst@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
  • Loading branch information
mstsirkin committed Sep 2, 2014
1 parent b5a280c commit 2d2507e
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions hw/net/vhost_net.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2d2507e

Please sign in to comment.