summaryrefslogtreecommitdiffstats
path: root/net/sched/sch_gred.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-11-05 21:14:23 +0100
committerThomas Graf <tgr@axs.localdomain>2005-11-05 22:02:28 +0100
commit7051703b990ec40bdf192ec7c87ffafd7011c640 (patch)
treeb32b6579fd3598a9808f173e5da9f5266eb472cf /net/sched/sch_gred.c
parent4a591834cfc79b2ff74457e976420361f8ae28b4 (diff)
downloadlinux-7051703b990ec40bdf192ec7c87ffafd7011c640.tar.bz2
[PKT_SCHED]: GRED: Dont abuse default VQ for equalizing
Introduces a new red parameter set for use in equalize mode, although only the qavg variable and the idle period marker are being used for now this makes it possible to allow a separate parameter set to be used for equalize later on. The use of this separate parameter set fixes a bogus start of an idle period in gred_drop() which did start an idle period on the default VQ even if equalize mode was disabled. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/sched/sch_gred.c')
-rw-r--r--net/sched/sch_gred.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index 29869a077480..a545532be2c4 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -89,6 +89,7 @@ struct gred_sched
unsigned long flags;
u32 DPs;
u32 def;
+ struct red_parms wred_set;
};
static inline int gred_wred_mode(struct gred_sched *table)
@@ -158,6 +159,19 @@ static inline u16 tc_index_to_dp(struct sk_buff *skb)
return skb->tc_index & GRED_VQ_MASK;
}
+static inline void gred_load_wred_set(struct gred_sched *table,
+ struct gred_sched_data *q)
+{
+ q->parms.qavg = table->wred_set.qavg;
+ q->parms.qidlestart = table->wred_set.qidlestart;
+}
+
+static inline void gred_store_wred_set(struct gred_sched *table,
+ struct gred_sched_data *q)
+{
+ table->wred_set.qavg = q->parms.qavg;
+}
+
static int
gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
{
@@ -204,8 +218,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
if (gred_wred_mode(t)) {
qavg = 0;
- q->parms.qavg = t->tab[t->def]->parms.qavg;
- q->parms.qidlestart = t->tab[t->def]->parms.qidlestart;
+ gred_load_wred_set(t, q);
}
q->parms.qavg = red_calc_qavg(&q->parms, gred_backlog(t, q, sch));
@@ -214,7 +227,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
red_end_of_idle_period(&q->parms);
if (gred_wred_mode(t))
- t->tab[t->def]->parms.qavg = q->parms.qavg;
+ gred_store_wred_set(t, q);
switch (red_action(&q->parms, q->parms.qavg + qavg)) {
case RED_DONT_MARK:
@@ -293,14 +306,8 @@ gred_dequeue(struct Qdisc* sch)
return skb;
}
- if (gred_wred_mode(t)) {
- q= t->tab[t->def];
- if (!q)
- D2PRINTK("no default VQ set: Results will be "
- "screwed up\n");
- else
- red_start_of_idle_period(&q->parms);
- }
+ if (gred_wred_mode(t))
+ red_start_of_idle_period(&t->wred_set);
return NULL;
}
@@ -334,13 +341,9 @@ static unsigned int gred_drop(struct Qdisc* sch)
return len;
}
- q=t->tab[t->def];
- if (!q) {
- D2PRINTK("no default VQ set: Results might be screwed up\n");
- return 0;
- }
+ if (gred_wred_mode(t))
+ red_start_of_idle_period(&t->wred_set);
- red_start_of_idle_period(&q->parms);
return 0;
}