hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/sched/sch_fq_codel.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Fair Queue CoDel discipline
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation; either version
7
- * 2 of the License, or (at your option) any later version.
84 *
95 * Copyright (C) 2012,2015 Eric Dumazet <edumazet@google.com>
106 */
....@@ -18,7 +14,6 @@
1814 #include <linux/errno.h>
1915 #include <linux/init.h>
2016 #include <linux/skbuff.h>
21
-#include <linux/jhash.h>
2217 #include <linux/slab.h>
2318 #include <linux/vmalloc.h>
2419 #include <net/netlink.h>
....@@ -49,7 +44,6 @@
4944 struct sk_buff *tail;
5045 struct list_head flowchain;
5146 int deficit;
52
- u32 dropped; /* number of drops (or ECN marks) on this flow */
5347 struct codel_vars cvars;
5448 }; /* please try to keep this structure <= 64 bytes */
5549
....@@ -105,7 +99,7 @@
10599 case TC_ACT_QUEUED:
106100 case TC_ACT_TRAP:
107101 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
108
- /* fall through */
102
+ fallthrough;
109103 case TC_ACT_SHOT:
110104 return 0;
111105 }
....@@ -124,7 +118,7 @@
124118 struct sk_buff *skb = flow->head;
125119
126120 flow->head = skb->next;
127
- skb->next = NULL;
121
+ skb_mark_not_on_list(skb);
128122 return skb;
129123 }
130124
....@@ -177,7 +171,8 @@
177171 __qdisc_drop(skb, to_free);
178172 } while (++i < max_packets && len < threshold);
179173
180
- flow->dropped += i;
174
+ /* Tell codel to increase its signal strength also */
175
+ flow->cvars.count += i;
181176 q->backlogs[idx] -= len;
182177 q->memory_usage -= mem;
183178 sch->qstats.drops += i;
....@@ -192,7 +187,7 @@
192187 struct fq_codel_sched_data *q = qdisc_priv(sch);
193188 unsigned int idx, prev_backlog, prev_qlen;
194189 struct fq_codel_flow *flow;
195
- int uninitialized_var(ret);
190
+ int ret;
196191 unsigned int pkt_len;
197192 bool memory_limited;
198193
....@@ -215,7 +210,6 @@
215210 list_add_tail(&flow->flowchain, &q->new_flows);
216211 q->new_flow_count++;
217212 flow->deficit = q->quantum;
218
- flow->dropped = 0;
219213 }
220214 get_codel_cb(skb)->mem_usage = skb->truesize;
221215 q->memory_usage += get_codel_cb(skb)->mem_usage;
....@@ -290,7 +284,6 @@
290284 struct sk_buff *skb;
291285 struct fq_codel_flow *flow;
292286 struct list_head *head;
293
- u32 prev_drop_count, prev_ecn_mark;
294287
295288 begin:
296289 head = &q->new_flows;
....@@ -307,15 +300,9 @@
307300 goto begin;
308301 }
309302
310
- prev_drop_count = q->cstats.drop_count;
311
- prev_ecn_mark = q->cstats.ecn_mark;
312
-
313303 skb = codel_dequeue(sch, &sch->qstats.backlog, &q->cparams,
314304 &flow->cvars, &q->cstats, qdisc_pkt_len,
315305 codel_get_enqueue_time, drop_func, dequeue_func);
316
-
317
- flow->dropped += q->cstats.drop_count - prev_drop_count;
318
- flow->dropped += q->cstats.ecn_mark - prev_ecn_mark;
319306
320307 if (!skb) {
321308 /* force a pass through old_flows to prevent starvation */
....@@ -360,8 +347,6 @@
360347 codel_vars_init(&flow->cvars);
361348 }
362349 memset(q->backlogs, 0, q->flows_cnt * sizeof(u32));
363
- sch->q.qlen = 0;
364
- sch->qstats.backlog = 0;
365350 q->memory_usage = 0;
366351 }
367352
....@@ -388,8 +373,8 @@
388373 if (!opt)
389374 return -EINVAL;
390375
391
- err = nla_parse_nested(tb, TCA_FQ_CODEL_MAX, opt, fq_codel_policy,
392
- NULL);
376
+ err = nla_parse_nested_deprecated(tb, TCA_FQ_CODEL_MAX, opt,
377
+ fq_codel_policy, NULL);
393378 if (err < 0)
394379 return err;
395380 if (tb[TCA_FQ_CODEL_FLOWS]) {
....@@ -535,7 +520,7 @@
535520 struct fq_codel_sched_data *q = qdisc_priv(sch);
536521 struct nlattr *opts;
537522
538
- opts = nla_nest_start(skb, TCA_OPTIONS);
523
+ opts = nla_nest_start_noflag(skb, TCA_OPTIONS);
539524 if (opts == NULL)
540525 goto nla_put_failure;
541526
....@@ -670,7 +655,7 @@
670655 sch_tree_unlock(sch);
671656 }
672657 qs.backlog = q->backlogs[idx];
673
- qs.drops = flow->dropped;
658
+ qs.drops = 0;
674659 }
675660 if (gnet_stats_copy_queue(d, NULL, &qs, qs.qlen) < 0)
676661 return -1;
....@@ -742,3 +727,4 @@
742727 module_exit(fq_codel_module_exit)
743728 MODULE_AUTHOR("Eric Dumazet");
744729 MODULE_LICENSE("GPL");
730
+MODULE_DESCRIPTION("Fair Queue CoDel discipline");