diff options
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_gred.c | 37 |
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 | |||
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 | ||
94 | static inline int gred_wred_mode(struct gred_sched *table) | 95 | 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) | |||
158 | return skb->tc_index & GRED_VQ_MASK; | 159 | return skb->tc_index & GRED_VQ_MASK; |
159 | } | 160 | } |
160 | 161 | ||
162 | static 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 | |||
169 | static 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 | |||
161 | static int | 175 | static int |
162 | gred_enqueue(struct sk_buff *skb, struct Qdisc* sch) | 176 | gred_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 | } |