mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	net: sched: optimize class dumps
In commit 59cc1f61f0 ("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>
			
			
This commit is contained in:
		
							parent
							
								
									b451e5d24b
								
							
						
					
					
						commit
						cb395b2010
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1831,6 +1831,12 @@ static int tc_dump_tclass_root(struct Qdisc *root, struct sk_buff *skb,
 | 
			
		|||
	if (!qdisc_dev(root))
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (tcm->tcm_parent) {
 | 
			
		||||
		q = qdisc_match_from_root(root, TC_H_MAJ(tcm->tcm_parent));
 | 
			
		||||
		if (q && tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0)
 | 
			
		||||
			return -1;
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	hash_for_each(qdisc_dev(root)->qdisc_hash, b, q, hash) {
 | 
			
		||||
		if (tc_dump_tclass_qdisc(q, skb, tcm, cb, t_p, s_t) < 0)
 | 
			
		||||
			return -1;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue