mptcp: push queued data on passive TFO subflows becoming established
Subsystems (2)
PATCH v3 1/1 mptcp: push queued data on passive TFO subflows becoming established
With TCP Fast Open on an MPTCP listener, if the server application writes data while the passive subflow is still in SYN_RECV (after consuming the client's SYN data but before the MP_CAPABLE third ACK arrives), __mptcp_subflow_active() refuses transmission and the data is queued into the msk write queue.
When the MPC third ACK arrives, the subflow transitions to TCP_ESTABLISHED and is marked fully established in check_fully_established(), but because the third ACK carries no DSS data, the queued bytes remain stranded until the peer sends more data.
Fix this in check_fully_established() by checking if the subflow was doing passive TFO (subflow->is_mptfo). Under mptcp_data_lock(), flush queued bytes via __mptcp_check_push().
Additionally, ensure subflow->is_mptfo is set in mptcp_fastopen_subflow_synack_set_params() even if the cookie-bearing SYN carries no data, so that server-first replies on zero-data TFO connections are also pushed upon 3WHS completion.
---
v3:
- In mptcp_fastopen_subflow_synack_set_params(), set subflow->is_mptfo unconditionally before checking for SYN data in the receive queue, ensuring server-first replies on zero-data TFO connections are also pushed upon 3WHS completion (Petar Sakic).
- Added Tested-by tag for Petar Sakic.
v2:
- Reverted moving/clearing is_mptfo since check_fully_established() is only called once and is_mptfo is read-only at this stage (Matthieu Baerts).
- Added Suggested-by tag for Petar Sakic.
- Rebased cleanly on top of mptcp_net-next export branch.
--- net/mptcp/fastopen.c | 4 ++-- net/mptcp/options.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
net/mptcp/fastopen.c +2 -2
@@ -24,13 +24,13 @@ void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subf sk = subflow->conn; tp =tcp_sk (ssk); + subflow->is_mptfo =1 ; +/* A valid TFO cookie does not guarantee SYN data. */ skb =skb_peek (&ssk->sk_receive_queue);if (!skb)return ; - subflow->is_mptfo =1 ; -/* dequeue the skb from sk receive queue */ __skb_unlink (skb, &ssk->sk_receive_queue);skb_ext_reset (skb);
net/mptcp/options.c +2 -0
@@ -1046,6 +1046,8 @@ static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk,mptcp_data_lock ((struct sock *)msk);__mptcp_subflow_fully_established (msk, subflow, mp_opt); +if (subflow->is_mptfo) +__mptcp_check_push ((struct sock *)msk, ssk);mptcp_data_unlock ((struct sock *)msk); check_notify:
Signature · 1 line
2.34.1
Hi T,
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! ✅
- Perf: Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/38368903325
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/9a32a1768402
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1184480
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-normalFor 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)
Matthieu Baerts
maintainerHi T S,
Quoted 20 lines · T S Rameshkumar
With TCP Fast Open on an MPTCP listener, if the server application writes data while the passive subflow is still in
SYN_RECV(after consuming the client's SYN data but before theMP_CAPABLEthird ACK arrives),__mptcp_subflow_active()refuses transmission and the data is queued into the msk write queue.When the MPC third ACK arrives, the subflow transitions to
TCP_ESTABLISHEDand is marked fully established incheck_fully_established(), but because the third ACK carries no DSS data, the queued bytes remain stranded until the peer sends more data.Fix this in
check_fully_established()by checking if the subflow was doing passive TFO (subflow->is_mptfo). Undermptcp_data_lock(), flush queued bytes via__mptcp_check_push().Additionally, ensure
subflow->is_mptfois set inmptcp_fastopen_subflow_synack_set_params()even if the cookie-bearing SYN carries no data, so that server-first replies on zero-data TFO connections are also pushed upon 3WHS completion.
(...)
Quoted 6 lines
net/mptcp/fastopen.c +0
-0@@ -24,13 +24,13 @@ void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subf sk = subflow->conn;
net/mptcp/fastopen.c void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subf · line 32
Quoted 10 lines
net/mptcp/fastopen.c +2
-1tp =tcp_sk (ssk); + subflow->is_mptfo =1 ; +/* A valid TFO cookie does not guarantee SYN data. */ skb =skb_peek (&ssk->sk_receive_queue);if (!skb)return ; - subflow->is_mptfo =1 ;
No, we cannot do that:
https://lore.kernel.org/[email protected]
Please wait for the discussions to settle before sending new versions.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.