Message ID | 20220726072225.19884-18-xuanzhuo@linux.alibaba.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | virtio pci support VIRTIO_F_RING_RESET | expand |
在 2022/7/26 15:22, Xuan Zhuo 写道: > 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> > --- > drivers/virtio/virtio_ring.c | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index 58355e1ac7d7..891900b31c3d 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -1835,6 +1835,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,
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 58355e1ac7d7..891900b31c3d 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -1835,6 +1835,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,
Free the structure struct vring_vritqueue_packed. Subsequent patches require it. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> --- drivers/virtio/virtio_ring.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)