From: Gang Yan <gang.yan@linux.dev>
To: mptcp@lists.linux.dev
Cc: pabeni@redhat.com, Gang Yan <yangang@kylinos.cn>,
Geliang Tang <geliang@kernel.org>
Subject: [PATCH mptcp-net v4 2/5] mptcp: fix the stall problems using backlog_queue
Date: Mon, 30 Mar 2026 13:32:57 +0800 [thread overview]
Message-ID: <20260330053300.15717-3-gang.yan@linux.dev> (raw)
In-Reply-To: <20260330053300.15717-1-gang.yan@linux.dev>
From: Gang Yan <yangang@kylinos.cn>
The original condition would stop moving skbs or spooling backlog even
when the receive queue is empty, leading to receive stall.
Modify the condition in __mptcp_move_skbs() and mptcp_can_spool_backlog()
to only treat rcvbuf as full when:
sk_rmem_alloc_get(sk) > sk->sk_rcvbuf && !skb_queue_empty(&sk->sk_receive_queue)
This ensures the backlog can still be moved to the receive queue when
the queue is empty, avoiding stall problems.
Fixes: 6228efe0cc01 ("mptcp: leverage the backlog for RX packet processing")
Co-developed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Gang Yan <yangang@kylinos.cn>
---
net/mptcp/protocol.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 03eaa92badd5..01d04cbea53d 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2197,6 +2197,12 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
msk->rcvq_space.time = mstamp;
}
+static bool mptcp_can_dequeue_from_backlog(struct sock *sk)
+{
+ return sk_rmem_alloc_get(sk) <= sk->sk_rcvbuf ||
+ skb_queue_empty(&sk->sk_receive_queue);
+}
+
static bool __mptcp_move_skbs(struct sock *sk, struct list_head *skbs, u32 *delta)
{
struct sk_buff *skb = list_first_entry(skbs, struct sk_buff, list);
@@ -2206,7 +2212,7 @@ static bool __mptcp_move_skbs(struct sock *sk, struct list_head *skbs, u32 *delt
*delta = 0;
while (1) {
/* If the msk recvbuf is full stop, don't drop */
- if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf)
+ if (!mptcp_can_dequeue_from_backlog(sk))
break;
prefetch(skb->next);
@@ -2261,7 +2267,7 @@ static bool mptcp_can_spool_backlog(struct sock *sk, struct list_head *skbs)
/* Don't spool the backlog if the rcvbuf is full. */
if (RB_EMPTY_ROOT(&msk->backlog_queue) ||
- sk_rmem_alloc_get(sk) > sk->sk_rcvbuf)
+ !mptcp_can_dequeue_from_backlog(sk))
return false;
INIT_LIST_HEAD(skbs);
--
2.43.0
next prev parent reply other threads:[~2026-03-30 5:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 5:32 [PATCH mptcp-net v4 0/5] mptcp: fix stall because of data_ready Gang Yan
2026-03-30 5:32 ` [PATCH mptcp-net v4 1/5] mptcp: replace backlog_list with backlog_queue Gang Yan
2026-03-30 5:32 ` Gang Yan [this message]
2026-03-30 5:32 ` [PATCH mptcp-net v4 3/5] mptcp: fix the stall problems with data_ready Gang Yan
2026-03-30 5:32 ` [PATCH mptcp-net v4 4/5] mptcp: fix the dead_loack in mptcp_data_ready Gang Yan
2026-03-30 5:33 ` [PATCH mptcp-net v4 5/5] selftests: mptcp: test transmission with small rcvbuf Gang Yan
2026-03-30 6:56 ` [PATCH mptcp-net v4 0/5] mptcp: fix stall because of data_ready MPTCP CI
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=20260330053300.15717-3-gang.yan@linux.dev \
--to=gang.yan@linux.dev \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=pabeni@redhat.com \
--cc=yangang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox