Skip to contentSkip to conversation

convert helpers for win and space

PATCH In review Geliang Tang 4 participants 6 messages May 11, 2024 – May 15, 2024

Subsystems (2)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

cover convert helpers for win and space

From: Geliang Tang <[email protected]>

Paired with mptcp_win_from_space(), added an mptcp_space_from_win() helper, use them in mptcp_rcv_space_adjust() and mptcp_set_rcvlowat().

Geliang Tang (2):
mptcp: use mptcp_win_from_space helper
mptcp: add mptcp_space_from_win helper

 net/mptcp/protocol.c | 4 ++--
 net/mptcp/protocol.h | 5 +++++
 net/mptcp/sockopt.c  | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH 1/2 mptcp: use mptcp_win_from_space helper

From: Geliang Tang <[email protected]>

The MPTCP dedicated win_from_space helper mptcp_win_from_space() is defined in protocol.h, use it in mptcp_rcv_space_adjust() instead of using the TCP one. Here scaling_ratio is the same as msk->scaling_ratio.

---
 net/mptcp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/protocol.c +1 -1
index 579031c60937..04dda32ccbef 100644
@@ -2046,7 +2046,7 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 		if (rcvbuf > sk->sk_rcvbuf) {
 			u32 window_clamp;
 
-			window_clamp = __tcp_win_from_space(scaling_ratio, rcvbuf);
+			window_clamp = mptcp_win_from_space(sk, rcvbuf);
 			WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
 
 			/* Make subflows follow along.  If we do not do this, we
Signature · 1 line
2.43.0
author reviewer
#2 lore raw

PATCH 2/2 mptcp: add mptcp_space_from_win helper

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

As a wrapper of __tcp_space_from_win(), this patch adds a MPTCP dedicated space_from_win helper mptcp_space_from_win() in protocol.h to paired with mptcp_win_from_space().

Use it instead of __tcp_space_from_win() in both mptcp_rcv_space_adjust() and mptcp_set_rcvlowat().

---
 net/mptcp/protocol.c | 2 +-
 net/mptcp/protocol.h | 5 +++++
 net/mptcp/sockopt.c  | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)
net/mptcp/protocol.c +1 -1
index 04dda32ccbef..8b0a5b74a3b1 100644
@@ -2040,7 +2040,7 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
 		do_div(grow, msk->rcvq_space.space);
 		rcvwin += (grow << 1);
 
-		rcvbuf = min_t(u64, __tcp_space_from_win(scaling_ratio, rcvwin),
+		rcvbuf = min_t(u64, mptcp_space_from_win(sk, rcvwin),
 			       READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]));
 
 		if (rcvbuf > sk->sk_rcvbuf) {
net/mptcp/protocol.h +5 -0
index b5fb26ece2b8..19d60b6d5b45 100644
@@ -386,6 +386,11 @@ static inline int mptcp_win_from_space(const struct sock *sk, int space)
 	return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space);
 }
 
+static inline int mptcp_space_from_win(const struct sock *sk, int win)
+{
+	return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win);
+}
+
 static inline int __mptcp_space(const struct sock *sk)
 {
 	return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - __mptcp_rmem(sk));
net/mptcp/sockopt.c +1 -1
index 7265b6733f5a..00e06c698415 100644
@@ -1581,7 +1581,7 @@ int mptcp_set_rcvlowat(struct sock *sk, int val)
 	if (sk->sk_userlocks & SOCK_RCVBUF_LOCK)
 		return 0;
 
-	space = __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, val);
+	space = mptcp_space_from_win(sk, val);
 	if (space <= sk->sk_rcvbuf)
 		return 0;
 
Signature · 1 line
2.43.0
#3 lore raw
In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/9042513520

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

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 the v1 series
#4 lore raw
In reply to Geliang Tang
Quoted 5 lines · Geliang Tang

From: Geliang Tang <[email protected]>

Paired with mptcp_win_from_space(), added an mptcp_space_from_win() helper, use them in mptcp_rcv_space_adjust() and mptcp_set_rcvlowat().

Quoted 9 lines

Geliang Tang (2):
mptcp: use mptcp_win_from_space helper
mptcp: add mptcp_space_from_win helper

net/mptcp/protocol.c | 4 ++--
net/mptcp/protocol.h | 5 +++++
net/mptcp/sockopt.c  | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)

Series LGTM, thanks Geliang!

maintainer
#5 lore raw
In reply to Geliang Tang

Hi Geliang, Mat,

Quoted 4 lines · Geliang Tang

From: Geliang Tang <[email protected]>

Paired with mptcp_win_from_space(), added an mptcp_space_from_win() helper, use them in mptcp_rcv_space_adjust() and mptcp_set_rcvlowat().

Thank you for the patches and the reviews!

Now in our tree (feat. for net-next):

New patches for t/upstream:
- 1b4da355e261: mptcp: use mptcp_win_from_space helper
- 9562c14a05f0: mptcp: add mptcp_space_from_win helper
- Results: c30047008247..767563eb7a1b (export)

Tests are now in progress:

- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/85fd224def76881f192ebfbd8c066f59984eb7d4/checks

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.