From 83cb53f3a2630fc39e6d87372aefe6950df4b144 Mon Sep 17 00:00:00 2001 From: Vadim Suraev Date: Wed, 21 May 2014 22:53:45 +0300 Subject: [PATCH] timer: fix reloading after changes Bug: when a periodic timer's callback is running, if another timer is manipulated, the periodic timer is not reloaded. Solution: set the update flag only if the modified timer is in RUNNING state Signed-off-by: Vadim Suraev Acked-by: Olivier Matz --- lib/librte_timer/rte_timer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c index 884ee0e9c8..d07232b8ef 100755 --- a/lib/librte_timer/rte_timer.c +++ b/lib/librte_timer/rte_timer.c @@ -378,7 +378,9 @@ __rte_timer_reset(struct rte_timer *tim, uint64_t expire, return -1; __TIMER_STAT_ADD(reset, 1); - priv_timer[lcore_id].updated = 1; + if (prev_status.state == RTE_TIMER_RUNNING) { + priv_timer[lcore_id].updated = 1; + } /* remove it from list */ if (prev_status.state == RTE_TIMER_PENDING) { @@ -453,7 +455,9 @@ rte_timer_stop(struct rte_timer *tim) return -1; __TIMER_STAT_ADD(stop, 1); - priv_timer[lcore_id].updated = 1; + if (prev_status.state == RTE_TIMER_RUNNING) { + priv_timer[lcore_id].updated = 1; + } /* remove it from list */ if (prev_status.state == RTE_TIMER_PENDING) {