vlib: avoid double process dispatch 88/13888/4
authorFlorin Coras <fcoras@cisco.com>
Wed, 1 Aug 2018 23:25:45 +0000 (16:25 -0700)
committerDamjan Marion <dmarion@me.com>
Fri, 3 Aug 2018 09:12:02 +0000 (09:12 +0000)
Change-Id: I46467b1f149be9dfbd00e3ea6d60681d19acf235
Signed-off-by: Florin Coras <fcoras@cisco.com>
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
src/vlib/node_funcs.h
src/vppinfra/tw_timer_template.c
src/vppinfra/tw_timer_template.h

index 577e013..d848419 100644 (file)
@@ -818,7 +818,15 @@ vlib_process_signal_event_helper (vlib_node_main_t * nm,
     {
       /* Waiting for both event and clock? */
       if (p_flags & VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT)
-       delete_from_wheel = 1;
+       {
+         if (!TW (tw_timer_handle_is_free)
+             ((TWT (tw_timer_wheel) *) nm->timing_wheel,
+              p->stop_timer_handle))
+           delete_from_wheel = 1;
+         else
+           /* timer just popped so process should already be on the list */
+           add_to_pending = 0;
+       }
       else
        /* Waiting only for clock.  Event will be queue and may be
           handled when timer expires. */
index c96c329..9c9bb97 100644 (file)
@@ -376,6 +376,11 @@ void TW (tw_timer_stop) (TWT (tw_timer_wheel) * tw, u32 handle)
   pool_put_index (tw->timers, handle);
 }
 
+int TW (tw_timer_handle_is_free) (TWT (tw_timer_wheel) * tw, u32 handle)
+{
+  return pool_is_free_index (tw->timers, handle);
+}
+
 /**
  * @brief Update a tw timer
  * @param tw_timer_wheel_t * tw timer wheel object pointer
index b5cdac0..e581f07 100644 (file)
@@ -238,6 +238,7 @@ u32 TW (tw_timer_start) (TWT (tw_timer_wheel) * tw,
                         u32 pool_index, u32 timer_id, u64 interval);
 
 void TW (tw_timer_stop) (TWT (tw_timer_wheel) * tw, u32 handle);
+int TW (tw_timer_handle_is_free) (TWT (tw_timer_wheel) * tw, u32 handle);
 void TW (tw_timer_update) (TWT (tw_timer_wheel) * tw, u32 handle,
                           u64 interval);