From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by dpdk.org (Postfix) with ESMTP id DD490B0A9 for ; Wed, 14 May 2014 22:03:36 +0200 (CEST) Received: by mail-we0-f171.google.com with SMTP id w62so57873wes.30 for ; Wed, 14 May 2014 13:03:44 -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=ezOxYaFgPeQN/Nu+gbFL9lvTZZg/11mhZBnCDlvz6aA=; b=r75/raJUQD0tYJvG51rR3QQAUKD8+zx1nrIZFGoNo+5CV+TQOl9Tg0mBHZSwuCBQKv QjqCn/RARPuPkPOtvm91KMBXba0nDbcJnrBoliclSIIsvOtjgDoHs1VuNaeRLTP1QyF1 1Qc70CtP+UHb5ZfHtyq+UVynvo4hTIT+i4NAPLqPApu0TiR97Otu7j22n2FGKAImJ9PK Bi5Gs0604DuII1b9v855rPXqnSTme4u/A8jl2AUAen1oKZ8kTdgQSxtkKotxQK7cc6pg OSwmiidValSPg/Yu+yxn+sk1VtLOO0Bk0yvxffpgDfF4J/0XLgG2fcMwP6D6yTeWHfLt 9hXQ== X-Received: by 10.194.122.6 with SMTP id lo6mr4785644wjb.38.1400097824652; Wed, 14 May 2014 13:03:44 -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 em5sm5736929wic.23.2014.05.14.13.03.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 May 2014 13:03:44 -0700 (PDT) From: Vadim Suraev To: dev@dpdk.org Message-Id: <1401739380-21975-3-git-send-email-vadim.suraev@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1401739380-21975-1-git-send-email-vadim.suraev@gmail.com> References: <1401739380-21975-1-git-send-email-vadim.suraev@gmail.com> Subject: [dpdk-dev] [PATCH 2/2] Bug fixed: when timer's callback (for periodic timer) calls timer_reset for another timer, a per-core updated flag is raised which prevents reloading of that periodic timer. The flag is moved to the timer's control block structure 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: , Date: Wed, 14 May 2014 20:03:37 -0000 X-Original-Date: Mon, 2 Jun 2014 23:03:00 +0300 X-List-Received-Date: Wed, 14 May 2014 20:03:37 -0000 --- lib/librte_timer/rte_timer.c | 14 ++++---------- lib/librte_timer/rte_timer.h | 3 +++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c index f98e904..ea2f22a 100755 --- a/lib/librte_timer/rte_timer.c +++ b/lib/librte_timer/rte_timer.c @@ -58,11 +58,6 @@ LIST_HEAD(rte_timer_list, rte_timer); struct priv_timer { struct rte_timer pending_head; /**< dummy timer instance to head up list */ rte_spinlock_t list_lock; /**< lock to protect list access */ - - /** per-core variable that true if a timer was updated on this - * core since last reset of the variable */ - int updated; - /** track the current depth of the skiplist */ unsigned curr_skiplist_depth; @@ -378,7 +373,7 @@ __rte_timer_reset(struct rte_timer *tim, uint64_t expire, return -1; __TIMER_STAT_ADD(reset, 1); - priv_timer[lcore_id].updated = 1; + tim->updated = 1; /* remove it from list */ if (prev_status.state == RTE_TIMER_PENDING) { @@ -443,7 +438,6 @@ int rte_timer_stop(struct rte_timer *tim) { union rte_timer_status prev_status, status; - unsigned lcore_id = rte_lcore_id(); int ret; /* wait that the timer is in correct status before update, @@ -453,7 +447,7 @@ rte_timer_stop(struct rte_timer *tim) return -1; __TIMER_STAT_ADD(stop, 1); - priv_timer[lcore_id].updated = 1; + tim->updated = 1; /* remove it from list */ if (prev_status.state == RTE_TIMER_PENDING) { @@ -541,7 +535,7 @@ void rte_timer_manage(void) rte_spinlock_unlock(&priv_timer[lcore_id].list_lock); - priv_timer[lcore_id].updated = 0; + tim->updated = 0; /* execute callback function with list unlocked */ tim->f(tim, tim->arg); @@ -550,7 +544,7 @@ void rte_timer_manage(void) /* the timer was stopped or reloaded by the callback * function, we have nothing to do here */ - if (priv_timer[lcore_id].updated == 1) + if (tim->updated == 1) continue; if (tim->period == 0) { diff --git a/lib/librte_timer/rte_timer.h b/lib/librte_timer/rte_timer.h index c5f936b..19f6514 100755 --- a/lib/librte_timer/rte_timer.h +++ b/lib/librte_timer/rte_timer.h @@ -129,6 +129,9 @@ struct rte_timer uint64_t period; /**< Period of timer (0 if not periodic). */ rte_timer_cb_t *f; /**< Callback function. */ void *arg; /**< Argument to callback function. */ + /** if a timer was updated on this + * core since last reset of the variable */ + int updated; }; -- 1.7.9.5