Lines Matching refs:sr

91 #define service_range_upper(sr) ((sr)->upper)  argument
99 #define service_range_overlap(sr, start, end) \ in RB_DECLARE_CALLBACKS_MAX() argument
100 ((sr)->lower <= (end) && (sr)->upper >= (start)) in RB_DECLARE_CALLBACKS_MAX()
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()
114 sr; \
115 sr = service_range_match_next(&(sr)->tree_node, \
131 struct service_range *sr; local
152 sr = service_range_entry(n);
153 if (service_range_overlap(sr, start, end))
154 return sr;
158 if (sr->lower <= end &&
181 struct service_range *sr; in service_range_match_next() local
203 sr = service_range_entry(p); in service_range_match_next()
204 if (service_range_overlap(sr, start, end)) in service_range_match_next()
205 return sr; in service_range_match_next()
208 if (sr->lower <= end) { in service_range_match_next()
238 p->sr = ua->sr; in tipc_publ_create()
271 service->type = ua->sr.type; in tipc_service_create()
275 hd = &nt->services[hash(ua->sr.type)]; in tipc_service_create()
285 struct service_range *sr; in tipc_service_find_range() local
287 service_range_foreach_match(sr, sc, ua->sr.lower, ua->sr.upper) { in tipc_service_find_range()
289 if (sr->lower == ua->sr.lower && sr->upper == ua->sr.upper) in tipc_service_find_range()
290 return sr; in tipc_service_find_range()
300 struct service_range *sr; in tipc_service_create_range() local
301 u32 lower = p->sr.lower; in tipc_service_create_range()
302 u32 upper = p->sr.upper; in tipc_service_create_range()
307 sr = service_range_entry(parent); in tipc_service_create_range()
308 if (lower == sr->lower && upper == sr->upper) in tipc_service_create_range()
309 return sr; in tipc_service_create_range()
310 if (sr->max < upper) in tipc_service_create_range()
311 sr->max = upper; in tipc_service_create_range()
312 if (lower <= sr->lower) in tipc_service_create_range()
317 sr = kzalloc(sizeof(*sr), GFP_ATOMIC); in tipc_service_create_range()
318 if (!sr) in tipc_service_create_range()
320 sr->lower = lower; in tipc_service_create_range()
321 sr->upper = upper; in tipc_service_create_range()
322 sr->max = upper; in tipc_service_create_range()
323 INIT_LIST_HEAD(&sr->local_publ); in tipc_service_create_range()
324 INIT_LIST_HEAD(&sr->all_publ); in tipc_service_create_range()
325 rb_link_node(&sr->tree_node, parent, n); in tipc_service_create_range()
326 rb_insert_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); in tipc_service_create_range()
327 return sr; in tipc_service_create_range()
335 struct service_range *sr; in tipc_service_insert_publ() local
343 sr = tipc_service_create_range(sc, p); in tipc_service_insert_publ()
344 if (!sr) in tipc_service_insert_publ()
347 first = list_empty(&sr->all_publ); in tipc_service_insert_publ()
350 list_for_each_entry(_p, &sr->all_publ, all_publ) { in tipc_service_insert_publ()
353 p->sr.type, p->sr.lower, p->sr.upper, in tipc_service_insert_publ()
360 list_add(&p->local_publ, &sr->local_publ); in tipc_service_insert_publ()
361 list_add(&p->all_publ, &sr->all_publ); in tipc_service_insert_publ()
372 p->sr.type, p->sr.lower, p->sr.upper); in tipc_service_insert_publ()
426 struct service_range *sr; in tipc_service_subscribe() local
440 service_range_foreach_match(sr, service, lower, upper) { in tipc_service_subscribe()
442 list_for_each_entry(p, &sr->all_publ, all_publ) { in tipc_service_subscribe()
468 service_head = &nt->services[hash(ua->sr.type)]; in tipc_service_find()
470 if (service->type == ua->sr.type) in tipc_service_find()
504 struct service_range *sr; in tipc_nametbl_remove_publ() local
513 sr = tipc_service_find_range(sc, ua); in tipc_nametbl_remove_publ()
514 if (!sr) in tipc_nametbl_remove_publ()
516 p = tipc_service_remove_publ(sr, sk, key); in tipc_nametbl_remove_publ()
521 last = list_empty(&sr->all_publ); in tipc_nametbl_remove_publ()
527 if (list_empty(&sr->all_publ)) { in tipc_nametbl_remove_publ()
528 rb_erase_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); in tipc_nametbl_remove_publ()
529 kfree(sr); in tipc_nametbl_remove_publ()
542 ua->sr.type, ua->sr.lower, ua->sr.upper, in tipc_nametbl_remove_publ()
634 struct service_range *sr; in tipc_nametbl_lookup_group() local
647 sr = service_range_match_first(sc->ranges.rb_node, inst, inst); in tipc_nametbl_lookup_group()
648 if (!sr) in tipc_nametbl_lookup_group()
651 list_for_each_entry(p, &sr->all_publ, all_publ) { in tipc_nametbl_lookup_group()
660 list_move_tail(&p->all_publ, &sr->all_publ); in tipc_nametbl_lookup_group()
678 struct service_range *sr; in tipc_nametbl_lookup_mcast_sockets() local
689 service_range_foreach_match(sr, sc, ua->sr.lower, ua->sr.upper) { in tipc_nametbl_lookup_mcast_sockets()
690 list_for_each_entry(p, &sr->local_publ, local_publ) { in tipc_nametbl_lookup_mcast_sockets()
708 struct service_range *sr; in tipc_nametbl_lookup_mcast_nodes() local
718 service_range_foreach_match(sr, sc, ua->sr.lower, ua->sr.upper) { in tipc_nametbl_lookup_mcast_nodes()
719 list_for_each_entry(p, &sr->all_publ, all_publ) { in tipc_nametbl_lookup_mcast_nodes()
733 struct service_range *sr; in tipc_nametbl_build_group() local
745 sr = container_of(n, struct service_range, tree_node); in tipc_nametbl_build_group()
746 list_for_each_entry(p, &sr->all_publ, all_publ) { in tipc_nametbl_build_group()
750 p->sr.lower); in tipc_nametbl_build_group()
913 struct service_range *sr, *tmpr; in tipc_service_delete() local
917 rbtree_postorder_for_each_entry_safe(sr, tmpr, &sc->ranges, tree_node) { in tipc_service_delete()
918 list_for_each_entry_safe(p, tmp, &sr->all_publ, all_publ) { in tipc_service_delete()
919 tipc_service_remove_publ(sr, &p->sk, p->key); in tipc_service_delete()
922 rb_erase_augmented(&sr->tree_node, &sc->ranges, &sr_callbacks); in tipc_service_delete()
923 kfree(sr); in tipc_service_delete()
958 struct service_range *sr, in __tipc_nl_add_nametable_publ() argument
967 list_for_each_entry(p, &sr->all_publ, all_publ) in __tipc_nl_add_nametable_publ()
970 if (list_entry_is_head(p, &sr->all_publ, all_publ)) in __tipc_nl_add_nametable_publ()
973 p = list_first_entry(&sr->all_publ, in __tipc_nl_add_nametable_publ()
978 list_for_each_entry_from(p, &sr->all_publ, all_publ) { in __tipc_nl_add_nametable_publ()
997 if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_LOWER, sr->lower)) in __tipc_nl_add_nametable_publ()
999 if (nla_put_u32(msg->skb, TIPC_NLA_PUBL_UPPER, sr->upper)) in __tipc_nl_add_nametable_publ()
1032 struct service_range *sr; in __tipc_nl_service_range_list() local
1037 sr = container_of(n, struct service_range, tree_node); in __tipc_nl_service_range_list()
1038 if (sr->lower < *last_lower) in __tipc_nl_service_range_list()
1040 err = __tipc_nl_add_nametable_publ(msg, sc, sr, last_key); in __tipc_nl_service_range_list()
1042 *last_lower = sr->lower; in __tipc_nl_service_range_list()