[LARTC] patching htc 3.7 on kernel 2.4.20 error

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi !

I'm trying to patch kernel 2.4.20 with
htb 3.7.

Since I've source kernel at "/usr/src/linux"
and I've patch htb3.7 at "/usr/src/linux" too,
and patch file heads is:

--- /usr/src/linux-2.4/net/sched/sch_htb.c      2002/12/27 10:22:45

I put -p4 with patch command.

But patch fails:

[root@xxxxxx linux]# patch -p4 < htb_3.7_delay_bug.patch
patching file net/sched/sch_htb.c
Hunk #1 FAILED at 19.
1 out of 13 hunks FAILED -- saving rejects to file net/sched/sch_htb.c.rej

Could someone help me ?
Thank you in advance !

Mac
... ThE PhP_KiD.


*****************************************************************
this is "htb_3.7_delay_bug.patch" file:
*****************************************************************
--- /usr/src/linux-2.4/net/sched/sch_htb.c      2002/12/27 10:22:45     1.15
+++ /usr/src/linux-2.4/net/sched/sch_htb.c      2003/01/22 09:54:59
@@ -19,7 +19,7 @@
  *                     created test case so that I was able to fix nasty bug
  *             and many others. thanks.
  *
- * $Id: sch_htb.c,v 1.15 2002/12/27 10:22:45 devik Exp $
+ * $Id: sch_htb.c,v 1.16 2003/01/11 21:31:31 devik Exp devik $
  */
 #include <linux/config.h>
 #include <linux/module.h>
@@ -71,16 +71,12 @@
 #define HTB_HYSTERESIS 1/* whether to use mode hysteresis for speedup */
 #define HTB_QLOCK(S) spin_lock_bh(&(S)->dev->queue_lock)
 #define HTB_QUNLOCK(S) spin_unlock_bh(&(S)->dev->queue_lock)
-#define HTB_VER 0x30007        /* major must be matched with number suplied by TC as version */
+#define HTB_VER 0x30009        /* major must be matched with number suplied by TC as version */
 
 #if HTB_VER >> 16 != TC_HTB_PROTOVER
 #error "Mismatched sch_htb.c and pkt_sch.h"
 #endif
 
-/* temporary debug defines to be removed after beta stage */
-#define DEVIK_MEND(N)
-#define DEVIK_MSTART(N)
-
 /* debugging support; S is subsystem, these are defined:
   0 - netlink messages
   1 - enqueue
@@ -421,7 +417,6 @@
        if ((delay <= 0 || delay > cl->mbuffer) && net_ratelimit())
                printk(KERN_ERR "HTB: suspicious delay in wait_tree d=%ld cl=%X h=%d\n",delay,cl->classid,debug_hint);
 #endif
-       DEVIK_MSTART(9);
        cl->pq_key = jiffies + PSCHED_US2JIFFIE(delay);
        if (cl->pq_key == jiffies)
                cl->pq_key++;
@@ -440,7 +435,6 @@
        }
        rb_link_node(&cl->pq_node, parent, p);
        rb_insert_color(&cl->pq_node, &q->wait_pq[cl->level]);
-       DEVIK_MEND(9);
 }
 
 /**
@@ -689,7 +683,6 @@
     struct htb_sched *q = (struct htb_sched *)sch->data;
     struct htb_class *cl = htb_classify(skb,sch);
 
-    DEVIK_MSTART(0);
     if (cl == HTB_DIRECT || !cl) {
        /* enqueue to helper queue */
        if (q->direct_queue.qlen < q->direct_qlen && cl) {
@@ -698,25 +691,20 @@
        } else {
            kfree_skb (skb);
            sch->stats.drops++;
-           DEVIK_MEND(0);
            return NET_XMIT_DROP;
        }
     } else if (cl->un.leaf.q->enqueue(skb, cl->un.leaf.q) != NET_XMIT_SUCCESS) {
        sch->stats.drops++;
        cl->stats.drops++;
-       DEVIK_MEND(0);
        return NET_XMIT_DROP;
     } else {
        cl->stats.packets++; cl->stats.bytes += skb->len;
-       DEVIK_MSTART(1);
        htb_activate (q,cl);
-       DEVIK_MEND(1);
     }
 
     sch->q.qlen++;
     sch->stats.packets++; sch->stats.bytes += skb->len;
     HTB_DBG(1,1,"htb_enq_ok cl=%X skb=%p\n",cl?cl->classid:0,skb);
-    DEVIK_MEND(0);
     return NET_XMIT_SUCCESS;
 }
 
