aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/msg.h
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-03-25 12:07:25 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-25 14:05:56 -0400
commit3127a0200d4a46cf279bb388cc0f71827cd60699 (patch)
treec0bf142814ecd5cea45db33cd8706c118ea6e45d /net/tipc/msg.h
parent1f66d161ab3d8b518903fa6c3f9c1f48d6919e74 (diff)
tipc: clean up handling of link congestion
After the recent changes in message importance handling it becomes possible to simplify handling of messages and sockets when we encounter link congestion. We merge the function tipc_link_cong() into link_schedule_user(), and simplify the code of the latter. The code should now be easier to follow, especially regarding return codes and handling of the message that caused the situation. In case the scheduling function is unable to pre-allocate a wakeup message buffer, it now returns -ENOBUFS, which is a more correct code than the previously used -EHOSTUNREACH. Reviewed-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/msg.h')
-rw-r--r--net/tipc/msg.h28
1 files changed, 11 insertions, 17 deletions
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index bd3969a80dd4..6445db09c0c4 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -240,6 +240,15 @@ static inline void msg_set_size(struct tipc_msg *m, u32 sz)
240 m->hdr[0] = htonl((msg_word(m, 0) & ~0x1ffff) | sz); 240 m->hdr[0] = htonl((msg_word(m, 0) & ~0x1ffff) | sz);
241} 241}
242 242
243static inline unchar *msg_data(struct tipc_msg *m)
244{
245 return ((unchar *)m) + msg_hdr_sz(m);
246}
247
248static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
249{
250 return (struct tipc_msg *)msg_data(m);
251}
243 252
244/* 253/*
245 * Word 1 254 * Word 1
@@ -372,6 +381,8 @@ static inline void msg_set_prevnode(struct tipc_msg *m, u32 a)
372 381
373static inline u32 msg_origport(struct tipc_msg *m) 382static inline u32 msg_origport(struct tipc_msg *m)
374{ 383{
384 if (msg_user(m) == MSG_FRAGMENTER)
385 m = msg_get_wrapped(m);
375 return msg_word(m, 4); 386 return msg_word(m, 4);
376} 387}
377 388
@@ -467,16 +478,6 @@ static inline void msg_set_nameupper(struct tipc_msg *m, u32 n)
467 msg_set_word(m, 10, n); 478 msg_set_word(m, 10, n);
468} 479}
469 480
470static inline unchar *msg_data(struct tipc_msg *m)
471{
472 return ((unchar *)m) + msg_hdr_sz(m);
473}
474
475static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
476{
477 return (struct tipc_msg *)msg_data(m);
478}
479
480/* 481/*
481 * Constants and routines used to read and write TIPC internal message headers 482 * Constants and routines used to read and write TIPC internal message headers
482 */ 483 */
@@ -753,13 +754,6 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n)
753 msg_set_bits(m, 9, 0, 0xffff, n); 754 msg_set_bits(m, 9, 0, 0xffff, n);
754} 755}
755 756
756static inline u32 msg_tot_origport(struct tipc_msg *m)
757{
758 if ((msg_user(m) == MSG_FRAGMENTER) && (msg_type(m) == FIRST_FRAGMENT))
759 return msg_origport(msg_get_wrapped(m));
760 return msg_origport(m);
761}
762
763struct sk_buff *tipc_buf_acquire(u32 size); 757struct sk_buff *tipc_buf_acquire(u32 size);
764bool tipc_msg_validate(struct sk_buff *skb); 758bool tipc_msg_validate(struct sk_buff *skb);
765bool tipc_msg_reverse(u32 own_addr, struct sk_buff *buf, u32 *dnode, 759bool tipc_msg_reverse(u32 own_addr, struct sk_buff *buf, u32 *dnode,