summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKalpan Jani <kalpan.jani@mpiricsoftware.com>2026-08-12 16:55:39 +0200
committerJakub Kicinski <kuba@kernel.org>2026-08-17 17:25:49 -0700
commitea4eb2adb0d3414abeddaba72dbf8876fa66528f (patch)
tree6657dfa8ffe85e0597d2ba102f4e7808dceca1e6 /net
parentbb961fdd1700859ab764bae3f7b0c8f3b14f87dc (diff)
mptcp: honour configured min/max RTO in retransmit paths
The MPTCP-level retransmit timers (DATA_FIN retransmissions and the fallback timeout) used the hard-coded TCP_RTO_MIN / TCP_RTO_MAX constants, ignoring the tcp_rto_min_us and tcp_rto_max_ms sysctls. Make them follow the sysctls instead: seed icsk_rto_min / icsk_rto_max on the MPTCP socket from the per-netns sysctls in __mptcp_init_sock() -- the msk does not go through tcp_init_sock(), so these fields would otherwise stay zero -- and read them directly where the constants were used: - mptcp_set_datafin_timeout(): both the backoff cap computation and the resulting timer_ival. The two sysctls are validated independently, so rto_min > rto_max is a valid configuration; keep a max_t() guard so ilog2() is never called with 0. - __mptcp_set_timeout(): the fallback when no subflow timeout is available. The icsk fields are read directly instead of using the tcp_rto_min()/tcp_rto_max() helpers: the MPTCP socket does not perform routing lookups in these paths, so the rto_min route metric checked by tcp_rto_min() can never apply here. The TCP_RTO_MIN_US / TCP_RTO_MAX_MS socket options are not supported by MPTCP setsockopt() either; this can be revisited if they get supported on MPTCP sockets. The remaining uses of TCP_RTO_MAX in net/mptcp/ctrl.c (default add_addr_timeout) and net/mptcp/subflow.c (MP_FAIL timeout) are intentionally left unchanged: they use the constant as a default duration, not as an RTO bound on a retransmit timer. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/618 Signed-off-by: Kalpan Jani <kalpan.jani@mpiricsoftware.com> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260812-net-next-mptcp-misc-feat-7-3-v1-4-1905a818f6cb@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/mptcp/protocol.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index ec874d2ead6a..8f074d757743 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -581,17 +581,23 @@ static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq)
static void mptcp_set_datafin_timeout(struct sock *sk)
{
struct inet_connection_sock *icsk = inet_csk(sk);
+ u32 rto_min = READ_ONCE(icsk->icsk_rto_min);
+ u32 rto_max = READ_ONCE(icsk->icsk_rto_max);
u32 retransmits;
+ /* The sysctls are validated independently: rto_min > rto_max is
+ * possible, guard against ilog2(0).
+ */
retransmits = min_t(u32, icsk->icsk_retransmits,
- ilog2(TCP_RTO_MAX / TCP_RTO_MIN));
+ ilog2(max_t(u32, rto_max / rto_min, 1)));
- mptcp_sk(sk)->timer_ival = TCP_RTO_MIN << retransmits;
+ mptcp_sk(sk)->timer_ival = rto_min << retransmits;
}
static void __mptcp_set_timeout(struct sock *sk, long tout)
{
- mptcp_sk(sk)->timer_ival = tout > 0 ? tout : TCP_RTO_MIN;
+ mptcp_sk(sk)->timer_ival = tout > 0 ? tout :
+ READ_ONCE(inet_csk(sk)->icsk_rto_min);
}
static long mptcp_timeout_from_subflow(const struct mptcp_subflow_context *subflow)
@@ -3161,7 +3167,9 @@ unlock:
static void __mptcp_init_sock(struct sock *sk)
{
+ struct inet_connection_sock *icsk = inet_csk(sk);
struct mptcp_sock *msk = mptcp_sk(sk);
+ struct net *net = sock_net(sk);
INIT_LIST_HEAD(&msk->conn_list);
INIT_LIST_HEAD(&msk->join_list);
@@ -3170,7 +3178,13 @@ static void __mptcp_init_sock(struct sock *sk)
INIT_WORK(&msk->work, mptcp_worker);
msk->out_of_order_queue = RB_ROOT;
msk->first_pending = NULL;
- msk->timer_ival = TCP_RTO_MIN;
+
+ /* msk does not go through tcp_init_sock(); seed RTO bounds. */
+ icsk->icsk_rto_min =
+ usecs_to_jiffies(READ_ONCE(net->ipv4.sysctl_tcp_rto_min_us));
+ icsk->icsk_rto_max =
+ msecs_to_jiffies(READ_ONCE(net->ipv4.sysctl_tcp_rto_max_ms));
+ msk->timer_ival = icsk->icsk_rto_min;
msk->scaling_ratio = TCP_DEFAULT_SCALING_RATIO;
msk->backlog_len = 0;
mptcp_init_rtt_est(msk);