summaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-11-25 22:41:48 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-26 12:30:16 -0500
commit47b4c9a82f2ed0c00aa1c20899b41f54d6f8a07a (patch)
tree5467cbb0b503c03207a1e4b0291fd334d99510d8 /net/tipc/link.c
parent7b6f087f98107617e0535a6ed378c561f1ae84d7 (diff)
tipc: clean up the process of link pushing packets
In original tipc_link_push_packet(), it pushes messages from protocol message queue, retransmission queue and next_out queue. But as the two first queues are removed, we can simplify its relevant code through deleting tipc_link_push_queue(). Signed-off-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c62
1 files changed, 22 insertions, 40 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 4b7cbfd57714..470f05383d43 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -149,18 +149,6 @@ static void link_init_max_pkt(struct tipc_link *l_ptr)
149 l_ptr->max_pkt_probes = 0; 149 l_ptr->max_pkt_probes = 0;
150} 150}
151 151
152static u32 link_next_sent(struct tipc_link *l_ptr)
153{
154 if (l_ptr->next_out)
155 return buf_seqno(l_ptr->next_out);
156 return mod(l_ptr->next_out_no);
157}
158
159static u32 link_last_sent(struct tipc_link *l_ptr)
160{
161 return mod(link_next_sent(l_ptr) - 1);
162}
163
164/* 152/*
165 * Simple non-static link routines (i.e. referenced outside this file) 153 * Simple non-static link routines (i.e. referenced outside this file)
166 */ 154 */
@@ -222,7 +210,7 @@ static void link_timeout(struct tipc_link *l_ptr)
222 link_state_event(l_ptr, TIMEOUT_EVT); 210 link_state_event(l_ptr, TIMEOUT_EVT);
223 211
224 if (l_ptr->next_out) 212 if (l_ptr->next_out)
225 tipc_link_push_queue(l_ptr); 213 tipc_link_push_packets(l_ptr);
226 214
227 tipc_node_unlock(l_ptr->owner); 215 tipc_node_unlock(l_ptr->owner);
228} 216}
@@ -864,43 +852,37 @@ static void tipc_link_sync_rcv(struct tipc_node *n, struct sk_buff *buf)
864} 852}
865 853
866/* 854/*
867 * tipc_link_push_packet: Push one unsent packet to the media 855 * tipc_link_push_packets - push unsent packets to bearer
856 *
857 * Push out the unsent messages of a link where congestion
858 * has abated. Node is locked.
859 *
860 * Called with node locked
868 */ 861 */
869static u32 tipc_link_push_packet(struct tipc_link *l_ptr) 862void tipc_link_push_packets(struct tipc_link *l_ptr)
870{ 863{
871 struct sk_buff *buf = l_ptr->next_out; 864 struct sk_buff *skb;
865 struct tipc_msg *msg;
866 u32 next, first;
872 867
873 /* Send one deferred data message, if send window not full: */ 868 while (l_ptr->next_out) {
874 if (buf) { 869 skb = l_ptr->next_out;
875 struct tipc_msg *msg = buf_msg(buf); 870 msg = buf_msg(skb);
876 u32 next = msg_seqno(msg); 871 next = msg_seqno(msg);
877 u32 first = buf_seqno(l_ptr->first_out); 872 first = buf_seqno(l_ptr->first_out);
878 873
879 if (mod(next - first) < l_ptr->queue_limit[0]) { 874 if (mod(next - first) < l_ptr->queue_limit[0]) {
880 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); 875 msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
881 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 876 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
882 tipc_bearer_send(l_ptr->bearer_id, buf,
883 &l_ptr->media_addr);
884 if (msg_user(msg) == MSG_BUNDLER) 877 if (msg_user(msg) == MSG_BUNDLER)
885 msg_set_type(msg, BUNDLE_CLOSED); 878 msg_set_type(msg, BUNDLE_CLOSED);
886 l_ptr->next_out = buf->next; 879 tipc_bearer_send(l_ptr->bearer_id, skb,
887 return 0; 880 &l_ptr->media_addr);
881 l_ptr->next_out = skb->next;
882 } else {
883 break;
888 } 884 }
889 } 885 }
890 return 1;
891}
892
893/*
894 * push_queue(): push out the unsent messages of a link where
895 * congestion has abated. Node is locked
896 */
897void tipc_link_push_queue(struct tipc_link *l_ptr)
898{
899 u32 res;
900
901 do {
902 res = tipc_link_push_packet(l_ptr);
903 } while (!res);
904} 886}
905 887
906void tipc_link_reset_all(struct tipc_node *node) 888void tipc_link_reset_all(struct tipc_node *node)
@@ -1164,7 +1146,7 @@ void tipc_rcv(struct sk_buff *head, struct tipc_bearer *b_ptr)
1164 1146
1165 /* Try sending any messages link endpoint has pending */ 1147 /* Try sending any messages link endpoint has pending */
1166 if (unlikely(l_ptr->next_out)) 1148 if (unlikely(l_ptr->next_out))
1167 tipc_link_push_queue(l_ptr); 1149 tipc_link_push_packets(l_ptr);
1168 1150
1169 if (released && !skb_queue_empty(&l_ptr->waiting_sks)) { 1151 if (released && !skb_queue_empty(&l_ptr->waiting_sks)) {
1170 link_prepare_wakeup(l_ptr); 1152 link_prepare_wakeup(l_ptr);