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

Function schedule_destroy_fd_instance

freebsd/net/route/fib_algo.c:735–770  ·  view source on GitHub ↗

* Schedules epoch-backed @fd instance deletion. * * Unlinks @fd from the list of active algo instances. * * Removes rib subscription. * * Stops callout. * * Schedules actual deletion. * * Assume @fd is already unlinked from the datapath. */

Source from the content-addressed store, hash-verified

733 * Assume @fd is already unlinked from the datapath.
734 */
735static int
736schedule_destroy_fd_instance(struct fib_data *fd, bool in_callout)
737{
738 bool is_dead;
739
740 NET_EPOCH_ASSERT();
741 RIB_WLOCK_ASSERT(fd->fd_rh);
742
743 FIB_MOD_LOCK();
744 is_dead = fd->fd_dead;
745 if (!is_dead)
746 fd->fd_dead = true;
747 if (fd->fd_linked) {
748 TAILQ_REMOVE(&V_fib_data_list, fd, entries);
749 fd->fd_linked = false;
750 }
751 FIB_MOD_UNLOCK();
752 if (is_dead)
753 return (0);
754
755 FD_PRINTF(LOG_INFO, fd, "DETACH");
756
757 if (fd->fd_rs != NULL)
758 rib_unsibscribe_locked(fd->fd_rs);
759
760 /*
761 * After rib_unsubscribe() no _new_ handle_rtable_change_cb() calls
762 * will be executed, hence no _new_ callout schedules will happen.
763 */
764 callout_stop(&fd->fd_callout);
765
766 epoch_call(net_epoch_preempt, destroy_fd_instance_epoch,
767 &fd->fd_epoch_ctx);
768
769 return (0);
770}
771
772/*
773 * Wipe all fd instances from the list matching rib specified by @rh.

Callers 3

fib_cleanup_algoFunction · 0.85
setup_fd_instanceFunction · 0.85
rebuild_fdFunction · 0.85

Calls 2

rib_unsibscribe_lockedFunction · 0.85
epoch_callFunction · 0.50

Tested by

no test coverage detected