From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next 2/3] mptcp: make ADD_ADDR timeout adaptive to subflow RTT
Date: Wed, 30 Jul 2025 11:26:13 +0200 [thread overview]
Message-ID: <b56526fb-0807-4309-84af-5c38289e2ec4@kernel.org> (raw)
In-Reply-To: <12b2e330c05554b030615375f82b5af1fb7b8289.1753777199.git.tanggeliang@kylinos.cn>
Hi Geliang,
On 29/07/2025 10:22, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> This patch makes the ADD_ADDR retransmission timeout adaptive by using
> the maximum subflow RTT, while still capping it at the configured max
> value (add_addr_timeout_max). This improves responsiveness when
> establishing new subflows.
>
> The change:
> - Adds mptcp_get_add_addr_timeout() helper
> - Uses subflow RTT when available
> - Falls back to max timeout otherwise
>
Can you add the Closes tag here, so GitHub will automatically close the
ticket when this patch will be applied?
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/576
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> net/mptcp/pm.c | 27 ++++++++++++++++++++++++---
> 1 file changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index 40e8ebe566e5..bf4d92293e1e 100644
> --- a/net/mptcp/pm.c
> +++ b/net/mptcp/pm.c
> @@ -268,6 +268,27 @@ int mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
> return -EINVAL;
> }
>
> +static unsigned int mptcp_get_add_addr_timeout(struct mptcp_sock *msk,
> + const struct net *net)
> +{
> + unsigned int timeout = mptcp_get_add_addr_timeout_max(net);
> + struct mptcp_subflow_context *subflow;
> + unsigned int srtt_us = 0;
> +
> + mptcp_for_each_subflow(msk, subflow) {
> + struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
> + struct tcp_sock *tp = tcp_sk(ssk);
> +
> + if (srtt_us < tp->srtt_us)
(detail: it feels more logical do have "if (tp->srtt_us > srtt_us)" if
you look for the max, but the result is the same)
> + srtt_us = tp->srtt_us;
> + }
> +
> + if (srtt_us && srtt_us < timeout)
I don't think you can do that: timeout is in jiffies, while srtt_us is
in µsec. You need to use "usecs_to_jiffies(srtt_us)"
> + timeout = srtt_us;
Taking just srtt_us doesn't seem to be a good idea as the ADD_ADDR echo
is supposed to arrive around srtt_us: this will certainly cause too
aggressive ADD_ADDR retransmissions if timeout is around the time the
echo is supposed to arrive.
I think we should imitate TCP here: using srtt_us and rttvar_us. (Or
start with "srtt_us << 1"?). Or maybe better to use "icsk->icsk_rto"
instead, but I don't know if it will be set to a correct value when we
will look, no?
> +
> + return timeout;
> +}
> +
> static void mptcp_pm_add_timer(struct timer_list *timer)
> {
> struct mptcp_pm_add_entry *entry = timer_container_of(entry, timer,
> @@ -302,7 +323,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
>
> if (entry->retrans_times < ADD_ADDR_RETRANS_MAX)
> sk_reset_timer(sk, timer,
> - jiffies + mptcp_get_add_addr_timeout_max(sock_net(sk)));
> + jiffies + mptcp_get_add_addr_timeout(msk, sock_net(sk)));
I wonder if we should increase the time after each retransmission,
similar to what is done in TCP (timeout << entry->retrans_times). We
could keep it linear, but because this time now depends on the measured
srtt, it might be better to have an exponential backoff. It will still
need to be bounded to the max. In this case, it might be easier to pass
entry->retrans_times to mptcp_get_add_addr_timeout())
>
> spin_unlock_bh(&msk->pm.lock);
>
> @@ -354,7 +375,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
> return false;
>
> sk_reset_timer(sk, &add_entry->add_timer,
> - jiffies + mptcp_get_add_addr_timeout_max(net));
> + jiffies + mptcp_get_add_addr_timeout(msk, net));
> return true;
> }
>
> @@ -370,7 +391,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
>
> timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0);
> sk_reset_timer(sk, &add_entry->add_timer,
> - jiffies + mptcp_get_add_addr_timeout_max(net));
> + jiffies + mptcp_get_add_addr_timeout(msk, net));
>
> return true;
> }
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2025-07-30 9:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 8:22 [PATCH mptcp-next 0/3] mptcp: improve ADD_ADDR timeout handling Geliang Tang
2025-07-29 8:22 ` [PATCH mptcp-next 1/3] mptcp: rename add_addr_timeout to add_addr_timeout_max Geliang Tang
2025-07-30 9:22 ` Matthieu Baerts
2025-07-29 8:22 ` [PATCH mptcp-next 2/3] mptcp: make ADD_ADDR timeout adaptive to subflow RTT Geliang Tang
2025-07-30 9:26 ` Matthieu Baerts [this message]
2025-07-29 8:22 ` [PATCH mptcp-next 3/3] selftests: mptcp: update for add_addr_timeout_max rename Geliang Tang
2025-07-30 9:26 ` Matthieu Baerts
2025-07-29 10:24 ` [PATCH mptcp-next 0/3] mptcp: improve ADD_ADDR timeout handling MPTCP CI
2025-07-30 9:20 ` Matthieu Baerts
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=b56526fb-0807-4309-84af-5c38289e2ec4@kernel.org \
--to=matttbe@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=tanggeliang@kylinos.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.