1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
--- a/compat/net-sched-sch_fq_codel.c
+++ b/compat/net-sched-sch_fq_codel.c
@@ -65,6 +65,9 @@ struct fq_codel_sched_data {
struct list_head new_flows; /* list of new flows */
struct list_head old_flows; /* list of old flows */
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39))
+ u32 limit;
+#endif
};
static unsigned int fq_codel_hash(const struct fq_codel_sched_data *q,
@@ -195,7 +198,11 @@ static int fq_codel_enqueue(struct sk_bu
flow->deficit = q->quantum;
flow->dropped = 0;
}
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39))
+ if (++sch->q.qlen <= q->limit)
+#else
if (++sch->q.qlen <= sch->limit)
+#endif
return NET_XMIT_SUCCESS;
q->drop_overlimit++;
@@ -333,7 +340,11 @@ static int fq_codel_change(struct Qdisc
}
if (tb[TCA_FQ_CODEL_LIMIT])
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39))
+ q->limit = nla_get_u32(tb[TCA_FQ_CODEL_LIMIT]);
+#else
sch->limit = nla_get_u32(tb[TCA_FQ_CODEL_LIMIT]);
+#endif
if (tb[TCA_FQ_CODEL_ECN])
q->cparams.ecn = !!nla_get_u32(tb[TCA_FQ_CODEL_ECN]);
@@ -341,7 +352,11 @@ static int fq_codel_change(struct Qdisc
if (tb[TCA_FQ_CODEL_QUANTUM])
q->quantum = max(256U, nla_get_u32(tb[TCA_FQ_CODEL_QUANTUM]));
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39))
+ while (sch->q.qlen > q->limit) {
+#else
while (sch->q.qlen > sch->limit) {
+#endif
struct sk_buff *skb = fq_codel_dequeue(sch);
kfree_skb(skb);
@@ -377,7 +392,11 @@ static void fq_codel_destroy(struct Qdis
{
struct fq_codel_sched_data *q = qdisc_priv(sch);
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25))
+ tcf_destroy_chain(q->filter_list);
+#else
tcf_destroy_chain(&q->filter_list);
+#endif
fq_codel_free(q->backlogs);
fq_codel_free(q->flows);
}
@@ -387,7 +406,11 @@ static int fq_codel_init(struct Qdisc *s
struct fq_codel_sched_data *q = qdisc_priv(sch);
int i;
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39))
+ q->limit = 10*1024;
+#else
sch->limit = 10*1024;
+#endif
q->flows_cnt = 1024;
q->quantum = psched_mtu(qdisc_dev(sch));
q->perturbation = prandom_u32();
@@ -420,7 +443,11 @@ static int fq_codel_init(struct Qdisc *s
codel_vars_init(&flow->cvars);
}
}
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39))
+ if (q->limit >= 1)
+#else
if (sch->limit >= 1)
+#endif
sch->flags |= TCQ_F_CAN_BYPASS;
else
sch->flags &= ~TCQ_F_CAN_BYPASS;
@@ -439,7 +466,11 @@ static int fq_codel_dump(struct Qdisc *s
if (nla_put_u32(skb, TCA_FQ_CODEL_TARGET,
codel_time_to_us(q->cparams.target)) ||
nla_put_u32(skb, TCA_FQ_CODEL_LIMIT,
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39))
+ q->limit) ||
+#else
sch->limit) ||
+#endif
nla_put_u32(skb, TCA_FQ_CODEL_INTERVAL,
codel_time_to_us(q->cparams.interval)) ||
nla_put_u32(skb, TCA_FQ_CODEL_ECN,
@@ -598,7 +629,9 @@ static struct Qdisc_ops fq_codel_qdisc_o
.priv_size = sizeof(struct fq_codel_sched_data),
.enqueue = fq_codel_enqueue,
.dequeue = fq_codel_dequeue,
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
.peek = qdisc_peek_dequeued,
+#endif
.drop = fq_codel_drop,
.init = fq_codel_init,
.reset = fq_codel_reset,
|