diff options
author | Nikolay Nikolaev <n.nikolaev@virtualopensystems.com> | 2014-05-27 15:04:55 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-06-19 16:41:55 +0300 |
commit | 212d69f25e8bff3e9dc8af6ca30a6556094fc5a5 (patch) | |
tree | 054c19ad99f03ba6d8f0ac4aedb6ddeeef1511ed /hw/net | |
parent | 2e6d46d77ed328d34a94688da8371bcbe243479b (diff) | |
download | qemu-212d69f25e8bff3e9dc8af6ca30a6556094fc5a5.tar.gz qemu-212d69f25e8bff3e9dc8af6ca30a6556094fc5a5.tar.bz2 qemu-212d69f25e8bff3e9dc8af6ca30a6556094fc5a5.zip |
vhost_net should call the poll callback only when it is set
The poll callback needs to be called when bringing up or down
the vhost_net instance. As it is not mandatory for an NetClient
to implement it, invoke it only when it is set.
Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/net')
-rw-r--r-- | hw/net/vhost_net.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 6a9a32f56b..dcec0f730b 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -168,7 +168,10 @@ static int vhost_net_start_one(struct vhost_net *net, goto fail_start; } - net->nc->info->poll(net->nc, false); + if (net->nc->info->poll) { + net->nc->info->poll(net->nc, false); + } + qemu_set_fd_handler(net->backend, NULL, NULL, NULL); file.fd = net->backend; for (file.index = 0; file.index < net->dev.nvqs; ++file.index) { @@ -185,7 +188,9 @@ fail: int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file); assert(r >= 0); } - net->nc->info->poll(net->nc, true); + if (net->nc->info->poll) { + net->nc->info->poll(net->nc, true); + } vhost_dev_stop(&net->dev, dev); fail_start: vhost_dev_disable_notifiers(&net->dev, dev); @@ -206,7 +211,9 @@ static void vhost_net_stop_one(struct vhost_net *net, int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file); assert(r >= 0); } - net->nc->info->poll(net->nc, true); + if (net->nc->info->poll) { + net->nc->info->poll(net->nc, true); + } vhost_dev_stop(&net->dev, dev); vhost_dev_disable_notifiers(&net->dev, dev); } |