Lines Matching refs:peer
166 static struct tipc_peer *peer_prev(struct tipc_peer *peer) in peer_prev() argument
168 return list_last_entry(&peer->list, struct tipc_peer, list); in peer_prev()
171 static struct tipc_peer *peer_nxt(struct tipc_peer *peer) in peer_nxt() argument
173 return list_first_entry(&peer->list, struct tipc_peer, list); in peer_nxt()
176 static struct tipc_peer *peer_head(struct tipc_peer *peer) in peer_head() argument
178 while (!peer->is_head) in peer_head()
179 peer = peer_prev(peer); in peer_head()
180 return peer; in peer_head()
185 struct tipc_peer *peer; in get_peer() local
188 hlist_for_each_entry(peer, &mon->peers[thash], hash) { in get_peer()
189 if (peer->addr == addr) in get_peer()
190 return peer; in get_peer()
211 static void mon_identify_lost_members(struct tipc_peer *peer, in mon_identify_lost_members() argument
215 struct tipc_peer *member = peer; in mon_identify_lost_members()
216 struct tipc_mon_domain *dom_aft = peer->domain; in mon_identify_lost_members()
217 int applied_aft = peer->applied; in mon_identify_lost_members()
246 struct tipc_peer *peer) in mon_apply_domain() argument
248 struct tipc_mon_domain *dom = peer->domain; in mon_apply_domain()
253 if (!dom || !peer->is_up) in mon_apply_domain()
257 peer->applied = 0; in mon_apply_domain()
258 member = peer_nxt(peer); in mon_apply_domain()
263 peer->applied++; in mon_apply_domain()
275 struct tipc_peer *peer = self; in mon_update_local_domain() local
289 peer = peer_nxt(peer); in mon_update_local_domain()
290 diff |= dom->members[i] != peer->addr; in mon_update_local_domain()
291 dom->members[i] = peer->addr; in mon_update_local_domain()
292 map_set(&dom->up_map, i, peer->is_up); in mon_update_local_domain()
293 cache->members[i] = mon_cpu_to_le32(peer->addr); in mon_update_local_domain()
309 struct tipc_peer *peer) in mon_update_neighbors() argument
315 mon_apply_domain(mon, peer); in mon_update_neighbors()
316 peer = peer_prev(peer); in mon_update_neighbors()
326 struct tipc_peer *peer = peer_nxt(head); in mon_assign_roles() local
330 for (; peer != self; peer = peer_nxt(peer)) { in mon_assign_roles()
331 peer->is_local = false; in mon_assign_roles()
335 peer->is_head = false; in mon_assign_roles()
337 peer->is_local = true; in mon_assign_roles()
341 if (!peer->is_up) in mon_assign_roles()
343 if (peer->is_head) in mon_assign_roles()
345 head = peer; in mon_assign_roles()
356 struct tipc_peer *peer, *prev, *head; in tipc_mon_remove_peer() local
363 peer = get_peer(mon, addr); in tipc_mon_remove_peer()
364 if (!peer) in tipc_mon_remove_peer()
366 prev = peer_prev(peer); in tipc_mon_remove_peer()
367 list_del(&peer->list); in tipc_mon_remove_peer()
368 hlist_del(&peer->hash); in tipc_mon_remove_peer()
369 kfree(peer->domain); in tipc_mon_remove_peer()
370 kfree(peer); in tipc_mon_remove_peer()
379 list_for_each_entry(peer, &self->list, list) { in tipc_mon_remove_peer()
380 kfree(peer->domain); in tipc_mon_remove_peer()
381 peer->domain = NULL; in tipc_mon_remove_peer()
382 peer->applied = 0; in tipc_mon_remove_peer()
391 struct tipc_peer **peer) in tipc_mon_add_peer() argument
397 *peer = p; in tipc_mon_add_peer()
426 struct tipc_peer *peer, *head; in tipc_mon_peer_up() local
429 peer = get_peer(mon, addr); in tipc_mon_peer_up()
430 if (!peer && !tipc_mon_add_peer(mon, addr, &peer)) in tipc_mon_peer_up()
432 peer->is_up = true; in tipc_mon_peer_up()
433 head = peer_head(peer); in tipc_mon_peer_up()
445 struct tipc_peer *peer, *head; in tipc_mon_peer_down() local
454 peer = get_peer(mon, addr); in tipc_mon_peer_down()
455 if (!peer) { in tipc_mon_peer_down()
459 applied = peer->applied; in tipc_mon_peer_down()
460 peer->applied = 0; in tipc_mon_peer_down()
461 dom = peer->domain; in tipc_mon_peer_down()
462 peer->domain = NULL; in tipc_mon_peer_down()
463 if (peer->is_head) in tipc_mon_peer_down()
464 mon_identify_lost_members(peer, dom, applied); in tipc_mon_peer_down()
466 peer->is_up = false; in tipc_mon_peer_down()
467 peer->is_head = false; in tipc_mon_peer_down()
468 peer->is_local = false; in tipc_mon_peer_down()
469 peer->down_cnt = 0; in tipc_mon_peer_down()
470 head = peer_head(peer); in tipc_mon_peer_down()
487 struct tipc_peer *peer; in tipc_mon_rcv() local
523 peer = get_peer(mon, addr); in tipc_mon_rcv()
524 if (!peer || !peer->is_up) in tipc_mon_rcv()
528 peer->down_cnt = 0; in tipc_mon_rcv()
538 dom = peer->domain; in tipc_mon_rcv()
546 peer->domain = dom; in tipc_mon_rcv()
558 applied_bef = peer->applied; in tipc_mon_rcv()
559 mon_apply_domain(mon, peer); in tipc_mon_rcv()
560 mon_identify_lost_members(peer, &dom_bef, applied_bef); in tipc_mon_rcv()
561 mon_assign_roles(mon, peer_head(peer)); in tipc_mon_rcv()
604 struct tipc_peer *peer; in tipc_mon_get_state() local
619 peer = get_peer(mon, addr); in tipc_mon_get_state()
620 if (peer) { in tipc_mon_get_state()
622 state->probing |= peer->down_cnt; in tipc_mon_get_state()
623 state->reset |= peer->down_cnt >= MAX_PEER_DOWN_EVENTS; in tipc_mon_get_state()
624 state->monitoring = peer->is_local; in tipc_mon_get_state()
625 state->monitoring |= peer->is_head; in tipc_mon_get_state()
687 struct tipc_peer *peer, *tmp; in tipc_mon_delete() local
695 list_for_each_entry_safe(peer, tmp, &self->list, list) { in tipc_mon_delete()
696 list_del(&peer->list); in tipc_mon_delete()
697 hlist_del(&peer->hash); in tipc_mon_delete()
698 kfree(peer->domain); in tipc_mon_delete()
699 kfree(peer); in tipc_mon_delete()
743 static int __tipc_nl_add_monitor_peer(struct tipc_peer *peer, in __tipc_nl_add_monitor_peer() argument
746 struct tipc_mon_domain *dom = peer->domain; in __tipc_nl_add_monitor_peer()
759 if (nla_put_u32(msg->skb, TIPC_NLA_MON_PEER_ADDR, peer->addr)) in __tipc_nl_add_monitor_peer()
761 if (nla_put_u32(msg->skb, TIPC_NLA_MON_PEER_APPLIED, peer->applied)) in __tipc_nl_add_monitor_peer()
764 if (peer->is_up) in __tipc_nl_add_monitor_peer()
767 if (peer->is_local) in __tipc_nl_add_monitor_peer()
770 if (peer->is_head) in __tipc_nl_add_monitor_peer()
801 struct tipc_peer *peer; in tipc_nl_add_monitor_peer() local
807 peer = mon->self; in tipc_nl_add_monitor_peer()
810 if (peer->addr == *prev_node) in tipc_nl_add_monitor_peer()
815 if (__tipc_nl_add_monitor_peer(peer, msg)) { in tipc_nl_add_monitor_peer()
816 *prev_node = peer->addr; in tipc_nl_add_monitor_peer()
820 } while ((peer = peer_nxt(peer)) != mon->self); in tipc_nl_add_monitor_peer()