| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * net/sched/sch_cbq.c Class-Based Queueing discipline. |
|---|
| 3 | 4 | * |
|---|
| 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 | | - * |
|---|
| 9 | 5 | * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> |
|---|
| 10 | | - * |
|---|
| 11 | 6 | */ |
|---|
| 12 | 7 | |
|---|
| 13 | 8 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 255 | 250 | case TC_ACT_STOLEN: |
|---|
| 256 | 251 | case TC_ACT_TRAP: |
|---|
| 257 | 252 | *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; |
|---|
| 258 | | - /* fall through */ |
|---|
| 253 | + fallthrough; |
|---|
| 259 | 254 | case TC_ACT_SHOT: |
|---|
| 260 | 255 | return NULL; |
|---|
| 261 | 256 | case TC_ACT_RECLASSIFY: |
|---|
| .. | .. |
|---|
| 365 | 360 | struct sk_buff **to_free) |
|---|
| 366 | 361 | { |
|---|
| 367 | 362 | struct cbq_sched_data *q = qdisc_priv(sch); |
|---|
| 368 | | - int uninitialized_var(ret); |
|---|
| 363 | + int ret; |
|---|
| 369 | 364 | struct cbq_class *cl = cbq_classify(skb, sch, &ret); |
|---|
| 370 | 365 | |
|---|
| 371 | 366 | #ifdef CONFIG_NET_CLS_ACT |
|---|
| .. | .. |
|---|
| 1058 | 1053 | cl->cpriority = cl->priority; |
|---|
| 1059 | 1054 | } |
|---|
| 1060 | 1055 | } |
|---|
| 1061 | | - sch->q.qlen = 0; |
|---|
| 1062 | 1056 | } |
|---|
| 1063 | 1057 | |
|---|
| 1064 | 1058 | |
|---|
| .. | .. |
|---|
| 1143 | 1137 | return -EINVAL; |
|---|
| 1144 | 1138 | } |
|---|
| 1145 | 1139 | |
|---|
| 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); |
|---|
| 1147 | 1142 | if (err < 0) |
|---|
| 1148 | 1143 | return err; |
|---|
| 1149 | 1144 | |
|---|
| .. | .. |
|---|
| 1326 | 1321 | struct cbq_sched_data *q = qdisc_priv(sch); |
|---|
| 1327 | 1322 | struct nlattr *nest; |
|---|
| 1328 | 1323 | |
|---|
| 1329 | | - nest = nla_nest_start(skb, TCA_OPTIONS); |
|---|
| 1324 | + nest = nla_nest_start_noflag(skb, TCA_OPTIONS); |
|---|
| 1330 | 1325 | if (nest == NULL) |
|---|
| 1331 | 1326 | goto nla_put_failure; |
|---|
| 1332 | 1327 | if (cbq_dump_attr(skb, &q->link) < 0) |
|---|
| .. | .. |
|---|
| 1361 | 1356 | tcm->tcm_handle = cl->common.classid; |
|---|
| 1362 | 1357 | tcm->tcm_info = cl->q->handle; |
|---|
| 1363 | 1358 | |
|---|
| 1364 | | - nest = nla_nest_start(skb, TCA_OPTIONS); |
|---|
| 1359 | + nest = nla_nest_start_noflag(skb, TCA_OPTIONS); |
|---|
| 1365 | 1360 | if (nest == NULL) |
|---|
| 1366 | 1361 | goto nla_put_failure; |
|---|
| 1367 | 1362 | if (cbq_dump_attr(skb, cl) < 0) |
|---|
| .. | .. |
|---|
| 1379 | 1374 | { |
|---|
| 1380 | 1375 | struct cbq_sched_data *q = qdisc_priv(sch); |
|---|
| 1381 | 1376 | struct cbq_class *cl = (struct cbq_class *)arg; |
|---|
| 1377 | + __u32 qlen; |
|---|
| 1382 | 1378 | |
|---|
| 1383 | 1379 | cl->xstats.avgidle = cl->avgidle; |
|---|
| 1384 | 1380 | cl->xstats.undertime = 0; |
|---|
| 1381 | + qdisc_qstats_qlen_backlog(cl->q, &qlen, &cl->qstats.backlog); |
|---|
| 1385 | 1382 | |
|---|
| 1386 | 1383 | if (cl->undertime != PSCHED_PASTPERFECT) |
|---|
| 1387 | 1384 | cl->xstats.undertime = cl->undertime - q->now; |
|---|
| .. | .. |
|---|
| 1389 | 1386 | if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), |
|---|
| 1390 | 1387 | d, NULL, &cl->bstats) < 0 || |
|---|
| 1391 | 1388 | 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) |
|---|
| 1393 | 1390 | return -1; |
|---|
| 1394 | 1391 | |
|---|
| 1395 | 1392 | return gnet_stats_copy_app(d, &cl->xstats, sizeof(cl->xstats)); |
|---|
| .. | .. |
|---|
| 1681 | 1678 | { |
|---|
| 1682 | 1679 | struct cbq_sched_data *q = qdisc_priv(sch); |
|---|
| 1683 | 1680 | struct cbq_class *cl = (struct cbq_class *)arg; |
|---|
| 1684 | | - unsigned int qlen, backlog; |
|---|
| 1685 | 1681 | |
|---|
| 1686 | 1682 | if (cl->filters || cl->children || cl == &q->link) |
|---|
| 1687 | 1683 | return -EBUSY; |
|---|
| 1688 | 1684 | |
|---|
| 1689 | 1685 | sch_tree_lock(sch); |
|---|
| 1690 | 1686 | |
|---|
| 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); |
|---|
| 1695 | 1688 | |
|---|
| 1696 | 1689 | if (cl->next_alive) |
|---|
| 1697 | 1690 | cbq_deactivate_class(cl); |
|---|