Lines Matching refs:ctl

116 static void consider_resize(struct unhop_ctl *ctl, uint32_t new_size);
156 struct unhop_ctl *ctl = atomic_load_ptr(&V_un_ctl); in nl_find_nhop() local
159 if (__predict_false(ctl == NULL)) in nl_find_nhop()
173 UN_RLOCK(ctl); in nl_find_nhop()
174 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in nl_find_nhop()
177 UN_RLOCK(ctl); in nl_find_nhop()
187 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in nl_find_nhop()
189 UN_RUNLOCK(ctl); in nl_find_nhop()
194 UN_RUNLOCK(ctl); in nl_find_nhop()
215 UN_WLOCK(ctl); in nl_find_nhop()
218 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in nl_find_nhop()
221 UN_WUNLOCK(ctl); 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()
243 UN_WUNLOCK(ctl); in nl_find_nhop()
254 nl_find_base_unhop(struct unhop_ctl *ctl, uint32_t uidx) in nl_find_base_unhop() argument
260 UN_RLOCK(ctl); in nl_find_base_unhop()
261 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in nl_find_base_unhop()
262 UN_RUNLOCK(ctl); in nl_find_base_unhop()
356 find_spare_uidx(struct unhop_ctl *ctl) in find_spare_uidx() argument
362 UN_RLOCK(ctl); in find_spare_uidx()
366 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in find_spare_uidx()
372 UN_RUNLOCK(ctl); in find_spare_uidx()
506 delete_unhop(struct unhop_ctl *ctl, struct nlmsghdr *hdr, uint32_t uidx) in delete_unhop() argument
512 UN_WLOCK(ctl); in delete_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()
541 UN_WUNLOCK(ctl); in delete_unhop()
575 consider_resize(struct unhop_ctl *ctl, uint32_t new_size) in consider_resize() argument
590 NL_LOG(LOG_DEBUG, "resizing hash: %u -> %u", ctl->un_head.hash_size, new_size); in consider_resize()
591 UN_WLOCK(ctl); in consider_resize()
593 CHT_SLIST_RESIZE(&ctl->un_head, unhop, new_ptr, new_size); in consider_resize()
595 UN_WUNLOCK(ctl); in consider_resize()
608 struct unhop_ctl *ctl = malloc(sizeof(struct unhop_ctl), M_NETLINK, in vnet_init_unhops() local
610 if (ctl == NULL) in vnet_init_unhops()
615 free(ctl, M_NETLINK); in vnet_init_unhops()
618 CHT_SLIST_INIT(&ctl->un_head, ptr, num_buckets); in vnet_init_unhops()
619 UN_LOCK_INIT(ctl); in vnet_init_unhops()
621 if (!atomic_cmpset_ptr((uintptr_t *)&V_un_ctl, (uintptr_t)NULL, (uintptr_t)ctl)) { in vnet_init_unhops()
623 free(ctl, M_NETLINK); in vnet_init_unhops()
637 struct unhop_ctl *ctl = atomic_load_ptr(&V_un_ctl); in vnet_destroy_unhops() local
640 if (ctl == NULL) in vnet_destroy_unhops()
647 UN_WLOCK(ctl); in vnet_destroy_unhops()
648 CHT_SLIST_FOREACH_SAFE(&ctl->un_head, unhop, unhop, tmp) { in vnet_destroy_unhops()
651 UN_WUNLOCK(ctl); in vnet_destroy_unhops()
653 free(ctl->un_head.ptr, M_NETLINK); in vnet_destroy_unhops()
654 free(ctl, M_NETLINK); in vnet_destroy_unhops()
752 newnhg(struct unhop_ctl *ctl, struct nl_parsed_nhop *attrs, struct user_nhop *unhop) in newnhg() argument
764 unhop = nl_find_base_unhop(ctl, grp[i].id); in newnhg()
890 struct unhop_ctl *ctl = V_un_ctl; in rtnl_handle_newnhop() local
902 attrs.nha_id = find_spare_uidx(ctl); in rtnl_handle_newnhop()
920 error = newnhg(ctl, &attrs, unhop); in rtnl_handle_newnhop()
929 UN_WLOCK(ctl); in rtnl_handle_newnhop()
932 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, unhop, tmp); in rtnl_handle_newnhop()
934 UN_WUNLOCK(ctl); in rtnl_handle_newnhop()
939 CHT_SLIST_INSERT_HEAD(&ctl->un_head, unhop, unhop); in rtnl_handle_newnhop()
940 uint32_t num_buckets_new = CHT_SLIST_GET_RESIZE_BUCKETS(&ctl->un_head); in rtnl_handle_newnhop()
941 UN_WUNLOCK(ctl); in rtnl_handle_newnhop()
960 consider_resize(ctl, num_buckets_new); in rtnl_handle_newnhop()
969 struct unhop_ctl *ctl = atomic_load_ptr(&V_un_ctl); in rtnl_handle_delnhop() local
972 if (__predict_false(ctl == NULL)) in rtnl_handle_delnhop()
985 error = delete_unhop(ctl, hdr, attrs.nha_id); in rtnl_handle_delnhop()
1026 struct unhop_ctl *ctl = atomic_load_ptr(&V_un_ctl); in rtnl_handle_getnhop() local
1029 if (__predict_false(ctl == NULL)) in rtnl_handle_getnhop()
1033 UN_RLOCK(ctl); in rtnl_handle_getnhop()
1034 CHT_SLIST_FIND_BYOBJ(&ctl->un_head, unhop, &key, unhop); in rtnl_handle_getnhop()
1035 UN_RUNLOCK(ctl); in rtnl_handle_getnhop()
1074 struct unhop_ctl *ctl = atomic_load_ptr(&V_un_ctl); in rtnl_handle_getnhop() local
1076 if (__predict_false(ctl == NULL)) in rtnl_handle_getnhop()
1080 UN_RLOCK(ctl); in rtnl_handle_getnhop()
1082 CHT_SLIST_FOREACH(&ctl->un_head, unhop, unhop) { in rtnl_handle_getnhop()
1086 UN_RUNLOCK(ctl); in rtnl_handle_getnhop()