.. | .. |
---|
845 | 845 | } |
---|
846 | 846 | |
---|
847 | 847 | static void |
---|
848 | | -hfsc_purge_queue(struct Qdisc *sch, struct hfsc_class *cl) |
---|
849 | | -{ |
---|
850 | | - unsigned int len = cl->qdisc->q.qlen; |
---|
851 | | - unsigned int backlog = cl->qdisc->qstats.backlog; |
---|
852 | | - |
---|
853 | | - qdisc_reset(cl->qdisc); |
---|
854 | | - qdisc_tree_reduce_backlog(cl->qdisc, len, backlog); |
---|
855 | | -} |
---|
856 | | - |
---|
857 | | -static void |
---|
858 | 848 | hfsc_adjust_levels(struct hfsc_class *cl) |
---|
859 | 849 | { |
---|
860 | 850 | struct hfsc_class *p; |
---|
.. | .. |
---|
936 | 926 | if (opt == NULL) |
---|
937 | 927 | return -EINVAL; |
---|
938 | 928 | |
---|
939 | | - err = nla_parse_nested(tb, TCA_HFSC_MAX, opt, hfsc_policy, NULL); |
---|
| 929 | + err = nla_parse_nested_deprecated(tb, TCA_HFSC_MAX, opt, hfsc_policy, |
---|
| 930 | + NULL); |
---|
940 | 931 | if (err < 0) |
---|
941 | 932 | return err; |
---|
942 | 933 | |
---|
.. | .. |
---|
1021 | 1012 | if (parent == NULL) |
---|
1022 | 1013 | return -ENOENT; |
---|
1023 | 1014 | } |
---|
| 1015 | + if (!(parent->cl_flags & HFSC_FSC) && parent != &q->root) { |
---|
| 1016 | + NL_SET_ERR_MSG(extack, "Invalid parent - parent class must have FSC"); |
---|
| 1017 | + return -EINVAL; |
---|
| 1018 | + } |
---|
1024 | 1019 | |
---|
1025 | 1020 | if (classid == 0 || TC_H_MAJ(classid ^ sch->handle) != 0) |
---|
1026 | 1021 | return -EINVAL; |
---|
.. | .. |
---|
1076 | 1071 | qdisc_class_hash_insert(&q->clhash, &cl->cl_common); |
---|
1077 | 1072 | list_add_tail(&cl->siblings, &parent->children); |
---|
1078 | 1073 | if (parent->level == 0) |
---|
1079 | | - hfsc_purge_queue(sch, parent); |
---|
| 1074 | + qdisc_purge_queue(parent->qdisc); |
---|
1080 | 1075 | hfsc_adjust_levels(parent); |
---|
1081 | 1076 | sch_tree_unlock(sch); |
---|
1082 | 1077 | |
---|
.. | .. |
---|
1112 | 1107 | list_del(&cl->siblings); |
---|
1113 | 1108 | hfsc_adjust_levels(cl->cl_parent); |
---|
1114 | 1109 | |
---|
1115 | | - hfsc_purge_queue(sch, cl); |
---|
| 1110 | + qdisc_purge_queue(cl->qdisc); |
---|
1116 | 1111 | qdisc_class_hash_remove(&q->clhash, &cl->cl_common); |
---|
1117 | 1112 | |
---|
1118 | 1113 | sch_tree_unlock(sch); |
---|
.. | .. |
---|
1145 | 1140 | case TC_ACT_STOLEN: |
---|
1146 | 1141 | case TC_ACT_TRAP: |
---|
1147 | 1142 | *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; |
---|
1148 | | - /* fall through */ |
---|
| 1143 | + fallthrough; |
---|
1149 | 1144 | case TC_ACT_SHOT: |
---|
1150 | 1145 | return NULL; |
---|
1151 | 1146 | } |
---|
.. | .. |
---|
1310 | 1305 | if (cl->level == 0) |
---|
1311 | 1306 | tcm->tcm_info = cl->qdisc->handle; |
---|
1312 | 1307 | |
---|
1313 | | - nest = nla_nest_start(skb, TCA_OPTIONS); |
---|
| 1308 | + nest = nla_nest_start_noflag(skb, TCA_OPTIONS); |
---|
1314 | 1309 | if (nest == NULL) |
---|
1315 | 1310 | goto nla_put_failure; |
---|
1316 | 1311 | if (hfsc_dump_curves(skb, cl) < 0) |
---|
.. | .. |
---|
1328 | 1323 | { |
---|
1329 | 1324 | struct hfsc_class *cl = (struct hfsc_class *)arg; |
---|
1330 | 1325 | struct tc_hfsc_stats xstats; |
---|
| 1326 | + __u32 qlen; |
---|
1331 | 1327 | |
---|
1332 | | - cl->qstats.backlog = cl->qdisc->qstats.backlog; |
---|
| 1328 | + qdisc_qstats_qlen_backlog(cl->qdisc, &qlen, &cl->qstats.backlog); |
---|
1333 | 1329 | xstats.level = cl->level; |
---|
1334 | 1330 | xstats.period = cl->cl_vtperiod; |
---|
1335 | 1331 | xstats.work = cl->cl_total; |
---|
.. | .. |
---|
1337 | 1333 | |
---|
1338 | 1334 | if (gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), d, NULL, &cl->bstats) < 0 || |
---|
1339 | 1335 | gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 || |
---|
1340 | | - gnet_stats_copy_queue(d, NULL, &cl->qstats, cl->qdisc->q.qlen) < 0) |
---|
| 1336 | + gnet_stats_copy_queue(d, NULL, &cl->qstats, qlen) < 0) |
---|
1341 | 1337 | return -1; |
---|
1342 | 1338 | |
---|
1343 | 1339 | return gnet_stats_copy_app(d, &xstats, sizeof(xstats)); |
---|
.. | .. |
---|
1492 | 1488 | } |
---|
1493 | 1489 | q->eligible = RB_ROOT; |
---|
1494 | 1490 | qdisc_watchdog_cancel(&q->watchdog); |
---|
1495 | | - sch->qstats.backlog = 0; |
---|
1496 | | - sch->q.qlen = 0; |
---|
1497 | 1491 | } |
---|
1498 | 1492 | |
---|
1499 | 1493 | static void |
---|
.. | .. |
---|
1539 | 1533 | static int |
---|
1540 | 1534 | hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) |
---|
1541 | 1535 | { |
---|
| 1536 | + unsigned int len = qdisc_pkt_len(skb); |
---|
1542 | 1537 | struct hfsc_class *cl; |
---|
1543 | | - int uninitialized_var(err); |
---|
| 1538 | + int err; |
---|
| 1539 | + bool first; |
---|
1544 | 1540 | |
---|
1545 | 1541 | cl = hfsc_classify(skb, sch, &err); |
---|
1546 | 1542 | if (cl == NULL) { |
---|
.. | .. |
---|
1550 | 1546 | return err; |
---|
1551 | 1547 | } |
---|
1552 | 1548 | |
---|
| 1549 | + first = !cl->qdisc->q.qlen; |
---|
1553 | 1550 | err = qdisc_enqueue(skb, cl->qdisc, to_free); |
---|
1554 | 1551 | if (unlikely(err != NET_XMIT_SUCCESS)) { |
---|
1555 | 1552 | if (net_xmit_drop_count(err)) { |
---|
.. | .. |
---|
1559 | 1556 | return err; |
---|
1560 | 1557 | } |
---|
1561 | 1558 | |
---|
1562 | | - if (cl->qdisc->q.qlen == 1) { |
---|
1563 | | - unsigned int len = qdisc_pkt_len(skb); |
---|
1564 | | - |
---|
| 1559 | + if (first) { |
---|
1565 | 1560 | if (cl->cl_flags & HFSC_RSC) |
---|
1566 | 1561 | init_ed(cl, len); |
---|
1567 | 1562 | if (cl->cl_flags & HFSC_FSC) |
---|
.. | .. |
---|
1576 | 1571 | |
---|
1577 | 1572 | } |
---|
1578 | 1573 | |
---|
1579 | | - qdisc_qstats_backlog_inc(sch, skb); |
---|
| 1574 | + sch->qstats.backlog += len; |
---|
1580 | 1575 | sch->q.qlen++; |
---|
1581 | 1576 | |
---|
1582 | 1577 | return NET_XMIT_SUCCESS; |
---|