]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mptcp: consolidate rcv space init
authorPaolo Abeni <pabeni@redhat.com>
Tue, 3 Feb 2026 18:41:19 +0000 (19:41 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 5 Feb 2026 02:45:09 +0000 (18:45 -0800)
MPTCP uses several calls of the mptcp_rcv_space_init() helper to
initialize the receive space, with a catch-up call in
mptcp_rcv_space_adjust().

Drop all the other strictly not needed invocations and move constant
fields initialization at socket init/reset time.

This removes a bit of complexity from mptcp DRS code. No functional
changes intended.

Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260203-net-next-mptcp-misc-feat-6-20-v1-3-31ec8bfc56d1@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/protocol.c
net/mptcp/protocol.h
net/mptcp/subflow.c

index 8d16ed00fcb4f613148e7867aee794e9747256cd..514272179714a749c87d5bc6f2180fd0911444ee 100644 (file)
@@ -2065,6 +2065,21 @@ static int __mptcp_recvmsg_mskq(struct sock *sk, struct msghdr *msg,
        return copied;
 }
 
+static void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk)
+{
+       const struct tcp_sock *tp = tcp_sk(ssk);
+
+       msk->rcvspace_init = 1;
+       msk->rcvq_space.copied = 0;
+       msk->rcvq_space.rtt_us = 0;
+
+       /* initial rcv_space offering made to peer */
+       msk->rcvq_space.space = min_t(u32, tp->rcv_wnd,
+                                     TCP_INIT_CWND * tp->advmss);
+       if (msk->rcvq_space.space == 0)
+               msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT;
+}
+
 /* receive buffer autotuning.  See tcp_rcv_space_adjust for more information.
  *
  * Only difference: Use highest rtt estimate of the subflows in use.
@@ -3558,21 +3573,6 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
        return nsk;
 }
 
-void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk)
-{
-       const struct tcp_sock *tp = tcp_sk(ssk);
-
-       msk->rcvspace_init = 1;
-       msk->rcvq_space.copied = 0;
-       msk->rcvq_space.rtt_us = 0;
-
-       /* initial rcv_space offering made to peer */
-       msk->rcvq_space.space = min_t(u32, tp->rcv_wnd,
-                                     TCP_INIT_CWND * tp->advmss);
-       if (msk->rcvq_space.space == 0)
-               msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT;
-}
-
 static void mptcp_destroy(struct sock *sk)
 {
        struct mptcp_sock *msk = mptcp_sk(sk);
index 39afd44e072f2c04632e640fe2be818dd1db9640..66a30409f21785d0d5bf9a6846fe1a86bcd205eb 100644 (file)
@@ -920,7 +920,6 @@ static inline u64 mptcp_stamp(void)
        return div_u64(tcp_clock_ns(), NSEC_PER_USEC);
 }
 
-void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk);
 void mptcp_data_ready(struct sock *sk, struct sock *ssk);
 bool mptcp_finish_join(struct sock *sk);
 bool mptcp_schedule_work(struct sock *sk);
index 96d54cb2cd93f447e0e04c53d8eaceaa7de3e9c8..f66129f1e649248e00215d254c925f66c3fffa6a 100644 (file)
@@ -462,8 +462,6 @@ void __mptcp_sync_state(struct sock *sk, int state)
 
        subflow = mptcp_subflow_ctx(ssk);
        __mptcp_propagate_sndbuf(sk, ssk);
-       if (!msk->rcvspace_init)
-               mptcp_rcv_space_init(msk, ssk);
 
        if (sk->sk_state == TCP_SYN_SENT) {
                /* subflow->idsn is always available is TCP_SYN_SENT state,