@@ -952,7 +940,6 @@
        //struct htb_sched *q = (struct htb_sched *)sch->data;
        struct htb_class *cl,*start;
        /* look initial class up in the row */
-       DEVIK_MSTART(6);
        start = cl = htb_lookup_leaf (q->row[level]+prio,prio,q->ptr[level]+prio);
        
        do {
@@ -971,8 +958,6 @@
                cl = htb_lookup_leaf (q->row[level]+prio,prio,q->ptr[level]+prio);
        } while (cl != start);
 
-       DEVIK_MEND(6);
-       DEVIK_MSTART(7);
        if (likely(skb != NULL)) {
                if ((cl->un.leaf.deficit[level] -= skb->len) < 0) {
                        HTB_DBG(4,2,"htb_next_cl oldptr=%p quant_add=%d\n",
@@ -984,11 +969,8 @@
                   gives us slightly better performance */
                if (!cl->un.leaf.q->q.qlen)
                        htb_deactivate (q,cl);
-       DEVIK_MSTART(8);
                htb_charge_class (q,cl,level,skb->len);
-       DEVIK_MEND(8);
        }
-       DEVIK_MEND(7);
        return skb;
 }
 
@@ -1027,17 +1009,15 @@
                return skb;
        }
 
-       DEVIK_MSTART(2);
        if (!sch->q.qlen) goto fin;
        PSCHED_GET_TIME(q->now);
 
-       min_delay = HZ*5;
+       min_delay = LONG_MAX;
        q->nwc_hit = 0;
        for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
                /* common case optimization - skip event handler quickly */
                int m;
                long delay;
-       DEVIK_MSTART(3);
                if (jiffies - q->near_ev_cache[level] < 0x80000000 || 0) {
                        delay = htb_do_events(q,level);
                        q->near_ev_cache[level] += delay ? delay : HZ;
@@ -1046,8 +1026,6 @@
                
                if (delay && min_delay > delay) 
                        min_delay = delay;
-       DEVIK_MEND(3);
-       DEVIK_MSTART(5);
                m = ~q->row_mask[level];
                while (m != (int)(-1)) {
                        int prio = ffz (m);
@@ -1056,24 +1034,23 @@
                        if (likely(skb != NULL)) {
                                sch->q.qlen--;
                                sch->flags &= ~TCQ_F_THROTTLED;
-       DEVIK_MEND(5);
                                goto fin;
                        }
                }
-       DEVIK_MEND(5);
        }
-       DEVIK_MSTART(4);
 #ifdef HTB_DEBUG
-       if (!q->nwc_hit && min_delay >= 5*HZ && net_ratelimit()) { 
-               printk(KERN_ERR "HTB: mindelay=%ld, report it please !\n",min_delay);
-               htb_debug_dump(q);
+       if (!q->nwc_hit && min_delay >= 10*HZ && net_ratelimit()) {
+               if (min_delay == LONG_MAX) {
+                       printk(KERN_ERR "HTB: dequeue bug, report it please !\n");
+                       htb_debug_dump(q);
+               } else 
+                       printk(KERN_WARNING "HTB: mindelay=%ld, some class has "
+                                       "too small rate\n",min_delay);
        }
 #endif
-       htb_delay_by (sch,min_delay);
-       DEVIK_MEND(4);
+       htb_delay_by (sch,min_delay > 5*HZ ? 5*HZ : min_delay);
 fin:
        HTB_DBG(3,1,"htb_deq_end %s j=%lu skb=%p\n",sch->dev->name,jiffies,skb);
-       DEVIK_MEND(2);
        return skb;
 }
 
@@ -1514,11 +1491,11 @@
        if (!cl->level) {
                cl->un.leaf.quantum = rtab->rate.rate / q->rate2quantum;
                if (!hopt->quantum && cl->un.leaf.quantum < 1000) {
-                       printk(KERN_WARNING "HTB: quantum of class %X is small. Consider r2q change.", cl->classid);
+                       printk(KERN_WARNING "HTB: quantum of class %X is small. Consider r2q change.\n", cl->classid);
                        cl->un.leaf.quantum = 1000;
                }
                if (!hopt->quantum && cl->un.leaf.quantum > 200000) {
-                       printk(KERN_WARNING "HTB: quantum of class %X is big. Consider r2q change.", cl->classid);
+                       printk(KERN_WARNING "HTB: quantum of class %X is big. Consider r2q change.\n", cl->classid);
                        cl->un.leaf.quantum = 200000;
                }
                if (hopt->quantum) 

===8<=========== Fin texto del mensaje original ===========



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux