{
if (!(dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)))
- goto out;
+ return -1;
if (vq_is_packed(dev)) {
if (vring_translate_packed(dev, vq) < 0)
if (vring_translate_split(dev, vq) < 0)
return -1;
}
-out:
vq->access_ok = 1;
return 0;
return dev;
}
+ vq->access_ok = 1;
return dev;
}
}
vq->log_guest_addr = addr->log_guest_addr;
+ vq->access_ok = 1;
VHOST_LOG_DEBUG(VHOST_CONFIG, "(%d) mapped address desc: %p\n",
dev->vid, vq->desc);
struct virtio_net *dev = *pdev;
struct vhost_virtqueue *vq;
struct vhost_vring_addr *addr = &msg->payload.addr;
+ bool access_ok;
if (dev->mem == NULL)
return RTE_VHOST_MSG_RESULT_ERR;
/* addr->index refers to the queue index. The txq 1, rxq is 0. */
vq = dev->virtqueue[msg->payload.addr.index];
+ access_ok = vq->access_ok;
+
/*
* Rings addresses should not be interpreted as long as the ring is not
* started and enabled
vring_invalidate(dev, vq);
- if (vq->enabled && (dev->features &
- (1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) {
+ if ((vq->enabled && (dev->features &
+ (1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) ||
+ access_ok) {
dev = translate_ring_addresses(dev, msg->payload.addr.index);
if (!dev)
return RTE_VHOST_MSG_RESULT_ERR;
msg->size = sizeof(msg->payload.state);
msg->fd_num = 0;
+ vring_invalidate(dev, vq);
+
return RTE_VHOST_MSG_RESULT_REPLY;
}