diff options
author | Eric Dumazet <edumazet@google.com> | 2018-09-21 18:51:47 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-22 05:37:59 +0300 |
commit | 2fd66ffba50716fc5ab481c48db643af3bda2276 (patch) | |
tree | 0429f0bb89fa036d79e9b9d2105f89c0a3e38ca0 /include | |
parent | 72b0094f918294e6cb8cf5c3b4520d928fbb1a57 (diff) | |
download | linux-2fd66ffba50716fc5ab481c48db643af3bda2276.tar.xz |
tcp: introduce tcp_skb_timestamp_us() helper
There are few places where TCP reads skb->skb_mstamp expecting
a value in usec unit.
skb->tstamp (aka skb->skb_mstamp) will soon store CLOCK_TAI nsec value.
Add tcp_skb_timestamp_us() to provide proper conversion when needed.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/tcp.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index c6f0bc1dc678..0ca5ea10dc06 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -774,6 +774,12 @@ static inline u32 tcp_skb_timestamp(const struct sk_buff *skb) return div_u64(skb->skb_mstamp, USEC_PER_SEC / TCP_TS_HZ); } +/* provide the departure time in us unit */ +static inline u64 tcp_skb_timestamp_us(const struct sk_buff *skb) +{ + return skb->skb_mstamp; +} + #define tcp_flag_byte(th) (((u_int8_t *)th)[13]) @@ -1940,7 +1946,7 @@ static inline s64 tcp_rto_delta_us(const struct sock *sk) { const struct sk_buff *skb = tcp_rtx_queue_head(sk); u32 rto = inet_csk(sk)->icsk_rto; - u64 rto_time_stamp_us = skb->skb_mstamp + jiffies_to_usecs(rto); + u64 rto_time_stamp_us = tcp_skb_timestamp_us(skb) + jiffies_to_usecs(rto); return rto_time_stamp_us - tcp_sk(sk)->tcp_mstamp; } |