From 3459b5a966c9f4bd0ab5576f582e3b9c6e86d22b Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Tue, 12 Sep 2017 17:54:50 +0200 Subject: [PATCH] rte_virtio: set proper desc count on request enqueue This was broken by commit 157969b60e. However, this change doesn't fix any errors. Neither vq->vq_free_cnt nor dxp->ndescs are used at the moment, but this will change with future patches. Fixes: 157969b60e3a ("bdev_virtio: added virtio_scsi_io_ctx") Change-Id: I215d437c52f7060bf631bd193e7e59e2a4710368 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/378116 Tested-by: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- lib/bdev/virtio/rte_virtio/virtio_rxtx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/bdev/virtio/rte_virtio/virtio_rxtx.c b/lib/bdev/virtio/rte_virtio/virtio_rxtx.c index d6d6b955f..e0b81fdf2 100644 --- a/lib/bdev/virtio/rte_virtio/virtio_rxtx.c +++ b/lib/bdev/virtio/rte_virtio/virtio_rxtx.c @@ -136,13 +136,14 @@ virtqueue_enqueue_xmit(struct virtqueue *vq, struct virtio_req *req) struct vring_desc *descs; uint32_t i; uint16_t head_idx, idx; + uint32_t total_iovs = req->iovcnt + 2; struct iovec *iov = req->iov; head_idx = vq->vq_desc_head_idx; idx = head_idx; dxp = &vq->vq_descx[idx]; dxp->cookie = (void *)req; - dxp->ndescs = req->iovcnt; + dxp->ndescs = total_iovs; descs = vq->vq_ring.desc; @@ -176,7 +177,7 @@ virtqueue_enqueue_xmit(struct virtqueue *vq, struct virtio_req *req) vq->vq_desc_head_idx = idx; if (vq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END) vq->vq_desc_tail_idx = idx; - vq->vq_free_cnt = (uint16_t)(vq->vq_free_cnt - req->iovcnt); + vq->vq_free_cnt = (uint16_t)(vq->vq_free_cnt - total_iovs); vq_update_avail_ring(vq, head_idx); }