Lines Matching refs:unhop

99 CHT_SLIST_DEFINE(unhop, struct user_nhop);
120 static void destroy_unhop(struct user_nhop *unhop);
121 static struct nhop_object *clone_unhop(const struct user_nhop *unhop,
166 struct user_nhop *unhop; in nl_find_nhop() local
174 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in nl_find_nhop()
175 if (unhop != NULL) { in nl_find_nhop()
176 struct nhop_object *nh = unhop->un_nhop; in nl_find_nhop()
187 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in nl_find_nhop()
188 if (unhop == NULL) { in nl_find_nhop()
207 un_new->un_nhop = clone_unhop(unhop, fibnum, family, nh_flags); in nl_find_nhop()
218 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in nl_find_nhop()
219 if (unhop == NULL) { in nl_find_nhop()
228 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, un_new, un_tmp); in nl_find_nhop()
236 CHT_SLIST_INSERT_HEAD(&ctl->un_head, unhop, un_new); in nl_find_nhop()
237 un_new->un_nextchild = unhop->un_nextchild; in nl_find_nhop()
238 unhop->un_nextchild = un_new; in nl_find_nhop()
257 struct user_nhop *unhop = NULL; in nl_find_base_unhop() local
261 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in nl_find_base_unhop()
264 return (unhop); in nl_find_base_unhop()
269 clone_unhop(const struct user_nhop *unhop, uint32_t fibnum, int family, int nh_flags) in clone_unhop() argument
279 if (unhop->un_nhop_src != NULL) { in clone_unhop()
282 nhop_print_buf_any(unhop->un_nhop_src, nhbuf, sizeof(nhbuf)); in clone_unhop()
283 FIB_NH_LOG(LOG_DEBUG2, unhop->un_nhop_src, in clone_unhop()
291 nhop_copy(nh, unhop->un_nhop_src); in clone_unhop()
297 nhop_set_uidx(nh, unhop->un_idx); in clone_unhop()
302 wn = unhop->un_nhgrp_src; in clone_unhop()
303 num_nhops = unhop->un_nhgrp_count; in clone_unhop()
325 error = nhgrp_get_group(rh, wn_new, num_nhops, unhop->un_idx, &nhg); in clone_unhop()
336 destroy_unhop(struct user_nhop *unhop) in destroy_unhop() argument
338 if (unhop->un_nhop != NULL) in destroy_unhop()
339 nhop_free_any(unhop->un_nhop); in destroy_unhop()
340 if (unhop->un_nhop_src != NULL) in destroy_unhop()
341 nhop_free_any(unhop->un_nhop_src); in destroy_unhop()
342 free(unhop, M_NETLINK); in destroy_unhop()
348 struct user_nhop *unhop; in destroy_unhop_epoch() local
350 unhop = __containerof(ctx, struct user_nhop, un_epoch_ctx); in destroy_unhop_epoch()
352 destroy_unhop(unhop); in destroy_unhop_epoch()
358 struct user_nhop *unhop, key = {}; in find_spare_uidx() local
366 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in find_spare_uidx()
367 if (unhop == NULL) { in find_spare_uidx()
393 dump_nhgrp(const struct user_nhop *unhop, struct nlmsghdr *hdr, in dump_nhgrp() argument
403 nhm->nh_protocol = unhop->un_protocol; in dump_nhgrp()
406 nlattr_add_u32(nw, NHA_ID, unhop->un_idx); in dump_nhgrp()
409 struct weightened_nhop *wn = unhop->un_nhgrp_src; in dump_nhgrp()
410 uint32_t num_nhops = unhop->un_nhgrp_count; in dump_nhgrp()
496 dump_unhop(const struct user_nhop *unhop, struct nlmsghdr *hdr, in dump_unhop() argument
499 if (unhop->un_nhop_src != NULL) in dump_unhop()
500 dump_nhop(unhop->un_nhop_src, unhop->un_idx, hdr, nw); in dump_unhop()
502 dump_nhgrp(unhop, hdr, nw); in dump_unhop()
514 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop_base); in delete_unhop()
517 CHT_SLIST_REMOVE(&ctl->un_head, unhop, unhop_base, unhop_ret); in delete_unhop()
527 CHT_SLIST_REMOVE(&ctl->un_head, unhop, unhop_chain, in delete_unhop()
593 CHT_SLIST_RESIZE(&ctl->un_head, unhop, new_ptr, new_size); in consider_resize()
638 struct user_nhop *unhop, *tmp; in vnet_destroy_unhops() local
648 CHT_SLIST_FOREACH_SAFE(&ctl->un_head, unhop, unhop, tmp) { in vnet_destroy_unhops()
649 destroy_unhop(unhop); in vnet_destroy_unhops()
752 newnhg(struct unhop_ctl *ctl, struct nl_parsed_nhop *attrs, struct user_nhop *unhop) in newnhg() argument
763 struct user_nhop *unhop; in newnhg() local
764 unhop = nl_find_base_unhop(ctl, grp[i].id); in newnhg()
765 if (unhop == NULL) { in newnhg()
769 } else if (unhop->un_nhop_src == NULL) { in newnhg()
774 } else if (!eligible_nhg(unhop->un_nhop_src)) { in newnhg()
784 wn[i].nh = unhop->un_nhop_src; in newnhg()
787 unhop->un_nhgrp_src = wn; in newnhg()
788 unhop->un_nhgrp_count = count; in newnhg()
819 newnhop(struct nl_parsed_nhop *attrs, struct user_nhop *unhop, struct nl_pstate *npt) in newnhop() argument
876 unhop->un_nhop_src = nh; in newnhop()
885 struct user_nhop *unhop; in rtnl_handle_newnhop() local
911 unhop = malloc(sizeof(struct user_nhop), M_NETLINK, M_NOWAIT | M_ZERO); in rtnl_handle_newnhop()
912 if (unhop == NULL) { in rtnl_handle_newnhop()
916 unhop->un_idx = attrs.nha_id; in rtnl_handle_newnhop()
917 unhop->un_protocol = attrs.nh_protocol; in rtnl_handle_newnhop()
920 error = newnhg(ctl, &attrs, unhop); in rtnl_handle_newnhop()
922 error = newnhop(&attrs, unhop, npt); in rtnl_handle_newnhop()
925 free(unhop, M_NETLINK); in rtnl_handle_newnhop()
932 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, unhop, tmp); in rtnl_handle_newnhop()
936 destroy_unhop(unhop); in rtnl_handle_newnhop()
939 CHT_SLIST_INSERT_HEAD(&ctl->un_head, unhop, unhop); in rtnl_handle_newnhop()
957 dump_unhop(unhop, &wa.hdr, &nw); in rtnl_handle_newnhop()
991 match_unhop(const struct nl_parsed_nhop *attrs, struct user_nhop *unhop) in match_unhop() argument
993 if (attrs->nha_id != 0 && unhop->un_idx != attrs->nha_id) in match_unhop()
995 if (attrs->nha_groups != 0 && unhop->un_nhgrp_src == NULL) in match_unhop()
998 (unhop->un_nhop_src == NULL || unhop->un_nhop_src->nh_ifp != attrs->nha_oif)) in match_unhop()
1008 struct user_nhop *unhop; in rtnl_handle_getnhop() local
1034 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in rtnl_handle_getnhop()
1037 if (unhop == NULL) in rtnl_handle_getnhop()
1039 dump_unhop(unhop, &wa.hdr, wa.nw); in rtnl_handle_getnhop()
1082 CHT_SLIST_FOREACH(&ctl->un_head, unhop, unhop) { in rtnl_handle_getnhop()
1083 if (UNHOP_IS_MASTER(unhop) && match_unhop(&attrs, unhop)) in rtnl_handle_getnhop()
1084 dump_unhop(unhop, &wa.hdr, wa.nw); in rtnl_handle_getnhop()