tcp: switch TCP TS option (RFC 7323) to 1ms clock
TCP Timestamps option is defined in RFC 7323 Traditionally on linux, it has been tied to the internal 'jiffies' variable, because it had been a cheap and good enough generator. For TCP flows on the Internet, 1 ms resolution would be much better than 4ms or 10ms (HZ=250 or HZ=100 respectively) For TCP flows in the DC, Google has used usec resolution for more than two years with great success [1] Receive size autotuning (DRS) is indeed more precise and converges faster to optimal window size. This patch converts tp->tcp_mstamp to a plain u64 value storing a 1 usec TCP clock. This choice will allow us to upstream the 1 usec TS option as discussed in IETF 97. [1] https://www.ietf.org/proceedings/97/slides/slides-97-tcpm-tcp-options-for-low-latency-00.pdf Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
ac9517fcf3
commit
9a568de481
@@ -66,10 +66,10 @@ static u32 cookie_hash(__be32 saddr, __be32 daddr, __be16 sport, __be16 dport,
|
||||
* Since subsequent timestamps use the normal tcp_time_stamp value, we
|
||||
* must make sure that the resulting initial timestamp is <= tcp_time_stamp.
|
||||
*/
|
||||
__u32 cookie_init_timestamp(struct request_sock *req)
|
||||
u64 cookie_init_timestamp(struct request_sock *req)
|
||||
{
|
||||
struct inet_request_sock *ireq;
|
||||
u32 ts, ts_now = tcp_time_stamp;
|
||||
u32 ts, ts_now = tcp_time_stamp_raw();
|
||||
u32 options = 0;
|
||||
|
||||
ireq = inet_rsk(req);
|
||||
@@ -88,7 +88,7 @@ __u32 cookie_init_timestamp(struct request_sock *req)
|
||||
ts <<= TSBITS;
|
||||
ts |= options;
|
||||
}
|
||||
return ts;
|
||||
return (u64)ts * (USEC_PER_SEC / TCP_TS_HZ);
|
||||
}
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
|
||||
ireq->wscale_ok = tcp_opt.wscale_ok;
|
||||
ireq->tstamp_ok = tcp_opt.saw_tstamp;
|
||||
req->ts_recent = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0;
|
||||
treq->snt_synack.v64 = 0;
|
||||
treq->snt_synack = 0;
|
||||
treq->tfo_listener = false;
|
||||
|
||||
ireq->ir_iif = inet_request_bound_dev_if(sk, skb);
|
||||
|
Reference in New Issue
Block a user