aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/vhost/net.c3
-rw-r--r--drivers/vhost/vhost.c2
-rw-r--r--drivers/vhost/vhost.h12
3 files changed, 12 insertions, 5 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 072cbbadbc36..f80ae5fc9b00 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -237,7 +237,8 @@ static void handle_tx(struct vhost_net *net)
237 } else { 237 } else {
238 struct ubuf_info *ubuf = &vq->ubuf_info[head]; 238 struct ubuf_info *ubuf = &vq->ubuf_info[head];
239 239
240 vq->heads[vq->upend_idx].len = len; 240 vq->heads[vq->upend_idx].len =
241 VHOST_DMA_IN_PROGRESS;
241 ubuf->callback = vhost_zerocopy_callback; 242 ubuf->callback = vhost_zerocopy_callback;
242 ubuf->ctx = vq->ubufs; 243 ubuf->ctx = vq->ubufs;
243 ubuf->desc = vq->upend_idx; 244 ubuf->desc = vq->upend_idx;
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 73d08db2e677..f23cf8956d19 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1606,7 +1606,7 @@ void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool status)
1606 struct vhost_virtqueue *vq = ubufs->vq; 1606 struct vhost_virtqueue *vq = ubufs->vq;
1607 1607
1608 vhost_poll_queue(&vq->poll); 1608 vhost_poll_queue(&vq->poll);
1609 /* set len = 1 to mark this desc buffers done DMA */ 1609 /* set len to mark this desc buffers done DMA */
1610 vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN; 1610 vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN;
1611 kref_put(&ubufs->kref, vhost_zerocopy_done_signal); 1611 kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
1612} 1612}
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index 2de4ce2fec40..b6538eef7468 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -13,9 +13,15 @@
13#include <linux/virtio_ring.h> 13#include <linux/virtio_ring.h>
14#include <linux/atomic.h> 14#include <linux/atomic.h>
15 15
16/* This is for zerocopy, used buffer len is set to 1 when lower device DMA 16/*
17 * done */ 17 * For transmit, used buffer len is unused; we override it to track buffer
18#define VHOST_DMA_DONE_LEN 1 18 * status internally; used for zerocopy tx only.
19 */
20/* Lower device DMA done */
21#define VHOST_DMA_DONE_LEN 2
22/* Lower device DMA in progress */
23#define VHOST_DMA_IN_PROGRESS 1
24/* Buffer unused */
19#define VHOST_DMA_CLEAR_LEN 0 25#define VHOST_DMA_CLEAR_LEN 0
20 26
21struct vhost_device; 27struct vhost_device;