aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/pkt_sched.h3
-rw-r--r--include/net/red.h4
-rw-r--r--net/sched/sch_cbq.c17
-rw-r--r--net/sched/sch_netem.c2
4 files changed, 12 insertions, 14 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 49325ffb00b1..c40147a60205 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -54,8 +54,7 @@ typedef long psched_tdiff_t;
54#define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2)) 54#define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2))
55#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ 55#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \
56 min_t(long long, (tv1) - (tv2), bound) 56 min_t(long long, (tv1) - (tv2), bound)
57#define PSCHED_SET_PASTPERFECT(t) ((t) = 0) 57#define PSCHED_PASTPERFECT 0
58#define PSCHED_IS_PASTPERFECT(t) ((t) == 0)
59 58
60struct qdisc_watchdog { 59struct qdisc_watchdog {
61 struct hrtimer timer; 60 struct hrtimer timer;
diff --git a/include/net/red.h b/include/net/red.h
index a4eb37946f2c..d9e1149a2bca 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -151,7 +151,7 @@ static inline void red_set_parms(struct red_parms *p,
151 151
152static inline int red_is_idling(struct red_parms *p) 152static inline int red_is_idling(struct red_parms *p)
153{ 153{
154 return !PSCHED_IS_PASTPERFECT(p->qidlestart); 154 return p->qidlestart != PSCHED_PASTPERFECT;
155} 155}
156 156
157static inline void red_start_of_idle_period(struct red_parms *p) 157static inline void red_start_of_idle_period(struct red_parms *p)
@@ -161,7 +161,7 @@ static inline void red_start_of_idle_period(struct red_parms *p)
161 161
162static inline void red_end_of_idle_period(struct red_parms *p) 162static inline void red_end_of_idle_period(struct red_parms *p)
163{ 163{
164 PSCHED_SET_PASTPERFECT(p->qidlestart); 164 p->qidlestart = PSCHED_PASTPERFECT;
165} 165}
166 166
167static inline void red_restart(struct red_parms *p) 167static inline void red_restart(struct red_parms *p)
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 9e6cdab6af3b..2bb271b0efc3 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -738,7 +738,7 @@ cbq_update_toplevel(struct cbq_sched_data *q, struct cbq_class *cl,
738 if (cl && q->toplevel >= borrowed->level) { 738 if (cl && q->toplevel >= borrowed->level) {
739 if (cl->q->q.qlen > 1) { 739 if (cl->q->q.qlen > 1) {
740 do { 740 do {
741 if (PSCHED_IS_PASTPERFECT(borrowed->undertime)) { 741 if (borrowed->undertime == PSCHED_PASTPERFECT) {
742 q->toplevel = borrowed->level; 742 q->toplevel = borrowed->level;
743 return; 743 return;
744 } 744 }
@@ -824,7 +824,7 @@ cbq_update(struct cbq_sched_data *q)
824 } else { 824 } else {
825 /* Underlimit */ 825 /* Underlimit */
826 826
827 PSCHED_SET_PASTPERFECT(cl->undertime); 827 cl->undertime = PSCHED_PASTPERFECT;
828 if (avgidle > cl->maxidle) 828 if (avgidle > cl->maxidle)
829 cl->avgidle = cl->maxidle; 829 cl->avgidle = cl->maxidle;
830 else 830 else
@@ -845,7 +845,7 @@ cbq_under_limit(struct cbq_class *cl)
845 if (cl->tparent == NULL) 845 if (cl->tparent == NULL)
846 return cl; 846 return cl;
847 847
848 if (PSCHED_IS_PASTPERFECT(cl->undertime) || q->now >= cl->undertime) { 848 if (cl->undertime == PSCHED_PASTPERFECT || q->now >= cl->undertime) {
849 cl->delayed = 0; 849 cl->delayed = 0;
850 return cl; 850 return cl;
851 } 851 }
@@ -868,8 +868,7 @@ cbq_under_limit(struct cbq_class *cl)
868 } 868 }
869 if (cl->level > q->toplevel) 869 if (cl->level > q->toplevel)
870 return NULL; 870 return NULL;
871 } while (!PSCHED_IS_PASTPERFECT(cl->undertime) && 871 } while (cl->undertime != PSCHED_PASTPERFECT && q->now < cl->undertime);
872 q->now < cl->undertime);
873 872
874 cl->delayed = 0; 873 cl->delayed = 0;
875 return cl; 874 return cl;
@@ -1054,11 +1053,11 @@ cbq_dequeue(struct Qdisc *sch)
1054 */ 1053 */
1055 1054
1056 if (q->toplevel == TC_CBQ_MAXLEVEL && 1055 if (q->toplevel == TC_CBQ_MAXLEVEL &&
1057 PSCHED_IS_PASTPERFECT(q->link.undertime)) 1056 q->link.undertime == PSCHED_PASTPERFECT)
1058 break; 1057 break;
1059 1058
1060 q->toplevel = TC_CBQ_MAXLEVEL; 1059 q->toplevel = TC_CBQ_MAXLEVEL;
1061 PSCHED_SET_PASTPERFECT(q->link.undertime); 1060 q->link.undertime = PSCHED_PASTPERFECT;
1062 } 1061 }
1063 1062
1064 /* No packets in scheduler or nobody wants to give them to us :-( 1063 /* No packets in scheduler or nobody wants to give them to us :-(
@@ -1289,7 +1288,7 @@ cbq_reset(struct Qdisc* sch)
1289 qdisc_reset(cl->q); 1288 qdisc_reset(cl->q);
1290 1289
1291 cl->next_alive = NULL; 1290 cl->next_alive = NULL;
1292 PSCHED_SET_PASTPERFECT(cl->undertime); 1291 cl->undertime = PSCHED_PASTPERFECT;
1293 cl->avgidle = cl->maxidle; 1292 cl->avgidle = cl->maxidle;
1294 cl->deficit = cl->quantum; 1293 cl->deficit = cl->quantum;
1295 cl->cpriority = cl->priority; 1294 cl->cpriority = cl->priority;
@@ -1650,7 +1649,7 @@ cbq_dump_class_stats(struct Qdisc *sch, unsigned long arg,
1650 cl->xstats.avgidle = cl->avgidle; 1649 cl->xstats.avgidle = cl->avgidle;
1651 cl->xstats.undertime = 0; 1650 cl->xstats.undertime = 0;
1652 1651
1653 if (!PSCHED_IS_PASTPERFECT(cl->undertime)) 1652 if (cl->undertime != PSCHED_PASTPERFECT)
1654 cl->xstats.undertime = PSCHED_TDIFF(cl->undertime, q->now); 1653 cl->xstats.undertime = PSCHED_TDIFF(cl->undertime, q->now);
1655 1654
1656 if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || 1655 if (gnet_stats_copy_basic(d, &cl->bstats) < 0 ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 5d571aa04a76..1e88301f505c 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -532,7 +532,7 @@ static int tfifo_init(struct Qdisc *sch, struct rtattr *opt)
532 } else 532 } else
533 q->limit = max_t(u32, sch->dev->tx_queue_len, 1); 533 q->limit = max_t(u32, sch->dev->tx_queue_len, 1);
534 534
535 PSCHED_SET_PASTPERFECT(q->oldest); 535 q->oldest = PSCHED_PASTPERFECT;
536 return 0; 536 return 0;
537} 537}
538 538