backports: update sch_fq_codel_core.c
authorHauke Mehrtens <hauke@hauke-m.de>
Fri, 7 Feb 2014 23:52:57 +0000 (00:52 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 8 Feb 2014 12:34:15 +0000 (13:34 +0100)
This brings sch_fq_codel_core.c to the version used in kernel 3.14-rc1.
Most of the changes were done many kernel versions before 3.14-rc1, but
in kernel 3.14-rc1 net_random() was removed and not it does not even
compile any more.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
backport/compat/sch_fq_codel_core.c

index f7139791d48403188d84ae0f9f109067ce42d685..4864f735c668698be81f3ac3d5ea2b385efb0cef 100644 (file)
@@ -194,15 +194,14 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 
        if (list_empty(&flow->flowchain)) {
                list_add_tail(&flow->flowchain, &q->new_flows);
-               codel_vars_init(&flow->cvars);
                q->new_flow_count++;
                flow->deficit = q->quantum;
                flow->dropped = 0;
        }
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39))
-       if (++sch->q.qlen < q->limit)
+       if (++sch->q.qlen <= q->limit)
 #else
-       if (++sch->q.qlen < sch->limit)
+       if (++sch->q.qlen <= sch->limit)
 #endif
                return NET_XMIT_SUCCESS;
 
@@ -414,7 +413,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
 #endif
        q->flows_cnt = 1024;
        q->quantum = psched_mtu(qdisc_dev(sch));
-       q->perturbation = net_random();
+       q->perturbation = prandom_u32();
        INIT_LIST_HEAD(&q->new_flows);
        INIT_LIST_HEAD(&q->old_flows);
        codel_params_init(&q->cparams);
@@ -441,6 +440,7 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
                        struct fq_codel_flow *flow = q->flows + i;
 
                        INIT_LIST_HEAD(&flow->flowchain);
+                       codel_vars_init(&flow->cvars);
                }
        }
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39))