Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Initialize TCP timer variables in a new function...



details:   https://anonhg.NetBSD.org/src/rev/37acba124317
branches:  trunk
changeset: 514799:37acba124317
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Sep 10 20:36:43 2001 +0000

description:
Initialize TCP timer variables in a new function, tcp_timer_init().

diffstat:

 sys/netinet/tcp_subr.c  |   8 ++++----
 sys/netinet/tcp_timer.c |  39 +++++++++++++++++++++++++++++++++------
 sys/netinet/tcp_timer.h |   5 ++++-
 3 files changed, 41 insertions(+), 11 deletions(-)

diffs (111 lines):

diff -r fc4d11f3b92f -r 37acba124317 sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c    Mon Sep 10 20:19:54 2001 +0000
+++ b/sys/netinet/tcp_subr.c    Mon Sep 10 20:36:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_subr.c,v 1.116 2001/09/10 20:19:54 thorpej Exp $   */
+/*     $NetBSD: tcp_subr.c,v 1.117 2001/09/10 20:36:43 thorpej Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -240,9 +240,6 @@
        tcb6.in6p_next = tcb6.in6p_prev = &tcb6;
 #endif
 
-       if (tcp_delack_ticks == 0)
-               tcp_delack_ticks = TCP_DELACK_TICKS;
-
        hlen = sizeof(struct ip) + sizeof(struct tcphdr);
 #ifdef INET6
        if (sizeof(struct ip) < sizeof(struct ip6_hdr))
@@ -260,6 +257,9 @@
        icmp6_mtudisc_callback_register(tcp6_mtudisc_callback);
 #endif
 
+       /* Initialize timer state. */
+       tcp_timer_init();
+
        /* Initialize the compressed state engine. */
        syn_cache_init();
 
diff -r fc4d11f3b92f -r 37acba124317 sys/netinet/tcp_timer.c
--- a/sys/netinet/tcp_timer.c   Mon Sep 10 20:19:54 2001 +0000
+++ b/sys/netinet/tcp_timer.c   Mon Sep 10 20:36:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_timer.c,v 1.51 2001/09/10 20:15:14 thorpej Exp $   */
+/*     $NetBSD: tcp_timer.c,v 1.52 2001/09/10 20:36:43 thorpej Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -141,11 +141,15 @@
 #include <netinet/tcp_debug.h>
 #endif
 
-int    tcp_keepidle = TCPTV_KEEP_IDLE;
-int    tcp_keepintvl = TCPTV_KEEPINTVL;
-int    tcp_keepcnt = TCPTV_KEEPCNT;            /* max idle probes */
-int    tcp_maxpersistidle = TCPTV_KEEP_IDLE;   /* max idle time in persist */
-int    tcp_maxidle;
+/*
+ * Various tunable timer parameters.  These are initialized in tcp_init(),
+ * unless they are patched.
+ */
+int    tcp_keepidle = 0;
+int    tcp_keepintvl = 0;
+int    tcp_keepcnt = 0;                /* max idle probes */
+int    tcp_maxpersistidle = 0;         /* max idle time in persist */
+int    tcp_maxidle;                    /* computed in tcp_slowtimo() */
 
 /*
  * Time to delay the ACK.  This is initialized in tcp_init(), unless
@@ -166,6 +170,29 @@
 };
 
 /*
+ * Timer state initialization, called from tcp_init().
+ */
+void
+tcp_timer_init(void)
+{
+
+       if (tcp_keepidle == 0)
+               tcp_keepidle = TCPTV_KEEP_IDLE;
+
+       if (tcp_keepintvl == 0)
+               tcp_keepintvl = TCPTV_KEEPINTVL;
+
+       if (tcp_keepcnt == 0)
+               tcp_keepcnt = TCPTV_KEEPCNT;
+
+       if (tcp_maxpersistidle == 0)
+               tcp_maxpersistidle = TCPTV_KEEP_IDLE;
+
+       if (tcp_delack_ticks == 0)
+               tcp_delack_ticks = TCP_DELACK_TICKS;
+}
+
+/*
  * Callout to process delayed ACKs for a TCPCB.
  */
 void
diff -r fc4d11f3b92f -r 37acba124317 sys/netinet/tcp_timer.h
--- a/sys/netinet/tcp_timer.h   Mon Sep 10 20:19:54 2001 +0000
+++ b/sys/netinet/tcp_timer.h   Mon Sep 10 20:36:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_timer.h,v 1.13 2001/09/10 20:19:54 thorpej Exp $   */
+/*     $NetBSD: tcp_timer.h,v 1.14 2001/09/10 20:36:43 thorpej Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -152,9 +152,12 @@
 extern int tcp_keepidle;               /* time before keepalive probes begin */
 extern int tcp_keepintvl;              /* time between keepalive probes */
 extern int tcp_keepcnt;                        /* number of keepalives, 0=infty */
+extern int tcp_maxpersistidle;         /* max idle time in persist */
 extern int tcp_maxidle;                        /* time to drop after starting probes */
 extern int tcp_ttl;                    /* time to live for TCP segs */
 extern int tcp_backoff[];
+
+void   tcp_timer_init(void);
 #endif
 
 #endif /* _NETINET_TCP_TIMER_H_ */



Home | Main Index | Thread Index | Old Index