aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-11-05 15:14:23 -0500
committerThomas Graf <tgr@axs.localdomain>2005-11-05 16:02:28 -0500
commit7051703b990ec40bdf192ec7c87ffafd7011c640 (patch)
treeb32b6579fd3598a9808f173e5da9f5266eb472cf /net/sched
parent4a591834cfc79b2ff74457e976420361f8ae28b4 (diff)
[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')
-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 29869a07748..a545532be2c 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -89,6 +89,7 @@ struct gred_sched
89 unsigned long flags; 89 unsigned long flags;
90 u32 DPs; 90 u32 DPs;
91 u32 def; 91 u32 def;
92 struct red_parms wred_set;
92}; 93};
93 94
94static inline int gred_wred_mode(struct gred_sched *table) 95static inline int gred_wred_mode(struct gred_sched *table)
@@ -158,6 +159,19 @@ static inline u16 tc_index_to_dp(struct sk_buff *skb)
158 return skb->tc_index & GRED_VQ_MASK; 159 return skb->tc_index & GRED_VQ_MASK;
159} 160}
160 161
162static inline void gred_load_wred_set(struct gred_sched *table,
163 struct gred_sched_data *q)
164{
165 q->parms.qavg = table->wred_set.qavg;
166 q->parms.qidlestart = table->wred_set.qidlestart;
167}
168
169static inline void gred_store_wred_set(struct gred_sched *table,
170 struct gred_sched_data *q)
171{
172 table->wred_set.qavg = q->parms.qavg;
173}
174
161static int 175static int
162gred_enqueue(struct sk_buff *skb, struct Qdisc* sch) 176gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
163{ 177{
@@ -204,8 +218,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
204 218
205 if (gred_wred_mode(t)) { 219 if (gred_wred_mode(t)) {
206 qavg = 0; 220 qavg = 0;
207 q->parms.qavg = t->tab[t->def]->parms.qavg; 221 gred_load_wred_set(t, q);
208 q->parms.qidlestart = t->tab[t->def]->parms.qidlestart;
209 } 222 }
210 223
211 q->parms.qavg = red_calc_qavg(&q->parms, gred_backlog(t, q, sch)); 224 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)
214 red_end_of_idle_period(&q->parms); 227 red_end_of_idle_period(&q->parms);
215 228
216 if (gred_wred_mode(t)) 229 if (gred_wred_mode(t))
217 t->tab[t->def]->parms.qavg = q->parms.qavg; 230 gred_store_wred_set(t, q);
218 231
219 switch (red_action(&q->parms, q->parms.qavg + qavg)) { 232 switch (red_action(&q->parms, q->parms.qavg + qavg)) {
220 case RED_DONT_MARK: 233 case RED_DONT_MARK:
@@ -293,14 +306,8 @@ gred_dequeue(struct Qdisc* sch)
293 return skb; 306 return skb;
294 } 307 }
295 308
296 if (gred_wred_mode(t)) { 309 if (gred_wred_mode(t))
297 q= t->tab[t->def]; 310 red_start_of_idle_period(&t->wred_set);
298 if (!q)
299 D2PRINTK("no default VQ set: Results will be "
300 "screwed up\n");
301 else
302 red_start_of_idle_period(&q->parms);
303 }
304 311
305 return NULL; 312 return NULL;
306} 313}
@@ -334,13 +341,9 @@ static unsigned int gred_drop(struct Qdisc* sch)
334 return len; 341 return len;
335 } 342 }
336 343
337 q=t->tab[t->def]; 344 if (gred_wred_mode(t))
338 if (!q) { 345 red_start_of_idle_period(&t->wred_set);
339 D2PRINTK("no default VQ set: Results might be screwed up\n");
340 return 0;
341 }
342 346
343 red_start_of_idle_period(&q->parms);
344 return 0; 347 return 0;
345 348
346} 349}