-.\" $OpenBSD: sysctl.2,v 1.49 2022/08/16 13:29:52 visa Exp $
+.\" $OpenBSD: sysctl.2,v 1.50 2022/11/07 11:22:55 yasuoka Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: August 16 2022 $
+.Dd $Mdocdate: November 7 2022 $
.Dt SYSCTL 2
.Os
.Sh NAME
.It tcp Ta rootonly Ta array Ta yes
.It tcp Ta rstppslimit Ta integer Ta yes
.It tcp Ta sack Ta integer Ta yes
-.It tcp Ta slowhz Ta integer Ta no
.It tcp Ta stats Ta structure Ta no
.It tcp Ta synbucketlimit Ta integer Ta yes
.It tcp Ta syncachelimit Ta integer Ta yes
.It Li tcp.keepidle Pq Va net.inet.tcp.keepidle
If the socket option
.Dv SO_KEEPALIVE
-has been set on a socket, then this value specifies how much time a
-connection needs to be idle before keepalives are sent.
-See also tcp.slowhz.
+has been set on a socket, then this value specifies how much time in seconds
+a connection needs to be idle before keepalives are sent.
.It Li tcp.keepinittime Pq Va net.inet.tcp.keepinittime
-Time to keep alive the initial SYN packet of a TCP handshake.
+Time in seconds to keep alive the initial SYN packet of a TCP handshake.
.It Li tcp.keepintvl Pq Va net.inet.tcp.keepintvl
-Time after a keepalive probe is sent until, in the absence of any response,
-another probe is sent.
+Time in seconds after a keepalive probe is sent until, in the absence of any
+response, another probe is sent.
See also tcp.slowhz.
.It Li tcp.always_keepalive Pq Va net.inet.tcp.always_keepalive
Act as if the option
A negative value disables rate limitation.
.It Li tcp.sack Pq Va net.inet.tcp.sack
Returns 1 if RFC 2018 Selective Acknowledgements are enabled.
-.It Li tcp.slowhz Pq Va net.inet.tcp.slowhz
-The units for tcp.keepidle and tcp.keepintvl; those variables are in ticks
-of a clock that ticks tcp.slowhz times per second.
-(That is, their values must be divided by the tcp.slowhz value to get times
-in seconds.)
.It Li tcp.stats Pq Va net.inet.tcp.stats
Returns the TCP statistics in a struct tcpstat.
.It Li tcp.synbucketlimit Pq Va net.inet.tcp.synbucketlimit
-/* $OpenBSD: tcp_input.c,v 1.381 2022/10/03 16:43:52 bluhm Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.382 2022/11/07 11:22:55 yasuoka Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
int tcp_ackdrop_ppslim_count = 0;
struct timeval tcp_ackdrop_ppslim_last;
-#define TCP_PAWS_IDLE (24 * 24 * 60 * 60 * PR_SLOWHZ)
+#define TCP_PAWS_IDLE TCP_TIME(24 * 24 * 60 * 60)
/* for modulo comparisons of timestamps */
#define TSTMP_LT(a,b) ((int)((a)-(b)) < 0)
(ifp && (ifp->if_flags & IFF_LOOPBACK))) \
tp->t_flags |= TF_ACKNOW; \
else \
- TCP_TIMER_ARM_MSEC(tp, TCPT_DELACK, tcp_delack_msecs); \
+ TCP_TIMER_ARM(tp, TCPT_DELACK, tcp_delack_msecs); \
if_put(ifp); \
} while (0)
opti.ts_present = 0;
opti.maxseg = 0;
- now = READ_ONCE(tcp_now);
+ now = tcp_now();
/*
* RFC1122 4.2.3.10, p. 104: discard bcast/mcast SYN
*/
tp->t_rcvtime = now;
if (TCPS_HAVEESTABLISHED(tp->t_state))
- TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle);
+ TCP_TIMER_ARM(tp, TCPT_KEEP, TCP_TIME(tcp_keepidle));
if (tp->sack_enable)
tcp_del_sackholes(tp, th); /* Delete stale SACK holes */
if (so->so_state & SS_CANTRCVMORE)
m_freem(m);
else {
- if (opti.ts_present && opti.ts_ecr) {
- if (tp->rfbuf_ts < opti.ts_ecr &&
- opti.ts_ecr - tp->rfbuf_ts < hz) {
- tcp_update_rcvspace(tp);
- /* Start over with next RTT. */
- tp->rfbuf_cnt = 0;
- tp->rfbuf_ts = 0;
- } else
- tp->rfbuf_cnt += tlen;
- }
+ if (tp->t_srtt != 0 && tp->rfbuf_ts != 0 &&
+ now - tp->rfbuf_ts > (tp->t_srtt >>
+ (TCP_RTT_SHIFT + TCP_RTT_BASE_SHIFT))) {
+ tcp_update_rcvspace(tp);
+ /* Start over with next RTT. */
+ tp->rfbuf_cnt = 0;
+ tp->rfbuf_ts = 0;
+ } else
+ tp->rfbuf_cnt += tlen;
m_adj(m, iphlen + off);
sbappendstream(so, &so->so_rcv, m);
}
tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt));
}
- /* Reset receive buffer auto scaling when not in bulk receive mode. */
- tp->rfbuf_cnt = 0;
- tp->rfbuf_ts = 0;
-
switch (tp->t_state) {
/*
soisconnected(so);
tp->t_flags &= ~TF_BLOCKOUTPUT;
tp->t_state = TCPS_ESTABLISHED;
- TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle);
+ TCP_TIMER_ARM(tp, TCPT_KEEP, TCP_TIME(tcp_keepidle));
/* Do window scaling on this connection? */
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
(TF_RCVD_SCALE|TF_REQ_SCALE)) {
soisconnected(so);
tp->t_flags &= ~TF_BLOCKOUTPUT;
tp->t_state = TCPS_ESTABLISHED;
- TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle);
+ TCP_TIMER_ARM(tp, TCPT_KEEP, TCP_TIME(tcp_keepidle));
/* Do window scaling? */
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
(TF_RCVD_SCALE|TF_REQ_SCALE)) {
tp->t_flags |= TF_BLOCKOUTPUT;
soisdisconnected(so);
tp->t_flags &= ~TF_BLOCKOUTPUT;
- TCP_TIMER_ARM(tp, TCPT_2MSL, tcp_maxidle);
+ TCP_TIMER_ARM(tp, TCPT_2MSL,
+ TCP_TIME(tcp_maxidle));
}
tp->t_state = TCPS_FIN_WAIT_2;
}
if (ourfinisacked) {
tp->t_state = TCPS_TIME_WAIT;
tcp_canceltimers(tp);
- TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * TCPTV_MSL);
+ TCP_TIMER_ARM(tp, TCPT_2MSL,
+ TCP_TIME(2 * TCPTV_MSL));
tp->t_flags |= TF_BLOCKOUTPUT;
soisdisconnected(so);
tp->t_flags &= ~TF_BLOCKOUTPUT;
* it and restart the finack timer.
*/
case TCPS_TIME_WAIT:
- TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * TCPTV_MSL);
+ TCP_TIMER_ARM(tp, TCPT_2MSL, TCP_TIME(2 * TCPTV_MSL));
goto dropafterack;
}
}
case TCPS_FIN_WAIT_2:
tp->t_state = TCPS_TIME_WAIT;
tcp_canceltimers(tp);
- TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * TCPTV_MSL);
+ TCP_TIMER_ARM(tp, TCPT_2MSL, TCP_TIME(2 * TCPTV_MSL));
tp->t_flags |= TF_BLOCKOUTPUT;
soisdisconnected(so);
tp->t_flags &= ~TF_BLOCKOUTPUT;
* In TIME_WAIT state restart the 2 MSL time_wait timer.
*/
case TCPS_TIME_WAIT:
- TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * TCPTV_MSL);
+ TCP_TIMER_ARM(tp, TCPT_2MSL, TCP_TIME(2 * TCPTV_MSL));
break;
}
}
* statistical, we have to test that we don't drop below
* the minimum feasible timer (which is 2 ticks).
*/
- rttmin = min(max(rtt + 2, tp->t_rttmin), TCPTV_REXMTMAX);
+ rttmin = min(max(tp->t_rttmin, rtt + 2 * (TCP_TIME(1) / hz)),
+ TCPTV_REXMTMAX);
TCPT_RANGESET(tp->t_rxtcur, TCP_REXMTVAL(tp), rttmin, TCPTV_REXMTMAX);
/*
TCPTV_REXMTMAX); \
if (!timeout_initialized(&(sc)->sc_timer)) \
timeout_set_proc(&(sc)->sc_timer, syn_cache_timer, (sc)); \
- timeout_add(&(sc)->sc_timer, (sc)->sc_rxtcur * (hz / PR_SLOWHZ)); \
+ timeout_add_msec(&(sc)->sc_timer, (sc)->sc_rxtcur); \
} while (/*CONSTCOND*/0)
void
if (sc->sc_flags & SCF_DEAD)
goto out;
- now = READ_ONCE(tcp_now);
+ now = tcp_now();
if (__predict_false(sc->sc_rxtshift == TCP_MAXRXTSHIFT)) {
/* Drop it -- too many retransmissions. */
tp->t_sndtime = now;
tp->t_rcvacktime = now;
tp->t_sndacktime = now;
- TCP_TIMER_ARM(tp, TCPT_KEEP, tcptv_keep_init);
+ TCP_TIMER_ARM(tp, TCPT_KEEP, TCP_TIME(tcptv_keep_init));
tcpstat_inc(tcps_accepts);
tcp_mss(tp, sc->sc_peermaxseg); /* sets t_maxseg */
-/* $OpenBSD: tcp_output.c,v 1.133 2022/09/03 19:22:19 bluhm Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.134 2022/11/07 11:22:55 yasuoka Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
return (EINVAL);
#endif /* defined(TCP_SIGNATURE) && defined(DIAGNOSTIC) */
- now = READ_ONCE(tcp_now);
+ now = tcp_now();
/*
* Determine length of data that should be transmitted,
*lp++ = htonl(now + tp->ts_modulate);
*lp = htonl(tp->ts_recent);
optlen += TCPOLEN_TSTAMP_APPA;
-
- /* Set receive buffer autosizing timestamp. */
- if (tp->rfbuf_ts == 0)
- tp->rfbuf_ts = now;
-
+ }
+ /* Set receive buffer autosizing timestamp. */
+ if (tp->rfbuf_ts == 0) {
+ tp->rfbuf_ts = now;
+ tp->rfbuf_cnt = 0;
}
#ifdef TCP_SIGNATURE
/* Restart the delayed ACK timer, if necessary. */
if (TCP_TIMER_ISARMED(tp, TCPT_DELACK))
- TCP_TIMER_ARM_MSEC(tp, TCPT_DELACK, tcp_delack_msecs);
+ TCP_TIMER_ARM(tp, TCPT_DELACK, tcp_delack_msecs);
return (error);
}
tcp_setpersist(struct tcpcb *tp)
{
int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> (1 + TCP_RTT_BASE_SHIFT);
- int nticks;
+ int msec;
if (TCP_TIMER_ISARMED(tp, TCPT_REXMT))
panic("tcp_output REXMT");
*/
if (t < tp->t_rttmin)
t = tp->t_rttmin;
- TCPT_RANGESET(nticks, t * tcp_backoff[tp->t_rxtshift],
+ TCPT_RANGESET(msec, t * tcp_backoff[tp->t_rxtshift],
TCPTV_PERSMIN, TCPTV_PERSMAX);
- TCP_TIMER_ARM(tp, TCPT_PERSIST, nticks);
+ TCP_TIMER_ARM(tp, TCPT_PERSIST, msec);
if (tp->t_rxtshift < TCP_MAXRXTSHIFT)
tp->t_rxtshift++;
}
-/* $OpenBSD: tcp_subr.c,v 1.189 2022/10/03 16:43:52 bluhm Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.190 2022/11/07 11:22:55 yasuoka Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
/* patchable/settable parameters for tcp */
int tcp_mssdflt = TCP_MSS;
-int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ;
+int tcp_rttdflt = TCPTV_SRTTDFLT;
/* values controllable via sysctl */
int tcp_do_rfc1323 = 1;
u_char tcp_secret[16]; /* [I] */
SHA2_CTX tcp_secret_ctx; /* [I] */
tcp_seq tcp_iss; /* [T] updated by timer and connection */
-uint32_t tcp_now; /* [T] incremented by slow timer */
/*
* Tcp initialization
tcp_init(void)
{
tcp_iss = 1; /* wrong */
- tcp_now = 1;
pool_init(&tcpcb_pool, sizeof(struct tcpcb), 0, IPL_SOFTNET, 0,
"tcpcb", NULL);
pool_init(&tcpqe_pool, sizeof(struct tcpqent), 0, IPL_SOFTNET, 0,
* reasonable initial retransmit time.
*/
tp->t_srtt = TCPTV_SRTTBASE;
- tp->t_rttvar = tcp_rttdflt * PR_SLOWHZ <<
+ tp->t_rttvar = tcp_rttdflt <<
(TCP_RTTVAR_SHIFT + TCP_RTT_BASE_SHIFT - 1);
tp->t_rttmin = TCPTV_MIN;
TCPT_RANGESET(tp->t_rxtcur, TCP_REXMTVAL(tp),
-/* $OpenBSD: tcp_timer.c,v 1.70 2022/09/03 19:22:19 bluhm Exp $ */
+/* $OpenBSD: tcp_timer.c,v 1.71 2022/11/07 11:22:55 yasuoka Exp $ */
/* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */
/*
mtx_enter(&tcp_timer_mtx);
tcp_maxidle = TCPTV_KEEPCNT * tcp_keepintvl;
tcp_iss += TCP_ISSINCR2/PR_SLOWHZ; /* increment iss */
- tcp_now++; /* for timestamps */
mtx_leave(&tcp_timer_mtx);
}
rto = TCP_REXMTVAL(tp);
if (rto < tp->t_rttmin)
rto = tp->t_rttmin;
- now = READ_ONCE(tcp_now);
+ now = tcp_now();
if (tp->t_rxtshift == TCP_MAXRXTSHIFT &&
- ((now - tp->t_rcvtime) >= tcp_maxpersistidle ||
+ ((now - tp->t_rcvtime) >= TCP_TIME(tcp_maxpersistidle) ||
(now - tp->t_rcvtime) >= rto * tcp_totbackoff)) {
tcpstat_inc(tcps_persistdrop);
tp = tcp_drop(tp, ETIMEDOUT);
uint32_t now;
maxidle = READ_ONCE(tcp_maxidle);
- now = READ_ONCE(tcp_now);
- if ((maxidle > 0) &&
- ((now - tp->t_rcvtime) >= tcp_keepidle + maxidle))
+ now = tcp_now();
+ if ((maxidle > 0) && ((now - tp->t_rcvtime) >=
+ TCP_TIME(tcp_keepidle + maxidle)))
goto dropit;
/*
* Send a packet designed to force a response
tcpstat_inc(tcps_keepprobe);
tcp_respond(tp, mtod(tp->t_template, caddr_t),
NULL, tp->rcv_nxt, tp->snd_una - 1, 0, 0, now);
- TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepintvl);
+ TCP_TIMER_ARM(tp, TCPT_KEEP, TCP_TIME(tcp_keepintvl));
} else
- TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle);
+ TCP_TIMER_ARM(tp, TCPT_KEEP, TCP_TIME(tcp_keepidle));
if (otp)
tcp_trace(TA_TIMER, ostate, tp, otp, NULL, TCPT_KEEP, 0);
out:
tcp_timer_freesack(tp);
maxidle = READ_ONCE(tcp_maxidle);
- now = READ_ONCE(tcp_now);
+ now = tcp_now();
if (tp->t_state != TCPS_TIME_WAIT &&
- ((maxidle == 0) || ((now - tp->t_rcvtime) <= maxidle)))
- TCP_TIMER_ARM(tp, TCPT_2MSL, tcp_keepintvl);
+ ((maxidle == 0) || ((now - tp->t_rcvtime) <= TCP_TIME(maxidle))))
+ TCP_TIMER_ARM(tp, TCPT_2MSL, TCP_TIME(tcp_keepintvl));
else
tp = tcp_close(tp);
if (otp)
-/* $OpenBSD: tcp_timer.h,v 1.18 2018/05/08 15:10:33 bluhm Exp $ */
+/* $OpenBSD: tcp_timer.h,v 1.19 2022/11/07 11:22:55 yasuoka Exp $ */
/* $NetBSD: tcp_timer.h,v 1.6 1995/03/26 20:32:37 jtc Exp $ */
/*
/*
* Time constants.
*/
-#define TCPTV_MSL ( 30*PR_SLOWHZ) /* max seg lifetime (hah!) */
-#define TCPTV_SRTTBASE 0 /* base roundtrip time;
- if 0, no idea yet */
-#define TCPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */
+#define TCPTV_MSL 30 /* max seg lifetime (hah!) */
+#define TCPTV_SRTTBASE 0 /* base roundtrip time;
+ if 0, no idea yet */
+#define TCPTV_SRTTDFLT TCP_TIME_MSEC(1500) /* assumed RTT if no info */
-#define TCPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistence */
-#define TCPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */
+#define TCPTV_PERSMIN 5 /* retransmit persistence */
+#define TCPTV_PERSMAX 60 /* maximum persist interval */
-#define TCPTV_KEEP_INIT ( 75*PR_SLOWHZ) /* initial connect keep alive */
-#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ) /* dflt time before probing */
-#define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ) /* default probe interval */
-#define TCPTV_KEEPCNT 8 /* max probes before drop */
+#define TCPTV_KEEP_INIT 75 /* initial connect keep alive */
+#define TCPTV_KEEP_IDLE 120*60 /* dflt time before probing */
+#define TCPTV_KEEPINTVL 75 /* default probe interval */
+#define TCPTV_KEEPCNT 8 /* max probes before drop */
-#define TCPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */
-#define TCPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */
+#define TCPTV_MIN TCP_TIME(1) /* minimum allowable value */
+#define TCPTV_REXMTMAX TCP_TIME(64) /* max allowable REXMT value */
-#define TCP_LINGERTIME 120 /* linger at most 2 minutes */
+#define TCP_LINGERTIME 120 /* linger at most 2 minutes */
-#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */
+#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */
-#define TCP_DELACK_MSECS 200 /* time to delay ACK */
+#define TCP_DELACK_MSECS 200 /* time to delay ACK */
#ifdef TCPTIMERS
const char *tcptimers[TCPT_NTIMERS] =
#define TCP_TIMER_INIT(tp, timer) \
timeout_set_proc(&(tp)->t_timer[(timer)], tcp_timer_funcs[(timer)], tp)
-#define TCP_TIMER_ARM(tp, timer, nticks) \
+#define TCP_TIMER_ARM(tp, timer, msecs) \
do { \
SET((tp)->t_flags, TF_TIMER << (timer)); \
- timeout_add_msec(&(tp)->t_timer[(timer)], (nticks) * 500); \
-} while (0)
-
-#define TCP_TIMER_ARM_MSEC(tp, timer, msecs) \
-do { \
- SET((tp)->t_flags, TF_TIMER << (timer)); \
- timeout_add_msec(&(tp)->t_timer[(timer)], (msecs)); \
+ timeout_add_msec(&(tp)->t_timer[(timer)], (msecs)); \
} while (0)
#define TCP_TIMER_DISARM(tp, timer) \
-/* $OpenBSD: tcp_usrreq.c,v 1.210 2022/10/17 14:49:02 mvs Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.211 2022/11/07 11:22:55 yasuoka Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
};
#endif
-static int pr_slowhz = PR_SLOWHZ;
const struct sysctl_bounded_args tcpctl_vars[] = {
- { TCPCTL_SLOWHZ, &pr_slowhz, SYSCTL_INT_READONLY },
{ TCPCTL_RFC1323, &tcp_do_rfc1323, 0, 1 },
{ TCPCTL_KEEPINITTIME, &tcptv_keep_init, 1, 3 * TCPTV_KEEP_INIT },
{ TCPCTL_KEEPIDLE, &tcp_keepidle, 1, 5 * TCPTV_KEEP_IDLE },
{
struct proc *p = curproc;
struct tcp_info *ti;
- u_int t = 1000000 / PR_SLOWHZ;
+ u_int t = 1000; /* msec => usec */
uint32_t now;
if (sizeof(*ti) > MLEN) {
ti = mtod(m, struct tcp_info *);
m->m_len = sizeof(*ti);
memset(ti, 0, sizeof(*ti));
- now = READ_ONCE(tcp_now);
+ now = tcp_now();
ti->tcpi_state = tp->t_state;
if ((tp->t_flags & TF_REQ_TSTMP) && (tp->t_flags & TF_RCVD_TSTMP))
soisconnecting(so);
tcpstat_inc(tcps_connattempt);
tp->t_state = TCPS_SYN_SENT;
- TCP_TIMER_ARM(tp, TCPT_KEEP, tcptv_keep_init);
+ TCP_TIMER_ARM(tp, TCPT_KEEP, TCP_TIME(tcptv_keep_init));
tcp_set_iss_tsm(tp);
tcp_sendseqinit(tp);
tp->snd_last = tp->snd_una;
* not left in FIN_WAIT_2 forever.
*/
if (tp->t_state == TCPS_FIN_WAIT_2)
- TCP_TIMER_ARM(tp, TCPT_2MSL, tcp_maxidle);
+ TCP_TIMER_ARM(tp, TCPT_2MSL, TCP_TIME(tcp_maxidle));
}
return (tp);
}
-/* $OpenBSD: tcp_var.h,v 1.160 2022/10/17 14:49:02 mvs Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.161 2022/11/07 11:22:55 yasuoka Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
struct timeout t_timer[TCPT_NTIMERS]; /* tcp timers */
short t_state; /* state of this connection */
short t_rxtshift; /* log(2) of rexmt exp. backoff */
- short t_rxtcur; /* current retransmit value */
+ int t_rxtcur; /* current retransmit value */
short t_dupacks; /* consecutive dup acks recd */
u_short t_maxseg; /* maximum segment size */
char t_force; /* 1 if forcing out a byte */
uint32_t t_sndacktime; /* time last ack sent */
uint32_t t_rtttime; /* time we started measuring rtt */
tcp_seq t_rtseq; /* sequence number being timed */
- short t_srtt; /* smoothed round-trip time */
- short t_rttvar; /* variance in round-trip time */
- u_short t_rttmin; /* minimum rtt allowed */
+ int t_srtt; /* smoothed round-trip time */
+ int t_rttvar; /* variance in round-trip time */
+ u_int t_rttmin; /* minimum rtt allowed */
u_long max_sndwnd; /* largest window peer has offered */
/* out-of-band data */
#define TCP_RTT_SHIFT 3 /* shift for srtt; 5 bits frac. */
#define TCP_RTTVAR_SHIFT 2 /* shift for rttvar; 4 bits */
#define TCP_RTT_BASE_SHIFT 2 /* remaining 2 bit shift */
-#define TCP_RTT_MAX (1<<9) /* maximum rtt */
+#define TCP_RTT_MAX (1<<18) /* maximum rtt */
/*
* The initial retransmission should happen at rtt + 4 * rttvar.
{ "keepinittime", CTLTYPE_INT }, \
{ "keepidle", CTLTYPE_INT }, \
{ "keepintvl", CTLTYPE_INT }, \
- { "slowhz", CTLTYPE_INT }, \
+ { NULL, 0 }, \
{ "baddynamic", CTLTYPE_STRUCT }, \
{ NULL, 0 }, \
{ NULL, 0 }, \
counters_pkt(tcpcounters, pcounter, bcounter, v);
}
+static inline uint32_t
+tcp_now(void)
+{
+ return (getnsecuptime() / 1000000);
+}
+
+#define TCP_TIME_MSEC(_ms) (_ms) /* tcp_now() is in milliseconds */
+#define TCP_TIME(_sec) ((_sec) * 1000)
+
extern struct mutex tcp_timer_mtx;
extern const struct pr_usrreqs tcp_usrreqs;
extern struct pool tcpcb_pool;
extern struct inpcbtable tcbtable; /* head of queue of active tcpcb's */
-extern uint32_t tcp_now; /* for RFC 1323 timestamps */
extern int tcp_do_rfc1323; /* enabled/disabled? */
extern int tcptv_keep_init; /* time to keep alive the initial SYN packet */
extern int tcp_mssdflt; /* default maximum segment size */