tcp_timer.c (130989) | tcp_timer.c (133874) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95 | 1/* 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95 |
30 * $FreeBSD: head/sys/netinet/tcp_timer.c 130989 2004-06-23 21:04:37Z ps $ | 30 * $FreeBSD: head/sys/netinet/tcp_timer.c 133874 2004-08-16 18:32:07Z rwatson $ |
31 */ 32 33#include "opt_inet6.h" 34#include "opt_tcpdebug.h" 35#include "opt_tcp_sack.h" 36 37#include <sys/param.h> 38#include <sys/kernel.h> --- 36 unchanged lines hidden (view full) --- 75 if (error || !req->newptr) 76 return (error); 77 78 tt = (int)((int64_t)s * hz / 1000); 79 if (tt < 1) 80 return (EINVAL); 81 82 *(int *)oidp->oid_arg1 = tt; | 31 */ 32 33#include "opt_inet6.h" 34#include "opt_tcpdebug.h" 35#include "opt_tcp_sack.h" 36 37#include <sys/param.h> 38#include <sys/kernel.h> --- 36 unchanged lines hidden (view full) --- 75 if (error || !req->newptr) 76 return (error); 77 78 tt = (int)((int64_t)s * hz / 1000); 79 if (tt < 1) 80 return (EINVAL); 81 82 *(int *)oidp->oid_arg1 = tt; |
83 return (0); | 83 return (0); |
84} 85 86int tcp_keepinit; 87SYSCTL_PROC(_net_inet_tcp, TCPCTL_KEEPINIT, keepinit, CTLTYPE_INT|CTLFLAG_RW, 88 &tcp_keepinit, 0, sysctl_msec_to_ticks, "I", ""); 89 90int tcp_keepidle; 91SYSCTL_PROC(_net_inet_tcp, TCPCTL_KEEPIDLE, keepidle, CTLTYPE_INT|CTLFLAG_RW, 92 &tcp_keepidle, 0, sysctl_msec_to_ticks, "I", ""); 93 94int tcp_keepintvl; 95SYSCTL_PROC(_net_inet_tcp, TCPCTL_KEEPINTVL, keepintvl, CTLTYPE_INT|CTLFLAG_RW, 96 &tcp_keepintvl, 0, sysctl_msec_to_ticks, "I", ""); 97 98int tcp_delacktime; 99SYSCTL_PROC(_net_inet_tcp, TCPCTL_DELACKTIME, delacktime, 100 CTLTYPE_INT|CTLFLAG_RW, &tcp_delacktime, 0, sysctl_msec_to_ticks, "I", 101 "Time before a delayed ACK is sent"); | 84} 85 86int tcp_keepinit; 87SYSCTL_PROC(_net_inet_tcp, TCPCTL_KEEPINIT, keepinit, CTLTYPE_INT|CTLFLAG_RW, 88 &tcp_keepinit, 0, sysctl_msec_to_ticks, "I", ""); 89 90int tcp_keepidle; 91SYSCTL_PROC(_net_inet_tcp, TCPCTL_KEEPIDLE, keepidle, CTLTYPE_INT|CTLFLAG_RW, 92 &tcp_keepidle, 0, sysctl_msec_to_ticks, "I", ""); 93 94int tcp_keepintvl; 95SYSCTL_PROC(_net_inet_tcp, TCPCTL_KEEPINTVL, keepintvl, CTLTYPE_INT|CTLFLAG_RW, 96 &tcp_keepintvl, 0, sysctl_msec_to_ticks, "I", ""); 97 98int tcp_delacktime; 99SYSCTL_PROC(_net_inet_tcp, TCPCTL_DELACKTIME, delacktime, 100 CTLTYPE_INT|CTLFLAG_RW, &tcp_delacktime, 0, sysctl_msec_to_ticks, "I", 101 "Time before a delayed ACK is sent"); |
102 | 102 |
103int tcp_msl; 104SYSCTL_PROC(_net_inet_tcp, OID_AUTO, msl, CTLTYPE_INT|CTLFLAG_RW, 105 &tcp_msl, 0, sysctl_msec_to_ticks, "I", "Maximum segment lifetime"); 106 107int tcp_rexmit_min; 108SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_min, CTLTYPE_INT|CTLFLAG_RW, 109 &tcp_rexmit_min, 0, sysctl_msec_to_ticks, "I", "Minimum Retransmission Timeout"); 110 111int tcp_rexmit_slop; 112SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_slop, CTLTYPE_INT|CTLFLAG_RW, 113 &tcp_rexmit_slop, 0, sysctl_msec_to_ticks, "I", "Retransmission Timer Slop"); 114 115static int always_keepalive = 1; | 103int tcp_msl; 104SYSCTL_PROC(_net_inet_tcp, OID_AUTO, msl, CTLTYPE_INT|CTLFLAG_RW, 105 &tcp_msl, 0, sysctl_msec_to_ticks, "I", "Maximum segment lifetime"); 106 107int tcp_rexmit_min; 108SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_min, CTLTYPE_INT|CTLFLAG_RW, 109 &tcp_rexmit_min, 0, sysctl_msec_to_ticks, "I", "Minimum Retransmission Timeout"); 110 111int tcp_rexmit_slop; 112SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_slop, CTLTYPE_INT|CTLFLAG_RW, 113 &tcp_rexmit_slop, 0, sysctl_msec_to_ticks, "I", "Retransmission Timer Slop"); 114 115static int always_keepalive = 1; |
116SYSCTL_INT(_net_inet_tcp, OID_AUTO, always_keepalive, CTLFLAG_RW, | 116SYSCTL_INT(_net_inet_tcp, OID_AUTO, always_keepalive, CTLFLAG_RW, |
117 &always_keepalive , 0, "Assume SO_KEEPALIVE on all TCP connections"); 118 119static int tcp_keepcnt = TCPTV_KEEPCNT; 120 /* max idle probes */ 121int tcp_maxpersistidle; 122 /* max idle time in persist */ 123int tcp_maxidle; 124 --- 169 unchanged lines hidden (view full) --- 294} 295 296struct tcptw * 297tcp_timer_2msl_tw(int reuse) 298{ 299 struct tcptw *tw, *tw_tail; 300 struct twlist *twl; 301 int i; | 117 &always_keepalive , 0, "Assume SO_KEEPALIVE on all TCP connections"); 118 119static int tcp_keepcnt = TCPTV_KEEPCNT; 120 /* max idle probes */ 121int tcp_maxpersistidle; 122 /* max idle time in persist */ 123int tcp_maxidle; 124 --- 169 unchanged lines hidden (view full) --- 294} 295 296struct tcptw * 297tcp_timer_2msl_tw(int reuse) 298{ 299 struct tcptw *tw, *tw_tail; 300 struct twlist *twl; 301 int i; |
302 | 302 |
303 for (i = 0; i < 2; i++) { 304 twl = tw_2msl_list[i]; 305 tw_tail = &twl->tw_tail; 306 for (;;) { 307 tw = LIST_FIRST(&twl->tw_list); 308 if (tw == tw_tail || (!reuse && tw->tw_time > ticks)) 309 break; 310 INP_LOCK(tw->tw_inpcb); --- 201 unchanged lines hidden (view full) --- 512 tp->t_softerror : ETIMEDOUT); 513 goto out; 514 } 515 INP_INFO_WUNLOCK(&tcbinfo); 516 headlocked = 0; 517 if (tp->t_rxtshift == 1) { 518 /* 519 * first retransmit; record ssthresh and cwnd so they can | 303 for (i = 0; i < 2; i++) { 304 twl = tw_2msl_list[i]; 305 tw_tail = &twl->tw_tail; 306 for (;;) { 307 tw = LIST_FIRST(&twl->tw_list); 308 if (tw == tw_tail || (!reuse && tw->tw_time > ticks)) 309 break; 310 INP_LOCK(tw->tw_inpcb); --- 201 unchanged lines hidden (view full) --- 512 tp->t_softerror : ETIMEDOUT); 513 goto out; 514 } 515 INP_INFO_WUNLOCK(&tcbinfo); 516 headlocked = 0; 517 if (tp->t_rxtshift == 1) { 518 /* 519 * first retransmit; record ssthresh and cwnd so they can |
520 * be recovered if this turns out to be a "bad" retransmit. 521 * A retransmit is considered "bad" if an ACK for this | 520 * be recovered if this turns out to be a "bad" retransmit. 521 * A retransmit is considered "bad" if an ACK for this |
522 * segment is received within RTT/2 interval; the assumption | 522 * segment is received within RTT/2 interval; the assumption |
523 * here is that the ACK was already in flight. See | 523 * here is that the ACK was already in flight. See |
524 * "On Estimating End-to-End Network Path Properties" by 525 * Allman and Paxson for more details. 526 */ 527 tp->snd_cwnd_prev = tp->snd_cwnd; 528 tp->snd_ssthresh_prev = tp->snd_ssthresh; 529 tp->snd_recover_prev = tp->snd_recover; 530 if (IN_FASTRECOVERY(tp)) 531 tp->t_flags |= TF_WASFRECOVERY; --- 5 unchanged lines hidden (view full) --- 537 if (tp->t_state == TCPS_SYN_SENT) 538 rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp->t_rxtshift]; 539 else 540 rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; 541 TCPT_RANGESET(tp->t_rxtcur, rexmt, 542 tp->t_rttmin, TCPTV_REXMTMAX); 543 /* 544 * Disable rfc1323 and rfc1644 if we havn't got any response to | 524 * "On Estimating End-to-End Network Path Properties" by 525 * Allman and Paxson for more details. 526 */ 527 tp->snd_cwnd_prev = tp->snd_cwnd; 528 tp->snd_ssthresh_prev = tp->snd_ssthresh; 529 tp->snd_recover_prev = tp->snd_recover; 530 if (IN_FASTRECOVERY(tp)) 531 tp->t_flags |= TF_WASFRECOVERY; --- 5 unchanged lines hidden (view full) --- 537 if (tp->t_state == TCPS_SYN_SENT) 538 rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp->t_rxtshift]; 539 else 540 rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; 541 TCPT_RANGESET(tp->t_rxtcur, rexmt, 542 tp->t_rttmin, TCPTV_REXMTMAX); 543 /* 544 * Disable rfc1323 and rfc1644 if we havn't got any response to |
545 * our third SYN to work-around some broken terminal servers 546 * (most of which have hopefully been retired) that have bad VJ 547 * header compression code which trashes TCP segments containing | 545 * our third SYN to work-around some broken terminal servers 546 * (most of which have hopefully been retired) that have bad VJ 547 * header compression code which trashes TCP segments containing |
548 * unknown-to-them TCP options. 549 */ 550 if ((tp->t_state == TCPS_SYN_SENT) && (tp->t_rxtshift == 3)) 551 tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_REQ_CC); 552 /* 553 * If we backed off this far, our srtt estimate is probably bogus. 554 * Clobber it so we'll take the next rtt measurement as our srtt; 555 * move the current srtt into rttvar to keep the current --- 68 unchanged lines hidden --- | 548 * unknown-to-them TCP options. 549 */ 550 if ((tp->t_state == TCPS_SYN_SENT) && (tp->t_rxtshift == 3)) 551 tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_REQ_CC); 552 /* 553 * If we backed off this far, our srtt estimate is probably bogus. 554 * Clobber it so we'll take the next rtt measurement as our srtt; 555 * move the current srtt into rttvar to keep the current --- 68 unchanged lines hidden --- |