From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: devik@cdi.cz, netdev@vger.kernel.org,
Patrick McHardy <kaber@trash.net>,
shemminger@linux-foundation.org
Subject: [NET_SCHED 10/10]: kill jiffie conversion macros
Date: Fri, 16 Mar 2007 06:31:02 +0100 (MET) [thread overview]
Message-ID: <20070316053032.22744.77229.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070316053018.22744.76883.sendpatchset@localhost.localdomain>
[NET_SCHED]: kill jiffie conversion macros
Now that all packet schedulers have been converted to hrtimers most users
of PSCHED_JIFFIE2US and PSCHED_US2JIFFIE are gone. The remaining users use
it to convert external time units to packet scheduler clock ticks, so use
PSCHED_TICKS_PER_SEC instead.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 32b945035419c2d458cd0bf7072acb335e5c4044
tree 6837d1c9419e1ada826701fbb1f9e93ff8ff5a33
parent a5eaa252c5da48fef25a308ebc99b4020dad7f64
author Patrick McHardy <kaber@trash.net> Fri, 16 Mar 2007 06:17:44 +0100
committer Patrick McHardy <kaber@trash.net> Fri, 16 Mar 2007 06:17:44 +0100
include/net/pkt_sched.h | 3 ---
net/sched/sch_hfsc.c | 12 ++++++------
net/sched/sch_htb.c | 2 +-
3 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index b090d55..6555e57 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -51,9 +51,6 @@ #define PSCHED_TICKS_PER_SEC PSCHED_NS2
#define PSCHED_GET_TIME(stamp) \
((stamp) = PSCHED_NS2US(ktime_to_ns(ktime_get())))
-#define PSCHED_US2JIFFIE(usecs) usecs_to_jiffies(PSCHED_US2NS((usecs)) / NSEC_PER_USEC)
-#define PSCHED_JIFFIE2US(delay) PSCHED_NS2US(jiffies_to_usecs((delay)) * NSEC_PER_USEC)
-
#define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2))
#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \
min_t(long long, (tv1) - (tv2), bound)
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 49cae7d..522018b 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -434,8 +434,8 @@ m2sm(u32 m)
u64 sm;
sm = ((u64)m << SM_SHIFT);
- sm += PSCHED_JIFFIE2US(HZ) - 1;
- do_div(sm, PSCHED_JIFFIE2US(HZ));
+ sm += PSCHED_TICKS_PER_SEC - 1;
+ do_div(sm, PSCHED_TICKS_PER_SEC);
return sm;
}
@@ -448,7 +448,7 @@ m2ism(u32 m)
if (m == 0)
ism = HT_INFINITY;
else {
- ism = ((u64)PSCHED_JIFFIE2US(HZ) << ISM_SHIFT);
+ ism = ((u64)PSCHED_TICKS_PER_SEC << ISM_SHIFT);
ism += m - 1;
do_div(ism, m);
}
@@ -461,7 +461,7 @@ d2dx(u32 d)
{
u64 dx;
- dx = ((u64)d * PSCHED_JIFFIE2US(HZ));
+ dx = ((u64)d * PSCHED_TICKS_PER_SEC);
dx += USEC_PER_SEC - 1;
do_div(dx, USEC_PER_SEC);
return dx;
@@ -473,7 +473,7 @@ sm2m(u64 sm)
{
u64 m;
- m = (sm * PSCHED_JIFFIE2US(HZ)) >> SM_SHIFT;
+ m = (sm * PSCHED_TICKS_PER_SEC) >> SM_SHIFT;
return (u32)m;
}
@@ -484,7 +484,7 @@ dx2d(u64 dx)
u64 d;
d = dx * USEC_PER_SEC;
- do_div(d, PSCHED_JIFFIE2US(HZ));
+ do_div(d, PSCHED_TICKS_PER_SEC);
return (u32)d;
}
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index b00cef7..1721043 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1469,7 +1469,7 @@ static int htb_change_class(struct Qdisc
/* set class to be in HTB_CAN_SEND state */
cl->tokens = hopt->buffer;
cl->ctokens = hopt->cbuffer;
- cl->mbuffer = PSCHED_JIFFIE2US(HZ * 60); /* 1min */
+ cl->mbuffer = 60 * PSCHED_TICKS_PER_SEC; /* 1min */
PSCHED_GET_TIME(cl->t_c);
cl->cmode = HTB_CAN_SEND;
next prev parent reply other threads:[~2007-03-16 5:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-16 5:30 [NET_SCHED 00/10]: ktime clocksource + hrtimer Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 01/10]: Use ktime as clocksource Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 02/10]: Add hrtimer based qdisc watchdog Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 03/10]: sch_hfsc: use hrtimer based watchdog Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 04/10]: sch_tbf: " Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 05/10]: sch_netem: " Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 06/10]: sch_cbq: " Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 07/10]: sch_cbq: fix cbq_undelay_prio for non-active priorites Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 08/10]: sch_cbq: use hrtimer for delay_timer Patrick McHardy
2007-03-16 5:31 ` [NET_SCHED 09/10]: sch_htb: use hrtimer based watchdog Patrick McHardy
2007-03-16 5:31 ` Patrick McHardy [this message]
2007-03-16 9:35 ` [NET_SCHED 00/10]: ktime clocksource + hrtimer David Miller
2007-03-16 9:42 ` Patrick McHardy
2007-03-16 12:41 ` Thomas Graf
2007-03-16 12:45 ` Patrick McHardy
2007-03-16 19:31 ` David Miller
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=20070316053032.22744.77229.sendpatchset@localhost.localdomain \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=devik@cdi.cz \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).