protocol.c (3c69a99b62fde9de86a612ef1daaa07d95f0a773) protocol.c (02739545951ad4c1215160db7fbf9b7a918d3c0b)
1// SPDX-License-Identifier: GPL-2.0
2/* Multipath TCP
3 *
4 * Copyright (c) 2017 - 2019, Intel Corporation.
5 */
6
7#define pr_fmt(fmt) "MPTCP: " fmt
8

--- 1894 unchanged lines hidden (view full) ---

1903
1904 msk->rcvq_space.rtt_us = rtt_us;
1905 if (time < (rtt_us >> 3) || rtt_us == 0)
1906 return;
1907
1908 if (msk->rcvq_space.copied <= msk->rcvq_space.space)
1909 goto new_measure;
1910
1// SPDX-License-Identifier: GPL-2.0
2/* Multipath TCP
3 *
4 * Copyright (c) 2017 - 2019, Intel Corporation.
5 */
6
7#define pr_fmt(fmt) "MPTCP: " fmt
8

--- 1894 unchanged lines hidden (view full) ---

1903
1904 msk->rcvq_space.rtt_us = rtt_us;
1905 if (time < (rtt_us >> 3) || rtt_us == 0)
1906 return;
1907
1908 if (msk->rcvq_space.copied <= msk->rcvq_space.space)
1909 goto new_measure;
1910
1911 if (sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf &&
1911 if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) &&
1912 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {
1913 int rcvmem, rcvbuf;
1914 u64 rcvwin, grow;
1915
1916 rcvwin = ((u64)msk->rcvq_space.copied << 1) + 16 * advmss;
1917
1918 grow = rcvwin * (msk->rcvq_space.copied - msk->rcvq_space.space);
1919
1920 do_div(grow, msk->rcvq_space.space);
1921 rcvwin += (grow << 1);
1922
1923 rcvmem = SKB_TRUESIZE(advmss + MAX_TCP_HEADER);
1924 while (tcp_win_from_space(sk, rcvmem) < advmss)
1925 rcvmem += 128;
1926
1927 do_div(rcvwin, advmss);
1928 rcvbuf = min_t(u64, rcvwin * rcvmem,
1912 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) {
1913 int rcvmem, rcvbuf;
1914 u64 rcvwin, grow;
1915
1916 rcvwin = ((u64)msk->rcvq_space.copied << 1) + 16 * advmss;
1917
1918 grow = rcvwin * (msk->rcvq_space.copied - msk->rcvq_space.space);
1919
1920 do_div(grow, msk->rcvq_space.space);
1921 rcvwin += (grow << 1);
1922
1923 rcvmem = SKB_TRUESIZE(advmss + MAX_TCP_HEADER);
1924 while (tcp_win_from_space(sk, rcvmem) < advmss)
1925 rcvmem += 128;
1926
1927 do_div(rcvwin, advmss);
1928 rcvbuf = min_t(u64, rcvwin * rcvmem,
1929 sock_net(sk)->ipv4.sysctl_tcp_rmem[2]);
1929 READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2]));
1930
1931 if (rcvbuf > sk->sk_rcvbuf) {
1932 u32 window_clamp;
1933
1934 window_clamp = tcp_win_from_space(sk, rcvbuf);
1935 WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
1936
1937 /* Make subflows follow along. If we do not do this, we

--- 726 unchanged lines hidden (view full) ---

2664 return ret;
2665
2666 /* fetch the ca name; do it outside __mptcp_init_sock(), so that clone will
2667 * propagate the correct value
2668 */
2669 mptcp_ca_reset(sk);
2670
2671 sk_sockets_allocated_inc(sk);
1930
1931 if (rcvbuf > sk->sk_rcvbuf) {
1932 u32 window_clamp;
1933
1934 window_clamp = tcp_win_from_space(sk, rcvbuf);
1935 WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
1936
1937 /* Make subflows follow along. If we do not do this, we

--- 726 unchanged lines hidden (view full) ---

2664 return ret;
2665
2666 /* fetch the ca name; do it outside __mptcp_init_sock(), so that clone will
2667 * propagate the correct value
2668 */
2669 mptcp_ca_reset(sk);
2670
2671 sk_sockets_allocated_inc(sk);
2672 sk->sk_rcvbuf = sock_net(sk)->ipv4.sysctl_tcp_rmem[1];
2673 sk->sk_sndbuf = sock_net(sk)->ipv4.sysctl_tcp_wmem[1];
2672 sk->sk_rcvbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[1]);
2673 sk->sk_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[1]);
2674
2675 return 0;
2676}
2677
2678static void __mptcp_clear_xmit(struct sock *sk)
2679{
2680 struct mptcp_sock *msk = mptcp_sk(sk);
2681 struct mptcp_data_frag *dtmp, *dfrag;

--- 1196 unchanged lines hidden ---
2674
2675 return 0;
2676}
2677
2678static void __mptcp_clear_xmit(struct sock *sk)
2679{
2680 struct mptcp_sock *msk = mptcp_sk(sk);
2681 struct mptcp_data_frag *dtmp, *dfrag;

--- 1196 unchanged lines hidden ---