aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/node.h')
-rw-r--r--net/tipc/node.h53
1 files changed, 30 insertions, 23 deletions
diff --git a/net/tipc/node.h b/net/tipc/node.h
index cbe0e950f1cc..3d18c66b7f78 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * net/tipc/node.h: Include file for TIPC node management routines 2 * net/tipc/node.h: Include file for TIPC node management routines
3 * 3 *
4 * Copyright (c) 2000-2006, 2014, Ericsson AB 4 * Copyright (c) 2000-2006, 2014-2015, Ericsson AB
5 * Copyright (c) 2005, 2010-2014, Wind River Systems 5 * Copyright (c) 2005, 2010-2014, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
@@ -42,10 +42,10 @@
42#include "bearer.h" 42#include "bearer.h"
43#include "msg.h" 43#include "msg.h"
44 44
45/* 45/* Out-of-range value for node signature */
46 * Out-of-range value for node signature 46#define INVALID_NODE_SIG 0x10000
47 */ 47
48#define INVALID_NODE_SIG 0x10000 48#define NODE_HTABLE_SIZE 512
49 49
50/* Flags used to take different actions according to flag type 50/* Flags used to take different actions according to flag type
51 * TIPC_WAIT_PEER_LINKS_DOWN: wait to see that peer's links are down 51 * TIPC_WAIT_PEER_LINKS_DOWN: wait to see that peer's links are down
@@ -55,14 +55,16 @@
55 * TIPC_DISTRIBUTE_NAME: publish or withdraw link state name type 55 * TIPC_DISTRIBUTE_NAME: publish or withdraw link state name type
56 */ 56 */
57enum { 57enum {
58 TIPC_MSG_EVT = 1,
58 TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1), 59 TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1),
59 TIPC_WAIT_OWN_LINKS_DOWN = (1 << 2), 60 TIPC_WAIT_OWN_LINKS_DOWN = (1 << 2),
60 TIPC_NOTIFY_NODE_DOWN = (1 << 3), 61 TIPC_NOTIFY_NODE_DOWN = (1 << 3),
61 TIPC_NOTIFY_NODE_UP = (1 << 4), 62 TIPC_NOTIFY_NODE_UP = (1 << 4),
62 TIPC_WAKEUP_USERS = (1 << 5), 63 TIPC_WAKEUP_BCAST_USERS = (1 << 5),
63 TIPC_WAKEUP_BCAST_USERS = (1 << 6), 64 TIPC_NOTIFY_LINK_UP = (1 << 6),
64 TIPC_NOTIFY_LINK_UP = (1 << 7), 65 TIPC_NOTIFY_LINK_DOWN = (1 << 7),
65 TIPC_NOTIFY_LINK_DOWN = (1 << 8) 66 TIPC_NAMED_MSG_EVT = (1 << 8),
67 TIPC_BCAST_MSG_EVT = (1 << 9)
66}; 68};
67 69
68/** 70/**
@@ -73,6 +75,7 @@ enum {
73 * @oos_state: state tracker for handling OOS b'cast messages 75 * @oos_state: state tracker for handling OOS b'cast messages
74 * @deferred_queue: deferred queue saved OOS b'cast message received from node 76 * @deferred_queue: deferred queue saved OOS b'cast message received from node
75 * @reasm_buf: broadcast reassembly queue head from node 77 * @reasm_buf: broadcast reassembly queue head from node
78 * @inputq_map: bitmap indicating which inqueues should be kicked
76 * @recv_permitted: true if node is allowed to receive b'cast messages 79 * @recv_permitted: true if node is allowed to receive b'cast messages
77 */ 80 */
78struct tipc_node_bclink { 81struct tipc_node_bclink {
@@ -83,6 +86,7 @@ struct tipc_node_bclink {
83 u32 deferred_size; 86 u32 deferred_size;
84 struct sk_buff_head deferred_queue; 87 struct sk_buff_head deferred_queue;
85 struct sk_buff *reasm_buf; 88 struct sk_buff *reasm_buf;
89 int inputq_map;
86 bool recv_permitted; 90 bool recv_permitted;
87}; 91};
88 92
@@ -90,7 +94,11 @@ struct tipc_node_bclink {
90 * struct tipc_node - TIPC node structure 94 * struct tipc_node - TIPC node structure
91 * @addr: network address of node 95 * @addr: network address of node
92 * @lock: spinlock governing access to structure 96 * @lock: spinlock governing access to structure
97 * @net: the applicable net namespace
93 * @hash: links to adjacent nodes in unsorted hash chain 98 * @hash: links to adjacent nodes in unsorted hash chain
99 * @inputq: pointer to input queue containing messages for msg event
100 * @namedq: pointer to name table input queue with name table messages
101 * @curr_link: the link holding the node lock, if any
94 * @active_links: pointers to active links to node 102 * @active_links: pointers to active links to node
95 * @links: pointers to all links to node 103 * @links: pointers to all links to node
96 * @action_flags: bit mask of different types of node actions 104 * @action_flags: bit mask of different types of node actions
@@ -106,11 +114,14 @@ struct tipc_node_bclink {
106struct tipc_node { 114struct tipc_node {
107 u32 addr; 115 u32 addr;
108 spinlock_t lock; 116 spinlock_t lock;
117 struct net *net;
109 struct hlist_node hash; 118 struct hlist_node hash;
119 struct sk_buff_head *inputq;
120 struct sk_buff_head *namedq;
110 struct tipc_link *active_links[2]; 121 struct tipc_link *active_links[2];
111 u32 act_mtus[2]; 122 u32 act_mtus[2];
112 struct tipc_link *links[MAX_BEARERS]; 123 struct tipc_link *links[MAX_BEARERS];
113 unsigned int action_flags; 124 int action_flags;
114 struct tipc_node_bclink bclink; 125 struct tipc_node_bclink bclink;
115 struct list_head list; 126 struct list_head list;
116 int link_cnt; 127 int link_cnt;
@@ -118,28 +129,24 @@ struct tipc_node {
118 u32 signature; 129 u32 signature;
119 u32 link_id; 130 u32 link_id;
120 struct list_head publ_list; 131 struct list_head publ_list;
121 struct sk_buff_head waiting_sks;
122 struct list_head conn_sks; 132 struct list_head conn_sks;
123 struct rcu_head rcu; 133 struct rcu_head rcu;
124}; 134};
125 135
126extern struct list_head tipc_node_list; 136struct tipc_node *tipc_node_find(struct net *net, u32 addr);
127 137struct tipc_node *tipc_node_create(struct net *net, u32 addr);
128struct tipc_node *tipc_node_find(u32 addr); 138void tipc_node_stop(struct net *net);
129struct tipc_node *tipc_node_create(u32 addr);
130void tipc_node_stop(void);
131void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); 139void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr);
132void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); 140void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr);
133void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr); 141void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr);
134void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr); 142void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr);
135int tipc_node_active_links(struct tipc_node *n_ptr); 143int tipc_node_active_links(struct tipc_node *n_ptr);
136int tipc_node_is_up(struct tipc_node *n_ptr); 144int tipc_node_is_up(struct tipc_node *n_ptr);
137struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space); 145int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 node,
138struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space); 146 char *linkname, size_t len);
139int tipc_node_get_linkname(u32 bearer_id, u32 node, char *linkname, size_t len);
140void tipc_node_unlock(struct tipc_node *node); 147void tipc_node_unlock(struct tipc_node *node);
141int tipc_node_add_conn(u32 dnode, u32 port, u32 peer_port); 148int tipc_node_add_conn(struct net *net, u32 dnode, u32 port, u32 peer_port);
142void tipc_node_remove_conn(u32 dnode, u32 port); 149void tipc_node_remove_conn(struct net *net, u32 dnode, u32 port);
143 150
144int tipc_nl_node_dump(struct sk_buff *skb, struct netlink_callback *cb); 151int tipc_nl_node_dump(struct sk_buff *skb, struct netlink_callback *cb);
145 152
@@ -154,12 +161,12 @@ static inline bool tipc_node_blocked(struct tipc_node *node)
154 TIPC_NOTIFY_NODE_DOWN | TIPC_WAIT_OWN_LINKS_DOWN)); 161 TIPC_NOTIFY_NODE_DOWN | TIPC_WAIT_OWN_LINKS_DOWN));
155} 162}
156 163
157static inline uint tipc_node_get_mtu(u32 addr, u32 selector) 164static inline uint tipc_node_get_mtu(struct net *net, u32 addr, u32 selector)
158{ 165{
159 struct tipc_node *node; 166 struct tipc_node *node;
160 u32 mtu; 167 u32 mtu;
161 168
162 node = tipc_node_find(addr); 169 node = tipc_node_find(net, addr);
163 170
164 if (likely(node)) 171 if (likely(node))
165 mtu = node->act_mtus[selector & 1]; 172 mtu = node->act_mtus[selector & 1];