aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/port.c48
1 files changed, 12 insertions, 36 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c
index ab0a8e97e315..54d812a5a4d9 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -327,14 +327,12 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable)
327} 327}
328 328
329/* 329/*
330 * port_build_proto_msg(): build a port level protocol 330 * port_build_proto_msg(): create connection protocol message for port
331 * or a connection abortion message. Called with 331 *
332 * tipc_port lock on. 332 * On entry the port must be locked and connected.
333 */ 333 */
334static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode, 334static struct sk_buff *port_build_proto_msg(struct tipc_port *p_ptr,
335 u32 origport, u32 orignode, 335 u32 type, u32 ack)
336 u32 usr, u32 type, u32 err,
337 u32 ack)
338{ 336{
339 struct sk_buff *buf; 337 struct sk_buff *buf;
340 struct tipc_msg *msg; 338 struct tipc_msg *msg;
@@ -342,11 +340,10 @@ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
342 buf = tipc_buf_acquire(INT_H_SIZE); 340 buf = tipc_buf_acquire(INT_H_SIZE);
343 if (buf) { 341 if (buf) {
344 msg = buf_msg(buf); 342 msg = buf_msg(buf);
345 tipc_msg_init(msg, usr, type, INT_H_SIZE, destnode); 343 tipc_msg_init(msg, CONN_MANAGER, type, INT_H_SIZE,
346 msg_set_errcode(msg, err); 344 port_peernode(p_ptr));
347 msg_set_destport(msg, destport); 345 msg_set_destport(msg, port_peerport(p_ptr));
348 msg_set_origport(msg, origport); 346 msg_set_origport(msg, p_ptr->ref);
349 msg_set_orignode(msg, orignode);
350 msg_set_msgcnt(msg, ack); 347 msg_set_msgcnt(msg, ack);
351 } 348 }
352 return buf; 349 return buf;
@@ -458,14 +455,7 @@ static void port_timeout(unsigned long ref)
458 if (p_ptr->probing_state == PROBING) { 455 if (p_ptr->probing_state == PROBING) {
459 buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_PORT); 456 buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
460 } else { 457 } else {
461 buf = port_build_proto_msg(port_peerport(p_ptr), 458 buf = port_build_proto_msg(p_ptr, CONN_PROBE, 0);
462 port_peernode(p_ptr),
463 p_ptr->ref,
464 tipc_own_addr,
465 CONN_MANAGER,
466 CONN_PROBE,
467 TIPC_OK,
468 0);
469 p_ptr->probing_state = PROBING; 459 p_ptr->probing_state = PROBING;
470 k_start_timer(&p_ptr->timer, p_ptr->probing_interval); 460 k_start_timer(&p_ptr->timer, p_ptr->probing_interval);
471 } 461 }
@@ -567,14 +557,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
567 } 557 }
568 break; 558 break;
569 case CONN_PROBE: 559 case CONN_PROBE:
570 r_buf = port_build_proto_msg(origport, 560 r_buf = port_build_proto_msg(p_ptr, CONN_PROBE_REPLY, 0);
571 orignode,
572 destport,
573 tipc_own_addr,
574 CONN_MANAGER,
575 CONN_PROBE_REPLY,
576 TIPC_OK,
577 0);
578 break; 561 break;
579 default: 562 default:
580 /* CONN_PROBE_REPLY or unrecognized - no action required */ 563 /* CONN_PROBE_REPLY or unrecognized - no action required */
@@ -899,14 +882,7 @@ void tipc_acknowledge(u32 ref, u32 ack)
899 return; 882 return;
900 if (p_ptr->connected) { 883 if (p_ptr->connected) {
901 p_ptr->conn_unacked -= ack; 884 p_ptr->conn_unacked -= ack;
902 buf = port_build_proto_msg(port_peerport(p_ptr), 885 buf = port_build_proto_msg(p_ptr, CONN_ACK, ack);
903 port_peernode(p_ptr),
904 ref,
905 tipc_own_addr,
906 CONN_MANAGER,
907 CONN_ACK,
908 TIPC_OK,
909 ack);
910 } 886 }
911 tipc_port_unlock(p_ptr); 887 tipc_port_unlock(p_ptr);
912 tipc_net_route_msg(buf); 888 tipc_net_route_msg(buf);