[NET_SCHED]: teql_enqueue can check limits before skb enqueue
authorKrishna Kumar <krkumar2@in.ibm.com>
Wed, 9 May 2007 01:57:50 +0000 (18:57 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 11 May 2007 06:45:10 +0000 (23:45 -0700)
Optimize teql_enqueue so that it first checks limits before enqueing.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_teql.c

index d24914db786124d187fc53a546d2ab9c5ebac958..f05ad9a30b4cd67bfef9d956023367303ddb5343 100644 (file)
@@ -94,14 +94,13 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
        struct net_device *dev = sch->dev;
        struct teql_sched_data *q = qdisc_priv(sch);
 
-       __skb_queue_tail(&q->q, skb);
-       if (q->q.qlen <= dev->tx_queue_len) {
+       if (q->q.qlen < dev->tx_queue_len) {
+               __skb_queue_tail(&q->q, skb);
                sch->bstats.bytes += skb->len;
                sch->bstats.packets++;
                return 0;
        }
 
-       __skb_unlink(skb, &q->q);
        kfree_skb(skb);
        sch->qstats.drops++;
        return NET_XMIT_DROP;