netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcp: add tsval and tsecr to TCP_INFO
@ 2019-10-02 22:10 William Dauchy
  2019-10-02 22:33 ` Eric Dumazet
  2019-10-26 18:45 ` [PATCH v2] tcp: add timestamp options fetcher William Dauchy
  0 siblings, 2 replies; 7+ messages in thread
From: William Dauchy @ 2019-10-02 22:10 UTC (permalink / raw)
  To: netdev; +Cc: davem, William Dauchy

tsval and tsecr are useful in some cases to diagnose TCP issues from the
sender point of view where unexplained RTT values are seen. Getting the
the timestamps from both ends will help understand those issues more
easily.

Signed-off-by: William Dauchy <wdauchy@gmail.com>
---
 include/uapi/linux/tcp.h | 3 +++
 net/ipv4/tcp.c           | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index 81e697978e8b..fecd4d0f177c 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -276,6 +276,9 @@ struct tcp_info {
 	__u32	tcpi_snd_wnd;	     /* peer's advertised receive window after
 				      * scaling (bytes)
 				      */
+
+	__u32	tcpi_tsval;          /* Time stamp value */
+	__u32	tcpi_tsecr;          /* Time stamp echo reply */
 };
 
 /* netlink attributes types for SCM_TIMESTAMPING_OPT_STATS */
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 79c325a07ba5..7d0968df99c9 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3229,8 +3229,11 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
 	info->tcpi_probes = icsk->icsk_probes_out;
 	info->tcpi_backoff = icsk->icsk_backoff;
 
-	if (tp->rx_opt.tstamp_ok)
+	if (tp->rx_opt.tstamp_ok) {
 		info->tcpi_options |= TCPI_OPT_TIMESTAMPS;
+		info->tcpi_tsval = tp->rx_opt.rcv_tsval;
+		info->tcpi_tsecr = tp->rx_opt.rcv_tsecr;
+	}
 	if (tcp_is_sack(tp))
 		info->tcpi_options |= TCPI_OPT_SACK;
 	if (tp->rx_opt.wscale_ok) {
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-26 20:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 22:10 [PATCH] tcp: add tsval and tsecr to TCP_INFO William Dauchy
2019-10-02 22:33 ` Eric Dumazet
2019-10-02 22:54   ` William Dauchy
2019-10-02 23:14     ` Eric Dumazet
2019-10-03  5:47       ` William Dauchy
2019-10-26 18:45 ` [PATCH v2] tcp: add timestamp options fetcher William Dauchy
2019-10-26 20:42   ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).