From patchwork Tue Jul 8 14:42:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 33227 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f198.google.com (mail-ig0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AAC8E20969 for ; Tue, 8 Jul 2014 14:42:31 +0000 (UTC) Received: by mail-ig0-f198.google.com with SMTP id h3sf2553113igd.5 for ; Tue, 08 Jul 2014 07:42:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=x5tAe8eEm2SnQbHzgra8cR+sYHdPGSZvtSHGJhoumNo=; b=jQhFRZ9rWyu0yYXCfke210pqwQH3E01RtwcFbhTW0czqRjsN0/Ht2+yyNBXp9vAnmL mI7PD4ylVOLOKOKRM4DeRk0D5ntog6Kl3wBCQjo0bFBBjKY+Betr/MWAHI9SB9Hm4pCl /0ZUZRhd+/JqV3dR+OUZ747xShnO0wULNoZ+DFGTkxH/IsEghGoWPEfEfQssl6i3LSMW e3/UwzIoRJbVFTBZF4lyN3JCiSE0EJr6Ho5TOKHfZ4UWU+pxjx/lImG6ZjXZjRZ76Bwi 8Rg9n6FPlQQoSx3iyItOujla2dYz1/BEd3M23ogUgo9lSc1Ko1GCZuWRgMokNMmj5WeS 2AHg== X-Gm-Message-State: ALoCoQnIv8K1Mem5PvT5Yx2QSiyeAhjY8+hCh324OjD4zOucsfNYz89hSmNiDXjoG/vDsvQD8XIO X-Received: by 10.182.213.135 with SMTP id ns7mr15998671obc.46.1404830551198; Tue, 08 Jul 2014 07:42:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.23 with SMTP id t23ls2261260qge.32.gmail; Tue, 08 Jul 2014 07:42:31 -0700 (PDT) X-Received: by 10.52.232.200 with SMTP id tq8mr7421815vdc.32.1404830551107; Tue, 08 Jul 2014 07:42:31 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id vk6si13632680vec.45.2014.07.08.07.42.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Jul 2014 07:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.173 as permitted sender) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id db11so5738715veb.18 for ; Tue, 08 Jul 2014 07:42:31 -0700 (PDT) X-Received: by 10.220.44.141 with SMTP id a13mr527076vcf.71.1404830550985; Tue, 08 Jul 2014 07:42:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp776331vcb; Tue, 8 Jul 2014 07:42:30 -0700 (PDT) X-Received: by 10.140.37.232 with SMTP id r95mr54432189qgr.59.1404830550028; Tue, 08 Jul 2014 07:42:30 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id o36si47207755qgo.11.2014.07.08.07.42.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 08 Jul 2014 07:42:30 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X4WZ4-0002R0-Hq; Tue, 08 Jul 2014 14:40:14 +0000 Received: from mail-lb0-f172.google.com ([209.85.217.172]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X4WYz-0002QF-1X for lng-odp@lists.linaro.org; Tue, 08 Jul 2014 14:40:09 +0000 Received: by mail-lb0-f172.google.com with SMTP id c11so4052115lbj.17 for ; Tue, 08 Jul 2014 07:42:17 -0700 (PDT) X-Received: by 10.152.203.233 with SMTP id kt9mr1654193lac.84.1404830537174; Tue, 08 Jul 2014 07:42:17 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-29-79.pppoe.mtu-net.ru. [91.76.29.79]) by mx.google.com with ESMTPSA id jf2sm56681377lbc.34.2014.07.08.07.42.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Jul 2014 07:42:16 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Tue, 8 Jul 2014 18:42:09 +0400 Message-Id: <1404830529-31373-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 X-Topics: timers patch Subject: [lng-odp] [ODP/PATCH] implement odp_timer_disarm_all() X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Implement function to disarm all timers. Needed in case of normal exit from application. Signed-off-by: Maxim Uvarov --- One more call to apply this patch. This is needed for clean exit from applications like tcpdump, snort odp accelerated. This can be replaced with new implementation when it will be done. Best regards, Maxim. platform/linux-generic/include/odp_internal.h | 1 + platform/linux-generic/source/odp_timer.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index fb3be79..9b0769e 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -38,6 +38,7 @@ int odp_schedule_init_global(void); int odp_schedule_init_local(void); int odp_timer_init_global(void); +int odp_timer_disarm_all(void); #ifdef __cplusplus } diff --git a/platform/linux-generic/source/odp_timer.c b/platform/linux-generic/source/odp_timer.c index 6fb5025..98ffde3 100644 --- a/platform/linux-generic/source/odp_timer.c +++ b/platform/linux-generic/source/odp_timer.c @@ -217,6 +217,30 @@ int odp_timer_init_global(void) return 0; } +int odp_timer_disarm_all(void) +{ + int timers; + struct itimerspec ispec; + + timers = odp_atomic_load_int(&odp_timer.num_timers); + + ispec.it_interval.tv_sec = 0; + ispec.it_interval.tv_nsec = 0; + ispec.it_value.tv_sec = 0; + ispec.it_value.tv_nsec = 0; + + for (; timers >= 0; timers--) { + if (timer_settime(odp_timer.timer[timers].timerid, + 0, &ispec, NULL)) { + ODP_DBG("Timer reset failed\n"); + return -1; + } + odp_atomic_fetch_sub_int(&odp_timer.num_timers, 1); + } + + return 0; +} + odp_timer_t odp_timer_create(const char *name, odp_buffer_pool_t pool, uint64_t resolution, uint64_t min_tmo, uint64_t max_tmo)