vserver 1.9.5.x5
[linux-2.6.git] / net / sched / sch_gred.c
index 375c6c2..25c171c 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/module.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
-#include <asm/bitops.h>
+#include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -130,7 +130,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 
        D2PRINTK("gred_enqueue virtualQ 0x%x classid %x backlog %d "
            "general backlog %d\n",skb->tc_index&0xf,sch->handle,q->backlog,
-           sch->stats.backlog);
+           sch->qstats.backlog);
        /* sum up all the qaves of prios <= to ours to get the new qave*/
        if (!t->eqp && t->grio) {
                for (i=0;i<t->DPs;i++) {
@@ -161,7 +161,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
                q->qave >>= q->Stab[(us_idle>>q->Scell_log)&0xFF];
        } else {
                if (t->eqp) {
-                       q->qave += sch->stats.backlog - (q->qave >> q->Wlog);
+                       q->qave += sch->qstats.backlog - (q->qave >> q->Wlog);
                } else {
                        q->qave += q->backlog - (q->qave >> q->Wlog);
                }
@@ -179,9 +179,9 @@ enqueue:
                        q->backlog += skb->len;
 do_enqueue:
                        __skb_queue_tail(&sch->q, skb);
-                       sch->stats.backlog += skb->len;
-                       sch->stats.bytes += skb->len;
-                       sch->stats.packets++;
+                       sch->qstats.backlog += skb->len;
+                       sch->bstats.bytes += skb->len;
+                       sch->bstats.packets++;
                        return 0;
                } else {
                        q->pdrop++;
@@ -189,12 +189,12 @@ do_enqueue:
 
 drop:
                kfree_skb(skb);
-               sch->stats.drops++;
+               sch->qstats.drops++;
                return NET_XMIT_DROP;
        }
        if ((q->qave+qave) >= q->qth_max) {
                q->qcount = -1;
-               sch->stats.overlimits++;
+               sch->qstats.overlimits++;
                q->forced++;
                goto drop;
        }
@@ -203,7 +203,7 @@ drop:
                        goto enqueue;
                q->qcount = 0;
                q->qR = net_random()&q->Rmask;
-               sch->stats.overlimits++;
+               sch->qstats.overlimits++;
                q->early++;
                goto drop;
        }
@@ -221,7 +221,8 @@ gred_requeue(struct sk_buff *skb, struct Qdisc* sch)
        PSCHED_SET_PASTPERFECT(q->qidlestart);
 
        __skb_queue_head(&sch->q, skb);
-       sch->stats.backlog += skb->len;
+       sch->qstats.backlog += skb->len;
+       sch->qstats.requeues++;
        q->backlog += skb->len;
        return 0;
 }
@@ -235,7 +236,7 @@ gred_dequeue(struct Qdisc* sch)
 
        skb = __skb_dequeue(&sch->q);
        if (skb) {
-               sch->stats.backlog -= skb->len;
+               sch->qstats.backlog -= skb->len;
                q= t->tab[(skb->tc_index&0xf)];
                if (q) {
                        q->backlog -= skb->len;
@@ -269,8 +270,8 @@ static unsigned int gred_drop(struct Qdisc* sch)
        skb = __skb_dequeue_tail(&sch->q);
        if (skb) {
                unsigned int len = skb->len;
-               sch->stats.backlog -= len;
-               sch->stats.drops++;
+               sch->qstats.backlog -= len;
+               sch->qstats.drops++;
                q= t->tab[(skb->tc_index&0xf)];
                if (q) {
                        q->backlog -= len;
@@ -304,7 +305,7 @@ static void gred_reset(struct Qdisc* sch)
 
        __skb_queue_purge(&sch->q);
 
-       sch->stats.backlog = 0;
+       sch->qstats.backlog = 0;
 
         for (i=0;i<t->DPs;i++) {
                q= t->tab[i];
@@ -331,13 +332,11 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
        struct rtattr *tb2[TCA_GRED_DPS];
        int i;
 
-       if (opt == NULL ||
-               rtattr_parse(tb, TCA_GRED_STAB, RTA_DATA(opt), RTA_PAYLOAD(opt)) )
-                       return -EINVAL;
+       if (opt == NULL || rtattr_parse_nested(tb, TCA_GRED_STAB, opt))
+               return -EINVAL;
 
        if (tb[TCA_GRED_PARMS-1] == 0 && tb[TCA_GRED_STAB-1] == 0) {
-               rtattr_parse(tb2, TCA_GRED_DPS, RTA_DATA(opt),
-                   RTA_PAYLOAD(opt));
+               rtattr_parse_nested(tb2, TCA_GRED_DPS, opt);
 
            if (tb2[TCA_GRED_DPS-1] == 0) 
                        return -EINVAL;
@@ -474,12 +473,11 @@ static int gred_init(struct Qdisc *sch, struct rtattr *opt)
        struct rtattr *tb[TCA_GRED_STAB];
        struct rtattr *tb2[TCA_GRED_DPS];
 
-       if (opt == NULL ||
-               rtattr_parse(tb, TCA_GRED_STAB, RTA_DATA(opt), RTA_PAYLOAD(opt)) )
-                       return -EINVAL;
+       if (opt == NULL || rtattr_parse_nested(tb, TCA_GRED_STAB, opt))
+               return -EINVAL;
 
        if (tb[TCA_GRED_PARMS-1] == 0 && tb[TCA_GRED_STAB-1] == 0) {
-               rtattr_parse(tb2, TCA_GRED_DPS, RTA_DATA(opt),RTA_PAYLOAD(opt));
+               rtattr_parse_nested(tb2, TCA_GRED_DPS, opt);
 
            if (tb2[TCA_GRED_DPS-1] == 0) 
                        return -EINVAL;