diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2012-11-01 09:16:42 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-02 21:29:57 -0400 |
commit | c4fcb586c337f8b8de3a3d7ba8514eed03695f6e (patch) | |
tree | ba018d4de83d2e4a9898e06e9f813359a56d85fd /drivers/vhost/vhost.c | |
parent | 70e4cb9aafb3caa9e5eb25614a5bc40b0ffa9ffd (diff) |
vhost: track zero copy failures using DMA length
This will be used to disable zerocopy when error rate
is high.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index f23cf8956d1..5affce32503 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -425,7 +425,7 @@ int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq) int j = 0; for (i = vq->done_idx; i != vq->upend_idx; i = (i + 1) % UIO_MAXIOV) { - if ((vq->heads[i].len == VHOST_DMA_DONE_LEN)) { + if (VHOST_DMA_IS_DONE(vq->heads[i].len)) { vq->heads[i].len = VHOST_DMA_CLEAR_LEN; vhost_add_used_and_signal(vq->dev, vq, vq->heads[i].id, 0); @@ -1600,13 +1600,14 @@ void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *ubufs) kfree(ubufs); } -void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool status) +void vhost_zerocopy_callback(struct ubuf_info *ubuf, int status) { struct vhost_ubuf_ref *ubufs = ubuf->ctx; struct vhost_virtqueue *vq = ubufs->vq; vhost_poll_queue(&vq->poll); /* set len to mark this desc buffers done DMA */ - vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN; + vq->heads[ubuf->desc].len = status ? + VHOST_DMA_FAILED_LEN : VHOST_DMA_DONE_LEN; kref_put(&ubufs->kref, vhost_zerocopy_done_signal); } |