revert TCP retransmission backoff on ICMP destination unreachable
Subsystems (3)
PATCH 1/1 revert TCP retransmission backoff on ICMP destination unreachable
This patch is a proof-of-concept related to the draft "Make TCP more Robust to Long Connectivity Disruptions"
(http://tools.ietf.org/html/draft-zimmermann-tcp-lcd-01).
Exponential backoff is TCP's standard behaviour during long connectivity disruptions, which is a countermeasure against network congestion. If congestion can be excluded as the reason for RTO retransmission loss, backoff is not desirable, as it yields longer TCP recovery times, when the communication path is repaired shortly after an unsuccessful retransmission probe.
Here, an ICMP host/network unreachable message, whose payload fits to TCPs SND.UNA, is taken as an indication that the RTO retransmission has not been lost due to congestion, but because of a route failure somewhere along the path. On receipt of such a message, the timeout is halved (in order to revert to doubling after the retransmission). With true congestion, a router won't trigger such a message and the patched TCP will operate as standard TCP.
Comments are appreciated, especially regarding eventual side effects with the zero window probing mechanism.
In Linux, the RTO retransmisson mechanism is coupled to the zero window probing mechanism, but is not intended to be changed. I hope I have not missed something, here.
---
include/net/tcp.h +2 -0
@@ -1220,6 +1220,8 @@#define tcp_for_write_queue_from_safe (skb, tmp, sk) \ skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) +#define retrans_overstepped (sk, boundary) (inet_csk(sk)->icsk_retransmits && (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= TCP_RTO_MIN*(2 << boundary)) +static inline struct sk_buff *tcp_send_head (struct sock *sk) {return sk->sk_send_head;
net/ipv4/tcp_ipv4.c +32 -0
@@ -332,11 +332,14 @@ {struct iphdr *iph = (struct iphdr *)skb->data;struct tcphdr *th = (struct tcphdr *)(skb->data + (iph->ihl <<2 )); + +struct inet_connection_sock *icsk;struct tcp_sock *tp;struct inet_sock *inet;const int type =icmp_hdr (skb)->type;const int code =icmp_hdr (skb)->code;struct sock *sk; +struct sk_buff *skb_r;__u32 seq;int err;struct net *net =dev_net (skb->dev);
@@ -367,6 +370,7 @@if (sk->sk_state ==TCP_CLOSE ) goto out; + icsk =inet_csk (sk); tp =tcp_sk (sk); seq =ntohl (th->seq); if (sk->sk_state != TCP_LISTEN &&
@@ -393,6 +397,34 @@ } err = icmp_err_convert[code].errno; + +/* check if ICMP unreachable messages allow revert of back-off */ +if ((code !=ICMP_NET_UNREACH && code !=ICMP_HOST_UNREACH ) || seq != tp->snd_una + || !icsk->icsk_retransmits || !icsk->icsk_backoff)break ; + + icsk->icsk_backoff--; + icsk->icsk_rto >>=1 ; + + skb_r =skb_peek (&sk->sk_write_queue); +BUG_ON (!skb_r); + +if (sock_owned_by_user (sk)) { +// Deferring retransmission clocked by ICMP due to locked socket. +inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , +min (icsk->icsk_rto,TCP_RESOURCE_PROBE_INTERVAL ), +TCP_RTO_MAX ); + } + +if (tcp_time_stamp -TCP_SKB_CB (skb_r)->when >inet_csk (sk)->icsk_rto) { +// RTO revert clocked out retransmission. +tcp_retransmit_skb (sk, skb_r); +inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , icsk->icsk_rto,TCP_RTO_MAX ); + }else { +//RTO revert shortened timer. +inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , + icsk->icsk_rto - (tcp_time_stamp -TCP_SKB_CB (skb_r)->when),TCP_RTO_MAX ); + } +break ;case ICMP_TIME_EXCEEDED : err =EHOSTUNREACH ;
net/ipv4/tcp_timer.c +4 -4
@@ -143,7 +143,7 @@dst_negative_advice (&sk->sk_dst_cache); retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries; }else { -if (icsk->icsk_retransmits >= sysctl_tcp_retries1) { +if (retrans_overstepped (sk, sysctl_tcp_retries1)) {/* Black hole detection */ tcp_mtu_probing (icsk, sk);
@@ -156,12 +156,12 @@ retry_until =tcp_orphan_retries (sk, alive); -if (tcp_out_of_resources (sk, alive || icsk->icsk_retransmits < retry_until)) +if (tcp_out_of_resources (sk, alive || !retrans_overstepped (sk, retry_until)))return 1 ; } } -if (icsk->icsk_retransmits >= retry_until) { +if (retrans_overstepped (sk, retry_until)) {/* Has it gone just too far? */ tcp_write_err (sk);return 1 ;
@@ -385,7 +385,7 @@ out_reset_timer: icsk->icsk_rto =min (icsk->icsk_rto <<1 ,TCP_RTO_MAX );inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , icsk->icsk_rto,TCP_RTO_MAX ); -if (icsk->icsk_retransmits > sysctl_tcp_retries1) +if (retrans_overstepped (sk, sysctl_tcp_retries1))__sk_dst_reset (sk); out:;
David Miller
maintainerFrom: Damian Lukowski <[email protected]>
Date: Tue, 11 Aug 2009 13:27:42 +0200
include/net/tcp.h line 1224
Quoted 6 lines
include/net/tcp.h +2
-0@@ -1220,6 +1220,8 @@#define tcp_for_write_queue_from_safe (skb, tmp, sk) \ skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) +#define retrans_overstepped (sk, boundary) (inet_csk(sk)->icsk_retransmits && (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= TCP_RTO_MIN*(2 << boundary)) +
Longer than 80 columns, and use an inline function instead of a macro in order to get proper type checking.
net/ipv4/tcp_ipv4.c line 338
Quoted 8 lines
net/ipv4/tcp_ipv4.c +2
-0@@ -332,11 +332,14 @@ {struct iphdr *iph = (struct iphdr *)skb->data;struct tcphdr *th = (struct tcphdr *)(skb->data + (iph->ihl <<2 )); + +struct inet_connection_sock *icsk;struct tcp_sock *tp;struct inet_sock *inet;
Do not break up the function local variables with spurious new lines like this, please.
Quoted 20 lines
net/ipv4/tcp_ipv4.c +3
-0const int type =icmp_hdr (skb)->type;const int code =icmp_hdr (skb)->code;struct sock *sk; +struct sk_buff *skb_r;__u32 seq;int err;struct net *net =dev_net (skb->dev);@@ -367,6 +370,7 @@if (sk->sk_state ==TCP_CLOSE ) goto out; + icsk =inet_csk (sk); tp =tcp_sk (sk); seq =ntohl (th->seq); if (sk->sk_state != TCP_LISTEN &&@@ -393,6 +397,34 @@ } err = icmp_err_convert[code].errno; +
net/ipv4/tcp_ipv4.c line 410
Quoted 10 lines
net/ipv4/tcp_ipv4.c +10
-0+/* check if ICMP unreachable messages allow revert of back-off */ +if ((code !=ICMP_NET_UNREACH && code !=ICMP_HOST_UNREACH ) || seq != tp->snd_una + || !icsk->icsk_retransmits || !icsk->icsk_backoff)break ; + + icsk->icsk_backoff--; + icsk->icsk_rto >>=1 ; + + skb_r =skb_peek (&sk->sk_write_queue); +BUG_ON (!skb_r); +
The indentation and tabbing is messed up in all of the code you are adding, please fix it up to be consistent with the surrounding code and the rest of the TCP stack.
Do not use C++ style // comments.
Quoted 11 lines
Longer than 80 columns, and use an inline function instead of a macro in order to get proper type checking.
[...]
Do not break up the function local variables with spurious new lines like this, please.
[...]
The indentation and tabbing is messed up in all of the code you are adding, please fix it up to be consistent with the surrounding code and the rest of the TCP stack.Do not use C++ style // comments.
Better?
--
include/net/tcp.h +8 -0
@@ -1220,6 +1220,14 @@#define tcp_for_write_queue_from_safe (skb, tmp, sk) \ skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) +static inline bool retrans_overstepped (const struct sock *sk, +unsigned int boundary) +{ +return inet_csk (sk)->icsk_retransmits && + (tcp_time_stamp -tcp_sk (sk)->retrans_stamp) >= +TCP_RTO_MIN *(2 << boundary); +} +static inline struct sk_buff *tcp_send_head (struct sock *sk) {return sk->sk_send_head;
net/ipv4/tcp_ipv4.c +38 -0
@@ -332,11 +332,13 @@ {struct iphdr *iph = (struct iphdr *)skb->data;struct tcphdr *th = (struct tcphdr *)(skb->data + (iph->ihl <<2 )); +struct inet_connection_sock *icsk;struct tcp_sock *tp;struct inet_sock *inet;const int type =icmp_hdr (skb)->type;const int code =icmp_hdr (skb)->code;struct sock *sk; +struct sk_buff *skb_r;__u32 seq;int err;struct net *net =dev_net (skb->dev);
@@ -367,6 +369,7 @@if (sk->sk_state ==TCP_CLOSE ) goto out; + icsk =inet_csk (sk); tp =tcp_sk (sk); seq =ntohl (th->seq); if (sk->sk_state != TCP_LISTEN &&
@@ -393,6 +396,41 @@ } err = icmp_err_convert[code].errno; +/* check if ICMP unreachable messages allow revert of backoff */ +if ((code !=ICMP_NET_UNREACH && code !=ICMP_HOST_UNREACH ) || + seq != tp->snd_una || !icsk->icsk_retransmits || + !icsk->icsk_backoff) +break ; + + icsk->icsk_backoff--; + icsk->icsk_rto >>=1 ; + + skb_r =skb_peek (&sk->sk_write_queue); +BUG_ON (!skb_r); + +if (sock_owned_by_user (sk)) { +/* Deferring retransmission clocked by ICMP +* due to locked socket. */ +inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , +min (icsk->icsk_rto,TCP_RESOURCE_PROBE_INTERVAL ), +TCP_RTO_MAX ); + } + +if (tcp_time_stamp -TCP_SKB_CB (skb_r)->when > +inet_csk (sk)->icsk_rto) { +/* RTO revert clocked out retransmission. */ +tcp_retransmit_skb (sk, skb_r); +inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , + icsk->icsk_rto,TCP_RTO_MAX ); + }else { +/* RTO revert shortened timer. */ +inet_csk_reset_xmit_timer ( + sk,ICSK_TIME_RETRANS , + icsk->icsk_rto- + (tcp_time_stamp-TCP_SKB_CB (skb_r)->when), +TCP_RTO_MAX ); + } +break ;case ICMP_TIME_EXCEEDED : err =EHOSTUNREACH ;
net/ipv4/tcp_timer.c +6 -4
@@ -143,7 +143,7 @@dst_negative_advice (&sk->sk_dst_cache); retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries; }else { -if (icsk->icsk_retransmits >= sysctl_tcp_retries1) { +if (retrans_overstepped (sk, sysctl_tcp_retries1)) {/* Black hole detection */ tcp_mtu_probing (icsk, sk);
@@ -156,12 +156,14 @@ retry_until =tcp_orphan_retries (sk, alive); -if (tcp_out_of_resources (sk, alive || icsk->icsk_retransmits < retry_until)) +if (tcp_out_of_resources ( + sk, alive || + !retrans_overstepped (sk, retry_until)))return 1 ; } } -if (icsk->icsk_retransmits >= retry_until) { +if (retrans_overstepped (sk, retry_until)) {/* Has it gone just too far? */ tcp_write_err (sk);return 1 ;
@@ -385,7 +387,7 @@ out_reset_timer: icsk->icsk_rto =min (icsk->icsk_rto <<1 ,TCP_RTO_MAX );inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , icsk->icsk_rto,TCP_RTO_MAX ); -if (icsk->icsk_retransmits > sysctl_tcp_retries1) +if (retrans_overstepped (sk, sysctl_tcp_retries1))__sk_dst_reset (sk); out:;
Quoted 10 lines · Damian Lukowski
Quoted 10 lines
Longer than 80 columns, and use an inline function instead of a macro in order to get proper type checking.
[...]
Do not break up the function local variables with spurious new lines like this, please.
[...]
The indentation and tabbing is messed up in all of the code you are adding, please fix it up to be consistent with the surrounding code and the rest of the TCP stack.
Quoted 3 lines
Quoted 1 line
Do not use C++ style // comments.
Better?
Please, include the changelog message on resubmits too next time.
Quoted 25 lines
Signed-off-by Damian Lukowski <[email protected]>diff -Naur
linux-2.6.30.4/include/net/tcp.hlinux-2.6.30.4-tcp-icmp/include/net/tcp.hinclude/net/tcp.h +8
-0@@ -1220,6 +1220,14 @@#define tcp_for_write_queue_from_safe (skb, tmp, sk) \ skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp) +static inline bool retrans_overstepped (const struct sock *sk, +unsigned int boundary) +{ +return inet_csk (sk)->icsk_retransmits && + (tcp_time_stamp -tcp_sk (sk)->retrans_stamp) >= +TCP_RTO_MIN *(2 << boundary); +} +static inline struct sk_buff *tcp_send_head (struct sock *sk) {return sk->sk_send_head;diff -Naur
linux-2.6.30.4/net/ipv4/tcp_ipv4.clinux-2.6.30.4-tcp-icmp/net/ipv4/tcp_ipv4.c
net/ipv4/tcp_ipv4.c line 341
Quoted 10 lines
net/ipv4/tcp_ipv4.c +2
-0@@ -332,11 +332,13 @@ {struct iphdr *iph = (struct iphdr *)skb->data;struct tcphdr *th = (struct tcphdr *)(skb->data + (iph->ihl <<2 )); +struct inet_connection_sock *icsk;struct tcp_sock *tp;struct inet_sock *inet;const int type =icmp_hdr (skb)->type;const int code =icmp_hdr (skb)->code;struct sock *sk; +struct sk_buff *skb_r;
I'd make this called "skb", and change the old skb to icmp_skb.
Quoted 12 lines
net/ipv4/tcp_ipv4.c +1
-0__u32 seq;int err;struct net *net =dev_net (skb->dev);@@ -367,6 +369,7 @@if (sk->sk_state ==TCP_CLOSE ) goto out; + icsk =inet_csk (sk); tp =tcp_sk (sk); seq =ntohl (th->seq); if (sk->sk_state != TCP_LISTEN &&
net/ipv4/tcp_ipv4.c line 402
Quoted 7 lines
net/ipv4/tcp_ipv4.c +4
-0@@ -393,6 +396,41 @@ } err = icmp_err_convert[code].errno; +/* check if ICMP unreachable messages allow revert of backoff */ +if ((code !=ICMP_NET_UNREACH && code !=ICMP_HOST_UNREACH ) || + seq != tp->snd_una || !icsk->icsk_retransmits || + !icsk->icsk_backoff)
I'd recommend you break this into two if()\nbreak's, one for filtering other icmps and other for filtering mismatching against the socket's state.
net/ipv4/tcp_ipv4.c line 406
Quoted 4 lines
net/ipv4/tcp_ipv4.c +4
-0+break ; + + icsk->icsk_backoff--; + icsk->icsk_rto >>=1 ;
Are you absolute sure that we don't go to zero here when phase of the moon is just right? I'd put a max(..., 1) guard there.
net/ipv4/tcp_ipv4.c line 408
Quoted 2 lines
net/ipv4/tcp_ipv4.c +2
-0+ + skb_r =skb_peek (&sk->sk_write_queue);
tcp_write_queue_head(sk)
net/ipv4/tcp_ipv4.c line 415
Quoted 7 lines
net/ipv4/tcp_ipv4.c +7
-0+BUG_ON (!skb_r); + +if (sock_owned_by_user (sk)) { +/* Deferring retransmission clocked by ICMP +* due to locked socket. */ + inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + min(icsk->icsk_rto, TCP_RESOURCE_PROBE_INTERVAL),
??? (besides having indent wrong). What makes you think HZ/2 is right value if icsk_rto is large?
net/ipv4/tcp_ipv4.c line 416
Quoted 1 line
net/ipv4/tcp_ipv4.c +1
-0+ TCP_RTO_MAX);
Perhaps you lack here something to exit?
net/ipv4/tcp_ipv4.c line 420
Quoted 4 lines
net/ipv4/tcp_ipv4.c +4
-0+ } + +if (tcp_time_stamp -TCP_SKB_CB (skb_r)->when > +inet_csk (sk)->icsk_rto) {
icsk->icsk_rto !?!
net/ipv4/tcp_ipv4.c line 422
Quoted 2 lines
net/ipv4/tcp_ipv4.c +2
-0+/* RTO revert clocked out retransmission. */ +tcp_retransmit_skb (sk, skb_r);
This is plain wrong, tcp_sock counters will get messed up if TCPCB_SACKED_RETRANS is already set while calling tcp_retransmit_skb. As a sidenote, it would be probably useful to move the check + clear of that bit before doing the retransmission to some common place one day.
net/ipv4/tcp_ipv4.c line 424
Quoted 2 lines
net/ipv4/tcp_ipv4.c +2
-0+inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , + icsk->icsk_rto,TCP_RTO_MAX );
RFC 2988, step 5.5 missing? Have you verified this patch for real?
net/ipv4/tcp_ipv4.c line 430
Quoted 6 lines
net/ipv4/tcp_ipv4.c +6
-0+ }else { +/* RTO revert shortened timer. */ + inet_csk_reset_xmit_timer( + sk, ICSK_TIME_RETRANS, + icsk->icsk_rto- + (tcp_time_stamp-TCP_SKB_CB(skb_r)->when),
Spacing.
net/ipv4/tcp_ipv4.c line 418
Quoted 3 lines
net/ipv4/tcp_ipv4.c +3
-0+ TCP_RTO_MAX); + } +
How about:
u32 remaining;
remaining = icsk->icsk_rto - min(icsk->icsk_rto,
tcp_time_stamp - TCP_SKB_CB(skb_r)->when));
if (!remaining) {
tcp_retransmit_skb(...);
remaining = icsk->icsk_rto;
}
inet_csk_reset_xmit_timer(..., remaining);But check my note about step 5.5 (see above) to get remaining set right in the if branch.
net/ipv4/tcp_timer.c line 146
Quoted 12 lines
net/ipv4/tcp_ipv4.c +0
-0break ;case ICMP_TIME_EXCEEDED : err =EHOSTUNREACH ;diff -Naur
linux-2.6.30.4/net/ipv4/tcp_timer.clinux-2.6.30.4-tcp-icmp/net/ipv4/tcp_timer.cnet/ipv4/tcp_timer.c +1
-1@@ -143,7 +143,7 @@dst_negative_advice (&sk->sk_dst_cache); retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries; }else { -if (icsk->icsk_retransmits >= sysctl_tcp_retries1) { +if (retrans_overstepped (sk, sysctl_tcp_retries1)) {
??? Could you justify these changes and explain their relation to the draft and icmp messages? If not, please drop them and try with proper description and description for them in a separate patch. I fail to see what you're trying to achieve here. You just ended up redefining the sysctl meaning too I think...
net/ipv4/tcp_timer.c line 161
Quoted 11 lines
net/ipv4/tcp_timer.c +3
-1/* Black hole detection */ tcp_mtu_probing (icsk, sk);@@ -156,12 +156,14 @@ retry_until =tcp_orphan_retries (sk, alive); -if (tcp_out_of_resources (sk, alive || icsk->icsk_retransmits < retry_until)) +if (tcp_out_of_resources ( + sk, alive || + !retrans_overstepped (sk, retry_until)))
???
Quoted 6 lines
net/ipv4/tcp_timer.c +1
-1return 1 ; } } -if (icsk->icsk_retransmits >= retry_until) { +if (retrans_overstepped (sk, retry_until)) {
...
net/ipv4/tcp_timer.c line 390
Quoted 9 lines
net/ipv4/tcp_timer.c +1
-1/* Has it gone just too far? */ tcp_write_err (sk);return 1 ;@@ -385,7 +387,7 @@ out_reset_timer: icsk->icsk_rto =min (icsk->icsk_rto <<1 ,TCP_RTO_MAX );inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , icsk->icsk_rto,TCP_RTO_MAX ); -if (icsk->icsk_retransmits > sysctl_tcp_retries1) +if (retrans_overstepped (sk, sysctl_tcp_retries1))
...I guess none of these retrans_overstepped are related to the icmp stuff at all?
Quoted 3 lines
net/ipv4/tcp_timer.c +0
-0__sk_dst_reset (sk); out:;
Signature · 1 line
i.
Quoted 12 lines · Damian Lukowski
Quoted 11 lines
Quoted 11 lines
Longer than 80 columns, and use an inline function instead of a macro in order to get proper type checking.
[...]
Do not break up the function local variables with spurious new lines like this, please.
[...]
The indentation and tabbing is messed up in all of the code you are adding, please fix it up to be consistent with the surrounding code and the rest of the TCP stack.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Do not use C++ style // comments.
Better?
Please, include the changelog message on resubmits too next time.
I'm sorry, which message do you mean? I used plain diff without GIT or anything.
Quoted 6 lines
net/ipv4/tcp_ipv4.c line 402
Quoted 3 lines
net/ipv4/tcp_ipv4.c +3
-0+if ((code !=ICMP_NET_UNREACH && code !=ICMP_HOST_UNREACH ) || + seq != tp->snd_una || !icsk->icsk_retransmits || + !icsk->icsk_backoff)I'd recommend you break this into two if()\nbreak's, one for filtering other icmps and other for filtering mismatching against the socket's state.
Ok.
Quoted 5 lines
net/ipv4/tcp_ipv4.c line 406
Quoted 2 lines
net/ipv4/tcp_ipv4.c +2
-0+ icsk->icsk_backoff--; + icsk->icsk_rto >>=1 ;Are you absolute sure that we don't go to zero here when phase of the moon is just right? I'd put a
max(..., 1)guard there.
Well, the retransmission timer doubles icsk_rto whenever it increases icsk_backoff, so we should reach the original icsk_rto, when icsk_backoff becomes zero.
Quoted 3 lines
Quoted 1 line
+
skb_r=skb_peek(&sk->sk_write_queue);
tcp_write_queue_head(sk)
Ok.
Quoted 11 lines
net/ipv4/tcp_ipv4.c line 415
Quoted 8 lines
net/ipv4/tcp_ipv4.c +7
-0+BUG_ON (!skb_r); + +if (sock_owned_by_user (sk)) { +/* Deferring retransmission clocked by ICMP +* due to locked socket. */ + inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + min(icsk->icsk_rto, TCP_RESOURCE_PROBE_INTERVAL),??? (besides having indent wrong). What makes you think HZ/2 is right value if
icsk_rtois large?
To be honest, I have taken over the code from my predecessor and didn't question this part. When thinking about it, I would remove this block completely. Will bad things happen, if I mess with the timer, when the socket is locked?
Quoted 11 lines
Quoted 1 line
+
TCP_RTO_MAX);Perhaps you lack here something to exit?
net/ipv4/tcp_ipv4.c line 420
Quoted 4 lines
net/ipv4/tcp_ipv4.c +4
-0+ } + +if (tcp_time_stamp -TCP_SKB_CB (skb_r)->when > +inet_csk (sk)->icsk_rto) {
icsk->icsk_rto!?!
Quoted 7 lines
net/ipv4/tcp_ipv4.c line 422
Quoted 2 lines
net/ipv4/tcp_ipv4.c +2
-0+/* RTO revert clocked out retransmission. */ +tcp_retransmit_skb (sk, skb_r);This is plain wrong,
tcp_sockcounters will get messed up ifTCPCB_SACKED_RETRANSis already set while callingtcp_retransmit_skb. As a sidenote, it would be probably useful to move the check + clear of that bit before doing the retransmission to some common place one day.
What, if I call tcp_retransmit_timer() manually instead? Will there still be problems with SACK?
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + icsk->icsk_rto, TCP_RTO_MAX);RFC 2988, step 5.5 missing? Have you verified this patch for real?
Thats the whole point of the draft. If consecutive retransmissions trigger fitting ICMPs, the RTO value is not doubled, but remains constant. So you can have a retransmission schedule of t, t+r, t+2r, t+3r, t+4r, t+5r ...
instead of
t, t+r, t+3r, t+7r, t+15r, t+31r ...
I can show you trace plots of patched an unpatched TCP, if you like. Should I attach files in the mails, or better post hyperlinks to them?
Quoted 15 lines
net/ipv4/tcp_ipv4.c line 430
Quoted 6 lines
net/ipv4/tcp_ipv4.c +6
-0+ }else { +/* RTO revert shortened timer. */ + inet_csk_reset_xmit_timer( + sk, ICSK_TIME_RETRANS, + icsk->icsk_rto- + (tcp_time_stamp-TCP_SKB_CB(skb_r)->when),Spacing.
net/ipv4/tcp_ipv4.c line 418
Quoted 3 lines
net/ipv4/tcp_ipv4.c +3
-0+ TCP_RTO_MAX); + } +How about:
Quoted 9 lines
u32 remaining;
remaining = icsk->icsk_rto - min(icsk->icsk_rto,
tcp_time_stamp - TCP_SKB_CB(skb_r)->when));
if (!remaining) {
tcp_retransmit_skb(...);
remaining = icsk->icsk_rto;
}
inet_csk_reset_xmit_timer(..., remaining);Seems to be ok, but isn't tcp_retransmit_timer(...) better?
Quoted 8 lines
net/ipv4/tcp_timer.c line 146
Quoted 2 lines
net/ipv4/tcp_timer.c +1
-1-if (icsk->icsk_retransmits >= sysctl_tcp_retries1) { +if (retrans_overstepped (sk, sysctl_tcp_retries1)) {??? Could you justify these changes and explain their relation to the draft and icmp messages? If not, please drop them and try with proper description and description for them in a separate patch. I fail to see what you're trying to achieve here. You just ended up redefining the sysctl meaning too I think...
Well, you're quite right. RFCs specify timeouts in dimensions of time (seconds, minutes, etc.), but Linux specifies timeouts in form of numbers of retransmissions. One can do this, as long as the retransmission schedule (exponential backoff in RFC case) is known. But with this patch, the schedule can be completely different. In the "worst" case, the time intervals between consecutive retransmission probes are constant, leading to a TCP timeout after few seconds, instead of several minutes.
What I did here, is to calculate the TCP timeout as if the schedule were still an exponential backoff, given the allowed number of retransmissions. It is possible, that TCP will now retransmit many more times than tcp_retries indicates, but the duration until the TCP connection times out, is more or less equivalent to unpatched TCP with same tcp_retries values.
So, whenever some control block uses count values, but means time values, I have to replace the control block appropriately; and that's what retrans_overstepped() is supposed to do.
Thanks for your help, so far
Damian
Quoted 12 lines · Damian Lukowski
Quoted 12 lines · Damian Lukowski
Quoted 11 lines
Quoted 11 lines
Longer than 80 columns, and use an inline function instead of a macro in order to get proper type checking.
[...]
Do not break up the function local variables with spurious new lines like this, please.
[...]
The indentation and tabbing is messed up in all of the code you are adding, please fix it up to be consistent with the surrounding code and the rest of the TCP stack.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Do not use C++ style // comments.
Better?
Please, include the changelog message on resubmits too next time.
I'm sorry, which message do you mean? I used plain diff without GIT or anything.
In the original mail you had some description about the patch, I was thinking of quoting something out of it but it was missing so I didn't bother copying. But more importantly, would Dave Miller want to apply the patch of yours, he would need that description and it saves work for him to have the description in every resubmit "duplicated" (one usually just gets a boomerang mail asking for the description which is similarly wasting his time).
Quoted 9 lines
Quoted 5 lines
net/ipv4/tcp_ipv4.c line 406
Quoted 2 lines
net/ipv4/tcp_ipv4.c +2
-0+ icsk->icsk_backoff--; + icsk->icsk_rto >>=1 ;Are you absolute sure that we don't go to zero here when phase of the moon is just right? I'd put a
max(..., 1)guard there.Well, the retransmission timer doubles
icsk_rtowhenever it increasesicsk_backoff, so we should reach the originalicsk_rto, whenicsk_backoffbecomes zero.
This is a false assumption. Take a look into the formula, there's a cap how far icsk_rto goes but icsk_backoff keeps increasing. In fact, there would probably be a need to set some other lower bound than 1, TCP_RTO_MIN would probably be more appropriate for this.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
net/ipv4/tcp_ipv4.c +7
-0+BUG_ON (!skb_r); + +if (sock_owned_by_user (sk)) { +/* Deferring retransmission clocked by ICMP +* due to locked socket. */ + inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + min(icsk->icsk_rto, TCP_RESOURCE_PROBE_INTERVAL),
Quoted 5 lines
Quoted 2 lines
??? (besides having indent wrong). What makes you think HZ/2 is right value if
icsk_rtois large?To be honest, I have taken over the code from my predecessor and didn't question this part.
But you did Signoff that regardless, so you should know ;-).
Quoted 3 lines
When thinking about it, I would remove this block completely. Will bad things happen, if I mess with the timer, when the socket is locked?
I've no idea without looking into all the details but I think this needs to be moved slightly later anyway into the imminent expiry branch and the timeout value needs to be copied from tcp_write_timer instead of using that bogus formula.
Quoted 14 lines
Quoted 14 lines
Quoted 1 line
+
TCP_RTO_MAX);Perhaps you lack here something to exit?
net/ipv4/tcp_ipv4.c line 420
Quoted 4 lines
net/ipv4/tcp_ipv4.c +4
-0+ } + +if (tcp_time_stamp -TCP_SKB_CB (skb_r)->when > +inet_csk (sk)->icsk_rto) {
icsk->icsk_rto!?!Quoted 2 lines
net/ipv4/tcp_ipv4.c +2
-0+/* RTO revert clocked out retransmission. */ +tcp_retransmit_skb (sk, skb_r);
Quoted 7 lines
Quoted 4 lines
This is plain wrong,
tcp_sockcounters will get messed up ifTCPCB_SACKED_RETRANSis already set while callingtcp_retransmit_skb. As a sidenote, it would be probably useful to move the check + clear of that bit before doing the retransmission to some common place one day.What, if I call
tcp_retransmit_timer()manually instead? Will there still be problems with SACK?
SACK is fine then, and I took a quick look into the other stuff which seemed to be quite ok too but it was just a quick glance, but then you certainly must delay the RTO if sock_owned_by_user(sk) is true like tcp_write_timer does. Tcp_retransmit_timer would also deal with the missing step 5.5 btw. I'm not sure if you like all the things that will happen in the tcp_enter_loss though, especially the undo_marker clearing might not please you, or is at best, sub-optimal in a certain scenario.
Quoted 8 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + icsk->icsk_rto, TCP_RTO_MAX);RFC 2988, step 5.5 missing? Have you verified this patch for real?
Thats the whole point of the draft. If consecutive retransmissions trigger fitting ICMPs, the RTO value is not doubled, but remains constant.
No, either the draft is wrong or the implementation. 5.5 step should be applied. Now you end up decreasing RTO per icmp which causes imminent retransmission instead of keeping it "constant". Effectively, step 4, 5, 6 (halves like you do), 7 -> R, R is 5.4-5.6 and 5.5 increases RTO again because the timer _expired_ here even though we did short-circuit it instead of setting a zero timer and using the normal procedure (which in itself is ok approach, no need to force timer to expire).
Quoted 4 lines
So you can have a retransmission schedule of
t, t+r, t+2r, t+3r, t+4r, t+5r ...
instead of
t, t+r, t+3r, t+7r, t+15r, t+31r ...
Sure, but that's not what happens, instead you will get this series:
t, t+r, (t+r)/2, (t+r)/4, ...
...disclaimer: it might be off-by-something somewhere but I hope you get my point anyway.
Quoted 2 lines
I can show you trace plots of patched an unpatched TCP, if you like. Should I attach files in the mails, or better post hyperlinks to them?
Sure, but they must not be from a trivial case but the rto must "flunctuate" and the expirys must be using the "imminent" branch for it to count for me as a proof that you did it right.
Quoted 12 lines
Quoted 11 lines
How about:
u32 remaining; remaining = icsk->icsk_rto - min(icsk->icsk_rto, tcp_time_stamp - TCP_SKB_CB(skb_r)->when)); if (!remaining) { tcp_retransmit_skb(...); remaining = icsk->icsk_rto; } inet_csk_reset_xmit_timer(..., remaining);
Quoted 1 line
Seems to be ok, but isn't
tcp_retransmit_timer(...)better?
Yeah, that's mostly fine I guess (at least in meaning of "safe").
Quoted 18 lines
Quoted 8 lines
net/ipv4/tcp_timer.c line 146
Quoted 2 lines
net/ipv4/tcp_timer.c +1
-1-if (icsk->icsk_retransmits >= sysctl_tcp_retries1) { +if (retrans_overstepped (sk, sysctl_tcp_retries1)) {??? Could you justify these changes and explain their relation to the draft and icmp messages? If not, please drop them and try with proper description and description for them in a separate patch. I fail to see what you're trying to achieve here. You just ended up redefining the sysctl meaning too I think...
Well, you're quite right. RFCs specify timeouts in dimensions of time (seconds, minutes, etc.), but Linux specifies timeouts in form of numbers of retransmissions. One can do this, as long as the retransmission schedule (exponential backoff in RFC case) is known. But with this patch, the schedule can be completely different. In the "worst" case, the time intervals between consecutive retransmission probes are constant, leading to a TCP timeout after few seconds, instead of several minutes.
What I did here, is to calculate the TCP timeout as if the schedule were
Quoted 8 lines
still an exponential backoff, given the allowed number of retransmissions. It is possible, that TCP will now retransmit many more times than
tcp_retriesindicates, but the duration until the TCP connection times out, is more or less equivalent to unpatched TCP with sametcp_retriesvalues.
So, whenever some control block uses count values, but means time values, I have to replace the control block appropriately; and that's whatretrans_overstepped()is supposed to do.
I can understand your point, however, this is independent thing which should not be mixed with the other part of the change. So in future provide them as a two patch series. ...And expect some to not like this kind of change.
Signature · 1 line
i.
Quoted 20 lines · Damian Lukowski
Quoted 13 lines
Quoted 13 lines · Damian Lukowski
Quoted 11 lines
Quoted 11 lines
Longer than 80 columns, and use an inline function instead of a macro in order to get proper type checking.
[...]
Do not break up the function local variables with spurious new lines like this, please.
[...]
The indentation and tabbing is messed up in all of the code you are adding, please fix it up to be consistent with the surrounding code and the rest of the TCP stack.Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
Do not use C++ style // comments.
Better?
Please, include the changelog message on resubmits too next time.
I'm sorry, which message do you mean? I used plain diff without GIT or anything.
Quoted 7 lines
In the original mail you had some description about the patch, I was thinking of quoting something out of it but it was missing so I didn't bother copying. But more importantly, would Dave Miller want to apply the patch of yours, he would need that description and it saves work for him to have the description in every resubmit "duplicated" (one usually just gets a boomerang mail asking for the description which is similarly wasting his time).
Ok, I will fully quote previous messages now. Just wanted to avoid redundancy. Anyway, as long as the draft is not accepted as RFC, the patch will violate current standards, so I doubt, Dave would like to apply it soon. :)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
net/ipv4/tcp_ipv4.c line 406
Quoted 3 lines
net/ipv4/tcp_ipv4.c +2
-0+ icsk->icsk_backoff--; + icsk->icsk_rto >>=1 ;Are you absolute sure that we don't go to zero here when phase of the moon is just right? I'd put a
max(..., 1)guard there.
Quoted 8 lines
Quoted 3 lines
Well, the retransmission timer doubles
icsk_rtowhenever it increasesicsk_backoff, so we should reach the originalicsk_rto, whenicsk_backoffbecomes zero.This is a false assumption. Take a look into the formula, there's a cap how far
icsk_rtogoes buticsk_backoffkeeps increasing. In fact, there would probably be a need to set some other lower bound than 1,TCP_RTO_MINwould probably be more appropriate for this.
*sigh* I should have seen that. I would like to preserve the initial rto value and not work with RTO_MIN. First, I have thought about storing the initial rto in another state variable. But what, if we simply recalculate the value?:
###
icsk->icsk_backoff--;
- icsk->icsk_rto >>= 1;
+ tcp_set_rto(sk);
+ icsk->icsk_rto <<= icsk->icsk_backoff;
+ tcp_bound_rto(sk);
###
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
net/ipv4/tcp_ipv4.c +7
-0+BUG_ON (!skb_r); + +if (sock_owned_by_user (sk)) { +/* Deferring retransmission clocked by ICMP +* due to locked socket. */ + inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + min(icsk->icsk_rto, TCP_RESOURCE_PROBE_INTERVAL),
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
??? (besides having indent wrong). What makes you think HZ/2 is right value if
icsk_rtois large?To be honest, I have taken over the code from my predecessor and didn't question this part.
But you did Signoff that regardless, so you should know ;-).
Only because checkpatch.pl didn't like it otherwise. :)
Quoted 56 lines
Quoted 4 lines
When thinking about it, I would remove this block completely. Will bad things happen, if I mess with the timer, when the socket is locked?
I've no idea without looking into all the details but I think this needs to be moved slightly later anyway into the imminent expiry branch and the timeout value needs to be copied from
tcp_write_timerinstead of using that bogus formula.Quoted 9 lines
Quoted 9 lines
Quoted 1 line
+
TCP_RTO_MAX);Perhaps you lack here something to exit?
net/ipv4/tcp_ipv4.c line 420
Quoted 4 lines
net/ipv4/tcp_ipv4.c +4
-0+ } + +if (tcp_time_stamp -TCP_SKB_CB (skb_r)->when > +inet_csk (sk)->icsk_rto) {
icsk->icsk_rto!?!Quoted 8 lines
Quoted 6 lines
net/ipv4/tcp_ipv4.c line 422
Quoted 2 lines
net/ipv4/tcp_ipv4.c +2
-0+/* RTO revert clocked out retransmission. */ +tcp_retransmit_skb (sk, skb_r);This is plain wrong,
tcp_sockcounters will get messed up ifTCPCB_SACKED_RETRANSis already set while callingtcp_retransmit_skb. As a sidenote, it would be probably useful to move the check + clear of that bit before doing the retransmission to some common place one day.What, if I call
tcp_retransmit_timer()manually instead? Will there still be problems with SACK?SACK is fine then, and I took a quick look into the other stuff which seemed to be quite ok too but it was just a quick glance, but then you certainly must delay the RTO if
sock_owned_by_user(sk)is true liketcp_write_timerdoes.Tcp_retransmit_timerwould also deal with the missing step 5.5 btw. I'm not sure if you like all the things that will happen in thetcp_enter_lossthough, especially theundo_markerclearing might not please you, or is at best, sub-optimal in a certain scenario.Quoted 6 lines
Quoted 3 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + icsk->icsk_rto, TCP_RTO_MAX);RFC 2988, step 5.5 missing? Have you verified this patch for real?
Thats the whole point of the draft. If consecutive retransmissions trigger fitting ICMPs, the RTO value is not doubled, but remains constant.
No, either the draft is wrong or the implementation. 5.5 step should be applied. Now you end up decreasing RTO per icmp which causes imminent retransmission instead of keeping it "constant". Effectively, step 4, 5, 6 (halves like you do), 7 -> R, R is 5.4-5.6 and 5.5 increases RTO again because the timer _expired_ here even though we did short-circuit it instead of setting a zero timer and using the normal procedure (which in itself is ok approach, no need to force timer to expire).
Quoted 4 lines
So you can have a retransmission schedule of
t, t+r, t+2r, t+3r, t+4r, t+5r ...
instead of
t, t+r, t+3r, t+7r, t+15r, t+31r ...
Quoted 6 lines
Sure, but that's not what happens, instead you will get this series:
t, t+r, (t+r)/2, (t+r)/4, ...
...disclaimer: it might be off-by-something somewhere but I hope you get my point anyway.
It seems to me, that we focus on different things. From the TCP code's point of view, RFC2988 step 5.5 is of course executed, because timeouts still trigger tcp_retransmit_timer(), which doubles the RTO at the end. But from the network's point of view, there is no doubling, but constant intervals between retransmissions.
The following happens with patched TCP (not considering RTO_MAX):
t: Connectivity breaks, rto is r
t+r: First RTO fires, SND.UNA is retransmitted by
tcp_retransmit_timer() and rto := 2rto Now it is rto == 2r t+r+epsilon: ICMP unreach arrives from a router. The patch sets rto := rto/2 Now it is rto == r
t+2r: Second RTO fires, SND.UNA is retransmitted by
tcp_retransmit_timer() and rto := 2rto Now it is rto == 2r
Assume, that this retransmission did not trigger any ICMP message.
t+4r: Third RTO fires, SND.UNA is retransmitted by
tcp_retransmit_timer() and rto := 2rto Now it is rto == 4r
Assume, that this retransmission did not trigger any ICMP message.
t+8r: Fourth RTO fires, SND.UNA is retransmitted by
tcp_retransmit_timer() and rto := 2rto Now it is rto == 8r t+8r+epsilon: ICMP unreach arrives from a router. The patch sets rto := rto/2 Now it is rto == 4r
t+12r: Fifth RTO fires ...
Quoted 5 lines
Quoted 2 lines
I can show you trace plots of patched an unpatched TCP, if you like. Should I attach files in the mails, or better post hyperlinks to them?
Sure, but they must not be from a trivial case but the rto must "flunctuate"
How should they fluctuate? RTO is doubled by tcp_retransmit_timer() no matter what happens, and it is halved by the the patch, if an appropriate ICMP packet has been received.
Quoted 2 lines
and the expirys must be using the "imminent" branch for it to count for me as a proof that you did it right.
I'm not sure what you mean.
Still, hyperlinks or attachments?
Quoted 41 lines
Quoted 5 lines
Quoted 5 lines
How about:
u32 remaining;Quoted 8 lines
Quoted 7 lines
remaining = icsk->icsk_rto - min(icsk->icsk_rto, tcp_time_stamp - TCP_SKB_CB(skb_r)->when)); if (!remaining) { tcp_retransmit_skb(...); remaining = icsk->icsk_rto; } inet_csk_reset_xmit_timer(..., remaining);Seems to be ok, but isn't
tcp_retransmit_timer(...)better?Yeah, that's mostly fine I guess (at least in meaning of "safe").
Quoted 16 lines
Quoted 7 lines
net/ipv4/tcp_timer.c line 146
Quoted 2 lines
net/ipv4/tcp_timer.c +1
-1-if (icsk->icsk_retransmits >= sysctl_tcp_retries1) { +if (retrans_overstepped (sk, sysctl_tcp_retries1)) {??? Could you justify these changes and explain their relation to the draft and icmp messages? If not, please drop them and try with proper description and description for them in a separate patch. I fail to see what you're trying to achieve here. You just ended up redefining the sysctl meaning too I think...
Well, you're quite right. RFCs specify timeouts in dimensions of time (seconds, minutes, etc.), but Linux specifies timeouts in form of numbers of retransmissions. One can do this, as long as the retransmission schedule (exponential backoff in RFC case) is known. But with this patch, the schedule can be completely different. In the "worst" case, the time intervals between consecutive retransmission probes are constant, leading to a TCP timeout after few seconds, instead of several minutes.
What I did here, is to calculate the TCP timeout as if the schedule wereQuoted 8 lines
still an exponential backoff, given the allowed number of retransmissions. It is possible, that TCP will now retransmit many more times than
tcp_retriesindicates, but the duration until the TCP connection times out, is more or less equivalent to unpatched TCP with sametcp_retriesvalues.
So, whenever some control block uses count values, but means time values, I have to replace the control block appropriately; and that's whatretrans_overstepped()is supposed to do.
Quoted 4 lines
I can understand your point, however, this is independent thing which should not be mixed with the other part of the change. So in future provide them as a two patch series. ...And expect some to not like this kind of change.
Ok.
David Miller
maintainerFrom: Damian Lukowski <[email protected]>
Date: Tue, 18 Aug 2009 19:40:01 +0200
Quoted 12 lines
Quoted 12 lines · Damian Lukowski
Quoted 11 lines
Quoted 11 lines
Longer than 80 columns, and use an inline function instead of a macro in order to get proper type checking.
[...]
Do not break up the function local variables with spurious new lines like this, please.
[...]
The indentation and tabbing is messed up in all of the code you are adding, please fix it up to be consistent with the surrounding code and the rest of the TCP stack.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Do not use C++ style // comments.
Better?
Please, include the changelog message on resubmits too next time.
I'm sorry, which message do you mean? I used plain diff without GIT or anything.
He means the commit message.
When you fix up patches, don't just reply and say "here's the fixed up patch". That doesn't work.
We need the full context, the full commit message, and your signoffs, when you submit any patch you intend us to consider applying.
Quoted 2 lines · Damian Lukowski
Ok, I will fully quote previous messages now. Just wanted to avoid redundancy.
Full quoting is not what I meant, Dave explained what I meant in his mail.
Quoted 3 lines
Anyway, as long as the draft is not accepted as RFC, the patch will violate current standards, so I doubt, Dave would like to apply it soon. :)
...Don't be too sure on that ;-).
Quoted 20 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
net/ipv4/tcp_ipv4.c line 406
Quoted 2 lines
net/ipv4/tcp_ipv4.c +2
-0+ icsk->icsk_backoff--; + icsk->icsk_rto >>=1 ;Are you absolute sure that we don't go to zero here when phase of the moon is just right? I'd put a
max(..., 1)guard there.Well, the retransmission timer doubles
icsk_rtowhenever it increasesicsk_backoff, so we should reach the originalicsk_rto, whenicsk_backoffbecomes zero.This is a false assumption. Take a look into the formula, there's a cap how far
icsk_rtogoes buticsk_backoffkeeps increasing. In fact, there would probably be a need to set some other lower bound than 1,TCP_RTO_MINwould probably be more appropriate for this.*sigh* I should have seen that. I would like to preserve the initial rto value and not work with
RTO_MIN. First, I have thought about storing the initial rto in another state variable. But what, if we simply recalculate the value?:
###icsk->icsk_backoff--;(quoted diff) +3
-1- icsk->icsk_rto >>= 1; + tcp_set_rto(sk); + icsk->icsk_rto <<= icsk->icsk_backoff; + tcp_bound_rto(sk);
Quoted 1 line
###
Yes, this is sort of a problem. I'd recommend that you read through all icsk_rto readers and writers and see if recalculation can be done without getting into some problems.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
net/ipv4/tcp_ipv4.c +7
-0+BUG_ON (!skb_r); + +if (sock_owned_by_user (sk)) { +/* Deferring retransmission clocked by ICMP +* due to locked socket. */ + inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + min(icsk->icsk_rto, TCP_RESOURCE_PROBE_INTERVAL),
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
??? (besides having indent wrong). What makes you think HZ/2 is right value if
icsk_rtois large?To be honest, I have taken over the code from my predecessor and didn't question this part.
But you did Signoff that regardless, so you should know ;-).
Only because checkpatch.pl didn't like it otherwise. :)
...And you dare to admit :-) ...It certainly has some other meaning beyond checkpatch complain, for future, please check and understand what it means that you add it there.
Quoted 16 lines
Quoted 16 lines
Quoted 6 lines
Quoted 3 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + icsk->icsk_rto, TCP_RTO_MAX);RFC 2988, step 5.5 missing? Have you verified this patch for real?
Thats the whole point of the draft. If consecutive retransmissions trigger fitting ICMPs, the RTO value is not doubled, but remains constant.
No, either the draft is wrong or the implementation. 5.5 step should be applied. Now you end up decreasing RTO per icmp which causes imminent retransmission instead of keeping it "constant". Effectively, step 4, 5, 6 (halves like you do), 7 -> R, R is 5.4-5.6 and 5.5 increases RTO again because the timer _expired_ here even though we did short-circuit it instead of setting a zero timer and using the normal procedure (which in itself is ok approach, no need to force timer to expire).
Quoted 4 lines
So you can have a retransmission schedule of
t, t+r, t+2r, t+3r, t+4r, t+5r ...
instead of
t, t+r, t+3r, t+7r, t+15r, t+31r ...Sure, but that's not what happens, instead you will get this series:
Quoted 7 lines
Quoted 3 lines
t, t+r, (t+r)/2, (t+r)/4, ...
...disclaimer: it might be off-by-something somewhere but I hope you get my point anyway.
It seems to me, that we focus on different things. From the TCP code's point of view, RFC2988 step 5.5 is of course executed, because timeouts still trigger
tcp_retransmit_timer(), which doubles the RTO at the end.
No and yes. For no: you artificially made tcp_retransmit_timer to not be called whenever the ICMP arrives at a point where RTO/2 step causes the timer to expire right away. But yes: if you change it to call tcp_retransmit_timer as we have discussed, 5.5 should be there (but that's not in original patch which I was commenting).
Quoted 2 lines
But from the network's point of view, there is no doubling, but constant intervals between retransmissions.
Plain wrong, you would only end up halving as per icmp when the timing is right to produce the scenario I'm talking. Please show from the original patch
Quoted 19 lines
The following happens with patched TCP (not considering
RTO_MAX):
t: Connectivity breaks, rto is r
t+r: First RTO fires, SND.UNA is retransmitted bytcp_retransmit_timer() and rto := 2rto Now it is rto == 2r t+r+epsilon: ICMP unreach arrives from a router. The patch sets rto := rto/2 Now it is rto == rt+2r: Second RTO fires, SND.UNA is retransmitted by
tcp_retransmit_timer()and rto := 2rto Now it is rto == 2r
Assume, that this retransmission did not trigger any ICMP message.
t+4r: Third RTO fires, SND.UNA is retransmitted by
tcp_retransmit_timer()and rto := 2rto Now it is rto == 4r
Assume, that this retransmission did not trigger any ICMP message.
t+8r: Fourth RTO fires, SND.UNA is retransmitted by
Quoted 6 lines
tcp_retransmit_timer() and rto := 2rto Now it is rto == 8r t+8r+epsilon: ICMP unreach arrives from a router. The patch sets rto := rto/2 Now it is rto == 4rt+12r: Fifth RTO fires ...
No, that was not the scenario I'm talking about. Let me try to explain:
Quoted 4 lines
t: Connectivity breaks, rto is r
t+r: First RTO fires, SND.UNA is retransmitted bytcp_retransmit_timer() and rto := 2rto Now it is rto == 2r
t+2r+epsilon: ICMP unreach arrives from a router.
Quoted 1 line
The patch sets rto := rto/2
t+2r+epsilon > t+r+rto => call for retransmit in the icmp code set rto = r
t+5/2r+epsilon ICMP unreach arrives from a router.
The patch sets rto := rto/2
t+5/2r+epsilon > t+something => call for retransmit set rto = r/2
...
See, it's a downward spiral because nothing in the original patch takes care of the rto*2 (ie., step 5.5) when RTO is artificially _caused by_ the ICMP (ie., the halving does make expiry to happen right away, see draft step 7).
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I can show you trace plots of patched an unpatched TCP, if you like. Should I attach files in the mails, or better post hyperlinks to them?
Sure, but they must not be from a trivial case but the rto must "flunctuate"
How should they fluctuate? RTO is doubled by
tcp_retransmit_timer()no matter what happens, and it is halved by the the patch, if an appropriate ICMP packet has been received.
The original patch doesn't agree. If you'd have used tcp_retransmit_timer in the original I'd agree but you called for tcp_retransmit_skb(skb_r) and set the next rto yourself which wouldn't let tcp_retransmit_timer to run at all in the scenario I was talking about. But lets see the next version of the patch first and only then continue the discussion on this particular point about 5.5 (probably not then necessary anymore because of a change we've discussed).
Quoted 4 lines
Quoted 2 lines
and the expirys must be using the "imminent" branch for it to count for me as a proof that you did it right.
I'm not sure what you mean.
The case I'm talking about is the branch where we notice that after doing rto/2 the RTO is to be scheduled right away (see step 7 in the draft).
Quoted 1 line
Still, hyperlinks or attachments?
Either is fine, but large stuff as links. However, honestly I'm not that interest in them as I know that if you have the traces from the particular case I'm talking about, they would show the misbehavior (other cases work but they do not interest me at all). It would have been mostly just to convince you that this misbehavior is there, since my words didn't seem to make it :-). I propose we put this "proving" aside too for now since the changes we've already discussed should make this a non-issue anyway, and therefore no need to waste time on that.
Signature · 1 line
i.