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 22A6345A6D; Sun, 20 Oct 2024 11:23:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 841D4402EB; Sun, 20 Oct 2024 11:23:16 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2082.outbound.protection.outlook.com [40.107.94.82]) by mails.dpdk.org (Postfix) with ESMTP id 7537540285 for ; Sun, 20 Oct 2024 11:23:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eYF2+BPQXE12iiBOIGNUNOOcgr8goIpSheg2lFfo1g2qdHLPLu/PSHwY8LE2h0Q900E9FmhbWu75hCGMvpYbM0MvHWZMnW1b0CEJyao9Ytu7usQglcQEpd6RcXTYhMKTISIv0nj9/PDKSDPgmjEIvfaGsnw++zDqOfronJ2zLsqCan2zsoMqowRRznoH6GKOofUEiMhou7jo3uhGg4x1pyiNWXwzQmuiCAEB4HI/21eA9pBpWowvPRKxTUzTRM4HVgvt7gR1EDYWofrJOqE7KDcnPrUV4LGq8NLEnjosJ1GTom+mOImhblSCi/HvZl5VeLt5Zn/VtsNO+4YMaY9CgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=A7Uf3Jw2cJ3E7iCkMoYaS7w0bT4qgeYpA3+tXTFvpgs=; b=jDw+jptv7ZLmkny2tk025STsgZJNTnpycVXAXyLap/L2N3AysXKv9ezKcgfMHbDSV+yODUgeYT29X42cL5Py2mxx+NooX+SaoGXjFaM5oy5/xDHKBzgxE8MAFKq0aCZoFp7MXQpD+RBW41YMvZj9Vc/C0DiY2TMi6kCuyBS9iq8uQwZiwWbBu1UWDMYdTVd89G/cjFvlhh/ahuc+YyR+uYVfMP/vSAyJ5a7OXVoCFtbcoFRLKQ/VIFtOnJb5BYZnoiYqdG7RSlhsss+lqaYG0N5QQIjy3459nWsgbN2rn2coKjxx5O4J77we10YiViZ3MJ4vqeCFxeRFZ9oMaI4YKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A7Uf3Jw2cJ3E7iCkMoYaS7w0bT4qgeYpA3+tXTFvpgs=; b=cMaGSt7rS4wRV7J67tytuHlkWf8OFdmVStZz2tAvf8KPsFiLLJhFNmD+6WnM5bffkUkVseZhRXqz2wo8ML1o42MKUHmS2n/PabI9f2OkgmuvV20ukemIv/ZVdL0NwrT1z7I25bAKGEGu8sW2rBP6JZK7YN3JD6Jg1Lj4h9l5Gr4= Received: from CH2PR07CA0039.namprd07.prod.outlook.com (2603:10b6:610:5b::13) by PH8PR12MB6963.namprd12.prod.outlook.com (2603:10b6:510:1be::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.27; Sun, 20 Oct 2024 09:23:00 +0000 Received: from CH1PEPF0000AD7C.namprd04.prod.outlook.com (2603:10b6:610:5b:cafe::a5) by CH2PR07CA0039.outlook.office365.com (2603:10b6:610:5b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28 via Frontend Transport; Sun, 20 Oct 2024 09:22:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH1PEPF0000AD7C.mail.protection.outlook.com (10.167.244.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Sun, 20 Oct 2024 09:22:59 +0000 Received: from jfw9ny3-os.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 20 Oct 2024 04:22:56 -0500 From: Sivaprasad Tummala To: , , , , , , , , CC: Subject: [PATCH v6 3/5] test/power: removed function pointer validations Date: Sun, 20 Oct 2024 09:22:30 +0000 Message-ID: <20241020092233.2906612-4-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241020092233.2906612-1-sivaprasad.tummala@amd.com> References: <20241017102650.1041030-1-sivaprasad.tummala@amd.com> <20241020092233.2906612-1-sivaprasad.tummala@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD7C:EE_|PH8PR12MB6963:EE_ X-MS-Office365-Filtering-Correlation-Id: 96a93697-5c73-4e0a-8884-08dcf0e8ca5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?OKRpQshmMifUGeShayx45yqWOFTlHaU+VpkQMqsjevNJ4kVLdGMbrL/ffxxE?= =?us-ascii?Q?FBDMJ79rxM18kwUgbS37kUVIDSSLxNvR1EmgbY9aHDcqtUriDz3d8zjZunvZ?= =?us-ascii?Q?CDtRnEa6pDFKHcVQdmQJz35R8hNtuIdhyR0QWU8+Hi4ku0cUXeRaJALPJVVF?= =?us-ascii?Q?BLuA7QvP4u9jwvVXWvUUksaDsB5fvpOti/1lnDyR6Iy+CWS1rVURnthBJ4Tj?= =?us-ascii?Q?YObMm5XiliBrgWMFipUd+ZL/+wS4z+83Nl7IcVdA9BnCAUI1t65n5guR0rkV?= =?us-ascii?Q?QUyhLeLzzmpjDW08ZSsEn55Cd4N4rhV8MVxZpBNFYzsFzkdG1c/nP7fjwC1S?= =?us-ascii?Q?sIsDe0t8/a/2hwTHI7KUJpMliAFNITpR6sYjcGLeUnKcfFIrw0nPqt5fVfyn?= =?us-ascii?Q?SFGsm1tak7dA8/VOQUvR5yU9LvHE78mxhOOLpVNlGF2FX8GPFxRM7bbuEb7r?= =?us-ascii?Q?l5tBokVfldJbQANdlX9ykuSd9/Cbwo9i2A012f3Rj1fFezAWiM8/BATCcGrJ?= =?us-ascii?Q?kyYTIcvrulAUYwaf/FWrv22BTS18TMS3fdH0aoKoxDW0F+am4yfn/SHAiR02?= =?us-ascii?Q?c0D5ogsCabVek9hpcS6kbZrJqx8PBtjwyC8lXA0Jt3Vbz9onaOtj/IPaHGJ2?= =?us-ascii?Q?pCfGDcmYxgRx0KFaKu1hc/bVH/vRAcsgRzHkjlr5G8pAIGHV7WW1eb35yFHF?= =?us-ascii?Q?M7sE/H8mll/Rt3q9lllhSJ0epCBfxHF7TNV3O7DaR2SEdL554brKKqBEzHSA?= =?us-ascii?Q?gVBbTlYHz4YLlYlYY0siHzC0ymTJnKT+uoQMT0iqoFVjXQrE/22qRHLbeTSK?= =?us-ascii?Q?50xWFAdV3OWoo6kNJvQgkbdkqAZPSWr4FltXXxjJ/z9s6wz2jIW6i+l4vUau?= =?us-ascii?Q?3BVr4bDfqaNy70jHK9qy7zCDeMaN3grsxUVvUPmKGHWbNLUNcH69b0kTxjsS?= =?us-ascii?Q?GgzLLA4SeQYfmhAFWOPtOH8EVcRmRalZCSIODVWGv5BsnDVoc82fWejy6pME?= =?us-ascii?Q?i5GkgLG5jJHKB/QB4eyDCp54AmkWGsczYCZN8w+aSgvLmvwoPeKWbkq0ofko?= =?us-ascii?Q?5Y47rQ2nNPrz2S3x1z1C4Dqgx2jEQ0X+YRP1HI1r+rR9lYQSwyfh6OuJjEsK?= =?us-ascii?Q?l7yVrqg2vHKbB70qRtIk3+VaniHGVQaBGWyL5LZO7Q7JCF08VIWP5vuZnDCP?= =?us-ascii?Q?9QKWPpmO138+7HBcbhC6R9uuc3lO0OWK/yXG/DEjP/c90G0C0WRyEn9ZLP+x?= =?us-ascii?Q?xsLDyaGRT4tJvlUnEtqPzGBaSNlOCeBEEg9XJBNBvurSSqG8+kdCAMnLcWP3?= =?us-ascii?Q?pcLzammpBbXV96oHqJbWqA7jerUOHYcxMnMh/NUkdv19HsalPzrSGU0MTHDM?= =?us-ascii?Q?PI25ENrmSDmyC8Q0yo5CY83d1ScNPpSbMeT8GGTqHDlMxA8hVg=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2024 09:22:59.6971 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96a93697-5c73-4e0a-8884-08dcf0e8ca5c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD7C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6963 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org After refactoring the power library, power management operations are now consistently supported regardless of the operating environment, making function pointer checks unnecessary and thus removed from applications. v2: - removed function pointer validation in l3fwd-power app. Signed-off-by: Sivaprasad Tummala --- app/test/test_power.c | 95 ----------------------------------- app/test/test_power_cpufreq.c | 52 ------------------- app/test/test_power_kvm_vm.c | 36 ------------- examples/l3fwd-power/main.c | 12 ++--- 4 files changed, 4 insertions(+), 191 deletions(-) diff --git a/app/test/test_power.c b/app/test/test_power.c index 403adc22d6..5df5848c70 100644 --- a/app/test/test_power.c +++ b/app/test/test_power.c @@ -24,86 +24,6 @@ test_power(void) #include -static int -check_function_ptrs(void) -{ - enum power_management_env env = rte_power_get_env(); - - const bool not_null_expected = !(env == PM_ENV_NOT_SET); - - const char *inject_not_string1 = not_null_expected ? " not" : ""; - const char *inject_not_string2 = not_null_expected ? "" : " not"; - - if ((rte_power_freqs == NULL) == not_null_expected) { - printf("rte_power_freqs should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_get_freq == NULL) == not_null_expected) { - printf("rte_power_get_freq should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_set_freq == NULL) == not_null_expected) { - printf("rte_power_set_freq should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_up == NULL) == not_null_expected) { - printf("rte_power_freq_up should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_down == NULL) == not_null_expected) { - printf("rte_power_freq_down should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_max == NULL) == not_null_expected) { - printf("rte_power_freq_max should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_min == NULL) == not_null_expected) { - printf("rte_power_freq_min should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_turbo_status == NULL) == not_null_expected) { - printf("rte_power_turbo_status should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_enable_turbo == NULL) == not_null_expected) { - printf("rte_power_freq_enable_turbo should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_disable_turbo == NULL) == not_null_expected) { - printf("rte_power_freq_disable_turbo should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_get_capabilities == NULL) == not_null_expected) { - printf("rte_power_get_capabilities should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - - return 0; -} - static int test_power(void) { @@ -124,10 +44,6 @@ test_power(void) return -1; } - /* Verify that function pointers are NULL */ - if (check_function_ptrs() < 0) - goto fail_all; - rte_power_unset_env(); /* Perform tests for valid environments.*/ @@ -154,22 +70,11 @@ test_power(void) return -1; } - /* Verify that function pointers are NOT NULL */ - if (check_function_ptrs() < 0) - goto fail_all; - rte_power_unset_env(); - /* Verify that function pointers are NULL */ - if (check_function_ptrs() < 0) - goto fail_all; - } return 0; -fail_all: - rte_power_unset_env(); - return -1; } #endif diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c index edbd34424e..f4522747d5 100644 --- a/app/test/test_power_cpufreq.c +++ b/app/test/test_power_cpufreq.c @@ -534,58 +534,6 @@ test_power_cpufreq(void) goto fail_all; } - /* verify that function pointers are not NULL */ - if (rte_power_freqs == NULL) { - printf("rte_power_freqs should not be NULL, environment has not been " - "initialised\n"); - goto fail_all; - } - if (rte_power_get_freq == NULL) { - printf("rte_power_get_freq should not be NULL, environment has not " - "been initialised\n"); - goto fail_all; - } - if (rte_power_set_freq == NULL) { - printf("rte_power_set_freq should not be NULL, environment has not " - "been initialised\n"); - goto fail_all; - } - if (rte_power_freq_up == NULL) { - printf("rte_power_freq_up should not be NULL, environment has not " - "been initialised\n"); - goto fail_all; - } - if (rte_power_freq_down == NULL) { - printf("rte_power_freq_down should not be NULL, environment has not " - "been initialised\n"); - goto fail_all; - } - if (rte_power_freq_max == NULL) { - printf("rte_power_freq_max should not be NULL, environment has not " - "been initialised\n"); - goto fail_all; - } - if (rte_power_freq_min == NULL) { - printf("rte_power_freq_min should not be NULL, environment has not " - "been initialised\n"); - goto fail_all; - } - if (rte_power_turbo_status == NULL) { - printf("rte_power_turbo_status should not be NULL, environment has not " - "been initialised\n"); - goto fail_all; - } - if (rte_power_freq_enable_turbo == NULL) { - printf("rte_power_freq_enable_turbo should not be NULL, environment has not " - "been initialised\n"); - goto fail_all; - } - if (rte_power_freq_disable_turbo == NULL) { - printf("rte_power_freq_disable_turbo should not be NULL, environment has not " - "been initialised\n"); - goto fail_all; - } - ret = rte_power_exit(TEST_POWER_LCORE_ID); if (ret < 0) { printf("Cannot exit power management for lcore %u\n", diff --git a/app/test/test_power_kvm_vm.c b/app/test/test_power_kvm_vm.c index 464e06002e..a7d104e973 100644 --- a/app/test/test_power_kvm_vm.c +++ b/app/test/test_power_kvm_vm.c @@ -47,42 +47,6 @@ test_power_kvm_vm(void) return -1; } - /* verify that function pointers are not NULL */ - if (rte_power_freqs == NULL) { - printf("rte_power_freqs should not be NULL, environment has not been " - "initialised\n"); - return -1; - } - if (rte_power_get_freq == NULL) { - printf("rte_power_get_freq should not be NULL, environment has not " - "been initialised\n"); - return -1; - } - if (rte_power_set_freq == NULL) { - printf("rte_power_set_freq should not be NULL, environment has not " - "been initialised\n"); - return -1; - } - if (rte_power_freq_up == NULL) { - printf("rte_power_freq_up should not be NULL, environment has not " - "been initialised\n"); - return -1; - } - if (rte_power_freq_down == NULL) { - printf("rte_power_freq_down should not be NULL, environment has not " - "been initialised\n"); - return -1; - } - if (rte_power_freq_max == NULL) { - printf("rte_power_freq_max should not be NULL, environment has not " - "been initialised\n"); - return -1; - } - if (rte_power_freq_min == NULL) { - printf("rte_power_freq_min should not be NULL, environment has not " - "been initialised\n"); - return -1; - } /* Test initialisation of an out of bounds lcore */ ret = rte_power_init(TEST_POWER_VM_LCORE_OUT_OF_BOUNDS); if (ret != -1) { diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 2bb6b092c3..6bd76515e6 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -440,8 +440,7 @@ power_timer_cb(__rte_unused struct rte_timer *tim, * check whether need to scale down frequency a step if it sleep a lot. */ if (sleep_time_ratio >= SCALING_DOWN_TIME_RATIO_THRESHOLD) { - if (rte_power_freq_down) - rte_power_freq_down(lcore_id); + rte_power_freq_down(lcore_id); } else if ( (unsigned)(stats[lcore_id].nb_rx_processed / stats[lcore_id].nb_iteration_looped) < MAX_PKT_BURST) { @@ -449,8 +448,7 @@ power_timer_cb(__rte_unused struct rte_timer *tim, * scale down a step if average packet per iteration less * than expectation. */ - if (rte_power_freq_down) - rte_power_freq_down(lcore_id); + rte_power_freq_down(lcore_id); } /** @@ -1344,11 +1342,9 @@ main_legacy_loop(__rte_unused void *dummy) } if (lcore_scaleup_hint == FREQ_HIGHEST) { - if (rte_power_freq_max) - rte_power_freq_max(lcore_id); + rte_power_freq_max(lcore_id); } else if (lcore_scaleup_hint == FREQ_HIGHER) { - if (rte_power_freq_up) - rte_power_freq_up(lcore_id); + rte_power_freq_up(lcore_id); } } else { /** -- 2.34.1