X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_timer%2Frte_timer.c;h=43da8365462ee43a60cf2b573de7285fd68414c8;hb=6bbfb64b4ea17594110d09941386e182b46930fb;hp=7457d32e2765d4230f3f27adf0802197c343d23a;hpb=d43baa8503741a0df3feb890265084c22e3fd3ba;p=dpdk.git diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c index 7457d32e27..43da836546 100644 --- a/lib/librte_timer/rte_timer.c +++ b/lib/librte_timer/rte_timer.c @@ -69,6 +69,9 @@ struct priv_timer { unsigned prev_lcore; /**< used for lcore round robin */ + /** running timer on this lcore now */ + struct rte_timer *running_tim; + #ifdef RTE_LIBRTE_TIMER_DEBUG /** per-lcore statistics */ struct rte_timer_debug_stats stats; @@ -135,9 +138,12 @@ timer_set_config_state(struct rte_timer *tim, while (success == 0) { prev_status.u32 = tim->status.u32; - /* timer is running on another core, exit */ + /* timer is running on another core + * or ready to run on local core, exit + */ if (prev_status.state == RTE_TIMER_RUNNING && - prev_status.owner != (uint16_t)lcore_id) + (prev_status.owner != (uint16_t)lcore_id || + tim != priv_timer[lcore_id].running_tim)) return -1; /* timer is being configured on another core */ @@ -564,10 +570,9 @@ void rte_timer_manage(void) pprev = &tim->sl_next[0]; } else { /* another core is trying to re-config this one, - * remove it from local expired list and put it - * back on the priv_timer[] skip list */ + * remove it from local expired list + */ *pprev = next_tim; - timer_add(tim, lcore_id, 1); } } @@ -582,6 +587,7 @@ void rte_timer_manage(void) for (tim = run_first_tim; tim != NULL; tim = next_tim) { next_tim = tim->sl_next[0]; priv_timer[lcore_id].updated = 0; + priv_timer[lcore_id].running_tim = tim; /* execute callback function with list unlocked */ tim->f(tim, tim->arg); @@ -612,6 +618,7 @@ void rte_timer_manage(void) rte_spinlock_unlock(&priv_timer[lcore_id].list_lock); } } + priv_timer[lcore_id].running_tim = NULL; } /* dump statistics about timers */