Thread (9 messages) 9 messages, 1 author, 2026-01-30

Re: [PATCH net-next 4/6] mptcp: implement .splice_read

From: Matthieu Baerts <matttbe@kernel.org>
Date: 2026-01-30 07:24:46
Also in: linux-kselftest, lkml, mptcp

Hello,

On 29/01/2026 20:23, Matthieu Baerts (NGI0) wrote:
quoted hunk ↗ jump to hunk
From: Geliang Tang <redacted>

This patch implements .splice_read interface of mptcp struct proto_ops
as mptcp_splice_read() with reference to tcp_splice_read().

Corresponding to __tcp_splice_read(), __mptcp_splice_read() is defined,
invoking mptcp_read_sock() instead of tcp_read_sock().

mptcp_splice_read() is almost the same as tcp_splice_read(), except for
sock_rps_record_flow().

Signed-off-by: Geliang Tang <redacted>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/protocol.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index c58e306ec3ef..3aee29f70954 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4396,6 +4396,118 @@ static int mptcp_read_sock(struct sock *sk, read_descriptor_t *desc,
 	return __mptcp_read_sock(sk, desc, recv_actor, false);
 }
 
+static int __mptcp_splice_read(struct sock *sk, struct tcp_splice_state *tss)
+{
+	/* Store TCP splice context information in read_descriptor_t. */
+	read_descriptor_t rd_desc = {
+		.arg.data = tss,
+		.count	  = tss->len,
+	};
+
+	return mptcp_read_sock(sk, &rd_desc, tcp_splice_data_recv);
+}
+
+/**
+ *  mptcp_splice_read - splice data from MPTCP socket to a pipe
+ * @sock:	socket to splice from
+ * @ppos:	position (not valid)
+ * @pipe:	pipe to splice to
+ * @len:	number of bytes to splice
+ * @flags:	splice modifier flags
+ *
+ * Description:
+ *    Will read pages from given socket and fill them into a pipe.
This comment is a copy of tcp_splice_read() where only the first line
has been adapted, but this seems to cause a new kdoc warning:

  net/mptcp/protocol.c:4424 No description found for return value of
'mptcp_splice_read'


I guess something like that should be added in a v2:

  Return:
     Amount of bytes that have been spliced.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help