summary refs log tree commit diff stats
path: root/hw/vhost_net.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2011-06-12 16:21:57 +0300
committerMichael S. Tsirkin <mst@redhat.com>2011-06-12 16:36:53 +0300
commitbcbabae8ff7f7ec114da9fe2aa7f25f420f35306 (patch)
tree568175283599e2c4c696b015a8234b1b6c91c9d6 /hw/vhost_net.c
parent01731cfb39ae234a8df852f56fc21efd155dbc26 (diff)
downloadfocaccia-qemu-bcbabae8ff7f7ec114da9fe2aa7f25f420f35306.tar.gz
focaccia-qemu-bcbabae8ff7f7ec114da9fe2aa7f25f420f35306.zip
virtio: event index support
Add support for event_idx feature, and utilize it to
reduce the number of interrupts and exits for the guest.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/vhost_net.c')
-rw-r--r--hw/vhost_net.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index 420e05f112..e8c9e940d9 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -50,6 +50,9 @@ unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
     if (!(net->dev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC))) {
         features &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
     }
+    if (!(net->dev.features & (1 << VIRTIO_RING_F_EVENT_IDX))) {
+        features &= ~(1 << VIRTIO_RING_F_EVENT_IDX);
+    }
     if (!(net->dev.features & (1 << VIRTIO_NET_F_MRG_RXBUF))) {
         features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF);
     }
@@ -65,6 +68,9 @@ void vhost_net_ack_features(struct vhost_net *net, unsigned features)
     if (features & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
         net->dev.acked_features |= (1 << VIRTIO_RING_F_INDIRECT_DESC);
     }
+    if (features & (1 << VIRTIO_RING_F_EVENT_IDX)) {
+        net->dev.acked_features |= (1 << VIRTIO_RING_F_EVENT_IDX);
+    }
     if (features & (1 << VIRTIO_NET_F_MRG_RXBUF)) {
         net->dev.acked_features |= (1 << VIRTIO_NET_F_MRG_RXBUF);
     }