From: Antonios Motakis <a.motakis@virtualopensystems.com>
To: qemu-devel@nongnu.org, snabb-devel@googlegroups.com
Cc: lukego@gmail.com,
Antonios Motakis <a.motakis@virtualopensystems.com>,
tech@virtualopensystems.com, n.nikolaev@virtualopensystems.com,
mst@redhat.com
Subject: [Qemu-devel] [PATCH v7 05/13] vhost_net should call the poll callback only when it is set
Date: Fri, 31 Jan 2014 18:34:34 +0100 [thread overview]
Message-ID: <1391189683-1602-6-git-send-email-a.motakis@virtualopensystems.com> (raw)
In-Reply-To: <1391189683-1602-1-git-send-email-a.motakis@virtualopensystems.com>
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>
---
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 006576d..6aa6e87 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
next prev parent reply other threads:[~2014-01-31 17:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-31 17:34 [Qemu-devel] [PATCH v7 00/13] Vhost and vhost-net support for userspace based backends Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 01/13] Convert -mem-path to QemuOpts and add prealloc and share properties Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 02/13] Add chardev API qemu_chr_fe_read_all Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 03/13] Add chardev API qemu_chr_fe_set_msgfds Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 04/13] Add G_IO_HUP handler for socket chardev Antonios Motakis
2014-01-31 17:34 ` Antonios Motakis [this message]
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 06/13] Refactor virtio-net to use a generic get_vhost_net Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 07/13] vhost_net_init will use VhostNetOptions to get all its arguments Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 08/13] Add vhost_ops to the vhost_dev struct and replace all relevant ioctls Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 09/13] Add vhost-backend and VhostBackendType Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 10/13] Add vhost-user as a vhost backend Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 11/13] Add new vhost-user netdev backend Antonios Motakis
2014-02-10 8:42 ` Michael S. Tsirkin
2014-02-10 16:05 ` Antonios Motakis
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 12/13] Add the vhost-user netdev backend to command line Antonios Motakis
2014-02-10 8:49 ` Michael S. Tsirkin
2014-02-10 16:43 ` Eric Blake
2014-01-31 17:34 ` [Qemu-devel] [PATCH v7 13/13] Add vhost-user protocol documentation Antonios Motakis
2014-02-10 8:57 ` [Qemu-devel] [PATCH v7 00/13] Vhost and vhost-net support for userspace based backends Michael S. Tsirkin
2014-02-10 16:02 ` Antonios Motakis
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=1391189683-1602-6-git-send-email-a.motakis@virtualopensystems.com \
--to=a.motakis@virtualopensystems.com \
--cc=lukego@gmail.com \
--cc=mst@redhat.com \
--cc=n.nikolaev@virtualopensystems.com \
--cc=qemu-devel@nongnu.org \
--cc=snabb-devel@googlegroups.com \
--cc=tech@virtualopensystems.com \
/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).