MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vhost_backend_cleanup

Function vhost_backend_cleanup

dpdk/lib/vhost/vhost_user.c:190–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void
191vhost_backend_cleanup(struct virtio_net *dev)
192{
193 struct rte_vdpa_device *vdpa_dev;
194
195 vdpa_dev = dev->vdpa_dev;
196 if (vdpa_dev && vdpa_dev->ops->dev_cleanup != NULL)
197 vdpa_dev->ops->dev_cleanup(dev->vid);
198
199 if (dev->mem) {
200 free_mem_region(dev);
201 rte_free(dev->mem);
202 dev->mem = NULL;
203 }
204
205 rte_free(dev->guest_pages);
206 dev->guest_pages = NULL;
207
208 if (dev->log_addr) {
209 munmap((void *)(uintptr_t)dev->log_addr, dev->log_size);
210 dev->log_addr = 0;
211 }
212
213 if (dev->inflight_info) {
214 if (dev->inflight_info->addr) {
215 munmap(dev->inflight_info->addr,
216 dev->inflight_info->size);
217 dev->inflight_info->addr = NULL;
218 }
219
220 if (dev->inflight_info->fd >= 0) {
221 close(dev->inflight_info->fd);
222 dev->inflight_info->fd = -1;
223 }
224
225 rte_free(dev->inflight_info);
226 dev->inflight_info = NULL;
227 }
228
229 if (dev->backend_req_fd >= 0) {
230 close(dev->backend_req_fd);
231 dev->backend_req_fd = -1;
232 }
233
234 if (dev->postcopy_ufd >= 0) {
235 close(dev->postcopy_ufd);
236 dev->postcopy_ufd = -1;
237 }
238
239 dev->postcopy_listening = 0;
240
241 vhost_user_iotlb_destroy(dev);
242}
243
244static void
245vhost_user_notify_queue_state(struct virtio_net *dev, struct vhost_virtqueue *vq,

Callers 1

cleanup_deviceFunction · 0.85

Calls 4

free_mem_regionFunction · 0.85
rte_freeFunction · 0.85
vhost_user_iotlb_destroyFunction · 0.85
closeFunction · 0.50

Tested by

no test coverage detected