diff options
author | Paolo Abeni <pabeni@redhat.com> | 2025-07-23 16:32:23 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2025-07-25 11:29:04 -0700 |
commit | c65c2e3bae6912b6baf8ea12eeace220e8e99b47 (patch) | |
tree | 9af001acf5192384bc9ce9f5597de5010854cd7d /net/mptcp/protocol.h | |
parent | 5ec9b15d8dfa4992c6f9c26c1f96e69202d8fcb1 (diff) |
mptcp: track fallbacks accurately via mibs
Add the mibs required to cover the few possible fallback causes still
lacking suck info.
Move the relevant mib increment into the fallback helper, so that no
eventual future fallback operation will miss a paired mib increment.
Additionally track failed fallback via its own mib, such mib is
incremented only when a fallback mandated by the protocol fails - due to
racing subflow creation.
While at the above, rename an existing helper to reduce long lines
problems all along.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20250723-net-next-mptcp-track-fallbacks-v1-1-a83cce08f2d5@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mptcp/protocol.h')
-rw-r--r-- | net/mptcp/protocol.h | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 1a32edf6f343..912f048994a1 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1223,24 +1223,6 @@ static inline bool mptcp_check_fallback(const struct sock *sk) return __mptcp_check_fallback(msk); } -static inline bool __mptcp_try_fallback(struct mptcp_sock *msk) -{ - if (__mptcp_check_fallback(msk)) { - pr_debug("TCP fallback already done (msk=%p)\n", msk); - return true; - } - spin_lock_bh(&msk->fallback_lock); - if (!msk->allow_infinite_fallback) { - spin_unlock_bh(&msk->fallback_lock); - return false; - } - - msk->allow_subflows = false; - set_bit(MPTCP_FALLBACK_DONE, &msk->flags); - spin_unlock_bh(&msk->fallback_lock); - return true; -} - static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk) { struct sock *ssk = READ_ONCE(msk->first); @@ -1250,14 +1232,16 @@ static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk) TCPF_SYN_RECV | TCPF_LISTEN)); } -static inline bool mptcp_try_fallback(struct sock *ssk) +bool __mptcp_try_fallback(struct mptcp_sock *msk, int fb_mib); + +static inline bool mptcp_try_fallback(struct sock *ssk, int fb_mib) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); struct sock *sk = subflow->conn; struct mptcp_sock *msk; msk = mptcp_sk(sk); - if (!__mptcp_try_fallback(msk)) + if (!__mptcp_try_fallback(msk, fb_mib)) return false; if (READ_ONCE(msk->snd_data_fin_enable) && !(ssk->sk_shutdown & SEND_SHUTDOWN)) { gfp_t saved_allocation = ssk->sk_allocation; @@ -1275,12 +1259,13 @@ static inline bool mptcp_try_fallback(struct sock *ssk) #define pr_fallback(a) pr_debug("%s:fallback to TCP (msk=%p)\n", __func__, a) -static inline void mptcp_subflow_early_fallback(struct mptcp_sock *msk, - struct mptcp_subflow_context *subflow) +static inline void mptcp_early_fallback(struct mptcp_sock *msk, + struct mptcp_subflow_context *subflow, + int fb_mib) { pr_fallback(msk); subflow->request_mptcp = 0; - WARN_ON_ONCE(!__mptcp_try_fallback(msk)); + WARN_ON_ONCE(!__mptcp_try_fallback(msk, fb_mib)); } static inline bool mptcp_check_infinite_map(struct sk_buff *skb) |