diff options
-rw-r--r-- | include/linux/skbuff.h | 7 | ||||
-rw-r--r-- | include/uapi/linux/errqueue.h | 1 | ||||
-rw-r--r-- | include/uapi/linux/net_tstamp.h | 3 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 6 | ||||
-rw-r--r-- | net/socket.c | 2 |
5 files changed, 17 insertions, 2 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 50e1e9b3a5a5..11c270551d25 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -250,9 +250,14 @@ enum { | |||
250 | 250 | ||
251 | /* generate software time stamp when entering packet scheduling */ | 251 | /* generate software time stamp when entering packet scheduling */ |
252 | SKBTX_SCHED_TSTAMP = 1 << 6, | 252 | SKBTX_SCHED_TSTAMP = 1 << 6, |
253 | |||
254 | /* generate software timestamp on peer data acknowledgment */ | ||
255 | SKBTX_ACK_TSTAMP = 1 << 7, | ||
253 | }; | 256 | }; |
254 | 257 | ||
255 | #define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | SKBTX_SCHED_TSTAMP) | 258 | #define SKBTX_ANY_SW_TSTAMP (SKBTX_SW_TSTAMP | \ |
259 | SKBTX_SCHED_TSTAMP | \ | ||
260 | SKBTX_ACK_TSTAMP) | ||
256 | #define SKBTX_ANY_TSTAMP (SKBTX_HW_TSTAMP | SKBTX_ANY_SW_TSTAMP) | 261 | #define SKBTX_ANY_TSTAMP (SKBTX_HW_TSTAMP | SKBTX_ANY_SW_TSTAMP) |
257 | 262 | ||
258 | /* | 263 | /* |
diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h index 17437cf297b7..07bdce1f444a 100644 --- a/include/uapi/linux/errqueue.h +++ b/include/uapi/linux/errqueue.h | |||
@@ -40,6 +40,7 @@ struct scm_timestamping { | |||
40 | enum { | 40 | enum { |
41 | SCM_TSTAMP_SND, /* driver passed skb to NIC, or HW */ | 41 | SCM_TSTAMP_SND, /* driver passed skb to NIC, or HW */ |
42 | SCM_TSTAMP_SCHED, /* data entered the packet scheduler */ | 42 | SCM_TSTAMP_SCHED, /* data entered the packet scheduler */ |
43 | SCM_TSTAMP_ACK, /* data acknowledged by peer */ | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | #endif /* _UAPI_LINUX_ERRQUEUE_H */ | 46 | #endif /* _UAPI_LINUX_ERRQUEUE_H */ |
diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h index 60733845fcdd..ff354021bb69 100644 --- a/include/uapi/linux/net_tstamp.h +++ b/include/uapi/linux/net_tstamp.h | |||
@@ -22,8 +22,9 @@ enum { | |||
22 | SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6), | 22 | SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6), |
23 | SOF_TIMESTAMPING_OPT_ID = (1<<7), | 23 | SOF_TIMESTAMPING_OPT_ID = (1<<7), |
24 | SOF_TIMESTAMPING_TX_SCHED = (1<<8), | 24 | SOF_TIMESTAMPING_TX_SCHED = (1<<8), |
25 | SOF_TIMESTAMPING_TX_ACK = (1<<9), | ||
25 | 26 | ||
26 | SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_TX_SCHED, | 27 | SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_TX_ACK, |
27 | SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | | 28 | SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) | |
28 | SOF_TIMESTAMPING_LAST | 29 | SOF_TIMESTAMPING_LAST |
29 | }; | 30 | }; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 6a2984507755..a3d47af01906 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/ipsec.h> | 74 | #include <linux/ipsec.h> |
75 | #include <asm/unaligned.h> | 75 | #include <asm/unaligned.h> |
76 | #include <net/netdma.h> | 76 | #include <net/netdma.h> |
77 | #include <linux/errqueue.h> | ||
77 | 78 | ||
78 | int sysctl_tcp_timestamps __read_mostly = 1; | 79 | int sysctl_tcp_timestamps __read_mostly = 1; |
79 | int sysctl_tcp_window_scaling __read_mostly = 1; | 80 | int sysctl_tcp_window_scaling __read_mostly = 1; |
@@ -3106,6 +3107,11 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, | |||
3106 | tp->retrans_stamp = 0; | 3107 | tp->retrans_stamp = 0; |
3107 | } | 3108 | } |
3108 | 3109 | ||
3110 | if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_ACK_TSTAMP) && | ||
3111 | between(skb_shinfo(skb)->tskey, prior_snd_una, | ||
3112 | tp->snd_una + 1)) | ||
3113 | __skb_tstamp_tx(skb, NULL, sk, SCM_TSTAMP_ACK); | ||
3114 | |||
3109 | if (!fully_acked) | 3115 | if (!fully_acked) |
3110 | break; | 3116 | break; |
3111 | 3117 | ||
diff --git a/net/socket.c b/net/socket.c index 3a2778d71631..ae89569a2db5 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -619,6 +619,8 @@ void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags) | |||
619 | *tx_flags |= SKBTX_SW_TSTAMP; | 619 | *tx_flags |= SKBTX_SW_TSTAMP; |
620 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_SCHED) | 620 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_SCHED) |
621 | *tx_flags |= SKBTX_SCHED_TSTAMP; | 621 | *tx_flags |= SKBTX_SCHED_TSTAMP; |
622 | if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_ACK) | ||
623 | *tx_flags |= SKBTX_ACK_TSTAMP; | ||
622 | 624 | ||
623 | if (sock_flag(sk, SOCK_WIFI_STATUS)) | 625 | if (sock_flag(sk, SOCK_WIFI_STATUS)) |
624 | *tx_flags |= SKBTX_WIFI_STATUS; | 626 | *tx_flags |= SKBTX_WIFI_STATUS; |