mptcp: track app-limited state in mptcp_sendmsg
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] In net/mptcp/protocol.c, mptcp_rate_check_app_limited() decides whether MPTCP still has data to send using only…
- [Low] Commit metadata mismatch for "mptcp: track app-limited state in mptcp_sendmsg": the author is Geliang Tang <[email protected]>, but…
--
mptcp: track app-limited state in mptcp_sendmsg
This adds mptcp_rate_check_app_limited(). It walks the subflows of an MPTCP socket and calls tcp_rate_check_app_limited() on each one, unless the msk still has unpushed or re-injected data. It is called from mptcp_sendmsg_locked() so that congestion controllers like BBR can ignore rate samples taken while the connection is application-limited.
Quoted 1 line
Signed-off-by Geliang Tang <[email protected]>
[Severity: Low]
This isn't a bug, but the Signed-off-by address doesn't match the author address (Geliang Tang <[email protected]>). checkpatch reports FROM_SIGN_OFF_MISMATCH for this. It doesn't read .mailmap, so the existing .mailmap entry that maps these two addresses won't stop the warning.
Patch 1 of the series ("mptcp: update mptcp_check_readable") signs off with [email protected]. Could this one use the same address?
Quoted 5 lines
net/mptcp/protocol.c +0
-0
net/mptcp/protocol.c static void mptcp_rps_record_subflows(const struct mptcp_sock *msk) · line 2047
Quoted 10 lines
net/mptcp/protocol.c +7
-0@@ -2038,6 +2038,24 @@ static void mptcp_rps_record_subflows(const struct mptcp_sock *msk) } } +static void mptcp_rate_check_app_limited (struct sock *sk) +{ +struct mptcp_sock *msk =mptcp_sk (sk); +struct mptcp_subflow_context *subflow; + +if (msk->write_seq != msk->snd_nxt ||mptcp_send_head (sk)) +return ;
[Severity: Medium]
Does this check miss data that is waiting for an MPTCP-level retransmission?
When the MPTCP RTO fires, mptcp_retransmit_timer() only defers the work:
net/mptcp/protocol.c:mptcp_retransmit_timer() {
...
if (!sock_owned_by_user(sk)) {
/* we need a process context to retransmit */
if (!test_and_set_bit(MPTCP_WORK_RTX, &msk->flags))
mptcp_schedule_work(sk);
} else {
/* delegate our work to tcp_release_cb() */
__set_bit(MPTCP_RETRANSMIT, &msk->cb_flags);
}
...
}Neither path changes write_seq, snd_nxt or first_pending.
Later, __mptcp_retrans() reads the data straight from mptcp_rtx_head() and sends it with __mptcp_push_retrans(). It never sets msk->first_pending. The only path that sets first_pending = rtx_head is __mptcp_retransmit_pending_data(), which runs when a subflow is closed or goes stale.
So suppose mptcp_sendmsg_locked() takes the msk lock after the RTO has fired but before mptcp_worker() or mptcp_release_cb() has run __mptcp_retrans(). Then write_seq == snd_nxt and mptcp_send_head() is NULL. The same holds if __mptcp_retrans() bailed out because mptcp_sched_get_retrans() found no suitable subflow and the data is still waiting.
In that window, won't the subflow loop below set tp->app_limited on idle subflows? That includes the one mptcp_subflow_get_retrans() is about to pick for the retransmission.
Plain TCP avoids this with the tp->lost_out <= tp->retrans_out condition in tcp_rate_check_app_limited(). Nothing here does the same for data lost at the MPTCP level. BBR would then keep the recovery burst samples out of its max-bw filter in bbr_update_bw(), reset sampling in bbr_lt_bw_sampling(), and skip them for full-bandwidth detection.
This also seems to contradict the commit message:
With this in place, subflow rate samples taken while the MPTCP connection is genuinely application-limited are flagged as such
Should the early return also cover a pending MPTCP_WORK_RTX or MPTCP_RETRANSMIT?
Quoted 10 lines
net/mptcp/protocol.c +10
-0+ +mptcp_for_each_subflow (msk, subflow) { +struct sock *ssk =mptcp_subflow_tcp_sock (subflow); +bool slow; + + slow =lock_sock_fast_nested (ssk); +tcp_rate_check_app_limited (ssk); +unlock_sock_fast (ssk, slow); + } +}
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1793324316.git.tanggeliang%40kylinos.cn