Lines Matching refs:node

2  * net/tipc/node.c: TIPC node management routines
39 #include "node.h"
53 * TIPC_NOTIFY_NODE_DOWN: notify node is down
54 * TIPC_NOTIFY_NODE_UP: notify node is up
83 * struct tipc_node - TIPC node structure
84 * @addr: network address of node
85 * @kref: reference counter to node object
92 * @links: array containing references to all links to node
94 * @action_flags: bit mask of different types of node actions
95 * @state: connectivity state vs peer node
96 * @preliminary: a preliminary node or not
100 * @working_links: number of working links to node (both active and standby)
101 * @link_cnt: number of links to node
102 * @capabilities: bitmap, indicating peer node's functional capabilities
103 * @signature: node instance identifier
109 * @timer: node's keepalive timer
112 * @delete_at: indicates the time for deleting a down node
182 static void tipc_node_delete(struct tipc_node *node);
188 static void tipc_node_delete_from_list(struct tipc_node *node);
266 u32 tipc_node_get_addr(struct tipc_node *node)
268 return (node) ? node->addr : 0;
271 char *tipc_node_get_id_str(struct tipc_node *node)
273 return node->peer_id_string;
278 * tipc_node_crypto_rx - Retrieve crypto RX handle from node
280 * Note: node ref counter must be held first!
319 void tipc_node_put(struct tipc_node *node)
321 kref_put(&node->kref, tipc_node_kref_release);
324 void tipc_node_get(struct tipc_node *node)
326 kref_get(&node->kref);
330 * tipc_node_find - locate specified node object, if it exists
335 struct tipc_node *node;
339 hlist_for_each_entry_rcu(node, &tn->node_htable[thash], hash) {
340 if (node->addr != addr || node->preliminary)
342 if (!kref_get_unless_zero(&node->kref))
343 node = NULL;
347 return node;
350 /* tipc_node_find_by_id - locate specified node object by its 128-bit id
352 * to find the node by its 32-bit id, and is not time critical
406 u32 bearer_id, node;
416 sk.node = tipc_own_addr(net);
417 node = n->addr;
427 tipc_publ_notify(net, publ_list, node, n->capabilities);
430 tipc_named_node_up(net, node, n->capabilities);
433 tipc_mon_peer_up(net, node, bearer_id);
437 tipc_mon_peer_down(net, node, bearer_id);
456 /* Integrity checking whether node exists in namespace or not */
489 /* A preliminary node becomes "real" now, refresh its data */
519 /* Same node may come back with new capabilities */
628 static void tipc_node_delete_from_list(struct tipc_node *node)
631 tipc_crypto_key_flush(node->crypto_rx);
633 list_del_rcu(&node->list);
634 hlist_del_rcu(&node->hash);
635 tipc_node_put(node);
638 static void tipc_node_delete(struct tipc_node *node)
640 trace_tipc_node_delete(node, true, " ");
641 tipc_node_delete_from_list(node);
643 del_timer_sync(&node->timer);
644 tipc_node_put(node);
650 struct tipc_node *node, *t_node;
653 list_for_each_entry_safe(node, t_node, &tn->node_list, list)
654 tipc_node_delete(node);
667 pr_warn("Node subscribe rejected, unknown node 0x%x\n", addr);
685 pr_warn("Node unsubscribe rejected, unknown node 0x%x\n", addr);
696 struct tipc_node *node;
703 node = tipc_node_find(net, dnode);
704 if (!node) {
705 pr_warn("Connecting sock to node 0x%x failed\n", dnode);
717 tipc_node_write_lock(node);
718 list_add_tail(&conn->list, &node->conn_sks);
719 tipc_node_write_unlock(node);
721 tipc_node_put(node);
727 struct tipc_node *node;
733 node = tipc_node_find(net, dnode);
734 if (!node)
737 tipc_node_write_lock(node);
738 list_for_each_entry_safe(conn, safe, &node->conn_sks, list) {
744 tipc_node_write_unlock(node);
745 tipc_node_put(node);
748 static void tipc_node_clear_links(struct tipc_node *node)
753 struct tipc_link_entry *le = &node->links[i];
758 node->link_cnt--;
772 /* If lock held by tipc_node_stop() the node will be deleted anyway */
801 /* tipc_node_timeout - handle expiration of node timer
825 /* Initial node interval to value larger (10 seconds), then it will be
943 * failover can be already started on peer node but not on this node.
953 * ==> Node 1 does never start link/node failover!
955 * @n: tipc node structure
1090 trace_tipc_node_link_down(n, true, "node link down or deleted!");
1163 /* Even this node may be in conflict */
1201 /* Prepare to validate requesting node's signature and media address */
1212 /* Peer node is not a container/local namespace */
1223 * chosen the same node address and signature as an
1238 /* Peer node rebooted. Two possibilities:
1241 * receiving a discovery message from that node.
1242 * (The peer happened to receive one from this node first).
1251 /* The peer node has rebooted.
1339 /* tipc_node_fsm_evt - node finite state machine
1340 * Determines when contact is allowed with peer node
1506 pr_err("Unknown node fsm state %x\n", state);
1514 pr_err("Illegal node fsm evt %x in state %x\n", evt, state);
1542 /* Notify publications from this node */
1546 /* Notify sockets connected to node */
1564 * @addr: peer node address
1575 struct tipc_node *node = tipc_node_find(net, addr);
1577 if (!node)
1583 tipc_node_read_lock(node);
1584 link = node->links[bearer_id].link;
1589 tipc_node_read_unlock(node);
1591 tipc_node_put(node);
1595 /* Caller should hold node lock for the passed node */
1596 static int __tipc_nl_add_node(struct tipc_nl_msg *msg, struct tipc_node *node)
1610 if (nla_put_u32(msg->skb, TIPC_NLA_NODE_ADDR, node->addr))
1612 if (node_is_up(node))
1684 * @dnode: address of destination node
1864 * tipc_node_bc_rcv - process TIPC broadcast packet arriving from off-node
1884 /* If NACK for other node, let rcv link for that node peek into it */
1925 * tipc_node_check_state - check and if necessary update node state
1947 trace_tipc_skb_dump(skb, false, "skb for node state check");
1973 /* Check and update node accesibility if applicable */
2002 "node link down <- failover!");
2008 * the tunnel link came up, node failover was never started.
2010 * NODE_FAILINGOVER state, also this node must accept
2077 * tipc_rcv - process TIPC packets/messages arriving from off-node
2132 /* Discard unicast link messages destined for another node */
2136 /* Locate neighboring node that sent packet */
2166 /* Check/update node state before receiving */
2229 /* Update MTU for node link entry */
2322 struct tipc_node *node;
2334 node = tipc_node_find(net, last_addr);
2335 if (!node) {
2341 * the NLM_F_DUMP_INTR flag set if the node state
2347 tipc_node_put(node);
2350 list_for_each_entry_rcu(node, &tn->node_list, list) {
2351 if (node->preliminary)
2354 if (node->addr == last_addr)
2360 tipc_node_read_lock(node);
2361 err = __tipc_nl_add_node(&msg, node);
2363 last_addr = node->addr;
2364 tipc_node_read_unlock(node);
2368 tipc_node_read_unlock(node);
2379 /* tipc_node_find_by_name - locate owner node of link by link's name
2382 * @bearer_id: pointer to index in 'node->links' array where the link was found.
2384 * Returns pointer to node owning the link, or 0 if no matching link is found.
2424 struct tipc_node *node;
2448 node = tipc_node_find_by_name(net, name, &bearer_id);
2449 if (!node)
2452 tipc_node_read_lock(node);
2454 link = node->links[bearer_id].link;
2492 tipc_node_read_unlock(node);
2493 tipc_bearer_xmit(net, bearer_id, &xmitq, &node->links[bearer_id].maddr,
2533 struct tipc_node *node;
2536 node = tipc_node_find_by_name(net, name, &bearer_id);
2537 if (!node) {
2542 tipc_node_read_lock(node);
2543 link = node->links[bearer_id].link;
2545 tipc_node_read_unlock(node);
2551 tipc_node_read_unlock(node);
2569 struct tipc_node *node;
2597 list_for_each_entry_rcu(node, &tn->node_list, list) {
2598 tipc_node_read_lock(node);
2599 link = node->bc_entry.link;
2602 tipc_node_read_unlock(node);
2605 tipc_node_read_unlock(node);
2611 node = tipc_node_find_by_name(net, link_name, &bearer_id);
2612 if (!node)
2615 le = &node->links[bearer_id];
2616 tipc_node_read_lock(node);
2618 link = node->links[bearer_id].link;
2621 tipc_node_read_unlock(node);
2626 tipc_node_read_unlock(node);
2630 /* Caller should hold node lock */
2632 struct tipc_node *node, u32 *prev_link,
2641 if (!node->links[i].link)
2645 node->links[i].link, NLM_F_MULTI);
2652 err = tipc_nl_add_bc_link(net, msg, node->bc_entry.link);
2668 struct tipc_node *node;
2701 node = tipc_node_find(net, prev_node);
2702 if (!node) {
2712 tipc_node_put(node);
2714 list_for_each_entry_continue_rcu(node, &tn->node_list,
2716 tipc_node_read_lock(node);
2717 err = __tipc_nl_add_node_links(net, &msg, node,
2719 tipc_node_read_unlock(node);
2723 prev_node = node->addr;
2730 list_for_each_entry_rcu(node, &tn->node_list, list) {
2731 tipc_node_read_lock(node);
2732 err = __tipc_nl_add_node_links(net, &msg, node,
2734 tipc_node_read_unlock(node);
2738 prev_node = node->addr;
2984 GENL_SET_ERR_MSG(info, "not found own node identity (set id?)");
3082 * tipc_node_dump - dump TIPC node data
3083 * @n: tipc node to be dumped
3085 * - false: dump only tipc node data
3086 * - true: dump node link data as well
3095 i += scnprintf(buf, sz, "node data: (null)\n");
3099 i += scnprintf(buf, sz, "node data: %x", n->addr);