diff options
author | Jason Wang <jasowang@redhat.com> | 2010-09-14 23:53:05 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-10-05 13:33:43 +0200 |
commit | e0e9b406470b8dd75a115cf82c4791f41615c4c3 (patch) | |
tree | d31f3ee226e91854bc97d948a30b80c18b21fa47 /drivers/vhost/vhost.h | |
parent | a00eac0c459abecb539fb2a2abd3122dd7ca5d4a (diff) | |
download | blackbird-op-linux-e0e9b406470b8dd75a115cf82c4791f41615c4c3.tar.gz blackbird-op-linux-e0e9b406470b8dd75a115cf82c4791f41615c4c3.zip |
vhost: max s/g to match qemu
Qemu supports up to UIO_MAXIOV s/g so we have to match that because guest
drivers may rely on this.
Allocate indirect and log arrays dynamically to avoid using too much contigious
memory and make the length of hdr array to match the header length since each
iovec entry has a least one byte.
Test with copying large files w/ and w/o migration in both linux and windows
guests.
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.h')
-rw-r--r-- | drivers/vhost/vhost.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index afd77295971c..edc892989992 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@ -15,11 +15,6 @@ struct vhost_device; -enum { - /* Enough place for all fragments, head, and virtio net header. */ - VHOST_NET_MAX_SG = MAX_SKB_FRAGS + 2, -}; - struct vhost_work; typedef void (*vhost_work_fn_t)(struct vhost_work *work); @@ -93,12 +88,15 @@ struct vhost_virtqueue { bool log_used; u64 log_addr; - struct iovec indirect[VHOST_NET_MAX_SG]; - struct iovec iov[VHOST_NET_MAX_SG]; - struct iovec hdr[VHOST_NET_MAX_SG]; + struct iovec iov[UIO_MAXIOV]; + /* hdr is used to store the virtio header. + * Since each iovec has >= 1 byte length, we never need more than + * header length entries to store the header. */ + struct iovec hdr[sizeof(struct virtio_net_hdr_mrg_rxbuf)]; + struct iovec *indirect; size_t vhost_hlen; size_t sock_hlen; - struct vring_used_elem heads[VHOST_NET_MAX_SG]; + struct vring_used_elem *heads; /* We use a kind of RCU to access private pointer. * All readers access it from worker, which makes it possible to * flush the vhost_work instead of synchronize_rcu. Therefore readers do @@ -109,7 +107,7 @@ struct vhost_virtqueue { void *private_data; /* Log write descriptors */ void __user *log_base; - struct vhost_log log[VHOST_NET_MAX_SG]; + struct vhost_log *log; }; struct vhost_dev { |