diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c --- a/sys/netinet/in_proto.c +++ b/sys/netinet/in_proto.c @@ -131,7 +131,6 @@ .pr_flags = PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD| PR_CAPATTACH, .pr_ctloutput = tcp_ctloutput, - .pr_slowtimo = tcp_slowtimo, .pr_drain = tcp_drain, .pr_usrreqs = &tcp_usrreqs }, diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -233,15 +233,17 @@ } /* - * Tcp protocol timeout routine called every 500 ms. - * Updates timestamps used for TCP - * causes finite state machine actions if timers expire. + * Legacy TCP global callout routine called every 500 ms. + * Used to cleanup timewait states, which lack their own callouts. */ -void -tcp_slowtimo(void) +static struct callout tcpslow_callout; +static void +tcp_slowtimo(void *arg __unused) { + struct epoch_tracker et; VNET_ITERATOR_DECL(vnet_iter); + NET_EPOCH_ENTER(et); VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); @@ -249,7 +251,21 @@ CURVNET_RESTORE(); } VNET_LIST_RUNLOCK_NOSLEEP(); + NET_EPOCH_EXIT(et); + + callout_reset_sbt(&tcpslow_callout, SBT_1MS * 500, SBT_1MS * 10, + tcp_slowtimo, NULL, 0); +} + +static void +tcp_slowtimo_init(void *arg __unused) +{ + + callout_init(&tcpslow_callout, 1); + callout_reset_sbt(&tcpslow_callout, SBT_1MS * 500, SBT_1MS * 10, + tcp_slowtimo, NULL, 0); } +SYSINIT(tcp_timer, SI_SUB_VNET_DONE, SI_ORDER_ANY, tcp_slowtimo_init, NULL); int tcp_backoff[TCP_MAXRXTSHIFT + 1] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, 512, 512 }; diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1187,7 +1187,6 @@ int tcp_twcheck(struct inpcb *, struct tcpopt *, struct tcphdr *, struct mbuf *, int); void tcp_setpersist(struct tcpcb *); -void tcp_slowtimo(void); void tcp_record_dsack(struct tcpcb *tp, tcp_seq start, tcp_seq end, int tlp); struct tcptemp * tcpip_maketemplate(struct inpcb *); diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -166,7 +166,6 @@ PR_LISTEN|PR_CAPATTACH, .pr_ctloutput = tcp_ctloutput, #ifndef INET /* don't call initialization, timeout, and drain routines twice */ - .pr_slowtimo = tcp_slowtimo, .pr_drain = tcp_drain, #endif .pr_usrreqs = &tcp6_usrreqs,