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

Function destroy_device

dpdk/examples/vhost_blk/vhost_blk.c:692–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

690}
691
692static void
693destroy_device(int vid)
694{
695 char path[PATH_MAX];
696 struct vhost_blk_ctrlr *ctrlr;
697 struct vhost_blk_queue *vq;
698 int i, ret;
699
700 ret = rte_vhost_get_ifname(vid, path, PATH_MAX);
701 if (ret) {
702 fprintf(stderr, "Destroy Ctrlr Failed\n");
703 return;
704 }
705
706 fprintf(stdout, "Destroy %s Device ID %d\n", path, vid);
707 ctrlr = vhost_blk_ctrlr_find(path);
708 if (!ctrlr) {
709 fprintf(stderr, "Destroy Ctrlr Failed\n");
710 return;
711 }
712
713 if (!ctrlr->started)
714 return;
715
716 worker_thread_status = WORKER_STATE_STOP;
717 sem_wait(&exit_sem);
718
719 for (i = 0; i < NUM_OF_BLK_QUEUES; i++) {
720 vq = &ctrlr->queues[i];
721 if (vq->packed_ring) {
722 vq->last_avail_idx |= (vq->avail_wrap_counter <<
723 15);
724 vq->last_used_idx |= (vq->used_wrap_counter <<
725 15);
726 }
727
728 rte_vhost_set_vring_base(ctrlr->vid, i,
729 vq->last_avail_idx,
730 vq->last_used_idx);
731 }
732
733 free_task_pool(ctrlr);
734 free(ctrlr->mem);
735
736 ctrlr->started = 0;
737}
738
739static int
740new_connection(int vid)

Callers 1

signal_handlerFunction · 0.70

Calls 5

rte_vhost_get_ifnameFunction · 0.85
vhost_blk_ctrlr_findFunction · 0.85
rte_vhost_set_vring_baseFunction · 0.85
free_task_poolFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected