.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * net/sched/sch_htb.c Hierarchical token bucket, feed tree version |
---|
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. |
---|
8 | 4 | * |
---|
9 | 5 | * Authors: Martin Devera, <devik@cdi.cz> |
---|
10 | 6 | * |
---|
.. | .. |
---|
132 | 128 | struct htb_class_inner { |
---|
133 | 129 | struct htb_prio clprio[TC_HTB_NUMPRIO]; |
---|
134 | 130 | } inner; |
---|
135 | | - } un; |
---|
| 131 | + }; |
---|
136 | 132 | s64 pq_key; |
---|
137 | 133 | |
---|
138 | 134 | int prio_activity; /* for which prios are we active */ |
---|
.. | .. |
---|
165 | 161 | |
---|
166 | 162 | /* non shaped skbs; let them go directly thru */ |
---|
167 | 163 | struct qdisc_skb_head direct_queue; |
---|
168 | | - long direct_pkts; |
---|
| 164 | + u32 direct_pkts; |
---|
| 165 | + u32 overlimits; |
---|
169 | 166 | |
---|
170 | 167 | struct qdisc_watchdog watchdog; |
---|
171 | 168 | |
---|
.. | .. |
---|
242 | 239 | case TC_ACT_STOLEN: |
---|
243 | 240 | case TC_ACT_TRAP: |
---|
244 | 241 | *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; |
---|
245 | | - /* fall through */ |
---|
| 242 | + fallthrough; |
---|
246 | 243 | case TC_ACT_SHOT: |
---|
247 | 244 | return NULL; |
---|
248 | 245 | } |
---|
.. | .. |
---|
411 | 408 | int prio = ffz(~m); |
---|
412 | 409 | m &= ~(1 << prio); |
---|
413 | 410 | |
---|
414 | | - if (p->un.inner.clprio[prio].feed.rb_node) |
---|
| 411 | + if (p->inner.clprio[prio].feed.rb_node) |
---|
415 | 412 | /* parent already has its feed in use so that |
---|
416 | 413 | * reset bit in mask as parent is already ok |
---|
417 | 414 | */ |
---|
418 | 415 | mask &= ~(1 << prio); |
---|
419 | 416 | |
---|
420 | | - htb_add_to_id_tree(&p->un.inner.clprio[prio].feed, cl, prio); |
---|
| 417 | + htb_add_to_id_tree(&p->inner.clprio[prio].feed, cl, prio); |
---|
421 | 418 | } |
---|
422 | 419 | p->prio_activity |= mask; |
---|
423 | 420 | cl = p; |
---|
.. | .. |
---|
447 | 444 | int prio = ffz(~m); |
---|
448 | 445 | m &= ~(1 << prio); |
---|
449 | 446 | |
---|
450 | | - if (p->un.inner.clprio[prio].ptr == cl->node + prio) { |
---|
| 447 | + if (p->inner.clprio[prio].ptr == cl->node + prio) { |
---|
451 | 448 | /* we are removing child which is pointed to from |
---|
452 | 449 | * parent feed - forget the pointer but remember |
---|
453 | 450 | * classid |
---|
454 | 451 | */ |
---|
455 | | - p->un.inner.clprio[prio].last_ptr_id = cl->common.classid; |
---|
456 | | - p->un.inner.clprio[prio].ptr = NULL; |
---|
| 452 | + p->inner.clprio[prio].last_ptr_id = cl->common.classid; |
---|
| 453 | + p->inner.clprio[prio].ptr = NULL; |
---|
457 | 454 | } |
---|
458 | 455 | |
---|
459 | 456 | htb_safe_rb_erase(cl->node + prio, |
---|
460 | | - &p->un.inner.clprio[prio].feed); |
---|
| 457 | + &p->inner.clprio[prio].feed); |
---|
461 | 458 | |
---|
462 | | - if (!p->un.inner.clprio[prio].feed.rb_node) |
---|
| 459 | + if (!p->inner.clprio[prio].feed.rb_node) |
---|
463 | 460 | mask |= 1 << prio; |
---|
464 | 461 | } |
---|
465 | 462 | |
---|
.. | .. |
---|
533 | 530 | if (new_mode == cl->cmode) |
---|
534 | 531 | return; |
---|
535 | 532 | |
---|
536 | | - if (new_mode == HTB_CANT_SEND) |
---|
| 533 | + if (new_mode == HTB_CANT_SEND) { |
---|
537 | 534 | cl->overlimits++; |
---|
| 535 | + q->overlimits++; |
---|
| 536 | + } |
---|
538 | 537 | |
---|
539 | 538 | if (cl->prio_activity) { /* not necessary: speed optimization */ |
---|
540 | 539 | if (cl->cmode != HTB_CANT_SEND) |
---|
.. | .. |
---|
555 | 554 | */ |
---|
556 | 555 | static inline void htb_activate(struct htb_sched *q, struct htb_class *cl) |
---|
557 | 556 | { |
---|
558 | | - WARN_ON(cl->level || !cl->un.leaf.q || !cl->un.leaf.q->q.qlen); |
---|
| 557 | + WARN_ON(cl->level || !cl->leaf.q || !cl->leaf.q->q.qlen); |
---|
559 | 558 | |
---|
560 | 559 | if (!cl->prio_activity) { |
---|
561 | 560 | cl->prio_activity = 1 << cl->prio; |
---|
.. | .. |
---|
577 | 576 | cl->prio_activity = 0; |
---|
578 | 577 | } |
---|
579 | 578 | |
---|
580 | | -static void htb_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, |
---|
581 | | - struct qdisc_skb_head *qh) |
---|
582 | | -{ |
---|
583 | | - struct sk_buff *last = qh->tail; |
---|
584 | | - |
---|
585 | | - if (last) { |
---|
586 | | - skb->next = NULL; |
---|
587 | | - last->next = skb; |
---|
588 | | - qh->tail = skb; |
---|
589 | | - } else { |
---|
590 | | - qh->tail = skb; |
---|
591 | | - qh->head = skb; |
---|
592 | | - } |
---|
593 | | - qh->qlen++; |
---|
594 | | -} |
---|
595 | | - |
---|
596 | 579 | static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch, |
---|
597 | 580 | struct sk_buff **to_free) |
---|
598 | 581 | { |
---|
599 | | - int uninitialized_var(ret); |
---|
| 582 | + int ret; |
---|
| 583 | + unsigned int len = qdisc_pkt_len(skb); |
---|
600 | 584 | struct htb_sched *q = qdisc_priv(sch); |
---|
601 | 585 | struct htb_class *cl = htb_classify(skb, sch, &ret); |
---|
602 | 586 | |
---|
603 | 587 | if (cl == HTB_DIRECT) { |
---|
604 | 588 | /* enqueue to helper queue */ |
---|
605 | 589 | if (q->direct_queue.qlen < q->direct_qlen) { |
---|
606 | | - htb_enqueue_tail(skb, sch, &q->direct_queue); |
---|
| 590 | + __qdisc_enqueue_tail(skb, &q->direct_queue); |
---|
607 | 591 | q->direct_pkts++; |
---|
608 | 592 | } else { |
---|
609 | 593 | return qdisc_drop(skb, sch, to_free); |
---|
.. | .. |
---|
615 | 599 | __qdisc_drop(skb, to_free); |
---|
616 | 600 | return ret; |
---|
617 | 601 | #endif |
---|
618 | | - } else if ((ret = qdisc_enqueue(skb, cl->un.leaf.q, |
---|
| 602 | + } else if ((ret = qdisc_enqueue(skb, cl->leaf.q, |
---|
619 | 603 | to_free)) != NET_XMIT_SUCCESS) { |
---|
620 | 604 | if (net_xmit_drop_count(ret)) { |
---|
621 | 605 | qdisc_qstats_drop(sch); |
---|
.. | .. |
---|
626 | 610 | htb_activate(q, cl); |
---|
627 | 611 | } |
---|
628 | 612 | |
---|
629 | | - qdisc_qstats_backlog_inc(sch, skb); |
---|
| 613 | + sch->qstats.backlog += len; |
---|
630 | 614 | sch->q.qlen++; |
---|
631 | 615 | return NET_XMIT_SUCCESS; |
---|
632 | 616 | } |
---|
.. | .. |
---|
823 | 807 | cl = rb_entry(*sp->pptr, struct htb_class, node[prio]); |
---|
824 | 808 | if (!cl->level) |
---|
825 | 809 | return cl; |
---|
826 | | - clp = &cl->un.inner.clprio[prio]; |
---|
| 810 | + clp = &cl->inner.clprio[prio]; |
---|
827 | 811 | (++sp)->root = clp->feed.rb_node; |
---|
828 | 812 | sp->pptr = &clp->ptr; |
---|
829 | 813 | sp->pid = &clp->last_ptr_id; |
---|
.. | .. |
---|
857 | 841 | * graft operation on the leaf since last dequeue; |
---|
858 | 842 | * simply deactivate and skip such class |
---|
859 | 843 | */ |
---|
860 | | - if (unlikely(cl->un.leaf.q->q.qlen == 0)) { |
---|
| 844 | + if (unlikely(cl->leaf.q->q.qlen == 0)) { |
---|
861 | 845 | struct htb_class *next; |
---|
862 | 846 | htb_deactivate(q, cl); |
---|
863 | 847 | |
---|
.. | .. |
---|
873 | 857 | goto next; |
---|
874 | 858 | } |
---|
875 | 859 | |
---|
876 | | - skb = cl->un.leaf.q->dequeue(cl->un.leaf.q); |
---|
| 860 | + skb = cl->leaf.q->dequeue(cl->leaf.q); |
---|
877 | 861 | if (likely(skb != NULL)) |
---|
878 | 862 | break; |
---|
879 | 863 | |
---|
880 | | - qdisc_warn_nonwc("htb", cl->un.leaf.q); |
---|
881 | | - htb_next_rb_node(level ? &cl->parent->un.inner.clprio[prio].ptr: |
---|
| 864 | + qdisc_warn_nonwc("htb", cl->leaf.q); |
---|
| 865 | + htb_next_rb_node(level ? &cl->parent->inner.clprio[prio].ptr: |
---|
882 | 866 | &q->hlevel[0].hprio[prio].ptr); |
---|
883 | 867 | cl = htb_lookup_leaf(hprio, prio); |
---|
884 | 868 | |
---|
.. | .. |
---|
886 | 870 | |
---|
887 | 871 | if (likely(skb != NULL)) { |
---|
888 | 872 | bstats_update(&cl->bstats, skb); |
---|
889 | | - cl->un.leaf.deficit[level] -= qdisc_pkt_len(skb); |
---|
890 | | - if (cl->un.leaf.deficit[level] < 0) { |
---|
891 | | - cl->un.leaf.deficit[level] += cl->quantum; |
---|
892 | | - htb_next_rb_node(level ? &cl->parent->un.inner.clprio[prio].ptr : |
---|
| 873 | + cl->leaf.deficit[level] -= qdisc_pkt_len(skb); |
---|
| 874 | + if (cl->leaf.deficit[level] < 0) { |
---|
| 875 | + cl->leaf.deficit[level] += cl->quantum; |
---|
| 876 | + htb_next_rb_node(level ? &cl->parent->inner.clprio[prio].ptr : |
---|
893 | 877 | &q->hlevel[0].hprio[prio].ptr); |
---|
894 | 878 | } |
---|
895 | 879 | /* this used to be after charge_class but this constelation |
---|
896 | 880 | * gives us slightly better performance |
---|
897 | 881 | */ |
---|
898 | | - if (!cl->un.leaf.q->q.qlen) |
---|
| 882 | + if (!cl->leaf.q->q.qlen) |
---|
899 | 883 | htb_deactivate(q, cl); |
---|
900 | 884 | htb_charge_class(q, cl, level, skb); |
---|
901 | 885 | } |
---|
.. | .. |
---|
952 | 936 | goto ok; |
---|
953 | 937 | } |
---|
954 | 938 | } |
---|
955 | | - qdisc_qstats_overlimit(sch); |
---|
956 | 939 | if (likely(next_event > q->now)) |
---|
957 | 940 | qdisc_watchdog_schedule_ns(&q->watchdog, next_event); |
---|
958 | 941 | else |
---|
.. | .. |
---|
972 | 955 | for (i = 0; i < q->clhash.hashsize; i++) { |
---|
973 | 956 | hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) { |
---|
974 | 957 | if (cl->level) |
---|
975 | | - memset(&cl->un.inner, 0, sizeof(cl->un.inner)); |
---|
| 958 | + memset(&cl->inner, 0, sizeof(cl->inner)); |
---|
976 | 959 | else { |
---|
977 | | - if (cl->un.leaf.q) |
---|
978 | | - qdisc_reset(cl->un.leaf.q); |
---|
| 960 | + if (cl->leaf.q) |
---|
| 961 | + qdisc_reset(cl->leaf.q); |
---|
979 | 962 | } |
---|
980 | 963 | cl->prio_activity = 0; |
---|
981 | 964 | cl->cmode = HTB_CAN_SEND; |
---|
.. | .. |
---|
983 | 966 | } |
---|
984 | 967 | qdisc_watchdog_cancel(&q->watchdog); |
---|
985 | 968 | __qdisc_reset_queue(&q->direct_queue); |
---|
986 | | - sch->q.qlen = 0; |
---|
987 | | - sch->qstats.backlog = 0; |
---|
988 | 969 | memset(q->hlevel, 0, sizeof(q->hlevel)); |
---|
989 | 970 | memset(q->row_mask, 0, sizeof(q->row_mask)); |
---|
990 | 971 | } |
---|
.. | .. |
---|
1027 | 1008 | if (err) |
---|
1028 | 1009 | return err; |
---|
1029 | 1010 | |
---|
1030 | | - err = nla_parse_nested(tb, TCA_HTB_MAX, opt, htb_policy, NULL); |
---|
| 1011 | + err = nla_parse_nested_deprecated(tb, TCA_HTB_MAX, opt, htb_policy, |
---|
| 1012 | + NULL); |
---|
1031 | 1013 | if (err < 0) |
---|
1032 | 1014 | return err; |
---|
1033 | 1015 | |
---|
.. | .. |
---|
1062 | 1044 | struct nlattr *nest; |
---|
1063 | 1045 | struct tc_htb_glob gopt; |
---|
1064 | 1046 | |
---|
| 1047 | + sch->qstats.overlimits = q->overlimits; |
---|
1065 | 1048 | /* Its safe to not acquire qdisc lock. As we hold RTNL, |
---|
1066 | 1049 | * no change can happen on the qdisc parameters. |
---|
1067 | 1050 | */ |
---|
.. | .. |
---|
1072 | 1055 | gopt.defcls = q->defcls; |
---|
1073 | 1056 | gopt.debug = 0; |
---|
1074 | 1057 | |
---|
1075 | | - nest = nla_nest_start(skb, TCA_OPTIONS); |
---|
| 1058 | + nest = nla_nest_start_noflag(skb, TCA_OPTIONS); |
---|
1076 | 1059 | if (nest == NULL) |
---|
1077 | 1060 | goto nla_put_failure; |
---|
1078 | 1061 | if (nla_put(skb, TCA_HTB_INIT, sizeof(gopt), &gopt) || |
---|
.. | .. |
---|
1098 | 1081 | */ |
---|
1099 | 1082 | tcm->tcm_parent = cl->parent ? cl->parent->common.classid : TC_H_ROOT; |
---|
1100 | 1083 | tcm->tcm_handle = cl->common.classid; |
---|
1101 | | - if (!cl->level && cl->un.leaf.q) |
---|
1102 | | - tcm->tcm_info = cl->un.leaf.q->handle; |
---|
| 1084 | + if (!cl->level && cl->leaf.q) |
---|
| 1085 | + tcm->tcm_info = cl->leaf.q->handle; |
---|
1103 | 1086 | |
---|
1104 | | - nest = nla_nest_start(skb, TCA_OPTIONS); |
---|
| 1087 | + nest = nla_nest_start_noflag(skb, TCA_OPTIONS); |
---|
1105 | 1088 | if (nest == NULL) |
---|
1106 | 1089 | goto nla_put_failure; |
---|
1107 | 1090 | |
---|
.. | .. |
---|
1142 | 1125 | }; |
---|
1143 | 1126 | __u32 qlen = 0; |
---|
1144 | 1127 | |
---|
1145 | | - if (!cl->level && cl->un.leaf.q) { |
---|
1146 | | - qlen = cl->un.leaf.q->q.qlen; |
---|
1147 | | - qs.backlog = cl->un.leaf.q->qstats.backlog; |
---|
1148 | | - } |
---|
| 1128 | + if (!cl->level && cl->leaf.q) |
---|
| 1129 | + qdisc_qstats_qlen_backlog(cl->leaf.q, &qlen, &qs.backlog); |
---|
| 1130 | + |
---|
1149 | 1131 | cl->xstats.tokens = clamp_t(s64, PSCHED_NS2TICKS(cl->tokens), |
---|
1150 | 1132 | INT_MIN, INT_MAX); |
---|
1151 | 1133 | cl->xstats.ctokens = clamp_t(s64, PSCHED_NS2TICKS(cl->ctokens), |
---|
.. | .. |
---|
1172 | 1154 | cl->common.classid, extack)) == NULL) |
---|
1173 | 1155 | return -ENOBUFS; |
---|
1174 | 1156 | |
---|
1175 | | - *old = qdisc_replace(sch, new, &cl->un.leaf.q); |
---|
| 1157 | + *old = qdisc_replace(sch, new, &cl->leaf.q); |
---|
1176 | 1158 | return 0; |
---|
1177 | 1159 | } |
---|
1178 | 1160 | |
---|
1179 | 1161 | static struct Qdisc *htb_leaf(struct Qdisc *sch, unsigned long arg) |
---|
1180 | 1162 | { |
---|
1181 | 1163 | struct htb_class *cl = (struct htb_class *)arg; |
---|
1182 | | - return !cl->level ? cl->un.leaf.q : NULL; |
---|
| 1164 | + return !cl->level ? cl->leaf.q : NULL; |
---|
1183 | 1165 | } |
---|
1184 | 1166 | |
---|
1185 | 1167 | static void htb_qlen_notify(struct Qdisc *sch, unsigned long arg) |
---|
.. | .. |
---|
1205 | 1187 | { |
---|
1206 | 1188 | struct htb_class *parent = cl->parent; |
---|
1207 | 1189 | |
---|
1208 | | - WARN_ON(cl->level || !cl->un.leaf.q || cl->prio_activity); |
---|
| 1190 | + WARN_ON(cl->level || !cl->leaf.q || cl->prio_activity); |
---|
1209 | 1191 | |
---|
1210 | 1192 | if (parent->cmode != HTB_CAN_SEND) |
---|
1211 | 1193 | htb_safe_rb_erase(&parent->pq_node, |
---|
1212 | 1194 | &q->hlevel[parent->level].wait_pq); |
---|
1213 | 1195 | |
---|
1214 | 1196 | parent->level = 0; |
---|
1215 | | - memset(&parent->un.inner, 0, sizeof(parent->un.inner)); |
---|
1216 | | - parent->un.leaf.q = new_q ? new_q : &noop_qdisc; |
---|
| 1197 | + memset(&parent->inner, 0, sizeof(parent->inner)); |
---|
| 1198 | + parent->leaf.q = new_q ? new_q : &noop_qdisc; |
---|
1217 | 1199 | parent->tokens = parent->buffer; |
---|
1218 | 1200 | parent->ctokens = parent->cbuffer; |
---|
1219 | 1201 | parent->t_c = ktime_get_ns(); |
---|
.. | .. |
---|
1223 | 1205 | static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl) |
---|
1224 | 1206 | { |
---|
1225 | 1207 | if (!cl->level) { |
---|
1226 | | - WARN_ON(!cl->un.leaf.q); |
---|
1227 | | - qdisc_put(cl->un.leaf.q); |
---|
| 1208 | + WARN_ON(!cl->leaf.q); |
---|
| 1209 | + qdisc_put(cl->leaf.q); |
---|
1228 | 1210 | } |
---|
1229 | 1211 | gen_kill_estimator(&cl->rate_est); |
---|
1230 | 1212 | tcf_block_put(cl->block); |
---|
.. | .. |
---|
1285 | 1267 | |
---|
1286 | 1268 | sch_tree_lock(sch); |
---|
1287 | 1269 | |
---|
1288 | | - if (!cl->level) { |
---|
1289 | | - unsigned int qlen = cl->un.leaf.q->q.qlen; |
---|
1290 | | - unsigned int backlog = cl->un.leaf.q->qstats.backlog; |
---|
1291 | | - |
---|
1292 | | - qdisc_reset(cl->un.leaf.q); |
---|
1293 | | - qdisc_tree_reduce_backlog(cl->un.leaf.q, qlen, backlog); |
---|
1294 | | - } |
---|
| 1270 | + if (!cl->level) |
---|
| 1271 | + qdisc_purge_queue(cl->leaf.q); |
---|
1295 | 1272 | |
---|
1296 | 1273 | /* delete from hash and active; remainder in destroy_class */ |
---|
1297 | 1274 | qdisc_class_hash_remove(&q->clhash, &cl->common); |
---|
.. | .. |
---|
1323 | 1300 | struct htb_class *cl = (struct htb_class *)*arg, *parent; |
---|
1324 | 1301 | struct nlattr *opt = tca[TCA_OPTIONS]; |
---|
1325 | 1302 | struct nlattr *tb[TCA_HTB_MAX + 1]; |
---|
| 1303 | + struct Qdisc *parent_qdisc = NULL; |
---|
1326 | 1304 | struct tc_htb_opt *hopt; |
---|
1327 | 1305 | u64 rate64, ceil64; |
---|
1328 | 1306 | int warn = 0; |
---|
.. | .. |
---|
1331 | 1309 | if (!opt) |
---|
1332 | 1310 | goto failure; |
---|
1333 | 1311 | |
---|
1334 | | - err = nla_parse_nested(tb, TCA_HTB_MAX, opt, htb_policy, NULL); |
---|
| 1312 | + err = nla_parse_nested_deprecated(tb, TCA_HTB_MAX, opt, htb_policy, |
---|
| 1313 | + NULL); |
---|
1335 | 1314 | if (err < 0) |
---|
1336 | 1315 | goto failure; |
---|
1337 | 1316 | |
---|
.. | .. |
---|
1419 | 1398 | classid, NULL); |
---|
1420 | 1399 | sch_tree_lock(sch); |
---|
1421 | 1400 | if (parent && !parent->level) { |
---|
1422 | | - unsigned int qlen = parent->un.leaf.q->q.qlen; |
---|
1423 | | - unsigned int backlog = parent->un.leaf.q->qstats.backlog; |
---|
1424 | | - |
---|
1425 | 1401 | /* turn parent into inner node */ |
---|
1426 | | - qdisc_reset(parent->un.leaf.q); |
---|
1427 | | - qdisc_tree_reduce_backlog(parent->un.leaf.q, qlen, backlog); |
---|
1428 | | - qdisc_put(parent->un.leaf.q); |
---|
| 1402 | + qdisc_purge_queue(parent->leaf.q); |
---|
| 1403 | + parent_qdisc = parent->leaf.q; |
---|
1429 | 1404 | if (parent->prio_activity) |
---|
1430 | 1405 | htb_deactivate(q, parent); |
---|
1431 | 1406 | |
---|
.. | .. |
---|
1436 | 1411 | } |
---|
1437 | 1412 | parent->level = (parent->parent ? parent->parent->level |
---|
1438 | 1413 | : TC_HTB_MAXDEPTH) - 1; |
---|
1439 | | - memset(&parent->un.inner, 0, sizeof(parent->un.inner)); |
---|
| 1414 | + memset(&parent->inner, 0, sizeof(parent->inner)); |
---|
1440 | 1415 | } |
---|
1441 | 1416 | /* leaf (we) needs elementary qdisc */ |
---|
1442 | | - cl->un.leaf.q = new_q ? new_q : &noop_qdisc; |
---|
| 1417 | + cl->leaf.q = new_q ? new_q : &noop_qdisc; |
---|
1443 | 1418 | |
---|
1444 | 1419 | cl->common.classid = classid; |
---|
1445 | 1420 | cl->parent = parent; |
---|
.. | .. |
---|
1455 | 1430 | qdisc_class_hash_insert(&q->clhash, &cl->common); |
---|
1456 | 1431 | if (parent) |
---|
1457 | 1432 | parent->children++; |
---|
1458 | | - if (cl->un.leaf.q != &noop_qdisc) |
---|
1459 | | - qdisc_hash_add(cl->un.leaf.q, true); |
---|
| 1433 | + if (cl->leaf.q != &noop_qdisc) |
---|
| 1434 | + qdisc_hash_add(cl->leaf.q, true); |
---|
1460 | 1435 | } else { |
---|
1461 | 1436 | if (tca[TCA_RATE]) { |
---|
1462 | 1437 | err = gen_replace_estimator(&cl->bstats, NULL, |
---|
.. | .. |
---|
1478 | 1453 | psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, ceil64); |
---|
1479 | 1454 | |
---|
1480 | 1455 | /* it used to be a nasty bug here, we have to check that node |
---|
1481 | | - * is really leaf before changing cl->un.leaf ! |
---|
| 1456 | + * is really leaf before changing cl->leaf ! |
---|
1482 | 1457 | */ |
---|
1483 | 1458 | if (!cl->level) { |
---|
1484 | 1459 | u64 quantum = cl->rate.rate_bytes_ps; |
---|
.. | .. |
---|
1504 | 1479 | cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer); |
---|
1505 | 1480 | |
---|
1506 | 1481 | sch_tree_unlock(sch); |
---|
| 1482 | + qdisc_put(parent_qdisc); |
---|
1507 | 1483 | |
---|
1508 | 1484 | if (warn) |
---|
1509 | 1485 | pr_warn("HTB: quantum of class %X is %s. Consider r2q change.\n", |
---|