Re: [PATCH net-next 5/6] selftests: mptcp: add splice io mode

From: Matthieu Baerts

Date: Fri Jan 30 2026 - 05:06:14 EST


Hello,

On 29/01/2026 20:23, Matthieu Baerts (NGI0) wrote:
> From: Geliang Tang <tanggeliang@xxxxxxxxxx>
>
> This patch adds a new 'splice' io mode for mptcp_connect to test
> the newly added read_sock() and splice_read() functions of MPTCP.
>
> do_splice() efficiently transfers data directly between two file
> descriptors (infd and outfd) without copying to userspace, using
> Linux's splice() system call.
>
> Usage:
> ./mptcp_connect.sh -m splice

(...)

> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index 10f6f99cfd4e..1c4fe60089a2 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c

(...)

> @@ -935,6 +936,55 @@ static int copyfd_io_sendfile(int infd, int peerfd, int outfd,
> return err;
> }
>
> +static int do_splice(const int infd, const int outfd, const size_t len,
> + struct wstate *winfo)
> +{
> + int pipefd[2];
> + ssize_t bytes;
> + int err;
> +
> + err = pipe(pipefd);
> + if (err)
> + return err;
> +
> + while ((bytes = splice(infd, NULL, pipefd[1], NULL,
> + len - winfo->total_len,
> + SPLICE_F_MOVE | SPLICE_F_MORE)) > 0) {
> + splice(pipefd[0], NULL, outfd, NULL, bytes,
> + SPLICE_F_MOVE | SPLICE_F_MORE);

The review assistant rightly spotted errors with splice() are simply...
ignored! Technically, the script launching this tool will check the
integrity of the transfer, but still, that's clearly not a good practice!

Sorry for the noise, I didn't spot that when sending these patches. I
will fix the issues and send a v2 later.

pw-bot: cr

Cheers,
Matt
--
Sponsored by the NGI0 Core fund.