Skip to content

Commit 86c6a2c

Browse files
nealcardwelldavem330
authored andcommitted
tcp: switch snt_synack back to measuring transmit time of first SYNACK
Always store in snt_synack the time at which the server received the first client SYN and attempted to send the first SYNACK. Recent commit aa27fc5 ("tcp: tcp_v[46]_conn_request: fix snt_synack initialization") resolved an inconsistency between IPv4 and IPv6 in the initialization of snt_synack. This commit brings back the idea from 843f4a5 (tcp: use tcp_v4_send_synack on first SYN-ACK), which was going for the original behavior of snt_synack from the commit where it was added in 9ad7c04 ("tcp: RFC2988bis + taking RTT sample from 3WHS for the passive open side") in v3.1. In addition to being simpler (and probably a tiny bit faster), unconditionally storing the time of the first SYNACK attempt has been useful because it allows calculating a performance metric quantifying how long it took to establish a passive TCP connection. Signed-off-by: Neal Cardwell <[email protected]> Signed-off-by: Yuchung Cheng <[email protected]> Cc: Octavian Purdila <[email protected]> Cc: Jerry Chu <[email protected]> Acked-by: Octavian Purdila <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0b88e70 commit 86c6a2c

File tree

3 files changed

+1
-5
lines changed

3 files changed

+1
-5
lines changed

include/net/tcp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
10931093
req->cookie_ts = 0;
10941094
tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
10951095
tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
1096-
tcp_rsk(req)->snt_synack = 0;
1096+
tcp_rsk(req)->snt_synack = tcp_time_stamp;
10971097
req->mss = rx_opt->mss_clamp;
10981098
req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
10991099
ireq->tstamp_ok = rx_opt->tstamp_ok;

net/ipv4/tcp_ipv4.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,6 @@ static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst,
838838
ireq->ir_rmt_addr,
839839
ireq->opt);
840840
err = net_xmit_eval(err);
841-
if (!tcp_rsk(req)->snt_synack && !err)
842-
tcp_rsk(req)->snt_synack = tcp_time_stamp;
843841
}
844842

845843
return err;

net/ipv6/tcp_ipv6.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,6 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst,
498498
skb_set_queue_mapping(skb, queue_mapping);
499499
err = ip6_xmit(sk, skb, fl6, np->opt, np->tclass);
500500
err = net_xmit_eval(err);
501-
if (!tcp_rsk(req)->snt_synack && !err)
502-
tcp_rsk(req)->snt_synack = tcp_time_stamp;
503501
}
504502

505503
done:

0 commit comments

Comments
 (0)