Commit 8b94174a authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Jim Harris
Browse files

virtio: fix full-virtqueue handling



Distinguish between "not enough descriptors available"
and "iovcnt > queue depth".

This patch brings back I/O re-queueing for virtio bdev
module. It was temporarily disabled by 451de7e1 [1].

[1] 451de7e1: "virtio: switch to the new virtqueue API"

Change-Id: I4c4f6a6d9d91373ee647ea7cafd53ad999aa6aa2
Signed-off-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/393447


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 48245f4b
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -209,9 +209,10 @@ uint16_t virtio_recv_pkts(struct virtqueue *vq, void **io, uint32_t *len, uint16
 * is sent, processed and a response is received, the same object will be
 * returned to the user calling the virtio poll API.
 * \param iovcnt number of required iovectors for the request. This can be
 * higher than than the actual number of descriptors to be added.
 * \return 0 on success or negative errno otherwise. If not enough iovectors
 * are available, -ENOSPC is returned.
 * higher than than the actual number of iovectors to be added.
 * \return 0 on success or negative errno otherwise. If the `iovcnt` is
 * greater than virtqueue depth, -EINVAL is returned. If simply not enough
 * iovectors are available, -ENOMEM is returned.
 */
int virtqueue_req_start(struct virtqueue *vq, void *cookie, int iovcnt);

+1 −1
Original line number Diff line number Diff line
@@ -448,7 +448,7 @@ virtqueue_req_start(struct virtqueue *vq, void *cookie, int iovcnt)
	assert(virtio_dev_get_status(vq->vdev) & VIRTIO_CONFIG_S_DRIVER_OK);

	if (iovcnt > vq->vq_free_cnt) {
		return -ENOSPC;
		return iovcnt > vq->vq_nentries ? -EINVAL : -ENOMEM;
	}

	if (vq->req_start != VQ_RING_DESC_CHAIN_END) {