struct vhost_vring_state *ring)
{
struct vhost_vdpa *v = dev->opaque;
+ VirtQueue *vq = virtio_get_queue(dev->vdev, ring->index);
+ /*
+ * vhost-vdpa devices does not support in-flight requests. Set all of them
+ * as available.
+ *
+ * TODO: This is ok for networking, but other kinds of devices might
+ * have problems with these retransmissions.
+ */
+ while (virtqueue_rewind(vq, 1)) {
+ continue;
+ }
if (v->shadow_vqs_enabled) {
/*
* Device vring base was set at device start. SVQ base is handled by
struct vhost_vring_state *ring)
{
struct vhost_vdpa *v = dev->opaque;
- int vdpa_idx = ring->index - dev->vq_index;
int ret;
if (v->shadow_vqs_enabled) {
- VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx);
-
- /*
- * Setting base as last used idx, so destination will see as available
- * all the entries that the device did not use, including the in-flight
- * processing ones.
- *
- * TODO: This is ok for networking, but other kinds of devices might
- * have problems with these retransmissions.
- */
- ring->num = svq->last_used_idx;
+ ring->num = virtio_queue_get_last_avail_idx(dev->vdev, ring->index);
return 0;
}