summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_timer.h
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-03-08 03:49:59 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-03-08 03:49:59 +0000
commit9b09c9e18ad5231f2173323c6bcd2f1df26a4f81 (patch)
treea4bcf043e4a4ef0f97c84a071e496a6c55ba1af2 /sys/netinet/tcp_timer.h
parentbfd6cab07ebbe219670eb8f3c2903f2290a508c2 (diff)
use timeout(9) to schedule TCP timers. this avoid traversing all
tcp connections during tcp_slowtimo. apdapted from thorpej@netbsd.org
Diffstat (limited to 'sys/netinet/tcp_timer.h')
-rw-r--r--sys/netinet/tcp_timer.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/netinet/tcp_timer.h b/sys/netinet/tcp_timer.h
index 03523dd8f31..d6e7b0a30a9 100644
--- a/sys/netinet/tcp_timer.h
+++ b/sys/netinet/tcp_timer.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_timer.h,v 1.7 2002/03/01 22:29:29 provos Exp $ */
+/* $OpenBSD: tcp_timer.h,v 1.8 2002/03/08 03:49:58 provos Exp $ */
/* $NetBSD: tcp_timer.h,v 1.6 1995/03/26 20:32:37 jtc Exp $ */
/*
@@ -120,16 +120,16 @@ char *tcptimers[] =
* Init, arm, disarm, and test TCP timers.
*/
#define TCP_TIMER_INIT(tp, timer) \
- (tp)->t_timer[(timer)] = 0
+ timeout_set(&(tp)->t_timer[(timer)], tcp_timer_funcs[(timer)], tp)
#define TCP_TIMER_ARM(tp, timer, nticks) \
- (tp)->t_timer[(timer)] = (nticks)
+ timeout_add(&(tp)->t_timer[(timer)], (nticks) * (hz / PR_SLOWHZ))
#define TCP_TIMER_DISARM(tp, timer) \
- (tp)->t_timer[(timer)] = 0
+ timeout_del(&(tp)->t_timer[(timer)])
#define TCP_TIMER_ISARMED(tp, timer) \
- (tp)->t_timer[(timer)]
+ timeout_pending(&(tp)->t_timer[(timer)])
/*
* Force a time value to be in a certain range.
@@ -143,6 +143,10 @@ char *tcptimers[] =
}
#ifdef _KERNEL
+typedef void (*tcp_timer_func_t)(void *);
+
+extern const tcp_timer_func_t tcp_timer_funcs[TCPT_NTIMERS];
+
extern int tcptv_keep_init;
extern int tcp_keepidle; /* time before keepalive probes begin */
extern int tcp_keepintvl; /* time between keepalive probes */