diff options
| -rw-r--r-- | include/net/sock.h | 6 | ||||
| -rw-r--r-- | net/socket.c | 20 |
2 files changed, 17 insertions, 9 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 52fe0bc5598a..38805fa02e48 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -2199,9 +2199,11 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, | |||
| 2199 | /** | 2199 | /** |
| 2200 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped | 2200 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped |
| 2201 | * @sk: socket sending this packet | 2201 | * @sk: socket sending this packet |
| 2202 | * @tx_flags: filled with instructions for time stamping | 2202 | * @tx_flags: completed with instructions for time stamping |
| 2203 | * | ||
| 2204 | * Note : callers should take care of initial *tx_flags value (usually 0) | ||
| 2203 | */ | 2205 | */ |
| 2204 | void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); | 2206 | void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags); |
| 2205 | 2207 | ||
| 2206 | /** | 2208 | /** |
| 2207 | * sk_eat_skb - Release a skb if it is no longer needed | 2209 | * sk_eat_skb - Release a skb if it is no longer needed |
diff --git a/net/socket.c b/net/socket.c index ae89569a2db5..95ee7d8682e7 100644 --- a/net/socket.c +++ b/net/socket.c | |||
| @@ -610,20 +610,26 @@ void sock_release(struct socket *sock) | |||
| 610 | } | 610 | } |
| 611 | EXPORT_SYMBOL(sock_release); | 611 | EXPORT_SYMBOL(sock_release); |
| 612 | 612 | ||
| 613 | void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags) | 613 | void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags) |
| 614 | { | 614 | { |
| 615 | *tx_flags = 0; | 615 | u8 flags = *tx_flags; |
| 616 | |||
| 616 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_HARDWARE) | 617 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_HARDWARE) |
| 617 | *tx_flags |= SKBTX_HW_TSTAMP; | 618 | flags |= SKBTX_HW_TSTAMP; |
| 619 | |||
| 618 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_SOFTWARE) | 620 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_SOFTWARE) |
| 619 | *tx_flags |= SKBTX_SW_TSTAMP; | 621 | flags |= SKBTX_SW_TSTAMP; |
| 622 | |||
| 620 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_SCHED) | 623 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_SCHED) |
| 621 | *tx_flags |= SKBTX_SCHED_TSTAMP; | 624 | flags |= SKBTX_SCHED_TSTAMP; |
| 625 | |||
| 622 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_ACK) | 626 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_ACK) |
| 623 | *tx_flags |= SKBTX_ACK_TSTAMP; | 627 | flags |= SKBTX_ACK_TSTAMP; |
| 624 | 628 | ||
| 625 | if (sock_flag(sk, SOCK_WIFI_STATUS)) | 629 | if (sock_flag(sk, SOCK_WIFI_STATUS)) |
| 626 | *tx_flags |= SKBTX_WIFI_STATUS; | 630 | flags |= SKBTX_WIFI_STATUS; |
| 631 | |||
| 632 | *tx_flags = flags; | ||
| 627 | } | 633 | } |
| 628 | EXPORT_SYMBOL(sock_tx_timestamp); | 634 | EXPORT_SYMBOL(sock_tx_timestamp); |
| 629 | 635 | ||
