Skip to contentSkip to conversation

Squash to "implement mptcp read_sock" v9

PATCH In review Geliang Tang 3 participants 5 messages Aug 29, 2025 – Sep 1, 2025

Subsystems (3)

v2 of 4 In review Latest is v4 →

lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

v2 cover Squash to "implement mptcp read_sock" v9

From: Geliang Tang <[email protected]>

v2:
- a new squash-to patch for "mptcp: implement .read_sock".

Based-on: <[email protected]>

Geliang Tang (2):
Squash to "mptcp: implement .read_sock"
Squash to "selftests: mptcp: connect: cover splice mode"

 net/mptcp/protocol.c                          | 22 ++++++++++++++-----
 .../net/mptcp/mptcp_connect_splice.sh         |  3 ++-
 2 files changed, 19 insertions(+), 6 deletions(-)
Signature · 1 line
2.48.1
author reviewer
#1 lore raw

PATCH v2 1/2 Squash to "mptcp: implement .read_sock"

From: Geliang Tang <[email protected]>

Add an offset parameter for mptcp_recv_skb and make it more like tcp_recv_skb.

---
 net/mptcp/protocol.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
net/mptcp/protocol.c +17 -5
index 33bf5bc26d36..701295f6ae1b 100644
@@ -4019,11 +4019,23 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
 	return mask;
 }
 
-static struct sk_buff *mptcp_recv_skb(struct sock *sk)
+static struct sk_buff *mptcp_recv_skb(struct sock *sk, u32 *off)
 {
+	struct sk_buff *skb;
+	u32 offset;
+
 	if (skb_queue_empty(&sk->sk_receive_queue))
 		__mptcp_move_skbs(sk);
-	return skb_peek(&sk->sk_receive_queue);
+
+	while ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) {
+		offset = MPTCP_SKB_CB(skb)->offset;
+		if (offset < skb->len) {
+			*off = offset;
+			return skb;
+		}
+		mptcp_eat_recv_skb(sk, skb);
+	}
+	return NULL;
 }
 
 /*
@@ -4037,11 +4049,11 @@ static int mptcp_read_sock(struct sock *sk, read_descriptor_t *desc,
 	size_t len = sk->sk_rcvbuf;
 	struct sk_buff *skb;
 	int copied = 0;
+	u32 offset;
 
 	if (sk->sk_state == TCP_LISTEN)
 		return -ENOTCONN;
-	while ((skb = mptcp_recv_skb(sk)) != NULL) {
-		u32 offset = MPTCP_SKB_CB(skb)->offset;
+	while ((skb = mptcp_recv_skb(sk, &offset)) != NULL) {
 		u32 data_len = skb->len - offset;
 		u32 size = min_t(size_t, len - copied, data_len);
 		int count;
@@ -4072,7 +4084,7 @@ static int mptcp_read_sock(struct sock *sk, read_descriptor_t *desc,
 	mptcp_rcv_space_adjust(msk, copied);
 
 	if (copied > 0) {
-		mptcp_recv_skb(sk);
+		mptcp_recv_skb(sk, &offset);
 		mptcp_cleanup_rbuf(msk, copied);
 	}
 
Signature · 1 line
2.48.1
author reviewer
#2 lore raw

PATCH v2 2/2 Squash to "selftests: mptcp: connect: cover splice mode"

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

Update subtest name.

---
 tools/testing/selftests/net/mptcp/mptcp_connect_splice.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_connect_splice.sh +2 -1
index 77fe240ecf8c..241254a966c9 100755
@@ -1,4 +1,5 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
-"$(dirname "${0}")/mptcp_connect.sh" -m splice "${@}"
+MPTCP_LIB_KSFT_TEST="$(basename "${0}" .sh)" \
+	"$(dirname "${0}")/mptcp_connect.sh" -m splice "${@}"
Signature · 1 line
2.48.1
#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: Unstable: 1 failed test(s): packetdrill_add_addr 🔴
- KVM Validation: debug: Unstable: 1 failed test(s): packetdrill_add_addr 🔴
- 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/17320054633

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

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
#4 lore raw
In reply to Geliang Tang

Hi Geliang,

Quoted 4 lines · Geliang Tang

From: Geliang Tang <[email protected]>

v2:
- a new squash-to patch for "mptcp: implement .read_sock".

When the series is a few days old, and has not been reviewed yet, I think it is easier if you send a new version instead of squash-to patches.

I think such squash-to patches are good when patches have already been applied, or when you realised you forgot something minor just after having send a series with a few patches. (For the latter, it might be interesting to use '--in-reply-to $PREVIOUS_COVER_LETTER'.)

When the v10 will be posted, I can check with Paolo if he is planning to continue the review of this series.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.