diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2011-11-09 13:29:18 -0500 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-02-29 11:44:32 -0500 |
commit | 9b641251aee1a804169a17fe4236a50188894994 (patch) | |
tree | 38748e8e60bb1df91e3ea5a70444823e05398c26 /net/tipc/port.c | |
parent | b58343f9ea75f02ef48b984767511c6b3ba76eaf (diff) |
tipc: Un-inline port routine for processing incoming messages
Converts a non-trivial routine from inline to non-inline form
to avoid bloating the TIPC code base with 6 copies of its body.
This change is essentially cosmetic, and doesn't change existing
TIPC behavior.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/port.c')
-rw-r--r-- | net/tipc/port.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index b103d7630c82..6adcdf99123b 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -1133,6 +1133,49 @@ int tipc_shutdown(u32 ref) | |||
1133 | return tipc_disconnect(ref); | 1133 | return tipc_disconnect(ref); |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | /** | ||
1137 | * tipc_port_recv_msg - receive message from lower layer and deliver to port user | ||
1138 | */ | ||
1139 | |||
1140 | int tipc_port_recv_msg(struct sk_buff *buf) | ||
1141 | { | ||
1142 | struct tipc_port *p_ptr; | ||
1143 | struct tipc_msg *msg = buf_msg(buf); | ||
1144 | u32 destport = msg_destport(msg); | ||
1145 | u32 dsz = msg_data_sz(msg); | ||
1146 | u32 err; | ||
1147 | |||
1148 | /* forward unresolved named message */ | ||
1149 | if (unlikely(!destport)) { | ||
1150 | tipc_net_route_msg(buf); | ||
1151 | return dsz; | ||
1152 | } | ||
1153 | |||
1154 | /* validate destination & pass to port, otherwise reject message */ | ||
1155 | p_ptr = tipc_port_lock(destport); | ||
1156 | if (likely(p_ptr)) { | ||
1157 | if (likely(p_ptr->connected)) { | ||
1158 | if ((unlikely(msg_origport(msg) != | ||
1159 | tipc_peer_port(p_ptr))) || | ||
1160 | (unlikely(msg_orignode(msg) != | ||
1161 | tipc_peer_node(p_ptr))) || | ||
1162 | (unlikely(!msg_connected(msg)))) { | ||
1163 | err = TIPC_ERR_NO_PORT; | ||
1164 | tipc_port_unlock(p_ptr); | ||
1165 | goto reject; | ||
1166 | } | ||
1167 | } | ||
1168 | err = p_ptr->dispatcher(p_ptr, buf); | ||
1169 | tipc_port_unlock(p_ptr); | ||
1170 | if (likely(!err)) | ||
1171 | return dsz; | ||
1172 | } else { | ||
1173 | err = TIPC_ERR_NO_PORT; | ||
1174 | } | ||
1175 | reject: | ||
1176 | return tipc_reject_msg(buf, err); | ||
1177 | } | ||
1178 | |||
1136 | /* | 1179 | /* |
1137 | * tipc_port_recv_sections(): Concatenate and deliver sectioned | 1180 | * tipc_port_recv_sections(): Concatenate and deliver sectioned |
1138 | * message for this node. | 1181 | * message for this node. |