From: Patrick McHardy Date: Sun, 4 Mar 2007 19:14:56 +0000 (+0100) Subject: Use tc_calc_xmittime() where appropriate X-Git-Tag: v2.6.23-071016~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=476daa7278aaf324f6cef27981f81187afce8836;p=thirdparty%2Fiproute2.git Use tc_calc_xmittime() where appropriate [IPROUTE]: Use tc_calc_xmittime() where appropriate Replace expressions of the form "tc_core_usec2tick(1000000 * size/rate)" by tc_calc_xmittime(). The CBQ case deserves an extra comment: when called with bnwd=rate, tc_cbq_calc_maxidle() behaves identical to tc_calc_xmittime(): unsigned tc_cbq_calc_maxidle(...) { double g = 1.0 - 1.0/(1< Signed-off-by: Stephen Hemminger --- diff --git a/tc/q_cbq.c b/tc/q_cbq.c index bc7e8ba75..0000a563b 100644 --- a/tc/q_cbq.c +++ b/tc/q_cbq.c @@ -147,7 +147,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl if (ewma_log < 0) ewma_log = TC_CBQ_DEF_EWMA; lss.ewma_log = ewma_log; - lss.maxidle = tc_cbq_calc_maxidle(r.rate, r.rate, avpkt, lss.ewma_log, 0); + lss.maxidle = tc_calc_xmittime(r.rate, avpkt); lss.change = TCF_CBQ_LSS_MAXIDLE|TCF_CBQ_LSS_EWMA|TCF_CBQ_LSS_AVPKT; lss.avpkt = avpkt; diff --git a/tc/tc_core.c b/tc/tc_core.c index 10c375ef8..90a097d36 100644 --- a/tc/tc_core.c +++ b/tc/tc_core.c @@ -76,7 +76,7 @@ int tc_calc_rtable(unsigned bps, __u32 *rtab, int cell_log, unsigned mtu, sz += overhead; if (sz < mpu) sz = mpu; - rtab[i] = tc_core_usec2tick(1000000*((double)sz/bps)); + rtab[i] = tc_calc_xmittime(bps, sz); } return cell_log; } diff --git a/tc/tc_red.c b/tc/tc_red.c index 385e7af11..8f9bde088 100644 --- a/tc/tc_red.c +++ b/tc/tc_red.c @@ -71,7 +71,7 @@ int tc_red_eval_ewma(unsigned qmin, unsigned burst, unsigned avpkt) int tc_red_eval_idle_damping(int Wlog, unsigned avpkt, unsigned bps, __u8 *sbuf) { - double xmit_time = tc_core_usec2tick(1000000*(double)avpkt/bps); + double xmit_time = tc_calc_xmittime(bps, avpkt); double lW = -log(1.0 - 1.0/(1<