Annotation of cci/sys/netinet/tcp_timer.h, revision 1.1.1.2

1.1       root        1: /*     tcp_timer.h     6.1     83/07/29        */
                      2: 
                      3: /*
                      4:  * Definitions of the TCP timers.  These timers are counted
                      5:  * down PR_SLOWHZ times a second.
                      6:  */
                      7: #define        TCPT_NTIMERS    4
                      8: 
                      9: #define        TCPT_REXMT      0               /* retransmit */
                     10: #define        TCPT_PERSIST    1               /* retransmit persistance */
                     11: #define        TCPT_KEEP       2               /* keep alive */
                     12: #define        TCPT_2MSL       3               /* 2*msl quiet time timer */
                     13: 
                     14: /*
                     15:  * The TCPT_REXMT timer is used to force retransmissions.
                     16:  * The TCP has the TCPT_REXMT timer set whenever segments
                     17:  * have been sent for which ACKs are expected but not yet
                     18:  * received.  If an ACK is received which advances tp->snd_una,
                     19:  * then the retransmit timer is cleared (if there are no more
                     20:  * outstanding segments) or reset to the base value (if there
                     21:  * are more ACKs expected).  Whenever the retransmit timer goes off,
                     22:  * we retransmit all unacknowledged segments, and do an exponential
                     23:  * backoff on the retransmit timer.
                     24:  *
                     25:  * The TCPT_PERSIST timer is used to keep window size information
                     26:  * flowing even if the window goes shut.  If all previous transmissions
                     27:  * have been acknowledged (so that there are no retransmissions in progress),
                     28:  * and the window is shut, then we start the TCPT_PERSIST timer, and at
                     29:  * intervals send a single byte into the peers window to force him to update
                     30:  * our window information.  We do this at most as often as TCPT_PERSMIN
                     31:  * time intervals, but no more frequently than the current estimate of
                     32:  * round-trip packet time.  The TCPT_PERSIST timer is cleared whenever
                     33:  * we receive a window update from the peer.
                     34:  *
                     35:  * The TCPT_KEEP timer is used to keep connections alive.  If an
                     36:  * connection is idle (no segments received) for TCPTV_KEEP amount of time,
                     37:  * but not yet established, then we drop the connection.  If the connection
                     38:  * is established, then we force the peer to send us a segment by sending:
                     39:  *     <SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK>
                     40:  * This segment is (deliberately) outside the window, and should elicit
                     41:  * an ack segment in response from the peer.  If, despite the TCPT_KEEP
                     42:  * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE
                     43:  * amount of time, then we drop the connection.
                     44:  */
                     45: 
1.1.1.2 ! root       46: #define        TCP_TTL         50              /* time to live for TCP segs */
1.1       root       47: /*
                     48:  * Time constants.
                     49:  */
                     50: #define        TCPTV_MSL       ( 30*PR_SLOWHZ)         /* max seg lifetime */
                     51: #define        TCPTV_SRTTBASE  (  1*PR_SLOWHZ)         /* base roundtrip time */
1.1.1.2 ! root       52: #define        TCPTV_KEEP      ( 60*PR_SLOWHZ)         /* keep alive - Was 45 secs */
1.1       root       53: #define        TCPTV_PERSMIN   (  5*PR_SLOWHZ)         /* retransmit persistance */
                     54: 
                     55: #define        TCPTV_MAXIDLE   (  8*TCPTV_KEEP)        /* maximum allowable idle
                     56:                                                   time before drop conn */
                     57: 
1.1.1.2 ! root       58: /*     Too small for slower interface with multiple sessions
        !            59: #define        TCPTV_MIN       (  1*PR_SLOWHZ)         /* minimum allowable value
        !            60: */
        !            61: #define        TCPTV_MIN       (  2*PR_SLOWHZ)         /* minimum allowable value */
1.1       root       62: #define        TCPTV_MAX       ( 30*PR_SLOWHZ)         /* maximum allowable value */
                     63: 
                     64: #define        TCP_LINGERTIME  120                     /* linger at most 2 minutes */
                     65: 
                     66: #define        TCP_MAXRXTSHIFT 10                      /* maximum retransmits */
                     67: 
                     68: #ifdef TCPTIMERS
                     69: char *tcptimers[] =
                     70:     { "REXMT", "PERSIST", "KEEP", "2MSL" };
                     71: #endif
                     72: 
                     73: /*
                     74:  * Retransmission smoothing constants.
                     75:  * Smoothed round trip time is updated by
                     76:  *    tp->t_srtt = (tcp_alpha * tp->t_srtt) + ((1 - tcp_alpha) * tp->t_rtt)
                     77:  * each time a new value of tp->t_rtt is available.  The initial
                     78:  * retransmit timeout is then based on
                     79:  *    tp->t_timer[TCPT_REXMT] = tcp_beta * tp->t_srtt;
                     80:  * limited, however to be at least TCPTV_REXMTLO and at most TCPTV_REXMTHI.
                     81:  */
                     82: float  tcp_alpha, tcp_beta;
                     83: 
                     84: /*
                     85:  * Initial values of tcp_alpha and tcp_beta.
                     86:  * These are conservative: averaging over a long
                     87:  * period of time, and allowing for large individual deviations from
                     88:  * tp->t_srtt.
                     89:  */
                     90: #define        TCP_ALPHA       0.9
                     91: #define        TCP_BETA        2.0
                     92: 
                     93: /*
                     94:  * Force a time value to be in a certain range.
                     95:  */
                     96: #define        TCPT_RANGESET(tv, value, tvmin, tvmax) { \
                     97:        (tv) = (value); \
                     98:        if ((tv) < (tvmin)) \
                     99:                (tv) = (tvmin); \
                    100:        if ((tv) > (tvmax)) \
                    101:                (tv) = (tvmax); \
                    102: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.