diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2008-06-04 20:32:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-04 20:32:35 -0400 |
commit | 1265a02108c508b508112cdeac922aad03e0146a (patch) | |
tree | 3a52ee41e6273650bcfb2d3df9c5d17ecd08361a | |
parent | a686e6859e976712e28f6af927cd52a6a3bb372a (diff) |
tipc: Minor optimizations to received message processing
This patch enhances TIPC's handler for incoming messages in two
ways:
- the trivial, single-use routine for processing non-sequenced
messages has been merged into the main handler
- the interface that received a message is now identified without
having to access and/or modify the associated sk_buff
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/tipc/discover.c | 4 | ||||
-rw-r--r-- | net/tipc/discover.h | 2 | ||||
-rw-r--r-- | net/tipc/link.c | 27 |
3 files changed, 8 insertions, 25 deletions
diff --git a/net/tipc/discover.c b/net/tipc/discover.c index faeaf06d377e..ada213aac4d4 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c | |||
@@ -156,11 +156,11 @@ static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr, | |||
156 | /** | 156 | /** |
157 | * tipc_disc_recv_msg - handle incoming link setup message (request or response) | 157 | * tipc_disc_recv_msg - handle incoming link setup message (request or response) |
158 | * @buf: buffer containing message | 158 | * @buf: buffer containing message |
159 | * @b_ptr: bearer that message arrived on | ||
159 | */ | 160 | */ |
160 | 161 | ||
161 | void tipc_disc_recv_msg(struct sk_buff *buf) | 162 | void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr) |
162 | { | 163 | { |
163 | struct bearer *b_ptr = (struct bearer *)TIPC_SKB_CB(buf)->handle; | ||
164 | struct link *link; | 164 | struct link *link; |
165 | struct tipc_media_addr media_addr; | 165 | struct tipc_media_addr media_addr; |
166 | struct tipc_msg *msg = buf_msg(buf); | 166 | struct tipc_msg *msg = buf_msg(buf); |
diff --git a/net/tipc/discover.h b/net/tipc/discover.h index 9fd7587b143a..c36eaeb7d5d0 100644 --- a/net/tipc/discover.h +++ b/net/tipc/discover.h | |||
@@ -48,7 +48,7 @@ struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr, | |||
48 | void tipc_disc_update_link_req(struct link_req *req); | 48 | void tipc_disc_update_link_req(struct link_req *req); |
49 | void tipc_disc_stop_link_req(struct link_req *req); | 49 | void tipc_disc_stop_link_req(struct link_req *req); |
50 | 50 | ||
51 | void tipc_disc_recv_msg(struct sk_buff *buf); | 51 | void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr); |
52 | 52 | ||
53 | void tipc_disc_link_event(u32 addr, char *name, int up); | 53 | void tipc_disc_link_event(u32 addr, char *name, int up); |
54 | #if 0 | 54 | #if 0 |
diff --git a/net/tipc/link.c b/net/tipc/link.c index b8c1231e3147..c62ebfea9304 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -1766,21 +1766,6 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, | |||
1766 | l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0; | 1766 | l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0; |
1767 | } | 1767 | } |
1768 | 1768 | ||
1769 | /* | ||
1770 | * link_recv_non_seq: Receive packets which are outside | ||
1771 | * the link sequence flow | ||
1772 | */ | ||
1773 | |||
1774 | static void link_recv_non_seq(struct sk_buff *buf) | ||
1775 | { | ||
1776 | struct tipc_msg *msg = buf_msg(buf); | ||
1777 | |||
1778 | if (msg_user(msg) == LINK_CONFIG) | ||
1779 | tipc_disc_recv_msg(buf); | ||
1780 | else | ||
1781 | tipc_bclink_recv_pkt(buf); | ||
1782 | } | ||
1783 | |||
1784 | /** | 1769 | /** |
1785 | * link_insert_deferred_queue - insert deferred messages back into receive chain | 1770 | * link_insert_deferred_queue - insert deferred messages back into receive chain |
1786 | */ | 1771 | */ |
@@ -1857,7 +1842,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) | |||
1857 | { | 1842 | { |
1858 | read_lock_bh(&tipc_net_lock); | 1843 | read_lock_bh(&tipc_net_lock); |
1859 | while (head) { | 1844 | while (head) { |
1860 | struct bearer *b_ptr; | 1845 | struct bearer *b_ptr = (struct bearer *)tb_ptr; |
1861 | struct node *n_ptr; | 1846 | struct node *n_ptr; |
1862 | struct link *l_ptr; | 1847 | struct link *l_ptr; |
1863 | struct sk_buff *crs; | 1848 | struct sk_buff *crs; |
@@ -1868,9 +1853,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) | |||
1868 | u32 released = 0; | 1853 | u32 released = 0; |
1869 | int type; | 1854 | int type; |
1870 | 1855 | ||
1871 | b_ptr = (struct bearer *)tb_ptr; | ||
1872 | TIPC_SKB_CB(buf)->handle = b_ptr; | ||
1873 | |||
1874 | head = head->next; | 1856 | head = head->next; |
1875 | 1857 | ||
1876 | /* Ensure message is well-formed */ | 1858 | /* Ensure message is well-formed */ |
@@ -1889,7 +1871,10 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) | |||
1889 | msg = buf_msg(buf); | 1871 | msg = buf_msg(buf); |
1890 | 1872 | ||
1891 | if (unlikely(msg_non_seq(msg))) { | 1873 | if (unlikely(msg_non_seq(msg))) { |
1892 | link_recv_non_seq(buf); | 1874 | if (msg_user(msg) == LINK_CONFIG) |
1875 | tipc_disc_recv_msg(buf, b_ptr); | ||
1876 | else | ||
1877 | tipc_bclink_recv_pkt(buf); | ||
1893 | continue; | 1878 | continue; |
1894 | } | 1879 | } |
1895 | 1880 | ||
@@ -1996,8 +1981,6 @@ deliver: | |||
1996 | if (link_recv_changeover_msg(&l_ptr, &buf)) { | 1981 | if (link_recv_changeover_msg(&l_ptr, &buf)) { |
1997 | msg = buf_msg(buf); | 1982 | msg = buf_msg(buf); |
1998 | seq_no = msg_seqno(msg); | 1983 | seq_no = msg_seqno(msg); |
1999 | TIPC_SKB_CB(buf)->handle | ||
2000 | = b_ptr; | ||
2001 | if (type == ORIGINAL_MSG) | 1984 | if (type == ORIGINAL_MSG) |
2002 | goto deliver; | 1985 | goto deliver; |
2003 | goto protocol_check; | 1986 | goto protocol_check; |