mptcp: update window_clamp on subflows when SO_RCVBUF is set
Subsystems (2)
PATCH 1/1 mptcp: update window_clamp on subflows when SO_RCVBUF is set
From: Gang Yan <[email protected]>
Add __mptcp_subflow_set_rcvbuf() helper that calls the tcp_set_rcvbuf to update window_clamp, in addition to writing sk_rcvbuf. Use it in both mptcp_sol_socket_sync_intval() (setsockopt path) and sync_socket_options() (new subflow creation path).
---
Notes:
Hi Matt:
Note that I do not implement set_rcvbuf in mptcp_stream_ops for the following reasons:
- The callback receives the MPTCP meta socket as 'sk', but tcp_set_rcvbuf() must be called on each TCP subflow to update window_clamp. A callback implementation would need to iterate all subflows, duplicating the work already done by mptcp_sol_socket_sync_intval().
- Subflows are grafted to the MPTCP socket via mptcp_sock_graft(), so ssk->sk_socket->ops points to mptcp_stream_ops, not inet_stream_ops. This means the TCP set_rcvbuf callback is not reachable through the subflow's ops either.
- The existing subflow sync functions cover both the setsockopt path (mptcp_sol_socket_sync_intval) and new subflow creation path (sync_socket_options), making the proto_ops callback unnecessary.
WDYT?
The packetdrill tests is also implemented:
-Link: https://github.com/multipath-tcp/packetdrill/pull/194
Thanks
Gang
--- net/mptcp/sockopt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/mptcp/sockopt.c +8 -2
@@ -67,6 +67,12 @@ static int mptcp_get_int_option(struct mptcp_sock *msk, sockptr_t optval,return 0 ; } +static inline void __mptcp_subflow_set_rcvbuf (struct sock *ssk,int val) +{ +WRITE_ONCE (ssk->sk_rcvbuf, val); +tcp_set_rcvbuf (ssk, val); +} +static void mptcp_sol_socket_sync_intval (struct mptcp_sock *msk,int optname,int val) {struct mptcp_subflow_context *subflow;
@@ -100,7 +106,7 @@ static void mptcp_sol_socket_sync_intval(struct mptcp_sock *msk, int optname, incase SO_RCVBUF :case SO_RCVBUFFORCE : ssk->sk_userlocks |=SOCK_RCVBUF_LOCK ; -WRITE_ONCE (ssk->sk_rcvbuf, sk->sk_rcvbuf); +__mptcp_subflow_set_rcvbuf (ssk, sk->sk_rcvbuf);break ;case SO_MARK :if (READ_ONCE (ssk->sk_mark) != sk->sk_mark) {
@@ -1556,7 +1562,7 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk)mptcp_subflow_ctx (ssk)->cached_sndbuf = sk->sk_sndbuf; }if (sk->sk_userlocks &SOCK_RCVBUF_LOCK ) -WRITE_ONCE (ssk->sk_rcvbuf, sk->sk_rcvbuf); +__mptcp_subflow_set_rcvbuf (ssk, sk->sk_rcvbuf); }if (sock_flag (sk,SOCK_LINGER )) {
Signature · 1 line
2.43.0
Matthieu Baerts
maintainerHi Gang,
Quoted 6 lines · Gang Yan
From: Gang Yan <[email protected]>
Add
__mptcp_subflow_set_rcvbuf()helper that calls thetcp_set_rcvbufto updatewindow_clamp, in addition to writingsk_rcvbuf. Use it in bothmptcp_sol_socket_sync_intval()(setsockopt path) andsync_socket_options()(new subflow creation path).
I didn't review the code yet, but just a note for next time: please don't use the RESEND tag if you did a modification, even if it is only in the commit message. Instead, increment the version and add a changelog describing the modifications.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
A message that is not in the archive (sent off-list or not yet received): [email protected]
-------- Forwarded message -------
From: [email protected] mailto:[email protected]
To: "Matthieu Baerts" <[email protected] mailto:[email protected]?to=%22Matthieu%20Baerts%22%20%3Cmatttbe%40kernel.org%3E >
Sent: April 20, 2026 at 5:30 PM
Subject: Re: [RESEDN PATCH mptcp-net] mptcp: update window_clamp on subflows when SO_RCVBUF is set
Quoted 13 lines · Matthieu Baerts
Hi Gang,
On 20/04/2026 10:56, Gang Yan wrote:
From: Gang Yan <[email protected]>
Add
__mptcp_subflow_set_rcvbuf()helper that calls thetcp_set_rcvbufto updatewindow_clamp, in addition to writingsk_rcvbuf. Use it in bothmptcp_sol_socket_sync_intval()(setsockopt path) andsync_socket_options()(new subflow creation path).
Quoted 5 lines
I didn't review the code yet, but just a note for next time: please don't use the RESEND tag if you did a modification, even if it is only in the commit message. Instead, increment the version and add a changelog describing the modifications.
Thanks for the advice and reminder!
The reason I sent this patch with the RESEND tag is that I wanted to trigger the CI checks, especially the AI reivew, to see if there are any issues that need to be fixed. It seems my previous patch didn't properly trigger those tests.
Thanks
Gang
Quoted 6 lines
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerQuoted 29 lines · On 20/04/2026 11:31, [email protected] wrote:
-------- Forwarded message -------
From: [email protected] mailto:[email protected]
To: "Matthieu Baerts" <[email protected] mailto:[email protected]?to=%22Matthieu%20Baerts%22%20%3Cmatttbe%40kernel.org%3E >
Sent: April 20, 2026 at 5:30 PM
Subject: Re: [RESEDN PATCH mptcp-net] mptcp: updatewindow_clampon subflows whenSO_RCVBUFis setQuoted 13 lines · Matthieu Baerts
Hi Gang,
On 20/04/2026 10:56, Gang Yan wrote:
From: Gang Yan <[email protected]>
Add
__mptcp_subflow_set_rcvbuf()helper that calls thetcp_set_rcvbufto updatewindow_clamp, in addition to writingsk_rcvbuf. Use it in bothmptcp_sol_socket_sync_intval()(setsockopt path) andsync_socket_options()(new subflow creation path).Quoted 5 lines
I didn't review the code yet, but just a note for next time: please don't use the RESEND tag if you did a modification, even if it is only in the commit message. Instead, increment the version and add a changelog describing the modifications.
Quoted 6 lines
Thanks for the advice and reminder!
The reason I sent this patch with the RESEND tag is that I wanted to trigger the CI checks, especially the AI reivew, to see if there are any issues that need to be fixed. It seems my previous patch didn't properly trigger those tests.
Strange, I don't see your previous patch on Patchew:
And sashiko had some issues with it:
https://sashiko.dev/#/patchset/20260416122945.324166-1-gang.yan%40linux.dev
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Gang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): 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/24844502734
Initiator: Matthieu Baerts (NGI0)
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/546f74028ce0
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1083201
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)