]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Support event idx in virtio-net
authorSasha Levin <levinsasha928@gmail.com>
Thu, 17 Nov 2011 13:53:25 +0000 (15:53 +0200)
committerPekka Enberg <penberg@kernel.org>
Fri, 18 Nov 2011 06:43:00 +0000 (08:43 +0200)
Support event idx both when using vhost and when using simple TAP mode.

I did simple TCP stream performance test with vhost, and it showed another 9%
increase over regular vhost mode.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/virtio/net.c

index 58ca4ed2c6d2ddb6975ce7ec4730b21e83f9cc40..118517fcbf0dcf1ec313b2c61d541f141cc95795 100644 (file)
@@ -102,7 +102,9 @@ static void *virtio_net_rx_thread(void *p)
                        virt_queue__set_used_elem(vq, head, len);
 
                        /* We should interrupt guest right now, otherwise latency is huge. */
-                       ndev->vtrans.trans_ops->signal_vq(kvm, &ndev->vtrans, VIRTIO_NET_RX_QUEUE);
+                       if (virtio_queue__should_signal(&ndev->vqs[VIRTIO_NET_RX_QUEUE]))
+                               ndev->vtrans.trans_ops->signal_vq(kvm, &ndev->vtrans,
+                                                               VIRTIO_NET_RX_QUEUE);
                }
 
        }
@@ -140,7 +142,8 @@ static void *virtio_net_tx_thread(void *p)
                        virt_queue__set_used_elem(vq, head, len);
                }
 
-               ndev->vtrans.trans_ops->signal_vq(kvm, &ndev->vtrans, VIRTIO_NET_TX_QUEUE);
+               if (virtio_queue__should_signal(&ndev->vqs[VIRTIO_NET_TX_QUEUE]))
+                       ndev->vtrans.trans_ops->signal_vq(kvm, &ndev->vtrans, VIRTIO_NET_TX_QUEUE);
        }
 
        pthread_exit(NULL);
@@ -314,7 +317,8 @@ static u32 get_host_features(struct kvm *kvm, void *dev)
                | 1UL << VIRTIO_NET_F_HOST_TSO6
                | 1UL << VIRTIO_NET_F_GUEST_UFO
                | 1UL << VIRTIO_NET_F_GUEST_TSO4
-               | 1UL << VIRTIO_NET_F_GUEST_TSO6;
+               | 1UL << VIRTIO_NET_F_GUEST_TSO6
+               | 1UL << VIRTIO_RING_F_EVENT_IDX;
 }
 
 static void set_guest_features(struct kvm *kvm, void *dev, u32 features)
@@ -453,7 +457,7 @@ static struct virtio_ops net_dev_virtio_ops = (struct virtio_ops) {
 
 static void virtio_net__vhost_init(struct kvm *kvm, struct net_dev *ndev)
 {
-       u64 features = 0;
+       u64 features = 1UL << VIRTIO_RING_F_EVENT_IDX;
        struct vhost_memory *mem;
        int r;