Lines Matching full:peer
49 * @ack_gen: most recent generation of self's domain acked by peer
63 /* struct tipc_peer: state of a peer node and its domain
64 * @addr: tipc node identity of peer
65 * @head_map: shows which other nodes currently consider peer 'up'
66 * @domain: most recent domain record from peer
70 * @is_up: peer is up as seen from this node
71 * @is_head: peer is assigned domain head as seen from this node
72 * @is_local: peer is in local domain and should be continuously monitored
136 static struct tipc_peer *peer_prev(struct tipc_peer *peer) in peer_prev() argument
138 return list_last_entry(&peer->list, struct tipc_peer, list); in peer_prev()
141 static struct tipc_peer *peer_nxt(struct tipc_peer *peer) in peer_nxt() argument
143 return list_first_entry(&peer->list, struct tipc_peer, list); in peer_nxt()
146 static struct tipc_peer *peer_head(struct tipc_peer *peer) in peer_head() argument
148 while (!peer->is_head) in peer_head()
149 peer = peer_prev(peer); in peer_head()
150 return peer; in peer_head()
155 struct tipc_peer *peer; in get_peer() local
158 hlist_for_each_entry(peer, &mon->peers[thash], hash) { in get_peer()
159 if (peer->addr == addr) in get_peer()
160 return peer; in get_peer()
181 static void mon_identify_lost_members(struct tipc_peer *peer, in mon_identify_lost_members() argument
185 struct tipc_peer *member = peer; in mon_identify_lost_members()
186 struct tipc_mon_domain *dom_aft = peer->domain; in mon_identify_lost_members()
187 int applied_aft = peer->applied; in mon_identify_lost_members()
193 /* Do nothing if self or peer already see member as down */ in mon_identify_lost_members()
213 /* mon_apply_domain() : match a peer's domain record against monitor list
216 struct tipc_peer *peer) in mon_apply_domain() argument
218 struct tipc_mon_domain *dom = peer->domain; in mon_apply_domain()
223 if (!dom || !peer->is_up) in mon_apply_domain()
227 peer->applied = 0; in mon_apply_domain()
228 member = peer_nxt(peer); in mon_apply_domain()
233 peer->applied++; in mon_apply_domain()
238 /* mon_update_local_domain() : update after peer addition/removal/up/down
245 struct tipc_peer *peer = self; in mon_update_local_domain() local
259 peer = peer_nxt(peer); in mon_update_local_domain()
260 diff |= dom->members[i] != peer->addr; in mon_update_local_domain()
261 dom->members[i] = peer->addr; in mon_update_local_domain()
262 map_set(&dom->up_map, i, peer->is_up); in mon_update_local_domain()
263 cache->members[i] = htonl(peer->addr); in mon_update_local_domain()
276 /* mon_update_neighbors() : update preceding neighbors of added/removed peer
279 struct tipc_peer *peer) in mon_update_neighbors() argument
285 mon_apply_domain(mon, peer); in mon_update_neighbors()
286 peer = peer_prev(peer); in mon_update_neighbors()
290 /* mon_assign_roles() : reassign peer roles after a network change
291 * The monitor list is consistent at this stage; i.e., each peer is monitoring
296 struct tipc_peer *peer = peer_nxt(head); in mon_assign_roles() local
300 for (; peer != self; peer = peer_nxt(peer)) { in mon_assign_roles()
301 peer->is_local = false; in mon_assign_roles()
305 peer->is_head = false; in mon_assign_roles()
307 peer->is_local = true; in mon_assign_roles()
311 if (!peer->is_up) in mon_assign_roles()
313 if (peer->is_head) in mon_assign_roles()
315 head = peer; in mon_assign_roles()
326 struct tipc_peer *peer, *prev, *head; in tipc_mon_remove_peer() local
333 peer = get_peer(mon, addr); in tipc_mon_remove_peer()
334 if (!peer) in tipc_mon_remove_peer()
336 prev = peer_prev(peer); in tipc_mon_remove_peer()
337 list_del(&peer->list); in tipc_mon_remove_peer()
338 hlist_del(&peer->hash); in tipc_mon_remove_peer()
339 kfree(peer->domain); in tipc_mon_remove_peer()
340 kfree(peer); in tipc_mon_remove_peer()
349 list_for_each_entry(peer, &self->list, list) { in tipc_mon_remove_peer()
350 kfree(peer->domain); in tipc_mon_remove_peer()
351 peer->domain = NULL; in tipc_mon_remove_peer()
352 peer->applied = 0; in tipc_mon_remove_peer()
361 struct tipc_peer **peer) in tipc_mon_add_peer() argument
367 *peer = p; in tipc_mon_add_peer()
372 /* Add new peer to lookup list */ in tipc_mon_add_peer()
376 /* Sort new peer into iterator list, in ascending circular order */ in tipc_mon_add_peer()
396 struct tipc_peer *peer, *head; in tipc_mon_peer_up() local
399 peer = get_peer(mon, addr); in tipc_mon_peer_up()
400 if (!peer && !tipc_mon_add_peer(mon, addr, &peer)) in tipc_mon_peer_up()
402 peer->is_up = true; in tipc_mon_peer_up()
403 head = peer_head(peer); in tipc_mon_peer_up()
415 struct tipc_peer *peer, *head; in tipc_mon_peer_down() local
424 peer = get_peer(mon, addr); in tipc_mon_peer_down()
425 if (!peer) { in tipc_mon_peer_down()
429 applied = peer->applied; in tipc_mon_peer_down()
430 peer->applied = 0; in tipc_mon_peer_down()
431 dom = peer->domain; in tipc_mon_peer_down()
432 peer->domain = NULL; in tipc_mon_peer_down()
433 if (peer->is_head) in tipc_mon_peer_down()
434 mon_identify_lost_members(peer, dom, applied); in tipc_mon_peer_down()
436 peer->is_up = false; in tipc_mon_peer_down()
437 peer->is_head = false; in tipc_mon_peer_down()
438 peer->is_local = false; in tipc_mon_peer_down()
439 peer->down_cnt = 0; in tipc_mon_peer_down()
440 head = peer_head(peer); in tipc_mon_peer_down()
457 struct tipc_peer *peer; in tipc_mon_rcv() local
475 /* Synch generation numbers with peer if link just came up */ in tipc_mon_rcv()
490 peer = get_peer(mon, addr); in tipc_mon_rcv()
491 if (!peer || !peer->is_up) in tipc_mon_rcv()
494 /* Peer is confirmed, stop any ongoing probing */ in tipc_mon_rcv()
495 peer->down_cnt = 0; in tipc_mon_rcv()
505 dom = peer->domain; in tipc_mon_rcv()
513 peer->domain = dom; in tipc_mon_rcv()
525 applied_bef = peer->applied; in tipc_mon_rcv()
526 mon_apply_domain(mon, peer); in tipc_mon_rcv()
527 mon_identify_lost_members(peer, &dom_bef, applied_bef); in tipc_mon_rcv()
528 mon_assign_roles(mon, peer_head(peer)); in tipc_mon_rcv()
547 /* Send only a dummy record with ack if peer has acked our last sent */ in tipc_mon_prep()
571 struct tipc_peer *peer; in tipc_mon_get_state() local
586 peer = get_peer(mon, addr); in tipc_mon_get_state()
587 if (peer) { in tipc_mon_get_state()
589 state->probing |= peer->down_cnt; in tipc_mon_get_state()
590 state->reset |= peer->down_cnt >= MAX_PEER_DOWN_EVENTS; in tipc_mon_get_state()
591 state->monitoring = peer->is_local; in tipc_mon_get_state()
592 state->monitoring |= peer->is_head; in tipc_mon_get_state()
654 struct tipc_peer *peer, *tmp; in tipc_mon_delete() local
662 list_for_each_entry_safe(peer, tmp, &self->list, list) { in tipc_mon_delete()
663 list_del(&peer->list); in tipc_mon_delete()
664 hlist_del(&peer->hash); in tipc_mon_delete()
665 kfree(peer->domain); in tipc_mon_delete()
666 kfree(peer); in tipc_mon_delete()
710 static int __tipc_nl_add_monitor_peer(struct tipc_peer *peer, in __tipc_nl_add_monitor_peer() argument
713 struct tipc_mon_domain *dom = peer->domain; in __tipc_nl_add_monitor_peer()
726 if (nla_put_u32(msg->skb, TIPC_NLA_MON_PEER_ADDR, peer->addr)) in __tipc_nl_add_monitor_peer()
728 if (nla_put_u32(msg->skb, TIPC_NLA_MON_PEER_APPLIED, peer->applied)) in __tipc_nl_add_monitor_peer()
731 if (peer->is_up) in __tipc_nl_add_monitor_peer()
734 if (peer->is_local) in __tipc_nl_add_monitor_peer()
737 if (peer->is_head) in __tipc_nl_add_monitor_peer()
768 struct tipc_peer *peer; in tipc_nl_add_monitor_peer() local
774 peer = mon->self; in tipc_nl_add_monitor_peer()
777 if (peer->addr == *prev_node) in tipc_nl_add_monitor_peer()
782 if (__tipc_nl_add_monitor_peer(peer, msg)) { in tipc_nl_add_monitor_peer()
783 *prev_node = peer->addr; in tipc_nl_add_monitor_peer()
787 } while ((peer = peer_nxt(peer)) != mon->self); in tipc_nl_add_monitor_peer()