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: 157969b60e ("bdev_virtio: added virtio_scsi_io_ctx")

Change-Id: I215d437c52f7060bf631bd193e7e59e2a4710368
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/378116
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-09-12 17:54:50 +02:00 committed by Jim Harris
parent dec982245e
commit 3459b5a966

View File

@ -136,13 +136,14 @@ virtqueue_enqueue_xmit(struct virtqueue *vq, struct virtio_req *req)
struct vring_desc *descs; struct vring_desc *descs;
uint32_t i; uint32_t i;
uint16_t head_idx, idx; uint16_t head_idx, idx;
uint32_t total_iovs = req->iovcnt + 2;
struct iovec *iov = req->iov; struct iovec *iov = req->iov;
head_idx = vq->vq_desc_head_idx; head_idx = vq->vq_desc_head_idx;
idx = head_idx; idx = head_idx;
dxp = &vq->vq_descx[idx]; dxp = &vq->vq_descx[idx];
dxp->cookie = (void *)req; dxp->cookie = (void *)req;
dxp->ndescs = req->iovcnt; dxp->ndescs = total_iovs;
descs = vq->vq_ring.desc; 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; vq->vq_desc_head_idx = idx;
if (vq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END) if (vq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END)
vq->vq_desc_tail_idx = idx; 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); vq_update_avail_ring(vq, head_idx);
} }