Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/tcp_fastopen: Add snmp counter for blackhole detection

This counter records the number of times the firewall blackhole issue is
detected and active TFO is disabled.

Signed-off-by: Wei Wang <weiwan@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wei Wang and committed by
David S. Miller
46c2fa39 cf1ef3f0

+8 -5
+1 -1
include/net/tcp.h
··· 1507 1507 }; 1508 1508 1509 1509 extern unsigned int sysctl_tcp_fastopen_blackhole_timeout; 1510 - void tcp_fastopen_active_disable(void); 1510 + void tcp_fastopen_active_disable(struct sock *sk); 1511 1511 bool tcp_fastopen_active_should_disable(struct sock *sk); 1512 1512 void tcp_fastopen_active_disable_ofo_check(struct sock *sk); 1513 1513 void tcp_fastopen_active_timeout_reset(void);
+1
include/uapi/linux/snmp.h
··· 259 259 LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */ 260 260 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ 261 261 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ 262 + LINUX_MIB_TCPFASTOPENBLACKHOLE, /* TCPFastOpenBlackholeDetect */ 262 263 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ 263 264 LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */ 264 265 LINUX_MIB_TCPAUTOCORKING, /* TCPAutoCorking */
+1
net/ipv4/proc.c
··· 281 281 SNMP_MIB_ITEM("TCPFastOpenPassiveFail", LINUX_MIB_TCPFASTOPENPASSIVEFAIL), 282 282 SNMP_MIB_ITEM("TCPFastOpenListenOverflow", LINUX_MIB_TCPFASTOPENLISTENOVERFLOW), 283 283 SNMP_MIB_ITEM("TCPFastOpenCookieReqd", LINUX_MIB_TCPFASTOPENCOOKIEREQD), 284 + SNMP_MIB_ITEM("TCPFastOpenBlackhole", LINUX_MIB_TCPFASTOPENBLACKHOLE), 284 285 SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES), 285 286 SNMP_MIB_ITEM("BusyPollRxPackets", LINUX_MIB_BUSYPOLLRXPACKETS), 286 287 SNMP_MIB_ITEM("TCPAutoCorking", LINUX_MIB_TCPAUTOCORKING),
+3 -2
net/ipv4/tcp_fastopen.c
··· 410 410 /* Disable active TFO and record current jiffies and 411 411 * tfo_active_disable_times 412 412 */ 413 - void tcp_fastopen_active_disable(void) 413 + void tcp_fastopen_active_disable(struct sock *sk) 414 414 { 415 415 atomic_inc(&tfo_active_disable_times); 416 416 tfo_active_disable_stamp = jiffies; 417 + NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENBLACKHOLE); 417 418 } 418 419 419 420 /* Reset tfo_active_disable_times to 0 */ ··· 470 469 if (p && !rb_next(p)) { 471 470 skb = rb_entry(p, struct sk_buff, rbnode); 472 471 if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) { 473 - tcp_fastopen_active_disable(); 472 + tcp_fastopen_active_disable(sk); 474 473 return; 475 474 } 476 475 }
+2 -2
net/ipv4/tcp_input.c
··· 5307 5307 */ 5308 5308 if (tp->syn_fastopen && !tp->data_segs_in && 5309 5309 sk->sk_state == TCP_ESTABLISHED) 5310 - tcp_fastopen_active_disable(); 5310 + tcp_fastopen_active_disable(sk); 5311 5311 tcp_send_challenge_ack(sk, skb); 5312 5312 } 5313 5313 goto discard; ··· 6061 6061 after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt)) { 6062 6062 /* Receive out of order FIN after close() */ 6063 6063 if (tp->syn_fastopen && th->fin) 6064 - tcp_fastopen_active_disable(); 6064 + tcp_fastopen_active_disable(sk); 6065 6065 tcp_done(sk); 6066 6066 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONDATA); 6067 6067 return 1;