Subject: [PATCH] sched: teql_enqueue can check limits before skb enqueue

From: Krishna Kumar <[email-masked]>
Date: Tue, 08 May 2007 13:01:24 +0530

Optimize teql_enqueue so that it first checks limits before
enqueing.

Patch against net-2.6.22.git

Signed-off-by: Krishna Kumar <[email-masked]>
---
diff -ruNp org/net/sched/sch_teql.c new/net/sched/sch_teql.c
--- org/net/sched/sch_teql.c	2007-04-09 12:37:41.000000000 +0530
+++ new/net/sched/sch_teql.c	2007-04-09 12:39:15.000000000 +0530
@@ -94,14 +94,13 @@ teql_enqueue(struct sk_buff *skb, struct
 	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;