summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroleg <oleg@FreeBSD.org>2007-12-17 10:25:56 +0000
committeroleg <oleg@FreeBSD.org>2007-12-17 10:25:56 +0000
commit3ced3975d99146a0d4f69805de38b8502f0ad386 (patch)
tree1ce467b7a9ee6aa836e627cb7e04cd61a4f54eeb
parentf0dbf05ef2e00eed8a58f6f58a1fcf68dd018264 (diff)
downloadFreeBSD-src-3ced3975d99146a0d4f69805de38b8502f0ad386.zip
FreeBSD-src-3ced3975d99146a0d4f69805de38b8502f0ad386.tar.gz
Calculate p.fs.lookup_step correctly. This should prevent zeroing of
w_q_lookup table (used in RED algorithm for (1 - w_q)^t computation). MFC after: 1 months
-rw-r--r--sbin/ipfw/ipfw2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index cac78d2..335855f 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -4392,7 +4392,7 @@ end_mask:
if (p.bandwidth==0) /* this is a WF2Q+ queue */
s = 0;
else
- s = ck.hz * avg_pkt_size * 8 / p.bandwidth;
+ s = (double)ck.hz * avg_pkt_size * 8 / p.bandwidth;
/*
* max idle time (in ticks) before avg queue size becomes 0.
@@ -4405,8 +4405,8 @@ end_mask:
if (!p.fs.lookup_step)
p.fs.lookup_step = 1;
weight = 1 - w_q;
- for (t = p.fs.lookup_step; t > 0; --t)
- weight *= weight;
+ for (t = p.fs.lookup_step; t > 1; --t)
+ weight *= 1 - w_q;
p.fs.lookup_weight = (int)(weight * (1 << SCALE_RED));
}
i = do_cmd(IP_DUMMYNET_CONFIGURE, &p, sizeof p);
OpenPOWER on IntegriCloud