[PATCH mptcp-net v3 1/2] mptcp: sync the msk->sndbuf at accept() time

Gang Yan posted 2 patches 4 days, 2 hours ago
There is a newer version of this series
[PATCH mptcp-net v3 1/2] mptcp: sync the msk->sndbuf at accept() time
Posted by Gang Yan 4 days, 2 hours ago
From: Gang Yan <yangang@kylinos.cn>

After an MPTCP connection is established, the sk_sndbuf of client's msk
can be updated through 'subflow_finish_connect'. However, the newly
accepted msk on the server side has a small sk_sndbuf than
msk->first->sk_sndbuf:

'''
MPTCP: msk:00000000e55b09db, msk->sndbuf:20480, msk->first->sndbuf:2626560
'''

This patch synchronizes the sk_sndbuf by triggering its update during
accept.

Fixes: 8005184fd1ca ("mptcp: refactor sndbuf auto-tuning")
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/602
Signed-off-by: Gang Yan <yangang@kylinos.cn>
---
 net/mptcp/protocol.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 17b9a8c13ebf..6f6c8cabf74f 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4252,6 +4252,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
 
 		mptcp_graft_subflows(newsk);
 		mptcp_rps_record_subflows(msk);
+		__mptcp_propagate_sndbuf(newsk, mptcp_subflow_tcp_sock(subflow));
 
 		/* Do late cleanup for the first subflow as necessary. Also
 		 * deal with bad peers not doing a complete shutdown.
-- 
2.43.0
Re: [PATCH mptcp-net v3 1/2] mptcp: sync the msk->sndbuf at accept() time
Posted by Paolo Abeni 1 day, 2 hours ago
On 4/7/26 10:45 AM, Gang Yan wrote:
> From: Gang Yan <yangang@kylinos.cn>
> 
> After an MPTCP connection is established, the sk_sndbuf of client's msk
> can be updated through 'subflow_finish_connect'. However, the newly
> accepted msk on the server side has a small sk_sndbuf than
> msk->first->sk_sndbuf:
> 
> '''
> MPTCP: msk:00000000e55b09db, msk->sndbuf:20480, msk->first->sndbuf:2626560
> '''
> 
> This patch synchronizes the sk_sndbuf by triggering its update during
> accept.

I finally could wrap my head around the root cause: tcp_child_process()
-> tcp_init_transfer() -> tcp_sndbuf_expand() can and will grow the ssk
sndbuf _after_ tcp_check_req() -> subflow_syn_recv_sock() ->
mptcp_sk_clone_init() where __mptcp_propagate_sndbuf() is currently hooked.

I think the latter __mptcp_propagate_sndbuf() invocation can be removed,
and the commit message expanded to capture some of the above.

With the above included feel free to add:

Acked-by: Paolo Abeni <pabeni@redhat.com>
Re: [PATCH mptcp-net v3 1/2] mptcp: sync the msk->sndbuf at accept() time
Posted by gang.yan@linux.dev 7 hours ago
April 10, 2026 at 5:04 PM, "Paolo Abeni" <pabeni@redhat.com mailto:pabeni@redhat.com?to=%22Paolo%20Abeni%22%20%3Cpabeni%40redhat.com%3E > wrote:


> 
> On 4/7/26 10:45 AM, Gang Yan wrote:
> 
> > 
> > From: Gang Yan <yangang@kylinos.cn>
> >  
> >  After an MPTCP connection is established, the sk_sndbuf of client's msk
> >  can be updated through 'subflow_finish_connect'. However, the newly
> >  accepted msk on the server side has a small sk_sndbuf than
> >  msk->first->sk_sndbuf:
> >  
> >  '''
> >  MPTCP: msk:00000000e55b09db, msk->sndbuf:20480, msk->first->sndbuf:2626560
> >  '''
> >  
> >  This patch synchronizes the sk_sndbuf by triggering its update during
> >  accept.
> > 
> I finally could wrap my head around the root cause: tcp_child_process()
> -> tcp_init_transfer() -> tcp_sndbuf_expand() can and will grow the ssk
> sndbuf _after_ tcp_check_req() -> subflow_syn_recv_sock() ->
> mptcp_sk_clone_init() where __mptcp_propagate_sndbuf() is currently hooked.
> 
> I think the latter __mptcp_propagate_sndbuf() invocation can be removed,
> and the commit message expanded to capture some of the above.
> 
> With the above included feel free to add:
> 
> Acked-by: Paolo Abeni <pabeni@redhat.com>
Hi Paolo,

Thanks for your suggestions. The v4 code will be sent soon.

Cherrs,
Gang
>
Re: [PATCH mptcp-net v3 1/2] mptcp: sync the msk->sndbuf at accept() time
Posted by Matthieu Baerts 1 day, 2 hours ago
Hi Paolo,

On 10/04/2026 11:04, Paolo Abeni wrote:
> On 4/7/26 10:45 AM, Gang Yan wrote:
>> From: Gang Yan <yangang@kylinos.cn>
>>
>> After an MPTCP connection is established, the sk_sndbuf of client's msk
>> can be updated through 'subflow_finish_connect'. However, the newly
>> accepted msk on the server side has a small sk_sndbuf than
>> msk->first->sk_sndbuf:
>>
>> '''
>> MPTCP: msk:00000000e55b09db, msk->sndbuf:20480, msk->first->sndbuf:2626560
>> '''
>>
>> This patch synchronizes the sk_sndbuf by triggering its update during
>> accept.
> 
> I finally could wrap my head around the root cause: tcp_child_process()
> -> tcp_init_transfer() -> tcp_sndbuf_expand() can and will grow the ssk
> sndbuf _after_ tcp_check_req() -> subflow_syn_recv_sock() ->
> mptcp_sk_clone_init() where __mptcp_propagate_sndbuf() is currently hooked.
> 
> I think the latter __mptcp_propagate_sndbuf() invocation can be removed,
> and the commit message expanded to capture some of the above.
> 
> With the above included feel free to add:
> 
> Acked-by: Paolo Abeni <pabeni@redhat.com>
Thank you for this review!

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.