+ /* traverse slot, place timers wherever they go */
+ while (next_index != head - tw->timers)
+ {
+ t = pool_elt_at_index (tw->timers, next_index);
+ next_index = t->next;
+
+ /* Remove from the overflow vector (hammer) */
+ t->next = t->prev = ~0;
+
+ ASSERT (t->expiration_time >= tw->current_tick);
+
+ interval = t->expiration_time - tw->current_tick;
+
+ /* Right back onto the overflow vector? */
+ if (interval >= (1 << (3 * TW_RING_SHIFT)))
+ {
+ ts = &tw->overflow;
+ timer_addhead (tw->timers, ts->head_index, t - tw->timers);
+ continue;
+ }
+ /* Compute ring offsets */
+ new_glacier_ring_offset = interval >> (2 * TW_RING_SHIFT);
+
+ interval -= (new_glacier_ring_offset << (2 * TW_RING_SHIFT));
+
+ /* Note: the wheels are at (0,0,0), no add-with-carry needed */
+ new_slow_ring_offset = interval >> TW_RING_SHIFT;
+ interval -= (new_slow_ring_offset << TW_RING_SHIFT);
+ new_fast_ring_offset = interval & TW_RING_MASK;
+ t->slow_ring_offset = new_slow_ring_offset;
+ t->fast_ring_offset = new_fast_ring_offset;
+
+ /* Timer expires Right Now */
+ if (PREDICT_FALSE (t->slow_ring_offset == 0 &&
+ t->fast_ring_offset == 0 &&
+ new_glacier_ring_offset == 0))
+ {
+ vec_add1 (callback_vector, t->user_handle);
+#if TW_START_STOP_TRACE_SIZE > 0
+ TW (tw_timer_trace) (tw, 0xfe, t->user_handle,
+ t - tw->timers);
+#endif
+ pool_put (tw->timers, t);
+ }
+ /* Timer moves to the glacier ring */
+ else if (new_glacier_ring_offset)
+ {
+ ts = &tw->w[TW_TIMER_RING_GLACIER][new_glacier_ring_offset];
+ timer_addhead (tw->timers, ts->head_index, t - tw->timers);
+ }
+ /* Timer moves to the slow ring */
+ else if (t->slow_ring_offset)
+ {
+ /* Add to slow ring */
+ ts = &tw->w[TW_TIMER_RING_SLOW][t->slow_ring_offset];
+ timer_addhead (tw->timers, ts->head_index, t - tw->timers);
+ }
+ /* Timer timer moves to the fast ring */
+ else
+ {
+ ts = &tw->w[TW_TIMER_RING_FAST][t->fast_ring_offset];
+ timer_addhead (tw->timers, ts->head_index, t - tw->timers);
+#if TW_FAST_WHEEL_BITMAP
+ tw->fast_slot_bitmap =
+ clib_bitmap_set (tw->fast_slot_bitmap,
+ t->fast_ring_offset, 1);
+#endif
+ }
+ }
+ }
+#endif
+
+#if TW_TIMER_WHEELS > 2