diff options
Diffstat (limited to 'net/sched/sch_red.c')
-rw-r--r-- | net/sched/sch_red.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index 5da05839e225..2bdf241f6315 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -108,23 +108,6 @@ congestion_drop: | |||
108 | return NET_XMIT_CN; | 108 | return NET_XMIT_CN; |
109 | } | 109 | } |
110 | 110 | ||
111 | static int red_requeue(struct sk_buff *skb, struct Qdisc* sch) | ||
112 | { | ||
113 | struct red_sched_data *q = qdisc_priv(sch); | ||
114 | struct Qdisc *child = q->qdisc; | ||
115 | int ret; | ||
116 | |||
117 | if (red_is_idling(&q->parms)) | ||
118 | red_end_of_idle_period(&q->parms); | ||
119 | |||
120 | ret = child->ops->requeue(skb, child); | ||
121 | if (likely(ret == NET_XMIT_SUCCESS)) { | ||
122 | sch->qstats.requeues++; | ||
123 | sch->q.qlen++; | ||
124 | } | ||
125 | return ret; | ||
126 | } | ||
127 | |||
128 | static struct sk_buff * red_dequeue(struct Qdisc* sch) | 111 | static struct sk_buff * red_dequeue(struct Qdisc* sch) |
129 | { | 112 | { |
130 | struct sk_buff *skb; | 113 | struct sk_buff *skb; |
@@ -140,6 +123,14 @@ static struct sk_buff * red_dequeue(struct Qdisc* sch) | |||
140 | return skb; | 123 | return skb; |
141 | } | 124 | } |
142 | 125 | ||
126 | static struct sk_buff * red_peek(struct Qdisc* sch) | ||
127 | { | ||
128 | struct red_sched_data *q = qdisc_priv(sch); | ||
129 | struct Qdisc *child = q->qdisc; | ||
130 | |||
131 | return child->ops->peek(child); | ||
132 | } | ||
133 | |||
143 | static unsigned int red_drop(struct Qdisc* sch) | 134 | static unsigned int red_drop(struct Qdisc* sch) |
144 | { | 135 | { |
145 | struct red_sched_data *q = qdisc_priv(sch); | 136 | struct red_sched_data *q = qdisc_priv(sch); |
@@ -211,7 +202,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt) | |||
211 | q->limit = ctl->limit; | 202 | q->limit = ctl->limit; |
212 | if (child) { | 203 | if (child) { |
213 | qdisc_tree_decrease_qlen(q->qdisc, q->qdisc->q.qlen); | 204 | qdisc_tree_decrease_qlen(q->qdisc, q->qdisc->q.qlen); |
214 | qdisc_destroy(xchg(&q->qdisc, child)); | 205 | qdisc_destroy(q->qdisc); |
206 | q->qdisc = child; | ||
215 | } | 207 | } |
216 | 208 | ||
217 | red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, | 209 | red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, |
@@ -292,7 +284,8 @@ static int red_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, | |||
292 | new = &noop_qdisc; | 284 | new = &noop_qdisc; |
293 | 285 | ||
294 | sch_tree_lock(sch); | 286 | sch_tree_lock(sch); |
295 | *old = xchg(&q->qdisc, new); | 287 | *old = q->qdisc; |
288 | q->qdisc = new; | ||
296 | qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); | 289 | qdisc_tree_decrease_qlen(*old, (*old)->q.qlen); |
297 | qdisc_reset(*old); | 290 | qdisc_reset(*old); |
298 | sch_tree_unlock(sch); | 291 | sch_tree_unlock(sch); |
@@ -361,7 +354,7 @@ static struct Qdisc_ops red_qdisc_ops __read_mostly = { | |||
361 | .cl_ops = &red_class_ops, | 354 | .cl_ops = &red_class_ops, |
362 | .enqueue = red_enqueue, | 355 | .enqueue = red_enqueue, |
363 | .dequeue = red_dequeue, | 356 | .dequeue = red_dequeue, |
364 | .requeue = red_requeue, | 357 | .peek = red_peek, |
365 | .drop = red_drop, | 358 | .drop = red_drop, |
366 | .init = red_init, | 359 | .init = red_init, |
367 | .reset = red_reset, | 360 | .reset = red_reset, |