From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 32D03A04F1; Thu, 18 Jun 2020 19:19:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C75EB1C01F; Thu, 18 Jun 2020 19:18:58 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 25E171BFB5 for ; Thu, 18 Jun 2020 19:18:48 +0200 (CEST) IronPort-SDR: 3I3szmVqiIJxnu4jY1YvFcpxlW/pZtdeZRvsYxDEQVeJYdYEBE3F5PWIGQ28QonXFaNEGajuQ9 pZeTWVjG0J7Q== X-IronPort-AV: E=McAfee;i="6000,8403,9656"; a="131064117" X-IronPort-AV: E=Sophos;i="5.75,251,1589266800"; d="scan'208";a="131064117" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jun 2020 10:18:48 -0700 IronPort-SDR: Yv7KBtZTqwCvwAwQI21HQXcdLtuOLPfW8J2zcUz0S+94epjqelgFXVtjQcUCA5S94yLIH/cYAU JNQUmIpCoBnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,251,1589266800"; d="scan'208";a="299768460" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.52]) by fmsmga004.fm.intel.com with ESMTP; 18 Jun 2020 10:18:45 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: David Hunt , reshma.pattan@intel.com, hkalra@marvell.com, jerinjacobk@gmail.com, yinan.wang@intel.com Date: Thu, 18 Jun 2020 18:18:29 +0100 Message-Id: <16cd5ba00d6675037804f671309b245643e173db.1592500565.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 7/7] l3fwd-power: add auto-selection of default mode 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" Currently, the application does support running without the power library being initialized, but it has to be specifically requested. On platforms without support for frequency scaling using the power library, we can just enable interrupt-only mode by default. Signed-off-by: Anatoly Burakov Suggested-by: Jerin Jacob --- examples/l3fwd-power/main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 51acbfd87d..a66599e734 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -2412,6 +2412,20 @@ launch_timer(unsigned int lcore_id) return 0; } +static int +autodetect_mode(void) +{ + /* + * Empty poll and telemetry modes have to be specifically requested to + * be enabled, but we can auto-detect between legacy mode with or + * without interrupts. Both ACPI and pstate can be used. + */ + if (rte_power_check_env_supported(PM_ENV_ACPI_CPUFREQ)) + return APP_MODE_LEGACY; + if (rte_power_check_env_supported(PM_ENV_PSTATE_CPUFREQ)) + return APP_MODE_LEGACY; + return APP_MODE_INTERRUPT; +} int main(int argc, char **argv) @@ -2449,7 +2463,7 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n"); if (app_mode == APP_MODE_DEFAULT) - app_mode = APP_MODE_LEGACY; + app_mode = autodetect_mode(); /* only legacy and empty poll mode rely on power library */ if ((app_mode == APP_MODE_LEGACY || app_mode == APP_MODE_EMPTY_POLL) && -- 2.17.1