瀏覽代碼

tipc: let port protocol senders use new link send function

Several functions in port.c, related to the port protocol and
connection shutdown, need to send messages. We now convert them
to use the new link send function.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Jon Paul Maloy 11 年之前
父節點
當前提交
b786e2b0fa
共有 1 個文件被更改,包括 23 次插入7 次删除
  1. 23 7
      net/tipc/port.c

+ 23 - 7
net/tipc/port.c

@@ -236,6 +236,8 @@ u32 tipc_port_init(struct tipc_port *p_ptr,
 void tipc_port_destroy(struct tipc_port *p_ptr)
 void tipc_port_destroy(struct tipc_port *p_ptr)
 {
 {
 	struct sk_buff *buf = NULL;
 	struct sk_buff *buf = NULL;
+	struct tipc_msg *msg = NULL;
+	u32 peer;
 
 
 	tipc_withdraw(p_ptr, 0, NULL);
 	tipc_withdraw(p_ptr, 0, NULL);
 
 
@@ -247,14 +249,15 @@ void tipc_port_destroy(struct tipc_port *p_ptr)
 	if (p_ptr->connected) {
 	if (p_ptr->connected) {
 		buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
 		buf = port_build_peer_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
 		tipc_nodesub_unsubscribe(&p_ptr->subscription);
 		tipc_nodesub_unsubscribe(&p_ptr->subscription);
+		msg = buf_msg(buf);
+		peer = msg_destnode(msg);
+		tipc_link_xmit2(buf, peer, msg_link_selector(msg));
 	}
 	}
-
 	spin_lock_bh(&tipc_port_list_lock);
 	spin_lock_bh(&tipc_port_list_lock);
 	list_del(&p_ptr->port_list);
 	list_del(&p_ptr->port_list);
 	list_del(&p_ptr->wait_list);
 	list_del(&p_ptr->wait_list);
 	spin_unlock_bh(&tipc_port_list_lock);
 	spin_unlock_bh(&tipc_port_list_lock);
 	k_term_timer(&p_ptr->timer);
 	k_term_timer(&p_ptr->timer);
-	tipc_net_route_msg(buf);
 }
 }
 
 
 /*
 /*
@@ -276,6 +279,7 @@ static struct sk_buff *port_build_proto_msg(struct tipc_port *p_ptr,
 		msg_set_destport(msg, tipc_port_peerport(p_ptr));
 		msg_set_destport(msg, tipc_port_peerport(p_ptr));
 		msg_set_origport(msg, p_ptr->ref);
 		msg_set_origport(msg, p_ptr->ref);
 		msg_set_msgcnt(msg, ack);
 		msg_set_msgcnt(msg, ack);
+		buf->next = NULL;
 	}
 	}
 	return buf;
 	return buf;
 }
 }
@@ -284,6 +288,7 @@ static void port_timeout(unsigned long ref)
 {
 {
 	struct tipc_port *p_ptr = tipc_port_lock(ref);
 	struct tipc_port *p_ptr = tipc_port_lock(ref);
 	struct sk_buff *buf = NULL;
 	struct sk_buff *buf = NULL;
+	struct tipc_msg *msg = NULL;
 
 
 	if (!p_ptr)
 	if (!p_ptr)
 		return;
 		return;
@@ -302,7 +307,8 @@ static void port_timeout(unsigned long ref)
 		k_start_timer(&p_ptr->timer, p_ptr->probing_interval);
 		k_start_timer(&p_ptr->timer, p_ptr->probing_interval);
 	}
 	}
 	tipc_port_unlock(p_ptr);
 	tipc_port_unlock(p_ptr);
-	tipc_net_route_msg(buf);
+	msg = buf_msg(buf);
+	tipc_link_xmit2(buf, msg_destnode(msg),	msg_link_selector(msg));
 }
 }
 
 
 
 
@@ -310,12 +316,14 @@ static void port_handle_node_down(unsigned long ref)
 {
 {
 	struct tipc_port *p_ptr = tipc_port_lock(ref);
 	struct tipc_port *p_ptr = tipc_port_lock(ref);
 	struct sk_buff *buf = NULL;
 	struct sk_buff *buf = NULL;
+	struct tipc_msg *msg = NULL;
 
 
 	if (!p_ptr)
 	if (!p_ptr)
 		return;
 		return;
 	buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE);
 	buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_NODE);
 	tipc_port_unlock(p_ptr);
 	tipc_port_unlock(p_ptr);
-	tipc_net_route_msg(buf);
+	msg = buf_msg(buf);
+	tipc_link_xmit2(buf, msg_destnode(msg),	msg_link_selector(msg));
 }
 }
 
 
 
 
@@ -327,6 +335,7 @@ static struct sk_buff *port_build_self_abort_msg(struct tipc_port *p_ptr, u32 er
 		struct tipc_msg *msg = buf_msg(buf);
 		struct tipc_msg *msg = buf_msg(buf);
 		msg_swap_words(msg, 4, 5);
 		msg_swap_words(msg, 4, 5);
 		msg_swap_words(msg, 6, 7);
 		msg_swap_words(msg, 6, 7);
+		buf->next = NULL;
 	}
 	}
 	return buf;
 	return buf;
 }
 }
@@ -351,6 +360,7 @@ static struct sk_buff *port_build_peer_abort_msg(struct tipc_port *p_ptr, u32 er
 		if (imp < TIPC_CRITICAL_IMPORTANCE)
 		if (imp < TIPC_CRITICAL_IMPORTANCE)
 			msg_set_importance(msg, ++imp);
 			msg_set_importance(msg, ++imp);
 		msg_set_errcode(msg, err);
 		msg_set_errcode(msg, err);
+		buf->next = NULL;
 	}
 	}
 	return buf;
 	return buf;
 }
 }
@@ -401,7 +411,7 @@ void tipc_port_proto_rcv(struct sk_buff *buf)
 	p_ptr->probing_state = CONFIRMED;
 	p_ptr->probing_state = CONFIRMED;
 	tipc_port_unlock(p_ptr);
 	tipc_port_unlock(p_ptr);
 exit:
 exit:
-	tipc_net_route_msg(r_buf);
+	tipc_link_xmit2(r_buf, msg_destnode(msg), msg_link_selector(msg));
 	kfree_skb(buf);
 	kfree_skb(buf);
 }
 }
 
 
@@ -496,6 +506,7 @@ void tipc_acknowledge(u32 ref, u32 ack)
 {
 {
 	struct tipc_port *p_ptr;
 	struct tipc_port *p_ptr;
 	struct sk_buff *buf = NULL;
 	struct sk_buff *buf = NULL;
+	struct tipc_msg *msg;
 
 
 	p_ptr = tipc_port_lock(ref);
 	p_ptr = tipc_port_lock(ref);
 	if (!p_ptr)
 	if (!p_ptr)
@@ -505,7 +516,10 @@ void tipc_acknowledge(u32 ref, u32 ack)
 		buf = port_build_proto_msg(p_ptr, CONN_ACK, ack);
 		buf = port_build_proto_msg(p_ptr, CONN_ACK, ack);
 	}
 	}
 	tipc_port_unlock(p_ptr);
 	tipc_port_unlock(p_ptr);
-	tipc_net_route_msg(buf);
+	if (!buf)
+		return;
+	msg = buf_msg(buf);
+	tipc_link_xmit2(buf, msg_destnode(msg),	msg_link_selector(msg));
 }
 }
 
 
 int tipc_publish(struct tipc_port *p_ptr, unsigned int scope,
 int tipc_publish(struct tipc_port *p_ptr, unsigned int scope,
@@ -656,6 +670,7 @@ int tipc_port_disconnect(u32 ref)
  */
  */
 int tipc_port_shutdown(u32 ref)
 int tipc_port_shutdown(u32 ref)
 {
 {
+	struct tipc_msg *msg;
 	struct tipc_port *p_ptr;
 	struct tipc_port *p_ptr;
 	struct sk_buff *buf = NULL;
 	struct sk_buff *buf = NULL;
 
 
@@ -665,6 +680,7 @@ int tipc_port_shutdown(u32 ref)
 
 
 	buf = port_build_peer_abort_msg(p_ptr, TIPC_CONN_SHUTDOWN);
 	buf = port_build_peer_abort_msg(p_ptr, TIPC_CONN_SHUTDOWN);
 	tipc_port_unlock(p_ptr);
 	tipc_port_unlock(p_ptr);
-	tipc_net_route_msg(buf);
+	msg = buf_msg(buf);
+	tipc_link_xmit2(buf, msg_destnode(msg),	msg_link_selector(msg));
 	return tipc_port_disconnect(ref);
 	return tipc_port_disconnect(ref);
 }
 }