Lines Matching refs:grp

102 static void tipc_group_proto_xmit(struct tipc_group *grp, struct tipc_member *m,
115 static void tipc_group_decr_active(struct tipc_group *grp, in tipc_group_decr_active() argument
120 grp->active_cnt--; in tipc_group_decr_active()
123 static int tipc_group_rcvbuf_limit(struct tipc_group *grp) in tipc_group_rcvbuf_limit() argument
126 int mcnt = grp->member_cnt + 1; in tipc_group_rcvbuf_limit()
131 grp->max_active = max_active; in tipc_group_rcvbuf_limit()
141 u16 tipc_group_bc_snd_nxt(struct tipc_group *grp) in tipc_group_bc_snd_nxt() argument
143 return grp->bc_snd_nxt; in tipc_group_bc_snd_nxt()
156 u32 tipc_group_exclude(struct tipc_group *grp) in tipc_group_exclude() argument
158 if (!grp->loopback) in tipc_group_exclude()
159 return grp->portid; in tipc_group_exclude()
169 struct tipc_group *grp; in tipc_group_create() local
172 grp = kzalloc(sizeof(*grp), GFP_ATOMIC); in tipc_group_create()
173 if (!grp) in tipc_group_create()
175 tipc_nlist_init(&grp->dests, tipc_own_addr(net)); in tipc_group_create()
176 INIT_LIST_HEAD(&grp->small_win); in tipc_group_create()
177 INIT_LIST_HEAD(&grp->active); in tipc_group_create()
178 INIT_LIST_HEAD(&grp->pending); in tipc_group_create()
179 grp->members = RB_ROOT; in tipc_group_create()
180 grp->net = net; in tipc_group_create()
181 grp->portid = portid; in tipc_group_create()
182 grp->type = type; in tipc_group_create()
183 grp->instance = mreq->instance; in tipc_group_create()
184 grp->scope = mreq->scope; in tipc_group_create()
185 grp->loopback = mreq->flags & TIPC_GROUP_LOOPBACK; in tipc_group_create()
186 grp->events = mreq->flags & TIPC_GROUP_MEMBER_EVTS; in tipc_group_create()
187 grp->open = group_is_open; in tipc_group_create()
188 *grp->open = false; in tipc_group_create()
191 filter, &grp->subid)) in tipc_group_create()
192 return grp; in tipc_group_create()
193 kfree(grp); in tipc_group_create()
197 void tipc_group_join(struct net *net, struct tipc_group *grp, int *sk_rcvbuf) in tipc_group_join() argument
199 struct rb_root *tree = &grp->members; in tipc_group_join()
205 tipc_group_proto_xmit(grp, m, GRP_JOIN_MSG, &xmitq); in tipc_group_join()
209 *sk_rcvbuf = tipc_group_rcvbuf_limit(grp); in tipc_group_join()
212 void tipc_group_delete(struct net *net, struct tipc_group *grp) in tipc_group_delete() argument
214 struct rb_root *tree = &grp->members; in tipc_group_delete()
221 tipc_group_proto_xmit(grp, m, GRP_LEAVE_MSG, &xmitq); in tipc_group_delete()
227 tipc_nlist_purge(&grp->dests); in tipc_group_delete()
228 tipc_topsrv_kern_unsubscr(net, grp->subid); in tipc_group_delete()
229 kfree(grp); in tipc_group_delete()
232 static struct tipc_member *tipc_group_find_member(struct tipc_group *grp, in tipc_group_find_member() argument
235 struct rb_node *n = grp->members.rb_node; in tipc_group_find_member()
252 static struct tipc_member *tipc_group_find_dest(struct tipc_group *grp, in tipc_group_find_dest() argument
257 m = tipc_group_find_member(grp, node, port); in tipc_group_find_dest()
263 static struct tipc_member *tipc_group_find_node(struct tipc_group *grp, in tipc_group_find_node() argument
269 for (n = rb_first(&grp->members); n; n = rb_next(n)) { in tipc_group_find_node()
277 static int tipc_group_add_to_tree(struct tipc_group *grp, in tipc_group_add_to_tree() argument
284 n = &grp->members.rb_node; in tipc_group_add_to_tree()
298 rb_insert_color(&m->tree_node, &grp->members); in tipc_group_add_to_tree()
302 static struct tipc_member *tipc_group_create_member(struct tipc_group *grp, in tipc_group_create_member() argument
315 m->group = grp; in tipc_group_create_member()
319 m->bc_acked = grp->bc_snd_nxt - 1; in tipc_group_create_member()
320 ret = tipc_group_add_to_tree(grp, m); in tipc_group_create_member()
325 grp->member_cnt++; in tipc_group_create_member()
326 tipc_nlist_add(&grp->dests, m->node); in tipc_group_create_member()
331 void tipc_group_add_member(struct tipc_group *grp, u32 node, in tipc_group_add_member() argument
334 tipc_group_create_member(grp, node, port, instance, MBR_PUBLISHED); in tipc_group_add_member()
337 static void tipc_group_delete_member(struct tipc_group *grp, in tipc_group_delete_member() argument
340 rb_erase(&m->tree_node, &grp->members); in tipc_group_delete_member()
341 grp->member_cnt--; in tipc_group_delete_member()
344 if (grp->bc_ackers && less(m->bc_acked, grp->bc_snd_nxt - 1)) in tipc_group_delete_member()
345 grp->bc_ackers--; in tipc_group_delete_member()
349 tipc_group_decr_active(grp, m); in tipc_group_delete_member()
352 if (!tipc_group_find_node(grp, m->node)) in tipc_group_delete_member()
353 tipc_nlist_del(&grp->dests, m->node); in tipc_group_delete_member()
358 struct tipc_nlist *tipc_group_dests(struct tipc_group *grp) in tipc_group_dests() argument
360 return &grp->dests; in tipc_group_dests()
363 void tipc_group_self(struct tipc_group *grp, struct tipc_service_range *seq, in tipc_group_self() argument
366 seq->type = grp->type; in tipc_group_self()
367 seq->lower = grp->instance; in tipc_group_self()
368 seq->upper = grp->instance; in tipc_group_self()
369 *scope = grp->scope; in tipc_group_self()
374 struct tipc_group *grp = m->group; in tipc_group_update_member() local
388 list_for_each_entry_safe(_m, tmp, &grp->small_win, small_win) { in tipc_group_update_member()
395 void tipc_group_update_bc_members(struct tipc_group *grp, int len, bool ack) in tipc_group_update_bc_members() argument
397 u16 prev = grp->bc_snd_nxt - 1; in tipc_group_update_bc_members()
402 for (n = rb_first(&grp->members); n; n = rb_next(n)) { in tipc_group_update_bc_members()
413 grp->bc_ackers = ackers; in tipc_group_update_bc_members()
414 grp->bc_snd_nxt++; in tipc_group_update_bc_members()
417 bool tipc_group_cong(struct tipc_group *grp, u32 dnode, u32 dport, in tipc_group_cong() argument
424 m = tipc_group_find_dest(grp, dnode, dport); in tipc_group_cong()
434 *grp->open = false; in tipc_group_cong()
446 tipc_group_proto_xmit(grp, m, GRP_ADV_MSG, &xmitq); in tipc_group_cong()
447 tipc_node_distr_xmit(grp->net, &xmitq); in tipc_group_cong()
451 bool tipc_group_bc_cong(struct tipc_group *grp, int len) in tipc_group_bc_cong() argument
456 if (grp->bc_ackers) { in tipc_group_bc_cong()
457 *grp->open = false; in tipc_group_bc_cong()
460 if (list_empty(&grp->small_win)) in tipc_group_bc_cong()
463 m = list_first_entry(&grp->small_win, struct tipc_member, small_win); in tipc_group_bc_cong()
467 return tipc_group_cong(grp, m->node, m->port, len, &m); in tipc_group_bc_cong()
496 void tipc_group_filter_msg(struct tipc_group *grp, struct sk_buff_head *inputq, in tipc_group_filter_msg() argument
517 m = tipc_group_find_member(grp, node, port); in tipc_group_filter_msg()
542 if (msg_nameinst(hdr) != grp->instance) { in tipc_group_filter_msg()
556 if (!grp->events) in tipc_group_filter_msg()
571 tipc_group_proto_xmit(grp, m, GRP_ACK_MSG, xmitq); in tipc_group_filter_msg()
575 tipc_group_delete_member(grp, m); in tipc_group_filter_msg()
581 tipc_group_update_rcv_win(grp, blks, node, port, xmitq); in tipc_group_filter_msg()
588 void tipc_group_update_rcv_win(struct tipc_group *grp, int blks, u32 node, in tipc_group_update_rcv_win() argument
591 struct list_head *active = &grp->active; in tipc_group_update_rcv_win()
592 int max_active = grp->max_active; in tipc_group_update_rcv_win()
594 int active_cnt = grp->active_cnt; in tipc_group_update_rcv_win()
597 m = tipc_group_find_member(grp, node, port); in tipc_group_update_rcv_win()
609 grp->active_cnt++; in tipc_group_update_rcv_win()
610 tipc_group_proto_xmit(grp, m, GRP_ADV_MSG, xmitq); in tipc_group_update_rcv_win()
613 list_add_tail(&m->list, &grp->pending); in tipc_group_update_rcv_win()
624 tipc_group_proto_xmit(grp, rm, GRP_RECLAIM_MSG, xmitq); in tipc_group_update_rcv_win()
628 pm = list_first_entry(&grp->pending, struct tipc_member, list); in tipc_group_update_rcv_win()
631 tipc_group_proto_xmit(grp, pm, GRP_ADV_MSG, xmitq); in tipc_group_update_rcv_win()
634 if (!list_is_last(&m->list, &grp->active)) in tipc_group_update_rcv_win()
635 list_move_tail(&m->list, &grp->active); in tipc_group_update_rcv_win()
638 tipc_group_proto_xmit(grp, m, GRP_ADV_MSG, xmitq); in tipc_group_update_rcv_win()
644 grp->active_cnt--; in tipc_group_update_rcv_win()
647 tipc_group_proto_xmit(grp, m, GRP_ADV_MSG, xmitq); in tipc_group_update_rcv_win()
650 if (list_empty(&grp->pending)) in tipc_group_update_rcv_win()
654 pm = list_first_entry(&grp->pending, struct tipc_member, list); in tipc_group_update_rcv_win()
656 list_move_tail(&pm->list, &grp->active); in tipc_group_update_rcv_win()
657 grp->active_cnt++; in tipc_group_update_rcv_win()
658 tipc_group_proto_xmit(grp, pm, GRP_ADV_MSG, xmitq); in tipc_group_update_rcv_win()
668 static void tipc_group_create_event(struct tipc_group *grp, in tipc_group_create_event() argument
672 { u32 dnode = tipc_own_addr(grp->net); in tipc_group_create_event()
683 evt.s.seq.type = grp->type; in tipc_group_create_event()
689 grp->portid, m->port, 0); in tipc_group_create_event()
694 msg_set_nametype(hdr, grp->type); in tipc_group_create_event()
703 static void tipc_group_proto_xmit(struct tipc_group *grp, struct tipc_member *m, in tipc_group_proto_xmit() argument
711 m->node, tipc_own_addr(grp->net), in tipc_group_proto_xmit()
712 m->port, grp->portid, 0); in tipc_group_proto_xmit()
724 msg_set_grp_bc_syncpt(hdr, grp->bc_snd_nxt); in tipc_group_proto_xmit()
728 msg_set_grp_bc_syncpt(hdr, grp->bc_snd_nxt); in tipc_group_proto_xmit()
741 void tipc_group_proto_rcv(struct tipc_group *grp, bool *usr_wakeup, in tipc_group_proto_rcv() argument
750 if (!grp) in tipc_group_proto_rcv()
753 if (grp->scope == TIPC_NODE_SCOPE && node != tipc_own_addr(grp->net)) in tipc_group_proto_rcv()
756 m = tipc_group_find_member(grp, node, port); in tipc_group_proto_rcv()
761 m = tipc_group_create_member(grp, node, port, in tipc_group_proto_rcv()
777 tipc_group_proto_xmit(grp, m, GRP_ADV_MSG, xmitq); in tipc_group_proto_rcv()
778 tipc_group_create_event(grp, m, TIPC_PUBLISHED, in tipc_group_proto_rcv()
787 tipc_group_decr_active(grp, m); in tipc_group_proto_rcv()
789 tipc_group_create_event(grp, m, TIPC_WITHDRAWN, in tipc_group_proto_rcv()
802 if (--grp->bc_ackers) in tipc_group_proto_rcv()
812 tipc_group_proto_xmit(grp, m, GRP_REMIT_MSG, xmitq); in tipc_group_proto_rcv()
835 grp->active_cnt--; in tipc_group_proto_rcv()
839 if (list_empty(&grp->pending)) in tipc_group_proto_rcv()
841 pm = list_first_entry(&grp->pending, struct tipc_member, list); in tipc_group_proto_rcv()
843 list_move_tail(&pm->list, &grp->active); in tipc_group_proto_rcv()
844 grp->active_cnt++; in tipc_group_proto_rcv()
846 tipc_group_proto_xmit(grp, pm, GRP_ADV_MSG, xmitq); in tipc_group_proto_rcv()
855 void tipc_group_member_evt(struct tipc_group *grp, in tipc_group_member_evt() argument
871 if (!grp) in tipc_group_member_evt()
874 net = grp->net; in tipc_group_member_evt()
876 if (!grp->loopback && node == self && port == grp->portid) in tipc_group_member_evt()
879 m = tipc_group_find_member(grp, node, port); in tipc_group_member_evt()
885 m = tipc_group_create_member(grp, node, port, instance, in tipc_group_member_evt()
890 tipc_group_proto_xmit(grp, m, GRP_JOIN_MSG, xmitq); in tipc_group_member_evt()
902 tipc_group_proto_xmit(grp, m, GRP_JOIN_MSG, xmitq); in tipc_group_member_evt()
903 tipc_group_create_event(grp, m, TIPC_PUBLISHED, in tipc_group_member_evt()
910 tipc_group_decr_active(grp, m); in tipc_group_member_evt()
917 tipc_group_create_event(grp, m, TIPC_WITHDRAWN, in tipc_group_member_evt()
923 *sk_rcvbuf = tipc_group_rcvbuf_limit(grp); in tipc_group_member_evt()
926 int tipc_group_fill_sock_diag(struct tipc_group *grp, struct sk_buff *skb) in tipc_group_fill_sock_diag() argument
934 grp->type) || in tipc_group_fill_sock_diag()
936 grp->instance) || in tipc_group_fill_sock_diag()
938 grp->bc_snd_nxt)) in tipc_group_fill_sock_diag()
941 if (grp->scope == TIPC_NODE_SCOPE) in tipc_group_fill_sock_diag()
945 if (grp->scope == TIPC_CLUSTER_SCOPE) in tipc_group_fill_sock_diag()
949 if (*grp->open) in tipc_group_fill_sock_diag()