From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0062.outbound.protection.outlook.com [104.47.36.62]) by dpdk.org (Postfix) with ESMTP id 37B76199AE; Tue, 12 Dec 2017 11:12:04 +0100 (CET) Received: from BN6PR03CA0094.namprd03.prod.outlook.com (10.164.122.160) by DM5PR03MB2699.namprd03.prod.outlook.com (10.168.197.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Tue, 12 Dec 2017 10:12:02 +0000 Received: from BN1AFFO11FD048.protection.gbl (2a01:111:f400:7c10::123) by BN6PR03CA0094.outlook.office365.com (2603:10b6:405:6f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Tue, 12 Dec 2017 10:12:02 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.168.50) smtp.mailfrom=linaro.org; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=fail action=none header.from=linaro.org; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 192.88.168.50 as permitted sender) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD048.mail.protection.outlook.com (10.58.53.63) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.282.5 via Frontend Transport; Tue, 12 Dec 2017 10:11:56 +0000 Received: from netperf2.ap.freescale.net ([10.232.133.164]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vBCABtGu014116; Tue, 12 Dec 2017 03:11:59 -0700 From: Nikhil Agarwal To: CC: , , , Date: Tue, 12 Dec 2017 15:38:24 +0530 Message-ID: <20171212100826.20550-2-nikhil.agarwal@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171212100826.20550-1-nikhil.agarwal@linaro.org> References: <20171212100826.20550-1-nikhil.agarwal@linaro.org> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131575471164063114; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(39860400002)(39380400002)(346002)(376002)(2980300002)(199004)(189003)(97736004)(50466002)(48376002)(498600001)(50226002)(8676002)(4326008)(5660300001)(47776003)(106466001)(36756003)(54906003)(105596002)(53936002)(2351001)(51416003)(77096006)(68736007)(76176011)(6666003)(81156014)(81166006)(104016004)(316002)(8656006)(575784001)(1076002)(86362001)(6916009)(2950100002)(8936002)(16586007)(305945005)(356003)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2699; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD048; 1:zwO2GvVyQldG5TeCsOobRI+Oyn8mQSDxVsYXeo26igOl4oa9LUJ7FupWrQZk7NemFAU8Ft8prUAcdyIHOtUMbb4K1sj/qgBofcvhK94BveeUwpbVs/s+0vt4zYtyAp4M MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 33e65dc2-8c16-4504-7d8a-08d54148c65a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:DM5PR03MB2699; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 3:/AIaeSlBMF8zjxcr0UgV0/HAfBLGsqE0d6BFWCSAB16JZhlOcWfdaf4k/va9xJ08BYju7UZl/VaCdfl7Df7Cr4cXVj1D6wh78cpEZyIZxI/48KWjpo17g770G0LbqJzzdVwQ5f1SjLdWiHPaWx4i50Rlut9t231NDCuio6APHCWDUpvZZzcGpj807vV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W6vRPxIvs7khKK6TzfwlKSXgpaUOnXnKcYjHbHz7vb+Mf96mA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231023)(10201501046)(6055026)(6096035)(20161123556025)(20161123565025)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(20161123561025)(201708071742011); SRVR:DM5PR03MB2699; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM5PR03MB2699; X-Forefront-PRVS: 051900244E X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2699; 23:O3ihyprHRf42dK3a4sTW0Cvr4dJPjtrVAPwooisVa?= =?us-ascii?Q?z7jv4NKQSWZOvu3/73SgaGbrrNuFRXnGzmiBaH7oqMU8WGsCXeXLVevsAP+m?= =?us-ascii?Q?+jC+6XBvJ1I0rRswH8vL1li/G5T2Li/XsajkYHFFmWFTPXZ167iPxGSSkk/s?= =?us-ascii?Q?E5zoc0hxmRrsQ2gar3noCgAQEC62z1788b9YD1y0lqzs7Jffw0BPqtVQf8zC?= =?us-ascii?Q?sCSMlny1weDUQqksKFh9NKjaZ2bBWIx2TqZ06meRn8QdhbTUdhOXrZenvB+F?= =?us-ascii?Q?JBhnpXkuvpfIy+W0tcF8spc0mXVML90WrDKgl82DHSjfDzw18eF9me2QbB+R?= =?us-ascii?Q?XvJ7L/xYY37Pm299e6rsVh/i9U/Oxg9Wik60c85eAR+uH9B4Jaak2hZiutOI?= =?us-ascii?Q?jutSxdNDamoUgKS32uQNoL8PmESIC8OIAQ+1NqUKdx627VCXwwysC3plZWyP?= =?us-ascii?Q?0DHTSDbbegD8avadtkk5175WNm3FRt/6iKekM5bEwQSE21kfEWRPAT97FSXa?= =?us-ascii?Q?/ecLvvAa9QelpU3NDEwJzdAs4j6fDQauM26Y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otI8SQSX3NgwlWQvJlP4V19cARVrX3CYTi2/3ztJixhDLhFyGqdy+c5UpeuS42mtPaw5LH1JjhGDpqFYPOxY+N2y4H5wPHyF2ctvnsD3hScYQrD/qqJcI=; 24:4yEX17i+fIJSNBKw5QUy4lldYLXuNtVLMeKGlpM3qHU0Msfp8mJw4IUtajcnz3m4bP7IHlhHh/eaOTZE4UtJ59xQNYKF1L3No4uZlXDiZdo=; 7:9L5Xm8V4YI0eFSTXKxroZ2VeFHiX9tu29lnIna7zUf51MOnFX4Tjlw2lK+4E0LZ2K/KW4SA0D5urP8j1wsmHViCLjLSgA9wmWE7pz4w5CI7sfmrsmvrTRPSCzyZEtO0zAhlWCIazsb4Wz+XKeW2IDpC31qRqaG2FBIn6oDE/gGJaoZKrrphMGsLhYW+DYQ49nsxuqtBgxcORkMoPhrlM59KaLGSRr5k517eW3MPHy1Z/FcyP/sZLkTEfaG22/1ZC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2017 10:11:56.2347 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33e65dc2-8c16-4504-7d8a-08d54148c65a X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2699 Subject: [dpdk-stable] [PATCH 2/4] examples/l3fwd-power: fix the timer for any platform freq X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Dec 2017 10:12:04 -0000 The code assumes that the platform frequency is 2GHz. This patch add support for dynamically detecting platform frequence. Fixes: d7937e2e3d12 ("power: initial import") Cc: stable@dpdk.org Signed-off-by: Nikhil Agarwal --- examples/l3fwd-power/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index d335b0d..50c3702 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -79,8 +79,6 @@ #define MIN_ZERO_POLL_COUNT 10 -/* around 100ms at 2 Ghz */ -#define TIMER_RESOLUTION_CYCLES 200000000ULL /* 100 ms interval */ #define TIMER_NUMBER_PER_SECOND 10 /* 100000 us */ @@ -875,7 +873,7 @@ main_loop(__attribute__((unused)) void *dummy) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; unsigned lcore_id; - uint64_t prev_tsc, diff_tsc, cur_tsc; + uint64_t prev_tsc, diff_tsc, cur_tsc, tim_res_tsc, hz; uint64_t prev_tsc_power = 0, cur_tsc_power, diff_tsc_power; int i, j, nb_rx; uint8_t queueid; @@ -890,6 +888,8 @@ main_loop(__attribute__((unused)) void *dummy) const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / US_PER_S * BURST_TX_DRAIN_US; prev_tsc = 0; + hz = rte_get_timer_hz(); + tim_res_tsc = hz/TIMER_NUMBER_PER_SECOND; lcore_id = rte_lcore_id(); qconf = &lcore_conf[lcore_id]; @@ -935,7 +935,7 @@ main_loop(__attribute__((unused)) void *dummy) } diff_tsc_power = cur_tsc_power - prev_tsc_power; - if (diff_tsc_power > TIMER_RESOLUTION_CYCLES) { + if (diff_tsc_power > tim_res_tsc) { rte_timer_manage(); prev_tsc_power = cur_tsc_power; } -- 2.7.4