From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f176.google.com (mail-we0-f176.google.com [74.125.82.176]) by dpdk.org (Postfix) with ESMTP id 45AD6B0A3 for ; Fri, 16 May 2014 00:18:14 +0200 (CEST) Received: by mail-we0-f176.google.com with SMTP id q59so1709657wes.7 for ; Thu, 15 May 2014 15:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=5zR3EljiXESuO54JrI+Hfe04aqy+JO6gqgcfIkxqEuM=; b=HK/rF/0p88aNXDRA0je2HTzwC/gjmWxrV+vzfGghOpmL3jCxROYxTg472FT7azphBH iBu3GmXGcJVb25JyQaNeFvlT2S5GS2gxTZ/PhwitR60eCUAFxvKeXrH4KIZBrmo8BNa1 /BaPio8sJSBKzOyEDOyjHKtkUY8KTE0k+oIfI7m4YoL4HWIdT0ximewi0xsT6ZdjTKWe C6pXlmcL/M1eIsNr9nn1DsPcZstJhCr+VcuFL82wFE+0khxAD100EphFREiJXWps1t/E m7wxGSb4jy14XvvsDOjp1FDc2xvKVN/iCw6XISq2MkWipeRy2fWZkbBeDXyW3szn5PWC rffg== X-Received: by 10.180.76.179 with SMTP id l19mr10677177wiw.43.1400192302230; Thu, 15 May 2014 15:18:22 -0700 (PDT) Received: from ubuntu.ubuntu-domain (bzq-79-181-48-4.red.bezeqint.net. [79.181.48.4]) by mx.google.com with ESMTPSA id fu10sm35871317wib.11.2014.05.15.15.18.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 May 2014 15:18:21 -0700 (PDT) From: Vadim Suraev To: dev@dpdk.org Date: Fri, 16 May 2014 13:15:53 +0300 Message-Id: <1400235354-14810-2-git-send-email-vadim.suraev@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400235354-14810-1-git-send-email-vadim.suraev@gmail.com> References: <1400235354-14810-1-git-send-email-vadim.suraev@gmail.com> Subject: [dpdk-dev] [PATCH 1/2] timer bug fix X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 May 2014 22:18:14 -0000 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 --- 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