diff options
Diffstat (limited to 'net/tipc/port.c')
-rw-r--r-- | net/tipc/port.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index b58a777a4399..edbd83d223c5 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -48,7 +48,6 @@ | |||
48 | DEFINE_SPINLOCK(tipc_port_list_lock); | 48 | DEFINE_SPINLOCK(tipc_port_list_lock); |
49 | 49 | ||
50 | static LIST_HEAD(ports); | 50 | static LIST_HEAD(ports); |
51 | static void port_handle_node_down(unsigned long ref); | ||
52 | static struct sk_buff *port_build_self_abort_msg(struct tipc_port *, u32 err); | 51 | static struct sk_buff *port_build_self_abort_msg(struct tipc_port *, u32 err); |
53 | static struct sk_buff *port_build_peer_abort_msg(struct tipc_port *, u32 err); | 52 | static struct sk_buff *port_build_peer_abort_msg(struct tipc_port *, u32 err); |
54 | static void port_timeout(unsigned long ref); | 53 | static void port_timeout(unsigned long ref); |
@@ -126,10 +125,10 @@ void tipc_port_destroy(struct tipc_port *p_ptr) | |||
126 | k_cancel_timer(&p_ptr->timer); | 125 | k_cancel_timer(&p_ptr->timer); |
127 | if (p_ptr->connected) { | 126 | if (p_ptr->connected) { |
128 | buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT); | 127 | buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT); |
129 | tipc_nodesub_unsubscribe(&p_ptr->subscription); | ||
130 | msg = buf_msg(buf); | 128 | msg = buf_msg(buf); |
131 | peer = msg_destnode(msg); | 129 | peer = msg_destnode(msg); |
132 | tipc_link_xmit(buf, peer, msg_link_selector(msg)); | 130 | tipc_link_xmit(buf, peer, msg_link_selector(msg)); |
131 | tipc_node_remove_conn(peer, p_ptr->ref); | ||
133 | } | 132 | } |
134 | spin_lock_bh(&tipc_port_list_lock); | 133 | spin_lock_bh(&tipc_port_list_lock); |
135 | list_del(&p_ptr->port_list); | 134 | list_del(&p_ptr->port_list); |
@@ -188,22 +187,6 @@ static void port_timeout(unsigned long ref) | |||
188 | tipc_link_xmit(buf, msg_destnode(msg), msg_link_selector(msg)); | 187 | tipc_link_xmit(buf, msg_destnode(msg), msg_link_selector(msg)); |
189 | } | 188 | } |
190 | 189 | ||
191 | |||
192 | static void port_handle_node_down(unsigned long ref) | ||
193 | { | ||
194 | struct tipc_port *p_ptr = tipc_port_lock(ref); | ||
195 | struct sk_buff *buf = NULL; | ||
196 | struct tipc_msg *msg = NULL; | ||
197 | |||
198 | if (!p_ptr) | ||
199 | return; | ||
200 | buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE); | ||
201 | tipc_port_unlock(p_ptr); | ||
202 | msg = buf_msg(buf); | ||
203 | tipc_link_xmit(buf, msg_destnode(msg), msg_link_selector(msg)); | ||
204 | } | ||
205 | |||
206 | |||
207 | static struct sk_buff *port_build_self_abort_msg(struct tipc_port *p_ptr, u32 err) | 190 | static struct sk_buff *port_build_self_abort_msg(struct tipc_port *p_ptr, u32 err) |
208 | { | 191 | { |
209 | struct sk_buff *buf = port_build_peer_abort_msg(p_ptr, err); | 192 | struct sk_buff *buf = port_build_peer_abort_msg(p_ptr, err); |
@@ -217,7 +200,6 @@ static struct sk_buff *port_build_self_abort_msg(struct tipc_port *p_ptr, u32 er | |||
217 | return buf; | 200 | return buf; |
218 | } | 201 | } |
219 | 202 | ||
220 | |||
221 | static struct sk_buff *port_build_peer_abort_msg(struct tipc_port *p_ptr, u32 err) | 203 | static struct sk_buff *port_build_peer_abort_msg(struct tipc_port *p_ptr, u32 err) |
222 | { | 204 | { |
223 | struct sk_buff *buf; | 205 | struct sk_buff *buf; |
@@ -447,11 +429,8 @@ int __tipc_port_connect(u32 ref, struct tipc_port *p_ptr, | |||
447 | p_ptr->probing_state = TIPC_CONN_OK; | 429 | p_ptr->probing_state = TIPC_CONN_OK; |
448 | p_ptr->connected = 1; | 430 | p_ptr->connected = 1; |
449 | k_start_timer(&p_ptr->timer, p_ptr->probing_interval); | 431 | k_start_timer(&p_ptr->timer, p_ptr->probing_interval); |
450 | 432 | res = tipc_node_add_conn(tipc_port_peernode(p_ptr), p_ptr->ref, | |
451 | tipc_nodesub_subscribe(&p_ptr->subscription, peer->node, | 433 | tipc_port_peerport(p_ptr)); |
452 | (void *)(unsigned long)ref, | ||
453 | (net_ev_handler)port_handle_node_down); | ||
454 | res = 0; | ||
455 | exit: | 434 | exit: |
456 | p_ptr->max_pkt = tipc_node_get_mtu(peer->node, ref); | 435 | p_ptr->max_pkt = tipc_node_get_mtu(peer->node, ref); |
457 | return res; | 436 | return res; |
@@ -467,7 +446,7 @@ int __tipc_port_disconnect(struct tipc_port *tp_ptr) | |||
467 | if (tp_ptr->connected) { | 446 | if (tp_ptr->connected) { |
468 | tp_ptr->connected = 0; | 447 | tp_ptr->connected = 0; |
469 | /* let timer expire on it's own to avoid deadlock! */ | 448 | /* let timer expire on it's own to avoid deadlock! */ |
470 | tipc_nodesub_unsubscribe(&tp_ptr->subscription); | 449 | tipc_node_remove_conn(tipc_port_peernode(tp_ptr), tp_ptr->ref); |
471 | return 0; | 450 | return 0; |
472 | } | 451 | } |
473 | 452 | ||