Files
immortalwrt-mt798x/target/linux/generic/pending-5.4/620-net_sched-codel-do-not-defer-queue-length-update.patch
yangxu52 81a41bfe22 kernel: bump to 5.4.302
- update the 5.4 kernel baseline from 5.4.284 to 5.4.302
- rebase the affected generic patches, including the MikroTik build bits and codel backport, to the 5.4.302 source context
- rebase the affected MediaTek TRNG and PWM patches to the new source context
- adjust 993-usb-serial-option-add-u9300.patch so the LONGSUNG U9300 modem patch still applies after the qmi_wwan changes
2026-04-14 11:20:54 +08:00

77 lines
2.4 KiB
Diff

From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date: Mon, 21 Aug 2017 11:14:14 +0300
Subject: [PATCH] net_sched/codel: do not defer queue length update
When codel wants to drop last packet in ->dequeue() it cannot call
qdisc_tree_reduce_backlog() right away - it will notify parent qdisc
about zero qlen and HTB/HFSC will deactivate class. The same class will
be deactivated second time by caller of ->dequeue(). Currently codel and
fq_codel defer update. This triggers warning in HFSC when it's qlen != 0
but there is no active classes.
This patch update parent queue length immediately: just temporary increase
qlen around qdisc_tree_reduce_backlog() to prevent first class deactivation
if we have skb to return.
This might open another problem in HFSC - now operation peek could fail and
deactivate parent class.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=109581
---
--- a/net/sched/sch_codel.c
+++ b/net/sched/sch_codel.c
@@ -96,7 +96,12 @@ static struct sk_buff *codel_qdisc_deque
drop_func, dequeue_func);
if (q->stats.drop_count) {
- qdisc_tree_reduce_backlog(sch, q->stats.drop_count, q->stats.drop_len);
+ if (skb)
+ sch->q.qlen++;
+ qdisc_tree_reduce_backlog(sch, q->stats.drop_count,
+ q->stats.drop_len);
+ if (skb)
+ sch->q.qlen--;
q->stats.drop_count = 0;
q->stats.drop_len = 0;
}
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -304,6 +304,21 @@ begin:
skb = codel_dequeue(sch, &sch->qstats.backlog, &q->cparams,
&flow->cvars, &q->cstats, qdisc_pkt_len,
codel_get_enqueue_time, drop_func, dequeue_func);
+
+ /* If our qlen is 0 qdisc_tree_reduce_backlog() will deactivate
+ * parent class, dequeue in parent qdisc will do the same if we
+ * return skb. Temporary increment qlen if we have skb.
+ */
+ if (q->cstats.drop_count) {
+ if (skb)
+ sch->q.qlen++;
+ qdisc_tree_reduce_backlog(sch, q->cstats.drop_count,
+ q->cstats.drop_len);
+ if (skb)
+ sch->q.qlen--;
+ q->cstats.drop_count = 0;
+ q->cstats.drop_len = 0;
+ }
if (!skb) {
/* force a pass through old_flows to prevent starvation */
@@ -315,13 +330,6 @@ begin:
}
qdisc_bstats_update(sch, skb);
flow->deficit -= qdisc_pkt_len(skb);
-
- if (q->cstats.drop_count) {
- qdisc_tree_reduce_backlog(sch, q->cstats.drop_count,
- q->cstats.drop_len);
- q->cstats.drop_count = 0;
- q->cstats.drop_len = 0;
- }
return skb;
}