aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2005-07-05 18:18:51 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-05 18:18:51 -0400
commita762a9800752f05fa8768bb0ac35d0e7f1bcfe7f (patch)
tree2e92990b86b5bb5404e2f784f7cbb2579609bd95 /net/ipv4
parentf44b527177d57ed382bfd93e1b55232465f6d058 (diff)
[TCP]: Kill extra cwnd validate in __tcp_push_pending_frames().
The tcp_cwnd_validate() function should only be invoked if we actually send some frames, yet __tcp_push_pending_frames() will always invoke it. tcp_write_xmit() does the call for us, so the call here can simply be removed. Also, tcp_write_xmit() can be marked static. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_output.c79
1 files changed, 49 insertions, 30 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 5e63ed09658d..a6375ca2a59e 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -511,35 +511,6 @@ static inline int tcp_skb_is_last(const struct sock *sk,
511 return skb->next == (struct sk_buff *)&sk->sk_write_queue; 511 return skb->next == (struct sk_buff *)&sk->sk_write_queue;
512} 512}
513 513
514/* Push out any pending frames which were held back due to
515 * TCP_CORK or attempt at coalescing tiny packets.
516 * The socket must be locked by the caller.
517 */
518void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp,
519 unsigned cur_mss, int nonagle)
520{
521 struct sk_buff *skb = sk->sk_send_head;
522
523 if (skb) {
524 if (!tcp_skb_is_last(sk, skb))
525 nonagle = TCP_NAGLE_PUSH;
526 if (!tcp_snd_test(sk, skb, cur_mss, nonagle) ||
527 tcp_write_xmit(sk, nonagle))
528 tcp_check_probe_timer(sk, tp);
529 }
530 tcp_cwnd_validate(sk, tp);
531}
532
533void __tcp_data_snd_check(struct sock *sk, struct sk_buff *skb)
534{
535 struct tcp_sock *tp = tcp_sk(sk);
536
537 if (after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd) ||
538 tcp_packets_in_flight(tp) >= tp->snd_cwnd ||
539 tcp_write_xmit(sk, tp->nonagle))
540 tcp_check_probe_timer(sk, tp);
541}
542
543int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp) 514int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp)
544{ 515{
545 struct sk_buff *skb = sk->sk_send_head; 516 struct sk_buff *skb = sk->sk_send_head;
@@ -841,6 +812,26 @@ unsigned int tcp_current_mss(struct sock *sk, int large)
841 return mss_now; 812 return mss_now;
842} 813}
843 814
815/* Congestion window validation. (RFC2861) */
816
817static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp)
818{
819 __u32 packets_out = tp->packets_out;
820
821 if (packets_out >= tp->snd_cwnd) {
822 /* Network is feed fully. */
823 tp->snd_cwnd_used = 0;
824 tp->snd_cwnd_stamp = tcp_time_stamp;
825 } else {
826 /* Network starves. */
827 if (tp->packets_out > tp->snd_cwnd_used)
828 tp->snd_cwnd_used = tp->packets_out;
829
830 if ((s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= tp->rto)
831 tcp_cwnd_application_limited(sk);
832 }
833}
834
844/* This routine writes packets to the network. It advances the 835/* This routine writes packets to the network. It advances the
845 * send_head. This happens as incoming acks open up the remote 836 * send_head. This happens as incoming acks open up the remote
846 * window for us. 837 * window for us.
@@ -848,7 +839,7 @@ unsigned int tcp_current_mss(struct sock *sk, int large)
848 * Returns 1, if no segments are in flight and we have queued segments, but 839 * Returns 1, if no segments are in flight and we have queued segments, but
849 * cannot send anything now because of SWS or another problem. 840 * cannot send anything now because of SWS or another problem.
850 */ 841 */
851int tcp_write_xmit(struct sock *sk, int nonagle) 842static int tcp_write_xmit(struct sock *sk, int nonagle)
852{ 843{
853 struct tcp_sock *tp = tcp_sk(sk); 844 struct tcp_sock *tp = tcp_sk(sk);
854 unsigned int mss_now; 845 unsigned int mss_now;
@@ -901,6 +892,34 @@ int tcp_write_xmit(struct sock *sk, int nonagle)
901 return 0; 892 return 0;
902} 893}
903 894
895/* Push out any pending frames which were held back due to
896 * TCP_CORK or attempt at coalescing tiny packets.
897 * The socket must be locked by the caller.
898 */
899void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp,
900 unsigned cur_mss, int nonagle)
901{
902 struct sk_buff *skb = sk->sk_send_head;
903
904 if (skb) {
905 if (!tcp_skb_is_last(sk, skb))
906 nonagle = TCP_NAGLE_PUSH;
907 if (!tcp_snd_test(sk, skb, cur_mss, nonagle) ||
908 tcp_write_xmit(sk, nonagle))
909 tcp_check_probe_timer(sk, tp);
910 }
911}
912
913void __tcp_data_snd_check(struct sock *sk, struct sk_buff *skb)
914{
915 struct tcp_sock *tp = tcp_sk(sk);
916
917 if (after(TCP_SKB_CB(skb)->end_seq, tp->snd_una + tp->snd_wnd) ||
918 tcp_packets_in_flight(tp) >= tp->snd_cwnd ||
919 tcp_write_xmit(sk, tp->nonagle))
920 tcp_check_probe_timer(sk, tp);
921}
922
904/* This function returns the amount that we can raise the 923/* This function returns the amount that we can raise the
905 * usable window based on the following constraints 924 * usable window based on the following constraints
906 * 925 *