diff options
author | Ying Xue <ying.xue@windriver.com> | 2014-11-25 22:41:48 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-26 12:30:16 -0500 |
commit | 47b4c9a82f2ed0c00aa1c20899b41f54d6f8a07a (patch) | |
tree | 5467cbb0b503c03207a1e4b0291fd334d99510d8 /net/tipc | |
parent | 7b6f087f98107617e0535a6ed378c561f1ae84d7 (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')
-rw-r--r-- | net/tipc/bcast.c | 2 | ||||
-rw-r--r-- | net/tipc/link.c | 62 | ||||
-rw-r--r-- | net/tipc/link.h | 2 |
3 files changed, 24 insertions, 42 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index 556b26ad4b1e..27648841e7ff 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -307,7 +307,7 @@ void tipc_bclink_acknowledge(struct tipc_node *n_ptr, u32 acked) | |||
307 | /* Try resolving broadcast link congestion, if necessary */ | 307 | /* Try resolving broadcast link congestion, if necessary */ |
308 | 308 | ||
309 | if (unlikely(bcl->next_out)) { | 309 | if (unlikely(bcl->next_out)) { |
310 | tipc_link_push_queue(bcl); | 310 | tipc_link_push_packets(bcl); |
311 | bclink_set_last_sent(); | 311 | bclink_set_last_sent(); |
312 | } | 312 | } |
313 | if (unlikely(released && !skb_queue_empty(&bcl->waiting_sks))) | 313 | if (unlikely(released && !skb_queue_empty(&bcl->waiting_sks))) |
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 | ||
152 | static 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 | |||
159 | static 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 | */ |
869 | static u32 tipc_link_push_packet(struct tipc_link *l_ptr) | 862 | void 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 | */ | ||
897 | void 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 | ||
906 | void tipc_link_reset_all(struct tipc_node *node) | 888 | void 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); |
diff --git a/net/tipc/link.h b/net/tipc/link.h index cc816aacb16e..1681076cb339 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h | |||
@@ -227,7 +227,7 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector); | |||
227 | void tipc_link_bundle_rcv(struct sk_buff *buf); | 227 | void tipc_link_bundle_rcv(struct sk_buff *buf); |
228 | void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, | 228 | void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int prob, |
229 | u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); | 229 | u32 gap, u32 tolerance, u32 priority, u32 acked_mtu); |
230 | void tipc_link_push_queue(struct tipc_link *l_ptr); | 230 | void tipc_link_push_packets(struct tipc_link *l_ptr); |
231 | u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, | 231 | u32 tipc_link_defer_pkt(struct sk_buff **head, struct sk_buff **tail, |
232 | struct sk_buff *buf); | 232 | struct sk_buff *buf); |
233 | void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window); | 233 | void tipc_link_set_queue_limits(struct tipc_link *l_ptr, u32 window); |