All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: shemminger@osdl.org
Cc: netdev@vger.kernel.org, Patrick McHardy <kaber@trash.net>
Subject: [IPROUTE 01/05]: Use tc_calc_xmittime where appropriate
Date: Wed, 10 Jan 2007 11:01:45 +0100 (MET)	[thread overview]
Message-ID: <20070110100144.29356.52367.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070110100143.29356.98344.sendpatchset@localhost.localdomain>

[IPROUTE]: Use tc_calc_xmittime where appropriate

Replace expressions of the form "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, so use it
for clarity.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit d786eedd7b3e9ceb381ee602efcbe002afc7be73
tree 4db59786df1da875f9c3956000496dd8455d5af6
parent 40076f622e0aacb2b792d3ac1b5d12aa97c4da9c
author Patrick McHardy <kaber@trash.net> Wed, 10 Jan 2007 10:40:05 +0100
committer Patrick McHardy <kaber@trash.net> Wed, 10 Jan 2007 10:40:05 +0100

 tc/q_cbq.c   |    2 +-
 tc/tc_core.c |    2 +-
 tc/tc_red.c  |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tc/q_cbq.c b/tc/q_cbq.c
index bc7e8ba..0000a56 100644
--- a/tc/q_cbq.c
+++ b/tc/q_cbq.c
@@ -147,7 +147,7 @@ static int cbq_parse_opt(struct qdisc_ut
 	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 10c375e..90a097d 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -76,7 +76,7 @@ int tc_calc_rtable(unsigned bps, __u32 *
 			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 385e7af..8f9bde0 100644
--- a/tc/tc_red.c
+++ b/tc/tc_red.c
@@ -71,7 +71,7 @@ int tc_red_eval_ewma(unsigned qmin, unsi
 
 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<<Wlog))/xmit_time;
 	double maxtime = 31/lW;
 	int clog;

  reply	other threads:[~2007-01-10 10:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-10 10:01 [IPROUTE 00/05]: Time cleanups Patrick McHardy
2007-01-10 10:01 ` Patrick McHardy [this message]
2007-01-16  8:56   ` [IPROUTE 01/05]: Use tc_calc_xmittime where appropriate Jarek Poplawski
2007-01-16 10:19     ` Patrick McHardy
2007-01-16 11:02       ` Jarek Poplawski
2007-01-16 12:28         ` Patrick McHardy
2007-01-16 12:48           ` Jarek Poplawski
2007-01-10 10:01 ` [IPROUTE 02/05]: Introduce tc_calc_xmitsize and use " Patrick McHardy
2007-01-15 12:35   ` Jarek Poplawski
2007-01-15 15:07     ` Patrick McHardy
2007-01-10 10:01 ` [IPROUTE 03/05]: Introduce TIME_UNITS_PER_SEC to represent internal clock resolution Patrick McHardy
2007-01-10 10:01 ` [IPROUTE 04/05]: Replace "usec" by "time" in function names Patrick McHardy
2007-01-15 10:17   ` Jarek Poplawski
2007-01-16 13:42     ` Patrick McHardy
2007-01-10 10:01 ` [IPROUTE 05/05]: Add sprint_ticks() function and use in CBQ Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2006-06-23 18:06 [RFC IPROUTE 00/05]: Time cleanups Patrick McHardy
2006-06-23 18:06 ` [IPROUTE 01/05]: Use tc_calc_xmittime where appropriate Patrick McHardy
2006-06-23 18:28   ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070110100144.29356.52367.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.