From patchwork Mon Aug 26 13:06:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tummala, Sivaprasad" X-Patchwork-Id: 143393 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 284CB4586C; Mon, 26 Aug 2024 15:07:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F0D340651; Mon, 26 Aug 2024 15:07:30 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2052.outbound.protection.outlook.com [40.107.94.52]) by mails.dpdk.org (Postfix) with ESMTP id 422194060B for ; Mon, 26 Aug 2024 15:07:28 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PJEmdRWXXR91u9YQpBIKrGHfQW3zd+1LO8tA1yKLD+Rv8uB9cw3b54lYAx6jR6G6HyGoo5EaEk5B9BrcdPO2uLO3W1Tk2c3nnKTy19Fh5JeasQ44IrC+cXKDMuJOG1glTf2c77/68hntgMbwGLb6I2s9E09DMmLfcm9MwJ1hj2eGcakdCXGE37vWonUgERE5kSSeWsFaEkp4ZsjOA7LYHZ6lM5F35fRCT1mlz4kGZqA4sTaF2gZrak5kHH80xEZuRcnQnPrtJ9HLeWdlsXtqQoXhJJywcfOJxm7sZEcZu7kL58zgfTUzGapC/qBWVEVozptQ0iKxvYgVGO8QbEV8dA== 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=l9CAsKWfalPHzN4JTj01lLBSxrkkNvX4zoltm9rUe2Y=; b=SL69ytfjPHONTiiV0OSVv+pNVzGXdIWJI9gKMfAdqQz4ay2A7Ufn7swyrXUJs0nLEjNL/g+uuuXjSmNg0RHOBPwhz12JGpw+8n26TkpxVtszN6NZIvVAhP0bj1zrWU3wzVyWTF2EBAG6gp6XxjRCIx3/wT3sKmlFKgTzLD3xaZgRsDdB7pMULqGlwGY5Zx6ho3gD79xDw6ZWkphoc7+Sbfa+yxCBTlBWSXgNLx2XGVj8fT9+5wBAxnuXv51tpWkO7aFodUJQKgGA2+8KqVMPt6MwJdR4XPjVzkaLpkqBz+xfuKY6EjZTTGsPv/10V9AZKzuBKo9VVnZouJs9exP8Sw== 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=l9CAsKWfalPHzN4JTj01lLBSxrkkNvX4zoltm9rUe2Y=; b=BB7fqPz94+1fyXdZb/uPO0eljJyQBdkbbB5dVt1tWb6S2KtzCuxT95hEEdItrXB9iSPir5C8KgnA+wmaD4K0UxD6sP0lUgC/WFSQ+Lm5RY33JnIoa+uoZYpqsK3qvCcw5Baji/PaXcEPN7og3RcJcGrrF3ayPlGxhgwf7aK3WxY= Received: from BN9PR03CA0448.namprd03.prod.outlook.com (2603:10b6:408:113::33) by SN7PR12MB7276.namprd12.prod.outlook.com (2603:10b6:806:2af::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 13:07:24 +0000 Received: from BL6PEPF0001AB74.namprd02.prod.outlook.com (2603:10b6:408:113:cafe::f5) by BN9PR03CA0448.outlook.office365.com (2603:10b6:408:113::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24 via Frontend Transport; Mon, 26 Aug 2024 13:07:23 +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 BL6PEPF0001AB74.mail.protection.outlook.com (10.167.242.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Mon, 26 Aug 2024 13:07:23 +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; Mon, 26 Aug 2024 08:07:20 -0500 From: Sivaprasad Tummala To: , , , , , , , CC: Subject: [PATCH v2 3/4] test/power: removed function pointer validations Date: Mon, 26 Aug 2024 13:06:48 +0000 Message-ID: <20240826130650.320130-4-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826130650.320130-1-sivaprasad.tummala@amd.com> References: <20240720165030.246294-1-sivaprasad.tummala@amd.com> <20240826130650.320130-1-sivaprasad.tummala@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB74:EE_|SN7PR12MB7276:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b61c990-c073-4aaf-cad4-08dcc5d006e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: Oa5/fxV9Dmx009vr9YnpvuxMGMgt25bKLEdGRQDXmpnEzx4fUlEGu/3fiMnijR14tF3IoItAs9f+F6qcNqWixd8x6GY59nYsDNbOR726KecOH4pzhEQ6JGKV6QN1gquHwB1xgIzwtrwgYl5qPfOMp5kj76nK+RCbdChbXP+ktEyxb5qxJohd6YA1bCbH2UJrMYzsON+0n2kXsYwyzg+wd4ybfdfTTv0pR4vAIT5fsNvoeDdmURKjDkLlDopBQO6FJCq3mi+E0HpV7nHKhvnrtUpqemkDJJZVscRDkamIIg6KddLsKqexm/sCZjUVDkepNEcLd++vwfX+XwJ14WfX+5LnSi/nrqn2tw4Vb9eW1DEGAjPIirXdtumKDTj7v4a6TJLE+8xFJ+xNdwWNWX5ZBscNvTEgDb6AbzQtG0vKIUFHFQ1lN8BvUdoLL856cpuaxNvTkw70IwVcd5PDi8CtahD0gfnVgIUitQKF22dkAMolZed22EvJArCKNcvZacGGniynImT8Zrx5n8mlwas1mMc9yDHwqiPKeqdO+yEKEYvwjwfio8FOEQ7OQVkNC3bcY1Di9YqmvfKfSXK+FBlSOOwOldcmeryiTwTfBzKOmgLRSgn+LbiRszfRPM7SPiYjA5g5n1L15zCv44QorOLRGrONgA9ygYL+6sqW2LXgXn0QpgcpD243Oys54+xtZuAkNt0CXDjmyOISV2LyWFmqxDrOm5ubKHwE6h6DqB03mS5v1O6dYcHlQE+eiE1jTe+UUXpNvTdybPlLApGC/iQ+1vUcY8lkfsjWQIDbJKkbpktFgi8ipgJ+XPNsZz9kn4uyYS2lguo0Q1wjxKE/+ueBmU0LYgYxaXVq9JrhYk9O0xYhRl819/Blaat4lsimdGtmVSX0UcXd1Gh/NgUr9depahiV+yQ6ncoqXBizqaHc90+U0SpAP/ffqZuxZl04j98CeW27omdjsi5DfgUrKV3+kKunpMuTMRcXFtyNVu7fc+4TCU92SNaNJUZeJ1U79hZUeLtQO1JkBldY6YAcZv+m68O5CshQKE5hMJLw0Fmg19xQH7Tye9uDl4DJEFKiVY0JpVt7sDNSUKPzm4BKMpiwvUJbI0ZkqDKL2tUu/WB1o7GWtBi9pQhM1OptsyIDfwURL7tBSpcPlCVq+mtL1vjcknpnJXVw2jXtsNEpn7UA7dbP+jzvQV74NHMVdvsql4AotjhjG3wVbtqkd/ptj8NOui4mlxzbxSf7sqXhPlnSYhfhNkdCa4Lb1QUmE+MgpLUzSPYa1mKGcy1+bVTIl5zqARywbuexV8L3Wq3myxJ9I66vwCqpHFjy+pTAONVnohACR2B5qur4AJxLJBmFKt1pB8sa3M61vTknbwR7CDX2WVGd0grAUgBeczLBmiFBEngw7RHrs3w//JnbtIztRsm6qElegC7qWLSaK1vRZKGmxAHZs+DvkDKNLyvlKavxjqMU 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)(82310400026)(36860700013)(1800799024)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 13:07:23.8251 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b61c990-c073-4aaf-cad4-08dcc5d006e0 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: BL6PEPF0001AB74.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7276 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 619b2811c6..8cb67e662c 100644 --- a/app/test/test_power_cpufreq.c +++ b/app/test/test_power_cpufreq.c @@ -519,58 +519,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 { /**