Setting tag linux-2.6-22-50
[linux-2.6.git] / linux-2.6-680-htb-hysteresis-tso.patch
1 diff -Nurp linux-2.6.22-660/net/sched/sch_htb.c linux-2.6.22-670/net/sched/sch_htb.c
2 --- linux-2.6.22-660/net/sched/sch_htb.c        2007-07-09 01:32:17.000000000 +0200
3 +++ linux-2.6.22-670/net/sched/sch_htb.c        2008-11-12 17:35:17.000000000 +0100
4 @@ -71,7 +71,7 @@
5  #define HTB_HSIZE 16           /* classid hash size */
6  #define HTB_EWMAC 2            /* rate average over HTB_EWMAC*HTB_HSIZE sec */
7  #define HTB_RATECM 1           /* whether to use rate computer */
8 -#define HTB_HYSTERESIS 1       /* whether to use mode hysteresis for speedup */
9 +#define HTB_HYSTERESIS 0       /* whether to use mode hysteresis for speedup */
10  #define HTB_VER 0x30011                /* major must be matched with number suplied by TC as version */
11  
12  #if HTB_VER >> 16 != TC_HTB_PROTOVER
13 @@ -153,15 +153,12 @@ struct htb_class {
14                                 /* of un.leaf originals should be done. */
15  };
16  
17 -/* TODO: maybe compute rate when size is too large .. or drop ? */
18  static inline long L2T(struct htb_class *cl, struct qdisc_rate_table *rate,
19                            int size)
20  {
21         int slot = size >> rate->rate.cell_log;
22 -       if (slot > 255) {
23 -               cl->xstats.giants++;
24 -               slot = 255;
25 -       }
26 +       if (slot > 255)
27 +               return (rate->data[255]*(slot >> 8) + rate->data[slot & 0xFF]);
28         return rate->data[slot];
29  }
30  
31 @@ -634,13 +631,13 @@ static int htb_enqueue(struct sk_buff *s
32                 cl->qstats.drops++;
33                 return NET_XMIT_DROP;
34         } else {
35 -               cl->bstats.packets++;
36 +               cl->bstats.packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
37                 cl->bstats.bytes += skb->len;
38                 htb_activate(q, cl);
39         }
40  
41         sch->q.qlen++;
42 -       sch->bstats.packets++;
43 +       sch->bstats.packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
44         sch->bstats.bytes += skb->len;
45         return NET_XMIT_SUCCESS;
46  }
47 @@ -717,8 +714,9 @@ static void htb_rate_timer(unsigned long
48   * In such case we remove class from event queue first.
49   */
50  static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
51 -                            int level, int bytes)
52 +                            int level, struct sk_buff *skb)
53  {
54 +       int bytes = skb->len;
55         long toks, diff;
56         enum htb_cmode old_mode;
57  
58 @@ -759,7 +757,8 @@ static void htb_charge_class(struct htb_
59                 /* update byte stats except for leaves which are already updated */
60                 if (cl->level) {
61                         cl->bstats.bytes += bytes;
62 -                       cl->bstats.packets++;
63 +                       cl->bstats.packets +=
64 +                               skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
65                 }
66                 cl = cl->parent;
67         }
68 @@ -943,7 +942,7 @@ next:
69                    gives us slightly better performance */
70                 if (!cl->un.leaf.q->q.qlen)
71                         htb_deactivate(q, cl);
72 -               htb_charge_class(q, cl, level, skb->len);
73 +               htb_charge_class(q, cl, level, skb);
74         }
75         return skb;
76  }