diff options
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 204328b88412..49a178b8d5b2 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -2232,4 +2232,23 @@ void clean_acked_data_disable(struct inet_connection_sock *icsk); | |||
2232 | void clean_acked_data_flush(void); | 2232 | void clean_acked_data_flush(void); |
2233 | #endif | 2233 | #endif |
2234 | 2234 | ||
2235 | DECLARE_STATIC_KEY_FALSE(tcp_tx_delay_enabled); | ||
2236 | static inline void tcp_add_tx_delay(struct sk_buff *skb, | ||
2237 | const struct tcp_sock *tp) | ||
2238 | { | ||
2239 | if (static_branch_unlikely(&tcp_tx_delay_enabled)) | ||
2240 | skb->skb_mstamp_ns += (u64)tp->tcp_tx_delay * NSEC_PER_USEC; | ||
2241 | } | ||
2242 | |||
2243 | static inline void tcp_set_tx_time(struct sk_buff *skb, | ||
2244 | const struct sock *sk) | ||
2245 | { | ||
2246 | if (static_branch_unlikely(&tcp_tx_delay_enabled)) { | ||
2247 | u32 delay = (sk->sk_state == TCP_TIME_WAIT) ? | ||
2248 | tcp_twsk(sk)->tw_tx_delay : tcp_sk(sk)->tcp_tx_delay; | ||
2249 | |||
2250 | skb->skb_mstamp_ns = tcp_clock_ns() + (u64)delay * NSEC_PER_USEC; | ||
2251 | } | ||
2252 | } | ||
2253 | |||
2235 | #endif /* _TCP_H */ | 2254 | #endif /* _TCP_H */ |