Skip to content

prepare interfaces for kTLS and sockmap support

Geliang Tang mptcp 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest7 patches 1 replyIn review
  2. v77 patches 1 replySuperseded
  3. v67 patches 1 replySuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v57 patches2 repliesSuperseded
v45 patches1 replySuperseded
v35 patches1 replySuperseded
v25 patches1 replySuperseded
v16 patches1 replySuperseded

Changes in v8 from the cover letter

- patch 1: change mptcp_inq_hint() to maintain TCP semantics by adding 1 to hint_val when RCV_SHUTDOWN is set or sk_state is TCP_CLOSE, matching TCP behavior where FIN consumes a sequence number.
- patch 2: update the test.
- patches 3-7: no changes.

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hintnet/mptcp/protocol.c+5 -120 replies
2/7selftests: mptcp: connect: check TFO SIOCINQ overflowtools/testing/selftests/net/mptcp/mptcp_connect.c+64 -00 replies
3/7mptcp: implement peek_len for proto_opsnet/mptcp/protocol.c+22 -00 replies
4/7mptcp: add sendmsg_locked to proto_opsnet/mptcp/protocol.c+16 -40 replies
5/7mptcp: track app-limited state in mptcp_sendmsgnet/mptcp/protocol.c+27 -00 replies
6/7selftests: mptcp: sockopt: check app_limitedtools/testing/selftests/net/mptcp/mptcp_sockopt.c+5 -00 replies
7/7mptcp: update mptcp_check_readablenet/mptcp/protocol.c+6 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v8 yet.

Read the v8 thread

Cover letter [PATCH mptcp-next v8 0/7] prepare interfaces for kTLS and sockmap support

v8:
- patch 1: change mptcp_inq_hint() to maintain TCP semantics by adding 1 to hint_val when RCV_SHUTDOWN is set or sk_state is TCP_CLOSE, matching TCP behavior where FIN consumes a sequence number.
- patch 2: update the test.
- patches 3-7: no changes.

v7:
- patch 1: add 1 to hint_val when RCV_SHUTDOWN is set to include the FIN
byte, matching the previous ack_seq - map_seq behavior. Simplify the
EOF condition accordingly.
- patch 2: replace poll()-based check with a wait_for_remote_key() helper
that polls MPTCP_INFO until MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED is set, ensuring the third ACK has been processed before checking SIOCINQ. Add SOL_MPTCP fallback definition and handle ENOPROTOOPT/EOPNOTSUPP for
TCP or fallback sockets.
- patches 3-7: no changes.
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/

v6:
- patch 2: add Fixes tag, and use '-net' prefix.
- patch 3: remove poll() call, check SIOCINQ directly after accept().
- patch 6: add READ_ONCE() for msk->flags and msk->cb_flags reads in mptcp_rate_check_app_limited() to annotate intentionally racy accesses.
- update commit logs.
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/

v5:
- patch 2: new patch - rewrite mptcp_inq_hint() to use mptcp_data_avail() instead of ack_seq - map_seq, completely avoiding TFO overflow issues.
- patch 3: new patch - add TFO SIOCINQ overflow detection in
mptcp_connect test to catch INT_MAX returns on TFO connections.
- patch 4: mptcp_inq() now returns INT_MAX instead of 0 when avail >=
INT_MAX. Removed mptcp_inq_hint() changes (moved to patch 2).
- patch 6: replace mptcp_rtx_head() check with MPTCP_WORK_RTX and MPTCP_RETRANSMIT flag checks in mptcp_rate_check_app_limited() to
properly detect pending retransmissions without data race issues.
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/

v4:
- patch 2: fix mptcp_inq_hint() to return 0 instead of INT_MAX on
passive TFO overflow (ack_seq - map_seq >= INT_MAX).
- patch 4: add mptcp_rtx_head(sk) to the early-return check in mptcp_rate_check_app_limited() so pending retransmissions also
prevent false app-limited marking.
- patch 5: update comment message.
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/

v3:
- patch 2: drop DATA_FIN subtraction in mptcp_inq(), remove the
intermediate 'answ' variable and return (unsigned int)avail
directly. Update commit message accordingly.
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/

v2:
- drop the patch "prevent dummy DATA_FIN on RST in fallback mode".
- keep mptcp_inq_hint in mptcp_ioctl unchanged.
- use mptcp_data_avail in mptcp_inq.
- add msk_owned_by_me check in mptcp_sendmsg_locked.
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/

v1:
- https://patchwork.kernel.org/project/mptcp/cover/[email protected]/

This series was previously posted as part of "Reduce the differences between TCP and MPTCP for TLS usage" v15. It creates the mptcp_inq() and mptcp_sendmsg_locked() interfaces that are required for the upcoming MPTCP kTLS and MPTCP sockmap implementations.

The series has been rebased and no longer depends on Paolo's CB layout refactoring patches (mptcp: drop the mptcp_ooo_try_coalesce() helper,
mptcp: drop the cant_coalesce CB field, mptcp: remove CB offset field,
mptcp: sync mptcp skb cb layout with tcp one, mptcp: defer read_sock cleanup to mptcp_worker). Those patches are more complex and will be sent in a separate series.

Patch overview:

1. mptcp: update mptcp_check_readable
- Align with TCP's sock_is_readable for better TLS compatibility

2. mptcp: prevent dummy DATA_FIN on RST in fallback mode
- Fix semantic issue where RST on fallback connections would create dummy DATA_FIN, causing unnecessary state transitions
- Add sk_err check to subflow_is_done() to distinguish abortive closes (RST) from clean closes (FIN)

3. mptcp: implement peek_len for proto_ops
- Add mptcp_inq() to report readable bytes at MPTCP level
- Wire into .peek_len proto_ops for both IPv4 and IPv6
- Handle 32-bit torn reads by returning 0 instead of INT_MAX
- Prepare for TLS strparser integration

4. mptcp: add sendmsg_locked to proto_ops
- Split mptcp_sendmsg() into locked/unlocked variants
- Expose .sendmsg_locked in proto_ops for TLS send path

5. mptcp: track app-limited state in mptcp_sendmsg
- Add mptcp_rate_check_app_limited() to mark subflows as app-limited
- Bail out when MPTCP has unsent data (write_seq != snd_nxt or mptcp_send_head() != NULL) to avoid false app-limited marking
- Enable accurate delivery rate estimation for BBR

6. selftests: mptcp: sockopt: check app_limited
- Add regression test for app-limited accounting
- Verify tcpi_delivery_rate_app_limited == 1 after small transfers

Gang Yan (1):
mptcp: update mptcp_check_readable

Geliang Tang (6):
mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint
selftests: mptcp: connect: check TFO SIOCINQ overflow
mptcp: implement peek_len for proto_ops
mptcp: add sendmsg_locked to proto_ops
mptcp: track app-limited state in mptcp_sendmsg
selftests: mptcp: sockopt: check app_limited

 net/mptcp/protocol.c                          | 95 +++++++++++++++----
 .../selftests/net/mptcp/mptcp_connect.c       | 64 +++++++++++++
 .../selftests/net/mptcp/mptcp_sockopt.c       |  5 +
 3 files changed, 145 insertions(+), 19 deletions(-)
Signature · 1 line
2.55.0