diff options
Diffstat (limited to 'net/tipc/node.h')
-rw-r--r-- | net/tipc/node.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/tipc/node.h b/net/tipc/node.h index e89ac04ec2c3..02d5c20dc551 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
@@ -64,7 +64,8 @@ enum { | |||
64 | TIPC_NOTIFY_LINK_UP = (1 << 6), | 64 | TIPC_NOTIFY_LINK_UP = (1 << 6), |
65 | TIPC_NOTIFY_LINK_DOWN = (1 << 7), | 65 | TIPC_NOTIFY_LINK_DOWN = (1 << 7), |
66 | TIPC_NAMED_MSG_EVT = (1 << 8), | 66 | TIPC_NAMED_MSG_EVT = (1 << 8), |
67 | TIPC_BCAST_MSG_EVT = (1 << 9) | 67 | TIPC_BCAST_MSG_EVT = (1 << 9), |
68 | TIPC_BCAST_RESET = (1 << 10) | ||
68 | }; | 69 | }; |
69 | 70 | ||
70 | /** | 71 | /** |
@@ -93,6 +94,7 @@ struct tipc_node_bclink { | |||
93 | /** | 94 | /** |
94 | * struct tipc_node - TIPC node structure | 95 | * struct tipc_node - TIPC node structure |
95 | * @addr: network address of node | 96 | * @addr: network address of node |
97 | * @ref: reference counter to node object | ||
96 | * @lock: spinlock governing access to structure | 98 | * @lock: spinlock governing access to structure |
97 | * @net: the applicable net namespace | 99 | * @net: the applicable net namespace |
98 | * @hash: links to adjacent nodes in unsorted hash chain | 100 | * @hash: links to adjacent nodes in unsorted hash chain |
@@ -114,6 +116,7 @@ struct tipc_node_bclink { | |||
114 | */ | 116 | */ |
115 | struct tipc_node { | 117 | struct tipc_node { |
116 | u32 addr; | 118 | u32 addr; |
119 | struct kref kref; | ||
117 | spinlock_t lock; | 120 | spinlock_t lock; |
118 | struct net *net; | 121 | struct net *net; |
119 | struct hlist_node hash; | 122 | struct hlist_node hash; |
@@ -136,6 +139,7 @@ struct tipc_node { | |||
136 | }; | 139 | }; |
137 | 140 | ||
138 | struct tipc_node *tipc_node_find(struct net *net, u32 addr); | 141 | struct tipc_node *tipc_node_find(struct net *net, u32 addr); |
142 | void tipc_node_put(struct tipc_node *node); | ||
139 | struct tipc_node *tipc_node_create(struct net *net, u32 addr); | 143 | struct tipc_node *tipc_node_create(struct net *net, u32 addr); |
140 | void tipc_node_stop(struct net *net); | 144 | void tipc_node_stop(struct net *net); |
141 | void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); | 145 | void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr); |
@@ -170,10 +174,12 @@ static inline uint tipc_node_get_mtu(struct net *net, u32 addr, u32 selector) | |||
170 | 174 | ||
171 | node = tipc_node_find(net, addr); | 175 | node = tipc_node_find(net, addr); |
172 | 176 | ||
173 | if (likely(node)) | 177 | if (likely(node)) { |
174 | mtu = node->act_mtus[selector & 1]; | 178 | mtu = node->act_mtus[selector & 1]; |
175 | else | 179 | tipc_node_put(node); |
180 | } else { | ||
176 | mtu = MAX_MSG_SIZE; | 181 | mtu = MAX_MSG_SIZE; |
182 | } | ||
177 | 183 | ||
178 | return mtu; | 184 | return mtu; |
179 | } | 185 | } |