From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9926AA0543 for ; Thu, 7 Jul 2022 16:38:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 936134069D; Thu, 7 Jul 2022 16:38:01 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2068.outbound.protection.outlook.com [40.107.223.68]) by mails.dpdk.org (Postfix) with ESMTP id 2A1C8406B4; Thu, 7 Jul 2022 10:23:10 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CPifXggDE3QSsllwFxl6TF+t72UhA3+KmIg0QJRtp1clvdcVUi8qvMhyS8D2rM3+4ak84wu/mul6jtBG+BHsPxWbX21Y0Sv/ngCpQqUnfZdwISSRI4WtCTWF1zum+5j8oohq42wzuc4f6QIhrOgTv4P+uxeQGe3Wz+8eqriBswozCojGlRpf5FJzodyWAAQGVMBqfz0w4JfFUrUh62WDQiio7KogGWcVpqhnVMfAIzz3KxgnxwZG17UQgaeY4pnBHhQrEnN0/V6j+caHmJpVv9xlJsLtMq+GY3yMwVNsiw3/XT14PWLdvmR0NdXdvRzpZd6Dle47ud3X+/OHOHMrng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fvvM31pev69/U01P0/4hPGVYvlQmpE4zbyN4wvSYPas=; b=bgiIuNV7HjgIm9A6Xwt+4jrzgjlzgy4qNqWFOd/26onM7wUhxFDig9zBSvPQpUE8/ov9/cgSmzQ0b+ky4Vg2GbGrSne9F7aDkTNftpW9LtFSrDRa71VwPQfNR1Yvc7cWkwKDycFejabqkj8Cas6hfhf4DQBtDLYUm+lEjdCi2bV7UOJ+oIUJ7Vzy7Ns2Ams4h0o+2IjDvLwByEBcTrby80cOc7lW8xw6sNY0k/2oWg1V6AECT11mZ/nU0c0YxO44roMHzopcs6Q5KsiGs4pDO+sMrqhYnj23jCIz8gWNfaeeYw3m/htQvT+WFJgVz42+RSLB5FXtSnVDfbqj6c17Eg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fvvM31pev69/U01P0/4hPGVYvlQmpE4zbyN4wvSYPas=; b=NZI1KXEBl0wqo1ZlTsZVR2LR7G3D35r0zFUqWnKGdo/8Pl0DwJPFipz0gYDu0z825wJOQ24DWBrvQxVqt/HOtnwAYXZ9Bi1kuGqg+Mz35P/xDa3nm4XrBIhBd7wBw4J8HN5Cmf4HzJqaonhXocUAIxfC2IvBOnvAH2jCRNraKluU2nv22VIPCIDcYZ38AukdTrYX9xeYQMtqKbfXDABhakgr/lB+XU2rJiVmQuA8do2h9iMcF5jRlSdGOgT1+JlvT6E0Cb5QAhP7n6WYs/yoyNeHIbiiLPRKlLEv//w8TNljPRHHy0BNbYvKRi63SvGyiA0DQ9yUS88MDzGxBkjBHw== Received: from BN0PR03CA0036.namprd03.prod.outlook.com (2603:10b6:408:e7::11) by MN2PR12MB3549.namprd12.prod.outlook.com (2603:10b6:208:107::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.16; Thu, 7 Jul 2022 08:23:08 +0000 Received: from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e7:cafe::3) by BN0PR03CA0036.outlook.office365.com (2603:10b6:408:e7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15 via Frontend Transport; Thu, 7 Jul 2022 08:23:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5417.15 via Frontend Transport; Thu, 7 Jul 2022 08:23:08 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 7 Jul 2022 08:23:01 +0000 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Thu, 7 Jul 2022 01:22:58 -0700 From: Omar Awaysa To: CC: , , Raja Zidane , Subject: [PATCH v2] examples/link_status_interrupt: fix stats refresh rate Date: Thu, 7 Jul 2022 08:22:34 +0000 Message-ID: <20220707082234.2787-1-omara@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220530093702.11745-1-rzidane@nvidia.com> References: <20220530093702.11745-1-rzidane@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bd94c6ec-e0e8-4eb5-3d8e-08da5ff1ec4d X-MS-TrafficTypeDiagnostic: MN2PR12MB3549:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oZmqj+6xA0MCGu+mJV/GshgUkhsEX/WG+0rjmC97YEZ44r6nVdXW0Iw2tJL+5y4RYmngppsQrf9l8rK5bXgfPdM3a1rgcNOXG9Xuzj2pS/vVlO3nQEGV4sC/Ydta/cWt1HfFWRPZ4yMOuFCULLovse9vKzk5hzaYlOwGj6STEO1X7674Fr0TTSmdMcqR2RcDTCgrlGxe1hxzrg3GALN25kDJFTHxPyAgwUA3I1gO8oYhyMEzU26YHJAWBf9g0uSg+X51L5nq2k5apTnYdkIzKvD9UtBznc+ppVYoEMtnen4ZweQ26xjB44phPDZJE5lo9e2jNQAHkYAuyM7cWIKdccTM5oBdOutqby2o6JIoMInfsCNeUks9sFuiaOpjeg/PkdFy7mdwghZyklfjF5HQw5RVwRHLFLB4K8yVe/HbN4l/ycMf/oRlNRVTM5jfGB9qz7BUeglFKJzrMAY+5kDmI7R8Xt3+t66y7Sv8fSxC+ByvWFjcvIrbJk4AiegKz/eymH7CK8wcGK3+JYMrcBWlyj78ZsWzno0V8rpEg5md944t7YW3YtVZhJOcIuUMFGDWa3fT/FpHfaNJ53mxbr+gQ5820QDa9Ta0W9k/7hJMQA+ix3lRCmyPSwONzk7helo+ALTgP0PqgX/w5HzBYn5MkWfmH8pIfDfjwQcYFv6ng7rg50ZUc96u/qDYT/WecLeAZcVQcScZxDsexGkm8sq1mBky9IM7pFXjuiGpovrU2rW/ZnEtsrrF5cRgrak2shuUw5mX/aQOGVRzs9h7SJEBVNlrXArJjqcOdS4Qqw8BkyhKwrVXcMQpHSlAoJpA379ojs+R99hjhDt71YVT7ob84jhLoHLJdFz0iPWv0wsL5NI= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(136003)(39860400002)(346002)(396003)(376002)(40470700004)(36840700001)(46966006)(26005)(6286002)(8936002)(2616005)(4326008)(40460700003)(70586007)(8676002)(478600001)(186003)(86362001)(6916009)(6666004)(54906003)(316002)(5660300002)(70206006)(7696005)(55016003)(16526019)(40480700001)(2906002)(336012)(356005)(47076005)(41300700001)(82740400003)(83380400001)(81166007)(1076003)(36756003)(426003)(82310400005)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2022 08:23:08.0713 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd94c6ec-e0e8-4eb5-3d8e-08da5ff1ec4d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3549 X-Mailman-Approved-At: Thu, 07 Jul 2022 16:38:01 +0200 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Raja Zidane TIMER_MILLISECOND is defined as the number of cpu cycles per millisecond, current definition is correct for cores with frequency of 2GHZ, for cores with different frequency, it caused different periods between refresh, (i.e. the definition is about 14ms on ARM cores). Use dpdk API to get CPU frequency, to define TIMER_MILLISECOND. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Omar Awaysa --- v2: use rte_get_timer_hz instead of rte_get_tsc_hz update initial timer value to be in seconds --- --- examples/link_status_interrupt/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 551f0524da..79dd7461fd 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -101,9 +101,10 @@ struct lsi_port_statistics { struct lsi_port_statistics port_statistics[RTE_MAX_ETHPORTS]; /* A tsc-based timer responsible for triggering statistics printout */ -#define TIMER_MILLISECOND 2000000ULL /* around 1ms at 2 Ghz */ +#define TIMER_MILLISECOND (rte_get_timer_hz() / 1000) #define MAX_TIMER_PERIOD 86400 /* 1 day max */ -static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000; /* default period is 10 seconds */ +#define DEFAULT_TIMER_PERIOD 10UL /* default period is 10 seconds */ +static int64_t timer_period; /* Print out statistics on packets dropped */ static void @@ -370,6 +371,8 @@ lsi_parse_args(int argc, char **argv) {NULL, 0, 0, 0} }; + timer_period = DEFAULT_TIMER_PERIOD * TIMER_MILLISECOND * 1000; + argvopt = argv; while ((opt = getopt_long(argc, argvopt, "p:q:T:", -- 2.17.1