Skip to content

Commit 21f4d5c

Browse files
koct9idavem330
authored andcommitted
net_sched/hfsc: fix curve activation in hfsc_change_class()
If real-time or fair-share curves are enabled in hfsc_change_class() class isn't inserted into rb-trees yet. Thus init_ed() and init_vf() must be called in place of update_ed() and update_vf(). Remove isn't required because for now curves cannot be disabled. Signed-off-by: Konstantin Khlebnikov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c8e1812 commit 21f4d5c

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

net/sched/sch_hfsc.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,8 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
958958
}
959959

960960
if (cl != NULL) {
961+
int old_flags;
962+
961963
if (parentid) {
962964
if (cl->cl_parent &&
963965
cl->cl_parent->cl_common.classid != parentid)
@@ -978,6 +980,8 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
978980
}
979981

980982
sch_tree_lock(sch);
983+
old_flags = cl->cl_flags;
984+
981985
if (rsc != NULL)
982986
hfsc_change_rsc(cl, rsc, cur_time);
983987
if (fsc != NULL)
@@ -986,10 +990,21 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
986990
hfsc_change_usc(cl, usc, cur_time);
987991

988992
if (cl->qdisc->q.qlen != 0) {
989-
if (cl->cl_flags & HFSC_RSC)
990-
update_ed(cl, qdisc_peek_len(cl->qdisc));
991-
if (cl->cl_flags & HFSC_FSC)
992-
update_vf(cl, 0, cur_time);
993+
int len = qdisc_peek_len(cl->qdisc);
994+
995+
if (cl->cl_flags & HFSC_RSC) {
996+
if (old_flags & HFSC_RSC)
997+
update_ed(cl, len);
998+
else
999+
init_ed(cl, len);
1000+
}
1001+
1002+
if (cl->cl_flags & HFSC_FSC) {
1003+
if (old_flags & HFSC_FSC)
1004+
update_vf(cl, 0, cur_time);
1005+
else
1006+
init_vf(cl, len);
1007+
}
9931008
}
9941009
sch_tree_unlock(sch);
9951010

0 commit comments

Comments
 (0)