[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220624025621.128843-18-xuanzhuo@linux.alibaba.com>
Date: Fri, 24 Jun 2022 10:55:57 +0800
From: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To: virtualization@...ts.linux-foundation.org
Cc: Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
Johannes Berg <johannes@...solutions.net>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
Vadim Pasternak <vadimp@...dia.com>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Cornelia Huck <cohuck@...hat.com>,
Halil Pasic <pasic@...ux.ibm.com>,
Eric Farman <farman@...ux.ibm.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Vincent Whitchurch <vincent.whitchurch@...s.com>,
linux-um@...ts.infradead.org, netdev@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
linux-remoteproc@...r.kernel.org, linux-s390@...r.kernel.org,
kvm@...r.kernel.org, bpf@...r.kernel.org,
kangjie.xu@...ux.alibaba.com
Subject: [PATCH v10 17/41] virtio_ring: packed: introduce vring_free_packed
Free the structure struct vring_vritqueue_packed.
Subsequent patches require it.
Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
---
drivers/virtio/virtio_ring.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 1ba00e73d601..a72b929f51fb 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -1807,6 +1807,27 @@ 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,
+ struct virtio_device *vdev)
+{
+ if (vring->vring.desc)
+ vring_free_queue(vdev, vring->ring_size_in_bytes,
+ vring->vring.desc, vring->ring_dma_addr);
+
+ if (vring->vring.driver)
+ vring_free_queue(vdev, vring->event_size_in_bytes,
+ vring->vring.driver,
+ vring->driver_event_dma_addr);
+
+ if (vring->vring.device)
+ vring_free_queue(vdev, vring->event_size_in_bytes,
+ vring->vring.device,
+ vring->device_event_dma_addr);
+
+ kfree(vring->desc_state);
+ kfree(vring->desc_extra);
+}
+
static struct virtqueue *vring_create_virtqueue_packed(
unsigned int index,
unsigned int num,
--
2.31.0
Powered by blists - more mailing lists