Module Name: src Committed By: dyoung Date: Fri Jun 3 17:11:34 UTC 2011
Modified Files: src/sys/netinet: tcp_vtw.c Log Message: Defer scheduling vtw_tick() and setting the vtw hooks until vtw_control() is called. In this way, vtw_tick() will be re-scheduled repeatedly while vtw is in use. Pay tcp_vtw_was_enabled no attention in vtw_earlyinit(), since it's always going to be 0 during initialization. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/netinet/tcp_vtw.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/tcp_vtw.c diff -u src/sys/netinet/tcp_vtw.c:1.4 src/sys/netinet/tcp_vtw.c:1.5 --- src/sys/netinet/tcp_vtw.c:1.4 Tue May 17 05:42:40 2011 +++ src/sys/netinet/tcp_vtw.c Fri Jun 3 17:11:34 2011 @@ -77,7 +77,7 @@ #include <machine/stdarg.h> #include <netinet/tcp_vtw.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_vtw.c,v 1.4 2011/05/17 05:42:40 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_vtw.c,v 1.5 2011/06/03 17:11:34 dyoung Exp $"); #define db_trace(__a, __b) do { } while (/*CONSTCOND*/0) @@ -1826,6 +1826,16 @@ if (!fat->base || !ctl->base.v) return NULL; + if (!tcp_vtw_was_enabled) { + /* This guarantees is timer ticks until we no longer need them. + */ + tcp_vtw_was_enabled = 1; + + callout_schedule(&vtw_cs, hz / 5); + + tcbtable.vestige = &tcp_hooks; + } + return ctl + class; } @@ -2120,25 +2130,14 @@ int vtw_earlyinit(void) { - int rc; - - if (!tcp_vtw_was_enabled) { - int i; - - /* This guarantees is timer ticks until we no longer need them. - */ - tcp_vtw_was_enabled = 1; + int i, rc; - callout_init(&vtw_cs, 0); - callout_setfunc(&vtw_cs, vtw_tick, 0); - callout_schedule(&vtw_cs, hz / 5); - - for (i = 0; i < VTW_NCLASS; ++i) { - vtw_tcpv4[i].is_v4 = 1; - vtw_tcpv6[i].is_v6 = 1; - } + callout_init(&vtw_cs, 0); + callout_setfunc(&vtw_cs, vtw_tick, 0); - tcbtable.vestige = &tcp_hooks; + for (i = 0; i < VTW_NCLASS; ++i) { + vtw_tcpv4[i].is_v4 = 1; + vtw_tcpv6[i].is_v6 = 1; } if ((rc = vtw_control_init(AF_INET)) != 0 ||