]> git.pld-linux.org Git - packages/kernel.git/blame - htb_3.10_3.12_2.diff
- obsolete
[packages/kernel.git] / htb_3.10_3.12_2.diff
CommitLineData
aacb9c19
AM
1--- linux-2.4.21/net/sched/sch_htb.c Thu Jun 19 09:33:50 2003
2+++ linux-2.4/net/sched/sch_htb.c Wed Jun 18 21:57:07 2003
3@@ -9,6 +9,8 @@
4 * Authors: Martin Devera, <devik@cdi.cz>
5 *
6 * Credits (in time order) for older HTB versions:
7+ * Stef Coene <stef.coene@docum.org>
8+ * HTB support at LARTC mailing list
9 * Ondrej Kraus, <krauso@barr.cz>
10 * found missing INIT_QDISC(htb)
11 * Vladimir Smelhaus, Aamer Akhter, Bert Hubert
12@@ -19,7 +21,7 @@
13 * created test case so that I was able to fix nasty bug
14 * and many others. thanks.
15 *
16- * $Id$
17+ * $Id$
18 */
19 #include <linux/config.h>
20 #include <linux/module.h>
21@@ -71,7 +73,7 @@
22 #define HTB_HYSTERESIS 1/* whether to use mode hysteresis for speedup */
23 #define HTB_QLOCK(S) spin_lock_bh(&(S)->dev->queue_lock)
24 #define HTB_QUNLOCK(S) spin_unlock_bh(&(S)->dev->queue_lock)
25-#define HTB_VER 0x3000a /* major must be matched with number suplied by TC as version */
26+#define HTB_VER 0x3000c /* major must be matched with number suplied by TC as version */
27
28 #if HTB_VER >> 16 != TC_HTB_PROTOVER
29 #error "Mismatched sch_htb.c and pkt_sch.h"
30@@ -217,6 +219,9 @@
31 /* time of nearest event per level (row) */
32 unsigned long near_ev_cache[TC_HTB_MAXDEPTH];
33
34+ /* cached value of jiffies in dequeue */
35+ unsigned long jiffies;
36+
37 /* whether we hit non-work conserving class during this dequeue; we use */
38 int nwc_hit; /* this to disable mindelay complaint in dequeue */
39
40@@ -336,7 +341,7 @@
41 static void htb_debug_dump (struct htb_sched *q)
42 {
43 int i,p;
44- printk(KERN_DEBUG "htb*g j=%lu\n",jiffies);
45+ printk(KERN_DEBUG "htb*g j=%lu lj=%lu\n",jiffies,q->jiffies);
46 /* rows */
47 for (i=TC_HTB_MAXDEPTH-1;i>=0;i--) {
48 printk(KERN_DEBUG "htb*r%d m=%x",i,q->row_mask[i]);
49@@ -419,8 +424,8 @@
50 if ((delay <= 0 || delay > cl->mbuffer) && net_ratelimit())
51 printk(KERN_ERR "HTB: suspicious delay in wait_tree d=%ld cl=%X h=%d\n",delay,cl->classid,debug_hint);
52 #endif
53- cl->pq_key = jiffies + PSCHED_US2JIFFIE(delay);
54- if (cl->pq_key == jiffies)
55+ cl->pq_key = q->jiffies + PSCHED_US2JIFFIE(delay);
56+ if (cl->pq_key == q->jiffies)
57 cl->pq_key++;
58
59 /* update the nearest event cache */
60@@ -598,7 +603,7 @@
61 long toks;
62
63 if ((toks = (cl->ctokens + *diff)) < (
64-#ifdef HTB_HYSTERESIS
65+#if HTB_HYSTERESIS
66 cl->cmode != HTB_CANT_SEND ? -cl->cbuffer :
67 #endif
68 0)) {
69@@ -606,7 +611,7 @@
70 return HTB_CANT_SEND;
71 }
72 if ((toks = (cl->tokens + *diff)) >= (
73-#ifdef HTB_HYSTERESIS
74+#if HTB_HYSTERESIS
75 cl->cmode == HTB_CAN_SEND ? -cl->buffer :
76 #endif
77 0))
78@@ -809,7 +814,7 @@
79 cl->classid, diff,
80 (unsigned long long) q->now,
81 (unsigned long long) cl->t_c,
82- jiffies);
83+ q->jiffies);
84 diff = 1000;
85 }
86 #endif
87@@ -852,6 +857,7 @@
88 *
89 * Scans event queue for pending events and applies them. Returns jiffies to
90 * next pending event (0 for no event in pq).
91+ * Note: Aplied are events whose have cl->pq_key <= jiffies.
92 */
93 static long htb_do_events(struct htb_sched *q,int level)
94 {
95@@ -866,9 +872,9 @@
96 while (p->rb_left) p = p->rb_left;
97
98 cl = rb_entry(p, struct htb_class, pq_node);
99- if (cl->pq_key - (jiffies+1) < 0x80000000) {
100- HTB_DBG(8,3,"htb_do_ev_ret delay=%ld\n",cl->pq_key - jiffies);
101- return cl->pq_key - jiffies;
102+ if (cl->pq_key - (q->jiffies+1) < 0x80000000) {
103+ HTB_DBG(8,3,"htb_do_ev_ret delay=%ld\n",cl->pq_key - q->jiffies);
104+ return cl->pq_key - q->jiffies;
105 }
106 htb_safe_rb_erase(p,q->wait_pq+level);
107 diff = PSCHED_TDIFF_SAFE(q->now, cl->t_c, (u32)cl->mbuffer, 0);
108@@ -879,7 +885,7 @@
109 cl->classid, diff,
110 (unsigned long long) q->now,
111 (unsigned long long) cl->t_c,
112- jiffies);
113+ q->jiffies);
114 diff = 1000;
115 }
116 #endif
117@@ -987,7 +993,8 @@
118 delay = 5*HZ;
119 }
120 del_timer(&q->timer);
121- q->timer.expires = jiffies + delay;
122+ /* why don't use jiffies here ? because expires can be in past */
123+ q->timer.expires = q->jiffies + delay;
124 add_timer(&q->timer);
125 sch->flags |= TCQ_F_THROTTLED;
126 sch->stats.overlimits++;
127@@ -1004,6 +1011,7 @@
128 int evs_used = 0;
129 #endif
130
131+ q->jiffies = jiffies;
132 HTB_DBG(3,1,"htb_deq dircnt=%d qlen=%d\n",skb_queue_len(&q->direct_queue),
133 sch->q.qlen);
134
135@@ -1023,14 +1031,14 @@
136 /* common case optimization - skip event handler quickly */
137 int m;
138 long delay;
139- if (jiffies - q->near_ev_cache[level] < 0x80000000 || 0) {
140+ if (q->jiffies - q->near_ev_cache[level] < 0x80000000 || 0) {
141 delay = htb_do_events(q,level);
142- q->near_ev_cache[level] += delay ? delay : HZ;
143+ q->near_ev_cache[level] = q->jiffies + (delay ? delay : HZ);
144 #ifdef HTB_DEBUG
145 evs_used++;
146 #endif
147 } else
148- delay = q->near_ev_cache[level] - jiffies;
149+ delay = q->near_ev_cache[level] - q->jiffies;
150
151 if (delay && min_delay > delay)
152 min_delay = delay;
153@@ -1049,8 +1057,8 @@
154 #ifdef HTB_DEBUG
155 if (!q->nwc_hit && min_delay >= 10*HZ && net_ratelimit()) {
156 if (min_delay == LONG_MAX) {
157- printk(KERN_ERR "HTB: dequeue bug (%d), report it please !\n",
158- evs_used);
159+ printk(KERN_ERR "HTB: dequeue bug (%d,%lu,%lu), report it please !\n",
160+ evs_used,q->jiffies,jiffies);
161 htb_debug_dump(q);
162 } else
163 printk(KERN_WARNING "HTB: mindelay=%ld, some class has "
164@@ -1059,7 +1067,7 @@
165 #endif
166 htb_delay_by (sch,min_delay > 5*HZ ? 5*HZ : min_delay);
167 fin:
168- HTB_DBG(3,1,"htb_deq_end %s j=%lu skb=%p\n",sch->dev->name,jiffies,skb);
169+ HTB_DBG(3,1,"htb_deq_end %s j=%lu skb=%p\n",sch->dev->name,q->jiffies,skb);
170 return skb;
171 }
172
173@@ -1424,7 +1432,7 @@
174 parent = parentid == TC_H_ROOT ? NULL : htb_find (parentid,sch);
175
176 hopt = RTA_DATA(tb[TCA_HTB_PARMS-1]);
177- HTB_DBG(0,1,"htb_chg cl=%p, clid=%X, opt/prio=%d, rate=%u, buff=%d, quant=%d\n", cl,cl?cl->classid:0,(int)hopt->prio,hopt->rate.rate,hopt->buffer,hopt->quantum);
178+ HTB_DBG(0,1,"htb_chg cl=%p(%X), clid=%X, parid=%X, opt/prio=%d, rate=%u, buff=%d, quant=%d\n", cl,cl?cl->classid:0,classid,parentid,(int)hopt->prio,hopt->rate.rate,hopt->buffer,hopt->quantum);
179 rtab = qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB-1]);
180 ctab = qdisc_get_rtab(&hopt->ceil, tb[TCA_HTB_CTAB-1]);
181 if (!rtab || !ctab) goto failure;
This page took 0.261199 seconds and 4 git commands to generate.