aboutsummaryrefslogtreecommitdiff
path: root/hw/vhost_net.c
diff options
context:
space:
mode:
authormst@redhat.com <mst@redhat.com>2011-02-01 22:13:42 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-02-01 16:50:44 -0600
commit5430a28fe452907c9e1b2097e073bc1ea4b29f39 (patch)
tree066db9fdbac5a5ddca922b5d282161e9b6141b0e /hw/vhost_net.c
parentf157ed202e51dc2492b201dc34ed28e89c973fb7 (diff)
vhost: force vhost off for non-MSI guests
When MSI is off, each interrupt needs to be bounced through the io thread when it's set/cleared, so vhost-net causes more context switches and higher CPU utilization than userspace virtio which handles networking in the same thread. We'll need to fix this by adding level irq support in kvm irqfd, for now disable vhost-net in these configurations. Added a vhostforce flag to force vhost-net back on. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/vhost_net.c')
-rw-r--r--hw/vhost_net.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index c068be1f54..420e05f112 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -81,7 +81,8 @@ static int vhost_net_get_fd(VLANClientState *backend)
}
}
-struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
+struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd,
+ bool force)
{
int r;
struct vhost_net *net = qemu_malloc(sizeof *net);
@@ -98,7 +99,7 @@ struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
(1 << VHOST_NET_F_VIRTIO_NET_HDR);
net->backend = r;
- r = vhost_dev_init(&net->dev, devfd);
+ r = vhost_dev_init(&net->dev, devfd, force);
if (r < 0) {
goto fail;
}
@@ -121,6 +122,11 @@ fail:
return NULL;
}
+bool vhost_net_query(VHostNetState *net, VirtIODevice *dev)
+{
+ return vhost_dev_query(&net->dev, dev);
+}
+
int vhost_net_start(struct vhost_net *net,
VirtIODevice *dev)
{
@@ -188,15 +194,21 @@ void vhost_net_cleanup(struct vhost_net *net)
qemu_free(net);
}
#else
-struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
+struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd,
+ bool force)
+{
+ return NULL;
+}
+
+bool vhost_net_query(VHostNetState *net, VirtIODevice *dev)
{
- return NULL;
+ return false;
}
int vhost_net_start(struct vhost_net *net,
VirtIODevice *dev)
{
- return -ENOSYS;
+ return -ENOSYS;
}
void vhost_net_stop(struct vhost_net *net,
VirtIODevice *dev)
@@ -209,7 +221,7 @@ void vhost_net_cleanup(struct vhost_net *net)
unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
{
- return features;
+ return features;
}
void vhost_net_ack_features(struct vhost_net *net, unsigned features)
{