diff options
| author | Eric Dumazet <edumazet@google.com> | 2018-09-21 08:51:47 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-11-08 16:19:08 +0100 |
| commit | 624db16292e1d6b0b54d911deca5a603e1dc8e1a (patch) | |
| tree | dffc89a24f0142bdcc328ee59766aae5526cebbb /include | |
| parent | 25d559ed2beec9b34045886100dac46d1ad92eba (diff) | |
tcp: introduce tcp_skb_timestamp_us() helper
[ Upstream commit 2fd66ffba50716fc5ab481c48db643af3bda2276 ]
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>
Stable-dep-of: c8770db2d544 ("tcp: check skb is non-NULL in tcp_rto_delta_us()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
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 49da4d4a3c3d..3138f01db669 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -794,6 +794,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]) @@ -2003,7 +2009,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; } |
