Lines Matching refs:sc

110 #define service_range_foreach_match(sr, sc, start, end)			\  in RB_DECLARE_CALLBACKS_MAX()  argument
111 for (sr = service_range_match_first((sc)->ranges.rb_node, \ in RB_DECLARE_CALLBACKS_MAX()
282 static struct service_range *tipc_service_find_range(struct tipc_service *sc, in tipc_service_find_range() argument
287 service_range_foreach_match(sr, sc, ua->sr.lower, ua->sr.upper) { in tipc_service_find_range()
296 static struct service_range *tipc_service_create_range(struct tipc_service *sc, in tipc_service_create_range() argument
304 n = &sc->ranges.rb_node; in tipc_service_create_range()
326 rb_insert_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); in tipc_service_create_range()
331 struct tipc_service *sc, in tipc_service_insert_publ() argument
342 spin_lock_bh(&sc->lock); in tipc_service_insert_publ()
343 sr = tipc_service_create_range(sc, p); in tipc_service_insert_publ()
362 p->id = sc->publ_cnt++; in tipc_service_insert_publ()
365 list_for_each_entry_safe(sub, tmp, &sc->subscriptions, service_list) { in tipc_service_insert_publ()
373 spin_unlock_bh(&sc->lock); in tipc_service_insert_publ()
481 struct tipc_service *sc; in tipc_nametbl_insert_publ() local
488 sc = tipc_service_find(net, ua); in tipc_nametbl_insert_publ()
489 if (!sc) in tipc_nametbl_insert_publ()
490 sc = tipc_service_create(net, ua); in tipc_nametbl_insert_publ()
491 if (sc && tipc_service_insert_publ(net, sc, p)) in tipc_nametbl_insert_publ()
505 struct tipc_service *sc; in tipc_nametbl_remove_publ() local
508 sc = tipc_service_find(net, ua); in tipc_nametbl_remove_publ()
509 if (!sc) in tipc_nametbl_remove_publ()
512 spin_lock_bh(&sc->lock); in tipc_nametbl_remove_publ()
513 sr = tipc_service_find_range(sc, ua); in tipc_nametbl_remove_publ()
522 list_for_each_entry_safe(sub, tmp, &sc->subscriptions, service_list) { in tipc_nametbl_remove_publ()
528 rb_erase_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); in tipc_nametbl_remove_publ()
533 if (RB_EMPTY_ROOT(&sc->ranges) && list_empty(&sc->subscriptions)) { in tipc_nametbl_remove_publ()
534 hlist_del_init_rcu(&sc->service_list); in tipc_nametbl_remove_publ()
535 kfree_rcu(sc, rcu); in tipc_nametbl_remove_publ()
538 spin_unlock_bh(&sc->lock); in tipc_nametbl_remove_publ()
578 struct tipc_service *sc; in tipc_nametbl_lookup_anycast() local
587 sc = tipc_service_find(net, ua); in tipc_nametbl_lookup_anycast()
588 if (unlikely(!sc)) in tipc_nametbl_lookup_anycast()
591 spin_lock_bh(&sc->lock); in tipc_nametbl_lookup_anycast()
592 service_range_foreach_match(r, sc, inst, inst) { in tipc_nametbl_lookup_anycast()
616 spin_unlock_bh(&sc->lock); in tipc_nametbl_lookup_anycast()
635 struct tipc_service *sc; in tipc_nametbl_lookup_group() local
640 sc = tipc_service_find(net, ua); in tipc_nametbl_lookup_group()
641 if (unlikely(!sc)) in tipc_nametbl_lookup_group()
644 spin_lock_bh(&sc->lock); in tipc_nametbl_lookup_group()
647 sr = service_range_match_first(sc->ranges.rb_node, inst, inst); in tipc_nametbl_lookup_group()
664 spin_unlock_bh(&sc->lock); in tipc_nametbl_lookup_group()
679 struct tipc_service *sc; in tipc_nametbl_lookup_mcast_sockets() local
684 sc = tipc_service_find(net, ua); in tipc_nametbl_lookup_mcast_sockets()
685 if (!sc) in tipc_nametbl_lookup_mcast_sockets()
688 spin_lock_bh(&sc->lock); in tipc_nametbl_lookup_mcast_sockets()
689 service_range_foreach_match(sr, sc, ua->sr.lower, ua->sr.upper) { in tipc_nametbl_lookup_mcast_sockets()
695 spin_unlock_bh(&sc->lock); in tipc_nametbl_lookup_mcast_sockets()
709 struct tipc_service *sc; in tipc_nametbl_lookup_mcast_nodes() local
713 sc = tipc_service_find(net, ua); in tipc_nametbl_lookup_mcast_nodes()
714 if (!sc) in tipc_nametbl_lookup_mcast_nodes()
717 spin_lock_bh(&sc->lock); in tipc_nametbl_lookup_mcast_nodes()
718 service_range_foreach_match(sr, sc, ua->sr.lower, ua->sr.upper) { in tipc_nametbl_lookup_mcast_nodes()
723 spin_unlock_bh(&sc->lock); in tipc_nametbl_lookup_mcast_nodes()
734 struct tipc_service *sc; in tipc_nametbl_build_group() local
739 sc = tipc_service_find(net, ua); in tipc_nametbl_build_group()
740 if (!sc) in tipc_nametbl_build_group()
743 spin_lock_bh(&sc->lock); in tipc_nametbl_build_group()
744 for (n = rb_first(&sc->ranges); n; n = rb_next(n)) { in tipc_nametbl_build_group()
753 spin_unlock_bh(&sc->lock); in tipc_nametbl_build_group()
831 struct tipc_service *sc; in tipc_nametbl_subscribe() local
838 sc = tipc_service_find(sub->net, &ua); in tipc_nametbl_subscribe()
839 if (!sc) in tipc_nametbl_subscribe()
840 sc = tipc_service_create(sub->net, &ua); in tipc_nametbl_subscribe()
841 if (sc) { in tipc_nametbl_subscribe()
842 spin_lock_bh(&sc->lock); in tipc_nametbl_subscribe()
843 tipc_service_subscribe(sc, sub); in tipc_nametbl_subscribe()
844 spin_unlock_bh(&sc->lock); in tipc_nametbl_subscribe()
861 struct tipc_service *sc; in tipc_nametbl_unsubscribe() local
867 sc = tipc_service_find(sub->net, &ua); in tipc_nametbl_unsubscribe()
868 if (!sc) in tipc_nametbl_unsubscribe()
871 spin_lock_bh(&sc->lock); in tipc_nametbl_unsubscribe()
876 if (RB_EMPTY_ROOT(&sc->ranges) && list_empty(&sc->subscriptions)) { in tipc_nametbl_unsubscribe()
877 hlist_del_init_rcu(&sc->service_list); in tipc_nametbl_unsubscribe()
878 kfree_rcu(sc, rcu); in tipc_nametbl_unsubscribe()
880 spin_unlock_bh(&sc->lock); in tipc_nametbl_unsubscribe()
911 static void tipc_service_delete(struct net *net, struct tipc_service *sc) in tipc_service_delete() argument
916 spin_lock_bh(&sc->lock); in tipc_service_delete()
917 rbtree_postorder_for_each_entry_safe(sr, tmpr, &sc->ranges, tree_node) { in tipc_service_delete()
922 rb_erase_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); in tipc_service_delete()
925 hlist_del_init_rcu(&sc->service_list); in tipc_service_delete()
926 spin_unlock_bh(&sc->lock); in tipc_service_delete()
927 kfree_rcu(sc, rcu); in tipc_service_delete()
1029 struct tipc_service *sc, in __tipc_nl_service_range_list() argument
1036 for (n = rb_first(&sc->ranges); n; n = rb_next(n)) { in __tipc_nl_service_range_list()
1040 err = __tipc_nl_add_nametable_publ(msg, sc, sr, last_key); in __tipc_nl_service_range_list()