* [Devel] [PATCH hci-8.1 v3 01/11] ms/mptcp: fix retransmission loop when csum is enabled
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
@ 2026-11-16 20:05 ` Eva Kurchatova
2026-11-16 20:50 ` no-reply
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 02/11] ms/mptcp: move the retrans loop to a separate helper Eva Kurchatova
` (11 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:05 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
Sashiko noted that retransmission with csum enabled can actually
transmit new data, but currently the relevant code does not update
accordingly snd_nxt.
The may cause incoming ack drop and an endless retransmission loop.
Address the issue incrementing snd_nxt as needed.
Fixes: 4e14867d5e91 ("mptcp: tune re-injections for csum enabled mode")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260602-net-mptcp-misc-fixes-7-1-rc7-v2-2-856831229976@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit d1918b36edcaed0ec4ef6888b2358c6b1ddcff47)
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/protocol.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index e526648a583e..9f1cc648a272 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2666,6 +2666,10 @@ static void __mptcp_retrans(struct sock *sk)
msk->bytes_retrans += len;
dfrag->already_sent = max(dfrag->already_sent, len);
+ /* With csum enabled retransmission can send new data. */
+ if (after64(dfrag->already_sent + dfrag->data_seq, msk->snd_nxt))
+ WRITE_ONCE(msk->snd_nxt, dfrag->already_sent + dfrag->data_seq);
+
reset_timer:
mptcp_check_and_set_pending(sk);
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [Devel] [PATCH hci-8.1 v3 01/11] ms/mptcp: fix retransmission loop when csum is enabled
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 01/11] ms/mptcp: fix retransmission loop when csum is enabled Eva Kurchatova
@ 2026-11-16 20:50 ` no-reply
0 siblings, 0 replies; 26+ messages in thread
From: no-reply @ 2026-11-16 20:50 UTC (permalink / raw)
To: Eva Kurchatova, khorenko; +Cc: devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mptcp: __mptcp_retrans() advances snd_nxt without updating
bytes_sent
--
commit 1c9efc05c58bc70aa1470c52a10b437a4cddae0e
Author: Paolo Abeni <pabeni@redhat.com>
ms/mptcp: fix retransmission loop when csum is enabled
When MPTCP checksums are enabled, __mptcp_retrans() can send bytes past dfrag->already_sent. This patch advances msk->snd_nxt to cover those bytes, to avoid dropped ACKs and an endless retransmission loop.
Link: https://patch.msgid.link/20260602-net-mptcp-misc-fixes-7-1-rc7-v2-2-856831229976@kernel.org
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index e526648a583e..9f1cc648a272 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2666,6 +2666,10 @@ static void __mptcp_retrans(struct sock *sk)
> msk->bytes_retrans += len;
> dfrag->already_sent = max(dfrag->already_sent, len);
>
> + /* With csum enabled retransmission can send new data. */
> + if (after64(dfrag->already_sent + dfrag->data_seq, msk->snd_nxt))
> + WRITE_ONCE(msk->snd_nxt, dfrag->already_sent + dfrag->data_seq);
> +
[Severity: Low]
As reported by no-reply@sashiko.virtuozzo.com on v1 [1], this isn't a
bug in the ACK handling, but should msk->bytes_sent also be advanced here?
mptcp_update_post_push() does "msk->bytes_sent += snd_nxt_new - msk->snd_nxt"
next to its snd_nxt update, and this hunk skips that step.
With csum enabled, the new bytes sent past the old already_sent are never
counted later by the push path, because the dfrag then has
already_sent == data_len. They are also counted in msk->bytes_retrans
above. So mptcpi_bytes_sent under-reports and mptcpi_bytes_retrans
over-reports on such connections.
[1] https://lore.kernel.org/r/010701a1aed34772-28c94ba5-5fa6-417e-9598-ebdd1dab980d-000000@eu-central-1.amazonses.com
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116204557.718500-1-eva.kurchatova@virtuozzo.com?part=1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Devel] [PATCH hci-8.1 v3 02/11] ms/mptcp: move the retrans loop to a separate helper
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 01/11] ms/mptcp: fix retransmission loop when csum is enabled Eva Kurchatova
@ 2026-11-16 20:05 ` Eva Kurchatova
2026-11-16 20:50 ` no-reply
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 03/11] ms/mptcp: move the stale logic out of retrans scheduler Eva Kurchatova
` (10 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:05 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
This is a cleanup in order to make the next patch simpler.
No functional change intended.
Tested-by: Gang Yan <yangang@kylinos.cn>
Tested-by: Geliang Tang <geliang@kernel.org>
Acked-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260807-net-next-mptcp-oooq-pruning-v3-1-dbc1eb853cc3@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 789e6a844b51bf6362a7e7f551553ba988f3dc92)
Rebase note: this tree increments icsk_retransmits without the
WRITE_ONCE() that mainline added later, and the moved code keeps the
plain increment.
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/protocol.c | 72 ++++++++++++++++++++++++++------------------
1 file changed, 42 insertions(+), 30 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 9f1cc648a272..8c17857bbbcf 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2578,40 +2578,14 @@ static void mptcp_check_fastclose(struct mptcp_sock *msk)
sk_error_report(sk);
}
-static void __mptcp_retrans(struct sock *sk)
+/* Retransmit the specified data fragment on all the selected subflows. */
+static int __mptcp_push_retrans(struct sock *sk, struct mptcp_data_frag *dfrag)
{
struct mptcp_sendmsg_info info = { .data_lock_held = true, };
struct mptcp_sock *msk = mptcp_sk(sk);
struct mptcp_subflow_context *subflow;
- struct mptcp_data_frag *dfrag;
struct sock *ssk;
- int ret, err;
- u16 len = 0;
-
- mptcp_clean_una_wakeup(sk);
-
- /* first check ssk: need to kick "stale" logic */
- err = mptcp_sched_get_retrans(msk);
- dfrag = mptcp_rtx_head(sk);
- if (!dfrag) {
- if (mptcp_data_fin_enabled(msk)) {
- struct inet_connection_sock *icsk = inet_csk(sk);
-
- icsk->icsk_retransmits++;
- mptcp_set_datafin_timeout(sk);
- mptcp_send_ack(msk);
-
- goto reset_timer;
- }
-
- if (!mptcp_send_head(sk))
- goto clear_scheduled;
-
- goto reset_timer;
- }
-
- if (err)
- goto reset_timer;
+ int ret, len = 0;
mptcp_for_each_subflow(msk, subflow) {
if (READ_ONCE(subflow->scheduled)) {
@@ -2639,7 +2613,7 @@ static void __mptcp_retrans(struct sock *sk)
!msk->allow_subflows) {
spin_unlock_bh(&msk->fallback_lock);
release_sock(ssk);
- goto clear_scheduled;
+ return -1;
}
while (info.sent < info.limit) {
@@ -2662,6 +2636,44 @@ static void __mptcp_retrans(struct sock *sk)
release_sock(ssk);
}
}
+ return len;
+}
+
+static void __mptcp_retrans(struct sock *sk)
+{
+ struct mptcp_sock *msk = mptcp_sk(sk);
+ struct mptcp_subflow_context *subflow;
+ struct mptcp_data_frag *dfrag;
+ int err, len;
+
+ mptcp_clean_una_wakeup(sk);
+
+ /* first check ssk: need to kick "stale" logic */
+ err = mptcp_sched_get_retrans(msk);
+ dfrag = mptcp_rtx_head(sk);
+ if (!dfrag) {
+ if (mptcp_data_fin_enabled(msk)) {
+ struct inet_connection_sock *icsk = inet_csk(sk);
+
+ icsk->icsk_retransmits++;
+ mptcp_set_datafin_timeout(sk);
+ mptcp_send_ack(msk);
+
+ goto reset_timer;
+ }
+
+ if (!mptcp_send_head(sk))
+ goto clear_scheduled;
+
+ goto reset_timer;
+ }
+
+ if (err)
+ goto reset_timer;
+
+ len = __mptcp_push_retrans(sk, dfrag);
+ if (len < 0)
+ goto clear_scheduled;
msk->bytes_retrans += len;
dfrag->already_sent = max(dfrag->already_sent, len);
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* [Devel] [PATCH hci-8.1 v3 03/11] ms/mptcp: move the stale logic out of retrans scheduler
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 01/11] ms/mptcp: fix retransmission loop when csum is enabled Eva Kurchatova
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 02/11] ms/mptcp: move the retrans loop to a separate helper Eva Kurchatova
@ 2026-11-16 20:05 ` Eva Kurchatova
2026-11-16 20:52 ` no-reply
2026-11-17 11:25 ` Konstantin Khorenko
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 04/11] ms/mptcp: let the retrans scheduler do its job Eva Kurchatova
` (9 subsequent siblings)
12 siblings, 2 replies; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:05 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
This allow separating the stale logic invocation and the retrans
scheduler, and will simplify the next patch.
It's also a cleaner design as the retrans scheduler has currently
too many side effects. As a possible downside, the retrans work will
now traverse the subflows list additional times; that does not matter
much, as this is slowpath.
While at it, pick more accurate names for the involved helpers and
explicitly note that the per subflow stale data is under msk socket
lock protection.
The scheduler and the stale logic may observe different subflow
statues, as no subflow lock is acquired. This is intentional and not
harmful, worst case leading to slower retransmissions.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260807-net-next-mptcp-oooq-pruning-v3-2-dbc1eb853cc3@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 6cafe51e0f98fe60a106783d30b2f4c4b6039f4c)
Rebase note: this tree has no "closing" subflow flag, so __unused grows
from 9 to 10 instead of from 8 to 9.
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/pm.c | 43 ++++++++++++++++++++++++++++---------------
net/mptcp/protocol.c | 4 ++--
net/mptcp/protocol.h | 11 +++++++----
3 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index a330e74bf5c1..05775d0b6493 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -908,7 +908,8 @@ bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc)
return mptcp_pm_nl_is_backup(msk, &skc_local);
}
-static void mptcp_pm_subflows_chk_stale(const struct mptcp_sock *msk, struct sock *ssk)
+static void
+mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk)
{
struct mptcp_subflow_context *iter, *subflow = mptcp_subflow_ctx(ssk);
struct sock *sk = (struct sock *)msk;
@@ -945,22 +946,34 @@ static void mptcp_pm_subflows_chk_stale(const struct mptcp_sock *msk, struct soc
}
}
-void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk)
+void mptcp_pm_chk_stale(const struct mptcp_sock *msk)
{
- struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
- u32 rcv_tstamp = READ_ONCE(tcp_sk(ssk)->rcv_tstamp);
-
- /* keep track of rtx periods with no progress */
- if (!subflow->stale_count) {
- subflow->stale_rcv_tstamp = rcv_tstamp;
- subflow->stale_count++;
- } else if (subflow->stale_rcv_tstamp == rcv_tstamp) {
- if (subflow->stale_count < U8_MAX)
+ struct mptcp_subflow_context *subflow;
+
+ mptcp_for_each_subflow(msk, subflow) {
+ struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+ u32 rcv_tstamp;
+
+ if (!__mptcp_subflow_active(subflow))
+ continue;
+
+ /* No data outstanding at TCP level? not stale */
+ if (tcp_rtx_and_write_queues_empty(ssk))
+ continue;
+
+ /* keep track of rtx periods with no progress */
+ rcv_tstamp = READ_ONCE(tcp_sk(ssk)->rcv_tstamp);
+ if (!subflow->stale_count) {
+ subflow->stale_rcv_tstamp = rcv_tstamp;
subflow->stale_count++;
- mptcp_pm_subflows_chk_stale(msk, ssk);
- } else {
- subflow->stale_count = 0;
- mptcp_subflow_set_active(subflow);
+ } else if (subflow->stale_rcv_tstamp == rcv_tstamp) {
+ if (subflow->stale_count < U8_MAX)
+ subflow->stale_count++;
+ mptcp_pm_subflow_chk_stale(msk, ssk);
+ } else {
+ subflow->stale_count = 0;
+ mptcp_subflow_set_active(subflow);
+ }
}
}
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 8c17857bbbcf..838b18bc19c9 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2291,7 +2291,6 @@ struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk)
/* still data outstanding at TCP level? skip this */
if (!tcp_rtx_and_write_queues_empty(ssk)) {
- mptcp_pm_subflow_chk_stale(msk, ssk);
min_stale_count = min_t(int, min_stale_count, subflow->stale_count);
continue;
}
@@ -2646,9 +2645,10 @@ static void __mptcp_retrans(struct sock *sk)
struct mptcp_data_frag *dfrag;
int err, len;
+ mptcp_pm_chk_stale(msk);
+
mptcp_clean_una_wakeup(sk);
- /* first check ssk: need to kick "stale" logic */
err = mptcp_sched_get_retrans(msk);
dfrag = mptcp_rtx_head(sk);
if (!dfrag) {
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 22804ae2e85a..efddbb1920e6 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -530,12 +530,11 @@ struct mptcp_subflow_context {
send_infinite_map : 1,
remote_key_valid : 1, /* received the peer key from */
disposable : 1, /* ctx can be free at ulp release time */
- stale : 1, /* unable to snd/rcv data, do not use for xmit */
valid_csum_seen : 1, /* at least one csum validated */
is_mptfo : 1, /* subflow is doing TFO */
close_event_done : 1, /* has done the post-closed part */
mpc_drop : 1, /* the MPC option has been dropped in a rtx */
- __unused : 9;
+ __unused : 10;
bool data_avail;
bool scheduled;
bool pm_listener; /* a listener managed by the kernel PM? */
@@ -553,7 +552,11 @@ struct mptcp_subflow_context {
u8 reset_seen:1;
u8 reset_transient:1;
u8 reset_reason:4;
- u8 stale_count;
+ u8 stale_count; /* Protected by the msk socket lock */
+ u8 stale; /* Protected by the msk socket lock,
+ * if set the subflow is unable to snd/rcv
+ * data, the schedule should skip it
+ */
u32 subflow_id;
@@ -1004,7 +1007,7 @@ int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info,
bool mptcp_pm_addr_families_match(const struct sock *sk,
const struct mptcp_addr_info *loc,
const struct mptcp_addr_info *rem);
-void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk);
+void mptcp_pm_chk_stale(const struct mptcp_sock *msk);
void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int server_side);
void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk);
bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk);
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [Devel] [PATCH hci-8.1 v3 03/11] ms/mptcp: move the stale logic out of retrans scheduler
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 03/11] ms/mptcp: move the stale logic out of retrans scheduler Eva Kurchatova
@ 2026-11-16 20:52 ` no-reply
2026-11-17 11:25 ` Konstantin Khorenko
1 sibling, 0 replies; 26+ messages in thread
From: no-reply @ 2026-11-16 20:52 UTC (permalink / raw)
To: Eva Kurchatova, khorenko; +Cc: devel
> From: Paolo Abeni <pabeni@redhat.com>
>
> This allow separating the stale logic invocation and the retrans
> scheduler, and will simplify the next patch.
>
> It's also a cleaner design as the retrans scheduler has currently
> too many side effects. As a possible downside, the retrans work will
> now traverse the subflows list additional times; that does not matter
> much, as this is slowpath.
>
> While at it, pick more accurate names for the involved helpers and
> explicitly note that the per subflow stale data is under msk socket
> lock protection.
>
> The scheduler and the stale logic may observe different subflow
> [ ... ]
> from 9 to 10 instead of from 8 to 9.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-153491
> Feature: fix ms/net
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116204557.718500-1-eva.kurchatova@virtuozzo.com?part=3
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Devel] [PATCH hci-8.1 v3 03/11] ms/mptcp: move the stale logic out of retrans scheduler
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 03/11] ms/mptcp: move the stale logic out of retrans scheduler Eva Kurchatova
2026-11-16 20:52 ` no-reply
@ 2026-11-17 11:25 ` Konstantin Khorenko
1 sibling, 0 replies; 26+ messages in thread
From: Konstantin Khorenko @ 2026-11-17 11:25 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
I won't apply this version, please send v4 with the changes below.
On Mon, 16 Nov 2026 22:05:55 +0200, Eva Kurchatova wrote:
> Rebase note: this tree has no "closing" subflow flag, so __unused grows
> from 9 to 10 instead of from 8 to 9.
Item 1 of the cover letter reply: __unused : 11, and "grows from 10 to
11" here, with close_event_done already gone from the bitfield after
d79fde42c8ab5.
Why: d79fde42c8ab5 already made __unused 10. This patch takes stale out
and leaves __unused as is, so the bitfield adds up to 31 bits instead
of 32 as in the base and in mainline 6cafe51e0f98. Nothing reads
__unused, so it is harmless at runtime, but the note describes a change
the patch does not make.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Devel] [PATCH hci-8.1 v3 04/11] ms/mptcp: let the retrans scheduler do its job
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (2 preceding siblings ...)
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 03/11] ms/mptcp: move the stale logic out of retrans scheduler Eva Kurchatova
@ 2026-11-16 20:05 ` Eva Kurchatova
2026-11-16 20:55 ` no-reply
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 05/11] ms/mptcp: close TOCTOU race while computing rcv_wnd Eva Kurchatova
` (8 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:05 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
Currently the MPTCP core enforces that when MPTCP-level retrans timer
fires, at most a single dfrag is retransmitted. In some corner-cases, it
may be necessary to retransmit multiple dfrags, and the MPTCP socket
will need to wait multiple retrans timeout to accomplish that.
Remove the mentioned constraint, allowing to transmit multiple dfrags
per retrans period, as long as the scheduler keeps selecting subflows
for retransmissions and pending data is available in the rtx queue.
The default scheduler will transmit a dfrag per available subflow.
Tested-by: Gang Yan <yangang@kylinos.cn>
Tested-by: Geliang Tang <geliang@kernel.org>
Acked-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260807-net-next-mptcp-oooq-pruning-v3-3-dbc1eb853cc3@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 96d846e3e2a7ea01ff8a584a0b5e2a42fa9ccc1e)
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/protocol.c | 106 ++++++++++++++++++++++++++++++-------------
1 file changed, 75 insertions(+), 31 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 838b18bc19c9..2dcce47a1ef7 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1000,13 +1000,6 @@ static void __mptcp_clean_una_wakeup(struct sock *sk)
mptcp_write_space(sk);
}
-static void mptcp_clean_una_wakeup(struct sock *sk)
-{
- mptcp_data_lock(sk);
- __mptcp_clean_una_wakeup(sk);
- mptcp_data_unlock(sk);
-}
-
static void mptcp_enter_memory_pressure(struct sock *sk)
{
struct mptcp_subflow_context *subflow;
@@ -2577,8 +2570,12 @@ static void mptcp_check_fastclose(struct mptcp_sock *msk)
sk_error_report(sk);
}
-/* Retransmit the specified data fragment on all the selected subflows. */
-static int __mptcp_push_retrans(struct sock *sk, struct mptcp_data_frag *dfrag)
+/*
+ * Retransmit the specified data fragment on all the selected subflows,
+ * starting from the specified sequence
+ */
+static int __mptcp_push_retrans(struct sock *sk, struct mptcp_data_frag *dfrag,
+ u64 sent_seq)
{
struct mptcp_sendmsg_info info = { .data_lock_held = true, };
struct mptcp_sock *msk = mptcp_sk(sk);
@@ -2588,6 +2585,7 @@ static int __mptcp_push_retrans(struct sock *sk, struct mptcp_data_frag *dfrag)
mptcp_for_each_subflow(msk, subflow) {
if (READ_ONCE(subflow->scheduled)) {
+ u16 offset = sent_seq - dfrag->data_seq;
u16 copied = 0;
mptcp_subflow_set_scheduled(subflow, false);
@@ -2597,7 +2595,7 @@ static int __mptcp_push_retrans(struct sock *sk, struct mptcp_data_frag *dfrag)
lock_sock(ssk);
/* limit retransmission to the bytes already sent on some subflows */
- info.sent = 0;
+ info.sent = offset;
info.limit = READ_ONCE(msk->csum_enabled) ? dfrag->data_len :
dfrag->already_sent;
@@ -2643,45 +2641,91 @@ static void __mptcp_retrans(struct sock *sk)
struct mptcp_sock *msk = mptcp_sk(sk);
struct mptcp_subflow_context *subflow;
struct mptcp_data_frag *dfrag;
+ u64 retrans_seq, sent_seq;
+ bool need_retrans;
int err, len;
mptcp_pm_chk_stale(msk);
- mptcp_clean_una_wakeup(sk);
-
- err = mptcp_sched_get_retrans(msk);
+ /* Get an updated and consistent rtx queue status. */
+ mptcp_data_lock(sk);
+ __mptcp_clean_una_wakeup(sk);
+ retrans_seq = msk->snd_una;
dfrag = mptcp_rtx_head(sk);
- if (!dfrag) {
+ need_retrans = !!dfrag;
+ mptcp_data_unlock(sk);
+
+ for (;;) {
+ bool already_acked;
+
+ err = mptcp_sched_get_retrans(msk);
+ if (err)
+ break;
+
+ /* `already_sent` can be 0 for `dfrag` belonging to the RTX
+ * queue due to __mptcp_retransmit_pending_data().
+ */
+ if (!dfrag || !dfrag->already_sent)
+ break;
+
+ /* Can fail only in case of fallback. */
+ len = __mptcp_push_retrans(sk, dfrag, retrans_seq);
+ if (len < 0)
+ goto clear_scheduled;
+
+ retrans_seq += len;
+ msk->bytes_retrans += len;
+ dfrag->already_sent = max_t(u16, dfrag->already_sent,
+ retrans_seq - dfrag->data_seq);
+
+ /* With csum enabled, retransmission can send new data. */
+ sent_seq = dfrag->already_sent + dfrag->data_seq;
+ if (after64(sent_seq, msk->snd_nxt))
+ WRITE_ONCE(msk->snd_nxt, sent_seq);
+
+ /* Attempt the next fragment only if the current one is
+ * completely retransmitted.
+ */
+ if (before64(retrans_seq, dfrag->data_seq + dfrag->data_len))
+ break;
+
+ dfrag = list_is_last(&dfrag->list, &msk->rtx_queue) ?
+ NULL : list_next_entry(dfrag, list);
+ if (!dfrag)
+ break;
+
+ /* Incoming acks can move snd_una after the current dfrag
+ * across loop iterations, if so start again from RTX head.
+ */
+ mptcp_data_lock(sk);
+ already_acked = !before64(msk->snd_una, dfrag->data_seq +
+ dfrag->already_sent);
+ if (already_acked) {
+ __mptcp_clean_una_wakeup(sk);
+ retrans_seq = msk->snd_una;
+ dfrag = mptcp_rtx_head(sk);
+ need_retrans = !!dfrag;
+ } else if (after64(msk->snd_una, retrans_seq)) {
+ retrans_seq = msk->snd_una;
+ }
+ mptcp_data_unlock(sk);
+ }
+
+ /* Attempt data-fin retransmission only when the RTX queue is empty. */
+ if (!need_retrans) {
if (mptcp_data_fin_enabled(msk)) {
struct inet_connection_sock *icsk = inet_csk(sk);
icsk->icsk_retransmits++;
mptcp_set_datafin_timeout(sk);
mptcp_send_ack(msk);
-
goto reset_timer;
}
if (!mptcp_send_head(sk))
goto clear_scheduled;
-
- goto reset_timer;
}
- if (err)
- goto reset_timer;
-
- len = __mptcp_push_retrans(sk, dfrag);
- if (len < 0)
- goto clear_scheduled;
-
- msk->bytes_retrans += len;
- dfrag->already_sent = max(dfrag->already_sent, len);
-
- /* With csum enabled retransmission can send new data. */
- if (after64(dfrag->already_sent + dfrag->data_seq, msk->snd_nxt))
- WRITE_ONCE(msk->snd_nxt, dfrag->already_sent + dfrag->data_seq);
-
reset_timer:
mptcp_check_and_set_pending(sk);
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* [Devel] [PATCH hci-8.1 v3 05/11] ms/mptcp: close TOCTOU race while computing rcv_wnd
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (3 preceding siblings ...)
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 04/11] ms/mptcp: let the retrans scheduler do its job Eva Kurchatova
@ 2026-11-16 20:05 ` Eva Kurchatova
2026-11-16 20:53 ` no-reply
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 06/11] ms/mptcp: allow subflow rcv wnd to shrink Eva Kurchatova
` (7 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:05 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
The MPTCP output path access locklessly the MPTCP-level ack_seq
in multiple times, using possibly different values for the data_ack
in the DSS option and to compute the announced rcv wnd for the same
packet.
Refactor the cote to avoid inconsistencies which may confuse the
peer. Also ensure that the MPTCP level rcv wnd is updated only when
the egress packet actually contains a DSS ack.
Fixes: fa3fe2b15031 ("mptcp: track window announced to peer")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260602-net-mptcp-misc-fixes-7-1-rc7-v2-3-856831229976@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 8ab24fdebc369c0dfb90f82c1650b1e66662bb45)
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/options.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index bdc2b71a89e7..51978cf24f23 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -577,7 +577,6 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
struct mptcp_ext *mpext;
unsigned int ack_size;
bool ret = false;
- u64 ack_seq;
opts->csum_reqd = READ_ONCE(msk->csum_enabled);
mpext = skb ? mptcp_get_ext(skb) : NULL;
@@ -608,14 +607,11 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
return ret;
}
- ack_seq = READ_ONCE(msk->ack_seq);
if (READ_ONCE(msk->use_64bit_ack)) {
ack_size = TCPOLEN_MPTCP_DSS_ACK64;
- opts->ext_copy.data_ack = ack_seq;
opts->ext_copy.ack64 = 1;
} else {
ack_size = TCPOLEN_MPTCP_DSS_ACK32;
- opts->ext_copy.data_ack32 = (uint32_t)ack_seq;
opts->ext_copy.ack64 = 0;
}
opts->ext_copy.use_ack = 1;
@@ -1302,19 +1298,14 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
return true;
}
-static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th)
+static u64 mptcp_set_rwin(struct mptcp_sock *msk, struct tcp_sock *tp,
+ struct tcphdr *th, u64 ack_seq)
{
const struct sock *ssk = (const struct sock *)tp;
- struct mptcp_subflow_context *subflow;
- u64 ack_seq, rcv_wnd_old, rcv_wnd_new;
- struct mptcp_sock *msk;
+ u64 rcv_wnd_old, rcv_wnd_new;
u32 new_win;
u64 win;
- subflow = mptcp_subflow_ctx(ssk);
- msk = mptcp_sk(subflow->conn);
-
- ack_seq = READ_ONCE(msk->ack_seq);
rcv_wnd_new = ack_seq + tp->rcv_wnd;
rcv_wnd_old = atomic64_read(&msk->rcv_wnd_sent);
@@ -1366,7 +1357,7 @@ static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th)
update_wspace:
WRITE_ONCE(msk->old_wspace, tp->rcv_wnd);
- subflow->rcv_wnd_sent = rcv_wnd_new;
+ return rcv_wnd_new;
}
static void mptcp_track_rwin(struct tcp_sock *tp)
@@ -1478,13 +1469,25 @@ void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp,
*ptr++ = mptcp_option(MPTCPOPT_DSS, len, 0, flags);
if (mpext->use_ack) {
+ struct mptcp_sock *msk;
+ u64 ack_seq;
+
+ /* DSS option is set only by mptcp_established_options,
+ * the caller is __tcp_transmit_skb() and ssk is always
+ * not NULL.
+ */
+ subflow = mptcp_subflow_ctx(ssk);
+ msk = mptcp_sk(subflow->conn);
+ ack_seq = READ_ONCE(msk->ack_seq);
if (mpext->ack64) {
- put_unaligned_be64(mpext->data_ack, ptr);
+ put_unaligned_be64(ack_seq, ptr);
ptr += 2;
} else {
- put_unaligned_be32(mpext->data_ack32, ptr);
+ put_unaligned_be32(ack_seq, ptr);
ptr += 1;
}
+ subflow->rcv_wnd_sent = mptcp_set_rwin(msk, tp, th,
+ ack_seq);
}
if (mpext->use_map) {
@@ -1712,9 +1715,6 @@ void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp,
i += 4;
}
}
-
- if (tp)
- mptcp_set_rwin(tp, th);
}
__be32 mptcp_get_reset_option(const struct sk_buff *skb)
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* [Devel] [PATCH hci-8.1 v3 06/11] ms/mptcp: allow subflow rcv wnd to shrink
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (4 preceding siblings ...)
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 05/11] ms/mptcp: close TOCTOU race while computing rcv_wnd Eva Kurchatova
@ 2026-11-16 20:05 ` Eva Kurchatova
2026-11-16 20:56 ` no-reply
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 07/11] ms/mptcp: cleanup fallback dummy mapping generation Eva Kurchatova
` (6 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:05 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
In MPTCP connection, the `window` field in the TCP header refers to the
MPTCP-level rcv_nxt and it's right edge should not move backward. Such
constraint is enforced at DSS option generation time.
At the same time, the TCP stack ensures independently that the TCP-level
rcv wnd right's edge does not move backward. That in turn causes artificial
inflating of the MPTCP rcv window when the incoming data is acked at the
TCP level and is OoO in the MPTCP sequence space (or lands in the backlog).
As a consequence, the incoming traffic can exceed the receiver rcvbuf size
even when the sender is not misbehaving.
Prevent such scenario forcibly allowing the TCP subflow to shrink the
TCP-level rcv wnd regardless of the current netns setting.
Fixes: f3589be0c420 ("mptcp: never shrink offered window")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260602-net-mptcp-misc-fixes-7-1-rc7-v2-4-856831229976@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit da23be77e1292cd611e736c3aa17da633d7ddce7)
Rebase note: mainline 0e24d17bd966 ("tcp: implement RFC 7323 window
retraction receiver requirements"), which this commit sits on in
mainline, is not taken, as in 6.12.y. So tcp_sequence() checks the
shrunk window here, and a segment the peer sent before the shrink and
past the new edge is dropped and retransmitted by TCP.
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/options.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 51978cf24f23..51cb4ed3f7ce 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -573,6 +573,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
{
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct mptcp_sock *msk = mptcp_sk(subflow->conn);
+ struct tcp_sock *tp = tcp_sk(sk);
unsigned int dss_size = 0;
struct mptcp_ext *mpext;
unsigned int ack_size;
@@ -621,6 +622,12 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
if (dss_size == 0)
ack_size += TCPOLEN_MPTCP_DSS_BASE;
+ /* The caller is __tcp_transmit_skb(), and will compute the new rcv
+ * wnd soon: ensure that the window can shrink.
+ */
+ if (skb)
+ tp->rcv_wnd = tp->rcv_nxt - tp->rcv_wup;
+
dss_size += ack_size;
*size = ALIGN(dss_size, 4);
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [Devel] [PATCH hci-8.1 v3 06/11] ms/mptcp: allow subflow rcv wnd to shrink
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 06/11] ms/mptcp: allow subflow rcv wnd to shrink Eva Kurchatova
@ 2026-11-16 20:56 ` no-reply
0 siblings, 0 replies; 26+ messages in thread
From: no-reply @ 2026-11-16 20:56 UTC (permalink / raw)
To: Eva Kurchatova, khorenko; +Cc: devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mptcp: option builder clobbers tp->rcv_wnd, skewing zero-window
MIBs
--
commit 8f686f3528d02f3f50498a1afeae84f4871b89e3
Author: Paolo Abeni <pabeni@redhat.com>
ms/mptcp: allow subflow rcv wnd to shrink
This forces the TCP-level receive window of an MPTCP subflow to shrink, so the right edge advertised on the wire does not run ahead of the MPTCP-level window. It does this by resetting tp->rcv_wnd from the DSS option builder, before the TCP window is computed.
Link: https://patch.msgid.link/20260602-net-mptcp-misc-fixes-7-1-rc7-v2-4-856831229976@kernel.org
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index 51978cf24f23..51cb4ed3f7ce 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
[ ... ]
> @@ -621,6 +622,12 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
> if (dss_size == 0)
> ack_size += TCPOLEN_MPTCP_DSS_BASE;
>
> + /* The caller is __tcp_transmit_skb(), and will compute the new rcv
> + * wnd soon: ensure that the window can shrink.
> + */
> + if (skb)
> + tp->rcv_wnd = tp->rcv_nxt - tp->rcv_wup;
> +
> dss_size += ack_size;
>
> *size = ALIGN(dss_size, 4);
[Severity: Low]
Can this assignment skew the zero-window SNMP counters?
mptcp_established_options_dss() runs from tcp_established_options() in __tcp_transmit_skb(), before tcp_select_window(). tcp_select_window() starts with "u32 old_win = tp->rcv_wnd;", so old_win now holds the data received since the last window update rather than the previously advertised window.
old_win drives LINUX_MIB_TCPTOZEROWINDOWADV (if (old_win)) and LINUX_MIB_TCPFROMZEROWINDOWADV (else if (old_win == 0)). When rcv_nxt == rcv_wup, TCPFROMZEROWINDOWADV is bumped even though the advertised window is non-zero. A real transition to a zero window can be missed by TCPTOZEROWINDOWADV.
The !rcv_wscale path in __tcp_select_window() also reads tp->rcv_wnd and sees the modified value. The coupling is only safe because __tcp_transmit_skb() is the sole caller that passes a non-NULL skb, and the commit message does not mention it. Would it be cleaner to have the TCP core apply the shrink, or to preserve and restore the old value around tcp_select_window()?
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116204557.718500-1-eva.kurchatova@virtuozzo.com?part=6
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Devel] [PATCH hci-8.1 v3 07/11] ms/mptcp: cleanup fallback dummy mapping generation
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (5 preceding siblings ...)
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 06/11] ms/mptcp: allow subflow rcv wnd to shrink Eva Kurchatova
@ 2026-11-16 20:05 ` Eva Kurchatova
2026-11-16 20:58 ` no-reply
2026-11-16 20:06 ` [Devel] [PATCH hci-8.1 v3 08/11] ms/mptcp: explicitly drop over memory limits Eva Kurchatova
` (5 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:05 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
MPTCP currently access ack_seq outside the msk socket log scope to
generate the dummy mapping for fallback socket. Soon we are going
to introduce backlog usage and even for fallback socket the ack_seq
value will be significantly off outside of the msk socket lock scope.
Avoid relying on ack_seq for dummy mapping generation, using instead
the subflow sequence number. Note that in case of disconnect() and
(re)connect() we must ensure that any previous state is re-set.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Geliang Tang <geliang@kernel.org>
Tested-by: Geliang Tang <geliang@kernel.org>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20251121-net-next-mptcp-memcg-backlog-imp-v1-6-1f34b6c1e0b1@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 2834f8edd74d5dda368087a654c0e52b141e9893)
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/protocol.c | 3 +++
net/mptcp/subflow.c | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 2dcce47a1ef7..e0048bfda370 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3299,6 +3299,9 @@ static int mptcp_disconnect(struct sock *sk, int flags)
msk->rcvspace_init = 0;
msk->fastclosing = 0;
+ /* for fallback's sake */
+ WRITE_ONCE(msk->ack_seq, 0);
+
WRITE_ONCE(sk->sk_shutdown, 0);
sk_error_report(sk);
return 0;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 040a7f1bdcf0..eeb4c926a66b 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -490,6 +490,9 @@ static void subflow_set_remote_key(struct mptcp_sock *msk,
mptcp_crypto_key_sha(subflow->remote_key, NULL, &subflow->iasn);
subflow->iasn++;
+ /* for fallback's sake */
+ subflow->map_seq = subflow->iasn;
+
WRITE_ONCE(msk->remote_key, subflow->remote_key);
WRITE_ONCE(msk->ack_seq, subflow->iasn);
WRITE_ONCE(msk->can_ack, true);
@@ -1432,9 +1435,12 @@ static bool subflow_check_data_avail(struct sock *ssk)
skb = skb_peek(&ssk->sk_receive_queue);
subflow->map_valid = 1;
- subflow->map_seq = READ_ONCE(msk->ack_seq);
subflow->map_data_len = skb->len;
subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset;
+ subflow->map_seq = __mptcp_expand_seq(subflow->map_seq,
+ subflow->iasn +
+ TCP_SKB_CB(skb)->seq -
+ subflow->ssn_offset - 1);
WRITE_ONCE(subflow->data_avail, true);
return true;
}
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* [Devel] [PATCH hci-8.1 v3 08/11] ms/mptcp: explicitly drop over memory limits
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (6 preceding siblings ...)
2026-11-16 20:05 ` [Devel] [PATCH hci-8.1 v3 07/11] ms/mptcp: cleanup fallback dummy mapping generation Eva Kurchatova
@ 2026-11-16 20:06 ` Eva Kurchatova
2026-11-16 20:58 ` no-reply
2026-11-16 20:06 ` [Devel] [PATCH hci-8.1 v3 09/11] ms/mptcp: implemented OoO queue pruning Eva Kurchatova
` (4 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:06 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
Currently the enforcement of the rcvbuf constraint is implemented
when moving the skbs into the msk receive or OoO queue, keeping the
incoming skbs in the subflow queue when over limits.
Under significant memory pressure the above can cause permanent data
transfer stalls, as the skb needed to make forward progress can be
stuck in a subflow queue.
Over memory limits, drop the incoming skb, relying on MPTCP-level
retransmissions.
Note that fallback socket must perform the limit before the skb reaches
the subflow-level queue, as dropping an in-sequence already acked skb
would break the stream.
This is not a complete fix for the stall issue, as the drop strategy
needs refinements that will come in the next patches.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260807-net-next-mptcp-oooq-pruning-v3-4-dbc1eb853cc3@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit e0e4d56b050597a690b4dd1c281af532469b0636)
Rebase note: this tree has no MPTCP-level backlog, its receive path
moves the skbs from the subflow queue straight to the msk. The drop goes
into __mptcp_move_skb(), and the loops that move the skbs stop over the
limits only for a fallback socket, which keeps them in the subflow queue
as before. The options.c check that drops them for a fallback socket
before that queue, and the BacklogDrop counter, are left out; RcvPruned
is already there.
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/protocol.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index e0048bfda370..4cf70cca0158 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -286,6 +286,15 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
skb_ext_reset(skb);
skb_orphan(skb);
+ /* Can't drop packets for fallback socket this late, or the stream
+ * will break.
+ */
+ if (unlikely(sk_rmem_alloc_get(sk) > READ_ONCE(sk->sk_rcvbuf)) &&
+ !__mptcp_check_fallback(msk)) {
+ MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
+ goto drop;
+ }
+
/* try to fetch required memory from subflow */
if (!sk_rmem_schedule(sk, skb, skb->truesize)) {
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
@@ -599,7 +608,8 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
struct sk_buff *skb;
bool fin;
- if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf)
+ if (__mptcp_check_fallback(msk) &&
+ sk_rmem_alloc_get(sk) > sk->sk_rcvbuf)
break;
/* try to move as much data as available */
@@ -2078,11 +2088,11 @@ static bool __mptcp_move_skbs(struct sock *sk)
struct sock *ssk;
bool slowpath;
- /*
- * As an optimization avoid traversing the subflows list
- * and ev. acquiring the subflow socket lock before baling out
+ /* Over the limits a fallback socket leaves the data in the
+ * subflows, don't loop on them
*/
- if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf)
+ if (__mptcp_check_fallback(msk) &&
+ sk_rmem_alloc_get(sk) > sk->sk_rcvbuf)
break;
subflow = __mptcp_first_ready_from(msk, subflow);
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [Devel] [PATCH hci-8.1 v3 08/11] ms/mptcp: explicitly drop over memory limits
2026-11-16 20:06 ` [Devel] [PATCH hci-8.1 v3 08/11] ms/mptcp: explicitly drop over memory limits Eva Kurchatova
@ 2026-11-16 20:58 ` no-reply
0 siblings, 0 replies; 26+ messages in thread
From: no-reply @ 2026-11-16 20:58 UTC (permalink / raw)
To: Eva Kurchatova, khorenko; +Cc: devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] commit message: Signed-off-by name has organisation tag
'(NGI0)'
--
commit df84538a8d8ad307de4869b8e2892420245975fb
Author: Paolo Abeni <pabeni@redhat.com>
ms/mptcp: explicitly drop over memory limits
This commit makes __mptcp_move_skb() drop an incoming skb when the msk is over its receive memory limit, instead of leaving it in the subflow queue. The loops that move skbs from the subflows now stop over the limit only for a fallback socket.
> ms/mptcp: explicitly drop over memory limits
>
> Currently the enforcement of the rcvbuf constraint is implemented
> when moving the skbs into the msk receive or OoO queue, keeping the
> incoming skbs in the subflow queue when over limits.
>
> Under significant memory pressure the above can cause permanent data
> transfer stalls, as the skb needed to make forward progress can be
> stuck in a subflow queue.
>
> Over memory limits, drop the incoming skb, relying on MPTCP-level
> retransmissions.
>
> Note that fallback socket must perform the limit before the skb reaches
> the subflow-level queue, as dropping an in-sequence already acked skb
> would break the stream.
>
> This is not a complete fix for the stall issue, as the drop strategy
> needs refinements that will come in the next patches.
>
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> Link: https://patch.msgid.link/20260807-net-next-mptcp-oooq-pruning-v3-4-dbc1eb853cc3@kernel.org
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> (cherry picked from commit e0e4d56b050597a690b4dd1c281af532469b0636)
>
> Rebase note: this tree has no MPTCP-level backlog, its receive path
> moves the skbs from the subflow queue straight to the msk. The drop goes
> into __mptcp_move_skb(), and the loops that move the skbs stop over the
> limits only for a fallback socket, which keeps them in the subflow queue
> as before. The options.c check that drops them for a fallback socket
> before that queue, and the BacklogDrop counter, are left out; RcvPruned
> is already there.
>
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
[Severity: High]
Is the name in the trailer "Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>" what is meant to appear in the chain? The parenthesised organisation tag "(NGI0)" is not part of a plain real name. Should the Signed-off-by (and the matching Reviewed-by) use just the name, "Matthieu Baerts <matttbe@kernel.org>"?
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116204557.718500-1-eva.kurchatova@virtuozzo.com?part=8
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* [Devel] [PATCH hci-8.1 v3 09/11] ms/mptcp: implemented OoO queue pruning
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (7 preceding siblings ...)
2026-11-16 20:06 ` [Devel] [PATCH hci-8.1 v3 08/11] ms/mptcp: explicitly drop over memory limits Eva Kurchatova
@ 2026-11-16 20:06 ` Eva Kurchatova
2026-11-16 21:00 ` no-reply
2026-11-16 20:06 ` [Devel] [PATCH hci-8.1 v3 10/11] ms/mptcp: being below memory limit is a likely() condition Eva Kurchatova
` (3 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:06 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
When moving incoming skbs in the msk receive queue and the latter
is above limits, prune it as needed quite alike what TCP is doing
at the subflow level. The main difference relies in the stop condition:
since MPTCP does not perform collapsing, it's better off dropping the
bare minimum to fit the (newer) incoming packet.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Tested-by: Gang Yan <yangang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260807-net-next-mptcp-oooq-pruning-v3-7-dbc1eb853cc3@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit e468d371180d3c5b3333660bd742103b88703adf)
Rebase note: in the older receive path of this tree the check goes
into __mptcp_move_skb() and mptcp_data_queue_ofo(), after the map_seq
of the skb is set, and replaces the drop of the previous patch, as in
mainline. The two commits of the series between them are not needed:
b1224c4b40f6 ("mptcp: enforce hard limit on backlog flushing") is about
the backlog this tree lacks, and 996643574cc8 ("mptcp: avoid code
duplication in __mptcp_move_skb()") is a cleanup. OFOPruned is added
after the last counter of this tree.
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/mib.c | 1 +
net/mptcp/mib.h | 1 +
net/mptcp/protocol.c | 79 +++++++++++++++++++++++++++++++++++++++-----
3 files changed, 72 insertions(+), 9 deletions(-)
diff --git a/net/mptcp/mib.c b/net/mptcp/mib.c
index 19eb9292bd60..fbe27ddea8e1 100644
--- a/net/mptcp/mib.c
+++ b/net/mptcp/mib.c
@@ -79,6 +79,7 @@ static const struct snmp_mib mptcp_snmp_list[] = {
SNMP_MIB_ITEM("RcvWndConflict", MPTCP_MIB_RCVWNDCONFLICT),
SNMP_MIB_ITEM("MPCurrEstab", MPTCP_MIB_CURRESTAB),
SNMP_MIB_ITEM("Blackhole", MPTCP_MIB_BLACKHOLE),
+ SNMP_MIB_ITEM("OFOPruned", MPTCP_MIB_OFOPRUNED),
SNMP_MIB_SENTINEL
};
diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h
index 128282982843..f2b9934a6ecb 100644
--- a/net/mptcp/mib.h
+++ b/net/mptcp/mib.h
@@ -80,6 +80,7 @@ enum linux_mptcp_mib_field {
MPTCP_MIB_RCVWNDCONFLICT, /* Conflict with while updating msk rcv wnd */
MPTCP_MIB_CURRESTAB, /* Current established MPTCP connections */
MPTCP_MIB_BLACKHOLE, /* A blackhole has been detected */
+ MPTCP_MIB_OFOPRUNED, /* MPTCP-level OoO queue pruned */
__MPTCP_MIB_MAX
};
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 4cf70cca0158..4fe666ed9d27 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -157,6 +157,65 @@ static bool mptcp_ooo_try_coalesce(struct mptcp_sock *msk, struct sk_buff *to,
return mptcp_try_coalesce((struct sock *)msk, to, from);
}
+/* "Inspired" from the TCP version; main difference: stop as soon as the MPTCP
+ * socket is under memory limit.
+ */
+static void mptcp_prune_ofo_queue(struct sock *sk,
+ const struct sk_buff *in_skb)
+{
+ struct mptcp_sock *msk = mptcp_sk(sk);
+ struct rb_node *node, *prev;
+ bool pruned = false;
+ u64 mem;
+
+ if (RB_EMPTY_ROOT(&msk->out_of_order_queue))
+ return;
+
+ node = &msk->ooo_last_skb->rbnode;
+
+ do {
+ struct sk_buff *skb = rb_to_skb(node);
+
+ /* Stop pruning if the incoming skb would land in OoO tail. */
+ if (after64(MPTCP_SKB_CB(in_skb)->map_seq,
+ MPTCP_SKB_CB(skb)->map_seq))
+ break;
+
+ pruned = true;
+ prev = rb_prev(node);
+ rb_erase(node, &msk->out_of_order_queue);
+ mptcp_drop(sk, skb);
+ msk->ooo_last_skb = rb_to_skb(prev);
+
+ mem = (unsigned int)sk_rmem_alloc_get(sk);
+ if (mem <= sk->sk_rcvbuf)
+ break;
+
+ node = prev;
+ } while (node);
+
+ if (pruned)
+ MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOPRUNED);
+}
+
+/* The stack can't drop packets for fallback socket at the msk level, or the
+ * stream will break.
+ */
+static bool mptcp_can_ingest(const struct sock *sk)
+{
+ return unlikely(sk_rmem_alloc_get(sk) <= READ_ONCE(sk->sk_rcvbuf)) ||
+ __mptcp_check_fallback(mptcp_sk(sk));
+}
+
+static bool mptcp_try_rmem_schedule(struct sock *sk, const struct sk_buff *skb)
+{
+ if (!mptcp_can_ingest(sk)) {
+ mptcp_prune_ofo_queue(sk, skb);
+ return mptcp_can_ingest(sk);
+ }
+ return true;
+}
+
/* "inspired" by tcp_data_queue_ofo(), main differences:
* - use mptcp seqs
* - don't cope with sacks
@@ -168,6 +227,12 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb)
u64 seq, end_seq, max_seq;
struct sk_buff *skb1;
+ if (!mptcp_try_rmem_schedule(sk, skb)) {
+ MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
+ mptcp_drop(sk, skb);
+ return;
+ }
+
seq = MPTCP_SKB_CB(skb)->map_seq;
end_seq = MPTCP_SKB_CB(skb)->end_seq;
max_seq = atomic64_read(&msk->rcv_wnd_sent);
@@ -286,15 +351,6 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
skb_ext_reset(skb);
skb_orphan(skb);
- /* Can't drop packets for fallback socket this late, or the stream
- * will break.
- */
- if (unlikely(sk_rmem_alloc_get(sk) > READ_ONCE(sk->sk_rcvbuf)) &&
- !__mptcp_check_fallback(msk)) {
- MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
- goto drop;
- }
-
/* try to fetch required memory from subflow */
if (!sk_rmem_schedule(sk, skb, skb->truesize)) {
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
@@ -315,6 +371,11 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
if (MPTCP_SKB_CB(skb)->map_seq == msk->ack_seq) {
/* in sequence */
+ if (!mptcp_try_rmem_schedule(sk, skb)) {
+ MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
+ goto drop;
+ }
+
msk->bytes_received += copy_len;
WRITE_ONCE(msk->ack_seq, msk->ack_seq + copy_len);
tail = skb_peek_tail(&sk->sk_receive_queue);
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* [Devel] [PATCH hci-8.1 v3 10/11] ms/mptcp: being below memory limit is a likely() condition
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (8 preceding siblings ...)
2026-11-16 20:06 ` [Devel] [PATCH hci-8.1 v3 09/11] ms/mptcp: implemented OoO queue pruning Eva Kurchatova
@ 2026-11-16 20:06 ` Eva Kurchatova
2026-11-16 20:59 ` no-reply
2026-11-16 20:06 ` [Devel] [PATCH hci-8.1 v3 11/11] ms/mptcp: avoid pruning for OoW data Eva Kurchatova
` (2 subsequent siblings)
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:06 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
The current compiler hint annotation is wrong, due to inverted
logic in the previous revision of the relevant code.
Fixes: e468d371180d ("mptcp: implemented OoO queue pruning")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260908-net-mptcp-misc-fixes-7-3-rc1-v2-14-df1de70348b6@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit a4257a91af7a77a8347d33413ec9e54106f7ff48)
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/protocol.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 4fe666ed9d27..caa560d0d460 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -203,8 +203,8 @@ static void mptcp_prune_ofo_queue(struct sock *sk,
*/
static bool mptcp_can_ingest(const struct sock *sk)
{
- return unlikely(sk_rmem_alloc_get(sk) <= READ_ONCE(sk->sk_rcvbuf)) ||
- __mptcp_check_fallback(mptcp_sk(sk));
+ return likely(sk_rmem_alloc_get(sk) <= READ_ONCE(sk->sk_rcvbuf)) ||
+ __mptcp_check_fallback(mptcp_sk(sk));
}
static bool mptcp_try_rmem_schedule(struct sock *sk, const struct sk_buff *skb)
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* [Devel] [PATCH hci-8.1 v3 11/11] ms/mptcp: avoid pruning for OoW data
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (9 preceding siblings ...)
2026-11-16 20:06 ` [Devel] [PATCH hci-8.1 v3 10/11] ms/mptcp: being below memory limit is a likely() condition Eva Kurchatova
@ 2026-11-16 20:06 ` Eva Kurchatova
2026-11-16 21:00 ` no-reply
2026-11-16 20:58 ` [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova (Virtuozzo)
2026-11-17 11:25 ` Konstantin Khorenko
12 siblings, 1 reply; 26+ messages in thread
From: Eva Kurchatova @ 2026-11-16 20:06 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Paolo Abeni <pabeni@redhat.com>
Pruning is expansive and destructive, do it only when we expect
to accept the skb triggering the cleanup.
Fixes: e468d371180d ("mptcp: implemented OoO queue pruning")
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260908-net-mptcp-misc-fixes-7-3-rc1-v2-15-df1de70348b6@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit f01b8275745efe611284f6c3628099a81a421f0d)
https://virtuozzo.atlassian.net/browse/VSTOR-153491
Feature: fix ms/net
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
net/mptcp/protocol.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index caa560d0d460..07bfb443450e 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -227,12 +227,6 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb)
u64 seq, end_seq, max_seq;
struct sk_buff *skb1;
- if (!mptcp_try_rmem_schedule(sk, skb)) {
- MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
- mptcp_drop(sk, skb);
- return;
- }
-
seq = MPTCP_SKB_CB(skb)->map_seq;
end_seq = MPTCP_SKB_CB(skb)->end_seq;
max_seq = atomic64_read(&msk->rcv_wnd_sent);
@@ -249,6 +243,12 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb)
return;
}
+ if (!mptcp_try_rmem_schedule(sk, skb)) {
+ MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
+ mptcp_drop(sk, skb);
+ return;
+ }
+
p = &msk->out_of_order_queue.rb_node;
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUE);
if (RB_EMPTY_ROOT(&msk->out_of_order_queue)) {
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (10 preceding siblings ...)
2026-11-16 20:06 ` [Devel] [PATCH hci-8.1 v3 11/11] ms/mptcp: avoid pruning for OoW data Eva Kurchatova
@ 2026-11-16 20:58 ` Eva Kurchatova (Virtuozzo)
2026-11-17 11:25 ` Konstantin Khorenko
12 siblings, 0 replies; 26+ messages in thread
From: Eva Kurchatova (Virtuozzo) @ 2026-11-16 20:58 UTC (permalink / raw)
To: khorenko; +Cc: devel
On 11/16/26 22:05, Eva Kurchatova wrote:
> Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-153491
>
> mptcp_join.sh test 021 never completes in CI: a link fails during a
> bidirectional transfer and the transfer stalls. The series backports
> mainline fixes for the two problems behind it:
>
> - Endless retransmission with csum enabled: A retransmission can send
> data beyond snd_nxt, the acks for that data are dropped, and the same
> data is retransmitted again and again. Patch 1/11 fixes it.
> - Receive stalls under memory pressure: Incoming data over the receive
> buffer limit waits in the subflow queue, and may get stuck, blocking
> further progress. Patch 8 drops it instead and patch 9 prunes the
> out-of-order queue, both relying on MPTCP-level retransmission.
> - Patches 10/11 and 11/11 are mainline fixes for patch 9/11.
>
> The other patches are prerequisites:
> - Patches 2/11 and 3/11 are cleanups the later patches are based on.
> - Patch 4/11 lets one MPTCP retransmit timeout resend more than one data
> fragment, so the data dropped by 8/11 and 9/11 retransmits sooner.
> - Patches 5/11 and 6/11 keep the window announced to the peer within
> receive buffer, so that a peer that behaves correctly does not send
> data that patch 8/11 would even drop.
> - Patch 7/11 builds the dummy mapping of a fallback socket from the TCP
> sequence number instead of msk->ack_seq. Without it, data dropped by
> patch 8/11 and then a fallback to TCP would give the following bytes
> the DSN of the dropped ones, and the reader would get a stream with
> bytes missing.
>
> Left out of the mainline series, between patches 8/11 and 9/11:
> b1224c4b40f6 ("mptcp: enforce hard limit on backlog flushing"), as this
> tree has no backlog, and 996643574cc8 ("mptcp: avoid code duplication
> in __mptcp_move_skb()"), a cleanup. Mainline 0e24d17bd966 ("tcp:
> implement RFC 7323 window retraction receiver requirements"), which
> patch 6/11 sits on in mainline, is not taken either, and 6/11 rebases
> the same way it does in upstream stable 6.12.y branch.
>
> Tested in QEMU (4 vCPUs): test 021 with a failing link have not failed,
> against 3 failures on unpatched kernel, and the net/mptcp selftest suite
> passes with no warnings. The v1 also did fix the failures described here
> but was arguably a less coherent series of patches.
>
> Changes in v3:
> - Add "ms/mptcp: cleanup fallback dummy mapping generation" before
> "ms/mptcp: explicitly drop over memory limits".
> - 6/11: A rebase note on the commit, based on 6.12.y tree observations.
> - Expand cover letter.
> - Rebase.
>
> Link to v2: http://lore.virtuozzo.com/kernel/179484894400.861498.16940306217017869314.b4-review@b4/T/#t
>
> Changes in v2:
> - Add "ms/mptcp: close TOCTOU race while computing rcv_wnd" and
> "ms/mptcp: allow subflow rcv wnd to shrink before the drop over memory
> limits".
> - 3/10: reword the rebase note.
> - 8/10: name the two skipped mainline commits in the rebase note.
> - Rebase.
>
> Link to v1: http://lore.virtuozzo.com/kernel/179450441149.4060562.12778470791653323060.b4-review@b4/T/#t
>
> Paolo Abeni (11):
> ms/mptcp: fix retransmission loop when csum is enabled
> ms/mptcp: move the retrans loop to a separate helper
> ms/mptcp: move the stale logic out of retrans scheduler
> ms/mptcp: let the retrans scheduler do its job
> ms/mptcp: close TOCTOU race while computing rcv_wnd
> ms/mptcp: allow subflow rcv wnd to shrink
> ms/mptcp: cleanup fallback dummy mapping generation
> ms/mptcp: explicitly drop over memory limits
> ms/mptcp: implemented OoO queue pruning
> ms/mptcp: being below memory limit is a likely() condition
> ms/mptcp: avoid pruning for OoW data
>
> net/mptcp/mib.c | 1 +
> net/mptcp/mib.h | 1 +
> net/mptcp/options.c | 43 ++++----
> net/mptcp/pm.c | 43 +++++---
> net/mptcp/protocol.c | 226 ++++++++++++++++++++++++++++++++++---------
> net/mptcp/protocol.h | 11 ++-
> net/mptcp/subflow.c | 8 +-
> 7 files changed, 249 insertions(+), 84 deletions(-)
Slight corrections to the cover letter:
- The series is based on rh10-6.12.0-211.75.1.24.2.vz10, which was not
mentioned but you asked for it.
- The v2 changelog entry should read: Add "ms/mptcp: close TOCTOU race
while computing rcv_wnd" and "ms/mptcp: allow subflow rcv wnd to shrink"
before the drop over memory limits; It was instead copied from the
original v2 as usual.
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread* Re: [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes
2026-11-16 20:05 [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova
` (11 preceding siblings ...)
2026-11-16 20:58 ` [Devel] [PATCH hci-8.1 v3 00/11] ms/mptcp: stability fixes Eva Kurchatova (Virtuozzo)
@ 2026-11-17 11:25 ` Konstantin Khorenko
12 siblings, 0 replies; 26+ messages in thread
From: Konstantin Khorenko @ 2026-11-17 11:25 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
I won't apply this version, please send v4 with the changes below.
On Mon, 16 Nov 2026 22:05:52 +0200, Eva Kurchatova wrote:
> - Expand cover letter.
> - Rebase.
The v2 asks are done: 7/11 is 2834f8edd74d5 and sits before the drop,
the 6/11 note is accurate, and the cover letter now says what the
series fixes and how it was tested. What is left:
1. Patch 3: the rebase over d79fde42c8ab5 ("ms/mptcp: fix subflow
bitfield misuse") lost the __unused change. stale leaves the
bitfield but __unused stays 10, so the word adds up to 31 bits. Make
it __unused : 11 and fix the rebase note: close_event_done already
left the bitfield in d79fde42c8ab5, so __unused grows from 10 to
11.
2. Cover letter: name the base. v3 needs d79fde42c8ab5, which is in
the hci-8.2 branch (rh10-6.12.0-211.75.1.26.x) and not in
rh10-6.12.0-211.75.1.24.2.vz10 that your follow-up names; 3/11 does
not apply there.
3. "[PATCH hci-8.1 0/4] ms/mptcp: backport cc-stable fixes" touches
mptcp_disconnect() next to 7/11. This series goes first, as in
mainline and 6.12.y; I will ask for that series to be rebased on
top of this one.
Thanks.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 26+ messages in thread