• Home
  • Raw
  • Download

Lines Matching refs:n

167 static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id,
170 static void tipc_node_link_down(struct tipc_node *n, int bearer_id,
172 static void node_lost_contact(struct tipc_node *n, struct sk_buff_head *inputq);
175 static void tipc_node_fsm_evt(struct tipc_node *n, int evt);
178 static bool node_is_up(struct tipc_node *n);
188 static struct tipc_link *node_active_link(struct tipc_node *n, int sel) in node_active_link() argument
190 int bearer_id = n->active_links[sel & 1]; in node_active_link()
195 return n->links[bearer_id].link; in node_active_link()
200 struct tipc_node *n; in tipc_node_get_mtu() local
204 n = tipc_node_find(net, addr); in tipc_node_get_mtu()
205 if (unlikely(!n)) in tipc_node_get_mtu()
211 if (n->peer_net && connected) { in tipc_node_get_mtu()
212 tipc_node_put(n); in tipc_node_get_mtu()
216 bearer_id = n->active_links[sel & 1]; in tipc_node_get_mtu()
218 mtu = n->links[bearer_id].mtu; in tipc_node_get_mtu()
219 tipc_node_put(n); in tipc_node_get_mtu()
226 struct tipc_node *n; in tipc_node_get_id() local
235 n = tipc_node_find(net, addr); in tipc_node_get_id()
236 if (!n) in tipc_node_get_id()
239 memcpy(id, &n->peer_id, TIPC_NODEID_LEN); in tipc_node_get_id()
240 tipc_node_put(n); in tipc_node_get_id()
246 struct tipc_node *n; in tipc_node_get_capabilities() local
249 n = tipc_node_find(net, addr); in tipc_node_get_capabilities()
250 if (unlikely(!n)) in tipc_node_get_capabilities()
252 caps = n->capabilities; in tipc_node_get_capabilities()
253 tipc_node_put(n); in tipc_node_get_capabilities()
284 struct tipc_node *n; in tipc_node_crypto_rx_by_addr() local
286 n = tipc_node_find(net, addr); in tipc_node_crypto_rx_by_addr()
287 return (n) ? n->crypto_rx : NULL; in tipc_node_crypto_rx_by_addr()
293 struct tipc_node *n = container_of(rp, struct tipc_node, rcu); in tipc_node_free() local
296 tipc_crypto_stop(&n->crypto_rx); in tipc_node_free()
298 kfree(n); in tipc_node_free()
303 struct tipc_node *n = container_of(kref, struct tipc_node, kref); in tipc_node_kref_release() local
305 kfree(n->bc_entry.link); in tipc_node_kref_release()
306 call_rcu(&n->rcu, tipc_node_free); in tipc_node_kref_release()
347 struct tipc_node *n; in tipc_node_find_by_id() local
351 list_for_each_entry_rcu(n, &tn->node_list, list) { in tipc_node_find_by_id()
352 read_lock_bh(&n->lock); in tipc_node_find_by_id()
353 if (!memcmp(id, n->peer_id, 16) && in tipc_node_find_by_id()
354 kref_get_unless_zero(&n->kref)) in tipc_node_find_by_id()
356 read_unlock_bh(&n->lock); in tipc_node_find_by_id()
361 return found ? n : NULL; in tipc_node_find_by_id()
364 static void tipc_node_read_lock(struct tipc_node *n) in tipc_node_read_lock() argument
366 read_lock_bh(&n->lock); in tipc_node_read_lock()
369 static void tipc_node_read_unlock(struct tipc_node *n) in tipc_node_read_unlock() argument
371 read_unlock_bh(&n->lock); in tipc_node_read_unlock()
374 static void tipc_node_write_lock(struct tipc_node *n) in tipc_node_write_lock() argument
376 write_lock_bh(&n->lock); in tipc_node_write_lock()
379 static void tipc_node_write_unlock_fast(struct tipc_node *n) in tipc_node_write_unlock_fast() argument
381 write_unlock_bh(&n->lock); in tipc_node_write_unlock_fast()
384 static void tipc_node_write_unlock(struct tipc_node *n) in tipc_node_write_unlock() argument
386 struct net *net = n->net; in tipc_node_write_unlock()
388 u32 flags = n->action_flags; in tipc_node_write_unlock()
394 write_unlock_bh(&n->lock); in tipc_node_write_unlock()
398 addr = n->addr; in tipc_node_write_unlock()
399 link_id = n->link_id; in tipc_node_write_unlock()
401 publ_list = &n->publ_list; in tipc_node_write_unlock()
403 n->action_flags &= ~(TIPC_NOTIFY_NODE_DOWN | TIPC_NOTIFY_NODE_UP | in tipc_node_write_unlock()
406 write_unlock_bh(&n->lock); in tipc_node_write_unlock()
409 tipc_publ_notify(net, publ_list, addr, n->capabilities); in tipc_node_write_unlock()
412 tipc_named_node_up(net, addr, n->capabilities); in tipc_node_write_unlock()
426 static void tipc_node_assign_peer_net(struct tipc_node *n, u32 hash_mixes) in tipc_node_assign_peer_net() argument
428 int net_id = tipc_netid(n->net); in tipc_node_assign_peer_net()
433 if (n->peer_net) in tipc_node_assign_peer_net()
443 if (memcmp(n->peer_id, tn_peer->node_id, NODE_ID_LEN)) in tipc_node_assign_peer_net()
448 n->peer_net = tmp; in tipc_node_assign_peer_net()
449 n->peer_hash_mix = hash_mixes; in tipc_node_assign_peer_net()
459 struct tipc_node *n, *temp_node; in tipc_node_create() local
466 n = tipc_node_find(net, addr) ?: in tipc_node_create()
468 if (n) { in tipc_node_create()
469 if (!n->preliminary) in tipc_node_create()
474 tipc_node_write_lock(n); in tipc_node_create()
475 n->preliminary = false; in tipc_node_create()
476 n->addr = addr; in tipc_node_create()
477 hlist_del_rcu(&n->hash); in tipc_node_create()
478 hlist_add_head_rcu(&n->hash, in tipc_node_create()
480 list_del_rcu(&n->list); in tipc_node_create()
482 if (n->addr < temp_node->addr) in tipc_node_create()
485 list_add_tail_rcu(&n->list, &temp_node->list); in tipc_node_create()
486 tipc_node_write_unlock_fast(n); in tipc_node_create()
489 if (n->peer_hash_mix ^ hash_mixes) in tipc_node_create()
490 tipc_node_assign_peer_net(n, hash_mixes); in tipc_node_create()
491 if (n->capabilities == capabilities) in tipc_node_create()
494 tipc_node_write_lock(n); in tipc_node_create()
495 n->capabilities = capabilities; in tipc_node_create()
497 l = n->links[bearer_id].link; in tipc_node_create()
501 tipc_node_write_unlock_fast(n); in tipc_node_create()
514 n = kzalloc(sizeof(*n), GFP_ATOMIC); in tipc_node_create()
515 if (!n) { in tipc_node_create()
519 tipc_nodeid2string(n->peer_id_string, peer_id); in tipc_node_create()
521 if (unlikely(tipc_crypto_start(&n->crypto_rx, net, n))) { in tipc_node_create()
522 pr_warn("Failed to start crypto RX(%s)!\n", n->peer_id_string); in tipc_node_create()
523 kfree(n); in tipc_node_create()
524 n = NULL; in tipc_node_create()
528 n->addr = addr; in tipc_node_create()
529 n->preliminary = preliminary; in tipc_node_create()
530 memcpy(&n->peer_id, peer_id, 16); in tipc_node_create()
531 n->net = net; in tipc_node_create()
532 n->peer_net = NULL; in tipc_node_create()
533 n->peer_hash_mix = 0; in tipc_node_create()
535 tipc_node_assign_peer_net(n, hash_mixes); in tipc_node_create()
536 n->capabilities = capabilities; in tipc_node_create()
537 kref_init(&n->kref); in tipc_node_create()
538 rwlock_init(&n->lock); in tipc_node_create()
539 INIT_HLIST_NODE(&n->hash); in tipc_node_create()
540 INIT_LIST_HEAD(&n->list); in tipc_node_create()
541 INIT_LIST_HEAD(&n->publ_list); in tipc_node_create()
542 INIT_LIST_HEAD(&n->conn_sks); in tipc_node_create()
543 skb_queue_head_init(&n->bc_entry.namedq); in tipc_node_create()
544 skb_queue_head_init(&n->bc_entry.inputq1); in tipc_node_create()
545 __skb_queue_head_init(&n->bc_entry.arrvq); in tipc_node_create()
546 skb_queue_head_init(&n->bc_entry.inputq2); in tipc_node_create()
548 spin_lock_init(&n->links[i].lock); in tipc_node_create()
549 n->state = SELF_DOWN_PEER_LEAVING; in tipc_node_create()
550 n->delete_at = jiffies + msecs_to_jiffies(NODE_CLEANUP_AFTER); in tipc_node_create()
551 n->signature = INVALID_NODE_SIG; in tipc_node_create()
552 n->active_links[0] = INVALID_BEARER_ID; in tipc_node_create()
553 n->active_links[1] = INVALID_BEARER_ID; in tipc_node_create()
554 n->bc_entry.link = NULL; in tipc_node_create()
555 tipc_node_get(n); in tipc_node_create()
556 timer_setup(&n->timer, tipc_node_timeout, 0); in tipc_node_create()
558 n->keepalive_intv = 10000; in tipc_node_create()
559 intv = jiffies + msecs_to_jiffies(n->keepalive_intv); in tipc_node_create()
560 if (!mod_timer(&n->timer, intv)) in tipc_node_create()
561 tipc_node_get(n); in tipc_node_create()
562 hlist_add_head_rcu(&n->hash, &tn->node_htable[tipc_hashfn(addr)]); in tipc_node_create()
564 if (n->addr < temp_node->addr) in tipc_node_create()
567 list_add_tail_rcu(&n->list, &temp_node->list); in tipc_node_create()
574 trace_tipc_node_create(n, true, " "); in tipc_node_create()
577 return n; in tipc_node_create()
580 static void tipc_node_calculate_timer(struct tipc_node *n, struct tipc_link *l) in tipc_node_calculate_timer() argument
586 if (intv < n->keepalive_intv) in tipc_node_calculate_timer()
587 n->keepalive_intv = intv; in tipc_node_calculate_timer()
590 tipc_link_set_abort_limit(l, tol / n->keepalive_intv); in tipc_node_calculate_timer()
625 struct tipc_node *n; in tipc_node_subscribe() local
630 n = tipc_node_find(net, addr); in tipc_node_subscribe()
631 if (!n) { in tipc_node_subscribe()
635 tipc_node_write_lock(n); in tipc_node_subscribe()
636 list_add_tail(subscr, &n->publ_list); in tipc_node_subscribe()
637 tipc_node_write_unlock_fast(n); in tipc_node_subscribe()
638 tipc_node_put(n); in tipc_node_subscribe()
643 struct tipc_node *n; in tipc_node_unsubscribe() local
648 n = tipc_node_find(net, addr); in tipc_node_unsubscribe()
649 if (!n) { in tipc_node_unsubscribe()
653 tipc_node_write_lock(n); in tipc_node_unsubscribe()
655 tipc_node_write_unlock_fast(n); in tipc_node_unsubscribe()
656 tipc_node_put(n); in tipc_node_unsubscribe()
770 struct tipc_node *n = from_timer(n, t, timer); in tipc_node_timeout() local
773 int remains = n->link_cnt; in tipc_node_timeout()
777 trace_tipc_node_timeout(n, false, " "); in tipc_node_timeout()
778 if (!node_is_up(n) && tipc_node_cleanup(n)) { in tipc_node_timeout()
780 tipc_node_put(n); in tipc_node_timeout()
786 tipc_crypto_timeout(n->crypto_rx); in tipc_node_timeout()
793 tipc_node_read_lock(n); in tipc_node_timeout()
794 n->keepalive_intv = 10000; in tipc_node_timeout()
795 tipc_node_read_unlock(n); in tipc_node_timeout()
797 tipc_node_read_lock(n); in tipc_node_timeout()
798 le = &n->links[bearer_id]; in tipc_node_timeout()
802 tipc_node_calculate_timer(n, le->link); in tipc_node_timeout()
807 tipc_node_read_unlock(n); in tipc_node_timeout()
808 tipc_bearer_xmit(n->net, bearer_id, &xmitq, &le->maddr, n); in tipc_node_timeout()
810 tipc_node_link_down(n, bearer_id, false); in tipc_node_timeout()
812 mod_timer(&n->timer, jiffies + msecs_to_jiffies(n->keepalive_intv)); in tipc_node_timeout()
820 static void __tipc_node_link_up(struct tipc_node *n, int bearer_id, in __tipc_node_link_up() argument
823 int *slot0 = &n->active_links[0]; in __tipc_node_link_up()
824 int *slot1 = &n->active_links[1]; in __tipc_node_link_up()
825 struct tipc_link *ol = node_active_link(n, 0); in __tipc_node_link_up()
826 struct tipc_link *nl = n->links[bearer_id].link; in __tipc_node_link_up()
835 n->working_links++; in __tipc_node_link_up()
836 n->action_flags |= TIPC_NOTIFY_LINK_UP; in __tipc_node_link_up()
837 n->link_id = tipc_link_id(nl); in __tipc_node_link_up()
840 n->links[bearer_id].mtu = tipc_link_mss(nl); in __tipc_node_link_up()
842 tipc_bearer_add_dest(n->net, bearer_id, n->addr); in __tipc_node_link_up()
843 tipc_bcast_inc_bearer_dst_cnt(n->net, bearer_id); in __tipc_node_link_up()
847 trace_tipc_node_link_up(n, true, " "); in __tipc_node_link_up()
856 tipc_node_fsm_evt(n, SELF_ESTABL_CONTACT_EVT); in __tipc_node_link_up()
857 n->action_flags |= TIPC_NOTIFY_NODE_UP; in __tipc_node_link_up()
859 tipc_bcast_add_peer(n->net, nl, xmitq); in __tipc_node_link_up()
886 static void tipc_node_link_up(struct tipc_node *n, int bearer_id, in tipc_node_link_up() argument
891 tipc_node_write_lock(n); in tipc_node_link_up()
892 __tipc_node_link_up(n, bearer_id, xmitq); in tipc_node_link_up()
893 maddr = &n->links[bearer_id].maddr; in tipc_node_link_up()
894 tipc_bearer_xmit(n->net, bearer_id, xmitq, maddr, n); in tipc_node_link_up()
895 tipc_node_write_unlock(n); in tipc_node_link_up()
918 static void tipc_node_link_failover(struct tipc_node *n, struct tipc_link *l, in tipc_node_link_failover() argument
931 tipc_node_fsm_evt(n, NODE_SYNCH_END_EVT); in tipc_node_link_failover()
933 n->sync_point = tipc_link_rcv_nxt(tnl) + (U16_MAX / 2 - 1); in tipc_node_link_failover()
938 tipc_node_fsm_evt(n, NODE_FAILOVER_BEGIN_EVT); in tipc_node_link_failover()
944 static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id, in __tipc_node_link_down() argument
948 struct tipc_link_entry *le = &n->links[*bearer_id]; in __tipc_node_link_down()
949 int *slot0 = &n->active_links[0]; in __tipc_node_link_down()
950 int *slot1 = &n->active_links[1]; in __tipc_node_link_down()
954 l = n->links[*bearer_id].link; in __tipc_node_link_down()
958 n->working_links--; in __tipc_node_link_down()
959 n->action_flags |= TIPC_NOTIFY_LINK_DOWN; in __tipc_node_link_down()
960 n->link_id = tipc_link_id(l); in __tipc_node_link_down()
962 tipc_bearer_remove_dest(n->net, *bearer_id, n->addr); in __tipc_node_link_down()
971 _l = n->links[i].link; in __tipc_node_link_down()
988 if (!node_is_up(n)) { in __tipc_node_link_down()
990 tipc_node_fsm_evt(n, PEER_LOST_CONTACT_EVT); in __tipc_node_link_down()
991 tipc_node_fsm_evt(n, SELF_LOST_CONTACT_EVT); in __tipc_node_link_down()
996 *maddr = &n->links[*bearer_id].maddr; in __tipc_node_link_down()
997 node_lost_contact(n, &le->inputq); in __tipc_node_link_down()
998 tipc_bcast_dec_bearer_dst_cnt(n->net, *bearer_id); in __tipc_node_link_down()
1001 tipc_bcast_dec_bearer_dst_cnt(n->net, *bearer_id); in __tipc_node_link_down()
1004 *bearer_id = n->active_links[0]; in __tipc_node_link_down()
1005 tnl = n->links[*bearer_id].link; in __tipc_node_link_down()
1007 tipc_node_fsm_evt(n, NODE_SYNCH_END_EVT); in __tipc_node_link_down()
1008 n->sync_point = tipc_link_rcv_nxt(tnl) + (U16_MAX / 2 - 1); in __tipc_node_link_down()
1014 tipc_node_fsm_evt(n, NODE_FAILOVER_BEGIN_EVT); in __tipc_node_link_down()
1015 *maddr = &n->links[*bearer_id].maddr; in __tipc_node_link_down()
1018 static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete) in tipc_node_link_down() argument
1020 struct tipc_link_entry *le = &n->links[bearer_id]; in tipc_node_link_down()
1031 tipc_node_write_lock(n); in tipc_node_link_down()
1033 __tipc_node_link_down(n, &bearer_id, &xmitq, &maddr); in tipc_node_link_down()
1042 n->link_cnt--; in tipc_node_link_down()
1044 trace_tipc_node_link_down(n, true, "node link down or deleted!"); in tipc_node_link_down()
1045 tipc_node_write_unlock(n); in tipc_node_link_down()
1047 tipc_mon_remove_peer(n->net, n->addr, old_bearer_id); in tipc_node_link_down()
1049 tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr, n); in tipc_node_link_down()
1050 tipc_sk_rcv(n->net, &le->inputq); in tipc_node_link_down()
1053 static bool node_is_up(struct tipc_node *n) in node_is_up() argument
1055 return n->active_links[0] != INVALID_BEARER_ID; in node_is_up()
1060 struct tipc_node *n; in tipc_node_is_up() local
1066 n = tipc_node_find(net, addr); in tipc_node_is_up()
1067 if (!n) in tipc_node_is_up()
1069 retval = node_is_up(n); in tipc_node_is_up()
1070 tipc_node_put(n); in tipc_node_is_up()
1076 struct tipc_node *n; in tipc_node_suggest_addr() local
1079 while ((n = tipc_node_find(net, addr))) { in tipc_node_suggest_addr()
1080 tipc_node_put(n); in tipc_node_suggest_addr()
1092 struct tipc_node *n; in tipc_node_try_addr() local
1097 n = tipc_node_find(net, addr); in tipc_node_try_addr()
1098 if (n) { in tipc_node_try_addr()
1099 if (!memcmp(n->peer_id, id, NODE_ID_LEN)) in tipc_node_try_addr()
1101 tipc_node_put(n); in tipc_node_try_addr()
1108 n = tipc_node_find_by_id(net, id); in tipc_node_try_addr()
1109 if (n) { in tipc_node_try_addr()
1110 sugg_addr = n->addr; in tipc_node_try_addr()
1111 preliminary = n->preliminary; in tipc_node_try_addr()
1112 tipc_node_put(n); in tipc_node_try_addr()
1130 struct tipc_node *n; in tipc_node_check_dest() local
1145 n = tipc_node_create(net, addr, peer_id, capabilities, hash_mixes, in tipc_node_check_dest()
1147 if (!n) in tipc_node_check_dest()
1150 tipc_node_write_lock(n); in tipc_node_check_dest()
1151 if (unlikely(!n->bc_entry.link)) { in tipc_node_check_dest()
1157 n->capabilities, in tipc_node_check_dest()
1158 &n->bc_entry.inputq1, in tipc_node_check_dest()
1159 &n->bc_entry.namedq, snd_l, in tipc_node_check_dest()
1160 &n->bc_entry.link)) { in tipc_node_check_dest()
1162 tipc_node_write_unlock_fast(n); in tipc_node_check_dest()
1163 tipc_node_put(n); in tipc_node_check_dest()
1168 le = &n->links[b->identity]; in tipc_node_check_dest()
1174 sign_match = (signature == n->signature); in tipc_node_check_dest()
1182 if (!n->peer_hash_mix) in tipc_node_check_dest()
1183 n->peer_hash_mix = hash_mixes; in tipc_node_check_dest()
1217 n->signature = signature; in tipc_node_check_dest()
1222 n->signature = signature; in tipc_node_check_dest()
1233 n->signature = signature; in tipc_node_check_dest()
1243 if (n->link_cnt == 2) in tipc_node_check_dest()
1252 n->capabilities, in tipc_node_check_dest()
1253 tipc_bc_sndlink(n->net), n->bc_entry.link, in tipc_node_check_dest()
1255 &n->bc_entry.namedq, &l)) { in tipc_node_check_dest()
1262 if (n->state == NODE_FAILINGOVER) in tipc_node_check_dest()
1265 n->link_cnt++; in tipc_node_check_dest()
1266 tipc_node_calculate_timer(n, l); in tipc_node_check_dest()
1267 if (n->link_cnt == 1) { in tipc_node_check_dest()
1268 intv = jiffies + msecs_to_jiffies(n->keepalive_intv); in tipc_node_check_dest()
1269 if (!mod_timer(&n->timer, intv)) in tipc_node_check_dest()
1270 tipc_node_get(n); in tipc_node_check_dest()
1275 tipc_node_write_unlock(n); in tipc_node_check_dest()
1277 tipc_node_link_down(n, b->identity, false); in tipc_node_check_dest()
1278 tipc_node_put(n); in tipc_node_check_dest()
1284 struct tipc_node *n; in tipc_node_delete_links() local
1287 list_for_each_entry_rcu(n, &tn->node_list, list) { in tipc_node_delete_links()
1288 tipc_node_link_down(n, bearer_id, true); in tipc_node_delete_links()
1293 static void tipc_node_reset_links(struct tipc_node *n) in tipc_node_reset_links() argument
1297 pr_warn("Resetting all links to %x\n", n->addr); in tipc_node_reset_links()
1299 trace_tipc_node_reset_links(n, true, " "); in tipc_node_reset_links()
1301 tipc_node_link_down(n, i, false); in tipc_node_reset_links()
1308 static void tipc_node_fsm_evt(struct tipc_node *n, int evt) in tipc_node_fsm_evt() argument
1310 int state = n->state; in tipc_node_fsm_evt()
1475 trace_tipc_node_fsm(n->peer_id, n->state, state, evt); in tipc_node_fsm_evt()
1476 n->state = state; in tipc_node_fsm_evt()
1481 trace_tipc_node_fsm(n->peer_id, n->state, state, evt); in tipc_node_fsm_evt()
1484 static void node_lost_contact(struct tipc_node *n, in node_lost_contact() argument
1489 struct list_head *conns = &n->conn_sks; in node_lost_contact()
1493 pr_debug("Lost contact with %x\n", n->addr); in node_lost_contact()
1494 n->delete_at = jiffies + msecs_to_jiffies(NODE_CLEANUP_AFTER); in node_lost_contact()
1495 trace_tipc_node_lost_contact(n, true, " "); in node_lost_contact()
1498 tipc_bcast_remove_peer(n->net, n->bc_entry.link); in node_lost_contact()
1499 skb_queue_purge(&n->bc_entry.namedq); in node_lost_contact()
1503 l = n->links[i].link; in node_lost_contact()
1509 n->action_flags |= TIPC_NOTIFY_NODE_DOWN; in node_lost_contact()
1510 n->peer_net = NULL; in node_lost_contact()
1511 n->peer_hash_mix = 0; in node_lost_contact()
1515 SHORT_H_SIZE, 0, tipc_own_addr(n->net), in node_lost_contact()
1657 struct tipc_node *n; in tipc_node_xmit() local
1670 n = tipc_node_find(net, dnode); in tipc_node_xmit()
1671 if (unlikely(!n)) { in tipc_node_xmit()
1676 tipc_node_read_lock(n); in tipc_node_xmit()
1677 node_up = node_is_up(n); in tipc_node_xmit()
1678 if (node_up && n->peer_net && check_net(n->peer_net)) { in tipc_node_xmit()
1680 tipc_lxc_xmit(n->peer_net, list); in tipc_node_xmit()
1682 tipc_node_read_unlock(n); in tipc_node_xmit()
1683 tipc_node_put(n); in tipc_node_xmit()
1688 bearer_id = n->active_links[selector & 1]; in tipc_node_xmit()
1690 tipc_node_read_unlock(n); in tipc_node_xmit()
1691 tipc_node_put(n); in tipc_node_xmit()
1697 le = &n->links[bearer_id]; in tipc_node_xmit()
1701 tipc_node_read_unlock(n); in tipc_node_xmit()
1704 tipc_node_link_down(n, bearer_id, false); in tipc_node_xmit()
1706 tipc_bearer_xmit(net, bearer_id, &xmitq, &le->maddr, n); in tipc_node_xmit()
1708 tipc_node_put(n); in tipc_node_xmit()
1750 struct tipc_node *n; in tipc_node_broadcast() local
1764 list_for_each_entry_rcu(n, tipc_nodes(net), list) { in tipc_node_broadcast()
1765 dst = n->addr; in tipc_node_broadcast()
1768 if (!node_is_up(n)) in tipc_node_broadcast()
1780 static void tipc_node_mcast_rcv(struct tipc_node *n) in tipc_node_mcast_rcv() argument
1782 struct tipc_bclink_entry *be = &n->bc_entry; in tipc_node_mcast_rcv()
1790 tipc_sk_mcast_rcv(n->net, &be->arrvq, &be->inputq2); in tipc_node_mcast_rcv()
1793 static void tipc_node_bc_sync_rcv(struct tipc_node *n, struct tipc_msg *hdr, in tipc_node_bc_sync_rcv() argument
1799 rc = tipc_bcast_sync_rcv(n->net, n->bc_entry.link, hdr, xmitq); in tipc_node_bc_sync_rcv()
1802 tipc_node_reset_links(n); in tipc_node_bc_sync_rcv()
1814 tipc_node_read_lock(n); in tipc_node_bc_sync_rcv()
1815 ucl = n->links[bearer_id].link; in tipc_node_bc_sync_rcv()
1818 tipc_node_read_unlock(n); in tipc_node_bc_sync_rcv()
1838 struct tipc_node *n; in tipc_node_bc_rcv() local
1844 n = tipc_node_find(net, dnode); in tipc_node_bc_rcv()
1846 n = tipc_node_find(net, msg_prevnode(hdr)); in tipc_node_bc_rcv()
1847 if (!n) { in tipc_node_bc_rcv()
1851 be = &n->bc_entry; in tipc_node_bc_rcv()
1852 le = &n->links[bearer_id]; in tipc_node_bc_rcv()
1858 tipc_node_read_lock(n); in tipc_node_bc_rcv()
1860 tipc_node_read_unlock(n); in tipc_node_bc_rcv()
1864 tipc_bearer_xmit(net, bearer_id, &xmitq, &le->maddr, n); in tipc_node_bc_rcv()
1867 tipc_node_mcast_rcv(n); in tipc_node_bc_rcv()
1870 if (!skb_queue_empty(&n->bc_entry.namedq)) in tipc_node_bc_rcv()
1871 tipc_named_rcv(net, &n->bc_entry.namedq, in tipc_node_bc_rcv()
1872 &n->bc_entry.named_rcv_nxt, in tipc_node_bc_rcv()
1873 &n->bc_entry.named_open); in tipc_node_bc_rcv()
1877 tipc_node_reset_links(n); in tipc_node_bc_rcv()
1879 tipc_node_put(n); in tipc_node_bc_rcv()
1888 static bool tipc_node_check_state(struct tipc_node *n, struct sk_buff *skb, in tipc_node_check_state() argument
1897 int state = n->state; in tipc_node_check_state()
1904 trace_tipc_node_check_state(n, true, " "); in tipc_node_check_state()
1906 l = n->links[bearer_id].link; in tipc_node_check_state()
1917 if ((pb_id != bearer_id) && n->links[pb_id].link) { in tipc_node_check_state()
1918 pl = n->links[pb_id].link; in tipc_node_check_state()
1935 tipc_node_fsm_evt(n, PEER_ESTABL_CONTACT_EVT); in tipc_node_check_state()
1941 tipc_node_fsm_evt(n, PEER_LOST_CONTACT_EVT); in tipc_node_check_state()
1956 __tipc_node_link_down(n, &pb_id, xmitq, &maddr); in tipc_node_check_state()
1957 trace_tipc_node_link_down(n, true, in tipc_node_check_state()
1969 if (n->state != NODE_FAILINGOVER) in tipc_node_check_state()
1970 tipc_node_link_failover(n, pl, l, xmitq); in tipc_node_check_state()
1973 if (less(syncpt, n->sync_point)) in tipc_node_check_state()
1974 n->sync_point = syncpt; in tipc_node_check_state()
1978 if ((n->state == NODE_FAILINGOVER) && tipc_link_is_up(l)) { in tipc_node_check_state()
1979 if (!more(rcv_nxt, n->sync_point)) in tipc_node_check_state()
1981 tipc_node_fsm_evt(n, NODE_FAILOVER_END_EVT); in tipc_node_check_state()
1993 if (n->capabilities & TIPC_TUNNEL_ENHANCED) in tipc_node_check_state()
1998 __tipc_node_link_up(n, bearer_id, xmitq); in tipc_node_check_state()
1999 if (n->state == SELF_UP_PEER_UP) { in tipc_node_check_state()
2000 n->sync_point = syncpt; in tipc_node_check_state()
2002 tipc_node_fsm_evt(n, NODE_SYNCH_BEGIN_EVT); in tipc_node_check_state()
2007 if (n->state == NODE_SYNCHING) { in tipc_node_check_state()
2016 if (more(dlv_nxt, n->sync_point)) { in tipc_node_check_state()
2018 tipc_node_fsm_evt(n, NODE_SYNCH_END_EVT); in tipc_node_check_state()
2046 struct tipc_node *n; in tipc_rcv() local
2060 n = tipc_node_find(net, ntohl(ehdr->addr)); in tipc_rcv()
2061 if (unlikely(!n)) in tipc_rcv()
2064 n = tipc_node_find_by_id(net, ehdr->id); in tipc_rcv()
2066 tipc_crypto_rcv(net, (n) ? n->crypto_rx : NULL, &skb, b); in tipc_rcv()
2093 n = tipc_node_find(net, msg_prevnode(hdr)); in tipc_rcv()
2094 if (unlikely(!n)) in tipc_rcv()
2096 le = &n->links[bearer_id]; in tipc_rcv()
2101 tipc_node_put(n); in tipc_rcv()
2105 tipc_node_bc_sync_rcv(n, hdr, bearer_id, &xmitq); in tipc_rcv()
2106 } else if (unlikely(tipc_link_acked(n->bc_entry.link) != bc_ack)) { in tipc_rcv()
2107 tipc_bcast_ack_rcv(net, n->bc_entry.link, hdr); in tipc_rcv()
2111 tipc_node_read_lock(n); in tipc_rcv()
2112 if (likely((n->state == SELF_UP_PEER_UP) && (usr != TUNNEL_PROTOCOL))) { in tipc_rcv()
2120 tipc_node_read_unlock(n); in tipc_rcv()
2126 tipc_node_write_lock(n); in tipc_rcv()
2127 if (tipc_node_check_state(n, skb, bearer_id, &xmitq)) { in tipc_rcv()
2133 tipc_node_write_unlock(n); in tipc_rcv()
2137 tipc_node_link_up(n, bearer_id, &xmitq); in tipc_rcv()
2140 tipc_node_link_down(n, bearer_id, false); in tipc_rcv()
2142 if (unlikely(!skb_queue_empty(&n->bc_entry.namedq))) in tipc_rcv()
2143 tipc_named_rcv(net, &n->bc_entry.namedq, in tipc_rcv()
2144 &n->bc_entry.named_rcv_nxt, in tipc_rcv()
2145 &n->bc_entry.named_open); in tipc_rcv()
2147 if (unlikely(!skb_queue_empty(&n->bc_entry.inputq1))) in tipc_rcv()
2148 tipc_node_mcast_rcv(n); in tipc_rcv()
2154 tipc_bearer_xmit(net, bearer_id, &xmitq, &le->maddr, n); in tipc_rcv()
2157 tipc_node_put(n); in tipc_rcv()
2169 struct tipc_node *n; in tipc_node_apply_property() local
2175 list_for_each_entry_rcu(n, &tn->node_list, list) { in tipc_node_apply_property()
2176 tipc_node_write_lock(n); in tipc_node_apply_property()
2177 e = &n->links[bearer_id]; in tipc_node_apply_property()
2189 tipc_node_write_unlock(n); in tipc_node_apply_property()
2333 struct tipc_node *n; in tipc_node_find_by_name() local
2339 list_for_each_entry_rcu(n, &tn->node_list, list) { in tipc_node_find_by_name()
2340 tipc_node_read_lock(n); in tipc_node_find_by_name()
2342 l = n->links[i].link; in tipc_node_find_by_name()
2345 found_node = n; in tipc_node_find_by_name()
2349 tipc_node_read_unlock(n); in tipc_node_find_by_name()
2907 struct tipc_node *n = NULL; in __tipc_nl_node_set_key() local
2952 n = tipc_node_find_by_id(net, id) ?: in __tipc_nl_node_set_key()
2954 if (unlikely(!n)) in __tipc_nl_node_set_key()
2956 c = n->crypto_rx; in __tipc_nl_node_set_key()
2965 if (n) in __tipc_nl_node_set_key()
2966 tipc_node_put(n); in __tipc_nl_node_set_key()
2999 struct tipc_node *n; in __tipc_nl_node_flush_key() local
3003 list_for_each_entry_rcu(n, &tn->node_list, list) in __tipc_nl_node_flush_key()
3004 tipc_crypto_key_flush(n->crypto_rx); in __tipc_nl_node_flush_key()
3030 int tipc_node_dump(struct tipc_node *n, bool more, char *buf) in tipc_node_dump() argument
3035 if (!n) { in tipc_node_dump()
3040 i += scnprintf(buf, sz, "node data: %x", n->addr); in tipc_node_dump()
3041 i += scnprintf(buf + i, sz - i, " %x", n->state); in tipc_node_dump()
3042 i += scnprintf(buf + i, sz - i, " %d", n->active_links[0]); in tipc_node_dump()
3043 i += scnprintf(buf + i, sz - i, " %d", n->active_links[1]); in tipc_node_dump()
3044 i += scnprintf(buf + i, sz - i, " %x", n->action_flags); in tipc_node_dump()
3045 i += scnprintf(buf + i, sz - i, " %u", n->failover_sent); in tipc_node_dump()
3046 i += scnprintf(buf + i, sz - i, " %u", n->sync_point); in tipc_node_dump()
3047 i += scnprintf(buf + i, sz - i, " %d", n->link_cnt); in tipc_node_dump()
3048 i += scnprintf(buf + i, sz - i, " %u", n->working_links); in tipc_node_dump()
3049 i += scnprintf(buf + i, sz - i, " %x", n->capabilities); in tipc_node_dump()
3050 i += scnprintf(buf + i, sz - i, " %lu\n", n->keepalive_intv); in tipc_node_dump()
3056 i += scnprintf(buf + i, sz - i, " mtu: %u\n", n->links[0].mtu); in tipc_node_dump()
3058 i += tipc_media_addr_printf(buf + i, sz - i, &n->links[0].maddr); in tipc_node_dump()
3060 i += tipc_link_dump(n->links[0].link, TIPC_DUMP_NONE, buf + i); in tipc_node_dump()
3062 i += tipc_list_dump(&n->links[0].inputq, false, buf + i); in tipc_node_dump()
3065 i += scnprintf(buf + i, sz - i, " mtu: %u\n", n->links[1].mtu); in tipc_node_dump()
3067 i += tipc_media_addr_printf(buf + i, sz - i, &n->links[1].maddr); in tipc_node_dump()
3069 i += tipc_link_dump(n->links[1].link, TIPC_DUMP_NONE, buf + i); in tipc_node_dump()
3071 i += tipc_list_dump(&n->links[1].inputq, false, buf + i); in tipc_node_dump()
3074 i += tipc_link_dump(n->bc_entry.link, TIPC_DUMP_NONE, buf + i); in tipc_node_dump()
3081 struct tipc_node *n; in tipc_node_pre_cleanup_net() local
3093 list_for_each_entry_rcu(n, &tn->node_list, list) { in tipc_node_pre_cleanup_net()
3094 if (!n->peer_net) in tipc_node_pre_cleanup_net()
3096 if (n->peer_net != exit_net) in tipc_node_pre_cleanup_net()
3098 tipc_node_write_lock(n); in tipc_node_pre_cleanup_net()
3099 n->peer_net = NULL; in tipc_node_pre_cleanup_net()
3100 n->peer_hash_mix = 0; in tipc_node_pre_cleanup_net()
3101 tipc_node_write_unlock_fast(n); in tipc_node_pre_cleanup_net()