aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_multiq.c
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2008-10-31 03:45:55 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-31 03:45:55 -0400
commit8e3af97899db433111287e07d5105189f56fe191 (patch)
tree40e7779ea4b587c9c3b882018ccaac1b53419f1c /net/sched/sch_multiq.c
parent99c0db26797edb39cf83c8c5f8972067f5426b4e (diff)
pkt_sched: Add qdisc->ops->peek() implementation.
Add qdisc->ops->peek() implementation for work-conserving qdiscs. With feedback from Patrick McHardy. Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_multiq.c')
-rw-r--r--net/sched/sch_multiq.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c
index 915f3149dde2..155648d23b7c 100644
--- a/net/sched/sch_multiq.c
+++ b/net/sched/sch_multiq.c
@@ -155,6 +155,34 @@ static struct sk_buff *multiq_dequeue(struct Qdisc *sch)
155 155
156} 156}
157 157
158static struct sk_buff *multiq_peek(struct Qdisc *sch)
159{
160 struct multiq_sched_data *q = qdisc_priv(sch);
161 unsigned int curband = q->curband;
162 struct Qdisc *qdisc;
163 struct sk_buff *skb;
164 int band;
165
166 for (band = 0; band < q->bands; band++) {
167 /* cycle through bands to ensure fairness */
168 curband++;
169 if (curband >= q->bands)
170 curband = 0;
171
172 /* Check that target subqueue is available before
173 * pulling an skb to avoid excessive requeues
174 */
175 if (!__netif_subqueue_stopped(qdisc_dev(sch), curband)) {
176 qdisc = q->queues[curband];
177 skb = qdisc->ops->peek(qdisc);
178 if (skb)
179 return skb;
180 }
181 }
182 return NULL;
183
184}
185
158static unsigned int multiq_drop(struct Qdisc *sch) 186static unsigned int multiq_drop(struct Qdisc *sch)
159{ 187{
160 struct multiq_sched_data *q = qdisc_priv(sch); 188 struct multiq_sched_data *q = qdisc_priv(sch);
@@ -451,6 +479,7 @@ static struct Qdisc_ops multiq_qdisc_ops __read_mostly = {
451 .priv_size = sizeof(struct multiq_sched_data), 479 .priv_size = sizeof(struct multiq_sched_data),
452 .enqueue = multiq_enqueue, 480 .enqueue = multiq_enqueue,
453 .dequeue = multiq_dequeue, 481 .dequeue = multiq_dequeue,
482 .peek = multiq_peek,
454 .requeue = multiq_requeue, 483 .requeue = multiq_requeue,
455 .drop = multiq_drop, 484 .drop = multiq_drop,
456 .init = multiq_init, 485 .init = multiq_init,