]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Add set_size_vq for virtio-net
authorAsias He <asias.hejun@gmail.com>
Sat, 7 Apr 2012 12:01:51 +0000 (20:01 +0800)
committerPekka Enberg <penberg@kernel.org>
Mon, 9 Apr 2012 08:34:47 +0000 (11:34 +0300)
set_size_vq does not do the actual work, we can implement this later.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/virtio/net.c

index 11581cef7efee81dd8c7c5d4d91e2f0530812057..35e51aa10e9f8f1feacfef5ecd0eca7f564a93e1 100644 (file)
@@ -340,6 +340,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 pfn)
        queue->pfn      = pfn;
        p               = guest_pfn_to_host(kvm, queue->pfn);
 
+       /* FIXME: respect pci and mmio vring alignment */
        vring_init(&queue->vring, VIRTIO_NET_QUEUE_SIZE, p, VIRTIO_PCI_VRING_ALIGN);
 
        if (ndev->vhost_fd == 0)
@@ -436,18 +437,26 @@ static int get_pfn_vq(struct kvm *kvm, void *dev, u32 vq)
 
 static int get_size_vq(struct kvm *kvm, void *dev, u32 vq)
 {
+       /* FIXME: dynamic */
        return VIRTIO_NET_QUEUE_SIZE;
 }
 
+static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
+{
+       /* FIXME: dynamic */
+       return size;
+}
+
 static struct virtio_ops net_dev_virtio_ops = (struct virtio_ops) {
        .set_config             = set_config,
        .get_config             = get_config,
        .get_host_features      = get_host_features,
        .set_guest_features     = set_guest_features,
        .init_vq                = init_vq,
-       .notify_vq              = notify_vq,
        .get_pfn_vq             = get_pfn_vq,
        .get_size_vq            = get_size_vq,
+       .set_size_vq            = set_size_vq,
+       .notify_vq              = notify_vq,
        .notify_vq_gsi          = notify_vq_gsi,
        .notify_vq_eventfd      = notify_vq_eventfd,
 };