diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 6f9e116598edb5..3ef6368e26f6b1 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2758,6 +2758,8 @@ static void __mptcp_init_sock(struct sock *sk) msk->rmem_fwd_alloc = 0; WRITE_ONCE(msk->rmem_released, 0); msk->timer_ival = TCP_RTO_MIN; + msk->scaling_ratio = (1200 << TCP_RMEM_TO_WIN_SCALE) / + SKB_TRUESIZE(4096); WRITE_ONCE(msk->first, NULL); inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss; diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index 340e87195a2708..6b37946b5c520b 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -1473,6 +1473,7 @@ void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk) */ int mptcp_set_rcvlowat(struct sock *sk, int val) { + struct mptcp_subflow_context *subflow; int space, cap; if (sk->sk_userlocks & SOCK_RCVBUF_LOCK) @@ -1490,9 +1491,19 @@ int mptcp_set_rcvlowat(struct sock *sk, int val) return 0; space = __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, val); - if (space > sk->sk_rcvbuf) { - WRITE_ONCE(sk->sk_rcvbuf, space); - tcp_sk(sk)->window_clamp = val; + if (space <= sk->sk_rcvbuf) + return 0; + + /* propagate the rcvbuf changes to all the subflows */ + WRITE_ONCE(sk->sk_rcvbuf, space); + mptcp_for_each_subflow(mptcp_sk(sk), subflow) { + struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + bool slow; + + slow = lock_sock_fast(ssk); + WRITE_ONCE(ssk->sk_rcvbuf, space); + tcp_sk(ssk)->window_clamp = val; + unlock_sock_fast(ssk, slow); } return 0; }