Commit | Line | Data |
---|---|---|
9d362412 MK |
1 | /* |
2 | * Copyright (c) 1982, 1986, 1988 Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
dbf0c423 | 5 | * %sccs.include.redist.c% |
9d362412 | 6 | * |
dbf0c423 | 7 | * @(#)spp_timer.h 7.3 (Berkeley) %G% |
9d362412 MK |
8 | */ |
9 | ||
10 | /* | |
11 | * Definitions of the SPP timers. These timers are counted | |
12 | * down PR_SLOWHZ times a second. | |
13 | */ | |
14 | #define SPPT_NTIMERS 4 | |
15 | ||
16 | #define SPPT_REXMT 0 /* retransmit */ | |
17 | #define SPPT_PERSIST 1 /* retransmit persistance */ | |
18 | #define SPPT_KEEP 2 /* keep alive */ | |
19 | #define SPPT_2MSL 3 /* 2*msl quiet time timer */ | |
20 | ||
21 | /* | |
22 | * The SPPT_REXMT timer is used to force retransmissions. | |
23 | * The SPP has the SPPT_REXMT timer set whenever segments | |
24 | * have been sent for which ACKs are expected but not yet | |
25 | * received. If an ACK is received which advances tp->snd_una, | |
26 | * then the retransmit timer is cleared (if there are no more | |
27 | * outstanding segments) or reset to the base value (if there | |
28 | * are more ACKs expected). Whenever the retransmit timer goes off, | |
29 | * we retransmit one unacknowledged segment, and do a backoff | |
30 | * on the retransmit timer. | |
31 | * | |
32 | * The SPPT_PERSIST timer is used to keep window size information | |
33 | * flowing even if the window goes shut. If all previous transmissions | |
34 | * have been acknowledged (so that there are no retransmissions in progress), | |
35 | * and the window is too small to bother sending anything, then we start | |
36 | * the SPPT_PERSIST timer. When it expires, if the window is nonzero, | |
37 | * we go to transmit state. Otherwise, at intervals send a single byte | |
38 | * into the peer's window to force him to update our window information. | |
39 | * We do this at most as often as SPPT_PERSMIN time intervals, | |
40 | * but no more frequently than the current estimate of round-trip | |
41 | * packet time. The SPPT_PERSIST timer is cleared whenever we receive | |
42 | * a window update from the peer. | |
43 | * | |
44 | * The SPPT_KEEP timer is used to keep connections alive. If an | |
45 | * connection is idle (no segments received) for SPPTV_KEEP amount of time, | |
46 | * but not yet established, then we drop the connection. If the connection | |
47 | * is established, then we force the peer to send us a segment by sending: | |
48 | * <SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK> | |
49 | * This segment is (deliberately) outside the window, and should elicit | |
50 | * an ack segment in response from the peer. If, despite the SPPT_KEEP | |
51 | * initiated segments we cannot elicit a response from a peer in SPPT_MAXIDLE | |
52 | * amount of time, then we drop the connection. | |
53 | */ | |
54 | ||
55 | #define SPP_TTL 30 /* default time to live for SPP segs */ | |
56 | /* | |
57 | * Time constants. | |
58 | */ | |
59 | #define SPPTV_MSL ( 15*PR_SLOWHZ) /* max seg lifetime */ | |
60 | #define SPPTV_SRTTBASE 0 /* base roundtrip time; | |
61 | if 0, no idea yet */ | |
62 | #define SPPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */ | |
63 | ||
64 | #define SPPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */ | |
65 | #define SPPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */ | |
66 | ||
67 | #define SPPTV_KEEP ( 75*PR_SLOWHZ) /* keep alive - 75 secs */ | |
68 | #define SPPTV_MAXIDLE ( 8*SPPTV_KEEP) /* maximum allowable idle | |
69 | time before drop conn */ | |
70 | ||
71 | #define SPPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */ | |
72 | #define SPPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */ | |
73 | ||
74 | #define SPP_LINGERTIME 120 /* linger at most 2 minutes */ | |
75 | ||
76 | #define SPP_MAXRXTSHIFT 12 /* maximum retransmits */ | |
77 | ||
78 | #ifdef SPPTIMERS | |
79 | char *spptimers[] = | |
80 | { "REXMT", "PERSIST", "KEEP", "2MSL" }; | |
81 | #endif | |
82 | ||
83 | /* | |
84 | * Force a time value to be in a certain range. | |
85 | */ | |
86 | #define SPPT_RANGESET(tv, value, tvmin, tvmax) { \ | |
87 | (tv) = (value); \ | |
88 | if ((tv) < (tvmin)) \ | |
89 | (tv) = (tvmin); \ | |
90 | else if ((tv) > (tvmax)) \ | |
91 | (tv) = (tvmax); \ | |
92 | } | |
93 | ||
94 | #ifdef KERNEL | |
95 | extern int spp_backoff[]; | |
96 | #endif |