Commit 0c266898b42fe4e4e2f9edfc9d3474c10f93aa6a

Authored by Satoru SATOH
Committed by David S. Miller
1 parent 0b2febf38a

tcp: Fix tcp_prequeue() to get correct rto_min value

tcp_prequeue() refers to the constant value (TCP_RTO_MIN) regardless of
the actual value might be tuned. The following patches fix this and make
tcp_prequeue get the actual value returns from tcp_rto_min().

Signed-off-by: Satoru SATOH <satoru.satoh@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 13 additions and 11 deletions Side-by-side Diff

... ... @@ -41,6 +41,7 @@
41 41 #include <net/ip.h>
42 42 #include <net/tcp_states.h>
43 43 #include <net/inet_ecn.h>
  44 +#include <net/dst.h>
44 45  
45 46 #include <linux/seq_file.h>
46 47  
... ... @@ -530,6 +531,17 @@
530 531 tcp_fast_path_on(tp);
531 532 }
532 533  
  534 +/* Compute the actual rto_min value */
  535 +static inline u32 tcp_rto_min(struct sock *sk)
  536 +{
  537 + struct dst_entry *dst = __sk_dst_get(sk);
  538 + u32 rto_min = TCP_RTO_MIN;
  539 +
  540 + if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
  541 + rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
  542 + return rto_min;
  543 +}
  544 +
533 545 /* Compute the actual receive window we are currently advertising.
534 546 * Rcv_nxt can be after the window if our peer push more data
535 547 * than the offered window.
... ... @@ -895,7 +907,7 @@
895 907 wake_up_interruptible(sk->sk_sleep);
896 908 if (!inet_csk_ack_scheduled(sk))
897 909 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
898   - (3 * TCP_RTO_MIN) / 4,
  910 + (3 * tcp_rto_min(sk)) / 4,
899 911 TCP_RTO_MAX);
900 912 }
901 913 return 1;
net/ipv4/tcp_input.c
... ... @@ -597,16 +597,6 @@
597 597 tcp_grow_window(sk, skb);
598 598 }
599 599  
600   -static u32 tcp_rto_min(struct sock *sk)
601   -{
602   - struct dst_entry *dst = __sk_dst_get(sk);
603   - u32 rto_min = TCP_RTO_MIN;
604   -
605   - if (dst && dst_metric_locked(dst, RTAX_RTO_MIN))
606   - rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
607   - return rto_min;
608   -}
609   -
610 600 /* Called to compute a smoothed rtt estimate. The data fed to this
611 601 * routine either comes from timestamps, or from segments that were
612 602 * known _not_ to have been retransmitted [see Karn/Partridge