diff --git a/include/net/tcp.h b/include/net/tcp.h index ecbadcb3a744..fb2bc9edc7de 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1015,6 +1015,16 @@ static inline u32 tcp_time_stamp_ts(const struct tcp_sock *tp) return tcp_time_stamp_ms(tp); } +/* Refresh clocks of a TCP socket, + * ensuring monotically increasing values. + */ +static inline void tcp_mstamp_refresh_inline(struct tcp_sock *tp) +{ + u64 val = tcp_clock_ns(); + + tp->tcp_clock_cache = val; + tp->tcp_mstamp = div_u64(val, NSEC_PER_USEC); +} void tcp_mstamp_refresh(struct tcp_sock *tp); static inline u32 tcp_stamp_us_delta(u64 t1, u64 t0) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index d5c9e65d9760..7995a89bafc9 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6474,7 +6474,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) /* TCP congestion window tracking */ trace_tcp_probe(sk, skb); - tcp_mstamp_refresh(tp); + tcp_mstamp_refresh_inline(tp); if (unlikely(!rcu_access_pointer(sk->sk_rx_dst))) inet_csk(sk)->icsk_af_ops->sk_rx_dst_set(sk, skb); /* diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index f9d8755705f7..c8d7b5d20d18 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -52,15 +52,9 @@ #include -/* Refresh clocks of a TCP socket, - * ensuring monotically increasing values. - */ -void tcp_mstamp_refresh(struct tcp_sock *tp) +void noinline tcp_mstamp_refresh(struct tcp_sock *tp) { - u64 val = tcp_clock_ns(); - - tp->tcp_clock_cache = val; - tp->tcp_mstamp = div_u64(val, NSEC_PER_USEC); + tcp_mstamp_refresh_inline(tp); } static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, @@ -2971,7 +2965,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, sent_pkts = 0; - tcp_mstamp_refresh(tp); + tcp_mstamp_refresh_inline(tp); /* AccECN option beacon depends on mstamp, it may change mss */ if (tcp_ecn_mode_accecn(tp) && tcp_accecn_option_beacon_check(sk))