diff options
-rw-r--r-- | net/sched/sch_api.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index dca6c1a576f7..3d8981fde301 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -618,20 +618,24 @@ void qdisc_class_hash_remove(struct Qdisc_class_hash *clhash, | |||
618 | } | 618 | } |
619 | EXPORT_SYMBOL(qdisc_class_hash_remove); | 619 | EXPORT_SYMBOL(qdisc_class_hash_remove); |
620 | 620 | ||
621 | /* Allocate an unique handle from space managed by kernel */ | 621 | /* Allocate an unique handle from space managed by kernel |
622 | 622 | * Possible range is [8000-FFFF]:0000 (0x8000 values) | |
623 | */ | ||
623 | static u32 qdisc_alloc_handle(struct net_device *dev) | 624 | static u32 qdisc_alloc_handle(struct net_device *dev) |
624 | { | 625 | { |
625 | int i = 0x10000; | 626 | int i = 0x8000; |
626 | static u32 autohandle = TC_H_MAKE(0x80000000U, 0); | 627 | static u32 autohandle = TC_H_MAKE(0x80000000U, 0); |
627 | 628 | ||
628 | do { | 629 | do { |
629 | autohandle += TC_H_MAKE(0x10000U, 0); | 630 | autohandle += TC_H_MAKE(0x10000U, 0); |
630 | if (autohandle == TC_H_MAKE(TC_H_ROOT, 0)) | 631 | if (autohandle == TC_H_MAKE(TC_H_ROOT, 0)) |
631 | autohandle = TC_H_MAKE(0x80000000U, 0); | 632 | autohandle = TC_H_MAKE(0x80000000U, 0); |
632 | } while (qdisc_lookup(dev, autohandle) && --i > 0); | 633 | if (!qdisc_lookup(dev, autohandle)) |
634 | return autohandle; | ||
635 | cond_resched(); | ||
636 | } while (--i > 0); | ||
633 | 637 | ||
634 | return i > 0 ? autohandle : 0; | 638 | return 0; |
635 | } | 639 | } |
636 | 640 | ||
637 | void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n) | 641 | void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n) |