kmod-sched-cake: switch to in-tree cake for 4.19+
[openwrt/openwrt.git] / target / linux / generic / backport-4.19 / 395-v5.4-sch_cake-drop-unused-variable-tin_quantum_prio.patch
1 From d7e1738f0a0b0573ac93cf570ba3df9dee61b68e Mon Sep 17 00:00:00 2001
2 From: Kevin 'ldir' Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
3 Date: Wed, 18 Dec 2019 14:05:13 +0000
4 Subject: [PATCH 2/2] sch_cake: drop unused variable tin_quantum_prio
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Turns out tin_quantum_prio isn't used anymore and is a leftover from a
10 previous implementation of diffserv tins. Since the variable isn't used
11 in any calculations it can be eliminated.
12
13 Drop variable and places where it was set. Rename remaining variable
14 and consolidate naming of intermediate variables that set it.
15
16 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
17 Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 ---
20 net/sched/sch_cake.c | 59 ++++++++++++++------------------------------
21 1 file changed, 18 insertions(+), 41 deletions(-)
22
23 --- a/net/sched/sch_cake.c
24 +++ b/net/sched/sch_cake.c
25 @@ -173,8 +173,7 @@ struct cake_tin_data {
26 u64 tin_rate_bps;
27 u16 tin_rate_shft;
28
29 - u16 tin_quantum_prio;
30 - u16 tin_quantum_band;
31 + u16 tin_quantum;
32 s32 tin_deficit;
33 u32 tin_backlog;
34 u32 tin_dropped;
35 @@ -1916,7 +1915,7 @@ begin:
36 while (b->tin_deficit < 0 ||
37 !(b->sparse_flow_count + b->bulk_flow_count)) {
38 if (b->tin_deficit <= 0)
39 - b->tin_deficit += b->tin_quantum_band;
40 + b->tin_deficit += b->tin_quantum;
41 if (b->sparse_flow_count + b->bulk_flow_count)
42 empty = false;
43
44 @@ -2237,8 +2236,7 @@ static int cake_config_besteffort(struct
45
46 cake_set_rate(b, rate, mtu,
47 us_to_ns(q->target), us_to_ns(q->interval));
48 - b->tin_quantum_band = 65535;
49 - b->tin_quantum_prio = 65535;
50 + b->tin_quantum = 65535;
51
52 return 0;
53 }
54 @@ -2249,8 +2247,7 @@ static int cake_config_precedence(struct
55 struct cake_sched_data *q = qdisc_priv(sch);
56 u32 mtu = psched_mtu(qdisc_dev(sch));
57 u64 rate = q->rate_bps;
58 - u32 quantum1 = 256;
59 - u32 quantum2 = 256;
60 + u32 quantum = 256;
61 u32 i;
62
63 q->tin_cnt = 8;
64 @@ -2263,18 +2260,14 @@ static int cake_config_precedence(struct
65 cake_set_rate(b, rate, mtu, us_to_ns(q->target),
66 us_to_ns(q->interval));
67
68 - b->tin_quantum_prio = max_t(u16, 1U, quantum1);
69 - b->tin_quantum_band = max_t(u16, 1U, quantum2);
70 + b->tin_quantum = max_t(u16, 1U, quantum);
71
72 /* calculate next class's parameters */
73 rate *= 7;
74 rate >>= 3;
75
76 - quantum1 *= 3;
77 - quantum1 >>= 1;
78 -
79 - quantum2 *= 7;
80 - quantum2 >>= 3;
81 + quantum *= 7;
82 + quantum >>= 3;
83 }
84
85 return 0;
86 @@ -2343,8 +2336,7 @@ static int cake_config_diffserv8(struct
87 struct cake_sched_data *q = qdisc_priv(sch);
88 u32 mtu = psched_mtu(qdisc_dev(sch));
89 u64 rate = q->rate_bps;
90 - u32 quantum1 = 256;
91 - u32 quantum2 = 256;
92 + u32 quantum = 256;
93 u32 i;
94
95 q->tin_cnt = 8;
96 @@ -2360,18 +2352,14 @@ static int cake_config_diffserv8(struct
97 cake_set_rate(b, rate, mtu, us_to_ns(q->target),
98 us_to_ns(q->interval));
99
100 - b->tin_quantum_prio = max_t(u16, 1U, quantum1);
101 - b->tin_quantum_band = max_t(u16, 1U, quantum2);
102 + b->tin_quantum = max_t(u16, 1U, quantum);
103
104 /* calculate next class's parameters */
105 rate *= 7;
106 rate >>= 3;
107
108 - quantum1 *= 3;
109 - quantum1 >>= 1;
110 -
111 - quantum2 *= 7;
112 - quantum2 >>= 3;
113 + quantum *= 7;
114 + quantum >>= 3;
115 }
116
117 return 0;
118 @@ -2410,17 +2398,11 @@ static int cake_config_diffserv4(struct
119 cake_set_rate(&q->tins[3], rate >> 2, mtu,
120 us_to_ns(q->target), us_to_ns(q->interval));
121
122 - /* priority weights */
123 - q->tins[0].tin_quantum_prio = quantum;
124 - q->tins[1].tin_quantum_prio = quantum >> 4;
125 - q->tins[2].tin_quantum_prio = quantum << 2;
126 - q->tins[3].tin_quantum_prio = quantum << 4;
127 -
128 /* bandwidth-sharing weights */
129 - q->tins[0].tin_quantum_band = quantum;
130 - q->tins[1].tin_quantum_band = quantum >> 4;
131 - q->tins[2].tin_quantum_band = quantum >> 1;
132 - q->tins[3].tin_quantum_band = quantum >> 2;
133 + q->tins[0].tin_quantum = quantum;
134 + q->tins[1].tin_quantum = quantum >> 4;
135 + q->tins[2].tin_quantum = quantum >> 1;
136 + q->tins[3].tin_quantum = quantum >> 2;
137
138 return 0;
139 }
140 @@ -2451,15 +2433,10 @@ static int cake_config_diffserv3(struct
141 cake_set_rate(&q->tins[2], rate >> 2, mtu,
142 us_to_ns(q->target), us_to_ns(q->interval));
143
144 - /* priority weights */
145 - q->tins[0].tin_quantum_prio = quantum;
146 - q->tins[1].tin_quantum_prio = quantum >> 4;
147 - q->tins[2].tin_quantum_prio = quantum << 4;
148 -
149 /* bandwidth-sharing weights */
150 - q->tins[0].tin_quantum_band = quantum;
151 - q->tins[1].tin_quantum_band = quantum >> 4;
152 - q->tins[2].tin_quantum_band = quantum >> 2;
153 + q->tins[0].tin_quantum = quantum;
154 + q->tins[1].tin_quantum = quantum >> 4;
155 + q->tins[2].tin_quantum = quantum >> 2;
156
157 return 0;
158 }