diff options
author | Erik Hugne <erik.hugne@ericsson.com> | 2014-04-24 10:26:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-26 12:13:24 -0400 |
commit | a89778d8baf19cd7e728d81121a294a06cedaad1 (patch) | |
tree | 0b28a16308baf11df88b2557f0184156655c1cb7 /net/tipc/node.c | |
parent | d42f157b3498a042d9930506d4b55ded5dcb35c0 (diff) |
tipc: add support for link state subscriptions
When links are established over a bearer plane, we create a node
local publication containing information about the peer node and
bearer plane. This allows TIPC applications to use the standard
TIPC topology server subscription mechanism to get notifications
when a link goes up or down.
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r-- | net/tipc/node.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index be90115cda1a..3b86a74cb31f 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -144,9 +144,11 @@ void tipc_node_stop(void) | |||
144 | void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | 144 | void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) |
145 | { | 145 | { |
146 | struct tipc_link **active = &n_ptr->active_links[0]; | 146 | struct tipc_link **active = &n_ptr->active_links[0]; |
147 | u32 addr = n_ptr->addr; | ||
147 | 148 | ||
148 | n_ptr->working_links++; | 149 | n_ptr->working_links++; |
149 | 150 | tipc_nametbl_publish(TIPC_LINK_STATE, addr, addr, TIPC_NODE_SCOPE, | |
151 | l_ptr->bearer_id, addr); | ||
150 | pr_info("Established link <%s> on network plane %c\n", | 152 | pr_info("Established link <%s> on network plane %c\n", |
151 | l_ptr->name, l_ptr->net_plane); | 153 | l_ptr->name, l_ptr->net_plane); |
152 | 154 | ||
@@ -203,8 +205,10 @@ static void node_select_active_links(struct tipc_node *n_ptr) | |||
203 | void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | 205 | void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) |
204 | { | 206 | { |
205 | struct tipc_link **active; | 207 | struct tipc_link **active; |
208 | u32 addr = n_ptr->addr; | ||
206 | 209 | ||
207 | n_ptr->working_links--; | 210 | n_ptr->working_links--; |
211 | tipc_nametbl_withdraw(TIPC_LINK_STATE, addr, l_ptr->bearer_id, addr); | ||
208 | 212 | ||
209 | if (!tipc_link_is_active(l_ptr)) { | 213 | if (!tipc_link_is_active(l_ptr)) { |
210 | pr_info("Lost standby link <%s> on network plane %c\n", | 214 | pr_info("Lost standby link <%s> on network plane %c\n", |