aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost/vhost.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2012-11-01 05:16:46 -0400
committerDavid S. Miller <davem@davemloft.net>2012-11-02 21:29:58 -0400
commitb211616d712551874db3ce0fb44196f6faad2c34 (patch)
tree3945dbbf5d533828e0e31396dfb3ae582ffb7fff /drivers/vhost/vhost.h
parentc4fcb586c337f8b8de3a3d7ba8514eed03695f6e (diff)
vhost: move -net specific code out
Zerocopy handling code is vhost-net specific. Move it from vhost.c/vhost.h out to net.c Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/vhost/vhost.h')
-rw-r--r--drivers/vhost/vhost.h21
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 464469d901d5..5e19e3d5db8c 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -7,27 +7,11 @@
7#include <linux/mutex.h> 7#include <linux/mutex.h>
8#include <linux/poll.h> 8#include <linux/poll.h>
9#include <linux/file.h> 9#include <linux/file.h>
10#include <linux/skbuff.h>
11#include <linux/uio.h> 10#include <linux/uio.h>
12#include <linux/virtio_config.h> 11#include <linux/virtio_config.h>
13#include <linux/virtio_ring.h> 12#include <linux/virtio_ring.h>
14#include <linux/atomic.h> 13#include <linux/atomic.h>
15 14
16/*
17 * For transmit, used buffer len is unused; we override it to track buffer
18 * status internally; used for zerocopy tx only.
19 */
20/* Lower device DMA failed */
21#define VHOST_DMA_FAILED_LEN 3
22/* Lower device DMA done */
23#define VHOST_DMA_DONE_LEN 2
24/* Lower device DMA in progress */
25#define VHOST_DMA_IN_PROGRESS 1
26/* Buffer unused */
27#define VHOST_DMA_CLEAR_LEN 0
28
29#define VHOST_DMA_IS_DONE(len) ((len) >= VHOST_DMA_DONE_LEN)
30
31struct vhost_device; 15struct vhost_device;
32 16
33struct vhost_work; 17struct vhost_work;
@@ -80,6 +64,8 @@ struct vhost_ubuf_ref *vhost_ubuf_alloc(struct vhost_virtqueue *, bool zcopy);
80void vhost_ubuf_put(struct vhost_ubuf_ref *); 64void vhost_ubuf_put(struct vhost_ubuf_ref *);
81void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *); 65void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *);
82 66
67struct ubuf_info;
68
83/* The virtqueue structure describes a queue attached to a device. */ 69/* The virtqueue structure describes a queue attached to a device. */
84struct vhost_virtqueue { 70struct vhost_virtqueue {
85 struct vhost_dev *dev; 71 struct vhost_dev *dev;
@@ -177,6 +163,7 @@ long vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue *vqs, int nvqs);
177long vhost_dev_check_owner(struct vhost_dev *); 163long vhost_dev_check_owner(struct vhost_dev *);
178long vhost_dev_reset_owner(struct vhost_dev *); 164long vhost_dev_reset_owner(struct vhost_dev *);
179void vhost_dev_cleanup(struct vhost_dev *, bool locked); 165void vhost_dev_cleanup(struct vhost_dev *, bool locked);
166void vhost_dev_stop(struct vhost_dev *);
180long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg); 167long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, unsigned long arg);
181int vhost_vq_access_ok(struct vhost_virtqueue *vq); 168int vhost_vq_access_ok(struct vhost_virtqueue *vq);
182int vhost_log_access_ok(struct vhost_dev *); 169int vhost_log_access_ok(struct vhost_dev *);
@@ -201,8 +188,6 @@ bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *);
201 188
202int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, 189int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
203 unsigned int log_num, u64 len); 190 unsigned int log_num, u64 len);
204void vhost_zerocopy_callback(struct ubuf_info *, bool);
205int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq);
206 191
207#define vq_err(vq, fmt, ...) do { \ 192#define vq_err(vq, fmt, ...) do { \
208 pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ 193 pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \