Stores desc IOVA in the queue's vring data structure, as preliminary work to provide a way for Virtio-user to share desc IOVA to the vhost backend.
Signed-off-by: Srujana Challa <scha...@marvell.com> --- drivers/net/virtio/virtio_ring.h | 12 ++++++++---- drivers/net/virtio/virtqueue.c | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/virtio/virtio_ring.h b/drivers/net/virtio/virtio_ring.h index e848c0b73b..998605dbb5 100644 --- a/drivers/net/virtio/virtio_ring.h +++ b/drivers/net/virtio/virtio_ring.h @@ -83,6 +83,7 @@ struct vring_packed_desc_event { struct vring_packed { unsigned int num; + rte_iova_t desc_iova; struct vring_packed_desc *desc; struct vring_packed_desc_event *driver; struct vring_packed_desc_event *device; @@ -90,6 +91,7 @@ struct vring_packed { struct vring { unsigned int num; + rte_iova_t desc_iova; struct vring_desc *desc; struct vring_avail *avail; struct vring_used *used; @@ -149,11 +151,12 @@ vring_size(struct virtio_hw *hw, unsigned int num, unsigned long align) return size; } static inline void -vring_init_split(struct vring *vr, uint8_t *p, unsigned long align, - unsigned int num) +vring_init_split(struct vring *vr, uint8_t *p, rte_iova_t iova, + unsigned long align, unsigned int num) { vr->num = num; vr->desc = (struct vring_desc *) p; + vr->desc_iova = iova; vr->avail = (struct vring_avail *) (p + num * sizeof(struct vring_desc)); vr->used = (void *) @@ -161,11 +164,12 @@ vring_init_split(struct vring *vr, uint8_t *p, unsigned long align, } static inline void -vring_init_packed(struct vring_packed *vr, uint8_t *p, unsigned long align, - unsigned int num) +vring_init_packed(struct vring_packed *vr, uint8_t *p, rte_iova_t iova, + unsigned long align, unsigned int num) { vr->num = num; vr->desc = (struct vring_packed_desc *)p; + vr->desc_iova = iova; vr->driver = (struct vring_packed_desc_event *)(p + vr->num * sizeof(struct vring_packed_desc)); vr->device = (struct vring_packed_desc_event *) diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c index 6f419665f1..cf46abfd06 100644 --- a/drivers/net/virtio/virtqueue.c +++ b/drivers/net/virtio/virtqueue.c @@ -282,13 +282,13 @@ virtio_init_vring(struct virtqueue *vq) vq->vq_free_cnt = vq->vq_nentries; memset(vq->vq_descx, 0, sizeof(struct vq_desc_extra) * vq->vq_nentries); if (virtio_with_packed_queue(vq->hw)) { - vring_init_packed(&vq->vq_packed.ring, ring_mem, + vring_init_packed(&vq->vq_packed.ring, ring_mem, vq->vq_ring_mem, VIRTIO_VRING_ALIGN, size); vring_desc_init_packed(vq, size); } else { struct vring *vr = &vq->vq_split.ring; - vring_init_split(vr, ring_mem, VIRTIO_VRING_ALIGN, size); + vring_init_split(vr, ring_mem, vq->vq_ring_mem, VIRTIO_VRING_ALIGN, size); vring_desc_init_split(vr->desc, size); } /* -- 2.25.1