Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Defer scheduling vtw_tick() and setting the vtw ...



details:   https://anonhg.NetBSD.org/src/rev/6a6a9316c609
branches:  trunk
changeset: 765715:6a6a9316c609
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Fri Jun 03 17:11:34 2011 +0000

description:
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.

diffstat:

 sys/netinet/tcp_vtw.c |  39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)

diffs (63 lines):

diff -r efb2a12a44f5 -r 6a6a9316c609 sys/netinet/tcp_vtw.c
--- a/sys/netinet/tcp_vtw.c     Fri Jun 03 17:03:52 2011 +0000
+++ b/sys/netinet/tcp_vtw.c     Fri Jun 03 17:11:34 2011 +0000
@@ -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;
-
-               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;
-               }
-
-               tcbtable.vestige = &tcp_hooks;
+       int i, rc;
+
+       callout_init(&vtw_cs, 0);
+       callout_setfunc(&vtw_cs, vtw_tick, 0);
+
+       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 || 



Home | Main Index | Thread Index | Old Index