virtio: fix false-positive assertion failure on virtqueue_req_add_iovs
We need to decrement the free_cnt before checking if it reached 0. Note: the vq_free_cnt overflow is asserted at the beginning of the function. Change-Id: I655217785e4425d1cd3c704d24321b643be55dcf Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/420584 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
ea55b03940
commit
117fdae94b
@ -548,11 +548,11 @@ virtqueue_req_add_iovs(struct virtqueue *vq, struct iovec *iovs, uint16_t iovcnt
|
||||
|
||||
vq->req_end = prev_head;
|
||||
vq->vq_desc_head_idx = new_head;
|
||||
vq->vq_free_cnt = (uint16_t)(vq->vq_free_cnt - iovcnt);
|
||||
if (vq->vq_desc_head_idx == VQ_RING_DESC_CHAIN_END) {
|
||||
assert(vq->vq_free_cnt == 0);
|
||||
vq->vq_desc_tail_idx = VQ_RING_DESC_CHAIN_END;
|
||||
}
|
||||
vq->vq_free_cnt = (uint16_t)(vq->vq_free_cnt - iovcnt);
|
||||
}
|
||||
|
||||
#define DESC_PER_CACHELINE (RTE_CACHE_LINE_SIZE / sizeof(struct vring_desc))
|
||||
|
Loading…
Reference in New Issue
Block a user