This patch fixes the used ring address calculation, to
avoid Vhost-vDPA backends (such as VDUSE) to fail while
trying to translate it.
Fixes: 666ef294ddf7 ("net/virtio-user: share descriptor IOVA to backend")
Cc: [email protected]
Reported-by: Adrian Moreno <[email protected]>
Signed-off-by: Maxime Coquelin <[email protected]>
---
drivers/net/virtio/virtio_user/virtio_user_dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c
b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 187f81b066..7789f337f6 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -149,7 +149,8 @@ virtio_user_kick_queue(struct virtio_user_dev *dev,
uint32_t queue_sel)
} else {
desc_addr = vring->desc_iova;
avail_addr = desc_addr + vring->num * sizeof(struct vring_desc);
- used_addr =
RTE_ALIGN_CEIL((uintptr_t)(&vring->avail->ring[vring->num]),
+ used_addr = RTE_ALIGN_CEIL(avail_addr + offsetof(struct
vring_avail,
+ ring[vring->num]),
VIRTIO_VRING_ALIGN);
addr.desc_user_addr = desc_addr;
--
2.50.1