Skip to content

Commit

Permalink
net_sched: gred: eliminate redundant DP prio comparisons
Browse files Browse the repository at this point in the history
Each pair of DPs only needs to be compared once when searching for
a non-unique prio value.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Ward authored and David S. Miller committed Sep 13, 2012
1 parent e29fe83 commit c22e464
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/sched/sch_gred.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ static inline int gred_wred_mode_check(struct Qdisc *sch)
if (q == NULL)
continue;

for (n = 0; n < table->DPs; n++)
if (table->tab[n] && table->tab[n] != q &&
table->tab[n]->prio == q->prio)
for (n = i + 1; n < table->DPs; n++)
if (table->tab[n] && table->tab[n]->prio == q->prio)
return 1;
}

Expand Down

0 comments on commit c22e464

Please sign in to comment.