* 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. */
| 733 | * Assume @fd is already unlinked from the datapath. |
| 734 | */ |
| 735 | static int |
| 736 | schedule_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. |
no test coverage detected