]> Pileus Git - ~andy/linux/blobdiff - drivers/vhost/vhost.h
vhost: track zero copy failures using DMA length
[~andy/linux] / drivers / vhost / vhost.h
index 2de4ce2fec4054ee1ee45451aa43ee89b7ec9923..464469d901d5cfcb31c79de6c49e46cc9747fffd 100644 (file)
 #include <linux/virtio_ring.h>
 #include <linux/atomic.h>
 
-/* This is for zerocopy, used buffer len is set to 1 when lower device DMA
- * done */
-#define VHOST_DMA_DONE_LEN     1
+/*
+ * For transmit, used buffer len is unused; we override it to track buffer
+ * status internally; used for zerocopy tx only.
+ */
+/* Lower device DMA failed */
+#define VHOST_DMA_FAILED_LEN   3
+/* Lower device DMA done */
+#define VHOST_DMA_DONE_LEN     2
+/* Lower device DMA in progress */
+#define VHOST_DMA_IN_PROGRESS  1
+/* Buffer unused */
 #define VHOST_DMA_CLEAR_LEN    0
 
+#define VHOST_DMA_IS_DONE(len) ((len) >= VHOST_DMA_DONE_LEN)
+
 struct vhost_device;
 
 struct vhost_work;