RE: TCP keepalive timer problem

Li_Xin2
2009-08-28T01:56:16Z

> Yep, so to recap we have two changes :

> 1) The one I sent (taking into account the time of last ACK we
received) to compute the
> timer delays.

> 2) The one you suggest, avoiding to send a probe if we have packets in
flight, relying
> on normal retransmits timers.

I agree with these two changes, but I think the patch for point 2 given
by Eric is not correct:

elapsed = keepalive_time_when(tp);

if (tp->packets_out || tcp_send_head(sk))
if (tcp_retries2_time < keepalive_time_when(tp))
goto resched;
elapsed = tcp_time_stamp - tp->rcv_tstamp;

The problem is: you should not always compare tcp_retries2_time with
keepalive_time_when. If the first keepalive probe is already sent, you
should compare with keepalive_intvl_when
( or keepalive_intvl_when * (
tp->keepalive_probes?:sysctl_tcp_keepalive_probes -
icsk->icsk_probes_out ) if keepalive probe is already sent, and the
elapsed time also needs to take that into account.

elapsed =
icsk->icsk_probes_out?keepalive_intvl_when(tp):keepalive_time_when(tp);

if (tp->packets_out || tcp_send_head(sk))
if (tcp_retries2_time < (icsk->icsk_probes_out?
keepalive_intvl_when(tp) : keepalive_time_when(tp))
goto resched;
elapsed = tcp_time_stamp - tp->rcv_tstamp;

How do you think?