--- zzzz-none-000/linux-5.4.213/net/sched/sch_fq_codel.c 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/net/sched/sch_fq_codel.c 2024-05-29 11:20:02.000000000 +0000 @@ -305,6 +305,21 @@ &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 */ if ((head == &q->new_flows) && !list_empty(&q->old_flows)) @@ -315,15 +330,6 @@ } qdisc_bstats_update(sch, skb); flow->deficit -= qdisc_pkt_len(skb); - /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, - * or HTB crashes. Defer it for next round. - */ - if (q->cstats.drop_count && sch->q.qlen) { - 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; } @@ -464,7 +470,11 @@ sch->limit = 10*1024; q->flows_cnt = 1024; +#ifdef CONFIG_X86_64 q->memory_limit = 32 << 20; /* 32 MBytes */ +#else + q->memory_limit = 4 << 20; /* 4 MBytes */ +#endif q->drop_batch_size = 64; q->quantum = psched_mtu(qdisc_dev(sch)); INIT_LIST_HEAD(&q->new_flows); @@ -700,7 +710,7 @@ .walk = fq_codel_walk, }; -static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { +struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { .cl_ops = &fq_codel_class_ops, .id = "fq_codel", .priv_size = sizeof(struct fq_codel_sched_data), @@ -715,6 +725,7 @@ .dump_stats = fq_codel_dump_stats, .owner = THIS_MODULE, }; +EXPORT_SYMBOL(fq_codel_qdisc_ops); static int __init fq_codel_module_init(void) {