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 EAA63A0542 for ; Mon, 30 May 2022 11:37:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E02A842B88; Mon, 30 May 2022 11:37:18 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2075.outbound.protection.outlook.com [40.107.223.75]) by mails.dpdk.org (Postfix) with ESMTP id DFA2242B75; Mon, 30 May 2022 11:37:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fm5HLGRXD6/Dxb0cguPWJZVyvZSceplHI5qVUqAdNDd4rEK4Ro24Nh6XDks7afbvLOzc5LBLdSYS8fsIyyFJP8L5BbJJIlmT2KfR9XGlbamVpmYmzyM3qwpSAuqvr8CiD8IB+ZQJMUuSx/ErszXQb2E8z2gsuUd3ALDnQLkcJO3LHHANdYT6RnPl/QXT4GV2fSJRyfw+/EIdlWJhm6kA2JWOnB247EOtRZDn0BYyfGOdDuXCfPYEacV0zmmKWjRdRSPtau4hqHkdcu3UJqHIMMzgjHZRKvSCKgkeAdnt8Z729FRzZI5+z7rSPP8Pqgvd7N0h9s4JlmoV8YDpVzZccA== 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=/QxtA7f2XgZofi9A1r4khYHHeIwO9RRQMW0E54VzAcc=; b=LFMkucir2oS5BLcUlV7n19iQw4EuI8hDGBK9pZfJSVkzQdzCAYeiQwT/4OkJVqhhxaE3FZ2bsC6JJYA7iA2dalIQIztFFokUNyh4qk58pgHL4OQcyIYy2GWusL5nvQg7AX/GlNvXM+lTQa7PE3ui63r01D/0K0yRaLjdUXJ0Y8B3jNHX7hP2MnZNg3ojp9j18Zz1FP13A6l23jui7k4guXphAonGlA6YSbIwBmFgMmOnxQcIuvhRGcZ0egjaVzrvnD5hPTKsBnJNaEMK2WwPeyfmDHPROOGEBVYCsMv64Y9HhTadE+OXFQkl3CEu+M2NkbdSDLIeafK3xf2DwaTc9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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=/QxtA7f2XgZofi9A1r4khYHHeIwO9RRQMW0E54VzAcc=; b=rIihg86BgZe45Cak4l2F1MiLnqbA1dmTRWvM6FFp8R9PVEpg5XmugatRnO22WOMNHL1vvDYxCoYwC5eOAZJiLgmPRMKUbO2lOSXyWzXqtxJcksP/pxC3ns4Ld5VL0bVWLzowUhYPtM3giRcF5sH1w/pGAEj0iwIhBe7GGbLqvdkpZsm3kHcFRVoNKVgfQdJF0XmhJBldKTkbOxNUQ7urOEyEtC3EL1j6Z4x+x7siqngCINEVMmyqJzkipPd465fN+JZm3BNsIxq7e9S5s4OWvKx9+EMLy5OwwsBlbZ0G45B3vRHMKJAwVf00WEc+jf6SNZXvLC8rJRI6+UVWYXx95w== Received: from DM6PR21CA0005.namprd21.prod.outlook.com (2603:10b6:5:174::15) by BN6PR12MB1491.namprd12.prod.outlook.com (2603:10b6:405:5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Mon, 30 May 2022 09:37:13 +0000 Received: from DM6NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:5:174:cafe::67) by DM6PR21CA0005.outlook.office365.com (2603:10b6:5:174::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.6 via Frontend Transport; Mon, 30 May 2022 09:37:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT040.mail.protection.outlook.com (10.13.173.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5293.13 via Frontend Transport; Mon, 30 May 2022 09:37:13 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Mon, 30 May 2022 09:37:12 +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.22; Mon, 30 May 2022 02:37:11 -0700 From: Raja Zidane To: CC: , Subject: [PATCH] examples/link_status_interrupt: fix stats refresh rate Date: Mon, 30 May 2022 12:37:02 +0300 Message-ID: <20220530093702.11745-1-rzidane@nvidia.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2f9a4c46-66a9-45cf-98e1-08da421ffa2e X-MS-TrafficTypeDiagnostic: BN6PR12MB1491:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aFqkwu0aeQf6hpBBjy5JqNC6mVdLA5gUmqi9kYjKJgU8j1dbmJec1d3U6ZXnt4C3PqOvYC5oUTRYGyHsoX0Ny65v28iZXQBFwRowvn7vfnfbOD1NK4g31zYYOt80NVsu9iz76AMW7Et2oxoy7gmk1dxFegpKg7fi5sEfoJ7gbYJWg6GYnfzcqDYZy+xvrIaTXbiVMbiXBvOmx55SZdFKpdVXyIGKL+hJFQ7kgdScK3VxjD6xbXxeneErBYQyoz9HTZCO5B1M/KU73PLCDfcBIUhQ3poTgk4+fo7kpfOJ/Gr5m+Ki834lQQwHt9SJbSd/R0cGOa/8RCqAZWGgCtUOBEj8Amw1XCQC0IN97Wwgyrr6kiw2G1GI+apt6zDyoF6fUDbzIuqpZUScV5uvSYioqVg3NRXdzLJBygK06P511L3nCIm1GP19OYOGwp8UqzTZhs56rXWp4cUFuuobbV/sOlqh45hYz5zA7GfH1PZmnVyJwJTmnCWByaTY8FO5GoAucdqKLxV4TDqzP9e8q37F4aPIPvnOplEB7Qm/oQx3tP3b3dKL5WeRYP3XIL5GBaNF0y6TKHlL3CQI+63onvBv5V2TNuXZ50ypgUYrYPN6BQR6EAA1/mKq7CduoGTSxcTFaNXpd9GcWkrFy2zdLvn0iB9sjCy76Ow83tR+ApTGECNoLHquEUB69JG0k+GKhqrZlcNusetIfJc3ae5gVOPx0Q== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(83380400001)(40460700003)(5660300002)(508600001)(8676002)(7696005)(450100002)(82310400005)(4326008)(36756003)(2616005)(8936002)(70206006)(70586007)(6666004)(356005)(2906002)(36860700001)(316002)(186003)(81166007)(86362001)(16526019)(47076005)(6916009)(26005)(54906003)(6286002)(426003)(1076003)(336012)(55016003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2022 09:37:13.4030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f9a4c46-66a9-45cf-98e1-08da421ffa2e 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.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1491 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 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: Raja Zidane Acked-by: Matan Azrad --- examples/link_status_interrupt/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 551f0524da..eb7a74d37c 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_tsc_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 @@ -371,6 +372,7 @@ lsi_parse_args(int argc, char **argv) }; argvopt = argv; + timer_period = DEFAULT_TIMER_PERIOD; while ((opt = getopt_long(argc, argvopt, "p:q:T:", lgopts, &option_index)) != EOF) { -- 2.21.0