Lines Matching full:fd

79  * fd - fib data - instance of an flm bound to specific routing table
194 static bool rebuild_fd(struct fib_data *fd, const char *reason);
195 static bool rebuild_fd_flm(struct fib_data *fd, struct fib_lookup_module *flm_new);
198 static bool is_idx_free(struct fib_data *fd, uint32_t index);
202 static uint32_t fib_ref_nhop(struct fib_data *fd, struct nhop_object *nh);
203 static void fib_unref_nhop(struct fib_data *fd, struct nhop_object *nh);
414 fib_printf(int level, struct fib_data *fd, const char *func, char *fmt, ...) in fib_printf() argument
426 _ALGO_PRINTF(fd->fd_fibnum, fd->fd_family, fd->fd_flm->flm_name, in fib_printf()
427 fd->fd_gen, func, "%s", buf); in fib_printf()
485 callout_calc_delay_ms(struct fib_data *fd) in callout_calc_delay_ms() argument
489 if (fd->fd_failed_rebuilds > 10) in callout_calc_delay_ms()
492 shift = fd->fd_failed_rebuilds; in callout_calc_delay_ms()
498 schedule_callout(struct fib_data *fd, enum fib_callout_action action, int delay_ms) in schedule_callout() argument
501 FD_PRINTF(LOG_DEBUG, fd, "delay=%d action=%d", delay_ms, action); in schedule_callout()
502 fd->fd_callout_action = action; in schedule_callout()
503 callout_reset_sbt(&fd->fd_callout, SBT_1MS * delay_ms, 0, in schedule_callout()
504 handle_fd_callout, fd, 0); in schedule_callout()
508 schedule_fd_rebuild(struct fib_data *fd, const char *reason) in schedule_fd_rebuild() argument
511 RIB_WLOCK_ASSERT(fd->fd_rh); in schedule_fd_rebuild()
513 if (!fd->fd_need_rebuild) { in schedule_fd_rebuild()
514 fd->fd_need_rebuild = true; in schedule_fd_rebuild()
516 fd->fd_batch = false; in schedule_fd_rebuild()
522 FD_PRINTF(LOG_INFO, fd, "Scheduling rebuild: %s (failures=%d)", in schedule_fd_rebuild()
523 reason, fd->fd_failed_rebuilds); in schedule_fd_rebuild()
524 schedule_callout(fd, FDA_REBUILD, callout_calc_delay_ms(fd)); in schedule_fd_rebuild()
529 sync_rib_gen(struct fib_data *fd) in sync_rib_gen() argument
531 FD_PRINTF(LOG_DEBUG, fd, "Sync gen %u -> %u", fd->fd_rh->rnh_gen, fd->fd_rh->rnh_gen_rib); in sync_rib_gen()
532 fd->fd_rh->rnh_gen = fd->fd_rh->rnh_gen_rib; in sync_rib_gen()
563 mark_diverge_time(struct fib_data *fd) in mark_diverge_time() argument
565 struct fib_sync_status *fd_ss = &fd->fd_ss; in mark_diverge_time()
584 update_rebuild_delay(struct fib_data *fd, enum fib_callout_action action) in update_rebuild_delay() argument
601 struct fib_sync_status *fd_ss = &fd->fd_ss; in update_rebuild_delay()
610 FD_PRINTF(LOG_DEBUG, fd, in update_rebuild_delay()
616 FD_PRINTF(LOG_DEBUG, fd, in update_rebuild_delay()
632 schedule_callout(fd, action, delay_ms); in update_rebuild_delay()
637 update_algo_state(struct fib_data *fd) in update_algo_state() argument
640 RIB_WLOCK_ASSERT(fd->fd_rh); in update_algo_state()
642 if (fd->fd_batch || fd->fd_need_rebuild) { in update_algo_state()
643 enum fib_callout_action action = fd->fd_need_rebuild ? FDA_REBUILD : FDA_BATCH; in update_algo_state()
644 update_rebuild_delay(fd, action); in update_algo_state()
648 if (fd->fd_num_changes++ == 0) { in update_algo_state()
650 if (!callout_pending(&fd->fd_callout)) in update_algo_state()
651 schedule_callout(fd, FDA_EVAL, ALGO_EVAL_DELAY_MS); in update_algo_state()
652 } else if (fd->fd_num_changes == ALGO_EVAL_NUM_ROUTES) { in update_algo_state()
654 if (fd->fd_callout_action == FDA_EVAL) in update_algo_state()
655 schedule_callout(fd, FDA_EVAL, 1); in update_algo_state()
660 need_immediate_sync(struct fib_data *fd, struct rib_cmd_info *rc) in need_immediate_sync() argument
690 apply_rtable_changes(struct fib_data *fd) in apply_rtable_changes() argument
693 struct fib_change_queue *q = &fd->fd_ss.fd_change_queue; in apply_rtable_changes()
695 result = fd->fd_flm->flm_change_rib_items_cb(fd->fd_rh, q, fd->fd_algo_data); in apply_rtable_changes()
698 sync_rib_gen(fd); in apply_rtable_changes()
701 fib_unref_nhop(fd, q->entries[i].nh_old); in apply_rtable_changes()
704 fd->fd_batch = false; in apply_rtable_changes()
710 fill_change_entry(struct fib_data *fd, struct fib_change_entry *ce, struct rib_cmd_info *rc) in fill_change_entry() argument
714 switch (fd->fd_family) { in fill_change_entry()
731 if (fib_ref_nhop(fd, ce->nh_new) == 0) in fill_change_entry()
739 queue_rtable_change(struct fib_data *fd, struct rib_cmd_info *rc) in queue_rtable_change() argument
741 struct fib_change_queue *q = &fd->fd_ss.fd_change_queue; in queue_rtable_change()
754 FD_PRINTF(LOG_INFO, fd, "Unable to realloc queue for %u elements", in queue_rtable_change()
762 return (fill_change_entry(fd, &q->entries[q->count++], rc)); in queue_rtable_change()
774 struct fib_data *fd = (struct fib_data *)_data; in handle_rtable_change_cb() local
784 if (!fd->init_done) in handle_rtable_change_cb()
787 bool immediate_sync = need_immediate_sync(fd, rc); in handle_rtable_change_cb()
790 update_algo_state(fd); in handle_rtable_change_cb()
796 if (fd->fd_need_rebuild) { in handle_rtable_change_cb()
798 rebuild_fd(fd, "rtable change type enforced sync"); in handle_rtable_change_cb()
806 if (fd->fd_batch) { in handle_rtable_change_cb()
808 if (!queue_rtable_change(fd, rc) || !apply_rtable_changes(fd)) in handle_rtable_change_cb()
809 rebuild_fd(fd, "batch sync failed"); in handle_rtable_change_cb()
811 if (!queue_rtable_change(fd, rc)) in handle_rtable_change_cb()
812 schedule_fd_rebuild(fd, "batch queue failed"); in handle_rtable_change_cb()
823 if (fib_ref_nhop(fd, rc->rc_nh_new) == 0) { in handle_rtable_change_cb()
825 schedule_fd_rebuild(fd, "ran out of nhop indexes"); in handle_rtable_change_cb()
830 result = fd->fd_flm->flm_change_rib_item_cb(rnh, rc, fd->fd_algo_data); in handle_rtable_change_cb()
834 sync_rib_gen(fd); in handle_rtable_change_cb()
837 fib_unref_nhop(fd, rc->rc_nh_old); in handle_rtable_change_cb()
844 if (queue_rtable_change(fd, rc)) { in handle_rtable_change_cb()
846 fd->fd_batch = true; in handle_rtable_change_cb()
847 mark_diverge_time(fd); in handle_rtable_change_cb()
848 update_rebuild_delay(fd, FDA_BATCH); in handle_rtable_change_cb()
851 if (apply_rtable_changes(fd)) in handle_rtable_change_cb()
854 FD_PRINTF(LOG_ERR, fd, "batched sync failed, force the rebuild"); in handle_rtable_change_cb()
863 mark_diverge_time(fd); in handle_rtable_change_cb()
864 schedule_fd_rebuild(fd, "algo requested rebuild"); in handle_rtable_change_cb()
868 FD_PRINTF(LOG_INFO, fd, "running sync rebuild"); in handle_rtable_change_cb()
869 rebuild_fd(fd, "rtable change type enforced sync"); in handle_rtable_change_cb()
878 FD_PRINTF(LOG_ERR, fd, "algo reported non-recoverable error"); in handle_rtable_change_cb()
879 if (!flm_error_add(fd->fd_flm, fd->fd_fibnum)) in handle_rtable_change_cb()
880 FD_PRINTF(LOG_ERR, fd, "failed to ban algo"); in handle_rtable_change_cb()
881 schedule_fd_rebuild(fd, "algo reported non-recoverable error"); in handle_rtable_change_cb()
886 estimate_nhop_scale(const struct fib_data *old_fd, struct fib_data *fd) in estimate_nhop_scale() argument
891 fd->number_nhops = 16; in estimate_nhop_scale()
896 fd->number_nhops = 2 * old_fd->number_nhops; in estimate_nhop_scale()
898 fd->number_nhops = old_fd->number_nhops; in estimate_nhop_scale()
902 struct fib_data *fd; member
918 struct fib_data *fd = w->fd; in sync_algo_end_cb() local
920 RIB_WLOCK_ASSERT(w->fd->fd_rh); in sync_algo_end_cb()
927 if (fd->hit_nhops) { in sync_algo_end_cb()
928 FD_PRINTF(LOG_INFO, fd, "ran out of nexthops at %u nhops", in sync_algo_end_cb()
929 fd->nh_ref_table->count); in sync_algo_end_cb()
939 w->result = fd->fd_flm->flm_dump_end_cb(fd->fd_algo_data, &fd->fd_dp); in sync_algo_end_cb()
943 fd->init_done = 1; in sync_algo_end_cb()
957 RIB_WLOCK_ASSERT(w->fd->fd_rh); in sync_algo_cb()
967 if (fib_ref_nhop(w->fd, nh) != 0) in sync_algo_cb()
968 w->result = w->func(rt, w->fd->fd_algo_data); in sync_algo_cb()
980 sync_algo(struct fib_data *fd) in sync_algo() argument
983 .fd = fd, in sync_algo()
984 .func = fd->fd_flm->flm_dump_rib_item_cb, in sync_algo()
988 rib_walk_ext_locked(fd->fd_rh, sync_algo_cb, sync_algo_end_cb, &w); in sync_algo()
990 FD_PRINTF(LOG_INFO, fd, in sync_algo()
992 fd->fd_rh->rnh_gen, print_op_result(w.result)); in sync_algo()
998 * Schedules epoch-backed @fd instance deletion.
999 * * Unlinks @fd from the list of active algo instances.
1004 * Assume @fd is already unlinked from the datapath.
1007 schedule_destroy_fd_instance(struct fib_data *fd, bool in_callout) in schedule_destroy_fd_instance() argument
1012 RIB_WLOCK_ASSERT(fd->fd_rh); in schedule_destroy_fd_instance()
1015 is_dead = fd->fd_dead; in schedule_destroy_fd_instance()
1017 fd->fd_dead = true; in schedule_destroy_fd_instance()
1018 if (fd->fd_linked) { in schedule_destroy_fd_instance()
1019 TAILQ_REMOVE(&V_fib_data_list, fd, entries); in schedule_destroy_fd_instance()
1020 fd->fd_linked = false; in schedule_destroy_fd_instance()
1026 FD_PRINTF(LOG_INFO, fd, "DETACH"); in schedule_destroy_fd_instance()
1028 if (fd->fd_rs != NULL) in schedule_destroy_fd_instance()
1029 rib_unsubscribe_locked(fd->fd_rs); in schedule_destroy_fd_instance()
1035 callout_stop(&fd->fd_callout); in schedule_destroy_fd_instance()
1037 fib_epoch_call(destroy_fd_instance_epoch, &fd->fd_epoch_ctx); in schedule_destroy_fd_instance()
1043 * Wipe all fd instances from the list matching rib specified by @rh.
1050 struct fib_data *fd, *fd_tmp; in fib_cleanup_algo() local
1054 TAILQ_FOREACH_SAFE(fd, &V_fib_data_list, entries, fd_tmp) { in fib_cleanup_algo()
1055 if (fd->fd_rh == rh) { in fib_cleanup_algo()
1060 TAILQ_REMOVE(&V_fib_data_list, fd, entries); in fib_cleanup_algo()
1061 fd->fd_linked = false; in fib_cleanup_algo()
1062 TAILQ_INSERT_TAIL(&tmp_head, fd, entries); in fib_cleanup_algo()
1069 TAILQ_FOREACH_SAFE(fd, &tmp_head, entries, fd_tmp) { in fib_cleanup_algo()
1071 RIB_WLOCK(fd->fd_rh); in fib_cleanup_algo()
1072 schedule_destroy_fd_instance(fd, in_callout); in fib_cleanup_algo()
1074 RIB_WUNLOCK(fd->fd_rh); in fib_cleanup_algo()
1084 * rnh has `is_dying` flag set, so setup of new fd's will fail at in fib_destroy_rib()
1092 * Finalises fd destruction by freeing all fd resources.
1095 destroy_fd_instance(struct fib_data *fd) in destroy_fd_instance() argument
1098 FD_PRINTF(LOG_INFO, fd, "destroy fd %p", fd); in destroy_fd_instance()
1101 if (fd->fd_algo_data != NULL) in destroy_fd_instance()
1102 fd->fd_flm->flm_destroy_cb(fd->fd_algo_data); in destroy_fd_instance()
1105 if ((fd->nh_idx != NULL) && (fd->nh_ref_table != NULL)) { in destroy_fd_instance()
1106 for (int i = 0; i < fd->number_nhops; i++) { in destroy_fd_instance()
1107 if (!is_idx_free(fd, i)) { in destroy_fd_instance()
1108 FD_PRINTF(LOG_DEBUG2, fd, " FREE nhop %d %p", in destroy_fd_instance()
1109 i, fd->nh_idx[i]); in destroy_fd_instance()
1110 nhop_free_any(fd->nh_idx[i]); in destroy_fd_instance()
1113 free(fd->nh_idx, M_RTABLE); in destroy_fd_instance()
1115 if (fd->nh_ref_table != NULL) in destroy_fd_instance()
1116 free(fd->nh_ref_table, M_RTABLE); in destroy_fd_instance()
1118 if (fd->fd_ss.fd_change_queue.entries != NULL) in destroy_fd_instance()
1119 free(fd->fd_ss.fd_change_queue.entries, M_TEMP); in destroy_fd_instance()
1121 fib_unref_algo(fd->fd_flm); in destroy_fd_instance()
1123 free(fd, M_RTABLE); in destroy_fd_instance()
1127 * Epoch callback indicating fd is safe to destroy
1132 struct fib_data *fd; in destroy_fd_instance_epoch() local
1134 fd = __containerof(ctx, struct fib_data, fd_epoch_ctx); in destroy_fd_instance_epoch()
1136 CURVNET_SET(fd->fd_vnet); in destroy_fd_instance_epoch()
1137 destroy_fd_instance(fd); in destroy_fd_instance_epoch()
1142 * Tries to setup fd instance.
1143 * - Allocates fd/nhop table
1145 * - Subscribes fd to the rib
1149 * Returns: operation result. Fills in @pfd with resulting fd on success.
1156 struct fib_data *fd; in try_setup_fd_instance() local
1161 fd = malloc(sizeof(struct fib_data), M_RTABLE, M_NOWAIT | M_ZERO); in try_setup_fd_instance()
1162 if (fd == NULL) { in try_setup_fd_instance()
1167 *pfd = fd; in try_setup_fd_instance()
1169 estimate_nhop_scale(old_fd, fd); in try_setup_fd_instance()
1171 fd->fd_rh = rh; in try_setup_fd_instance()
1172 fd->fd_family = rh->rib_family; in try_setup_fd_instance()
1173 fd->fd_fibnum = rh->rib_fibnum; in try_setup_fd_instance()
1174 callout_init_rm(&fd->fd_callout, &rh->rib_lock, 0); in try_setup_fd_instance()
1175 fd->fd_vnet = curvnet; in try_setup_fd_instance()
1176 fd->fd_flm = flm; in try_setup_fd_instance()
1180 fd->fd_gen = ++fib_gen; in try_setup_fd_instance()
1183 FD_PRINTF(LOG_DEBUG, fd, "allocated fd %p", fd); in try_setup_fd_instance()
1186 size = fd->number_nhops * sizeof(void *); in try_setup_fd_instance()
1187 fd->nh_idx = malloc(size, M_RTABLE, M_NOWAIT | M_ZERO); in try_setup_fd_instance()
1188 if (fd->nh_idx == NULL) { in try_setup_fd_instance()
1189 FD_PRINTF(LOG_INFO, fd, "Unable to allocate nhop table idx (sz:%zu)", size); in try_setup_fd_instance()
1195 size += fd->number_nhops * sizeof(uint32_t); in try_setup_fd_instance()
1196 fd->nh_ref_table = malloc(size, M_RTABLE, M_NOWAIT | M_ZERO); in try_setup_fd_instance()
1197 if (fd->nh_ref_table == NULL) { in try_setup_fd_instance()
1198 FD_PRINTF(LOG_INFO, fd, "Unable to allocate nhop refcount table (sz:%zu)", size); in try_setup_fd_instance()
1201 FD_PRINTF(LOG_DEBUG, fd, "Allocated %u nhop indexes", fd->number_nhops); in try_setup_fd_instance()
1205 result = flm->flm_init_cb(fd->fd_fibnum, fd, old_algo_data, &fd->fd_algo_data); in try_setup_fd_instance()
1207 FD_PRINTF(LOG_INFO, fd, "%s algo init failed", flm->flm_name); in try_setup_fd_instance()
1213 fd->fd_rs = rib_subscribe_locked(fd->fd_rh, in try_setup_fd_instance()
1214 handle_rtable_change_cb, fd, RIB_NOTIFY_IMMEDIATE); in try_setup_fd_instance()
1215 if (fd->fd_rs == NULL) { in try_setup_fd_instance()
1216 FD_PRINTF(LOG_INFO, fd, "failed to subscribe to the rib changes"); in try_setup_fd_instance()
1222 result = sync_algo(fd); in try_setup_fd_instance()
1224 FD_PRINTF(LOG_INFO, fd, "rib sync failed"); in try_setup_fd_instance()
1227 FD_PRINTF(LOG_INFO, fd, "DUMP completed successfully."); in try_setup_fd_instance()
1231 * Insert fd in the beginning of a list, to maintain invariant in try_setup_fd_instance()
1235 TAILQ_INSERT_HEAD(&V_fib_data_list, fd, entries); in try_setup_fd_instance()
1236 fd->fd_linked = true; in try_setup_fd_instance()
1317 execute_callout_action(struct fib_data *fd) in execute_callout_action() argument
1319 enum fib_callout_action action = fd->fd_callout_action; in execute_callout_action()
1324 RIB_WLOCK_ASSERT(fd->fd_rh); in execute_callout_action()
1326 fd->fd_need_rebuild = false; in execute_callout_action()
1327 fd->fd_batch = false; in execute_callout_action()
1328 fd->fd_num_changes = 0; in execute_callout_action()
1331 if (!is_algo_fixed(fd->fd_rh)) in execute_callout_action()
1332 flm_new = fib_check_best_algo(fd->fd_rh, fd->fd_flm); in execute_callout_action()
1338 if (!apply_rtable_changes(fd)) in execute_callout_action()
1343 result = rebuild_fd_flm(fd, flm_new != NULL ? flm_new : fd->fd_flm); in execute_callout_action()
1351 * Callout for all scheduled fd-related work.
1359 struct fib_data *fd = (struct fib_data *)_data; in handle_fd_callout() local
1362 FD_PRINTF(LOG_INFO, fd, "running callout type=%d", fd->fd_callout_action); in handle_fd_callout()
1365 CURVNET_SET(fd->fd_vnet); in handle_fd_callout()
1366 execute_callout_action(fd); in handle_fd_callout()
1372 * Tries to create new algo instance based on @fd data.
1376 rebuild_fd_flm(struct fib_data *fd, struct fib_lookup_module *flm_new) in rebuild_fd_flm() argument
1381 if (flm_new == fd->fd_flm) in rebuild_fd_flm()
1382 fd_tmp = fd; in rebuild_fd_flm()
1384 FD_PRINTF(LOG_INFO, fd, "switching algo to %s", flm_new->flm_name); in rebuild_fd_flm()
1386 result = setup_fd_instance(flm_new, fd->fd_rh, fd_tmp, &fd_new, true); in rebuild_fd_flm()
1388 FD_PRINTF(LOG_NOTICE, fd, "table rebuild failed"); in rebuild_fd_flm()
1394 schedule_destroy_fd_instance(fd, true); in rebuild_fd_flm()
1400 rebuild_fd(struct fib_data *fd, const char *reason) in rebuild_fd() argument
1405 if (!is_algo_fixed(fd->fd_rh)) in rebuild_fd()
1406 flm_new = fib_check_best_algo(fd->fd_rh, fd->fd_flm); in rebuild_fd()
1408 FD_PRINTF(LOG_INFO, fd, "running sync rebuild: %s", reason); in rebuild_fd()
1409 result = rebuild_fd_flm(fd, flm_new != NULL ? flm_new : fd->fd_flm); in rebuild_fd()
1414 FD_PRINTF(LOG_ERR, fd, "sync rebuild failed"); in rebuild_fd()
1415 schedule_fd_rebuild(fd, "sync rebuild failed"); in rebuild_fd()
1457 struct fib_data *fd = NULL; in set_fib_algo() local
1466 TAILQ_FOREACH(fd, &V_fib_data_list, entries) { in set_fib_algo()
1467 if ((fd->fd_family == family) && (fd->fd_fibnum == fibnum)) in set_fib_algo()
1470 if (fd == NULL) { in set_fib_algo()
1474 rh = fd->fd_rh; in set_fib_algo()
1475 strlcpy(old_algo_name, fd->fd_flm->flm_name, in set_fib_algo()
1494 fd = NULL; in set_fib_algo()
1497 result = setup_fd_instance(flm, rh, NULL, &fd, true); in set_fib_algo()
1586 * contains updated callback/algo data from @fd.
1590 replace_rtables_family(struct fib_dp **pdp, struct fib_data *fd, struct fib_dp *dp) in replace_rtables_family() argument
1596 FD_PRINTF(LOG_DEBUG, fd, "[vnet %p] replace with f:%p arg:%p", in replace_rtables_family()
1602 if (old_fdh->fdh_idx[fd->fd_fibnum].f == dp->f) { in replace_rtables_family()
1607 old_fdh->fdh_idx[fd->fd_fibnum].arg = dp->arg; in replace_rtables_family()
1608 FD_PRINTF(LOG_DEBUG, fd, "FDH %p inline update", old_fdh); in replace_rtables_family()
1614 FD_PRINTF(LOG_DEBUG, fd, "OLD FDH: %p NEW FDH: %p", old_fdh, new_fdh); in replace_rtables_family()
1617 FD_PRINTF(LOG_WARNING, fd, "error attaching datapath"); in replace_rtables_family()
1623 /* Update relevant data structure for @fd */ in replace_rtables_family()
1624 new_fdh->fdh_idx[fd->fd_fibnum] = *dp; in replace_rtables_family()
1631 FD_PRINTF(LOG_DEBUG, fd, "update %p -> %p", old_fdh, new_fdh); in replace_rtables_family()
1655 * Make datapath use fib instance @fd
1658 fib_set_datapath_ptr(struct fib_data *fd, struct fib_dp *dp) in fib_set_datapath_ptr() argument
1662 pdp = get_family_dp_ptr(fd->fd_family); in fib_set_datapath_ptr()
1663 return (replace_rtables_family(pdp, fd, dp)); in fib_set_datapath_ptr()
1723 * Updates pointer to the algo data for the @fd.
1726 fib_set_algo_ptr(struct fib_data *fd, void *algo_data) in fib_set_algo_ptr() argument
1728 RIB_WLOCK_ASSERT(fd->fd_rh); in fib_set_algo_ptr()
1730 fd->fd_algo_data = algo_data; in fib_set_algo_ptr()
1743 * Accessor to get rib instance @fd is attached to.
1746 fib_get_rh(struct fib_data *fd) in fib_get_rh() argument
1749 return (fd->fd_rh); in fib_get_rh()
1756 fib_get_nhop_array(struct fib_data *fd) in fib_get_nhop_array() argument
1759 return (fd->nh_idx); in fib_get_nhop_array()
1774 fib_get_nhop_idx(struct fib_data *fd, struct nhop_object *nh) in fib_get_nhop_idx() argument
1781 is_idx_free(struct fib_data *fd, uint32_t index) in is_idx_free() argument
1784 return (fd->nh_ref_table->refcnt[index] == 0); in is_idx_free()
1788 fib_ref_nhop(struct fib_data *fd, struct nhop_object *nh) in fib_ref_nhop() argument
1792 if (idx >= fd->number_nhops) { in fib_ref_nhop()
1793 fd->hit_nhops = 1; in fib_ref_nhop()
1797 if (is_idx_free(fd, idx)) { in fib_ref_nhop()
1799 fd->nh_idx[idx] = nh; in fib_ref_nhop()
1800 fd->nh_ref_table->count++; in fib_ref_nhop()
1801 FD_PRINTF(LOG_DEBUG2, fd, " REF nhop %u %p", idx, fd->nh_idx[idx]); in fib_ref_nhop()
1803 fd->nh_ref_table->refcnt[idx]++; in fib_ref_nhop()
1831 fib_schedule_release_nhop(struct fib_data *fd, struct nhop_object *nh) in fib_schedule_release_nhop() argument
1844 FD_PRINTF(LOG_ERR, fd, "unable to schedule nhop %p deletion", nh); in fib_schedule_release_nhop()
1849 fib_unref_nhop(struct fib_data *fd, struct nhop_object *nh) in fib_unref_nhop() argument
1853 KASSERT((idx < fd->number_nhops), ("invalid nhop index")); in fib_unref_nhop()
1854 KASSERT((nh == fd->nh_idx[idx]), ("index table contains whong nh")); in fib_unref_nhop()
1856 fd->nh_ref_table->refcnt[idx]--; in fib_unref_nhop()
1857 if (fd->nh_ref_table->refcnt[idx] == 0) { in fib_unref_nhop()
1858 FD_PRINTF(LOG_DEBUG, fd, " FREE nhop %d %p", idx, fd->nh_idx[idx]); in fib_unref_nhop()
1859 fib_schedule_release_nhop(fd, fd->nh_idx[idx]); in fib_unref_nhop()
1951 struct fib_data *fd = NULL; in fib_select_algo_initial() local
1964 result = setup_fd_instance(flm, rh, NULL, &fd, false); in fib_select_algo_initial()
1968 RH_PRINTF(LOG_DEBUG, rh, "result=%d fd=%p", result, fd); in fib_select_algo_initial()
1970 *dp = fd->fd_dp; in fib_select_algo_initial()