aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/port.h
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-11-09 13:29:18 -0500
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-02-29 11:44:32 -0500
commit9b641251aee1a804169a17fe4236a50188894994 (patch)
tree38748e8e60bb1df91e3ea5a70444823e05398c26 /net/tipc/port.h
parentb58343f9ea75f02ef48b984767511c6b3ba76eaf (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.h')
-rw-r--r--net/tipc/port.h42
1 files changed, 1 insertions, 41 deletions
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 */
208int tipc_port_recv_msg(struct sk_buff *buf);
208int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect, 209int 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
278static 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 }
311reject:
312 return tipc_reject_msg(buf, err);
313}
314
315#endif 275#endif