Hi,

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.

I would like to move to milliseconds and merge them eventually.
This makes it easier to see the actual values.

Let's get rid of some easy ticks and hz.

ok?

bluhm

Index: netinet/tcp_timer.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_timer.c,v
retrieving revision 1.63
diff -u -p -r1.63 tcp_timer.c
--- netinet/tcp_timer.c 6 Feb 2018 15:13:08 -0000       1.63
+++ netinet/tcp_timer.c 6 Feb 2018 15:47:06 -0000
@@ -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;
 }
 
 /*
Index: netinet/tcp_timer.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_timer.h,v
retrieving revision 1.16
diff -u -p -r1.16 tcp_timer.h
--- netinet/tcp_timer.h 6 Feb 2018 15:13:08 -0000       1.16
+++ netinet/tcp_timer.h 6 Feb 2018 15:47:06 -0000
@@ -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 */
Index: netinet/tcp_var.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_var.h,v
retrieving revision 1.130
diff -u -p -r1.130 tcp_var.h
--- netinet/tcp_var.h   6 Feb 2018 15:13:08 -0000       1.130
+++ netinet/tcp_var.h   6 Feb 2018 15:47:06 -0000
@@ -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 {                                                                   \

Reply via email to