hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/net/sched/sch_cbq.c
....@@ -1,13 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * net/sched/sch_cbq.c Class-Based Queueing discipline.
34 *
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.
8
- *
95 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
10
- *
116 */
127
138 #include <linux/module.h>
....@@ -255,7 +250,7 @@
255250 case TC_ACT_STOLEN:
256251 case TC_ACT_TRAP:
257252 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
258
- /* fall through */
253
+ fallthrough;
259254 case TC_ACT_SHOT:
260255 return NULL;
261256 case TC_ACT_RECLASSIFY:
....@@ -365,7 +360,7 @@
365360 struct sk_buff **to_free)
366361 {
367362 struct cbq_sched_data *q = qdisc_priv(sch);
368
- int uninitialized_var(ret);
363
+ int ret;
369364 struct cbq_class *cl = cbq_classify(skb, sch, &ret);
370365
371366 #ifdef CONFIG_NET_CLS_ACT
....@@ -1058,7 +1053,6 @@
10581053 cl->cpriority = cl->priority;
10591054 }
10601055 }
1061
- sch->q.qlen = 0;
10621056 }
10631057
10641058
....@@ -1143,7 +1137,8 @@
11431137 return -EINVAL;
11441138 }
11451139
1146
- err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy, extack);
1140
+ err = nla_parse_nested_deprecated(tb, TCA_CBQ_MAX, opt,
1141
+ cbq_policy, extack);
11471142 if (err < 0)
11481143 return err;
11491144
....@@ -1326,7 +1321,7 @@
13261321 struct cbq_sched_data *q = qdisc_priv(sch);
13271322 struct nlattr *nest;
13281323
1329
- nest = nla_nest_start(skb, TCA_OPTIONS);
1324
+ nest = nla_nest_start_noflag(skb, TCA_OPTIONS);
13301325 if (nest == NULL)
13311326 goto nla_put_failure;
13321327 if (cbq_dump_attr(skb, &q->link) < 0)
....@@ -1361,7 +1356,7 @@
13611356 tcm->tcm_handle = cl->common.classid;
13621357 tcm->tcm_info = cl->q->handle;
13631358
1364
- nest = nla_nest_start(skb, TCA_OPTIONS);
1359
+ nest = nla_nest_start_noflag(skb, TCA_OPTIONS);
13651360 if (nest == NULL)
13661361 goto nla_put_failure;
13671362 if (cbq_dump_attr(skb, cl) < 0)
....@@ -1379,9 +1374,11 @@
13791374 {
13801375 struct cbq_sched_data *q = qdisc_priv(sch);
13811376 struct cbq_class *cl = (struct cbq_class *)arg;
1377
+ __u32 qlen;
13821378
13831379 cl->xstats.avgidle = cl->avgidle;
13841380 cl->xstats.undertime = 0;
1381
+ qdisc_qstats_qlen_backlog(cl->q, &qlen, &cl->qstats.backlog);
13851382
13861383 if (cl->undertime != PSCHED_PASTPERFECT)
13871384 cl->xstats.undertime = cl->undertime - q->now;
....@@ -1389,7 +1386,7 @@
13891386 if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch),
13901387 d, NULL, &cl->bstats) < 0 ||
13911388 gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 ||
1392
- gnet_stats_copy_queue(d, NULL, &cl->qstats, cl->q->q.qlen) < 0)
1389
+ gnet_stats_copy_queue(d, NULL, &cl->qstats, qlen) < 0)
13931390 return -1;
13941391
13951392 return gnet_stats_copy_app(d, &cl->xstats, sizeof(cl->xstats));
....@@ -1681,17 +1678,13 @@
16811678 {
16821679 struct cbq_sched_data *q = qdisc_priv(sch);
16831680 struct cbq_class *cl = (struct cbq_class *)arg;
1684
- unsigned int qlen, backlog;
16851681
16861682 if (cl->filters || cl->children || cl == &q->link)
16871683 return -EBUSY;
16881684
16891685 sch_tree_lock(sch);
16901686
1691
- qlen = cl->q->q.qlen;
1692
- backlog = cl->q->qstats.backlog;
1693
- qdisc_reset(cl->q);
1694
- qdisc_tree_reduce_backlog(cl->q, qlen, backlog);
1687
+ qdisc_purge_queue(cl->q);
16951688
16961689 if (cl->next_alive)
16971690 cbq_deactivate_class(cl);