diff options
Diffstat (limited to 'net/tipc/port.h')
| -rw-r--r-- | net/tipc/port.h | 42 |
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 | */ |
| 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 |
