Lines Matching full:fd

80  * fd - fib data - instance of an flm bound to specific routing table
195 static bool rebuild_fd(struct fib_data *fd, const char *reason);
196 static bool rebuild_fd_flm(struct fib_data *fd, struct fib_lookup_module *flm_new);
199 static bool is_idx_free(struct fib_data *fd, uint32_t index);
203 static uint32_t fib_ref_nhop(struct fib_data *fd, struct nhop_object *nh);
204 static void fib_unref_nhop(struct fib_data *fd, struct nhop_object *nh);
415 fib_printf(int level, struct fib_data *fd, const char *func, char *fmt, ...) in fib_printf() argument
427 _ALGO_PRINTF(fd->fd_fibnum, fd->fd_family, fd->fd_flm->flm_name, in fib_printf()
428 fd->fd_gen, func, "%s", buf); in fib_printf()
486 callout_calc_delay_ms(struct fib_data *fd) in callout_calc_delay_ms() argument
490 if (fd->fd_failed_rebuilds > 10) in callout_calc_delay_ms()
493 shift = fd->fd_failed_rebuilds; in callout_calc_delay_ms()
499 schedule_callout(struct fib_data *fd, enum fib_callout_action action, int delay_ms) in schedule_callout() argument
502 FD_PRINTF(LOG_DEBUG, fd, "delay=%d action=%d", delay_ms, action); in schedule_callout()
503 fd->fd_callout_action = action; in schedule_callout()
504 callout_reset_sbt(&fd->fd_callout, SBT_1MS * delay_ms, 0, in schedule_callout()
505 handle_fd_callout, fd, 0); in schedule_callout()
509 schedule_fd_rebuild(struct fib_data *fd, const char *reason) in schedule_fd_rebuild() argument
512 RIB_WLOCK_ASSERT(fd->fd_rh); in schedule_fd_rebuild()
514 if (!fd->fd_need_rebuild) { in schedule_fd_rebuild()
515 fd->fd_need_rebuild = true; in schedule_fd_rebuild()
517 fd->fd_batch = false; in schedule_fd_rebuild()
523 FD_PRINTF(LOG_INFO, fd, "Scheduling rebuild: %s (failures=%d)", in schedule_fd_rebuild()
524 reason, fd->fd_failed_rebuilds); in schedule_fd_rebuild()
525 schedule_callout(fd, FDA_REBUILD, callout_calc_delay_ms(fd)); in schedule_fd_rebuild()
530 sync_rib_gen(struct fib_data *fd) in sync_rib_gen() argument
532 FD_PRINTF(LOG_DEBUG, fd, "Sync gen %u -> %u", fd->fd_rh->rnh_gen, fd->fd_rh->rnh_gen_rib); in sync_rib_gen()
533 fd->fd_rh->rnh_gen = fd->fd_rh->rnh_gen_rib; in sync_rib_gen()
564 mark_diverge_time(struct fib_data *fd) in mark_diverge_time() argument
566 struct fib_sync_status *fd_ss = &fd->fd_ss; in mark_diverge_time()
585 update_rebuild_delay(struct fib_data *fd, enum fib_callout_action action) in update_rebuild_delay() argument
602 struct fib_sync_status *fd_ss = &fd->fd_ss; in update_rebuild_delay()
611 FD_PRINTF(LOG_DEBUG, fd, in update_rebuild_delay()
617 FD_PRINTF(LOG_DEBUG, fd, in update_rebuild_delay()
633 schedule_callout(fd, action, delay_ms); in update_rebuild_delay()
638 update_algo_state(struct fib_data *fd) in update_algo_state() argument
641 RIB_WLOCK_ASSERT(fd->fd_rh); in update_algo_state()
643 if (fd->fd_batch || fd->fd_need_rebuild) { in update_algo_state()
644 enum fib_callout_action action = fd->fd_need_rebuild ? FDA_REBUILD : FDA_BATCH; in update_algo_state()
645 update_rebuild_delay(fd, action); in update_algo_state()
649 if (fd->fd_num_changes++ == 0) { in update_algo_state()
651 if (!callout_pending(&fd->fd_callout)) in update_algo_state()
652 schedule_callout(fd, FDA_EVAL, ALGO_EVAL_DELAY_MS); in update_algo_state()
653 } else if (fd->fd_num_changes == ALGO_EVAL_NUM_ROUTES) { in update_algo_state()
655 if (fd->fd_callout_action == FDA_EVAL) in update_algo_state()
656 schedule_callout(fd, FDA_EVAL, 1); in update_algo_state()
661 need_immediate_sync(struct fib_data *fd, struct rib_cmd_info *rc) in need_immediate_sync() argument
691 apply_rtable_changes(struct fib_data *fd) in apply_rtable_changes() argument
694 struct fib_change_queue *q = &fd->fd_ss.fd_change_queue; in apply_rtable_changes()
696 result = fd->fd_flm->flm_change_rib_items_cb(fd->fd_rh, q, fd->fd_algo_data); in apply_rtable_changes()
699 sync_rib_gen(fd); in apply_rtable_changes()
702 fib_unref_nhop(fd, q->entries[i].nh_old); in apply_rtable_changes()
705 fd->fd_batch = false; in apply_rtable_changes()
711 fill_change_entry(struct fib_data *fd, struct fib_change_entry *ce, struct rib_cmd_info *rc) in fill_change_entry() argument
715 switch (fd->fd_family) { in fill_change_entry()
732 if (fib_ref_nhop(fd, ce->nh_new) == 0) in fill_change_entry()
740 queue_rtable_change(struct fib_data *fd, struct rib_cmd_info *rc) in queue_rtable_change() argument
742 struct fib_change_queue *q = &fd->fd_ss.fd_change_queue; in queue_rtable_change()
755 FD_PRINTF(LOG_INFO, fd, "Unable to realloc queue for %u elements", in queue_rtable_change()
763 return (fill_change_entry(fd, &q->entries[q->count++], rc)); in queue_rtable_change()
775 struct fib_data *fd = (struct fib_data *)_data; in handle_rtable_change_cb() local
785 if (!fd->init_done) in handle_rtable_change_cb()
788 bool immediate_sync = need_immediate_sync(fd, rc); in handle_rtable_change_cb()
791 update_algo_state(fd); in handle_rtable_change_cb()
797 if (fd->fd_need_rebuild) { in handle_rtable_change_cb()
799 rebuild_fd(fd, "rtable change type enforced sync"); in handle_rtable_change_cb()
807 if (fd->fd_batch) { in handle_rtable_change_cb()
809 if (!queue_rtable_change(fd, rc) || !apply_rtable_changes(fd)) in handle_rtable_change_cb()
810 rebuild_fd(fd, "batch sync failed"); in handle_rtable_change_cb()
812 if (!queue_rtable_change(fd, rc)) in handle_rtable_change_cb()
813 schedule_fd_rebuild(fd, "batch queue failed"); in handle_rtable_change_cb()
824 if (fib_ref_nhop(fd, rc->rc_nh_new) == 0) { in handle_rtable_change_cb()
826 schedule_fd_rebuild(fd, "ran out of nhop indexes"); in handle_rtable_change_cb()
831 result = fd->fd_flm->flm_change_rib_item_cb(rnh, rc, fd->fd_algo_data); in handle_rtable_change_cb()
835 sync_rib_gen(fd); in handle_rtable_change_cb()
838 fib_unref_nhop(fd, rc->rc_nh_old); in handle_rtable_change_cb()
845 if (queue_rtable_change(fd, rc)) { in handle_rtable_change_cb()
847 fd->fd_batch = true; in handle_rtable_change_cb()
848 mark_diverge_time(fd); in handle_rtable_change_cb()
849 update_rebuild_delay(fd, FDA_BATCH); in handle_rtable_change_cb()
852 if (apply_rtable_changes(fd)) in handle_rtable_change_cb()
855 FD_PRINTF(LOG_ERR, fd, "batched sync failed, force the rebuild"); in handle_rtable_change_cb()
864 mark_diverge_time(fd); in handle_rtable_change_cb()
865 schedule_fd_rebuild(fd, "algo requested rebuild"); in handle_rtable_change_cb()
869 FD_PRINTF(LOG_INFO, fd, "running sync rebuild"); in handle_rtable_change_cb()
870 rebuild_fd(fd, "rtable change type enforced sync"); in handle_rtable_change_cb()
879 FD_PRINTF(LOG_ERR, fd, "algo reported non-recoverable error"); in handle_rtable_change_cb()
880 if (!flm_error_add(fd->fd_flm, fd->fd_fibnum)) in handle_rtable_change_cb()
881 FD_PRINTF(LOG_ERR, fd, "failed to ban algo"); in handle_rtable_change_cb()
882 schedule_fd_rebuild(fd, "algo reported non-recoverable error"); in handle_rtable_change_cb()
887 estimate_nhop_scale(const struct fib_data *old_fd, struct fib_data *fd) in estimate_nhop_scale() argument
892 fd->number_nhops = 16; in estimate_nhop_scale()
897 fd->number_nhops = 2 * old_fd->number_nhops; in estimate_nhop_scale()
899 fd->number_nhops = old_fd->number_nhops; in estimate_nhop_scale()
903 struct fib_data *fd; member
919 struct fib_data *fd = w->fd; in sync_algo_end_cb() local
921 RIB_WLOCK_ASSERT(w->fd->fd_rh); in sync_algo_end_cb()
928 if (fd->hit_nhops) { in sync_algo_end_cb()
929 FD_PRINTF(LOG_INFO, fd, "ran out of nexthops at %u nhops", in sync_algo_end_cb()
930 fd->nh_ref_table->count); in sync_algo_end_cb()
940 w->result = fd->fd_flm->flm_dump_end_cb(fd->fd_algo_data, &fd->fd_dp); in sync_algo_end_cb()
944 fd->init_done = 1; in sync_algo_end_cb()
958 RIB_WLOCK_ASSERT(w->fd->fd_rh); in sync_algo_cb()
968 if (fib_ref_nhop(w->fd, nh) != 0) in sync_algo_cb()
969 w->result = w->func(rt, w->fd->fd_algo_data); in sync_algo_cb()
981 sync_algo(struct fib_data *fd) in sync_algo() argument
984 .fd = fd, in sync_algo()
985 .func = fd->fd_flm->flm_dump_rib_item_cb, in sync_algo()
989 rib_walk_ext_locked(fd->fd_rh, sync_algo_cb, sync_algo_end_cb, &w); in sync_algo()
991 FD_PRINTF(LOG_INFO, fd, in sync_algo()
993 fd->fd_rh->rnh_gen, print_op_result(w.result)); in sync_algo()
999 * Schedules epoch-backed @fd instance deletion.
1000 * * Unlinks @fd from the list of active algo instances.
1005 * Assume @fd is already unlinked from the datapath.
1008 schedule_destroy_fd_instance(struct fib_data *fd, bool in_callout) in schedule_destroy_fd_instance() argument
1013 RIB_WLOCK_ASSERT(fd->fd_rh); in schedule_destroy_fd_instance()
1016 is_dead = fd->fd_dead; in schedule_destroy_fd_instance()
1018 fd->fd_dead = true; in schedule_destroy_fd_instance()
1019 if (fd->fd_linked) { in schedule_destroy_fd_instance()
1020 TAILQ_REMOVE(&V_fib_data_list, fd, entries); in schedule_destroy_fd_instance()
1021 fd->fd_linked = false; in schedule_destroy_fd_instance()
1027 FD_PRINTF(LOG_INFO, fd, "DETACH"); in schedule_destroy_fd_instance()
1029 if (fd->fd_rs != NULL) in schedule_destroy_fd_instance()
1030 rib_unsubscribe_locked(fd->fd_rs); in schedule_destroy_fd_instance()
1036 callout_stop(&fd->fd_callout); in schedule_destroy_fd_instance()
1038 fib_epoch_call(destroy_fd_instance_epoch, &fd->fd_epoch_ctx); in schedule_destroy_fd_instance()
1044 * Wipe all fd instances from the list matching rib specified by @rh.
1051 struct fib_data *fd, *fd_tmp; in fib_cleanup_algo() local
1055 TAILQ_FOREACH_SAFE(fd, &V_fib_data_list, entries, fd_tmp) { in fib_cleanup_algo()
1056 if (fd->fd_rh == rh) { in fib_cleanup_algo()
1061 TAILQ_REMOVE(&V_fib_data_list, fd, entries); in fib_cleanup_algo()
1062 fd->fd_linked = false; in fib_cleanup_algo()
1063 TAILQ_INSERT_TAIL(&tmp_head, fd, entries); in fib_cleanup_algo()
1070 TAILQ_FOREACH_SAFE(fd, &tmp_head, entries, fd_tmp) { in fib_cleanup_algo()
1072 RIB_WLOCK(fd->fd_rh); in fib_cleanup_algo()
1073 schedule_destroy_fd_instance(fd, in_callout); in fib_cleanup_algo()
1075 RIB_WUNLOCK(fd->fd_rh); in fib_cleanup_algo()
1085 * rnh has `is_dying` flag set, so setup of new fd's will fail at in fib_destroy_rib()
1093 * Finalises fd destruction by freeing all fd resources.
1096 destroy_fd_instance(struct fib_data *fd) in destroy_fd_instance() argument
1099 FD_PRINTF(LOG_INFO, fd, "destroy fd %p", fd); in destroy_fd_instance()
1102 if (fd->fd_algo_data != NULL) in destroy_fd_instance()
1103 fd->fd_flm->flm_destroy_cb(fd->fd_algo_data); in destroy_fd_instance()
1106 if ((fd->nh_idx != NULL) && (fd->nh_ref_table != NULL)) { in destroy_fd_instance()
1107 for (int i = 0; i < fd->number_nhops; i++) { in destroy_fd_instance()
1108 if (!is_idx_free(fd, i)) { in destroy_fd_instance()
1109 FD_PRINTF(LOG_DEBUG2, fd, " FREE nhop %d %p", in destroy_fd_instance()
1110 i, fd->nh_idx[i]); in destroy_fd_instance()
1111 nhop_free_any(fd->nh_idx[i]); in destroy_fd_instance()
1114 free(fd->nh_idx, M_RTABLE); in destroy_fd_instance()
1116 if (fd->nh_ref_table != NULL) in destroy_fd_instance()
1117 free(fd->nh_ref_table, M_RTABLE); in destroy_fd_instance()
1119 if (fd->fd_ss.fd_change_queue.entries != NULL) in destroy_fd_instance()
1120 free(fd->fd_ss.fd_change_queue.entries, M_TEMP); in destroy_fd_instance()
1122 fib_unref_algo(fd->fd_flm); in destroy_fd_instance()
1124 free(fd, M_RTABLE); in destroy_fd_instance()
1128 * Epoch callback indicating fd is safe to destroy
1133 struct fib_data *fd; in destroy_fd_instance_epoch() local
1135 fd = __containerof(ctx, struct fib_data, fd_epoch_ctx); in destroy_fd_instance_epoch()
1137 CURVNET_SET(fd->fd_vnet); in destroy_fd_instance_epoch()
1138 destroy_fd_instance(fd); in destroy_fd_instance_epoch()
1143 * Tries to setup fd instance.
1144 * - Allocates fd/nhop table
1146 * - Subscribes fd to the rib
1150 * Returns: operation result. Fills in @pfd with resulting fd on success.
1157 struct fib_data *fd; in try_setup_fd_instance() local
1162 fd = malloc(sizeof(struct fib_data), M_RTABLE, M_NOWAIT | M_ZERO); in try_setup_fd_instance()
1163 if (fd == NULL) { in try_setup_fd_instance()
1168 *pfd = fd; in try_setup_fd_instance()
1170 estimate_nhop_scale(old_fd, fd); in try_setup_fd_instance()
1172 fd->fd_rh = rh; in try_setup_fd_instance()
1173 fd->fd_family = rh->rib_family; in try_setup_fd_instance()
1174 fd->fd_fibnum = rh->rib_fibnum; in try_setup_fd_instance()
1175 callout_init_rm(&fd->fd_callout, &rh->rib_lock, 0); in try_setup_fd_instance()
1176 fd->fd_vnet = curvnet; in try_setup_fd_instance()
1177 fd->fd_flm = flm; in try_setup_fd_instance()
1181 fd->fd_gen = ++fib_gen; in try_setup_fd_instance()
1184 FD_PRINTF(LOG_DEBUG, fd, "allocated fd %p", fd); in try_setup_fd_instance()
1187 size = fd->number_nhops * sizeof(void *); in try_setup_fd_instance()
1188 fd->nh_idx = malloc(size, M_RTABLE, M_NOWAIT | M_ZERO); in try_setup_fd_instance()
1189 if (fd->nh_idx == NULL) { in try_setup_fd_instance()
1190 FD_PRINTF(LOG_INFO, fd, "Unable to allocate nhop table idx (sz:%zu)", size); in try_setup_fd_instance()
1196 size += fd->number_nhops * sizeof(uint32_t); in try_setup_fd_instance()
1197 fd->nh_ref_table = malloc(size, M_RTABLE, M_NOWAIT | M_ZERO); in try_setup_fd_instance()
1198 if (fd->nh_ref_table == NULL) { in try_setup_fd_instance()
1199 FD_PRINTF(LOG_INFO, fd, "Unable to allocate nhop refcount table (sz:%zu)", size); in try_setup_fd_instance()
1202 FD_PRINTF(LOG_DEBUG, fd, "Allocated %u nhop indexes", fd->number_nhops); in try_setup_fd_instance()
1206 result = flm->flm_init_cb(fd->fd_fibnum, fd, old_algo_data, &fd->fd_algo_data); in try_setup_fd_instance()
1208 FD_PRINTF(LOG_INFO, fd, "%s algo init failed", flm->flm_name); in try_setup_fd_instance()
1214 fd->fd_rs = rib_subscribe_locked(fd->fd_rh, in try_setup_fd_instance()
1215 handle_rtable_change_cb, fd, RIB_NOTIFY_IMMEDIATE); in try_setup_fd_instance()
1216 if (fd->fd_rs == NULL) { in try_setup_fd_instance()
1217 FD_PRINTF(LOG_INFO, fd, "failed to subscribe to the rib changes"); in try_setup_fd_instance()
1223 result = sync_algo(fd); in try_setup_fd_instance()
1225 FD_PRINTF(LOG_INFO, fd, "rib sync failed"); in try_setup_fd_instance()
1228 FD_PRINTF(LOG_INFO, fd, "DUMP completed successfully."); in try_setup_fd_instance()
1232 * Insert fd in the beginning of a list, to maintain invariant in try_setup_fd_instance()
1236 TAILQ_INSERT_HEAD(&V_fib_data_list, fd, entries); in try_setup_fd_instance()
1237 fd->fd_linked = true; in try_setup_fd_instance()
1318 execute_callout_action(struct fib_data *fd) in execute_callout_action() argument
1320 enum fib_callout_action action = fd->fd_callout_action; in execute_callout_action()
1325 RIB_WLOCK_ASSERT(fd->fd_rh); in execute_callout_action()
1327 fd->fd_need_rebuild = false; in execute_callout_action()
1328 fd->fd_batch = false; in execute_callout_action()
1329 fd->fd_num_changes = 0; in execute_callout_action()
1332 if (!is_algo_fixed(fd->fd_rh)) in execute_callout_action()
1333 flm_new = fib_check_best_algo(fd->fd_rh, fd->fd_flm); in execute_callout_action()
1339 if (!apply_rtable_changes(fd)) in execute_callout_action()
1344 result = rebuild_fd_flm(fd, flm_new != NULL ? flm_new : fd->fd_flm); in execute_callout_action()
1352 * Callout for all scheduled fd-related work.
1360 struct fib_data *fd = (struct fib_data *)_data; in handle_fd_callout() local
1363 FD_PRINTF(LOG_INFO, fd, "running callout type=%d", fd->fd_callout_action); in handle_fd_callout()
1366 CURVNET_SET(fd->fd_vnet); in handle_fd_callout()
1367 execute_callout_action(fd); in handle_fd_callout()
1373 * Tries to create new algo instance based on @fd data.
1377 rebuild_fd_flm(struct fib_data *fd, struct fib_lookup_module *flm_new) in rebuild_fd_flm() argument
1382 if (flm_new == fd->fd_flm) in rebuild_fd_flm()
1383 fd_tmp = fd; in rebuild_fd_flm()
1385 FD_PRINTF(LOG_INFO, fd, "switching algo to %s", flm_new->flm_name); in rebuild_fd_flm()
1387 result = setup_fd_instance(flm_new, fd->fd_rh, fd_tmp, &fd_new, true); in rebuild_fd_flm()
1389 FD_PRINTF(LOG_NOTICE, fd, "table rebuild failed"); in rebuild_fd_flm()
1395 schedule_destroy_fd_instance(fd, true); in rebuild_fd_flm()
1401 rebuild_fd(struct fib_data *fd, const char *reason) in rebuild_fd() argument
1406 if (!is_algo_fixed(fd->fd_rh)) in rebuild_fd()
1407 flm_new = fib_check_best_algo(fd->fd_rh, fd->fd_flm); in rebuild_fd()
1409 FD_PRINTF(LOG_INFO, fd, "running sync rebuild: %s", reason); in rebuild_fd()
1410 result = rebuild_fd_flm(fd, flm_new != NULL ? flm_new : fd->fd_flm); in rebuild_fd()
1415 FD_PRINTF(LOG_ERR, fd, "sync rebuild failed"); in rebuild_fd()
1416 schedule_fd_rebuild(fd, "sync rebuild failed"); in rebuild_fd()
1458 struct fib_data *fd = NULL; in set_fib_algo() local
1467 TAILQ_FOREACH(fd, &V_fib_data_list, entries) { in set_fib_algo()
1468 if ((fd->fd_family == family) && (fd->fd_fibnum == fibnum)) in set_fib_algo()
1471 if (fd == NULL) { in set_fib_algo()
1475 rh = fd->fd_rh; in set_fib_algo()
1476 strlcpy(old_algo_name, fd->fd_flm->flm_name, in set_fib_algo()
1495 fd = NULL; in set_fib_algo()
1498 result = setup_fd_instance(flm, rh, NULL, &fd, true); in set_fib_algo()
1587 * contains updated callback/algo data from @fd.
1591 replace_rtables_family(struct fib_dp **pdp, struct fib_data *fd, struct fib_dp *dp) in replace_rtables_family() argument
1597 FD_PRINTF(LOG_DEBUG, fd, "[vnet %p] replace with f:%p arg:%p", in replace_rtables_family()
1603 if (old_fdh->fdh_idx[fd->fd_fibnum].f == dp->f) { in replace_rtables_family()
1608 old_fdh->fdh_idx[fd->fd_fibnum].arg = dp->arg; in replace_rtables_family()
1609 FD_PRINTF(LOG_DEBUG, fd, "FDH %p inline update", old_fdh); in replace_rtables_family()
1615 FD_PRINTF(LOG_DEBUG, fd, "OLD FDH: %p NEW FDH: %p", old_fdh, new_fdh); in replace_rtables_family()
1618 FD_PRINTF(LOG_WARNING, fd, "error attaching datapath"); in replace_rtables_family()
1624 /* Update relevant data structure for @fd */ in replace_rtables_family()
1625 new_fdh->fdh_idx[fd->fd_fibnum] = *dp; in replace_rtables_family()
1632 FD_PRINTF(LOG_DEBUG, fd, "update %p -> %p", old_fdh, new_fdh); in replace_rtables_family()
1656 * Make datapath use fib instance @fd
1659 fib_set_datapath_ptr(struct fib_data *fd, struct fib_dp *dp) in fib_set_datapath_ptr() argument
1663 pdp = get_family_dp_ptr(fd->fd_family); in fib_set_datapath_ptr()
1664 return (replace_rtables_family(pdp, fd, dp)); in fib_set_datapath_ptr()
1724 * Updates pointer to the algo data for the @fd.
1727 fib_set_algo_ptr(struct fib_data *fd, void *algo_data) in fib_set_algo_ptr() argument
1729 RIB_WLOCK_ASSERT(fd->fd_rh); in fib_set_algo_ptr()
1731 fd->fd_algo_data = algo_data; in fib_set_algo_ptr()
1744 * Accessor to get rib instance @fd is attached to.
1747 fib_get_rh(struct fib_data *fd) in fib_get_rh() argument
1750 return (fd->fd_rh); in fib_get_rh()
1757 fib_get_nhop_array(struct fib_data *fd) in fib_get_nhop_array() argument
1760 return (fd->nh_idx); in fib_get_nhop_array()
1775 fib_get_nhop_idx(struct fib_data *fd, struct nhop_object *nh) in fib_get_nhop_idx() argument
1782 is_idx_free(struct fib_data *fd, uint32_t index) in is_idx_free() argument
1785 return (fd->nh_ref_table->refcnt[index] == 0); in is_idx_free()
1789 fib_ref_nhop(struct fib_data *fd, struct nhop_object *nh) in fib_ref_nhop() argument
1793 if (idx >= fd->number_nhops) { in fib_ref_nhop()
1794 fd->hit_nhops = 1; in fib_ref_nhop()
1798 if (is_idx_free(fd, idx)) { in fib_ref_nhop()
1800 fd->nh_idx[idx] = nh; in fib_ref_nhop()
1801 fd->nh_ref_table->count++; in fib_ref_nhop()
1802 FD_PRINTF(LOG_DEBUG2, fd, " REF nhop %u %p", idx, fd->nh_idx[idx]); in fib_ref_nhop()
1804 fd->nh_ref_table->refcnt[idx]++; in fib_ref_nhop()
1832 fib_schedule_release_nhop(struct fib_data *fd, struct nhop_object *nh) in fib_schedule_release_nhop() argument
1845 FD_PRINTF(LOG_ERR, fd, "unable to schedule nhop %p deletion", nh); in fib_schedule_release_nhop()
1850 fib_unref_nhop(struct fib_data *fd, struct nhop_object *nh) in fib_unref_nhop() argument
1854 KASSERT((idx < fd->number_nhops), ("invalid nhop index")); in fib_unref_nhop()
1855 KASSERT((nh == fd->nh_idx[idx]), ("index table contains whong nh")); in fib_unref_nhop()
1857 fd->nh_ref_table->refcnt[idx]--; in fib_unref_nhop()
1858 if (fd->nh_ref_table->refcnt[idx] == 0) { in fib_unref_nhop()
1859 FD_PRINTF(LOG_DEBUG, fd, " FREE nhop %d %p", idx, fd->nh_idx[idx]); in fib_unref_nhop()
1860 fib_schedule_release_nhop(fd, fd->nh_idx[idx]); in fib_unref_nhop()
1952 struct fib_data *fd = NULL; in fib_select_algo_initial() local
1965 result = setup_fd_instance(flm, rh, NULL, &fd, false); in fib_select_algo_initial()
1969 RH_PRINTF(LOG_DEBUG, rh, "result=%d fd=%p", result, fd); in fib_select_algo_initial()
1971 *dp = fd->fd_dp; in fib_select_algo_initial()