diff -ru linux-2.6.4-esfq-old/net/sched/sch_esfq.c linux-2.6.4-esfq-new/net/sched/sch_esfq.c
--- linux-2.6.4-esfq-old/net/sched/sch_esfq.c	2004-03-12 00:33:21.000000000 -0800
+++ linux-2.6.4-esfq-new/net/sched/sch_esfq.c	2004-03-12 00:51:56.000000000 -0800
@@ -20,7 +20,7 @@
 #include <asm/bitops.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
+#include <linux/jiffies.h>
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/socket.h>
@@ -109,10 +109,6 @@
 	return h & (q->hash_divisor-1);
 }
 
-#ifndef IPPROTO_ESP
-#define IPPROTO_ESP 50
-#endif
-
 static unsigned esfq_hash(struct esfq_sched_data *q, struct sk_buff *skb)
 {
 	u32 h, h2;
@@ -164,7 +160,7 @@
 	return esfq_fold_hash_classic(q, h, h2);
 }
 
-extern __inline__ void esfq_link(struct esfq_sched_data *q, esfq_index x)
+static inline void esfq_link(struct esfq_sched_data *q, esfq_index x)
 {
 	esfq_index p, n;
 	int d = q->qs[x].qlen + q->depth;
@@ -176,7 +172,7 @@
 	q->dep[p].next = q->dep[n].prev = x;
 }
 
-extern __inline__ void esfq_dec(struct esfq_sched_data *q, esfq_index x)
+static inline void esfq_dec(struct esfq_sched_data *q, esfq_index x)
 {
 	esfq_index p, n;
 
@@ -191,7 +187,7 @@
 	esfq_link(q, x);
 }
 
-extern __inline__ void esfq_inc(struct esfq_sched_data *q, esfq_index x)
+static inline void esfq_inc(struct esfq_sched_data *q, esfq_index x)
 {
 	esfq_index p, n;
 	int d;
@@ -212,6 +208,7 @@
 	struct esfq_sched_data *q = (struct esfq_sched_data *)sch->data;
 	esfq_index d = q->max_depth;
 	struct sk_buff *skb;
+	unsigned int len;
 
 	/* Queue is full! Find the longest slot and
 	   drop a packet from it */
@@ -219,12 +216,13 @@
 	if (d > 1) {
 		esfq_index x = q->dep[d+q->depth].next;
 		skb = q->qs[x].prev;
+		len = skb->len;
 		__skb_unlink(skb, &q->qs[x]);
 		kfree_skb(skb);
 		esfq_dec(q, x);
 		sch->q.qlen--;
 		sch->stats.drops++;
-		return 1;
+		return len;
 	}
 
 	if (d == 1) {
@@ -233,13 +231,14 @@
 		q->next[q->tail] = q->next[d];
 		q->allot[q->next[d]] += q->quantum;
 		skb = q->qs[d].prev;
+		len = skb->len;
 		__skb_unlink(skb, &q->qs[d]);
 		kfree_skb(skb);
 		esfq_dec(q, d);
 		sch->q.qlen--;
 		q->ht[q->hash[d]] = q->depth;
 		sch->stats.drops++;
-		return 1;
+		return len;
 	}
 
 	return 0;
@@ -339,6 +338,7 @@
 	
 	/* Is the slot empty? */
 	if (q->qs[a].qlen == 0) {
+		q->ht[q->hash[a]] = depth;
 		a = q->next[a];
 		if (a == old_a) {
 			q->tail = depth;
@@ -428,9 +428,9 @@
 	if (opt && opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
 		return -EINVAL;
 
+	init_timer(&q->perturb_timer);
 	q->perturb_timer.data = (unsigned long)sch;
 	q->perturb_timer.function = esfq_perturbation;
-	init_timer(&q->perturb_timer);
 	q->perturbation = 0;
 	q->hash_kind = TCA_SFQ_HASH_CLASSIC;
 	q->max_depth = 0;
@@ -494,7 +494,6 @@
 	
 	for (i=0; i<q->depth; i++)
 		esfq_link(q, i);
-	MOD_INC_USE_COUNT;
 	return 0;
 err_case:
 	if (q->ht)
@@ -528,7 +527,6 @@
 		kfree(q->hash);
 	if(q->qs)
 		kfree(q->qs);
-	MOD_DEC_USE_COUNT;
 }
 
 static int esfq_dump(struct Qdisc *sch, struct sk_buff *skb)
@@ -554,35 +552,32 @@
 	return -1;
 }
 
-struct Qdisc_ops esfq_qdisc_ops =
+static struct Qdisc_ops esfq_qdisc_ops =
 {
-	NULL,
-	NULL,
-	"esfq",
-	sizeof(struct esfq_sched_data),
-
-	esfq_enqueue,
-	esfq_dequeue,
-	esfq_requeue,
-	esfq_drop,
-
-	esfq_init,
-	esfq_reset,
-	esfq_destroy,
-	NULL, /* esfq_change - needs more work */
-
-	esfq_dump,
+	.next		=	NULL,
+	.cl_ops		=	NULL,
+	.id		=	"esfq",
+	.priv_size	=	sizeof(struct esfq_sched_data),
+	.enqueue	=	esfq_enqueue,
+	.dequeue	=	esfq_dequeue,
+	.requeue	=	esfq_requeue,
+	.drop		=	esfq_drop,
+	.init		=	esfq_init,
+	.reset		=	esfq_reset,
+	.destroy	=	esfq_destroy,
+	.change		=	NULL, /* esfq_change - needs more work */
+	.dump		=	esfq_dump,
+	.owner		=	THIS_MODULE,
 };
 
-#ifdef MODULE
-int init_module(void)
+static int __init esfq_module_init(void)
 {
 	return register_qdisc(&esfq_qdisc_ops);
 }
-
-void cleanup_module(void) 
+static void __exit esfq_module_exit(void) 
 {
 	unregister_qdisc(&esfq_qdisc_ops);
 }
-#endif
+module_init(esfq_module_init)
+module_exit(esfq_module_exit)
 MODULE_LICENSE("GPL");
