Commit 99d67955 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: add tcp_time_stamp_ms() helper

In preparation of adding usec TCP TS values, add tcp_time_stamp_ms()
for contexts needing ms based values.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 73ed8e03
......@@ -804,6 +804,11 @@ static inline u32 tcp_time_stamp(const struct tcp_sock *tp)
return div_u64(tp->tcp_mstamp, USEC_PER_SEC / TCP_TS_HZ);
}
static inline u32 tcp_time_stamp_ms(const struct tcp_sock *tp)
{
return div_u64(tp->tcp_mstamp, USEC_PER_MSEC);
}
/* Convert a nsec timestamp into TCP TSval timestamp (ms based currently) */
static inline u64 tcp_ns_to_ts(u64 ns)
{
......
......@@ -2856,7 +2856,7 @@ void tcp_enter_recovery(struct sock *sk, bool ece_ack)
static void tcp_update_rto_time(struct tcp_sock *tp)
{
if (tp->rto_stamp) {
tp->total_rto_time += tcp_time_stamp(tp) - tp->rto_stamp;
tp->total_rto_time += tcp_time_stamp_ms(tp) - tp->rto_stamp;
tp->rto_stamp = 0;
}
}
......
......@@ -422,7 +422,7 @@ static void tcp_update_rto_stats(struct sock *sk)
if (!icsk->icsk_retransmits) {
tp->total_rto_recoveries++;
tp->rto_stamp = tcp_time_stamp(tp);
tp->rto_stamp = tcp_time_stamp_ms(tp);
}
icsk->icsk_retransmits++;
tp->total_rto++;
......
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