summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2018-02-07 00:31:11 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2018-02-07 00:31:11 +0000
commit88097c659d9054f852fff3a68375a79c345c7822 (patch)
tree3e1dc6384f32b724797ef22d8e7d1b35ee204a9b
parent57b80dd8cd9a6b27ad0b5a1e837d4d892df5d860 (diff)
Historically TCP timeouts were implemented with pr_slowtimo and
pr_fasttimo. That is the reason why we have two timeout mechanisms with complicated ticks calculation. Move the delay ACK timeout to milliseconds and remove some ticks and hz mess from the others. This makes it easier to see the actual values. OK florian@ dhill@ dlg@
-rw-r--r--sys/netinet/tcp_timer.c8
-rw-r--r--sys/netinet/tcp_timer.h7
-rw-r--r--sys/netinet/tcp_var.h5
3 files changed, 10 insertions, 10 deletions
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 5c16bd04ab7..b8ac1ac8087 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_timer.c,v 1.63 2018/02/06 15:13:08 bluhm Exp $ */
+/* $OpenBSD: tcp_timer.c,v 1.64 2018/02/07 00:31:10 bluhm Exp $ */
/* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */
/*
@@ -64,7 +64,7 @@ int tcp_maxidle;
* Time to delay the ACK. This is initialized in tcp_init(), unless
* its patched.
*/
-int tcp_delack_ticks;
+int tcp_delack_msecs;
void tcp_timer_rexmt(void *);
void tcp_timer_persist(void *);
@@ -96,8 +96,8 @@ tcp_timer_init(void)
if (tcp_maxpersistidle == 0)
tcp_maxpersistidle = TCPTV_KEEP_IDLE;
- if (tcp_delack_ticks == 0)
- tcp_delack_ticks = TCP_DELACK_TICKS;
+ if (tcp_delack_msecs == 0)
+ tcp_delack_msecs = TCP_DELACK_MSECS;
}
/*
diff --git a/sys/netinet/tcp_timer.h b/sys/netinet/tcp_timer.h
index 966b533e7e3..6d685649647 100644
--- a/sys/netinet/tcp_timer.h
+++ b/sys/netinet/tcp_timer.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_timer.h,v 1.16 2018/02/06 15:13:08 bluhm Exp $ */
+/* $OpenBSD: tcp_timer.h,v 1.17 2018/02/07 00:31:10 bluhm Exp $ */
/* $NetBSD: tcp_timer.h,v 1.6 1995/03/26 20:32:37 jtc Exp $ */
/*
@@ -106,7 +106,7 @@
#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */
-#define TCP_DELACK_TICKS (hz / PR_FASTHZ) /* time to delay ACK */
+#define TCP_DELACK_MSECS 200 /* time to delay ACK */
#ifdef TCPTIMERS
const char *tcptimers[TCPT_NTIMERS] =
@@ -122,7 +122,7 @@ const char *tcptimers[TCPT_NTIMERS] =
#define TCP_TIMER_ARM(tp, timer, nticks) \
do { \
SET((tp)->t_flags, TF_TIMER << (timer)); \
- timeout_add(&(tp)->t_timer[(timer)], (nticks) * (hz / PR_SLOWHZ)); \
+ timeout_add_msec(&(tp)->t_timer[(timer)], (nticks) * 500); \
} while (0)
#define TCP_TIMER_DISARM(tp, timer) \
@@ -151,6 +151,7 @@ typedef void (*tcp_timer_func_t)(void *);
extern const tcp_timer_func_t tcp_timer_funcs[TCPT_NTIMERS];
+extern int tcp_delack_msecs; /* delayed ACK timeout in millisecs */
extern int tcptv_keep_init;
extern int tcp_always_keepalive; /* assume SO_KEEPALIVE is always set */
extern int tcp_keepidle; /* time before keepalive probes begin */
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index eb6d3ac2a7b..0ad9b2444f4 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.130 2018/02/06 15:13:08 bluhm Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.131 2018/02/07 00:31:10 bluhm Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -205,14 +205,13 @@ struct tcpcb {
#define sototcpcb(so) (intotcpcb(sotoinpcb(so)))
#ifdef _KERNEL
-extern int tcp_delack_ticks;
void tcp_delack(void *);
#define TCP_INIT_DELACK(tp) \
timeout_set_proc(&(tp)->t_delack_to, tcp_delack, tp)
#define TCP_RESTART_DELACK(tp) \
- timeout_add(&(tp)->t_delack_to, tcp_delack_ticks)
+ timeout_add_msec(&(tp)->t_delack_to, tcp_delack_msecs)
#define TCP_SET_DELACK(tp) \
do { \