public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: uapi: add TCPI_OPT_NODELAY to tcp_info
@ 2024-07-17 22:22 James Tucker
  2024-07-17 22:42 ` Joe Damato
  0 siblings, 1 reply; 4+ messages in thread
From: James Tucker @ 2024-07-17 22:22 UTC (permalink / raw)
  To: Eric Dumazet, David S. Miller, David Ahern, Jakub Kicinski,
	Paolo Abeni
  Cc: netdev, linux-kernel, James Tucker

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@gmail.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@gmail.com>


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

end of thread, other threads:[~2024-07-17 23:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-17 22:22 [PATCH] net: uapi: add TCPI_OPT_NODELAY to tcp_info James Tucker
2024-07-17 22:42 ` Joe Damato
2024-07-17 22:46   ` Joe Damato
     [not found]     ` <CABGa_T9HJdFiO8gSn72_YP6rp3t+RhSEtYXtgqxp2GUzQJiBmg@mail.gmail.com>
2024-07-17 23:41       ` Joe Damato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox