netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/4] tipc: Minor optimizations to name table translation code
@ 2010-09-03 18:33 Paul Gortmaker
  2010-09-03 18:33 ` [PATCH net-next 2/4] tipc: Ensure outgoing messages on Ethernet have sufficient headroom Paul Gortmaker
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Paul Gortmaker @ 2010-09-03 18:33 UTC (permalink / raw)
  To: davem; +Cc: netdev, allan.stephens

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

Optimizes TIPC's name table translation code to avoid unnecessary
manipulation of the node address field of the resulting port id when
name translation fails.  This change is possible because a valid port
id cannot have a reference field of zero, so examining the reference
only is sufficient to determine if the translation was successful.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 net/tipc/name_table.c |    4 +---
 net/tipc/port.c       |    4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index d504e49..c13c2c7 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -613,8 +613,7 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
 }
 
 /*
- * tipc_nametbl_translate(): Translate tipc_name -> tipc_portid.
- *                      Very time-critical.
+ * tipc_nametbl_translate - translate name to port id
  *
  * Note: on entry 'destnode' is the search domain used during translation;
  *       on exit it passes back the node address of the matching port (if any)
@@ -685,7 +684,6 @@ found:
 	}
 	spin_unlock_bh(&seq->lock);
 not_found:
-	*destnode = 0;
 	read_unlock_bh(&tipc_nametbl_lock);
 	return 0;
 }
diff --git a/net/tipc/port.c b/net/tipc/port.c
index ebcbc21..d760336 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -1464,7 +1464,7 @@ int tipc_forward2name(u32 ref,
 	msg_set_destnode(msg, destnode);
 	msg_set_destport(msg, destport);
 
-	if (likely(destport || destnode)) {
+	if (likely(destport)) {
 		p_ptr->sent++;
 		if (likely(destnode == tipc_own_addr))
 			return tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
@@ -1542,7 +1542,7 @@ int tipc_forward_buf2name(u32 ref,
 	skb_push(buf, LONG_H_SIZE);
 	skb_copy_to_linear_data(buf, msg, LONG_H_SIZE);
 	msg_dbg(buf_msg(buf),"PREP:");
-	if (likely(destport || destnode)) {
+	if (likely(destport)) {
 		p_ptr->sent++;
 		if (destnode == tipc_own_addr)
 			return tipc_port_recv_msg(buf);
-- 
1.7.2.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-09-10  4:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-03 18:33 [PATCH net-next 1/4] tipc: Minor optimizations to name table translation code Paul Gortmaker
2010-09-03 18:33 ` [PATCH net-next 2/4] tipc: Ensure outgoing messages on Ethernet have sufficient headroom Paul Gortmaker
2010-09-07  1:13   ` David Miller
2010-09-03 18:33 ` [PATCH net-next 3/4] tipc: Optimize handling excess content on incoming messages Paul Gortmaker
2010-09-03 19:55   ` David Miller
2010-09-08 23:31     ` Paul Gortmaker
2010-09-10  4:33       ` David Miller
2010-09-03 18:33 ` [PATCH net-next 4/4] tipc: Fix misleading error code when enabling Ethernet bearers Paul Gortmaker
2010-09-07  1:13   ` David Miller
2010-09-07  1:13 ` [PATCH net-next 1/4] tipc: Minor optimizations to name table translation code David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).