X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Ftw_timer_template.c;h=9ad74624521a0e59e26d340c8a38329aa9b5c08e;hb=dc20371f83ed81462c0b24eb750b76f7819df64a;hp=9c9bb977d5e48ec37d59e40f5d43ad53eaea45cb;hpb=40f92469c6c1b7145ad752475350f71d752d8033;p=vpp.git diff --git a/src/vppinfra/tw_timer_template.c b/src/vppinfra/tw_timer_template.c index 9c9bb977d5e..9ad74624521 100644 --- a/src/vppinfra/tw_timer_template.c +++ b/src/vppinfra/tw_timer_template.c @@ -301,7 +301,7 @@ TW (tw_timer_start) (TWT (tw_timer_wheel) * tw, u32 user_id, u32 timer_id, ASSERT (interval); pool_get (tw->timers, t); - memset (t, 0xff, sizeof (*t)); + clib_memset (t, 0xff, sizeof (*t)); t->user_handle = TW (make_internal_timer_handle) (user_id, timer_id); @@ -411,7 +411,7 @@ TW (tw_timer_wheel_init) (TWT (tw_timer_wheel) * tw, int ring, slot; tw_timer_wheel_slot_t *ts; TWT (tw_timer) * t; - memset (tw, 0, sizeof (*tw)); + clib_memset (tw, 0, sizeof (*tw)); tw->expired_timer_callback = expired_timer_callback; tw->max_expirations = max_expirations; if (timer_interval_in_seconds == 0.0) @@ -432,7 +432,7 @@ TW (tw_timer_wheel_init) (TWT (tw_timer_wheel) * tw, { ts = &tw->w[ring][slot]; pool_get (tw->timers, t); - memset (t, 0xff, sizeof (*t)); + clib_memset (t, 0xff, sizeof (*t)); t->next = t->prev = t - tw->timers; ts->head_index = t - tw->timers; } @@ -441,7 +441,7 @@ TW (tw_timer_wheel_init) (TWT (tw_timer_wheel) * tw, #if TW_OVERFLOW_VECTOR > 0 ts = &tw->overflow; pool_get (tw->timers, t); - memset (t, 0xff, sizeof (*t)); + clib_memset (t, 0xff, sizeof (*t)); t->next = t->prev = t - tw->timers; ts->head_index = t - tw->timers; #endif @@ -490,7 +490,7 @@ void TW (tw_timer_wheel_free) (TWT (tw_timer_wheel) * tw) pool_put (tw->timers, head); #endif - memset (tw, 0, sizeof (*tw)); + clib_memset (tw, 0, sizeof (*tw)); } /** @@ -827,6 +827,18 @@ u32 TW (tw_timer_first_expires_in_ticks) (TWT (tw_timer_wheel) * tw) u32 first_expiring_index, fast_ring_index; i32 delta; +#if TW_TIMER_WHEELS > 1 + fast_ring_index = tw->current_index[TW_TIMER_RING_FAST]; + if (fast_ring_index == TW_SLOTS_PER_RING) + return 1; + + first_expiring_index = clib_bitmap_next_set (tw->fast_slot_bitmap, + fast_ring_index); + if (first_expiring_index == ~0) + first_expiring_index = TW_SLOTS_PER_RING; + +#else + if (clib_bitmap_is_zero (tw->fast_slot_bitmap)) return TW_SLOTS_PER_RING; @@ -838,6 +850,7 @@ u32 TW (tw_timer_first_expires_in_ticks) (TWT (tw_timer_wheel) * tw) fast_ring_index); if (first_expiring_index == ~0 && fast_ring_index != 0) first_expiring_index = clib_bitmap_first_set (tw->fast_slot_bitmap); +#endif ASSERT (first_expiring_index != ~0);