aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/vhost.h
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2010-09-14 11:53:05 -0400
committerMichael S. Tsirkin <mst@redhat.com>2010-10-05 07:33:43 -0400
commite0e9b406470b8dd75a115cf82c4791f41615c4c3 (patch)
treed31f3ee226e91854bc97d948a30b80c18b21fa47 /drivers/vhost/vhost.h
parenta00eac0c459abecb539fb2a2abd3122dd7ca5d4a (diff)
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.h18
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 @@
15 15
16struct vhost_device; 16struct vhost_device;
17 17
18enum {
19 /* Enough place for all fragments, head, and virtio net header. */
20 VHOST_NET_MAX_SG = MAX_SKB_FRAGS + 2,
21};
22
23struct vhost_work; 18struct vhost_work;
24typedef void (*vhost_work_fn_t)(struct vhost_work *work); 19typedef void (*vhost_work_fn_t)(struct vhost_work *work);
25 20
@@ -93,12 +88,15 @@ struct vhost_virtqueue {
93 bool log_used; 88 bool log_used;
94 u64 log_addr; 89 u64 log_addr;
95 90
96 struct iovec indirect[VHOST_NET_MAX_SG]; 91 struct iovec iov[UIO_MAXIOV];
97 struct iovec iov[VHOST_NET_MAX_SG]; 92 /* hdr is used to store the virtio header.
98 struct iovec hdr[VHOST_NET_MAX_SG]; 93 * Since each iovec has >= 1 byte length, we never need more than
94 * header length entries to store the header. */
95 struct iovec hdr[sizeof(struct virtio_net_hdr_mrg_rxbuf)];
96 struct iovec *indirect;
99 size_t vhost_hlen; 97 size_t vhost_hlen;
100 size_t sock_hlen; 98 size_t sock_hlen;
101 struct vring_used_elem heads[VHOST_NET_MAX_SG]; 99 struct vring_used_elem *heads;
102 /* We use a kind of RCU to access private pointer. 100 /* We use a kind of RCU to access private pointer.
103 * All readers access it from worker, which makes it possible to 101 * All readers access it from worker, which makes it possible to
104 * flush the vhost_work instead of synchronize_rcu. Therefore readers do 102 * flush the vhost_work instead of synchronize_rcu. Therefore readers do
@@ -109,7 +107,7 @@ struct vhost_virtqueue {
109 void *private_data; 107 void *private_data;
110 /* Log write descriptors */ 108 /* Log write descriptors */
111 void __user *log_base; 109 void __user *log_base;
112 struct vhost_log log[VHOST_NET_MAX_SG]; 110 struct vhost_log *log;
113}; 111};
114 112
115struct vhost_dev { 113struct vhost_dev {