aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/vhost.h
diff options
context:
space:
mode:
authorDavid Stevens <dlstevens@us.ibm.com>2010-07-27 11:52:21 -0400
committerMichael S. Tsirkin <mst@redhat.com>2010-07-28 08:45:36 -0400
commit8dd014adfea6f173c1ef6378f7e5e7924866c923 (patch)
tree303df47f73c53cc4c919e3f8aca8245d50d76a08 /drivers/vhost/vhost.h
parent9e3d195720d1c8b1e09013185ab8c3b749180fc2 (diff)
vhost-net: mergeable buffers support
This adds support for mergeable buffers in vhost-net: this is needed for older guests without indirect buffer support, as well as for zero copy with some devices. Includes changes by Michael S. Tsirkin to make the patch as low risk as possible (i.e., close to no changes when feature is disabled). Signed-off-by: David Stevens <dlstevens@us.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.h')
-rw-r--r--drivers/vhost/vhost.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 3693327549b3..afd77295971c 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -96,7 +96,9 @@ struct vhost_virtqueue {
96 struct iovec indirect[VHOST_NET_MAX_SG]; 96 struct iovec indirect[VHOST_NET_MAX_SG];
97 struct iovec iov[VHOST_NET_MAX_SG]; 97 struct iovec iov[VHOST_NET_MAX_SG];
98 struct iovec hdr[VHOST_NET_MAX_SG]; 98 struct iovec hdr[VHOST_NET_MAX_SG];
99 size_t hdr_size; 99 size_t vhost_hlen;
100 size_t sock_hlen;
101 struct vring_used_elem heads[VHOST_NET_MAX_SG];
100 /* We use a kind of RCU to access private pointer. 102 /* We use a kind of RCU to access private pointer.
101 * All readers access it from worker, which makes it possible to 103 * All readers access it from worker, which makes it possible to
102 * flush the vhost_work instead of synchronize_rcu. Therefore readers do 104 * flush the vhost_work instead of synchronize_rcu. Therefore readers do
@@ -139,12 +141,16 @@ int vhost_get_vq_desc(struct vhost_dev *, struct vhost_virtqueue *,
139 struct iovec iov[], unsigned int iov_count, 141 struct iovec iov[], unsigned int iov_count,
140 unsigned int *out_num, unsigned int *in_num, 142 unsigned int *out_num, unsigned int *in_num,
141 struct vhost_log *log, unsigned int *log_num); 143 struct vhost_log *log, unsigned int *log_num);
142void vhost_discard_vq_desc(struct vhost_virtqueue *); 144void vhost_discard_vq_desc(struct vhost_virtqueue *, int n);
143 145
144int vhost_add_used(struct vhost_virtqueue *, unsigned int head, int len); 146int vhost_add_used(struct vhost_virtqueue *, unsigned int head, int len);
145void vhost_signal(struct vhost_dev *, struct vhost_virtqueue *); 147int vhost_add_used_n(struct vhost_virtqueue *, struct vring_used_elem *heads,
148 unsigned count);
146void vhost_add_used_and_signal(struct vhost_dev *, struct vhost_virtqueue *, 149void vhost_add_used_and_signal(struct vhost_dev *, struct vhost_virtqueue *,
147 unsigned int head, int len); 150 unsigned int id, int len);
151void vhost_add_used_and_signal_n(struct vhost_dev *, struct vhost_virtqueue *,
152 struct vring_used_elem *heads, unsigned count);
153void vhost_signal(struct vhost_dev *, struct vhost_virtqueue *);
148void vhost_disable_notify(struct vhost_virtqueue *); 154void vhost_disable_notify(struct vhost_virtqueue *);
149bool vhost_enable_notify(struct vhost_virtqueue *); 155bool vhost_enable_notify(struct vhost_virtqueue *);
150 156
@@ -161,7 +167,8 @@ enum {
161 VHOST_FEATURES = (1 << VIRTIO_F_NOTIFY_ON_EMPTY) | 167 VHOST_FEATURES = (1 << VIRTIO_F_NOTIFY_ON_EMPTY) |
162 (1 << VIRTIO_RING_F_INDIRECT_DESC) | 168 (1 << VIRTIO_RING_F_INDIRECT_DESC) |
163 (1 << VHOST_F_LOG_ALL) | 169 (1 << VHOST_F_LOG_ALL) |
164 (1 << VHOST_NET_F_VIRTIO_NET_HDR), 170 (1 << VHOST_NET_F_VIRTIO_NET_HDR) |
171 (1 << VIRTIO_NET_F_MRG_RXBUF),
165}; 172};
166 173
167static inline int vhost_has_feature(struct vhost_dev *dev, int bit) 174static inline int vhost_has_feature(struct vhost_dev *dev, int bit)