aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index f665d74ae509..0e3a09380655 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2340,22 +2340,39 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2340void __sock_tx_timestamp(__u16 tsflags, __u8 *tx_flags); 2340void __sock_tx_timestamp(__u16 tsflags, __u8 *tx_flags);
2341 2341
2342/** 2342/**
2343 * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped 2343 * _sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
2344 * @sk: socket sending this packet 2344 * @sk: socket sending this packet
2345 * @tsflags: timestamping flags to use 2345 * @tsflags: timestamping flags to use
2346 * @tx_flags: completed with instructions for time stamping 2346 * @tx_flags: completed with instructions for time stamping
2347 * @tskey: filled in with next sk_tskey (not for TCP, which uses seqno)
2347 * 2348 *
2348 * Note: callers should take care of initial ``*tx_flags`` value (usually 0) 2349 * Note: callers should take care of initial ``*tx_flags`` value (usually 0)
2349 */ 2350 */
2350static inline void sock_tx_timestamp(const struct sock *sk, __u16 tsflags, 2351static inline void _sock_tx_timestamp(struct sock *sk, __u16 tsflags,
2351 __u8 *tx_flags) 2352 __u8 *tx_flags, __u32 *tskey)
2352{ 2353{
2353 if (unlikely(tsflags)) 2354 if (unlikely(tsflags)) {
2354 __sock_tx_timestamp(tsflags, tx_flags); 2355 __sock_tx_timestamp(tsflags, tx_flags);
2356 if (tsflags & SOF_TIMESTAMPING_OPT_ID && tskey &&
2357 tsflags & SOF_TIMESTAMPING_TX_RECORD_MASK)
2358 *tskey = sk->sk_tskey++;
2359 }
2355 if (unlikely(sock_flag(sk, SOCK_WIFI_STATUS))) 2360 if (unlikely(sock_flag(sk, SOCK_WIFI_STATUS)))
2356 *tx_flags |= SKBTX_WIFI_STATUS; 2361 *tx_flags |= SKBTX_WIFI_STATUS;
2357} 2362}
2358 2363
2364static inline void sock_tx_timestamp(struct sock *sk, __u16 tsflags,
2365 __u8 *tx_flags)
2366{
2367 _sock_tx_timestamp(sk, tsflags, tx_flags, NULL);
2368}
2369
2370static inline void skb_setup_tx_timestamp(struct sk_buff *skb, __u16 tsflags)
2371{
2372 _sock_tx_timestamp(skb->sk, tsflags, &skb_shinfo(skb)->tx_flags,
2373 &skb_shinfo(skb)->tskey);
2374}
2375
2359/** 2376/**
2360 * sk_eat_skb - Release a skb if it is no longer needed 2377 * sk_eat_skb - Release a skb if it is no longer needed
2361 * @sk: socket to eat this skb from 2378 * @sk: socket to eat this skb from