aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r--net/ipv4/tcp_timer.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 388158c9d9f6..71fc60f1b326 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -198,11 +198,6 @@ static int tcp_write_timeout(struct sock *sk)
198 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { 198 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) {
199 if (icsk->icsk_retransmits) { 199 if (icsk->icsk_retransmits) {
200 dst_negative_advice(sk); 200 dst_negative_advice(sk);
201 if (tp->syn_fastopen || tp->syn_data)
202 tcp_fastopen_cache_set(sk, 0, NULL, true, 0);
203 if (tp->syn_data && icsk->icsk_retransmits == 1)
204 NET_INC_STATS(sock_net(sk),
205 LINUX_MIB_TCPFASTOPENACTIVEFAIL);
206 } else if (!tp->syn_data && !tp->syn_fastopen) { 201 } else if (!tp->syn_data && !tp->syn_fastopen) {
207 sk_rethink_txhash(sk); 202 sk_rethink_txhash(sk);
208 } 203 }
@@ -210,17 +205,6 @@ static int tcp_write_timeout(struct sock *sk)
210 expired = icsk->icsk_retransmits >= retry_until; 205 expired = icsk->icsk_retransmits >= retry_until;
211 } else { 206 } else {
212 if (retransmits_timed_out(sk, net->ipv4.sysctl_tcp_retries1, 0)) { 207 if (retransmits_timed_out(sk, net->ipv4.sysctl_tcp_retries1, 0)) {
213 /* Some middle-boxes may black-hole Fast Open _after_
214 * the handshake. Therefore we conservatively disable
215 * Fast Open on this path on recurring timeouts after
216 * successful Fast Open.
217 */
218 if (tp->syn_data_acked) {
219 tcp_fastopen_cache_set(sk, 0, NULL, true, 0);
220 if (icsk->icsk_retransmits == net->ipv4.sysctl_tcp_retries1)
221 NET_INC_STATS(sock_net(sk),
222 LINUX_MIB_TCPFASTOPENACTIVEFAIL);
223 }
224 /* Black hole detection */ 208 /* Black hole detection */
225 tcp_mtu_probing(icsk, sk); 209 tcp_mtu_probing(icsk, sk);
226 210
@@ -243,11 +227,19 @@ static int tcp_write_timeout(struct sock *sk)
243 expired = retransmits_timed_out(sk, retry_until, 227 expired = retransmits_timed_out(sk, retry_until,
244 icsk->icsk_user_timeout); 228 icsk->icsk_user_timeout);
245 } 229 }
230 tcp_fastopen_active_detect_blackhole(sk, expired);
231
232 if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_RTO_CB_FLAG))
233 tcp_call_bpf_3arg(sk, BPF_SOCK_OPS_RTO_CB,
234 icsk->icsk_retransmits,
235 icsk->icsk_rto, (int)expired);
236
246 if (expired) { 237 if (expired) {
247 /* Has it gone just too far? */ 238 /* Has it gone just too far? */
248 tcp_write_err(sk); 239 tcp_write_err(sk);
249 return 1; 240 return 1;
250 } 241 }
242
251 return 0; 243 return 0;
252} 244}
253 245