mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
tcp: address problems caused by EDT misshaps
When a qdisc setup including pacing FQ is dismantled and recreated,
some TCP packets are sent earlier than instructed by TCP stack.
TCP can be fooled when ACK comes back, because the following
operation can return a negative value.
tcp_time_stamp(tp) - tp->rx_opt.rcv_tsecr;
Some paths in TCP stack were not dealing properly with this,
this patch addresses four of them.
Fixes: ab408b6dc7
("tcp: switch tcp and sch_fq to new earliest departure time model")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d146194f31
commit
9efdda4e3a
2 changed files with 16 additions and 10 deletions
|
@ -579,10 +579,12 @@ static inline void tcp_rcv_rtt_measure_ts(struct sock *sk,
|
|||
u32 delta = tcp_time_stamp(tp) - tp->rx_opt.rcv_tsecr;
|
||||
u32 delta_us;
|
||||
|
||||
if (!delta)
|
||||
delta = 1;
|
||||
delta_us = delta * (USEC_PER_SEC / TCP_TS_HZ);
|
||||
tcp_rcv_rtt_update(tp, delta_us, 0);
|
||||
if (likely(delta < INT_MAX / (USEC_PER_SEC / TCP_TS_HZ))) {
|
||||
if (!delta)
|
||||
delta = 1;
|
||||
delta_us = delta * (USEC_PER_SEC / TCP_TS_HZ);
|
||||
tcp_rcv_rtt_update(tp, delta_us, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2910,9 +2912,11 @@ static bool tcp_ack_update_rtt(struct sock *sk, const int flag,
|
|||
if (seq_rtt_us < 0 && tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr &&
|
||||
flag & FLAG_ACKED) {
|
||||
u32 delta = tcp_time_stamp(tp) - tp->rx_opt.rcv_tsecr;
|
||||
u32 delta_us = delta * (USEC_PER_SEC / TCP_TS_HZ);
|
||||
|
||||
seq_rtt_us = ca_rtt_us = delta_us;
|
||||
if (likely(delta < INT_MAX / (USEC_PER_SEC / TCP_TS_HZ))) {
|
||||
seq_rtt_us = delta * (USEC_PER_SEC / TCP_TS_HZ);
|
||||
ca_rtt_us = seq_rtt_us;
|
||||
}
|
||||
}
|
||||
rs->rtt_us = ca_rtt_us; /* RTT of last (S)ACKed packet (or -1) */
|
||||
if (seq_rtt_us < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue