[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 06/17] vhost_net should call the poll callback on
From: |
Antonios Motakis |
Subject: |
[Qemu-devel] [PATCH v8 06/17] vhost_net should call the poll callback only when it is set |
Date: |
Thu, 13 Feb 2014 13:03:17 +0100 |
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>
---
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 854997d..cbbf50a 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -166,7 +166,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) {
@@ -183,7 +186,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);
@@ -204,7 +209,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);
}
--
1.8.3.2
- [Qemu-devel] [PATCH v8 02/17] Add chardev API qemu_chr_fe_read_all, (continued)
[Qemu-devel] [PATCH v8 03/17] Add chardev API qemu_chr_fe_set_msgfds, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 04/17] Add chardev API qemu_chr_fe_get_msgfds, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 05/17] Add G_IO_HUP handler for socket chardev, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 06/17] vhost_net should call the poll callback only when it is set,
Antonios Motakis <=
[Qemu-devel] [PATCH v8 07/17] Refactor virtio-net to use generic get_vhost_net, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 08/17] vhost_net_init will use VhostNetOptions to get all its arguments, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 09/17] Add vhost_ops to vhost_dev struct and replace all relevant ioctls, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 10/17] Add mandatory_features to vhost_dev, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 11/17] Add vhost-backend and VhostBackendType, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 12/17] Add vhost-user as a vhost backend, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 13/17] Add new vhost-user netdev backend, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 14/17] Add the vhost-user netdev backend to the command line, Antonios Motakis, 2014/02/13
[Qemu-devel] [PATCH v8 15/17] Add vhost-user protocol documentation, Antonios Motakis, 2014/02/13