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