summaryrefslogtreecommitdiff
path: root/net/sched/sch_atm.c
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2008-10-31 00:46:19 -0700
committerDavid S. Miller <davem@davemloft.net>2008-10-31 00:46:19 -0700
commit03c05f0d4bb0c267edf12d614025a40e33c5a6f9 (patch)
treec23b79ed8b7dfcdabb872f5c114541ae2de8ac0f /net/sched/sch_atm.c
parent8e3af97899db433111287e07d5105189f56fe191 (diff)
downloadlwn-03c05f0d4bb0c267edf12d614025a40e33c5a6f9.tar.gz
lwn-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_atm.c')
-rw-r--r--net/sched/sch_atm.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index f9eac0818d18..2ee0c1a8efa9 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -480,11 +480,14 @@ static void sch_atm_dequeue(unsigned long data)
* If traffic is properly shaped, this won't generate nasty
* little bursts. Otherwise, it may ... (but that's okay)
*/
- while ((skb = flow->q->dequeue(flow->q))) {
- if (!atm_may_send(flow->vcc, skb->truesize)) {
- (void)flow->q->ops->requeue(skb, flow->q);
+ while ((skb = flow->q->ops->peek(flow->q))) {
+ if (!atm_may_send(flow->vcc, skb->truesize))
break;
- }
+
+ skb = flow->q->dequeue(flow->q);
+ if (unlikely(!skb))
+ break;
+
pr_debug("atm_tc_dequeue: sending on class %p\n", flow);
/* remove any LL header somebody else has attached */
skb_pull(skb, skb_network_offset(skb));