aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/pkt_sched.h1
-rw-r--r--net/sched/sch_cbq.c14
2 files changed, 7 insertions, 8 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index c40147a60205..163973740207 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -51,7 +51,6 @@ typedef long psched_tdiff_t;
51#define PSCHED_GET_TIME(stamp) \ 51#define PSCHED_GET_TIME(stamp) \
52 ((stamp) = PSCHED_NS2US(ktime_to_ns(ktime_get()))) 52 ((stamp) = PSCHED_NS2US(ktime_to_ns(ktime_get())))
53 53
54#define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2))
55#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ 54#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \
56 min_t(long long, (tv1) - (tv2), bound) 55 min_t(long long, (tv1) - (tv2), bound)
57#define PSCHED_PASTPERFECT 0 56#define PSCHED_PASTPERFECT 0
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 2bb271b0efc3..f9e8403c5222 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -386,7 +386,7 @@ cbq_mark_toplevel(struct cbq_sched_data *q, struct cbq_class *cl)
386 psched_tdiff_t incr; 386 psched_tdiff_t incr;
387 387
388 PSCHED_GET_TIME(now); 388 PSCHED_GET_TIME(now);
389 incr = PSCHED_TDIFF(now, q->now_rt); 389 incr = now - q->now_rt;
390 now = q->now + incr; 390 now = q->now + incr;
391 391
392 do { 392 do {
@@ -474,7 +474,7 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
474static void cbq_ovl_classic(struct cbq_class *cl) 474static void cbq_ovl_classic(struct cbq_class *cl)
475{ 475{
476 struct cbq_sched_data *q = qdisc_priv(cl->qdisc); 476 struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
477 psched_tdiff_t delay = PSCHED_TDIFF(cl->undertime, q->now); 477 psched_tdiff_t delay = cl->undertime - q->now;
478 478
479 if (!cl->delayed) { 479 if (!cl->delayed) {
480 delay += cl->offtime; 480 delay += cl->offtime;
@@ -509,7 +509,7 @@ static void cbq_ovl_classic(struct cbq_class *cl)
509 psched_tdiff_t base_delay = q->wd_expires; 509 psched_tdiff_t base_delay = q->wd_expires;
510 510
511 for (b = cl->borrow; b; b = b->borrow) { 511 for (b = cl->borrow; b; b = b->borrow) {
512 delay = PSCHED_TDIFF(b->undertime, q->now); 512 delay = b->undertime - q->now;
513 if (delay < base_delay) { 513 if (delay < base_delay) {
514 if (delay <= 0) 514 if (delay <= 0)
515 delay = 1; 515 delay = 1;
@@ -547,7 +547,7 @@ static void cbq_ovl_rclassic(struct cbq_class *cl)
547static void cbq_ovl_delay(struct cbq_class *cl) 547static void cbq_ovl_delay(struct cbq_class *cl)
548{ 548{
549 struct cbq_sched_data *q = qdisc_priv(cl->qdisc); 549 struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
550 psched_tdiff_t delay = PSCHED_TDIFF(cl->undertime, q->now); 550 psched_tdiff_t delay = cl->undertime - q->now;
551 551
552 if (!cl->delayed) { 552 if (!cl->delayed) {
553 psched_time_t sched = q->now; 553 psched_time_t sched = q->now;
@@ -776,7 +776,7 @@ cbq_update(struct cbq_sched_data *q)
776 idle = (now - last) - last_pktlen/rate 776 idle = (now - last) - last_pktlen/rate
777 */ 777 */
778 778
779 idle = PSCHED_TDIFF(q->now, cl->last); 779 idle = q->now - cl->last;
780 if ((unsigned long)idle > 128*1024*1024) { 780 if ((unsigned long)idle > 128*1024*1024) {
781 avgidle = cl->maxidle; 781 avgidle = cl->maxidle;
782 } else { 782 } else {
@@ -1004,7 +1004,7 @@ cbq_dequeue(struct Qdisc *sch)
1004 psched_tdiff_t incr; 1004 psched_tdiff_t incr;
1005 1005
1006 PSCHED_GET_TIME(now); 1006 PSCHED_GET_TIME(now);
1007 incr = PSCHED_TDIFF(now, q->now_rt); 1007 incr = now - q->now_rt;
1008 1008
1009 if (q->tx_class) { 1009 if (q->tx_class) {
1010 psched_tdiff_t incr2; 1010 psched_tdiff_t incr2;
@@ -1650,7 +1650,7 @@ cbq_dump_class_stats(struct Qdisc *sch, unsigned long arg,
1650 cl->xstats.undertime = 0; 1650 cl->xstats.undertime = 0;
1651 1651
1652 if (cl->undertime != PSCHED_PASTPERFECT) 1652 if (cl->undertime != PSCHED_PASTPERFECT)
1653 cl->xstats.undertime = PSCHED_TDIFF(cl->undertime, q->now); 1653 cl->xstats.undertime = cl->undertime - q->now;
1654 1654
1655 if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || 1655 if (gnet_stats_copy_basic(d, &cl->bstats) < 0 ||
1656#ifdef CONFIG_NET_ESTIMATOR 1656#ifdef CONFIG_NET_ESTIMATOR