include/uapi/linux/tcp.h | 1 + net/ipv4/tcp.c | 2 ++ 2 files changed, 3 insertions(+)
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>
Hi: FYI new features should be sent with net-next in the subject line (e.g. [PATCH net-next]) On Wed, Jul 17, 2024 at 03:22:14PM -0700, James Tucker wrote: > 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. Commit messages should be written in imperative mood. Thanks, Joe
On Wed, Jul 17, 2024 at 03:42:57PM -0700, Joe Damato wrote: > Hi: > > FYI new features should be sent with net-next in the subject line > (e.g. [PATCH net-next]) Sorry, I should have also mentioned that net-next is currently closed for a 2 week merge window. So, you'd need to wait until it re-opens to send patches for new features. Thanks, Joe
© 2016 - 2025 Red Hat, Inc.