From 77cd8f64ca261bfb3cf5a905fb2f227981934613 Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Mon, 29 Jun 2020 19:52:10 +0100 Subject: [PATCH] kernel: cake: backport unused var patch to 5.4 This was backported to 4.19 and I clearly expected it to land in 5.4 but it didn't (5.5) so backport it to 5.4 for consistency. Signed-off-by: Kevin Darbyshire-Bryant --- ...op-unused-variable-tin_quantum_prio.patch} | 0 ...rop-unused-variable-tin_quantum_prio.patch | 158 ++++++++++++++++++ 2 files changed, 158 insertions(+) rename target/linux/generic/backport-4.19/{393-v5.4-sch_cake-drop-unused-variable-tin_quantum_prio.patch => 393-v5.5-sch_cake-drop-unused-variable-tin_quantum_prio.patch} (100%) create mode 100644 target/linux/generic/backport-5.4/393-v5.5-sch_cake-drop-unused-variable-tin_quantum_prio.patch diff --git a/target/linux/generic/backport-4.19/393-v5.4-sch_cake-drop-unused-variable-tin_quantum_prio.patch b/target/linux/generic/backport-4.19/393-v5.5-sch_cake-drop-unused-variable-tin_quantum_prio.patch similarity index 100% rename from target/linux/generic/backport-4.19/393-v5.4-sch_cake-drop-unused-variable-tin_quantum_prio.patch rename to target/linux/generic/backport-4.19/393-v5.5-sch_cake-drop-unused-variable-tin_quantum_prio.patch diff --git a/target/linux/generic/backport-5.4/393-v5.5-sch_cake-drop-unused-variable-tin_quantum_prio.patch b/target/linux/generic/backport-5.4/393-v5.5-sch_cake-drop-unused-variable-tin_quantum_prio.patch new file mode 100644 index 00000000000..33e5c54b8cc --- /dev/null +++ b/target/linux/generic/backport-5.4/393-v5.5-sch_cake-drop-unused-variable-tin_quantum_prio.patch @@ -0,0 +1,158 @@ +From d7e1738f0a0b0573ac93cf570ba3df9dee61b68e Mon Sep 17 00:00:00 2001 +From: Kevin 'ldir' Darbyshire-Bryant +Date: Wed, 18 Dec 2019 14:05:13 +0000 +Subject: [PATCH 2/2] sch_cake: drop unused variable tin_quantum_prio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Turns out tin_quantum_prio isn't used anymore and is a leftover from a +previous implementation of diffserv tins. Since the variable isn't used +in any calculations it can be eliminated. + +Drop variable and places where it was set. Rename remaining variable +and consolidate naming of intermediate variables that set it. + +Signed-off-by: Kevin Darbyshire-Bryant +Acked-by: Toke Høiland-Jørgensen +Signed-off-by: David S. Miller +--- + net/sched/sch_cake.c | 59 ++++++++++++++------------------------------ + 1 file changed, 18 insertions(+), 41 deletions(-) + +--- a/net/sched/sch_cake.c ++++ b/net/sched/sch_cake.c +@@ -173,8 +173,7 @@ struct cake_tin_data { + u64 tin_rate_bps; + u16 tin_rate_shft; + +- u16 tin_quantum_prio; +- u16 tin_quantum_band; ++ u16 tin_quantum; + s32 tin_deficit; + u32 tin_backlog; + u32 tin_dropped; +@@ -1916,7 +1915,7 @@ begin: + while (b->tin_deficit < 0 || + !(b->sparse_flow_count + b->bulk_flow_count)) { + if (b->tin_deficit <= 0) +- b->tin_deficit += b->tin_quantum_band; ++ b->tin_deficit += b->tin_quantum; + if (b->sparse_flow_count + b->bulk_flow_count) + empty = false; + +@@ -2237,8 +2236,7 @@ static int cake_config_besteffort(struct + + cake_set_rate(b, rate, mtu, + us_to_ns(q->target), us_to_ns(q->interval)); +- b->tin_quantum_band = 65535; +- b->tin_quantum_prio = 65535; ++ b->tin_quantum = 65535; + + return 0; + } +@@ -2249,8 +2247,7 @@ static int cake_config_precedence(struct + struct cake_sched_data *q = qdisc_priv(sch); + u32 mtu = psched_mtu(qdisc_dev(sch)); + u64 rate = q->rate_bps; +- u32 quantum1 = 256; +- u32 quantum2 = 256; ++ u32 quantum = 256; + u32 i; + + q->tin_cnt = 8; +@@ -2263,18 +2260,14 @@ static int cake_config_precedence(struct + cake_set_rate(b, rate, mtu, us_to_ns(q->target), + us_to_ns(q->interval)); + +- b->tin_quantum_prio = max_t(u16, 1U, quantum1); +- b->tin_quantum_band = max_t(u16, 1U, quantum2); ++ b->tin_quantum = max_t(u16, 1U, quantum); + + /* calculate next class's parameters */ + rate *= 7; + rate >>= 3; + +- quantum1 *= 3; +- quantum1 >>= 1; +- +- quantum2 *= 7; +- quantum2 >>= 3; ++ quantum *= 7; ++ quantum >>= 3; + } + + return 0; +@@ -2343,8 +2336,7 @@ static int cake_config_diffserv8(struct + struct cake_sched_data *q = qdisc_priv(sch); + u32 mtu = psched_mtu(qdisc_dev(sch)); + u64 rate = q->rate_bps; +- u32 quantum1 = 256; +- u32 quantum2 = 256; ++ u32 quantum = 256; + u32 i; + + q->tin_cnt = 8; +@@ -2360,18 +2352,14 @@ static int cake_config_diffserv8(struct + cake_set_rate(b, rate, mtu, us_to_ns(q->target), + us_to_ns(q->interval)); + +- b->tin_quantum_prio = max_t(u16, 1U, quantum1); +- b->tin_quantum_band = max_t(u16, 1U, quantum2); ++ b->tin_quantum = max_t(u16, 1U, quantum); + + /* calculate next class's parameters */ + rate *= 7; + rate >>= 3; + +- quantum1 *= 3; +- quantum1 >>= 1; +- +- quantum2 *= 7; +- quantum2 >>= 3; ++ quantum *= 7; ++ quantum >>= 3; + } + + return 0; +@@ -2410,17 +2398,11 @@ static int cake_config_diffserv4(struct + cake_set_rate(&q->tins[3], rate >> 2, mtu, + us_to_ns(q->target), us_to_ns(q->interval)); + +- /* priority weights */ +- q->tins[0].tin_quantum_prio = quantum; +- q->tins[1].tin_quantum_prio = quantum >> 4; +- q->tins[2].tin_quantum_prio = quantum << 2; +- q->tins[3].tin_quantum_prio = quantum << 4; +- + /* bandwidth-sharing weights */ +- q->tins[0].tin_quantum_band = quantum; +- q->tins[1].tin_quantum_band = quantum >> 4; +- q->tins[2].tin_quantum_band = quantum >> 1; +- q->tins[3].tin_quantum_band = quantum >> 2; ++ q->tins[0].tin_quantum = quantum; ++ q->tins[1].tin_quantum = quantum >> 4; ++ q->tins[2].tin_quantum = quantum >> 1; ++ q->tins[3].tin_quantum = quantum >> 2; + + return 0; + } +@@ -2451,15 +2433,10 @@ static int cake_config_diffserv3(struct + cake_set_rate(&q->tins[2], rate >> 2, mtu, + us_to_ns(q->target), us_to_ns(q->interval)); + +- /* priority weights */ +- q->tins[0].tin_quantum_prio = quantum; +- q->tins[1].tin_quantum_prio = quantum >> 4; +- q->tins[2].tin_quantum_prio = quantum << 4; +- + /* bandwidth-sharing weights */ +- q->tins[0].tin_quantum_band = quantum; +- q->tins[1].tin_quantum_band = quantum >> 4; +- q->tins[2].tin_quantum_band = quantum >> 2; ++ q->tins[0].tin_quantum = quantum; ++ q->tins[1].tin_quantum = quantum >> 4; ++ q->tins[2].tin_quantum = quantum >> 2; + + return 0; + } -- 2.30.2