summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-wrt-2.4.30/205-net_sched_sched_generic_c.patch
blob: 9de11d38ed0a3936bb2bf7ba850c309403c40b1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--- linux-2.4.30/net/sched/sch_generic.c	2004-11-17 12:54:22.000000000 +0100
+++ linux-2.4.30-wl/net/sched/sch_generic.c	2005-04-24 18:09:38.000000000 +0200
@@ -392,7 +392,6 @@
 		return NULL;
 	memset(sch, 0, size);
 
-	INIT_LIST_HEAD(&sch->list);
 	skb_queue_head_init(&sch->q);
 	sch->ops = ops;
 	sch->enqueue = ops->enqueue;
@@ -422,11 +421,22 @@
 void qdisc_destroy(struct Qdisc *qdisc)
 {
 	struct Qdisc_ops *ops = qdisc->ops;
+	struct net_device *dev;
 
 	if (qdisc->flags&TCQ_F_BUILTIN ||
 	    !atomic_dec_and_test(&qdisc->refcnt))
 		return;
-	list_del(&qdisc->list);
+
+	dev = qdisc->dev;
+	if (dev) {
+		struct Qdisc *q, **qp;
+		for (qp = &qdisc->dev->qdisc_list; (q=*qp) != NULL; qp = &q->next) {
+			if (q == qdisc) {
+				*qp = q->next;
+				break;
+			}
+		}
+	}
 #ifdef CONFIG_NET_ESTIMATOR
 	qdisc_kill_estimator(&qdisc->stats);
 #endif
@@ -455,9 +465,9 @@
 				return;
 			}
 			write_lock(&qdisc_tree_lock);
-			list_add_tail(&qdisc->list, &dev->qdisc_list);
+			qdisc->next = dev->qdisc_list;
+			dev->qdisc_list = qdisc;
 			write_unlock(&qdisc_tree_lock);
-
 		} else {
 			qdisc =  &noqueue_qdisc;
 		}
@@ -501,7 +511,7 @@
 	dev->qdisc = &noop_qdisc;
 	spin_unlock_bh(&dev->queue_lock);
 	dev->qdisc_sleeping = &noop_qdisc;
-	INIT_LIST_HEAD(&dev->qdisc_list);
+	dev->qdisc_list = NULL;
 	write_unlock(&qdisc_tree_lock);
 
 	dev_watchdog_init(dev);
@@ -523,7 +533,7 @@
 		qdisc_destroy(qdisc);
         }
 #endif
-	BUG_TRAP(list_empty(&dev->qdisc_list));
+	BUG_TRAP(dev->qdisc_list == NULL);
 	BUG_TRAP(!timer_pending(&dev->watchdog_timer));
 	spin_unlock_bh(&dev->queue_lock);
 	write_unlock(&qdisc_tree_lock);