diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2011-10-24 16:03:12 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-12-27 11:33:54 -0500 |
commit | f905730c7ed97dc2dfcbf6af894acd6ce70a62e7 (patch) | |
tree | 15e9f4ebe56165668dfb61dc77bef84daefc807c /net/tipc | |
parent | 3655959143ebf1fd32e28a448d204be2f7f13e99 (diff) |
tipc: Allow use of buf_seqno() helper routine by unicast links
Migrates the buf_seqno() helper routine from broadcast link level to
unicast link level so that it can be used both types of TIPC links.
This is a cosmetic change only, and does not affect the operation of TIPC.
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/bcast.c | 5 | ||||
-rw-r--r-- | net/tipc/link.c | 39 | ||||
-rw-r--r-- | net/tipc/link.h | 5 |
3 files changed, 24 insertions, 25 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 15eb74458748..048b7a3e848e 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -115,11 +115,6 @@ static void tipc_nmap_diff(struct tipc_node_map *nm_a, | |||
115 | struct tipc_node_map *nm_b, | 115 | struct tipc_node_map *nm_b, |
116 | struct tipc_node_map *nm_diff); | 116 | struct tipc_node_map *nm_diff); |
117 | 117 | ||
118 | static u32 buf_seqno(struct sk_buff *buf) | ||
119 | { | ||
120 | return msg_seqno(buf_msg(buf)); | ||
121 | } | ||
122 | |||
123 | static u32 bcbuf_acks(struct sk_buff *buf) | 118 | static u32 bcbuf_acks(struct sk_buff *buf) |
124 | { | 119 | { |
125 | return (u32)(unsigned long)TIPC_SKB_CB(buf)->handle; | 120 | return (u32)(unsigned long)TIPC_SKB_CB(buf)->handle; |
diff --git a/net/tipc/link.c b/net/tipc/link.c index 4eff342326e2..853b286dd08c 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -130,7 +130,7 @@ static void link_init_max_pkt(struct link *l_ptr) | |||
130 | static u32 link_next_sent(struct link *l_ptr) | 130 | static u32 link_next_sent(struct link *l_ptr) |
131 | { | 131 | { |
132 | if (l_ptr->next_out) | 132 | if (l_ptr->next_out) |
133 | return msg_seqno(buf_msg(l_ptr->next_out)); | 133 | return buf_seqno(l_ptr->next_out); |
134 | return mod(l_ptr->next_out_no); | 134 | return mod(l_ptr->next_out_no); |
135 | } | 135 | } |
136 | 136 | ||
@@ -1354,7 +1354,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) | |||
1354 | if (r_q_size && buf) { | 1354 | if (r_q_size && buf) { |
1355 | u32 last = lesser(mod(r_q_head + r_q_size), | 1355 | u32 last = lesser(mod(r_q_head + r_q_size), |
1356 | link_last_sent(l_ptr)); | 1356 | link_last_sent(l_ptr)); |
1357 | u32 first = msg_seqno(buf_msg(buf)); | 1357 | u32 first = buf_seqno(buf); |
1358 | 1358 | ||
1359 | while (buf && less(first, r_q_head)) { | 1359 | while (buf && less(first, r_q_head)) { |
1360 | first = mod(first + 1); | 1360 | first = mod(first + 1); |
@@ -1403,7 +1403,7 @@ u32 tipc_link_push_packet(struct link *l_ptr) | |||
1403 | if (buf) { | 1403 | if (buf) { |
1404 | struct tipc_msg *msg = buf_msg(buf); | 1404 | struct tipc_msg *msg = buf_msg(buf); |
1405 | u32 next = msg_seqno(msg); | 1405 | u32 next = msg_seqno(msg); |
1406 | u32 first = msg_seqno(buf_msg(l_ptr->first_out)); | 1406 | u32 first = buf_seqno(l_ptr->first_out); |
1407 | 1407 | ||
1408 | if (mod(next - first) < l_ptr->queue_limit[0]) { | 1408 | if (mod(next - first) < l_ptr->queue_limit[0]) { |
1409 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); | 1409 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); |
@@ -1558,7 +1558,7 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf, | |||
1558 | } else { | 1558 | } else { |
1559 | tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); | 1559 | tipc_bearer_schedule(l_ptr->b_ptr, l_ptr); |
1560 | l_ptr->stats.bearer_congs++; | 1560 | l_ptr->stats.bearer_congs++; |
1561 | l_ptr->retransm_queue_head = msg_seqno(buf_msg(buf)); | 1561 | l_ptr->retransm_queue_head = buf_seqno(buf); |
1562 | l_ptr->retransm_queue_size = retransmits; | 1562 | l_ptr->retransm_queue_size = retransmits; |
1563 | return; | 1563 | return; |
1564 | } | 1564 | } |
@@ -1579,7 +1579,7 @@ static struct sk_buff *link_insert_deferred_queue(struct link *l_ptr, | |||
1579 | if (l_ptr->oldest_deferred_in == NULL) | 1579 | if (l_ptr->oldest_deferred_in == NULL) |
1580 | return buf; | 1580 | return buf; |
1581 | 1581 | ||
1582 | seq_no = msg_seqno(buf_msg(l_ptr->oldest_deferred_in)); | 1582 | seq_no = buf_seqno(l_ptr->oldest_deferred_in); |
1583 | if (seq_no == mod(l_ptr->next_in_no)) { | 1583 | if (seq_no == mod(l_ptr->next_in_no)) { |
1584 | l_ptr->newest_deferred_in->next = buf; | 1584 | l_ptr->newest_deferred_in->next = buf; |
1585 | buf = l_ptr->oldest_deferred_in; | 1585 | buf = l_ptr->oldest_deferred_in; |
@@ -1738,7 +1738,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr) | |||
1738 | 1738 | ||
1739 | crs = l_ptr->first_out; | 1739 | crs = l_ptr->first_out; |
1740 | while ((crs != l_ptr->next_out) && | 1740 | while ((crs != l_ptr->next_out) && |
1741 | less_eq(msg_seqno(buf_msg(crs)), ackd)) { | 1741 | less_eq(buf_seqno(crs), ackd)) { |
1742 | struct sk_buff *next = crs->next; | 1742 | struct sk_buff *next = crs->next; |
1743 | 1743 | ||
1744 | buf_discard(crs); | 1744 | buf_discard(crs); |
@@ -1861,7 +1861,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, | |||
1861 | { | 1861 | { |
1862 | struct sk_buff *prev = NULL; | 1862 | struct sk_buff *prev = NULL; |
1863 | struct sk_buff *crs = *head; | 1863 | struct sk_buff *crs = *head; |
1864 | u32 seq_no = msg_seqno(buf_msg(buf)); | 1864 | u32 seq_no = buf_seqno(buf); |
1865 | 1865 | ||
1866 | buf->next = NULL; | 1866 | buf->next = NULL; |
1867 | 1867 | ||
@@ -1872,7 +1872,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, | |||
1872 | } | 1872 | } |
1873 | 1873 | ||
1874 | /* Last ? */ | 1874 | /* Last ? */ |
1875 | if (less(msg_seqno(buf_msg(*tail)), seq_no)) { | 1875 | if (less(buf_seqno(*tail), seq_no)) { |
1876 | (*tail)->next = buf; | 1876 | (*tail)->next = buf; |
1877 | *tail = buf; | 1877 | *tail = buf; |
1878 | return 1; | 1878 | return 1; |
@@ -1909,7 +1909,7 @@ u32 tipc_link_defer_pkt(struct sk_buff **head, | |||
1909 | static void link_handle_out_of_seq_msg(struct link *l_ptr, | 1909 | static void link_handle_out_of_seq_msg(struct link *l_ptr, |
1910 | struct sk_buff *buf) | 1910 | struct sk_buff *buf) |
1911 | { | 1911 | { |
1912 | u32 seq_no = msg_seqno(buf_msg(buf)); | 1912 | u32 seq_no = buf_seqno(buf); |
1913 | 1913 | ||
1914 | if (likely(msg_user(buf_msg(buf)) == LINK_PROTOCOL)) { | 1914 | if (likely(msg_user(buf_msg(buf)) == LINK_PROTOCOL)) { |
1915 | link_recv_proto_msg(l_ptr, buf); | 1915 | link_recv_proto_msg(l_ptr, buf); |
@@ -1971,10 +1971,10 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, | |||
1971 | if (!tipc_link_is_up(l_ptr)) | 1971 | if (!tipc_link_is_up(l_ptr)) |
1972 | return; | 1972 | return; |
1973 | if (l_ptr->next_out) | 1973 | if (l_ptr->next_out) |
1974 | next_sent = msg_seqno(buf_msg(l_ptr->next_out)); | 1974 | next_sent = buf_seqno(l_ptr->next_out); |
1975 | msg_set_next_sent(msg, next_sent); | 1975 | msg_set_next_sent(msg, next_sent); |
1976 | if (l_ptr->oldest_deferred_in) { | 1976 | if (l_ptr->oldest_deferred_in) { |
1977 | u32 rec = msg_seqno(buf_msg(l_ptr->oldest_deferred_in)); | 1977 | u32 rec = buf_seqno(l_ptr->oldest_deferred_in); |
1978 | gap = mod(rec - mod(l_ptr->next_in_no)); | 1978 | gap = mod(rec - mod(l_ptr->next_in_no)); |
1979 | } | 1979 | } |
1980 | msg_set_seq_gap(msg, gap); | 1980 | msg_set_seq_gap(msg, gap); |
@@ -2589,7 +2589,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, | |||
2589 | 2589 | ||
2590 | /* Is there an incomplete message waiting for this fragment? */ | 2590 | /* Is there an incomplete message waiting for this fragment? */ |
2591 | 2591 | ||
2592 | while (pbuf && ((msg_seqno(buf_msg(pbuf)) != long_msg_seq_no) || | 2592 | while (pbuf && ((buf_seqno(pbuf) != long_msg_seq_no) || |
2593 | (msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) { | 2593 | (msg_orignode(fragm) != msg_orignode(buf_msg(pbuf))))) { |
2594 | prev = pbuf; | 2594 | prev = pbuf; |
2595 | pbuf = pbuf->next; | 2595 | pbuf = pbuf->next; |
@@ -3112,13 +3112,12 @@ static void link_print(struct link *l_ptr, const char *str) | |||
3112 | tipc_printf(buf, "NXI(%u):", mod(l_ptr->next_in_no)); | 3112 | tipc_printf(buf, "NXI(%u):", mod(l_ptr->next_in_no)); |
3113 | tipc_printf(buf, "SQUE"); | 3113 | tipc_printf(buf, "SQUE"); |
3114 | if (l_ptr->first_out) { | 3114 | if (l_ptr->first_out) { |
3115 | tipc_printf(buf, "[%u..", msg_seqno(buf_msg(l_ptr->first_out))); | 3115 | tipc_printf(buf, "[%u..", buf_seqno(l_ptr->first_out)); |
3116 | if (l_ptr->next_out) | 3116 | if (l_ptr->next_out) |
3117 | tipc_printf(buf, "%u..", | 3117 | tipc_printf(buf, "%u..", buf_seqno(l_ptr->next_out)); |
3118 | msg_seqno(buf_msg(l_ptr->next_out))); | 3118 | tipc_printf(buf, "%u]", buf_seqno(l_ptr->last_out)); |
3119 | tipc_printf(buf, "%u]", msg_seqno(buf_msg(l_ptr->last_out))); | 3119 | if ((mod(buf_seqno(l_ptr->last_out) - |
3120 | if ((mod(msg_seqno(buf_msg(l_ptr->last_out)) - | 3120 | buf_seqno(l_ptr->first_out)) |
3121 | msg_seqno(buf_msg(l_ptr->first_out))) | ||
3122 | != (l_ptr->out_queue_size - 1)) || | 3121 | != (l_ptr->out_queue_size - 1)) || |
3123 | (l_ptr->last_out->next != NULL)) { | 3122 | (l_ptr->last_out->next != NULL)) { |
3124 | tipc_printf(buf, "\nSend queue inconsistency\n"); | 3123 | tipc_printf(buf, "\nSend queue inconsistency\n"); |
@@ -3130,8 +3129,8 @@ static void link_print(struct link *l_ptr, const char *str) | |||
3130 | tipc_printf(buf, "[]"); | 3129 | tipc_printf(buf, "[]"); |
3131 | tipc_printf(buf, "SQSIZ(%u)", l_ptr->out_queue_size); | 3130 | tipc_printf(buf, "SQSIZ(%u)", l_ptr->out_queue_size); |
3132 | if (l_ptr->oldest_deferred_in) { | 3131 | if (l_ptr->oldest_deferred_in) { |
3133 | u32 o = msg_seqno(buf_msg(l_ptr->oldest_deferred_in)); | 3132 | u32 o = buf_seqno(l_ptr->oldest_deferred_in); |
3134 | u32 n = msg_seqno(buf_msg(l_ptr->newest_deferred_in)); | 3133 | u32 n = buf_seqno(l_ptr->newest_deferred_in); |
3135 | tipc_printf(buf, ":RQUE[%u..%u]", o, n); | 3134 | tipc_printf(buf, ":RQUE[%u..%u]", o, n); |
3136 | if (l_ptr->deferred_inqueue_sz != mod((n + 1) - o)) { | 3135 | if (l_ptr->deferred_inqueue_sz != mod((n + 1) - o)) { |
3137 | tipc_printf(buf, ":RQSIZ(%u)", | 3136 | tipc_printf(buf, ":RQSIZ(%u)", |
diff --git a/net/tipc/link.h b/net/tipc/link.h index 78792399d667..d35b0f3045ea 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h | |||
@@ -254,6 +254,11 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *start, u32 retrans | |||
254 | * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) | 254 | * Link sequence number manipulation routines (uses modulo 2**16 arithmetic) |
255 | */ | 255 | */ |
256 | 256 | ||
257 | static inline u32 buf_seqno(struct sk_buff *buf) | ||
258 | { | ||
259 | return msg_seqno(buf_msg(buf)); | ||
260 | } | ||
261 | |||
257 | static inline u32 mod(u32 x) | 262 | static inline u32 mod(u32 x) |
258 | { | 263 | { |
259 | return x & 0xffffu; | 264 | return x & 0xffffu; |