diff options
author | Eric Dumazet <edumazet@google.com> | 2023-10-20 15:57:41 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-10-23 11:35:01 +0300 |
commit | d1a02ed66fe62aa2edd77bd54e270ebc33bd12ff (patch) | |
tree | 037c2e87d2deab26135a119690d0862beeff5138 /include/net/tcp.h | |
parent | 16cf6477741bdaa287d5e4531a1a503618a41a22 (diff) | |
download | linux-d1a02ed66fe62aa2edd77bd54e270ebc33bd12ff.tar.xz |
tcp: rename tcp_skb_timestamp()
This helper returns a 32bit TCP TSval from skb->tstamp.
As we are going to support usec or ms units soon, rename it
to tcp_skb_timestamp_ts() and add a boolean to select the unit.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 0534526a535d..493f8550055b 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -837,17 +837,21 @@ static inline u32 tcp_stamp_us_delta(u64 t1, u64 t0) return max_t(s64, t1 - t0, 0); } -static inline u32 tcp_skb_timestamp(const struct sk_buff *skb) -{ - return tcp_ns_to_ts(skb->skb_mstamp_ns); -} - /* provide the departure time in us unit */ static inline u64 tcp_skb_timestamp_us(const struct sk_buff *skb) { return div_u64(skb->skb_mstamp_ns, NSEC_PER_USEC); } +/* Provide skb TSval in usec or ms unit */ +static inline u32 tcp_skb_timestamp_ts(bool usec_ts, const struct sk_buff *skb) +{ + if (usec_ts) + return tcp_skb_timestamp_us(skb); + + return div_u64(skb->skb_mstamp_ns, NSEC_PER_MSEC); +} + static inline u32 tcp_tw_tsval(const struct tcp_timewait_sock *tcptw) { return tcp_clock_ts(false) + tcptw->tw_ts_offset; |