Skip to content

Commit 6b0355f

Browse files
koct9idavem330
authored andcommitted
net_sched/hfsc: opencode trivial set_active() and set_passive()
Any move comment abount update_vf() into right place. Signed-off-by: Konstantin Khlebnikov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9594665 commit 6b0355f

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

net/sched/sch_hfsc.c

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -829,28 +829,6 @@ update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time)
829829
}
830830
}
831831

832-
static void
833-
set_active(struct hfsc_class *cl, unsigned int len)
834-
{
835-
if (cl->cl_flags & HFSC_RSC)
836-
init_ed(cl, len);
837-
if (cl->cl_flags & HFSC_FSC)
838-
init_vf(cl, len);
839-
840-
}
841-
842-
static void
843-
set_passive(struct hfsc_class *cl)
844-
{
845-
if (cl->cl_flags & HFSC_RSC)
846-
eltree_remove(cl);
847-
848-
/*
849-
* vttree is now handled in update_vf() so that update_vf(cl, 0, 0)
850-
* needs to be called explicitly to remove a class from vttree.
851-
*/
852-
}
853-
854832
static unsigned int
855833
qdisc_peek_len(struct Qdisc *sch)
856834
{
@@ -1221,8 +1199,12 @@ hfsc_qlen_notify(struct Qdisc *sch, unsigned long arg)
12211199
{
12221200
struct hfsc_class *cl = (struct hfsc_class *)arg;
12231201

1202+
/* vttree is now handled in update_vf() so that update_vf(cl, 0, 0)
1203+
* needs to be called explicitly to remove a class from vttree.
1204+
*/
12241205
update_vf(cl, 0, 0);
1225-
set_passive(cl);
1206+
if (cl->cl_flags & HFSC_RSC)
1207+
eltree_remove(cl);
12261208
}
12271209

12281210
static unsigned long
@@ -1583,7 +1565,12 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free)
15831565
}
15841566

15851567
if (cl->qdisc->q.qlen == 1) {
1586-
set_active(cl, qdisc_pkt_len(skb));
1568+
unsigned int len = qdisc_pkt_len(skb);
1569+
1570+
if (cl->cl_flags & HFSC_RSC)
1571+
init_ed(cl, len);
1572+
if (cl->cl_flags & HFSC_FSC)
1573+
init_vf(cl, len);
15871574
/*
15881575
* If this is the first packet, isolate the head so an eventual
15891576
* head drop before the first dequeue operation has no chance
@@ -1647,18 +1634,18 @@ hfsc_dequeue(struct Qdisc *sch)
16471634
if (realtime)
16481635
cl->cl_cumul += qdisc_pkt_len(skb);
16491636

1650-
if (cl->qdisc->q.qlen != 0) {
1651-
if (cl->cl_flags & HFSC_RSC) {
1637+
if (cl->cl_flags & HFSC_RSC) {
1638+
if (cl->qdisc->q.qlen != 0) {
16521639
/* update ed */
16531640
next_len = qdisc_peek_len(cl->qdisc);
16541641
if (realtime)
16551642
update_ed(cl, next_len);
16561643
else
16571644
update_d(cl, next_len);
1645+
} else {
1646+
/* the class becomes passive */
1647+
eltree_remove(cl);
16581648
}
1659-
} else {
1660-
/* the class becomes passive */
1661-
set_passive(cl);
16621649
}
16631650

16641651
qdisc_bstats_update(sch, skb);

0 commit comments

Comments
 (0)