[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191002221017.2085-1-wdauchy@gmail.com>
Date: Thu, 3 Oct 2019 00:10:17 +0200
From: William Dauchy <wdauchy@...il.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, William Dauchy <wdauchy@...il.com>
Subject: [PATCH] tcp: add tsval and tsecr to TCP_INFO
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@...il.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
Powered by blists - more mailing lists