提交 5d9c54c1 编写于 作者: A Allan Stephens 提交者: David S. Miller

tipc: Minor optimizations to name table translation code

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: NAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 dcfc5d78
...@@ -613,8 +613,7 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, ...@@ -613,8 +613,7 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
} }
/* /*
* tipc_nametbl_translate(): Translate tipc_name -> tipc_portid. * tipc_nametbl_translate - translate name to port id
* Very time-critical.
* *
* Note: on entry 'destnode' is the search domain used during translation; * 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) * on exit it passes back the node address of the matching port (if any)
...@@ -685,7 +684,6 @@ u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode) ...@@ -685,7 +684,6 @@ u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
} }
spin_unlock_bh(&seq->lock); spin_unlock_bh(&seq->lock);
not_found: not_found:
*destnode = 0;
read_unlock_bh(&tipc_nametbl_lock); read_unlock_bh(&tipc_nametbl_lock);
return 0; return 0;
} }
......
...@@ -1464,7 +1464,7 @@ int tipc_forward2name(u32 ref, ...@@ -1464,7 +1464,7 @@ int tipc_forward2name(u32 ref,
msg_set_destnode(msg, destnode); msg_set_destnode(msg, destnode);
msg_set_destport(msg, destport); msg_set_destport(msg, destport);
if (likely(destport || destnode)) { if (likely(destport)) {
p_ptr->sent++; p_ptr->sent++;
if (likely(destnode == tipc_own_addr)) if (likely(destnode == tipc_own_addr))
return tipc_port_recv_sections(p_ptr, num_sect, msg_sect); return tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
...@@ -1542,7 +1542,7 @@ int tipc_forward_buf2name(u32 ref, ...@@ -1542,7 +1542,7 @@ int tipc_forward_buf2name(u32 ref,
skb_push(buf, LONG_H_SIZE); skb_push(buf, LONG_H_SIZE);
skb_copy_to_linear_data(buf, msg, LONG_H_SIZE); skb_copy_to_linear_data(buf, msg, LONG_H_SIZE);
msg_dbg(buf_msg(buf),"PREP:"); msg_dbg(buf_msg(buf),"PREP:");
if (likely(destport || destnode)) { if (likely(destport)) {
p_ptr->sent++; p_ptr->sent++;
if (destnode == tipc_own_addr) if (destnode == tipc_own_addr)
return tipc_port_recv_msg(buf); return tipc_port_recv_msg(buf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册