From: James Tucker <jftucker@gmail.com>
To: Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
James Tucker <jftucker@gmail.com>
Subject: [PATCH] net: uapi: add TCPI_OPT_NODELAY to tcp_info
Date: Wed, 17 Jul 2024 15:22:14 -0700 [thread overview]
Message-ID: <20240717-nagle-tcpinfo-v1-1-83e149ef9953@gmail.com> (raw)
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>
next reply other threads:[~2024-07-17 22:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-17 22:22 James Tucker [this message]
2024-07-17 22:42 ` [PATCH] net: uapi: add TCPI_OPT_NODELAY to tcp_info 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240717-nagle-tcpinfo-v1-1-83e149ef9953@gmail.com \
--to=jftucker@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox