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 | |
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')
-rw-r--r-- | net/tipc/port.c | 43 | ||||
-rw-r--r-- | net/tipc/port.h | 42 |
2 files changed, 44 insertions, 41 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. |
diff --git a/net/tipc/port.h b/net/tipc/port.h index f751807e2a91..9b88531e5a61 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h | |||
@@ -205,6 +205,7 @@ int tipc_disconnect_port(struct tipc_port *tp_ptr); | |||
205 | /* | 205 | /* |
206 | * TIPC messaging routines | 206 | * TIPC messaging routines |
207 | */ | 207 | */ |
208 | int tipc_port_recv_msg(struct sk_buff *buf); | ||
208 | int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect, | 209 | int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect, |
209 | unsigned int total_len); | 210 | unsigned int total_len); |
210 | 211 | ||
@@ -271,45 +272,4 @@ static inline int tipc_port_congested(struct tipc_port *p_ptr) | |||
271 | return (p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2); | 272 | return (p_ptr->sent - p_ptr->acked) >= (TIPC_FLOW_CONTROL_WIN * 2); |
272 | } | 273 | } |
273 | 274 | ||
274 | /** | ||
275 | * tipc_port_recv_msg - receive message from lower layer and deliver to port user | ||
276 | */ | ||
277 | |||
278 | static inline int tipc_port_recv_msg(struct sk_buff *buf) | ||
279 | { | ||
280 | struct tipc_port *p_ptr; | ||
281 | struct tipc_msg *msg = buf_msg(buf); | ||
282 | u32 destport = msg_destport(msg); | ||
283 | u32 dsz = msg_data_sz(msg); | ||
284 | u32 err; | ||
285 | |||
286 | /* forward unresolved named message */ | ||
287 | if (unlikely(!destport)) { | ||
288 | tipc_net_route_msg(buf); | ||
289 | return dsz; | ||
290 | } | ||
291 | |||
292 | /* validate destination & pass to port, otherwise reject message */ | ||
293 | p_ptr = tipc_port_lock(destport); | ||
294 | if (likely(p_ptr)) { | ||
295 | if (likely(p_ptr->connected)) { | ||
296 | if ((unlikely(msg_origport(msg) != tipc_peer_port(p_ptr))) || | ||
297 | (unlikely(msg_orignode(msg) != tipc_peer_node(p_ptr))) || | ||
298 | (unlikely(!msg_connected(msg)))) { | ||
299 | err = TIPC_ERR_NO_PORT; | ||
300 | tipc_port_unlock(p_ptr); | ||
301 | goto reject; | ||
302 | } | ||
303 | } | ||
304 | err = p_ptr->dispatcher(p_ptr, buf); | ||
305 | tipc_port_unlock(p_ptr); | ||
306 | if (likely(!err)) | ||
307 | return dsz; | ||
308 | } else { | ||
309 | err = TIPC_ERR_NO_PORT; | ||
310 | } | ||
311 | reject: | ||
312 | return tipc_reject_msg(buf, err); | ||
313 | } | ||
314 | |||
315 | #endif | 275 | #endif |