diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2008-10-31 00:46:19 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-31 00:46:19 -0700 |
commit | 03c05f0d4bb0c267edf12d614025a40e33c5a6f9 (patch) | |
tree | c23b79ed8b7dfcdabb872f5c114541ae2de8ac0f /net/sched/sch_netem.c | |
parent | 8e3af97899db433111287e07d5105189f56fe191 (diff) | |
download | linux-03c05f0d4bb0c267edf12d614025a40e33c5a6f9.tar.gz linux-03c05f0d4bb0c267edf12d614025a40e33c5a6f9.tar.bz2 linux-03c05f0d4bb0c267edf12d614025a40e33c5a6f9.zip |
pkt_sched: Use qdisc->ops->peek() instead of ->dequeue() & ->requeue()
Use qdisc->ops->peek() instead of ->dequeue() & ->requeue() pair.
After this patch the only remaining user of qdisc->ops->requeue() is
netem_enqueue(). Based on ideas of Herbert Xu, Patrick McHardy and
David S. Miller.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_netem.c')
-rw-r--r-- | net/sched/sch_netem.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 2898d9dc31eb..74fbdb52baed 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -283,25 +283,22 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch) if (sch->flags & TCQ_F_THROTTLED) return NULL; - skb = q->qdisc->dequeue(q->qdisc); + skb = q->qdisc->ops->peek(q->qdisc); if (skb) { const struct netem_skb_cb *cb = netem_skb_cb(skb); psched_time_t now = psched_get_time(); /* if more time remaining? */ if (cb->time_to_send <= now) { + skb = q->qdisc->dequeue(q->qdisc); + if (!skb) + return NULL; + pr_debug("netem_dequeue: return skb=%p\n", skb); sch->q.qlen--; return skb; } - if (unlikely(q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS)) { - qdisc_tree_decrease_qlen(q->qdisc, 1); - sch->qstats.drops++; - printk(KERN_ERR "netem: %s could not requeue\n", - q->qdisc->ops->id); - } - qdisc_watchdog_schedule(&q->watchdog, cb->time_to_send); } |