diff options
author | Xuan Zhuo <xuanzhuo@linux.alibaba.com> | 2022-08-01 09:38:37 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-08-11 11:06:39 +0300 |
commit | 6356f8bb01ddf4a6d9f2da16f7c0e3c093c7f548 (patch) | |
tree | c4b688807dbac3b9e45cf0a366302a3c91389eea /drivers/virtio | |
parent | 6fea20e5611fc5c8264f04a878a98c06b6209eed (diff) | |
download | linux-6356f8bb01ddf4a6d9f2da16f7c0e3c093c7f548.tar.xz |
virtio_ring: packed: introduce vring_free_packed
Free the structure struct vring_vritqueue_packed.
Subsequent patches require it.
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-18-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio_ring.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1852912d711e..2993d817871a 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -1832,6 +1832,28 @@ static struct vring_desc_extra *vring_alloc_desc_extra(unsigned int num) return desc_extra; } +static void vring_free_packed(struct vring_virtqueue_packed *vring_packed, + struct virtio_device *vdev) +{ + if (vring_packed->vring.desc) + vring_free_queue(vdev, vring_packed->ring_size_in_bytes, + vring_packed->vring.desc, + vring_packed->ring_dma_addr); + + if (vring_packed->vring.driver) + vring_free_queue(vdev, vring_packed->event_size_in_bytes, + vring_packed->vring.driver, + vring_packed->driver_event_dma_addr); + + if (vring_packed->vring.device) + vring_free_queue(vdev, vring_packed->event_size_in_bytes, + vring_packed->vring.device, + vring_packed->device_event_dma_addr); + + kfree(vring_packed->desc_state); + kfree(vring_packed->desc_extra); +} + static struct virtqueue *vring_create_virtqueue_packed( unsigned int index, unsigned int num, |