Skip to contentSkip to conversation

mptcp: update window_clamp on subflows when SO_RCVBUF is set

PATCH In review Gang Yan 3 participants 4 messages May 6 – May 8

Subsystems (2)
lore
Share & tools
lore

Gang Yan

author
#0 lore raw

PATCH v3 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).

Fixes a2cbb1603943 ("tcp: Update window clamping condition")

---
Changelog:
v3:
- Remove the special symbols.
v2:
- Optimize the commit msg.

v1:

---
 net/mptcp/sockopt.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
net/mptcp/sockopt.c +8 -2
index 1cf608e7357b..1544e3563852 100644
@@ -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, in
 		case 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) {
@@ -1560,7 +1566,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)) {

---
base-commit: aa15c271d79edde595fb6f4eedb52fbc16325a83
change-id: 20260506-window_clamp-8a8d2fbf38e9

Best regards,

Signature · 1 line
Gang Yan <[email protected]>
#1 lore raw

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): Unstable: 1 failed test(s): packetdrill_dss ⚠️
- 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/25429148337

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/4f281af32a03
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1090379

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-normal

For 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)

maintainer Reviewed-by on v3 1/1
#2 lore raw
In reply to Gang Yan

Hi Gang,

Quoted 6 lines · Gang Yan

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).

Next time, please insist more on the reason: why is it needed to update window_clamp?

Quoted 1 line
Fixes a2cbb1603943 ("tcp: Update window clamping condition")

I think it should be:

Fixes b025461303d8 ("tcp: update window_clamp when SO_RCVBUF is set")

This commit introduced tcp_set_rcvbuf(), so it was hard to call it
before: this commit could have been added MPTCP support, hence the Fixes tag linked to that one.

The rest looks good to me, and I can do the modification when applying the patch:

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer
#3 lore raw
In reply to Gang Yan

Hi Gang,

Quoted 6 lines · Gang Yan

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).

Now in our tree, with small modifications in the commit message.

New patches for t/upstream-net and t/upstream:
- 840fb208ba03: mptcp: update window_clamp on subflows when SO_RCVBUF is set
- Results: 83b57683234a..a968ca54c292 (export-net)
- Results: fac20e19a7d2..9ec315f69069 (export)

Tests are now in progress:

- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/ebbd36260bf0fc51690fbf16c146a51f95d32602/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/876e5cac2c615fa953d03f4b90ab234ebfca3c73/checks

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.