diff options
author | Yuchung Cheng <ycheng@google.com> | 2018-05-16 19:40:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-17 15:41:29 -0400 |
commit | b8fef65a8a76c2f887c56bf8e9684ff04e8d3b9f (patch) | |
tree | c6126e6ae98c561fa0d1a77593c367d779737771 | |
parent | c77d62ffae377de331a19020c0b598a6faceb0ef (diff) |
tcp: new helper tcp_rack_skb_timeout
Create and export a new helper tcp_rack_skb_timeout and move tcp_is_rack
to prepare the final RTO change.
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Priyaranjan Jha <priyarjha@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 10 | ||||
-rw-r--r-- | net/ipv4/tcp_recovery.c | 9 |
3 files changed, 14 insertions, 7 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 2b5372ef2e0e..6deb540297cc 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1879,6 +1879,8 @@ void tcp_init(void); | |||
1879 | /* tcp_recovery.c */ | 1879 | /* tcp_recovery.c */ |
1880 | void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb); | 1880 | void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb); |
1881 | void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced); | 1881 | void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced); |
1882 | extern s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb, | ||
1883 | u32 reo_wnd); | ||
1882 | extern void tcp_rack_mark_lost(struct sock *sk); | 1884 | extern void tcp_rack_mark_lost(struct sock *sk); |
1883 | extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq, | 1885 | extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq, |
1884 | u64 xmit_time); | 1886 | u64 xmit_time); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 1ccc97b368c7..ba8a8e3464aa 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1917,6 +1917,11 @@ static inline void tcp_init_undo(struct tcp_sock *tp) | |||
1917 | tp->undo_retrans = tp->retrans_out ? : -1; | 1917 | tp->undo_retrans = tp->retrans_out ? : -1; |
1918 | } | 1918 | } |
1919 | 1919 | ||
1920 | static bool tcp_is_rack(const struct sock *sk) | ||
1921 | { | ||
1922 | return sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_LOSS_DETECTION; | ||
1923 | } | ||
1924 | |||
1920 | /* If we detect SACK reneging, forget all SACK information | 1925 | /* If we detect SACK reneging, forget all SACK information |
1921 | * and reset tags completely, otherwise preserve SACKs. If receiver | 1926 | * and reset tags completely, otherwise preserve SACKs. If receiver |
1922 | * dropped its ofo queue, we will know this due to reneging detection. | 1927 | * dropped its ofo queue, we will know this due to reneging detection. |
@@ -2031,11 +2036,6 @@ static inline int tcp_dupack_heuristics(const struct tcp_sock *tp) | |||
2031 | return tp->sacked_out + 1; | 2036 | return tp->sacked_out + 1; |
2032 | } | 2037 | } |
2033 | 2038 | ||
2034 | static bool tcp_is_rack(const struct sock *sk) | ||
2035 | { | ||
2036 | return sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_LOSS_DETECTION; | ||
2037 | } | ||
2038 | |||
2039 | /* Linux NewReno/SACK/ECN state machine. | 2039 | /* Linux NewReno/SACK/ECN state machine. |
2040 | * -------------------------------------- | 2040 | * -------------------------------------- |
2041 | * | 2041 | * |
diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c index b2f9be388bf3..30cbfb69b1de 100644 --- a/net/ipv4/tcp_recovery.c +++ b/net/ipv4/tcp_recovery.c | |||
@@ -47,6 +47,12 @@ u32 tcp_rack_reo_wnd(const struct sock *sk) | |||
47 | tp->srtt_us >> 3); | 47 | tp->srtt_us >> 3); |
48 | } | 48 | } |
49 | 49 | ||
50 | s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb, u32 reo_wnd) | ||
51 | { | ||
52 | return tp->rack.rtt_us + reo_wnd - | ||
53 | tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp); | ||
54 | } | ||
55 | |||
50 | /* RACK loss detection (IETF draft draft-ietf-tcpm-rack-01): | 56 | /* RACK loss detection (IETF draft draft-ietf-tcpm-rack-01): |
51 | * | 57 | * |
52 | * Marks a packet lost, if some packet sent later has been (s)acked. | 58 | * Marks a packet lost, if some packet sent later has been (s)acked. |
@@ -92,8 +98,7 @@ static void tcp_rack_detect_loss(struct sock *sk, u32 *reo_timeout) | |||
92 | /* A packet is lost if it has not been s/acked beyond | 98 | /* A packet is lost if it has not been s/acked beyond |
93 | * the recent RTT plus the reordering window. | 99 | * the recent RTT plus the reordering window. |
94 | */ | 100 | */ |
95 | remaining = tp->rack.rtt_us + reo_wnd - | 101 | remaining = tcp_rack_skb_timeout(tp, skb, reo_wnd); |
96 | tcp_stamp_us_delta(tp->tcp_mstamp, skb->skb_mstamp); | ||
97 | if (remaining <= 0) { | 102 | if (remaining <= 0) { |
98 | tcp_mark_skb_lost(sk, skb); | 103 | tcp_mark_skb_lost(sk, skb); |
99 | list_del_init(&skb->tcp_tsorted_anchor); | 104 | list_del_init(&skb->tcp_tsorted_anchor); |