summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-03-08 03:49:59 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-03-08 03:49:59 +0000
commit9b09c9e18ad5231f2173323c6bcd2f1df26a4f81 (patch)
treea4bcf043e4a4ef0f97c84a071e496a6c55ba1af2 /sys/netinet/tcp_input.c
parentbfd6cab07ebbe219670eb8f3c2903f2290a508c2 (diff)
use timeout(9) to schedule TCP timers. this avoid traversing all
tcp connections during tcp_slowtimo. apdapted from thorpej@netbsd.org
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 60394196464..302167307bf 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.106 2002/03/02 00:44:52 provos Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.107 2002/03/08 03:49:58 provos Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -79,6 +79,7 @@
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
+#include <sys/kernel.h>
#include <net/if.h>
#include <net/route.h>
@@ -877,7 +878,7 @@ findpcb:
* Segment received on connection.
* Reset idle time and keep-alive timer.
*/
- tp->t_idle = 0;
+ tp->t_rcvtime = tcp_now;
if (tp->t_state != TCPS_SYN_RECEIVED)
TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle);
@@ -942,9 +943,10 @@ findpcb:
++tcpstat.tcps_predack;
if (ts_present)
tcp_xmit_timer(tp, tcp_now-ts_ecr+1);
- else if (tp->t_rtt &&
+ else if (tp->t_rtttime &&
SEQ_GT(th->th_ack, tp->t_rtseq))
- tcp_xmit_timer(tp, tp->t_rtt);
+ tcp_xmit_timer(tp,
+ tcp_now - tp->t_rtttime);
acked = th->th_ack - tp->snd_una;
tcpstat.tcps_rcvackpack++;
tcpstat.tcps_rcvackbyte += acked;
@@ -1287,8 +1289,8 @@ findpcb:
* if we didn't have to retransmit the SYN,
* use its rtt as our initial srtt & rtt var.
*/
- if (tp->t_rtt)
- tcp_xmit_timer(tp, tp->t_rtt);
+ if (tp->t_rtttime)
+ tcp_xmit_timer(tp, tcp_now - tp->t_rtttime);
/*
* Since new data was acked (the SYN), open the
* congestion window by one MSS. We do this
@@ -1645,7 +1647,7 @@ trimthenstep6:
#ifdef TCP_SACK
if (!tp->sack_disable) {
TCP_TIMER_DISARM(tp, TCPT_REXMT);
- tp->t_rtt = 0;
+ tp->t_rtttime = 0;
tcpstat.tcps_sndrexmitfast++;
#if defined(TCP_SACK) && defined(TCP_FACK)
tp->t_dupacks = tcprexmtthresh;
@@ -1668,7 +1670,7 @@ trimthenstep6:
}
#endif /* TCP_SACK */
TCP_TIMER_DISARM(tp, TCPT_REXMT);
- tp->t_rtt = 0;
+ tp->t_rtttime = 0;
tp->snd_nxt = th->th_ack;
tp->snd_cwnd = tp->t_maxseg;
tcpstat.tcps_sndrexmitfast++;
@@ -1778,8 +1780,8 @@ trimthenstep6:
*/
if (ts_present)
tcp_xmit_timer(tp, tcp_now-ts_ecr+1);
- else if (tp->t_rtt && SEQ_GT(th->th_ack, tp->t_rtseq))
- tcp_xmit_timer(tp,tp->t_rtt);
+ else if (tp->t_rtttime && SEQ_GT(th->th_ack, tp->t_rtseq))
+ tcp_xmit_timer(tp, tcp_now - tp->t_rtttime);
/*
* If all outstanding data is acked, stop retransmit
@@ -2664,7 +2666,7 @@ tcp_sack_partialack(tp, th)
if (SEQ_LT(th->th_ack, tp->snd_last)) {
/* Turn off retx. timer (will start again next segment) */
TCP_TIMER_DISARM(tp, TCPT_REXMT);
- tp->t_rtt = 0;
+ tp->t_rtttime = 0;
#ifndef TCP_FACK
/*
* Partial window deflation. This statement relies on the
@@ -2766,7 +2768,7 @@ tcp_xmit_timer(tp, rtt)
tp->t_srtt = rtt << (TCP_RTT_SHIFT + 2);
tp->t_rttvar = rtt << (TCP_RTTVAR_SHIFT + 2 - 1);
}
- tp->t_rtt = 0;
+ tp->t_rtttime = 0;
tp->t_rxtshift = 0;
/*
@@ -3085,7 +3087,7 @@ tcp_newreno(tp, th)
tcp_seq onxt = tp->snd_nxt;
u_long ocwnd = tp->snd_cwnd;
TCP_TIMER_DISARM(tp, TCPT_REXMT);
- tp->t_rtt = 0;
+ tp->t_rtttime = 0;
tp->snd_nxt = th->th_ack;
/*
* Set snd_cwnd to one segment beyond acknowledged offset