diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2012-11-01 09:16:37 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-02 21:29:57 -0400 |
commit | 70e4cb9aafb3caa9e5eb25614a5bc40b0ffa9ffd (patch) | |
tree | f3b88279253e04599ac949e393ee0820ceaa5f57 /drivers | |
parent | 149d36f7187cbd10beff88e4e20f93e51a34827e (diff) | |
download | linux-70e4cb9aafb3caa9e5eb25614a5bc40b0ffa9ffd.tar.gz linux-70e4cb9aafb3caa9e5eb25614a5bc40b0ffa9ffd.tar.bz2 linux-70e4cb9aafb3caa9e5eb25614a5bc40b0ffa9ffd.zip |
vhost-net: cleanup macros for DMA status tracking
Better document macros for DMA tracking. Add an
explicit one for DMA in progress instead of
relying on user supplying len != 1.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/vhost/net.c | 3 | ||||
-rw-r--r-- | drivers/vhost/vhost.c | 2 | ||||
-rw-r--r-- | drivers/vhost/vhost.h | 12 |
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) } else { struct ubuf_info *ubuf = &vq->ubuf_info[head]; - vq->heads[vq->upend_idx].len = len; + vq->heads[vq->upend_idx].len = + VHOST_DMA_IN_PROGRESS; ubuf->callback = vhost_zerocopy_callback; ubuf->ctx = vq->ubufs; 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) struct vhost_virtqueue *vq = ubufs->vq; vhost_poll_queue(&vq->poll); - /* set len = 1 to mark this desc buffers done DMA */ + /* set len to mark this desc buffers done DMA */ vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN; kref_put(&ubufs->kref, vhost_zerocopy_done_signal); } 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 @@ #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 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 struct vhost_device; |