From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 4FDCB1B3AD for ; Fri, 13 Oct 2017 02:02:56 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id E692121394; Thu, 12 Oct 2017 20:02:55 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 12 Oct 2017 20:02:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=mo++cREiowsLpZ GOWd3BqEH5dFDK/51LGFKRfiNVwuw=; b=N6wb6DZW0kSaMmBbV5PXjZnQvD9yGu xd0a2rFJopMHmn50Mk9WUPqjd5pIDbOG0x+Kw6sd/8p0ROsVLD5EwO9LuNtd8vbm Tui5oCKh3I4UEBOaBfVBrGRfDvec/rReAhK58nTdbTNwDhuCtxhF2M/1tYO291x6 KJaIDyc9HsMSU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=mo++cREiowsLpZGOWd3BqEH5dFDK/51LGFKRfiNVwuw=; b=UL14txTv UHvMh6xqLgcIBgrpOq11cSrzCaRjFQ6F0wy8lhamRa3VzdxBJ140AyHDHznv1MxZ uxeyzpqSmWFMB6f/mYa6Aj1OjcsmHe8TzfzuImMXv4OvJnrfX7iIWisKjad5IVXn O8prePVQfN6mUjBCmscjLd0llGYehByupb9Njcns3uoHRlbTn3nHYKkcH+cUYnYc hqtcMvbZb1Om+9j12sIZnBsoTFwC8MDeHQC03M4beK5bQTyHMolpYjmEpa2UqO1O t43JrJYafeSg+Uc+2kD+D3rLPjZoc8AnP3cBJ/6QXvgQ3mMp/ghlDu0ndoOcWHiB vJ5hhc0fCfcP8A== X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id E37B92489B; Thu, 12 Oct 2017 20:02:54 -0400 (EDT) From: Thomas Monjalon To: gowrishankar.m@linux.vnet.ibm.com, jerin.jacob@caviumnetworks.com, jianbo.liu@linaro.org, sergio.gonzalez.monroy@intel.com, bruce.richardson@intel.com Cc: dev@dpdk.org Date: Fri, 13 Oct 2017 02:02:46 +0200 Message-Id: <20171013000247.4158-4-thomas@monjalon.net> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171013000247.4158-1-thomas@monjalon.net> References: <20171013000247.4158-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH 3/4] eal/ppc64: implement arch-specific TSC freq query X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2017 00:02:56 -0000 From: Jerin Jacob In ppc_64, rte_rdtsc() returns timebase register value which increments at independent timebase frequency and hence not related to lcore cpu frequency to derive TSC hz. Hence, we stick with master lcore frequency. Signed-off-by: Jerin Jacob Signed-off-by: Gowrishankar Muthukrishnan --- lib/librte_eal/common/arch/ppc_64/rte_cycles.c | 47 +++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cycles.c b/lib/librte_eal/common/arch/ppc_64/rte_cycles.c index 851fd0255..69a9f7475 100644 --- a/lib/librte_eal/common/arch/ppc_64/rte_cycles.c +++ b/lib/librte_eal/common/arch/ppc_64/rte_cycles.c @@ -1,7 +1,52 @@ +/* + * BSD LICENSE + * + * Copyright (C) IBM Corporation 2014. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of IBM Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "eal_filesystem.h" #include "eal_private.h" +static const char sys_cpu_dir[] = "/sys/devices/system/cpu"; + uint64_t get_tsc_freq_arch(void) { - return 0; + unsigned long cpu_hz; + char path[PATH_MAX]; + + snprintf(path, sizeof(path), "%s/cpu%d/cpufreq/cpuinfo_cur_freq", + sys_cpu_dir, rte_get_master_lcore()); + if (eal_parse_sysfs_value(path, &cpu_hz) < 0) + RTE_LOG(WARNING, EAL, "Unable to parse %s\n", path); + + return cpu_hz*1000; } -- 2.14.1