From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by dpdk.org (Postfix) with ESMTP id 66C0EC466 for ; Mon, 27 Jul 2015 01:41:42 +0200 (CEST) Received: by wibud3 with SMTP id ud3so93688250wib.0 for ; Sun, 26 Jul 2015 16:41:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=AZxDtGLFPAzNOUMVSLx5jId2skuQAyoR1izq1tvkyiM=; b=N5lQRyl+rnx2bYhtTiWQydolwMneAmYK6+6qrkGTExZas7JWxKgOTjlcoqVCVizFG/ jmzmov8CPXrgpdObyRJdHmNa7iSE/wwydXjmNZ2uY9OWMswGNjh7YAXP4hfrKyfqKEEd 4+dpLsXoCf1UVq4zSboFRzz8wlFvepbXx2OnFla1TWHHe22XifxNIZGpizOi9EqIL2vM 3Q5dRMcNNzBch0uoyMp34RV9WcAQhuXLWT3HRmlPPN1Q/P9c3GKxpUtUQYsWdy1hgfqb 3fAtJEDgFVhlqocAgqxHVF3s7UQGIap+vd29Lt8aNwk8htanLb3VzROl4k+wWquX5C5W AElQ== X-Gm-Message-State: ALoCoQmamb/PzHja4YGWJX3+t0mJX7xpI4YcehHygbqS7ObbgkDsT16eBxjPTFPAvM6J7p5ShaQ8 X-Received: by 10.180.21.175 with SMTP id w15mr18960684wie.58.1437954102270; Sun, 26 Jul 2015 16:41:42 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by smtp.gmail.com with ESMTPSA id pf4sm24775478wjb.23.2015.07.26.16.41.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Jul 2015 16:41:41 -0700 (PDT) From: Thomas Monjalon To: Ravi Kerur Date: Mon, 27 Jul 2015 01:40:26 +0200 Message-ID: <18444292.n7c28FrYlF@xps13> Organization: 6WIND User-Agent: KMail/4.14.8 (Linux/4.0.4-2-ARCH; KDE/4.14.8; x86_64; ; ) In-Reply-To: <1437852990-6096-2-git-send-email-rkerur@gmail.com> References: <1437852868-6031-1-git-send-email-rkerur@gmail.com> <1437852990-6096-1-git-send-email-rkerur@gmail.com> <1437852990-6096-2-git-send-email-rkerur@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v9 2/3] Move common functions in eal_timer.c 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: Sun, 26 Jul 2015 23:41:42 -0000 2015-07-25 12:36, Ravi Kerur > static int > set_tsc_freq_from_sysctl(void) > { > size_t sz; > int tmp; > + uint64_t tsc_hz; > > sz = sizeof(tmp); > tmp = 0; > @@ -94,42 +77,23 @@ set_tsc_freq_from_sysctl(void) > else if (tmp != 1) > RTE_LOG(WARNING, EAL, "TSC is not invariant\n"); > > - sz = sizeof(eal_tsc_resolution_hz); > - if (sysctlbyname("machdep.tsc_freq", &eal_tsc_resolution_hz, &sz, NULL, 0)) { > + sz = sizeof(tsc_hz); > + if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) { > RTE_LOG(WARNING, EAL, "%s\n", strerror(errno)); > return -1; > } > + rte_set_tsc_hz(tsc_hz); > > return 0; > } [...] > --- /dev/null > +++ b/lib/librte_eal/common/eal_common_timer.c > +void > +rte_set_tsc_hz(uint64_t tsc_hz) > +{ > + eal_tsc_resolution_hz = tsc_hz; > +} [...] > +void > +set_tsc_freq(void) > +{ > + if (set_tsc_freq_from_clock() < 0) > + set_tsc_freq_fallback(); It would be simpler to get value from return of these functions and store it in eal_tsc_resolution_hz here.