Netdev List
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Allan.Stephens@windriver.com,
	Allan Stephens <allan.stephens@windriver.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH net-next 20/20] tipc: Optimize creation of connection protocol messages
Date: Fri, 24 Jun 2011 18:07:27 -0400	[thread overview]
Message-ID: <1308953247-25266-21-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1308953247-25266-1-git-send-email-paul.gortmaker@windriver.com>

From: Allan Stephens <allan.stephens@windriver.com>

Simplifies the creation of connection protocol messages by eliminating
the passing of information that is no longer required, is constant,
or is contained within the port structure that is issuing the message.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 net/tipc/port.c |   48 ++++++++++++------------------------------------
 1 files changed, 12 insertions(+), 36 deletions(-)

diff --git a/net/tipc/port.c b/net/tipc/port.c
index ab0a8e9..54d812a 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -327,14 +327,12 @@ int tipc_set_portunreturnable(u32 ref, unsigned int isunrejectable)
 }
 
 /*
- * port_build_proto_msg(): build a port level protocol
- * or a connection abortion message. Called with
- * tipc_port lock on.
+ * port_build_proto_msg(): create connection protocol message for port
+ *
+ * On entry the port must be locked and connected.
  */
-static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
-					    u32 origport, u32 orignode,
-					    u32 usr, u32 type, u32 err,
-					    u32 ack)
+static struct sk_buff *port_build_proto_msg(struct tipc_port *p_ptr,
+					    u32 type, u32 ack)
 {
 	struct sk_buff *buf;
 	struct tipc_msg *msg;
@@ -342,11 +340,10 @@ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
 	buf = tipc_buf_acquire(INT_H_SIZE);
 	if (buf) {
 		msg = buf_msg(buf);
-		tipc_msg_init(msg, usr, type, INT_H_SIZE, destnode);
-		msg_set_errcode(msg, err);
-		msg_set_destport(msg, destport);
-		msg_set_origport(msg, origport);
-		msg_set_orignode(msg, orignode);
+		tipc_msg_init(msg, CONN_MANAGER, type, INT_H_SIZE,
+			      port_peernode(p_ptr));
+		msg_set_destport(msg, port_peerport(p_ptr));
+		msg_set_origport(msg, p_ptr->ref);
 		msg_set_msgcnt(msg, ack);
 	}
 	return buf;
@@ -458,14 +455,7 @@ static void port_timeout(unsigned long ref)
 	if (p_ptr->probing_state == PROBING) {
 		buf = port_build_self_abort_msg(p_ptr, TIPC_ERR_NO_PORT);
 	} else {
-		buf = port_build_proto_msg(port_peerport(p_ptr),
-					   port_peernode(p_ptr),
-					   p_ptr->ref,
-					   tipc_own_addr,
-					   CONN_MANAGER,
-					   CONN_PROBE,
-					   TIPC_OK,
-					   0);
+		buf = port_build_proto_msg(p_ptr, CONN_PROBE, 0);
 		p_ptr->probing_state = PROBING;
 		k_start_timer(&p_ptr->timer, p_ptr->probing_interval);
 	}
@@ -567,14 +557,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
 		}
 		break;
 	case CONN_PROBE:
-		r_buf = port_build_proto_msg(origport,
-					     orignode,
-					     destport,
-					     tipc_own_addr,
-					     CONN_MANAGER,
-					     CONN_PROBE_REPLY,
-					     TIPC_OK,
-					     0);
+		r_buf = port_build_proto_msg(p_ptr, CONN_PROBE_REPLY, 0);
 		break;
 	default:
 		/* CONN_PROBE_REPLY or unrecognized - no action required */
@@ -899,14 +882,7 @@ void tipc_acknowledge(u32 ref, u32 ack)
 		return;
 	if (p_ptr->connected) {
 		p_ptr->conn_unacked -= ack;
-		buf = port_build_proto_msg(port_peerport(p_ptr),
-					   port_peernode(p_ptr),
-					   ref,
-					   tipc_own_addr,
-					   CONN_MANAGER,
-					   CONN_ACK,
-					   TIPC_OK,
-					   ack);
+		buf = port_build_proto_msg(p_ptr, CONN_ACK, ack);
 	}
 	tipc_port_unlock(p_ptr);
 	tipc_net_route_msg(buf);
-- 
1.7.4.4


  parent reply	other threads:[~2011-06-24 22:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-24 22:07 [PATCH net-next 00/20] misc tipc updates / enhancements Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 01/20] tipc: Convert fatal broadcast sanity check to non-fatal check Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 02/20] tipc: Remove unused sanity test macro Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 03/20] tipc: Standardize exit logic for message rejection handling Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 04/20] tipc: Add sanity check to detect rejection of non-payload messages Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 05/20] tipc: Optimize routing of returned payload messages Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 06/20] tipc: Optimizations & corrections to message rejection Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 07/20] tipc: Eliminate message header routines for caching destination node Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 08/20] tipc: Eliminate redundant masking in message header routines Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 09/20] tipc: Partition name table instance array info into two parts Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 10/20] tipc: Convert name table publication lists to standard kernel lists Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 11/20] tipc: Eliminate checks for empty zone list during name translation Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 12/20] tipc: Correct typo in link statistics output Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 13/20] tipc: Eliminate unused field in bearer structure Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 14/20] tipc: Remove unnecessary includes in socket code Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 15/20] tipc: Eliminate useless check when creating internal message Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 16/20] tipc: Cleanup of message header size terminology Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 17/20] tipc: Optimize creation of FIN messages Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 18/20] tipc: Reject connection protocol message sent to unconnected port Paul Gortmaker
2011-06-24 22:07 ` [PATCH net-next 19/20] tipc: Don't create payload message using connection protocol routine Paul Gortmaker
2011-06-24 22:07 ` Paul Gortmaker [this message]
2011-06-24 23:55 ` [PATCH net-next 00/20] misc tipc updates / enhancements David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1308953247-25266-21-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=Allan.Stephens@windriver.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox