diff options
Diffstat (limited to 'src/vnet/util/throttle.c')
-rw-r--r-- | src/vnet/util/throttle.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/vnet/util/throttle.c b/src/vnet/util/throttle.c index 0985b4a81a3..8b8e030bf53 100644 --- a/src/vnet/util/throttle.c +++ b/src/vnet/util/throttle.c @@ -16,17 +16,18 @@ #include <vnet/util/throttle.h> void -throttle_init (throttle_t * t, u32 n_threads, f64 time) +throttle_init (throttle_t *t, u32 n_threads, u32 buckets, f64 time) { u32 i; t->time = time; + t->buckets = 1 << max_log2 (buckets); vec_validate (t->bitmaps, n_threads); vec_validate (t->seeds, n_threads); vec_validate (t->last_seed_change_time, n_threads); for (i = 0; i < n_threads; i++) - vec_validate (t->bitmaps[i], (THROTTLE_BITS / BITS (uword)) - 1); + clib_bitmap_alloc (t->bitmaps[i], t->buckets); } /* |