Skip to content

Commit 9721e70

Browse files
yuchungchengdavem330
authored andcommitted
tcp: simplify window probe aborting on USER_TIMEOUT
Previously we use the next unsent skb's timestamp to determine when to abort a socket stalling on window probes. This no longer works as skb timestamp reflects the last instead of the first transmission. Instead we can estimate how long the socket has been stalling with the probe count and the exponential backoff behavior. Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Neal Cardwell <ncardwell@google.com> Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 01a523b commit 9721e70

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

net/ipv4/tcp_timer.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ static void tcp_probe_timer(struct sock *sk)
333333
struct sk_buff *skb = tcp_send_head(sk);
334334
struct tcp_sock *tp = tcp_sk(sk);
335335
int max_probes;
336-
u32 start_ts;
337336

338337
if (tp->packets_out || !skb) {
339338
icsk->icsk_probes_out = 0;
@@ -348,12 +347,13 @@ static void tcp_probe_timer(struct sock *sk)
348347
* corresponding system limit. We also implement similar policy when
349348
* we use RTO to probe window in tcp_retransmit_timer().
350349
*/
351-
start_ts = tcp_skb_timestamp(skb);
352-
if (!start_ts)
353-
skb->skb_mstamp_ns = tp->tcp_clock_cache;
354-
else if (icsk->icsk_user_timeout &&
355-
(s32)(tcp_time_stamp(tp) - start_ts) > icsk->icsk_user_timeout)
356-
goto abort;
350+
if (icsk->icsk_user_timeout) {
351+
u32 elapsed = tcp_model_timeout(sk, icsk->icsk_probes_out,
352+
tcp_probe0_base(sk));
353+
354+
if (elapsed >= icsk->icsk_user_timeout)
355+
goto abort;
356+
}
357357

358358
max_probes = sock_net(sk)->ipv4.sysctl_tcp_retries2;
359359
if (sock_flag(sk, SOCK_DEAD)) {

0 commit comments

Comments
 (0)