[PATCH mptcp-next v2 0/5] mptcp: add MSG_ZEROCOPY support

Geliang Tang posted 5 patches 1 week, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/cover.1783821830.git.tanggeliang@kylinos.cn
There is a newer version of this series
net/mptcp/protocol.c                          | 117 ++++++++++++++++--
net/mptcp/protocol.h                          |   1 +
net/mptcp/sockopt.c                           |  15 ++-
tools/testing/selftests/net/mptcp/Makefile    |   1 +
.../selftests/net/mptcp/mptcp_connect.c       |  96 +++++++++++++-
.../net/mptcp/mptcp_connect_zerocopy.sh       |   5 +
6 files changed, 223 insertions(+), 12 deletions(-)
create mode 100755 tools/testing/selftests/net/mptcp/mptcp_connect_zerocopy.sh
[PATCH mptcp-next v2 0/5] mptcp: add MSG_ZEROCOPY support
Posted by Geliang Tang 1 week, 6 days ago
From: Geliang Tang <tanggeliang@kylinos.cn>

This series adds MSG_ZEROCOPY support for MPTCP sockets, allowing
userspace to transmit data without intermediate kernel copies, and
provides corresponding selftests to exercise the new path.

The first patch is a small cleanup that introduces a local 'tp'
variable in mptcp_sendmsg_frag() to avoid repeated tcp_sk()
dereferencing, preparing for the subsequent zero-copy changes.

The second patch implements the core MSG_ZEROCOPY support. The design
follows TCP's reference-counting model, with a single ubuf_info per
sendmsg tracked by three reference buckets: one held by sendmsg itself,
one per MPTCP dfrag in the retransmission queue, and one per subflow
skb. Completion is reported only after all bytes are acknowledged at
both MPTCP and subflow levels. The feature is silently downgraded to
regular copy in cases where zero-copy cannot be safely performed
(MSG_FASTOPEN, fallback mode, or memory pressure).

The third patch handles SO_ZEROCOPY in setsockopt.

The last two patches add a new 'zerocopy' I/O mode to the mptcp_connect
selftest, and a wrapper script to run it as part of the regular test
suite, ensuring the zero-copy path is exercised in CI.

v2:
 - patch 2, never mix PURE_ZEROCOPY frags with kernel-copy frags in the
   same skb; handle fallback, return values.
 - patch 3, a new patch to handle SO_ZEROCOPY in setsockopt.
 - patch 4, set SO_ZEROCOPY, handle listen_mode, error queue.

v1:
 - https://patchwork.kernel.org/project/mptcp/cover/cover.1783774784.git.tanggeliang@kylinos.cn/

Geliang Tang (5):
  mptcp: use local variable tp in sendmsg_frag
  mptcp: add MSG_ZEROCOPY support
  mptcp: handle SO_ZEROCOPY in setsockopt
  selftests: mptcp: connect: add zerocopy io mode
  selftests: mptcp: connect: cover zerocopy mode

 net/mptcp/protocol.c                          | 117 ++++++++++++++++--
 net/mptcp/protocol.h                          |   1 +
 net/mptcp/sockopt.c                           |  15 ++-
 tools/testing/selftests/net/mptcp/Makefile    |   1 +
 .../selftests/net/mptcp/mptcp_connect.c       |  96 +++++++++++++-
 .../net/mptcp/mptcp_connect_zerocopy.sh       |   5 +
 6 files changed, 223 insertions(+), 12 deletions(-)
 create mode 100755 tools/testing/selftests/net/mptcp/mptcp_connect_zerocopy.sh

-- 
2.53.0
Re: [PATCH mptcp-next v2 0/5] mptcp: add MSG_ZEROCOPY support
Posted by MPTCP CI 1 week, 6 days ago
Hi Geliang,

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): Success! ✅
- 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/29176900092

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


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)