diff options
Diffstat (limited to 'net/sched/sch_red.c')
-rw-r--r-- | net/sched/sch_red.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index ce2256a17d7e..a5cc3012cf42 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -41,6 +41,7 @@ struct red_sched_data { | |||
41 | unsigned char flags; | 41 | unsigned char flags; |
42 | struct timer_list adapt_timer; | 42 | struct timer_list adapt_timer; |
43 | struct red_parms parms; | 43 | struct red_parms parms; |
44 | struct red_vars vars; | ||
44 | struct red_stats stats; | 45 | struct red_stats stats; |
45 | struct Qdisc *qdisc; | 46 | struct Qdisc *qdisc; |
46 | }; | 47 | }; |
@@ -61,12 +62,14 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
61 | struct Qdisc *child = q->qdisc; | 62 | struct Qdisc *child = q->qdisc; |
62 | int ret; | 63 | int ret; |
63 | 64 | ||
64 | q->parms.qavg = red_calc_qavg(&q->parms, child->qstats.backlog); | 65 | q->vars.qavg = red_calc_qavg(&q->parms, |
66 | &q->vars, | ||
67 | child->qstats.backlog); | ||
65 | 68 | ||
66 | if (red_is_idling(&q->parms)) | 69 | if (red_is_idling(&q->vars)) |
67 | red_end_of_idle_period(&q->parms); | 70 | red_end_of_idle_period(&q->vars); |
68 | 71 | ||
69 | switch (red_action(&q->parms, q->parms.qavg)) { | 72 | switch (red_action(&q->parms, &q->vars, q->vars.qavg)) { |
70 | case RED_DONT_MARK: | 73 | case RED_DONT_MARK: |
71 | break; | 74 | break; |
72 | 75 | ||
@@ -117,8 +120,8 @@ static struct sk_buff *red_dequeue(struct Qdisc *sch) | |||
117 | qdisc_bstats_update(sch, skb); | 120 | qdisc_bstats_update(sch, skb); |
118 | sch->q.qlen--; | 121 | sch->q.qlen--; |
119 | } else { | 122 | } else { |
120 | if (!red_is_idling(&q->parms)) | 123 | if (!red_is_idling(&q->vars)) |
121 | red_start_of_idle_period(&q->parms); | 124 | red_start_of_idle_period(&q->vars); |
122 | } | 125 | } |
123 | return skb; | 126 | return skb; |
124 | } | 127 | } |
@@ -144,8 +147,8 @@ static unsigned int red_drop(struct Qdisc *sch) | |||
144 | return len; | 147 | return len; |
145 | } | 148 | } |
146 | 149 | ||
147 | if (!red_is_idling(&q->parms)) | 150 | if (!red_is_idling(&q->vars)) |
148 | red_start_of_idle_period(&q->parms); | 151 | red_start_of_idle_period(&q->vars); |
149 | 152 | ||
150 | return 0; | 153 | return 0; |
151 | } | 154 | } |
@@ -156,7 +159,7 @@ static void red_reset(struct Qdisc *sch) | |||
156 | 159 | ||
157 | qdisc_reset(q->qdisc); | 160 | qdisc_reset(q->qdisc); |
158 | sch->q.qlen = 0; | 161 | sch->q.qlen = 0; |
159 | red_restart(&q->parms); | 162 | red_restart(&q->vars); |
160 | } | 163 | } |
161 | 164 | ||
162 | static void red_destroy(struct Qdisc *sch) | 165 | static void red_destroy(struct Qdisc *sch) |
@@ -212,17 +215,19 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt) | |||
212 | q->qdisc = child; | 215 | q->qdisc = child; |
213 | } | 216 | } |
214 | 217 | ||
215 | red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, | 218 | red_set_parms(&q->parms, |
219 | ctl->qth_min, ctl->qth_max, ctl->Wlog, | ||
216 | ctl->Plog, ctl->Scell_log, | 220 | ctl->Plog, ctl->Scell_log, |
217 | nla_data(tb[TCA_RED_STAB]), | 221 | nla_data(tb[TCA_RED_STAB]), |
218 | max_P); | 222 | max_P); |
223 | red_set_vars(&q->vars); | ||
219 | 224 | ||
220 | del_timer(&q->adapt_timer); | 225 | del_timer(&q->adapt_timer); |
221 | if (ctl->flags & TC_RED_ADAPTATIVE) | 226 | if (ctl->flags & TC_RED_ADAPTATIVE) |
222 | mod_timer(&q->adapt_timer, jiffies + HZ/2); | 227 | mod_timer(&q->adapt_timer, jiffies + HZ/2); |
223 | 228 | ||
224 | if (!q->qdisc->q.qlen) | 229 | if (!q->qdisc->q.qlen) |
225 | red_start_of_idle_period(&q->parms); | 230 | red_start_of_idle_period(&q->vars); |
226 | 231 | ||
227 | sch_tree_unlock(sch); | 232 | sch_tree_unlock(sch); |
228 | return 0; | 233 | return 0; |
@@ -235,7 +240,7 @@ static inline void red_adaptative_timer(unsigned long arg) | |||
235 | spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch)); | 240 | spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch)); |
236 | 241 | ||
237 | spin_lock(root_lock); | 242 | spin_lock(root_lock); |
238 | red_adaptative_algo(&q->parms); | 243 | red_adaptative_algo(&q->parms, &q->vars); |
239 | mod_timer(&q->adapt_timer, jiffies + HZ/2); | 244 | mod_timer(&q->adapt_timer, jiffies + HZ/2); |
240 | spin_unlock(root_lock); | 245 | spin_unlock(root_lock); |
241 | } | 246 | } |