From: Jason Xing <kerneljasonxing@gmail•com>
To: edumazet@google•com, kuba@kernel•org, pabeni@redhat•com,
davem@davemloft•net, dsahern@kernel•org, ncardwell@google•com
Cc: netdev@vger•kernel.org, kerneljasonxing@gmail•com,
Jason Xing <kernelxing@tencent•com>
Subject: [PATCH net-next 1/2] tcp: fix showing wrong rtomin in snmp file when using route option
Date: Thu, 6 Jun 2024 23:03:06 +0800 [thread overview]
Message-ID: <20240606150307.78648-2-kerneljasonxing@gmail.com> (raw)
In-Reply-To: <20240606150307.78648-1-kerneljasonxing@gmail.com>
From: Jason Xing <kernelxing@tencent•com>
TCP_MIB_RTOMIN implemented in tcp mib definitions is always 200, which
is true if without any method to tune rto min. In 2007, we got a way to
tune it globaly when setting rto_min route option, but TCP_MIB_RTOMIN
in /proc/net/snmp still shows the same, namely, 200.
As RFC 1213 said:
"tcpRtoMin
...
The minimum value permitted by a TCP implementation for the
retransmission timeout, measured in milliseconds."
Since the lower bound of rto can be changed, we should accordingly
adjust the output of /proc/net/snmp.
Fixes: 05bb1fad1cde ("[TCP]: Allow minimum RTO to be configurable via routing metrics.")
Signed-off-by: Jason Xing <kernelxing@tencent•com>
---
include/net/tcp.h | 2 ++
net/ipv4/metrics.c | 4 ++++
net/ipv4/proc.c | 3 +++
3 files changed, 9 insertions(+)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index a70fc39090fe..a111a5d151b7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -260,6 +260,8 @@ static_assert((1 << ATO_BITS) > TCP_DELACK_MAX);
extern int sysctl_tcp_max_orphans;
extern long sysctl_tcp_mem[3];
+extern unsigned int tcp_rtax_rtomin;
+
#define TCP_RACK_LOSS_DETECTION 0x1 /* Use RACK to detect losses */
#define TCP_RACK_STATIC_REO_WND 0x2 /* Use static RACK reo wnd */
#define TCP_RACK_NO_DUPTHRESH 0x4 /* Do not use DUPACK threshold in RACK */
diff --git a/net/ipv4/metrics.c b/net/ipv4/metrics.c
index 8ddac1f595ed..61ca949b8281 100644
--- a/net/ipv4/metrics.c
+++ b/net/ipv4/metrics.c
@@ -7,6 +7,8 @@
#include <net/net_namespace.h>
#include <net/tcp.h>
+unsigned int tcp_rtax_rtomin __read_mostly;
+
static int ip_metrics_convert(struct nlattr *fc_mx,
int fc_mx_len, u32 *metrics,
struct netlink_ext_ack *extack)
@@ -60,6 +62,8 @@ static int ip_metrics_convert(struct nlattr *fc_mx,
if (ecn_ca)
metrics[RTAX_FEATURES - 1] |= DST_FEATURE_ECN_CA;
+ tcp_rtax_rtomin = metrics[RTAX_RTO_MIN - 1];
+
return 0;
}
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 6c4664c681ca..ce387081a3c9 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -428,6 +428,9 @@ static int snmp_seq_show_tcp_udp(struct seq_file *seq, void *v)
/* MaxConn field is signed, RFC 2012 */
if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
seq_printf(seq, " %ld", buff[i]);
+ else if (snmp4_tcp_list[i].entry == TCP_MIB_RTOMIN)
+ seq_printf(seq, " %lu",
+ tcp_rtax_rtomin ? tcp_rtax_rtomin : buff[i]);
else
seq_printf(seq, " %lu", buff[i]);
}
--
2.37.3
next prev parent reply other threads:[~2024-06-06 15:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 15:03 [PATCH net-next 0/2] tcp: show the right value of TCP_MIB_RTOMIN Jason Xing
2024-06-06 15:03 ` Jason Xing [this message]
2024-06-06 15:14 ` [PATCH net-next 1/2] tcp: fix showing wrong rtomin in snmp file when using route option Eric Dumazet
2024-06-06 15:40 ` Jason Xing
2024-06-06 15:43 ` Eric Dumazet
2024-06-06 15:50 ` Jason Xing
2024-06-06 15:03 ` [PATCH net-next 2/2] tcp: fix showing wrong rtomin in snmp file when setting sysctl_tcp_rto_min_us Jason Xing
2024-06-06 15:17 ` Eric Dumazet
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=20240606150307.78648-2-kerneljasonxing@gmail.com \
--to=kerneljasonxing@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=dsahern@kernel$(echo .)org \
--cc=edumazet@google$(echo .)com \
--cc=kernelxing@tencent$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=ncardwell@google$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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