* Fix several bugs where the scaled versions of srtt and rttvar

where used incorrectly.
* Use appropriate variable names for RTO instead of RTT.

MFC after: 3 months.
This commit is contained in:
Michael Tuexen 2011-02-24 22:58:15 +00:00
parent be1d917696
commit 0191fb6de2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219014
3 changed files with 23 additions and 23 deletions

View File

@ -428,7 +428,7 @@ sctp_cwnd_update_after_sack(struct sctp_tcb *stcb,
*/
if (net->net_ack2) {
/* restore any doubled timers */
net->RTO = ((net->lastsa >> 2) + net->lastsv) >> 1;
net->RTO = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
if (net->RTO < stcb->asoc.minrto) {
net->RTO = stcb->asoc.minrto;
}
@ -518,8 +518,8 @@ sctp_cwnd_update_after_packet_dropped(struct sctp_tcb *stcb,
unsigned int incr;
int old_cwnd = net->cwnd;
/* need real RTT for this calc */
rtt = ((net->lastsa >> 2) + net->lastsv) >> 1;
/* need real RTT in msd for this calc */
rtt = net->rtt / 1000;
/* get bottle neck bw */
*bottle_bw = ntohl(cp->bottle_bw);
/* and whats on queue */
@ -1079,7 +1079,7 @@ sctp_hs_cwnd_update_after_sack(struct sctp_tcb *stcb,
*/
if (net->net_ack2) {
/* restore any doubled timers */
net->RTO = ((net->lastsa >> 2) + net->lastsv) >> 1;
net->RTO = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
if (net->RTO < stcb->asoc.minrto) {
net->RTO = stcb->asoc.minrto;
}
@ -1146,7 +1146,7 @@ htcp_cwnd_undo(struct sctp_tcb *stcb, struct sctp_nets *net)
static inline void
measure_rtt(struct sctp_tcb *stcb, struct sctp_nets *net)
{
uint32_t srtt = net->lastsa >> 3;
uint32_t srtt = net->lastsa >> SCTP_RTT_SHIFT;
/* keep track of minimum RTT seen so far, minRTT is zero at first */
if (net->htcp_ca.minRTT > srtt || !net->htcp_ca.minRTT)
@ -1532,7 +1532,7 @@ sctp_htcp_cwnd_update_after_sack(struct sctp_tcb *stcb,
*/
if (net->net_ack2) {
/* restore any doubled timers */
net->RTO = ((net->lastsa >> 2) + net->lastsv) >> 1;
net->RTO = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
if (net->RTO < stcb->asoc.minrto) {
net->RTO = stcb->asoc.minrto;
}

View File

@ -61,24 +61,24 @@ sctp_early_fr_timer(struct sctp_inpcb *inp,
{
struct sctp_tmit_chunk *chk, *pchk;
struct timeval now, min_wait, tv;
unsigned int cur_rtt, cnt = 0, cnt_resend = 0;
unsigned int cur_rto, cnt = 0, cnt_resend = 0;
/* an early FR is occuring. */
(void)SCTP_GETTIME_TIMEVAL(&now);
/* get cur rto in micro-seconds */
if (net->lastsa == 0) {
/* Hmm no rtt estimate yet? */
cur_rtt = stcb->asoc.initial_rto >> 2;
cur_rto = stcb->asoc.initial_rto >> 2;
} else {
cur_rtt = ((net->lastsa >> 2) + net->lastsv) >> 1;
cur_rto = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
}
if (cur_rtt < SCTP_BASE_SYSCTL(sctp_early_fr_msec)) {
cur_rtt = SCTP_BASE_SYSCTL(sctp_early_fr_msec);
if (cur_rto < SCTP_BASE_SYSCTL(sctp_early_fr_msec)) {
cur_rto = SCTP_BASE_SYSCTL(sctp_early_fr_msec);
}
cur_rtt *= 1000;
tv.tv_sec = cur_rtt / 1000000;
tv.tv_usec = cur_rtt % 1000000;
cur_rto *= 1000;
tv.tv_sec = cur_rto / 1000000;
tv.tv_usec = cur_rto % 1000000;
min_wait = now;
timevalsub(&min_wait, &tv);
if (min_wait.tv_sec < 0 || min_wait.tv_usec < 0) {
@ -626,7 +626,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
struct sctp_tmit_chunk *chk, *nchk;
struct sctp_nets *lnets;
struct timeval now, min_wait, tv;
int cur_rtt;
int cur_rto;
int cnt_abandoned;
int audit_tf, num_mk, fir;
unsigned int cnt_mk;
@ -644,10 +644,10 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
*/
(void)SCTP_GETTIME_TIMEVAL(&now);
/* get cur rto in micro-seconds */
cur_rtt = (((net->lastsa >> 2) + net->lastsv) >> 1);
cur_rtt *= 1000;
cur_rto = (net->lastsa >> SCTP_RTT_SHIFT) + net->lastsv;
cur_rto *= 1000;
if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
sctp_log_fr(cur_rtt,
sctp_log_fr(cur_rto,
stcb->asoc.peers_rwnd,
window_probe,
SCTP_FR_T3_MARK_TIME);
@ -657,8 +657,8 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
SCTP_FR_CWND_REPORT);
sctp_log_fr(net->flight_size, net->cwnd, stcb->asoc.total_flight, SCTP_FR_CWND_REPORT);
}
tv.tv_sec = cur_rtt / 1000000;
tv.tv_usec = cur_rtt % 1000000;
tv.tv_sec = cur_rto / 1000000;
tv.tv_usec = cur_rto % 1000000;
min_wait = now;
timevalsub(&min_wait, &tv);
if (min_wait.tv_sec < 0 || min_wait.tv_usec < 0) {
@ -671,7 +671,7 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
min_wait.tv_sec = min_wait.tv_usec = 0;
}
if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
sctp_log_fr(cur_rtt, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME);
sctp_log_fr(cur_rto, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME);
sctp_log_fr(0, min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME);
}
/*

View File

@ -2401,7 +2401,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
paddri->spinfo_state = SCTP_INACTIVE;
}
paddri->spinfo_cwnd = net->cwnd;
paddri->spinfo_srtt = ((net->lastsa >> 2) + net->lastsv) >> 1;
paddri->spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT;
paddri->spinfo_rto = net->RTO;
paddri->spinfo_assoc_id = sctp_get_associd(stcb);
SCTP_TCB_UNLOCK(stcb);
@ -2478,7 +2478,7 @@ sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
sstat->sstat_primary.spinfo_state = SCTP_INACTIVE;
}
sstat->sstat_primary.spinfo_cwnd = net->cwnd;
sstat->sstat_primary.spinfo_srtt = net->lastsa;
sstat->sstat_primary.spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT;
sstat->sstat_primary.spinfo_rto = net->RTO;
sstat->sstat_primary.spinfo_mtu = net->mtu;
sstat->sstat_primary.spinfo_assoc_id = sctp_get_associd(stcb);