[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 050/103] vhost_net should call the poll callback only
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 050/103] vhost_net should call the poll callback only when it is set |
Date: |
Tue, 17 Jun 2014 20:39:10 +0300 |
From: Nikolay Nikolaev <address@hidden>
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 <address@hidden>
Signed-off-by: Nikolay Nikolaev <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/net/vhost_net.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 6a9a32f..dcec0f7 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);
}
--
MST
- [Qemu-devel] [PULL 039/103] ich: get rid of spaces in type name, (continued)
- [Qemu-devel] [PULL 039/103] ich: get rid of spaces in type name, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 040/103] pc: q35: acpi: report error to user on unsupported unplug request, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 038/103] qtest: fix hex2nib for capital characters, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 032/103] pc: ACPI BIOS: reserve SRAT entry for hotplug mem hole, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 041/103] migration: export SELF_ANNOUNCE_ROUNDS, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 042/103] migration: introduce self_announce_delay(), Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 043/103] virtio-net: announce self by guest, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 044/103] Add kvm_eventfds_enabled function, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 045/103] Add chardev API qemu_chr_fe_read_all, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 049/103] vhost: add vhost_get_features and vhost_ack_features, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 050/103] vhost_net should call the poll callback only when it is set,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 051/103] Refactor virtio-net to use generic get_vhost_net, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 052/103] vhost_net_init will use VhostNetOptions to get all its arguments, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 053/103] Add vhost_ops to vhost_dev struct and replace all relevant ioctls, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 054/103] Add vhost-backend and VhostBackendType, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 056/103] vhost-net: vhost-user feature bits support, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 047/103] Add chardev API qemu_chr_fe_get_msgfds, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 055/103] Add vhost-user as a vhost backend., Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 057/103] Add new vhost-user netdev backend, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 058/103] Add the vhost-user netdev backend to the command line, Michael S. Tsirkin, 2014/06/17
- [Qemu-devel] [PULL 059/103] Add vhost-user protocol documentation, Michael S. Tsirkin, 2014/06/17