Commit 623df484 authored by Neal Cardwell's avatar Neal Cardwell Committed by David S. Miller

tcp: extract code to compute SYNACK RTT

In preparation for adding another spot where we compute the SYNACK
RTT, extract this code so that it can be shared.
Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de465846
...@@ -1137,6 +1137,15 @@ static inline void tcp_openreq_init(struct request_sock *req, ...@@ -1137,6 +1137,15 @@ static inline void tcp_openreq_init(struct request_sock *req,
ireq->loc_port = tcp_hdr(skb)->dest; ireq->loc_port = tcp_hdr(skb)->dest;
} }
/* Compute time elapsed between SYNACK and the ACK completing 3WHS */
static inline void tcp_synack_rtt_meas(struct sock *sk,
struct request_sock *req)
{
if (tcp_rsk(req)->snt_synack)
tcp_valid_rtt_meas(sk,
tcp_time_stamp - tcp_rsk(req)->snt_synack);
}
extern void tcp_enter_memory_pressure(struct sock *sk); extern void tcp_enter_memory_pressure(struct sock *sk);
static inline int keepalive_intvl_when(const struct tcp_sock *tp) static inline int keepalive_intvl_when(const struct tcp_sock *tp)
......
...@@ -1733,9 +1733,7 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, ...@@ -1733,9 +1733,7 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
newtp->advmss = tcp_sk(sk)->rx_opt.user_mss; newtp->advmss = tcp_sk(sk)->rx_opt.user_mss;
tcp_initialize_rcv_mss(newsk); tcp_initialize_rcv_mss(newsk);
if (tcp_rsk(req)->snt_synack) tcp_synack_rtt_meas(newsk, req);
tcp_valid_rtt_meas(newsk,
tcp_time_stamp - tcp_rsk(req)->snt_synack);
newtp->total_retrans = req->retrans; newtp->total_retrans = req->retrans;
#ifdef CONFIG_TCP_MD5SIG #ifdef CONFIG_TCP_MD5SIG
......
...@@ -1348,9 +1348,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, ...@@ -1348,9 +1348,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
newtp->advmss = tcp_sk(sk)->rx_opt.user_mss; newtp->advmss = tcp_sk(sk)->rx_opt.user_mss;
tcp_initialize_rcv_mss(newsk); tcp_initialize_rcv_mss(newsk);
if (tcp_rsk(req)->snt_synack) tcp_synack_rtt_meas(newsk, req);
tcp_valid_rtt_meas(newsk,
tcp_time_stamp - tcp_rsk(req)->snt_synack);
newtp->total_retrans = req->retrans; newtp->total_retrans = req->retrans;
newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment