From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id BF8493772 for ; Wed, 13 Mar 2019 20:50:40 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2019 12:50:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,475,1544515200"; d="scan'208";a="213891756" Received: from mhajkowx-mobl.ger.corp.intel.com ([10.104.116.179]) by orsmga001.jf.intel.com with ESMTP; 13 Mar 2019 12:50:27 -0700 From: Hajkowski To: david.hunt@intel.com Cc: dev@dpdk.org, Marcin Hajkowski Date: Wed, 13 Mar 2019 20:48:43 +0100 Message-Id: <20190313194844.11820-4-marcinx.hajkowski@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190313194844.11820-1-marcinx.hajkowski@intel.com> References: <20190313194844.11820-1-marcinx.hajkowski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 14 Mar 2019 15:56:49 +0100 Subject: [dpdk-dev] [PATCH 3/4] power: reset function pointers on unset env X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2019 19:50:41 -0000 From: Marcin Hajkowski Set all power environment related function pointers to NULL when unset is being made. Signed-off-by: Marcin Hajkowski --- lib/librte_power/rte_power.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c index ed701087d..6b7722727 100644 --- a/lib/librte_power/rte_power.c +++ b/lib/librte_power/rte_power.c @@ -27,6 +27,22 @@ rte_power_freq_change_t rte_power_freq_enable_turbo; rte_power_freq_change_t rte_power_freq_disable_turbo; rte_power_get_capabilities_t rte_power_get_capabilities; +static void +reset_power_function_ptrs(void) +{ + rte_power_freqs = NULL; + rte_power_get_freq = NULL; + rte_power_set_freq = NULL; + rte_power_freq_up = NULL; + rte_power_freq_down = NULL; + rte_power_freq_max = NULL; + rte_power_freq_min = NULL; + rte_power_turbo_status = NULL; + rte_power_freq_enable_turbo = NULL; + rte_power_freq_disable_turbo = NULL; + rte_power_get_capabilities = NULL; +} + int rte_power_set_env(enum power_management_env env) { @@ -85,8 +101,10 @@ rte_power_set_env(enum power_management_env env) if (ret == 0) global_default_env = env; - else + else { global_default_env = PM_ENV_NOT_SET; + reset_power_function_ptrs(); + } rte_spinlock_unlock(&global_env_cfg_lock); return ret; @@ -97,6 +115,7 @@ rte_power_unset_env(void) { rte_spinlock_lock(&global_env_cfg_lock); global_default_env = PM_ENV_NOT_SET; + reset_power_function_ptrs(); rte_spinlock_unlock(&global_env_cfg_lock); } -- 2.17.2 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9E73DA0096 for ; Thu, 14 Mar 2019 15:57:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BD7F15587; Thu, 14 Mar 2019 15:56:57 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id BF8493772 for ; Wed, 13 Mar 2019 20:50:40 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2019 12:50:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,475,1544515200"; d="scan'208";a="213891756" Received: from mhajkowx-mobl.ger.corp.intel.com ([10.104.116.179]) by orsmga001.jf.intel.com with ESMTP; 13 Mar 2019 12:50:27 -0700 From: Hajkowski To: david.hunt@intel.com Cc: dev@dpdk.org, Marcin Hajkowski Date: Wed, 13 Mar 2019 20:48:43 +0100 Message-Id: <20190313194844.11820-4-marcinx.hajkowski@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 In-Reply-To: <20190313194844.11820-1-marcinx.hajkowski@intel.com> References: <20190313194844.11820-1-marcinx.hajkowski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Thu, 14 Mar 2019 15:56:49 +0100 Subject: [dpdk-dev] [PATCH 3/4] power: reset function pointers on unset env X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190313194843._DEcZ_b7Z9wCF2RDoeoxFsvX-ABDtnpluNBSK3fEXZQ@z> From: Marcin Hajkowski Set all power environment related function pointers to NULL when unset is being made. Signed-off-by: Marcin Hajkowski --- lib/librte_power/rte_power.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c index ed701087d..6b7722727 100644 --- a/lib/librte_power/rte_power.c +++ b/lib/librte_power/rte_power.c @@ -27,6 +27,22 @@ rte_power_freq_change_t rte_power_freq_enable_turbo; rte_power_freq_change_t rte_power_freq_disable_turbo; rte_power_get_capabilities_t rte_power_get_capabilities; +static void +reset_power_function_ptrs(void) +{ + rte_power_freqs = NULL; + rte_power_get_freq = NULL; + rte_power_set_freq = NULL; + rte_power_freq_up = NULL; + rte_power_freq_down = NULL; + rte_power_freq_max = NULL; + rte_power_freq_min = NULL; + rte_power_turbo_status = NULL; + rte_power_freq_enable_turbo = NULL; + rte_power_freq_disable_turbo = NULL; + rte_power_get_capabilities = NULL; +} + int rte_power_set_env(enum power_management_env env) { @@ -85,8 +101,10 @@ rte_power_set_env(enum power_management_env env) if (ret == 0) global_default_env = env; - else + else { global_default_env = PM_ENV_NOT_SET; + reset_power_function_ptrs(); + } rte_spinlock_unlock(&global_env_cfg_lock); return ret; @@ -97,6 +115,7 @@ rte_power_unset_env(void) { rte_spinlock_lock(&global_env_cfg_lock); global_default_env = PM_ENV_NOT_SET; + reset_power_function_ptrs(); rte_spinlock_unlock(&global_env_cfg_lock); } -- 2.17.2 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.