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 57EB645AE3; Tue, 8 Oct 2024 19:28:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DFA440DDD; Tue, 8 Oct 2024 19:28:03 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2047.outbound.protection.outlook.com [40.107.101.47]) by mails.dpdk.org (Postfix) with ESMTP id 714B040A72 for ; Tue, 8 Oct 2024 19:28:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qI/VustmhbbKsRZf+T7I9sVs9ugd64Mc4A0CmlFn2v28a4T9XmJWicTwVC+76MKVQklOBV4QBIccpjMLh6kqNczC6Oy6qyr8OeOdR+ZfcizEcfBUEHOIYTgA/wfwFvFnNBIAGZhYEoZ07gdWq47hSNF6fQjxnQvRkK8oY0jdQVL/JpOn2KMn3bg/NqXs63lnFrX+nErW9f9Q9D6bZWXJ9XZfr4+DI/KGKS8i0W634UKze7YhJCEehV0f07yZrcJZpLwfmVk+NJIcGV23MWvcNcLgnrsKImmLldcsw4apC+t5rqAfh8R8FFZao2iqOjk06E76x+OIu1KaT/HBUs7z6Q== 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=KOiPznY2UW/e1vq8hO3eB8J7GdHod5tWZzB+Qz3+Ac3kGv4/hHxu2JcDkaHDNNb1KCKr5lB0P86kWRCcP4bSMgwn5OpFO1qEtVreVtard7VkCWaCMEJpP5YoHKVz6C+ZWH0TdImtpM3+4csI5tFIp6a13sooPgNm0hHhDZ1NsEnKAgwIpR1FjntUnNDsyP9TtqpSIZ+rWaDiCVOmSp6ehU6qWKn8hIKb04B1t8YYXsjBI/4u1U/CGmxec7Xh6FXir3RaheiwpTI9l5K4tkFIKOGYaGBtluOQi9eF7alcqpNXV+UkGlLCcmp54Ukom5JxF45rqQTzWY2YfPZ1loQigQ== 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=WviR2dD/iZM+wOxcB911pwfyOhXN682gG5lD8s2zvhZ2Ueq5/fr8mOOTFgqAhXFZNLB7CtwWluF9j3q5qSjYXvvZs087hdDUxqDkH8H1mw5cwfsfdsiz0c83RQ8dYQqmHKUcM3HnjxVhLcPilvmuRLnINVUqWaJEOhS2+Q0mHew= Received: from SA0PR11CA0019.namprd11.prod.outlook.com (2603:10b6:806:d3::24) by CY8PR12MB8266.namprd12.prod.outlook.com (2603:10b6:930:79::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Tue, 8 Oct 2024 17:27:53 +0000 Received: from SA2PEPF00003AE6.namprd02.prod.outlook.com (2603:10b6:806:d3:cafe::90) by SA0PR11CA0019.outlook.office365.com (2603:10b6:806:d3::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.24 via Frontend Transport; Tue, 8 Oct 2024 17:27:53 +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 SA2PEPF00003AE6.mail.protection.outlook.com (10.167.248.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Tue, 8 Oct 2024 17:27:52 +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; Tue, 8 Oct 2024 12:27:44 -0500 From: Sivaprasad Tummala To: , , , , , , , CC: Subject: [PATCH v3 3/5] test/power: removed function pointer validations Date: Tue, 8 Oct 2024 17:27:16 +0000 Message-ID: <20241008172719.902619-4-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008172719.902619-1-sivaprasad.tummala@amd.com> References: <20240826130650.320130-1-sivaprasad.tummala@amd.com> <20241008172719.902619-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: 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: SA2PEPF00003AE6:EE_|CY8PR12MB8266:EE_ X-MS-Office365-Filtering-Correlation-Id: a1a4abfd-ac9a-471d-bfa0-08dce7be8a47 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?vxWYmrHqnPRHQQ36jJxY6FeLkRQ9LNQroBmU3tSC4Y0L2TG+Kzx6Emc8OOsu?= =?us-ascii?Q?Ux9tS1xKAtaqDDSSiZRM2wLjI8zMh06HRzpLnxYfNtnqRnMsDd+IwTbwv30C?= =?us-ascii?Q?tshkmaW5qwFWGt7QeMhJb/l0GbwwkMHPfUfthTPH3aqfu2q+HALx+zQfmhbh?= =?us-ascii?Q?/+5wEbr7RBWCozHqDypVGjMV3VeEekokR1JVWueNmmNe2vH0JT8TzKknQq/2?= =?us-ascii?Q?EYC9W1+YyoruKxRdMXbbWLTxHg1v/yALSmIG1OCsyjKn5r1JllBgXfaVqwxh?= =?us-ascii?Q?yUpsrgJqRAlpb2kXHHNoznCpe/DfYS1Qr+oCOsDCSkHe9ybViUsIH1HDX9Dw?= =?us-ascii?Q?yzYxngQfKdJA+2Yp5QfgR+W0iqFt8f1QwjldiVGyQap57wnfleRuxLAh00Wr?= =?us-ascii?Q?95Fyr5HGUbGhlhTyGF6gnLJ795eXUuzzWiZdrQG1ZR5eEQXfBIXiUtO3224T?= =?us-ascii?Q?150GVSYtc2C3wldpnLKLenPsC2TWcOdZjRh/3QqxOONaesgXymFNJuHnNN/A?= =?us-ascii?Q?lg+02+j9dwKfkVVQERYPS5ifn9ePOP9CdIxhNxfDv+gDD/T+oG6TdOD1jxFd?= =?us-ascii?Q?15V1sS2xgy7OGl28vB9OKsXjHj9QH89B+KDqhxKIhqG3ttXbeFtMkBC8T6IX?= =?us-ascii?Q?4jhSKZoxcgTn73nbdGJMTTvbPRsBgf4FWiYg4cgbyUAxz4mFrO2Kf7Z0tu1j?= =?us-ascii?Q?7QPl13Ve8z1BZZ5//Xy678tBAvh+M2DxxJBfStAwMV+X5JW0LGfirxAwHYFV?= =?us-ascii?Q?/vx1HUsruk+L1DmpocvjyqVhp87Calcbs3vnZS5s29QOjpFcr6PAU+5TV9Gu?= =?us-ascii?Q?0AsHYu0926DncOcscMYoz+8T9lrX2nY7ekaSLM5W+zLY8N6rBkaWCeKqzByx?= =?us-ascii?Q?zNFZ5hbHTIlEwYSDK0hs+EnB3Zbq3gHgGE74/qAeiVtVmT9xVcjqPD12pRAw?= =?us-ascii?Q?ljNkVNOXzFHW4E582M7+STQK3Ds+4EZ9GzdgWrJNzfGqZyiV1fS+mJUQP6RQ?= =?us-ascii?Q?x28H47fNZ2PjmlQAo0Vj5Gnt7thsfNtwXP1iZh4Ll+iRg2IGIW16qXlM+LIh?= =?us-ascii?Q?FRV1o1RoC1jxgRd4z33s6OgbIVIU7CC4sucQDOrRFNq4CuyvmGWKZAWoF7h6?= =?us-ascii?Q?50m0Cca0Mc/Z5jNma19cODATlt+H0JBxccei02gX/fn8OTxxM9qjzZTdGxCL?= =?us-ascii?Q?IVf7iBFhEj6dawiYgRlLkf3JSe+o9bUnZrMhAYbYA8aTWokijo/vW3AyKKt+?= =?us-ascii?Q?8eLkeqoCQ62N75D/IQhiXWU5RQHCktKT23eAqdKZPE7/gMCTY9Q6abDaGVbL?= =?us-ascii?Q?PwVrEZQkv065hXr1CT984U++nzRQ+BEGnYnNTrKHb2xUuqc8jxEoVBqsKwVL?= =?us-ascii?Q?JOhN8eOWCirImPX1SBgGTEZSL85w?= 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: 08 Oct 2024 17:27:52.8747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1a4abfd-ac9a-471d-bfa0-08dce7be8a47 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: SA2PEPF00003AE6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8266 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 { /** -- 2.34.1