[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240717-nagle-tcpinfo-v1-1-83e149ef9953@gmail.com>
Date: Wed, 17 Jul 2024 15:22:14 -0700
From: James Tucker <jftucker@...il.com>
To: Eric Dumazet <edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>, David Ahern <dsahern@...nel.org>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
James Tucker <jftucker@...il.com>
Subject: [PATCH] net: uapi: add TCPI_OPT_NODELAY to tcp_info
Nagle's algorithm is one of the classic causes of poor performance for
certain classes of userspace software over TCP, but is currently not
reported in userspace tools such as ss(1) from iproute2 as it is only
observable via getsockopt.
Signed-off-by: James Tucker <jftucker@...il.com>
---
The impact of Nagle is substantial on TCP connections in a lot of use
cases, but is currently unreported in the TCP info structure.
---
include/uapi/linux/tcp.h | 1 +
net/ipv4/tcp.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index dbf896f3146c..d7675e7022b4 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -178,6 +178,7 @@ enum tcp_fastopen_client_fail {
#define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */
#define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */
#define TCPI_OPT_USEC_TS 64 /* usec timestamps */
+#define TCPI_OPT_NODELAY 128 /* Nagle's algorithm is disabled */
/*
* Sender's congestion state indicating normal or abnormal situations
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index e03a342c9162..2f5aa78800d3 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3853,6 +3853,8 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info)
info->tcpi_options |= TCPI_OPT_SYN_DATA;
if (tp->tcp_usec_ts)
info->tcpi_options |= TCPI_OPT_USEC_TS;
+ if (tp->nonagle & TCP_NAGLE_OFF)
+ info->tcpi_options |= TCPI_OPT_NODELAY;
info->tcpi_rto = jiffies_to_usecs(icsk->icsk_rto);
info->tcpi_ato = jiffies_to_usecs(min_t(u32, icsk->icsk_ack.ato,
---
base-commit: e2f710f97f3544df08ebe608c8157536e0ffb494
change-id: 20240717-nagle-tcpinfo-c6c3eef0b91d
Best regards,
--
James Tucker <jftucker@...il.com>
Powered by blists - more mailing lists