diff options
author | Eric Dumazet <edumazet@google.com> | 2017-11-03 09:09:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-11-05 08:14:23 -0500 |
commit | d0f36847016276920d860d5c089934ff3fea7e30 (patch) | |
tree | bb970e4fdaa4fbc92de0c39ed6edd4db823dcdc8 /net/ipv4/tcp_timer.c | |
parent | f21506cb42112b1c0b391dae7a700e69a42128e8 (diff) |
tcp: tcp_mtu_probing() cleanup
Reduce one indentation level to make code more readable.
tcp_sync_mss() can be factorized.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r-- | net/ipv4/tcp_timer.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 035a1ef1f2d8..16df6dd44b98 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -107,26 +107,23 @@ static int tcp_orphan_retries(struct sock *sk, bool alive) | |||
107 | 107 | ||
108 | static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk) | 108 | static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk) |
109 | { | 109 | { |
110 | struct net *net = sock_net(sk); | 110 | const struct net *net = sock_net(sk); |
111 | int mss; | ||
111 | 112 | ||
112 | /* Black hole detection */ | 113 | /* Black hole detection */ |
113 | if (net->ipv4.sysctl_tcp_mtu_probing) { | 114 | if (!net->ipv4.sysctl_tcp_mtu_probing) |
114 | if (!icsk->icsk_mtup.enabled) { | 115 | return; |
115 | icsk->icsk_mtup.enabled = 1; | 116 | |
116 | icsk->icsk_mtup.probe_timestamp = tcp_jiffies32; | 117 | if (!icsk->icsk_mtup.enabled) { |
117 | tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); | 118 | icsk->icsk_mtup.enabled = 1; |
118 | } else { | 119 | icsk->icsk_mtup.probe_timestamp = tcp_jiffies32; |
119 | struct net *net = sock_net(sk); | 120 | } else { |
120 | struct tcp_sock *tp = tcp_sk(sk); | 121 | mss = tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_low) >> 1; |
121 | int mss; | 122 | mss = min(net->ipv4.sysctl_tcp_base_mss, mss); |
122 | 123 | mss = max(mss, 68 - tcp_sk(sk)->tcp_header_len); | |
123 | mss = tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_low) >> 1; | 124 | icsk->icsk_mtup.search_low = tcp_mss_to_mtu(sk, mss); |
124 | mss = min(net->ipv4.sysctl_tcp_base_mss, mss); | ||
125 | mss = max(mss, 68 - tp->tcp_header_len); | ||
126 | icsk->icsk_mtup.search_low = tcp_mss_to_mtu(sk, mss); | ||
127 | tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); | ||
128 | } | ||
129 | } | 125 | } |
126 | tcp_sync_mss(sk, icsk->icsk_pmtu_cookie); | ||
130 | } | 127 | } |
131 | 128 | ||
132 | 129 | ||