/* virtqueue_add_consumed_buffer - Returns consumed buffer back to VirtIO queue */
int virtqueue_add_consumed_buffer(struct virtqueue *vq, uint16_t head_idx, uint32_t len)
/* virtqueue_add_consumed_buffer - Returns consumed buffer back to VirtIO queue */
int virtqueue_add_consumed_buffer(struct virtqueue *vq, uint16_t head_idx, uint32_t len)
{
	struct vring_used_elem *used_desc = NULL;
	uint16_t used_idx;
	if (head_idx > vq->vq_nentries) {
		return ERROR_VRING_NO_BUFF;
	}
	VQUEUE_BUSY(vq);
	used_idx = vq->vq_ring.used->idx & (vq->vq_nentries - 1);
	used_desc = &vq->vq_ring.used->ring[used_idx];
	used_desc->id = head_idx;
	used_desc->len = len;
	atomic_thread_fence(memory_order_seq_cst);
	vq->vq_ring.used->idx++;
	VQUEUE_IDLE(vq);
	return VQUEUE_SUCCESS;
}