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 * @ref: reference counter to node object
92 * @links: array containing references to all links to node
93 * @action_flags: bit mask of different types of node actions
94 * @state: connectivity state vs peer node
95 * @preliminary: a preliminary node or not
98 * @working_links: number of working links to node (both active and standby)
99 * @link_cnt: number of links to node
100 * @capabilities: bitmap, indicating peer node's functional capabilities
101 * @signature: node instance identifier
105 * @delete_at: indicates the time for deleting a down node
173 static void tipc_node_delete(struct tipc_node *node);
179 static void tipc_node_delete_from_list(struct tipc_node *node);
257 u32 tipc_node_get_addr(struct tipc_node *node)
259 return (node) ? node->addr : 0;
262 char *tipc_node_get_id_str(struct tipc_node *node)
264 return node->peer_id_string;
269 * tipc_node_crypto_rx - Retrieve crypto RX handle from node
270 * Note: node ref counter must be held first!
309 void tipc_node_put(struct tipc_node *node)
311 kref_put(&node->kref, tipc_node_kref_release);
314 void tipc_node_get(struct tipc_node *node)
316 kref_get(&node->kref);
320 * tipc_node_find - locate specified node object, if it exists
325 struct tipc_node *node;
329 hlist_for_each_entry_rcu(node, &tn->node_htable[thash], hash) {
330 if (node->addr != addr || node->preliminary)
332 if (!kref_get_unless_zero(&node->kref))
333 node = NULL;
337 return node;
340 /* tipc_node_find_by_id - locate specified node object by its 128-bit id
342 * to find the node by its 32-bit id, and is not time critical
440 /* Integrity checking whether node exists in namespace or not */
473 /* A preliminary node becomes "real" now, refresh its data */
503 /* Same node may come back with new capabilities */
612 static void tipc_node_delete_from_list(struct tipc_node *node)
615 tipc_crypto_key_flush(node->crypto_rx);
617 list_del_rcu(&node->list);
618 hlist_del_rcu(&node->hash);
619 tipc_node_put(node);
622 static void tipc_node_delete(struct tipc_node *node)
624 trace_tipc_node_delete(node, true, " ");
625 tipc_node_delete_from_list(node);
627 del_timer_sync(&node->timer);
628 tipc_node_put(node);
634 struct tipc_node *node, *t_node;
637 list_for_each_entry_safe(node, t_node, &tn->node_list, list)
638 tipc_node_delete(node);
651 pr_warn("Node subscribe rejected, unknown node 0x%x\n", addr);
669 pr_warn("Node unsubscribe rejected, unknown node 0x%x\n", addr);
680 struct tipc_node *node;
687 node = tipc_node_find(net, dnode);
688 if (!node) {
689 pr_warn("Connecting sock to node 0x%x failed\n", dnode);
701 tipc_node_write_lock(node);
702 list_add_tail(&conn->list, &node->conn_sks);
703 tipc_node_write_unlock(node);
705 tipc_node_put(node);
711 struct tipc_node *node;
717 node = tipc_node_find(net, dnode);
718 if (!node)
721 tipc_node_write_lock(node);
722 list_for_each_entry_safe(conn, safe, &node->conn_sks, list) {
728 tipc_node_write_unlock(node);
729 tipc_node_put(node);
732 static void tipc_node_clear_links(struct tipc_node *node)
737 struct tipc_link_entry *le = &node->links[i];
742 node->link_cnt--;
756 /* If lock held by tipc_node_stop() the node will be deleted anyway */
785 /* tipc_node_timeout - handle expiration of node timer
809 /* Initial node interval to value larger (10 seconds), then it will be
921 * failover can be already started on peer node but not on this node.
930 * ==> Node 1 does never start link/node failover!
932 * @n: tipc node structure
1063 trace_tipc_node_link_down(n, true, "node link down or deleted!");
1136 /* Even this node may be in conflict */
1174 /* Prepare to validate requesting node's signature and media address */
1185 /* Peer node is not a container/local namespace */
1196 * chosen the same node address and signature as an
1211 /* Peer node rebooted. Two possibilities:
1214 * receiving a discovery message from that node.
1215 * (The peer happened to receive one from this node first).
1224 /* The peer node has rebooted.
1312 /* tipc_node_fsm_evt - node finite state machine
1313 * Determines when contact is allowed with peer node
1479 pr_err("Unknown node fsm state %x\n", state);
1487 pr_err("Illegal node fsm evt %x in state %x\n", evt, state);
1515 /* Notify publications from this node */
1519 /* Notify sockets connected to node */
1536 * @addr: peer node address
1546 struct tipc_node *node = tipc_node_find(net, addr);
1548 if (!node)
1554 tipc_node_read_lock(node);
1555 link = node->links[bearer_id].link;
1560 tipc_node_read_unlock(node);
1562 tipc_node_put(node);
1566 /* Caller should hold node lock for the passed node */
1567 static int __tipc_nl_add_node(struct tipc_nl_msg *msg, struct tipc_node *node)
1581 if (nla_put_u32(msg->skb, TIPC_NLA_NODE_ADDR, node->addr))
1583 if (node_is_up(node))
1655 * @dnode: address of destination node
1835 * tipc_node_bc_rcv - process TIPC broadcast packet arriving from off-node
1855 /* If NACK for other node, let rcv link for that node peek into it */
1896 * tipc_node_check_state - check and if necessary update node state
1916 trace_tipc_skb_dump(skb, false, "skb for node state check");
1942 /* Check and update node accesibility if applicable */
1971 "node link down <- failover!");
1977 * the tunnel link came up, node failover was never started.
1979 * NODE_FAILINGOVER state, also this node must accept
2046 * tipc_rcv - process TIPC packets/messages arriving from off-node
2101 /* Discard unicast link messages destined for another node */
2105 /* Locate neighboring node that sent packet */
2135 /* Check/update node state before receiving */
2198 /* Update MTU for node link entry */
2276 struct tipc_node *node;
2288 node = tipc_node_find(net, last_addr);
2289 if (!node) {
2295 * the NLM_F_DUMP_INTR flag set if the node state
2301 tipc_node_put(node);
2304 list_for_each_entry_rcu(node, &tn->node_list, list) {
2305 if (node->preliminary)
2308 if (node->addr == last_addr)
2314 tipc_node_read_lock(node);
2315 err = __tipc_nl_add_node(&msg, node);
2317 last_addr = node->addr;
2318 tipc_node_read_unlock(node);
2322 tipc_node_read_unlock(node);
2333 /* tipc_node_find_by_name - locate owner node of link by link's name
2336 * @bearer_id: pointer to index in 'node->links' array where the link was found.
2338 * Returns pointer to node owning the link, or 0 if no matching link is found.
2378 struct tipc_node *node;
2402 node = tipc_node_find_by_name(net, name, &bearer_id);
2403 if (!node)
2406 tipc_node_read_lock(node);
2408 link = node->links[bearer_id].link;
2446 tipc_node_read_unlock(node);
2447 tipc_bearer_xmit(net, bearer_id, &xmitq, &node->links[bearer_id].maddr,
2487 struct tipc_node *node;
2490 node = tipc_node_find_by_name(net, name, &bearer_id);
2491 if (!node) {
2496 tipc_node_read_lock(node);
2497 link = node->links[bearer_id].link;
2499 tipc_node_read_unlock(node);
2505 tipc_node_read_unlock(node);
2523 struct tipc_node *node;
2551 list_for_each_entry_rcu(node, &tn->node_list, list) {
2552 tipc_node_read_lock(node);
2553 link = node->bc_entry.link;
2556 tipc_node_read_unlock(node);
2559 tipc_node_read_unlock(node);
2565 node = tipc_node_find_by_name(net, link_name, &bearer_id);
2566 if (!node)
2569 le = &node->links[bearer_id];
2570 tipc_node_read_lock(node);
2572 link = node->links[bearer_id].link;
2575 tipc_node_read_unlock(node);
2580 tipc_node_read_unlock(node);
2584 /* Caller should hold node lock */
2586 struct tipc_node *node, u32 *prev_link,
2595 if (!node->links[i].link)
2599 node->links[i].link, NLM_F_MULTI);
2606 err = tipc_nl_add_bc_link(net, msg, node->bc_entry.link);
2622 struct tipc_node *node;
2655 node = tipc_node_find(net, prev_node);
2656 if (!node) {
2666 tipc_node_put(node);
2668 list_for_each_entry_continue_rcu(node, &tn->node_list,
2670 tipc_node_read_lock(node);
2671 err = __tipc_nl_add_node_links(net, &msg, node,
2673 tipc_node_read_unlock(node);
2677 prev_node = node->addr;
2684 list_for_each_entry_rcu(node, &tn->node_list, list) {
2685 tipc_node_read_lock(node);
2686 err = __tipc_nl_add_node_links(net, &msg, node,
2688 tipc_node_read_unlock(node);
2692 prev_node = node->addr;
2938 GENL_SET_ERR_MSG(info, "not found own node identity (set id?)");
3036 * tipc_node_dump - dump TIPC node data
3037 * @n: tipc node to be dumped
3039 * - false: dump only tipc node data
3040 * - true: dump node link data as well
3049 i += scnprintf(buf, sz, "node data: (null)\n");
3053 i += scnprintf(buf, sz, "node data: %x", n->addr);