mptcp: improve ADD_ADDR timeout handling
Subsystems (4)
Geliang Tang
reviewerv4 cover mptcp: improve ADD_ADDR timeout handling
From: Geliang Tang <[email protected]>
v4:
- rollback to v2, just use icsk->icsk_rto.
Depends on:
- mptcp: disable add_addr retrans, v2
Based-on: <[email protected]>
v3:
- a new patch, remove duplicate sk_reset_timer call
- use __tcp_set_rto() * 2 instead of icsk->icsk_rto
- update selftests.
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/
v2:
- do not rename add_addr_timeout
- use icsk->icsk_rto instead of tp->srtt_us
- increase the time after each retransmission
- https://patchwork.kernel.org/project/mptcp/patch/40706ad511220729207ccd7cf48e320e4d0d7dea.1754028199.git.tanggeliang@kylinos.cn/
v1:
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/
Geliang Tang (2):
mptcp: make ADD_ADDR retransmission timeout adaptive
selftests: mptcp: remove add_addr_timeout settings
Documentation/networking/mptcp-sysctl.rst | 4 +-- net/mptcp/pm.c | 28 ++++++++++++++++--- .../testing/selftests/net/mptcp/mptcp_join.sh | 3 -- 3 files changed, 26 insertions(+), 9 deletions(-)
Signature · 1 line
2.48.1
Geliang Tang
reviewerPATCH v4 1/2 mptcp: make ADD_ADDR retransmission timeout adaptive
From: Geliang Tang <[email protected]>
Currently the ADD_ADDR option is retransmitted with a fixed timeout. This patch makes the retransmission timeout adaptive by using the maximum RTO among all the subflows, while still capping it at the configured maximum value (add_addr_timeout_max). This improves responsiveness when establishing new subflows.
Specifically:
1. Adds mptcp_adjust_add_addr_timeout() helper to compute the adaptive timeout.
2. Uses maximum subflow RTO (icsk_rto) when available.
3. Applies exponential backoff based on retransmission count.
4. Maintains fallback to configured max timeout when no RTO data exists.
--- Documentation/networking/mptcp-sysctl.rst | 4 ++-- net/mptcp/pm.c | 28 +++++++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-)
Documentation/networking/mptcp-sysctl.rst +2 -2
@@ -8,8 +8,8 @@ MPTCP Sysfs variables =============================== add_addr_timeout - INTEGER (seconds) - Set the timeout after which an ADD_ADDR control message will be - resent to an MPTCP peer that has not acknowledged a previous + Set the maximum value of timeout after which an ADD_ADDR control message + will be resent to an MPTCP peer that has not acknowledged a previous ADD_ADDR message. Do not retransmit if set to 0.
net/mptcp/pm.c +24 -4
@@ -268,6 +268,27 @@ int mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,return -EINVAL ; } +static unsigned int mptcp_adjust_add_addr_timeout (struct mptcp_sock *msk) +{ +const struct net *net =sock_net ((struct sock *)msk); +unsigned int rto =mptcp_get_add_addr_timeout (net); +struct mptcp_subflow_context *subflow; +unsigned int max =0 ; + +mptcp_for_each_subflow (msk, subflow) { +struct sock *ssk =mptcp_subflow_tcp_sock (subflow); +struct inet_connection_sock *icsk =inet_csk (ssk); + +if (icsk->icsk_rto > max) + max = icsk->icsk_rto; + } + +if (max && max < rto) + rto = max; + +return rto; +} +static void mptcp_pm_add_timer (struct timer_list *timer) { struct mptcp_pm_add_entry *entry = timer_container_of(entry, timer,
@@ -292,7 +313,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer) goto out; } - timeout =mptcp_get_add_addr_timeout (sock_net (sk)); + timeout =mptcp_adjust_add_addr_timeout (msk);if (!timeout) goto out;
@@ -307,7 +328,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 + timeout); + jiffies + (timeout << entry->retrans_times));spin_unlock_bh (&msk->pm.lock);
@@ -348,7 +369,6 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, {struct mptcp_pm_add_entry *add_entry =NULL ;struct sock *sk = (struct sock *)msk; -struct net *net =sock_net (sk);unsigned int timeout;lockdep_assert_held (&msk->pm.lock);
@@ -374,7 +394,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,timer_setup (&add_entry->add_timer, mptcp_pm_add_timer,0 ); reset_timer: - timeout =mptcp_get_add_addr_timeout (net); + timeout =mptcp_adjust_add_addr_timeout (msk);if (timeout)sk_reset_timer (sk, &add_entry->add_timer, jiffies + timeout);
Signature · 1 line
2.48.1
Matthieu Baerts
maintainerRe: [PATCH mptcp-next v4 1/2] mptcp: make ADD_ADDR retransmission timeout adaptive
Hi Geliang,
Quoted 8 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Currently the
ADD_ADDRoption is retransmitted with a fixed timeout. This patch makes the retransmission timeout adaptive by using the maximum RTO among all the subflows, while still capping it at the configured maximum value (add_addr_timeout_max). This improves responsiveness when establishing new subflows.
Quoted 6 lines
Specifically:
1. Addsmptcp_adjust_add_addr_timeout()helper to compute the adaptive timeout.
2. Uses maximum subflow RTO (icsk_rto) when available.
3. Applies exponential backoff based on retransmission count.
4. Maintains fallback to configured max timeout when no RTO data exists.
I might be good to add a note about the behavioural change:
This slightly change the behaviour of the MPTCP "add_addr_timeout" sysctl knob to be used as a maximum instead of a fixed value, but this is seen as an improvement: the ADD_ADDR might be sent quicker than before to improve the overall MPTCP connection. Also, the default value is set at 2 min, which was way too big, and caused the ADD_ADDR not to be retransmitted for connections shorter than 2 minutes.
Quoted 13 lines
Reviewed-by Christoph Paasch <[email protected]>Signed-off-by Geliang Tang <[email protected]>--- Documentation/networking/mptcp-sysctl.rst | 4 ++-- net/mptcp/pm.c | 28 +++++++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-)Documentation/networking/mptcp-sysctl.rst +0
-0
Documentation/networking/mptcp-sysctl.rst MPTCP Sysfs variables · line 13
Quoted 8 lines
Documentation/networking/mptcp-sysctl.rst +2
-2@@ -8,8 +8,8 @@ MPTCP Sysfs variables =============================== add_addr_timeout - INTEGER (seconds) - Set the timeout after which an ADD_ADDR control message will be - resent to an MPTCP peer that has not acknowledged a previous + Set the maximum value of timeout after which an ADD_ADDR control message + will be resent to an MPTCP peer that has not acknowledged a previous ADD_ADDR message.
I suggest adding this at the end:
A dynamically estimated retransmission timeout based on the estimated connection round-trip-time is used if this value is lower than the maximum one.
I can do that when applying the patch. I can update the text if needed later on.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Geliang Tang
reviewerPATCH v4 2/2 selftests: mptcp: remove add_addr_timeout settings
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Now that add_addr_timeout can be dynamically adjusted, there is no need to set specific timeout values in the mptcp_join.sh tests. This patch removes the explicit sysctl settings for net.mptcp.add_addr_timeout from the test scripts.
The change simplifies the test setup and ensures the tests work with the default or dynamically adjusted timeout values.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 --- 1 file changed, 3 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -3
@@ -347,8 +347,6 @@ reset_with_add_addr_timeout() tables="${ip6tables}" fi - ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1 - if ! ip netns exec $ns2 $tables -A OUTPUT -p tcp \ -m tcp --tcp-option 30 \ -m bpf --bytecode \
@@ -2183,7 +2181,6 @@ signal_address_tests() pm_nl_add_endpoint $ns2 10.0.4.2 flags signal # the peer could possibly miss some addr notification, allow retransmission - ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1 speed=slow \ run_tests $ns1 $ns2 10.0.1.1
Signature · 1 line
2.48.1
Matthieu Baerts
maintainerRe: [PATCH mptcp-next v4 2/2] selftests: mptcp: remove add_addr_timeout settings
Hi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Now that
add_addr_timeoutcan be dynamically adjusted, there is no need to set specific timeout values in themptcp_join.shtests. This patch removes the explicit sysctl settings for net.mptcp.add_addr_timeout from the test scripts.
I don't think we should remove them: when looking at mptcp_join.sh, I see that chk_add_nr() and chk_add_tx_nr() are more tolerant with retransmissions.
Linked to that, I see that some tests are failing because too many ADD_ADDR are seen:
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/17391054770
https://netdev-3.bots.linux.dev/vmksft-mptcp-dbg/results/280241/1-mptcp-join-sh/stdout
https://netdev-3.bots.linux.dev/vmksft-mptcp-dbg/results/279881/1-mptcp-join-sh/stdout
I wonder if it would not be better to always check for fewer ADD_ADDR than expected.
Also, for this one:
https://netdev-3.bots.linux.dev/vmksft-mptcp-dbg/results/277181/1-mptcp-join-sh/stdout
Probably we should mark the test as "slow".
I will try to look at that.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Unstable: 1 failed test(s): packetdrill_add_addr 🔴
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/16904044239
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/9cc8618373f4
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=990438
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normalFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Hi Geliang,
Quoted 4 lines · Geliang Tang
From: Geliang Tang <[email protected]>
v4:
- rollback to v2, just useicsk->icsk_rto.
Thank you for the v4. Thanks to the previous measurements you did, the new version looks good to me:
I have one small comment in patch 1/2, but that's not blocking.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerHi Geliang,
Quoted 8 lines · Matthieu Baerts
Hi Geliang,
Quoted 4 lines · Geliang Tang
From: Geliang Tang <[email protected]>
v4:
- rollback to v2, just useicsk->icsk_rto.
Quoted 6 lines
Thank you for the v4. Thanks to the previous measurements you did, the new version looks good to me:
Reviewed-by Matthieu Baerts (NGI0) <[email protected]>I have one small comment in patch 1/2, but that's not blocking.
Now in our tree (with this suggestion ↑ -- feat. for -next):
New patches for t/upstream:
- 34c96ea5123b: mptcp: make ADD_ADDR retransmission timeout adaptive
- 5d56ac514943: selftests: mptcp: remove add_addr_timeout settings
- Results: d89b1338067d..de0b36f41cae (export)
Tests are now in progress:
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.