Description: when going running, the pending count is not incremented. Fix: decremend pending when going running. Then, if periodic, increment, if one shot - do nothing
Signed-off-by: Vadim Suraev <vadim.suraev at gmail.com> --- lib/librte_timer/rte_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c index a3d5cca..f98e904 100755 --- a/lib/librte_timer/rte_timer.c +++ b/lib/librte_timer/rte_timer.c @@ -173,7 +173,7 @@ timer_set_running_state(struct rte_timer *tim) /* timer is not pending anymore */ if (prev_status.state != RTE_TIMER_PENDING) return -1; - + __TIMER_STAT_ADD(pending, -1); /* here, we know that timer is stopped or pending, * mark it atomically as beeing configured */ status.state = RTE_TIMER_RUNNING; @@ -555,7 +555,6 @@ void rte_timer_manage(void) if (tim->period == 0) { /* remove from done list and mark timer as stopped */ - __TIMER_STAT_ADD(pending, -1); status.state = RTE_TIMER_STOP; status.owner = RTE_TIMER_NO_OWNER; rte_wmb(); @@ -564,6 +563,7 @@ void rte_timer_manage(void) else { /* keep it in list and mark timer as pending */ status.state = RTE_TIMER_PENDING; + __TIMER_STAT_ADD(pending, 1); status.owner = (int16_t)lcore_id; rte_wmb(); tim->status.u32 = status.u32; -- 1.7.9.5