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

Function vduse_vring_cleanup

dpdk/lib/vhost/vduse.c:242–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242static void
243vduse_vring_cleanup(struct virtio_net *dev, unsigned int index)
244{
245 struct vhost_virtqueue *vq = dev->virtqueue[index];
246 struct vduse_vq_eventfd vq_efd;
247 int ret;
248
249 if (vq == dev->cvq && vq->kickfd >= 0) {
250 fdset_del(&vduse.fdset, vq->kickfd);
251 fdset_pipe_notify(&vduse.fdset);
252 }
253
254 vq_efd.index = index;
255 vq_efd.fd = VDUSE_EVENTFD_DEASSIGN;
256
257 ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
258 if (ret)
259 VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to cleanup kickfd for VQ %u: %s\n",
260 index, strerror(errno));
261
262 close(vq->kickfd);
263 vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
264
265 rte_rwlock_write_lock(&vq->access_lock);
266 vring_invalidate(dev, vq);
267 rte_rwlock_write_unlock(&vq->access_lock);
268
269 rte_free(vq->batch_copy_elems);
270 vq->batch_copy_elems = NULL;
271
272 rte_free(vq->shadow_used_split);
273 vq->shadow_used_split = NULL;
274
275 vq->enabled = false;
276 vq->ready = false;
277 vq->size = 0;
278 vq->last_used_idx = 0;
279 vq->last_avail_idx = 0;
280}
281
282static void
283vduse_device_start(struct virtio_net *dev)

Callers 1

vduse_device_stopFunction · 0.85

Calls 6

fdset_delFunction · 0.85
fdset_pipe_notifyFunction · 0.85
vring_invalidateFunction · 0.85
rte_freeFunction · 0.85
ioctlFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected