Skip to content

Commit cb395b2

Browse files
edumazetdavem330
authored andcommitted
net: sched: optimize class dumps
In commit 59cc1f6 ("net: sched: convert qdisc linked list to hashtable") we missed the opportunity to considerably speed up tc_dump_tclass_root() if a qdisc handle is provided by user. Instead of iterating all the qdiscs, use qdisc_match_from_root() to directly get the one we look for. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: Cong Wang <xiyou.wangcong@gmail.com> Cc: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b451e5d commit cb395b2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/sched/sch_api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,12 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb,
18311831
if (!qdisc_dev(root))
18321832
return 0;
18331833

1834+
if (tcm->tcm_parent) {
1835+
q = qdisc_match_from_root(root, TC_H_MAJ(tcm->tcm_parent));
1836+
if (q && tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0)
1837+
return -1;
1838+
return 0;
1839+
}
18341840
hash_for_each(qdisc_dev(root)->qdisc_hash, b, q, hash) {
18351841
if (tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0)
18361842
return -1;

0 commit comments

Comments
 (0)